unified_texts stringlengths 32 30.1k | OpenStatus_id int64 0 4 | input_ids list | token_type_ids list | attention_mask list |
|---|---|---|---|---|
Switch on an enum
===
I have the following piece of code:
switch (self.status) {
case refused:
message=NSLocalizedString(@"booking refused", nil);
break;
case accepted:
message=NSLocalizedString(@"booking accepted", nil);
break;
case taxiAborted:
message=NSLocalizedString(@"booking aborted", nil);
break;
case near:
message=NSLocalizedString(@"booking aborted", nil);
break;
case completed:
message=NSLocalizedString(@"booking completed", nil);
break;
default:
break;
}
that never enters the interior of the switch: neither hitting the default case nor the correct value. In my case self.status had value 'active' that is part of the following enumeration:
typedef enum {
requested = 0,
refused = 1,
accepted =2,
taxiAborted=3,
near = 4,
running= 5,
completed = 6,
userAborted=7
} statuses;
What did I do wrong? | 0 | [
2,
5521,
27,
40,
1957,
723,
800,
3726,
3726,
31,
57,
14,
249,
1855,
16,
1797,
45,
5521,
13,
5,
8411,
9,
10631,
267,
6,
13,
1,
610,
2453,
45,
2802,
3726,
2172,
15580,
1333,
11130,
5,
1,
7,
5199,
68,
2453,
7,
15,
1781,
255,
6,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to set background to a random color at button press in Android?
===
I'm writing an app which changes the background color of the activity each time you press the button. And this is what I have till now. But it is not working! What am I doing wrong?
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button b = (Button) findViewById(R.id.button1);
final View a = findViewById(R.id.m);
final Random color = new Random();
final Paint p = new Paint();
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
p.setARGB(256,color.nextInt(256),color.nextInt(256),color.nextInt(256));
a.setBackgroundColor((p.getColor()));
}
});
}
It's working when I pass a single color, for example a.setBackgroundColor(Color.GREEN);
| 0 | [
2,
184,
20,
309,
2395,
20,
21,
5477,
1665,
35,
5167,
901,
19,
13005,
60,
800,
3726,
3726,
31,
22,
79,
1174,
40,
4865,
56,
1693,
14,
2395,
1665,
16,
14,
2358,
206,
85,
42,
901,
14,
5167,
9,
17,
48,
25,
98,
31,
57,
3924,
130,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
File upload with post parameter in curl
===
How to make a request for uploading a file to facebook using graph api in curl
I am making this request but getting Error:
curl https://graph.facebook.com/<id>/photos -F "source=@me.jpg" -d "message=Me" -v
ERR:
Only One Http Request can be Selected
| 0 | [
2,
3893,
71,
8294,
29,
678,
18906,
19,
14320,
800,
3726,
3726,
184,
20,
233,
21,
3772,
26,
71,
16866,
21,
3893,
20,
9090,
568,
7210,
21,
2159,
19,
14320,
31,
589,
544,
48,
3772,
47,
1017,
7019,
45,
14320,
7775,
18,
6903,
9614,
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... |
Socket Programming PHP script keeps loading
===
I want to implement a chat application in which php will act as a server and android will act as a client.
The problem is that php script keeps on loading and doesn't stop.When I introduce a loop to listen and output messages continously sent from my android emulator.But when I remove the loop it keeps on loading and as soon as I send message from my android emulator it outputs it once and the script stops.Now I don't know how to accomplish this(i.e whenever I send messages from android it echo's them on the page and keeps on doing it until i send an exit message which exits the script).
Here's my php script:
set_time_limit (0);
$address = '10.116.27.107';
$port = 1234;
$sock = socket_create(AF_INET, SOCK_STREAM, 0);
socket_bind($sock, $address, $port) or die('Could not bind to address');
socket_listen($sock);
while(1)
{
$client = socket_accept($sock);
$input = socket_read($client, 1024);
$output = preg_replace("[ \t\n\r]","",$input).chr(0);
socket_write($client, $output);
if($input=="exit")
break;
echo $input;
socket_close($client);
}
socket_close($sock); | 0 | [
2,
18482,
3143,
13,
26120,
3884,
8968,
12797,
800,
3726,
3726,
31,
259,
20,
8713,
21,
6615,
3010,
19,
56,
13,
26120,
129,
601,
28,
21,
8128,
17,
13005,
129,
601,
28,
21,
6819,
9,
14,
1448,
25,
30,
13,
26120,
3884,
8968,
27,
1279... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I disable portrait mode in Windows 8?
===
I have developed a XAML / C# Windows 8 app which does not support portrait mode. I've opened the Package.appxmanifest in Visual Studio and disabled the the portrait and portrait-flipped mode under "supported rotations". This Created the following rotations preferences:
<InitialRotationPreference>
<Rotation Preference="landscape" />
<Rotation Preference="landscapeFlipped" />
</InitialRotationPreference>
However, when I start my app in the simulator and rotate the simulator, the app still gets rotated in to portrait mode. how can I prevent this from happening?
Thanks,
Adrian
| 0 | [
2,
184,
92,
31,
1460,
579,
5548,
3740,
19,
1936,
469,
60,
800,
3726,
3726,
31,
57,
885,
21,
13,
6791,
8184,
13,
118,
272,
5910,
1936,
469,
4865,
56,
630,
52,
555,
5548,
3740,
9,
31,
22,
195,
520,
14,
6030,
9,
7753,
396,
8002,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 add components to Jdialog
===
d1=new JDialog();
d1.setSize(200, 100);
t1=new JTextField();
t1.setBounds(10,10,40,20);
d1.add(t1);
i want to add components in JDaiog such as TextField,Button... | 0 | [
2,
184,
20,
3547,
5090,
20,
487,
4286,
5567,
800,
3726,
3726,
13,
43,
165,
3726,
2681,
487,
4286,
5567,
5,
6,
73,
13,
43,
165,
9,
3554,
10454,
5,
4621,
15,
808,
6,
73,
13,
38,
165,
3726,
2681,
487,
11969,
1109,
5,
6,
73,
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... |
Error in passing Query string parameter in classic asp
===
I am working in classic asp and not much familliar with syntax
I have this javascript on my parent page
funtion redirect(ID)
{
document.frmMain.action = "manual.asp?ID=" + ID;
alert('manual.asp?ID='+ID)
document.frmMain.submit();
}
But the same ID when i am capturing on new asp page its coming empty.
<%
SQLStr = "SELECT * FROM tblUsers WHERE ID='" & Request.QueryString("ID") & "'"
set rst = DataConn.Execute(SQLStr)
Denied = 1
while not rst.eof
Denied = 0
rst.movenext
wend
rst.close
if Denied = 1 then
%>
Can somebody help me with this. | 0 | [
2,
7019,
19,
2848,
25597,
3724,
18906,
19,
2732,
28,
306,
800,
3726,
3726,
31,
589,
638,
19,
2732,
28,
306,
17,
52,
212,
1399,
8702,
49,
512,
29,
22649,
31,
57,
48,
8247,
8741,
27,
51,
4766,
2478,
2414,
3309,
302,
14706,
5,
1340... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
ffmpeg splitting RGB and Alpha channels using filter
===
I'm trying to use ffmpeg to split an input file into two separate files:
1. An MP4 with only R,G and B channels
2. An MP4 with the "extracted" A channel (a so-called Key clip, see http://ffmpeg-users.933282.n4.nabble.com/quot-Extracting-quot-Alpha-Channel-td3700227.html)
I've managed to do both, but now I want to combine them into one single command. Here's what I do:
ffmpeg -r $FPS -y -i input.flv -vcodec libx264 -vpre ipod640 -acodec libfaac -s 256x256 -r $FPS -filter_complex INSERT_FILTER_HERE rgb.mp4 alpha.mp4
where INSERT_FILTER_HERE is:
format=rgba, split [rgb_in][alpha_in];
[rgb_in] fifo, lutrgb=a=minval [rgb_out];
[alpha_in] format=rgba, split [T1], fifo, lutrgb=r=maxval:g=maxval:b=maxval, [T2] overlay [out];
[T1] fifo, lutrgb=r=minval:g=minval:b=minval [T2]
In short, I split the file into two streams, for the first stream, I "remove" the alpha channel, for the second stream, I extract a grayscale representation of the alpha channel. When I put this through graph2dot, it works fine, with a nullsink as output.
However, when I run it in ffmpeg with -filter_complex, I get:
ffmpeg version N-41994-g782763e Copyright (c) 2000-2012 the FFmpeg developers
built on Jun 28 2012 17:45:15 with gcc 4.6.3
configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-filters --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libtheora --enable-libvpx --enable-postproc --enable-avfilter
libavutil 51. 63.100 / 51. 63.100
libavcodec 54. 29.101 / 54. 29.101
libavformat 54. 11.100 / 54. 11.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 3. 0.100 / 3. 0.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, flv, from 'input.flv':
Metadata:
audiodelay : 0
canSeekToEnd : true
Duration: 00:01:10.56, start: 0.000000, bitrate: 1964 kb/s
Stream #0:0: Video: vp6a, yuva420p, 800x950, 1536 kb/s, 25 tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
[graph 0 input from stream 0:0 @ 0x2e4c6e0] w:800 h:950 pixfmt:yuva420p tb:1/30 fr:30/1 sar:0/1 sws_param:flags=2
Output pad "default" for the filter "Parsed_lutrgb_3" of type "lutrgb" not connected to any destination
Any ideas on how I make ffmpeg recognize that it has to write [rgb_out] to rgb.mp4 and [out] to alpha.mp3?
Thanks in advance! | 0 | [
2,
13,
2460,
79,
20427,
17282,
761,
11400,
17,
5705,
6328,
568,
11945,
800,
3726,
3726,
31,
22,
79,
749,
20,
275,
13,
2460,
79,
20427,
20,
2132,
40,
6367,
3893,
77,
81,
1725,
6488,
45,
137,
9,
40,
4628,
300,
29,
104,
761,
15,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
RSA Public exponent is always 65537. How can I alter this value?
===
I want to create unit tests for software that may encounter different exponent sizes. How can I use Bouncy Castle, or any other C# library to generate a RSA key pair that doesn't have a key size of 65537.
If the answer is that I can directly modify this, as long as I update the private key as well, what specific changes (or re-computation) should I make for the public and private key?
RsaKeyPairGenerator generator= new RsaKeyPairGenerator();
var param= new KeyGenerationParameters(new SecureRandom(), 1024);
generatorExponentTest.Init(paramExponentTest);
AsymmetricCipherKeyPair keyPair= generatorExponentTest.GenerateKeyPair();
RsaKeyParameters rsaKeyParameters= (RsaKeyParameters)keyPairExponentTest;
RSAParameters rsaParameters= new RSAParameters();
rsaParametersExponentTest.Modulus = rsaKeyParametersExponentTest.Modulus.ToByteArray();
rsaParametersExponentTest.Exponent = rsaKeyParametersExponentTest.Exponent.ToByteArray();
RSACryptoServiceProvider rsa= new RSACryptoServiceProvider();
rsaExponentTest.ImportParameters(rsaParameters);
| 0 | [
2,
13,
22038,
317,
25220,
25,
550,
2074,
264,
3555,
9,
184,
92,
31,
7835,
48,
1923,
60,
800,
3726,
3726,
31,
259,
20,
1600,
1237,
4894,
26,
2306,
30,
123,
7007,
421,
25220,
13403,
9,
184,
92,
31,
275,
5963,
14386,
1339,
15,
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... |
Writing messages of different types through sockets in C
===
I want to send a message to my Binder class via TCP socket connection in C. I have to pass in a request type (char*), ip address (int), argTypes(int array) etc. through this connection using the write() method. What's the best method to send all of the information in one single message? | 0 | [
2,
1174,
7561,
16,
421,
2551,
120,
18482,
18,
19,
272,
800,
3726,
3726,
31,
259,
20,
2660,
21,
2802,
20,
51,
13,
24200,
718,
1197,
13,
38,
7439,
18482,
2760,
19,
272,
9,
31,
57,
20,
1477,
19,
21,
3772,
1001,
13,
5,
5433,
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... |
Two seemingly identical questions returning different results when using count (pagination)
===
I am running two queries to my database for pagination reasons. As such, each query is nearly identical. My COUNT(*) query is not returning the number of results that the non-count query is. I'm baffled as to why this is the case. The queries are below.
SELECT p.host_id, p.rating_support, p.rating_tech, MAX(p.rating_overall) AS rating_overall, p.publish_rating, h.name, prices.price, prices.term_duration
FROM plans p
INNER JOIN hosts AS h ON h.id = p.host_id
INNER JOIN (SELECT plan_id, price, term_duration FROM prices WHERE price > 0 AND price < 50 AND term_duration = 1) prices ON prices.plan_id = p.id
WHERE p.published = 1 AND h.published = 1
GROUP BY p.host_id
ORDER BY rating_overall desc LIMIT 0, 12
SELECT COUNT(*) AS count
FROM plans p
INNER JOIN hosts AS h ON h.id = p.host_id
INNER JOIN (SELECT plan_id, price, term_duration FROM prices WHERE price > 0 AND price < 50 AND term_duration = 1) prices ON prices.plan_id = p.id
WHERE p.published = 1 AND h.published = 1
GROUP BY p.host_id
I'm not an expert at MySQL. Besides the count not providing the correct number of results, the non-count query works perfectly.
Any light on this problem would be great. | 0 | [
2,
81,
9688,
6323,
2346,
2485,
421,
1736,
76,
568,
2468,
13,
5,
1060,
5831,
857,
6,
800,
3726,
3726,
31,
589,
946,
81,
9386,
2829,
20,
51,
6018,
26,
19006,
108,
857,
2932,
9,
28,
145,
15,
206,
25597,
25,
1212,
6323,
9,
51,
246... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Point out flaws in my php security for cookies and sessions
===
Regarding PHP security with cookies and sessions, this is what i have done so far for prevention of attacks. What have i done incorrectly/unsafely?
login.php
if ($username==$dbusername&&$hashed_password==$dbpassword){
setcookie('username[0]',$username,time()+(60*60*24*365));
setcookie('username[1]',$userid,time()+(60*60*24*365));
setcookie('password',$hashed_password,time()+(60*60*24*365));
if($admin=='1') {
setcookie('username[3]',$admin,time()+(60*60*24*365));
}
$_SESSION['logged-in']=1;
logout.php
$time = time()-(60*60*24*365);
setcookie('username[0]', '',$time);
setcookie('username[1]', '',$time);
setcookie('username[2]', '',$time);
setcookie('username[3]', '',$time);
setcookie('password', '',$time);
unset($_COOKIE['username']);
unset($_SESSION['logged-in']);
I call session_regenerate_id() on everypage, is that correct to stop session fixation/hijacking?
<?php session_start(); session_regenerate_id();
Here is my PHP.ini what other ways do i provide security for sessions & cookies
session.use_trans_sid = 0
session.user_only_cookies = 1
Any examples/impovements welcomed, as i learn better with examples. | 0 | [
2,
454,
70,
398,
2371,
18,
19,
51,
13,
26120,
1221,
26,
19396,
17,
5763,
800,
3726,
3726,
3467,
13,
26120,
1221,
29,
19396,
17,
5763,
15,
48,
25,
98,
31,
57,
677,
86,
463,
26,
10173,
16,
3080,
9,
98,
57,
31,
677,
22870,
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... |
JTable Nimbus Look and Feel - how to make it clear which cell has focus
===
When editing data in a JTable (Nimbus L & F), as the user tabs from cell to cell, it is not obvious which cell has focus. How can I make it clearer which cell has focus? I know there are a number of properties that can be set to modify Nimbus - does anyone know which property I want?
The screen shot below has only one property set to something other than the default:
UIManager.put("Table.showGrid", true);
![JTable screen shot][1]
[1]: http://i.stack.imgur.com/AT0fj.png | 0 | [
2,
487,
5924,
11547,
3822,
361,
17,
583,
13,
8,
184,
20,
233,
32,
1207,
56,
1667,
63,
1776,
800,
3726,
3726,
76,
9510,
1054,
19,
21,
487,
5924,
13,
5,
889,
79,
3822,
644,
279,
398,
6,
15,
28,
14,
4155,
6523,
18,
37,
1667,
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 insert interactive map?
===
I am trying to use GoogleMap in my website :
function InsertMap()
{
var map;
var op = {
zoom: 10,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('id'), op);
}
I am calling this function on button click event. But my problem is that it insert a static map ( a single image ) instead of interactive map. I tried a `IsStaticMap : false` also but its not working and when i did that it shows nothing neither static nor interactive. Help me out ! | 0 | [
2,
184,
20,
14692,
9194,
2942,
60,
800,
3726,
3726,
31,
589,
749,
20,
275,
8144,
15022,
19,
51,
2271,
13,
45,
1990,
14692,
15022,
5,
6,
13,
1,
4033,
2942,
73,
4033,
3088,
800,
13,
1,
19469,
45,
332,
15,
459,
45,
78,
8144,
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... |
Using sscanf to pass 'template sentences'?
===
would it be appropriate to use PHP's sscanf to read user submitted sentences and try to get data from them? For example:
User inputs:
`"James is child of Bill"`and I want to make `$child="james"` and `$parent="bill"`
or: `"Mary is the mother of kate"`and I want to make `$child="kate"` and `$parent="mary"`
There could be quite a few other possible sentence formats that I would have to extract data from (no more than 100-ish).
So should I use:
$templates = array("%s is a child of %s","%s is the mother of %s");
$i=0;
$max = count($templates);
while( ($test == -1) && (i < $max) ) {
$test = sscanf($userInput, $templates[i]);
$i++;
}
if(i < $max) {
sscanf($userInput, $templates[i],$child,&parent);//hmm, what if $child,&parent should be the other way around?
} else {
echo "template not found for sentence";
}
? So I'm in a bit of a rut as you can see, can anyone suggest a better way of doing it, or a way to get this solution working?
Really appreciate it! | 0 | [
2,
568,
13,
18,
18,
1245,
410,
20,
1477,
13,
22,
9577,
6554,
13453,
22,
60,
800,
3726,
3726,
83,
32,
44,
4593,
20,
275,
13,
26120,
22,
18,
13,
18,
18,
1245,
410,
20,
1302,
4155,
7368,
13453,
17,
1131,
20,
164,
1054,
37,
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... |
Fade on scroll effect
===
I've added a script I found on here. It works a treat. However, I've come stuck when trying to apply a fade effect to it. At the minute it just cuts out.
script type="text/javascript">
$(document).ready(function() {
$(window).scroll(function () {
var height = $('body').height();
var scrollTop = $('body').scrollTop();
var opacity = 1;
if(scrollTop > 400) {
opacity = 0;
}
$('.social').css('opacity', opacity);
});
});
</script> | 0 | [
2,
11381,
27,
12159,
1590,
800,
3726,
3726,
31,
22,
195,
905,
21,
3884,
31,
216,
27,
235,
9,
32,
693,
21,
5752,
9,
207,
15,
31,
22,
195,
340,
4549,
76,
749,
20,
5645,
21,
11381,
1590,
20,
32,
9,
35,
14,
2038,
32,
114,
7960,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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: download file from server and show the download progress in the notification bar using AsyncTask
===
I am using this [example][1] to downloada file from a server using `AsycTask` and to show the downlaod progress in a notification bar. I just modified the `doInBackground` method in order to downoad my file:
@Override
protected Void doInBackground(String... Urls) {
//This is where we would do the actual download stuff
//for now I'm just going to loop for 10 seconds
// publishing progress every second
try {
URL url = new URL(Urls[0]);
URLConnection connection = url.openConnection();
connection.connect();
// this will be useful so that you can show a typical 0-100%
// progress bar
int fileLength = connection.getContentLength();
// download the file
InputStream input = new BufferedInputStream(url.openStream());
OutputStream output = new FileOutputStream( _context.getFilesDir() + "/file_name.apk");
byte data[] = new byte[1024];
long total = 0;
int count;
while ((count = input.read(data)) != -1) {
total += count ;
// publishing the progress....
publishProgress((int) (total * 100 / fileLength));
output.write(data, 0, count);
}
output.flush();
output.close();
input.close();
}
catch (Exception e){
e.printStackTrace();
}
return null;
}
Everything is going ok except that I cannot pull down the notification bar. Why?
[1]: https://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task-and-report-progress-in-the-status-bar-using-asynctask-on-android/
| 0 | [
2,
13005,
45,
7121,
3893,
37,
8128,
17,
298,
14,
7121,
3455,
19,
14,
52,
4634,
748,
568,
21,
9507,
20255,
3656,
800,
3726,
3726,
31,
589,
568,
48,
636,
29041,
500,
2558,
165,
500,
20,
7121,
58,
3893,
37,
21,
8128,
568,
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... |
Javascript Image Animation does not work in Firefox or Internet Explorer
===
I am using the following script to generate an animation of images.
It works in Chrome but not Firefox or Internet Explorer ...
Javascript
var lista = new Array('image1.gif','image1.gif','image1.gif','image1.gif');
var tiempo = 500;
var tempor = null;
var pos=0;
var i = 0;
function boucle_images(){
var nombre_total_images = 6;
document.images.centro.src = lista[i]
pos=i;
i++;
i%=nombre_total_images;
tempor=setTimeout("boucle_images()",tiempo);
}
function avanza(){
if (pos==(lista.length-1))
pos=0;
else
pos++;
document.images.centro.src = lista[pos]
}
function retroceso(){
if (pos==0)
pos=(lista.length-1);
else
pos--;
document.images.centro.src = lista[pos]
}
function automat(){
tempor = setTimeout("boucle_images()", tiempo)
}
function parar(){
clearTimeout(tempor);
}
HTML
<table width="52%" border="0" align="center">
<tr>
<td height="482" colspan="2" align="right">
<img id="centro" src="imagenes/cargando2.gif" alt="" width="640" height="480" /></td>
</tr>
<tr>
<td align="center"><div class="div_ani_sat">
<a href="javascript:retroceso()"><img src="imagenes/atras.png" width="48" height="48" alt="" /></a>
<a href="javascript:avanza()"><img src="imagenes/adelante.png" width="48" height="48" alt="" /></a>
<a href="javascript:boucle_images()"><img src="imagenes/play.png" width="48" height="48" alt="" /></a>
<a href="javascript:parar()"><img src="imagenes/pause.png" width="48" height="48" alt="" /></a></div>
</td>
</tr>
</table>
Not that I can not function in other browsers ...
Can you help?
thanks | 0 | [
2,
8247,
8741,
1961,
6236,
630,
52,
170,
19,
535,
18219,
54,
2620,
8520,
800,
3726,
3726,
31,
589,
568,
14,
249,
3884,
20,
7920,
40,
6236,
16,
3502,
9,
32,
693,
19,
13,
12985,
47,
52,
535,
18219,
54,
2620,
8520,
13,
9,
9,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to Register and UnRegister events for Interrupt
===
Im need of the Mechanism for Registering and unregistering event for an interrupt in C.So that,when there is an interrupt, I can use an application to trigger for specific acitivity. | 0 | [
2,
184,
20,
2243,
17,
367,
12463,
9959,
963,
26,
15811,
800,
3726,
3726,
797,
376,
16,
14,
6534,
26,
2243,
68,
17,
367,
12463,
9959,
68,
807,
26,
40,
15811,
19,
272,
9,
656,
30,
15,
3185,
80,
25,
40,
15811,
15,
31,
92,
275,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0... |
JQuery Mobile small checkbox
===
Is it possible to create a small checkbox / toggle like button using JQuery Mobile?
Placing them in a field set and set class=custom sort of does what I want, but I can't find a way to stretch the set so it fills 100% of the client width.
placing individual checkboxes in a grid with data-iconpos=center also sort of does it, but checkboxes don't quite support this mode.
Ideas?
Need 7 checkboxes horizontally. no text, just check or toggle. | 0 | [
2,
487,
8190,
93,
3241,
284,
2631,
5309,
800,
3726,
3726,
25,
32,
938,
20,
1600,
21,
284,
2631,
5309,
13,
118,
20,
263,
4875,
101,
5167,
568,
487,
8190,
93,
3241,
60,
5861,
105,
19,
21,
575,
309,
17,
309,
718,
3726,
4636,
6015,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 select a specific record from a query in Coldfusion?
===
I'm trying to optimize a product search to be used on mobile devices using Coldfusion8/MySQL.
Right now the following happens:
1. user searches for "FOO"
2. Q1: search database for no of results
3. Q2: search again to get actual data for results FROM TO depending on pagination
4. user clicks details for a product
5. redo Q1 to get no of results
6. redo Q2 to get single result
7. use single result to query for product details (sizes, colors, pricings...)
I'm looking for a way to skip redoing Q1 and Q2, because the user picked a result from the resultset, so why should I rebuild the resultset again just to get a single result.
**Question**:
I guess the way would be to pass a variable indicating I'm only needing details of a record in an exinsting query. Say I have results 1-20 and I pass a variable "DETAIL" and an articlenumber "123", how would I select the matching record from an existing resultset = how can I select a specific record from a resultset?uery
| 0 | [
2,
184,
20,
5407,
21,
1903,
571,
37,
21,
25597,
19,
1191,
9818,
60,
800,
3726,
3726,
31,
22,
79,
749,
20,
22864,
21,
2374,
2122,
20,
44,
147,
27,
3241,
4690,
568,
1191,
9818,
12530,
915,
18,
22402,
9,
193,
130,
14,
249,
5531,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 issue with getJSON
===
My issue is a javascript issue, i try to parse a Json file with the $.getJson function of Jquery and when i put them each in a variable, i noted that it takes more objects that i thought, here the code JS:
$.getJSON(
url,
function(data) {
var content = '<h1>Applications</h1>';
content += '<ul>';
for (var pos in data){
var app = data[pos];
content += '<li>'+app.name+'</li>';
}
content += '</ul>';
$('div.apps').html(content);
}
and here the json file:
[
{
"name": "apidocs",
"staging": {
"model": "rack",
"stack": "ruby18"
}
,
{
"name": "apidocs2",
"staging": {
"model": "rack",
"stack": "php53"
}
,
{
"name": "apidocs3",
"staging": {
"model": "rack",
"stack": "java17"
}
]
So then, in my html page i have in globality 6 objects instead of 3. the 3 last are as "undefined" but i would like only those which are in the json file because firefox don't accept the undefined tags.
| 0 | [
2,
487,
8190,
93,
1513,
29,
164,
728,
528,
800,
3726,
3726,
51,
1513,
25,
21,
8247,
8741,
1513,
15,
31,
1131,
20,
2017,
870,
21,
487,
528,
3893,
29,
14,
5579,
9,
3060,
728,
528,
1990,
16,
487,
8190,
93,
17,
76,
31,
442,
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... |
Running a thread from an actor
===
What is the best way to shut down an object which is itself running a Thread from within an Actor. I'm not sure what the best strategy is?
Most topics seem to revolve around the idea of using Threads for everything, but I'm doing Blocking IO and it's not an option to rewrite 3rd party code ;)
Is there anything particularly import to be aware of? | 0 | [
2,
946,
21,
9322,
37,
40,
1574,
800,
3726,
3726,
98,
25,
14,
246,
161,
20,
2218,
125,
40,
3095,
56,
25,
1145,
946,
21,
9322,
37,
363,
40,
1574,
9,
31,
22,
79,
52,
562,
98,
14,
246,
4427,
25,
60,
127,
7569,
2260,
20,
302,
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... |
jQuery and MVC3 Razor producing strange URL on Android browsers
===
I'm working on an MVC3 (with Razor) / jQuery Mobile application and am having trouble navigating back on many areas of my application when using an Android browser (or user agent).
The problem appears to be in the URL that gets created with the @Url.Action method. On iPhones and PC browsers the URL looks like this:
<li class="cl"><a href="/CustomerLookup/Search?ep=Home&t=8cf20faa37155b8"><span>Customer Lookup</span></a></li>
but on Android browsers or in Chrome using the Android user agent the URL looks like this:
<li class="cl"><a href="/(F(Kdqb5nTlCaTP52GkHZ76P50MXAvnUCexKHt0ucPisYJ0iubQ3jwKk6-tiqxAtGVdBmiOgq4mW1-ZF3XUZJc5Y9BHnXVa2fWeIyFE5BxUwmZRhPjbm4L8AWDeymlpAcYJ9ABEPfu5i5_JmvAFinX8y9Jnwj0YeQRnpx_NCVjGqEcuFB-0g5NYcOI_WAsixNP90))/CustomerLookup/Search?ep=Home&t=8cf20fb0b1db618"><span>Customer Lookup</span></a></li>
When I click this link I get an error:
Uncaught Error: Syntax error, unrecognized expression: data-url='/(F(Kdqb5nTlCaTP52GkHZ76P50MXAvnUCexKHt0ucPisYJ0iubQ3jwKk6-tiqxAtGVdBmiOgq4mW1-ZF3XUZJc5Y9BHnXVa2fWeIyFE5BxUwmZRhPjbm4L8AWDeymlpAcYJ9ABEPfu5i5_JmvAFinX8y9Jnwj0YeQRnpx_NCVjGqEcuFB-0g5NYcOI_WAsixNP90])/CustomerLookup/Search?ep=Home&t=8cf20fb0b1db618')
I'm now unable to navigate back to the original page.
Any ideas? | 0 | [
2,
487,
8190,
93,
17,
307,
8990,
240,
14282,
4081,
2578,
287,
6362,
27,
13005,
16495,
18,
800,
3726,
3726,
31,
22,
79,
638,
27,
40,
307,
8990,
240,
13,
5,
1410,
14282,
6,
13,
118,
487,
8190,
93,
3241,
3010,
17,
589,
452,
2572,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 an array sent with an jQuery's AJAX post request + php?
===
I'm trying to pass an array in an ajax request, but apparently it doesn't work...
$.post("process.php", array,
function(data) {
document.getElementById("output").innerHTML = JSON.parse(data);
});
My question is, how to use the data sent in the process file?
The array is built like that: `[key (0/1/2...)] => ["prod_id"]`. The id varies.
I read somewhere using `$_POST["key"];` would work, but it doesn't.
It'd be even better if I could just get the array **as is** in the process file.
`process.php` (really basic - just to check wether it's working or not.):
`<?php
print($_POST["test"]);
?>` | 0 | [
2,
184,
20,
275,
40,
7718,
795,
29,
40,
487,
8190,
93,
22,
18,
20624,
678,
3772,
2754,
13,
26120,
60,
800,
3726,
3726,
31,
22,
79,
749,
20,
1477,
40,
7718,
19,
40,
20624,
3772,
15,
47,
3083,
32,
1437,
22,
38,
170,
9,
9,
9,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
File fragmentation when data changes
===
If i add some letters to middle of file is that operation make file fragmentation?
I just want to store data to file and sometimes update them. So...when i made many changes is it may be bad for perfomance issue? | 0 | [
2,
3893,
28698,
76,
1054,
1693,
800,
3726,
3726,
100,
31,
3547,
109,
2516,
20,
772,
16,
3893,
25,
30,
1453,
233,
3893,
28698,
60,
31,
114,
259,
20,
1718,
1054,
20,
3893,
17,
1030,
11100,
105,
9,
86,
9,
9,
9,
3185,
31,
117,
151... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0... |
Jasmina test with Require/Backbone project
===
My objective is to test the TDD (Test driven development). But after one weekend on it , I really need your help :)
> First Question : "What is the best way to TDD between Browser runner
> or headless runner" ?
Second : I really want test my project without browser before put it in Production mode. For while I didn't succeed :(
For example if I want test my Projects model who look like :
define([
'underscore',
'backbone'
], function(_, Backbone) {
var projectsModel = Backbone.Model.extend({
defaults: {
score: 10
},
initialize: function(){
}
});
return projectsModel;
});
How can I do ?
I have already check jasmine-node / Js test driver / ... but without success :/
Jasmine-node look great but... I need some help because every tuto I found on web only work for simple model without Require dependence...
Thank you :)
| 0 | [
2,
13689,
6525,
1289,
29,
4077,
118,
1958,
8640,
669,
800,
3726,
3726,
51,
7038,
25,
20,
1289,
14,
15596,
43,
13,
5,
10543,
5355,
522,
6,
9,
47,
75,
53,
4010,
27,
32,
13,
15,
31,
510,
376,
154,
448,
13,
45,
6,
13,
1,
64,
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... |
CAML In Operator Equivalent For SharePoint Services 3 (SharePoint 2007)
===
Today I came across the need to write a CAML query that uses WHERE [Field] IN [Values]. I wanted to query a List where the list item's Title was contained by a collection of strings. After receiving several errors running my query, I realized the In operator was new to SharePoint 2010 but I'm still in SharePoint 2007. As a result, the only option is to use multiple Or operators. Additionally an Or operator can only operate on 2 values at a time so this requires nested Or operators. How can you build such a query? See my solution below. | 0 | [
2,
5373,
255,
19,
6022,
4602,
26,
1891,
3132,
687,
203,
13,
5,
16608,
3132,
624,
6,
800,
3726,
3726,
786,
31,
281,
464,
14,
376,
20,
2757,
21,
5373,
255,
25597,
30,
2027,
113,
636,
1109,
500,
19,
636,
15165,
18,
500,
9,
31,
41... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 AppCenter for Native app - Screenshots won't update
===
We have a native iOS app that uses Facebook for authenticating users.
So we are setting up the AppCenter for this app, but the screenshots won't upload.
So before hitting save:
![Before Pic][1]
After hitting save:
![Top][2]
![After Pic][3]
Has anyone gotten this to work lately? The page seems broken. We have waited 30 minutes and checked again, and tried several times with no luck.
It really sucks because if we try to submit the app for review:
![Error on Submit][4]
[1]: http://i.stack.imgur.com/r3q80.png
[2]: http://i.stack.imgur.com/NGLNU.png
[3]: http://i.stack.imgur.com/ceAHT.png
[4]: http://i.stack.imgur.com/zZ5vU.png | 0 | [
2,
9090,
4865,
12641,
26,
1275,
4865,
13,
8,
2324,
7868,
18,
230,
22,
38,
11100,
800,
3726,
3726,
95,
57,
21,
1275,
13,
7760,
4865,
30,
2027,
9090,
26,
14351,
1880,
3878,
9,
86,
95,
50,
2697,
71,
14,
4865,
12641,
26,
48,
4865,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Character Replacement in a String in Java
===
Currently, I have an array of Strings, each with random characters in it that are random in length. I want to replace every "A" with an "X", how would I come about doing this?
Example:
String str = "ABCDEFGAZYXW";
I want the String to become "XBCDEFGXZYXW".
I tried to use
str.replaceAll("A", "X");
But it does not change the string. Any help is greatly appreciated! | 0 | [
2,
925,
4610,
19,
21,
3724,
19,
8247,
800,
3726,
3726,
871,
15,
31,
57,
40,
7718,
16,
7887,
15,
206,
29,
5477,
1766,
19,
32,
30,
50,
5477,
19,
1476,
9,
31,
259,
20,
3934,
352,
13,
7,
58,
7,
29,
40,
13,
7,
396,
7,
15,
184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Multiple splitview controller with tabbar controller
===
I have five views in tab bar & clicking on each item of tab bar one view controller will open which has one separate split view.
So here i have to generate five different splitview controller & i know that i can add splitview from window but how can i generate more than one split view controller? | 0 | [
2,
1886,
2132,
4725,
9919,
29,
6523,
1850,
9919,
800,
3726,
3726,
31,
57,
355,
4146,
19,
6523,
748,
279,
25590,
27,
206,
9101,
16,
6523,
748,
53,
1418,
9919,
129,
368,
56,
63,
53,
1725,
2132,
1418,
9,
86,
235,
31,
57,
20,
7920,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
deploy java war file to IBM web sphere portal
===
I have java war file and i want deploy into IBM web sphere portal.
Kindly tell me steps to deploy java war file
Many Thanks | 0 | [
2,
17617,
8247,
176,
3893,
20,
10233,
2741,
9228,
8281,
800,
3726,
3726,
31,
57,
8247,
176,
3893,
17,
31,
259,
17617,
77,
10233,
2741,
9228,
8281,
9,
22215,
494,
55,
2382,
20,
17617,
8247,
176,
3893,
151,
3669,
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... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
Interface Configuration in Arista EOS
===
I am trying to configure the Ethernet interfaces in an Arista Switch that is running on a vm (using vmware workstation). I am able to configure the management interface according to the user guid given but during configuring ethernet interfaces using the same procedure i am getting the following error:
localhost(config-if-Eth1)# ip address 172.16.204.4/24
! IP configuration will be ignored while interface Ethernet1 is not a routed port.
If someone could provide some help in this regard.
Thanks in advance. | 0 | [
2,
6573,
8091,
19,
29822,
13,
3894,
18,
800,
3726,
3726,
31,
589,
749,
20,
1065,
15951,
14,
27820,
6573,
18,
19,
40,
29822,
5521,
30,
25,
946,
27,
21,
13,
20147,
13,
5,
12655,
13,
20147,
5011,
170,
10839,
6,
9,
31,
589,
777,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Writing Numbers to a text file - batch file
===
This should be a simple one and I am dissapointed with myself but cant for the life of me find a solution! I am trying to write the number 1 to a text file in a BAT script. If I do the below it works but leaves a trailing space after the number which I cannot have. I know you can remove the trailing space by deleting the space between the 1 and the > (this works with letters) but with numbers all of a sudden I get a message saying - ECHO is OFF.
ECHO 1 > mytextfile.txt
*This works but leaves a trailing space*
ECHO 1> mytextfile.txt
*This gives me an error saying ECHO is OFF*
Any help would be much appreciated!
Thanks In advance :) | 0 | [
2,
1174,
2116,
20,
21,
1854,
3893,
13,
8,
13064,
3893,
800,
3726,
3726,
48,
378,
44,
21,
1935,
53,
17,
31,
589,
1460,
1229,
3132,
69,
29,
992,
47,
2973,
26,
14,
201,
16,
55,
477,
21,
4295,
187,
31,
589,
749,
20,
2757,
14,
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... |
Javac error on Generic return type
===
It might sound like reinvention of wheel, but I am trying to implement a map, (like `Map<K,V>`). The class has a function called `sortedKey()` which returns an `ArrayList<K>` A cut-down version of my code is below. I have included my attempts to debug inline as comments.
import java.util.ArrayList;
import java.util.Collections;
public class Map<K,V> {
private ArrayList<Pair<K,V> > array; //Pair<K,V> is a class defined in another file.
//returns an ArrayList(of proper type) of keys (ie, the desired function)
public ArrayList<K> sortedKeys(){
ArrayList<K> ret = keys(); //another method defined inside same class
K s = ""; // error: no suitable method found for sort(ArrayList<K>)
Collections.sort(new ArrayList<String>()); //Works just fine..
Collections.sort(ret); //Same error here..
return ret;
}
}
Any idea on why is that error showing up? Can I not have generic return types depending on the type-variable used in creation of the class? Or do I have to do something else to achieve the desired effect?
Thanks and apologies if this question has already been asked
Cajetan
| 0 | [
2,
8247,
150,
7019,
27,
12733,
788,
1001,
800,
3726,
3726,
32,
530,
646,
101,
7102,
6645,
872,
16,
3556,
15,
47,
31,
589,
749,
20,
8713,
21,
2942,
15,
13,
5,
1403,
13,
1,
15022,
1,
197,
15,
710,
1,
6,
9,
14,
718,
63,
21,
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... |
Fullscreen Cocoa app retina support
===
I'm developing a screenshot application working in fullscreen mode. I have a bug report about issues with MBP Retina, but I have no idea how to test and fix them. It looks like QuartzDebug can change displays to HiDPI mode, but I'm not sure that will do the trick. Can't find any "Retina Emultaion" related topics in Apple docs.
So my question is how can I test app (not just icons, but whole fullscreen application) for being compatible with retina display without buying one. | 0 | [
2,
503,
7187,
24507,
4865,
24325,
555,
800,
3726,
3726,
31,
22,
79,
3561,
21,
2324,
7868,
3010,
638,
19,
503,
7187,
3740,
9,
31,
57,
21,
6256,
1330,
88,
1549,
29,
14023,
306,
24325,
15,
47,
31,
57,
90,
882,
184,
20,
1289,
17,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 flipboard fetches the featured images from the url present in the tweet?
===
How does flipboard fetches the featured images from the url present in the tweet ??
can it be achieved using NSXMLParser . if so then how ?
pls help . I am a beginner.
Thanks in advance | 0 | [
2,
184,
630,
8805,
2806,
18312,
160,
14,
1070,
3502,
37,
14,
287,
6362,
734,
19,
14,
20224,
60,
800,
3726,
3726,
184,
630,
8805,
2806,
18312,
160,
14,
1070,
3502,
37,
14,
287,
6362,
734,
19,
14,
20224,
13,
60,
60,
92,
32,
44,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Spring 3.1 MVC: GET & POST on the same mapping, can it work?
===
I'm learning Spring 3.1.
My webapp name is **"acme".**
The url is roughly **https://blah.blah.blah/acme**
That URL is set up to display the **login.jsp**
I have a "/login" mapping in my controller that my login.jsp submits to
If something goes wrong it return the user to the **login.jsp** with this url in the browser:
**https://blah.blah.blah/acme/login**
The "/login" mapping is set up to handle POST requests, so I am concerned about users bookmarking
**https://blah.blah.blah/acme/login**, and getting the error message of "GET request not supported"
So, I thought I would put in a function to handle GET requests to /login to reroute through my general mapping handler for "/" and "/home":
**Login.Controller.java**
package gov.noaa.acme.controller;
import java.security.Principal;
import javax.servlet.http.*;
import org.springframework.stereotype.Controller;
import org.springframework.validation.*;
import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.apache.log4j.Logger;
@Controller
public class LoginController {
private static final Logger logger = Logger.getLogger(LoginController.class);
@RequestMapping({"/","home"})
public String home(ModelMap model,HttpSession session,HttpServletRequest request) {
// Do some stuff
return "login";
}
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String login_get(){
logger.debug("started...");
return "forward:home";
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@ModelAttribute("laph") LAPH laph,
BindingResult bindingResult,
ModelMap model,
HttpSession session,
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(required=true) String last_usertype) {
if (bindingResult.hasErrors()) {
logger.debug("Error returning home");
return "home";
}
logger.debug("Started ....");
// Do authentication
if (!isAuthenticated) {
model.put("status_message", error_message);
return "login";
}
// success, send newly authenticated user to a search page
nextView = "search";
return "redirect:" + nextView;
}
}// end class LoginController
My logs show that I am not even reaching the controller method for handling GET requests for /login, I'm still getting the error messages that GET is not supported for /login.
Any ideas on how I can fix this?
Thanks
Steve
| 0 | [
2,
1573,
203,
9,
165,
307,
8990,
45,
164,
279,
678,
27,
14,
205,
13305,
15,
92,
32,
170,
60,
800,
3726,
3726,
31,
22,
79,
2477,
1573,
203,
9,
165,
9,
51,
2741,
7753,
204,
25,
13,
1409,
7,
1738,
790,
7,
9,
1409,
14,
287,
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... |
TWO separate jquery remote validations in row
===
I need make 2 remote validations of my form with different error text.
Smth like that:
$("#form").validate({
rules: {
email:{
remote: "api/checkEmail.php",
remote2: "api/mySecondRemoteValidation.php"
}
},
messages: {
email: {
remote: "This email address is already in use",
remote2: "Another error text"
}
},
submitHandler: function(form) {
$(form).ajaxSubmit({
success: ajaxValidationCallback
});
return false;
},
onkeyup:false
});
I know that "remote2" is wrong.
Can you help me with this problem? Thanks. | 0 | [
2,
81,
1725,
487,
8190,
93,
5388,
27999,
18,
19,
3131,
800,
3726,
3726,
31,
376,
233,
172,
5388,
27999,
18,
16,
51,
505,
29,
421,
7019,
1854,
9,
7613,
96,
101,
30,
45,
5579,
5,
7,
5910,
4190,
7,
6,
9,
18506,
8209,
5,
1,
1761... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
NodeJS - server static files with external css and js
===
I'm trying to serve static html files with external CSS and JS using Node.JS and Express.
The static files are being served, but the browser won't load the CSS and JS pointed in the html file.
Any ideas how it can be solved?
Thanks | 1 | [
2,
15421,
728,
18,
13,
8,
8128,
12038,
6488,
29,
4886,
272,
18,
18,
17,
487,
18,
800,
3726,
3726,
31,
22,
79,
749,
20,
1884,
12038,
13,
15895,
6488,
29,
4886,
272,
18,
18,
17,
487,
18,
568,
15421,
9,
728,
18,
17,
2999,
9,
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... |
jquery tabs - dynamic div below tabs should not slide up when switching tabs
===
I have content below jQuery tabs which is sliding up and down with the tabs. The tabs are collapsible and the content is also sliding up when a tab is closing. But when I am switching between tabs, the content also moves up and down when it should stay in place. I tried to solve this problem with the event handlers, but as you can see here http://jsfiddle.net/eqUVm/2/ , the problem still exists.
Does anyone know a possible solution for my problem? | 0 | [
2,
487,
8190,
93,
6523,
18,
13,
8,
7782,
13,
12916,
1021,
6523,
18,
378,
52,
6464,
71,
76,
13027,
6523,
18,
800,
3726,
3726,
31,
57,
2331,
1021,
487,
8190,
93,
6523,
18,
56,
25,
7609,
71,
17,
125,
29,
14,
6523,
18,
9,
14,
65... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I extend ApplicationController in a gem?
===
I thought I'd come up with a slick way to extend ApplicationController in a Rails 3.x gem.
In my gem's lib/my_namespace/my_controller.rb, I had:
class MyNamespace::MyController < ApplicationController
before_filter :some_method
after_filter :another_method
def initialize
# getting classname of the subclass to use for lookup of the associated model, etc.
# ...
end
# define :some_method, :another_method, etc.
# ...
end
but when the Gem is loaded, app/controllers/application_controller.rb is not yet loaded, so it fails:
/path/to/rvm/gemset/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:
in `require': cannot load such file -- my_gem_name/application_controller (LoadError)
As a workaround, I had defined ApplicationController in my gem's lib/gem_namespace/application_controller.rb as:
class ApplicationController < ActionController::Base
end
I assumed that even though I had defined it there, it would be redefined in my Rails 3 application's app/controllers/application_controller.rb, such that both controllers in the application that extended ApplicationController and controllers that extended MyNamespace::MyController would directly or indirectly extend the ApplicationController defined in app/controllers/application_controller.rb.
However, we noticed that after loading the gem, controllers that extend ApplicationController were unable to access methods defined in app/controllers/application_controller.rb. Also, the ApplicationHelper (app/helpers/application_helper.rb) module was no longer being loaded by other helper modules.
How can I extend ApplicationController within the controller in my gem for the purpose allowing others to subclass my controller that subclasses ApplicationController? | 0 | [
2,
184,
92,
31,
7206,
3010,
12898,
1252,
19,
21,
8551,
60,
800,
3726,
3726,
31,
289,
31,
22,
43,
340,
71,
29,
21,
12544,
161,
20,
7206,
3010,
12898,
1252,
19,
21,
2240,
18,
203,
9,
396,
8551,
9,
19,
51,
8551,
22,
18,
13,
832... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
pycuda -- error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
===
i installed sabayon linux and i tried to install pycuda but i am receiving the following error when i try
> su -c "make install"
> In file included from src/cpp/cuda.cpp:1:0: src/cpp/cuda.hpp:12:18:
> fatal error: cuda.h: No such file or directory compilation terminated.
> error: command 'x86_64-pc-linux-gnu-g++' failed with exit status 1
I must mention that i can compile with cuda.
The same happens and when i try with
> sudo -E sh -c "make install"
My .bashrc is :
# Put your fun stuff here.
export PATH=~/bin:$PATH
export PATH=$PATH:$HOME/Matlab_2010b/bin
export PATH=/opt/cuda/bin:$PATH
export LD_LIBRARY_PATH=/opt/cuda/lib64:$LD_LIBRARY_PATH
export CUDA_ROOT=/opt/cuda/bin
(When i do echo $PATH as user it shows me : /opt/cuda/bin but when i try it as root it doesn't show anything and i had to do export PATH...again in order to show.)
| 0 | [
2,
7103,
150,
5729,
13,
8,
8,
7019,
45,
1202,
13,
22,
396,
3274,
1,
3470,
8,
5779,
8,
1226,
7147,
8,
263,
4215,
8,
263,
20512,
22,
1702,
29,
4350,
1782,
137,
800,
3726,
3726,
31,
4066,
11735,
7370,
13024,
17,
31,
794,
20,
1614... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Standalone functions/data in C++
===
I am not certain about this and searching a bit hasn't turned up anything specifically useful. So, supposing I have a header file with a namespace that contains some classes C1 and C2;
namespace my_namesp {
class C1 {
public:
blah1;
...
private:
blah2;
...
};
class C2 {
public:
junk1;
...
private:
junk2;
...
};
} //-End namespace
Now supposing in the implementation (CPP), I have all the member functions of C1, C2 defined, then supposing I have some common data that I want C1 and C2 to share, say, an enum and a string array, but I don't necessarily want them to be a part of either class. Then is it legal to do the following (note: it builds and works fine); and how about if I am exporting this implementation as a library for a client application? Would this still work? Is this kind of a design frowned upon, for any reason that I should be aware of? Perhaps a specific feature of OOP might be better suited for this kind of thing?
namespace my_namesp {
enum some_list_num {
list_member1,
list_member1,
...,
list_length
}
static const std::string string_list[] = {
str1,
str2,
...,
strN
}
return_type C1::some_func1(...) {
...
}
...
return_type C1::some_func1(...) {
...
}
} //-End my namespace
Thanks in advance again for any ideas/corrections.
| 0 | [
2,
26986,
3719,
118,
18768,
19,
272,
20512,
800,
3726,
3726,
31,
589,
52,
1200,
88,
48,
17,
5792,
21,
1142,
9979,
22,
38,
412,
71,
602,
3524,
4811,
9,
86,
15,
11128,
14717,
31,
57,
21,
157,
106,
3893,
29,
21,
204,
5582,
30,
15... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how after ndimage.find_object ... color features?
===
I have a large image which after labeling has about 500 features. I know how to get them in the slices using find_object but I want to color them so I can see the result. Any quick suggestion for that? | 0 | [
2,
184,
75,
13,
706,
22039,
9,
19811,
1,
23793,
13,
9,
9,
9,
1665,
967,
60,
800,
3726,
3726,
31,
57,
21,
370,
1961,
56,
75,
1899,
68,
63,
88,
3033,
967,
9,
31,
143,
184,
20,
164,
105,
19,
14,
12982,
18,
568,
477,
1,
23793,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Positioning error menu css position: relative in IE7
===
I'm with a positioning problem in IE7
have the following in my css menu
In Chrome and Firefox works correctly, but in IE7, the menu is vertical. How can I fix this?
[Page with this problem][1]
[1]: http://infantile.montepage.com.br
Please look at the source of the page the link up between the lines:
the menu is between the lines:
457 and 614
tag starts in:
<div class="colorido" style="z-index: 10000; position: relative;">
The area of the div 'colorido' will **Destaques** to **Fale Conosco**
Any help is appreciated. | 0 | [
2,
649,
68,
7019,
11379,
272,
18,
18,
649,
45,
4543,
19,
13,
660,
465,
800,
3726,
3726,
31,
22,
79,
29,
21,
649,
68,
1448,
19,
13,
660,
465,
57,
14,
249,
19,
51,
272,
18,
18,
11379,
19,
13,
12985,
17,
535,
18219,
693,
12044,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Ruby on Rails: Sending javascript data to ruby controller
===
I would like to send a javascript array to be processed by a method in my controller.
I think I am doing this way wrong. I am a total RoR, jquery, and ajax noobie. Here is what I have. Please give me some guidelines:
<div id="dataTable" class="dataTable" style="width: 680px;height: 300px; overflow: scroll"></div>
<button>Save!</button>
<script>
var first = true;
var totalChanges = new Array();
$("#dataTable").handsontable({
//...some code that generates appropriate array totalChanges
});
var data = //..some code
$("#dataTable").handsontable("loadData", data);
$(function() {
$( "button").button();
$( "button" ).click(function() {
alert("clicked");
$.ajax({
type: "POST",
url: "save",
data: JSON.stringify(totalChanges),
success: function() { alert("Success!"); }
});
});
});
</script>
I get this error:
POST http://10.10.136.244:6500/qtl_table/save 500 (Internal Server Error)
and
Started POST "/qtl_table/save" for 10.64.229.59 at Mon Jun 25 16:58:46 -0500 2012
Processing by QtlTableController#save as
Parameters: {"125,0,\"\",\"Ph upt 1-2\""=>{","=>{"125,1,\"\",\"DOR364\""=>{","=>{"125,2,\"\",\"G19833\""=>nil}}}}}
LOGGER WORKS
Completed 500 Internal Server Error in 81ms
ActionView::MissingTemplate (Missing template qtl_table/save with {:formats=>[:html], :handlers=>[:rjs, :rhtml, :erb, :rxml, :builder], :locale=>[:en, :en]} in view paths "/usr/home/benjamin/phavubase/qtl/app/views", "/usr/home/benjamin/phavubase/qtl/ruby/1.8/gems/declarative_authorization-0.5.5/app/views", "/usr/home/benjamin/phavubase/qtl/ruby/1.8/gems/devise_cas_authenticatable-1.1.1/app/views", "/usr/home/benjamin/phavubase/qtl/ruby/1.8/gems/devise-1.2.1/app/views", "/usr/home/benjamin/phavubase/qtl/ruby/1.8/gems/kaminari-0.12.4/app/views"):
app/controllers/qtl_table_controller.rb:18:in `data'
app/controllers/qtl_table_controller.rb:25:in `save'
Rendered ruby/1.8/gems/actionpack-3.0.8/lib/action_dispatch/middleware/templates/rescues/missing_template.erb within rescues/layout (0.8ms)
| 0 | [
2,
10811,
27,
2240,
18,
45,
4907,
8247,
8741,
1054,
20,
10811,
9919,
800,
3726,
3726,
31,
83,
101,
20,
2660,
21,
8247,
8741,
7718,
20,
44,
16697,
34,
21,
2109,
19,
51,
9919,
9,
31,
277,
31,
589,
845,
48,
161,
1389,
9,
31,
589,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Interacting with shell program in C to feed a custom Buffer into its gets() function (and more)
===
If you dont want the long sschpeal head the the last paragraph-->
I found a buffer overflow vulnerability in a program that is using `gets()` to fill a function's local 1024-char* buffer. It's on **Sparc Solaris 5.8 (sun4u) 32-bit**.
The first obstacle to overcome was the `tch` was not letting me manually input > 257 chars
(256 if I want to be able to hit enter ;)
To bypass this, I have been executing `/bin/sh` and `stty raw` and I can effectively overflow the buffer now with > 1095 chars.
(Note : I have to use Ctrl-J to do line-feeds/enter , though I haven't researched stty raw to examine why this change occurs.
**My issue is this**: it is now time to not only overflow the buffer but also write new return address / preserve %fp in ***hex codes***. But since I know of no way to manually enter hex codes from inside a terminal program, I figured I could find a way to use C and have it execute/interact with the vulnerable program and eventually send it my custom buffer.
HOWEVER, if I had a way to manually enter / copy paste hex bytes, I could just do something EASY like this!!!<br>
perl -e 'print "n" . "A"x1094 . "\xff\xbe\xf5\x58" . "\xff\xbe\xff\x68" . "\0"'
(if you're wondering why I am printing 'n' it is because the vulnerable program checks for a yes/no @ index 0 of the string)
because I know no way to manually paste such hex-information, I have been trying in C.
In C, I craft the special buffer and have been learning to `popen()` the vulnerable program ("w") and fputs my buffer, but it has been working iffy at best. (popen and `IPC` is all new to me)
(I also tried `piping/dup2ing` and i got NO results, no evidence of effective string output/input) not sure what is going wrong, and I experimented much with the code and later abandoned it.
The best to depict the output from my 'popen' program is that there is a segfault in the vulnerable program only by delimiting the buffer at indexes [1096->1099], this is effectively the location of the function's `%fp`, so it seemed normal @ **first**. However, delimiting the string at indexes HIGHER than this leaves the programing working fine (WTF)!!! And that sort of behavior makes me think WTF!!? That is not the same behavior as manually pasting, as going more chars most definitely changes seg fault -> bus error, *because I will be next overwriting the return address* followed by whatever possibly important info in that *stack frame* and beyond!!
Is the whole string not actually getting sent in one bang?!?!? I heard something about buffer `fflush()` issues from the `popen() manpage`, but I dont understand that talk!!
It's my first time using `popen()`, and there is more behavior that I have deemed strange-> if i stop `fputs()` through the popen stream, the vulnerable program goes into an infinite loop, repeatedly printing the output string that it NORMALLY would
only print once and then WAIT for input,
but in this case, whenever i stop fputs'ing, the thing starts infinitely printing out. Now, I expected that if I am not outputting, wouldn't the program just sit and wait like a good duck. ??? apparently not. apparently it has to keep on pissing and moaning that I need to enter the next string!! is this normal behavior with popen?!
**Note**: I am using "\r\n" to signal the vulnerable program to do a 'return' , I am not sure the equivalent of CTRL-J / Enter key (which enter key does not work in raw tty). I am also not sure if raw tty is even necessary when piping a buffer.
then I thought I try to be clever and cat the strings to a file and then do a pipe via command line. I have no idea if u can pipe like this to a program expecting inputs<br>
*in this form, I could not even get a single overflow!!* i.e.
printf "\r\n" > derp && perl -e 'print "n" . "A"x1025' >> derp && printf "\r\n" >> derp
cat derp | ./vuln
Now, rewind <-> back in tsh, i said I have a 257 char limit, and i needed to do ONE LESS THAN THAT if i wanted to be able to hit enter and have the program continue operation. So, perhaps \r\n is not right here, cause that's 2 chars. either that or you just Cannot `cat` into a program like this. But I AM using \r\n in my C programs to tell the vulnerable program that I have hit enter, and they are at least mildly more functional, though still not overflowing the buffer in the same fashion as manually pasting my trash buffer.
ARGh!!!
However, using just one \r or \n was most definitely not working! is there another control char out there I am missing out on? And is it possible that this could be one of my issues with my programs???
but basically my whole problem is I cant' seem to understand how to communicate with an executable and say hey!!! Take this buffer into your gets(),<br>
And i know of no way to manually paste / write hex codes into the terminal, **is the whole reason** why i am trying to write an interacting program to
craft a string with hext bytes in C and send to that program's gets()!!!!
If you jumped to this paragraph, i want you also to know that I am using specifically /bin/bash and stty raw so that I could manually input more than 257 chars (not sure if I NEED to continue doing this if I can successfully create an interacting program to send the vulnerable program the buffer. maybe sending a buffer in that way bypasses tch' terminal 257 char limit)
Can anyone help me!?!?!?!?!
| 0 | [
2,
24747,
29,
3593,
625,
19,
272,
20,
4063,
21,
5816,
17497,
77,
82,
3049,
5,
6,
1990,
13,
5,
290,
91,
6,
800,
3726,
3726,
100,
42,
1049,
259,
14,
175,
13,
18,
2992,
1664,
192,
157,
14,
14,
236,
20599,
8,
8,
1,
31,
216,
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... |
Training one-class SVM
===
I'm trying to get familiar to 1-class SVM using libsvm implementation.
As I've read, there is no class labels in libsvm's 1-class task.
But when reading the data file without the label column, there is always a read error.
I tried labeling my toy data and then testing the result model with svm-train but accuracy was always terrible, around 50%.
My question is, if I have a labeled dataset (say, a few hundreds of gaussian distributed 2d-points and several outliers among them), how do I train libsvm with this data, and how do I estimate accuracy of the result model? | 0 | [
2,
838,
53,
8,
1898,
11209,
79,
800,
3726,
3726,
31,
22,
79,
749,
20,
164,
3694,
20,
137,
8,
1898,
11209,
79,
568,
13,
8326,
18,
20147,
6123,
9,
28,
31,
22,
195,
1302,
15,
80,
25,
90,
718,
13173,
19,
13,
8326,
18,
20147,
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... |
How to access files on the windows server 2003 programmatically
===
I'm trying to build logviewer for logfiles stored on our server.I know about the logviewers available on codeplex. But I'm looking to build something of my own.
Here's what I need to do first and foremost. The log files are stored on server with address \\windows server address\LogFiles. Over here there are various folders with names W3SVC69773105,W3SVC1208646085. Now I can't make head and shoulders of this folder name but each folder represents an application. Inside each folder there are log files for each day.
I need to be able to get the latest file from the server, and then do parsing on it. I want to know how can I access this file located on server programmatically from my local machine. | 0 | [
2,
184,
20,
1381,
6488,
27,
14,
1936,
8128,
973,
625,
6732,
1326,
800,
3726,
3726,
31,
22,
79,
749,
20,
1895,
6738,
4725,
106,
26,
6738,
16877,
18,
8214,
27,
318,
8128,
9,
49,
143,
88,
14,
6738,
4725,
445,
904,
27,
1797,
11326,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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# Serial Connection: Get pin state
===
I am working with a codec and am trying to poll the state of RS232 serial pin 1 (CD high/low).
The code I have I think is right but I am second guessing myself and was hoping someone could confirm or correct me.
According to the the data sheet of the codec Pin 1 should be High when a call is active. I suspect i have done something wrong because while in a call I get a return of false (low).
This is a Windows Forms application and I am using System.IO.Ports
private void button4_Click(object sender, EventArgs e)
{
if (!serialPort1.IsOpen)
{
serialPort1.Open();
}
bool test = serialPort1.CDHolding;
if (test == false)
{
MessageBox.Show("Pin low");
}
else
{
MessageBox.Show("Pin high");
}
}
Also is there an easy way to show the actual voltage on the pin? | 0 | [
2,
272,
5910,
5956,
2760,
45,
164,
3459,
146,
800,
3726,
3726,
31,
589,
638,
29,
21,
1797,
150,
17,
589,
749,
20,
4994,
14,
146,
16,
13,
1224,
20730,
5956,
3459,
137,
13,
5,
6324,
183,
118,
4121,
6,
9,
14,
1797,
31,
57,
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... |
DDD: How to properly define exception strategy in .NET?
===
I am developing enterprise-like project by using DDD pattern. I have following projects in my C# solution:
- Domain model - DLL project
- WebUI - ASP.NET MVC3 project
- DesktopUI - WPF project
- DAL - Entity Framework Code First
- Persistance - SQL Server Database
This project is not large but I am trying to use all good practices of enterprise applications.
What I'd like to define now is exception strategy but I am not sure how to approach that. I should probably use Enterprise Library Exception Handling and Logging Blocks but I am not sure how to fit that into the picture. Some concrete scenarios I am trying to resolve in my head are following:
- If new Entity is created by the user in the WPF application, and Save button is clicked how should error be reported and logged in case an exception occurs at different levels (eg. entity is not properly created according to domain rules, or there was an error trying to persist new object to database)
- User tries to retrieve unknown entity from database (eg. from WebUI by specifying unknown entity Id in URL)
I understand I can define custom exceptions but I am not quite sure where and how. Should they be defined per each layer? I know there is wrapping exception practice but again not quite sure how to best use that pattern.
Also should I create one custom exception for each error in some layer (eg. UserAlreadyExistInDatabaseException for trying to save two users with same email, and UnknownUserDatabaseException if trying to get unknown user from DB) or should I have one exception type that handles multiple layer errors (eg. DatabaseException, and then differentiate errors with custom property or Exception.Message property). | 0 | [
2,
13,
43,
8096,
45,
184,
20,
7428,
9267,
5391,
4427,
19,
13,
9,
2328,
60,
800,
3726,
3726,
31,
589,
3561,
6002,
8,
1403,
669,
34,
568,
13,
43,
8096,
3732,
9,
31,
57,
249,
2314,
19,
51,
272,
5910,
4295,
45,
13,
8,
4603,
1061... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 map key properties to differing column types on inherited entities in EF CodeFirst?
===
I'm trying to implement a TPC inheritance model in EF 4.3 CodeFirst for an existing Oracle database (over which I have no control). I have several sub-types that each map to its own table. Unfortunately, some of the key columns are of datatype `number(18,0)` instead of `integer`. EF seems to hate me now.
Here's my base class:
public abstract class Vehicle
{
public virtual int Id { get; set;}
public virtual string Color { get; set; }
//more properties
}
Here are some example sub-types:
public class Car : Vehicle
{
//more properties
}
public class Truck : Vehicle
{
//more properties
}
public class Motorcycle : Vehicle
{
//more properties
}
And here's my DbContet:
public class VehicleDataContext : DbContext
{
public DbSet<Vehicle> Vehicles { get; set; }
public DbSet<Car> Cars { get; set; }
public DbSet<Truck> Trucks { get; set; }
public DbSet<Motorcycle> Motorcycles { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Vehicle>().HasKey(x => x.Id);
modelBuilder.Entity<Car>().Map(m => m.MapInheritedProperties());
modelBuilder.Entity<Car>().Property(x => x.Id).HasColumnType("decimal");
modelBuilder.Entity<Truck>().Map(m => m.MapInheritedProperties());
modelBuilder.Entity<Truck>().Property(x => x.Id).HasColumnType("int");
modelBuilder.Entity<Motorcycle>().Map(m => m.MapInheritedProperties());
modelBuilder.Entity<Motorcycle>().Property(x => x.Id).HasColumnType("decimal");
base.OnModelCreating(modelBuilder);
}
}
So, I already know to `MapInheritedProperties` so that all the properties of the base and sub-type are mapped to one table. I'm assuming that I have to tell the base that it `HasKey` so that EF doesn't complain that my `DbSet<Vehicle>` doesn't have a key mapped. I'd like to be able to assume that I can "tell" each entity how to map its own key's column type like I've done above. But I think that's not quite it.
Here's a test that fails:
[TestFixture]
public class when_retrieving_all_vehicles
{
[Test]
public void it_should_return_a_list_of_vehicles_regardless_of_type()
{
var dc = new VehicleDataContext();
var vehicles = dc.Vehicles.ToList(); //throws exception here
Assert.Greater(vehicles.Count, 0);
}
}
The exception thrown is:
> The conceptual side property 'Id' has already been mapped to a storage
> property with type 'decimal'. If the conceptual side property is
> mapped to multiple properties in the storage model, make sure that all
> the properties in the storage model have the same type.
As mentioned above, I have no control over the database and it's types. It's silly that the key types are mixed, but "it is what it is".
How can I get around this? | 0 | [
2,
184,
20,
2942,
1246,
3704,
20,
19304,
4698,
2551,
27,
7179,
12549,
19,
11599,
1797,
3552,
60,
800,
3726,
3726,
31,
22,
79,
749,
20,
8713,
21,
13,
38,
5779,
13852,
1061,
19,
11599,
268,
9,
240,
1797,
3552,
26,
40,
3149,
15759,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
getting argument exception in concurrent dictionary when sorting and displaying as it is being updated
===
I am getting a hard to reproduce error in the following program in which a number of threads update a concurrent dictionary in parallel and the main thread displays the state of the dictionary in sorted order after fixed time intervals, until all updating threads complete.
public void Function(IEnumerable<ICharacterReader> characterReaders, IOutputter outputter)
{
ConcurrentDictionary<string, int> wordFrequencies = new ConcurrentDictionary<string, int>();
Thread t = new Thread(() => UpdateWordFrequencies(characterReaders, wordFrequencies));
bool completed = false;
var q = from pair in wordFrequencies orderby pair.Value descending, pair.Key select new Tuple<string, int>(pair.Key, pair.Value);
t.Start();
Thread.Sleep(0);
while (!completed)
{
completed = t.Join(1);
outputter.WriteBatch(q);
}
}
The function is given a list of character streams and an outputter. The function maintains a concurrent dictionary of word frequencies of words read from each of the character streams (in parallel). The words are read in by a new thread, and the main thread outputs the current state of the dictionary (in sorted order) every 1 miliseconds until all the input streams have been read (in practice the outputting will be something like every 10 seconds, but the error only seems to be appearing for very small values). The WriteBatch function just writes to the console:
public void WriteBatch(IEnumerable<Tuple<string, int>> batch)
{
foreach (var tuple in batch)
{
Console.WriteLine("{0} - {1}", tuple.Item1, tuple.Item2);
}
Console.WriteLine();
}
Most executions are fine, but sometimes I get the following error at the foreach statement in the WriteBatch function:
"Unhandled Exception: System.ArgumentException: The index is equal to or greater
than the length of the array, or the number of elements in the dictionary is gre
ater than the available space from index to the end of the destination array."
The error does seem to go away if the main thread sleeps for a short while after starting the updating threads and before starting the display loop. It also seems to go away if the orderby clause is removed and the dictionary is not sorted in the linq query. Any explanations?
| 0 | [
2,
1017,
5476,
5391,
19,
19513,
9186,
76,
2058,
68,
17,
17418,
28,
32,
25,
142,
6372,
800,
3726,
3726,
31,
589,
1017,
21,
552,
20,
21509,
7019,
19,
14,
249,
625,
19,
56,
21,
234,
16,
20396,
11100,
21,
19513,
9186,
19,
3821,
17,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Playing a specific audio file when a specific tableview cell opens, with a different audio file for each cell
===
I am trying to make my app so that when I tap a cell in the tableView, the sound according to the row, from my array, will play and then turn off when I push the back button.
The problem is that when the cell is tapped, an htm file opens and a sound plays. When I go back to the main tableview and press another cell, the sound from the previous cell should stop and play the sound that is assigned to the recently pressed cell, but instead it goes on top of the first sound. I have had this problem for a few days and have no idea how to fix it...
The sound files are in an array and are listed according to how which one should be played with a specific cell.
Any help will be appreciated. I am new to Xcode. Thanks
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString* myUrl5 = nil;
int Selectedrow = indexPath.row;
int SelectedAccrow = indexPath.row;
myUrl5 = [[NSBundle mainBundle] pathForResource:[self.listDataHtm objectAtIndex:Selectedrow] ofType:@"htm"];
myUrl5 = [[NSBundle mainBundle] pathForResource:[self.listMusicHtm objectAtIndex:SelectedAccrow] ofType:@"mp3"];
BrowserViewController *controller = [[BrowserViewController alloc] initWithNibName:@"Browser" bundle:nil];
controller.delegate = self;
controller.makeURL = myUrl5;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:controller];
[self presentModalViewController:navController animated:YES];
[navController release];
[controller release];
}
| 0 | [
2,
791,
21,
1903,
4023,
3893,
76,
21,
1903,
859,
4725,
1667,
8965,
15,
29,
21,
421,
4023,
3893,
26,
206,
1667,
800,
3726,
3726,
31,
589,
749,
20,
233,
51,
4865,
86,
30,
76,
31,
5526,
21,
1667,
19,
14,
859,
4725,
15,
14,
646,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 create movable nodes and edges in java swing GUI?
===
In my java project, I need to create a GUI with swing where I will have a canvas like space. The user should be able to click and create nodes and then link nodes with edges (like you would create a UML diagram in MS Visio). The user should also be able to move the nodes along with edges. Then my application would save the network and run the selfish nodes algorithm and user should be able to see it live on GUI (creation and elimination of edges). I am not sure which swing tools I would need to use to accomplish this. | 0 | [
2,
184,
20,
1600,
29618,
16272,
17,
7840,
19,
8247,
5587,
9457,
60,
800,
3726,
3726,
19,
51,
8247,
669,
15,
31,
376,
20,
1600,
21,
9457,
29,
5587,
113,
31,
129,
57,
21,
9696,
101,
726,
9,
14,
4155,
378,
44,
777,
20,
10840,
17,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Undefined Variable $_POST['data'] PHP /Ajax jquery
===
Hello guys that is not normal :) !!
foo.php
<?php
if (isset($_POST['data']))
$stringData = $_POST['data'];
$file = "ciao.txt";
$fh = fopen($file, 'w') or die("can't open file");
fwrite($fh, $stringData);
fclose($fh);
?>
file.js
function WriteToFile() {
var dataa = "foo bar";
$.post("foo.php", {data: dataa}, function(result){ alert("ciaoooo!!");}
, "json");
}
this is the error and i can't write on my file.txt
Notice: Undefined variable: stringData
I tried also with that kind of function
function WriteToFile() {
var data = "foo bar";
$.ajax({
url: 'foo.php',
type: 'POST',
data: { 'data' : 'data'},
success: function() {
alert('the data was successfully sent to the server');
}
});
but the result is the same!! Anyone have some idea???
| 0 | [
2,
367,
13439,
7612,
5579,
1,
6962,
2558,
22,
18768,
22,
500,
13,
26120,
13,
118,
6881,
7522,
487,
8190,
93,
800,
3726,
3726,
10975,
2776,
30,
25,
52,
1826,
13,
45,
6,
13,
19015,
4310,
111,
9,
26120,
13,
1,
60,
26120,
100,
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... |
Model/Table wont work heroku
===
I am following along in Agile Web Development with Rails (rails 3.2+) and I am on chapter 16, about deployment. However, I am skipping it for the most part b/c I am planning on using Heroku and I am currently trying to figure that out. Anyway, I successfully depolyed my app yesterday and it works fine, all except for one of my models. My 'orders' model always returns a "We're sorry, but something went wrong." error and I cannot figure out why. Here is 'heroku logs'
2012-07-27T16:46:00+00:00 app[web.1]: => Booting WEBrick
2012-07-27T16:46:00+00:00 app[web.1]: => Rails 3.2.6 application starting in production on http://0.0.0.0:59115
2012-07-27T16:46:00+00:00 app[web.1]: => Call with -d to detach
2012-07-27T16:46:00+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-07-27T16:46:00+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-07-27T16:46:00+00:00 app[web.1]: [2012-07-27 16:46:00] INFO WEBrick 1.3.1
2012-07-27T16:46:00+00:00 app[web.1]: [2012-07-27 16:46:00] INFO ruby 1.9.3 (2012-04-20) [x86_64-linux]
2012-07-27T16:46:00+00:00 app[web.1]: [2012-07-27 16:46:00] INFO WEBrick::HTTPServer#start: pid=2 port=59115
2012-07-27T16:46:01+00:00 heroku[web.1]: State changed from starting to up
2012-07-27T16:46:04+00:00 app[web.1]:
2012-07-27T16:46:04+00:00 app[web.1]: Started POST "/en/orders" for 68.110.76.153 at 2012-07-27 16:46:04 +0000
2012-07-27T16:46:04+00:00 app[web.1]:
2012-07-27T16:46:04+00:00 app[web.1]: Processing by OrdersController#create as HTML
2012-07-27T16:46:04+00:00 app[web.1]: Parameters: {"utf8"=>"✓", "authenticity_token"=>"MGaN236tlISbAvzPPHogMMyRPIOux+VjAhjCYv/Uv8g=", "order"=>{"name"=>"Tim Turner", "address"=>"9393 E Thorougbh ", "email"=>"xrobertquinnx@aol.com", "pay_type"=>"Check"}, "commit"=>"Place Order", "locale"=>"en"}
2012-07-27T16:46:05+00:00 app[web.1]: Rendered collection (0.0ms)
2012-07-27T16:46:05+00:00 app[web.1]: Rendered order_notifier/received.html.erb (58.4ms)
2012-07-27T16:46:05+00:00 app[web.1]: Rendered collection (0.0ms)
2012-07-27T16:46:05+00:00 app[web.1]: Rendered order_notifier/received.text.erb (0.8ms)
2012-07-27T16:46:08+00:00 app[web.1]:
2012-07-27T16:46:08+00:00 app[web.1]: Sent mail to johndoe@aol.com (3050ms)
2012-07-27T16:46:08+00:00 app[web.1]:
2012-07-27T16:46:08+00:00 app[web.1]: Completed 500 Internal Server Error in 3619ms
2012-07-27T16:46:08+00:00 app[web.1]: Errno::ECONNREFUSED (Connection refused - connect(2)):
2012-07-27T16:46:08+00:00 app[web.1]: app/controllers/orders_controller.rb:59:in `block in create'
2012-07-27T16:46:08+00:00 app[web.1]: app/controllers/orders_controller.rb:55:in `create'
2012-07-27T16:46:08+00:00 app[web.1]:
2012-07-27T16:46:08+00:00 app[web.1]:
2012-07-27T16:46:08+00:00 heroku[router]: POST depot-app-test.herokuapp.com/en/orders dyno=web.1 queue=0 wait=0ms service=3791ms status=500 bytes=643
2012-07-27T16:46:08+00:00 heroku[router]: GET depot-app-test.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=6ms status=304 bytes=0
2012-07-27T16:46:08+00:00 app[web.1]: [2012-07-27 16:46:08] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
As you can see, there is a 500 Internal server error. However, I dont know what could be causing this. All my other models work just fine. It is not like I added the 'orders' model late and forgot to migrate. I know the 'orders' table is working because I installed an sql console and I can see all the entries being logged. Also, It works just fine locally. I also did this to see more error reporting:
config.consider_all_requests_local = true
But, I did not get any more information than found in 'heroku logs'. Any and all input would be greatly appreciated. | 0 | [
2,
1061,
118,
5924,
7290,
170,
36,
9266,
800,
3726,
3726,
31,
589,
249,
303,
19,
27475,
2741,
522,
29,
2240,
18,
13,
5,
7301,
18,
203,
9,
21812,
6,
17,
31,
589,
27,
1260,
347,
15,
88,
10475,
9,
207,
15,
31,
589,
27225,
32,
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... |
Outputcache and HttpModule
===
I have an HTTP module that replaces relative URLs with the URL of our CDN for static content. However, when this module is added to the web.config, it causes our Outputcache to no longer work.
I've tried messing with the order of httpModules in web.config with no luck. Any ideas?
| 0 | [
2,
5196,
793,
2569,
17,
7775,
19673,
62,
800,
3726,
3726,
31,
57,
40,
7775,
12613,
30,
3934,
18,
4543,
13,
911,
7532,
29,
14,
287,
6362,
16,
318,
1745,
103,
26,
12038,
2331,
9,
207,
15,
76,
48,
12613,
25,
905,
20,
14,
2741,
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... |
Validating urls in django without doing it at runtime
===
My problem is that the website I built with django has 100s of links to YouTube videos so that we can embed them in our pages.
I don't want to validate that the urls exist in the template because that seems to be a waist of resources. Is there a way to test all of the links once a day and put a flag on them in the MySQL database? This way the bad links wouldn't even be looked at by the templates, which should speed up page load times.
Any ideas would be greatly appreciated. | 0 | [
2,
7394,
1880,
13,
911,
7532,
19,
3857,
14541,
366,
845,
32,
35,
485,
891,
800,
3726,
3726,
51,
1448,
25,
30,
14,
2271,
31,
392,
29,
3857,
14541,
63,
808,
18,
16,
6271,
20,
7330,
6610,
86,
30,
95,
92,
11911,
69,
105,
19,
318,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
GAE - Ancestor issue
===
I want to have unique values in my gae, so i read though the docs and found that "transactions" are atomic.
https://developers.google.com/appengine/docs/python/ndb/transactions
class Account(ndb.Model):
""""Required DB """
username = ndb.StringProperty(required=True)
password = ndb.StringProperty(required=True)
mail = ndb.StringProperty(required=True)
salt = ndb.StringProperty(required=True)
date = ndb.DateTimeProperty(auto_now_add=True)
name = ndb.StringProperty()
last_name = ndb.StringProperty()
phone_number = ndb.IntegerProperty()
postal = ndb.IntegerProperty()
city = ndb.StringProperty()
products = ndb.IntegerProperty(repeated=True)
@ndb.transactional
def create_account(self):
acc = Account.query(Account.username==self.username)
acc = tuple(acc)
if len(acc)== 0:
self.put()
else:
#yield error
pass
I awalys get the same error
> BadRequestError:
>
> Only ancestor queries are allowed inside transactions.
My db model "Account" does not have any ancestors.
Shouldn't it be the only "ancestor" ? | 0 | [
2,
13,
17721,
13,
8,
14628,
1513,
800,
3726,
3726,
31,
259,
20,
57,
2619,
4070,
19,
51,
13,
17721,
15,
86,
31,
1302,
362,
14,
9765,
18,
17,
216,
30,
13,
7,
7028,
8645,
18,
7,
50,
9692,
9,
7775,
18,
6903,
26051,
445,
9,
16111... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 execution flow on Android WebView
===
I have one question about javascript and WebView in android. I have not found answer on it.
When I trying to load web page using loadData (javascript enabled in web view settings) I can't understand working flow of javascript execution (seems like no execution of some javascript code ). Code of page is below(example):
<html><head><meta name='viewport' content='user-scalable=no initial-scale=1.0' />
<title>Title</title>
<script type="text/javascript">
var init = function() {
var uuu = window.uuu = {};
}
window.zzz = window.uuu;
</script>
<script type="text/javascript">/
(function() {
var c = window.c = {};
})();
</script>
<script type="text/javascript"> ...... some javascript ..... </script>
</head>
<body style="margin:0; padding:0; overflow:hidden; background-color:transparent;">
<div align="center">
<script> ..... some javascript ..... </script>
</div>
</body>
</html>
This page after loading not execute any javascript and start working only if all javascripts injects by loadUrl("javascript:" + ....); This is not good solution ( body can be complex and can contain javascript or not contain it ). How get working javascript similar on desktop browsers ?
| 0 | [
2,
8247,
8741,
5769,
3312,
27,
13005,
2741,
4725,
800,
3726,
3726,
31,
57,
53,
1301,
88,
8247,
8741,
17,
2741,
4725,
19,
13005,
9,
31,
57,
52,
216,
1623,
27,
32,
9,
76,
31,
749,
20,
6305,
2741,
2478,
568,
6305,
18768,
13,
5,
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... |
Defining class variables in Objective-C
===
As Objective-C has evolved (I use it exclusively with xcode/ios for iPhone/iPad development), there seems to be many different ways you can layout your class variables. Is there a 'best practice' way that's become common consensus? (I realise Apple demo/example code is all over the place in terms of style)
In particular the idea of handling private variables. Here are a number of ways I've seen to manage some instance variables for a class (I've left out the interface/implementation for brevity) - and I'm not even including the use of underscore named synthesized properties.
.h
@property (nonatomic, strong) NSString *aString;
.m
@synthesize aString;
- (void)aMethod {
aString = @"Access directly, but if I don't have custom getter/setters and am using ARC, do I care?";
self.aString = @"Access through self";
}
Or this:
.h
@property (readonly) NSString *aString;
.m
@property (nonatomic, strong) NSString *aString;
...
@synthesize aString;
Or this:
.m
@interface aClass {
NSString *aPrivateString;
}
- (void)aMethod {
aPrivateString = @"Now I have to access directly, but is this atomic/nonatomic?";
}
I don't want this question to turn into a style argument, but it seems to me there should be a "if you're not doing something specific or complex or weird, use this method for defining your class variables" standard. | 0 | [
2,
14684,
718,
12157,
19,
7038,
8,
150,
800,
3726,
3726,
28,
7038,
8,
150,
63,
7339,
13,
5,
49,
275,
32,
7008,
29,
993,
9375,
118,
7760,
26,
21024,
118,
49,
8240,
522,
6,
15,
80,
2206,
20,
44,
151,
421,
2847,
42,
92,
9106,
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... |
has_secure_password prevents setting a boolean to true
===
I want to do email confirmation, after having set up sign in/sign up and sessions using the has_secure_password and authenticate method.
I have a user model, and I added a confirmed boolean. When a user is created, I set their confirmed boolean to false, and send them an email with a link. Clicking the link generates a GET request to /users/:id/confirm, and executes the code of "confirm" action in the users_controller that is the following :
<pre><code>
def confirm
@user = User.find(params[:id])
@user.update_attributes(confirmed: true)
if @user.save
sign_in(@user)
flash[:success] = "Your account has been successfully confirmed"
else
flash[:error] = "There has been a problem confirming your account "
end
redirect_to root_path
end
</code></pre>
Very simple (I will do verification token later). My problem is that my user is never saved.
<pre><code>@user.errors.full_messages</code></pre> returns :
["Password is too short", "Password confirmation can't be blank"]
How can I change a user object without having to edit their password each time ?
Any help would be greatly appreciated.
Thanks ! | 0 | [
2,
63,
1,
22917,
1,
6201,
9587,
2501,
18,
2697,
21,
9827,
413,
210,
20,
1151,
800,
3726,
3726,
31,
259,
20,
107,
8517,
15939,
15,
75,
452,
309,
71,
1676,
19,
118,
11255,
71,
17,
5763,
568,
14,
63,
1,
22917,
1,
6201,
9587,
17,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 query analyzer xml resultset truncated
===
I store some xml data in a table.
Example:
INSERT INTO table (id, value) (1, '<xml>...</xml>')
SELECT value FROM table
but when I do a select query from query analyzer the 'value' field is showing truncated xml.
How can I see the full xml?
| 0 | [
2,
4444,
255,
25597,
16051,
139,
23504,
1736,
1198,
22328,
69,
800,
3726,
3726,
31,
1718,
109,
23504,
1054,
19,
21,
859,
9,
823,
45,
14692,
77,
859,
13,
5,
1340,
15,
1923,
6,
13,
5,
165,
15,
13,
22,
1,
396,
8184,
1,
9,
9,
9,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Can't get pygame font to render transparently on image
===
I've found lots of tutorials for using pygame, and its font library, but they all show the same exact thing. They all show you how to write some plain text on to a background, which is great, but going beyond that there's not a lot of useful information that I've found.
With the project I'm working on, I have menu buttons that I've implemented as sprites. When you hover over them they change colors, and that all works pretty well. What I'd like to do is write text on these buttons, but I'm baffled on how to do that. From the docs font.render works as so:
"This creates a new Surface with the specified text rendered on it. Pygame provides no way to directly draw text on an existing Surface: instead you must use Font.render - draw text on a new Surface to create an image (Surface) of the text, then blit this image onto another Surface."
So I've tried to take the image that's attached to my sprite and directly blit my text onto that. That seems to mostly do absolutely nothing:
resume = self.button_font.render(
'Resume Game',
True,
constants.WHITE,
(23, 56, 245) # Main color of the button, tried without this as well
)
self.resume_button.image.blit(
resume,
self.resume_button.rect,
)
I know that code runs, but you never see any text. If I blit the text directly to my main screen surface, it'll just write over the top of my resume button (depending on the blit order of course). What am I doing wrong? The docs seem to indicate that this is the right way to handle it, but I've yet to find anyone else doing this. Any help would be greatly appreciated.
| 0 | [
2,
92,
22,
38,
164,
7103,
5128,
9978,
20,
16535,
14862,
102,
27,
1961,
800,
3726,
3726,
31,
22,
195,
216,
7503,
16,
29724,
18,
26,
568,
7103,
5128,
15,
17,
82,
9978,
1248,
15,
47,
59,
65,
298,
14,
205,
5340,
584,
9,
59,
65,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Gravity Forms Function for Calculating an Endtime
===
I am a code beginner and have been trying to create some sort of way to create a hook that will dynamically create an endtime for an event based on a predetermined start time (standard number field) and a chosen start time. This is my first attempt at creating a custom hook and I have been struggling...
The form I started with came from here: http://anthonydispezio.com/blog/gf-ecp-frontend-submission/
`add_filter('gform_field_value_end_time', 'populate_end_time');
function populate_end_time($value){
}
$start_time = get_gform_field_value_start_time();
$duration = get_gform_field_value_duration();`
The duration would be in hours so I thought there might be some way to add that number to the starttime hh field? | 0 | [
2,
833,
5890,
8849,
1997,
1990,
26,
22937,
40,
241,
891,
800,
3726,
3726,
31,
589,
21,
1797,
26931,
17,
57,
74,
749,
20,
1600,
109,
2058,
16,
161,
20,
1600,
21,
5559,
30,
129,
7782,
1326,
1600,
40,
241,
891,
26,
40,
807,
432,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
UIView outside of a View Controller in a Storyboard
===
I'm stuck with a question I can't find an answer to in the official documentation, on Stackoverflow or on Google.
I'm an experimented iOS developer but new to Storyboards. I'd like to instantiate a view on the current viewcontroller, a view that, in a NIB, I would draw outside the viewController and attach an outlet to to refer to it in code and call something like addSubview: or so. It's useful to draw an overlay or, in my current case, a callout view for use in a MapView delegate. But I can't figure out how I can do this in a Storyboard.
I can't seem to have a view outside of a viewcontroller, and views inside the viewcontroller either have to be subviews of the controller's view or don't be visible in Interface Builder at all (which is okay when you drag a view composed outside, in a traditional NIB, but quite a problem if you need to tweak even the least detail of it).
Any hint on what to do or where to look? Thanks. | 0 | [
2,
13,
5661,
4725,
719,
16,
21,
1418,
9919,
19,
21,
609,
2806,
800,
3726,
3726,
31,
22,
79,
4549,
29,
21,
1301,
31,
92,
22,
38,
477,
40,
1623,
20,
19,
14,
989,
13945,
15,
27,
7566,
2549,
9990,
54,
27,
8144,
9,
31,
22,
79,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
self.delete() gives error: "instance needs to have a primary key value before a many-to-many relationship can be used"
===
I have three models. We'll call them Mod1, Mod1Request, and UserProfile.
Mod1Request looks like:
class Mod1Request(models.Model):
date_requested = models.DateField(auto_now_add=True)
mod1s = models.ManyToManyField('Mod1')
user = models.ForeignKey(User)
approved = models.BooleanField()
def save(self, *args, **kwargs):
if self.approved:
for c in list(self.mod1s.all()):
mod = mod1.objects.get(id=c.id)
self.user.get_profile().mod1s.add(mod)
self.delete()
else:
super(Mod1Request, self).save(*args, **kwargs)
And then the UserProfile has a 'mod1s' attribute that is a ManyToManyField to Mod1. What I'm trying to accomplish is this:
When a Mod1Request is saved, if Approved is set then have the Mod1s listed in the Mod1Request added to UserProfile and then delete the Mod1Request itself.
This functionality works right up until it goes to delete itself. If I remove the self.delete() line then the Mod1 instances in Mod1Request are correctly added to UserProfile.mod1s. However, if I leave it in I get the following error:
'Mod1Request' instance needs to have a primary key value before a many-to-many relationship can be used.
Any help would be greatly appreciated. | 0 | [
2,
1119,
9,
24249,
591,
5,
6,
2352,
7019,
45,
13,
7,
108,
384,
2416,
2274,
20,
57,
21,
1256,
1246,
1923,
115,
21,
151,
8,
262,
8,
14842,
1429,
92,
44,
147,
7,
800,
3726,
3726,
31,
57,
132,
2761,
9,
95,
22,
211,
645,
105,
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... |
Can the output Key type from a Mapper be changed before it enters Reducer?
===
If the mapper is emitting a set of key value pairs, can we do some processing in the sort and shuffle method and change the key type so that the reducer accepts a key type which is of a different kind?
| 0 | [
2,
92,
14,
5196,
1246,
1001,
37,
21,
2942,
1432,
44,
1015,
115,
32,
8104,
4136,
139,
60,
800,
3726,
3726,
100,
14,
2942,
1432,
25,
13,
28741,
21,
309,
16,
1246,
1923,
7473,
15,
92,
95,
107,
109,
5511,
19,
14,
2058,
17,
23682,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Liferay : web content, dynamic list record or specific model?
===
I find that Liferay concepts are quite confusing.
When I add new items, I don't know what is the best to choose :
- Use the web content concept with template and structure
- Use the dynamic list records
- Use a specific model (using service builder).
All of these are really similars and can achieve same goals.
Have you got any clue or advice on what concept to choose when you develop some new features in Liferay ? | 0 | [
2,
201,
2787,
13,
45,
2741,
2331,
15,
7782,
968,
571,
54,
1903,
1061,
60,
800,
3726,
3726,
31,
477,
30,
201,
2787,
8700,
50,
1450,
18084,
9,
76,
31,
3547,
78,
3755,
15,
31,
221,
22,
38,
143,
98,
25,
14,
246,
20,
3538,
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... |
.serialize() and parse_str() - issue with starting hashtag
===
I'm posting serialized form data with $.post to a PHP page, and then save the values using parse_str(). But when any field values starts with a hashtag (#) the $_POST value doesn't get set.
$('.ajax-form').submit(function() {});
$.post(url, {
data: $(this).serialize()
}, (function(json) {
return console.log(json);
}), 'json');
PHP receives the string, for example:
name=Richard&permalink=test&description=Test+description&headline_color=%23ffffff&position=1
And then parses it into an array:
parse_str($_POST['data'], $_POST);
All the values except 'headline_color' (value: #ffffff) gets set. If I remove the # it works.
How can I solve this? | 0 | [
2,
13,
9,
4104,
2815,
2952,
5,
6,
17,
2017,
870,
1,
9729,
5,
6,
13,
8,
1513,
29,
1422,
19170,
8628,
800,
3726,
3726,
31,
22,
79,
15669,
27877,
505,
1054,
29,
5579,
9,
6962,
20,
21,
13,
26120,
2478,
15,
17,
94,
2079,
14,
4070... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Failed to install plugin mahout-recommender-0.5.2
===
I am trying to install mahout-recommender-0.5.2 on grails 1.3.7 but it showing following error
Failed to install plugin [mahout-recommender-0.5.2]. Plugin has missing JAR dependencies.
But it is installing grails 2.0 but i want to install it on 1.3.7
| 0 | [
2,
1702,
20,
16146,
10922,
108,
6330,
1320,
8,
99,
960,
755,
1157,
8,
387,
9,
264,
9,
135,
800,
3726,
3726,
31,
589,
749,
20,
16146,
6330,
1320,
8,
99,
960,
755,
1157,
8,
387,
9,
264,
9,
135,
27,
489,
7301,
18,
137,
9,
240,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Solr: MLT filter by a field in matched doc
===
MoreLikeThis can return the matched doc. My question is that can i somehow pass in a query param to indicate that i would like to filter on a field value of the matched doc? Thanks a lot! | 0 | [
2,
7176,
139,
45,
13,
8184,
38,
11945,
34,
21,
575,
19,
11265,
9765,
800,
3726,
3726,
91,
1403,
1565,
92,
788,
14,
11265,
9765,
9,
51,
1301,
25,
30,
92,
31,
3625,
1477,
19,
21,
25597,
2258,
79,
20,
4342,
30,
31,
83,
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,
0,
0,
0... |
COlumn chart in gwt
===
i am new to gwt. actually i am adding the column chart first into the scrollpanel and then that scroll panel into VP. i need one help now. actually that column chart aligns at the center and there will be much space left out at left side.
so how to make that column chart on left side.
| 0 | [
2,
4698,
1795,
19,
14094,
38,
800,
3726,
3726,
31,
589,
78,
20,
14094,
38,
9,
1121,
31,
589,
4721,
14,
4698,
1795,
64,
77,
14,
12159,
3206,
532,
17,
94,
30,
12159,
4113,
77,
13,
10924,
9,
31,
376,
53,
448,
130,
9,
1121,
30,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Git merge only fixes, no merge from other branches
===
We're in a complex situation. We've got this king of repository:
C1 C4 C5
devel *---*---*---*-----------*---------
\_____
\ C2 C3
fix-ie *--*---------*----*----*-------*---
M1 \___
\
testing *----*-------------------------------*---
M2
As you can see, devel is merged inside fix-ie branch.
Problem is that "testing" branch should not have "devel" commits (we don't want C1) but we need to merge fix-ie in "testing" to have only C2 and C3 commits
If I do:
git checkout testing
git merge fix-ie
I will have the M1 merge in my testing branch... So C1 commit is found in our testing branch. That's not what we want.
How to avoid this ?
Remember that I simplified example, there are lot of merges, lot of commits in our fix-ie and devel branches.
Thanks :) | 0 | [
2,
13,
10404,
12666,
104,
6098,
160,
15,
90,
12666,
37,
89,
4395,
800,
3726,
3726,
95,
22,
99,
19,
21,
1502,
1858,
9,
95,
22,
195,
330,
48,
437,
16,
24869,
45,
272,
165,
272,
300,
272,
264,
121,
6532,
1637,
8,
8,
8,
2483,
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... |
smarty 'if' outputting in section
===
i need some help with this piece of smarty code
{section name=Index loop=$aProductReviews}
<tr>
<td>
<h2>{$aProductReviews[Index]['ProductName']}</h2>
<table style="border: 1px; border-style: solid; border-color: #000000">
{section name=SubIndex loop=$aProductReviews[Index]['reviews']}
<tr>
<td><h3>{$aProductReviews[Index]['reviews'][SubIndex]->Name}</h3></td>
<td><h3>{$aProductReviews[Index]['reviews'][SubIndex]->DateCreated}</h3></td>
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1}
<td><h3><a onclick="confirmDeleteDialog({$aProductReviews[Index]['reviews'][SubIndex]->Id})" style="text-decoration: underline;">Verwijderen</a></h3></td>
{ else }
<td><h3><a onclick="confirmApproveDialog({$aProductReviews[Index]['reviews'][SubIndex]->Id})" style="text-decoration: underline;">Goedkeuren</a>
<a onclick="confirmDeleteDialog({$aProductReviews[Index]['reviews'][SubIndex]->Id})" style="text-decoration: underline;">Niet Goedkeuren</a></h3></td>
{ /if }
</tr>
<tr>
<td colspan="3"><p>{$aProductReviews[Index]['reviews'][SubIndex]->Review}</p></td>
</tr>
{/section}
</table>
</td>
</tr>
{/section}
The problem with this is that the if/else statement inside the subsection is outputing rather then executing the if/else statements.
Shown on top of my page is the following:
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
{ if $aProductReviews[Index]['reviews'][SubIndex]->Approved == 1} { else } { /if }
What am i doing wrong? is there something i did not see? this has been troubling me for hours now and i just can't find the solution.
Thanks!! | 0 | [
2,
3978,
93,
13,
22,
821,
22,
5196,
1203,
19,
1050,
800,
3726,
3726,
31,
376,
109,
448,
29,
48,
1855,
16,
3978,
93,
1797,
13,
1,
10579,
204,
3726,
25671,
5293,
3726,
4403,
58,
14086,
99,
4725,
18,
1,
13,
1,
6384,
1,
13,
1,
3... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
relation model between two models: the relational key
===
I would like to make a relation between two models User and Task using backbone-relational.
I would like for each Task to get the User model or User attributes.
The relation between the two model is the following:
taskModel.creator_id = userModel.id
---
// TaskModel
var TaskModel = Backbone.RelationalModel.extend({
relations: [
{
type: 'HasOne',
key: 'creator_id',
relatedModel: UserModel
}
],
urlRoot: 'url_get_tasks'
});
---
Without using relations the taskModel.attributes looks like this:
taskModel.attributes = {
id: 12,
name: 'bar'
creator_id: 1
}
Using RelationalModel, when I fetch the taskModel I have the following result:
taskModel.attributes = {
id: 12,
name: 'bar'
creator_id: userModel
}
Actually I would like something like this
(3)
taskModel.attributes = {
id: 12,
name: 'bar'
creator_id: 1,
user: userModel or user.attributes
}
How can I achieve my goal (getting (3))? | 0 | [
2,
5827,
1061,
128,
81,
2761,
45,
14,
5827,
192,
1246,
800,
3726,
3726,
31,
83,
101,
20,
233,
21,
5827,
128,
81,
2761,
4155,
17,
3005,
568,
24036,
8,
99,
10832,
192,
9,
31,
83,
101,
26,
206,
3005,
20,
164,
14,
4155,
1061,
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... |
Create trigger using variable from table
===
I'm relatively new to triggers in MYSQL, so sorry if this is a pretty basic thing I'm trying to do. I've found how to set one up allowing a static update, however I haven't seen anything about how to use one of the fields from the inital update as a variable inside the trigger statement
Example:
Table 1, `items`:
id | name | total_stock
1 | item | 8
2 | item2 | 0
Table 2, `item_options`:
id | item_id | option | stock
1 | 1 | test | 5
2 | 1 | test2 | 3
3 | 2 | test | 0
If I then update `item_options`:
UPDATE `item_options` SET `stock`=7 WHERE `id`=1
Or insert a new item into `item_options`:
INSERT INTO `item_options` (`item_id`,`option`,`stock`) VALUES ('2','add','2')
Then I'd like (if it's possible) to use a trigger to update the `total_stock` in the `items` table with the SUM of `stock` in the `item_options` table with the same corresponding `item_id`.
So, I guess my question is in two parts:
1. Is this possible?
2. Can someone point me in the right direction of how to do this? | 0 | [
2,
1600,
7286,
568,
7612,
37,
859,
800,
3726,
3726,
31,
22,
79,
3109,
78,
20,
7286,
18,
19,
51,
18,
22402,
15,
86,
1875,
100,
48,
25,
21,
1772,
2125,
584,
31,
22,
79,
749,
20,
107,
9,
31,
22,
195,
216,
184,
20,
309,
53,
71... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Best way out for modify Lucene.net index c#
===
after indexing data we may have to re-index the data because later our data can be change. if i do not re-index the change data may not come in search result. here is my code for indexing data for first time.
private void CreateIndex(bool UpdateIndex=false)
{
string sIndexLocation = MapPath("~/IndexData/");
IsIndexExists(out created, sIndexLocation);
Lucene.Net.Store.Directory dir = Lucene.Net.Store.FSDirectory.GetDirectory(sIndexLocation, true);
object _lockObj = new object();
IndexWriter writer = new IndexWriter(dir, new StandardAnalyzer(), true);
if (!UpdateIndex)
{
lock (_lockObj)
{
try
{
SearchData srch = new SearchData();
List<Data> data = srch.GetData();
foreach (var oData in data)
{
Document doc = new Document();
doc.Add(new Field("ID", oData.ID.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
doc.Add(new Field("Title", oData.Title, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Description", oData.Description, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Url", oData.Url, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Type", oData.Type, Field.Store.YES, Field.Index.UN_TOKENIZED));
writer.AddDocument(doc);
}
writer.Optimize();
writer.Close();
}
catch (Exception ex) { }
}
}
}
the above way i create index. now i wrote the code for re-index the data. here is the code
lock (_lockObj)
{
try
{
IndexModifier modWriter = new IndexModifier(dir, new StandardAnalyzer(), true);
SearchData srch = new SearchData();
List<Data> data = srch.GetData();
foreach (var oData in data)
{
Document doc = new Document();
doc.Add(new Field("ID", oData.ID.ToString(), Field.Store.YES, Field.Index.UN_TOKENIZED));
doc.Add(new Field("Title", oData.Title, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Description", oData.Description, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Url", oData.Url, Field.Store.YES, Field.Index.TOKENIZED));
doc.Add(new Field("Type", oData.Type, Field.Store.YES, Field.Index.UN_TOKENIZED));
modWriter.DeleteDocuments(new Lucene.Net.Index.Term("ID", oData.ID.ToString()));
modWriter.DeleteDocuments(new Lucene.Net.Index.Term("Type", oData.Type));
modWriter.AddDocument(doc);
}
modWriter.Flush();
modWriter.Close();
}
catch (Exception ex) { }
}
the above routine i use to re-index and the code is working but i think this is not right way for re-indexing data.
why i said it is not right code for index because here i specify true in this line `IndexModifier modWriter = new IndexModifier(dir, new StandardAnalyzer(), true)`
which means create the index again....as a result the code i wrote which will create index again instead of update i think so. i need to modify index based on ID & type because my data would be unique based on ID & type. so that is why i add this line
modWriter.DeleteDocuments(new Lucene.Net.Index.Term("ID", oData.ID.ToString()));
modWriter.DeleteDocuments(new Lucene.Net.Index.Term("Type", oData.Type));
i am not good in lucene.net. so please guide me how could i modify index. the whole code running in my local pc. thanks
| 0 | [
2,
246,
161,
70,
26,
17579,
18515,
556,
9,
2328,
4348,
272,
5910,
800,
3726,
3726,
75,
4348,
68,
1054,
95,
123,
57,
20,
302,
8,
25671,
14,
1054,
185,
138,
318,
1054,
92,
44,
753,
9,
100,
31,
107,
52,
302,
8,
25671,
14,
753,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
in_array on objects with circular references
===
I'm building an array of objects. I need this array to only contain once instance of a given object, having multiple references to the same object should throw an exception. I'm using the following code to achieve this:
public function addField ($name, iface\Node $field)
{
// Prevent the same field being added multiple times
if (!in_array ($field, $this -> fields))
{
$this -> fields [$name] = $field;
$field -> setParent ($this);
}
else
{
throw new \InvalidArgumentException ('This field cannot be added to this group');
}
return ($this);
}
This started leading to problems when I started implementing the objects that implement the Node interface, as they can include circular references (they hold a collection of their child nodes, with each child holding a reference to its parent). Trying to add a field can result in the following error being generated:
> PHP Fatal error: Nesting level too deep - recursive dependency?
I suspect that PHP is trying to traverse the entire object array, rather than just comparing the object references to see if they hold the same value and therefore point to the same object.
What I need in_array to do is just compare the object references it stores with the object reference of field. This would prevent it trying to traverse the whole object tree and running into the recursion problem.
Is there a way of doing this? | 0 | [
2,
19,
1,
8576,
93,
27,
3916,
29,
8155,
7231,
800,
3726,
3726,
31,
22,
79,
353,
40,
7718,
16,
3916,
9,
31,
376,
48,
7718,
20,
104,
3717,
382,
4851,
16,
21,
504,
3095,
15,
452,
1886,
7231,
20,
14,
205,
3095,
378,
3814,
40,
53... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
WCF performance vs simple ASP.NET HttpHandler
===
**TL;DR ver** : WCF service behaves (although it seems configured for max throughput on HTTP) 4x slower than a naive ASP.NET handler implementation
---
Long explanation :
I was looking for an efficient way to transfer information fast in an intranet between two different physical machines (Named pipes gets out of question). My communication contract is composed of the following operations :
void SetUserAsState1(int id);
void SetUserAsState2(int id);
byte GetUserState(int id);
Pretty simple I'd say. I won't take into consideration security, reliability etc. Just sheer performance. And by performance I mean how many req/sec can be sent to the other machine.
I've done tests on my laptop on two scenarios :
* An ASP.NET empty website with a generic GetData.ashx handler which can be invoked like *http://localhost:1234/GetData.ashx?op=1&id=239* (IIS Express has been used)
* A WCF service hosted in IIS (Express) with basicHttpBinding
How did I test? I set up 10 threads and each thread would do 1000 requests to the target and measure the time taken to complete all 10x1000=10,000 requests.
Results?
* ASP.NET : 15 sec
* WCF : 60 sec
Test harness : (no, it's not production quality)
class Program
{
private static Service1Client _wcfProxy;
static void Main()
{
_wcfProxy = new Service1Client();
_wcfProxy.GetData(); // warm up proxy and service
_wcfProxy.GetData(); // make it really warm :P
var threads = new Thread[10];
for (var cnt = 0; cnt < 10; cnt++)
{
//var t = new ThreadStart(TestAspnetHandler); // scenario 1
var t = new ThreadStart(TestWcfService); // scenario 2
(threads[cnt] = new Thread(t)).Start();
}
var sw = Stopwatch.StartNew();
foreach (var thread in threads)
{
thread.Join();
}
sw.Stop();
Console.WriteLine("Done 10 x 1000 calls in " + sw.Elapsed);
Console.ReadLine();
}
private static void TestAspnetHandler()
{
var webClient = new WebClient();
for (var i = 0; i < 1000; i++)
{
webClient.DownloadData("http://localhost:1970/GetData.ashx?id=1");
}
}
private static void TestWcfService()
{
for (var i = 0; i < 1000; i++)
{
_wcfProxy.GetData();
}
}
}
ASP.NET implementation :
public class GetData : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
var id = context.Request.QueryString["id"];
if (string.IsNullOrEmpty(id))
{
context.Response.Write("Hello World");
}
else
{
var identifier = int.Parse(id);
context.Response.Write(identifier * 23);
}
}
public bool IsReusable { get { return true; } }
}
default 4.0 configuration, no changes
---
WCF contract :
[ServiceContract]
public interface IService1
{
[OperationContract]
int GetData();
}
and implementation
[ServiceBehavior(
ConcurrencyMode = ConcurrencyMode.Multiple,
InstanceContextMode = InstanceContextMode.Single)]
public class Service1 : IService1
{
public int GetData()
{
return 23;
}
}
and configuration :
<system.serviceModel>
<services>
<service behaviorConfiguration="beh" name="IService1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp"
contract="WcfService1.IService1" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttp" allowCookies="false" />
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="beh">
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentInstances="1000" maxConcurrentSessions="1000" />
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
---
**I've set the concurency mode to multiple (so they're not sync'ed), single service instantiation, throttling set to high values, dunno if/how can I speed up anymore the WCF service. Is there any change the WCF service will catch up to the ASP.NET one (implemented over HTTP, that is)?** | 0 | [
2,
11801,
410,
956,
4611,
1935,
28,
306,
9,
2328,
7775,
3203,
1252,
800,
3726,
3726,
13,
1409,
7786,
73,
3807,
2494,
1409,
13,
45,
11801,
410,
365,
14149,
18,
13,
5,
8655,
32,
2206,
28895,
26,
2049,
120,
4881,
27,
7775,
6,
268,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 UI Dialog buttons within an if statement
===
I have the following function, which brings up a menu of fish that can be bought within
.dialog({
title: "Fish Store",
resizable: true,
draggable: true,
modal: true,
buttons: {
"Beard Fish($30)": function() {
if (cash >= 30) {
fish1 =1;
fish1Swim1();
cash -= 30;
setNav();
$( this ).dialog( "close" );
}else { notEnoughCash(); }
},
"Clown Fish($50)": function() {
if (cash >= 50) {
fish2 = 1;
fish2Swim1();
cash -= 50;
setNav();
$( this ).dialog( "close" );
}else { notEnoughCash(); }
},
"Neon Fish($75)": function() {
if (cash >= 75) {
fish3 = 1;
fish3Swim1();
cash -= 75;
setNav();
$( this ).dialog( "close" );
}else { notEnoughCash(); }
}
}
});
I want to edit the function so that buttons can be turned on and off based on if variables (fish1, fish2, & fish3).
So I try to make the following change...
buttons: { if(fish1=0){
"Beard Fish($30)": function() {
if (cash >= 30) {
fish1 =1;
fish1Swim1();
cash -= 30;
setNav();
$( this ).dialog( "close" );
}else { notEnoughCash(); }
},}
but my text-edit says the syntax is invalid, how can I make this work? | 0 | [
2,
487,
8190,
93,
13,
5661,
28223,
12861,
363,
40,
100,
3331,
800,
3726,
3726,
31,
57,
14,
249,
1990,
15,
56,
7620,
71,
21,
11379,
16,
1968,
30,
92,
44,
2448,
363,
13,
9,
4286,
5567,
5,
1,
581,
45,
13,
7,
4934,
1718,
7,
15,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Execute failed: java.io.IOException: Cannot run program "jarsigner.exe": CreateProcess
===
I'm trying to run a buildXXX.xml file using ANT but i'm getting this error:
Buildfile: C:\Users\Amira\Desktop\SaloméTMF\Salome TMF
V3.1SourceCode\buildSOAPClient.xml
init:
prepare:
compile:
makesoapjar:
makeihmjar:
makecorejar:
makedatajar:
makeapijar:
makeloginjar:
maketoolsjar:
makeplugintoolsjar:
makeUpdatejar:
makebootjar:
makecodexjar:
makejar:
signjar:
[signjar] Signing JAR: C:\Users\Amira\Desktop\SaloméTMF\Salome TMF
V3.1SourceCode\distrib\salome_tmf-soap-client\activation.jar to
C:\Users\Amira\Desktop\SaloméTMF\Salome TMF V3.1SourceCode\distrib\salome_tmf-soap-
client\activation.jar as salome_tmf
BUILD FAILED
C:\Users\Amira\Desktop\SaloméTMF\Salome TMF V3.1SourceCode\buildSOAPClient.xml:251:
Execute failed: java.io.IOException: Cannot run program "jarsigner.exe": CreateProcess
error=2, Le fichier spécifié est introuvable
Total time: 5 seconds
I made a search so i found that i should use JDK instead of JRE so i change it but the same error persist.
Any idea will be appreciated
cheers | 0 | [
2,
15644,
1702,
45,
8247,
9,
1963,
9,
1963,
10066,
872,
45,
1967,
485,
625,
13,
7,
6300,
11255,
106,
9,
1706,
62,
7,
45,
1600,
16835,
800,
3726,
3726,
31,
22,
79,
749,
20,
485,
21,
1895,
13290,
9,
396,
8184,
3893,
568,
40,
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... |
PHP to SEARCH the Upper+Lower Case mixed Words in the strings?
===
Lets say there is a string like:
A quick Brown FOX called F. 4lvin
The WORDS I WANT TO SEARCH must have the following conditions:
- The words with MIXED Upper & Lower Case
- Containing only letters A to Z (e.g: No numbers, NO commas, NO full-stops, NO dash .. etc)
So suppose, when i search (for e.g in this string), the search result will be:
Brown
**Because it is the only word which contains both of Upper & Lower Case letters inside (and also containing only alphabets).<br><br>**
So how can I make it work in php? | 0 | [
2,
13,
26120,
20,
2122,
14,
1508,
2430,
17591,
610,
2198,
715,
19,
14,
7887,
60,
800,
3726,
3726,
6884,
395,
80,
25,
21,
3724,
101,
45,
21,
2231,
886,
2385,
227,
398,
9,
268,
255,
2511,
14,
715,
31,
259,
20,
2122,
491,
57,
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... |
XNA rectangle & contain, going to be crazy
===
I'm going to be crazy. In fact, i use Rectangle to know if a point if inside of a rectangle.
My rectangle is define like this : {X:0 Y:480 Width:480 Height:480}
The point (Vector2) is define like this : {X:283,3333 Y:141,1111}
Normaly, the point is inside of the rectangle ? But not...
if (rectangle.Contains(new Point((int)point.X, (int)point.Y)))
{
return true;
}
return false;
With another test, it work with the same code :
{X:-480 Y:0 Width:480 Height:480} contain {X:-12,22222 Y:12,22223}
Plz, i really need some advices.
Seriously, i don't understand why it don't works ! | 0 | [
2,
993,
325,
27181,
279,
3717,
15,
228,
20,
44,
3328,
800,
3726,
3726,
31,
22,
79,
228,
20,
44,
3328,
9,
19,
837,
15,
31,
275,
27181,
20,
143,
100,
21,
454,
100,
572,
16,
21,
27181,
9,
51,
27181,
25,
9267,
101,
48,
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... |
xml string parsed and handle as form
===
I have many problems in parsing and using parsers with Wikipedia,
but i have ended up with wikislurp parser tool,
with this tool i could read a wikipedia page as html,
What i want to do is:
I would have a checkbox before each link in this page ,
and handle all those checkbox`s , so if user check two boxes, then the form which should exist will redirect the user to the same page but first will calculate a trust value through another page which i already developed before.
So intotal my problem is,
with wikislurp i could get the wiki page as a string variable.
how can i use this string to build my form page which include that variable adding to it the checkboxes before each link.
then calculate the trust value and show it in the same page.
Thanks in advance.
| 0 | [
2,
23504,
3724,
2017,
18,
69,
17,
3053,
28,
505,
800,
3726,
3726,
31,
57,
151,
1716,
19,
2017,
18,
68,
17,
568,
2017,
18,
445,
29,
20169,
15,
47,
31,
57,
1272,
71,
29,
13,
17375,
18,
14130,
306,
2017,
4104,
5607,
15,
29,
48,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to select whole row depending on choosing highest 2 values of columns
===
how to select whole row depending on choosing highest 2 values of columns like i got a voting system and i got 2 columns per user which is avg vote and total number of ppl who voted. my problem now that i want to know how to grab the row or all info of the user depending on looking for the user that got the highest avg vote and total. not just highest in one of them. like if a the highest user got 100 total votes but not the highest avg votes value it looks for the second highest value that got also the highest avg vogte value. is that possible by any mean? | 0 | [
2,
184,
20,
5407,
979,
3131,
4758,
27,
10883,
1554,
172,
4070,
16,
7498,
800,
3726,
3726,
184,
20,
5407,
979,
3131,
4758,
27,
10883,
1554,
172,
4070,
16,
7498,
101,
31,
330,
21,
5880,
329,
17,
31,
330,
172,
7498,
416,
4155,
56,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
jqueryui- drop inside a draggable/droppable - dropped elements moves alongwith droppable
===
I need to drop a draggable inside another draggable.
Thereafter, if I drag the droppable, the elements already dropped inside that droppable should also move along with.
Similarly if I move the draggable outside the droppable, it's movement should become independent.
I was moderately successful in this by appending the dragged element to the droppable to make it nested, however the position of the dragged elements went haywire (http://jsfiddle.net/sandeepy02/kTAL3/41/). The relevant code is:
.droppable({
drop: function(event, ui) {
$(this).append(ui.draggable);
},
out: function(event, ui) {
$("#boundaryContainer").append(ui.draggable);
}
Thanks in advance. | 0 | [
2,
487,
2005,
11867,
49,
8,
2804,
572,
21,
5501,
263,
579,
118,
12361,
306,
579,
13,
8,
1539,
2065,
4927,
303,
1410,
2804,
306,
579,
800,
3726,
3726,
31,
376,
20,
2804,
21,
5501,
263,
579,
572,
226,
5501,
263,
579,
9,
6045,
15,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Play a video file from a Virtual URL
===
I'm having a hard time trying to play a video from a Virtual URL on a Website.
I cannot link directly to the video as the actual files not located anywhere under the web-accessible root. And, the virtual path is actually an HTTP Handler (ASP.Net "ASHX") used for additional permission checks and such.
I was trying to set up video access (using JWPlayer, but didn't get to that point),
The ASHX handler I had in the beginning was simply transmitting the file as a download,
using HTTP Header: `content-disposition: attachment; filename=example.mp4`
When I compared the behavior of the browser (Chrome 20.0.1132.57) between browsing a direct link .mp4 file vs. the virtual link - I noticed that the direct link makes opens up in a small embedded video player, where as the virtual link only downloads the file.
I have tried (and failed) capturing the difference of HTTP Headers (using Fiddler) and writing a special ASHX for videos - that would send exactly the same response as the IIS does (without any specific config for mp4, not even a mime-type).
I can't seem to get chrome to open the video from the virtual url like it does from the direct link, even if I emulate all headers (at least, to the best of my understanding).
I tried sending the right `Content-Type & Content-Length`, using the `Accept-Ranges & Content-Range` headers, even tried to emulate a two-phase request when the first one doesn't have `video/mp4` or `*/*` in the `Accept` header (I've also tried sending only 1 byte on the first response / sending the whole video on both responses).
(When I say all these values were "right" I mean that they were identical to the working response that I captured in Fiddler...)
Please, can somebody explain what triggers the browser to treat the file as a video?
What headers do I need to specify/omit ?
(besides omitting `content-disposition: attachment` of course...)
Thanks a lot in advance,
Roman Himmelreich | 0 | [
2,
418,
21,
763,
3893,
37,
21,
6599,
287,
6362,
800,
3726,
3726,
31,
22,
79,
452,
21,
552,
85,
749,
20,
418,
21,
763,
37,
21,
6599,
287,
6362,
27,
21,
2271,
9,
31,
1967,
3508,
1703,
20,
14,
763,
28,
14,
3463,
6488,
52,
335,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 nib view from UIBatButtonItem?
===
So I've seen previous questions similar to this but they were of no help. I've read Apple's documentation too but I could not understand where I've gone wrong. AFAIK I did everything logically, but when I click on my done button on an UItoolbar overlay, the button can be pushed but it does not do anything. This obviously means it fails to acknowledge the written code. But how?
I want to bring up the .nib of "TableViewController" when a done button is clicked on my UIToolBar. But the below isn't allowing the click to bring up a new view. How do I rectify this? Please show me where I went wrong and what should be replaced and why.
//Here's the selector:
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemDone target:self action:@selector(doneButtonPressed)];
Here's how I made my action.
-(void)doneButtonPressed {
TableViewController *tableView = [[TableViewController alloc]
initWithNibName:@"TableViewController" bundle:nil];
tableView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:tableView animated:YES];
}
//Yet nothing happens when I click on my done button on my overlay. The button can be clicked, but nothing happens. Please shed any insight pleasee!
| 0 | [
2,
2936,
1781,
220,
1418,
37,
13,
5661,
4900,
811,
444,
2119,
79,
60,
800,
3726,
3726,
86,
31,
22,
195,
541,
1158,
2346,
835,
20,
48,
47,
59,
46,
16,
90,
448,
9,
31,
22,
195,
1302,
4037,
22,
18,
13945,
266,
47,
31,
110,
52,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Reassigning member variables of a struct through properties
===
So I have a struct that is defined in the following manner:
public struct Item
{
public string _name { get; set; }
public double _weight
{
get
{
return _weight;
}
set
{
_weight = value;
//Shipping cost is 100% dependent on weight. Recalculate it now.
_shippingCost = 3.25m * (decimal)_weight;
//Retail price is partially dependent on shipping cost and thus on weight as well. Make sure retail price stays up to date.
_retailPrice = 1.7m * _wholesalePrice * _shippingCost;
}
}
public decimal _wholesalePrice
{
get
{
return _wholesalePrice;
}
set
{
//Retail price is partially determined by wholesale price. Make sure retail price stays up to date.
_retailPrice = 1.7m * _wholesalePrice * _shippingCost;
}
}
public int _quantity { get; set; }
public decimal _shippingCost { get; private set; }
public decimal _retailPrice { get; private set; }
public Item(string name, double weight, decimal wholesalePrice, int quantity) : this()
{
_name = name;
_weight = weight;
_wholesalePrice = wholesalePrice;
_quantity = quantity;
}
//More stuff
I also have an instance of Item in a different class. When I try to invoke the weight property through the following command, the program crashes:
currentUIItem._weight = formattedWeight;
A descriptive error is not provided. Note that at this point, currentUIItem has been newed with the parameterless default constructor. Now, here is the weird part. When I remove the custom implementation of weight's set property and replace it with a generic { get; set; }, the assignment works flawlessly.
Does anyone know what's going on here? Is this a quirk of structs that would work fine with classes? | 0 | [
2,
302,
472,
11255,
68,
322,
12157,
16,
21,
13,
10346,
120,
3704,
800,
3726,
3726,
86,
31,
57,
21,
13,
10346,
30,
25,
2811,
19,
14,
249,
3832,
45,
317,
13,
10346,
9101,
13,
1,
317,
3724,
13,
1,
7259,
13,
1,
164,
73,
309,
73,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
HTML5 FileList empty in FireFox
===
I'm writing this HTML5 music player that works by dragging music files onto it. (will soon use WebRTC too)
http://pepijndevos.nl/KjuMusic/
It works in Chrome, it used to work in Firefox, and still does on a friends Mac.
However, on my Xubuntu laptop, both with the default and the nightly Firefox, I get
FileList { length=0, item=item()}
when dropping one or more files. I'm not even sure anymore if this is a bug in my code, Firefox, or somewhere else in xfce. | 0 | [
2,
13,
15895,
264,
3893,
5739,
2424,
19,
535,
18219,
800,
3726,
3726,
31,
22,
79,
1174,
48,
13,
15895,
264,
232,
517,
30,
693,
34,
13052,
232,
6488,
1204,
32,
9,
13,
5,
5580,
651,
275,
2741,
5256,
150,
266,
6,
7775,
6903,
1664,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 Torrent tracker with only webseed
===
I need to implement folder downloading from server. For this purpose i want to develop a torrent tracker that uses web seeds only.
When i generate the torrent file for one file it works without any problems, but if i add several web seeds (one webseed per file in a folder) it doesnt work.
I use Torrent LW library.
This is the code i use to generate torrent file:
$links_list = array("links for downloading files");
$files = array('path to folder on server');
$torrent = new Torrent($files, 'http://xxx/index.php/tracker/announce');
$torrent->url_list($links_list);
if (!$error = $torrent->error()) // error method return the last error message
$torrent->save("aaa.torrent"); // save to disk
else
echo $error;
Could anybody help me? | 0 | [
2,
13,
26120,
23078,
792,
106,
29,
104,
2741,
870,
69,
800,
3726,
3726,
31,
376,
20,
8713,
19294,
7121,
68,
37,
8128,
9,
26,
48,
2131,
31,
259,
20,
2803,
21,
23078,
792,
106,
30,
2027,
2741,
7945,
104,
9,
76,
31,
7920,
14,
230... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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 pack/unpack float in big endian byte order
===
How can I pack/unpack floats in big endian byte order with php?
I got this far with an unpack function, but I'm not sure if this would even work.
function unpackFloat ($float) {
$n = unpack ('Nn');
$n = $n['n'];
$sign = ($n >> 31);
$exponent = ($n >> 23) & 0xFF;
$fraction = $n & 0x7FFFFF;
} | 0 | [
2,
13,
26120,
3607,
118,
1020,
8573,
11510,
19,
580,
241,
806,
34,
591,
389,
800,
3726,
3726,
184,
92,
31,
3607,
118,
1020,
8573,
11510,
18,
19,
580,
241,
806,
34,
591,
389,
29,
13,
26120,
60,
31,
330,
48,
463,
29,
40,
367,
85... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Using temporary variables in a for loop
===
I am writing a function that shuffles the item in an array:
this.shuffle = function () {
...
First, I get the two halves of the array and set up a third empty array:
this.leftHalf = this.cards.slice(0, this.size() / 2);
this.rightHalf = this.cards.slice(this.size() / 2);
this.result = [];
Next, I put one card from each half into the result array:
for (var i = ...) {
this.result.unshift(this.leftHalf[i]);
this.result.unshift(this.rightHalf[i]);
}
Last, I assign the result array to my original array and delete the "temporary" variables:
this.cards = this.result;
delete this.leftHalf;
delete this.rightHalf;
delete this.result;
}
My question: Is this a sensible way to approach this problem, or is there a better way that doesn't involve setting up temporary variables? I thought about using private variables instead (but wasn't sure if it would be any better performance wise) like so:
var leftHalf, rightHalf, result;
this.shuffle = function () {
leftHalf = ...
Just curious if there was anything obvious I'm doing wrong or if there's a best practice in these cases. | 0 | [
2,
568,
4700,
12157,
19,
21,
26,
5293,
800,
3726,
3726,
31,
589,
1174,
21,
1990,
30,
23682,
18,
14,
9101,
19,
40,
7718,
45,
48,
9,
1635,
5386,
413,
800,
1990,
13,
5,
6,
13,
1,
13,
9,
9,
9,
64,
15,
31,
164,
14,
81,
26319,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Auto increment an id over multiple models (model-in-between?)
===
I am writing my first rails app that's based on mongoid and have a question about how to best implement a certain situation.
I have multiple models that share a id field. That id field is used within the system to uniquely identify an object across those multiple models. Using ActiveRecord I've had a model "ABC" that each model belongs_to. Every time I created an object I also created the associated ABC object in an after_create filter. So I could search for an ABC id and got either a customer or a partner or anything else that was associated with that ABC wrapper object.
Now, using mongodb / mongoid, I'm searching for the best way to replicate this behavior.
My first idea was to have that abc_id in each of my models directly, not using any type of wrapper object for it at all. The idea was to auto-increment this id using mongoid_auto_increment. But I assume that's not possible, because I am speaking of multiple models sharing the same auto-increment value. Don't think that's possible.
Would it be suitable to use a wrapper model as in ActiveRecord once again? How would you build the relationship to it - keeping in mind that I have to search for an id across all available models? Would I just create a totally separated model again or is it better to nest it in some way in my models? Would I still be able to search across all models when nesting it?
How would you solve this problem?
Thanks in advance
Arne | 0 | [
2,
3108,
13,
28461,
40,
4924,
84,
1886,
2761,
13,
5,
13998,
8,
108,
8,
14427,
60,
6,
800,
3726,
3726,
31,
589,
1174,
51,
64,
2240,
18,
4865,
30,
22,
18,
432,
27,
21028,
6516,
17,
57,
21,
1301,
88,
184,
20,
246,
8713,
21,
120... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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... |
Free Transform Anrdoid Image
===
I would like to free transform an android image. I have gotten comfortable using a matrix to skew a bitmap see below **(Just imagine the red shape is replaced with a bitmap or jpeg image)**:
![enter image description here][1]
**What I want to do is be able to free transform the image. So for example only move 1 corner and have the other corners stay in the same location. If someone, could tell me an effective way of doing that it would help.**
Is there some sort of matrix math that I would need to do to do this. If so even a link would help.
Thanks
[1]: http://i.stack.imgur.com/Yoyhc.png | 0 | [
2,
551,
8007,
40,
897,
6516,
1961,
800,
3726,
3726,
31,
83,
101,
20,
551,
8007,
40,
13005,
1961,
9,
31,
57,
4094,
5733,
568,
21,
8187,
20,
13,
5835,
499,
21,
1142,
15022,
196,
1021,
13,
1409,
5,
2759,
4382,
14,
402,
2539,
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... |
Updateresource and RT_CURSOR/RT_ANICURSOR
===
I have been reading up on BeginUpdaterResource, UpdateResource, EndUpdateResource, FindResource etc. I have googled for updating cursors in an exe and I have found samples and examples for changing an exe's icon, updating bmp's and RT_RCDATA but nothing regarding cursors and anicursors. Does anyone know of examples, samples or information regarding RT_CURSOR and/or RT_ANICURSOR?
Thanks
Eric | 0 | [
2,
11100,
99,
12097,
17,
13,
5256,
1,
4734,
18,
248,
118,
5256,
1,
3443,
4734,
18,
248,
800,
3726,
3726,
31,
57,
74,
1876,
71,
27,
2348,
576,
593,
815,
99,
12097,
15,
11100,
99,
12097,
15,
241,
576,
8209,
99,
12097,
15,
477,
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... |
Not able to open graphical editor view in android ADT 16.0.0
===
Went through many posts I found on the graphical editor problem I am facing. Not able to get an answer. Here is the issue
I am using Android ADT 16.0.0 and I am able to open the graphical editor but not able to see the user interface view. The app on the whole builds and works fine on the simulator. It is annooying to use only XML editor.
I installed this environment by copying the SDK, ADT plugins separately from a successful installtion. It looks as though something related to the Android Layout Editor is missing. The error thrown is
java.lang.NullPointerException
at android.graphics.Paint_Delegate.updateFontObject(Paint_Delegate.java:1053)
at android.graphics.Paint_Delegate.reset(Paint_Delegate.java:1039)
at android.graphics.Paint_Delegate.<init>(Paint_Delegate.java:991)
at android.graphics.Paint_Delegate.native_init(Paint_Delegate.java:614)
at android.graphics.Paint.native_init(Paint.java)
at android.graphics.Paint.<init>(Paint.java:194)
at android.graphics.Paint.<init>(Paint.java:184)
at android.view.ViewGroup.<init>(ViewGroup.java:278)
at android.widget.LinearLayout.<init>(LinearLayout.java:116)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:227)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:318)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1323)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1077)
at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart$ConfigListener.onConfigurationChange(GraphicalEditorPart.java:497)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onDeviceConfigChange(ConfigurationComposite.java:2119)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.access$7(ConfigurationComposite.java:2111)
at com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite$5.widgetSelected(ConfigurationComposite.java:480)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
First look I guessed the layout editor files were missing. Any thougths on how to get around it??
| 0 | [
2,
52,
777,
20,
368,
21755,
1835,
1418,
19,
13005,
21,
43,
38,
347,
9,
387,
9,
387,
800,
3726,
3726,
296,
120,
151,
9868,
31,
216,
27,
14,
21755,
1835,
1448,
31,
589,
4325,
9,
52,
777,
20,
164,
40,
1623,
9,
235,
25,
14,
1513... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.