unified_texts stringlengths 32 30.1k | OpenStatus_id int64 0 4 | input_ids list | token_type_ids list | attention_mask list |
|---|---|---|---|---|
jQuery Chosen does not show data-placeholder when it is filled
===
I am using jQuery Chosen plugin in my ASP.NET MVC application. The `data-placeholder` attribute is not working when the dropdownlist has items in it. Instead of showing default text it automatically selects the first item in the list.
This is how I define my dropdownlist.
@Html.DropDownListFor(m => m.Keep, Model.Data,
new { @class = "chzn-select", data_placeholder = "Default..." })
If Model.Data is empty (it is filled in view model using EF), then default text is displayed. Otherwise, the first item is selected. I always want my dropdownlist to show default value.
I apply the plugin via `$('.chzn-select').chosen();` Nothing special.
Any ideas ? Thanks in advance. | 0 | [
2,
487,
8190,
93,
2519,
630,
52,
298,
1054,
8,
5119,
12427,
76,
32,
25,
1943,
800,
3726,
3726,
31,
589,
568,
487,
8190,
93,
2519,
10922,
108,
19,
51,
28,
306,
9,
2328,
307,
8990,
3010,
9,
14,
13,
1,
18768,
8,
5119,
12427,
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... |
Very poor webserver performance
===
so i ran this command "ab -c 50 -n 5000 http://lala.la" today on the server, and i got these "amazing" results:
Document Path: /
Document Length: 26476 bytes
Concurrency Level: 50
Time taken for tests: 1800.514 seconds
Complete requests: 2427
Failed requests: 164
(Connect: 0, Receive: 0, Length: 164, Exceptions: 0)
Write errors: 0
Total transferred: 65169733 bytes
HTML transferred: 64345285 bytes
Requests per second: 1.35 [#/sec] (mean)
Time per request: 37093.408 [ms] (mean)
Time per request: 741.868 [ms] (mean, across all concurrent requests)
Transfer rate: 35.35 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.7 0 22
Processing: 4335 36740 9513.2 33755 102808
Waiting: 7 33050 8655.1 30407 72691
Total: 4355 36741 9512.4 33755 102808
Percentage of the requests served within a certain time (ms)
50% 33754
66% 37740
75% 40977
80% 43010
90% 47742
95% 56277
98% 62663
99% 71301
100% 102808 (longest request)
This is on a newly installed Nginx server, using Cloudflare and APC.
Dont think ive ever seen such poor performance, so what the heck can be causing it?
Thanks. | 0 | [
2,
253,
1696,
2741,
10321,
106,
956,
800,
3726,
3726,
86,
31,
717,
48,
1202,
13,
7,
2297,
13,
8,
150,
1222,
13,
8,
103,
16024,
7775,
6903,
25152,
9,
531,
7,
786,
27,
14,
8128,
15,
17,
31,
330,
158,
13,
7,
3812,
9768,
7,
1736... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Performance issues with accelerometer
===
I have an accelerometer that I use to shift layers of UIImageviews slightly, to get some depth perception.
Here is the code I use to instantiate the animations and accelerometer inside my viewdidload method.
UIAccelerometer *accelerator = [UIAccelerometer sharedAccelerometer];
accelerator.delegate = self;
accelerator.updateInterval = 0.1f;
animateLayer0 = [CABasicAnimation animationWithKeyPath:@"position"];
animateLayer1 = [CABasicAnimation animationWithKeyPath:@"position"];
animateLayer2 = [CABasicAnimation animationWithKeyPath:@"position"];
animateLayer0.duration = 0.1;
animateLayer0.fillMode = kCAFillModeForwards;
animateLayer0.removedOnCompletion = false;
animateLayer1.duration = 0.1;
animateLayer1.fillMode = kCAFillModeForwards;
animateLayer1.removedOnCompletion = false;
animateLayer2.duration = 0.1;
animateLayer2.fillMode = kCAFillModeForwards;
animateLayer2.removedOnCompletion = false;
Here is the accelerometer function's code:
-(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{
self.difference = 0 - acceleration.y;
if (fabsf(self.difference) > 0.01) {
for (int i = 0; i < self.accLayerPoints0.count; i++) {
NSValue *val = [self.accLayerPoints0 objectAtIndex:i];
CGPoint origin = [val CGPointValue];
float x = origin.x + (acceleration.y * ACC_LAYER0_THRESHOLD);
[animateLayer0 setToValue:[NSValue valueWithCGPoint:CGPointMake(x, origin.y)]];
UIImageView *layer0 = [self.accLayerObjects0 objectAtIndex:i];
[layer0.layer addAnimation:animateLayer0 forKey:nil];
}
for (int i = 0; i < self.accLayerPoints1.count; i++) {
NSValue *val = [self.accLayerPoints1 objectAtIndex:i];
CGPoint origin = [val CGPointValue];
float x = origin.x + (acceleration.y * ACC_LAYER1_THRESHOLD);
[animateLayer1 setToValue:[NSValue valueWithCGPoint:CGPointMake(x, origin.y)]];
UIImageView *layer0 = [self.accLayerObjects1 objectAtIndex:i];
[layer0.layer addAnimation:animateLayer1 forKey:nil];
}
for (int i = 0; i < self.accLayerPoints2.count; i++) {
NSValue *val = [self.accLayerPoints2 objectAtIndex:i];
CGPoint origin = [val CGPointValue];
float x = origin.x + (acceleration.y * ACC_LAYER2_THRESHOLD);
[animateLayer2 setToValue:[NSValue valueWithCGPoint:CGPointMake(x, origin.y)]];
UIImageView *layer0 = [self.accLayerObjects2 objectAtIndex:i];
[layer0.layer addAnimation:animateLayer2 forKey:nil];
}
}
}
My problem is after a while the ipad starts having performance issues, starts lagging.
I've used the Allocations tool to verify that it is the code in the accelerometer function that's causing the issue.
Is there a way to release the objects thats not in use anymore or clean the code?
I'm using ARC so I'm not sure how the cleaning works. | 0 | [
2,
956,
1549,
29,
7602,
532,
106,
17325,
800,
3726,
3726,
31,
57,
40,
7602,
532,
106,
17325,
30,
31,
275,
20,
4471,
9124,
16,
13,
5661,
22039,
4725,
18,
1847,
15,
20,
164,
109,
5204,
9332,
9,
235,
25,
14,
1797,
31,
275,
20,
63... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
google indexed my home page as https:(
===
im having a BIG problem the last week...iv lauched my new website and indexed it to google. When i search google for my website (webheadz.ie) my home page is returning as https(i want it to be www or even http), my other pages(about, contact...etc) are not,...i dont have any links in my website that are https and i cant find any external links that are https...i was told to set up a redirect 301 but that didnt work, my hosting service emailed me and they said that i have to set a ZEUS redirect, but i have no idea how to set that up....any help would be greatly apreciated, iv been trying to fix this the last week and im ready to give up...Can anyone tell me WHY in the first place its https and how can i fix this....thanks!! | 0 | [
2,
8144,
4348,
69,
51,
213,
2478,
28,
7775,
18,
45,
5,
800,
3726,
3726,
797,
452,
21,
580,
1448,
14,
236,
877,
9,
9,
9,
3757,
7164,
6261,
51,
78,
2271,
17,
4348,
69,
32,
20,
8144,
9,
76,
31,
2122,
8144,
26,
51,
2271,
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... |
Bug in VBA/Scripting.Dictionary?
===
Similar to [this issue][1], I think I've found a bug in VBA and/or when using a `Scripting.Dictionary` object? (At the very least, the outcome of the code below is unexpected.)
Option Explicit
Sub test()
Dim d As Variant
Dim i As Integer
Dim s As String
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "a"
Debug.Print d.Count ' Prints '1' as expected
For i = 1 To d.Count
s = d.Item(i)
Debug.Print s ' Prints ' ' (null) instead of 'a'
Next i
Debug.Print d.Count ' Prints '2' instead of '1'
End Sub
Watching the object, I can actually see that it has two items, the key for the newly added is `1`, as added from `i`. If I increase this loop to a higher number, then the number of items in the dictionary is increased, once for each loop.
*I have tested this in Excel 2003 only.
I can work around this with other looping methods, but this caught me off guard when I was trying to store objects and was getting an **object expected error** on the `s = d.Item(i)` line. Have I done something wrong with this code, or is this really the expected result?
For the record, I know that I can do things like this:
For Each v In d.Keys
Set o = d.item(v)
Next v
But I'm more curious about why I can't seem to iterate through the items by number.
[1]:http://stackoverflow.com/a/9836919/698590 | 0 | [
2,
6256,
19,
566,
969,
118,
8741,
68,
9,
22595,
1857,
60,
800,
3726,
3726,
835,
20,
636,
1565,
1513,
500,
2558,
165,
500,
15,
31,
277,
31,
22,
195,
216,
21,
6256,
19,
566,
969,
17,
118,
248,
76,
568,
21,
13,
1,
8741,
68,
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... |
How to subtract the previous rows column from current column and create a new dimension in the array with this value using numpy?
===
What I want to do is take my current array and subtract the previous rows column value from the current rows column value. I also want to take the result and add it to the array as a new dimension.
Example Array:
[[1,2,4,7,9,15], [3, 4,3,5,10,2], [5,6,56,7,20,1]]
Lets say I want to do this with the 4th column so I want the output to be an array that looks like this:
[[1,2,4,7,9,15,0], [3, 4,3,5,10,2,-2], [5,6,56,7,20,1,2]]
Thanks
| 0 | [
2,
184,
20,
27031,
14,
1158,
11295,
4698,
37,
866,
4698,
17,
1600,
21,
78,
9547,
19,
14,
7718,
29,
48,
1923,
568,
13,
6336,
6448,
60,
800,
3726,
3726,
98,
31,
259,
20,
107,
25,
247,
51,
866,
7718,
17,
27031,
14,
1158,
11295,
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... |
QT Standalone application for symbian
===
how to build standalone QT application(no need to install qt components/dependency) for symbian os?
please help me sir | 0 | [
2,
2593,
38,
26986,
3010,
26,
13,
7261,
10035,
800,
3726,
3726,
184,
20,
1895,
26986,
2593,
38,
3010,
5,
251,
376,
20,
16146,
2593,
38,
5090,
118,
19038,
8883,
6,
26,
13,
7261,
10035,
13,
759,
60,
2247,
448,
55,
927,
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,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Java JComboBox.setSelectedItem() not updating dropdown list
===
So basically i want to make function updating current item in JComboBox:
@Override
public void updateId(String id) {
boolean old = notify;
notify = false;
comboBox.setEditable(true);
comboBox.setSelectedItem(id);
comboBox.setEditable(false);
notify = old;
}
The result is this:
http://i.stack.imgur.com/qbORT.jpg
1. ComboBox is bound to textbox,
2. I change textbox value, which is calling updateId(),
3. Expanding combobox,
4. Selecting item that got changed,
ComboBox's dropdown list does not reflect change made to selected item, in given example there should be "xxx" at the bottom of dropdown list. | 0 | [
2,
8247,
487,
960,
1192,
5309,
9,
3554,
18,
7138,
2119,
79,
5,
6,
52,
71,
43,
1880,
2804,
2968,
968,
800,
3726,
3726,
86,
11374,
31,
259,
20,
233,
1990,
71,
43,
1880,
866,
9101,
19,
487,
960,
1192,
5309,
45,
13,
1,
2549,
11891... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 get a landscape launch image to actually appear when launched?
===
I have read and put into practice everything [here][1], an Apple doc on launch images.
My app supports auto-rotation and according to the document above, if you specify a Landscape launch image for iPad, it will be used when the app launches in landscape mode.
But I have never seen this actually happen in practice. The iPad can be oriented landscape, but the Portrait launch image always shows. This has been my experience on iOS 4 and 5 and on several different apps.
What is necessary to get a Landscape launch image to actually appear?
[1]: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App-RelatedResources.html#//apple_ref/doc/uid/TP40007072-CH6-SW12 | 0 | [
2,
184,
20,
164,
21,
4453,
3394,
1961,
20,
1121,
1893,
76,
1601,
60,
800,
3726,
3726,
31,
57,
1302,
17,
442,
77,
1345,
796,
636,
6836,
500,
2558,
165,
500,
15,
40,
4037,
9765,
27,
3394,
3502,
9,
51,
4865,
6747,
3108,
8,
661,
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... |
iOS checking if Json return has Key.
===
I'm using NSJsonSerialization to get back a json return after I POST something. I either get back my correct return or I get:
{
"status":"false"
}
I need to check if I got back my return before I try to parse it (since it crashes if the Keys I ask for don't exist) However if I check against
[whatever objectForKey:@"status"] == nil
When it is nil it's ok, however if it does not exist it crashes (because I got back my other return)
The crash I get is this one, it seems NSJSONSerialzation is returning a NSArray as a NSdictionary?:
2012-07-02 11:03:40.426 [9412:10703] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x75f03f0
2012-07-02 11:03:40.429 [9412:10703] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0x75f03f0'
I need to figure out a way to know which return I got so I can act accordingly.
| 0 | [
2,
13,
7760,
9886,
100,
487,
528,
788,
63,
1246,
9,
800,
3726,
3726,
31,
22,
79,
568,
13,
2172,
728,
528,
4104,
2815,
1829,
20,
164,
97,
21,
487,
528,
788,
75,
31,
678,
301,
9,
31,
694,
164,
97,
51,
4456,
788,
54,
31,
164,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
paypal integration status always failure
===
I am using following code for paypal integration.But it always show me Failure message.
What should i have to do for that?
NVPCallerServices caller = new NVPCallerServices();
IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
paymentAction = "Sale";
amount="1.00";
creditCardType = "Visa";
creditCardNumber = "4012888888881881";
expdate_month = "042018";
cvv2Number="123";
firstName ="viprat";
lastName = "shah";
address1 = "new york";
city = "new york";
state = "new york";
zip = "11433";
countryCode="01";
currencyCode = "USD";
/*
WARNING: Do not embed plaintext credentials in your application code.
Doing so is insecure and against best practices.
Your API credentials must be handled securely. Please consider
encrypting them for use in any production environment, and ensure
that only authorized individuals may view or modify them.
*/
// Set up your API credentials, PayPal end point, API operation and version.
profile.APIUsername = "viprat_1341221072_biz_api1.ifuturz.com";
profile.APIPassword = "1341221096";
profile.APISignature = "A-fmJx5LZfYHwlUgogLeJ1crE.2WAMB5TXUDbWX0JhBk5BiRIs.rZKw9";
profile.Environment="sandbox";
caller.APIProfile = profile;
NVPCodec encoder = new NVPCodec();
encoder["VERSION"] = "51.0";
encoder["METHOD"] = "DoDirectPayment";
// Add request-specific fields to the request.
encoder["PAYMENTACTION"] = paymentAction;
encoder["AMT"] = amount;
encoder["CREDITCARDTYPE"] = creditCardType;
encoder["ACCT"] = creditCardNumber;
encoder["EXPDATE"] = expdate_month;
encoder["CVV2"] = cvv2Number;
encoder["FIRSTNAME"] = firstName;
encoder["LASTNAME"] = lastName;
encoder["STREET"] = address1;
encoder["CITY"] = city;
encoder["STATE"] = state;
encoder["ZIP"] = zip;
encoder["COUNTRYCODE"] = countryCode;
encoder["CURRENCYCODE"] = currencyCode;
// Execute the API operation and obtain the response.
string pStrrequestforNvp= encoder.Encode();
string pStresponsenvp=caller.Call(pStrrequestforNvp);
NVPCodec decoder = new NVPCodec();
decoder.Decode(pStresponsenvp);
return decoder["ACK"]; | 0 | [
2,
1372,
6720,
8078,
1782,
550,
2990,
800,
3726,
3726,
31,
589,
568,
249,
1797,
26,
1372,
6720,
8078,
9,
811,
32,
550,
298,
55,
2990,
2802,
9,
98,
378,
31,
57,
20,
107,
26,
30,
60,
13,
103,
10924,
9200,
106,
11449,
18,
21326,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Windows Service and batch file
===
I want to create windows service which will run batch file upon start.
I am aware of API's like `createservice` , but what i want is when I say `Start service` from `Service Control Manager` I want to invoke my batch file with parameter `start` and when I say stop I want to invoke same batch file with `stop` parameter | 0 | [
2,
2936,
1936,
365,
17,
13064,
3893,
800,
3726,
3726,
31,
259,
20,
1600,
1936,
365,
56,
129,
485,
13064,
3893,
685,
799,
9,
31,
589,
3854,
16,
21,
2159,
22,
18,
101,
13,
1,
6037,
1373,
11449,
1,
13,
15,
47,
98,
31,
259,
25,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
zoom.js fails when I load the need-to-be-zoomed images dynamically
===
I am using zoom.js to zoom the images (Which is a list in one of a div named "thumbsDiv"). Statically, it is giving excellent response. But I am trying to load the images dynamically (Which is actually a list of profile pictures from Facebook).
Here's the code I am using. . . (I am performing this function after an ajax call, and the necessary data is being returned from the controller..)
function callback(data){
var t=0
for (t=0;t<data.sizee;t++){
if (t==0){
document.getElementById('thumbsDiv').innerHTML="<ul id=thumbs><li class=\"i current\"><img src=\""+data.icon[t]+"\" class=page-"+t+" height=70 width=70><span>"+t+"</span></li></ul>"
}
else if (t>0){
$('#thumbs').append($("<li class=d> <img src="+data.icon[t]+" class=page-"+t+" height=70 width=70><span>"+t+"</span></li>"));
}
}
}
Please help, and let me know if I am doing anything wrong... | 0 | [
2,
19469,
9,
728,
18,
13614,
76,
31,
6305,
14,
376,
8,
262,
8,
863,
8,
2500,
2636,
69,
3502,
7782,
1326,
800,
3726,
3726,
31,
589,
568,
19469,
9,
728,
18,
20,
19469,
14,
3502,
13,
5,
2140,
25,
21,
968,
19,
53,
16,
21,
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... |
Fragment onResume() & onPause() is not called on backstack
===
Well I am starting with fragments. So this question might be a bit childish..
I have multiple fragment inside an activity. On a button click I am starting a new fragment, adding it to backstack. I naturally expected the `onPause()` method of current Fragment and `onResume()` of new Fragment to be called. Well it is not happening.
<h2>LoginFragment.java</h2>
public class LoginFragment extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.login_fragment, container, false);
final FragmentManager mFragmentmanager = getFragmentManager();
Button btnHome = (Button)view.findViewById(R.id.home_btn);
btnHome.setOnClickListener(new View.OnClickListener() {
public void onClick(View view){
HomeFragment fragment = new HomeFragment();
FragmentTransaction ft2 = mFragmentmanager.beginTransaction();
ft2.setCustomAnimations(R.anim.slide_right, R.anim.slide_out_left
, R.anim.slide_left, R.anim.slide_out_right);
ft2.replace(R.id.middle_fragment, fragment);
ft2.addToBackStack("");
ft2.commit();
}
});
}
@Override
public void onResume() {
Log.e("DEBUG", "onResume of LoginFragment");
super.onResume();
}
@Override
public void onPause() {
Log.e("DEBUG", "OnPause of loginFragment");
super.onPause();
}
}
<h2>HomeFragment.java</h2>
public class HomeFragment extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.login_fragment, container, false);
}
@Override
public void onResume() {
Log.e("DEBUG", "onResume of HomeFragment");
super.onResume();
}
@Override
public void onPause() {
Log.e("DEBUG", "OnPause of HomeFragment");
super.onPause();
}
}
What I expected, was,
1. When button is clicked, **LoginFragment** gets replaced with
**HomeFragment**, `onPause()` of **LoginFragment**, and `onResume()` of
**HomeFragment** gets called
2. When back is pressed, **HomeFragment** is poped out and **LoginFragment** is
seen, and `onPause()` of **HomeFragment** and `onResume()` of **LoginFragment**
gets called.
What I am getting is,
1. When button is clicked, **HomeFragment** is correctly replacing
**LoginFragment**, onResume() of **HomeFragment** is called, but onPause()
of **LoginFragment** is never called.
2. When back pressed, **HomeFragment** is correctly popping to reveal
**LoginFragment**, onPause() of **HomeFragment** gets called, but onResume()
of **LoginFragment** never gets called.
Is this the normal behaviour? Why is `onResume()` of **LoginFragment** not getting called when I press the back button. | 0 | [
2,
14847,
27,
99,
18,
9472,
5,
6,
279,
27,
1060,
3699,
5,
6,
25,
52,
227,
27,
97,
25325,
800,
3726,
3726,
134,
31,
589,
1422,
29,
10837,
9,
86,
48,
1301,
530,
44,
21,
1142,
26433,
9,
9,
31,
57,
1886,
14847,
572,
40,
2358,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
change name of project
===
How to change your project name in ruby on rails ?
while u create a project name of project is scattered in below files
In Rails 3, there are references to the application name in the following files:
config/application.rb
config/environment.rb
config/environments/development.rb
config/environments/production.rb
config/environments/test.rb
config/initializers/secret_token.rb
config/initializers/session_store.rb
config/mongoid.yml (if using Mongoid)
config/routes.rb
config.ru
Rakefile
app/views/layouts/application.html.erb, in title tag
Is there any command to replace the name of project in all these files? | 0 | [
2,
753,
204,
16,
669,
800,
3726,
3726,
184,
20,
753,
154,
669,
204,
19,
10811,
27,
2240,
18,
13,
60,
133,
287,
1600,
21,
669,
204,
16,
669,
25,
7471,
19,
1021,
6488,
19,
2240,
18,
203,
15,
80,
50,
7231,
20,
14,
3010,
204,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
SELECTing multiple values for the same attribute using FOR XML in SQL
===
I'm attempting to retrieve data from a SQL table as XML. Consider the following table:
Customers
Id Last First Phone1 Phone2
10 Doe John 555-2121 555-6145
33 Smith Sally 555-3333 555-7000
I'd like to retrieve the Last, First, Phone1, and Phone2 fields using the FOR XML clause in SQL. However, I'd like to retrieve the Phone2 field with an attribute of "Evening". For example, I'd like the XML to look like:
<Customers>
<Customer>
<Last>Doe</Last>
<First>John</First>
<Phone Type="Daytime">555-2121</Phone>
<Phone Type="Evening">555-6145</Phone>
</Customer>
</Customers>
However, I'm unable to get it to work. Is there something I'm missing? Any and all help would be greatly appreciated! | 0 | [
2,
20764,
1886,
4070,
26,
14,
205,
35,
14755,
568,
26,
23504,
19,
4444,
255,
800,
3726,
3726,
31,
22,
79,
6314,
20,
11917,
1054,
37,
21,
4444,
255,
859,
28,
23504,
9,
3563,
14,
249,
859,
45,
5279,
4924,
236,
64,
1132,
165,
1132,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 "login failed for user [username]" error for windows service, but SSMS login works
===
I'm writing a windows service that needs to connect to a SQL server to retrieve some information. However, the server doesn't allow me to connect: "login failed for user [domain/username]". The strange part is that everything works totally fine from inside SSMS. I can log in, query the database, and everything works out perfectly. It's only through the windows service that it's throwing that error.
For reference, here's the connection string I'm using:
Data Source=sqlserveraddresshere;Initial Catalog=databasenamehere;User ID=domain\username;Password=password
I doubt that this is related, but when I try to use Integrated Security it's getting my computer name instead of my own user name. I'm 99% sure this is because our anti-virus and monitoring software is spoofing an administrator user on top of my windows session to do its job. In any case, just entering the correct username and password should be working regardless, right?
I took a look at some other questions involving the same error, but they were all unrelated. From what I can tell everyone who can get in through SSMS can access their SQL server through code, too. This is the most similar question I could find, although it didn't help much:
http://stackoverflow.com/questions/7217472/cant-connect-to-sql-server-login-failed-for-user
Also, before you ask, I HAVE ALREADY CHECKED FOR TYPOS. Actually, I've even tried to use other user's accounts to make sure there wasn't something funky going on with my permissions. If you need me to post any code let me know. Thanks for your help! | 0 | [
2,
4444,
255,
13,
7,
5567,
108,
1702,
26,
4155,
636,
16704,
7259,
500,
7,
7019,
26,
1936,
365,
15,
47,
13,
18,
18,
79,
18,
6738,
108,
693,
800,
3726,
3726,
31,
22,
79,
1174,
21,
1936,
365,
30,
2274,
20,
6379,
20,
21,
4444,
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... |
Passing a pointer to member function
===
There are a number of examples out there but yet I can't seem to figure out the solution to my problem. I have
class FooSource{
...
void StartGetFoos(void (*callback)(vector<IFoo*>*, IAsyncResult));
...
}
When `StartGetFoos()` is called, a request it done to get Foos, saving the callback. when the request it complete (takes about 30 secs), the saved callback is called with results.
**I cannot change the signature of this method.**
and somewhere else I have a class
class FooUser {
...
void FooUser::MyCallback(vector<IFoo*>* foos, IAsyncResult result)
{
// marshall to UI thread and update UI
}
void init()
{
fooUser->StartGetFoos(??????);
// how do I pass my callback member function here?
}
}
| 0 | [
2,
2848,
21,
454,
106,
20,
322,
1990,
800,
3726,
3726,
80,
50,
21,
234,
16,
3770,
70,
80,
47,
768,
31,
92,
22,
38,
2260,
20,
1465,
70,
14,
4295,
20,
51,
1448,
9,
31,
57,
718,
4310,
111,
12097,
1,
13,
9,
9,
9,
11364,
799,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
CakePHP on webhost000
===
Can someone indicates or explains me how to run CakePHP in this free host?
I'm searching a lot, but I can´t find a good tutorial.
| 0 | [
2,
8390,
26120,
27,
2741,
11694,
3993,
800,
3726,
3726,
92,
737,
6475,
54,
7346,
55,
184,
20,
485,
8390,
26120,
19,
48,
551,
2015,
60,
31,
22,
79,
5792,
21,
865,
15,
47,
31,
92,
13,
38,
477,
21,
254,
29724,
9,
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,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Can one programmatically set the layout of a ListView in WinJS / Windows 8 Apps?
===
I have a ListView template that's being used in several places and I'd like to change the layout type on the fly:
<div class="sorteditemslist" arial-label="sorted items"
data-win-control="WinJS.UI.ListView"
data-win-options="{layout: { type: WinJS.UI.ListLayout}}"
data-win-bind="winControl.itemDataSource: items.dataSource; winControl.iteminvoked: ItemInvoked;">
The default layout type is `WinJS.UI.GridLayout` but in certain cases I'd like to change this to a `ListLayout`.
| 0 | [
2,
92,
53,
625,
6732,
1326,
309,
14,
9106,
16,
21,
968,
4725,
19,
628,
728,
18,
13,
118,
1936,
469,
4865,
18,
60,
800,
3726,
3726,
31,
57,
21,
968,
4725,
22894,
30,
22,
18,
142,
147,
19,
238,
1489,
17,
31,
22,
43,
101,
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... |
Programmatically hiding Apple iAd ADBannerView
===
I'd like to occasionally hide an `ADBannerView`. I'm thinking about `banner.hidden = YES` and similar to un-hide. I'm concerned that Apple will frown upon this because receiving and "displaying" ads while the banner is hidden seems questionable.
In `bannerView:didFailToReceiveAdWithError:` I'm animating the banner off the screen bottom. I'm open to doing this instead of using the hidden property if it's somehow better.
Perhaps it's possible to tell the banner to stop requesting ads. Unfortunately nothing jumped out at me while looking over `ADBannerView.h`.
**What's the best way to programatically hide `ADBannerView`?** | 0 | [
2,
625,
6732,
1326,
5314,
4037,
31,
1283,
21,
43,
4059,
1031,
4725,
800,
3726,
3726,
31,
22,
43,
101,
20,
4533,
3077,
40,
13,
1,
1283,
4059,
1031,
4725,
1,
9,
31,
22,
79,
1440,
88,
13,
1,
4059,
1031,
9,
1822,
43,
817,
800,
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... |
Python : Fixed Length Regex Required?
===
I have this regex that uses forward and backward look-aheads:
import re
re.compile("<!inc\((?=.*?\)!>)|(?<=<!inc\(.*?)\)!>")
I'm trying to port it from C# to Python but keep getting the error
look-behind requires fixed-width pattern
Is it possible to rewrite this in Python without losing meaning?
The idea is for it to match something like
<!inc(C:\My Documents\file.jpg)!> | 0 | [
2,
20059,
13,
45,
3535,
1476,
7953,
1706,
1390,
60,
800,
3726,
3726,
31,
57,
48,
7953,
1706,
30,
2027,
917,
17,
8540,
361,
8,
58,
12256,
45,
9010,
302,
302,
9,
11103,
3599,
5,
7,
1,
187,
108,
150,
1,
5,
5,
60,
3726,
9,
2483,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Retrieve the URL and the thumbnail from Youtube API (zend framework)
===
i trying to show a video playlist with zend, but after catching the playlist info, i'dont know what i have to do with for finding thumbnail or url of the thumbnail.
her my code
require_once 'Zend/Loader.php'; // the Zend dir must be in your include_path
Zend_Loader::loadClass('Zend_Gdata_YouTube');
$yt = new Zend_Gdata_YouTube();
$playlistListFeed = $yt->getPlaylistListFeed('admaltais');
//step 1: show the playlist name and his URL
foreach ($playlistListFeed as $playlistEntry)
{
echo $playlistEntry->title->text . "</br></br>";
echo $playlistEntry->getPlaylistVideoFeedUrl() . "</br></br>";
}
//step 2: parse the playlist
$feedUrl = $playlistEntry->getPlaylistVideoFeedUrl();
$playlistVideoFeed = $yt->getPlaylistVideoFeed('http://gdata.youtube.com/feeds/api/playlists/B15D7FD35D3814A5');
foreach ($playlistVideoFeed as $playlistVideoFeedEntry)
{
echo $playlistVideoFeedEntry->title->text . "</br></br>";
//here i want to retrieve the infos
//var_dump($playlistVideoFeedEntry);
}
thank you very much guys
Alex | 0 | [
2,
11917,
14,
287,
6362,
17,
14,
5078,
325,
947,
37,
7330,
21,
2159,
13,
5,
4257,
43,
6596,
6,
800,
3726,
3726,
31,
749,
20,
298,
21,
763,
27063,
29,
10526,
43,
15,
47,
75,
9436,
14,
27063,
15404,
15,
31,
22,
804,
38,
143,
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 best strategy to store objects ensuring unique name and being able to efficiently retrieve them later, in c++?
===
I'm coding a Composite class (similar to QObject of Qt) and at the moment I'm storing the children in a std::vector.
Each Composite instance has a name and this name has to be unique between all the other instances that are "brothers" of this one, or probably better said, between the instances that shares the same parent.
Each time a new instance is pushed inside the vector, I must look if its name is already used by one of the instances already in the vector, if it does, I must change its name adding a number.
The code I came up with is quite silly and very slow when the number of children become consistent.
here is the class:
class Composite
{
public:
Composite(const std::string &name, Composite *ancestor=NULL);
~Composite();
private:
std::string name;
Composite *ancestor;
std::vector<Composite*> descendants;
public:
void setName(const std::string &name);
};
this is the constructor and setName implementation:
Composite::Composite(const std::string &name, Composite *ancestor)
{
this->ancestor = ancestor;
setName(name);
if (ancestor!=NULL)
ancestor->descendants.push_back(this);
}
.
void Composite::setName(const std::string &name)
{
if (ancestor!=NULL)
{
CompositeList::iterator dIt;
for( dIt=ancestor->descendants.begin(); dIt!=ancestor->descendants.end(); dIt++)
{
if ((*dIt)==this)
{
continue;
}
else if (this->name == (*dIt)->getName())
{
int trailingNumber = stringToInt(getTrailingNumber(this->name));
std::string cleanName = removeTrailingNumber(this->name);
this->name = cleanName+intToString(trailingNumber+1);
}
}
}
}
This might be fine for very few children, but when they become hundreds then the setName function really become slow.
Imagine this situation:
Composite *parent = new Composite("pippo");
for (int i=0; i<10000; i++)
{
Composite("ClashingName", parent);
}
the first time is fine, the second time the name is changed in ClashingName0, the third time the name is firstly cahnged into ClashingName0, than it find the clashing with the second instance and set the name to ClashingName1... you got the idea, it is exponential, when it comes at the end of that loop an unacceptable amount of time is passed by.
So the real problem here is how to efficiently find the name clashing and efficiently assign a new name that is not already used?
Any std container is fine for me and my compiler support C++11, but I can't/want to use Boost because the project I'm working on is incredibly small (it is basically this class)
I'm not exactly a seasoned user of C++, I was thinking to use map or unordered_map but I'm really hungry for experts' suggestions here. | 0 | [
2,
98,
25,
14,
246,
4427,
20,
1718,
3916,
14183,
2619,
204,
17,
142,
777,
20,
20519,
11917,
105,
138,
15,
19,
272,
20512,
60,
800,
3726,
3726,
31,
22,
79,
13,
15458,
21,
12639,
718,
13,
5,
19107,
20,
2593,
23793,
16,
2593,
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... |
How to partially round corners of given block with box-shadow, and keep unrounded corners with unrounded box-shadow?
===
I have a block with multiple borders, and for one border I am using box-shadow. I want this block to have rounded corners, but not all of them. For example - top-right corner should not be rounded. But when I am rounding even only one corner, other corners of box-shadow are rounded too, not with the same radius though, but still. Is there a way to partially round corners of given block with box-shadow, and keep unrounded corners with unrounded box-shadow?
HTML:
<div class="wrap">
Top-right block corner is not rounded, but box-shadow is:
<div class="outer">
<div class="block1">
foo
</div>
</div>
<br>
Box-shadow on block without border-radius:
<div class="outer">
<div class="block2">
bar
</div>
</div>
</div>
CSS:
.block1 {
padding: 18px 14px;
margin: 5px;
background: #fff;
border: 1px solid red;
-webkit-box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);
-moz-box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);
box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);
-webkit-border-radius: 10px 0 10px 10px;
-moz-border-radius: 10px 0 10px 10px;
border-radius: 10px 0 10px 10px;}
.block2 {
padding: 18px 14px;
margin: 5px;
background: #fff;
border: 1px solid red;
-webkit-box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);
-moz-box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);
box-shadow: 0 0 0 5px rgba(0, 57, 47, .32);}
.outer {
border: 1px solid green;}
.wrap {
margin: 50px;}
Fiddle: http://jsfiddle.net/3efB5/2/ | 0 | [
2,
184,
20,
5933,
560,
8894,
16,
504,
1921,
29,
1649,
8,
18396,
15,
17,
643,
367,
5000,
69,
8894,
29,
367,
5000,
69,
1649,
8,
18396,
60,
800,
3726,
3726,
31,
57,
21,
1921,
29,
1886,
5878,
15,
17,
26,
53,
1862,
31,
589,
568,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
PHP form validation on same page shows to early
===
What I'm trying to do is put the valadiation of a form on the same page.
The problem is now that it already shows the errors if you visit the page.
It has to be that the errors show after you fill in the form, not before.
This is my code:
<html>
<head>
<title>Westpop</title>
<link rel="stylesheet" href="opmaak.css">
</head>
<body>
<fblack>
<div id="header"><a href="Index.php"></a></div>
<div id="registreer">
<table cellpadding="5" align="center">
<th colspan="2" align="left">Registeren</th>
<form name="registreren" method="post" action="registreer.php">
<tr>
<td><fblackbold>Inloggegevens:<fblackbold></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" size="50" placeholder="email@provider.com" name="email"></td>
</tr>
<tr>
<td>Wachtwoord</td>
<td><input type="password" size="50" placeholder="min. 8 tekens, één hoofdletter, één cijfer" name="wachtwoord"></td>
</tr>
<tr>
<td><fblackbold>Persoonlijke gegevens:<fblackbold></td>
</tr>
<tr>
<td>Voornaam</td>
<td><input type="text" size="50" placeholder="" name="voornaam" ></td>
</tr>
<tr>
<td>Achternaam</td>
<td><input type="text" size="50" placeholder="" name="achternaam"></td>
</tr>
<tr>
<td>Geboorte Datum</td>
<td><input type="text" size="50" placeholder="jjjj-mm-dd" name="geboortedatum"></td>
</tr>
<tr>
<td>Geslacht</td>
<td>M<input type="radio" size="50" value="m" name="geslacht">
V<input type="radio" size="50" value="v" name="geslacht"></td>
</tr>
<tr>
<td>Adres</td>
<td><input type="text" size="50" placeholder="Straat 00" name="adres"></td>
</tr>
<tr>
<td>Woonplaats</td>
<td><input type="text" size="50" placeholder="" name="woonplaats"></td>
</tr>
<tr>
<td>Telefoonnummer</td>
<td><input type="text" size="50" placeholder="min. 9 tekens" name="telefoonnummer"></td>
</tr>
<tr>
<td>Functie</td>
<td><select name="functie">
<option value="catering">Catering</option>
<option value="muziekpodia">Muziek en podia</option>
<option value="vervoerovernachten">Vervoer en overnachten</option>
<option value="logistiekbeveiliging">Logistiek en beveiliging</option>
<option value="diversen">Diversen</option>
</select></td>
</tr>
<tr align="right">
<td></td>
<td><input type="reset" value="Wissen"><input type="submit" name="verzenden" value="Verzenden"></td>
</tr>
</form>
</table>
<?php
$host = "localhost";
$gebruikersnaam = "root";
$wachtwoord = "";
mysql_connect($host, $gebruikersnaam, $wachtwoord);
$demooistedatabase = "c5g4westpopintranet";
mysql_select_db($demooistedatabase);
$achternaam = $_POST["achternaam"];
$voornaam = $_POST["voornaam"];
$gbdatum = $_POST["geboortedatum"];
$email = $_POST["email"];
$geslacht = $_POST["geslacht"];
$wachtwoord = $_POST["wachtwoord"];
$woonplaats = $_POST["woonplaats"];
$adres = $_POST["adres"];
$telefoonnummer = $_POST["telefoonnummer"];
$functie = $_POST["functie"];
$achternaam = stripslashes($achternaam);
$voornaam = stripslashes($voornaam);
$gbdatum = stripslashes($gbdatum);
$email = stripslashes($email);
$geslacht = stripslashes($geslacht);
$wachtwoord = stripslashes($wachtwoord);
$woonplaats = stripslashes($woonplaats);
$adres = stripslashes($adres);
$telefoonnummer = stripslashes($telefoonnummer);
$functie = stripslashes($functie);
$query ="INSERT INTO vrijwilliger (voornaam, achternaam, gbdatum, geslacht, wachtwoord, woonplaats, adres, telefoonnummer, functie, activiteitID, groepID, email)
VALUES('$voornaam','$achternaam','$gbdatum','$geslacht','$wachtwoord','$woonplaats','$adres','$telefoonnummer','$functie',null,null,'$email')";
$foutloos=true;
if(preg_match("/^.*(?=.{8,})(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).*$/", $wachtwoord) === 0)
{
echo '<fblack>Wachtwoord moet minstens 8 tekens lang zijn, een kleine letter, grote letter én cijfer bevatten.<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[0-9]{10}+$/", $telefoonnummer) === 0)
{
echo '<fblack>Het telefoonnummer moet 10 cijfers bevatten.<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$/", $gbdatum) === 0)
{
echo '<fblack>Geboorte datum moet op dit formaat ingevoerd worden: JJJJ-MM-DD<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i", $email) === 0)
{
echo '<fblack>Email moet hier op lijken: email@provider.com<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[A-Z][a-zA-Z -]+$/", $voornaam) === 0)
{
echo '<fblack>Voornaam is niet geldig ingevoerd, heeft u een hoofdletter gebruikt?<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[A-Z][a-zA-Z -]+$/", $achternaam) === 0)
{
echo '<fblack>Achternaam is niet geldig ingevoerd, heeft u een hoofdletter gebruikt?<br><fblack>';
$foutloos = false;
}
if ($geslacht == '')
{
echo '<fblack>U heeft uw geslacht niet aangegeven.<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[a-zA-Z]+\ +[0-9]+$/", $adres) === 0)
{
echo '<fblack>Het adres is verkeerd ingevoerd.<br><fblack>';
$foutloos = false;
}
if(preg_match("/^[a-zA-Z\s]+$/", $woonplaats) === 0)
{
echo '<fblack>De woonplaats is verkeerd ingevoerd.<br><fblack>';
$foutloos = false;
}
if ($foutloos == true)
{
mysql_query($query)
or die('<fblack>U staat al in ons systeem<A HREF="javascript:javascript:history.go(-1)"><br><br>Klik hier om terug te gaan</A><fblack>');
echo "<fblack>Uw registratie is succesvol verwerkt!<br>Log <a href='login.php' MEDIA=screen>hier</a> in<fblack>";
}
?>
</div>
<?php
include ("html_end.php");
?>
Thanks in advance! | 0 | [
2,
13,
26120,
505,
27999,
27,
205,
2478,
1285,
20,
274,
800,
3726,
3726,
98,
31,
22,
79,
749,
20,
107,
25,
442,
14,
3347,
6622,
857,
16,
21,
505,
27,
14,
205,
2478,
9,
14,
1448,
25,
130,
30,
32,
614,
1285,
14,
11908,
100,
42... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Numpy/Python: Mesgrid division operation: MemoryError
===
I'm programming a neural field with numpy and for a map of 100*100 neurons, I need to manage a 10000*10000 connections map.
So I create my connection map with meshgrid and I try to applicate an adaptation of Mexican Hat fonction. Here, you have the code you can try: if you put "taille = 60 or 70" (the width of the neural map), it will work (on my PC, it's ok) but, if you try with "taille = 100", you obtain a MemoryError.
import numpy as np
def connection_map4(width, se1, se2, K, inh):
x = np.arange(0, width**2, 1)
y = np.arange(0, width**2, 1)
X,Y = np.meshgrid(x, y)
print "Meshgrid cree"
A1 = 1.0 + inh
A2 = inh
# exp(|x-xc|/b + |y-yc|) -> Mexican Hat equation
# 2D/1D transformation relation: i = width.y + x
# ligne = (X/witdh - Y/width)**2
ligne = (X-Y)/width ## A priori, it's the division that doesn't pass.
print "avant carre"
ligne *= ligne
print "ligne"
colonne = (X%width-Y%width)**2
print "colonne"
M1 = A1*np.exp(-( (colonne)/(2*se1**2) + (ligne)/(2*se2**2) ) )
print "Premiere operation finie"
M2 = -A2*np.exp(-( (colonne)/(2*(K*se1)**2) + (ligne)/(2*(K*se2)**2) ) )
print "Seconde operation finie"
return(M1+M2)
taille = 100
connection_map4(taille, 7.5, 4.0, 2.0, 2.0)
A priori, after some trials to debug, I have separated each operations on the meshgrid and it seems that it is the division and the modulo that doesn't pass.
There is solution to make this division?? because I don't really want to use a loop and slow down the computation. Thank you for your attention.
| 0 | [
2,
13,
6336,
6448,
118,
6448,
11570,
45,
55,
18,
16375,
460,
1453,
45,
1912,
29992,
800,
3726,
3726,
31,
22,
79,
3143,
21,
17371,
575,
29,
13,
6336,
6448,
17,
26,
21,
2942,
16,
808,
2483,
4031,
18131,
15,
31,
376,
20,
4705,
21,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Mass mailing software for (25k-1000k) lists
===
We are planing mass mailing service for our internal usage. Our needs are from 25 k mailing list up to one million / list.
Any good back end SMTP feeding software for this?
We do have plans to buy new hardware for this porject too. At this point we will be using PowerMTA as our actual mailing server. User interface will be done with asp.net (vb.net). Every campaing will be saved to microsft SQL database. We do have own bounce handlig etc. ready to use.
Now we are seeking good way to feed up our SMTP server. We need to send up over 100 messages / second (with simple small message).
Currently we use Arailsoftwares Campaing for our campaings. I gives us good speed of 8-16 messages / second. But our campaing at this moment are much smaler than campaing we plan to send.
Software/solution should be actual windows based or asp.net application. | 0 | [
2,
1619,
4216,
68,
2306,
26,
13,
5,
1811,
197,
8,
19484,
197,
6,
7227,
800,
3726,
3726,
95,
50,
944,
68,
1619,
4216,
68,
365,
26,
318,
3117,
7514,
9,
318,
2274,
50,
37,
771,
680,
4216,
68,
968,
71,
20,
53,
507,
13,
118,
968,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
accessing junk folder of hotmail with htmlunit
===
I want to access junk folder of hotmail account with htmlUnit in java as it seems that htmlunit supports javascript. With the following code I could access the inbox folder but from it I want to get the junk folder. I found that "junk" displayed on the left side of the page is a label. So I am trying to access the label and then want to click on it. But I am not able to access the "junk" label from the HtmlPage. Html code of junk label looks like below.
<span class="FolderLabel">
Junk
<span style="display:none;">
(
<span class="count"></span>
)
</span>
</span>
</span>
and following is the code I use to get junk folder:
import java.io.IOException;
import java.net.URL;
import org.w3c.dom.Node;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlLabel;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlPasswordInput;
import com.gargoylesoftware.htmlunit.html.HtmlSubmitInput;
import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
public class TesthtmlUnit {
public static void main(String[] args) throws IOException
{
final WebClient webClient = new WebClient();
// Get the first page
final HtmlPage page1 = webClient.getPage("https://login.live.com/ppsecure/post.srf");
webClient.setThrowExceptionOnScriptError(false);
final HtmlForm form = page1.getFormByName("f1");
final HtmlSubmitInput button = form.getInputByName("SI");
final HtmlTextInput uname = form.getInputByName("login");
final HtmlPasswordInput pwd = form.getInputByName("passwd");
// Change the value of the text field
uname.setValueAttribute("emailid@hotmail.com");
pwd.setValueAttribute("pwd");
HtmlPage page2 = button.click();
//System.out.println(page2.asXml());
HtmlAnchor inbox = (HtmlAnchor) page2.getAnchorByHref("http://mail.live.com/?rru=inbox");
page2 = (HtmlPage) inbox.click();
//System.out.println(page2.asXml());
//CLICK ON JUNK LABEL
//here I want access label "junk" from page2
webClient.closeAllWindows();
}
}
Anybody has idea how to click on junk folder ? I went through methods provided by htmlpage but could not find a way to do it.
I would appreciate any help regarding this.
Thanks.
| 0 | [
2,
1381,
68,
12096,
19294,
16,
1047,
8079,
29,
13,
15895,
15464,
800,
3726,
3726,
31,
259,
20,
1381,
12096,
19294,
16,
1047,
8079,
2176,
29,
13,
15895,
15464,
19,
8247,
28,
32,
2206,
30,
13,
15895,
15464,
6747,
8247,
8741,
9,
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... |
how to automate autocomplete tags in selenium ide?
===
<tr>
<td>clickAt</td>
<td>css=ul.token-input-list-facebook</td>
<td></td>
</tr>
<tr>
<td>setCursorPosition</td>
<td>id=token-input-SongTags</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=token-input-SongTags</td>
<td>n</td>
</tr>
<tr>
<td>setCursorPosition</td>
<td>id=token-input-SongTags</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=token-input-SongTags</td>
<td></td>
</tr>
I tried out the above steps to automate autocomplete tags, but this is not working,
Can anyone help me out here? | 0 | [
2,
184,
20,
3108,
5281,
3108,
15990,
3383,
18,
19,
23027,
14311,
13,
3448,
60,
800,
3726,
3726,
13,
1,
6384,
1,
13,
1,
38,
43,
1,
150,
10129,
721,
1,
118,
38,
43,
1,
13,
1,
38,
43,
1,
6824,
18,
3726,
1287,
9,
262,
2853,
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... |
Convert C# function to VB, char value overflow error
===
I need the following function converted to VB.NET, but I'm not sure how to handle the statement
res = (uint)((h * 0x21) + c);
Complete function:
private static uint convert(string input)
{
uint res = 0;
foreach (int c in input)
res = (uint)((res * 0x21) + c);
return res;
}
I created the following, but I get an overflow error:
Private Shared Function convert(ByVal input As String) As UInteger
Dim res As UInteger = 0
For Each c In input
res = CUInt((res * &H21) + Asc(c)) ' also tried AscW
Next
Return res
End Function
What am I missing? Can someone explain the details? | 0 | [
2,
8406,
272,
5910,
1990,
20,
13,
20468,
15,
4892,
1923,
20285,
7019,
800,
3726,
3726,
31,
376,
14,
249,
1990,
3494,
20,
13,
20468,
9,
2328,
15,
47,
31,
22,
79,
52,
562,
184,
20,
3053,
14,
3331,
10719,
800,
13,
5,
291,
6391,
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... |
Android Service Running as a seprate process
===
I have a service Class in android can it be possible that a Service can run as a seprate process than an application just for receiving sms and enqueue them in a queue after that an application read sms from this Queue. Is it possible to launce a seprate service sir pl help me in this regard thanks in advance and sorry for my bad English if not understand.
I have tag the source code of SmsService class below
public class SmsService extends Service {
private SMSReceiver mSMSreceiver;
private IntentFilter mIntentFilter;
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
public SmsService(){
/*dba = new DataBaseAdapter(this);*/
mSMSreceiver = new SMSReceiver();
}
@Override
public void onCreate(){
super.onCreate();
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(ConstantClass.SMS_RECEIVED);
registerReceiver(mSMSreceiver,mIntentFilter);
}
@Override
public int onStartCommand(Intent intent , int flags, int type){
return START_STICKY;
}
@Override
public void onDestroy(){
super.onDestroy();
//unregisterReceiver(mSMSreceiver);
}
}
thanks n regards
| 0 | [
2,
13005,
365,
946,
28,
21,
10332,
5487,
953,
800,
3726,
3726,
31,
57,
21,
365,
718,
19,
13005,
92,
32,
44,
938,
30,
21,
365,
92,
485,
28,
21,
10332,
5487,
953,
119,
40,
3010,
114,
26,
3396,
7613,
18,
17,
1957,
2005,
4185,
105... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Cannot invoke replace(String, String) on the array type String[]
===
While trying to work with manipulation of strings on jsp, I used string.repalace(), method in my code but i am getting following errors persistently:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the jsp file: /final2.jsp
Cannot invoke replace(String, String) on the array type String[]
6: public void main (String str) {
7: String [] text = StringUtils.substringsBetween(str,"#","#");
8: for (int i=0; i<text.length;i++) {
9: String newtext = text.replace("#"+text[i]+"#","<b>"+text[i]+"</b>");
10: }
11:
12: }
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java: 102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
My code is as follows:
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@page import="org.apache.commons.lang.StringUtils" %>
<%
final class setext {
public void main (String str) {
String [] text = StringUtils.substringsBetween(str,"#","#");
for (int i=0; i<text.length;i++) {
String newtext = text.replace("#"+text[i]+"#","<b>"+text[i]+"</b>");
}
}
}
%> | 0 | [
2,
1967,
28371,
3934,
5,
11130,
15,
3724,
6,
27,
14,
7718,
1001,
3724,
2558,
500,
800,
3726,
3726,
133,
749,
20,
170,
29,
17561,
16,
7887,
27,
487,
3401,
15,
31,
147,
3724,
9,
99,
10447,
1105,
5,
6,
15,
2109,
19,
51,
1797,
47,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Setting html text having img tag using Html.ImageGetter not display content properly in android
===
I am trying to display `html` data having `img tag` in `TextView` in android. I am using `Html.ImageGetter` and AsyncTask to load images in background. In short I am using method given in this post.
http://stackoverflow.com/a/7442725/495906
My problem is that content is not displaying properly. The images are hiding text and when I scroll view images near top or bottom hides when scroll reaches edge of screen.
The `html content` is dynamically created by me programatically.Is this is due to problem in html content or I have to do something in layout. Example html I am using
this is dummy<br/><img src='www.domain/image.png'/><br/>second line<br/><img src='www.domain/image2.png'/><br/>
and so on.
I have tried using `WebView` but problem is that I have to show content inside `ScrollView` and WebView is having problem inside ScrollView as the layout is distorting near edges of webview when i scroll and also it is making app slow.
Thanks | 0 | [
2,
2697,
13,
15895,
1854,
452,
797,
263,
3383,
568,
13,
15895,
9,
22039,
3060,
815,
52,
3042,
2331,
7428,
19,
13005,
800,
3726,
3726,
31,
589,
749,
20,
3042,
13,
1,
15895,
1,
1054,
452,
13,
1,
1660,
263,
3383,
1,
19,
13,
1,
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... |
unable to login to facebook using asmack on Android
===
I´m try to connect to facebook using asmack and android. I can connect but not login. when i try to do that i got nullpointerexception on `super.authenticate();` how can i fix this problem, some examples please
Log:
D/tag: connection succeeded
W/System.err: java.lang.NullPointerException
W/System.err: at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:116)
W/System.err: at CustomSASLDigestMD5Mechanism.authenticate(CustomSASLDigestMD5Mechanism.java:36)
W/System.err: at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:319)
W/System.err: at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:204)
W/System.err: at org.jivesoftware.smack.Connection.login(Connection.java:357)
W/System.err: at se.hig.MainActivity.login(MainActivity.java:69)
W/System.err: at se.hig.MainActivity.onCreate(MainActivity.java:24)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
W/System.err: at android.app.ActivityThread.access$2200(ActivityThread.java:119)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
07-18 10:55:33.384: W/System.err(255): at android.os.Looper.loop(Looper.java:123)
07-18 10:55:33.384: W/System.err(255): at android.app.ActivityThread.main(ActivityThread.java:4363)
07-18 10:55:33.393: W/System.err(255): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err: at java.lang.reflect.Method.invoke(Method.java:521)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-18 10:55:33.393: W/System.err(255): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
W/System.err: at dalvik.system.NativeStart.main(Native Method)
D/tag: login fails exeption :
D/tag: service-unavailable(503)
CustomSASLDigestMD5Mechanism:
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
import org.apache.harmony.javax.security.sasl.Sasl;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.sasl.SASLMechanism;
public class CustomSASLDigestMD5Mechanism extends SASLMechanism
{
public CustomSASLDigestMD5Mechanism(SASLAuthentication saslAuthentication)
{
super(saslAuthentication);
}
@Override
public void authenticate(String username, String host, String password)
throws IOException, XMPPException
{
this.authenticationId = username;
this.password = password;
this.hostname = host;
String[] mechanisms = { getName() };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, this);
super.authenticate();
}
@Override
public void authenticate(String username, String host, CallbackHandler cbh)
throws IOException, XMPPException
{
String[] mechanisms = { getName() };
Map<String, String> props = new HashMap<String, String>();
sc = Sasl.createSaslClient(mechanisms, null, "xmpp", host, props, cbh);
super.authenticate();
}
protected String getName()
{
return "DIGEST-MD5";
}
}
MainActivity:
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.SASLAuthentication;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
public class MainActivity extends Activity
{
private XMPPConnection connection;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
connect();
login("username", "password");
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public String connect()
{
ConnectionConfiguration config = new ConnectionConfiguration("chat.facebook.com", 5222);
SASLAuthentication.registerSASLMechanism("DIGEST-MD5", CustomSASLDigestMD5Mechanism.class);
config.setSASLAuthenticationEnabled(true);
config.setTruststorePath("/system/etc/security/cacerts.bks");
config.setTruststoreType("bks");
config.setDebuggerEnabled(false);
connection = new XMPPConnection(config);
try
{
connection.connect();
Log.d("tag", "connection succeeded");
} catch (XMPPException e)
{
Log.d("tag", "connection fails exeption : \n " + e);
}
// fbml = new FBMessageListener(connection);
return connection.getConnectionID();
}
public boolean login(String userName, String password)
{
if ((connection != null) && (connection.isConnected()))
{
try
{
connection.login(userName, password);
} catch (XMPPException e)
{
Log.d("tag", "login fails exeption : \n " + e);
}
return true;
}
return false;
}
} | 0 | [
2,
2343,
20,
6738,
108,
20,
9090,
568,
28,
15571,
27,
13005,
800,
3726,
3726,
31,
307,
1131,
20,
6379,
20,
9090,
568,
28,
15571,
17,
13005,
9,
31,
92,
6379,
47,
52,
6738,
108,
9,
76,
31,
1131,
20,
107,
30,
31,
330,
16203,
3132... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
.class file opens instead of .java while debugging
===
Current setup:
- **MainProject** which is a Library Project
- **BranchProject** which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
| 0 | [
2,
13,
9,
1898,
3893,
8965,
700,
16,
13,
9,
1004,
1385,
133,
121,
16254,
2762,
800,
3726,
3726,
866,
18161,
45,
13,
8,
13,
1409,
6232,
21011,
1409,
56,
25,
21,
1248,
669,
13,
8,
13,
1409,
23014,
21011,
1409,
56,
25,
21,
78,
23... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
looping android method
===
I am making an android game. I am using RelativeLayout, which hosts a FrameLayout, which hosts a SurfaceView. However, i have added a textview onto the RelativeLayout to show how many health points the player has left. I have a method which sets the int value of how many health points he has left into the text view. The int value is located in the SurfaceView, which is another class. But the textview and the method which updates the textview, is inside the other class. I want the method in the other class to be constantly updated, so that the textview will always display the health value. How can i do this? The method is called updateHealthPointsTextView(). Please help me and thanks so much! My code:
package com.mysoftwaremobileapps.alien.attack;
import java.util.ArrayList;
public class GameScreenActivity extends Activity {
/** Called when the activity is first created. */
List<String> myList = new ArrayList<String>();
RadioButton radioEasy, radioMedium, radioHard;
private ExampleView eView;
public int ParachuterIndex;
TextView healthPoints;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
dropParachuters();
}
private void dropParachuters() {
// TODO Auto-generated method stub
}
@Override
protected void onStart()
{
FrameLayout fl = new FrameLayout(this);
eView = new ExampleView(this);
fl.addView(eView);
healthPoints = new TextView(this);
healthPoints.setText("Health Points: " + eView.getThread().healthPoints);
RelativeLayout relativeLayout= new RelativeLayout(this);
relativeLayout.addView(fl);
relativeLayout.addView(healthPoints);
setContentView(relativeLayout);
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().drawAlien();
eView.getThread().publicFloatX = 750;
eView.getThread().gettingAttacked();
updateHealthPointsTextView();
super.onStart();
try {
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("KEY");
}
} catch (Exception e) {
// TODO: handle exception
}
}
private void updateHealthPointsTextView() {
// TODO Auto-generated method stub
//Updating textview with health points value
healthPoints.setText(Integer.toString(eView.getThread().healthPoints));
}
}
@Override
public boolean onKeyDown(int KeyCode, KeyEvent Event) {
if ((KeyCode == KeyEvent.KEYCODE_MENU)) {
//Call performSpecialAttack()
Log.d("Parachute Hunter", "calling performSpecialAttack()");
eView.getThread().performSpecialAttack();
return true;
}
return super.onKeyDown(KeyCode, Event);
}
@Override
protected void onStop()
{
try {
eView.getThread().setRunning(false);
eView = null;
}
catch (NullPointerException e) {}
super.onStop();
}
} | 0 | [
2,
5293,
68,
13005,
2109,
800,
3726,
3726,
31,
589,
544,
40,
13005,
250,
9,
31,
589,
568,
4543,
4414,
1320,
15,
56,
5397,
21,
3523,
4414,
1320,
15,
56,
5397,
21,
1490,
4725,
9,
207,
15,
31,
57,
905,
21,
1854,
4725,
1204,
14,
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... |
Right way to union in rails 3.1.4 with sqlite3?
===
There are 3 tables `payment_logs`, `sourcings` and `purchasings` in our rails app. A payment_log belongs to either sourcing or purchasing but not both at the same time. There is a col `project_id` in both sourcing and purchasing. We want to pick up `all payment_logs with its project_id = project_id_search` (project_id_search passed from a search page). Also we need a ActiveRecord as resultset returned. Here is the individual query, assuming payment_logs holds the ActiveRecord result set:
1. pick all payment_logs with its sourcing's project_id = project_id_search
payment_logs = payment_logs.joins(:sourcing).where("sourcings.project_id = ?", project_id_search)
2. pick all payment_logs with its purchasing's project_id = project_id_search
payment_logs = payment_logs.(:purchasing).where("purchasings.project_id = ?", project_id_search)
We need to union 1 and 2 in order to pick up all the payment_logs whose project_id = project_id_search. What's the right way to accomplish it? We did not find union in rails and find_by_sql returns an array which is not what we want. Thanks. | 0 | [
2,
193,
161,
20,
667,
19,
2240,
18,
203,
9,
165,
9,
300,
29,
4444,
10601,
240,
60,
800,
3726,
3726,
80,
50,
203,
7484,
13,
1,
12224,
1130,
1,
5567,
18,
1,
15,
13,
1,
27028,
18,
1,
17,
13,
1,
2051,
1651,
18,
68,
18,
1,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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: Taking the contents of a page element and using it as a variable?
===
So I have two scripts on a page:
- The first one randomly chooses a number from an array and inserts it into an element called 'number'.
- The second one is a countdown script which counts down from two variables which are interpreted as minutes and seconds. It then plays a sound once the countdown has reached zero.
At the moment, the second script is all manually set-up, so the number of minutes and seconds are hard-coded into the script itself. I'd like the second script to take whatever number was inserted into the page by the first script, and use it as its variable.
Here's a better example of how I'd like it to work:
You load the page, and it tells you that you only have (X) minutes to spare (X = inserted by first script), and whatever (X) is, acts as the 'minutes' variable in the second script, which is now displaying a countdown from (X) minutes elsewhere on the page.
The first script's output is inserted into:
<span id="minutes"></span>
And here's the code for the second script (the one that needs changing):
var interval;
var minutes = 5;
var seconds = 0;
window.onload = function() {
countdown('countdown');
}
function play(file) {
var embed = document.createElement("embed");
embed.setAttribute('src', file);
embed.setAttribute('hidden', true);
embed.setAttribute('autostart', true);
document.body.appendChild(embed);
}
function countdown(element) {
interval = setInterval(function() {
var el = document.getElementById(element);
if(seconds == 0) {
if(minutes == 0) {
el.innerHTML = "Time's up!";
clearInterval(interval);
play('alarm.mp3');
return;
} else {
minutes--;
seconds = 60;
}
}
if(minutes > 0) {
var minute_text = minutes + (minutes > 1 ? ' minutes' : ' minute');
} else {
var minute_text = '';
}
var second_text = seconds > 1 ? 'seconds' : 'second';
el.innerHTML = minute_text + ' ' + seconds + ' ' + second_text + ' remaining';
seconds--;
}, 1000);
}
I've tried changing
var minutes = 5;
var seconds = 0;
to
var minutes = document.getElementById(minutes);
var seconds = 0;
(the second script runs after the first one)
... but it doesn't seem to work, just starting at 'null' minutes.
Could anyone shed any light on this? | 0 | [
2,
8247,
8741,
45,
741,
14,
8478,
16,
21,
2478,
4520,
17,
568,
32,
28,
21,
7612,
60,
800,
3726,
3726,
86,
31,
57,
81,
17505,
27,
21,
2478,
45,
13,
8,
14,
64,
53,
21324,
3538,
18,
21,
234,
37,
40,
7718,
17,
14692,
18,
32,
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... |
Problems using ActiveRecord in a command line utility
===
I have created a command line utility that uses ActiveRecord as an ORM. It works great during development. Since deploying it, it gets run 1k-2k times per week, submitting records to the database by the users.
To my surprise I am running into a significant number of issues that I believe are due to the server-less nature in which we are using ActiveRecord. Upon each execution of the command line utility a new process is started and a new connection is made to the database.
The types of issues I'm seeing are:
1. ActiveRecord::StatementInvalid "'SignalException: SIGTERM: *". I've verified the users are not prematurely terminating the process.
2. Mysql2::Error "Too many connections". I could increase the number of allowed connections, but I'm surprised with only 1k-2k executions per week that this would occur.
3. ActiveRecord::StatementInvalid "Mysql2::Error: Lock wait timeout exceeded; try restarting transaction: *"
4. ActiveRecord::RecordNotUnique "Mysql2::Error: Duplicate entry *". This occurs when different processes try to write the same record to the database and the DB uniq index catches it.
I'm looking for some recommendation as the best way to proceed. I'm contemplating creating a daemon so that there would always be a single process running in the background and then the command line utility sends information to a queue in the daemon for processing.
Thanks for any suggestions.
| 0 | [
2,
1716,
568,
1348,
14953,
19,
21,
1202,
293,
10082,
800,
3726,
3726,
31,
57,
679,
21,
1202,
293,
10082,
30,
2027,
1348,
14953,
28,
40,
54,
79,
9,
32,
693,
374,
112,
522,
9,
179,
17617,
68,
32,
15,
32,
3049,
485,
137,
197,
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... |
WordPress - wp-admin subdomain
===
I'm new with WordPress, trying to map the wp-admin to a subdomain:
instead of:
www.mydomain.net/wp-admin
I would like:
admin.mydomain.net
I have already created a sub-domain (I use GoDaddy) that maps admin.mydomain.net to www.mydomain.net/wp-admin
I'm posting this question after searching the whole wide web, but all I found is moving the entire site to a subdomain, which I am not interested in.
Thanks in advance to all the helpers! | 2 | [
2,
833,
5890,
13,
8,
13,
13790,
8,
1283,
2160,
972,
537,
6232,
800,
3726,
3726,
31,
22,
79,
78,
29,
833,
5890,
15,
749,
20,
2942,
14,
13,
13790,
8,
1283,
2160,
20,
21,
972,
537,
6232,
45,
700,
16,
45,
13,
6483,
9,
915,
537,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ActivePerl and PPM
===
So I have installed ActivePerl 5.14.2 on a Windows 32 bit machine running XP. My problem is that I'm trying to install a few modules with PPM and it's not working out.
According to their website, all you need to do to install a module from their repository is "ppm install module name" , example: http://code.activestate.com/ppm/Template-Toolkit/
Every time I try this or any other module I get: "No Perl script found in input"
Even when I do just "ppm" I get the same message, even though the GUI should run.
When I run PPM with a GUI from the start menu I get this error: "Failed 500 Can't connect to ppm4.activestate.com:8080 (connect: timeout)”
So I though it was my connection, so using cmd.exe I used the set HTTP_PROXY command and then tried ppm install, but still no luck. So is there anyway I can get these modules installed ?
Any advice is appreciated !! | 0 | [
2,
1348,
1432,
255,
17,
3273,
79,
800,
3726,
3726,
86,
31,
57,
4066,
1348,
1432,
255,
331,
9,
1419,
9,
135,
27,
21,
1936,
2512,
1142,
1940,
946,
23045,
9,
51,
1448,
25,
30,
31,
22,
79,
749,
20,
16146,
21,
310,
17113,
29,
3273,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Tutorial Link for HP Webinspect
===
Im working on HP Webinspect tool.. Need a link explaining the scanning process in HP Webinspect | 1 | [
2,
29724,
3508,
26,
5301,
2741,
108,
7350,
800,
3726,
3726,
797,
638,
27,
5301,
2741,
108,
7350,
5607,
9,
9,
376,
21,
3508,
10225,
14,
15863,
953,
19,
5301,
2741,
108,
7350,
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,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
MySQL Join Table with String of other Records
===
Can you help me cause all the records in the "`preference`" table to become a `string` inside the `p.data` returned result?
I could only think of `CONCAT`, but my inner join only selects 1 record.
**Example Query**
SELECT
u.userid,
p.data
FROM user u
INNER JOIN preference p ON (
p.userid = u.userid
)
WHERE u.userid = 1
**Desired Output**
userid | data
--------------
1 | 1,2,3,4,5
2 | 1,2,3,4
3 | 1,2,3 | 0 | [
2,
51,
18,
22402,
1865,
859,
29,
3724,
16,
89,
742,
800,
3726,
3726,
92,
42,
448,
55,
1679,
65,
14,
742,
19,
14,
13,
7,
1,
306,
28018,
1,
7,
859,
20,
533,
21,
13,
1,
11130,
1,
572,
14,
13,
1,
306,
9,
18768,
1,
587,
829,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Patterns for Python object transformation (encoding, decoding, deserialization, serialization)
===
I've been working with the parsing module [construct][1] and have found myself really enamored with the declarative nature of it's data structures. For those of you unfamiliar with it, you can write Python code that essentially looks like what you're trying to parse by nesting objects when you instantiate.
Example:
----------------------
ethernet = Struct("ethernet_header",
Bytes("destination", 6),
Bytes("source", 6),
Enum(UBInt16("type"),
IPv4 = 0x0800,
ARP = 0x0806,
RARP = 0x8035,
X25 = 0x0805,
IPX = 0x8137,
IPv6 = 0x86DD,
),
)
While construct doesn't really support storing values inside this structure (you can either parse an abstract Container into a bytestream or a bytestream into an abstract container), I want to extend the framework so that parsers can also store values as they parse through so that they can be accessed in dot notation **ethernet.type**.
But in doing so, think the best possible solution here would be a generic method of writing encoding/decoding mechanisms so that you could register an encode/decode mechanism and be able to produce a variety of outputs from the abstract data structure (the parser itself), as well as the output of the parser.
To give you an example, by default when you run an ethernet packed through the parser, you end up with something like a dict:
Container(name='ethernet_header',
destination='\x01\x02\x03\x04\x05\x06',
source='\x01\x02\x03\x04\x05\x06',
type=IPX
)
I don't want to have to parse things twice - I would ideally like to have the parser generate the 'target' object/strings/bytes in a configurable manner.
The root of the idea is that you could have various 'plugins' registered for consuming or processing structures so that you could programatically generate XML or Graphviz diagrams as well as being able to convert from bytes to Python dicts. The crux of the task is, walk a tree of nodes and based on the encoder/decoder, transform and return the transformed objects.
So the question is essentially - **what patterns are best suited for this purpose?**
<hr/>
codec style:
------
I've looked at the **codecs** module, which is fairly elegant in that you create encoding mechanisms, register that your class can encode things and you can specify the specific encoding you want on the fly.
'blah blah'.encode('utf8')
<hr/>
serdes (serializer, deserializer):
----
There's are a couple examples of existing serdes modules for Python, off the top of my head JSON springs to mind - but the problem with it is that it's very specific and doesn't support arbitrary formats easily. You can either encode or decode JSON and thats basically it. There's a variety of serdes constructed like this, some use the **loads**,**dumps** methods, some don't. It's a crapshoot.
objects = json.loads('{'a': 1, 'b': 2})
<hr/>
visitor pattern(?):
----
I'm not terribly familiar with the visitor pattern, but it does seem to have some mechanisms that might be applicable - the idea being that (if I understand this correctly), you'd setup a visitor for nodes and it'd walk the tree and apply some transformation (and return the new objects?).. I'm hazy here.
<hr/>
other?:
----
Are there other mechanisms that might be more pythonic or already be written? I considered perhaps using ElementTree and subclassing Elements - but I wanted to consult stackoverflow before doing something daft.
[1]: http://construct.wikispaces.com/ | 0 | [
2,
6282,
26,
20059,
3095,
6978,
13,
5,
219,
15458,
15,
121,
15458,
15,
1746,
106,
2815,
1829,
15,
5956,
1829,
6,
800,
3726,
3726,
31,
22,
195,
74,
638,
29,
14,
2017,
18,
68,
12613,
636,
1126,
10346,
500,
2558,
165,
500,
17,
57,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Change variable within array
===
My target is to assign a number to the string in the array.
$lang = array (
'title' => "Der Anti-Spam Dienst",
'button-login' => "Jetzt $number via Twitter anmelden."
);
The $number should be set like $lang['button-login'][5] - but I don't have any idea how to access the variable in the array.
maybe you can help me.
Thanks! | 0 | [
2,
753,
7612,
363,
7718,
800,
3726,
3726,
51,
2935,
25,
20,
13952,
21,
234,
20,
14,
3724,
19,
14,
7718,
9,
5579,
9949,
800,
7718,
13,
5,
13,
22,
22235,
22,
800,
1,
13,
7,
1157,
1082,
8,
3401,
765,
13,
28944,
7,
15,
13,
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... |
algorithm: Find the first hole number(missing number) in a range of numbers which is sorted
===
Let's say I have a continuous range of [0, 1, 2, 4, 5, 6] where 3 is missing, the algorithm is designed to find it out. However, the range is very huge, probably there are 2^32 numbers in it. what's the best time efficient and space efficient algorithm?
The range of numbers is stored on disk, space efficient is a main concern. What I can imagine is to load part of range (maybe 100000 items) to an array each time, then continuously iterate from the first number to the last and binary search each one to see if it exists.
anybody has a better way?
let's get more complex. [0, 1, 2, 4, 6], now 3 and 5 are both missing. How to find all missing numbers in a range? because of the massive range, it's impossible to create a bitmap for all of numbers. Still, space efficient is a main concern as I don't want to blow up my memory.
thank you.
BTW: This is not a homework, actually I am trying to find available ip address in a given ip range where items in range represent allocated ip. The worst case is you have to search from 0.0.0.0 to 255.255.255.255. I have converted each ip to a long value(in java), so I summarize the question to finding the first missing number in a continuous range. | 0 | [
2,
9083,
45,
477,
14,
64,
3990,
234,
5,
7292,
68,
234,
6,
19,
21,
978,
16,
2116,
56,
25,
22554,
800,
3726,
3726,
408,
22,
18,
395,
31,
57,
21,
6357,
978,
16,
636,
387,
15,
137,
15,
172,
15,
268,
15,
331,
15,
400,
500,
113,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 switch to user perspective in Blender
===
I've just started using Blender (v2.63) for the first time. I have used a lot of 3d modelling programs in the past but Blender's controls seem to be set up differently and it's taking a while to get used to it. The thing that is really bugging me at the moment is switching from user perspective to front/side/top views. I have my view in perspective mode and I want to switch to front view in orthographic mode and then switch back to the view I had before. It seems that the only way is to press numpad-0 to go to camera view, rotate the screen a bit to get rid of the annoying black outline and then switch it back to perspective mode. Then sometimes when I go back to front view it's in perspective mode which is annoying as you never want front view in perspective, only orthographic mode.
My question: Is there a way I can be in my user view in perspective mode, switch to front/side/top views in orthographic mode and then switch back to where I was before in my user mode and be back in perspective mode? | 2 | [
2,
184,
20,
5521,
20,
4155,
6531,
19,
11138,
106,
800,
3726,
3726,
31,
22,
195,
114,
373,
568,
11138,
106,
13,
5,
710,
135,
9,
3891,
6,
26,
14,
64,
85,
9,
31,
57,
147,
21,
865,
16,
203,
43,
23089,
1726,
19,
14,
640,
47,
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... |
Can't set default attribute due to circular reference with Backbone-relational
===
I'm using Backbone with Backbone-relational. I have two models, `Appointment` and `Client`, where a `Client` can have many `Appointments`. Here's my `Client` model definition (in CoffeeScript):
class Snip.Models.Client extends Backbone.RelationalModel
paramRoot: 'client'
relations: [
type: Backbone.HasMany
key: 'appointments'
relatedModel: 'Snip.Models.Appointment'
collectionType: 'Snip.Collections.AppointmentsCollection'
reverseRelation:
type: Backbone.HasOne
key: 'client'
includeInJSON: 'id'
]
defaults:
name: null
phone: null
email: null
notes: null
active: null
class Snip.Collections.ClientsCollection extends Backbone.Collection
model: Snip.Models.Client
url: '/clients'
And here's my `Appointment` model definition:
class Snip.Models.Appointment extends Backbone.RelationalModel
paramRoot: 'appointment'
defaults:
time_block_type_code: 'APPOINTMENT'
start_time: null
stylist: null
salon: null
client: Snip.Models.Client() # This doens't work
class Snip.Collections.AppointmentsCollection extends Backbone.Collection
model: Snip.Models.Appointment
url: '/appointments'
Here's the problem: since `Client` references `Appointment`, I need to include the `Appointment` file before the `Client` file so the `Snip.Models.Appointment` class will exist by the time I reference it. However, `Appointment` *also* references `Client`, so it's kind of a catch-22 situation. I don't know what to do. | 0 | [
2,
92,
22,
38,
309,
12838,
35,
14755,
397,
20,
8155,
2801,
29,
24036,
8,
99,
10832,
192,
800,
3726,
3726,
31,
22,
79,
568,
24036,
29,
24036,
8,
99,
10832,
192,
9,
31,
57,
81,
2761,
15,
13,
1,
2552,
3132,
1130,
1,
17,
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... |
ServiceStack Monotouch iPhone/Release Build Fails
===
I have a project which uses the ServiceStack.Common.Monotouch.dll, ServiceStack.Interfaces.Monotouch.dll, and ServiceStack.Text.Monotouch.dll. I can build this project in Simulator/Release & Debug, and iPhone/Debug, but when I build in iPhone/Release, I get the following error:
<pre>
...
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/System.Data.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/System.Data.dll"
AOT Compilation exited with code 134, command:
MONO_PATH=/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --llvm --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,llvm-path=/Developer/MonoTouch/LLVM/bin/,outfile=/var/folders/mt/b7h3_pgs3lxgpvpm2h1_2ppc0000gn/T/tmp39b8b8c7.tmp/ServiceStack.Text.MonoTouch.dll.7.s "/Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll"
Mono Ahead of Time compiler - compiling assembly /Users/pseabury/Projects/IMDSS_iOS/IMDSSMobile_iOS/bin/iPhone/Release/IMDSSMobile_iOS.app/ServiceStack.Text.MonoTouch.dll
* Assertion at ../../../../../mono/mono/mini/mini-llvm.c:4535, condition `LLVMTypeOf (values [sreg1]) == LLVMTypeOf (values [phi->dreg])' not met
...
mtouch exited with code 1
</pre>
If necessary I can put together an example project, but all you should need is the latest ServiceStack dlls or sources for Monotouch and a sample/contrived DTO for a ServiceClient in order to reproduce this. | 0 | [
2,
365,
25325,
4129,
15725,
21024,
118,
15202,
1895,
13614,
800,
3726,
3726,
31,
57,
21,
669,
56,
2027,
14,
365,
25325,
9,
17130,
9,
20027,
15725,
9,
43,
211,
15,
365,
25325,
9,
6280,
6413,
18,
9,
20027,
15725,
9,
43,
211,
15,
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... |
Pre Post Metrics in facebook Insights c#
===
How to get Pre Post Metrics from Facebook Insights API in ASp.net c#?
Thanks in Advance
| 0 | [
2,
782,
678,
11544,
18,
19,
9090,
9239,
18,
272,
5910,
800,
3726,
3726,
184,
20,
164,
782,
678,
11544,
18,
37,
9090,
9239,
18,
21,
2159,
19,
28,
306,
9,
2328,
272,
5910,
60,
3669,
19,
3612,
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,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Checkboxlist inside UpdatePanel triggers full postback when an item is checked
===
So I have this Checkboxlist and I want to implement a Select All feature for the elements inside it. I placed it inside an UpdatePanel, but everytime I click an item, the entire page is reloaded. This is my code:
<asp:UpdatePanel ID="CBLPanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<div class="LeftAligned">
<asp:Label ID="FilterLabel" runat="server" Text="Filter by:" />
<asp:DropDownList runat="server" ID="FilterDDL" AutoPostBack="true" OnSelectedIndexChanged="FilterDDL_SelectedIndexChanged" />
<asp:ImageButton ID="FB" runat="server" ImageUrl="~/images/filter.png" AlternateText="VALUE"
CssClass="filter_button" OnClick="FB_Click" />
<div onmouseout="javascript:bMouseOver=false;" onmouseover="javascript:bMouseOver=true;"
class="filter_div">
<asp:CheckBoxList AutoPostBack="true" ID="FilterCheckBoxList" ClientIDMode="Static"
runat="server" CssClass="filter_checklist collapsed" OnSelectedIndexChanged="FilterCheckBoxList_Selected">
</asp:CheckBoxList>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
I though I should set ChildrenAsTriggers to false and this way I would update only from the code, but it doesn't seem to work. | 0 | [
2,
2631,
5309,
5739,
572,
11100,
3206,
532,
7286,
18,
503,
678,
1958,
76,
40,
9101,
25,
6505,
800,
3726,
3726,
86,
31,
57,
48,
2631,
5309,
5739,
17,
31,
259,
20,
8713,
21,
5407,
65,
1580,
26,
14,
2065,
572,
32,
9,
31,
1037,
32... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Overcoming needle haystack confusion in PHP
===
It's a shame that PHP doesn't have needle haystack convention for its built-in functions. And I'm always confused about it when I am using one of these functions. Take **in_array** for example
<?php
bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] )
see $needle, it's the first argument of the function. Pretty common sense, because that's what you are looking for. The most important thing for you at that point. A convention maybe?
Now, let's break that assumption and send it to garbage bin.
<?php
string strstr ( string $haystack , mixed $needle [, bool $before_needle = false ] )
See there haystack as the first argument. What the deuce? Why whould the designers of PHP allow this? But it happened and a love child has born.
My question is **how can a PHP Developer overcome needle haystack confusion?** Are we going to have PHP manual open all the time? | 0 | [
2,
84,
9076,
11931,
4301,
25325,
5677,
19,
13,
26120,
800,
3726,
3726,
32,
22,
18,
21,
7912,
30,
13,
26120,
1437,
22,
38,
57,
11931,
4301,
25325,
3087,
26,
82,
392,
8,
108,
3719,
9,
17,
31,
22,
79,
550,
4230,
88,
32,
76,
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... |
Part of a dynamic page invisible depending on item on the page
===
Sorry about the strange title, I honestly tried to make it more precise but I couldn't, as it's such a strange problem. I have a page on a website I'm creating, and this page is like a profile page for a book. Now, the strange thing:
for some books, the page loads properly and for some nothing except the first big `<div>` is visible - but when I look at the source code, it's exactly the same for both pages (except for different titles, book description etc). You can see a visible and invisible page through the links below, and you will see what I mean. I am completely stumped by this, as the page source shows all the same content and on one page it's fine but on the other it's like everything has `display:hidden;`.
Working page:
http://jovansfreelance.com/booklist/list/item/Game-Of-Thrones-Book-1
Broken page:
http://jovansfreelance.com/booklist/list/item/A
Any ideas on what's going on here?
Explanation of book title being just 'A': the title is typed in by the user, and the actual title is fetched from Amazon. So if a user types in 'A' the first result is 'A Christmas Carol' so that gets displayed. | 0 | [
2,
141,
16,
21,
7782,
2478,
8874,
4758,
27,
9101,
27,
14,
2478,
800,
3726,
3726,
1875,
88,
14,
2578,
581,
15,
31,
10971,
794,
20,
233,
32,
91,
11114,
47,
31,
711,
22,
38,
15,
28,
32,
22,
18,
145,
21,
2578,
1448,
9,
31,
57,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
itunes movie trailers gridview
===
I'm trying to reproduce a gridview for a landscape only iPad app.
I've tried a few know Gridviews such as AQGridview or GMGridView but it doesn't fit since it's not a "traditional" gridview (it is for an epg so the elements are not of the same size - depending on their duration).
What I would like to achieve should be more like the [iTunes Movie Trailers app][appstore].
I was wondering if you know any library (free & open source, if possible) that could help me to achieve this.
Last one I've seen is [NGVaryingGridView](http://www.cocoacontrols.com/platforms/ios/controls/ngvaryinggridview) which sounds promising but it doesn't seem to be optimized (try to rotate it just for fun).
Thanks in advance for any advice.
[image]: http://a1.mzstatic.com/us/r1000/077/Purple/v4/7f/32/a5/7f32a529-264c-3884-d82c-fab03d016370/mza_8181692779139577744.480x480-75.jpg
[appstore]: http://itunes.apple.com/us/app/itunes-movie-trailers/id471966214 | 0 | [
2,
12952,
1308,
7932,
18,
7354,
4725,
800,
3726,
3726,
31,
22,
79,
749,
20,
21509,
21,
7354,
4725,
26,
21,
4453,
104,
31,
8240,
4865,
9,
31,
22,
195,
794,
21,
310,
143,
7354,
4725,
18,
145,
28,
21,
1251,
16375,
4725,
54,
12600,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 get rid of the FB auth webview and go back to previous activity after pressing Back button?
===
I am currently integrating the official Android Facebook SDK in one of my project.
In one of my activity, I launch the "Facebook" Authentication dialog (a web view actually). The thing is that if the user clicks on the "Back button" then it just makes the Webview disappears instead of going back to the previous activity.
Does anybody know how to make :
- the webview disappear
- and the app to go back to the previous Activity ?
in the same time
instead of :
just closing the FB webView
knowing that :
- We can't get any reference to this webview from the code or intercept any event related to this webview from the launching activity.
thanks a lot,
| 0 | [
2,
184,
20,
164,
6681,
16,
14,
13,
13478,
10343,
96,
2741,
4725,
17,
162,
97,
20,
1158,
2358,
75,
7196,
97,
5167,
60,
800,
3726,
3726,
31,
589,
871,
24529,
14,
989,
13005,
9090,
13,
18,
43,
197,
19,
53,
16,
51,
669,
9,
19,
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... |
Doctrine/Symfony2 get data from tables in relationship
===
I have an table Article that is in relationship with Steps (OneToMany) and Steps with Article ManyToOne.
I get Articles with:
$articles = $this->getDoctrine()
->getRepository("IftodiDesignBundle:Article")
->findAll();
And with foreach I want to show all Articles and Steps:
foreach($articles as $article)
{
$steps = $this->getDoctrine()
->getRepository("IftodiDesignBundle:Steps")
->createQueryBuilder('s')
->where('s.article = \''.$article.'\'')
->getQuery()
->execute();
echo "<b>".$article->getTitle()."</b><br />";
echo $article->getText()."<br />";
}
I don't know how to get data from table Steps usign the table Article and method getSteps() that is generated with Doctrine.
Please help me. | 0 | [
2,
7521,
118,
7261,
10229,
93,
135,
164,
1054,
37,
7484,
19,
1429,
800,
3726,
3726,
31,
57,
40,
859,
2002,
30,
25,
19,
1429,
29,
2382,
13,
5,
849,
262,
14842,
6,
17,
2382,
29,
2002,
151,
262,
849,
9,
31,
164,
3376,
29,
45,
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... |
package that works inside and outside django. Is this a good design?
===
I'm relative new to django and in generall to the python world. But I have experience with ruby (been working with rails for 2 years) so many concepts of python/django are not that new to me.
Anyway, I am writing an small package in python that will have a database connection and I want to use this package inside django but also in the feature outside django. So I decided take advantage of **django.db** and not worry about writing any database connection and managment stuff.
So I started writing my first models and wanted to make a first test outside of a django environment and I'm finding myself with some difficulties.
I thought about having the same configuration mechanism for my package as for any django application (I mean the settings.py file). I wrote a file (called nodjango_settings.py as a template) that only contains the DATABASES dictionary and added two custom variables to it:
MYAPP_DB_ID = "myappdb"
MYAPP_DB_PREFIX = "myapp_"
DATABASES = {
MYAPP_DB_ID: {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'myappdb',
}
}
The directory structure of my package is:
.
|-- README.txt
|-- doc
| `-- db.txt
|-- setup.py
|-- src
| |-- __init__.py
| `-- myapp
| |-- __init__.py
| |-- exceptions.py
| |-- models.py
| |-- nodjango_settings.py
| `-- nodjango_settings.pyc
`-- test
`-- test.py
I was reading a little bit of djangos own code to see how to handle the DJANGO_SETTINGS_MODULE environment variable and read the configuration file, so added the following code to `myapp/__init__py`.
import os
# try to look after the DJANGO_SETTINGS_MODULE environment variable
# if not present raise an import error
# code abstract from python2.6/site-packages/django/conf/__init__.py
try:
settings_module = os.environ["DJANGO_SETTINGS_MODULE"]
if not settings_module: # If it's set but is an empty string.
raise KeyError
except KeyError:
raise ImportError("The DJANGO_SETTINGS_MODULE environment variable is not present.")
# TODO: look at python2.6/site-packages/django/conf/__init__.py +93
# if you print sys.path then the project directory gets added
# in django/core/management/__init__.py with sys.path.append
from django.utils import importlib
p = importlib.import_module(settings_module)
print p.MYAPP_DB_ID
I wanted to test that `__init__.py` works as intended so on the root directory of my package I ran:
$ DJANGO_SETTINGS_MODULE="src.myapp.nodjango_settings" python src/myapp/__init__.py
Traceback (most recent call last):
File "src/myapp/__init__.py", line 22, in <module>
p = importlib.import_module(settings_module)
File "/home/yanez/devpython/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
ImportError: No module named src.myapp.nodjango_settings
I didn't expect that. When you create a new django application a `manage.py` file is created. And this file sets `DJANGO_SETTINGS_MODULE` the variable to the settings.py file from the perspective of the root directory of the application.
I read more code of django and realized that in `django/core/management/__init__.py` the root directory of the application is added to `sys.path`. This could also be the solution to my problem but I'm not quite sure whether it's a good idea to mess with `sys.path` or not.
I'm not quite sure whether my idea is a good one or a bad one. I'd like to know what you think about it and where/how I can improve it. Beside, if I stick to my idea, how can I read my custom varaibles in `settings.py` without having to reimport the settings module over and over?
Thanks | 0 | [
2,
6030,
30,
693,
572,
17,
719,
3857,
14541,
9,
25,
48,
21,
254,
704,
60,
800,
3726,
3726,
31,
22,
79,
4543,
78,
20,
3857,
14541,
17,
19,
297,
255,
20,
14,
20059,
126,
9,
47,
31,
57,
1496,
29,
10811,
13,
5,
863,
219,
638,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 callback within class loses binding
===
I have a problem with my class where I set a callback function to fire after an ajax request, this works fine except for the callback then having this= window instead of this = the calling class. I have tried fiddling with the bindings etc to no avail. any help appreciated.
<?php
if (isset($_POST['id'])){
echo json_encode(array('key' => 'val'));
die;
}
?>
<script type="text/javascript" src="/linkup/js/mootools-core-1.4.3-full-compat-yc.js" charset="utf-8"></script>
<script type="text/javascript" src="/linkup/js/mootools-more-1.4.0.1.js" charset="utf-8"></script><script>
var myClass = new Class({
blah: function(){
console.log('this worked ok');
},
foo: function(){
this.blah(); // at this point it is failing with "unknown function"
},
bar: function(){
this.reqJSON({id:1,req:'grabpoints'},this.foo);
},
// data - an aray containing some data to post {id:1,req:'grabpoints'}
// onS - a function to fire on return of data
reqJSON: function(data,onS){
if (this.jsonRequest) this.jsonRequest.cancel();
this.jsonRequest = new Request.JSON({
url: 'test.php',
onRequest: function (object){
console.log('sending json');
},
onSuccess: function (object){
console.log('json success');
onS(object);
}
}
).post(data);
},
});
var o = new myClass();
o.bar();
</script> | 0 | [
2,
8247,
8741,
645,
1958,
363,
718,
14745,
8728,
800,
3726,
3726,
31,
57,
21,
1448,
29,
51,
718,
113,
31,
309,
21,
645,
1958,
1990,
20,
535,
75,
40,
20624,
3772,
15,
48,
693,
1123,
1613,
26,
14,
645,
1958,
94,
452,
48,
3726,
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... |
How to change text color inside uipicker?
===
How to change the text color inside picker with various colors. For Example:
![enter image description here][1]
[1]: http://i.stack.imgur.com/sgN2g.png | 0 | [
2,
184,
20,
753,
1854,
1665,
572,
13,
5661,
16855,
106,
60,
800,
3726,
3726,
184,
20,
753,
14,
1854,
1665,
572,
2036,
106,
29,
617,
5268,
9,
26,
823,
45,
13,
187,
2558,
13679,
1961,
5318,
235,
500,
2558,
165,
500,
636,
165,
500,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
In Java Replace all instances of a character except the first one
===
In Java trying to find a regular expression that will match all instances of a specific character (:) except the first instance, want to replace all instances except first with nothing. | 0 | [
2,
19,
8247,
3934,
65,
13946,
16,
21,
925,
1613,
14,
64,
53,
800,
3726,
3726,
19,
8247,
749,
20,
477,
21,
1290,
1803,
30,
129,
730,
65,
13946,
16,
21,
1903,
925,
13,
5,
45,
6,
1613,
14,
64,
4851,
15,
259,
20,
3934,
65,
13946... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Advice on linking product codes to a product in a MySQL database
===
I need some advice of how to setup my tables I currently have a product table and a product codes table.
In the codes table I have an id and a title such as:
1 567902
2 345789
3 345678
there can be many items in this table.
In my product table I have the usual product id,title, etc but also a code id column that I'm currently storing a comma separate list of ids for any codes the product needs to reference.
in that column I could end up with ids like: 2,5,6,9
I'm going to need to be able to search the products table looking for code ids for a specific set this is where I've come into problems trying to use id IN ($var) or FIND_IN_SET is proving problematic I've been advised to restructure it I'm happy to do just wondering what the best method would be. | 0 | [
2,
4978,
27,
12585,
2374,
11358,
20,
21,
2374,
19,
21,
51,
18,
22402,
6018,
800,
3726,
3726,
31,
376,
109,
4978,
16,
184,
20,
18161,
51,
7484,
31,
871,
57,
21,
2374,
859,
17,
21,
2374,
11358,
859,
9,
19,
14,
11358,
859,
31,
57... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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: structs in structs
===
My assignment is to create a simple graph that has both Nodes and Edges.
In my header file which was given and cant't be modified I have
typedef struct Edge_s* Edge;
typedef struct Node_s* Node;
typedef struct Graph_s* Graph;
and in my graph.c
typedef struct{
size_t w;
struct Node_s* target;
}*Edge;
typedef struct{
size_t value;
Edge* edges;
size_t s;
}*Node;
typedef struct{
Node* nodes;
size_t n;
Edge* edges;
size_t e;
}*Graph;
Edge create_edge(Node t, size_t w){
Edge ret = malloc(sizeof(*ret));
ret->target = t;
ret->w = w;
return ret;
}
This gives a warning on compile
warning: assignment from incompatible pointer type
I'm kind of confused here, what am I getting wrong and how should I fix it? The program is almost working and I'm getting one strange bug that I believe might be because of this.
| 0 | [
2,
272,
45,
13,
10346,
18,
19,
13,
10346,
18,
800,
3726,
3726,
51,
8427,
25,
20,
1600,
21,
1935,
7210,
30,
63,
156,
16272,
17,
7840,
9,
19,
51,
157,
106,
3893,
56,
23,
504,
17,
2973,
22,
38,
44,
5372,
31,
57,
1001,
13862,
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... |
Facebook TOS Query
===
If I had a site that allowed a user to login and connect with their Facebook account, which then in turn allowed them to see all the photos they have an were tagged in, their messages, and their news-feed and wall. Would that be in violation of FB's TOS.
I would be making API calls to get the data and then display it in my own format. | 0 | [
2,
9090,
20,
18,
25597,
800,
3726,
3726,
100,
31,
41,
21,
689,
30,
1159,
21,
4155,
20,
6738,
108,
17,
6379,
29,
66,
9090,
2176,
15,
56,
94,
19,
805,
1159,
105,
20,
196,
65,
14,
7064,
59,
57,
40,
46,
27945,
19,
15,
66,
7561,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 get facebook cookie? (javascript)
===
I'm using javascript for the facebook login, and for posting action.
The problem is, if I login on facebook on the page A, I cannot post on a page B because I lost all the facebook information and I have to re-init and to re-log on facebook for posting on a other...
and I would like have a login page, and after the user could navigate on the website and post from any page.
Is there a way to fix that by using the cookie? or anything else? I looked for getting back but cookie but I still not find out how...
Thanks | 0 | [
2,
184,
20,
164,
9090,
19980,
60,
13,
5,
1004,
1385,
8741,
6,
800,
3726,
3726,
31,
22,
79,
568,
8247,
8741,
26,
14,
9090,
6738,
108,
15,
17,
26,
15669,
1028,
9,
14,
1448,
25,
15,
100,
31,
6738,
108,
27,
9090,
27,
14,
2478,
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 syntax error for init
===
Hey guys I'm getting a syntax error on my var url line but I can't seem to figure out
what or why it is, help appreciated
SW.wmode = {
init: function() {
$('iframe').each(function()
var url = $(this).attr("src")
$(this).attr("src",url+"?wmode=transparent")
);
}
} | 0 | [
2,
487,
8190,
93,
22649,
7019,
26,
19,
242,
800,
3726,
3726,
8409,
2776,
31,
22,
79,
1017,
21,
22649,
7019,
27,
51,
4033,
287,
6362,
293,
47,
31,
92,
22,
38,
2260,
20,
1465,
70,
98,
54,
483,
32,
25,
15,
448,
13746,
8783,
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... |
How to share services across projects in Service Stack?
===
What's the best way to share services among Service Stack projects?
The way I'm currently doing it is to inherit from services that are needed. For example:
// Grabbing a service from another project
public class ServiceA : AnotherNamespace.InAnotherAssembly.ServiceC
{
}
// Grabbing a service from another project
public class ServiceB : AnotherNamespace.InAnotherAssembly.ServiceD
{
}
// Business as usual
public class ServiceX : RestServiceBase<RequestPocoX>
{
....
}
// Business as usual
public class ServiceY : RestServiceBase<RequestPocoY>
{
....
}
This allows Service Stack to wire up all of the services automatically when referencing the assembly in the AppHost
public AppHost() : base("Combined Services", typeof(ServiceA).Assembly)
{
}
Is this a reasonable approach, or are there better alternatives?
The reason I bring this up is because I ran into an issue trying to ResolveService<ServiceC> in "ServiceD". I think this might be because the IoC couldn't find it.
I hope that's clear. | 0 | [
2,
184,
20,
1891,
687,
464,
2314,
19,
365,
7566,
60,
800,
3726,
3726,
98,
22,
18,
14,
246,
161,
20,
1891,
687,
497,
365,
7566,
2314,
60,
14,
161,
31,
22,
79,
871,
845,
32,
25,
20,
17569,
37,
687,
30,
50,
851,
9,
26,
823,
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... |
Cobertura set up - Build.xml file entries
===
I have followed all the steps , but the task what i have added , never gets called. meaning I dont see my targets for cobertura being executed when I run by ant script. Please help. | 1 | [
2,
326,
4461,
3031,
309,
71,
13,
8,
1895,
9,
396,
8184,
3893,
11399,
800,
3726,
3726,
31,
57,
709,
65,
14,
2382,
13,
15,
47,
14,
3005,
98,
31,
57,
905,
13,
15,
243,
3049,
227,
9,
1813,
31,
1049,
196,
51,
7767,
26,
326,
4461,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0... |
Classpath when re-implementing Java package?
===
I'm working on creating my own implementation of one of the system Java packages but am having some problems with the wrong class getting picked up when trying to use the package.
For example, lets say my package is: **a.b.c.DoStuff** and there is an existing Java package with the exact same name, **a.b.c.DoStuff**.
Using the following code in a test application, I can tell that the system class is still getting used (located in /usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar) instead of my own:
ClassLoader loader = test.class.getClassLoader();
System.out.println(loader.getResource("a.b.c.DoStuff.class");
My package has been compiled into a jar file (**package.jar**), and I have:
1. Imported the class in my test file (import a.b.c.DoStuff;)
2. Added package.jar to my classpath (with both "export CLASSPATH..." and using "java -classpath...")
There must be something I'm overlooking? Any thoughts on how to get my package picked up instead of the system package?
Thanks,<br/>
Chris | 0 | [
2,
718,
8353,
76,
302,
8,
8983,
413,
1130,
68,
8247,
6030,
60,
800,
3726,
3726,
31,
22,
79,
638,
27,
2936,
51,
258,
6123,
16,
53,
16,
14,
329,
8247,
16875,
47,
589,
452,
109,
1716,
29,
14,
1389,
718,
1017,
2114,
71,
76,
749,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 wrong with this simple RelativeLayout Android program?
===
I've created this very simple RelativeLayout as a test for something I may want to do later. Currently, there are just supposed to be 3 buttons, "second", "alpha" and "mode" arranged relative to each other. I have two issues: firstly, there is something wrong with the XML layout file and I have no idea what, as I've thoroughly checked through it. This leads to errors on lines 10 and 11 of the layout. Secondly, there is no generated R file as there usually is in an android activity. This leads to an error on line 11 of the main code, as it tries to call something from the R file. My code is as follows:
LAYOUT:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/second"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/alpha"
android:layout_toLeftOf="@id/mode"
android:text="@string/second"
android:layout_alignParentLeft="true" />
<Button
android:id="@+id/alpha"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/second"
android:layout_alignParentLeft="true"
android:text="@string/alpha" />
<Button
android:id="@+id/mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/second"
android:layout_alignParentLeft="true"
android:text="@string/mode" />
</RelativeLayout>
Main Activity Code:
package com.example.TI84;
import android.app.Activity;
import android.os.Bundle;
public class TI84GraphingCalculatorActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
Thank you for your help! | 0 | [
2,
98,
25,
1389,
29,
48,
1935,
4543,
4414,
1320,
13005,
625,
60,
800,
3726,
3726,
31,
22,
195,
679,
48,
253,
1935,
4543,
4414,
1320,
28,
21,
1289,
26,
301,
31,
123,
259,
20,
107,
138,
9,
871,
15,
80,
50,
114,
2293,
20,
44,
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... |
Renaming Group of Files Using Loop in Visual Basic
===
I currently have these group of files I want to rename:
C:\Users\tmedina\Documents\testenviroment\Testfolder\file1-1111.doc
C:\Users\tmedina\Documents\testenviroment\Testfolder\file2-1111.doc
C:\Users\tmedina\Documents\testenviroment\Testfolder\file3-1111.doc
...
C:\Users\tmedina\Documents\testenviroment\Testfolder\file20-1111.doc
I have a text box on my form where a I would enter a string of text which will replace the '1111' to whatever the string is in the text box field.
So for example, On my app, in the text box field, I would enter `2222`, then when I click on button1, it will rename `file1-1111.doc` to `file1-2222.doc`, `file2-1111.doc` to `file2-2222.doc`, etc.....
This is my VB code I currently have:
Dim base As String = "C:\Users\tmedina\Documents\testenviroment\"
Dim newDir As String = base + CStr(TextBox1.Text)
Directory.CreateDirectory(newDir)
Directory.SetCurrentDirectory(newDir)
For Each nameChangeFiles As String In My.Computer.FileSystem.GetFiles(newDir, Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*1111*")
My.Computer.FileSystem.RenameFile(nameChangeFiles, "2222")
But this only creates a blank file (with no extension) named 2222.
Any help will be appreciated.
| 0 | [
2,
25934,
214,
16,
6488,
568,
5293,
19,
3458,
2125,
800,
3726,
3726,
31,
871,
57,
158,
214,
16,
6488,
31,
259,
20,
302,
7259,
45,
272,
45,
1,
16704,
18,
1,
38,
13592,
325,
1,
28132,
18,
1,
10543,
219,
8145,
111,
1130,
1,
10543... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Generating java from IDL (avoiding default package)
===
I'm working with a LARGE legacy C++ code base with numerous IDL files that have all the types and constants declared outside of any module.
For C++, this results in code being generated to the global namespace -- ugly, but acceptable.
Now I'm trying to add Java clients to connect via CORBA. For Java, however, the types that are generated from the IDL are in the java _default package_ because they are not within an IDL module. This results in Java compilation errors, as it is illegal to import from the default package.
I'm looking for the easiest way to correct the problem.
I've considered the following:
1. **Place a module declaration around all types**. I'm currently working this solution, but it's VERY painful, based on the number of types affected and the impact to the large legacy C++ codebase.
2. **Use the -pkgPrefix or -pkgTranslate options**. So far, I can't figure out how to accomplish this, since you must specify a module to translate _from_ and, as mentioned before, the types are not in any module.
3. **Use a pragma directive**? I'm not aware of one to use, but hoping a guru can point the way?
4. ????
I find it difficult to believe that there's no easy way to force the IDL to be in a Java package if there's not an existing module that contains all the types. I'm hoping that I'm just missing the obvious! | 0 | [
2,
13500,
8247,
37,
31,
8643,
13,
5,
13884,
1340,
68,
12838,
6030,
6,
800,
3726,
3726,
31,
22,
79,
638,
29,
21,
370,
7780,
272,
20512,
1797,
1000,
29,
1548,
31,
8643,
6488,
30,
57,
65,
14,
2551,
17,
3587,
18,
2482,
719,
16,
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... |
Razor Foreach Loop not returning all data
===
I have a foreach loop that builds hyperlinks based on the number of items in the model. It's working fine, except the part that says: `ProgramId = @item.ProgramIds.First()` is only returning the first program ID for each ProgramType. What is the syntax for letting it loop through all of the program ID's rather than just the first?
@model IEnumerable<CMESurvey.ViewModels.ProgramTypeViewModel>
@{
ViewBag.Title = "Home";
}
@foreach (var item in Model)
{
<h2>@Html.DisplayFor(modelItem => item.ProgramTypes)</h2>
<ul>
@foreach (var ProgramTitles in item.ProgramTitles)
{
<li>
@Html.ActionLink(@ProgramTitles, "Results", "SurveyResponse", new { ProgramId = @item.ProgramIds.First() }, null)
</li>
}
</ul>
}
| 0 | [
2,
14282,
26,
14322,
5293,
52,
2485,
65,
1054,
800,
3726,
3726,
31,
57,
21,
26,
14322,
5293,
30,
1895,
18,
5443,
6258,
18,
432,
27,
14,
234,
16,
3755,
19,
14,
1061,
9,
32,
22,
18,
638,
1123,
15,
1613,
14,
141,
30,
898,
45,
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... |
Displaying a default view when a condition is true, asp.net mvc3
===
How to display a default page like Maintenance page for all the views if a web.config key is set to true?
If the key is false, then show the regular views.
Plz note, I don't want to repeat the code in each controller and am looking for a common place, like _ViewStart or _Layout page where this can be defined.
Thanks. | 0 | [
2,
17418,
21,
12838,
1418,
76,
21,
2874,
25,
1151,
15,
28,
306,
9,
2328,
307,
8990,
240,
800,
3726,
3726,
184,
20,
3042,
21,
12838,
2478,
101,
5010,
2478,
26,
65,
14,
4146,
100,
21,
2741,
9,
14093,
2816,
1246,
25,
309,
20,
1151,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 have a drop-down menu influence the returned value
===
I'm trying to set up an html form that allows the user to select a field from a drop-down menu, then specify the information for that field. For example, if they select "Name" from the menu, then enter a name, it posts a specific response.
Here's how the html looks:
<form action="hello.php" method="post">
<select>
<option disabled="yes" selected="yes">Select...</option>
<option value="name">Name</option>
<option value="gender">Gender</option>
<option value="birthday>Birthday</option>
<input name="name" type="text" />
<input type="submit" value="Submit">
</form>
What I'm trying to do is have the php code change responses based on what's submitted. Here's the php code:
$name = $_POST['name'];
$gender = $_POST['gender'];
$bday = $_POST['birthday'];
With the responses:
echo "Hello, $name!";
echo "Your gender is $gender!";
echo "Happy birthday on $birthday!";
depending on what option they select. (I haven't finished the if/elseif/else statements yet because I'm not sure if they're influenced by how the information is recieved.)
Is it possible to do this? I know that my code will only ever return $name in this example, because
<input name="name"...>
But I don't know if it's possible to have the text field's information identified by the drop-down menu. I imagine it's probably possible with Javascript, but I've never used Javascript and wouldn't know how to do this.
Thanks!
| 0 | [
2,
25,
32,
938,
20,
57,
21,
2804,
8,
2968,
11379,
1915,
14,
587,
1923,
800,
3726,
3726,
31,
22,
79,
749,
20,
309,
71,
40,
13,
15895,
505,
30,
2965,
14,
4155,
20,
5407,
21,
575,
37,
21,
2804,
8,
2968,
11379,
15,
94,
19077,
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... |
NSImageView setImageScaling notWorkingCorrectly
===
I'm having problems scaling an image in nsimageview correctly. What happens is when the image is loaded, it doesn't fill up the entire nsimageview. I used NSScaleToFit and it completely stretched the image. Since I don't know the dimensions of the photo (it changes, depending on what image is used) I can't set the nsimageview to a size and leave it there. **What I want to do is fill the entire nsimageview with an image, proportionally, even if some of the image is cut off.**
This is the code that I'm using:
NSString *image_path = [applicationSupportDirectory stringByAppendingPathComponent:desktop_name];
NSImage *imageFromBundle = [[NSImage alloc] initWithContentsOfFile:image_path];
[ViewImage setImageScaling:NSScaleProportionally];
[ViewImage setImage: imageFromBundle]; | 0 | [
2,
13,
2172,
22039,
4725,
309,
22039,
18,
3430,
68,
52,
14120,
25345,
102,
800,
3726,
3726,
31,
22,
79,
452,
1716,
26829,
40,
1961,
19,
13,
2172,
22039,
4725,
12044,
9,
98,
5531,
25,
76,
14,
1961,
25,
8572,
15,
32,
1437,
22,
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... |
How does object.equals method is supposed to work in Java?
===
This is my source code. I'trying to implement a simple program that asks a question to a user and expects the answer to be "yes" or "no" and terminates only if the user answer to the question "yes" or "no". The book I have suggested me not to use == comparison and to use the equals method instead, so that the program can understand if the user typed "y e s" instead of "yes". But in this way the result is the same and the method seems to compare the user's answer if it is exactly "yes" or "no". It doesn't accept for example an aswer of "n o". Is that logical for that method? Is it supposed to work that way? How can I change the program to accept answers like "Yes" "ye s" "No" "NO" etc.? I would appreciate your help:)
import acm.program.*;
public class YesNoExample extends ConsoleProgram{
public void run(){
while(true){
String answer = readLine("Would you like instructions? ");
if(askYesNoQuestion(answer)){
break;
}
println("Please answer yes or no.");
}
}
private boolean askYesNoQuestion(String str){
if(str.equals("yes")||str.equals("no")){
return true;
}else{
return false;
}
}
}
| 0 | [
2,
184,
630,
3095,
9,
62,
14512,
18,
2109,
25,
2293,
20,
170,
19,
8247,
60,
800,
3726,
3726,
48,
25,
51,
1267,
1797,
9,
31,
22,
5840,
68,
20,
8713,
21,
1935,
625,
30,
3913,
21,
1301,
20,
21,
4155,
17,
4186,
18,
14,
1623,
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... |
How to use Plupload HTML4 upload for S3?
===
I'm trying to get an html4 runtime of Plupload to work with S3. Unfortunately the [example I found here][1] must be a really old version of plupload or not properly documented, and has no live working example or source code download.
So I took my working version of Plupload/Flash runtime to S3 and simply put html4 runtime instead of flash and added `'success_action_redirect':` *(I learned from plupload forums that this is needed for plupload to know when the file upload is complete)*. I came to find out that it actually works, but some of the script does fail.
Here is my source code...
**PHP:**
<?php
$bucket = 'MyBucket';
$accessKeyId = 'MyKey';
$secret = 'MySecret';
// Policy Setup
if (!function_exists('hash_hmac')) : function hash_hmac($algo, $data, $key, $raw_output = false){
$blocksize = 64;
if (strlen($key) > $blocksize)
$key = pack('H*', $algo($key));
$key = str_pad($key, $blocksize, chr(0x00));
$ipad = str_repeat(chr(0x36), $blocksize);
$opad = str_repeat(chr(0x5c), $blocksize);
$hmac = pack('H*', $algo(($key^$opad) . pack('H*', $algo(($key^$ipad) . $data))));
return $raw_output ? $hmac : bin2hex($hmac);
}
endif;
// prepare policy
$policy = base64_encode(json_encode(array(
'expiration' => date('Y-m-d\TH:i:s.000\Z', strtotime('+1 day')),
'conditions' => array(
array('bucket' => $bucket),
array('acl' => 'authenticated-read'),
array('success_action_redirect' => 'http://mydomain.com/ThisCanBeAnyPage.php'),
array('starts-with', '$key', ''),
array('success_action_status' => '201'),
array('starts-with', '$name', ''),
array('starts-with', '$Filename', ''),
)
)));
// Sign Policy
$signature = base64_encode(hash_hmac('sha1', $policy, $secret, true));
?>
**Javascript:**
<script type="text/javascript" src="js/plupload.full.js"></script>
<script type="text/javascript" src="js/plupload.html4.js"></script>
<script type="text/javascript">
// Custom example logic
$(function() {
var uploader = new plupload.Uploader({
preinit : {
UploadFile: function(up, file) {
// When file is loaded, directory on S3 is set here.
up.settings.multipart_params.key = 'myFolder/'+file.name;
}
},
runtimes : 'html4',
browse_button : 'pickfiles',
container : 'container',
url : 'http://<?php echo $bucket; ?>.s3.amazonaws.com/',
max_file_size : '300mb',
multipart: true,
multipart_params: {
'key': '${filename}', // use filename as a key
'success_action_redirect':'http://mydomain.com/ThisCanBeAnyPage.php',
'Filename': '${filename}', // adding this to keep consistency across the runtimes
'acl': 'authenticated-read',
'success_action_status': '201',
'AWSAccessKeyId' : '<?php echo $accessKeyId; ?>',
'policy': '<?php echo $policy; ?>',
'signature': '<?php echo $signature; ?>'
},
file_data_name: 'file',
multiple_queues: true,
filters : [
{title : "Image Files", extensions : "jpg,jpeg"},
],
flash_swf_url : 'js/plupload.flash.swf',
silverlight_xap_url : 'js/plupload.silverlight.xap'
});
uploader.bind('Init', function(up, params) {
//$('#filelist').html("<div>Current runtime: " + params.runtime + "</div>");
});
$('#uploadfiles').click(function(e) {
uploader.start();
e.preventDefault();
});
uploader.bind('FilesAdded', function(up, files) {
$.each(files, function(i, file) {
// file.name seems to be the only thing that is returned so file.size is displayed as 'N/A'
$('#filelist').append(
'<div class="Section" id="'+file.id+'">'
+file.name+' ('+plupload.formatSize(file.size)+') <b>'
+'</b><div class="PlupLoadingBarWrap"><div class="PlupLoadingBar"></div></div>'
+'</div>'
);
});
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('UploadProgress', function(up, file) {
// file.name seems to be the only thing that is returned
// This triggers when file is complete before 'FileUploaded' and not during upload process.
});
uploader.bind('Error', function(up, err) {
// Haven't received an error to know if this works.
$('#filelist').append("<div>Error: " + err.code +
", Message: " + err.message +
(err.file ? ", File: " + err.file.name : "") +
"</div>"
);
up.refresh(); // Reposition Flash/Silverlight
});
uploader.bind('FileUploaded', function(up, file) {
// file.name seems to be the only thing that is returned
// This does trigger once file is completely loaded
});
uploader.bind('UploadComplete', function(up, files){
// Calls a function
});
uploader.init();
});
</script>
**HTML:**
<h3>Custom example</h3>
<div id="container">
<div id="filelist">No runtime found.</div>
<br />
<a id="pickfiles" href="#">[Select files]</a>
<a id="uploadfiles" href="#">[Upload files]</a>
</div>
So to conclude, this script does work but lacks file.size and there is no progress indication according to what I was able to find out. I want to knowt if there is a plupload html4 script out there that includes the things that are missing here. I have a workaround in mind that I have yet to test. But I'll keep this updated.
[1]: http://www.plupload.com/punbb/viewtopic.php?id=133 | 0 | [
2,
184,
20,
275,
12443,
576,
8294,
13,
15895,
300,
71,
8294,
26,
13,
18,
240,
60,
800,
3726,
3726,
31,
22,
79,
749,
20,
164,
40,
13,
15895,
300,
485,
891,
16,
12443,
576,
8294,
20,
170,
29,
13,
18,
240,
9,
6200,
14,
636,
290... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 make a Google-like side nav?
===
I need a little help to get my side nav working properly.
Link to my working version: http://recx.vaughndtaylor.com/
Notice that the nav expands/contracts properly, but I want to have the +/- acting independent of the link. For example, I want the menu to expand when the + is clicked, but I want the link to go to a page.
I'm using Google's side nav as an example: https://developers.google.com/chart/
The toggle in this example can be clicked, but you can also click the link.
This is what I have:
$('li.openable').click(function(){
if ($(this).children('div.accordion').is(':hidden')) {
$(this).siblings().removeClass('active').children('div.accordion').slideUp();
$(this).toggleClass('active').children('div.accordion').slideDown('fast');
} else {
$(this).removeClass('active').children('div.accordion').slideUp('fast');
}
return false;
});
I think I need something more like this:
$('li.openable > span.icon').click(function(){
if ($(this).children('div.accordion').is(':hidden')) {
$(this).siblings().removeClass('active').children('div.accordion').slideUp();
$(this).toggleClass('active').children('div.accordion').slideDown('fast');
} else {
$(this).removeClass('active').children('div.accordion').slideUp('fast');
}
return false;
});
I'm having difficulties figuring out the relationship between objects here. In my second example, $(this) is no longer the correct object (this is now span.icon). Do I set this as a variable? Do I use relationships (eg. siblings(), parents()?)
Any help on this issue would be greatly appreciated.
Thanks! | 0 | [
2,
184,
20,
233,
21,
8144,
8,
1403,
270,
16048,
60,
800,
3726,
3726,
31,
376,
21,
265,
448,
20,
164,
51,
270,
16048,
638,
7428,
9,
3508,
20,
51,
638,
615,
45,
7775,
6903,
14673,
396,
9,
1385,
9294,
706,
29111,
9,
960,
118,
355... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 do blank spaces in the end of the field in sql-query produces "wrong" result?
===
Suppose, we have a test table in MySql:
CREATE TABLE `test_table` (
`_id` INT(10) UNSIGNED NOT NULL,
`testfield` TEXT NULL COLLATE 'utf8_unicode_ci',
PRIMARY KEY (`_id`)
)
COLLATE='utf8_unicode_ci'
ENGINE=MyISAM;
it contains a single row:
INSERT INTO `test_table` (`testfield`) VALUES ('testValue');
Then when I do this query:
select * from test_table where testField = "testValue"
or this:
select * from test_table where testField = "testValue "
or even this:
select * from test_table where testField = "testValue "
I always receive the same result, and it is this single row, but I want this row only in first case.
Why mysql truncate blank spaces at the end of `"testVaue "`? And the main question, what should I do to eliminate such behavior?
| 0 | [
2,
483,
107,
6463,
7644,
19,
14,
241,
16,
14,
575,
19,
4444,
255,
8,
8190,
93,
6700,
13,
7,
499,
14271,
7,
829,
60,
800,
3726,
3726,
5787,
15,
95,
57,
21,
1289,
859,
19,
51,
18,
22402,
45,
1600,
859,
13,
1,
10543,
1,
5924,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Binding an XML file to a listbox
===
I have an XML file which is created by a c++ dll. I want this XML file to be displayed in a C# listbox.
How do I bind this file to a listbox so that it get updated everytime the XML file changes?
thanks | 0 | [
2,
8728,
40,
23504,
3893,
20,
21,
968,
5309,
800,
3726,
3726,
31,
57,
40,
23504,
3893,
56,
25,
679,
34,
21,
272,
20512,
13,
43,
211,
9,
31,
259,
48,
23504,
3893,
20,
44,
6115,
19,
21,
272,
5910,
968,
5309,
9,
184,
107,
31,
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... |
UITableView Cells Empty
===
Im having a real issue with my UITableView, let me walk you through it.
I have a UITableViewController in my storyboard which has four different prototype cells each with their own identifiers.
Then I have this in my class for the controller:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"name";
if (indexPath.section == 0) CellIdentifier = @"name";
else if (indexPath.section == 1) CellIdentifier = @"name";
else if (indexPath.section == 2 && indexPath.row == 0) CellIdentifier = @"segment";
else if (indexPath.section == 2 && (indexPath.row == 1 || indexPath.row == 2 || indexPath.row == 3)) CellIdentifier = @"switch";
else if (indexPath.section == 3) CellIdentifier = @"segment";
else if (indexPath.section == 4) CellIdentifier = @"segment2";
else if (indexPath.section == 5) CellIdentifier = @"name";
else if (indexPath.section == 6) CellIdentifier = @"name";
else if (indexPath.section == 7) CellIdentifier = @"name";
GuestDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[GuestDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
//Configure my cells here, like so:
if (indexPath.section == 0)
{
cell.title.text = @"title";
}
else if (indexPath.section == 1)
{
}
//etc
return cell;
}
I think this is where my problem lies, as I have had success with some different code (which I will add if you might need to see it, let me know.
Now when the view is shown, all the cells are blank. `cell = [[GuestDetailCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];` This seems to be called over and over, opposed to my cells as configured showing.
Any ideas, or need more info?
Thanks. | 0 | [
2,
13,
11193,
579,
4725,
2934,
2424,
800,
3726,
3726,
797,
452,
21,
683,
1513,
29,
51,
13,
11193,
579,
4725,
15,
408,
55,
1466,
42,
120,
32,
9,
31,
57,
21,
13,
11193,
579,
4725,
12898,
1252,
19,
51,
609,
2806,
56,
63,
222,
421... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
WPF Routed Event, subscribing to custom events
===
I am trying to get routed events working with child controls that will manually fire these events and they will bubble up and be handled at the main grid level. I basically want to do something like this:
<Grid Name="Root" WpfApplication5:SpecialEvent.Tap="Catcher_Tap">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<WpfApplication5:UserControl2 Grid.Row="0" x:Name="Catcher" />
<WpfApplication5:UserControl1 Grid.Row="1" />
<Frame Grid.Row="2" Source="Page1.xaml" />
</Grid>
But when I run my example, I get a null reference in the presentation framework, the application never initializes, it fails when it's trying to load/initialize the XAML (InitializeComponent()). Here's the small file that contains the event:
public class SpecialEvent
{
public static readonly RoutedEvent TapEvent = EventManager.RegisterRoutedEvent(
"Tap", RoutingStrategy.Direct, typeof(RoutedEventHandler), typeof(UserControl1));
// Provide CLR accessors for the event
public event RoutedEventHandler Tap;
}
I am basically wanting to copy the behavior of how ButtonBase.Click allows parents to subscribe to any button click() methods for their children. But, this doesn't seem to be working for anything but ButtonBase.Click(). That is, when I switch out my custom ` WpfApplication5:SpecialEvent.Tap="Catcher_Tap"` to `ButtonBase.Click="Catcher_Tap"` it works. Any ideas why? What is ButtonBase doing that I'm not doing? | 0 | [
2,
619,
7721,
858,
43,
807,
15,
972,
28723,
20,
5816,
963,
800,
3726,
3726,
31,
589,
749,
20,
164,
858,
43,
963,
638,
29,
850,
8671,
30,
129,
23671,
535,
158,
963,
17,
59,
129,
10937,
71,
17,
44,
9006,
35,
14,
407,
7354,
662,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 TokenInput with acts_as_taggable_on not creating token in search box
===
I am using Rails acts_as_taggable_on plugin with Jquery TokenInput but when a tag is entered and space bar pressed (changed delimiter to spaces) the token cloud is not created. Also, my Json output file looks a bit strange, it's not outputting the correct number ID.
**JSON Output**
{"id":"Funny","name":"Funny"},{"id":"Basketball","name":"Basketball"}
**Users Controller**
def tags
@tags = ActsAsTaggableOn::Tag.where("tags.name LIKE ?", "%#{params[:q]}%")
respond_to do |format|
format.json { render :json => @tags.collect{|t| {:id => t.name, :name => t.name }}}
end
end
**User Model**
class User < ActiveRecord::Base
attr_accessible :name, :tag_list
acts_as_taggable_on :tags
end
**Javascript File**
$(function() {
$("#user_tags").tokenInput("/users/tags.json", {
prePopulate: $("#user_tags").data("pre"),
preventDuplicates: true,
noResultsText: "No results, needs to be created.",
animateDropdown: false
});
});
**View**
<h2>Enter new user:</h2>
<%= form_for @user do |f| %>
Name: <%= f.text_field :name %><br />
Tags: <%= f.text_field :tag_list, :id => "user_tags",
"data-pre" => @user.tags.map(&:attributes).to_json %>
<%= f.submit %><br />
<% end %>
| 0 | [
2,
487,
8190,
93,
20,
2853,
108,
4881,
29,
3167,
1,
472,
1,
536,
4572,
579,
1,
218,
52,
2936,
20,
2853,
19,
2122,
1649,
800,
3726,
3726,
31,
589,
568,
2240,
18,
3167,
1,
472,
1,
536,
4572,
579,
1,
218,
10922,
108,
29,
487,
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... |
pass variable with Facebook PHP SDK
===
well i've been reading a lot but nothing works, i have these code right now
$signed_request = $facebook->getSignedRequest();<br/>
$uid = $signed_request['app_data'];
and im using Facebook PHP SDK but i dont seem to be able to make it to work my link is
https://www.facebook.com/xxxxxx?sk=app_1234567&app_data=uid%3Daaaaaaa
im trying to pass the variable uid=aaaaaaaaa
but is not working. can anyone help???
i need these because i have a like button with different id for each user picture but i need to pass these variable so when they come back to my page from the like link i need to know what is the user id.
| 0 | [
2,
1477,
7612,
29,
9090,
13,
26120,
13,
18,
43,
197,
800,
3726,
3726,
134,
31,
22,
195,
74,
1876,
21,
865,
47,
626,
693,
15,
31,
57,
158,
1797,
193,
130,
5579,
13472,
1,
99,
10351,
800,
5579,
6413,
5199,
8,
1,
3060,
13472,
99,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 force user to input a positive integer?
===
Force user to input a positive integer and put user in a loop till they do.
So I want everything including characters not allowed just over > 0 | 0 | [
2,
184,
107,
31,
558,
4155,
20,
6367,
21,
2221,
13820,
60,
800,
3726,
3726,
558,
4155,
20,
6367,
21,
2221,
13820,
17,
442,
4155,
19,
21,
5293,
3924,
59,
107,
9,
86,
31,
259,
796,
215,
1766,
52,
1159,
114,
84,
13,
1,
713,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
white line appearing in Safari under image
===
Under small header above the customization image "Customize this shirt", there is a thin white line that will sometimes appear in Safari. Doing a hard refresh will often solve the problem.
http://www.tshirthell.com/funny-shirts/atheist
We've tried a number of things but have been unable to figure out what's causing this. Any help would be greatly appreciated.
Mika | 0 | [
2,
359,
293,
4870,
19,
25055,
131,
1961,
800,
3726,
3726,
131,
284,
157,
106,
784,
14,
5816,
1829,
1961,
13,
7,
4636,
6015,
2952,
48,
2699,
7,
15,
80,
25,
21,
2951,
359,
293,
30,
129,
1030,
1893,
19,
25055,
9,
845,
21,
552,
24... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 : Ignoring invalid text regex
===
I am getting error in DDMS,
[2012-06-27 17:17:12 - LogCatFilter] Ignoring invalid text regex.
[2012-06-27 17:17:12 - LogCatFilter] Unexpected internal error near index 14
java.util.com\
^
Why I am getting this error, tried google but dint get proper information. What should I do. Please anyone can say or give me some solutions what should I do. | 0 | [
2,
13005,
13,
45,
9321,
16671,
1854,
7953,
1706,
800,
3726,
3726,
31,
589,
1017,
7019,
19,
13,
8096,
79,
18,
15,
636,
3212,
8,
3370,
8,
2567,
369,
45,
1053,
45,
918,
13,
8,
6738,
5782,
11924,
815,
500,
9321,
16671,
1854,
7953,
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... |
Custom post type breaks wordpress itself
===
I'm trying to add a custom post type to Wordpress. I can register the custom post type with the following code so that it is visible on the menu bar on the left.
add_action( 'init', 'add_member');
function add_member() {
$args = array(
'label' => __('Members'),
'singular_label' => __('Member'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarhical' => false,
'rewrite' => true,
'supports' => array('title', 'editor', 'thumbnail')
);
register_post_type( 'member', $args );
}
But the problem is that when I try to add a custom meta box, it breaks the site.
add_action("admin_init", "admin_init");
function admin_init() {
add_meta_box("memberInfo-meta", "Member Options", "meta_options", "member", "side", "low");
}
add_action('save_post', 'save_member');
function meta_options() {
global $post;
$custom = get_post_custom($post->ID);
$member = $custom["member"][0];
}
<label>Member:</label><input name="member" value="<?php echo $member; ?>" />
function save_member() {
global $post;
update_post_meta( $post->ID, "member", $_POST["member"] );
}
What am I doing wrong?
Thanks. | 0 | [
2,
5816,
678,
1001,
7947,
833,
5890,
1145,
800,
3726,
3726,
31,
22,
79,
749,
20,
3547,
21,
5816,
678,
1001,
20,
833,
5890,
9,
31,
92,
2243,
14,
5816,
678,
1001,
29,
14,
249,
1797,
86,
30,
32,
25,
4560,
27,
14,
11379,
748,
27,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Lucene hibernate search NumericRangeQuery<Float> not working on field defined with @NumericField
===
I use hibernate search 4.1.0 with good results except for this problem.
I´m trying to perform a range search in a column defined:
@Field(name = "startTime", store = Store.YES)
@NumericField
public Float startTime;
I have stored an item with startTime = 0.0f;
then I try to perform a range query:
NumericRangeQuery<Float> rangeQuery = NumericRangeQuery.newFloatRange(
"startDate", -100000.0f, +100000.0f, true, true);
FullTextQuery fullTextQuery = fullTextEntityManager
.createFullTextQuery(rangeQuery, Item.class);
results = fullTextQuery.getResultList();
**First**: I have no results.
**Second**: Inspecting the index with lukeall, I see simply stored what seems to be the toString() [judging by other experiments too], which looks no normal...
I feel like I´m missing something, any help would be appreciated.
Thanks | 0 | [
2,
18515,
556,
4148,
2102,
8820,
2122,
15764,
596,
8366,
8190,
93,
1,
14712,
721,
1,
52,
638,
27,
575,
2811,
29,
13,
1,
6336,
14744,
1109,
800,
3726,
3726,
31,
275,
4148,
2102,
8820,
2122,
268,
9,
165,
9,
387,
29,
254,
1736,
161... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
idiomatically merge maps into a map of value sets with clojure
===
I am trying idiomatically merge multiple maps into a single map using clojure.
Input
{:a 1 :b "a"}
{:a 2 :b "b"}
{:a 3 :b "c"}
{:a 4 :b "a"}
Expected
{:a #{1,2,3,4}, :b #{"a" "b" "c"}}
The values for each key are converted into a set of values in the original maps.
| 0 | [
2,
28380,
721,
8438,
12666,
6867,
77,
21,
2942,
16,
1923,
3415,
29,
7383,
2142,
99,
800,
3726,
3726,
31,
589,
749,
28380,
721,
8438,
12666,
1886,
6867,
77,
21,
345,
2942,
568,
7383,
2142,
99,
9,
6367,
13,
1,
45,
58,
137,
13,
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... |
How to place the icons,pics in list in the right side in Jquerymobile
===
I am using jquerymobile, and trying to show a list, the default place for the icons or other pics is left side! how can i change it to right?
<ul data-role="listview" data-theme="a">
<li>
<p><strong>text</strong></p>
<p class="ui-li-aside"><img src="images/album-bb.jpg"/></p>
</li> | 0 | [
2,
184,
20,
209,
14,
9801,
18,
15,
7763,
18,
19,
968,
19,
14,
193,
270,
19,
487,
8190,
93,
12571,
800,
3726,
3726,
31,
589,
568,
487,
8190,
93,
12571,
15,
17,
749,
20,
298,
21,
968,
15,
14,
12838,
209,
26,
14,
9801,
18,
54,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Basic Authentication : Is it possible to setRemoteUser like getRemoteUser()
===
Hi I am using basic authentication method for protecting some pages in my Webapp. Which have a specified url pattern as follows:
<url-pattern>/Important/*</url-pattern>
<auth-method>BASIC</auth-method>
Now the problem is if the user logs in the normal way using a login form .The data is posted to my servlet which validates the username and password and then proceeds further. Is there a way that i could setRemoteUser in this servlet , because the authentication input appears again once the user tries to access pages in the Important folder. Is there a way that I could inform the authentication mechanism that the user has already signed in ? | 0 | [
2,
2125,
27963,
13,
45,
25,
32,
938,
20,
309,
99,
20209,
16704,
101,
164,
99,
20209,
16704,
5,
6,
800,
3726,
3726,
4148,
31,
589,
568,
2125,
27963,
2109,
26,
8718,
109,
4434,
19,
51,
2741,
7753,
9,
56,
57,
21,
9931,
287,
6362,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
pyqt4 : when mouse over, draw a boundary in QListView
===
I tried that with QStyledItemDelegate, and it looks like working well.
But, when I select an item, sometimes boundary remains even after leaving the mouse.
This is the my code for delegate.
class PixmapItemDelegate(QtGui.QStyledItemDelegate):
def paint(self, painter, option, index):
painter.save()
if (option.state & QtGui.QStyle.State_MouseOver):
pen = QtGui.QPen(QtCore.Qt.yellow)
else:
pen = QtGui.QPen(QtCore.Qt.transparent)
pen.setWidth(2)
painter.setPen(pen)
painter.setBrush(QtGui.QBrush(QtCore.Qt.transparent))
painter.drawRect(option.rect)
painter.restore()
super(PixmapItemDelegate, self).paint(painter, option, index)
Is there anything wrong or something to add? | 0 | [
2,
7103,
1251,
38,
300,
13,
45,
76,
7567,
84,
15,
2003,
21,
5067,
19,
2593,
5739,
4725,
800,
3726,
3726,
31,
794,
30,
29,
2593,
4381,
43,
2119,
79,
24249,
3322,
15,
17,
32,
1879,
101,
638,
134,
9,
47,
15,
76,
31,
5407,
40,
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... |
Drawing a clickable hexagon using GWT
===
What would be the best technique of drawing hexagon in GWT? I'd like it to be clickable, so would be great to have some click listener on this shape. Some canvas based solution I suppose?
Is there a built-in mechanism or I rather should use some 3rd party library? | 0 | [
2,
3533,
21,
10840,
579,
24,
396,
13247,
568,
14094,
38,
800,
3726,
3726,
98,
83,
44,
14,
246,
4873,
16,
3533,
24,
396,
13247,
19,
14094,
38,
60,
31,
22,
43,
101,
32,
20,
44,
10840,
579,
15,
86,
83,
44,
374,
20,
57,
109,
108... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Unable to add load 'deploy/assets' to my capistrano deployment
===
When i try de deploy with the command cap deploy it fails :
> ./config/deploy.rb:31:in `load': no such file to load -- deploy/assets
> (LoadError)
This is due to the line
`load 'deploy/assets'`
in my capistrano deployment.rb file.
According to bundle show I'm using :
* bundler (1.1.4)
* capistrano (2.12.0)
* rails (3.1.3)
why is it not working? | 0 | [
2,
2343,
20,
3547,
6305,
13,
22,
17309,
10892,
118,
9790,
38,
18,
22,
20,
51,
2605,
702,
17555,
10475,
800,
3726,
3726,
76,
31,
1131,
121,
17617,
29,
14,
1202,
2605,
17617,
32,
13614,
13,
45,
13,
1,
13,
9,
118,
14093,
2816,
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... |
How to encrypt the existing column in mysql table?
===
I have table with password field which is a plain text. Now, I want to encrypt the field. how to do ? | 0 | [
2,
184,
20,
1957,
11435,
14,
3149,
4698,
19,
51,
18,
22402,
859,
60,
800,
3726,
3726,
31,
57,
859,
29,
20884,
575,
56,
25,
21,
3748,
1854,
9,
130,
15,
31,
259,
20,
1957,
11435,
14,
575,
9,
184,
20,
107,
13,
60,
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,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
sending emails based on date
===
How can i make conditions on sending emails to users based on date which they insert??
using if statement, without using gems.
users insert name,email and date. then based on date they inserts, system checks the date if today = date they insert + 7days then send email?? where should i type this?? is it in usermailer, or "Dop" controller???
user mailer:
class UserMailer < ActionMailer::Base
default from: "bla bla bla"
def welcome_email(dop)
@dop = dop
@url = "blah blah"
mail(:to => dop.mail, :subject => "Welcome to My Awesome Site")
end
end
-----------------------------------------------------------------------------------------
"Dop" refers to date of pregnancy | 0 | [
2,
4907,
8517,
18,
432,
27,
1231,
800,
3726,
3726,
184,
92,
31,
233,
2039,
27,
4907,
8517,
18,
20,
3878,
432,
27,
1231,
56,
59,
14692,
60,
60,
568,
100,
3331,
15,
366,
568,
8551,
18,
9,
3878,
14692,
204,
15,
62,
8079,
17,
1231... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Does Freepascal really use *far* less memory than gcc
===
The language shootout benchmarks at alioth.debian.org indicate that FPC programs use about **1/50th** of the memory that comparable programs using g++ use. Are these benchmarks biased or is it really true that FPC is _this_ much better than g++? I've always considered these benchmarks as a collection of decent microbenchmarks, so I'm surprised at these results, since a factor of 50 times is pretty significant IMHO.
References:
http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=fpascal&lang2=gpp
http://shootout.alioth.debian.org/u64q/benchmark.php?test=all&lang=fpascal&lang2=gpp | 0 | [
2,
630,
551,
11722,
3430,
510,
275,
1637,
3700,
2483,
787,
1912,
119,
489,
3384,
800,
3726,
3726,
14,
816,
20931,
25324,
18,
35,
21,
11188,
96,
9,
546,
10035,
9,
5583,
4342,
30,
398,
5779,
1726,
275,
88,
13,
1409,
8197,
2290,
96,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 check if a file is not empty in Batch
===
There are several ways google throws at me for checking if a file is empty but I need to do the opposite.
If (file is NOT empty)
do things
How would I do this in batch? | 0 | [
2,
184,
20,
2631,
100,
21,
3893,
25,
52,
2424,
19,
13064,
800,
3726,
3726,
80,
50,
238,
2847,
8144,
13566,
35,
55,
26,
9886,
100,
21,
3893,
25,
2424,
47,
31,
376,
20,
107,
14,
2794,
9,
100,
13,
5,
16877,
25,
52,
2424,
6,
107... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.