unified_texts stringlengths 32 30.1k | OpenStatus_id int64 0 4 | input_ids list | token_type_ids list | attention_mask list |
|---|---|---|---|---|
File read from second spider got trunced
===
I'm using scrapy to scrape some data.
i got 2 spiders = spider a and b
spider a fetches some data and write it to a file.
spider b reads that data.
the problem is that spider b gets an empty file.
I can see that the file is filled after spider a finishes hes job.
I spent few hour to figure this out.
code snippet:
spider a
=========
f = open('file.txt', 'r+')
f.write("str")
f.write("\n")
f.flush()
spider b
======
f = open('file.txt')
for line in f:
print f
f.close
nothing comes out
=====
what is wrong with this? | 0 | [
2,
3893,
1302,
37,
153,
5650,
330,
8600,
6175,
43,
800,
3726,
3726,
31,
22,
79,
568,
10241,
93,
20,
23855,
109,
1054,
9,
31,
330,
172,
16235,
800,
5650,
21,
17,
334,
5650,
21,
18312,
160,
109,
1054,
17,
2757,
32,
20,
21,
3893,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Get Sleep/Hibernate and Resume/Wakeup events in Visual Basic.NET
===
I have VB.NET app that communicates with some external server (maintains login sessions via Intranet), and I want to listen for Sleep/Hibernate events such that when it happens, I want to logout an existing session system before computer goes to sleep, while my app will remain running in the background but won't do anything.
And vice versa, when computer is resumed from Hibernate or Woke up from sleep, I want to immediately login to the server.
How can I grab those events and execute my code? I believe this relates to Win32 API which I'm supposed to use in VB.
Thanks. | 0 | [
2,
164,
1742,
118,
8630,
106,
8820,
17,
13113,
118,
22016,
576,
963,
19,
3458,
2125,
9,
2328,
800,
3726,
3726,
31,
57,
13,
20468,
9,
2328,
4865,
30,
8709,
18,
29,
109,
4886,
8128,
13,
5,
6232,
5851,
18,
6738,
108,
5763,
1197,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
perl can't use string as an array ref
===
I have 4 apps. let's call them: App1, App2, App3 and App4.
for each of these apps I have an array: for example:
my @App1_links = (...some data...);
my @App2_links = (...some data...);
my @App3_links = (...some data...);
my @App4_links = (...some data...);
Now I have a loop in my code that goes thru these 4 apps and I intend to do something like this:
my $link_name = $app_name . "_links";
where $app_name will be App1, App2 etc...
and then use it as : @$link_name
Now this code does what I intend to do when I don't use: use strict but not otherwise
The error is: Can't use string ("App1_links") as an ARRAY ref while "strict refs" in use at code.pm line 123.
How can I achieve this functionality using use strict.
Please help. | 0 | [
2,
416,
255,
92,
22,
38,
275,
3724,
28,
40,
7718,
13,
14057,
800,
3726,
3726,
31,
57,
268,
4865,
18,
9,
408,
22,
18,
645,
105,
45,
4865,
165,
15,
4865,
135,
15,
4865,
240,
17,
4865,
300,
9,
26,
206,
16,
158,
4865,
18,
31,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Assertion Failed - crash on Unity-Xbox
===
I keep getting this error in xbWatson after UNity-Xbox crashes:
Assertion failed: pDestination, file c:\program files (x86)\microsoft xbox 360 sdk\include\xbox\xnamathconvert.inl, line 7124
Assuming I know almost nothing about c++, what does this error typically mean? | 0 | [
2,
20878,
1702,
13,
8,
4597,
27,
8385,
8,
396,
5309,
800,
3726,
3726,
31,
643,
1017,
48,
7019,
19,
993,
220,
12801,
528,
75,
8385,
8,
396,
5309,
21563,
45,
20878,
1702,
45,
13,
9251,
15018,
7914,
15,
3893,
272,
45,
1,
19746,
648... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Alternative to foreach loop with hashes in perl
===
I have two files, one with text and another with key / hash values. I want to replace occurrences of the key with the hash values. The following code does this, what I want to know is if there is a better way than the foreach loop I am using.
Thanks all
File with key / hash values (hash.tsv):
strict $tr|ct
warnings w@rn|ng5
here h3r3
File with text (doc.txt):
Do you like use warnings and strict?
I do not like use warnings and strict.
Do you like them here or there?
I do not like them here or there?
I do not like them anywhere.
I do not like use warnings and strict.
I will not obey your good coding practice edict.
The perl script:
#!/usr/bin/perl
use strict;
use warnings;
open (fh_hash, "<", "hash.tsv") or die "could not open file $!";
my %hash =();
while (<fh_hash>)
{
s/\n//;
s/\r//;
my @tmp_hash = split(/\t/);
$hash{ @tmp_hash[0] } = @tmp_hash[1];
}
close (fh_hash);
open (fh_in, "<", "doc.txt") or die "could not open file $!";
open (fh_out, ">", "doc.out") or die "could not open file $!";
while (<fh_in>)
{
foreach my $key ( keys %hash )
{
s/$key/$hash{$key}/g;
}
print fh_out;
}
close (fh_in);
close (fh_out);
| 0 | [
2,
2676,
20,
26,
14322,
5293,
29,
63,
438,
18,
19,
416,
255,
800,
3726,
3726,
31,
57,
81,
6488,
15,
53,
29,
1854,
17,
226,
29,
1246,
13,
118,
19170,
4070,
9,
31,
259,
20,
3934,
12933,
18,
16,
14,
1246,
29,
14,
19170,
4070,
9... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
visual basic and vb.net
===
I was a moderately successful VB6 programmer (by that I mean nothing really complicated, just fairly simple apps for my own use). I am trying to "migrate" myself to Visual Studio 2010 (specifically VB). Oh my gosh, it's changed! Having had no experience with the interim versions, I feel like I am in way over my head.
One thing that I don't really understand is the relationship between a Visual Basic standalone application (i.e., an app that runs on a computer, not on web pages, which is what I have always developed), and a vb.net application. When I use the Visual Studio help functions for specific classes some of the pages say they are for .net features. How can I translate that to just a standalone app?
I am specifically wanting to create a simple app to capture and display incoming TCP packets from an iPhone app I am developing. That means I need to understand sockets better. It was fairly simple in VB6 (I've done it before), but I really need to do it in 2010.
My apologies for my stupidity. At 58 years old, my mind just doesn't capture new concepts like it used to, especially at the rate at which they speed past. | 0 | [
2,
3458,
2125,
17,
13,
20468,
9,
2328,
800,
3726,
3726,
31,
23,
21,
20773,
1300,
13,
20468,
379,
17968,
13,
5,
779,
30,
31,
884,
626,
510,
8343,
15,
114,
6647,
1935,
4865,
18,
26,
51,
258,
275,
6,
9,
31,
589,
749,
20,
13,
7,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I expose my EF Code First based repositories as domain services for a Silverlight application?
===
I have an EF 4.3 Code First `Entities` project, which I share between three client projects. I need to add a fourth client, which must be a Silverlight 5 application. I quickly noticed that the examples I worked through to add domain service classes are nothing more than reflections of my already written repository classes. How can I expose my repository classes to be consumes as domain services by a Silvelight application?
Then, is there any reason I should not do this? I have not stuck to any domain driven design here, so I have quite a few repository classes, which I guess might clog up the generated proxies etc. but today is my first day using these things so I don't really know. | 0 | [
2,
184,
92,
31,
13833,
51,
11599,
1797,
64,
432,
302,
14882,
262,
2829,
28,
4603,
687,
26,
21,
1172,
3130,
3010,
60,
800,
3726,
3726,
31,
57,
40,
11599,
268,
9,
240,
1797,
64,
13,
1,
2291,
3808,
1,
669,
15,
56,
31,
1891,
128,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to use xslt 2.0 in visual studio 2010
===
I am using xslt 2.0 for transforming one xml format to another xml format.But Visual Studio 2010 supports only xslt1.0.
So, I referred the stackoverflow link and followed the procedure they said.But it did not working for me...
http://zeetalks.wordpress.com/2011/07/26/vs2010-adding-xslt-to-visual-studio-2010/
http://stackoverflow.com/questions/4116854/xslt-2-0-intellisense-in-visual-studio-2010-adding-a-schema
When i opening my xslt 2.0 xsl file in VS-2010 then it raised following 5 Errors.They are...
1.xpath-default-namespace is not yet implemented
2.xsl:function is not yet implemented
3.xsl:param/@as is not yet implemented
4.xsl:for-each-group is not yet implemented
5.xsl:sequence is not yet implemetented
| 0 | [
2,
184,
20,
275,
993,
18,
255,
38,
172,
9,
387,
19,
3458,
1120,
498,
800,
3726,
3726,
31,
589,
568,
993,
18,
255,
38,
172,
9,
387,
26,
22335,
53,
23504,
2595,
20,
226,
23504,
2595,
9,
811,
3458,
1120,
498,
6747,
104,
993,
18,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
set alert for a particular date
===
Am trying to set alarm based on user entered start date and time. Below code block gave me date and time string in milliseconds.
private long calfn2(){
SimpleDateFormat sdf=null;
Date dt = null ;
sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", Locale.US);
//sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Calendar c = Calendar.getInstance();
try {
dt = sdf.parse(mStartDate.getText().toString()+" "+mStartTime.getText().toString()+":00");
c.setTime(dt);
} catch (ParseException e) {
Log.i("error","There's an error in the Date!");
}
long time = c.getTimeInMillis()*1000000;
return time;
}
This long value will be set using alarm manager like this:
public void addEvents(String time,String msg, int code){
long TimeInMillis = calfn2();
try{
Intent intent = new Intent(this, AddAlert.class);
intent.putExtra("alarm_message", msg);
intent.putExtra("alarm_time", TimeInMillis);
intent.putExtra("code", TimeInMillis);
sender = PendingIntent.getBroadcast(this, code, intent, PendingIntent.FLAG_UPDATE_CURRENT);
// Get the AlarmManager service
AlarmManager am = (AlarmManager) getSystemService(ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, TimeInMillis, sender);
}catch(Exception e){
e.printStackTrace();
}
}
But the notification is not coming. When I tried the same alarm manager for current time, I have received notification.
Can anyone tell me where I went wrong?
Thanks in advance.
regds,
Pratheeja
| 0 | [
2,
309,
7863,
26,
21,
1498,
1231,
800,
3726,
3726,
589,
749,
20,
309,
6490,
432,
27,
4155,
1297,
799,
1231,
17,
85,
9,
1021,
1797,
1921,
492,
55,
1231,
17,
85,
3724,
19,
13436,
5007,
18,
9,
932,
175,
21221,
103,
135,
5,
6,
1,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
If string contains forward slash
===
How do i make a if statement which checks if the string contains a forward slash?
$string = "Test/Test";
if($string .......)
{
mysql_query("");
}
else
{
echo "the value contains a invalid character";
} | 0 | [
2,
100,
3724,
1588,
917,
14098,
800,
3726,
3726,
184,
107,
31,
233,
21,
100,
3331,
56,
16602,
100,
14,
3724,
1588,
21,
917,
14098,
60,
5579,
11130,
800,
13,
7,
10543,
118,
10543,
7,
73,
100,
5,
4403,
11130,
13,
9,
9,
9,
9,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
What is the recommanded way to redraw wxframe content?
===
I have wx.Frame. i need to change the content from time to time.
I have a timer and every few sec i check the state and if the state has been changed , i need to change the content of the frame.
In order to do this i create a panel in the frame and i call to panel.Reparent(None) and create panel with new content, but the frame is not updated with the newly created panel. i tried with destroy (panel.Destroy()) but this didnt work.
So my question is:
What is the recommanded way to change frame content (not only data, i need to add and remove UI componenet) ?
Thank you | 0 | [
2,
98,
25,
14,
302,
16239,
69,
161,
20,
402,
12404,
619,
396,
8361,
2331,
60,
800,
3726,
3726,
31,
57,
619,
396,
9,
8361,
9,
31,
376,
20,
753,
14,
2331,
37,
85,
20,
85,
9,
31,
57,
21,
85,
139,
17,
352,
310,
9265,
31,
2631,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Synchronization on static and instance method
===
I am confused about synchronizing an instance method and a static method.
I want to write a thread safe class as follow :
public class safe {
private final static ConcurrentLinkedQueue<Object> objectList=
new ConcurrentLinkedQueue<Object>();
/**
* retrieves the head of the object and prints it
*/
public synchronized static void getHeadObject() {
System.out.println(objectList.peek().toString());
}
/**
* creates a new object and stores in the list.
*/
public synchronized void addObject() {
Object obj=new Object();
objectList.add(obj);
}
}
Synchronizing on a static method will lock on safe.class lock and synchronizing on a instance method will lock on this .and hence an inconsistent state will be reached.
so if I want to achieve a consistent state for a below code snippet how can that be achieved. | 0 | [
2,
13,
16023,
1829,
27,
12038,
17,
4851,
2109,
800,
3726,
3726,
31,
589,
4230,
88,
13,
16023,
3335,
40,
4851,
2109,
17,
21,
12038,
2109,
9,
31,
259,
20,
2757,
21,
9322,
1834,
718,
28,
1740,
13,
45,
317,
718,
1834,
13,
1,
932,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Integer overflow using lazy sequences in Clojure
===
I'm just learning to use lazy sequences in Clojure, and I'm not sure what I'm doing wrong in the following code:
(defn sum [seqn]
(reduce + seqn))
(defn fib
([] (concat [0 1] (fib 0 1)))
([a b] (lazy-seq (cons (+ a b) (fib b (+ a b))))))
(defn up-to [n seqn]
(filter (fn [x] (< x n)) seqn))
(sum (up-to 100 (fib))) => ArithmeticException integer overflow clojure.lang.Numbers.throwIntOverflow (Numbers.java:1388)
The numbers being summed shouldn't be larger than `100`, so what is causing the integer overflow? | 0 | [
2,
13820,
20285,
568,
16792,
11173,
19,
7383,
2142,
99,
800,
3726,
3726,
31,
22,
79,
114,
2477,
20,
275,
16792,
11173,
19,
7383,
2142,
99,
15,
17,
31,
22,
79,
52,
562,
98,
31,
22,
79,
845,
1389,
19,
14,
249,
1797,
45,
13,
5,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
EXCEL Data extraction, C# ASP.NET not working Console working
===
I have some code that parses an excel file for data.
It works in C# console but not in ASP.net.
For some reason the snippet below fails in my asp.net application:
After the Cells[i,j] no intellisense is provided and the value2 property is missing.
Help, both apps are referencing using Microsoft.Office.Interop.Excel;
var g = xlRange.Cells[i, j].value2.ToString();
| 0 | [
2,
20700,
1054,
16748,
15,
272,
5910,
28,
306,
9,
2328,
52,
638,
8650,
638,
800,
3726,
3726,
31,
57,
109,
1797,
30,
2017,
7202,
40,
20700,
3893,
26,
1054,
9,
32,
693,
19,
272,
5910,
8650,
47,
52,
19,
28,
306,
9,
2328,
9,
26,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Activiating Jcrop on ajax loaded image
===
html img returned from ajax has class of 'tocrop'. Currently I Calling the function on the success of the ajax call:
$("#imageform").ajaxForm({
target: '#image_upload_preview',
success: jcropp(),
})
function jcropp(){
$('.tocrop').Jcrop();
}
I have tried using .load(), setInterval() and clearInterval(when $('.tocrop').Jcrop()), .bind() to bind a function after it has loaded...nothing seems to work
There has already been a [thread][1] on this but the solutions did not work
Any help would be greatly appreciated
[1]: http://stackoverflow.com/questions/2151672/implementing-jcrop-in-ajax-upload | 0 | [
2,
13,
19516,
49,
1880,
13,
15864,
13483,
27,
20624,
8572,
1961,
800,
3726,
3726,
13,
15895,
797,
263,
587,
37,
20624,
63,
718,
16,
13,
22,
262,
7638,
306,
22,
9,
871,
31,
2555,
14,
1990,
27,
14,
1280,
16,
14,
20624,
645,
45,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
SQL Server 2012 - Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" (Microsoft SQL Server, Error: 7302)
===
I just installed SQL Server 2012 to test differences and make sure it is ok for my Work. I may not be a pro at SQL, but I don't see how to add a Link to Jet database on my server. I have imported Jet Databases, but when going thru the GUI to Link a JET Database I see no Provider for JET. I am running Access 2003 (I don't like the 2008+ GUI)
I searched an found nothing simular to my issue; at least nothing I understood. Nothing mentioned how to add Jet db Provider.
I ran a connection string to the Jet Database thru QA:
sp_addlinkedserver 'USGEScrub', 'Access', 'Microsoft.Jet.OLEDB.4.0',
'D:\Lead$\SupList\USGEScrub.mdb'
The connection string works till I try to access the data and then I get this the errorand of course if I click the links nothing shows up:
TITLE: Microsoft SQL Server Management Studio
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch.
Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked
server "USGEScrub". (Microsoft SQL Server, Error: 7302)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.2100&EvtSrc=MSSQLServer&EvtID=7302&LinkId=20476
| 0 | [
2,
4444,
255,
8128,
563,
13,
8,
1967,
1600,
40,
4851,
16,
12116,
13,
9007,
11747,
13,
7,
22019,
12980,
9,
10307,
9,
6069,
9007,
9,
300,
9,
387,
7,
13,
5,
22019,
12980,
4444,
255,
8128,
15,
7019,
45,
453,
22863,
6,
800,
3726,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is the behavior of i = post_increment_i() specified, unspecified, or undefined?
===
Consider the following C program:
int i = 0;
int post_increment_i() { return i++; }
int main() {
i = post_increment_i();
return i;
}
With respect to the 2011 version of the C standard (known as C11), which of the following alternatives is true:
1. C11 guarantees that main returns 0.
2. C11 guarantees that main returns either 0 or 1.
3. The behavior of this program is undefined according to C11.
Relevant snippets from the C11 standard:
- 5.1.2.3 Program execution
> Accessing a volatile object, modifying an object, modifying a file, or calling a function
that does any of those operations are all side effects, which are changes in the state of
the execution environment. Evaluation of an expression in general includes both value
computations and initiation of side effects. Value computation for an lvalue expression
includes determining the identity of the designated object.
> Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations
executed by a single thread, which induces a partial order among those evaluations.
Given any two evaluations A and B, if A is sequenced before B, then the execution of A
shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
sequenced after A.) If A is not sequenced before or after B, then A and B are
unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
either before or after B, but it is unspecified which.<sup>13</sup> The presence of a sequence point
between the evaluation of expressions A and B implies that every value computation and
side effect associated with A is sequenced before every value computation and side effect
associated with B. (A summary of the sequence points is given in annex C.)
> 13) The executions of unsequenced evaluations can interleave. Indeterminately sequenced evaluations cannot interleave, but can be executed in any order.
- 6.5 Expressions
> An expression is a sequence of operators and operands that specifies computation of a
value, or that designates an object or a function, or that generates side effects, or that
performs a combination thereof. The value computations of the operands of an operator
are sequenced before the value computation of the result of the operator.
> If a side effect on a scalar object is unsequenced relative to either a different side effect
on the same scalar object or a value computation using the value of the same scalar
object, the behavior is undefined. If there are multiple allowable orderings of the
subexpressions of an expression, the behavior is undefined if such an unsequenced side
effect occurs in any of the orderings.
- 6.5.2.2 Function calls
> There is a sequence point after the evaluations of the function designator and the actual
arguments but before the actual call. Every evaluation in the calling function (including
other function calls) that is not otherwise specifically sequenced before or after the
execution of the body of the called function is indeterminately sequenced with respect to
the execution of the called function.<sup>94</sup>
> 94) In other words, function executions do not ‘‘interleave’’ with each other.
- 6.5.2.4 Postfix increment and decrement operators
> The result of the postfix ++ operator is the value of the operand. As a side effect, the
value of the operand object is incremented (that is, the value 1 of the appropriate type is
added to it). [...] The value computation of the result is sequenced before the side effect of
updating the stored value of the operand. With respect to an indeterminately-sequenced
function call, the operation of postfix ++ is a single evaluation.
- 6.5.16 Assignments
> An assignment operator stores a value in the object designated by the left operand. [...] The side effect of updating the stored value of the left operand is
sequenced after the value computations of the left and right operands. The evaluations of
the operands are unsequenced.
- 6.8 Statements and blocks
> A full expression is an expression that is not part of another expression or of a declarator.
Each of the following is a full expression: [...] the expression in an expression statement; [...] the (optional) expression in a return
statement. There is a sequence point between the evaluation of a full expression and the
evaluation of the next full expression to be evaluated.
The three alternatives above correspond to the following three cases, respectively:
1. The side effect of the postfix increment operator is sequenced before the assignment in main.
2. The side effect of the postfix increment operator is sequenced either before or after the assignment in main, and C11 does not specify which. (In other words, the two side effects are indeterminately sequenced.)
3. The two side effects are unsequenced.
It seems that the first alternative holds, by the following chain of reasoning:
- Consider the rule <strong>Every evaluation in the calling function (including
other function calls) that is not otherwise specifically sequenced before or after the
execution of the body of the called function is indeterminately sequenced with respect to
the execution of the called function.</strong> in 6.5.2.2. Assumption A: The side effect of the assignment operator in main is such an "evaluation". Assumption B: The phrase "the execution of the called function" includes both the value computation of the postfix increment operator and the side effect of the postfix increment operator. From these assumptions and the above rule, it follows that either I) the value computation and the side effect of the postfix increment operator are both sequenced before the side effect of the assignment operator in main, or II) the value computation and the side effect of the postfix increment operator are both sequenced after the side effect of the assignment operator in main.
- Consider the rule <strong>The side effect of updating the stored value of the left operand is
sequenced after the value computations of the left and right operands.</strong> This rule rules out case I above. It follows that case II holds. QED
Overall, this looks like a pretty strong argument. Also, it corresponds to what one would intuitively consider the most likely alternative.
However, it does rely on specific interpretations of the terms "evaluation" and "execution of the called function" (Assumptions A and B) and a not entirely straightforward line of reasoning, so I wanted to put it out there to see if people have reasons to believe that this interpretation is incorrect. An alternative plausible interpretation of 6.5.2.2 would be to interpret "evaluation" as "whole expression evaluation", so that it says that while the called function does not interleave with other function calls or non-overlapping subexpressions that are part of the same full expression, it might still interleave with side effects of operators that it is "below" in the AST. Also, alternatives 2 and 3 would seem plausible in a scenario where the compiler inlines the function and then performs the same kinds of optimizations that motivate why the expression `i = i++` has undefined behavior. | 0 | [
2,
25,
14,
3257,
16,
31,
800,
678,
1,
28461,
1,
49,
5,
6,
9931,
15,
27005,
15,
54,
367,
13439,
60,
800,
3726,
3726,
3563,
14,
249,
272,
625,
45,
19,
38,
31,
800,
713,
73,
19,
38,
678,
1,
28461,
1,
49,
5,
6,
13,
1,
788,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Data Types and file structure
===
I interested to work with data types and file formats.
for example I want to open a jpeg file with php and work with it.
for example get the size, or change it to black and white without any library.
I want to know that how can decode bytes of a file and get informations about it?
I opened a jpeg file with HxD and saw some data in hexadecimal.
Please give me a reference to know more about files and structures...
Sorry for bad english.
Thanks a lot ...
| 0 | [
2,
1054,
2551,
17,
3893,
1411,
800,
3726,
3726,
31,
3158,
20,
170,
29,
1054,
2551,
17,
3893,
13767,
9,
26,
823,
31,
259,
20,
368,
21,
487,
20427,
3893,
29,
13,
26120,
17,
170,
29,
32,
9,
26,
823,
164,
14,
1072,
15,
54,
753,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Not changed cluster image after changing default cluster's number in gmap3
===
I have used below code for clusters but in this situation cluster-3 is not display and display only cluster-1 and cluster-2.
clusters: {
// This style will be used for clusters with more than 0 markers
10: {
content: '<div class="cluster cluster-1">CLUSTER_COUNT</div>',
width: 53,
height: 52
},
// This style will be used for clusters with more than 20 markers
50: {
content: '<div class="cluster cluster-2">CLUSTER_COUNT</div>',
width: 56,
height: 55
},
// This style will be used for clusters with more than 50 markers
100: {
content: '<div class="cluster cluster-3">CLUSTER_COUNT</div>',
width: 66,
height: 65
}
},
Here remaining code is same like in css and javascript as in http://gmap3.net/examples/clustering.html
Please suggest any good solution or its a drawback that we can't change existing ratio.
Thanks in advance.
| 0 | [
2,
52,
1015,
7460,
1961,
75,
4226,
12838,
7460,
22,
18,
234,
19,
489,
15022,
240,
800,
3726,
3726,
31,
57,
147,
1021,
1797,
26,
14497,
47,
19,
48,
1858,
7460,
8,
240,
25,
52,
3042,
17,
3042,
104,
7460,
8,
165,
17,
7460,
8,
135... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
If else minifier
===
I have many lines of code like this.. this is just a 1 thing i am trying right now.
if (RI2.Text.Contains("SOS") || RI2.Text.Contains("WAR"))
{
Response.Redirect("http://mydomain.com/rabat");
}
if (RI2.Text.Contains("sos") || RI2.Text.Contains("war"))
{
Response.Redirect("http://mydomain.com/rabat");
}
How do i minify this code. i mean, its very ugly and there many lines of code similar to this.
is there any better way of doing this which i dont know.
please help. appreciate your time and help.
| 0 | [
2,
100,
962,
4232,
16292,
800,
3726,
3726,
31,
57,
151,
1560,
16,
1797,
101,
48,
9,
9,
48,
25,
114,
21,
137,
584,
31,
589,
749,
193,
130,
9,
100,
13,
5,
928,
135,
9,
11969,
9,
1126,
5851,
18,
5,
7,
656,
18,
7,
6,
13,
1,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
firefox and chrome not yielding same result for code
===
PROBLEM - enabled/disabled button visually not different in firefox and chrome, works fine for IE.
I have a code for enabling and disabling a continue button on check of a checkbox. Display rules for the continue button -
1. Grayed out until customer checks the check box
2. Enabled only when customer clicks the check box
Here is the code for the button -
<div class="buttonContainerHorizontalBar">
<input name="Submit" class="primary" type="submit" value="Continue" disabled="true"/>
</div>
Here is the CSS code for the displaying of the button -
div.buttonContainerHorizontalBar {
clear:both;
margin:10px 0;
height:45px;
padding:0;
vertical-align:middle;
background-color:#f2f1ec;
border-top:1px dotted #c0bebe;
border-bottom:1px dotted #c0bebe;
}
div.buttonContainerHorizontalBar input.primary {
margin:7px 10px 8px 4px;
padding-top:5px;
padding-bottom:5px;
padding-left:10px;
padding-right:10px;
font-family:Arial;
font-size:12px;
font-weight:bold;
border:1px solid #e0e3e2;
background:url("images/btn_blueslice.gif") top left repeat-x;
This implementation works fine in Internet Explorer, but in case of Chrome and Firefox, there is no visual difference of the button in the enabled/disabled state.
Please help.
| 0 | [
2,
535,
18219,
17,
13,
12985,
52,
23953,
205,
829,
26,
1797,
800,
3726,
3726,
1448,
13,
8,
9338,
118,
2906,
579,
43,
5167,
20747,
52,
421,
19,
535,
18219,
17,
13,
12985,
15,
693,
1123,
26,
13,
660,
9,
31,
57,
21,
1797,
26,
131... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Pushing specific commits with git (compared to ClearCase)
===
We are currently using ClearCase for managing our source code.
With ClearCase, i'm used to making several changes, and to be able to commit (check in) these changes to the server in any way that i want.
This also means i can edit (check out and modify) 10 different files, but check in only some of these back to the server, and in any order that i'd like to.
With git, commiting locally forces me to push the changes back to the server in that particular order.
Is there any workflow in Git, that is similar to the one i'm used to with ClearCase? (being able to push only some of my local commits to the server without loads of work). | 0 | [
2,
5076,
1903,
9686,
18,
29,
13,
10404,
13,
5,
18415,
2095,
20,
1207,
10325,
6,
800,
3726,
3726,
95,
50,
871,
568,
1207,
10325,
26,
5616,
318,
1267,
1797,
9,
29,
1207,
10325,
15,
31,
22,
79,
147,
20,
544,
238,
1693,
15,
17,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Android datepicker and timepicker issue
===
The problem that am facing is with the from-to date and time dialog's. I have created all of them separate.
On onCreate i have set the current date and time on the dialog's for the user. i.e for eg 24/7/2012 as todays date. When ever i change/click on the dialog for the from_date to the date for eg: 26/7/2012 then i have change the text of the to_date dialog to 26/7/2012 via setText. The issue that comes here is when i open the to_date dialog the date that appears in the dialog is 24/7/2012 and not 26/7/2012. How can this be achieved same for date and time picker dialog. I have attached the code below.
Thanks in advance.
public Dialog onCreateDialog(int id) {
switch (id) {
case DATE_DIALOG_ID_FROM:
Log.i("Date Case", "" + from_day);
return new DatePickerDialog(this, dateListenerfrom, from_year,
from_month, from_day);
case DATE_DIALOG_ID_TO:
Log.i("Date Case", "" + to_day);
return new DatePickerDialog(this, dateListenerto, to_year,
to_month, to_day);
case TIME_DIALOG_ID_FROM:
return new TimePickerDialog(this, timeListenerfrom, from_hours,
from_min, false);
case TIME_DIALOG_ID_TO:
return new TimePickerDialog(this, timeListenerto, to_hours, to_min,
false);
}
return null;
}
private DatePickerDialog.OnDateSetListener dateListenerfrom = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int yr, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
from_year = yr;
from_month = monthOfYear;
from_day = dayOfMonth;
// to_year = yr;
// to_month = monthOfYear;
to_day = dayOfMonth;
Log.i("From Day", "" + from_day);
Log.i("To Day", "" + to_day);
Log.i("To Cons", "" + dayOfMonth);
try {
updateDateFrom();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
private DatePickerDialog.OnCancelListener mDateFromCancelListener = new DatePickerDialog.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
}
};
private DatePickerDialog.OnDateSetListener dateListenerto = new DatePickerDialog.OnDateSetListener() {
public void onDateSet(DatePicker view, int yr, int monthOfYear,
int dayOfMonth) {
// TODO Auto-generated method stub
to_year = yr;
to_month = monthOfYear;
to_day = dayOfMonth;
Log.i("From Day", "" + from_day);
Log.i("To Day", "" + to_day);
Log.i("To Cons", "" + dayOfMonth);
try {
updateDateTo();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
private void updateDateFrom() throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
try {
date_from = dateFormat.parse(from_day + "/" + from_month + "/"
+ from_year + " " + from_hours + ":" + to_min);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("From LONG " + date_from.getTime());
from_date_builder = new StringBuilder().append(from_day).append('/')
.append(from_month + 1).append('/').append(from_year);
from_date.setText(from_date_builder.toString());
to_date.setText(new StringBuilder().append(from_day).append('/')
.append(from_month + 1).append('/').append(from_year));
}
private void updateDateTo() throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
try {
date_to = dateFormat.parse(to_day + "/" + to_month + "/" + to_year
+ " " + to_hours + ":" + to_min);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("To LONG " + date_to.getTime());
if (date_from.getTime() <= date_to.getTime()) {
to_date_builder = new StringBuilder().append(to_day).append('/')
.append(to_month + 1).append('/').append(to_year);
to_date.setText(to_date_builder.toString());
} else {
Toast.makeText(this, "Please set proper date", Toast.LENGTH_SHORT)
.show();
}
}
private TimePickerDialog.OnTimeSetListener timeListenerfrom = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
from_hours = hourOfDay;
from_min = minute;
try {
updateTimeFrom();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
private TimePickerDialog.OnTimeSetListener timeListenerto = new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
to_hours = hourOfDay;
to_min = minute;
try {
updateTimeTo();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
};
private void updateTimeFrom() throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
time_from = dateFormat.parse(from_day + "/" + from_month + "/"
+ from_year + " " + from_hours + ":" + from_min);
from_time_builder = new StringBuilder().append(from_hours).append(':')
.append(from_min);
from_time.setText(from_time_builder.toString());
to_time.setText(new StringBuilder().append(from_hours).append(':')
.append(from_min));
}
private void updateTimeTo() throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
time_to = dateFormat.parse(to_day + "/" + to_month + "/" + to_year
+ " " + to_hours + ":" + to_min);
if (time_from.getTime() <= time_to.getTime()
&& date_from.getTime() <= date_to.getTime()) {
to_time_builder = new StringBuilder().append(to_hours).append(':')
.append(to_min);
to_time.setText(to_time_builder.toString());
}
else {
Toast.makeText(this, "Please set proper date", Toast.LENGTH_SHORT)
.show();
}
System.out.println("Thi is in the time to ");
}
This is onClick
{
if (v == from_date) {
showDialog(DATE_DIALOG_ID_FROM);
}
if (v == to_date) {
showDialog(DATE_DIALOG_ID_TO);
}
if (v == from_time) {
showDialog(TIME_DIALOG_ID_FROM);
}
if (v == to_time) {
showDialog(TIME_DIALOG_ID_TO);
}
} | 0 | [
2,
13005,
1231,
16855,
106,
17,
85,
16855,
106,
1513,
800,
3726,
3726,
14,
1448,
30,
589,
4325,
25,
29,
14,
37,
8,
262,
1231,
17,
85,
28223,
22,
18,
9,
31,
57,
679,
65,
16,
105,
1725,
9,
27,
27,
6037,
1373,
31,
57,
309,
14,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
SiteEdit Properties and Methods in Tridion 2011 SP1
===
Can someone provide me the documentation of SiteEdit Properties and Methods used in Tridion 2011 SP1.
E.g: SiteEdit.ComponentPresentation(),This property is used at two different places with different parameters.
I want a complete information regarding all such properties with their return types.
| 0 | [
2,
689,
69,
242,
3704,
17,
3195,
19,
2286,
43,
872,
542,
3782,
165,
800,
3726,
3726,
92,
737,
1181,
55,
14,
13945,
16,
689,
69,
242,
3704,
17,
3195,
147,
19,
2286,
43,
872,
542,
3782,
165,
9,
13,
62,
9,
263,
45,
689,
69,
242... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Basics of PHP class:passing value in class
===
I am debugging a site
I am having to work with classes which I am not that used to as of yet.
There is this class in this site that processes a `$this` but there does not seem to be any variable passed to the class.
the class is like this
class myclass extends otherclass{
function dosmthtomyclass{
print_r($this);
}
}
`function dosmttomyclass` prints an array.
there are bunch of variables defined protected in the class but there does not seem to be any specific value specified for any of those variables and there is no constructor in the class to the pass the value to.
I am seriously confused as to where the variable must have been passed from.
This may be something really basic but any help would be appreciated.
what are the possible ways of passing variables to the class
| 0 | [
2,
2125,
18,
16,
13,
26120,
718,
45,
6201,
68,
1923,
19,
718,
800,
3726,
3726,
31,
589,
121,
16254,
2762,
21,
689,
31,
589,
452,
20,
170,
29,
2684,
56,
31,
589,
52,
30,
147,
20,
28,
16,
768,
9,
80,
25,
48,
718,
19,
48,
689... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Best way of synchronizing lots of threads in java
===
I develop an application, and, at a given moment, I start about 10000 threads to stress-test a database. I want to synchronize this in the following way: I want to read all data from a table in all the threads, then I want all the treads to wait for the other threads to stop reading. After all threads finished reading, I delete all records from that table, then I want all the threads to insert the data read previously. Now, how do I synchronize my threads, to wait for each other in the before mentioned order? What is the best solution? | 0 | [
2,
246,
161,
16,
13,
16023,
3335,
7503,
16,
20396,
19,
8247,
800,
3726,
3726,
31,
2803,
40,
3010,
15,
17,
15,
35,
21,
504,
688,
15,
31,
799,
88,
332,
3993,
20396,
20,
5384,
8,
10543,
21,
6018,
9,
31,
259,
20,
13,
16023,
2952,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
widget in a QTreeView is not following when dropping
===
I have a QTreeView in which I added a push button using setIndexWidget (it's a static content, I used item delegates for dynamic content).
When a line is drag and dropped within the view, everything expect the pushbutton is copied. The pushbutton is lost.
Anybody knows why?
It's kind of a problem to recreate it afterwards. So, I wish the push button could follow the drag and drop.
Greetings,
Denis
| 0 | [
2,
4807,
43,
3060,
19,
21,
2593,
8101,
4725,
25,
52,
249,
76,
6780,
800,
3726,
3726,
31,
57,
21,
2593,
8101,
4725,
19,
56,
31,
905,
21,
3250,
5167,
568,
309,
25671,
3976,
43,
3060,
13,
5,
242,
22,
18,
21,
12038,
2331,
15,
31,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
jquery plugin bind change event
===
i just created a selectbox plugin.It is very simple and i am trying to modify.
actually what it doing is hide the select and add some `ul,li` after that `select`.
say that i have these options available
<select id="test">
<option>1</option>
<option>2</option>
</select>
now i can do
$("#test").selectBox(); //to make it my selectBox
I have setter and getter options
$("#test").selectBox("changeValue",["changed option",index]);
on my plugin i am using methods ..
var methods = {
init :function(options){},
changeValue:function(value){
//some code to change the value ...
}
};
I can change the value ,but how can i catch the `change` event ?
`change` means that a change in select or `ul,li`
what i really need is
$("#test").selectBox(); //initialise
$("#test").change(function(){ //attach change event
//my codes.....
});
or
$("#test").selectBox({
onChange : function(){
console.log("changed....");
}
});
Hope that the question is clear ...
Please help me ..
Thank you. | 0 | [
2,
487,
8190,
93,
10922,
108,
10193,
753,
807,
800,
3726,
3726,
31,
114,
679,
21,
5407,
5309,
10922,
108,
9,
242,
25,
253,
1935,
17,
31,
589,
749,
20,
17579,
9,
1121,
98,
32,
845,
25,
3077,
14,
5407,
17,
3547,
109,
13,
1,
1287... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
jQuery Moblie: passing parameters and dynamically load the content of a page
===
I know it's a base problem, but I wasn't able to find anything fitting my situation.
I have a jQuery Mobile page with a list of elements. The elements references to a second pages which has a content that depends on what element where choose (for example a list of articles and choosing an article it should show the relative text). Basically I have to pass a parameter between pages.
I tried to do that using AJAX:
$.ajax({
url : "index.html#page2",
data : "id="+id,
dataType : 'json'
type: "GET"
});
But i wasn't able to get the results in the second page.
How can I do that? | 0 | [
2,
487,
8190,
93,
7327,
3844,
45,
2848,
12905,
17,
7782,
1326,
6305,
14,
2331,
16,
21,
2478,
800,
3726,
3726,
31,
143,
32,
22,
18,
21,
1000,
1448,
15,
47,
31,
526,
22,
38,
777,
20,
477,
602,
11857,
51,
1858,
9,
31,
57,
21,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How has Haskell changed?
===
When I first learned Haskell, Haskell '98 was the official published language specification. Today, that specification is Haskell 2010. (I have to admit, I have a really hard time remembering what the heck the differences actually are.)
Now Haskell has been around for a _long_ time. (Well, in computing terms it's a long time.) So what I'm wondering is... Have there been any major design changes to the language over Haskell's history? Or have all the changes been relatively minor? Is there somewhere I can find a list of these, without sitting down and reading through every version of the Haskell Report trying to spot the differences?
| 0 | [
2,
184,
63,
63,
16507,
1015,
60,
800,
3726,
3726,
76,
31,
64,
2691,
63,
16507,
15,
63,
16507,
13,
22,
3804,
23,
14,
989,
467,
816,
14177,
9,
786,
15,
30,
14177,
25,
63,
16507,
498,
9,
13,
5,
49,
57,
20,
5251,
15,
31,
57,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
jQuery autocomplete select ignores custom data fields
===
My controller returns a json object with the fields "id", "value" and an additional field "result_type". Unfortunately I'm unable to access this "result_type" field in the select method.
I'm using Rails 3.2.6 with the `jquery-rails` and `coffeescript` gems. In `application.js` I require `jquery-ui`.
$('#q').autocomplete
source: (request, response) ->
...
select: (event,ui) ->
alert ui.item.value (works)
alert ui.item.result_type (does not work)
... | 0 | [
2,
487,
8190,
93,
3108,
15990,
5407,
7174,
18,
5816,
1054,
2861,
800,
3726,
3726,
51,
9919,
4815,
21,
487,
528,
3095,
29,
14,
2861,
13,
7,
1340,
7,
15,
13,
7,
15165,
7,
17,
40,
1351,
575,
13,
7,
29955,
1,
4474,
7,
9,
6200,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Compass Rails 3.0 working with 'compass watch' but not without
===
I'm trying Compass with Rails 3.0.7, just trying to get started. Using gem compass-rails. If I put my sass file in app/assets/stylesheets and run 'compass watch', everything works ok: the compiled css is put into public/stylesheets.
However, if I stop 'watch' and rely on Rails to do the compilation, it does not work. Instead, the program looks at the public/stylesheets/sass folder for the input. Furthermore, if a file in that folder has the '@include "compass"' directive, I get an error that the file is not found. How do I force Rails to look in the right place -- app/assets/stylesheets? | 0 | [
2,
18879,
2240,
18,
203,
9,
387,
638,
29,
13,
22,
960,
6201,
1455,
22,
47,
52,
366,
800,
3726,
3726,
31,
22,
79,
749,
18879,
29,
2240,
18,
203,
9,
387,
9,
465,
15,
114,
749,
20,
164,
373,
9,
568,
8551,
18879,
8,
7301,
18,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Application vs Service vs Intent
===
I am creating a project which connects to an embedded Bluetooth chip. Currently I have it set up with a separate application class which controls all the bluetooth functionality.
My program initialized with a main menu that has 9 buttons. In the main screen I create the connection to the Bluetooth device. Each button brings me to a separate Activity. Each activity needs to receive different pieces of data from the Bluetooth chip.
My question to you all is, would it make sense for me to use a service instead of an application? From what I understand of a service, it is used because there is always something running in the background. However in this case nothing needs to be running in the background ( unless keeping the connection with the Bluetooth device counts), data is only sent/received when an Activity asks for it.
Or, am I completely off track and shouldn't use either? Just a simple class to act as my data container which can be passed through intents? I know this will work, but am very new to Android and intents seem to be a bit messy. I would rather not use intents if I didn't have to. | 0 | [
2,
3010,
4611,
365,
4611,
6936,
800,
3726,
3726,
31,
589,
2936,
21,
669,
56,
8534,
20,
40,
12138,
705,
15808,
7525,
9,
871,
31,
57,
32,
309,
71,
29,
21,
1725,
3010,
718,
56,
8671,
65,
14,
705,
15808,
18548,
9,
51,
625,
2104,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
still about python file operation
===
I'm using Windows 7 and Python 2.7.3.
PS C:\Python27\LearnPythonTheHardWay> python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> input = open('file_operation_sample.txt', 'a+')
>>> print input.tell() # first 'tell()'
0
>>> input.write(u'add')
>>> print input.tell()
12
>>> input.seek(0)
>>> print input.read()
123456789add
>>> input.close()
>>>
I'm so puzzled why the first `tell()` prints `0`(I thought it would output `9`)? 'a+' is an append mode, the file pointer should be at the EOF. And I'm more puzzled that finally the string 'abc' is appended to '123456789'?
another question,
PS C:\Python27\LearnPythonTheHardWay> python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from io import open
>>> input = open('file_operation_sample.txt', 'a+')
>>> print input.tell()
9
>>> input.write(u'add')
3L
>>> print input.tell()
12
>>> input.seek(2)
2
>>> input.seek(2, 1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: can't do nonzero cur-relative seeks
>>>
what's the problem? if i comment out `from io import open`, it will be ok. | 0 | [
2,
174,
88,
20059,
3893,
1453,
800,
3726,
3726,
31,
22,
79,
568,
1936,
453,
17,
20059,
172,
9,
465,
9,
240,
9,
8613,
272,
45,
1,
6448,
11570,
2567,
1,
413,
10818,
6448,
11570,
124,
6011,
1443,
1,
20059,
20059,
172,
9,
465,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Python comparing strings
===
I have a code where in I first convert a .csv file into multiple lists and then I have to create a subset of the original file containing only those with a particular word in column 5 pf my file
I am trying to use the following code to do so
But it gives me a syntax error for the if statement.
Can anyone tell me how to fix this?
import csv
with open('/Users/jadhav/Documents/Hubble files/m4_hubble_1.csv') as f:
bl = [[],[],[],[],[]]
reader = csv.reader(f)
for r in reader:
for c in range(5):
bl[c].append(r[c])
print "The files have now been sorted into lists"
name = 'HST_10775_64_ACS_WFC_F814W_F606W'
for c in xrange(0,1):
if bl[4][c]!='HST_10775_64_ACS_WFC_F814W_F606W'
print bl[0][c]
| 0 | [
2,
20059,
15047,
7887,
800,
3726,
3726,
31,
57,
21,
1797,
113,
19,
31,
64,
8406,
21,
13,
9,
6824,
710,
3893,
77,
1886,
7227,
17,
94,
31,
57,
20,
1600,
21,
16622,
16,
14,
501,
3893,
3503,
104,
273,
29,
21,
1498,
833,
19,
4698,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Eclipse c++ configuration error
===
Im getting the following error when i try to create a simple helloWorld C++ project in eclipse. Please note that i have MinGW, msys and my environment variables set up right. Im using Windows 7 and the 32bit Eclipse Juno.
Error:
Error 127 occurred while running autoreconf HelloWorld -1 Configure Problem
The error occurs as soon as i create the project. I had another c++ compiler on my machine (DevC++) and thought this might be causing the problem, so i removed it..However im still getting the same error. Please help
Thanks | 0 | [
2,
11652,
272,
20512,
8091,
7019,
800,
3726,
3726,
797,
1017,
14,
249,
7019,
76,
31,
1131,
20,
1600,
21,
1935,
10975,
4423,
272,
20512,
669,
19,
11652,
9,
2247,
1945,
30,
31,
57,
12069,
499,
15,
4235,
93,
18,
17,
51,
2307,
12157,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Performant Bar Chart from FIFO buffer
===
I have question how to create a performant swing component.
The component should draw some kind of bar chart. The data for the component are stored in a separte FIFO buffer class. Everytime the buffer is updated the component is informed.
At the moment the component draws a BufferedImage everytime the data changes. The paintComponent method of the bar chart component then draws the created BufferedImage.
Due to the fact that there are a lot of data changes in my application, I am thinking to improve the painting of the BufferedImage. Most of the bar chart remains the same. It is just shifted to the right and the latest data changes are added to the left of the bar chart.
At the moment the whole BufferedImage is recreated out of the data stored in the buffer. What I could think of is to shift the old BufferedImage using AffineTransformation and only add the recently added data. This would enormously decrease the amount of drawing operations on the BufferedImage.
But I do not know if this will speed up the application. How expensive is the AffineTransformation on a BufferedImage?
Any remarks are welcome. Also some other hint how to create a performant swing application.
Thanks in advance | 0 | [
2,
2985,
1830,
748,
1795,
37,
6028,
4120,
17497,
800,
3726,
3726,
31,
57,
1301,
184,
20,
1600,
21,
2985,
1830,
5587,
5912,
9,
14,
5912,
378,
2003,
109,
825,
16,
748,
1795,
9,
14,
1054,
26,
14,
5912,
50,
8214,
19,
21,
10332,
1143... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Why the List is not updated and why the var w is all the time null?
===
I have a button click event and there im adding a point i drawed location to a new class two Lists:
private void button1_Click(object sender, EventArgs e)
{
halfX = pictureBox1.ClientRectangle.Width / 2;
halfY = pictureBox1.ClientRectangle.Height / 2;
Random rnd = new Random();
offsetX = rnd.Next(-10, 10);
offsetY = rnd.Next(-10, 10);
wireObject1.addPoint(halfX + offsetX, halfY + offsetY);
pictureBox1.Refresh();
}
in wireObject class this is the addPoint function:
public void addPoint(float x, float y)
{
Point_X.Add(x);
Point_Y.Add(y);
}
Point_X and Y are List<float>
Now i have another class i did wireObjectCoordinates:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AnimationEditor
{
class WireObjectCoordinates
{
public List<float> Point_X = new List<float>();
public List<float> Point_Y = new List<float>();
public WireObjectCoordinates()
{
}
public int FrameNumber { get; set; }
}
}
And in Form1 in button click 8 i want to use wireObjectCoordinates to hold the point/s coordinates in a new class List wireObjectAnimation:
private void button8_Click(object sender, EventArgs e)
{
if (buttonLockMode == true)
{
trackBar1.Enabled = true;
button8.ForeColor = Color.Red;
button8.Enabled = false;
textBox1.Text = "Frame Number : " + trackBar1.Value;
this.trackBar1.Select();
textBox3.Enabled = true;
textBox4.Enabled = true;
wireObjectAnimation1 = new WireObjectAnimation(this, wireObject1);
int currentFrameIndexRight = trackBar1.Value;
wireObjectCoordinates1 = new WireObjectCoordinates() { FrameNumber = currentFrameIndexRight };
WireObjectCoordinatesCloneFrame();
wireObjectAnimation1._coordinatesList.Add(wireObjectCoordinates1);
}
else
{
button8.ForeColor = Color.Black;
}
}
currentFrameIndexRight point on wich frame im now. So when i click this button the frame is 0.
For example i added one point and the point coordinates are 312,220
WireObjectCoordinatesCloneFrame(); is:
public void WireObjectCoordinatesCloneFrame()
{
wireObjectCoordinates1.Point_X = new List<float>(wireObject1._point_X);
wireObjectCoordinates1.Point_Y = new List<float>(wireObject1._point_Y);
}
Now when i put a breakpoint on the button8 click event on the wireObjectAnimation1._coordinatesList.Add(wireObjectCoordinates1); i see that the List _coordinatesList containing the point coordinates then i make F11 but it never get in the wireObjectAnimation class.
So instead of using a breakpoint there im going to the wireObjectAnimation class and put a breakpoint on the List _coordinatesList:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;
using DannyGeneral;
namespace AnimationEditor
{
class WireObjectAnimation
{
private List<WireObjectCoordinates> WireObjectCoordinatesList = new List<WireObjectCoordinates>();
private static bool saveOrLoad;
private static string settings_dir;
private static string settings_file;
private static OptionsFile setting_file;
private static string path_settings;
public TextBox tb;
private Form1 _frm = null;
private WireObject wo1 = null;
private WireObjectCoordinates wireObjectCoordinates1;
public WireObjectAnimation(Form1 frm, WireObject wo)
{
_frm = frm;
if (_frm != null)
{
tb = (TextBox)_frm.Controls["textBox4"];
}
saveOrLoad = false;
wo1 = wo;
if (wo1 != null)
{
}
}
public List<WireObjectCoordinates> _coordinatesList
{
get { return WireObjectCoordinatesList; }
}
I put a breakpoint on the get and it stop there when i click on button8
But now the List _coordinatesList is empty. If i put the breakpoint on Form1 button8 click event i see the List is containing the point coordinates but when im in wireObjectanimation class the List is empty.
Cant figure out why.
-----------------------------------------------------------------------------------------
After i click button8 its enable true the trackBar1 so beside the button8 click event problem i have another problem in the trackBar1 scroll event:
private void trackBar1_Scroll(object sender, EventArgs e)
{
LoadPictureAt(trackBar1.Value, sender);
currentFrameIndex = trackBar1.Value;
textBox1.Text = "Frame Number : " + trackBar1.Value;
int idx = -1;
wireObjectCoordinates1 = new WireObjectCoordinates();
try
{
var w = wireObjectAnimation1._coordinatesList.First(a => a.FrameNumber == currentFrameIndex);
idx = wireObjectAnimation1._coordinatesList.IndexOf(w);
}
catch
{
}
if (idx > -1)
{
// *** When moving the trackBar1 scroll to the right ***\\
if (idx == 0)
{
//*** If moved the scroll to the first frame to the left ***
// button8.Enabled = true;
}
wireObjectCoordinates1 = wireObjectAnimation1._coordinatesList[idx];
//...
//do the things you want to do when the list contains the object
wireObject1._point_X = new List<float>(wireObjectCoordinates1.Point_X);
wireObject1._point_Y = new List<float>(wireObjectCoordinates1.Point_Y);
}
else
{
// *** When moving the trackBar1 scroll to the right ***\\
int currentFrameIndexRight = trackBar1.Value;
wireObjectCoordinates1 = new WireObjectCoordinates() { FrameNumber = currentFrameIndexRight };
wireObjectAnimation1._coordinatesList.Add(wireObjectCoordinates1);
WireObjectCoordinatesCloneFrame();
button1.Enabled = false;
button2.Enabled = false;
button3.Enabled = false;
button4.Enabled = false;
button8.Enabled = false;
SaveFormPicutreBoxToBitMapIncludingDrawings();
}
}
The problem in the scroll event is that var w all the time null. And its getting to the catch and throw: Sequence contains no matching element
I put a breakpoint on the var w line click F11 and its going to the catch.
Same here in the scroll event i need that if move the bar to the right it will update the wireObjectanimation class List with the next frame point/s coordinates.
If on button8 click event the trackBar1 value is 0 so its frame 0 when im moving the trackBar to the right its frame 1,2,3,4....
But it dosent work good. How can be solved ? | 0 | [
2,
483,
14,
968,
25,
52,
6372,
17,
483,
14,
4033,
619,
25,
65,
14,
85,
16203,
60,
800,
3726,
3726,
31,
57,
21,
5167,
10840,
807,
17,
80,
797,
4721,
21,
454,
31,
2003,
69,
1474,
20,
21,
78,
718,
81,
7227,
45,
932,
11364,
5167... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Sphinx Search Index
===
I'm having an issue with a Sphinx Search Index. I keep getting empty result sets from it.
source mrc
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass =
sql_db = test_db
sql_port = 3306
mysql_connect_flags = 32
sql_query_pre = SET NAMES latin1
sql_query_pre = SET SESSION query_cache_type=OFF
sql_query_pre = REPLACE INTO sphinx.indexer (idx,server,version,lastrun_at) SELECT 'mrc','localhost','2.0.4',UNIX_TIMESTAMP(NOW()) FROM DUAL
sql_query_post = UPDATE sphinx.indexer SET fetched_by = UNIX_TIMESTAMP(NOW()) WHERE idx = 'mrc' AND server = 'localhost' AND version = '2.0.4'
sql_query_post_index = UPDATE sphinx.indexer SET indexed_by = UNIX_TIMESTAMP(NOW()) WHERE idx = 'mrc' AND server = 'localhost' AND version = '2.0.4'
sql_attr_uint = mrc_id
sql_attr_uint = mrc_parent
sql_attr_float = mrc_latitude
sql_attr_float = mrc_longitude
sql_query = \
SELECT mrc_id AS doc_id, \
mrc_id, \
mrc_parent, \
RADIANS(mrc_latitude) as mrc_latitude, \
RADIANS(mrc_longitude) as mrc_longitude \
FROM mrc_table \
WHERE mrc_parent > 0
sql_query_info = SELECT * FROM mrc_table WHERE mrc_id = $id
}
index mrc
{
charset_type = sbcs
docinfo = extern
mlock = 1
morphology = none
source = mrc
path = /usr/local/var/data/mrc
}
indexer gives me -
indexing index 'member_region_cities'...
collected 78312 docs, 0.0 MB
total 78312 docs, 0 bytes
total 0.656 sec, 0 bytes/sec, 119354.57 docs/sec
If I connected to searchd through mysql and do
SELECT * FROM mrc_table;
It returns empty.
Theres definitely data in the localhost table, you can see it where the indexer says 'collected 78312'
So why isn't Sphinx putting the data into searchd?
Cheers | 0 | [
2,
27274,
2122,
4348,
800,
3726,
3726,
31,
22,
79,
452,
40,
1513,
29,
21,
27274,
2122,
4348,
9,
31,
643,
1017,
2424,
829,
3415,
37,
32,
9,
1267,
820,
150,
13,
1,
1001,
800,
51,
18,
22402,
4444,
255,
1,
11694,
800,
375,
11694,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
read and process stdin output of another concole application
===
I want to manipulate the output of a console trace tool in a python script. So i want to read each line that the tool writes to stdout and maybe do sth with that line and print it to she screen.
So i got this script:
import sys
while True:
for l in sys.stdin:
print l
and i start the trace tool like this:
qspy -c COM7 | my_script.py
the problem is when i hit enter the first time: nothing happens. when i hit enter again, i see all the output that was created by the tool but it also quits (the trace-tool quits on any character). what am i doing wrong?
i'm on windows. | 0 | [
2,
1302,
17,
953,
354,
3653,
5196,
16,
226,
1065,
17221,
3010,
800,
3726,
3726,
31,
259,
20,
18468,
14,
5196,
16,
21,
8650,
5565,
5607,
19,
21,
20059,
3884,
9,
86,
31,
259,
20,
1302,
206,
293,
30,
14,
5607,
6215,
20,
354,
43,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
loading div using jquery inside shadowbox, IE
===
I am opening a page inside a shadowbox. But then when user clicks on a button, it loads the second div in the same page from a different page using jQuery.ajax. It works for FF,chrome and safari but not for IE8.
`function open_shadowbox_div_view(){
Shadowbox.open({
content:
$("#div1").html(),
player: "html",
height: 420,
width: 750 ,
options:{
onFinish: function(){
} ,
onClose: function(){ }
}
});
}
function newOccFunction(contract){
var site_url = "page.php?var=";?>"+var;
jQuery("#div1").load(site_url,function(){open_shadowbox_div_view();});
}'
this opens the first div.
Then there is a button in that page that loads up a div in the same page.php
Button onclick function
'function filter(){
var site_url = "page2.php";
jQuery.ajax({
type: "POST",
url : site_url,
success: function(data){
alert(data);
jQuery("#sb-player #div2").html(data);
alert(jQuery("#sb-player #div2").html());//This returns null
},
failure: function(){
alert("fail");
}
});
}'
Any help will be appreciated.
Than you | 0 | [
2,
12797,
13,
12916,
568,
487,
8190,
93,
572,
3118,
5309,
15,
13,
660,
800,
3726,
3726,
31,
589,
1214,
21,
2478,
572,
21,
3118,
5309,
9,
47,
94,
76,
4155,
10840,
18,
27,
21,
5167,
15,
32,
19069,
14,
153,
13,
12916,
19,
14,
205... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
c++ why initializer_list behavior for std::vector and std::array are different
===
Code :
std::vector<int> x{1,2,3,4};
std::array<int, 4> y{{1,2,3,4}};
Why do I need double curly braces for std::array? | 0 | [
2,
272,
20512,
483,
2104,
11907,
1,
5739,
3257,
26,
354,
43,
45,
45,
28033,
17,
354,
43,
45,
45,
8576,
93,
50,
421,
800,
3726,
3726,
1797,
13,
45,
354,
43,
45,
45,
28033,
1,
6391,
1,
993,
1,
15793,
15,
240,
15,
300,
1,
73,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Querying for script elements from HTML text using jQuery
===
I'm loading a page via `$.ajax()` and inserting *parts* of the result into the corresponding parts of the page:
$.ajax({
url: '/whole_page.html',
success: function (event, xhr) {
$result = $(xhr.responseText);
$('#menu').html($('#menu', $result).html());
$('#content').html($('#content', $result).html());
}
});
Works like a charm, but I've run into a problem.
Now my pages contain some page-specific JS which must be executed when the result is fetched and inserted. As far as I can tell, jQuery won't return `script` elements if you construct a jQuery object from HTML text and query against it (I've [made a fiddle](http://jsfiddle.net/kaen/rEWYz/5/) to demonstrate). So, I have no way of selectively inserting only the scripts I want via jQuery.
So it would seem that I've got to pull the `script` elements from response text myself. Essentially, I'm looking for the right way to do this. Here's what I came up with so far:
function pullScripts(text) {
var frag = document.createDocumentFragment()
, div = document.createElement('div')
, scriptElements
, i
;
// This is roughly how jQuery finds the scripts when cleaning text
frag.appendChild(div);
div.innerHTML = text;
scriptElements = div.getElementsByClassName('class-for-scripts-that-we-want');
$('head').append(scriptElements);
}
This works well enough, although I haven't tested it on any crappy browsers yet. Regardless, it feels uncomfortable to replicate such basic functionality of jQuery just to avoid one of its features (the special `script` handling). As can be seen in the fiddle, the jQuery object actually does contain the `script`s, but it won't return them with something like `.html()` or `.get()`. **Am I missing some obvious way of doing this?**
*Note: this whole topic will be moot once jQuery's internal `parseHTML` function is exposed since it can populate an array with the scripts it finds in the text*
*Note 2: I've also read http://stackoverflow.com/questions/4430707/trying-to-select-script-tags-from-a-jquery-ajax-get-response however the accepted answer is "you can't" followed by "use a regex". Both of which are unsatisfactory* | 0 | [
2,
25597,
68,
26,
3884,
2065,
37,
13,
15895,
1854,
568,
487,
8190,
93,
800,
3726,
3726,
31,
22,
79,
12797,
21,
2478,
1197,
13,
1,
4403,
9,
6881,
7522,
5,
6,
1,
17,
14692,
68,
1637,
3091,
18,
2483,
16,
14,
829,
77,
14,
7265,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Simplify bash script with variables - Help Please
===
I am currently trying to simplify a script. Instead of manually entering a host name for each command, I'd like to be able to use variables? arrays? of some sort. Was wondering if you can help.
Example:
<br>hostname1=192.168.1.1
<br>hostname2=192.168.1.2
<br>echo "What would you like to do?"
<br>echo "(1)Ping Hosts"
<br>echo "(2)mkdir /tmp/test"
<br>echo "(3)write to test.txt"
<br>read num_variable
<br>if num_variable = 1
<br>then
<br>ping hostname1
<br>ping hostname2
<br>if num_variable = 2
<br>ssh -n hostname1 "mkdir /tmp/test"
<br>ssh -n hostname2 "mkdir /tmp/test"
<br>if num_variable = 3
<br>ssh -n hostname1 "echo 'hello' > /tmp/test/test.txt"
<br>ssh -n hostname2 "echo 'hello' > /tmp/test/test.txt"
<br>**"Is there an easier way to write this?"**
<br>Example:
<br>Hosts=hostname1,hostname2
<br>
<br>Commands here?
<br>
<br>I'd hate to have 20,000 lines when all i could do is list the hostnames on top and for each num variable execute all of the commands below for the hosts listed in that particular section.
<br>Thanks,
<br>Shaun | 0 | [
2,
28257,
13158,
3884,
29,
12157,
13,
8,
448,
2247,
800,
3726,
3726,
31,
589,
871,
749,
20,
28257,
21,
3884,
9,
700,
16,
23671,
4604,
21,
2015,
204,
26,
206,
1202,
15,
31,
22,
43,
101,
20,
44,
777,
20,
275,
12157,
60,
7718,
18... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Saving programatically an ImageField duplicates the image file
===
I'm creating some instances of the `Item` model shown below from a csv file. In the csv file only the `name` and the `filename` of the Item is specified. The `image` field is set by looking if the image exists, and if it does, set the image file to `image`:
I do:
item = Item()
item.name = csv_fields[0]
item.filename = csv_fields[1]
item.save()
...
f = open(settings.MEDIA_ROOT+"images/"+item.filename, 'r')
item.image = File(f)
item.save()
Doing so, the image is duplicated in `settings.MEDIA_ROOT+"images/"` as `<original filename>_1`. How can avoid that? i.e. how can I just set an existing file to an imagefield, without copying it?
class Item(models.Model):
name = models.CharField(max_length=50)
filename = models.CharField(max_length=100,)
image = models.ImageField(upload_to='images', blank=True, null=True) | 0 | [
2,
7599,
625,
721,
8438,
40,
1961,
1109,
19429,
18,
14,
1961,
3893,
800,
3726,
3726,
31,
22,
79,
2936,
109,
13946,
16,
14,
13,
1,
2119,
79,
1,
1061,
1721,
1021,
37,
21,
272,
18,
710,
3893,
9,
19,
14,
272,
18,
710,
3893,
104,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Multiple condition selector in jQuery
===
I have the following code, and I want to select the element with type = text and id of 'announcement_date'. How would I do this in jQuery? Note that both the elements have same id. This is in a legacy classic ASP page I am working with.
<input type="hidden" name="announcement_date" id="announcement_date" value="1111"></input>
<input type="text" name="announcement_date" id="announcement_date" value="323"></input>
<input type="text" name="eff_date" id="eff_date" value="123"></input>
<input type="text" name="end_date" id="end_date" value="123"></input>
I tried the selector below, but it fails to select the correct element.
$("#announcement_date type=text").addClass("error"); | 0 | [
2,
1886,
2874,
23946,
19,
487,
8190,
93,
800,
3726,
3726,
31,
57,
14,
249,
1797,
15,
17,
31,
259,
20,
5407,
14,
4520,
29,
1001,
800,
1854,
17,
4924,
16,
13,
22,
8636,
11792,
1130,
1,
8209,
22,
9,
184,
83,
31,
107,
48,
19,
48... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Javascript window.print() defaults to PDF
===
A print button on a site I am working on opens a new window and populates it with some HTML. I call `window.print()` which works fine, but the default printer for myself and others who have tested it is always a PDF writer if one is available on the system. Is there a way to open the print dialog box with the appropriate default printer selected so that the user does not have to select their printer every time? | 0 | [
2,
8247,
8741,
1463,
9,
10299,
5,
6,
12838,
18,
20,
13,
11124,
800,
3726,
3726,
21,
4793,
5167,
27,
21,
689,
31,
589,
638,
27,
8965,
21,
78,
1463,
17,
1675,
12383,
18,
32,
29,
109,
13,
15895,
9,
31,
645,
13,
1,
27508,
9,
102... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Are "PixelHeight" and "PixelWidth" always present on ALAssetRepresentation metadata?
===
I have noticed that, for images, the dictionary ALAssetRepresentation.metadata contains a couple of keys named "PixelHeight" and "PixelWidth". My question is: is there a guarantee that these keys will be present for all the images? As far as I can see, all the metadatas from the default representation of my images contain those keys, however I have not found a place in the documention where it is stated, so I'm a bit worried about letting my App think that those values will be always available.
Can anyone confirm or deny this?
Thanks a lot and best regards. | 0 | [
2,
50,
13,
7,
18321,
532,
252,
7748,
7,
17,
13,
7,
18321,
532,
3976,
43,
96,
7,
550,
734,
27,
21,
4830,
3554,
99,
3914,
857,
28057,
60,
800,
3726,
3726,
31,
57,
2711,
30,
15,
26,
3502,
15,
14,
9186,
21,
4830,
3554,
99,
3914,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Arithmetic Pointer and fstream C++
===
I am writing to a file, using a memory buffer. I copy each record to the memory buffer and then flush it to the disk.
CODE:
char * OutBuffer;
char *pt;
OutBuffer = new char(BufferSize);
pt = OutBuffer;
for (int i=0; i<(FileSize / RECORD_SIZE); i++){
if (((i % recordsPerBlock)==0) && (i>0)){
FileSortHandle->write(OutBuffer, BufferSize);
pt = OutBuffer;
}
else{
memcpy(pt, minRecord, RECORD_SIZE);
pt = pt + RECORD_SIZE;
}
minRecord = nullptr;
}
When i call "FileSortHandle->write(OutBuffer, BufferSize);" the VS shows:
"Windows has triggered a breakpoint in STL_Test2.exe.
This may be due to a corruption of the heap, which indicates a bug in STL_Test2.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while STL_Test2.exe has focus.
The output window may have more diagnostic information."
Does anyone can help me?
| 0 | [
2,
21211,
454,
106,
17,
398,
11260,
272,
20512,
800,
3726,
3726,
31,
589,
1174,
20,
21,
3893,
15,
568,
21,
1912,
17497,
9,
31,
4344,
206,
571,
20,
14,
1912,
17497,
17,
94,
15017,
32,
20,
14,
8582,
9,
1797,
45,
4892,
1637,
70,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Improving MySQL Performance on a Run-Once Query with a Large Dataset
===
I previously asked a question on how to analyse large datasets ([how can I analyse 13GB of data][1]). One promising response was to add the data into a MySQL database using natural keys and thereby make use of INNODB's clustered indexing.
I've added the data to the database with a schema that looks like this:
TorrentsPerPeer
----------------------
peer_ip (unsigned int)
infohash (varchar(40))
The two fields together form the primary key.
This table represents known instances of peers downloading torrents. I'd like to be able to provide information on how many torrents can be found at peers. I'm going to draw a histogram of the frequencies of which I see numbers of torrents (e.g. 20 peers have 2 torrents, 40 peers have 3, ...).
I've written the following query:
SELECT `count`, COUNT(`ip`)
FROM (SELECT `ip`, COUNT(`infohash`) AS `count`
FROM TorrentsPerPeer
GROUP BY `ip`) AS `counts`
GROUP BY `count`;
This query is currently running (and has been for an hour). `top` is reporting that `mysqld` is only using ~5% of the available CPU whilst its `RSIZE` is steadily increasing. My assumption here is that the server is building temporary tables in RAM that it's using to complete the query.
My question is then; how can I improve the performance of this query? Should I change the query somehow? I've been altering the server settings in the `my.cnf` file to increase the INNODB buffer pool size, should I change any other values?
If it matters the table is 79'262'772 rows deep and takes up ~8GB of disk space. I'm not expecting this to be an easy query, maybe 'patience' is the only reasonable answer.
[1]: http://stackoverflow.com/questions/11449965/how-can-i-analyse-13gb-of-data | 0 | [
2,
9273,
51,
18,
22402,
956,
27,
21,
485,
8,
13120,
25597,
29,
21,
370,
1054,
3554,
800,
3726,
3726,
31,
1343,
411,
21,
1301,
27,
184,
20,
13,
21702,
370,
1054,
3554,
18,
13,
5,
2558,
1544,
92,
31,
13,
21702,
539,
11400,
16,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
android dialog with menu
===
Is there any way to create dialog by inflating menu resource
I have `custom_menu.xml` I want this to be shown in my custom dialog
want to add `Menu` object in Custom view | 0 | [
2,
13005,
28223,
29,
11379,
800,
3726,
3726,
25,
80,
186,
161,
20,
1600,
28223,
34,
19,
13830,
68,
11379,
6577,
31,
57,
13,
1,
4636,
6015,
1,
755,
291,
9,
396,
8184,
1,
31,
259,
48,
20,
44,
1721,
19,
51,
5816,
28223,
259,
20,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0... |
Pandas advanced indexing assignment
===
in a Pandas (v0.8.0) DataFrame I want to overwrite one slice of columns with another.
The below code throws the listed error.
What would be an efficient alternative method for achieving this? Thanks.
df = DataFrame({'a' : range(0,7),
'b' : np.random.randn(7),
'c' : np.random.randn(7),
'd' : np.random.randn(7),
'e' : np.random.randn(7),
'f' : np.random.randn(7),
'g' : np.random.randn(7)})
# overwrite cols
df.ix[:,'b':'d'] = df.ix[:, 'e':'g']
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pandas\core\indexing.py", line 68, in __setitem__
self._setitem_with_indexer(indexer, value)
File "C:\Python27\lib\site-packages\pandas\core\indexing.py", line 98, in _setitem_with_indexer
raise ValueError('Setting mixed-type DataFrames with '
ValueError: Setting mixed-type DataFrames with array/DataFrame pieces not yet supported | 0 | [
2,
16982,
18,
2255,
4348,
68,
8427,
800,
3726,
3726,
19,
21,
16982,
18,
13,
5,
710,
387,
9,
457,
9,
387,
6,
1054,
8361,
31,
259,
20,
84,
23716,
53,
12982,
16,
7498,
29,
226,
9,
14,
1021,
1797,
13566,
14,
1510,
7019,
9,
98,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Inserting a row in multiple tables, and maintaining a relationship separately using SSIS
===
I am a bit lost trying to insert my data in a specific scenario from an excel sheet into 4 tables, using SSIS.
Each row of my excel sheet needs to be split into 3 tables. The identity column value then needs to be inserted into a 4th mapping table to hold the relationship. How do I acheieve tihs efficiently using SSIS 2008?
Note in the below example, its fixed that both col4 and 5 go into 3rd table.
Here is data example
Excel
col1,col2,col3,col4,col5
a,b,c,d,3
a,x,c,y,5
Table1
PK,col
1,a
2,a
Table2
PK,col1,col2
1,b,c
2,x,c
Table3
PK,Col
1,d
2,3
3,y
4,5
Map_table
PK,Table1_ID,Table2_ID,Table3_ID
1,1,1,1
2,1,1,2
2,2,2,3
2,2,2,4
| 0 | [
2,
14692,
68,
21,
3131,
19,
1886,
7484,
15,
17,
8215,
21,
1429,
10714,
568,
13,
18,
4557,
800,
3726,
3726,
31,
589,
21,
1142,
529,
749,
20,
14692,
51,
1054,
19,
21,
1903,
12705,
37,
40,
20700,
6125,
77,
268,
7484,
15,
568,
13,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
C# MySQL Blob field - Cannot copy zip file stored in blob to another table
===
i have a zip file stored in a table by a third party application which i have no control over. I do however have access to the MySQL DB.
What i want to do is do a SELECT statement to retrieve a blob field and copy this record into another table. But on the other side, i do see the blob field on the far side but it is not a zip file, its a text file that says System.Byte[] and thats it - anyone any ideas on what is causing this and how to fix it?
heres what i have below - again any help greatly appreciated :)
OdbcCommand broadcastSelect = new OdbcCommand("select * from exchange where status='1' and type='UPDATE'", cloud);
OdbcDataReader DbReader = Select.ExecuteReader();
int fCount = DbReader.FieldCount;
String type = "";
String filename = "";
byte[] data = null;
int status = 0;
while (DbReader.Read())
{
if (DbReader.IsDBNull(0))
{
type = "BLANK";
}
else
{
type = (string)DbReader[0];
}
if (DbReader.IsDBNull(1))
{
filename = "BLANK";
}
else
{
filename = (string)DbReader[1];
}
if (DbReader.IsDBNull(2))
{
data = new byte[1];
}
else
{
data = (byte[])DbReader[2];
}
if (DbReader.IsDBNull(3))
{
status = 0;
}
else
{
status = (int)DbReader[3];
}
OdbcCommand Copy = new OdbcCommand("INSERT INTO exchange(type,filename,data,status) VALUES('" + type + "','" + filename + "','"
+ data + "','" + status + "')", local);
Copy.ExecuteNonQuery();
} | 0 | [
2,
272,
5910,
51,
18,
22402,
334,
10904,
575,
13,
8,
1967,
4344,
12133,
3893,
8214,
19,
334,
10904,
20,
226,
859,
800,
3726,
3726,
31,
57,
21,
12133,
3893,
8214,
19,
21,
859,
34,
21,
422,
346,
3010,
56,
31,
57,
90,
569,
84,
9,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
the event slideDown was not work correctly
===
i have problem in slideDown mehod.
the event slideDown was not work correctly...
when i click the button to run slideDown mehod this half opens and fast close:(
this page is for password recovery and use PasswordRecovery
<asp:Content ID="Content2" ContentPlaceHolderID="js" runat="server">
<script type="text/javascript">
$(document).ready(function () {
$(".passrecovery-btn").click(function () {
$("#pass-error").slideDown('slow');
});
});
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="page-content">
<div class="password-recovery">
<div class="identify-account">
<h1 class="identify">Identify Your Account</h1>
<hr />
</div>
<asp:PasswordRecovery ID="PassRecovery" runat="server">
<QuestionTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">
Identity Confirmation</td>
</tr>
<tr>
<td align="center" colspan="2">
Answer the following question to receive your password.</td>
</tr>
<tr>
<td align="right">
User Name:</td>
<td>
<asp:Literal ID="UserName" runat="server"></asp:Literal>
</td>
</tr>
<tr>
<td align="right">
Question:</td>
<td>
<asp:Literal ID="Question" runat="server"></asp:Literal>
</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Answer:</asp:Label>
</td>
<td>
<asp:TextBox ID="Answer" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="AnswerRequired" runat="server"
ControlToValidate="Answer" ErrorMessage="Answer is required."
ToolTip="Answer is required." ValidationGroup="PassRecovery">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit"
ValidationGroup="PassRecovery" CssClass="passrecovery-btn" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</QuestionTemplate>
<UserNameTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td>
<table cellpadding="0">
<tr>
<td align="center" colspan="2">
Forgot Your Password?</td>
</tr>
<tr>
<td align="center" colspan="2">
Enter your User Name to receive your password.</td>
</tr>
<tr>
<td align="right">
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
</td>
<td>
<asp:TextBox ID="UserName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server"
ControlToValidate="UserName" ErrorMessage="User Name is required."
ToolTip="User Name is required." ValidationGroup="PassRecovery">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit"
ValidationGroup="PassRecovery" CssClass="passrecovery-btn" />
</td>
</tr>
<tr>
<td align="center" colspan="2" style="color:Red;">
<div class="pass-error" id="pass-error"><asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal></div>
</td>
</tr>
</table>
<div class="loading">
<img src="../Static/images/Loadloading.gif" width="16" height="11" alt="" />
</div>
</tr>
</table>
</UserNameTemplate>
</asp:PasswordRecovery>
</div>
</div>
</asp:Content>
Css:
div.password-recovery
{
border:1px solid #333;
width:300px;
margin:0px auto;
text-align:center;
padding:30px 60px 0px 60px;
margin-top:30px;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 12px;
border-radius:5px;
overflow:visible;
}
div.pass-error{display:none;border:1px solid black;border-radius:5px;}
| 0 | [
2,
14,
807,
6464,
2968,
23,
52,
170,
12044,
800,
3726,
3726,
31,
57,
1448,
19,
6464,
2968,
55,
1807,
43,
9,
14,
807,
6464,
2968,
23,
52,
170,
12044,
9,
9,
9,
76,
31,
10840,
14,
5167,
20,
485,
6464,
2968,
55,
1807,
43,
48,
51... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
unified_thread still not open for public?
===
According to Facebook they released their new messaging system way back,
http://developers.facebook.com/blog/post/591/
From the Blog:
> Apps should move to the new messaging Graph API endpoints and messaging FQL tables ('unified_message' and 'unified_thread'). We will be formally deprecating the old messaging REST APIs, Graph APIs and messaging FQL tables at a date to be announced in the future.
But I still getting the "must be a developer". Is this just me, or does this work for anyone?
I'll try to use unified_thread table from FQL.
Facebook suggests to move to that table, but it's still not working after 6 months? | 0 | [
2,
11496,
1,
96,
10647,
174,
52,
368,
26,
317,
60,
800,
3726,
3726,
496,
20,
9090,
59,
261,
66,
78,
26437,
329,
161,
97,
15,
7775,
6903,
26051,
445,
9,
6413,
5199,
9,
960,
118,
220,
5567,
118,
6962,
118,
3902,
8197,
37,
14,
81... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Where to convert model to view model?
===
In my ASP.NET MVC application, I am using unit of work and repository patterns for data access.
Using the unit of work class and the repository defined inside it I am fetching the related set of entities in my controller. With my beginner knowledge, I can think of two ways to fetch the business model and convert it to view model.
- Repository returns the business model to controller, this model than mapped to view model, or
- Repository itself converts business model to view model and then it is returned to controller.
Currently I am using first approach, but my controller code started to look ugly and long for view models with lots of properties.
On the other hand, I am thinking, since my repository is called UserRepository (for example), it should be returning the business model directly, instead of some model that is useful only for single view.
Which one of these do you think is better practice for large projects ? Is there an alternative way ?
Thanks.
| 0 | [
2,
113,
20,
8406,
1061,
20,
1418,
1061,
60,
800,
3726,
3726,
19,
51,
28,
306,
9,
2328,
307,
8990,
3010,
15,
31,
589,
568,
1237,
16,
170,
17,
24869,
6282,
26,
1054,
1381,
9,
568,
14,
1237,
16,
170,
718,
17,
14,
24869,
2811,
572... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
android GCM doesn't work
===
I use the example provided by goole and I built an client side application to get notifications and a server side, both applications (code) is those provided bu google.
I run the application on the client side and I get the registration_id. some huge string, in this format:
"APA91bEgguwt98xLbivrXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLxDalNoEktCSVbOkT0-uFH2FaRnfpkRME2tzuvr0BycMNEhX_Ix1PV_XXXXXXXXXXXXXXXXXXXXXN5hcseY_wA".
This proves me that the client application works. Now the server (java, google example):
public static void main(String[] args) {
Sender sender = new Sender("AIzaSXXXXXXXXXX_XXXXXXXXXXXXXXXrQOnoGZw");
Message message = new Message.Builder()
.collapseKey("1")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message",
"this text will be seen in notification bar!!")
.build();
try {
Result result = sender.send(message, "APA91bEgguwt98xLbivrXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXLxDalNoEktCSVbOkT0-uFH2FaRnfpkRME2tzuvr0BycMNEhX_Ix1PV_XXXXXXXXXXXXXXXXXXXXXN5hcseY_wA", 3);
System.out.println(result.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This is the server. When I run the server I got as result something like this:
**[ messageId=0:1341907115903155%921c249a00000031 ]**
but no message on the client and I don't understand why. What is the meaning of the response I got from server? Is it the success response?
I need help to understand what is wrong? | 0 | [
2,
13005,
489,
9095,
1437,
22,
38,
170,
800,
3726,
3726,
31,
275,
14,
823,
1173,
34,
162,
6069,
17,
31,
392,
40,
6819,
270,
3010,
20,
164,
52,
4634,
18,
17,
21,
8128,
270,
15,
156,
3767,
13,
5,
9375,
6,
25,
273,
1173,
3183,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Hibernate: Avoid binding null to parameter in @Embeddable attribute
===
Hibernate scenario:
@Embeddable
public class CompositeKey...{
private String keyPart1;
private String keyPart2;
}
public class Entity{
@Embedded
private CompositeKey cKey;
...
}
Now when running this with a cKey with a value in only keyPart1 and keyPart2 == null I get a "binding null to parameter n" binding null to keyPart2.
Can I avoid that and have hibernate generate an SQL with only the parameters that actually has a value and omit the null ones?
So instead of
where keyPart1 = ? and keyPart2 = ?
I just want
where keyPart1 = ?
if cKey.keyPart2 == null
Thanks in advance...
./CJ | 0 | [
2,
4148,
2102,
8820,
45,
2658,
8728,
16203,
20,
18906,
19,
13,
1,
1503,
4283,
43,
579,
35,
14755,
800,
3726,
3726,
4148,
2102,
8820,
12705,
45,
13,
1,
1503,
4283,
43,
579,
317,
718,
12639,
4237,
9,
9,
9,
1,
932,
3724,
1246,
3091... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is it worth closing files in small functions?
===
Say you have:
def my_func():
fh = open(...)
try:
print fh.read()
finally:
fh.close()
My first question is: Is it worth having the try/finally (or with) statement? Isn't the file closed anyway when the function terminates (via garbage collection)?
I came across this after reading a recipe form Martelli's "python cookbook" where
all_the_text = open('thefile.txt').read()
comes with the comment: "When you do so, you no longer have a reference to the file object as soon as the reading operation finishes. In practice, Python notices the lack of a reference at once, and immediately closes the file."
My function example is almost the same. You do have a reference, it's just that the reference has a very short life.
My second question is: What does "immediately" in Martelli's statement mean? Even though you don't have a reference at all, doesn't the file closing happen at garbage collection time anyway? | 0 | [
2,
25,
32,
2715,
4239,
6488,
19,
284,
3719,
60,
800,
3726,
3726,
395,
42,
57,
45,
6312,
51,
1,
16638,
150,
5,
6,
45,
398,
252,
800,
368,
5,
9,
9,
9,
6,
1131,
45,
4793,
398,
252,
9,
10647,
5,
6,
722,
45,
398,
252,
9,
1433... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Printing SVG-PictureFiles in C# PrintDocument GDI+
===
I coded a tool which prints small labels. Here´s my problem:
Every printed text on the label looks fine with `e.Graphics.DrawString(...)` -
Pictures printed with `e.Graphics.DrawImage(...)` look bad. Small parts like a Copyright-Sign is not readable.
DPI is set to 300 (maximum of printer).
I got those pictures in Vector/SVG-Format from Corel Draw - if I print the Corel Draw File it looks great!
How can I print SVG-Files or similar with C# (.NET 3.5 or 4.0)?
Greetings
| 0 | [
2,
7312,
13,
18,
22955,
8,
25602,
16877,
18,
19,
272,
5910,
4793,
28132,
489,
1115,
2430,
800,
3726,
3726,
31,
13,
22254,
21,
5607,
56,
12202,
284,
13173,
9,
235,
13,
18,
51,
1448,
45,
352,
5317,
1854,
27,
14,
1899,
1879,
1123,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Portal Server hangs in debug mode (normal mode works fine)
===
I cant seem to fix the following problem:
when I start the server (IBM Portal Server 7) in "normal" mode, the deployed application works fine.
but when the server is started in debug mode with the same application deployed the server hangs when I try to run the index.xhtml on the server and times out ("thread webcontainer has been active for xxxxx ms and may be hung....").
I've increased the debugger/launch time out with no success. I've restarted the server, cleaned project, redeployed etc nothing seems to help.
Thank you for your help! | 0 | [
2,
8281,
8128,
4546,
18,
19,
121,
16254,
3740,
13,
5,
17462,
3740,
693,
1123,
6,
800,
3726,
3726,
31,
2973,
2260,
20,
6098,
14,
249,
1448,
45,
76,
31,
799,
14,
8128,
13,
5,
4598,
79,
8281,
8128,
453,
6,
19,
13,
7,
17462,
7,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
ipad Receiving Low Memory warning while Loading WebView with local HTML content and App crashes..!
===
I am loading my webview with html contents containing a lot of pages. Its working perfectly in simulator and in device it displays low memory warning issue.
Plz join hands ... | 0 | [
2,
31,
8240,
3396,
708,
1912,
3590,
133,
12797,
2741,
4725,
29,
375,
13,
15895,
2331,
17,
4865,
21563,
9,
9,
187,
800,
3726,
3726,
31,
589,
12797,
51,
2741,
4725,
29,
13,
15895,
8478,
3503,
21,
865,
16,
4434,
9,
82,
638,
5759,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
ajax dataType Html prepend data on IE7 and IE8
===
I have a problem on IE7+8 on this code:
//Post URL
$.ajax({
type : 'POST',
url: url,
dataType: "html",
//Success Post
success: function(data){
//Reactivate Filters and Grid
boxFilter.css({'opacity':1});
var productGrid = $('.products-grid');
productGrid.css({'background':'none', 'height':'auto', 'opacity':1}).find('img.ajax-loader').remove();
//Append Data
var response = $(data);
var newHtmlGrid = $(response).find(".products-grid > div");
productGrid.append(newHtmlGrid)
}
});
Everything is fine on IE9, firefox and all other, but on IE7+8 it's not working.
If I console.log(data) will give me the html, but if I try to append it (not filtered) it will not work.
Any idea why is that?
Thank you! | 0 | [
2,
20624,
1054,
4474,
13,
15895,
15884,
2451,
1054,
27,
13,
660,
465,
17,
13,
660,
457,
800,
3726,
3726,
31,
57,
21,
1448,
27,
13,
660,
465,
2430,
457,
27,
48,
1797,
45,
12894,
6962,
287,
6362,
5579,
9,
6881,
7522,
5,
1,
1001,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Where should I place clean up code inside a web application?
===
I have the following problem:
I need to run some clean up code from various of classes loaded as part of a web application in Tomcat.
Cleanup code ranges from shutting down `executors` to database clean-up code.
I tried and found out (and learned afterwards that this is documented as such) that:
> All servlets and filters will have been destroyed **before** any
> ServletContextListeners are notified of context destruction.
So this rules out running the clean up code in any `ServletContextListeners`.
I put the clean up code in the `destroy` method of a `Servlet`, but realized that if the client does not require its use it will *never* be loaded and as a result the clean up code in the `destroy` method will never run.
So now I am stuck.
Where is the best place to put clean up code in a web application since e.g. if I put it in a `servlet` I can not ensure that the client will use that and if I put it in a `listener` it is too late? | 0 | [
2,
113,
378,
31,
209,
2745,
71,
1797,
572,
21,
2741,
3010,
60,
800,
3726,
3726,
31,
57,
14,
249,
1448,
45,
31,
376,
20,
485,
109,
2745,
71,
1797,
37,
617,
16,
2684,
8572,
28,
141,
16,
21,
2741,
3010,
19,
2067,
5782,
9,
26862,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Jquery Iscroll get With of overflow hidden
===
I have a box div with this css property: " width:400px; height:300px; overflow:hidden;". Inside I have an image.
With Iscroll4 I zoom and move the image inside the box.
Works all fine but with Jquery if I Get the dimension of the zoomed image the function will return always 400px of with dimension and 300px of height dimension.
$('#dimpos').bind( "click", function(event, ui) {
var imgzoomed = $('#Container img');
var position = imgzoomed.position(); /* <----------- Work Fine */
var dim_width = imgzoomed.css("width"); /* <----------- Don't Work but return 400px */
var dim_height = imgzoomed.height(); /* <----------- Don't Work but return 300px */
$('#gdp').text("Position (left: " + position.left + ", top: " + position.top + ") - Width: " + dim_width + " Height: " + dim_height);
});
| 0 | [
2,
487,
8190,
93,
25,
150,
8694,
164,
29,
16,
20285,
3689,
800,
3726,
3726,
31,
57,
21,
1649,
13,
12916,
29,
48,
272,
18,
18,
1354,
45,
13,
7,
9456,
45,
7114,
306,
396,
73,
2947,
45,
6571,
306,
396,
73,
20285,
45,
1822,
43,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How Do I Luanch A Jar File From Another Program?
===
I am having an issue with a game im making, the thing is that i want it to be able
to update without going to a website to download the new version and that you would need to login (it will cost about $3) to play. The thing is that i want the jar to not be runnable unless you run it via the game launcher. I want it so it checks for updates and uses login sessions. The thing is i want to be able to debug the game while building it and then set the jar so you cannot run it without starting the launcher and loging then clicking a button to start it but what i don't know is how do you make it so the game jar can only start with the launcher and the launcher to send the login session to the jar so it knows the username and knows the game was not stolen? | 0 | [
2,
184,
107,
31,
1612,
210,
673,
21,
5112,
3893,
37,
226,
625,
60,
800,
3726,
3726,
31,
589,
452,
40,
1513,
29,
21,
250,
797,
544,
15,
14,
584,
25,
30,
31,
259,
32,
20,
44,
777,
20,
11100,
366,
228,
20,
21,
2271,
20,
7121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Python binding of C++ library(DLL) on Windows using SWIG
===
Please help me to generate python binding and wrappers of C++ code on windows using swig.
I have to write a .h and a .cpp file say example.h and example.cpp. And then an interface file example.i for swig to generate wrappers and python binding.
I have to create a project in visual studio 2008 say example.sln or example.vcproj to generate the DLL of the example.cpp and generated example_wrap.cxx by swig.
Now I want to call the function written in example.h from python using the generated DLL.
Sample Code:
example.h
-----------
class Test
{
int a;
public:
void Set(int);
int Get();
};
example.cpp
---------------
#include "example.h"
void Test::Set(int x)
{
a = x;
}
int Test::Get()
{
return a;
}
example.i
----------
module example
%{
#include "example.h"
%}
%include "example.h"
Now compile example.cpp and generated example_wrap.cxx to generate example.dll.
Now I want to call the function declared in example.h from Python using example.dll.
example.py
----------
how to do that ?
Please help me with proper steps and example.
Thanxx in advance.
| 0 | [
2,
20059,
8728,
16,
272,
20512,
1248,
5,
43,
211,
6,
27,
1936,
568,
13,
18,
12445,
800,
3726,
3726,
2247,
448,
55,
20,
7920,
20059,
8728,
17,
28051,
18,
16,
272,
20512,
1797,
27,
1936,
568,
13,
18,
12445,
9,
31,
57,
20,
2757,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How would I go about applying some sort of dynamic range counter to jQuery and CSS?
===
The gist of what I'm trying to achieve here is to have a list of articles where the headline is clickable and extends and div class via jQuery. As it is presently, it sort of works in that it applies this effect to everything simultaneously, but this obviously isn't desired.
Here's the jQuery:
$(function() {
$("a.expand").click(function(event) {
event.preventDefault();
$(".remainder").slideToggle("fast");
});
});
CSS:
a.expand {}
.remainder {
display: none;
}
XHTML:
<ul class="shows">
<li class="show">
<div class="showInfo alignLeft">
<h3><a href="" class="expand">Some Band @ Some Venue</a></h3>
</div>
<div class="showDate alignRight"><h3>00/00/0000</h3></div>
<div class="clear"></div>
<div id="1" class="remainder">
w/ Some Other Band. Cover is $ and doors are at 00:00.
</div>
</li>
</ul>
Any helps would be great. Thanks in advance. | 0 | [
2,
184,
83,
31,
162,
88,
11989,
109,
2058,
16,
7782,
978,
2105,
20,
487,
8190,
93,
17,
272,
18,
18,
60,
800,
3726,
3726,
14,
489,
702,
16,
98,
31,
22,
79,
749,
20,
4689,
235,
25,
20,
57,
21,
968,
16,
3376,
113,
14,
10596,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Relationship between GraphicsDevice.Clear's color and the color drawn onto the screen
===
I am a beginner to XNA and am experimenting with my new kinect for windows so decided to follow a tutorial: http://digitalerr0r.wordpress.com/2011/06/20/kinect-fundamentals-2-basic-programming/
After doing this one I noticed that all the colors are tinted light blue. For example a color of rgb 20,20,20 will look like dark blue instead of dark gray.
I noticed that the `GraphicsDevice.Clear()` is using `Color.CornflowerBlue`. I experimented with changing it to `Color.Black` and sure enough all the stuff are now tinted black.
What's the relationship between the GraphicsDevice.Clear(color) and the colors being drawn onto the screen?
Here's my draw function:
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(kinectRGBVideo, new Rectangle(0, 0, 640, 480), Color.White);
spriteBatch.DrawString(font, connectedStatus, new Vector2(20, 80), Color.Black);
spriteBatch.End();
base.Draw(gameTime);
} | 0 | [
2,
1429,
128,
8351,
546,
18507,
9,
18600,
22,
18,
1665,
17,
14,
1665,
3160,
1204,
14,
2324,
800,
3726,
3726,
31,
589,
21,
26931,
20,
993,
325,
17,
589,
5737,
68,
29,
51,
78,
6399,
11557,
26,
1936,
86,
868,
20,
1740,
21,
29724,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Why mail() not sending email?
===
Why the below code not sending mail to me ? what is the error ?
<?php
if(isset($_POST['name'])){
$msg="Name: ".$_POST['name']."\n Email: ".$_POST['email']."\n Address: ".$_POST['city']."\n Phone: ".$_POST['phone'];
mail('sganake@gmail.com', 'New Trial Request', $msg);
echo '<h2 align="center" style="color:green">Thank you for your message.</h2>';
} ?> | 0 | [
2,
483,
4216,
5,
6,
52,
4907,
8517,
60,
800,
3726,
3726,
483,
14,
1021,
1797,
52,
4907,
4216,
20,
55,
13,
60,
98,
25,
14,
7019,
13,
60,
13,
1,
60,
26120,
100,
5,
11001,
38,
5,
4403,
1,
6962,
2558,
22,
7259,
22,
500,
6,
6,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Load Balancing virtual machines via Service Management API - MS Azure
===
I found the below article to create a virtual machine and load balance with an existing virtual machine.
https://www.windowsazure.com/en-us/manage/windows/common-tasks/how-to-load-balance-virtual-machines/?_sm_au_=iVVNR02FVsMFjVB3
But how can the same be done via Service Management API.
The related tags i found in the POST request to create a VM are ,
LoadBalancedEndpointSetName, LoadBalancerProbe
Where do I get started ? How do i connect two virtual machine via API ?
Thanks.
| 0 | [
2,
6305,
16416,
6302,
6599,
6035,
1197,
365,
1097,
21,
2159,
13,
8,
4235,
25715,
800,
3726,
3726,
31,
216,
14,
1021,
2002,
20,
1600,
21,
6599,
1940,
17,
6305,
4468,
29,
40,
3149,
6599,
1940,
9,
7775,
18,
6903,
6483,
9,
27508,
18,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Relead fragment when TabPage change
===
I try Jake Wharton's ViewPagerIndicator sample.
And my app like that:
Activity1 when start like:
|------------------------
|Page1 Page2 Page3 Pa|
|-------_____-----------|
| |
| |
| fragment 2 |
| |
| |
here Page2 is selected.
Tabpage title has loaded dynamic from table row.
Example i start Acitivity2 to add more tabpage for Acitivity1. But i have problem at here.
Tabpage title loaded fine, fragment isnot.This like:
|------------------------
|Page0 Page1 Page2 Pa|
|_____------------------|
| |
| |
| fragment 1 |
| |
| |
i try mAdapter.notifyDataSetChanged() but not work.
How to fix my problem?
| 0 | [
2,
302,
11846,
14847,
76,
6523,
6486,
753,
800,
3726,
3726,
31,
1131,
3777,
26276,
22,
18,
1418,
6486,
2445,
4673,
3457,
5717,
9,
17,
51,
4865,
101,
30,
45,
2358,
165,
76,
799,
101,
45,
13,
1,
8,
8,
8,
8,
8,
8,
8,
8,
8,
8,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to draw the rect canvas on another view in android?
===
hi i am new in android also new in Stackoverflow.
i want create simple crop apps so i use the on image view and apply the on touch listener on this.when i touch on this.i draw simple and small defualt rect.after this when i drag the cursor on the screen i want to increase the size of rect in run time.so apply the attributes array on onDraw method.but i can`t do it. my code is below.
my Draw View Class
public class DrawView extends View
{
Paint paint ;
Canvas myCanvas;
float []atr;
public DrawView(Context context)
{
super(context);
}
public DrawView(Context context, float [] atr)
{
super(context);
this.atr=atr;
}
@Override
protected void onDraw(Canvas canvas)
{
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.BLUE);
canvas.drawRect(atr[0], atr[1], atr[2],atr[3], paint);
//System.err.println("After Call on Draw Method");
}
}
and i use in this class which my parent class.
enter code hereContext myContext;
RelativeLayout relMainLayout,relHeaderLayout,relBelowLayout;
DrawView drawView;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
myContext=DrawRectActivity.this;
LayoutInflater layoutInflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
int layoutId = myContext.getResources().getIdentifier("main","layout",getPackageName());
relMainLayout = (RelativeLayout) layoutInflater.inflate(layoutId,null);
relHeaderLayout=(RelativeLayout) relMainLayout.findViewById(R.id.relHeaderLayout);
relBelowLayout=(RelativeLayout) relMainLayout.findViewById(R.id.relBelowLayout);
/*int[] atr={10,10,00,00};
drawView=new DrawView(myContext,atr);
drawView.bringToFront();
drawView.setBackgroundColor(Color.YELLOW);
RelativeLayout.LayoutParams drawParams=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,200);
drawParams.addRule(RelativeLayout.BELOW, relHeaderLayout.getId());
relMainLayout.addView(drawView, drawParams); */
setContentView(relMainLayout);
//drawView.setOnTouchListener(this);
//relMainLayout.setOnTouchListener(this);
}
public boolean onTouch(View v, MotionEvent event)
{
float x,y;
float incx=5,incy=5;
x=event.getX();
y=event.getY();
switch (event.getActionMasked())
{
case MotionEvent.ACTION_DOWN:
System.err.println("X-->"+x);
System.err.println("Y-->"+y);
float[] atr={x,y,x+incx,y+incy};
drawView=new DrawView(myContext,atr);
drawView.bringToFront();
//drawView.setBackgroundColor(Color.YELLOW);
RelativeLayout.LayoutParams drawParams=new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,200);
drawParams.addRule(RelativeLayout.BELOW, relHeaderLayout.getId());
relMainLayout.addView(drawView, drawParams);
break;
case MotionEvent.ACTION_MOVE:
float x1=event.getX();
float y1=event.getY();
incx=x1+incx;
incy=y1+incy;
float[] at1={x,y,incx,incy};
drawView=new DrawView(myContext,at1);
drawView.bringToFront();
break;
case MotionEvent.ACTION_UP:
System.err.println("Up X-->"+x);
System.err.println("Up y-->"+y);
System.err.println("Up X-->"+incx);
System.err.println("Up y-->"+incy);
break;
default:
break;
}
/*int[] atr={100,100,00,00};
DrawView drawView2=new DrawView(myContext, atr);
Bitmap myCanvasBitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
Canvas myCanvas = new Canvas();
myCanvas.setBitmap(myCanvasBitmap);
//canvas.setDensity(BIND_AUTO_CREATE);
drawView2.draw(myCanvas); */
return false;
}
and also use the touch event on this.
| 0 | [
2,
184,
20,
2003,
14,
6042,
38,
9696,
27,
226,
1418,
19,
13005,
60,
800,
3726,
3726,
4148,
31,
589,
78,
19,
13005,
67,
78,
19,
7566,
2549,
9990,
9,
31,
259,
1600,
1935,
9833,
4865,
18,
86,
31,
275,
14,
27,
1961,
1418,
17,
5645... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Posting data from html form to specific tags in xml without overwriting the whole xml file
===
I am trying to learn how to post data from an html form, using a php file/code, to an existing XML file where only specified tags are found and then replaced based upon a `<select>` form attribute.
As a hypothetical I have the following form:
<form method="post" action="hypothetical_01.php" name="replacement" onsubmit="return validation()">
<h3>Which position are you replacing?</h3>
<select name="position" id="position">
<option></option>
<option>position01</option>
<option>position02</option>
<option>position03</option>
</select>
<h3>Entry name:</h3>
<input type="text" name="name" id="name" />
<h3>Description:</h3>
<input type="text" name="describe" id="describe" />
<h3>Link:</h3>
<input type="text" name="link" id="link" />
<input type="submit" value="submit" class="button" /> <input type="reset" value="reset form" class="button"/>
</form>
Pretty straight forward, as it has to be- because I am a technical fledgling... but I disgress.
The hypothetical XML file ought to look like this:
<data_feed_01>
<item>
<position01>
<name>Sample Name 01</name>
<description>blah, blah blah, ect., ect., yadda yadda yadda and so forth</description>
<link>http://www.yourmomshouse.com/</link>
</position01>
<position02>
<name>Sample Name 02</name>
<description>blah, blah blah, ect., ect., yadda yadda yadda and so forth</description>
<link>http://www.yourmomshouse.com/</link>
</position02>
<position03>
<name>Sample Name 03</name>
<description>blah, blah blah, ect., ect., yadda yadda yadda and so forth</description>
<link>http://www.yourmomshouse.com/</link>
</position03>
</item>
</data_feed_01>
Now what I am hoping to do is post the form data to the "hypothetical_01.php" file in which it can replace the only the specified "position" as selected in the form.
That is the whole key to my mad hatter project. Getting a selected data input from an HTML form to replace only that specific tag in an existing XML.... obviously without replacing, altering, wiping out data that exisits in the other position tags.
Could I have been any wordier? As if it weren't already self evident: I know just the tiniest bits of js and PHP... hence my display name
Much appreciated!
/Brian
| 0 | [
2,
15669,
1054,
37,
13,
15895,
505,
20,
1903,
3383,
18,
19,
23504,
366,
84,
12646,
14,
979,
23504,
3893,
800,
3726,
3726,
31,
589,
749,
20,
2484,
184,
20,
678,
1054,
37,
40,
13,
15895,
505,
15,
568,
21,
13,
26120,
3893,
118,
937... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
glDrawArrays drawing not correctly
===
I made painting program. Everything works as I expected. But while drawing, sometimes happens some strange things.
I run app, and press left mouse button on image. It should draw point from code:
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, brushTextura);
glPointSize(100);
glVertexPointer(2, GL_FLOAT, 0,GLVertices);
glDrawArrays(GL_POINTS, 0, count);
glDisableClientState(GL_VERTEX_ARRAY);
at point where I press. `mouseDown` registers mouseDown location, converts it to NSValue, sends to array, and then before drawing I extract NSValue to CGPoint and send it to GLfloat so that it could be drawn by glDrawArrays. But when i do first mouse click anywhere it draws point at coordinates (0,0). After that every thing works OK. Image:
![mouse click][1]
This was first problem. The second problem is that when I paint with it (drag pressed mouse), sometimes appears points where they were'n drawn. Image:
![mouse drag][2]
when I continue drag it gones. Image:
![enter image description here][3]
Any Ideas why it could happen? I will post code bellow:
----------
Mouse down:
- (void) mouseDown:(NSEvent *)event
{
location = [self convertPoint: [event locationInWindow] fromView:self];
NSValue *locationValue = [NSValue valueWithPoint:location];
[vertices addObject:locationValue];
[self drawing];
}
Mouse dragged:
- (void) mouseDragged:(NSEvent *)event
{
location = [self convertPoint: [event locationInWindow] fromView:self];
NSValue *locationValue = [NSValue valueWithPoint:location];
[vertices addObject:locationValue];
[self drawing];
}
Drawing:
- (void) drawing {
int count = [vertices count] * 2;
NSLog(@"count: %d", count);
int currIndex = 0;
GLfloat *GLVertices = (GLfloat *)malloc(count * sizeof(GLfloat));
for (NSValue *locationValue in vertices) {
CGPoint loc = locationValue.pointValue;
GLVertices[currIndex++] = loc.x;
GLVertices[currIndex++] = loc.y;
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, brushTextura);
glPointSize(100);
glVertexPointer(2, GL_FLOAT, 0,GLVertices);
glDrawArrays(GL_POINTS, 1, count);
glDisableClientState(GL_VERTEX_ARRAY);
}
[1]: http://i.stack.imgur.com/3dCCE.png
[2]: http://i.stack.imgur.com/cMKxM.png
[3]: http://i.stack.imgur.com/UNKaZ.png | 0 | [
2,
13,
8430,
3030,
1885,
2787,
18,
3533,
52,
12044,
800,
3726,
3726,
31,
117,
2469,
625,
9,
796,
693,
28,
31,
1727,
9,
47,
133,
3533,
15,
1030,
5531,
109,
2578,
564,
9,
31,
485,
4865,
15,
17,
901,
225,
7567,
5167,
27,
1961,
9,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Handling timeout while using Ksoap2 in android
===
I am calling a method of another class from my activity that calls a webservice using ksoap2. I want to handle timeout for this. If the method takes more than 10 seconds to execute, then I need to show an alert dialog indicating that the process was not successful.
I tried using the timeout value as follows:
HttpsTransportSE transport = new HttpsTransportSE(URL,TIMEOUT);
but ksoap2 is ignoring the timeout for some reason. I'm using ksoap2 2.6.5.
Is there any way where in I can execute the method for 10 seconds and then display the appropriate dialog box indicating a success or failure in android?
| 0 | [
2,
7988,
85,
1320,
133,
568,
680,
656,
2552,
135,
19,
13005,
800,
3726,
3726,
31,
589,
2555,
21,
2109,
16,
226,
718,
37,
51,
2358,
30,
3029,
21,
2741,
11449,
568,
680,
656,
2552,
135,
9,
31,
259,
20,
3053,
85,
1320,
26,
48,
9,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Right click menu in IE wont suppress unless I use js alert or when I debug
===
I'm trying to make a right click menu on a particular type of DIV ... thought i had it working because when I debug in Visual Studio, the right click menu does not appear. But when I run it without debugging, the right menu does appear!
If I use an alert() function, this kills the right menu but I do not want to use an alert, I simply want an alternate right click menu to appear and just cant seem to keep the default menu from appearing.
Here is a fiddle: http://jsfiddle.net/tvance929/5N2ak/
You will notice that if you comment out the alert line - the right click menu will reappear.
I have tried both RETURN FALSE and e.preventdefault() ... Im missing something.
| 0 | [
2,
193,
10840,
11379,
19,
13,
660,
7290,
12451,
4003,
31,
275,
487,
18,
7863,
54,
76,
31,
121,
16254,
800,
3726,
3726,
31,
22,
79,
749,
20,
233,
21,
193,
10840,
11379,
27,
21,
1498,
1001,
16,
13,
12916,
13,
9,
9,
9,
289,
31,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Simple Numeric Regex Match
===
Hi I'm having an issue doing a simple numeric match, what am I doing wrong:
Criteria:
1) Always anchor to start
2) Always Numeric 6-7 digits
3) Always Followed by _ (underscore)
Sample: (want to match everything before LoremIpsum)
1212384_LoremIpsum...
1266625_LoremIpsum...
234233_LoremIpsum...
2348199_LoremIpsum...
I have tried a couple of things: (Does not Match)
^[\d]{6-7}_
^[0-9]{6-7}_
If I do:
^[\d]{6}_
^[0-9]{7}_
I get matches, why can't I do variable length in this expression ? What am I missing here ?
Thanks !
| 0 | [
2,
1935,
15764,
596,
7953,
1706,
730,
800,
3726,
3726,
4148,
31,
22,
79,
452,
40,
1513,
845,
21,
1935,
15764,
596,
730,
15,
98,
589,
31,
845,
1389,
45,
9157,
45,
137,
6,
550,
6265,
20,
799,
172,
6,
550,
15764,
596,
400,
8,
465... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how do I get all items from a iteration combobox
===
I used to use getItems get all items in a dropdownList.
http://dev.developer.rallydev.com/developer/iteration-dropdown
but in the API 2.0 I can't find equivalent function to get all items from the iterations combobox.
Any idea?
anthoer issue:
using getRawValue returns only the iteration name, how could I get also the iteration start date and end date?
| 0 | [
2,
184,
107,
31,
164,
65,
3755,
37,
21,
23534,
22621,
5309,
800,
3726,
3726,
31,
147,
20,
275,
164,
2119,
79,
18,
164,
65,
3755,
19,
21,
2804,
2968,
5739,
9,
7775,
6903,
14438,
9,
26051,
106,
9,
139,
1326,
14438,
9,
960,
118,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Update Eclipse project with local repository changes push
===
I have a local GIT repository which is shared for a co-worker to pull from/push to it. Now he has done his first push, but I'm unable to update my Eclipse project with his changes. In fact his changes appear like deletions to me, that is, Synchronize shows as me having deleted his recently pushed files:
![enter image description here][1]
**Overwrite** throws an error:
An internal error occurred during: "Overwriting 3 resources.".
Attempted to beginRule: F/Core/src/com/zktechnology/android/core, does not match outer scope rule: F/Core/src/com/zktechnology/android/core/db
**Merge** says there are no changes to merge.
[1]: http://i.stack.imgur.com/F2qKb.png | 0 | [
2,
11100,
11652,
669,
29,
375,
24869,
1693,
3250,
800,
3726,
3726,
31,
57,
21,
375,
13,
10404,
24869,
56,
25,
2592,
26,
21,
326,
8,
22560,
20,
2201,
37,
118,
26973,
20,
32,
9,
130,
24,
63,
677,
33,
64,
3250,
15,
47,
31,
22,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
wrap panel in listbox.itempanel not working in sliverlight4
===
I am using silverlight 4. I am binding list of images to the list box and i want the images to be wrapped. here is my xaml.
<ListBox x:Name="lstimages" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="1">
<ListBox.ItemTemplate>
<DataTemplate>
<Image x:Name="imglstbx" Height="100" Width="100" Source="{Binding ImagePath}"></Image>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<layoutToolkit:WrapPanel Orientation="Horizantal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
But its showing all the images in the horizantally its not wrapping to the next line . whats the issue with my code. how to solve it ?
Thanks for any help. | 0 | [
2,
8118,
4113,
19,
968,
5309,
9,
2119,
15356,
7440,
52,
638,
19,
27890,
3130,
300,
800,
3726,
3726,
31,
589,
568,
1172,
3130,
268,
9,
31,
589,
8728,
968,
16,
3502,
20,
14,
968,
1649,
17,
31,
259,
14,
3502,
20,
44,
3684,
9,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Android GPS ACCURACY_HIGH causes force close?
===
I am working on a GPS portion and for criteria, I can set the accuracy to ACCURACY_FINE, ACCURACY_MEDIUM etc. However, for some reason I keep getting a force close error If i set it the Criteria to ACCURACY_HIGH. any ideas on what might be causing it?
Heres my Manifest, im pretty sure everything is ok, since I am able to use different Criterias:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
Here are my logs:
07-05 08:51:48.641: W/dalvikvm(1040): threadid=1: thread exiting with uncaught exception (group=0x40015578)
07-05 08:51:48.657: E/AndroidRuntime(1040): FATAL EXCEPTION: main
07-05 08:51:48.657: E/AndroidRuntime(1040): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jetdelivery.mobile/com.jetdelivery.mobile.statuspage}: java.lang.IllegalArgumentException: accuracy=3
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.os.Handler.dispatchMessage(Handler.java:99)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.os.Looper.loop(Looper.java:130)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread.main(ActivityThread.java:3687)
07-05 08:51:48.657: E/AndroidRuntime(1040): at java.lang.reflect.Method.invokeNative(Native Method)
07-05 08:51:48.657: E/AndroidRuntime(1040): at java.lang.reflect.Method.invoke(Method.java:507)
07-05 08:51:48.657: E/AndroidRuntime(1040): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
07-05 08:51:48.657: E/AndroidRuntime(1040): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
07-05 08:51:48.657: E/AndroidRuntime(1040): at dalvik.system.NativeStart.main(Native Method)
07-05 08:51:48.657: E/AndroidRuntime(1040): Caused by: java.lang.IllegalArgumentException: accuracy=3
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.location.Criteria.setAccuracy(Criteria.java:223)
07-05 08:51:48.657: E/AndroidRuntime(1040): at com.jetdelivery.mobile.statuspage.onCreate(statuspage.java:125)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-05 08:51:48.657: E/AndroidRuntime(1040): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
07-05 08:51:48.657: E/AndroidRuntime(1040): ... 11 more
I am developing using Android 2.3.5 firmware. Thanks! | 0 | [
2,
13005,
18298,
11270,
1,
4542,
4047,
558,
543,
60,
800,
3726,
3726,
31,
589,
638,
27,
21,
18298,
2980,
17,
26,
9157,
15,
31,
92,
309,
14,
11270,
20,
11270,
1,
7509,
15,
11270,
1,
28451,
2722,
9,
207,
15,
26,
109,
1215,
31,
6... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How dangerous is it to output certain content without escaping it first
===
Following on from a question I asked about escaping content when building a custom cms I wanted to find out how dangerous not escaping content from the db can be - assume the data ha been filtered/validated prior to insertion in the db.
I know it's a best practice to escape output but I'm just not sure how easy or even possible it is for someone to 'inject' a value into page content that is to be displayed.
For example let's assume this content with HTML markup is displayed using a simple echo statement:
<p>hello</p>
Admittedly it won't win any awards as far as content writing goes ;)
My question is can someone alter that for evil purposes assuming filtered/validated prior to db insertion?
Thanks a lot in advance. | 0 | [
2,
184,
3342,
25,
32,
20,
5196,
1200,
2331,
366,
14700,
32,
64,
800,
3726,
3726,
249,
27,
37,
21,
1301,
31,
411,
88,
14700,
2331,
76,
353,
21,
5816,
2390,
18,
31,
417,
20,
477,
70,
184,
3342,
52,
14700,
2331,
37,
14,
13,
9007,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Many many css backgrounds performance
===
I am trying different methods to turn an image into divs that represent each pixel.
One method has been using php imagecolorat to create divs with a `background-color` which works well.
However what if I had **thousands** of divs `width:1px;height:1pxx;` each with the same css `background-image` with incremented background position?
What performance hit would this have? Ie: does the browser draw the entire image many times or only the section that is visible as the background? Note the original image is several hundred kb.
Thanks | 0 | [
2,
151,
151,
272,
18,
18,
2395,
18,
956,
800,
3726,
3726,
31,
589,
749,
421,
3195,
20,
805,
40,
1961,
77,
13,
12916,
18,
30,
3501,
206,
18146,
9,
53,
2109,
63,
74,
568,
13,
26120,
1961,
11282,
721,
20,
1600,
13,
12916,
18,
29,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Reading a clients data input in a NodeJS TCP Server
===
Im trying to create a NodeJS TCP Server, that will read to the clients input and then act accordingly.
I'd like to know how I can read the data, so I can set up conditionals to perform process.
var net = require('net');
var server = net.createServer(function (socket) {
socket.on('data', function(data) {
buf = new Buffer(256);
len = buf.write(data.toString());
if (buf.toString('utf8', 0, len) === "test"){
console.log("you typed test");
}
console.log(len + " bytes: " + buf.toString('utf8', 0, len));
});
socket.write("Connected to server.\r\n");
});
server.listen(8080, "127.0.0.1");
I am outputting the value inputted - `console.log(len + " bytes: " + buf.toString('utf8', 0, len));` but my if statement isnt matching 'test' when I type it in the client window.
Any help is appreciated
-chris
| 0 | [
2,
1876,
21,
7421,
1054,
6367,
19,
21,
15421,
728,
18,
13,
38,
7439,
8128,
800,
3726,
3726,
797,
749,
20,
1600,
21,
15421,
728,
18,
13,
38,
7439,
8128,
15,
30,
129,
1302,
20,
14,
7421,
6367,
17,
94,
601,
12932,
9,
31,
22,
43,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is it possible to test if a text file can be loaded with a NSStringEncoding without actually loading it?
===
I'm working on an app that handles text files.
On the open dialog accessory view, when the user choses a file I want to display on a NSPopUpButton the supported encodings for the selected file, but so far the only way I could find to test if a file can be opened with a certain encoding is to actually trying to load it to a NSString.
Right now I'm doing this for each encoding:
NSString *fileContents = [NSString stringWithContentsOfURL:selectedURL encoding:encoding error:nil];
if (fileContents)
{
/* Add encoding to the list of supported encodings */
}
This loads the whole file to the `fileContents` object.
Is it possible possible to only test if the file can be loaded without actually loading it? | 0 | [
2,
25,
32,
938,
20,
1289,
100,
21,
1854,
3893,
92,
44,
8572,
29,
21,
13,
2172,
11130,
219,
15458,
366,
1121,
12797,
32,
60,
800,
3726,
3726,
31,
22,
79,
638,
27,
40,
4865,
30,
3053,
18,
1854,
6488,
9,
27,
14,
368,
28223,
26371... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Python django Error: no module named modeltranslation. Trying to migrate web site
===
I'm new at Python and Django so I received a project in Django.
I have my local environment with Python 2.7, wamp Apache 2.2, Django 4.0. and MySQL.
So I'm trying to make this work.
And I get the error : No module named modeltranslation
I checked the documentation of modeltranslation and everything seems to be in order.
What am I doing wrong?
If the version that I received was running y other configuration, lets say Python 2.6 and so on, does this has much to do with the problem? Isn't it suppose that upper versions run lower versions?
Any clue please?
| 0 | [
2,
20059,
3857,
14541,
7019,
45,
90,
12613,
377,
1061,
27455,
9,
749,
20,
22985,
2741,
689,
800,
3726,
3726,
31,
22,
79,
78,
35,
20059,
17,
3857,
14541,
86,
31,
420,
21,
669,
19,
3857,
14541,
9,
31,
57,
51,
375,
2307,
29,
20059,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Creating Authentication and Authorization on ASP.NET, with ability to access LDAP (Urgent help needed by ASP.NET Expert)
===
So, I've gotten weary with trying to search for my problem online.
I am currently creating an ASP.NET 2.0 application. The application currently is connected to a database which stores all the information I need to store. I also have connection to the LDAP directory at my workplace on it. I am using the LDAP directory for my application as everything is tracked by employee ids. I now need to add authentication and authorization.
Since my workplace is large, I need the ability to limit who has access to the website within the company as well as what they are allowed to do on the website. I know that ASP.NET has some sort of authentication and authorization, but I am completely oblivious as to how it works.
My current solution is to add a table to my database with two columns (employee id and access_id). The employee id can be used to pull information from LDAP about the employee whenever I need to. The access_id is a set of integers that represent what the user is allowed to see on the website.
When the user first starts a session on my website I use their nt id and pull the employee id from LDAP. I then look up all the access_id's and store them in an array for the session. Everytime a user accesses part of the website, I check whether they have the access_id associated with that section and allow or disallow them based on that. My first access_id of 1 allows the user to see the webpage by setting the visibility of <html id="Enter" runat="server"/> in C# as
if(access_id == 1)
Enter.visible = true;. | 0 | [
2,
2936,
27963,
17,
22677,
27,
28,
306,
9,
2328,
15,
29,
2165,
20,
1381,
644,
20472,
13,
5,
911,
7685,
448,
851,
34,
28,
306,
9,
2328,
5390,
6,
800,
3726,
3726,
86,
15,
31,
22,
195,
4094,
19536,
29,
749,
20,
2122,
26,
51,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Enlarge images in grid view - Android development
===
I'm just getting into Android development and have been following Google's HelloGridView tutorial (http://developer.android.com/guide/topics/ui/layout/gridview.html). I've understood the tutorial and wanted to add an additional function to enlarge a picture of whatever grid is clicked. The code below shows what I've tried so far and I think I'm not getting the correct "imageId" for each grid.
MainActivity.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
long imageId = ImageAdapter.getAdapter.getItemId(position);
Intent fullScreenIntent = new Intent(v.getContext(), FullScreenImage.class);
fullScreenIntent.putExtra(MainActivity.class.getName(), imageId);
MainActivity.this.startActivity(fullScreenIntent);
}
});
}
}
ImageAdapter.java
import android.content.Context;
import android.view.FocusFinder;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;
public class ImageAdapter extends BaseAdapter {
private Context mContext;
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
return mThumbIds[position];
}
// create a new ImageView for each item referenced by the Adapter.
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled, initialize some attributes
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setPadding(8, 8, 8, 8);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
return imageView;
}
// reference to our images
private Integer[] mThumbIds = {
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7,
R.drawable.sample_0, R.drawable.sample_1,
R.drawable.sample_2, R.drawable.sample_3,
R.drawable.sample_4, R.drawable.sample_5,
R.drawable.sample_6, R.drawable.sample_7
};
}
FullScreenImage.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
public class FullScreenImage extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_image_view);
Intent intent = getIntent();
long imageId = (Long) intent.getExtras().get(MainActivity.class.getName());
ImageView imageView = (ImageView)findViewById(R.id.fullscreenimage);
imageView.setLayoutParams(new ViewGroup.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT));
imageView.setImageResource((int)imageId);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
}
}
Also got activity_main.xml with grid view and full_screen_view.xml with ImageView that fills the whole screen.
Thanks | 0 | [
2,
1957,
11312,
3502,
19,
7354,
1418,
13,
8,
13005,
522,
800,
3726,
3726,
31,
22,
79,
114,
1017,
77,
13005,
522,
17,
57,
74,
249,
8144,
22,
18,
10975,
16375,
4725,
29724,
13,
5,
21127,
6903,
26051,
106,
9,
290,
18524,
9,
960,
11... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Creating a subscribe feature (linking multiple tables?)?
===
I currently have 3 sql tables "news" "content" and "users".
What I'm trying to achieve here is a subscribe/follow feature that allows users to follow anything listed inside the "content" table and then receive notifications whenever news is added regarding that content to the "news table". Will I need to link the 2 tables "content" and "news"in some way?. Other than I don't have any ideas at the moment. Any help will be really appreciated! | 0 | [
2,
2936,
21,
13,
20330,
1580,
13,
5,
6258,
68,
1886,
7484,
60,
6,
60,
800,
3726,
3726,
31,
871,
57,
203,
4444,
255,
7484,
13,
7,
14962,
7,
13,
7,
25424,
7,
17,
13,
7,
16704,
18,
7,
9,
98,
31,
22,
79,
749,
20,
4689,
235,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Greasemonkey: clicking confirm box
===
My script clicks an image with an anchor href and an onclick href, but the onclick href has a confirm box that pops up once its clicked. How do I get the script to click ok in that confirm box? | 0 | [
2,
21167,
2111,
4237,
45,
25590,
10265,
1649,
800,
3726,
3726,
51,
3884,
10840,
18,
40,
1961,
29,
40,
6265,
746,
14057,
17,
40,
27,
150,
10129,
746,
14057,
15,
47,
14,
27,
150,
10129,
746,
14057,
63,
21,
10265,
1649,
30,
1675,
18,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is there a 3rd party add-in/plugin for VS that will replace controls?
===
Delphi has the GExperts add-in (terminology?) that allows you to, say, select some comboboxes and then replace them with TextBoxes (TComboBox and TEdit, I guess).
Is such functionality available for Visual Studio (2010 Pro)? | 0 | [
2,
25,
80,
21,
203,
897,
346,
3547,
8,
108,
118,
18527,
5831,
26,
4611,
30,
129,
3934,
8671,
60,
800,
3726,
3726,
23030,
63,
14,
489,
1706,
17631,
18,
3547,
8,
108,
13,
5,
3964,
108,
4202,
60,
6,
30,
2965,
42,
20,
15,
395,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Cassandra-query on part of the composite key; range queries
===
I am using a composite primary key consisting of 2 strings Name1, Name2 and a timestamp (e.g. 'Joe:Smith:123456'). I want to query a range of timestamps given an equality condition for either Name1 or Name2.
For example, in SQL:
SELECT * FROM testcf WHERE (timestamp > 111111 AND timestamp < 222222 and Name2 = 'Brown');
and
SELECT * FROM testcf WHERE (timestamp > 111111 AND timestamp < 222222 and Name1 = 'Charlie);
From my understanding, the first part of the composite key is the partition key, so the second query is straightforward, but the first query would require some kind of index. Is it even possible to create a separate index on a component of the composite key? Or am I misunderstanding something here? | 0 | [
2,
17825,
8,
8190,
93,
27,
141,
16,
14,
12639,
1246,
73,
978,
9386,
2829,
800,
3726,
3726,
31,
589,
568,
21,
12639,
1256,
1246,
4160,
16,
172,
7887,
204,
165,
15,
204,
135,
17,
21,
436,
38,
10158,
13,
5,
62,
9,
263,
9,
13,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Writing an image file from array of xyz coordinate
===
I'm currently working on a fractal generator in C# and I'm trying to export my set of coordinates to a very simple image file.
What i have is a 1-dimensional array of 3d point (x, y and z coordinate) and i wish to save it to an image where the z value will be the color of the pixel (grayscale only).
From what i gathered, the RAW format would be the easiest to work with, but even then i couldn't find documentation on it. I then looked at the namespace System.Drawing but i'm at a lost, it seems overly complicated for what i'm trying to achieve.
Is there an easy way to write such an image? | 0 | [
2,
1174,
40,
1961,
3893,
37,
7718,
16,
13,
15161,
380,
15154,
800,
3726,
3726,
31,
22,
79,
871,
638,
27,
21,
13,
15891,
3663,
15286,
19,
272,
5910,
17,
31,
22,
79,
749,
20,
7487,
51,
309,
16,
13714,
20,
21,
253,
1935,
1961,
38... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Sencha Touch 2 - Position a floating panel next to source button
===
I have this code which creates a floating panel centered to the screen:
Ext.define('myapp.view.ButtonNav', {
extend: 'Ext.Container',
xtype: 'myapp_buttonnav',
config: {
fullscreen: false,
layout: 'hbox',
items: [
{
xtype: 'button',
text: 'Button 1',
listeners: {
tap: function () {
var panel = Ext.Viewport.add({
xtype: 'panel',
defaultType: 'button',
baseCls: 'btn1_cont',
centered: true,
layout: {
type: 'vbox',
align: 'center',
pack: 'center'
},
items: [
{
baseCls: 'btn1',
text: 'HOME PAGE',
handler: function() {
Ext.Viewport.setActiveItem({
xtype: 'myapp_homepage'
});
panel.destroy();
}
}
],
top: // SET TOP TO SOURCE BUTTON
left: // SET LEFT TO SOURCE BUTTON
});
}
}
},
]
}
});
As you can see, it is a container, with a button which when clicked shows a floating panel.
How do i position the floating panel centered to the button that triggered the floating panel? | 0 | [
2,
8252,
1651,
1723,
172,
13,
8,
649,
21,
8319,
4113,
328,
20,
1267,
5167,
800,
3726,
3726,
31,
57,
48,
1797,
56,
9695,
21,
8319,
4113,
10583,
20,
14,
2324,
45,
1396,
38,
9,
546,
7509,
5,
22,
915,
7753,
9,
4725,
9,
811,
444,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Purpose of using sub routines over functions
===
I've been working with Access for a while now, and although I understand the obvious benefit of a Function over a Sub, been that it can return values as a result, I'm not sure as to why I should use a Sub over a Function. After all unless I'm mistaken; Functions can do everything Subs can do? | 0 | [
2,
2131,
16,
568,
972,
8275,
18,
84,
3719,
800,
3726,
3726,
31,
22,
195,
74,
638,
29,
1381,
26,
21,
133,
130,
15,
17,
419,
31,
1369,
14,
4674,
4234,
16,
21,
1990,
84,
21,
972,
15,
74,
30,
32,
92,
788,
4070,
28,
21,
829,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Editing components array
===
I developed a small application in Delphi with TEdit components on it.![enter image description here][2]
I used this function to validate if the component fields are not empty.
function TF_config.Validatefields:boolean;
var
i : integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if (Components[i]is TEdit) then
begin
if ((TEdit(Components[i]).Text) ='') then
begin
MessageDlg('Enter data in all the fields',mtWarning,[MBOK],0);
TEdit(Components[i]).SetFocus;
result := false;
exit;
end;
end; //end for TEdit
end; //end component count
result := true;
end;
Now I have to add one more component
![enter image description here][1]
The order in which the function checks for data if valid is
*ID->Name->Address->Phone->Age*. But I want it to be *ID->Name->Address->Age->Phone*.
I tried solving it deleting the *Phone* Edit component and later add it after adding the *Age* Edit component.Or using the *Phone* Edit component for *Age* and add new Edit component for *Phone*. This is easier for few components, but becomes tedious when having many of them.
So I was wondering if we could arrange the components in a manner that suits us. Is this possible?
[1]: http://i.stack.imgur.com/Sp9AS.jpg
[2]: http://i.stack.imgur.com/NXAGU.jpg | 0 | [
2,
9510,
5090,
7718,
800,
3726,
3726,
31,
885,
21,
284,
3010,
19,
23030,
29,
7859,
242,
5090,
27,
32,
9,
187,
2558,
13679,
1961,
5318,
235,
500,
2558,
135,
500,
31,
147,
48,
1990,
20,
7394,
1373,
100,
14,
5912,
2861,
50,
52,
242... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to display the images from url in tableview in iPhone
===
I am using the following code to display the images in the table view,
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[xmlParser templates] count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
Temp *currentTemplate = [[xmlParser templates] objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
CGRect contentNameLabelFrame = CGRectMake(64, 2, 250, 20);
UILabel *contentNameLabelF = [[UILabel alloc] initWithFrame:contentNameLabelFrame];
contentNameLabelF.tag = 0011;
contentNameLabelF.font = [UIFont boldSystemFontOfSize:12];
contentNameLabelF.text = @"Template Name:";
contentNameLabelF.textColor = [UIColor orangeColor];
[cell.contentView addSubview:contentNameLabelF];
CGRect contentFrame = CGRectMake(115, 2, 250, 20);
UILabel *contentLabel = [[UILabel alloc] initWithFrame:contentFrame];
contentLabel.tag = 0012;
contentLabel.font = [UIFont boldSystemFontOfSize:12];
[cell.contentView addSubview:contentLabel];
CGRect contentnumberofcontacts = CGRectMake(63, 20, 250, 13);
UILabel *contentnumberofcontactsLabel = [[UILabel alloc] initWithFrame:contentnumberofcontacts];
contentnumberofcontactsLabel.tag = 0013;
contentnumberofcontactsLabel.font = [UIFont boldSystemFontOfSize:10];
contentnumberofcontactsLabel.text = @"Image:";
contentnumberofcontactsLabel.textColor = [UIColor brownColor];
[cell.contentView addSubview:contentnumberofcontactsLabel];
CGRect contentnumberFrame = CGRectMake(115, 20, 250, 13);
UILabel *contentnumberLabel = [[UILabel alloc] initWithFrame:contentnumberFrame];
contentnumberLabel.tag = 0014;
contentnumberLabel.font = [UIFont systemFontOfSize:10];
[cell.contentView addSubview:contentnumberLabel];
CGRect contentstatus = CGRectMake(78, 35, 250, 10);
UILabel *contentstatuslabel = [[UILabel alloc] initWithFrame:contentstatus];
contentstatuslabel.tag = 0015;
contentstatuslabel.font = [UIFont boldSystemFontOfSize:10];
contentstatuslabel.text = @"Category:";
contentstatuslabel.textColor = [UIColor grayColor];
[cell.contentView addSubview:contentstatuslabel];
CGRect statusFrame = CGRectMake(115, 35, 250, 10);
UILabel *statusLabel = [[UILabel alloc] initWithFrame:statusFrame];
statusLabel.tag = 0016;
statusLabel.font = [UIFont systemFontOfSize:10];
[cell.contentView addSubview:statusLabel];
}
UILabel *contentLabel = (UILabel *)[cell.contentView viewWithTag:0012];
contentLabel.text = [currentTemplate templateName];
UILabel *contentnumberLabel = (UILabel *)[cell.contentView viewWithTag:0014];
contentnumberLabel.text = [currentTemplate imagePath];
UILabel *statusLabel = (UILabel *)[cell.contentView viewWithTag:0016];
statusLabel.text = [currentTemplate category];
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 75;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
xmlParser = [[ViewController alloc] loadXMLByURL:@"http://www.xxxxx.net/xxxxx/xxxx.aspx?type=xxxxx&xxxx="];
}
-(id)loadXMLByURL:(NSString *)urlString
{
_templates = [[NSMutableArray alloc] init];
NSURL *url = [NSURL URLWithString:urlString];
NSData *data = [[NSData alloc] initWithContentsOfURL:url];
parser = [[NSXMLParser alloc] initWithData:data];
parser.delegate = self;
[parser parse];
return self;
}
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
currentNodeContent = (NSMutableString *) [string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
}
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
if([elementName isEqualToString:@"template_maste"])
{
currentTemplate = [Temp alloc];
}
if ([elementName isEqualToString:@"img_path"])
{
currentTemplate = [Temp alloc];
isStatus = YES;
}
}
-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
if([elementName isEqualToString:@"Template_name"])
{
currentTemplate.templateName = currentNodeContent;
}
if([elementName isEqualToString:@"img_path"])
{
currentTemplate.imagePath = currentNodeContent;
}
if([elementName isEqualToString:@"Category"])
{
currentTemplate.category = currentNodeContent;
}
if([elementName isEqualToString:@"template_maste"])
{
[self.templates addObject:currentTemplate];
currentTemplate = nil;
currentNodeContent = nil;
}
}
I am able to display the path of the image in the tableView, but i need to display the images in the tableView from the url.
I searched for the solution, but i was not able to get the solution,
Thanks in advance.
| 0 | [
2,
184,
20,
3042,
14,
3502,
37,
287,
6362,
19,
859,
4725,
19,
21024,
800,
3726,
3726,
31,
589,
568,
14,
249,
1797,
20,
3042,
14,
3502,
19,
14,
859,
1418,
15,
13,
8,
5,
2172,
6391,
13699,
6,
16299,
1041,
10579,
18,
108,
5924,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Use delay on jQuery Animation
===
I am using this code to animate 3 divs, How can I add delay so that animation will happen step by step. Now 3 divs are animate on same time. Please help me.
Here is my code:
$(document).ready(function() {
//iPhone Animation / Define Variable
var iPhoneOne = $(".iphoneOne");
var iPhoneTwo = $(".iphoneTwo");
var free = $(".free");
iPhoneOne.animate({marginTop:'80px',opacity:1},{duration:"slow", easing:"easeOutBounce"});
iPhoneTwo.animate({marginTop:'80px',opacity:1},{duration:"slow", easing:"easeOutBounce"});
free.show("fast");
}); | 0 | [
2,
275,
7255,
27,
487,
8190,
93,
6236,
800,
3726,
3726,
31,
589,
568,
48,
1797,
20,
14487,
591,
203,
13,
12916,
18,
15,
184,
92,
31,
3547,
7255,
86,
30,
6236,
129,
2384,
1424,
34,
1424,
9,
130,
203,
13,
12916,
18,
50,
14487,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.