django get display annotate
Models (short):
class Canvas(models.Model):
C_TYPE_CHOICES = (
('L', 'Lack'),
('M', 'Matt'),
('me', 'Met'),
('S', 'Satin'),
('pe', 'Pearl'),
('p', 'Photo'),
)
#in reports c_type_chioces must me the same as here!!
c_type = models.CharField(max_length=30, verbose_name=u'Òèï', choices
= C_TYPE_CHOICES, default = 'L')
c_width = models.DecimalField(max_digits=12, decimal_places=2,
verbose_name=u'Øèðèíà', validators=[MinValueValidator(0)])
class Order(models.Model):
part = models.ForeignKey('warehouse.Part',
verbose_name=u'Êîìïëåêòóþùàÿ', related_name='order_part_a',
blank=True, null=True)
canvas = models.ForeignKey('warehouse.Canvas', verbose_name=u'Òèï
ïîëîòíà', related_name='order_canv_a', blank=True, null=True)
I make an annotate:
sum_parts_c = Order.objects.filter(o_type = '1',
entry_date__range=(start_date, end_date)).values('canvas').annotate(o_sum
= Sum('full_price'), c_sum=Sum('cost'), o_count = Count('id'), a_sum =
Sum('amount'), c_name = Min('canvas__c_type'), c_width=
Min('canvas__c_width') , p_c_name = Min('canvas__prod__name'))
How do I become in 'c_name' the name of type and not code? something like
get_ _display().
Thursday, 3 October 2013
Wednesday, 2 October 2013
Receiving JSON from asmx web service in Android
Receiving JSON from asmx web service in Android
Anyone know of a sample or example of Android calling an .asmx web service
and getting JSON back? Up until now I've been using ksoap2/XML just fine,
but the web service now supposedly has a JSON option but I can't seem to
make it give me JSON. Via several attempts (I'm focusing on
HttpURLConnection mainly), I've been able to get data back but it's not in
JSON (still looks like XML).
I also need to send 2 parameters along with the web service call. Do I add
them as a query string to the URL or do they have to be parameterized as
value pairs? How would I find that out?
Anyone know of a sample or example of Android calling an .asmx web service
and getting JSON back? Up until now I've been using ksoap2/XML just fine,
but the web service now supposedly has a JSON option but I can't seem to
make it give me JSON. Via several attempts (I'm focusing on
HttpURLConnection mainly), I've been able to get data back but it's not in
JSON (still looks like XML).
I also need to send 2 parameters along with the web service call. Do I add
them as a query string to the URL or do they have to be parameterized as
value pairs? How would I find that out?
HTaccess how to redirect multiple URLs?
HTaccess how to redirect multiple URLs?
I want to redirect multiple URLs to the same page.
I could do it this way:
Redirect /index.html http://example.com/newdirectory/
Redirect /index1.html http://example.com/newdirectory/
Redirect /index2.html http://example.com/newdirectory/
Redirect /index3.html http://example.com/newdirectory/
Redirect /index4.html http://example.com/newdirectory/
Redirect /index5.html http://example.com/newdirectory/
Is there not a better method for doing this? (more clean)
I want to redirect multiple URLs to the same page.
I could do it this way:
Redirect /index.html http://example.com/newdirectory/
Redirect /index1.html http://example.com/newdirectory/
Redirect /index2.html http://example.com/newdirectory/
Redirect /index3.html http://example.com/newdirectory/
Redirect /index4.html http://example.com/newdirectory/
Redirect /index5.html http://example.com/newdirectory/
Is there not a better method for doing this? (more clean)
mysql query for select from two mysql tables
mysql query for select from two mysql tables
i'm using codeigniter.
i have two mysql tables.
what i'm doing is taking all the details in the first table and feed it to
html page and let all users to view it. but now i want to take some
details from second table related to a colum in first table.
i mean i have a column in first table call "Pending_on" in that column i
have inserted some branch names. and in the second table i have inserted
the contact details of those departments.
so if we think in the first table fifth row pending_on column has the
value "HR" then i want to display the telephone number of the HR
department.
so how can i write a query for this?
i'm using codeigniter.
i have two mysql tables.
what i'm doing is taking all the details in the first table and feed it to
html page and let all users to view it. but now i want to take some
details from second table related to a colum in first table.
i mean i have a column in first table call "Pending_on" in that column i
have inserted some branch names. and in the second table i have inserted
the contact details of those departments.
so if we think in the first table fifth row pending_on column has the
value "HR" then i want to display the telephone number of the HR
department.
so how can i write a query for this?
Tuesday, 1 October 2013
Android Failed to initialize display event receiver
Android Failed to initialize display event receiver
My application crashed when I open it again after closing it for quite
some time. The crash report shows this error:
java.lang.RuntimeException: Failed to initialize display event receiver.
status=-2147483648
at android.view.DisplayEventReceiver.nativeInit(Native Method)
at android.view.DisplayEventReceiver.<init>(DisplayEventReceiver.java:61)
at
android.view.Choreographer$FrameDisplayEventReceiver.<init>(Choreographer.java:676)
at android.view.Choreographer.<init>(Choreographer.java:165)
at android.view.Choreographer.<init>(Choreographer.java:68)
at android.view.Choreographer$1.initialValue(Choreographer.java:94)
at android.view.Choreographer$1.initialValue(Choreographer.java:87)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.view.Choreographer.getInstance(Choreographer.java:184)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:440)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:322)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:234)
at
android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:153)
at android.view.Window$LocalWindowManager.addView(Window.java:559)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.s
I am cracking my head looking for the solution or at least someone with
similar problem but surprisingly there is none. Thanks.
My application crashed when I open it again after closing it for quite
some time. The crash report shows this error:
java.lang.RuntimeException: Failed to initialize display event receiver.
status=-2147483648
at android.view.DisplayEventReceiver.nativeInit(Native Method)
at android.view.DisplayEventReceiver.<init>(DisplayEventReceiver.java:61)
at
android.view.Choreographer$FrameDisplayEventReceiver.<init>(Choreographer.java:676)
at android.view.Choreographer.<init>(Choreographer.java:165)
at android.view.Choreographer.<init>(Choreographer.java:68)
at android.view.Choreographer$1.initialValue(Choreographer.java:94)
at android.view.Choreographer$1.initialValue(Choreographer.java:87)
at java.lang.ThreadLocal$Values.getAfterMiss(ThreadLocal.java:430)
at java.lang.ThreadLocal.get(ThreadLocal.java:65)
at android.view.Choreographer.getInstance(Choreographer.java:184)
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:440)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:322)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:234)
at
android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:153)
at android.view.Window$LocalWindowManager.addView(Window.java:559)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2702)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2140)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.s
I am cracking my head looking for the solution or at least someone with
similar problem but surprisingly there is none. Thanks.
Method out of space?
Method out of space?
Today I got the following error message for the first time ever...
java.lang.Error: Unresolved compilation problem:
The code of method init() is exceeding the 65535 bytes limit
at generator.Main.init(Main.java:36)
at sun.applet.AppletPanel.run(AppletPanel.java:425)
at java.lang.Thread.run(Thread.java:680)
The error is being caused because I am creating an array list with around
10,000 ints in my init() method. The solution to this problem is not very
complicated, I made 3 methods that each had 3,300 ints in them and called
them all from my init().
But I have a couple questions purely out of curiosity.
Why do methods have a limit on space?
Why is it limited to 65535 bytes? (2^something-1?)
Is there any way to give a method more space or will they all be limited
the same amount?
How much information exactly is 65535 bytes?
Today I got the following error message for the first time ever...
java.lang.Error: Unresolved compilation problem:
The code of method init() is exceeding the 65535 bytes limit
at generator.Main.init(Main.java:36)
at sun.applet.AppletPanel.run(AppletPanel.java:425)
at java.lang.Thread.run(Thread.java:680)
The error is being caused because I am creating an array list with around
10,000 ints in my init() method. The solution to this problem is not very
complicated, I made 3 methods that each had 3,300 ints in them and called
them all from my init().
But I have a couple questions purely out of curiosity.
Why do methods have a limit on space?
Why is it limited to 65535 bytes? (2^something-1?)
Is there any way to give a method more space or will they all be limited
the same amount?
How much information exactly is 65535 bytes?
Uninstall Linux OS's with GRUB
Uninstall Linux OS's with GRUB
pIs there a way to uninstall my 3 Linux OS's: Ubuntu, Linux Mint and Pear
OS (Pear OS's Partition somehow got formatted, just the partition, not the
OS) With GRUB so I can install everything freshly? I made a big mess and I
think that I need to reinstall it freshly, I got a Linux Mint live USB in
case of emergency./p pThe real problem is that I also got Windows 8 and I
don't wanna lose any files there./p pSummary: How do I completely delete
My Linux Operative Systems along with GRUB to reinstall it freshly?/p
pIs there a way to uninstall my 3 Linux OS's: Ubuntu, Linux Mint and Pear
OS (Pear OS's Partition somehow got formatted, just the partition, not the
OS) With GRUB so I can install everything freshly? I made a big mess and I
think that I need to reinstall it freshly, I got a Linux Mint live USB in
case of emergency./p pThe real problem is that I also got Windows 8 and I
don't wanna lose any files there./p pSummary: How do I completely delete
My Linux Operative Systems along with GRUB to reinstall it freshly?/p
Kernel panic not Syncing:VFS:Unable to mount Root fs on unknow-block(0,0)
Kernel panic not Syncing:VFS:Unable to mount Root fs on unknow-block(0,0)
This is happening on USB version 13.04, too many times. I have tried the
suggestions but I am not able to proceed to get the commands to be
accepted when I type in. Can someone be more precise in the instructions.
I type in this ok: sudo mount /dev/sda1 /mnt But this line it gives error:
mnt/dev does not exist??? sudo mount --bind /dev /mnt/dev
This is happening on USB version 13.04, too many times. I have tried the
suggestions but I am not able to proceed to get the commands to be
accepted when I type in. Can someone be more precise in the instructions.
I type in this ok: sudo mount /dev/sda1 /mnt But this line it gives error:
mnt/dev does not exist??? sudo mount --bind /dev /mnt/dev
Monday, 30 September 2013
Representation of Inner Products ( Inner Product Matrix).
Representation of Inner Products ( Inner Product Matrix).
I am struggling with understanding this:
For an inner product of $\mathbb{R}^3$ defined by $\langle x,y\rangle =
2x_1y_1 -x_1y_2 -x_2y_1 + 5x_2y_2$ the matrix relative to the standard
basis is:-
$$\begin{pmatrix}2&-1\\-1& 5\end{pmatrix}$$
if the substitutions $$x_1 = (2/3)x_1' + (1/3)x_2'$$ $$x_2 = (1/3)x_1' -
(1/3)x_2'$$
and $$y_1 = (2/3)y_1' + (1/3)y_2'$$ $$y_2 = (1/3)y_2' - (1/3)y_2'$$ are
made,then the inner product takes the simple form $\langle x,y\rangle =
x_1'y_1' + x_2'y_2' = x'^ty'$ . I understand why it works and I understand
the use of eigenvectors to form an orthonormal vectors. Have tried this
but the eigenvalues are messy.
How do I arrive at the above substitutions?
I am struggling with understanding this:
For an inner product of $\mathbb{R}^3$ defined by $\langle x,y\rangle =
2x_1y_1 -x_1y_2 -x_2y_1 + 5x_2y_2$ the matrix relative to the standard
basis is:-
$$\begin{pmatrix}2&-1\\-1& 5\end{pmatrix}$$
if the substitutions $$x_1 = (2/3)x_1' + (1/3)x_2'$$ $$x_2 = (1/3)x_1' -
(1/3)x_2'$$
and $$y_1 = (2/3)y_1' + (1/3)y_2'$$ $$y_2 = (1/3)y_2' - (1/3)y_2'$$ are
made,then the inner product takes the simple form $\langle x,y\rangle =
x_1'y_1' + x_2'y_2' = x'^ty'$ . I understand why it works and I understand
the use of eigenvectors to form an orthonormal vectors. Have tried this
but the eigenvalues are messy.
How do I arrive at the above substitutions?
Can I set a content type if the origin doesn't send one in mod_proxy?
Can I set a content type if the origin doesn't send one in mod_proxy?
I have a misbehaving origin that when it has an error page it is not
setting a content-type header. This is then a problem as we're sitting
behind Edgecast and they default to application/octet-stream which causes
browsers to try and download the file. Is there any way I can get apache
to set a content type response header if there isn't one?
I have a misbehaving origin that when it has an error page it is not
setting a content-type header. This is then a problem as we're sitting
behind Edgecast and they default to application/octet-stream which causes
browsers to try and download the file. Is there any way I can get apache
to set a content type response header if there isn't one?
create list from xml file c#
create list from xml file c#
I am getting this rss feeds and i am trying to get the data of the rss
feed to a list format so that my customers can search through the data.
this is the ONLY way that worked for this kind of xml data:
xmlFile.SelectNodes("//ns:id |//ns:title | //ns:description", xmlnm);
public void MyMain(string[] args)
{
WebRequest request = WebRequest.Create("url to xml file");
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(dataStream);
XmlNamespaceManager xmlnm = new
XmlNamespaceManager(xmlDocument.NameTable);
xmlnm.AddNamespace("ns", "http://www.w3.org/2005/Atom");
ParseXML(xmlDocument, xmlnm);
MessageBox.Show("\n---XML parsed---");
//Console.ReadKey();
}
public void ParseXML(XmlDocument xmlFile, XmlNamespaceManager xmlnm)
{
//this commented section WORKS FANTASTIC!!
/* XmlNodeList nodes = xmlFile.SelectNodes("//ns:id |//ns:title |
//ns:description", xmlnm);;
foreach (XmlNode node in nodes)
{
MessageBox.Show(node.Name + " = " + node.InnerXml);
}
*/
//SO i decided to store the xml data into a list, and nothing works
below. I have a created a simple RSSXML class to store the information
XmlNodeList nodes = xmlFile.SelectNodes("//ns:id |//ns:title |
//ns:description", xmlnm);
List<RSSXML> items = new List<RSSXML>();
foreach (XmlNode node in nodes)
{
items.Select(x => new RSSXML()
{
id = node.InnerXml,
title = node.InnerXml,
description = node.InnerXml,
//can add more fields here
}).ToList();
}
foreach (var myitems in items)
{
MessageBox.Show(myitems.summary.ToString());
}
}
public class RSSXML()
{
//simple get set methods for id, title, description, etc
}
I am getting this rss feeds and i am trying to get the data of the rss
feed to a list format so that my customers can search through the data.
this is the ONLY way that worked for this kind of xml data:
xmlFile.SelectNodes("//ns:id |//ns:title | //ns:description", xmlnm);
public void MyMain(string[] args)
{
WebRequest request = WebRequest.Create("url to xml file");
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(dataStream);
XmlNamespaceManager xmlnm = new
XmlNamespaceManager(xmlDocument.NameTable);
xmlnm.AddNamespace("ns", "http://www.w3.org/2005/Atom");
ParseXML(xmlDocument, xmlnm);
MessageBox.Show("\n---XML parsed---");
//Console.ReadKey();
}
public void ParseXML(XmlDocument xmlFile, XmlNamespaceManager xmlnm)
{
//this commented section WORKS FANTASTIC!!
/* XmlNodeList nodes = xmlFile.SelectNodes("//ns:id |//ns:title |
//ns:description", xmlnm);;
foreach (XmlNode node in nodes)
{
MessageBox.Show(node.Name + " = " + node.InnerXml);
}
*/
//SO i decided to store the xml data into a list, and nothing works
below. I have a created a simple RSSXML class to store the information
XmlNodeList nodes = xmlFile.SelectNodes("//ns:id |//ns:title |
//ns:description", xmlnm);
List<RSSXML> items = new List<RSSXML>();
foreach (XmlNode node in nodes)
{
items.Select(x => new RSSXML()
{
id = node.InnerXml,
title = node.InnerXml,
description = node.InnerXml,
//can add more fields here
}).ToList();
}
foreach (var myitems in items)
{
MessageBox.Show(myitems.summary.ToString());
}
}
public class RSSXML()
{
//simple get set methods for id, title, description, etc
}
what is the technical difference between web application and cloud application?
what is the technical difference between web application and cloud
application?
Are we can call a cloud application as a web application? are they are
same? if not can any one provide a live example for this..thanks in
advance.. I already refered below link but not fully satisfied.
link: Difference between a web application, a web based application and
cloud application
application?
Are we can call a cloud application as a web application? are they are
same? if not can any one provide a live example for this..thanks in
advance.. I already refered below link but not fully satisfied.
link: Difference between a web application, a web based application and
cloud application
Sunday, 29 September 2013
How do I find the RGB representation of a color?
How do I find the RGB representation of a color?
How do I convert say, yellow, to RGB representation? (x,y,z)? I can find
the actual number representations online but I'm curious about the process
of actually converting from one to another.
How do I convert say, yellow, to RGB representation? (x,y,z)? I can find
the actual number representations online but I'm curious about the process
of actually converting from one to another.
XCode 5, Table View, How to bring the delete button to the front?
XCode 5, Table View, How to bring the delete button to the front?
After upgrading to Xcode 5, the delete button appears behind the cell
content in a table view.
How do I get it to show up on top of the cell content? In the past swiping
from right to left on the table cell used to bring up the Delete button
over the cell contents and now it comes up behind.
Thanks.
After upgrading to Xcode 5, the delete button appears behind the cell
content in a table view.
How do I get it to show up on top of the cell content? In the past swiping
from right to left on the table cell used to bring up the Delete button
over the cell contents and now it comes up behind.
Thanks.
Regex for 5 digit number with optional characters
Regex for 5 digit number with optional characters
I am trying to create a regex to validate a field where the user can enter
a 5 digit number with the option of adding a / followed by 3 letters. I
have tried quite a few variations of the following code:
^(\d{5})+?([/]+[A-Z]{1,3})?
But I just can't seem to get what I want.
For instance l would like the user to either enter a 5 digit number such
as 12345 with the option of adding a forward slash followed by any 3
letters such as 12345/WFE.
I am trying to create a regex to validate a field where the user can enter
a 5 digit number with the option of adding a / followed by 3 letters. I
have tried quite a few variations of the following code:
^(\d{5})+?([/]+[A-Z]{1,3})?
But I just can't seem to get what I want.
For instance l would like the user to either enter a 5 digit number such
as 12345 with the option of adding a forward slash followed by any 3
letters such as 12345/WFE.
Cassandra repair failing because of GC
Cassandra repair failing because of GC
We have a 9 node cluster and are running repairs every night as
recommended (1 node each night).
We recently started having problems during the repairs, some nodes would
die OutOfMemory because the GC would not collect fast enough. In the
beginning it was a promotion issue (as shown by the detailed GC logs).
So we assumed that the CMS was not triggered fast enough and prevented
ParNew from promoting surviging objects. When then lowered
XX:CMSInitiatingOccupancyFraction from 75 to 50 to force the old GC to
trigger faster.
It seemed to work, but yesterday two nodes dies because the GC couldn't
cope with the allocation speed, producing this kind of logs :
INFO [ScheduledTasks:1] 2013-09-27 23:36:38,111 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 21756 ms for 1 collections, 8003258240
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:36:38,878 GCInspector.java (line
142) Heap is 0.9746211436302873 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:36:57,018 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 17265 ms for 1 collections, 6587223560
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:36:57,243 GCInspector.java (line
142) Heap is 0.802179208376459 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:37:18,180 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 18437 ms for 1 collections, 6961687392
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:37:18,785 GCInspector.java (line
142) Heap is 0.8477806818323523 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:37:40,416 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19032 ms for 1 collections, 7338693168
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:37:40,456 GCInspector.java (line
142) Heap is 0.893691708259552 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:02,994 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 18853 ms for 1 collections, 7570047632
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:03,008 GCInspector.java (line
142) Heap is 0.9218656026318086 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:26,110 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19564 ms for 1 collections, 7714594464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:26,132 GCInspector.java (line
142) Heap is 0.9394682332713986 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:49,733 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 20388 ms for 1 collections, 7843428464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:49,748 GCInspector.java (line
142) Heap is 0.9551573859456055 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:39:14,564 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 20956 ms for 1 collections, 7934286376
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:39:14,578 GCInspector.java (line
142) Heap is 0.9662218848591505 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:39:40,186 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 22440 ms for 1 collections, 8008275464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:39:40,915 GCInspector.java (line
142) Heap is 0.9752321313612954 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:40:01,836 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19911 ms for 1 collections, 8022614576
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:40:06,032 GCInspector.java (line
142) Heap is 0.976978320390438 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:40:27,407 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 22590 ms for 1 collections, 8058828880
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:40:31,091 GCInspector.java (line
142) Heap is 0.9813884275395302 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [GossipTasks:1] 2013-09-27 23:40:53,798 Gossiper.java (line 799)
InetAddress /<datacenter02>.<node2> is now DOWN
INFO [GossipTasks:1] 2013-09-27 23:40:53,846 Gossiper.java (line 799)
InetAddress /<datacenter01>.<node3> is now DOWN
INFO [GossipStage:1] 2013-09-27 23:40:53,857 Gossiper.java (line 785)
InetAddress /<datacenter01>.<node3> is now UP
INFO [GossipStage:1] 2013-09-27 23:40:53,909 Gossiper.java (line 785)
InetAddress /<datacenter02>.<node2> is now UP
This time the heap grows and the GC run for 10-20 seconds without reducing
the heap size, causing nodes to think that each other is down because they
are busy GCing. In the end the nodes died of OOM.
We then tried to update to the latest version of Cassandra (1.2.8 ->
1.2.10) even though no fixed bug in these versions suggested any
improvement for our problem. We then reran a repair during last night, but
even though no nodes crashed, they failed to repair some ranges because of
GCs of this kind :
INFO [ScheduledTasks:1] 2013-09-29 04:45:05,467 GCInspector.java (line
119) GC for ParNew: 22875 ms for 2 collections, 4128819328 used; max is
8211660800
INFO [ScheduledTasks:1] 2013-09-29 04:53:24,597 GCInspector.java (line
119) GC for ParNew: 133643 ms for 2 collections, 3102634584 used; max is
8211660800
This time it's ParNew taking ridiculous amounts of time.
I first thought of a load issue, but it continued to happen during the w-e
when only the repair is happening.
Any help would be appreciated to diagnose / fix our issue.
We have a 9 node cluster and are running repairs every night as
recommended (1 node each night).
We recently started having problems during the repairs, some nodes would
die OutOfMemory because the GC would not collect fast enough. In the
beginning it was a promotion issue (as shown by the detailed GC logs).
So we assumed that the CMS was not triggered fast enough and prevented
ParNew from promoting surviging objects. When then lowered
XX:CMSInitiatingOccupancyFraction from 75 to 50 to force the old GC to
trigger faster.
It seemed to work, but yesterday two nodes dies because the GC couldn't
cope with the allocation speed, producing this kind of logs :
INFO [ScheduledTasks:1] 2013-09-27 23:36:38,111 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 21756 ms for 1 collections, 8003258240
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:36:38,878 GCInspector.java (line
142) Heap is 0.9746211436302873 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:36:57,018 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 17265 ms for 1 collections, 6587223560
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:36:57,243 GCInspector.java (line
142) Heap is 0.802179208376459 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:37:18,180 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 18437 ms for 1 collections, 6961687392
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:37:18,785 GCInspector.java (line
142) Heap is 0.8477806818323523 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:37:40,416 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19032 ms for 1 collections, 7338693168
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:37:40,456 GCInspector.java (line
142) Heap is 0.893691708259552 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:02,994 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 18853 ms for 1 collections, 7570047632
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:03,008 GCInspector.java (line
142) Heap is 0.9218656026318086 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:26,110 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19564 ms for 1 collections, 7714594464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:26,132 GCInspector.java (line
142) Heap is 0.9394682332713986 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:38:49,733 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 20388 ms for 1 collections, 7843428464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:38:49,748 GCInspector.java (line
142) Heap is 0.9551573859456055 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:39:14,564 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 20956 ms for 1 collections, 7934286376
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:39:14,578 GCInspector.java (line
142) Heap is 0.9662218848591505 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:39:40,186 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 22440 ms for 1 collections, 8008275464
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:39:40,915 GCInspector.java (line
142) Heap is 0.9752321313612954 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:40:01,836 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 19911 ms for 1 collections, 8022614576
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:40:06,032 GCInspector.java (line
142) Heap is 0.976978320390438 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [ScheduledTasks:1] 2013-09-27 23:40:27,407 GCInspector.java (line
119) GC for ConcurrentMarkSweep: 22590 ms for 1 collections, 8058828880
used; max is 8211660800
WARN [ScheduledTasks:1] 2013-09-27 23:40:31,091 GCInspector.java (line
142) Heap is 0.9813884275395302 full. You may need to reduce memtable
and/or cache sizes. Cassandra will now flush up to the two largest
memtables to free up memory. Adjust flush_largest_memtables_at threshold
in cassandra.yaml if you don't want Cassandra to do this automatically
INFO [GossipTasks:1] 2013-09-27 23:40:53,798 Gossiper.java (line 799)
InetAddress /<datacenter02>.<node2> is now DOWN
INFO [GossipTasks:1] 2013-09-27 23:40:53,846 Gossiper.java (line 799)
InetAddress /<datacenter01>.<node3> is now DOWN
INFO [GossipStage:1] 2013-09-27 23:40:53,857 Gossiper.java (line 785)
InetAddress /<datacenter01>.<node3> is now UP
INFO [GossipStage:1] 2013-09-27 23:40:53,909 Gossiper.java (line 785)
InetAddress /<datacenter02>.<node2> is now UP
This time the heap grows and the GC run for 10-20 seconds without reducing
the heap size, causing nodes to think that each other is down because they
are busy GCing. In the end the nodes died of OOM.
We then tried to update to the latest version of Cassandra (1.2.8 ->
1.2.10) even though no fixed bug in these versions suggested any
improvement for our problem. We then reran a repair during last night, but
even though no nodes crashed, they failed to repair some ranges because of
GCs of this kind :
INFO [ScheduledTasks:1] 2013-09-29 04:45:05,467 GCInspector.java (line
119) GC for ParNew: 22875 ms for 2 collections, 4128819328 used; max is
8211660800
INFO [ScheduledTasks:1] 2013-09-29 04:53:24,597 GCInspector.java (line
119) GC for ParNew: 133643 ms for 2 collections, 3102634584 used; max is
8211660800
This time it's ParNew taking ridiculous amounts of time.
I first thought of a load issue, but it continued to happen during the w-e
when only the repair is happening.
Any help would be appreciated to diagnose / fix our issue.
Saturday, 28 September 2013
How do I modify this program to make use of an ArrayList?
How do I modify this program to make use of an ArrayList?
First of all, here are the instructions:
http://ideone.com/eRHwUo
Yes, this is homework! With that being said (and because I simply love the
language), when you do post answers, please try to use pseudo code so that
I just don't copy and paste into my program. Thank you!
As far as the code goes, I've done everything needed in for the section
where the user enters all of the input. However, I need help with
'transferring' the data from the classes to the 'ArrayList' that we're
supposed to use. I figure that once I get that down, I'll be able to just
sort through the array to find the ID number for selection "B", and if the
user enters "C" I'll just cycle through the array displaying everything in
it.
Anyway, onto the code (this is main):
/*
* Name:
* Date:
* Assignment 2
*/
import java.util.Scanner;
public class homework
{
public static void main(String[] args)
{
char userSelection;
String convertString;
String userStrings;
Scanner kbd = new Scanner(System.in);
do
{
System.out.println("Here are your choices:");
System.out.println("A. Enter employee data" +
"\nB. Search for employee data" +
"\nC. List all data" +
"\nD. Exit");
convertString = kbd.next();
userSelection = convertString.charAt(0);
switch(userSelection)
{
case 'A':
GetUserInfo();
break;
case 'B':
// Stuff;
break;
case 'C':
// Display all data;
break;
case 'D':
System.out.println("Goodbye!");
break;
default:
System.out.println("Error, that is not a valid entry.
Please try again.");
}
} while (userSelection > 'D');
}
// Write functions here
public static void GetUserInfo()
{
String firstName;
String lastName;
String empID;
double hourlyRate;
int hoursWorked;
double withPercent;
Scanner kbd = new Scanner(System.in);
System.out.println("What is your first name?");
firstName = kbd.next();
System.out.println("What is your last name?");
lastName = kbd.next();
System.out.println("What is your employee ID?");
empID = kbd.next();
Employee user = new Employee(empID);
user.setFirstName(firstName);
user.setLastName(lastName);
System.out.println("What is your hourly rate?");
hourlyRate = kbd.nextDouble();
System.out.println("How many hours did you work?");
hoursWorked = kbd.nextInt();
System.out.println("What is your withholding percentage?");
withPercent = kbd.nextDouble();
Pay user1 = new Pay();
user1.setHourlyRate(hourlyRate);
user1.setHoursWorked(hoursWorked);
user1.setWithPercent(withPercent);
}
}
This is the Employee class:
public class Employee
{
// Members of the class
String firstName;
String lastName;
String employeeID;
// remember about the pay object
// EmployeeID constructor
public Employee(String empID)
{
this.employeeID = empID;
}
// Below are the various getters and setters of the Employee class
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
public String getEmployeeID()
{
return employeeID;
}
}
And this is the Pay class:
public class Pay
{
// Members of the class
double hourlyRate;
int hoursWorked;
double withPercent;
// Various getters and setters of the Pay class
public double getHourlyRate()
{
return hourlyRate;
}
public void setHourlyRate(double hourlyRate)
{
this.hourlyRate = hourlyRate;
}
public int getHoursWorked()
{
return hoursWorked;
}
public void setHoursWorked(int hoursWorked)
{
this.hoursWorked = hoursWorked;
}
public double getWithPercent()
{
return withPercent;
}
public void setWithPercent(double withPercent)
{
this.withPercent = withPercent;
}
// Calculates the raw payment
public double CalcPayRate(double hourlyRate, int hoursWorked)
{
return hourlyRate * hoursWorked;
}
// If the employee has worked overtime, calculates the new payment
public double CalcOvertimePay(double hourlyRate, int hoursWorked)
{
double rawPay = 0;
rawPay = hourlyRate * hoursWorked;
if (hoursWorked > 40)
{
rawPay *= 1.5;
}
return rawPay;
}
// Calculates final amount that the employee will be paid
public double CalcTotalPay(double hourlyRate, int hoursWorked, double
withPercent)
{
double rawPay = 0;
double subTotalPay = 0;
double finalPay = 0;
rawPay = hourlyRate * hoursWorked;
subTotalPay = rawPay * withPercent;
finalPay = rawPay - subTotalPay;
return finalPay;
}
}
So, thoughts please?
Also, final comments:
(1) I don't understand what 'Pay Object' is supposed to do under the
Employee class?
(2) How do I use the input data to create a 'Pay Object' and then create
an employee object?
Those are the two parts from the instructions I'm a little unclear about,
and as such if you could shade some light on that, it'd be helpful!
(3) If there's anything that seems off about my syntax, please let me know
about it so I can change it accordingly. I'm still new to this language,
so any help would be great.
First of all, here are the instructions:
http://ideone.com/eRHwUo
Yes, this is homework! With that being said (and because I simply love the
language), when you do post answers, please try to use pseudo code so that
I just don't copy and paste into my program. Thank you!
As far as the code goes, I've done everything needed in for the section
where the user enters all of the input. However, I need help with
'transferring' the data from the classes to the 'ArrayList' that we're
supposed to use. I figure that once I get that down, I'll be able to just
sort through the array to find the ID number for selection "B", and if the
user enters "C" I'll just cycle through the array displaying everything in
it.
Anyway, onto the code (this is main):
/*
* Name:
* Date:
* Assignment 2
*/
import java.util.Scanner;
public class homework
{
public static void main(String[] args)
{
char userSelection;
String convertString;
String userStrings;
Scanner kbd = new Scanner(System.in);
do
{
System.out.println("Here are your choices:");
System.out.println("A. Enter employee data" +
"\nB. Search for employee data" +
"\nC. List all data" +
"\nD. Exit");
convertString = kbd.next();
userSelection = convertString.charAt(0);
switch(userSelection)
{
case 'A':
GetUserInfo();
break;
case 'B':
// Stuff;
break;
case 'C':
// Display all data;
break;
case 'D':
System.out.println("Goodbye!");
break;
default:
System.out.println("Error, that is not a valid entry.
Please try again.");
}
} while (userSelection > 'D');
}
// Write functions here
public static void GetUserInfo()
{
String firstName;
String lastName;
String empID;
double hourlyRate;
int hoursWorked;
double withPercent;
Scanner kbd = new Scanner(System.in);
System.out.println("What is your first name?");
firstName = kbd.next();
System.out.println("What is your last name?");
lastName = kbd.next();
System.out.println("What is your employee ID?");
empID = kbd.next();
Employee user = new Employee(empID);
user.setFirstName(firstName);
user.setLastName(lastName);
System.out.println("What is your hourly rate?");
hourlyRate = kbd.nextDouble();
System.out.println("How many hours did you work?");
hoursWorked = kbd.nextInt();
System.out.println("What is your withholding percentage?");
withPercent = kbd.nextDouble();
Pay user1 = new Pay();
user1.setHourlyRate(hourlyRate);
user1.setHoursWorked(hoursWorked);
user1.setWithPercent(withPercent);
}
}
This is the Employee class:
public class Employee
{
// Members of the class
String firstName;
String lastName;
String employeeID;
// remember about the pay object
// EmployeeID constructor
public Employee(String empID)
{
this.employeeID = empID;
}
// Below are the various getters and setters of the Employee class
public String getFirstName()
{
return firstName;
}
public void setFirstName(String firstName)
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName(String lastName)
{
this.lastName = lastName;
}
public String getEmployeeID()
{
return employeeID;
}
}
And this is the Pay class:
public class Pay
{
// Members of the class
double hourlyRate;
int hoursWorked;
double withPercent;
// Various getters and setters of the Pay class
public double getHourlyRate()
{
return hourlyRate;
}
public void setHourlyRate(double hourlyRate)
{
this.hourlyRate = hourlyRate;
}
public int getHoursWorked()
{
return hoursWorked;
}
public void setHoursWorked(int hoursWorked)
{
this.hoursWorked = hoursWorked;
}
public double getWithPercent()
{
return withPercent;
}
public void setWithPercent(double withPercent)
{
this.withPercent = withPercent;
}
// Calculates the raw payment
public double CalcPayRate(double hourlyRate, int hoursWorked)
{
return hourlyRate * hoursWorked;
}
// If the employee has worked overtime, calculates the new payment
public double CalcOvertimePay(double hourlyRate, int hoursWorked)
{
double rawPay = 0;
rawPay = hourlyRate * hoursWorked;
if (hoursWorked > 40)
{
rawPay *= 1.5;
}
return rawPay;
}
// Calculates final amount that the employee will be paid
public double CalcTotalPay(double hourlyRate, int hoursWorked, double
withPercent)
{
double rawPay = 0;
double subTotalPay = 0;
double finalPay = 0;
rawPay = hourlyRate * hoursWorked;
subTotalPay = rawPay * withPercent;
finalPay = rawPay - subTotalPay;
return finalPay;
}
}
So, thoughts please?
Also, final comments:
(1) I don't understand what 'Pay Object' is supposed to do under the
Employee class?
(2) How do I use the input data to create a 'Pay Object' and then create
an employee object?
Those are the two parts from the instructions I'm a little unclear about,
and as such if you could shade some light on that, it'd be helpful!
(3) If there's anything that seems off about my syntax, please let me know
about it so I can change it accordingly. I'm still new to this language,
so any help would be great.
Error in WordPress import
Error in WordPress import
I am changing my website hosting, so I made a backup for everything,
themes, DB and used the Export utility in WP to export all posts,
pages...etc.
Now I am trying to import posts, pages, users in the new hosting but I am
getting the following errors:
Failed to create new user for John Their posts will be attributed to the
current user. Failed to create new user for guest. Their posts will be
attributed to the current user. Failed to create new user for Sam. Their
posts will be attributed to the current user. Failed to import Media "MW
profile" Failed to import Media "LA house" Failed to import Media "Gold"
Failed to import Media "Archive" Failed to import Media "21882183"
....etc
I checked the import xml file, paths inside it but I don't see any problem
as paths in the import XML file are exactly the same as images real paths.
So can someone please tell me what I might be doing wrong here, and how to
solve this problem?
thanksf or your time
I am changing my website hosting, so I made a backup for everything,
themes, DB and used the Export utility in WP to export all posts,
pages...etc.
Now I am trying to import posts, pages, users in the new hosting but I am
getting the following errors:
Failed to create new user for John Their posts will be attributed to the
current user. Failed to create new user for guest. Their posts will be
attributed to the current user. Failed to create new user for Sam. Their
posts will be attributed to the current user. Failed to import Media "MW
profile" Failed to import Media "LA house" Failed to import Media "Gold"
Failed to import Media "Archive" Failed to import Media "21882183"
....etc
I checked the import xml file, paths inside it but I don't see any problem
as paths in the import XML file are exactly the same as images real paths.
So can someone please tell me what I might be doing wrong here, and how to
solve this problem?
thanksf or your time
Are = valid C++ syntax
Are = valid C++ syntax
I want to know if the following code is valid.
int x = 4;
iny y = 5;
x <<= y; // x * 2^y
x >>= y; // x / 2^y
Thanks in advance.
I want to know if the following code is valid.
int x = 4;
iny y = 5;
x <<= y; // x * 2^y
x >>= y; // x / 2^y
Thanks in advance.
Friday, 27 September 2013
Xcode: lost connection with Error code -1
Xcode: lost connection with Error code -1
This seemingly trivial piece of code is copied from the textbook but after
Xcode takes the input at the scanf(), the program exits with error code -1
and says "lost connection".
#import <Foundation/Foundation.h>
int main (int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
int number;
NSLog(@"Type in your number: ");
scanf("%i", &number);
if (number < 0)
number = -number;
NSLog(@"The absolute value is: %i", number);
[pool drain];
return 0;
}
This seemingly trivial piece of code is copied from the textbook but after
Xcode takes the input at the scanf(), the program exits with error code -1
and says "lost connection".
#import <Foundation/Foundation.h>
int main (int argc, char *argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init];
int number;
NSLog(@"Type in your number: ");
scanf("%i", &number);
if (number < 0)
number = -number;
NSLog(@"The absolute value is: %i", number);
[pool drain];
return 0;
}
How to disable a childdivider in an ExpandableListView in Android
How to disable a childdivider in an ExpandableListView in Android
I'm trying to hide child dividers in my ExpandableListView. I've managed
to make the child dividers transparent by adding:
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="#00000000"/>
But it removes the last divider of the current group as well as removing
the first divider of the next group. I want to keep the dividers on both
sides of each group, and remove the internal dividers between children.
I'd post an image showing what I'm looking for but this is my first post
and it wouldn't let me. :)
Any help would be appreciated!
I'm trying to hide child dividers in my ExpandableListView. I've managed
to make the child dividers transparent by adding:
<ExpandableListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:childDivider="#00000000"/>
But it removes the last divider of the current group as well as removing
the first divider of the next group. I want to keep the dividers on both
sides of each group, and remove the internal dividers between children.
I'd post an image showing what I'm looking for but this is my first post
and it wouldn't let me. :)
Any help would be appreciated!
How Make a login Page?
How Make a login Page?
i make a register page but my problem is how to create how to create a
login page ? this is my register page
this is the form First Name: Last Name: Your Email: New Password: I am:
Select Sex: Female Male Birthday: Month: Day: Year: and my SQL
<?php
if(empty($_POST['fname']) || empty($_POST['lname']) ||
empty($_POST['email']) || empty($_POST['pass']))
{
die(msg(0,"All the fields are required"));
}
if(!(int)$_POST['sex-select'])
{
die(msg(0,"You have to select your sex"));
}
if(!(int)$_POST['day'] || !(int)$_POST['month'] || !(int)$_POST['year'])
{
die(msg(0,"You have to fill in your birthday"));
}
if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/",
$_POST['email'])))
die(msg(0,"You haven't provided a valid email"));
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$password1 = $_POST['pass'];
$email = $_POST['email'];
$sex = $_POST['sex-select'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$hash = hash('sha256', $password1);
function createSalt()
{
$text = md5(uniqid(rand(), true));
return substr($text, 0, 3);
}
$salt = createSalt();
$password = hash('sha256', $salt . $hash);
$conn = mysql_connect('localhost', 'root', '1234');
mysql_select_db('member', $conn);
$query = "INSERT INTO test ( fname, lname, password, email, salt, sex,
day, month, year)
VALUES ( '$fname', '$lname', '$password', '$email', '$salt',
'$sex', '$day', '$month', '$year');";
mysql_query($query);
mysql_close();
echo msg(1,"registered.html");
function msg($status,$txt)
{
return '{"status":'.$status.',"txt":"'.$txt.'"}';
}
?>
Some One Help Me also i want to know when i want to get for example the
name what i have to do??
i make a register page but my problem is how to create how to create a
login page ? this is my register page
this is the form First Name: Last Name: Your Email: New Password: I am:
Select Sex: Female Male Birthday: Month: Day: Year: and my SQL
<?php
if(empty($_POST['fname']) || empty($_POST['lname']) ||
empty($_POST['email']) || empty($_POST['pass']))
{
die(msg(0,"All the fields are required"));
}
if(!(int)$_POST['sex-select'])
{
die(msg(0,"You have to select your sex"));
}
if(!(int)$_POST['day'] || !(int)$_POST['month'] || !(int)$_POST['year'])
{
die(msg(0,"You have to fill in your birthday"));
}
if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/",
$_POST['email'])))
die(msg(0,"You haven't provided a valid email"));
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$password1 = $_POST['pass'];
$email = $_POST['email'];
$sex = $_POST['sex-select'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$hash = hash('sha256', $password1);
function createSalt()
{
$text = md5(uniqid(rand(), true));
return substr($text, 0, 3);
}
$salt = createSalt();
$password = hash('sha256', $salt . $hash);
$conn = mysql_connect('localhost', 'root', '1234');
mysql_select_db('member', $conn);
$query = "INSERT INTO test ( fname, lname, password, email, salt, sex,
day, month, year)
VALUES ( '$fname', '$lname', '$password', '$email', '$salt',
'$sex', '$day', '$month', '$year');";
mysql_query($query);
mysql_close();
echo msg(1,"registered.html");
function msg($status,$txt)
{
return '{"status":'.$status.',"txt":"'.$txt.'"}';
}
?>
Some One Help Me also i want to know when i want to get for example the
name what i have to do??
undefined scope into $watch
undefined scope into $watch
I have a directive named dir with:
ng-model="job.start_date"
comparison-date="job.end_date
Into scope.$watch("comparisonDate... I want to access my ng-model value.
The problem is that scope is undefined into watch's callback function. The
Question is: How can I get the ng-value inside this function?
.directive("dir", function() {
return {
scope: {
comparisonDate: "=",
ngModel: "="
},
link: function (scope, element, attrs, ctrl) {
scope.$watch("comparisonDate", function(value, oldValue) {
console.log(value);
console.log(scope.ngModel);
})
}
};
})
the view...
<input dir type="text" ng-model="job.start_date"
comparison-date="job.end_date"/>
I have a directive named dir with:
ng-model="job.start_date"
comparison-date="job.end_date
Into scope.$watch("comparisonDate... I want to access my ng-model value.
The problem is that scope is undefined into watch's callback function. The
Question is: How can I get the ng-value inside this function?
.directive("dir", function() {
return {
scope: {
comparisonDate: "=",
ngModel: "="
},
link: function (scope, element, attrs, ctrl) {
scope.$watch("comparisonDate", function(value, oldValue) {
console.log(value);
console.log(scope.ngModel);
})
}
};
})
the view...
<input dir type="text" ng-model="job.start_date"
comparison-date="job.end_date"/>
ElasticSearch: Multi field "upgrade" yields error:
ElasticSearch: Multi field "upgrade" yields error:
Okay, here is the task:
I've already read the whole documentation and I noticed that I can
"upgrade" a data type like string to a multi field - in a test scenario it
already worked.
My documents structure is currently:
{
"name": "test",
"words": [
{
"words": "hello world",
"verts": [
1,
2,
3
]
}
]
}
These documents were created using the default mappings - so no mapping
has been set explicitly.
I am issuing a XDELETE command with data like:
{
"article": {
"properties": {
"words": {
"type": "multi_field",
"fields": {
"words": {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
But I receive this error here:
{"error":"MergeMappingException[Merge failed with failures {[Can't merge a
non multi_field / non simple mapping [words] with a multi_field mapping
[words]]}]","status":400}
Can someone explain to me, why this happens? When I issue this mapping to
a clean index, it works and the not_analyzed filter is being applied.
Thanks :)
Jan
Okay, here is the task:
I've already read the whole documentation and I noticed that I can
"upgrade" a data type like string to a multi field - in a test scenario it
already worked.
My documents structure is currently:
{
"name": "test",
"words": [
{
"words": "hello world",
"verts": [
1,
2,
3
]
}
]
}
These documents were created using the default mappings - so no mapping
has been set explicitly.
I am issuing a XDELETE command with data like:
{
"article": {
"properties": {
"words": {
"type": "multi_field",
"fields": {
"words": {
"type": "string",
"index": "analyzed"
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
But I receive this error here:
{"error":"MergeMappingException[Merge failed with failures {[Can't merge a
non multi_field / non simple mapping [words] with a multi_field mapping
[words]]}]","status":400}
Can someone explain to me, why this happens? When I issue this mapping to
a clean index, it works and the not_analyzed filter is being applied.
Thanks :)
Jan
Command Line Argument in VB.net
Command Line Argument in VB.net
In below image you can see that i have set Commandline arguments in start
option, the requirement is i want to set that command line option
dynamically through vb.net.
In below image you can see that i have set Commandline arguments in start
option, the requirement is i want to set that command line option
dynamically through vb.net.
JQuery - how to close a parent element from within an iFrame in the parent element?
JQuery - how to close a parent element from within an iFrame in the parent
element?
couldn't find anything similiar to my problem.
I am writing DIVs by
var dialog = $('<div id="dialog-overlay"></div><div
id="dialog-box"></div><div
id="dialog-container"></div>').appendTo('body');
Within the div "dialog-container" I am creating an iFrame by
$("#dialog-container").html('<iframe id="ifrm" class="gs_iframe"
frameborder="0" scrolling="no"></iframe>');
Now the problem is that if I want to remove the element "dialog" from
withing the iFrame I only get undefineds. How can I do so please?
I know that I could remove each div by ID but think to would be easier and
at least cleaner to just remove the dialog object.
Thank u in advance.
element?
couldn't find anything similiar to my problem.
I am writing DIVs by
var dialog = $('<div id="dialog-overlay"></div><div
id="dialog-box"></div><div
id="dialog-container"></div>').appendTo('body');
Within the div "dialog-container" I am creating an iFrame by
$("#dialog-container").html('<iframe id="ifrm" class="gs_iframe"
frameborder="0" scrolling="no"></iframe>');
Now the problem is that if I want to remove the element "dialog" from
withing the iFrame I only get undefineds. How can I do so please?
I know that I could remove each div by ID but think to would be easier and
at least cleaner to just remove the dialog object.
Thank u in advance.
Thursday, 26 September 2013
Onclick button disables checkboxes
Onclick button disables checkboxes
. .I couldn't find a proper answer for onclick function on a button
disables three checkboxes. . .
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
And the button to add onclick function already there are many onclick
functions.
<input type="button" class="button2" id="item2" value="Add to Cart"
Title="Add to Cart"
onClick="addItem_check('item_listing_100','ItemTable','100','Amul
Butter','500','g','150.00','1','kg','200.00','2','kg','250.00');
amul1.style.backgroundColor='#c2ed5c'; if(this.value=='Add to Cart')
{this.value = 'Remove from Cart'}; item2();"/>
So please give me a solution guys
. .I couldn't find a proper answer for onclick function on a button
disables three checkboxes. . .
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
<input id="option" name="item_number" type="checkbox" class="ckbox"
value="1" onclick="this.checked=!this.checked;"/>
And the button to add onclick function already there are many onclick
functions.
<input type="button" class="button2" id="item2" value="Add to Cart"
Title="Add to Cart"
onClick="addItem_check('item_listing_100','ItemTable','100','Amul
Butter','500','g','150.00','1','kg','200.00','2','kg','250.00');
amul1.style.backgroundColor='#c2ed5c'; if(this.value=='Add to Cart')
{this.value = 'Remove from Cart'}; item2();"/>
So please give me a solution guys
Wednesday, 25 September 2013
Removing leading, trailing and multiple spaces within a string
Removing leading, trailing and multiple spaces within a string
I would like to remove all leading and trailing spaces. As well as replace
multiple spaces with a single space within a string, so that all words in
a string are separated exactly by single space.
I could achieve this using following two iteration of regex and looking
for single regex solution.
s/^\s+|\s+$//g
s/\s+/ /g
Sample Input:
word1 word2 word3 word4
Desired Output:
word1 word2 word3 word4
It would be appreciable if you could help me to solve this.
I would like to remove all leading and trailing spaces. As well as replace
multiple spaces with a single space within a string, so that all words in
a string are separated exactly by single space.
I could achieve this using following two iteration of regex and looking
for single regex solution.
s/^\s+|\s+$//g
s/\s+/ /g
Sample Input:
word1 word2 word3 word4
Desired Output:
word1 word2 word3 word4
It would be appreciable if you could help me to solve this.
Thursday, 19 September 2013
I am using eclipse and i get this error--
I am using eclipse and i get this error--
error
Exception in thread "main" java.lang.Error: Unresolved compilation
problem: at Wall.main(Wall.java:6)
import becker.robots.*;
import javax.swing.*;
public class Wall
{
public static void main (String[] args)
{
JFrame frame = new JFrame ();
frame.setVisible(true);
JPanel panel = new JPanel ();
panel.setVisible(true);
frame.add(panel);
JColorChooser color = new JColorChooser();
panel.add(color);
}
}
error
Exception in thread "main" java.lang.Error: Unresolved compilation
problem: at Wall.main(Wall.java:6)
import becker.robots.*;
import javax.swing.*;
public class Wall
{
public static void main (String[] args)
{
JFrame frame = new JFrame ();
frame.setVisible(true);
JPanel panel = new JPanel ();
panel.setVisible(true);
frame.add(panel);
JColorChooser color = new JColorChooser();
panel.add(color);
}
}
Why is my jQuery not working?
Why is my jQuery not working?
I just finished the introductory course on Codecademy and I wanted to use
it on a web project but I can't seem to get it working.
test.html
<html>
<head>
<title>jQuery</title>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="test.js"></script>
</head>
<body>
<p style="font-family: verdana;">wfef</p>
</body>
</html>
test.js
$(document).ready(function() {
$('p').click(function() {
$(this).hide();
};
});
I just finished the introductory course on Codecademy and I wanted to use
it on a web project but I can't seem to get it working.
test.html
<html>
<head>
<title>jQuery</title>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="test.js"></script>
</head>
<body>
<p style="font-family: verdana;">wfef</p>
</body>
</html>
test.js
$(document).ready(function() {
$('p').click(function() {
$(this).hide();
};
});
Iterating over PDFBytes data and writing to separate text files
Iterating over PDFBytes data and writing to separate text files
Is there any way to properly iterate over an array in my listener that
contains the PDF byte data for each PDF and have it write each one to a
separate text file? I've been working on this for three days and can only
get it to write the first one and that's it.
Is there any way to properly iterate over an array in my listener that
contains the PDF byte data for each PDF and have it write each one to a
separate text file? I've been working on this for three days and can only
get it to write the first one and that's it.
webbrowser navigate with proxy internet connection
webbrowser navigate with proxy internet connection
If navigate is done with postData, in a pc with proxy internet connection,
it is not navigating. any solution ?
(web.WebBrowser1.Navigate buildURL, 4 + 8, , byte_array)
If navigate is done with postData, in a pc with proxy internet connection,
it is not navigating. any solution ?
(web.WebBrowser1.Navigate buildURL, 4 + 8, , byte_array)
How's the property of a langauge called which makes you able to write eg. a bootloader?
How's the property of a langauge called which makes you able to write eg.
a bootloader?
How is such a property of a programming language called which makes one
able to write independently of any Operating System and any
standard|runtime library? For example, one can write a boot loader in C or
in assembly for a given processor platform. How is this property[|ies]
called?
a bootloader?
How is such a property of a programming language called which makes one
able to write independently of any Operating System and any
standard|runtime library? For example, one can write a boot loader in C or
in assembly for a given processor platform. How is this property[|ies]
called?
Running Powershell using administrator and server farm account
Running Powershell using administrator and server farm account
I am a newbie in Powershell and would like to know if running a powershell
command as administrator or service account is possible or not.
I tried running a Add-SPSolution -LiteralPath command as administrator and
using server farm account but I got this error: "Access denied.". I
checked the properties of SharePoint 2010 Management Shell and set the
advanced property to "Run as administrator". I tried running the command
both as administrator or as server farm account.
I am a newbie in Powershell and would like to know if running a powershell
command as administrator or service account is possible or not.
I tried running a Add-SPSolution -LiteralPath command as administrator and
using server farm account but I got this error: "Access denied.". I
checked the properties of SharePoint 2010 Management Shell and set the
advanced property to "Run as administrator". I tried running the command
both as administrator or as server farm account.
Wednesday, 18 September 2013
Basic steps for playing .sdp file in android?
Basic steps for playing .sdp file in android?
I am using this code to play sdp file but i am not able to play it so i
need basic steps to play sdp in android for playing live tv chinals
public class ChatWindowActivity extends Activity {
boolean optionstates=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vdoview=(VideoView) findViewById(R.id.vid1);
MediaController mdcController1=new MediaController(this);
mdcController1.setAnchorView(vdoview);
Uri video=Uri.parse("rtsp://121.244.145.226.554/prf1/cid_61_sdp");
vdoview.setMediaController(mdcController1);
vdoview.setVideoURI(video);
vdoview.start();
}
}
I am using this code to play sdp file but i am not able to play it so i
need basic steps to play sdp in android for playing live tv chinals
public class ChatWindowActivity extends Activity {
boolean optionstates=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vdoview=(VideoView) findViewById(R.id.vid1);
MediaController mdcController1=new MediaController(this);
mdcController1.setAnchorView(vdoview);
Uri video=Uri.parse("rtsp://121.244.145.226.554/prf1/cid_61_sdp");
vdoview.setMediaController(mdcController1);
vdoview.setVideoURI(video);
vdoview.start();
}
}
New Activity crashes with Runtime Exception and Null Pointer Exception
New Activity crashes with Runtime Exception and Null Pointer Exception
Brief explanation of application thus far:
the user clicks on the start button in MainActivity.java and will be
redirected to a new activity (FirstWord.java) with a TextToSpeech
instance. It might be possible that issues with FirstWord.java might cause
the crash [?] .
MainActivity.java [relevant portion]
public void startClicked(View view){
Intent i = new Intent( MainActivity.this, FirstWord.class );
MainActivity.this.startActivity(i);
}
activity_main.XML, I have done the android:onClick="startClicked"
attribute to a button.
FirstWord.java
package com.example.learnwords;
import java.util.Locale;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import android.view.View.OnClickListener;
public class FirstWord extends Activity implements OnClickListener,
OnInitListener{
private TextToSpeech myTTS;
private int MY_DATA_CHECK_CODE = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button proButton = (Button)findViewById(R.id.proButton);
proButton.setOnClickListener(this);
Intent checkTTSIntent = new Intent();
checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void proClicked(View view){
TextView textView = (TextView)findViewById(R.id.textView1);
String word = textView.getText().toString();
speakWords(word);
}
private void speakWords(String speech) {
//speak straight away
myTTS.speak(speech, TextToSpeech.QUEUE_FLUSH, null);
}
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
//the user has the necessary data - create the TTS
myTTS = new TextToSpeech(this, this);
}
else {
//no data - install it now
Intent installTTSIntent = new Intent();
installTTSIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installTTSIntent);
}
}
}
//setup TTS
public void onInit(int initStatus) {
//check for successful instantiation
if (initStatus == TextToSpeech.SUCCESS) {
if(myTTS.isLanguageAvailable(Locale.US)==TextToSpeech.LANG_AVAILABLE)
myTTS.setLanguage(Locale.US);
}
else if (initStatus == TextToSpeech.ERROR) {
Toast.makeText(this, "Sorry! Text To Speech failed...",
Toast.LENGTH_LONG).show();
}
}
@Override
public void onClick(View v) {
}
}
Full Logcat: There is a NullPointer Exception and a RunPointer Exception
09-18 21:15:45.094: D/ActivityThread(4730): setTargetHeapUtilization:0.25
09-18 21:15:45.094: D/ActivityThread(4730): setTargetHeapIdealFree:8388608
09-18 21:15:45.104: D/ActivityThread(4730):
setTargetHeapConcurrentStart:2097152
09-18 21:15:45.515: I/Adreno200-EGLSUB(4730): <ConfigWindowMatch:2087>:
Format RGBA_8888.
09-18 21:15:45.525: E/(4730): <s3dReadConfigFile:75>: Can't open file for
reading
09-18 21:15:45.535: E/(4730): <s3dReadConfigFile:75>: Can't open file for
reading
09-18 21:15:48.408: W/dalvikvm(4730): threadid=1: thread exiting with
uncaught exception (group=0x4196f438)
09-18 21:15:48.408: E/AndroidRuntime(4730): FATAL EXCEPTION: main
09-18 21:15:48.408: E/AndroidRuntime(4730): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.example.learnwords/com.example.learnwords.FirstWord}:
java.lang.NullPointerException
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.access$700(ActivityThread.java:143)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.os.Looper.loop(Looper.java:137)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.main(ActivityThread.java:4950)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
java.lang.reflect.Method.invokeNative(Native Method)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
java.lang.reflect.Method.invoke(Method.java:511)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
dalvik.system.NativeStart.main(Native Method)
09-18 21:15:48.408: E/AndroidRuntime(4730): Caused by:
java.lang.NullPointerException
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.example.learnwords.FirstWord.onCreate(FirstWord.java:27)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.Activity.performCreate(Activity.java:5179)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
09-18 21:15:48.408: E/AndroidRuntime(4730): ... 11 more
Any Ideas? Thanks
Brief explanation of application thus far:
the user clicks on the start button in MainActivity.java and will be
redirected to a new activity (FirstWord.java) with a TextToSpeech
instance. It might be possible that issues with FirstWord.java might cause
the crash [?] .
MainActivity.java [relevant portion]
public void startClicked(View view){
Intent i = new Intent( MainActivity.this, FirstWord.class );
MainActivity.this.startActivity(i);
}
activity_main.XML, I have done the android:onClick="startClicked"
attribute to a button.
FirstWord.java
package com.example.learnwords;
import java.util.Locale;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import android.view.View.OnClickListener;
public class FirstWord extends Activity implements OnClickListener,
OnInitListener{
private TextToSpeech myTTS;
private int MY_DATA_CHECK_CODE = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button proButton = (Button)findViewById(R.id.proButton);
proButton.setOnClickListener(this);
Intent checkTTSIntent = new Intent();
checkTTSIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkTTSIntent, MY_DATA_CHECK_CODE);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is
present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void proClicked(View view){
TextView textView = (TextView)findViewById(R.id.textView1);
String word = textView.getText().toString();
speakWords(word);
}
private void speakWords(String speech) {
//speak straight away
myTTS.speak(speech, TextToSpeech.QUEUE_FLUSH, null);
}
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == MY_DATA_CHECK_CODE) {
if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
//the user has the necessary data - create the TTS
myTTS = new TextToSpeech(this, this);
}
else {
//no data - install it now
Intent installTTSIntent = new Intent();
installTTSIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
startActivity(installTTSIntent);
}
}
}
//setup TTS
public void onInit(int initStatus) {
//check for successful instantiation
if (initStatus == TextToSpeech.SUCCESS) {
if(myTTS.isLanguageAvailable(Locale.US)==TextToSpeech.LANG_AVAILABLE)
myTTS.setLanguage(Locale.US);
}
else if (initStatus == TextToSpeech.ERROR) {
Toast.makeText(this, "Sorry! Text To Speech failed...",
Toast.LENGTH_LONG).show();
}
}
@Override
public void onClick(View v) {
}
}
Full Logcat: There is a NullPointer Exception and a RunPointer Exception
09-18 21:15:45.094: D/ActivityThread(4730): setTargetHeapUtilization:0.25
09-18 21:15:45.094: D/ActivityThread(4730): setTargetHeapIdealFree:8388608
09-18 21:15:45.104: D/ActivityThread(4730):
setTargetHeapConcurrentStart:2097152
09-18 21:15:45.515: I/Adreno200-EGLSUB(4730): <ConfigWindowMatch:2087>:
Format RGBA_8888.
09-18 21:15:45.525: E/(4730): <s3dReadConfigFile:75>: Can't open file for
reading
09-18 21:15:45.535: E/(4730): <s3dReadConfigFile:75>: Can't open file for
reading
09-18 21:15:48.408: W/dalvikvm(4730): threadid=1: thread exiting with
uncaught exception (group=0x4196f438)
09-18 21:15:48.408: E/AndroidRuntime(4730): FATAL EXCEPTION: main
09-18 21:15:48.408: E/AndroidRuntime(4730): java.lang.RuntimeException:
Unable to start activity
ComponentInfo{com.example.learnwords/com.example.learnwords.FirstWord}:
java.lang.NullPointerException
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.access$700(ActivityThread.java:143)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1241)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.os.Looper.loop(Looper.java:137)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.main(ActivityThread.java:4950)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
java.lang.reflect.Method.invokeNative(Native Method)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
java.lang.reflect.Method.invoke(Method.java:511)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
dalvik.system.NativeStart.main(Native Method)
09-18 21:15:48.408: E/AndroidRuntime(4730): Caused by:
java.lang.NullPointerException
09-18 21:15:48.408: E/AndroidRuntime(4730): at
com.example.learnwords.FirstWord.onCreate(FirstWord.java:27)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.Activity.performCreate(Activity.java:5179)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
09-18 21:15:48.408: E/AndroidRuntime(4730): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2074)
09-18 21:15:48.408: E/AndroidRuntime(4730): ... 11 more
Any Ideas? Thanks
I keep getting Global name 'username' not defined?
I keep getting Global name 'username' not defined?
My issue us that I keep getting a global name not defined error in this
script:
import time
def cls():
print(("\n")*100)
#Registers the Username and Password for the user.
def registerPro():
cls()
username=str(input("Enter your Username here: "))
password=str(input("Enter your Password here: "))
confirm=str(input("Please confirm your Password: "))
if password==confirm:
cls()
print("Thank you for registering at Apex Industries!")
time.sleep(3)
loggingIn()
else:
cls()
print("Your passwords do not match, please re-register.")
time.sleep(3)
registerPro()
return username, password
#Is called by getUsername. If the user entered the password correctly then
the login is successful.
def getPass(password):
cls()
confirmPass=str(input("Enter your password: "))
if confirmPass==password:
cls()
print("You have logged in successfully.")
else:
cls()
print("Wrong Password. Try again")
getPass()
#Makes sure the username is in the database.
def getUsername(username):
cls()
confirmUser=str(input("Enter your username: "))
if confirmUser==username:
getPass(password)
else:
cls()
print("No username with that name in the database.")
time.sleep(3)
loggingIn()
#The login for the main program.
def loggingIn():
cls()
print("Hello and welcome to the Apex Industries login/register page.")
print(" Please choose to either Login or Register.")
print()
regLog=str(input("Type Login or Register for your choice: "))
if regLog=='Login':
getUsername(username)
elif regLog=='Register':
registerPro()
else:
cls()
print("That is not a valid option. Try again.")
time.sleep(3)
loggingIn()
loggingIn()
My traceback gives me this:
Traceback (most recent call last):
File "C:/Users/Evu/Desktop/Python/testforLogin", line 59, in <module>
loggingIn()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 13, in loggingIn
registerPro()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 29, in registerPro
loggingIn()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 11, in loggingIn
getUsername(username)
NameError: global name 'username' is not defined
What am I doing wrong? I want to import username into the getUsername()
function I have created. Keep in mind that I am new to scripting and am
just trying to learn this on my own time, this is just a test script. Any
advice would be awesome.
My issue us that I keep getting a global name not defined error in this
script:
import time
def cls():
print(("\n")*100)
#Registers the Username and Password for the user.
def registerPro():
cls()
username=str(input("Enter your Username here: "))
password=str(input("Enter your Password here: "))
confirm=str(input("Please confirm your Password: "))
if password==confirm:
cls()
print("Thank you for registering at Apex Industries!")
time.sleep(3)
loggingIn()
else:
cls()
print("Your passwords do not match, please re-register.")
time.sleep(3)
registerPro()
return username, password
#Is called by getUsername. If the user entered the password correctly then
the login is successful.
def getPass(password):
cls()
confirmPass=str(input("Enter your password: "))
if confirmPass==password:
cls()
print("You have logged in successfully.")
else:
cls()
print("Wrong Password. Try again")
getPass()
#Makes sure the username is in the database.
def getUsername(username):
cls()
confirmUser=str(input("Enter your username: "))
if confirmUser==username:
getPass(password)
else:
cls()
print("No username with that name in the database.")
time.sleep(3)
loggingIn()
#The login for the main program.
def loggingIn():
cls()
print("Hello and welcome to the Apex Industries login/register page.")
print(" Please choose to either Login or Register.")
print()
regLog=str(input("Type Login or Register for your choice: "))
if regLog=='Login':
getUsername(username)
elif regLog=='Register':
registerPro()
else:
cls()
print("That is not a valid option. Try again.")
time.sleep(3)
loggingIn()
loggingIn()
My traceback gives me this:
Traceback (most recent call last):
File "C:/Users/Evu/Desktop/Python/testforLogin", line 59, in <module>
loggingIn()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 13, in loggingIn
registerPro()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 29, in registerPro
loggingIn()
File "C:/Users/Evu/Desktop/Python/testforLogin", line 11, in loggingIn
getUsername(username)
NameError: global name 'username' is not defined
What am I doing wrong? I want to import username into the getUsername()
function I have created. Keep in mind that I am new to scripting and am
just trying to learn this on my own time, this is just a test script. Any
advice would be awesome.
initializing pointer to array with two different constructor
initializing pointer to array with two different constructor
I have a program in which i want to initialize an array of class objects
using pointer.
class xyz{};
cin<<M;
xyz *a=new xyz[M]; //this will call the constructor for each object.
the problem is that i have two constructor in class xyz. i want to
initialize last two element using other constructor, not the default one
with no arguments. how can i do this?
i want M+1'th and M+2'th term to be initialized by different constructor
that accepts argument.
I have a program in which i want to initialize an array of class objects
using pointer.
class xyz{};
cin<<M;
xyz *a=new xyz[M]; //this will call the constructor for each object.
the problem is that i have two constructor in class xyz. i want to
initialize last two element using other constructor, not the default one
with no arguments. how can i do this?
i want M+1'th and M+2'th term to be initialized by different constructor
that accepts argument.
C# Button carries information saved in a textbox
C# Button carries information saved in a textbox
Textbox receive name and create button.
private void Adicionartxt_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Button c = new Button();
c.Location = new Point(15, x);
c.Text = Adicionartxt.Text; //here comes with the button
name, need textbox receives the name and create a button
with the name of the textbox.
panel1.Controls.Add(c);
Adicionartxt.Clear();
Adicionartxt.Visible = false;
x += 10 + c.Size.Height;
}
}
How do I get the button press information saved from a textbox?
Make array?
Textbox receive name and create button.
private void Adicionartxt_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Button c = new Button();
c.Location = new Point(15, x);
c.Text = Adicionartxt.Text; //here comes with the button
name, need textbox receives the name and create a button
with the name of the textbox.
panel1.Controls.Add(c);
Adicionartxt.Clear();
Adicionartxt.Visible = false;
x += 10 + c.Size.Height;
}
}
How do I get the button press information saved from a textbox?
Make array?
Slidetoggle on dynamic content
Slidetoggle on dynamic content
I am working on jquery and I am trying to use slideToggle on dynamic
content but I cannot make it up slide. How could make it work properly? I
will provide you the http://jsfiddle.net/P3WaC/
<li class="pull-right">
<div class="text-righ padding-right">
<div class="chart">My cart (<span class="item_cart">3</span>)</div>
<button class="btn btn-warning">CHECKOUT</button>
<input type="text" class="input-large light-panel active-tab-search"
placeholder="Search rewards">
</div>
<div id="cart-info" style="display: none;">
<div id="each-2" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">20</span>
</div><span>Quantity: </span><span class="shopp-quantity">2</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
<div id="each-3" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">10</span>
</div><span>Quantity: </span><span class="shopp-quantity">1</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
</div>
$('.pull-right').on('click',function(){
alert( $('#cart-info').text());
$('#cart-info').slideToggle('slow');
});
The dynamic content is under cart-info. I want to display the items and
hide them accordingly.
I am working on jquery and I am trying to use slideToggle on dynamic
content but I cannot make it up slide. How could make it work properly? I
will provide you the http://jsfiddle.net/P3WaC/
<li class="pull-right">
<div class="text-righ padding-right">
<div class="chart">My cart (<span class="item_cart">3</span>)</div>
<button class="btn btn-warning">CHECKOUT</button>
<input type="text" class="input-large light-panel active-tab-search"
placeholder="Search rewards">
</div>
<div id="cart-info" style="display: none;">
<div id="each-2" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">20</span>
</div><span>Quantity: </span><span class="shopp-quantity">2</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
<div id="each-3" class="shopp" style="display: none;">
<div class="label">Gift voucher</div>
<div class="shopp-price">$<span class="itempr">10</span>
</div><span>Quantity: </span><span class="shopp-quantity">1</span>
<img src="../img/erop/remove.png" class="remove">
<br class="all">
</div>
</div>
$('.pull-right').on('click',function(){
alert( $('#cart-info').text());
$('#cart-info').slideToggle('slow');
});
The dynamic content is under cart-info. I want to display the items and
hide them accordingly.
Haskell: removing specific duplicates that are next to each other from a string
Haskell: removing specific duplicates that are next to each other from a
string
I would like to know how to remove specific duplicates from a string. An
example would be:
"|Hello|| My|| Name|| Is|| XYZ|"
Should become:
"|Hello| My| Name| Is| XYZ|"
Thanks
string
I would like to know how to remove specific duplicates from a string. An
example would be:
"|Hello|| My|| Name|| Is|| XYZ|"
Should become:
"|Hello| My| Name| Is| XYZ|"
Thanks
uiimage apply filters like TOPAZ plugin in photoshop
uiimage apply filters like TOPAZ plugin in photoshop
I need suggestions over how can i apply filters like topaz plugin in
photoshop to my uiimage in iphone application. I dont even know whether it
is possible or not. Is this possible using coreimage framework. Any king
of help will be appreciated.
I need suggestions over how can i apply filters like topaz plugin in
photoshop to my uiimage in iphone application. I dont even know whether it
is possible or not. Is this possible using coreimage framework. Any king
of help will be appreciated.
Tuesday, 17 September 2013
Git list : viewing git repositories in home folder
Git list : viewing git repositories in home folder
I have installed GitList for repository view of my git repositories.
However, GitList lists only the repositories created inside the directory
"/var/www/html". I have other git repositories in my home folder e.g.,
/home/myhome/public, but unable to view them with GitList even after
changing gitlist/config.ini. Have I missed out anything for not getting
/home folders in gitlist? Any help??
I have installed GitList for repository view of my git repositories.
However, GitList lists only the repositories created inside the directory
"/var/www/html". I have other git repositories in my home folder e.g.,
/home/myhome/public, but unable to view them with GitList even after
changing gitlist/config.ini. Have I missed out anything for not getting
/home folders in gitlist? Any help??
Implementing Window Azure Cloud Services Web Role With Shared Cache Dedicated Roles?
Implementing Window Azure Cloud Services Web Role With Shared Cache
Dedicated Roles?
We(our company) is hosting a asp.net C# Cloud Services with a Web Role for
a Reporting WebSites. Unfortunately, usage of the reporting Website is
growth that original is only hosting with Medium Size VM and find out its
having a memory leak that cause the Cloud Services is always down and stop
working. End up we move to A7 VM(Okay, thats expensive) that solved our
problem for 2-3 month.Somehow, new stuff develop new function develop that
end up the memory is more than enough(its 56GB RAM) but the process is not
really can fulfilled such expensive usage in the same time.
Looking for solution on the web and found out there was a shared cache
that can be used. We decided to move from A7 to XM VM (A7 not supported
shared cache) and with a Dedicated Roles For Shared cahce.
What we wish to achieve is load balance between few instances(if one down,
it will redirect to another instances) and having the dedicated roles
stored all of our session stuff.Am i going the correct direction for this?
And if yes, how to achieve this? I look into this and is that really need
to sign up a preview program for cache services for using this?
Appreciate for the advice and please point out my mistake if any.
Dedicated Roles?
We(our company) is hosting a asp.net C# Cloud Services with a Web Role for
a Reporting WebSites. Unfortunately, usage of the reporting Website is
growth that original is only hosting with Medium Size VM and find out its
having a memory leak that cause the Cloud Services is always down and stop
working. End up we move to A7 VM(Okay, thats expensive) that solved our
problem for 2-3 month.Somehow, new stuff develop new function develop that
end up the memory is more than enough(its 56GB RAM) but the process is not
really can fulfilled such expensive usage in the same time.
Looking for solution on the web and found out there was a shared cache
that can be used. We decided to move from A7 to XM VM (A7 not supported
shared cache) and with a Dedicated Roles For Shared cahce.
What we wish to achieve is load balance between few instances(if one down,
it will redirect to another instances) and having the dedicated roles
stored all of our session stuff.Am i going the correct direction for this?
And if yes, how to achieve this? I look into this and is that really need
to sign up a preview program for cache services for using this?
Appreciate for the advice and please point out my mistake if any.
ANTLR tokenizing works with space, but not without
ANTLR tokenizing works with space, but not without
I'm trying to figure out this bug. Currently, when I supply a few
different inputs, I get either the correct result, or the ANTLRWorks
debugger loops infinitely.
1) {v0, p1} = Infinite loop or mismatched token exception
2) {v0..v1} Works!
3) {v0,p1} Works? Why?! Notice the lack of space?
If anyone could help me understand why this is ambiguous, I'd really
appreciate it. I've tried changing operator precedence, and still, I
cannot get it to work the way I think it should. Thank you!
WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel =
HIDDEN; };
LEFTCURL : '{';
RIGHTCURL : '}';
REGISTER : ('v'|'p') NUMBER+;
REGISTERLIST : LEFTCURL REGISTER (',' REGISTER)* RIGHTCURL;
REGISTERANGE : LEFTCURL REGISTER '..' REGISTER RIGHTCURL;
I'm trying to figure out this bug. Currently, when I supply a few
different inputs, I get either the correct result, or the ANTLRWorks
debugger loops infinitely.
1) {v0, p1} = Infinite loop or mismatched token exception
2) {v0..v1} Works!
3) {v0,p1} Works? Why?! Notice the lack of space?
If anyone could help me understand why this is ambiguous, I'd really
appreciate it. I've tried changing operator precedence, and still, I
cannot get it to work the way I think it should. Thank you!
WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel =
HIDDEN; };
LEFTCURL : '{';
RIGHTCURL : '}';
REGISTER : ('v'|'p') NUMBER+;
REGISTERLIST : LEFTCURL REGISTER (',' REGISTER)* RIGHTCURL;
REGISTERANGE : LEFTCURL REGISTER '..' REGISTER RIGHTCURL;
Way to initialize static members in the header
Way to initialize static members in the header
Given is a class with a static member.
class BaseClass {
static std::string bstring;
}
String has obviously to be default-initialized outside of the class.
std::string BaseClass::bstring {"."};
If I include the above line in the header along with the class, I get a
symbol multiply defined error. It has to be defined in a separate cpp
file, even with include guards or pragma once.
Isn't there a way to define it in the header?
Given is a class with a static member.
class BaseClass {
static std::string bstring;
}
String has obviously to be default-initialized outside of the class.
std::string BaseClass::bstring {"."};
If I include the above line in the header along with the class, I get a
symbol multiply defined error. It has to be defined in a separate cpp
file, even with include guards or pragma once.
Isn't there a way to define it in the header?
Heroku app crashes but not locally
Heroku app crashes but not locally
Like the title says, it crashes on Heroku but not locally. I have the logs
but could not find anything to help to solve this problem.
I have created a new app but the problem still happening.
Thanks for any help
Thanks
2013-09-17T19:57:30.321689+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:502:in
`load_missing_constant'
2013-09-17T19:57:30.421184+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:192:in
`block in const_missing'
2013-09-17T19:57:30.525746+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in
`each'
2013-09-17T19:57:30.627736+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in
`const_missing'
2013-09-17T19:57:30.731831+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in
`block in constantize'
2013-09-17T19:57:30.834073+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`each'
2013-09-17T19:57:30.946532+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`constantize'
2013-09-17T19:57:31.050229+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:260:in
`safe_constantize'
2013-09-17T19:57:31.150334+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/core_ext/string/inflections.rb:66:in
`safe_constantize'
2013-09-17T19:57:30.896776+00:00 heroku[web.1]: Process exited with status 1
2013-09-17T19:57:31.249699+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:152:in
`_default_wrap_model'
2013-09-17T19:57:31.352109+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:169:in
`_set_wrapper_defaults'
2013-09-17T19:57:31.452516+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:133:in
`inherited'
2013-09-17T19:57:31.551705+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/railties/routes_helpers.rb:7:in
`block (2 levels) in with'
2013-09-17T19:57:31.653297+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/railties/paths.rb:7:in
`block (2 levels) in with'
2013-09-17T19:57:31.753252+00:00 app[web.1]: from
/app/app/controllers/transactions_controller.rb:1:in `<top (required)>'
2013-09-17T19:57:31.861462+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
`require'
2013-09-17T19:57:31.960869+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
`block in require'
2013-09-17T19:57:32.069402+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in
`load_dependency'
2013-09-17T19:57:32.174620+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/de
pendencies.rb:251:in `require'
2013-09-17T19:57:32.274194+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in
`require_or_load'
2013-09-17T19:57:32.378424+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in
`depend_on'
2013-09-17T19:57:32.491041+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in
`require_dependency'
2013-09-17T19:57:32.590884+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:439:in
`block (2 levels) in eager_load!'
2013-09-17T19:57:32.690300+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in
`each'
2013-09-17T19:57:32.792440+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in
`block in eager_load!'
2013-09-17T19:57:32.894084+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in
`each'
2013-09-17T19:57:32.998078+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in
`eager_load!'
2013-09-17T19:57:33.098174+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in
`block in <module:Finisher>'
2013-09-17T19:57:33.216015+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
`instance_exec'
2013-09-17T19:57:33.315561+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
`run'
2013-09-17T19:57:33.414650+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in
`block in run_initializers'
2013-09-17T19:57:30.905790+00:00 heroku[web.1]: State changed from
starting to crashed
2013-09-17T19:57:33.522645+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
`each'
2013-09-17T19:57:33.628948+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
`run_initializers'
2013-09-17T19:57:33.734915+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in
`initialize!'
2013-09-17T19:57:33.834196+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
`method_missing'
2013-09-17T19:57:33.936142+00:00 app[web.1]: from
/app/config/environment.rb:6:in `<top (required)>'
2013-09-17T19:57:34.049350+00:00 app[web.1]: from config.ru:3:in `require'
2013-09-17T19:57:34.149198+00:00 app[web.1]: from config.ru:3:in `block
in <main>'
2013-09-17T19:57:34.249144+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`instance_eval'
2013-09-17T19:57:34.353380+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`initialize'
2013-09-17T19:57:34.458307+00:00 app[web.1]: from config.ru:1:in `new'
2013-09-17T19:57:34.569933+00:00 app[web.1]: from config.ru:1:in `<main>'
2013-09-17T19:57:34.680046+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in
`eval'
2013-09-17T19:57:34.783725+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in
`load'
2013-09-17T19:57:34.890167+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in
`load_rackup_config'
2013-09-17T19:57:34.993094+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in
`start'
2013-09-17T19:57:35.098098+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:187:in
`run_command'
2013-09-17T19:57:35.197156+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:152:in
`run!'
2013-09-17T19:57:35.299810+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/bin/thin:6:in `<top
(required)>'
Like the title says, it crashes on Heroku but not locally. I have the logs
but could not find anything to help to solve this problem.
I have created a new app but the problem still happening.
Thanks for any help
Thanks
2013-09-17T19:57:30.321689+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:502:in
`load_missing_constant'
2013-09-17T19:57:30.421184+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:192:in
`block in const_missing'
2013-09-17T19:57:30.525746+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in
`each'
2013-09-17T19:57:30.627736+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:190:in
`const_missing'
2013-09-17T19:57:30.731831+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in
`block in constantize'
2013-09-17T19:57:30.834073+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`each'
2013-09-17T19:57:30.946532+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:229:in
`constantize'
2013-09-17T19:57:31.050229+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:260:in
`safe_constantize'
2013-09-17T19:57:31.150334+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/core_ext/string/inflections.rb:66:in
`safe_constantize'
2013-09-17T19:57:30.896776+00:00 heroku[web.1]: Process exited with status 1
2013-09-17T19:57:31.249699+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:152:in
`_default_wrap_model'
2013-09-17T19:57:31.352109+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:169:in
`_set_wrapper_defaults'
2013-09-17T19:57:31.452516+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:133:in
`inherited'
2013-09-17T19:57:31.551705+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/abstract_controller/railties/routes_helpers.rb:7:in
`block (2 levels) in with'
2013-09-17T19:57:31.653297+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/actionpack-3.2.13/lib/action_controller/railties/paths.rb:7:in
`block (2 levels) in with'
2013-09-17T19:57:31.753252+00:00 app[web.1]: from
/app/app/controllers/transactions_controller.rb:1:in `<top (required)>'
2013-09-17T19:57:31.861462+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
`require'
2013-09-17T19:57:31.960869+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in
`block in require'
2013-09-17T19:57:32.069402+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in
`load_dependency'
2013-09-17T19:57:32.174620+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/de
pendencies.rb:251:in `require'
2013-09-17T19:57:32.274194+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:359:in
`require_or_load'
2013-09-17T19:57:32.378424+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:313:in
`depend_on'
2013-09-17T19:57:32.491041+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in
`require_dependency'
2013-09-17T19:57:32.590884+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:439:in
`block (2 levels) in eager_load!'
2013-09-17T19:57:32.690300+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in
`each'
2013-09-17T19:57:32.792440+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in
`block in eager_load!'
2013-09-17T19:57:32.894084+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in
`each'
2013-09-17T19:57:32.998078+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in
`eager_load!'
2013-09-17T19:57:33.098174+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in
`block in <module:Finisher>'
2013-09-17T19:57:33.216015+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
`instance_exec'
2013-09-17T19:57:33.315561+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in
`run'
2013-09-17T19:57:33.414650+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in
`block in run_initializers'
2013-09-17T19:57:30.905790+00:00 heroku[web.1]: State changed from
starting to crashed
2013-09-17T19:57:33.522645+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
`each'
2013-09-17T19:57:33.628948+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in
`run_initializers'
2013-09-17T19:57:33.734915+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in
`initialize!'
2013-09-17T19:57:33.834196+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in
`method_missing'
2013-09-17T19:57:33.936142+00:00 app[web.1]: from
/app/config/environment.rb:6:in `<top (required)>'
2013-09-17T19:57:34.049350+00:00 app[web.1]: from config.ru:3:in `require'
2013-09-17T19:57:34.149198+00:00 app[web.1]: from config.ru:3:in `block
in <main>'
2013-09-17T19:57:34.249144+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`instance_eval'
2013-09-17T19:57:34.353380+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in
`initialize'
2013-09-17T19:57:34.458307+00:00 app[web.1]: from config.ru:1:in `new'
2013-09-17T19:57:34.569933+00:00 app[web.1]: from config.ru:1:in `<main>'
2013-09-17T19:57:34.680046+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in
`eval'
2013-09-17T19:57:34.783725+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in
`load'
2013-09-17T19:57:34.890167+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in
`load_rackup_config'
2013-09-17T19:57:34.993094+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in
`start'
2013-09-17T19:57:35.098098+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:187:in
`run_command'
2013-09-17T19:57:35.197156+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:152:in
`run!'
2013-09-17T19:57:35.299810+00:00 app[web.1]: from
/app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/bin/thin:6:in `<top
(required)>'
Sunday, 15 September 2013
What is the benefit of '#pragma omp master' as opposed to '#pragma omp single'?
What is the benefit of '#pragma omp master' as opposed to '#pragma omp
single'?
In OpenMP any code inside a #pragma omp master directive is executed by a
single thread (the master), without an implied barrier at the region. LLNL
OpenMP tutorial
This seems equivalent to #pragma omp single nowait (with the exception
that rather than the 'master', any thread may execute the single region).
Under what circumstances, if any, is it beneficial to use #pragma omp master?
single'?
In OpenMP any code inside a #pragma omp master directive is executed by a
single thread (the master), without an implied barrier at the region. LLNL
OpenMP tutorial
This seems equivalent to #pragma omp single nowait (with the exception
that rather than the 'master', any thread may execute the single region).
Under what circumstances, if any, is it beneficial to use #pragma omp master?
Elastic Auto Resizing UL List Item Widths
Elastic Auto Resizing UL List Item Widths
I have a navigation bar as a list and I'd like to make it so that when I
make the width of the browser window smaller, the list items get closer
together before things get so small that they need to jump to the next
line.
#navigation-links {
color:white;
height:48px;
width:auto;
//line-height:48px;
float:right; // must float right
}
#navigation-links ul {
list-style-type: none;
margin-top: 19px;
}
#navigation-links li {
display: inline;
float:left;
min-width: 40px;
width: auto;
}
#navigation-links a {
font-weight: normal;
font-size: 14pt;
margin-left: 20px;
margin-right: 20px;
color: white;
text-decoration: none;
}
<div id="navigation-links">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</div>
I have a navigation bar as a list and I'd like to make it so that when I
make the width of the browser window smaller, the list items get closer
together before things get so small that they need to jump to the next
line.
#navigation-links {
color:white;
height:48px;
width:auto;
//line-height:48px;
float:right; // must float right
}
#navigation-links ul {
list-style-type: none;
margin-top: 19px;
}
#navigation-links li {
display: inline;
float:left;
min-width: 40px;
width: auto;
}
#navigation-links a {
font-weight: normal;
font-size: 14pt;
margin-left: 20px;
margin-right: 20px;
color: white;
text-decoration: none;
}
<div id="navigation-links">
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</div>
Bing Search API C# Sample Code not working
Bing Search API C# Sample Code not working
Has anyone got the Bing API C# Sample code working? I am referring the Web
Examples on this page:
https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822!112&app=Word&authkey=!ANNnJQREB0kDC04
I'm also using the BingSearchContainer.cs file string rootUri =
"https://api.datamarket.azure.com/Bing/Search";
var bingContainer = new Bing.BingSearchContainer(new Uri(rootUri));
var accountKey = "Zasjkdhfkajshdfkjhasdkfjhetc";
bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);
// Build the query:
// Example says "var webQuery = .... I just tried this
DataServiceQuery<WebResult> webQuery = bingContainer.Web("Testing", null,
null, null, null, null, null, null);
// This returns a 403
// Example says "var results = .... I just tried this too...
IEnumerable<WebResult> results = webQuery.Execute();
I also tried things like:
bingContainer.IgnoreMissingProperties = true;
... but that made no difference...
Thank you.
Has anyone got the Bing API C# Sample code working? I am referring the Web
Examples on this page:
https://skydrive.live.com/view.aspx?resid=9C9479871FBFA822!112&app=Word&authkey=!ANNnJQREB0kDC04
I'm also using the BingSearchContainer.cs file string rootUri =
"https://api.datamarket.azure.com/Bing/Search";
var bingContainer = new Bing.BingSearchContainer(new Uri(rootUri));
var accountKey = "Zasjkdhfkajshdfkjhasdkfjhetc";
bingContainer.Credentials = new NetworkCredential(accountKey, accountKey);
// Build the query:
// Example says "var webQuery = .... I just tried this
DataServiceQuery<WebResult> webQuery = bingContainer.Web("Testing", null,
null, null, null, null, null, null);
// This returns a 403
// Example says "var results = .... I just tried this too...
IEnumerable<WebResult> results = webQuery.Execute();
I also tried things like:
bingContainer.IgnoreMissingProperties = true;
... but that made no difference...
Thank you.
Hide keyword field in trac
Hide keyword field in trac
Description
Ticket input field could be hidden in trac. I have tried to accomplish
this via the trac ticket template, without success.
Description
Ticket input field could be hidden in trac. I have tried to accomplish
this via the trac ticket template, without success.
Find control by id in a UserControl structure
Find control by id in a UserControl structure
The situations (Not mike the douchebag) :
I have a multitudes of UserControls it inherit from one parent.
On the parent Page_Load, I want to find a specific control from the child
UserControl and add it an Attributes.
The problem is I never know the structure of the child UserControl.
I tried to use a recursive method to find the control by id :
public static Control FindControlRecursive(Control root, string id)
{
if (root.ID == id)
return root;
return root.Controls.Cast<Control>()
.Select(c => FindControlRecursive(c, id))
.FirstOrDefault(c => c != null);
}
And this is how I call it from the parent:
Page page = HttpContext.Current.Handler as Page;
var mycontrol = FindControlRecursive(page, "id_x");
if (mycontrol != null)
{
string test = "";
}
But I don't work. I am really not sure if this is a good way to achieve my
goal. Please, I want to know if you have any suggestions or better way to
do it. Your help will be highly appreciated.
The situations (Not mike the douchebag) :
I have a multitudes of UserControls it inherit from one parent.
On the parent Page_Load, I want to find a specific control from the child
UserControl and add it an Attributes.
The problem is I never know the structure of the child UserControl.
I tried to use a recursive method to find the control by id :
public static Control FindControlRecursive(Control root, string id)
{
if (root.ID == id)
return root;
return root.Controls.Cast<Control>()
.Select(c => FindControlRecursive(c, id))
.FirstOrDefault(c => c != null);
}
And this is how I call it from the parent:
Page page = HttpContext.Current.Handler as Page;
var mycontrol = FindControlRecursive(page, "id_x");
if (mycontrol != null)
{
string test = "";
}
But I don't work. I am really not sure if this is a good way to achieve my
goal. Please, I want to know if you have any suggestions or better way to
do it. Your help will be highly appreciated.
angular-ui select2 can not have multiple input with select2Options in same controller
angular-ui select2 can not have multiple input with select2Options in same
controller
I am using select2 from https://github.com/angular-ui/ui-select2
// I have two input select2 box inside one controller
<form ng-controller="MyCtrl">
<input
type="text"
ui-select2="select2Options"
ng-model="bookmarks"
>
<input
type="text"
ui-select2="select2Options"
ng-model="products"
>
</form>
//In controller I have list of bookmarks and products I am trying
something like below but it is not working and both the input box
ended up with same data i.e. products.
function MyCtrl($scope){
var bookmarks=[
{id:0,text:"enhancement"},
{id:1,text:"bug"},
{id:2,text:"duplicate"},
{id:3,text:"invalid"},
{id:4,text:"wontfix"}
];
$scope.select2Options = {
multiple: true,
width: "300px",
data:bookmarks
};
var products=[
{id:0,text:"Product1"},
{id:1,text:"Product2"},
{id:2,text:"Product3"},
{id:3,text:"Product4"},
{id:4,text:"Product5"}
];
$scope.select2Options = {
multiple: true,
width: "300px",
data:products
};
}
As you see above code will convert two input box in to select2 input boxes
but both box will have products data. I want bookmark input box filled
with bookmarks and product input box with products.
controller
I am using select2 from https://github.com/angular-ui/ui-select2
// I have two input select2 box inside one controller
<form ng-controller="MyCtrl">
<input
type="text"
ui-select2="select2Options"
ng-model="bookmarks"
>
<input
type="text"
ui-select2="select2Options"
ng-model="products"
>
</form>
//In controller I have list of bookmarks and products I am trying
something like below but it is not working and both the input box
ended up with same data i.e. products.
function MyCtrl($scope){
var bookmarks=[
{id:0,text:"enhancement"},
{id:1,text:"bug"},
{id:2,text:"duplicate"},
{id:3,text:"invalid"},
{id:4,text:"wontfix"}
];
$scope.select2Options = {
multiple: true,
width: "300px",
data:bookmarks
};
var products=[
{id:0,text:"Product1"},
{id:1,text:"Product2"},
{id:2,text:"Product3"},
{id:3,text:"Product4"},
{id:4,text:"Product5"}
];
$scope.select2Options = {
multiple: true,
width: "300px",
data:products
};
}
As you see above code will convert two input box in to select2 input boxes
but both box will have products data. I want bookmark input box filled
with bookmarks and product input box with products.
loadUrl and catch outgoing request headers
loadUrl and catch outgoing request headers
I want to laod the url and catch the outgoing headers that are sent with
http request, in a single request because my server accepts only one
request.
Is there any way to do this?
Right now i am loading url with webView.laodUrl() and catching headers in
another functions i-e; 2 functions right now but i want to be done in 1
funtion.
Below is what i am doing in 2 requests:
wv.loadUrl("http://" + url); /// This is First request.
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(aURL);
Header headers[] = httpget.getAllHeaders();
for(Header h : headers)
{
//something here...
}
HttpResponse response = null;
try
{
response = httpclient.execute(httpget); /// This is second request
}
catch (Exception e)
{
e.printStackTrace();
}
HttpEntity entity = response.getEntity();
headers = response.getAllHeaders();
String str_headers = "";
for(Header h : headers)
{
str_headers += h.getName() + ": " + h.getValue();
}
Kindly give me suggestions if any..
Thanks
I want to laod the url and catch the outgoing headers that are sent with
http request, in a single request because my server accepts only one
request.
Is there any way to do this?
Right now i am loading url with webView.laodUrl() and catching headers in
another functions i-e; 2 functions right now but i want to be done in 1
funtion.
Below is what i am doing in 2 requests:
wv.loadUrl("http://" + url); /// This is First request.
HttpClient httpclient = new DefaultHttpClient();
HttpGet httpget = new HttpGet(aURL);
Header headers[] = httpget.getAllHeaders();
for(Header h : headers)
{
//something here...
}
HttpResponse response = null;
try
{
response = httpclient.execute(httpget); /// This is second request
}
catch (Exception e)
{
e.printStackTrace();
}
HttpEntity entity = response.getEntity();
headers = response.getAllHeaders();
String str_headers = "";
for(Header h : headers)
{
str_headers += h.getName() + ": " + h.getValue();
}
Kindly give me suggestions if any..
Thanks
Saturday, 14 September 2013
image width not showing exact value
image width not showing exact value
I'm trying to get the width of the image but it's alerting zero.
var $curimg = $('#banner').find('.img1');
alert($curimg.Width()); // alerts 0
As I'm working on a slider which is scrolling images so it is confusing
for me what wrong with the width of image.
I'm trying to get the width of the image but it's alerting zero.
var $curimg = $('#banner').find('.img1');
alert($curimg.Width()); // alerts 0
As I'm working on a slider which is scrolling images so it is confusing
for me what wrong with the width of image.
Does Git Branch creates NEW files?
Does Git Branch creates NEW files?
I have a folder with a Linked List implementation that right now caters
only to integers. I have tested it, and it works perfect. Now next
morning, my boss comes up, and tells me that I need to update my
implementation so that it can now work with any datatype.
Now before I proceed to edit my code, I create a new git branch called
_test_templates, switch to this new branch with git checkout, and start
experimenting. After sometime, I realize my code is not working and I
think I will start again from scratch. I switch back to Master, and delete
my _test_templates branch.
But here is what confuses me: The changes I had made to my Node.h,
Node.cpp, LinkedList.h, LinkedList.cpp, and main.cpp within my
_templates_test branch are present in master branch too.
Why? Wasn't I working in a totally new temporary space called a branch
independent of master?
I have a folder with a Linked List implementation that right now caters
only to integers. I have tested it, and it works perfect. Now next
morning, my boss comes up, and tells me that I need to update my
implementation so that it can now work with any datatype.
Now before I proceed to edit my code, I create a new git branch called
_test_templates, switch to this new branch with git checkout, and start
experimenting. After sometime, I realize my code is not working and I
think I will start again from scratch. I switch back to Master, and delete
my _test_templates branch.
But here is what confuses me: The changes I had made to my Node.h,
Node.cpp, LinkedList.h, LinkedList.cpp, and main.cpp within my
_templates_test branch are present in master branch too.
Why? Wasn't I working in a totally new temporary space called a branch
independent of master?
Eclipse (CDT) can't resolve variables?
Eclipse (CDT) can't resolve variables?
I'm currently trying to program some OpenGL stuff, but Eclipse is acting
strangely.
For some reason, this works:
glClear(GL_COLOR_BUFFER_BIT)
and this too:
glClear(GL_DEPTH_BUFFER_BIT)
but eclipse says it can't resolve the individual enums here:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
Any ideas as to why this is happening? The program compiles and runs just
fine despite the error indicated by eclipse. Is there some configuration I
can change?
I'm currently trying to program some OpenGL stuff, but Eclipse is acting
strangely.
For some reason, this works:
glClear(GL_COLOR_BUFFER_BIT)
and this too:
glClear(GL_DEPTH_BUFFER_BIT)
but eclipse says it can't resolve the individual enums here:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
Any ideas as to why this is happening? The program compiles and runs just
fine despite the error indicated by eclipse. Is there some configuration I
can change?
Deleting ListView item from list and SharedPreferences
Deleting ListView item from list and SharedPreferences
I've looked around, and there are some similar questions, but none with a
working solution.
I've created a simple ListView to take input from an EditText and display
it in a list on button click. If a list item is clicked, I have a dialog
popup and ask for confirmation to delete. When "yes" is clicked, the item
appears to delete. Though if I then try to delete another item, that item
will delete, but the previous item will reappear in its place. I have no
idea how to solve this problem. From my limited understanding it seems as
though the item is never deleted from SharedPreferences, and when I load
them again on the next "onClick", the old item appears again. Though I've
tried clearing SharedPreferences and then saving them after deleting,
which did not work.
package com.example.send2omni;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.AndroidCharacter;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContextsList extends Activity {
public static final String CONTEXTS = "contexts_list";
EditText display;
ListView lv;
public ArrayAdapter<String> adapter;
Button addButton;
String temp_appender;
String appender = "";
List<String> dataset;
String[] splitup;
public String items;
ArrayList<String> itemsarraylist;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contexts_list);
display = (EditText) findViewById(R.id.editText);
lv = (ListView) findViewById(R.id.listView);
addButton = (Button) findViewById(R.id.bAdd);
LoadPreferences();
lv.setAdapter(adapter);
LoadPreferences();
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
appender = LoadPreferences();
if(display.getText().toString() != null){
temp_appender = display.getText().toString();
String string_to_split = appender + "," + temp_appender;
List<String> items =
Arrays.asList(string_to_split.split(","));
adapter = new ArrayAdapter<String>
(getApplicationContext(), android.R.layout.simple_list_item_1, items);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
SavePreferences("LISTS", string_to_split, null);
LoadPreferences();
}
display.setText("");
}
});
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
deleteItem(arg1);
}
});
}
protected void deleteItem(final View arg1)
{
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Delete");
dialogBuilder.setMessage
("Do you want to delete \"" + ((TextView) arg1).getText() + "\"?");
dialogBuilder.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String splitit = LoadPreferences();
List<String> listit = Arrays.asList(splitit.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <listit.size(); i++){
itemsarraylist.add(i, listit.get(i));
}
try {
adapter.remove(((TextView) arg1).getText().toString());
adapter.notifyDataSetChanged();
itemsarraylist.remove(((TextView)
arg1).getText().toString());
try{
SavePreferences("LISTS", null, itemsarraylist);
}catch(Exception e){
}
} catch (Exception e) {
Log.e("remove", "failed");
}
}
});
dialogBuilder.setNeutralButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog deleteDialog = dialogBuilder.create();
deleteDialog.show();
}
protected void SavePreferences(String key, String value, ArrayList<String>
opt) {
// TODO Auto-generated method stub
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
if (opt != null){
for (int i = 0 ; i <= opt.size(); i++)
value += opt.get(i) + ",";
}
SharedPreferences.Editor editor = data.edit();
editor.putString(key, value);
editor.commit();
}
protected String LoadPreferences(){
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
String dataSet = data.getString("LISTS", "");
dataset = Arrays.asList(dataSet.split(","));
splitup = dataSet.split(",");
List<String> items = Arrays.asList(dataSet.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <items.size(); i++){
itemsarraylist.add(i, items.get(i));
}
adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, itemsarraylist);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
return dataSet;
}
}
I've included all the code from the class, just in case you have the time
to try it out in your IDE, and because the working part may be useful to
other beginners.
I can't express how grateful I'd be if anyone could help me fix this. It's
pretty much the last step I have to take before completing my first app,
and I'm really not looking forward to having to learn SQLite just to save
a list of strings.
Thanks for your time everyone..
I've looked around, and there are some similar questions, but none with a
working solution.
I've created a simple ListView to take input from an EditText and display
it in a list on button click. If a list item is clicked, I have a dialog
popup and ask for confirmation to delete. When "yes" is clicked, the item
appears to delete. Though if I then try to delete another item, that item
will delete, but the previous item will reappear in its place. I have no
idea how to solve this problem. From my limited understanding it seems as
though the item is never deleted from SharedPreferences, and when I load
them again on the next "onClick", the old item appears again. Though I've
tried clearing SharedPreferences and then saving them after deleting,
which did not work.
package com.example.send2omni;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.AndroidCharacter;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContextsList extends Activity {
public static final String CONTEXTS = "contexts_list";
EditText display;
ListView lv;
public ArrayAdapter<String> adapter;
Button addButton;
String temp_appender;
String appender = "";
List<String> dataset;
String[] splitup;
public String items;
ArrayList<String> itemsarraylist;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.contexts_list);
display = (EditText) findViewById(R.id.editText);
lv = (ListView) findViewById(R.id.listView);
addButton = (Button) findViewById(R.id.bAdd);
LoadPreferences();
lv.setAdapter(adapter);
LoadPreferences();
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
appender = LoadPreferences();
if(display.getText().toString() != null){
temp_appender = display.getText().toString();
String string_to_split = appender + "," + temp_appender;
List<String> items =
Arrays.asList(string_to_split.split(","));
adapter = new ArrayAdapter<String>
(getApplicationContext(), android.R.layout.simple_list_item_1, items);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
SavePreferences("LISTS", string_to_split, null);
LoadPreferences();
}
display.setText("");
}
});
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
deleteItem(arg1);
}
});
}
protected void deleteItem(final View arg1)
{
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
dialogBuilder.setTitle("Delete");
dialogBuilder.setMessage
("Do you want to delete \"" + ((TextView) arg1).getText() + "\"?");
dialogBuilder.setPositiveButton("Yes", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String splitit = LoadPreferences();
List<String> listit = Arrays.asList(splitit.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <listit.size(); i++){
itemsarraylist.add(i, listit.get(i));
}
try {
adapter.remove(((TextView) arg1).getText().toString());
adapter.notifyDataSetChanged();
itemsarraylist.remove(((TextView)
arg1).getText().toString());
try{
SavePreferences("LISTS", null, itemsarraylist);
}catch(Exception e){
}
} catch (Exception e) {
Log.e("remove", "failed");
}
}
});
dialogBuilder.setNeutralButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
AlertDialog deleteDialog = dialogBuilder.create();
deleteDialog.show();
}
protected void SavePreferences(String key, String value, ArrayList<String>
opt) {
// TODO Auto-generated method stub
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
if (opt != null){
for (int i = 0 ; i <= opt.size(); i++)
value += opt.get(i) + ",";
}
SharedPreferences.Editor editor = data.edit();
editor.putString(key, value);
editor.commit();
}
protected String LoadPreferences(){
SharedPreferences data =
PreferenceManager.getDefaultSharedPreferences(this);
String dataSet = data.getString("LISTS", "");
dataset = Arrays.asList(dataSet.split(","));
splitup = dataSet.split(",");
List<String> items = Arrays.asList(dataSet.split(","));
ArrayList<String> itemsarraylist = new ArrayList<String>();
for(int i = 0; i <items.size(); i++){
itemsarraylist.add(i, items.get(i));
}
adapter = new ArrayAdapter<String>
(this, android.R.layout.simple_list_item_1, itemsarraylist);
lv.setAdapter(adapter);
adapter.notifyDataSetChanged();
return dataSet;
}
}
I've included all the code from the class, just in case you have the time
to try it out in your IDE, and because the working part may be useful to
other beginners.
I can't express how grateful I'd be if anyone could help me fix this. It's
pretty much the last step I have to take before completing my first app,
and I'm really not looking forward to having to learn SQLite just to save
a list of strings.
Thanks for your time everyone..
php vs nodejs vs java
php vs nodejs vs java
My question is, if you have a machine, after how many pageloads per second
would you have to add another machine to reduce the load on the first
machine? Would it be let's say 100 pageloads with php and for the same
machine 1000 pageloads with nodejs and again for the same machine 100000
pageloads with java. I would have a medium machine and optimized code for
either language. I'm not asking for opinions neither vague data just for
the ratio between the languages. Is it for example 1 to 10?
My question is, if you have a machine, after how many pageloads per second
would you have to add another machine to reduce the load on the first
machine? Would it be let's say 100 pageloads with php and for the same
machine 1000 pageloads with nodejs and again for the same machine 100000
pageloads with java. I would have a medium machine and optimized code for
either language. I'm not asking for opinions neither vague data just for
the ratio between the languages. Is it for example 1 to 10?
Get number of a given day in a month
Get number of a given day in a month
Is there a way to get the number of a given week days in a period (month),
other than iterating over the days in the month?
For example get the number of Mondays in January.
Is there a way to get the number of a given week days in a period (month),
other than iterating over the days in the month?
For example get the number of Mondays in January.
Linked CSS-document is shown as inline css in developer tools. what's wrong?
Linked CSS-document is shown as inline css in developer tools. what's wrong?
the page i am talking about is here: http://fc-suebia.de/trikotbestellung/
In my html-document i link to an "extern" css-document.
<link rel="stylesheet" href="styles.css" type="text/css" />
But in the developer tools and in the source code the styles are shown to
me as "inline"-stlyes. But they are not! what is wrong with my code?
the page i am talking about is here: http://fc-suebia.de/trikotbestellung/
In my html-document i link to an "extern" css-document.
<link rel="stylesheet" href="styles.css" type="text/css" />
But in the developer tools and in the source code the styles are shown to
me as "inline"-stlyes. But they are not! what is wrong with my code?
Google Fusion Tables Card Layout: How to format fields
Google Fusion Tables Card Layout: How to format fields
I have the following template:
{template .contents}
<div class='googft-card-view' style='font-family: sans-serif; height:
17em; width: 450px; padding: 4px; border: 1px solid #ccc; overflow:
hidden'>
<table border="0">
<tr>
<td>
<b>Village:</b> {$data.formatted.Village}<br>
<b>Location:</b> {$data.value.Location}<br>
<b>Location Accuracy:</b> {$data.value['Location:Accuracy']}
meters<br>
</td>
</table>
</div>
{/template}
Which gives me:
Village: TestVillage
Location:
<Point><coordinates>69.1782913000,34.5338741600,1787.5000000000</coordinates></Point>
Location Accuracy: 5.0 meters
I'd like to be able to get rid of the , tags, and format the values.
Javascript is disabled/stripped out in the card layout.
How can I manage this, if possible?
I have the following template:
{template .contents}
<div class='googft-card-view' style='font-family: sans-serif; height:
17em; width: 450px; padding: 4px; border: 1px solid #ccc; overflow:
hidden'>
<table border="0">
<tr>
<td>
<b>Village:</b> {$data.formatted.Village}<br>
<b>Location:</b> {$data.value.Location}<br>
<b>Location Accuracy:</b> {$data.value['Location:Accuracy']}
meters<br>
</td>
</table>
</div>
{/template}
Which gives me:
Village: TestVillage
Location:
<Point><coordinates>69.1782913000,34.5338741600,1787.5000000000</coordinates></Point>
Location Accuracy: 5.0 meters
I'd like to be able to get rid of the , tags, and format the values.
Javascript is disabled/stripped out in the card layout.
How can I manage this, if possible?
Friday, 13 September 2013
Download String from website to ListBox c#
Download String from website to ListBox c#
How to Download String from website to ListBox
i want download this string =
"http://www.cpalander.net/server/blacklist.txt" then transfer to Listbox.
Thanks in advance.
How to Download String from website to ListBox
i want download this string =
"http://www.cpalander.net/server/blacklist.txt" then transfer to Listbox.
Thanks in advance.
Facebook Java API other than restfb?
Facebook Java API other than restfb?
Hi I am using facebook login for my website. RestFB is convenient to
develop however it is really slow when I execute the below code
friends = facebookClient.fetchConnection("me/friends", FacebookUser.class,
Parameter.with("fields", "id, first_name, last_name, gender, education,
work, picture"));
It can take several seconds to minutes to load. Is there any other better
libraries that can do the same job faster?
Hi I am using facebook login for my website. RestFB is convenient to
develop however it is really slow when I execute the below code
friends = facebookClient.fetchConnection("me/friends", FacebookUser.class,
Parameter.with("fields", "id, first_name, last_name, gender, education,
work, picture"));
It can take several seconds to minutes to load. Is there any other better
libraries that can do the same job faster?
Background change using LinearGradient
Background change using LinearGradient
I'm programming in WPF(C#). I'm trying to define some thing to change skin
of program.
I use this code:
<LinearGradientBrush x:Key="AquaGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF6F6F6" Offset="1"/>
<GradientStop Color="#FFEAE8E8" Offset="1"/>
<GradientStop Color="#FFDCD9D9" Offset="1"/>
<GradientStop Color="#FF46AFBF" Offset="0.5"/>
<GradientStop Color="#FFE0DDDD"/>
<GradientStop Color="#FF4EDAF0" Offset="0.018"/>
<GradientStop Color="#FF75C2BF" Offset="0.964"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="GreenGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.082"/>
<GradientStop Color="#FFDDDDDD" Offset="0.071"/>
<GradientStop Color="#FF0FFB2F" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="YellowGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.082"/>
<GradientStop Color="#FFDDDDDD" Offset="0.071"/>
<GradientStop Color="#FFD0FB0F" Offset="1"/>
</LinearGradientBrush>
<Window.Resources>
how can I assign LinearGradientBrush to a control Background ? some thing
like this:
imageInsertUser.Background = GreenBackgroundGradient;
I'm programming in WPF(C#). I'm trying to define some thing to change skin
of program.
I use this code:
<LinearGradientBrush x:Key="AquaGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF6F6F6" Offset="1"/>
<GradientStop Color="#FFEAE8E8" Offset="1"/>
<GradientStop Color="#FFDCD9D9" Offset="1"/>
<GradientStop Color="#FF46AFBF" Offset="0.5"/>
<GradientStop Color="#FFE0DDDD"/>
<GradientStop Color="#FF4EDAF0" Offset="0.018"/>
<GradientStop Color="#FF75C2BF" Offset="0.964"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="GreenGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.082"/>
<GradientStop Color="#FFDDDDDD" Offset="0.071"/>
<GradientStop Color="#FF0FFB2F" Offset="1"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="YellowGradient" EndPoint="0,1"
StartPoint="0,0">
<GradientStop Color="#FFF3F3F3" Offset="0"/>
<GradientStop Color="#FFEBEBEB" Offset="0.082"/>
<GradientStop Color="#FFDDDDDD" Offset="0.071"/>
<GradientStop Color="#FFD0FB0F" Offset="1"/>
</LinearGradientBrush>
<Window.Resources>
how can I assign LinearGradientBrush to a control Background ? some thing
like this:
imageInsertUser.Background = GreenBackgroundGradient;
Where can I find Crystal Reports for Visual Studio 2008
Where can I find Crystal Reports for Visual Studio 2008
I am using Visual Studio 2008 Standard Edition. I have also installed
Visual Studio 2010 Ultimate Edition on my machine. I downloaded Crystal
Report Basic for Visual Studio 2008.
But whenever I tried to Add Crystal Report as a New Item, it gives me the
message saying "Invalid Keycode"
Please be kind enough to give me a solution or a link to download Crystal
Report for Visual Studio 2008
Thanks and regards.
I am using Visual Studio 2008 Standard Edition. I have also installed
Visual Studio 2010 Ultimate Edition on my machine. I downloaded Crystal
Report Basic for Visual Studio 2008.
But whenever I tried to Add Crystal Report as a New Item, it gives me the
message saying "Invalid Keycode"
Please be kind enough to give me a solution or a link to download Crystal
Report for Visual Studio 2008
Thanks and regards.
JSF Richfaces Calendar Css overide
JSF Richfaces Calendar Css overide
I display some data-tables on my jsf page, eventually I got my richfaces
calendar to work. but my data-table's css overrides the css of the
calendar so when my popup calendar opens it displays the whole page wide.
css:
table {
empty-cells: show;
width: 100%;
}
If I change the width to example 25% the calendar displays correctly but
then my data-tables looks horrible. Any suggestions?
I display some data-tables on my jsf page, eventually I got my richfaces
calendar to work. but my data-table's css overrides the css of the
calendar so when my popup calendar opens it displays the whole page wide.
css:
table {
empty-cells: show;
width: 100%;
}
If I change the width to example 25% the calendar displays correctly but
then my data-tables looks horrible. Any suggestions?
Thursday, 12 September 2013
Interfacing python with c++
Interfacing python with c++
I am trying to interface python with C++. I am using Visual Studio Express
2012. I also have an enthought python 2.7 distribution. When I tried to
build a Release on Win 32 for the following
#include "stdafx.h"
#include "C:/Python27/include/Python.h"
#include
"C:/Python27/Lib/site-packages/numpy/core/include/numpy/arrayobject.h"
using namespace std;
int main( int argc, char* argv[] )
{
int x = 1;
PyObject *mod1;
Py_Initialize();
return 0;
}
I get the following error,
Error 1 error LNK2001: unresolved external symbol _imp_Py_Initialize
Please help, any ideas more than welcome.
I am trying to interface python with C++. I am using Visual Studio Express
2012. I also have an enthought python 2.7 distribution. When I tried to
build a Release on Win 32 for the following
#include "stdafx.h"
#include "C:/Python27/include/Python.h"
#include
"C:/Python27/Lib/site-packages/numpy/core/include/numpy/arrayobject.h"
using namespace std;
int main( int argc, char* argv[] )
{
int x = 1;
PyObject *mod1;
Py_Initialize();
return 0;
}
I get the following error,
Error 1 error LNK2001: unresolved external symbol _imp_Py_Initialize
Please help, any ideas more than welcome.
Find Number of LineBreaks in String and Get Count of the LineBreaks in String C#
Find Number of LineBreaks in String and Get Count of the LineBreaks in
String C#
Could anyone please suggest how to find count of linebreaks in a string.
Current in the below example code I have two breaklines. So how can I
print showing number as 2
String Str = "Hello <br /> How are You <br />"
Thanks!
String C#
Could anyone please suggest how to find count of linebreaks in a string.
Current in the below example code I have two breaklines. So how can I
print showing number as 2
String Str = "Hello <br /> How are You <br />"
Thanks!
Uninitialised byte(s) Valgrind complaint - inexplicable
Uninitialised byte(s) Valgrind complaint - inexplicable
Valgrind has kept complaining about uninitialized bytes and by trimming
down in look for a minimal example I have ended up with this:
#include <valgrind/memcheck.h>
struct dummyObject{
int foo;
bool bar;
dummyObject():foo(1),bar(true) {}
};
int main(){
dummyObject dummy;
VALGRIND_CHECK_VALUE_IS_DEFINED(dummy);
return 0;
}
Having two ints or two bools, or a single int or bool, cause no
complaints. It looks as if having a class with members of different types
leads to Valgrind complaining. This is not simply due to my explicit
request for checking either; in a larger program where object similar to
dummyObject gets used, I 'm getting the "Conditional jump or move depends
on uninitialised value(s)" error.
My compiler is g++ 4.7.3 on a 64-bit linux, compiling with debug flags and
no optimizations - or with, it makes no difference.
Is there something I 'm missing, or is it a false positive?
Valgrind has kept complaining about uninitialized bytes and by trimming
down in look for a minimal example I have ended up with this:
#include <valgrind/memcheck.h>
struct dummyObject{
int foo;
bool bar;
dummyObject():foo(1),bar(true) {}
};
int main(){
dummyObject dummy;
VALGRIND_CHECK_VALUE_IS_DEFINED(dummy);
return 0;
}
Having two ints or two bools, or a single int or bool, cause no
complaints. It looks as if having a class with members of different types
leads to Valgrind complaining. This is not simply due to my explicit
request for checking either; in a larger program where object similar to
dummyObject gets used, I 'm getting the "Conditional jump or move depends
on uninitialised value(s)" error.
My compiler is g++ 4.7.3 on a 64-bit linux, compiling with debug flags and
no optimizations - or with, it makes no difference.
Is there something I 'm missing, or is it a false positive?
LINQ query has me baffled
LINQ query has me baffled
How would I write a LINQ query to do the following?
I have a database table with a schema like this:
ID - Int
Time - DateTime
RecordType - Int
Msg - String
I want to get the newest (using 'Time' field) record for each 'RecordType'
Another restriction is that I'm only interested in certain RecordTypes -
those contained in an int array.
The result of the query would be one record per RecordType - the newest
record for this type.
How would I write a LINQ query to do the following?
I have a database table with a schema like this:
ID - Int
Time - DateTime
RecordType - Int
Msg - String
I want to get the newest (using 'Time' field) record for each 'RecordType'
Another restriction is that I'm only interested in certain RecordTypes -
those contained in an int array.
The result of the query would be one record per RecordType - the newest
record for this type.
String values to boolean check
String values to boolean check
I have four string falgs get these values as string a[].
falg1 = Y or N
falg2= Y or N
falg3= Y or N
falg4= Y or N
Based on above falgs ,i am checking the below cases.Is it correct way of
doing it or do you have any better appraoch?
if (falg1.equals("Y")) {
if (falg2.equals("Y")) {
if (falg3.equals("Y") && falg4.equals("Y")) {
condition = true;
} else
condition = flase;
} else
return null;
} else
return null;
I have four string falgs get these values as string a[].
falg1 = Y or N
falg2= Y or N
falg3= Y or N
falg4= Y or N
Based on above falgs ,i am checking the below cases.Is it correct way of
doing it or do you have any better appraoch?
if (falg1.equals("Y")) {
if (falg2.equals("Y")) {
if (falg3.equals("Y") && falg4.equals("Y")) {
condition = true;
} else
condition = flase;
} else
return null;
} else
return null;
H323 PROTOCOL PACKET CAPTURE
H323 PROTOCOL PACKET CAPTURE
I would like to study h323 protocol in a practical way using wireshark.I
know it makes use of h225 and h245 protocols for communication purpose.Can
somebody help me how to have setup (just as we set ftp server and use ftp
client) so that i can get packets capture (using wireshark) belonging to
h323(h225 and h245) protocols.Even if somebody tell me the links to sample
pcap files belonging to h323(h225 and h245) protocol, it will be
fine.Thanks in advance.
I would like to study h323 protocol in a practical way using wireshark.I
know it makes use of h225 and h245 protocols for communication purpose.Can
somebody help me how to have setup (just as we set ftp server and use ftp
client) so that i can get packets capture (using wireshark) belonging to
h323(h225 and h245) protocols.Even if somebody tell me the links to sample
pcap files belonging to h323(h225 and h245) protocol, it will be
fine.Thanks in advance.
Reference Data is lost from Form when Validation Fails (Spring 3 MVC)
Reference Data is lost from Form when Validation Fails (Spring 3 MVC)
I am new to Spring I am having a page addContact,in that I am getting
dropDown Data from Database in the following way
@RequestMapping("/addContact")
public ModelAndView registerContact(@ModelAttribute Contact contact) {
List<ContactType> contactTypeList = contactdao.getContactTypeList();
Map<Integer,String> contactTypeSelect = new LinkedHashMap<Integer,String>();
Iterator<ContactType> iterator = contactTypeList.iterator();
while (iterator.hasNext()) {
ContactType ct = iterator.next();
contactTypeSelect.put(ct.getContactTypeId(),ct.getContactTypeName());
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("contactTypeSelect", contactTypeSelect);
return new ModelAndView("addContact", "map", map);
}
Now to Insert the Data into Database, I am having following method,
@RequestMapping("/insert")
public String insertData(@Valid Contact contact, BindingResult result,
HttpServletRequest request ) {
if (result.hasErrors()) {
return "addContact";
}
else {
HttpSession session = request.getSession();
session.setAttribute("path",
request.getSession().getServletContext().getRealPath("/WEB-INF"));
if (contact != null){
contactService.insertData(contact,request);
}
return "redirect:/getList";
}
}
When the validation fails, the drop down data is lost (which is obvious),
what is the correct way of achieving the validation.
I am new to Spring I am having a page addContact,in that I am getting
dropDown Data from Database in the following way
@RequestMapping("/addContact")
public ModelAndView registerContact(@ModelAttribute Contact contact) {
List<ContactType> contactTypeList = contactdao.getContactTypeList();
Map<Integer,String> contactTypeSelect = new LinkedHashMap<Integer,String>();
Iterator<ContactType> iterator = contactTypeList.iterator();
while (iterator.hasNext()) {
ContactType ct = iterator.next();
contactTypeSelect.put(ct.getContactTypeId(),ct.getContactTypeName());
}
Map<String, Object> map = new HashMap<String, Object>();
map.put("contactTypeSelect", contactTypeSelect);
return new ModelAndView("addContact", "map", map);
}
Now to Insert the Data into Database, I am having following method,
@RequestMapping("/insert")
public String insertData(@Valid Contact contact, BindingResult result,
HttpServletRequest request ) {
if (result.hasErrors()) {
return "addContact";
}
else {
HttpSession session = request.getSession();
session.setAttribute("path",
request.getSession().getServletContext().getRealPath("/WEB-INF"));
if (contact != null){
contactService.insertData(contact,request);
}
return "redirect:/getList";
}
}
When the validation fails, the drop down data is lost (which is obvious),
what is the correct way of achieving the validation.
Keep Integer Matrix in R as Integer Matrix
Keep Integer Matrix in R as Integer Matrix
Suppose that I have an integer matrix in R filled with "1".
When I divide it by two it will be converted to a double matrix.
How can I force R to not change the type matrix? (So the matrix will be
filled with 0 instead of .5).
It is true that I can use round function later, but it decrease the speed
significantly.
Suppose that I have an integer matrix in R filled with "1".
When I divide it by two it will be converted to a double matrix.
How can I force R to not change the type matrix? (So the matrix will be
filled with 0 instead of .5).
It is true that I can use round function later, but it decrease the speed
significantly.
Wednesday, 11 September 2013
unsatisfied link error when I run using cygwin but using visual studio it is running properly
unsatisfied link error when I run using cygwin but using visual studio it
is running properly
I try to run a sample JNI program in windows using cygwin, I am getting
unsatisfiedLinkError JNItest.javatoC()V where JNItest is the class and
javatoC() is the native method, I compiled using the command "gcc
-mno-cygwin -I$jdk/include -I$jdk/include/win32 -Wl,--add-stdcall-alias
-shared -o HelloWorld.dll HelloWorld.c". But when i compile the same using
Visual studio its running properly and the command is "cl"C:\Program
Files\Java\jdk1..0_45\include"
-I"C:\ProgramFiles\Java\Jdk1.6.0_45\include\win32" -LD Jni.c -Jni.dll".
Can someone tell me where the problem is, whether in cygwin or in
compilation?
is running properly
I try to run a sample JNI program in windows using cygwin, I am getting
unsatisfiedLinkError JNItest.javatoC()V where JNItest is the class and
javatoC() is the native method, I compiled using the command "gcc
-mno-cygwin -I$jdk/include -I$jdk/include/win32 -Wl,--add-stdcall-alias
-shared -o HelloWorld.dll HelloWorld.c". But when i compile the same using
Visual studio its running properly and the command is "cl"C:\Program
Files\Java\jdk1..0_45\include"
-I"C:\ProgramFiles\Java\Jdk1.6.0_45\include\win32" -LD Jni.c -Jni.dll".
Can someone tell me where the problem is, whether in cygwin or in
compilation?
Subscribe to:
Comments (Atom)