unified_texts stringlengths 32 30.1k | OpenStatus_id int64 0 4 | input_ids list | token_type_ids list | attention_mask list |
|---|---|---|---|---|
Drupal 7 - values added in hook_node_load not making its way to webform
===
I'm using hook_node_load to try and add some fields to a webform node. Here's the code:
function custom_node_load($nodes, $types)
{
foreach ($nodes as $node) {
if ($node->nid == '37') {
if (isset($_GET['departure'])) {
$node->departure_base_price = 'myValue';
drupal_set_message('Departure Base Price: ' . $node->departure_base_price);
//Have also tried $nodes[$node->nid]->departure_base_price
}
}
}
}
The drupal_set_message sets the message with the value properly. However, trying to access the value $node->departure_base_price in webform-form-37.tpl.php, it's not there (trying to access both in the tpl.php file and looking at Devel).
I've also tried setting $node->departure_base_price=NULL at the start of the function, thinking it might be a scope issue. In this case, the field made it to the tpl.php file, but it remained null (even though I had updated the value in hook_node_load).
What am I missing? | 0 | [
2,
15708,
6720,
453,
13,
8,
4070,
905,
19,
5559,
1,
251,
546,
1,
8294,
52,
544,
82,
161,
20,
2741,
4190,
800,
3726,
3726,
31,
22,
79,
568,
5559,
1,
251,
546,
1,
8294,
20,
1131,
17,
3547,
109,
2861,
20,
21,
2741,
4190,
15421,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 a custom color in itext?
===
Thanks for taking the time to answer my question.
I'm generating a PDF document using iText in Java. I need to set the column headers of a table a different colour than the ones in the values columns. I have the color hexadecimal value from Photoshop. I'm using PdfPTable with chunks and paragraphs. how do I set them to a different colour, other than the ones predefined in the BaseColor enum?
Thanks in advance! | 0 | [
2,
184,
20,
309,
21,
5816,
1665,
19,
31,
11969,
60,
800,
3726,
3726,
3669,
26,
741,
14,
85,
20,
1623,
51,
1301,
9,
31,
22,
79,
13500,
21,
13,
11124,
4492,
568,
31,
11969,
19,
8247,
9,
31,
376,
20,
309,
14,
4698,
157,
445,
16... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Eclipse CDT Autocomplete not working
===
I remember from some time ago that Eclipse had autocomplete when you type, and now I can only get it when pressing CTRL+Space. I already checked and don't have any unresolved dependencies, I can see all the autocomplete choices when pressing CTRL+Space, but that's not something i like to do everytime... Can someone point me in the direction to get autocomplete back? (Using CDT C++) | 0 | [
2,
11652,
1745,
38,
3108,
15990,
52,
638,
800,
3726,
3726,
31,
1518,
37,
109,
85,
1464,
30,
11652,
41,
3108,
15990,
76,
42,
1001,
15,
17,
130,
31,
92,
104,
164,
32,
76,
7196,
13,
4812,
6362,
2430,
5582,
9,
31,
614,
6505,
17,
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... |
C++ Converting from String^ to String*
===
I'm currently having a small issue which i thought would be easy, but not, so,(maybe it is easy, but i don't know) i need to convert a String^ into a String^* so basically a string pointer, small snippet of code:
ARPLC_command_byuser = textBox1->Text;
I've already tried various of methods, but all seem to fail(well, they don't, i do).
If you have any idea, please tell me what to do.
Thank you. | 0 | [
2,
272,
20512,
19583,
37,
3724,
1,
20,
3724,
2483,
800,
3726,
3726,
31,
22,
79,
871,
452,
21,
284,
1513,
56,
31,
289,
83,
44,
2010,
15,
47,
52,
15,
86,
15,
5,
5138,
32,
25,
2010,
15,
47,
31,
221,
22,
38,
143,
6,
31,
376,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 Case statement in Where clause
===
In my query I have the following condition
left Join Table2 on Table2.Id = Table1.Id and Table2.status in ('Close', 'Open')
And the above condition gives me 2 extra rows because of the left join. I noticed that if I have only either Close or Open in the condition it returns the correct number of rows.
To fix that I was trying to write something like this
And Table2.status = (Case Table2.status
WHEN 'Open' Then 'Open'
When 'Close' Then 'Close'
End )
But this still returns 2 extra rows. Any suggestions on how to fix this??
| 0 | [
2,
568,
610,
3331,
19,
113,
9040,
800,
3726,
3726,
19,
51,
25597,
31,
57,
14,
249,
2874,
225,
1865,
859,
135,
27,
859,
135,
9,
1340,
800,
859,
165,
9,
1340,
17,
859,
135,
9,
10631,
267,
19,
13,
5,
22,
14330,
22,
15,
13,
22,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
ListView and ContextMenu
===
Is it possible to implements working with context menu inside ListView class? It is no onContextItemSelected() method here. I don't want write a code with context menu inside Activity class.
Thank you! | 0 | [
2,
968,
4725,
17,
4141,
755,
291,
800,
3726,
3726,
25,
32,
938,
20,
8713,
18,
638,
29,
4141,
11379,
572,
968,
4725,
718,
60,
32,
25,
90,
27,
1126,
11969,
2119,
79,
18,
7138,
5,
6,
2109,
235,
9,
31,
221,
22,
38,
259,
2757,
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,
0,
0,
0,
0,
0... |
When would ServletRequest.getRemoteAddr return IPv6
===
I am making an API call and that call requires Request IP address.
I am using ServletRequest.getRemoteAddr() to get the IP of the request.
For one user, getRemoteAddr() is returning IPv6 rather than IPv4 why is this??
From my understanding, IPv6 is extension to the IPv4, where users can choose to use IPv6
rather than IPv4. Does this means user or user's ISP is using IPv6? How does this work....
Thanks. | 0 | [
2,
76,
83,
13,
10321,
1336,
99,
10351,
9,
3060,
99,
20209,
14854,
139,
788,
31,
10166,
379,
800,
3726,
3726,
31,
589,
544,
40,
21,
2159,
645,
17,
30,
645,
4781,
3772,
15735,
3218,
9,
31,
589,
568,
13,
10321,
1336,
99,
10351,
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 can I get the mouse coordinates related to a panel?
===
I am trying to get the coordinates of a click with the mouse in C# related to a panel in my form, but I don't know how to do that. I'm a begginer and I don't have any experience with events. Thanks! | 0 | [
2,
184,
92,
31,
164,
14,
7567,
13714,
1597,
20,
21,
4113,
60,
800,
3726,
3726,
31,
589,
749,
20,
164,
14,
13714,
16,
21,
10840,
29,
14,
7567,
19,
272,
5910,
1597,
20,
21,
4113,
19,
51,
505,
15,
47,
31,
221,
22,
38,
143,
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... |
ksort-ing an array of array using array_walk in PHP?
===
How can apply `ksort` to each element of `$counts` array? I mean simply **call this function on each nested array**, not recursively.
bool array_walk(array &$array, callable $funcname [,mixed $userdata = NULL])
I've tried `array_walk` passing the flag `SORT_NUMERIC` as user data. This gives me **a warning**:
$counts = array();
$counts['group1'] = array(); // Keys are timestamps but as STRING
$counts['group2'] = array(); // Keys are timestamps but as STRING
// ...
// Array + operator does a key reordering here
$counts['group1'] += $dummyData;
$counts['group2'] += $dummyData;
// .. so sort array by keys
array_walk($counts, 'ksort', SORT_NUMERIC);
> Warning: ksort() expects at most 2 parameters, 3 given.
What's the **third parameter**? | 0 | [
2,
680,
22843,
8,
68,
40,
7718,
16,
7718,
568,
7718,
1,
10915,
19,
13,
26120,
60,
800,
3726,
3726,
184,
92,
5645,
13,
1,
197,
22843,
1,
20,
206,
4520,
16,
13,
1,
4403,
16549,
18,
1,
7718,
60,
31,
884,
1659,
13,
1409,
9200,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Schema Comparison and Update without the updating of Data
===
i am using sql server as my master database and want an automated copy of its schema to another without updating the data .. Just scheme from one server to another automatically with out any third party tool. i have gone through the replication precess but cant find how to stop the data replication plxx help me regarding this asap..
Regards,
Rafay Pervaiz. | 0 | [
2,
23874,
6050,
17,
11100,
366,
14,
71,
43,
1880,
16,
1054,
800,
3726,
3726,
31,
589,
568,
4444,
255,
8128,
28,
51,
1129,
6018,
17,
259,
40,
14904,
4344,
16,
82,
23874,
20,
226,
366,
71,
43,
1880,
14,
1054,
13,
9,
9,
114,
4276... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Batch file loop ends after if statement
===
I am trying to create a batch file which runs other batch files in a loop depending on a variable, however after the first batch file execution, the 'master' batch file also ends.
What am i missing ?
:loop
if %variable% ==5 (bat1.bat) else (bat2.bat)
goto loop | 0 | [
2,
13064,
3893,
5293,
3451,
75,
100,
3331,
800,
3726,
3726,
31,
589,
749,
20,
1600,
21,
13064,
3893,
56,
1461,
89,
13064,
6488,
19,
21,
5293,
4758,
27,
21,
7612,
15,
207,
75,
14,
64,
13064,
3893,
5769,
15,
14,
13,
22,
4594,
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... |
why is mysqli_fetch_array is seperating the array?
===
I am retreiving values from a mySQL database and am populating them to radio buttons for the user to pick. These are wrapped in a div with the question that is also populated dynamically. For some reason it populates all the associated answers with the question but the second through fourth answers seem to be seperated from the first answer theres a break only with the first question any idea what would cause this? The following is the code to generate what I am doing:
// Connect to the Database
require_once('mysqli_connect.php');
//create the query for the question
$q = "SELECT `Question` FROM tbl_Question WHERE QuestionID = 1";
//Create the query for the Answers
$q2 = "SELECT `Answer`,`AnswerStatusID` FROM tbl_Answer WHERE QuestionID = 1";
//Run the query
$r = mysqli_query($conn,$q);
//run the answer quert
$r2 = mysqli_query($conn,$q2);
//Assign the AnswerStatusID to a var
$AnswerStatusID[] = $row2['AnswerStatusID'];
while($row = mysqli_fetch_array($r,MYSQLI_ASSOC)){
echo '<div id="Question1"><p>1)' . $row['Question'] . '</p>';
}
while($row2 = mysqli_fetch_array($r2,MYSQLI_ASSOC)){
echo '<input name="q1" type="radio"value="'.$AnswerStatusID.'"/>' . $row2['Answer'] . '</div><br/>';
}
| 0 | [
2,
483,
25,
51,
18,
1251,
1210,
1,
410,
19913,
1,
8576,
93,
25,
10332,
106,
1880,
14,
7718,
60,
800,
3726,
3726,
31,
589,
13,
6239,
99,
3757,
68,
4070,
37,
21,
51,
18,
22402,
6018,
17,
589,
1675,
10038,
105,
20,
603,
12861,
26... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to rotate JXImageview
===
This sounds a little bit stupid ;), but I want to rotate the JXImageview, but the method getRotateCounterClockwiseAction() is deprecated and does nothing...(have i got the wrong version?! i have swingx all 1.6.3).
My code:
PictureRotate1Button.addActionListener(new ActionListener() {
@SuppressWarnings("deprecation")
@Override
public void actionPerformed(ActionEvent arg0) {
imageView.getRotateCounterClockwiseAction();
}
});
What is the "right" method to rotate the image(or a workaround?)? I didn´t find one.... | 0 | [
2,
184,
20,
21448,
487,
396,
22039,
4725,
800,
3726,
3726,
48,
2795,
21,
265,
1142,
3553,
13,
73,
6,
15,
47,
31,
259,
20,
21448,
14,
487,
396,
22039,
4725,
15,
47,
14,
2109,
164,
11699,
1373,
24416,
21767,
8645,
5,
6,
25,
121,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
JavaFX TableView copy to clipboard
===
Is it possible to allow a user to select rows and copy from a TableView? | 0 | [
2,
8247,
16488,
859,
4725,
4344,
20,
12229,
2806,
800,
3726,
3726,
25,
32,
938,
20,
1655,
21,
4155,
20,
5407,
11295,
17,
4344,
37,
21,
859,
4725,
60,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
How do I ship files into eclipse java plugin in order to reuse them once the plugin is deployed
===
I am developping an eclipse plugin that uses external jars and images. I want to ship them into my plugin jar so that when the plugin is deployed in eclipse I can use them.
My question is : Where should I put those external files in my plugin project and how should I refer to them in order to have access to them.
I have already try to reference my files like this (the folder in which my files are located is CESSAOAuthInterceptors):
Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID);
Path path = new Path("CESSAOAuthInterceptors");
URL fileURL = FileLocator.find(bundle, path, null);
But when the plugin is installed in the dropin folder of eclipse I cannot access my directory anymore.
Any suggestion on how to reference my folder in a way that I can find it wherever my plugin is installed would be really helpful, thx
Yann | 0 | [
2,
184,
107,
31,
995,
6488,
77,
11652,
8247,
10922,
108,
19,
389,
20,
302,
3699,
105,
382,
14,
10922,
108,
25,
6698,
800,
3726,
3726,
31,
589,
2803,
3181,
40,
11652,
10922,
108,
30,
2027,
4886,
5112,
18,
17,
3502,
9,
31,
259,
20... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Getting SciPy quantiles to match Stata `xtile` function
===
I've inherited some old Stata code (Stata11) that uses the `xtile` function to categorize observations in a vector by their quantile (in this case, just the standard 5 quintiles, 20%, 40%, 60%, 80%, 100%).
I'm trying to replicate a piece of the code in Python and I am using the SciPy.stats.mstats function `mquantiles()` for the computation.
As near as I can tell from Stata documentation and searching online, the Stata `xtile` method tries to invert the empirical CDF of the data, and uses the equal-weighted average of all observations for which the CDF is flat to make the cutpoint. This seems like a very poor way to categorize quantiles, but it is what it is and I am sure there are cases where this is the right thing to do.
My question is how to make `mquantiles()` produce the same sort of breaking convention. I noticed that this function has two parameters, `alphap` and `betap` (the documentation calls them `alpha` and `beta` but you need the extra 'p' to get it to work, at least I do... I get an error if I just use 'alpha' and 'beta' with Enthought Python 2.7.1 and SciPy 0.10.0). But even in the SciPy docs, I can't see whether there's a combination of these parameters that produces the mean over flat CDF ranges.
I see what looks like the option to compute as the median or mode of this range, but not mean (it's also not clear if these SciPy median/mode options with alpha and beta are computed as the median/mode of the *observations* or of the range that would produce the flat CDF value.)
Any help disambiguating these different options and finding some documentation that helps me recreate the Stata convention in Python would be great. Please refrain from answers that just say "write your own quantile function." Firstly, that doesn't help me understand the conventions of either Stata or SciPy, and secondly, given these numerical libraries, writing my own quantile function should be a last resort. I can certainly do it, but it would be bad all around if I need to. | 0 | [
2,
1017,
9569,
6448,
9836,
9802,
18,
20,
730,
12819,
58,
13,
1,
396,
9802,
1,
1990,
800,
3726,
3726,
31,
22,
195,
7179,
109,
315,
12819,
58,
1797,
13,
5,
10631,
58,
1306,
6,
30,
2027,
14,
13,
1,
396,
9802,
1,
1990,
20,
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... |
Hashing (with salts) Username and Password in php
===
I am creating a user login function but I've seen mixed views on the best way to do this.
Here's what I was thinking of doing...
- Hashing the Username using 2 salts which are based on substrings of
the username.
- Hashing the password using 2 randomly generated salts which are held in a
table with the password and username.
Is this overkill, wrong, or even not secure enough?? | 0 | [
2,
19170,
68,
13,
5,
1410,
2693,
18,
6,
4155,
7259,
17,
20884,
19,
13,
26120,
800,
3726,
3726,
31,
589,
2936,
21,
4155,
6738,
108,
1990,
47,
31,
22,
195,
541,
2198,
4146,
27,
14,
246,
161,
20,
107,
48,
9,
235,
22,
18,
98,
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... |
mysqli DB connect scope?
===
I'm trying to use prepared statements to insert data into a database, from within a function.
The following works great when called from outside the file:
function insert($value1, $value2)
{
$mysqli = new mysqli("localhost", "***", "***", "***");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
if ($stmt = $mysqli->prepare("INSERT INTO table (col1, col2) values (?, ?)")) {
$stmt->bind_param('ss', $value1, $value2);
$stmt->execute();
}
}
However I want to move the connect string outside of the function, which results in scope issues. I've read that I need a class to do this, can anyone EXPLAIN an example please?
Thanks | 0 | [
2,
51,
18,
1251,
1210,
13,
9007,
6379,
9914,
60,
800,
3726,
3726,
31,
22,
79,
749,
20,
275,
3268,
9015,
20,
14692,
1054,
77,
21,
6018,
15,
37,
363,
21,
1990,
9,
14,
249,
693,
374,
76,
227,
37,
719,
14,
3893,
45,
1990,
14692,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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: RegExp not working no matter what my expression is
===
Ok, I've been using RegExp a number of times but for some reason I cannot get it to work this time. I am trying to test for latitude (0 to +/- 90 degrees). No matter what expression I use, it always returns false. Here's my code:
var regexLatitude = new RegExp("^-?([1-8]?[0-9]\.{1}\d{1,6}$|90\.{1}0{1,6}$)");
var status = regexLatitude.test("89.5");
I also tried without quotes:
var status = regexLatitude.test(89.5);
Any idea? | 0 | [
2,
8247,
8741,
45,
7953,
6899,
52,
638,
90,
1161,
98,
51,
1803,
25,
800,
3726,
3726,
5854,
15,
31,
22,
195,
74,
568,
7953,
6899,
21,
234,
16,
436,
47,
26,
109,
1215,
31,
1967,
164,
32,
20,
170,
48,
85,
9,
31,
589,
749,
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... |
Twitter:send direct message using scribe
===
Here is my code to send send direct message using scribe. But it gives me null response.Here is my code`
OAuthRequest req;
OAuthService s;
s = new ServiceBuilder()
.provider(TwitterApi.class)
.apiKey(APIKEY)
.apiSecret(APISECRET)
.callback(CALLBACK)
.build();
req = new OAuthRequest(Verb.POST, "https://api.twitter.com/1/direct_messages /new.format?user_id="+user_id+"&text=loco test");
s.signRequest(MyTwitteraccesToken, req);
Response response = req.send();
if (response.getBody() != null) {
String t=response.getBody();
Log.w("twittersent","twittersent"+t);
}
Can anybody help me ? | 0 | [
2,
10623,
45,
18,
2451,
1744,
2802,
568,
13,
12543,
800,
3726,
3726,
235,
25,
51,
1797,
20,
2660,
2660,
1744,
2802,
568,
13,
12543,
9,
47,
32,
2352,
55,
16203,
1627,
9,
6836,
25,
51,
1797,
1,
635,
1346,
96,
99,
10351,
302,
1251,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
phonegap tabbar plugin cannot change page
===
I used PhoneGap NativeControls Plugins created a ios Tabbar, when I click a tabbar, it didn't change the view to the correspond html, following is my code, thanks for any help.
these functions is used to change pageview:
function showFirstPage()
{
window.location.href = 'firstTab.html';
}
function showSecondPage()
{
window.location.href = 'secondTab.html';
}
function showThirdPage()
{
window.location.href = 'thirdTab.html';
}
function showFourthPage()
{
window.location.href = 'fourthTab.html';
}
function showFifthPage()
{
window.location.href = 'fifthTab.html';
}
create a tabbar:
function onBodyLoad()
{
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady() {
// Initializating TabBar
nativeControls = window.plugins.nativeControls;
nativeControls.createTabBar();
// 首页
nativeControls.createTabBarItem(
"firstTab",
"首页",
"/www/tabs/tabbar1.png",
{"onSelect": function() {
//console.log("firstTab");
showFirstPage();
}}
);
// 版块
nativeControls.createTabBarItem(
"secondTab",
"版块",
"/www/tabs/tabbar2.png",
{"onSelect": function() {
//console.log("secondTab");
showSecondPage();
}}
);
// 贴图
nativeControls.createTabBarItem(
"thirdTab",
"贴图",
"/www/tabs/tabbar3.png",
{"onSelect": function() {
//console.log("thirdTab");
showThirdPage();
}}
);
// 个人中心
nativeControls.createTabBarItem(
"fourthTab",
"个人中心",
"/www/tabs/tabbar4.png",
{"onSelect": function() {
//console.log("fourthTab");
showFourthPage();
}}
);
// 更多
nativeControls.createTabBarItem(
"fifthTab",
"更多",
"/www/tabs/tabbar5.png",
{"onSelect": function() {
//console.log("fifthTab");
showFifthPage();
}}
);
// Compile the TabBar
nativeControls.showTabBar();
nativeControls.showTabBarItems("firstTab", "secondTab", "thirdTab", "fourthTab", "fifthTab");
nativeControls.selectTabBarItem("firstTab");
} | 0 | [
2,
1132,
1136,
306,
6523,
1850,
10922,
108,
1967,
753,
2478,
800,
3726,
3726,
31,
147,
1132,
1136,
306,
1275,
12898,
18,
10922,
108,
18,
679,
21,
13,
7760,
6523,
1850,
15,
76,
31,
10840,
21,
6523,
1850,
15,
32,
223,
22,
38,
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... |
How do I perform an operation on ever other character on a string?
===
I am trying to capitalize only the strings even letters. | 0 | [
2,
184,
107,
31,
2985,
40,
1453,
27,
462,
89,
925,
27,
21,
3724,
60,
800,
3726,
3726,
31,
589,
749,
20,
1057,
2952,
104,
14,
7887,
166,
2516,
9,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
PHP - Shuffle displaying the same results?
===
So, I have this code.
//Iron Sword
$_SESSION['ShopWeapons'][0] = array("Iron Sword", 50);
/*$_SESSION['ShopWeapons'][0][1] = 50;*/
//Everwood Staff
$_SESSION['ShopWeapons'][1] = array("Everwood Staff", 51);
/*$_SESSION['ShopWeapons'][1][1] = 50;*/
//Steel Sword
$_SESSION['ShopWeapons'][2] = array("Steel Sword", 52);
/*$_SESSION['ShopWeapons'][2][1] = 100;*/
//Balsa Wand
$_SESSION['ShopWeapons'][3] = array("Balsa Wand", 53);;
/*$_SESSION['ShopWeapons'][3][1] = 75;*/
//Steel Dagger
$_SESSION['ShopWeapons'][4] = array("Steel Dagger", 54);
/*$_SESSION['ShopWeapons'][4][1] = 50;*/
//Balsa Bow
$_SESSION['ShopWeapons'][5] = array("Balsa Bow", 55);
/*$_SESSION['ShopWeapons'][5][1] = 125;*/
shuffle($_SESSION['ShopWeapons']);
which is supposed to shuffle up the order that it displays the items within the array [ShopWeapons'], obviously. It works just fine, except for sometimes it displays the same results more than once. Sometimes it doesn't. Sometimes more than one item is duplicated in this list. Here's the code for displaying this information, just in case it matters.
echo $_SESSION['ShopWeapons'][0][0] . " - " . $_SESSION['ShopWeapons'][0][1] . "<br>";
echo $_SESSION['ShopWeapons'][1][0] . " - " . $_SESSION['ShopWeapons'][1][1] . "<br>";
if(($_SESSION["citysize"] == "town") || ($_SESSION["citysize"] == "city")){
echo $_SESSION['ShopWeapons'][2][0] . " - " . $_SESSION['ShopWeapons'][2][1] . "<br>";
echo $_SESSION['ShopWeapons'][3][0] . " - " . $_SESSION['ShopWeapons'][3][1] . "<br>";
}
if($_SESSION["citysize"] == "city"){
echo $_SESSION['ShopWeapons'][4][0] . " - " . $_SESSION['ShopWeapons'][4][1] . "<br>";
echo $_SESSION['ShopWeapons'][5][0] . " - " . $_SESSION['ShopWeapons'][5][1] . "<br>";
}
I have no idea what I'm doing wrong here, and any help would be nice. Also, it seems more complex than necessary. Any advice in that regard would also be nice. Thanks again. | 0 | [
2,
13,
26120,
13,
8,
23682,
17418,
14,
205,
1736,
60,
800,
3726,
3726,
86,
15,
31,
57,
48,
1797,
9,
12894,
11803,
2960,
5579,
1,
7202,
5991,
2558,
22,
18,
5347,
458,
2552,
4710,
22,
500,
2558,
387,
500,
800,
7718,
5,
7,
11803,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 external ".js" files
===
I have the following two javascript functions:
1
showCountry()
2
showUser()
I would like to put them in external ".js" files
1
<a href="javascript:showCountry('countryCode')">countryCode</a>
2
<form>
<select name="users" onChange="showUser(this.value)">
<option value="1">Tom</option>
<option value="2">Bob</option>
<option value="3">Joe</option>
</select>
</form>
What is the correct syntax to call these functions?
| 0 | [
2,
184,
20,
275,
4886,
13,
7,
9,
728,
18,
7,
6488,
800,
3726,
3726,
31,
57,
14,
249,
81,
8247,
8741,
3719,
45,
137,
298,
10741,
5,
6,
172,
298,
16704,
5,
6,
31,
83,
101,
20,
442,
105,
19,
4886,
13,
7,
9,
728,
18,
7,
6488... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Simulate Mock Location on Android Device via DDMS
===
I have a GPS navigation application for Android 2.3.3 which I have been working on. I am currently trying to simulate locations via a GPX file through DDMS. While this works perfectly find on the android emulator, I am unable to get it working on an actual device.
I am able to see the device on the under the "Devices" tab, but I am unable to send any mock location data, or GPX data as the options are under "Emulation Control" tab are grayed out.
I have noticed that previous questions on StackOverflow mention that it is not possible, however the Google docs titled "Using DDMS" - http://developer.android.com/tools/debugging/ddms.html state the following (at the bottom of the page)
> Setting the location of the phone
>
> If your application depends on the location of the phone, you can have
> DDMS send **your device** or AVD a mock location. This is useful if you
> want to test different aspects of your application's location specific
> features without physically moving. The following geolocation data
> types are available to you:
I am just wondering how to send fake location data to a device via DDMS.
Thank you for your help in advance, and I really appreciate it. | 0 | [
2,
24969,
10506,
1474,
27,
13005,
3646,
1197,
13,
8096,
79,
18,
800,
3726,
3726,
31,
57,
21,
18298,
8368,
3010,
26,
13005,
172,
9,
240,
9,
240,
56,
31,
57,
74,
638,
27,
9,
31,
589,
871,
749,
20,
24969,
4095,
1197,
21,
10538,
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... |
backbone.marionette region and layout
===
is there a way to specify a template for marionette region?
right now i'm using the layout object to specify a template.
AppLayout = Backbone.Marionette.Layout.extend({
template: tmpl
});
var layout = new AppLayout();
App.main.show(layout);
App.addRegions({
userInfo: "#userInfo",
mainMenu: "#mainMenu",
content: "#content"
});
App.mainMenu.show(new mainMenuView.Views.menu());
App.content.show(new dashboard.Views.main());
why i cannot get access directly from my app object to my regions, when i define them inside the layout object?
AppLayout = Backbone.Marionette.Layout.extend({
template: tmpl
regions: {
userInfo: "#userInfo",
mainMenu: "#mainMenu",
content: "#content"
}
});
var layout = new AppLayout();
App.main.show(layout);
does not work:
App.mainMenu.show(new mainMenuView.Views.menu());
App.content.show(new dashboard.Views.main());
Thanks | 0 | [
2,
24036,
9,
1615,
872,
3286,
632,
17,
9106,
800,
3726,
3726,
25,
80,
21,
161,
20,
19077,
21,
22894,
26,
9689,
3286,
632,
60,
193,
130,
31,
22,
79,
568,
14,
9106,
3095,
20,
19077,
21,
22894,
9,
4865,
4414,
1320,
800,
24036,
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... |
<div> shrink when applied floating to its sub elements
===
I am trying to make some element container within the main container of my website . To make the element container in a line,I applied `float:left;` to them. But when I added `float` to them,the main container shrinks ! I tried applying `clear:both` to main container, but makes no changes.
CSS :
#main_container
{
clear:both;
margin-top:20px;
padding:20px 10px 30px 15px;
background:#ccc;
}
.element_container
{
float:left;
width:238px;
height:300px;
border:1px solid #000;
}
HTML :
<div id="main_container">
<div class="element_container"></div>
<div class="element_container"></div>
<div class="element_container"></div>
</div>
![enter image description here][1]
[1]: http://i.stack.imgur.com/V3ZBA.jpg | 0 | [
2,
13,
1,
12916,
1,
16269,
76,
2435,
8319,
20,
82,
972,
2065,
800,
3726,
3726,
31,
589,
749,
20,
233,
109,
4520,
12147,
363,
14,
407,
12147,
16,
51,
2271,
13,
9,
20,
233,
14,
4520,
12147,
19,
21,
293,
15,
49,
2435,
13,
1,
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 and OnClick
===
<script type="text/javascript">
$(document).ready(function() {
$("body").css("display", "none");
$("body").fadeIn("slow");
$("a.link").click(function(event){
event.preventDefault();
linkLocation = this.href;
$("body").fadeOut("slow", redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
});
</script>
It does not work "fadeOut" when using "onclick". As can be implemented without using the "href"?
<a class="link" onclick="window.location='index.php'">index.php</a> | 0 | [
2,
487,
8190,
93,
17,
27,
150,
10129,
800,
3726,
3726,
13,
1,
8741,
1001,
3726,
7,
11969,
118,
1004,
1385,
8741,
7,
1,
5579,
5,
28132,
6,
9,
15193,
5,
22359,
5,
6,
13,
1,
5579,
5,
7,
9760,
7,
6,
9,
6824,
18,
5,
7,
2906,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
css - how to hide href link nested inside a div?
===
I have a div with an anchor tag inside it. I want to set the display of just the "a" tag as none. How would I go about doing it? It looks like-
<div id="upper">
<a href="http://myLink">Hide Me!</a>
<p>Not to hide this text </p>
</div>
I tried doing -
#upper a {display:none;}
However this does not work for some reason. What am I doing wrong? | 0 | [
2,
272,
18,
18,
13,
8,
184,
20,
3077,
746,
14057,
3508,
5618,
69,
572,
21,
13,
12916,
60,
800,
3726,
3726,
31,
57,
21,
13,
12916,
29,
40,
6265,
3383,
572,
32,
9,
31,
259,
20,
309,
14,
3042,
16,
114,
14,
13,
7,
58,
7,
3383,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Convert a string (char) to an array (int)
===
i have a `file.txt` containing some int variables. I need to convert the third grup of numbers to an int `array` so I can manipulate the data the way I want:
EX: file.txt
============
111111 1001 20120131 30
122222 2002 20110230 25
133333 3003 20100325 12
144444 1001 20110526 18
155555 1001 20100524 25
166666 2002 20120312 30
177777 2003 20120428 28
188888 3003 20111214 15
199999 3002 20101113 27
199999 1001 20101202 29
133333 1001 20120715 25
155555 1001 20100204 24
177777 3003 20110102 30
I need to read the file line by line and I chose the `fscanf` function to this:
FILE *fp;
int n1, n2, n4;
char n3[9];
int array[9]
[...]
while (fscanf (fp, "%d %d %s %d", &n1, &n2, n3, &n4);
Now that I have my string, how can i convert it to an int array?
I tried with:
for (i = 0; i < strlen(n3); i++)
array[i] = atoi(strlen[i])
but it goes wrong... how can I resolve this? | 0 | [
2,
8406,
21,
3724,
13,
5,
5433,
6,
20,
40,
7718,
13,
5,
6391,
6,
800,
3726,
3726,
31,
57,
21,
13,
1,
16877,
9,
38,
396,
38,
1,
3503,
109,
19,
38,
12157,
9,
31,
376,
20,
8406,
14,
422,
8961,
306,
16,
2116,
20,
40,
19,
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... |
Do I need to release CGColorSpaceRef under ARC?
===
Let's say I have this piece of code:
CGColorSpaceRef colorSpaceRGB = CGColorSpaceCreateDeviceRGB();
CGContextSetStrokeColorSpace(context, colorSpaceRGB);
CGContextSetFillColorSpace(context, colorSpaceRGB);
After that I do some drawing. When I'm done,
do I need to manually release `colorSpaceRGB` if I'm using ARC? Like this:
CGColorSpaceRelease(colorSpaceRGB);
Or I don't need to do anything?
Thanks :) | 0 | [
2,
107,
31,
376,
20,
830,
13,
15123,
11282,
5582,
14057,
131,
4686,
60,
800,
3726,
3726,
408,
22,
18,
395,
31,
57,
48,
1855,
16,
1797,
45,
13,
15123,
11282,
5582,
14057,
1665,
5582,
139,
11400,
800,
13,
15123,
11282,
5582,
18475,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to share validations accros models?
===
I have this validations in a model TipoMovimiento:
class TipoMovimiento < ActiveRecord::Base
before_validation :default_values
validates :codigo, :numericality => {:greater_than => 0}
validates :codigo, :descripcion, :sintetico, :presence => true
validates :codigo, :descripcion, :sintetico, :uniqueness => true
validates :descripcion, :length => {:minimum => 3}
validates :sintetico, :length => {:minimum => 2}
private
def default_values
self.estado ||= true if self.estado.nil?
self.codigo ||= TipoMovimiento.maximum(:codigo) + 1
end
end
Also, I have others models with the same fields, and I don't want to repeat these validations on them. How I do that? | 0 | [
2,
184,
20,
1891,
27999,
18,
7602,
3171,
2761,
60,
800,
3726,
3726,
31,
57,
48,
27999,
18,
19,
21,
1061,
4265,
9253,
1755,
1435,
17050,
45,
718,
4265,
9253,
1755,
1435,
17050,
13,
1,
1348,
14953,
45,
45,
8436,
115,
1,
18506,
43,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How do I create a user through membership without being logged into their account after creation?
===
I'm having a logged in user create another user (different roles) using Membership.CreateUser. After creating the user, the logged in user automatically gets the boot and the newly created user is logged in.
The goal would be to have the logged in user create a new user and continue working within the app being logged in under their own credentials.
I'm not sure how to change this. Any help would be appreciated.
Here is my code:
[HttpPost]
public ActionResult RegisterClientContact(RegisterClientContactViewModel model)
{
if (ModelState.IsValid)
{
//Create Generic password - First initial Last initial 1234
string genericPassword = model.FirstName.Substring(0, 1).ToLower() + model.LastName.Substring(0, 1).ToLower() + "1234";
//Attempt to register the Client Contact
MembershipCreateStatus createStatus;
Membership.CreateUser(model.Email, genericPassword, model.Email, null, null, true, null, out createStatus);
if (createStatus == MembershipCreateStatus.Success)
{
Roles.AddUserToRole(model.Email, "Client");
FormsAuthentication.SetAuthCookie(model.Email, false /*create persistent cookie*/);
Person person = new Person();
person.FirstName = model.FirstName;
person.LastName = model.LastName;
person.Email = model.Email;
person.Phone = model.Phone;
person.Active = true;
db.Persons.Add(person);
db.SaveChanges();
ClientContact clientPerson = new ClientContact();
clientPerson.ClientPersonId = person.Id;
clientPerson.Title = model.Title;
clientPerson.ClientId = model.ClientId;
db.ClientPersons.Add(clientPerson);
db.SaveChanges();
return RedirectToAction("Index", "ClientContact");
}
}
return View("An Error has occured");
}
| 0 | [
2,
184,
107,
31,
1600,
21,
4155,
120,
4363,
366,
142,
13,
19287,
77,
66,
2176,
75,
2502,
60,
800,
3726,
3726,
31,
22,
79,
452,
21,
13,
19287,
19,
4155,
1600,
226,
4155,
13,
5,
15782,
2954,
6,
568,
4363,
9,
6037,
1373,
16704,
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... |
button_tag like link_to rails 3
===
I need use this code:
<%= button_tag :class => "btn btn-primary" do %>
<%= t('.follow_all')%>
<% end %>
html output:
<button class="btn btn-primary" name="button" type="submit">
Follow all
</button>
if it's possible, **How can I use this button like a link, something like:**
<%= button_tag new_user_registration_path, :class => "btn btn-primary" do %>
<%= t('.follow_all')%>
<% end %>
I need use `button_tag` helper. I can not use `link_to` helper, or instead, if it's possible, **How can I send params from button without use a form?**
| 0 | [
2,
5167,
1,
8628,
101,
3508,
1,
262,
2240,
18,
203,
800,
3726,
3726,
31,
376,
275,
48,
1797,
45,
13,
1,
11881,
3726,
5167,
1,
8628,
13,
45,
1898,
800,
1,
13,
7,
220,
38,
103,
334,
38,
103,
8,
29584,
7,
107,
13,
11881,
1,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Making the JTextArea or JEditorPane in a JFrame scrollable
===
I've been doing some research about Swing in order to build a css editor with Java. I'm stuck trying to export CSS and HTML in JTextArea's ( I'll after create .css document. )
Here is the GridLayout that my main layout calls after clicking "Build" menu item.
package csseditor_gui_built;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.text.DefaultCaret;
import java.awt.Font;
import java.awt.Color;
public class ExportGridLayout extends JFrame {
public ExportGridLayout(String HTML, String CSS){
GridLayout layout = new GridLayout(1,2,2,2);
setLayout(layout);
JTextArea textAreaHtml = new JTextArea();
JTextArea textAreaCss = new JTextArea();
//Creating a new font.
Font fontumuz = new Font("Courier New", Font.PLAIN, 12);
// Setting constructor strings
textAreaHtml.setText(HTML);
textAreaCss.setText(CSS);
//Additional details..
textAreaHtml.setEditable(false);
textAreaCss.setEditable(false);
//Appending font to the textArea's
textAreaHtml.setFont(fontumuz);
textAreaCss.setFont(fontumuz);
// Adding the objects to JFrame
add(textAreaHtml);
add(textAreaCss);
}
}
It's pretty straight forward. Just help me adding scroll bars or panes to these textArea's. Any other suggestions in the website do not work. | 0 | [
2,
544,
14,
487,
11969,
17760,
54,
487,
13401,
16660,
19,
21,
487,
8361,
12159,
579,
800,
3726,
3726,
31,
22,
195,
74,
845,
109,
527,
88,
5587,
19,
389,
20,
1895,
21,
272,
18,
18,
1835,
29,
8247,
9,
31,
22,
79,
4549,
749,
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 secure link_to @variable cross site scripting vulnerabilities
===
I've just started using the brakeman gem to explore my rails app for security vulnerabilities.
I've managed to get everything tidy except for several cross site scripting warnings.
These all share the following in common:
- They're all link_to tags
- They all have instance variables in the class, alt or title
attributes
- The instance variables all represent an active record query that
includes associated models
e.g
<%= link_to "Click" , :class=> @model.association.attribute, :alt=> @model.association.attribute, :title=> @model.association.attribute, @model.association %>
where
@model = Model.includes(:association).find(params[:id])
Is this something I need to be concerned about/ take action for? I thought Rails 3.2 escapes these by default.
I'd welcome advice to help me understand this issue better, and identify what steps I should take, if any. | 0 | [
2,
184,
20,
4315,
3508,
1,
262,
13,
1,
8220,
579,
919,
689,
3884,
68,
13,
12708,
1031,
58,
9168,
3808,
800,
3726,
3726,
31,
22,
195,
114,
373,
568,
14,
13615,
177,
8551,
20,
8594,
51,
2240,
18,
4865,
26,
1221,
13,
12708,
1031,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
MySQL query syntax Multiple where and or. Sanity Check?
===
My Query which I am sure can be optimized extensively but couldn't say how off the top of my head.
What I have is a post/comment like concept going on for my members. Where they can choose to share it with specific people or everyone. So from this I know my query can potentially cause duplicate results (if I could get it to work in the first place). I need to get a distinct 'ciID' while finding the users ID, along with any potential ID's mentioned else where. The ID's for the members are stored in 3 different columns for 3 different reasons.
mID is the member themselves, then sharedWith and whos_with kinda speak for themselves. I store the id's in sharedWith and whos_with like `1111:2222:3333` But in all I have to search across all 3 columns for the member ID shared, and whos column to make sure I get all the results for the ID's being passed through a function in an array. Which after building the query through a loop I come up with a query like
select DISTINCT(ciID),* from user_posting
where (mID = 21 OR sharedWith LIKE '%21%' OR whosWith LIKE '%21%')
or (mID = 22 OR sharedWith LIKE '%22%' OR whosWith LIKE '%22%')
or (mID = 45 OR sharedWith LIKE '%45%' OR whosWith LIKE '%45%')
limit 1
somewhere in that I have a syntax erro I am not noticing, and I need a pair of eyes to help me out | 0 | [
2,
51,
18,
22402,
25597,
22649,
1886,
113,
17,
54,
9,
22869,
2631,
60,
800,
3726,
3726,
51,
25597,
56,
31,
589,
562,
92,
44,
22864,
43,
7802,
47,
711,
22,
38,
395,
184,
168,
14,
371,
16,
51,
157,
9,
98,
31,
57,
25,
21,
678,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
WebServices client in java?
===
I would like have a solution for creating a WebServices client and it needs to consume the Services which already existed.
I have code this from Netbeans ide but my requirement is the wsdl url must be a dynamic one and more specific it needs to fetch from .xml,please suggest me to do that dynamic..cheers | 0 | [
2,
2741,
11449,
18,
6819,
19,
8247,
60,
800,
3726,
3726,
31,
83,
101,
57,
21,
4295,
26,
2936,
21,
2741,
11449,
18,
6819,
17,
32,
2274,
20,
16447,
14,
687,
56,
614,
4589,
9,
31,
57,
1797,
48,
37,
4275,
863,
5950,
13,
3448,
47,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
sending packet over 3G network
===
I am trying to write a method that will send a message over a 3G network with a base station to the server. IM trying to send the message multiple times until I decide to stop. But when I tested this, it always stops after a short time and stops sending the message. Anyone know why?
private Runnable commRunnable = new Runnable() {
public void run() {
try {
String message = "Just saying hello!";
PrintWriter out = new PrintWriter( new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true);
String startReceivingMessage = "Begin sending me data.";
String stopReceivingMessage = "Stop sending me data.";
startSend = false;
stopSend = false;
startReceive = false;
stopReceive = false;
while (!shouldDisconnect) {
if (startSend) {
sendData = true;
startSend = false;
}
if (stopSend) {
sendData = false;
stopSend = false;
}
// Send a message that the server should start transmitting data
// back to us. We only need to transmit this message once.
if (startReceive) {
out.println(startReceivingMessage);
startReceive = false;
receiveData = true;
Thread receiveThread = new Thread(receiveRunnable);
receiveThread.start();
// Tell the server to stop transmitting data.
} else if (stopReceive) {
out.println(stopReceivingMessage);
stopReceive = false;
receiveData = false;
}
if (sendData) {
out.println(message);
}
Thread.sleep(20);
}
} catch (Exception e) {
Log.e("PowerMonitor", e.toString());
} finally {
try {
socket.close();
connected = false;
} catch (Exception e) {
Log.e("PowerMonitor", e.toString());
}
}
}
}; | 0 | [
2,
4907,
12795,
84,
203,
263,
982,
800,
3726,
3726,
31,
589,
749,
20,
2757,
21,
2109,
30,
129,
2660,
21,
2802,
84,
21,
203,
263,
982,
29,
21,
1000,
312,
20,
14,
8128,
9,
797,
749,
20,
2660,
14,
2802,
1886,
436,
163,
31,
4073,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Dynamic Xml Data into Database using Java
===
I have a requirement to load xml data into database using java parses. I can load data either as static declaring column names statically. How to write code to reterive data dynamically from xml and store the data in database as table with columnsss.
import java.io.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
public class GetData{
static public void main(String[] arg) {
try{
BufferedReader bf = new BufferedReader(
new InputStreamReader(System.in));
System.out.print("Enter XML file name: ");
String xmlFile = bf.readLine();
File file = new File(xmlFile);
if (file.exists()){
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(xmlFile);
// Create transformer
Transformer tFormer =
TransformerFactory.newInstance().newTransformer();
// Output text type
tFormer.setOutputProperty(OutputKeys.METHOD, "text");
// Write the document to a file
Source source = new DOMSource(doc);
Result result = new StreamResult(System.out);
tFormer.transform(source, result);
}
else{
System.out.println("File not found!");
}
}
catch (Exception e){
System.err.println(e);
System.exit(0);
}
}
}
| 0 | [
2,
7782,
23504,
1054,
77,
6018,
568,
8247,
800,
3726,
3726,
31,
57,
21,
8981,
20,
6305,
23504,
1054,
77,
6018,
568,
8247,
2017,
7202,
9,
31,
92,
6305,
1054,
694,
28,
12038,
15594,
4698,
1817,
12038,
1326,
9,
184,
20,
2757,
1797,
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... |
Authentication Symfony2 from email link
===
Do you know the tips for authenticate user on a Symfony2 plateform from an email link ?
Many thanks before | 0 | [
2,
27963,
13,
7261,
10229,
93,
135,
37,
8517,
3508,
800,
3726,
3726,
107,
42,
143,
14,
11034,
26,
14351,
1373,
4155,
27,
21,
13,
7261,
10229,
93,
135,
3407,
4190,
37,
40,
8517,
3508,
13,
60,
151,
3669,
115,
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,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
Issue with UTL_SMTP Oracle
===
I'm trying to send email using `oracle 11g` as below.
begin
utl_mail.send(
sender => 'user@xxx.com',
recipients => 'user@gmail.com',
message => 'Hello World'
);
but i got below error.
ORA-29279: SMTP permanent error: 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 ph1sm17301835pbb.45
ORA-06512: at "SYS.UTL_MAIL", line 654
ORA-06512: at "SYS.UTL_MAIL", line 671
ORA-06512: at line 2
29279. 00000 - "SMTP permanent error: %s"
*Cause: A SMTP permanent error occurred.
*Action: Correct the error and retry the SMTP operation.
how could i solve this ? | 0 | [
2,
1513,
29,
287,
7786,
1,
18,
79,
13726,
15759,
800,
3726,
3726,
31,
22,
79,
749,
20,
2660,
8517,
568,
13,
1,
6055,
5615,
547,
263,
1,
28,
1021,
9,
2348,
287,
7786,
1,
8079,
9,
18,
2451,
5,
2660,
106,
800,
1,
13,
22,
16704,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Difference between Product Owner and StackHolder
===
What actually the role difference between **ProductOwner** and **StackHolder** ? | 2 | [
2,
2841,
128,
2374,
2410,
17,
7566,
12427,
800,
3726,
3726,
98,
1121,
14,
597,
2841,
128,
13,
1409,
14086,
10705,
1409,
17,
13,
1409,
25325,
12427,
1409,
13,
60,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
User registration form validation in drupal 7
===
Drupal 7 comes with the built-in user registration form (user/register). I use this form for new users to register. Which is quite obvious. Now the problem is, and I find it hard to believe that it isn't there, I need some validating.
When a new user completes the form and hits submit, the account is being created. Good.
**But**: when a user completes the form and hits submit, but the **email address or username is already in use**, the pages just reloads and the user is not being created, which is good, but theres no warning on what he has to change in the form what so ever.
I find it strange that this is not standard.
Could anyone provide me some help? I really have no clue... | 0 | [
2,
4155,
8587,
505,
27999,
19,
15708,
6720,
453,
800,
3726,
3726,
15708,
6720,
453,
1624,
29,
14,
392,
8,
108,
4155,
8587,
505,
13,
5,
16704,
118,
12463,
9959,
6,
9,
31,
275,
48,
505,
26,
78,
3878,
20,
2243,
9,
56,
25,
1450,
4... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
symbolic computation in c++
===
I need to do analytical integration in c++ .For example i should integrate expressions like this :
exp[I(x-y)] , "I" is an imaginary number.
How can i do this in c++. I tried GiNaC from here http://www.ginac.de/ but it can just integrate polynomials.
i also tried symbolicc++ from here http://issc.uj.ac.za/symbolic/symbolic.html . it can integrate functions like sine , cose or exp(x) and ln(x) but it is not very powerfull , for example it can not integrate x*ln(x) which can be easily obtained by use of Mathematica or by integration by parts.
Are there any other tools or libraries which are able to do symbolic computation like analytical integration in c++?
Thanks | 0 | [
2,
12882,
21683,
19,
272,
20512,
800,
3726,
3726,
31,
376,
20,
107,
20103,
8078,
19,
272,
20512,
13,
9,
1106,
823,
31,
378,
18399,
13832,
101,
48,
13,
45,
13,
6899,
2558,
49,
5,
396,
8,
93,
6,
500,
13,
15,
13,
7,
49,
7,
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... |
Xbap and ActiveX interaction
===
Is it possible that xbap app and ActiveX component, contained in one html page can interact with each other? | 0 | [
2,
993,
969,
306,
17,
1348,
396,
7754,
800,
3726,
3726,
25,
32,
938,
30,
993,
969,
306,
4865,
17,
1348,
396,
5912,
15,
3437,
19,
53,
13,
15895,
2478,
92,
10001,
29,
206,
89,
60,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... |
replicate process memory to another machine running the same process
===
I am planning to write a application that will monitor a given process and replicate the memory to the same process running on another machine. In this way, i want to achieve fault tolerance. The process on 2nd machine should have exact data at any point of time.
So, first thing, Is this possible to read a process memory?
If it is possible, then is it possible to write to another process memory, so that the objects that were created in the process / application on Machine A will be replicated to the process / application in Machine B. If Machine A goes down, then Machine B should be able to serve.
On Machine A and B, my application will run and should sync both the processes.
Any inputs in this regard will be very helpful. I don't know where to start. :(
Regards
Rahul W | 0 | [
2,
22156,
953,
1912,
20,
226,
1940,
946,
14,
205,
953,
800,
3726,
3726,
31,
589,
2334,
20,
2757,
21,
3010,
30,
129,
7626,
21,
504,
953,
17,
22156,
14,
1912,
20,
14,
205,
953,
946,
27,
226,
1940,
9,
19,
48,
161,
15,
31,
259,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 remove calender icon from DateField
===
Can you please help me to remove/Hide the calender icon from the DateField in Ext. I need the input only through directly editing the text.
My code is
DateField dtPlanDate = new DateField { ID = "dtPlanDate", FieldLabel = Strings.PlanDate, LabelAlign = LabelAlign.Top, ToolTip = "Enter Date", Value = DateTime.Today, MinDate = DateTime.Today, MaxDate = DateTime.Today.AddDays(1), StartDay = (int)DayOfWeek.Monday, };
Thanks
| 0 | [
2,
184,
20,
4681,
1658,
21607,
9801,
37,
1231,
1109,
800,
3726,
3726,
92,
42,
2247,
448,
55,
20,
4681,
118,
19522,
14,
1658,
21607,
9801,
37,
14,
1231,
1109,
19,
1396,
38,
9,
31,
376,
14,
6367,
104,
120,
1703,
9510,
14,
1854,
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... |
Find folders in a directory, then list them as options in bash script
===
I am writing a script in order to perform a series of operations with the development sites I have in my local machine. The idea is to list all folders (websites) in "/var/www/" and let the user choose one to perform subsequent operations. I found some inspiration for this script [here][1].
I am just beginning to learn bash, so do expect profanities in the code:
This is where I am stuck:
#!/bin/bash
cd /var/www
options=( $(find . -maxdepth 1 -type d -printf '%P\n') )
options[$[${#options[@]}+1]]="type a new site"
title="Website developing script"
prompt="Choose the site:"
echo "$title"
PS3="$prompt "
select opt in "${options[@]}" "Quit"; do
case "$REPLY" in
# the answer, I guess, is placing a loop here in order to change this
# example line into a list of options, but I can't figure out how
1 ) echo "You picked $opt which is option $REPLY";;
$(( ${#options[@]}+1 )) ) echo "Exiting"; break;;
*) echo "Invalid option. Try another one.";continue;;
esac
done
Any hints are most welcome. Thanks in advance.
[1]: http://askubuntu.com/questions/1705/how-can-i-create-a-select-menu-in-a-shell-script | 0 | [
2,
477,
19294,
18,
19,
21,
16755,
15,
94,
968,
105,
28,
6368,
19,
13158,
3884,
800,
3726,
3726,
31,
589,
1174,
21,
3884,
19,
389,
20,
2985,
21,
231,
16,
1311,
29,
14,
522,
3259,
31,
57,
19,
51,
375,
1940,
9,
14,
882,
25,
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... |
rails - disable select tag
===
I am trying to disable a select tag. The options to fill our not database attributes but rather an array of integers, so collection_select doesn't seem to work in this situation.
technique 1:
select_tag(:zev_qty, options_for_select(display_quantity(@order_subject_supplies_request.site), {:disabled => display_quantity(@order_subject_supplies_request.site)}))
def display_quantity(site)
if site
site.open_site? ? [[0,0],[1,1],[2,2]] : [[0,0],[1,1]]
else
[]
end
end
The above is not what I want. It disables the options not the select tag.
technique 2:
f.select(:zev_qty, display_quantity(@order_subject_supplies_request.site), {:disabled => true})
def display_quantity(site)
if site
site.open_site? ? [0,1,2] : [0,1]
else
[]
end
end
The above doesn't work. None of the options are disabled.
While the correct values display in dropdown in both cases, the select tag is not disabled, and note that in this example, I just set disabled to true, but of course I would be conditionally disabling the select tags. | 0 | [
2,
2240,
18,
13,
8,
1460,
579,
5407,
3383,
800,
3726,
3726,
31,
589,
749,
20,
1460,
579,
21,
5407,
3383,
9,
14,
6368,
20,
3509,
318,
52,
6018,
13422,
47,
864,
40,
7718,
16,
13820,
18,
15,
86,
1206,
1,
18,
16964,
1437,
22,
38,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
draw series of lines and move them
===
i want to draw a series of lines and move them but i want to connect the end point of line 1 to the start point of line 2 ... when i move line 1 or 2 ... the other line will affect by changing its point
i use the example here
http://stackoverflow.com/questions/10768570/graphic-drawline-draw-line-and-move-it?answertab=votes#tab-top
and change a little bit in code to make the draw lines
enter code here
void LineMover_Paint(object sender, PaintEventArgs e)
{
e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
var pen = new Pen(Color.Black, 2);
e.Graphics.DrawLine(pen, Lines[0].StartPoint, Lines[0].EndPoint);
e.Graphics.DrawLine(pen, Lines[0].EndPoint, Lines[2].StartPoint);
e.Graphics.DrawLine(pen, Lines[2].StartPoint, Lines[2].EndPoint);
}
but when i move them i do not have what i want ... any help ??
| 0 | [
2,
2003,
231,
16,
1560,
17,
780,
105,
800,
3726,
3726,
31,
259,
20,
2003,
21,
231,
16,
1560,
17,
780,
105,
47,
31,
259,
20,
6379,
14,
241,
454,
16,
293,
137,
20,
14,
799,
454,
16,
293,
172,
13,
9,
9,
9,
76,
31,
780,
293,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Cannot lookup a consumer from a connection that had not been registered / The subscription does not exist
===
I run an ActiveMQ 5.5.1 broker with two queue. Clients produce messages (varying from many small to some of significant size) and put them into queue 1, from where consumers take the messages from the queue by pulling them at their speed (message prefetch = 0). Messages are sent in transactions. Consumers then calculate some stuff and put an answer message into queue 2 when they have finished their calculation. Clients take the answer message from this queue.
<br>
Persistence is through kahaDB. Producer flow control is enabled, but the memory limits are not hit.
<br>
This works alright and throughput does not seem to be an issue either.
<br>
<br>
However I see the following two exceptions on the broker sometimes. Could anyone give me a hint what they might mean? I could not find anything useful in the ActiveMQ docs or Google either.
Many thanks,
jayeff
<pre>
WARN [ActiveMQ Transport: tcp:///140.39.12.159:40323] (TransportConnection.java:290) - org.apache.activemq.broker.TransportConnection.Service Async error occurred: java.lang.IllegalArgumentException: The subscr
iption does not exist: ID:XYZ:28807:2:1
java.lang.IllegalArgumentException: The subscription does not exist: ID:XYZ:28807:2:1
at org.apache.activemq.broker.region.AbstractRegion.messagePull(AbstractRegion.java:389)
at org.apache.activemq.broker.region.RegionBroker.messagePull(RegionBroker.java:557)
at org.apache.activemq.broker.BrokerFilter.messagePull(BrokerFilter.java:81)
at org.apache.activemq.broker.BrokerFilter.messagePull(BrokerFilter.java:81)
at org.apache.activemq.broker.BrokerFilter.messagePull(BrokerFilter.java:81)
at org.apache.activemq.broker.MutableBrokerFilter.messagePull(MutableBrokerFilter.java:245)
at org.apache.activemq.broker.TransportConnection.processMessagePull(TransportConnection.java:470)
at org.apache.activemq.command.MessagePull.visit(MessagePull.java:43)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:306)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:227)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
at java.lang.Thread.run(Thread.java:662)
</pre>
and
<pre>
WARN [ActiveMQ Transport: tcp:///140.39.12.159:45179] (TransportConnection.java:290) - org.apache.activemq.broker.TransportConnection.Service Async error occurred: java.lang.IllegalStateException: Cannot lookup a consumer from a connection that had not been registered: ID:XYZ:31449
java.lang.IllegalStateException: Cannot lookup a consumer from a connection that had not been registered: ID:XYZ:31449
at org.apache.activemq.broker.SingleTransportConnectionStateRegister.lookupConnectionState(SingleTransportConnectionStateRegister.java:83)
at org.apache.activemq.broker.TransportConnection.lookupConnectionState(TransportConnection.java:1423)
at org.apache.activemq.broker.TransportConnection.processMessagePull(TransportConnection.java:470)
at org.apache.activemq.command.MessagePull.visit(MessagePull.java:43)
at org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:306)
at org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:179)
at org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:69)
at org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:113)
at org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:227)
at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:220)
at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
at java.lang.Thread.run(Thread.java:662)
</pre> | 0 | [
2,
1967,
361,
576,
21,
6461,
37,
21,
2760,
30,
41,
52,
74,
3801,
13,
118,
14,
14213,
630,
52,
3182,
800,
3726,
3726,
31,
485,
40,
1348,
79,
1251,
331,
9,
264,
9,
165,
14930,
29,
81,
22521,
9,
7421,
2213,
7561,
13,
5,
3311,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to solve java.lang.StackOverflowError
===
This is the first time I got this error.
This code basically gets the sum of each item sold in a particular date.
Any tips on resolving this problem? Thanks.
> Statement statement = connection.createStatement();
> String query = "SELECT itemcode, SUM(quantity) AS 'Total Sales Per Day' "
> + "FROM sales "
> + "WHERE real_pur_date = '" + date + "' "
> + "GROUP BY itemcode ";
> ResultSet rs = statement.executeQuery( query ); // this line gets the error / exception
> while( rs.next() ){
> Vector row = new Vector();
> row.add( rs.getString( "itemcode" ) );
> row.add( rs.getInt( "Total Sales Per Day" ) );
> dailyData.add( row );
> }
> statement.close();
Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError
at com.mysql.jdbc.Util.handleNewInstance(Util.java:431)
at com.mysql.jdbc.ResultSetImpl.getInstance(ResultSetImpl.java:383)
at com.mysql.jdbc.MysqlIO.buildResultSetWithRows(MysqlIO.java:3140)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:491)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3118)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2709)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2627)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1556)
at posinventory.Controller.StatisticEngine.getDailyData(StatisticEngine.java:20)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:36)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37)
at posinventory.Statistic.refreshTableDailyStat(Statistic.java:37) | 0 | [
2,
184,
20,
8402,
8247,
9,
9949,
9,
25325,
2549,
9990,
29992,
800,
3726,
3726,
48,
25,
14,
64,
85,
31,
330,
48,
7019,
9,
48,
1797,
11374,
3049,
14,
3907,
16,
206,
9101,
945,
19,
21,
1498,
1231,
9,
186,
11034,
27,
28687,
48,
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... |
PHP variables necessary for insertion into SQL statement
===
I have been trying for several days to get the proper formatting for what I wish to execute.
The goal is to insert rows into a MYSQL table which is previously created. The table may be a mix of strings and integers, and as we know MYSQL requires quotes around strings for insertion while it does not for integers. So then, the proper way to insert something into a table of an integer and two strings would be:
insert into table values(number, "string", "string");
I wish the values to be php variables. However when I input the variables, the code will no longer produce the result when I check in MYSQL. The table will be created, but it will be empty. So it must be this statement that does not work.
This is my actual code for the function to insert it:
function insertRow($db, $new_table, $ID, $Partner, $Merchant)
$insert = "INSERT INTO ".$new_table. " VALUES (1,'Partner','Merchant')";
$q = mysqli_query($db, $insert);
It works like this, but fills the entire table with 1, partner and merchant for every row as many times as I choose.
I've also tried several variations like this
function insertRow($db, $new_table, $ID, $Partner, $Merchant)
$insert = "INSERT INTO ".$new_table. " VALUES(" .$ID. "," ."'$Partner'". ","."'$Merchant'".")";
$q = mysqli_query($db, $insert);
I've also tried these:
http://stackoverflow.com/questions/11163074/passing-php-variables-into-mysql
but none have worked to actually insert the tables into the rows.
Does anyone have an alternative way of doing this?
| 0 | [
2,
13,
26120,
12157,
2378,
26,
24245,
77,
4444,
255,
3331,
800,
3726,
3726,
31,
57,
74,
749,
26,
238,
509,
20,
164,
14,
4119,
2595,
1203,
26,
98,
31,
2536,
20,
15644,
9,
14,
1195,
25,
20,
14692,
11295,
77,
21,
51,
18,
22402,
8... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How do I subtract the value of a javascript variable when form element is unchecked
===
Note, this isn't my code, or the actual code in the form. This is just my testing version, but does represent what I want to do.
Given the following code, how can I get the script to subtract the passed value when the checkbox is unselected:
<!DOCTYPE html>
<html lang="en">
<head>
<title>form test</title>
<script type="text/javascript" charset="utf-8" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script type="text/javascript">
function updateAmount(amount) {
parseInt(amount);
if ($('#amount').val()) {
parseInt(amount);
amount=amount+parseInt($('#amount').val());
}
$('#amount').val(amount);
alert('Amount: '+$('#amount').val());
}
</script>
</head>
<body>
<form action="" method="post" name="form-test">
<input onclick="updateAmount(150)" class="inputbox" id="reservationfee0" value="Registration Fee" type="checkbox" /> <strong>$150</strong> Reservation Fee
</form>
</body>
</html>
As it stands, whoever coded the function didn't take into account that people might check and uncheck that box before they submit the form (which includes more fields and other numbers that get added into the amount variable before submission). There has been a couple of reports of over-charges due to this, so I need to figure out how to stop it from happening, but I know very little about javascript/jquery. | 0 | [
2,
184,
107,
31,
27031,
14,
1923,
16,
21,
8247,
8741,
7612,
76,
505,
4520,
25,
367,
12542,
69,
800,
3726,
3726,
1945,
15,
48,
2532,
22,
38,
51,
1797,
15,
54,
14,
3463,
1797,
19,
14,
505,
9,
48,
25,
114,
51,
4431,
615,
15,
47... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
The text color does not change TabWidget
===
Hi I'm trying to change the tabwidget text color, but does not change. I try of multiple forms of change it but i haven't success.
I must say that my background tabs is an image, and i must add to the code :
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) { tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.TRANSPARENT); }
I do not know if this creates some sort of conflict with what I want to do now.
Solution1:
main.xml
....
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/tabbarbackground"
android:tabStripEnabled="false"
style="@style/TabText"
/> ....
style.xml
... <style name="TabText">
<item name="android:textColor">@color/tab_text_color</item> </style> ....
tab_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:textColor="#2daed9" />
<item android:state_selected="false" android:color="#FFFFFF" />
</selector>
----------
solution 2
for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
RelativeLayout rl = (RelativeLayout) tabHost.getTabWidget().getChildAt(i);
TextView textView = (TextView) rl.getChildAt(1);
textView.setTextColor(R.color.tab_text_color);
}
tab_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:textColor="#2daed9" />
<item android:state_selected="false" android:color="#FFFFFF" /> </selector>
but neither solution works, however if I change the second solution
textView.setTextColor (R.color.tab_text_color);
by
textView.setTextColor (Color.parseColor ("# ...."));
works perfectly but with this solution does not change the color of text when I click on it
Thanks in advance! sorry for my english | 0 | [
2,
14,
1854,
1665,
630,
52,
753,
6523,
3976,
43,
3060,
800,
3726,
3726,
4148,
31,
22,
79,
749,
20,
753,
14,
6523,
3976,
43,
3060,
1854,
1665,
15,
47,
630,
52,
753,
9,
31,
1131,
16,
1886,
1997,
16,
753,
32,
47,
31,
2933,
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 resources are loaded into jboss
===
Can you please explain how resources are (jars, wars) loaded into jboss4.2.3
i have one jar ( base.jar )
on top base.jar, I customized some of the classes and created a jar ( custombase.jar )
on top base.jar & custombase.jar, I customized some more classes and created a jar (child1.jar)
As per my requirement it should be executed the following order only
<li> child1.jar (This jar placed at WEB-INF/lib)
<li> custombase.jar ( This jar placed at application level lib folder )
<li> base.jar ( This jar placed at application . )
Observe tree structure once
|--2 War Modules
|-- 6 Jar Modules ( including base.jar )
|-- lib
| |-- custombase.jar
| |--
| `-- And other jars
|
`-- META-INF
|-- application.xml
`-- MANIFEST.MF
And
war structure :-
|-- css
|-- images
|-- index.jsp
|-- js
|-- merge.xml
|-- META-INF
| `-- MANIFEST.MF
|-- theme
|-- WEB-INF
| |-- classes
| | |-- metainfo
| | |-- List of classes
| |-- lib
| | |-- child1.jar
| | |-- and ohter jars
i am assuming the order of classloading should like
1. WEB-INF/classes/*.classes
2. WEB-INF/lib/*.jar
3. Application/lib/*.jar
4. default/lib/*.jar
5. application/*.jar
But it is not taking child1.jar changes
Did i mistake anything ?
Note :- still now i didn't modify/add the jboss4.2.3 server
| 0 | [
2,
184,
2566,
50,
8572,
77,
487,
10349,
18,
800,
3726,
3726,
92,
42,
2247,
3271,
184,
2566,
50,
13,
5,
6300,
18,
15,
4822,
6,
8572,
77,
487,
10349,
18,
300,
9,
135,
9,
240,
31,
57,
53,
5112,
13,
5,
1000,
9,
6300,
13,
6,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Returning multiple lowest value rows
===
I have a select query which returns a list of data and I need to return all rows with the lowest common level.
SELECT code, level
FROM table
ORDER BY level
For Example
code | level
-----+------
A01 | 3
B56 | 3
J33 | 4
J35 | 4
K56 | 4
I would like to return all results with the lowest level value so in this case it would be
A01 | 3
B56 | 3
I have tried using `MIN(level)` but this only returns the top row. | 0 | [
2,
2485,
1886,
6543,
1923,
11295,
800,
3726,
3726,
31,
57,
21,
5407,
25597,
56,
4815,
21,
968,
16,
1054,
17,
31,
376,
20,
788,
65,
11295,
29,
14,
6543,
757,
662,
9,
5407,
1797,
15,
662,
37,
859,
389,
34,
662,
26,
823,
1797,
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... |
Custom typeface error
===
I want to change the app typeface and I can't:
AndroidManifest.xml
...
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomTheme"
>
...
style.xml
....
<style name="CustomTheme">
<item name="android:typeface">stheiti.ttf</item>
</style>
....
But I get an error:
> error: Error: String types not allowed (at 'android:typeface' with
> value 'stheiti.ttf').
But I have a rootAPP/assets/stheiti.ttf
I do not understand why get that error, I searched in many sites the solution but i couldn't found any with same problem
Thanks in advance! :=) | 0 | [
2,
5816,
1001,
6413,
7019,
800,
3726,
3726,
31,
259,
20,
753,
14,
4865,
1001,
6413,
17,
31,
92,
22,
38,
45,
13005,
8002,
9962,
9,
396,
8184,
13,
9,
9,
9,
13,
1,
2552,
20669,
13005,
45,
49,
1126,
3726,
7,
1,
43,
12404,
579,
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... |
What's the best way to trap a HttpRequestValidationException and add it to the ModelState?
===
Regarding the decorator `[AllowHtml]` on a property or even the `[ValidateInput(false)]` on a method, what is the best way to catch the `HttpRequestValidationException` and append it to the ModelState to show as a friendly error on the user side and not show an error page (either throwing a new page under `Application_Error` or make the use of custom error pages.
Inside the `global.asax` I have a trap:
protected void Application_Error()
{
// http://romsteady.blogspot.dk/2007/06/how-to-catch-httprequestvalidationexcep.html
// Code that runs when an unhandled error occurs
System.Exception ex = Server.GetLastError();
if (ex is System.Web.HttpRequestValidationException)
{
// I got the exception here, I can do plenty now!
Server.ClearError(); // no need to continue, I know the error
}
}
how do I get **from here to the model state**, without using any Session/Application variables (thinking about cloud here and all those different server hosting the user request)?
I was thinking add to the route, or `TempData` but such is not available here... maybe a `Cookie` but seams to hacky...
> **Any ideas?** | 0 | [
2,
98,
22,
18,
14,
246,
161,
20,
5585,
21,
7775,
99,
10351,
18506,
43,
857,
10066,
872,
17,
3547,
32,
20,
14,
1061,
3859,
60,
800,
3726,
3726,
3467,
14,
17650,
3457,
13,
1,
2558,
17976,
15895,
500,
1,
27,
21,
1354,
54,
166,
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... |
controlling CPU usage on android
===
I want to create an app which can control the cpu usage, Actually my main aim is to create power consumption vs cpu usage data for my android device.
In the power tutor app's paper it is written that they "create a CPU use controller, which controls the duty cycle of a computation-intensive task"
I dont know what is duty cycle here and which computation-intensive task they are talking about.
Please help. | 0 | [
2,
10106,
17578,
7514,
27,
13005,
800,
3726,
3726,
31,
259,
20,
1600,
40,
4865,
56,
92,
569,
14,
17578,
7514,
15,
1121,
51,
407,
5226,
25,
20,
1600,
414,
8330,
4611,
17578,
7514,
1054,
26,
51,
13005,
3646,
9,
19,
14,
414,
11494,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Disqus not counting up comments correctly
===
I'm currently using a plugin called 'Disqus' for comments on the website and it isn't 'counting' them up properly.
To get the comment counts to be correct I have to keep syncing them which is a pain.
I've read lots of stuff on the internet about it being easy to fix but I think it must be a case of 'easy when you know how'!
Here is an example:
It displays 5 comments here:
http://www.mac-nutrition.com/research-update-low-carbohydrate-diet-in-type-1-diabetes/
But on the actual page it displays 3 comments:
http://www.mac-nutrition.com/category/blogs/
Many thanks in advance! | 0 | [
2,
1460,
5495,
18,
52,
11195,
71,
7534,
12044,
800,
3726,
3726,
31,
22,
79,
871,
568,
21,
10922,
108,
227,
13,
22,
2906,
5495,
18,
22,
26,
7534,
27,
14,
2271,
17,
32,
2532,
22,
38,
13,
22,
16549,
68,
22,
105,
71,
7428,
9,
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... |
microsite in umbraco
===
I am relatively new to umbraco and have just got the site build but the clients request for a microsite with a completely new look and feel.
So how do I set up a new microsite in umbraco.
Please Help.
Thanks a ton | 0 | [
2,
2899,
9097,
19,
13,
723,
2559,
716,
800,
3726,
3726,
31,
589,
3109,
78,
20,
13,
723,
2559,
716,
17,
57,
114,
330,
14,
689,
1895,
47,
14,
7421,
3772,
26,
21,
2899,
9097,
29,
21,
1524,
78,
361,
17,
583,
9,
86,
184,
107,
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... |
cron job -query data base to send emails
===
I have a database with a list of email addresses and reminders, my php file
1 - checks for any dates that are 'today'
2 - uses phpmailer to send a reminder email
I need to setup a cron job to run the php file once a day (say 10am gmt) and run the .php file. | 0 | [
2,
13,
19587,
1205,
13,
8,
8190,
93,
1054,
1000,
20,
2660,
8517,
18,
800,
3726,
3726,
31,
57,
21,
6018,
29,
21,
968,
16,
8517,
12636,
17,
14973,
18,
15,
51,
13,
26120,
3893,
137,
13,
8,
16602,
26,
186,
4076,
30,
50,
13,
22,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Android code to record a video using remote IP camera which is accessed by using a url
===
Here are some links which tell about video recording:
[http://stackoverflow.com/questions/1817742/android-video-recording-sample][1]
[https://github.com/churnlabs/android-ffmpeg-sample][2]
and there are also many links which tell about video recording but got no any clue how to use the remote IP camera to record video.
By using different samples on stackoverflow I become able to take picture and save on sdcard but couldn't record video.
If any one has any idea or code along with required files I will be thankful.
For example the url I am using where the IP camera is available is given below:
http://trackfield.webcam.oregonstate.edu/axis-cgi/mjpg/video.cgi?resolution=800x600&%3bdummy=1333689998337
Here is the layout code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff" >
<RelativeLayout
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/logo"
android:layout_alignParentTop="true"
android:layout_weight="1" >
<ImageButton
android:id="@+id/btnCam"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/camera_icon" >
</ImageButton>
<ImageButton
android:id="@+id/btnVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@drawable/camera_icon" >
</ImageButton>
</RelativeLayout>
<LinearLayout
android:id="@+id/LinearLayout03"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/LinearLayout01"
android:layout_below="@+id/LinearLayout02"
android:layout_weight="1" >
<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#ffffff" >
<view
android:id="@+id/mv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
class="com.apps.GrahamConst.MjpegView" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="1"
android:background="@drawable/navbar" >
<ImageButton
android:id="@+id/btnPrevious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:background="@null"
android:src="@drawable/previous" >
</ImageButton>
<ImageButton
android:id="@+id/btnMain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:background="@null"
android:src="@drawable/main" >
</ImageButton>
<ImageButton
android:id="@+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="1"
android:background="@null"
android:src="@drawable/next" >
</ImageButton>
</LinearLayout>
</RelativeLayout>
Here is my Activity
public class CameraDetails2 extends Activity implements OnClickListener {
private MediaScannerConnection m_pScanner;
String drawable = null;
private MjpegView mv;
private ProgressDialog dialog;
private HashMap<String, String> item;
private int id = -1;
private WindowManager winMan;
boolean recording = false;
MediaRecorder recorder;
int bytearraysize = 0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
winMan = (WindowManager) getApplicationContext().getSystemService(
Context.WINDOW_SERVICE);
if (winMan != null) {
int orientation = winMan.getDefaultDisplay().getOrientation();
if (orientation == 0) {
// Portrait
setContentView(R.layout.cameradetails);
} else if (orientation == 1) {
// Landscape
setContentView(R.layout.cameradetailsl);
}
}
Bundle b = getIntent().getExtras();
ImageButton b1 = (ImageButton) findViewById(R.id.btnNext);
b1.setOnClickListener(this);
ImageButton b2 = (ImageButton) findViewById(R.id.btnMain);
b2.setOnClickListener(this);
ImageButton b3 = (ImageButton) findViewById(R.id.btnPrevious);
b3.setOnClickListener(this);
ImageButton b4 = (ImageButton) findViewById(R.id.btnCam);
b4.setOnClickListener(this);
ImageButton b5 = (ImageButton) findViewById(R.id.btnVideo);
b5.setOnClickListener(this);
id = Integer.valueOf(b.get("id").toString());
item = listarrayadapter.cameraList.get(Integer.valueOf(id));
mv = (MjpegView) findViewById(R.id.mv);
try {
getVal(item.get("cameraLink"));
// getVal("http://trackfield.webcam.oregonstate.edu/axis-cgi/mjpg
/video.cgi?resolution=800x600&%3bdummy=1333689998337");
} catch (Exception e) {
e.printStackTrace();
mv.setBackgroundResource(R.drawable.offline);
}
}
@Override
protected void onResume() {
// if(recording)
// {
// getVal("http://trackfield.webcam.oregonstate.edu/axis-cgi/mjpg
/video.cgi?resolution=800x600&%3bdummy=1333689998337");
// }
super.onResume();
}
public void onPause() {
super.onPause();
dialog.dismiss();
mv.stopPlayback();
}
private void getVal(final String url) {
Log.i("URL===", url);
updateButtons();
dialog = ProgressDialog.show(this, null, null, true);
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialog.dismiss();
}
};
Thread checkUpdate = null;
checkUpdate = new Thread() {
public void run() {
mv.setSource(MjpegInputStream.read(url));
mv.setDisplayMode(MjpegView.SIZE_FULLSCREEN);
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int btn = v.getId();
if (btn == R.id.btnMain) {
Intent intent = new Intent();
intent.setClass(CameraDetails2.this, CamerasList.class);
startActivity(intent);
finish();
}
if (btn == R.id.btnNext) {
id += 1;
Intent myintent = new Intent(CameraDetails2.this,
CameraDetails.class);
myintent.putExtra("id", id);
startActivity(myintent);
finish();
}
if (btn == R.id.btnPrevious) {
id -= 1;
Intent myintent = new Intent(CameraDetails2.this,
CameraDetails.class);
myintent.putExtra("id", id);
startActivity(myintent);
finish();
}
if (btn == R.id.btnCam) {
if (mv != null) {
Date dt = new Date();
int years = dt.getYear();
int month = dt.getMonth();
int day = dt.getDay();
int hours = dt.getHours();
int minutes = dt.getMinutes();
int seconds = dt.getSeconds();
final String filename = years + "" + month + "" + day + ""
+ hours + "" + minutes + "" + seconds;
try {
Bitmap image = MjpegView.savebmp;
File SDCardRoot =
Environment.getExternalStorageDirectory();
FileOutputStream fileOutputStream = null;
fileOutputStream = new FileOutputStream(
SDCardRoot.toString() + "/" +
filename + ".jpg");
BufferedOutputStream bos = new
BufferedOutputStream(
fileOutputStream);
int quality = 95;
image.compress(CompressFormat.JPEG, quality, bos);
final String szFile = SDCardRoot.toString() + "/"
+ filename + ".jpg";
m_pScanner = new MediaScannerConnection(this,
new MediaScannerConnectionClient()
{
public void
onMediaScannerConnected() {
m_pScanner
.scanFile(szFile, null /* mimeType */);
}
public void
onScanCompleted(String path, Uri uri) {
if
(path.equals(szFile)) {
CameraDetails2.this
.runOnUiThread(new Runnable() {
public void run() {
Toast.makeText(
getApplicationContext(),
"Image Saved.",
Toast.LENGTH_LONG)
.show();
}
});
m_pScanner.disconnect();
}
}
});
m_pScanner.connect();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (btn == R.id.btnVideo) {
if (recording) {
// stop and save
recording = false;
MjpegInputStream.isrecording = false;
List<byte[]> bytelist = new ArrayList<byte[]>();
ArrayList<ByteArrayOutputStream> byteArrayStream =
MjpegInputStream.byteArrayStream;
for (int i = 0; i < byteArrayStream.size(); i++) {
byte[] templist
=byteArrayStream.get(i).toByteArray();
bytelist.add(templist);
}
for (int j = 0; j < bytelist.size(); j++) {
bytearraysize += bytelist.get(j).length;
}
byte[] totalbytes = new byte[bytearraysize];
int f = 0;
for (int j = 0; j < bytelist.size(); j++) {
for (int a = 0; a < bytelist.get(j).length; a++) {
totalbytes[f] = bytelist.get(j)[a];
f++;
}
}
Log.e("num of bytes", "" + totalbytes.length);
// Byte[] bytes = bytelist.toArray(new
//Byte[bytelist.size()]);
try {
writeToFile(totalbytes, "" +
System.currentTimeMillis());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
recording = true;
MjpegInputStream.isrecording = true;
// onResume();
// start recording
}
// recorder=new MediaRecorder();
// try {
// recorder.prepare();
// } catch (IllegalStateException e) {
// e.printStackTrace();
// finish();
// } catch (IOException e) {
// e.printStackTrace();
// finish();
// }
//
// //recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
// // recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
//
// //
// //
// // CamcorderProfile cpHigh = CamcorderProfile
// // .get(CamcorderProfile.QUALITY_HIGH);
// // recorder.setProfile(cpHigh);
// recorder.setVideoSource(mv.getId());
// recorder.setOutputFile("/sdcard/videocapture_example.mp4");
// recorder.setMaxDuration(50000); // 50 seconds
// recorder.setMaxFileSize(5000000); // Approximately 5 megabytes
}
}
public void writeToFile(byte[] bytes, String videoname) throws IOException {
try {
Log.e("num of bytes to be saved", "" + bytes.length);
String path = "/sdcard/" + videoname + ".mp4";
FileOutputStream stream = new FileOutputStream(path);
stream.write(bytes);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
private void updateButtons() {
ImageButton btnNext = (ImageButton) findViewById(R.id.btnNext);
ImageButton btnPrevious = (ImageButton) findViewById(R.id.btnPrevious);
if (id == 0) {
btnPrevious.setEnabled(false);
} else {
btnPrevious.setEnabled(true);
}
if (id == listarrayadapter.cameraList.size() - 1) {
btnNext.setEnabled(false);
} else {
btnNext.setEnabled(true);
}
}
}
[1]: http://stackoverflow.com/questions/1817742/android-video-recording-sample
[2]: https://github.com/churnlabs/android-ffmpeg-sample | 0 | [
2,
13005,
1797,
20,
571,
21,
763,
568,
5388,
15735,
3336,
56,
25,
12904,
34,
568,
21,
287,
6362,
800,
3726,
3726,
235,
50,
109,
6271,
56,
494,
88,
763,
1576,
45,
636,
21127,
6903,
25325,
2549,
9990,
9,
960,
118,
24652,
18,
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... |
SignalR throwing JavaScript Error
===
I'm new to signalr. I've started an MVC 4.0 application, out of the box, and wired up my signalr JavaScript on the Index View. When I click either the Register or Login buttons, signalr throws a JavaScript error.
Unhandled exception at line 11, column 10700 in http://localhost:49172/Scripts/jquery.signalR- 0.5.1.min.js
0x800a138f - Microsoft JScript runtime error: Unable to set value of the property 'src': object is null or undefined
Any suggestions appreciated. | 0 | [
2,
2800,
139,
6033,
8247,
8741,
7019,
800,
3726,
3726,
31,
22,
79,
78,
20,
2800,
139,
9,
31,
22,
195,
373,
40,
307,
8990,
268,
9,
387,
3010,
15,
70,
16,
14,
1649,
15,
17,
21124,
71,
51,
2800,
139,
8247,
8741,
27,
14,
4348,
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... |
PostgresSQL pg_dump fails
===
['pg_restore', '-i', '-h', 'localhost', '-p', '5432', '-U', 'postgres', '-d', 'db_name', '-v', '/var/lib/backup/db.backup', '-c']
Password:
Traceback (most recent call last):
File "ignition.py", line 606, in <module>
main()
File "ignition.py", line 562, in main
load_fixtures()
File "ignition.py", line 73, in load_fixtures
run_command('pg_restore -i -h localhost -p 5432 -U postgres -d db_name -v "/var/lib/backup/db.backup" -c')
File "/var/lib/popen_helper.py", line 30, in run_command
raise Exception, mesg
Exception: Error [1]: pg_restore -i -h localhost -p 5432 -U postgres -d db_name -v "/var/lib/backup/db.backup" -c
Detail: pg_restore: connecting to database for restore
pg_restore: dropping FK CONSTRAINT user_group_user_id_fkey
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1857; 2606 61155 FK CONSTRAINT user_group_user_id_fkey postgres
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.user_group" does not exist
Command was:
ALTER TABLE ONLY public.user_group DROP CONSTRAINT user_group_user_id_fkey;
pg_restore: dropping FK CONSTRAINT user_group_group_id_fkey
pg_restore: [archiver (db)] Error from TOC entry 1858; 2606 61160 FK CONSTRAINT user_group_group_id_fkey postgres
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.user_group" does not exist
Command was: ALTER TABLE ONLY public.user_group DROP CONSTRAINT user_group_group_id_fkey;
pg_restore: dropping FK CONSTRAINT group_permission_permission_id_fkey
pg_restore: [archiver (db)] Error from TOC entry 1854; 2606 61131 FK CONSTRAINT group_permission_permission_id_fkey postgres
The log goes on.
What's exactly causing the problem? This backup comes from another server. I am trying to roll it into server B.
Thanks | 0 | [
2,
678,
13026,
22402,
13,
9623,
1,
43,
11134,
13614,
800,
3726,
3726,
636,
22,
9623,
1,
99,
16828,
22,
15,
13,
22,
8,
49,
22,
15,
13,
22,
8,
252,
22,
15,
13,
22,
15580,
11694,
22,
15,
13,
22,
8,
306,
22,
15,
13,
22,
3963,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 save trace data to table - Profiler stops with this message
===
I am trying to run profiler and get it to log to a database. The profiler starts to run and then after few hours (yes few hours, I know its bad!!) the profiler stops with the message.
**"Failed to save trace data to table".**
When I look at the logs, I can only find **"SQL Trace stopped. Trace ID = '2'. Login Name = 'sa'."**
There are no other error messages.
Any ideas why this might be happening? | 0 | [
2,
1702,
20,
2079,
5565,
1054,
20,
859,
13,
8,
5296,
139,
6604,
29,
48,
2802,
800,
3726,
3726,
31,
589,
749,
20,
485,
5296,
139,
17,
164,
32,
20,
6738,
20,
21,
6018,
9,
14,
5296,
139,
3244,
20,
485,
17,
94,
75,
310,
974,
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... |
InvalidCastException: Unable to cast object of type 'System.Decimal' to type 'System.String'
===
I am attempting to get the sale price from a table and put it into a text box. On my table the sale price is a Decimal variable, and of course the text box is string.. When I run this, there is an exception that is stopping it in my Data Access Layer.
Here is some code:
textSellPrice.Text = DAL.Util.getSellPrice(listItemsPricing.SelectedValue.ToString());
public static String getSellPrice(string item)
{
string sql = "SELECT Price FROM Item it INNER JOIN Customers cu
ON it.SalesRep = Cu.SalesRep WHERE CustomerID='"
+ HttpContext.Current.Session["SelectedCustomer"] +
"' AND ProductID='" + item + "'";
string dt = AdoUtil.GetDataColumn(sql);
return dt;
}
public static string GetDataColumn(string sqlQuery)
{
string result = String.Empty;
try
{
SqlCommand cmd = new SqlCommand(sqlQuery, GetACESConn());
if (cmd.Connection.State != ConnectionState.Open)
cmd.Connection.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.HasRows)
while (reader.Read())
{
result = reader.GetString(0);
}
if (cmd.Connection.State != ConnectionState.Closed)
cmd.Connection.Close();
return result;
}
catch (Exception ex)
{
return result;
}
}
So is there something completely obvious that I am missing?
Thanks for any helpful insight to this, and if any other code could be of use, I can provide it. Thank you
| 0 | [
2,
16671,
6146,
10066,
872,
45,
2343,
20,
1325,
3095,
16,
1001,
13,
22,
10724,
9,
9522,
49,
3482,
22,
20,
1001,
13,
22,
10724,
9,
11130,
22,
800,
3726,
3726,
31,
589,
6314,
20,
164,
14,
3299,
2162,
37,
21,
859,
17,
442,
32,
77... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
windows phone manago vs windows Phone 7
===
I an new for Windows phone development. When I searched on the web for looking the code sample for windows phone. Sometime, I saw there were project for windows phone manago. Would someone tell me the difference between windows phone 7 and windows phone manago? Thanks in advance. | 0 | [
2,
1936,
1132,
169,
9668,
4611,
1936,
1132,
453,
800,
3726,
3726,
31,
40,
78,
26,
1936,
1132,
522,
9,
76,
31,
9036,
27,
14,
2741,
26,
699,
14,
1797,
5717,
26,
1936,
1132,
9,
8530,
15,
31,
441,
80,
46,
669,
26,
1936,
1132,
169,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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-built C++ function that makes case insensitive comparision of two strings
===
Is there any in-built function in C++ library that is able to make case insensitive comparision of two strings ? I am aware of simple approaches like using toupper/tolower,writing function ourselves.I want to know if there is anything in string.h library or other which is able to meet above objective.Here,
strcasecmp of C don't support strings,so not much of help in C++.It only works with char *.
Any help would be very thankful.
P.S. Boost libraries won't be of much help.
Thanks. | 0 | [
2,
19,
8,
8607,
272,
20512,
1990,
30,
1364,
610,
19,
19435,
6479,
14688,
872,
16,
81,
7887,
800,
3726,
3726,
25,
80,
186,
19,
8,
8607,
1990,
19,
272,
20512,
1248,
30,
25,
777,
20,
233,
610,
19,
19435,
6479,
14688,
872,
16,
81,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Forwarding within local network to same network
===
I have X-Wrt based on OpenWrt 8.09 on my router
I have home LAN of few computers on which I have some network servers (SVN, web, etc). For each of service I made forwarding on my router (Linksys wrt54gl) to access it from the Internet (`<my_external_ip>:<external_port> -> <some_internal_ip>:<internal_port>`)
But within my local network this resources by above request is unreachable (so I need make some reconfiguration `<some_internal_ip>:<internal_port>` to access).
I added some line to my /etc/hosts
`<my_external_ip> localhost `
So now all requests from local network to `<my_external_ip>` forwards to my router but further redirection to appropriate port not works.
Advise proper redirection please. | 0 | [
2,
917,
68,
363,
375,
982,
20,
205,
982,
800,
3726,
3726,
31,
57,
993,
8,
7127,
38,
432,
27,
368,
7127,
38,
469,
9,
2545,
27,
51,
858,
139,
31,
57,
213,
6178,
16,
310,
7774,
27,
56,
31,
57,
109,
982,
17595,
13,
5,
18,
1657... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
first menu item not being selected
===
**Problem:**
I have a menu which when you hover on the parent items it should show the first item.
eg when you hover on 'Kayaks & Canoes' it *should* highlight the first item 2+ Person and show the content in the right.
You should also be able to hover on Boats and the content on the right should change. Recreation should be selected by default but you should be able to hover on fishing too.
Currently it doesnt show the first item but you can hover on any item and it will show up.
**What have i tried?**
$(document).ready(function() {
//on hover of sub menu li then highlight itself
$('div#new-menu-lower ul.menuul li.menuli').hover(
function() {
$(this).children('div#new-menu-lower ul li ul').css("display","block");
$('div#new-menu-lower ul li ul li ul:first').css("display","block");
$('div#new-menu-lower ul li ul li').css("display","block");
$('div#new-menu-lower ul li ul li ul li:first').css("display","block");
$(this).children('div#new-menu-lower ul li ul li ul').css("display","block");
}, function() {
$(this).children('div#new-menu-lower ul li ul').css("display","none");
$('div#new-menu-lower ul li ul li ul:first').css("display","none");
$('div#new-menu-lower ul li ul li:first').css("display","none");
$('div#new-menu-lower ul li ul li ul li:first').css("display","none");
$(this).children('div#new-menu-lower ul li ul li ul').css("display","none");
})
});
**JSFIDDLE:**
http://jsfiddle.net/NDMuu/7/
I'll accept a pure css solution using pseudo class `:hover` IF you can get it to work, otherwise i think Jquery/JS is the way to go?
**EDIT:**updated my description slightly | 0 | [
2,
64,
11379,
9101,
52,
142,
1704,
800,
3726,
3726,
13,
1409,
2740,
2854,
79,
45,
1409,
31,
57,
21,
11379,
56,
76,
42,
21350,
27,
14,
4766,
3755,
32,
378,
298,
14,
64,
9101,
9,
12369,
76,
42,
21350,
27,
13,
22,
18617,
4020,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Adding jRadioButton into jTable
===
I am trying to add `jRadioButton` into `jTable`. I used the given code
private class CustomCellRenderer extends DefaultTableCellRenderer {
/* (non-Javadoc)
* @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int)
*/
@Override
public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column) {
return new javax.swing.JRadioButton();
}
}
But when I run this I am getting `jTable` column in a different color and when I click on radio Button nothing happens. I am using netbeans. If I try to Customize the `jTable` then nothing will appear in `jTable`. Give me a proper guidance.
| 0 | [
2,
4721,
487,
11129,
811,
444,
77,
487,
5924,
800,
3726,
3726,
31,
589,
749,
20,
3547,
13,
1,
728,
11129,
811,
444,
1,
77,
13,
1,
728,
5924,
1,
9,
31,
147,
14,
504,
1797,
932,
718,
5816,
9725,
99,
16706,
106,
9073,
12838,
5924... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Rails mountable engine and overriding another engine
===
I'm in the proces of converting my standard Rails app to an mountable engine. The app is comparable to a standard blogging app and i want every model, controller and view to be extendable hence my choice for a mountable engine.
One of the gems i use is Devise which is as far as i understand a sort of a mountable engine itself. It can be used inside a mountable engine as stated [here](https://github.com/plataformatec/devise/wiki/How-To:-Use-devise-inside-a-mountable-engine).
I'm able to use it partially within my engine. Everything is working fine including some Devise controller i override like this one:
# config/routes.rb
Bbronline::Engine.routes.draw do
devise_for :users, class_name: "Bbronline::User", module: :devise,
controllers: { registrations: "bbronline/devise_overrides/registrations"}
...
# controllers/bbronline/devise_overrides/registrations_controller.rb
require_dependency "bbronline/application_controller"
module Bbronline
class DeviseOverrides::RegistrationsController < Devise::RegistrationsController
def new_intermediair
@user = User.new
end
...
The correct view 'views/bbronline/devise_overrides/registrations/new_intermediair.html.haml' is also correctly loading as expected.
However my issue is that the views that i override without a custom controller are not properly loaded. For example the view that should the login view is located in `views/bbronline/devise/sessions/new.html.haml` and is not loaded. Instead the standard Devise login view gets loaded i.e. `devise-2.1.0/app/views/devise/sessions/new.html.erb`
Of course i could solve this problem by overriding every controller with my own controller like i did with the registrations_controller above but this seems very ugly. Is overriding every controller the way to do this? Is there a more convenient way to override views from an mountable engine from within another mountable engine? | 0 | [
2,
2240,
18,
2149,
579,
1406,
17,
84,
5175,
68,
226,
1406,
800,
3726,
3726,
31,
22,
79,
19,
14,
895,
5052,
16,
19583,
51,
1236,
2240,
18,
4865,
20,
40,
2149,
579,
1406,
9,
14,
4865,
25,
14109,
20,
21,
1236,
334,
13919,
4865,
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... |
DirContext : Active Directory Ldap request: get groups of user with parent groups
===
I use javax.naming.directory.DirContext to create a LDAP request for Active Directory. This request returns groups of which the user with given name is member of.
hSearchControls searchCtls = new SearchControls();
searchCtls.setSearchScope(SearchControls.SUBTREE_SCOPE);
searchCtls.setCountLimit(1);
searchCtls.setReturningAttributes(new String[]{"memberOf"});
String searchFilter = MessageFormat.format("(sAMAccountName={0})", new Object[]{userName});
NamingEnumeration answer = null;
try {
String hostDC = host.replaceAll("\\.", ",dc=");
adSearchRequestCr = adSearchRequestCr.replace("DL3", getDomainName(host, 3));
adSearchRequestCr = adSearchRequestCr.replace("DL2", getDomainName(host, 2));
adSearchRequestCr = adSearchRequestCr.replace("DL1", getDomainName(host, 1));
answer = context.search(adSearchRequestCr, searchFilter, searchCtls);
}
This works fine but now I need to change this request. Changed request should return not just group in which the user is, but also parent groups of that group and so on (tree of groups). I read about LDAP_MATCHING_RULE_IN_CHAIN, but I still didn`t manage to use it.
Please help with using LDAP_MATCHING_RULE_IN_CHAIN or smth similar to get new aim of the request. | 0 | [
2,
13,
9035,
1126,
11969,
13,
45,
1348,
16755,
644,
20472,
3772,
45,
164,
1170,
16,
4155,
29,
4766,
1170,
800,
3726,
3726,
31,
275,
8247,
396,
9,
6865,
68,
9,
10197,
93,
9,
9035,
1126,
11969,
20,
1600,
21,
644,
20472,
3772,
26,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Accessing object within object in JavaScript
===
var obj = {{
data: {
type: 'string',
value: 'bir'
},
field: 'red'
},
{
data: {
type: 'string',
value: 'bir'
},
field: 'green'
}
};
How do you manipulate the `data`s.
| 0 | [
2,
1381,
68,
3095,
363,
3095,
19,
8247,
8741,
800,
3726,
3726,
4033,
5122,
728,
800,
13,
1,
1054,
45,
13,
1,
1001,
45,
13,
22,
11130,
22,
15,
1923,
45,
13,
22,
10071,
22,
13,
1,
15,
575,
45,
13,
22,
2095,
22,
13,
1,
15,
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... |
storyboards are unavailable on ios 4.3 and prior
===
i've developing the iphone application. i got a error when i run the application like "**storyboards are unavailable on ios 4.3 and prior**". i don't know how to resolve this so anyone guide me to resolve this.
My xcode is 4.3 version.
My iphone is 2g.
Thanks in advance. | 0 | [
2,
609,
2806,
18,
50,
22563,
27,
13,
7760,
268,
9,
240,
17,
1313,
800,
3726,
3726,
31,
22,
195,
3561,
14,
21024,
3010,
9,
31,
330,
21,
7019,
76,
31,
485,
14,
3010,
101,
13,
7,
1409,
4416,
2806,
18,
50,
22563,
27,
13,
7760,
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... |
Integrate Cppcheck with Emacs
===
Is it possible to integrate Cppcheck with Emacs in a more sophisticated way than [simply calling the shell command on the current buffer](http://stackoverflow.com/a/822144/789593)? I would like Emacs to be able to parse Cppcheck's messages and treat them as messages from a compiler (similar to how `compile` works), such as using <kbd>C-x \`</kbd> to visit the targets of Cppcheck's messages. | 0 | [
2,
18399,
272,
3421,
12542,
29,
13,
62,
6893,
18,
800,
3726,
3726,
25,
32,
938,
20,
18399,
272,
3421,
12542,
29,
13,
62,
6893,
18,
19,
21,
91,
13388,
161,
119,
636,
18,
8983,
102,
2555,
14,
3593,
1202,
27,
14,
866,
17497,
500,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
ScrollableView zoom does not work
===
var imageView = Ti.UI.createView();
imageView.add(imageBig);
var scrollViewImageDetail = Titanium.UI.createScrollableView({
views : imageArrayView,
showPagingControl : false,
currentPage : e.source.indexInArray,
maxZoomScale : 2.0,
minZoomScale : 0.5,
zoomScale : 1,
touchEnabled : true
});
it simply does not zoom an image if I try to resize it with 2 fingers.
I even add this code... no result
scrollViewImageDetail.addEventListener('doubletap', function(e) {
alert("hi");
scrollViewImageDetail.minZoomScale = 2.0;
});
the alert appears :)
What do I wrong?
| 0 | [
2,
12159,
579,
4725,
19469,
630,
52,
170,
800,
3726,
3726,
4033,
1961,
4725,
800,
4174,
9,
5661,
9,
6037,
1373,
4725,
5,
6,
73,
1961,
4725,
9,
14854,
5,
22039,
6407,
6,
73,
4033,
12159,
4725,
22039,
546,
8682,
800,
26398,
9,
5661,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Better client side of web-service
===
I'm writing client app for web-service using C# and MonoTouch. It has some commands for user session (register, login, logout), messaging (list, write, delete, like), image routines (upload, download) and so on.
I wrote implementation for user session request types, which could be executed asynchronously, like that:
{
public delegate void LoginEventHandler(Session session);
public delegate void ErrorEventHandler(Error error);
public delegate void StatusEventHandler(string status);
public interface IDataProvider
{
#region Session
Session GetSession();
event LoginEventHandler OnRegistered;
event ErrorEventHandler OnRegisteredError;
void Register(Person user);
event LoginEventHandler OnLoggedIn;
event ErrorEventHandler OnLoggedInError;
void Login(Person user);
event StatusEventHandler OnLoggedOut;
event ErrorEventHandler OnLoggedOutError;
void Logout(Session session);
#endregion
}
}
}
**It works**, but even now it's a bit **boring and weak** to implement 2 event handlers with unsubscribing from event handlers for any requests:
dataProvider = new DataProviderService ();
...
appDelegate.dataProvider.OnRegistered += HandleOnRegistered;
appDelegate.dataProvider.OnRegisteredError += HandleOnRegisteredError;
appDelegate.dataProvider.Register(GetPerson());
...
void HandleOnRegistered (Session session)
{
InvokeOnMainThread(delegate {
appDelegate.settings.Session = session;
appDelegate.dataProvider.OnRegistered -= HandleOnRegistered;
appDelegate.dataProvider.OnRegisteredError -= HandleOnRegisteredError;
Waiter.HideWaiter();
Console.WriteLine(session.userId);
}
);
}
void HandleOnRegisteredError (Error error)
{
InvokeOnMainThread(delegate {
appDelegate.dataProvider.OnRegistered -= HandleOnRegistered;
appDelegate.dataProvider.OnRegisteredError -= HandleOnRegisteredError;
Console.WriteLine(error);
});
}
Any suggestion to improve architecture for further development? Or any material to see how guru's usually do?
| 0 | [
2,
574,
6819,
270,
16,
2741,
8,
11449,
800,
3726,
3726,
31,
22,
79,
1174,
6819,
4865,
26,
2741,
8,
11449,
568,
272,
5910,
17,
4129,
15725,
9,
32,
63,
109,
14294,
26,
4155,
3723,
13,
5,
12463,
9959,
15,
6738,
108,
15,
6738,
1320,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Rest-SOAP gateaway for external services (Spring + Camel)
===
I need to build REST-SOAP gateaway between 2 external services
First web services makes SOAP requests and awaits SOAP response. Second service (mine, written in Play Framework 1.2.4) works only using RESTful approach. I don`t want to integrate SOAP related things with second service for many reasons. So I need some third service to act between them.
I have looked into using Spring web-app with Apache Camel, but still can't get the full picture because there are so many modules for Camel. CXF-RS and SOAP components looks promissing, but I can't figure out how to implement proxying using them.
First of all, how to make Camel listen for the specified SOAP request. And then, how to route response from RESTful service back to calling service.
I tried to do it using only spring configuration. | 0 | [
2,
760,
8,
656,
2552,
3315,
5533,
26,
4886,
687,
13,
5,
15827,
2754,
15386,
6,
800,
3726,
3726,
31,
376,
20,
1895,
760,
8,
656,
2552,
3315,
5533,
128,
172,
4886,
687,
64,
2741,
687,
1364,
6447,
12279,
17,
21,
8195,
18,
6447,
162... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Display Ontology Content in Java
===
I got an ontology/.owl-file. I want to display the content in my JAVA-Application.
The content which is to read should be just the classes and instances.
*I really hard tried different things in the last days. I worked with the OWLAPI and ProtegeAPI and includes different reasoners (HermiT, Pellet, FaCT++,Jena).*
*Most of the time it failed because important imports were missing because I can't find the package in the download from the official website.*
*One time I got rudimentarily my ontologie hierarchy with the reasoner HermiT. But the output from my classes and nodes wasn't the same like it is in Protege displayed.*
**1) Does anybody have a simple code example for displaying the hierarchy of an ontology in a JAVA-Application?**
| 1 | [
2,
3042,
27,
17810,
2331,
19,
8247,
800,
3726,
3726,
31,
330,
40,
27,
17810,
118,
9,
3581,
255,
8,
16877,
9,
31,
259,
20,
3042,
14,
2331,
19,
51,
8247,
8,
2552,
20669,
9,
14,
2331,
56,
25,
20,
1302,
378,
44,
114,
14,
2684,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to prevent MySql Cross Join Query returning zero results if one of the queries returns null
===
I use this query to fetch the ID of the Next and Previous Events in a mysql events table:
SELECT e.id AS current, prev.id AS previous, next.id AS next
FROM events e
CROSS JOIN
(
SELECT id FROM events
WHERE date < '{$result['date']}'
ORDER BY date DESC
LIMIT 1
) prev
CROSS JOIN
(
SELECT id
FROM events
WHERE date > '{$result['date']}'
ORDER BY date
LIMIT 1
) next
WHERE e.date = '{$result['date']}'
This query works fine.
lets pretend the table looks like so:
ID | EVENT_NAME | DATE
------------------------------
1 | test event 1 | 2012-01-01
2 | test event 2 | 2012-01-02
3 | test event 3 | 2012-02-03
If i run the query with `$result['date']` as `2012-01-02`, this is returned:
Array
(
[0] => Array
(
[current] => 2
[previous] => 1
[next] => 3
)
)
However if i run the query with `$result['date']` as `2012-01-01` OR `2012-01-03`, an empty result set is returned!
If a previous or a next date does not exist because the passed date is the highest or lowest, I still need the result set to return the next or previous
E.G.
So if i run the query with `$result['date']` as `2012-01-01`, i need the result set:
Array
(
[0] => Array
(
[current] => 1
[next] => 2
)
)
OR
Array
(
[0] => Array
(
[current] => 1
[previous] => NULL
[next] => 2
)
) | 0 | [
2,
184,
20,
2501,
51,
18,
22402,
919,
1865,
25597,
2485,
4606,
1736,
100,
53,
16,
14,
9386,
2829,
4815,
16203,
800,
3726,
3726,
31,
275,
48,
25597,
20,
18312,
14,
4924,
16,
14,
328,
17,
1158,
963,
19,
21,
51,
18,
22402,
963,
859... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 SDK on Eclipse helios
===
I am trying to develop a Facebook app using Eclipse Helios, i cannot figure out how to import the Facebook SDK . Help of any kind will be appreciated. Thank you in advance, Ronak | 0 | [
2,
9090,
13,
18,
43,
197,
27,
11652,
21937,
18,
800,
3726,
3726,
31,
589,
749,
20,
2803,
21,
9090,
4865,
568,
11652,
21937,
18,
15,
31,
1967,
1465,
70,
184,
20,
9010,
14,
9090,
13,
18,
43,
197,
13,
9,
448,
16,
186,
825,
129,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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... |
c# initializing OutlookEmail object gives Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)
===
when I try to initialize object as
OutlookEMail email = new OutlookEMail(MailType);
in c# i get exception:
**Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).**
using microsoft office (outlook) 2007.
can someone help to resolve that? | 0 | [
2,
272,
5910,
2104,
3335,
19837,
62,
8079,
3095,
2352,
5391,
37,
746,
29955,
45,
713,
396,
8464,
2738,
150,
300,
58,
13,
5,
4474,
1,
62,
1,
1245,
38,
8294,
1210,
2559,
622,
6,
800,
3726,
3726,
76,
31,
1131,
20,
2104,
2952,
3095,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
MS ADO DLL not properly installed?
===
I'm just trying to install everything needed to start messing with ADO in MSVC 2010 Express just to learn more about it and I may end up using some of these things I learn at work.
I have read from MSDN that I need to install MDAC, so I went and got the latest version here:
http://www.microsoft.com/en-us/download/details.aspx?id=5793
From what I've read online I need to use the #import pre-compiler directive with the name of my MS ADO DLL ("msado15.dll" is mentionned) to initialize ADO in MSVC but it seems that even after installing MDAC I do not have this DLL. What have I done wrong ?
I am using Windows 7 64 if that matters. | 0 | [
2,
4235,
21,
537,
13,
43,
211,
52,
7428,
4066,
60,
800,
3726,
3726,
31,
22,
79,
114,
749,
20,
16146,
796,
851,
20,
799,
3957,
68,
29,
21,
537,
19,
4235,
8990,
498,
2999,
114,
20,
2484,
91,
88,
32,
17,
31,
123,
241,
71,
568,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How to perform click event on anchor tags
===
I am working on asp.net using c#. I have one master page with 3 anchor tag links and one html label. When a user clicks on a particular link it should redirect to specific page and the link text should be displayed on the label. I have used following code,
$(document).ready(function () {
$('#div1 a').click(function () {
if (focus == true)
$('#lblHeader').text("Home");
});
$('#blog').click(function () {
if (focus == true)
$('#lblHeader').text("Blog");
});
$('#about').click(function () {
if (focus == true)
$('#lblHeader').text("About");
});
});
please guide me. | 0 | [
2,
184,
20,
2985,
10840,
807,
27,
6265,
3383,
18,
800,
3726,
3726,
31,
589,
638,
27,
28,
306,
9,
2328,
568,
272,
5910,
9,
31,
57,
53,
1129,
2478,
29,
203,
6265,
3383,
6271,
17,
53,
13,
15895,
1899,
9,
76,
21,
4155,
10840,
18,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
how to configure 2 persistence providers in jboss as 7
===
I am pretty new to java and new to JEE,
I'm working on a project and I want to user 2 dataSources(MySQL+Cassandra) implementing JPA(JBoss hibernate for MySQL and Kundera for Cassandra).
my persistence.xml is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="2.0">
<persistence-unit name="mysqlPU" transaction-type="JTA">
<description>MySQL Persistent Unit</description>
<jta-data-source>java:jboss/datasources/MySQLRemote</jta-data-source>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.eventit.entities.Event</class>
<class>com.eventit.entities.Group_icon</class>
<class>com.eventit.entities.Group</class>
<class>com.eventit.entities.User</class>
</persistence-unit>
<persistence-unit name="cassandraPU">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<property name="kundera.nodes" value="10.0.0.13" />
<property name="kundera.port" value="9160" />
<property name="kundera.keyspace" value="KunderaKeyspace" />
<property name="kundera.dialect" value="cassandra" />
<property name="kundera.client.lookup.class"
value="com.impetus.client.cassandra.pelops.PelopsClientFactory" />
<property name="kundera.cache.provider.class"
value="com.impetus.kundera.cache.ehcache.EhCacheProvider" />
<property name="kundera.cache.config.resource" value="/ehcache-test.xml" />
</properties>
</persistence-unit>
</persistence>
but when I deploy my project on JBoss(AS 7.1) i get the following error:
02:56:22,428 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."Event-it5.5.jar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."Event-it5.5.jar".INSTALL: Failed to process phase INSTALL of deployment "Event-it5.5.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider 'com.impetus.kundera.KunderaPersistence' not found
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.lookupProvider(PersistenceUnitDeploymentProcessor.java:555)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:295)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleJarDeployment(PersistenceUnitDeploymentProcessor.java:145)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:120)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
mysqlPU works just fine but when I add cassandraPU I get the exeption.
I'm pretty sure i'm deploying the kundera.jar with dependencies to jboss correctly because i can see the jar in `http://127.0.0.1:9990/console/App.html#deployments`
Thanks in advance and hopefully I've provided all that's necessary. | 0 | [
2,
184,
20,
1065,
15951,
172,
28584,
13488,
19,
487,
10349,
18,
28,
453,
800,
3726,
3726,
31,
589,
1772,
78,
20,
8247,
17,
78,
20,
13,
13412,
15,
31,
22,
79,
638,
27,
21,
669,
17,
31,
259,
20,
4155,
172,
1054,
12097,
18,
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... |
xercesc_3_1::RuntimeException when creating an XML Object
===
My application receives an xml message from a pipe and creates an xml object from it using Xerces. Every time I create the message I get the below error in my output window. All my searches don't seem to come up with anything related.
First-chance exception at 0x747fb9bc in App.exe: Microsoft C++ exception: xercesc_3_1::RuntimeException at memory location 0x0064be68..
I've surrounded everything with try catches but it doesn't catch it at all. My app doesn't crash because of it but it doesn't seem like a good practice to let something like this sit unfixed.
Has anyone else had any experience with something like this?
Below is the code where I'm calling it
void CentralBureauOfBureaucracy::receivedMessage(QString* message)
{
try
{
std::string schema("XMLStuff.xsd");
xml_schema::properties props;
props.no_namespace_schema_location (
"file:///" + schemaLocation_+schema);
props.schema_location (
"http://www.w3.org/XML/1998/namespace",
"file:///" + schemaLocation_+schema);
std::istringstream iss (message->toStdString());
boost::shared_ptr<XMLStuff::Object> obj( XMLStuff::Object_(iss,0, props ));
//Add message to queue
}
catch (const xml_schema::exception& e)
{
QString info(" Caught the exception ");
std::stringstream ss;
ss<<e;
info += ss.str().c_str();
std::cout<<info.toStdString()<<endl;
}
catch (const xml_schema::properties::argument& a)
{
cerr << "" << endl;
QString info(" invalid property argument (empty namespace or location)");
std::stringstream ss;
info += ss.str().c_str();
std::cout<<info.toStdString()<<endl;
}
catch(std::exception& ex)
{
QString info(" Caught the exception ");
info+=ex.what();
std::cout<<info.toStdString()<<endl;
}
catch(...)
{
QString info(" Caught an unknown exception ");
std::cout<<info.toStdString()<<endl;
}
} | 0 | [
2,
993,
106,
5052,
150,
1,
240,
1,
165,
45,
45,
3169,
891,
10066,
872,
76,
2936,
40,
23504,
3095,
800,
3726,
3726,
51,
3010,
8359,
40,
23504,
2802,
37,
21,
7642,
17,
9695,
40,
23504,
3095,
37,
32,
568,
993,
106,
5052,
9,
352,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Matlab fsolve optimization terminated
===
I used fsolve to solve a function but the result shows
Optimization terminated: norm of relative change in X is less
than max(options.TolX^2,eps) and sum-of-squares of function
values is less than sqrt(options.TolFun).
A =
0.3490
Anybody knows how to solve this? Thanks!
My code is as below
clear
M=10000;
x0=0.35;
Z=randn(M,1);
A=fsolve(@(x)function_1_5_3(x,Z),x0)
function f=function_1_5_3(x,Z)
r0=.02;%interest rate
sigma=.15;%vatality rate of risky asset
mu0=.06;%drift rate of risky asset
gamma=5;%risk aversion rate
M=10000;%number of trajectories
N=55;%time period
T=55;%total time period
R=40;%time of retirement
dt=T/N;%each time period
t=1:dt:T;
omega=x;
Rf=exp(r0);%riskless reture
mat=rand(M,N);
Rs=exp(mu0+sigma*Z);%risky market return
a=20*mat(:,N-2);
a_1=20*mat(:,N-1);
W=((a.*(Rf+omega*(Rs-Rf))-a_1).^(-gamma)).*(Rs-Rf);%regard as function 4
f=mean(W); | 0 | [
2,
4277,
9086,
398,
5594,
195,
21597,
13780,
800,
3726,
3726,
31,
147,
398,
5594,
195,
20,
8402,
21,
1990,
47,
14,
829,
1285,
21597,
13780,
45,
12889,
16,
4543,
753,
19,
993,
25,
787,
119,
2049,
5,
25458,
4710,
9,
13741,
396,
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... |
Floating a libGDX/lwjgl application in Xmonad
===
I recently switched to using Xmonad as my window manager.
When I run my libGDX/lwjgl app using eclipse, it's automatically tiled by Xmonad. This creates some problems with the positioning.
I tried running
xprop | grep WM_CLASS
and clicking on the application. It doesn't show any name.
If there's any way to detect these lwjgl applications and float them, let me know.
Thank you. | 0 | [
2,
8319,
21,
13,
8326,
263,
43,
396,
118,
23281,
728,
8430,
3010,
19,
993,
13951,
43,
800,
3726,
3726,
31,
1989,
6667,
20,
568,
993,
13951,
43,
28,
51,
1463,
1382,
9,
76,
31,
485,
51,
13,
8326,
263,
43,
396,
118,
23281,
728,
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... |
Python algorithm for lists and sublists
===
I have a number of lists that can be "opened" or "closed", something like this:
lista = ["a", "b", "c"]
listb = ["d", "e"]
listc = ["a", "b", "e"]
listd = ["c", "d"]
I have a master list of all open items:
all_open = ["a", "b", "c", "e"]
and a list of open lists:
open_lists = ["lista", "listc"]
As the sublists are openend, their items are added to the master list:
open_lists.append("listb")
for each i in listb:
if !(i in all_open):
all_open.append(i)
Is there a simple algorithm to remove items from the master list when a sublist is closed? The goal is to not remove items that belong to other lists that are still open.
| 0 | [
2,
20059,
9083,
26,
7227,
17,
972,
5739,
18,
800,
3726,
3726,
31,
57,
21,
234,
16,
7227,
30,
92,
44,
13,
7,
17808,
7,
54,
13,
7,
20372,
7,
15,
301,
101,
48,
45,
968,
58,
800,
636,
7,
58,
7,
15,
13,
7,
220,
7,
15,
13,
7... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Rudimentary power function in Scala not working - strange compiler error
===
My code:
def power(x: Double, n: Int): Double = {
if (n % 2 == 0 && n > 0) power(power(x, n/2), 2)
else if (n % 2 == 1 && n > 0) x * power(x, n - 1)
else if (n == 0) 1
else if (n < 0) 1 / power(x, -n)
}
println(power(2, 2))
Terminal:
$ scala ch2ex10.scala
/scala/impatient/ch2ex10.scala:5: error: type mismatch;
found : Unit
required: Double
else if (n < 0) 1 / power(x, -n)
Where is this `Unit` coming from?
Thanks! | 0 | [
2,
29329,
414,
1990,
19,
25975,
52,
638,
13,
8,
2578,
21486,
7019,
800,
3726,
3726,
51,
1797,
45,
6312,
414,
5,
396,
45,
1494,
15,
13,
103,
45,
19,
38,
6,
45,
1494,
800,
13,
1,
100,
13,
5,
103,
13,
11881,
172,
800,
3726,
713... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 generate MD5(CONCAT(?, password_salt)) this password and insert into mysql?
===
I testing on Authenticating Users in Zend Framework. http://framework.zend.com/manual/en/learning.multiuser.authentication.html.
i had create users table at mysql..
need help and advise on how to genearate MD5(CONCAT(?, password_salt)) into password_salt column
CREATE TABLE users (
id INTEGER NOT NULL PRIMARY KEY,
username VARCHAR(50) UNIQUE NOT NULL,
password VARCHAR(32) NULL,
password_salt VARCHAR(32) NULL,
real_name VARCHAR(150) NULL
)
class AuthController extends Zend_Controller_Action
{
public function loginAction()
{
$db = $this->_getParam('db');
$loginForm = new Default_Form_Auth_Login();
if ($loginForm->isValid($_POST)) {
$adapter = new Zend_Auth_Adapter_DbTable(
$db,
'users',
'username',
'password',
'MD5(CONCAT(?, password_salt))'
);
$adapter->setIdentity($loginForm->getValue('username'));
$adapter->setCredential($loginForm->getValue('password'));
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);
if ($result->isValid()) {
$this->_helper->FlashMessenger('Successful Login');
$this->_redirect('/');
return;
}
}
$this->view->loginForm = $loginForm;
}
} | 0 | [
2,
184,
20,
7920,
8138,
264,
5,
1126,
5782,
5,
60,
15,
20884,
1,
8266,
38,
6,
6,
48,
20884,
17,
14692,
77,
51,
18,
22402,
60,
800,
3726,
3726,
31,
4431,
27,
14351,
1880,
3878,
19,
10526,
43,
6596,
9,
7775,
6903,
8361,
3783,
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... |
SendKeys.Send Method in WPF application
===
I'm trying to send Keystroke(Ctrl+T) for browser control. But, `SendKeys.Send()` showed error in WPF application?? My question is
1) Can I use this method in WPF application?
2) Is there any alternative method fro sending automatic keystroke.
Thanks. | 0 | [
2,
2660,
4237,
18,
9,
18,
2451,
2109,
19,
619,
7721,
3010,
800,
3726,
3726,
31,
22,
79,
749,
20,
2660,
1246,
12962,
5,
4812,
6362,
2430,
38,
6,
26,
16495,
569,
9,
47,
15,
13,
1,
18,
2451,
4237,
18,
9,
18,
2451,
5,
6,
1,
19... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
How can I convert erb to html?
===
Imagine in rails I have
@template
that is an instance of
ActionTemplate::View
Question is: How can I convert
@template
whose @template.source is
'<%= "hello from erb" %>'
to
hello from erb!
?? thanks | 0 | [
2,
184,
92,
31,
8406,
13,
106,
220,
20,
13,
15895,
60,
800,
3726,
3726,
4382,
19,
2240,
18,
31,
57,
13,
1,
9577,
6554,
30,
25,
40,
4851,
16,
1028,
9577,
6554,
45,
45,
4725,
1301,
25,
45,
184,
92,
31,
8406,
13,
1,
9577,
6554,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... |
Is remove_if predicate guaranteed to be called only once per iterator?
===
I've been reading the latest C++ spec, and I'm unable to figure out whether or not `remove_if` can be called multiple times for the same element. In particular, I'm looking at `std::remove_if` being called on `deque` iterators. So far as I can figure, there's no *reason* for it to be called multiple times if all it does is simply start from the first param and iterate along till the second.
The code I'm working on uses manual reference counting and, as such, in case the `remove_if` predicate will return true, it'll decrement and delete the underlying object reference. The obvious catch being that this will only work if the `remove_if` predicate is only called once for each element, otherwise subsequent calls will be accessing a deleted object. Something tells me this isn't guaranteed to be OK and there will come a point where the same element will be passed to the `remove_if` predicate twice for a single `remove_if` call.
If you had some kind of crazy datastructure that implemented iterators and say, randomly selected an entry for each iterator increment until it (randomly) came upon the end iterator, I could see how this would fail. But for straight-forward, standardized structures like `deque`, `vector`, and `list`, can a single element be passed multiple times to the predicate? | 0 | [
2,
25,
4681,
1,
821,
28712,
13572,
20,
44,
227,
104,
382,
416,
32,
106,
3457,
60,
800,
3726,
3726,
31,
22,
195,
74,
1876,
14,
5736,
272,
20512,
12737,
15,
17,
31,
22,
79,
2343,
20,
1465,
70,
1472,
54,
52,
13,
1,
99,
16598,
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... |
PHP : which file causing to load
===
here is my top output :
> 6747 xxx.com 15 0 241m 19m 8188 R **29.9[CPU]** **0.2[RAM]** 3:24.89 **php**
> 31798 mysql 15 0 1952m 422m 5384 S **12.0[CPU]** **5.3[RAM]** 9:00.27 **mysqld**
Look at PHP's CPU usage. I don't know which file is causing this load. Is there any module for show which file is using CPU under tree? I mean like this :
> 6747 xxx.com 15 0 241m 19m 8188 R 29.9[CPU] 0.2[RAM] 3:24.89 php
> 5.49% index.php
> 15.39% videos.php
> x% y.php
> 31798 mysql 15 0 1952m 422m 5384 S 12.0[CPU] 5.3[RAM] 9:00.27 mysqld
and I want same thing for mysql too. I want to now which query is executing now and how long is it take. | 2 | [
2,
13,
26120,
13,
45,
56,
3893,
3242,
20,
6305,
800,
3726,
3726,
235,
25,
51,
371,
5196,
13,
45,
13,
1,
7323,
2918,
13,
13290,
9,
960,
357,
713,
13,
21658,
79,
732,
79,
469,
20768,
761,
13,
1409,
2738,
9,
518,
2558,
150,
4201,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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 tuples in Python from an XML String/File
===
I've decided it'd be nice to have a way to generically create a dictionary from an `XML` string.
import xml.etree.ElementTree as ET
response = '<some><generic><xml></xml></generic></some>'
targetTree = ET.fromstring(response)
# Do something cool here
for key in my_cool_dict:
print '{0} = {1}'.format(key, my_cool_dict[key])
I've found nifty ways of iterating through your elements:
for elem in targetTree.findall('some'):
for child in elem.getchildren():
print i.text
These kinds of things require I know the `XML` tags. What if I don't know what I'm receiving? How can I create `my_cool_dict` where the `key` is the name of the tag and the `value` is the value between the tags? | 0 | [
2,
1600,
2289,
18534,
19,
20059,
37,
40,
23504,
3724,
118,
16877,
800,
3726,
3726,
31,
22,
195,
868,
32,
22,
43,
44,
2210,
20,
57,
21,
161,
20,
12733,
1326,
1600,
21,
9186,
37,
40,
13,
1,
396,
8184,
1,
3724,
9,
9010,
23504,
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.