Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
39,042,637
Place Backslash Between Words In String [Python]
I Want to convert com to newcom com = 'R.E.M. - Losing My Religion.mp3' newcom = 'R.E.M.\ -\ Losing\ My\ Religion.mp3' I am doing this because ubuntu terminal needs backslashes to specify spaces in paths. This is just a string manipulation , i just don't know what to do here , a piece of help would be appreciated! thanks
<python>
2016-08-19 15:21:10
LQ_EDIT
39,042,765
encode image to base64 from amazon-s3
I have iframe which contain image. Image source is link to image in amazon-S3 bucket. I need encode this image in base64 and save ifram's body in db. How can i do this?
<javascript><jquery>
2016-08-19 15:27:54
LQ_EDIT
39,046,042
Console.log not working javascript/jquery
<p>I am trying to get started with javascript, but I can't see to get console.log to work.</p> <p>In the <code>head</code>, I load jquery as follows:</p> <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery.min.js"&gt;&lt;/script&gt; </code></pre> <p>Then, right before the end of <code>body</code>, I place the document.ready function as follows:</p> <pre><code>$( document ).ready(function() { console.log( "ready!" ); }); </code></pre> <p>No other javascript/jquery is present in the file. I expected the phrase "ready!" to be logged to the console, but instead, nothing happened. How can I fix this?</p>
<javascript><jquery><console>
2016-08-19 18:58:26
LQ_CLOSE
39,046,250
how to pull information from one table into text boxs based on primary key from another table?
protected void custo_search_Click(object sender, EventArgs e) { conn.Open(); if (appo_fname.Text != null || appo_lname.Text != null || appo_num.Text != null) { DataTable dt = new DataTable(); MySqlDataReader myReader = null; MySqlCommand myCommand = new MySqlCommand("SELECT customers.First_name,customers.Last_name,customers.Phone_num From customers INNER JOIN appointments On customers.Phone_num=appointments.Phone_num Where customers.Phone_num='" + search_txt.Text+"' ", conn); myReader = myCommand.ExecuteReader(); while (myReader.Read()) { appo_fname.Text = (myReader["customers.First_name"].ToString()); appo_lname.Text = (myReader["customers.Last_name"].ToString()); appo_num.Text = (myReader["customers.Phone_num"].ToString()); } conn.Close(); } Hi, i am trying to connent between 2 tables with the same primary key,so when i put a phone number in search textbox it will check if the number exist in the other table and if it is so i will get f.name,l.name and phone into other text boxs in order to insert the customer information without typing all over but somting is not working in my code,it skeep over the code inside the "while"
<c#><mysql><asp.net>
2016-08-19 19:14:44
LQ_EDIT
39,047,087
How to progromatically stop actions segue swift
<p>so I have multiple viewcontrollers in my project, and I perform an action segue from the first to the second when the button called <code>SignIn</code> is called. What I need to do, however, is stop this action segue from being performed, on a condition. For example, <code>if isThereAnError == true { write code to stop action segue }</code> I have looked all over apple documentation and stack overflow but to no prevail. Any and all help is greatly appreciated, thank you in advance.</p>
<ios><swift><viewcontroller>
2016-08-19 20:19:52
LQ_CLOSE
39,047,814
Is there a way to write a lambda expression inside an IF with everything captured?
<p>It's my understanding that if I use the syntax [&amp;] in a lambda expression, then my lambda expression has access to surrounding variables and parameters of the function.</p> <p>Therefore, I tried to write the following (simplified) code</p> <pre><code>if ( [&amp;]() { bool b = false; return b; } ) { // Do something in TRUE part of if statement } </code></pre> <p>but I get the error "Value of type 'lambda at...' is not contextually convertible to 'bool'</p> <p>Would appreciate some insight into this issue.</p> <p>Many thanks, D</p>
<c++><lambda>
2016-08-19 21:18:49
LQ_CLOSE
39,048,089
How to delete elements of a pointer in c++
<p>If I have a pointer <code>float *p;</code> And I want to delete one element of its elements or all of its elements .. Is there any operator can do this??</p> <p>And <code>delete [] p;</code> operator will delete only the address of the pointer or the elements too?</p> <p>Thanks in advance.</p>
<c++><pointers>
2016-08-19 21:44:15
LQ_CLOSE
39,048,232
server side script for AJAX call
<p>In writing my first program that uses jQuery's .ajax() function to ask a server side PHP script for data and then process it, I am struggling to come up with an appropriate file name for the PHP script. Is there a naming convention or a standard file name for a script whose purpose is to receive requests and send back data to AJAX calls? What file names are you using for your server side scripts that handle AJAX calls?</p>
<javascript><php><jquery><ajax>
2016-08-19 21:59:33
LQ_CLOSE
39,049,000
Clarification regarding NULL pointers in context of Binary tree
I have a data structure like: struct node { int count; node *left,*right; node(int count,node* l,node*r) { this->count=count; this->left=l; this->right=r; } node* update(int l,int r,int v); }; Now i declare a global variable: **node* p=new node(0,NULL,NULL);** So this very statement will cause 'p' to have : p->count=0; p->left=NULL; p->right=NULL; My question is what happens if I write: p->left=p->right=p; As far as i understood that it will give memory to p->left and p->right which were NULL initially. So, it would be: p->left->count=0, p->left->left=NULL,p->left->right=NULL; p->right->count=0, p->right->left=NULL,p->right->right=NULL; But i do not think that's what happening because when i am calling update(0,9,0) where l=0, r=9 and v=0, it is working fine if i have written this statement: p->left=p->right=p before calling this function. But it fails to run if i comment this statement (i.e. it tries to access NULL pointer values i guess). Please clarify this doubt. Thank You.
<c++><pointers><null><binary-tree><nodes>
2016-08-19 23:33:31
LQ_EDIT
39,050,556
the result of uint32_t become octonary automatically
int main() { uint32_t n1 = 00000000000000000000000000001000; uint32_t n2 = 00000000000000000000000000000100; cout << n2; } when I use vs2013 (c++): the result is 64. why this turns to octonary number system instead of binary?
<c++><uint32-t>
2016-08-20 04:44:04
LQ_EDIT
39,050,596
How to create a multi diamental array in jqury?
i want create a jquery blow formate with help of using two each statements. arrar [ 'aaa'=>'ccsdfccc', 'bb'=>'aaddsaaaa', '1'=>[ 'cccc'=>'dcvcdd' 'ddd'=>'eeee' ] '2'=>[ 'cccc'=>'dcvcdd' 'ddd'=>'eeee' ] ]
<javascript><jquery>
2016-08-20 04:50:32
LQ_EDIT
39,050,840
multiple underscores randomly in a string
/*I want random multiple underscores everytime I refresh the page in a string...*/ enter code here <html> <body> <p id="demo"></p> <p id="temo"></p> <p id="jemo"></p> <p id="remo"></p> <script> var i; var x="Sachin Tendulkar";//String in which i want underscores var res=x.split(""); for(i=1;i<=7;i++)//here in this for loop i generated random numbers and accessing the elements at that indexes and try to put underscores there. { var j=document.getElementById("demo").innerHTML=Math.floor(Math.random()* ((x.length-1)/2)); var t=res[j]; var f=document.getElementById("jemo").innerHTML=x.replace(res[j],"_"); var l=document.getElementById("jemo").innerHTML=f.replace(res[j],"_"); } </script> </body> </html>
<javascript><html>
2016-08-20 05:37:29
LQ_EDIT
39,051,504
How to display all array values from json in PHP?
<p>i am currently having problem displaying all array values for a particular type i am trying to fetch all the messages from the json </p> <p>Here is my code:</p> <pre><code>&lt;?php $request = 'https://devblogs.instavoice.com'; $response = file_get_contents($request); $jsonobj = json_decode($response,true); echo $jsonobj-&gt;status; echo $jsonobj[0]-&gt;msg_content; ?&gt; </code></pre> <p>Here is the json i am trying to fetch :</p> <pre><code>{"cmd":"fetch_vobolos","status":"ok","no_more_record":true,"blog_msgs":[{"from_blogger_id":17198634,"msg_id":19046254,"msg_content_type":"t","msg_content":"dsd\u0027.$msg.\u0027","duration":11,"msg_dt":1471675984000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046253,"msg_content_type":"t","msg_content":"rasdhulsdsa","duration":11,"msg_dt":1471675507000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046252,"msg_content_type":"t","msg_content":"rasdhulsdsa","duration":11,"msg_dt":1471675294000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046243,"msg_content_type":"t","msg_content":"ddsssd","duration":6,"msg_dt":1471670493000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046242,"msg_content_type":"t","msg_content":"asdsdas","duration":7,"msg_dt":1471670413000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false}],"last_blog_id":19046254,"before_blog_id":19046242,"device_id":61758} </code></pre> <p>I am having difficulty displaying all the messages on "msg_content" but it returns error.</p>
<php><json>
2016-08-20 07:09:01
LQ_CLOSE
39,051,560
Dropdown box like google search box designed in css
<p>Currently I am using normal CSS dropdown list and calling data from database through PHP. <br><br> But I want to create a search box like google.com has, wherein when you type, it will show suggestions from my database. I have its code in JQuery but I don’t know how to use it properly. Is it possible to create it using CSS and PHP?</p>
<php><css>
2016-08-20 07:15:45
LQ_CLOSE
39,051,564
PHP-I need to use the explode function for white spaces in the $str, after loading content of txt file to $str.But it dont seem to work well
$filename='acct.txt'; $str=file_get_contents($filename); print_r (explode("\t",$str)); Output Array ( [0] => 101 [1] => 345.23 102 [2] => 43.2 103 [3] => 0 104 [4] => 33 ) print_r (explode(" ",$str)); output Array ( [0] => 101 [1] => 345.23 102 [2] => 43.2 103 [3] => 0 104 [4] => 33 ) file contains this: 101 345.23 102 43.2 103 0 104 33 How should I change it to get one element at a time: ie: Array ( [0] => 101 [1] => 345.23 [2] => 102 ....[8]=>33) Thanks for any Help!
<php><arrays><string>
2016-08-20 07:16:18
LQ_EDIT
39,051,952
Conditional formatting google sheets based on date
[![enter image description here][1]][1] [1]: http://i.stack.imgur.com/3Zpr6.png I want the Status column(**C**) to display pending, today and lapsed based on the values in the M_Date column(**B**). In the conditional formatting, I have used the custom formula if($b2=Today(),"Today",if($b2<Today(),"Pending","Lapsed")) The formula shows no error but does not generate any output. Please help. Also, I want to receive an email when the value of status column changes from *Pending* to *Today*.
<google-sheets><conditional><gs-conditional-formatting>
2016-08-20 08:08:43
LQ_EDIT
39,052,282
Text editor that can be used inside an android application
How can i integrate a text editor in my android app. I need a text editor like stack exchange which can allow the user to post questions along with code snippets.
<android><text-editor>
2016-08-20 08:52:17
LQ_EDIT
39,052,381
PHP group multidimensional array
<p>I need help with grouping multidimensional PHP array. The array I have is :</p> <pre><code> Array ( [1385] =&gt; Array ( [product_id] =&gt; 1385 [product] =&gt; Tossed salad [category_ids] =&gt; Array ( [0] =&gt; 489 ) ) [1386] =&gt; Array ( [product_id] =&gt; 1386 [product] =&gt; Green salad [category_ids] =&gt; Array ( [0] =&gt; 489 ) ) [1387] =&gt; Array ( [product_id] =&gt; 1387 [product] =&gt; Milk Shake [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) [1388] =&gt; Array ( [product_id] =&gt; 1388 [product] =&gt; Mango Juice [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) [1389] =&gt; Array ( [product_id] =&gt; 1389 [product] =&gt; Orange Juice [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) ) </code></pre> <p>I want to group the array in different way so I can list them categories. Something like this : </p> <pre><code>Array ( [category_ids] =&gt; 489, [products] =&gt; [0] =&gt; Array ( [product_id] =&gt; 1385 [product] =&gt; Tossed salad ) [1] =&gt; Array ( [product_id] =&gt; 1386 [product] =&gt; Green salad ) [category_ids] =&gt; 440, [products] =&gt; [0] =&gt; Array ( [product_id] =&gt; 1387 [product] =&gt; Milk Shake ) [1] =&gt; Array ( [product_id] =&gt; 1388 [product] =&gt; Mango Juice ) [2] =&gt; Array ( [product_id] =&gt; 1389 [product] =&gt; Orange Juice ) ) </code></pre> <p>The structure can be wrong because I just made it with my text editor. But yes I want something like this. List those products under <code>category_ids</code>, sometimes there could be more then one <code>category_ids</code> as well. There many other products fields also, I shorten to make it look less complicated. There are <code>product_price</code>, <code>company_id</code> and some has multidimensional array like <code>product_options</code>.</p>
<php><arrays><multidimensional-array>
2016-08-20 09:05:05
LQ_CLOSE
39,052,410
vb.net date format as "Fri, 14 Oct 2011 23:10:10 -0000"
net to get this format for now(). can you please help me how to do this . it is not a supported format here [Microsoft MSDN][1] [1]: https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
<vb.net><datetime><datetime-format>
2016-08-20 09:09:26
LQ_EDIT
39,053,490
Python convert list to dict with multiple key value
<p>I have a list something like below and want to convert it to dict</p> <pre><code>my_list = ['key1=value1', 'key2=value2', 'key3=value3-1', 'value3-2', 'value3-3', 'key4=value4', 'key5=value5', 'value5-1', 'value5-2', 'key6=value6'] </code></pre> <p>How can I convert above list to dict something like below</p> <pre><code>my_dict = { 'key1': 'value1', 'key2': 'value2', 'key3': ['value3-1', 'value3-2', 'value3-3'], 'key4': 'value4', 'key5': ['value5', 'value5-1', 'value5-2'], 'key6': 'value6' } </code></pre>
<python><python-2.7><dictionary>
2016-08-20 11:15:06
LQ_CLOSE
39,053,793
How to dynamically add/remove show fields in Sonata Admin
<p>I wanted to remove some show fields that are only relevant if some other fields have a certain value, but the entity cannot be accessed from the admin class.</p>
<php><symfony><sonata-admin>
2016-08-20 11:49:51
LQ_CLOSE
39,053,834
Which would be more correct on C++11: switch-case or if( .. || .. || .. )?
I'm trying to build simple lexical analyzer - lexer. The part I'm working on now is tokenizer. I'm writing function which determines whitespaces (whitespaces, tabs, newlines(CR, LF)) in the input sequence. So the question is which code is more correct: The code with switch-case statement: bool isWhitespace(wchar_t &symbol) { switch (symbol) { case L' ': case L'\t': case L'\r': case L'\n': return true; default: return false; } } Or the code with if(.. || .. || ..) statement: bool isWhitespace(wchar_t &symbol) { if (symbol == L' ' || symbol == L'\t' || symbol == L'\r' || symbol == L'\n') { return true; } return false; } And which one would be faster?
<c++><c++11><optimization>
2016-08-20 11:53:48
LQ_EDIT
39,053,915
calculating days rent in hotel from checkin and checkout--asp, c#
check-in time and checkout time days rent calculating. if check-in at 31-08-2016 and checkout at 01-09-2016 then it was calculating rent to 30 days char sp = '/'; string[] date = checkin.Split(sp); string[] date2 = checkout.Split(sp); int c1 = Convert.ToInt32(date[0]); int c0 = Convert.ToInt32(date2[0]); totday = c0 - c1;
<c#><asp.net>
2016-08-20 12:04:12
LQ_EDIT
39,054,240
How to decrypt the shell file with SHC encryption?
How to decrypt the shell file with SHC encryption? I have a file that would like to know the contents of it, but it is encrypted and the use of SHC encryption
<linux><shell><encryption>
2016-08-20 12:38:03
LQ_EDIT
39,055,330
Add html inside a value to a javascript object
I'm working with a google sheet: my goal is to parse the html and turn into a json file in order to add some places to a google map (api), since in my google sheet I saved some map locations. So far so good, I was able to clean the html file and obtain a json file with all the value I need. My problem is that now, I want to add some html inside the json file. My single value looks like that: { "a": "Store Name", "b": "Address", "c": "Town/City", "d": "Prov", "e": "Postal Code", "f": "Phone", "g": "Website", }, { "a": "Nutter's Bulk Foods #50", "b": "102-400 Main Street", "c": " N.E.", "d": "Airdrie", "e": "AB", "f": "T4B 2N1", "g": "(403) 948-6354", }, { "a": "King Drug Hinton 1982 Ltd.", "b": "145 Athabasca Avenue", "c": "Hinton", "d": "AB", "e": "T7V 2A4", "f": "(780) 865-2645", "g": "http://www.kingdrug.ca/", }, and so on. I want to add some html inside the single value in order to change my file into: { "a": "King Drug Hinton 1982 Ltd.", "b": "145 Athabasca Avenue", "c": "Hinton", "d": "AB", "e": "T7V 2A4", "f": "<a href='tel:+1780..'>(780) 865-2645</a>", "g": "<a href='http://www.kingdrug.ca/'>http://www.kingdrug.ca/</a>", } And I would like to do it dynamically, in order to save time, so let's say that I want to target the property name "a", retrieve the value "780..." and add an html anchor tag <a> with the <href> equal to the value inside the file. The biggest problem for me is working with a json file, I used to word and iterate with javascript object. Thank you in advance for any useful suggestion.
<javascript><jquery><json><iteration>
2016-08-20 14:40:46
LQ_EDIT
39,055,331
How does python pass keyword changes values in list
I have one small code in python. I have created list and I am passing it as function parameter. According to me it should give output as 1 2 3 4 5. But it is giving me 5 2 3 4 5 as output. If I am just writing 'pass' keyword inside for loop then it should not do anything.Then why is that changing my output? Please help me out. Here is my code: def fun1(list1): for list1[0] in list1: pass list2=[1,2,3,4,5] fun1(list2) print(list2)
<python>
2016-08-20 14:40:47
LQ_EDIT
39,055,671
pointers, sizeof() and address in c++
[This is the link to the program][1] [1]: https://github.com/an0nh4x0r/code/blob/master/c_cpp/pointers/2.cpp The sizeof() function in cpp gives sizeof(int) 4 bytes, in g++ compiler. So i printed the sizeof(1), sizeof(2), sizeof(0) to terminal and i got 4 bytes. so i tried some pointer arithmetic in the program in above link. I added 1 to a pointer variable. lets say int *p; int a = 10; now i assigned p = &a; now when i printed p it gives 0x24fe04 and when i printed p + 0 its same. But when i tried adding p + 1 and p + 2 it gives different output like this 0x24fe08, 0x24fe0c respectively. Please help me understanding this arithmetic. why p+1, p+2 is not equal as in address it's contributing the same 4 bytes.
<c++><pointers><sizeof><pointer-arithmetic>
2016-08-20 15:15:13
LQ_EDIT
39,055,809
C++ Avoid passing variable to std::cout if variable is zero
Suppose I have a variable, `double x`, as a result of some calculations, which can have any value, including zero, and I need it passed to `std::cout`. How can I avoid printing `x` if its value is zero? As an example, this will print `1+<value_of_x>` if `x`, else just `1`: `std::cout << (x ? "1+" : "1") << x << '\n';` Is there a way to make the same but for `x`? Something like the following nonsense: `std::cout << (x ? ("1+" << x) : "1") << '\n';` I should probably add that I am not advanced in C++.
<c++><cout>
2016-08-20 15:29:22
LQ_EDIT
39,055,878
How to compare a string to an array?
I am trying to compare a string to an array but it doesn't seem to work... My code is shown below... if(rs.getString(1).equals(array[0]) && rs.getString(7).equals(array[6])){ JOptionPane.showMessageDialog(null, "not updated"); } how can I do the comparison?
<java><sql><database><string><nullpointerexception>
2016-08-20 15:36:17
LQ_EDIT
39,059,474
Java 8 - List Results are Printing Not Actual Content
<p>Using Java 8, I was checking out some of its new features...</p> <p>Created the following class:</p> <pre><code>public class Person { String name; int age; public Person(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } </code></pre> <p>Created the PersonApp class:</p> <pre><code>import java.util.ArrayList; import java.util.Comparator; import java.util.List; import static java.util.Comparator.comparing; public class PersonApp { public static void printSorted(List&lt;Person&gt; people, Comparator&lt;Person&gt; comparator) { people.stream() .sorted(comparator) .forEach(System.out::println); } public static void main(String[] args) { List&lt;Person&gt; people = new ArrayList&lt;&gt;(); people.add(new Person("Sara", 12)); people.add(new Person("Mark", 43)); people.add(new Person("Bob", 12)); people.add(new Person("Jill", 64)); printSorted(people, comparing(Person::getAge).thenComparing(Person::getName)); } } </code></pre> <p>When I run this class, I get the following instead of the values I wanted to see:</p> <pre><code>Person@682a0b20 Person@3d075dc0 Person@214c265e Person@448139f0 </code></pre> <p>What am I possibly doing wrong?</p>
<java><java-8>
2016-08-20 23:05:59
LQ_CLOSE
39,060,319
[Verilog]IES error:HDLCompiler:806
I keep getting errors below in ISE, and can not figure out the real problems. anyone has any clues? error messages: ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 29: Syntax error near "posedge". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 39: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 43: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 47: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 50: Syntax error near "end". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 54: Syntax error near "posedge". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 64: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 68: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 72: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 75: Syntax error near "end". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 88: Syntax error near "posedge". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 98: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 102: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 106: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 109: Syntax error near "end". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 113: Syntax error near "posedge". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 123: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 127: Syntax error near "<=". ERROR:HDLCompiler:806 - "C:\Users\Ray\Documents\project\QFC\QFC_A.v" Line 131: Syntax error near "<=". and here is my code: `timescale 1ns/1ps module QFC_A # ( parameter SPI_CYCLE = 100000, parameter MASTER_ID = 8'h66, parameter SLAVE_ID = 8'h66 ) ( input i_axi_lite_s_aclk, input i_rst, input i_din, output o_en, output o_dout ); reg [255:0] r_frame_message; reg [3:0] r_cnt_message; wire [31:0] w_frame_word_message; wire w_message_rd_en; wire w_id_match_message; wire w_message_empty; wire w_message_ready; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_frame_message <= 256'h0; end else begin if (w_id_match_message & (r_cnt_message != 4'hf)) begin r_frame_message <= {224'h0, w_frame_word_message}; end else if (w_message_rd_en & w_message_empty) begin r_frame_message <= 256'h0; end else if (w_message_rd_en) begin r_frame_message <= {r_frame_message[223:0], w_frame_word_message}; end end end assign w_id_match_message = (w_frame_word_message[23:16] == MASTER_ID)? 1'b1 : 1'b0; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_cnt_message <= 4'h0; end else if (w_message_rd_en) begin if (w_id_match_message) begin r_cnt_message <= 4'h0; end else if (r_cnt_message == 4'hf) begin r_cnt_message <= 4'h0; end else begin r_cnt_message <= r_cnt_message + 4'h1; end end end assign w_message_ready = (r_cnt_message == 4'hf & ~w_send_ready)? 1'b1 : 1'b0; reg [255:0] r_frame_data; reg [3:0] r_cnt_data; wire [31:0] w_frame_word_data; wire w_data_rd_en; wire w_id_match_data; wire w_data_empty; wire w_data_ready; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_frame_data <= 256'h0; end else begin if (w_id_match_data & (r_cnt_data != 4'hf)) begin r_frame_data <= {224'h0, w_frame_word_data}; end else if (w_data_rd_en & w_data_empty) begin r_frame_data <= 256'h0; end else if (w_data_rd_en) begin r_frame_data <= {r_frame_data[223:0], w_frame_word_data}; end end end assign w_id_match_data = (w_frame_word_data[23:16] == MASTER_ID)? 1'b1 : 1'b0; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_cnt_data <= 4'h0; end else if (w_data_rd_en) begin if (w_id_match_data) begin r_cnt_data <= 4'h0; end else if (r_cnt_data == 4'hf) begin r_cnt_data <= 4'h0; end else begin r_cnt_data <= r_cnt_data + 4'h1; end end end assign w_data_ready = (r_cnt_data == 4'hf & ~w_send_ready)? 1'b1 : 1'b0; reg [255:0] r_frame_rec; reg [3:0] r_cnt_rec; wire[31:0] w_frame_word_rec; wire w_rec_en; wire w_id_match_rec; wire w_rec_ready; wire w_rec_success; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_frame_rec <= 256'h0; end else begin if (w_id_match_rec & (r_cnt_rec != 4'hf)) begin r_frame_rec <= {224'h0, w_frame_word_rec}; end else if (w_rec_en) begin r_frame_rec <= {r_frame_rec[223:0], w_frame_word_rec}; end end end assign w_id_match_rec = (w_frame_word_rec[23:16] == SLAVE_ID)? 1'b1 : 1'b0; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_cnt_rec <= 4'h0; end else if (w_rec_en) begin if (w_id_match_rec) begin r_cnt_rec <= 4'h0; end else if (r_cnt_rec == 4'hf) begin r_cnt_rec <= 4'h0; end else begin r_cnt_rec <= r_cnt_rec + 4'h1; end end end assign w_rec_ready = (r_cnt_rec == 4'hf)? 1'b1 : 1'b0; assign w_rec_success = ((w_rec_ready) & (r_frame_rec[251] == 1'b1) & (checksum(r_frame_rec[239:16]) == r_frame_rec[15:0]))? 1'b1 : 1'b0; reg [2:0] r_current_state; reg [2:0] r_next_state; reg [16:0] r_cycle_timer; reg [14:0] r_trans_timer; reg [1:0] r_cycle_s; reg [223:0] r_payload; reg [255:0] r_frame_send; wire w_cycle; wire w_cycle_pos; wire w_state_start; localparam IDLE = 3'h0; localparam SEND_MSG = 3'h1; localparam RESEND_MSG = 3'h2; localparam SEND_DATA = 3'h3; localparam RCG_ACK = 3'h4; localparam CHANGE_TLG = 3'h5; localparam ABORT_MSG = 3'h6; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if (i_rst) begin r_cycle_timer <= 16'h0; end else if (r_cycle_timer < SPI_CYCLE) begin r_cycle_timer <= r_cycle_timer + 16'h1; end else begin r_cycle_timer <= 16'h0; end end assign w_cycle = (r_cycle_timer == SPI_CYCLE)? 1'b1 : 1'b0; always @ (posedge i_axi_lite_s_aclk & posedge i_rst) begin if(i_rst) begin r_cycle_s <= 2'h0; end else begin r_cycle_s <= {r_cycle_s[0], w_cycle}; end end assign w_cycle_pos = (~r_cycle_s[1] & r_cycle_s[0]); function reg [15:0] checksum (input reg [223:0] r_frame) begin integer i; reg [15:0] r_sum_1; reg [15:0] r_sum_2; r_sum_1 = 16'hff; r_sum_2 = 16'hff; for (i = 0; i < 28; i++) begin r_sum_1 = r_sum_1 + r_frame[(223-8*i)-:8]; r_sum_2 = r_sum_1 + r_sum_2; if (i == 20) begin r_sum_1 = ( r_sum_1 >> 8 ) + ( r_sum_1 & 8'hff); r_sum_2 = ( r_sum_2 >> 8 ) + ( r_sum_2 & 8'hff); end end r_sum_1 = ( r_sum_1 >> 8 ) + ( r_sum_1 & 8'hff); r_sum_2 = ( r_sum_2 >> 8 ) + ( r_sum_2 & 8'hff); r_sum_1 = ( r_sum_1 >> 8 ) + ( r_sum_1 & 8'hff); r_sum_2 = ( r_sum_2 >> 8 ) + ( r_sum_2 & 8'hff); checksum = (r_sum_1 << 8) | r_sum_2; end endfunction always @ (*) begin case (r_current_state) IDLE: begin r_next_state = SEND_DATA; r_frame_send = {8'h90, MASTER_ID, 240'h0}; end SEND_MSG: begin r_next_state = RCG_ACK; if (w_state_start) begin w_message_rd_en = 1'b1; w_send_ready = 1'b0; w_state_start = 1'b0; end if (r_frame_message == 256'h0) begin w_message_rd_en = 1'b0; r_frame_send = {r_frame_send[], MASTER_ID, 240'h0}; end else if end RCG_ACK: begin if (w_rec_success) begin r_next_state = CHANGE_TLG; end else if (r_resend_cnt == 2'b11) begin r_next_state = ABORT_MSG; end end endcase end endmodule
<syntax-error><verilog>
2016-08-21 02:24:25
LQ_EDIT
39,061,319
How to read the object inside json array android
I have json in this format.I m trying to create serialization class to store the value. how to read the "personaldata" field. I am making a separate class PersonalData to read it. And in my main serialization class i am reading it as List<PersonalData>personalData. Is it the right way to do it. And if yes .how will i fetch the personal data values. { "result": [{ "name": 0, "age": 1, "class": 0…….some more data “personalData” : { “isMarried” : true/false, “isEligible” : true/false, “Indian” : true/false, } ]}
<android><json>
2016-08-21 06:06:24
LQ_EDIT
39,061,511
Diaplaying table using HTML
I want to display the below contents in table format using HTML. Can you please quickly help to display this content using HTML. please find below sample table contents. Name Count X1 6 X2 3
<html><json><html-table>
2016-08-21 06:39:43
LQ_EDIT
39,061,612
what is double(::) in angular js?
<p>While going through some of the angular best practices guide I found this concept of using <code>::</code> before models for uni-direction binding. But it seems does not work with <code>input</code> field. Here is an example:</p> <p><a href="https://plnkr.co/edit/gZ73PNGGg4m45zFuBYZw?p=preview" rel="nofollow">https://plnkr.co/edit/gZ73PNGGg4m45zFuBYZw?p=preview</a></p> <p>Inside expression it works as expected but inside ng-model, it's still 2-way binding. Then what's the difference?</p>
<javascript><angularjs>
2016-08-21 06:55:36
LQ_CLOSE
39,062,610
display 7 string variables in a toast
I wanna display the information of 7 edit texts in a toast so I put the edit texts information in 7 string variables but I don't know how Here is what I written: public class MainActivity extends Activity { EditText ed1; EditText ed2; EditText ed3; EditText ed4; EditText ed5; EditText ed6; EditText ed7; Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); showinfo(); } private void showinfo() { ed1= (EditText) findViewById(R.id.editText1); ed2= (EditText) findViewById(R.id.editText2); ed3= (EditText) findViewById(R.id.editText3); ed4= (EditText) findViewById(R.id.editText4); ed5= (EditText) findViewById(R.id.editText5); ed6= (EditText) findViewById(R.id.editText6); ed7= (EditText) findViewById(R.id.editText7); btn= (Button) findViewById(R.id.button1); /////// btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub String str1 = ed1.getText().toString(); String str2 = ed2.getText().toString(); String str3 = ed3.getText().toString(); String str4 = ed4.getText().toString(); String str5 = ed5.getText().toString(); String str6 = ed6.getText().toString(); String str7 = ed7.getText().toString(); //////////// Toast.makeText(getApplicationContext(), ,Toast.LENGTH_LONG).show(); } }); } how can I display all the string variables in toast?
<android><string><android-edittext><toast><string-concatenation>
2016-08-21 09:09:04
LQ_EDIT
39,063,150
c nested makros Verschachtelte Makros
a problem occurred to me. Somebody might show me how to remove the "@". I am writing c for a uc and I am lazy; so I want to solve easy problems whit makros, e.g. switching on a led. I managed to do something like that: //Begin of c code #include <stdio.h> #define BIT_STD_SET(PORT, BITNUM) ((PORT) |= (1<<(BITNUM))) #define BIT_STD_CLE(PORT, BITNUM) ((PORT) &= ~(1<<(BITNUM))) #define BIT_STD_TOG(PORT, BITNUM) ((PORT) ^= (1<<(BITNUM))) #define LEDPORT_0 C #define LEDPAD_0 3 /*Blau*/ #define LEDPORT_1 D #define LEDPAD_1 4 /*GelbWeis*/ #define PO(n) LEDPORT_##n #define POR(n) PORT@PO(n) #define PA(n) LEDPAD_##n #define PAD(n) PA(n) #define LEDAN(n) BIT_STD_SET(POR(n),PAD(n)) #define f(a,b) a##b #define g(a) #a #define h(a) g(a) int main() { printf("%s\n",h(LEDAN(0))); printf("%s\n",h(LEDAN(1))); printf("\n"); printf("%s\n",h(LEDAN(1))); printf("\n"); printf("%s\n",h(POR(0))); printf("%s\n",h(POR(1))); printf("%s\n",h(f(0,1))); printf("%s\n",g(f(0,1))); return 0; } //End of c code p@d:~/$ gcc ./mak.c and got p@d:~/$ ./a.out Answer: ((PORT@C) |= (1<<(3))) ((PORT@D) |= (1<<(4))) ((PORT@D) |= (1<<(4))) PORT@C PORT@D 01 f(0,1) the "@" should be removed. unfortunately, I do not know how. I have read some manuals, but I do not know how to express my self. Thanks a lot. @admins to mark code via 4 spaces is a bad and time consuming way
<c><avr><avr-gcc><avrdude>
2016-08-21 10:23:04
LQ_EDIT
39,066,411
How to get the local ip address using php?
<p>I 'm creating a web app in which i need to save the sessions in the database including the Ip address of the user and the date and time of the session , for that i want to know how to do that ,knowing that the app will be used in LAN . i 'm using codeIgniter framework.</p>
<php><codeigniter>
2016-08-21 16:29:28
LQ_CLOSE
39,066,729
JAVA NullPointerException error (School project)
<pre><code>import android.app.ProgressDialog; import android.content.Context; import android.os.AsyncTask; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.io.InputStream; import java.lang.reflect.Array; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; /** * Created by Tim on 17-8-2016. */ public class ReadRss extends AsyncTask&lt;Void, Void, Void&gt; { Context context; //The URL where the app needs to get the information from String address = "http://www.sciencemag.org/rss/news_current.xml"; ProgressDialog progressDialog; ArrayList&lt;FeedItem&gt;feedItems; RecyclerView recyclerView; URL url; //The loading (Loading feed...) message public ReadRss(Context context, RecyclerView recyclerView){ this.recyclerView = recyclerView; this.context = context; progressDialog = new ProgressDialog(context); progressDialog.setMessage("Loading feed..."); } @Override //Shows the user that the page is loading (Loading feed...) protected void onPreExecute() { progressDialog.show(); super.onPreExecute(); } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); progressDialog.dismiss(); MyAdapter adapter = new MyAdapter(context, feedItems); recyclerView.setLayoutManager(new LinearLayoutManager(context)); recyclerView.addItemDecoration(new VerticalSpace(50)); recyclerView.setAdapter(adapter); } @Override protected Void doInBackground(Void... voids) { processXml(Getdata()); return null; } //!!!!!This part ensures all the data is collected from the feed and it is made ready //so it can be used by recycler view private void processXml(Document data) { if (data!=null) { //Add all feedItems to an ArrayList feedItems = new ArrayList&lt;&gt;(); //Object that will store root elements Element root = data.getDocumentElement(); //Node object that will show channel Node channel = root.getChildNodes().item(1); //Store all child of channel element NodeList items = channel.getChildNodes(); //Loop trough each child element of items for (int i=0; i&lt;items.getLength(); i++){ Node currentchild = items.item(i); //Check that node is item node by using an if statement if (currentchild.getNodeName().equalsIgnoreCase("item")){ FeedItem item = new FeedItem(); //Store childs in NodeList of current item NodeList itemchilds = currentchild.getChildNodes(); //For loop to loop through all childs of item tag for (int j=0; j&lt;itemchilds.getLength(); j++){ //Store current node Node current = itemchilds.item(j); //Check node is title, description, pubDate, link or thumbnail node by if else conditions if (current.getNodeName().equalsIgnoreCase("title")){ //If node is title, description, pubDate, link or thumbnail then set textcontent of our current node item.setTitle(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("description")){ item.setDescription(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("pubDate")){ item.setPubDate(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("link")){ item.setLink(current.getTextContent()); }else if (current.getNodeName().equalsIgnoreCase("media:thumbnail")){ //This will return a thumbnail url String url = current.getAttributes().item(0).getTextContent(); item.setThumbnailUrl(url); } } //feedItems to be added to the ArrayList&lt;FeedItem&gt; feedItems.add(item); } } } } public Document Getdata() { try { url = new URL(address); //Open connection by using Http url connection object HttpURLConnection connection = (HttpURLConnection) url.openConnection(); //Sets request method as GET connection.setRequestMethod("GET"); InputStream inputStream = connection.getInputStream(); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDoc = builder.parse(inputStream); return xmlDoc; } catch (Exception e) { e.printStackTrace(); return null; } } } </code></pre> <p>When adding this code for a RSS Reader to our final project (for school) we are getting this error:</p> <pre><code>08-21 16:53:27.583 2734-2734/com.example.codru.stendensocial E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.codru.stendensocial, PID: 2734 java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference at com.example.codru.stendensocial.ReadRss.onPostExecute(ReadRss.java:61) at com.example.codru.stendensocial.ReadRss.onPostExecute(ReadRss.java:28) at android.os.AsyncTask.finish(AsyncTask.java:651) at android.os.AsyncTask.-wrap1(AsyncTask.java) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) </code></pre> <p>We don't know how to fix this. We read something about adding final in front of setLayoutManager, but could not figure out how to do this.</p> <p>Any help would be highly appreciated!</p> <p>~ Tim</p>
<java><xml>
2016-08-21 17:06:43
LQ_CLOSE
39,067,727
What is the max number of rows one should pull at once from a database?
<p>I have a process that iterates through thousands of database tables and aggregates data, and I want to set a threshold limit <code>N</code> where if the row count is larger than N my process will dump the data to a file.</p> <p>I'm wondering what would be a good limit for N?</p>
<sql><postgresql>
2016-08-21 18:50:11
LQ_CLOSE
39,068,086
Alternate to match function in R that returns list of indexes
<p>I am using <code>R 3.5</code><br> I want to get all indexes that contain zero in my list</p> <pre><code>a = c(1,2,3,0,5,7,0) </code></pre> <p>result should be</p> <pre><code>[1] 4 7 </code></pre> <p>should return the indexes as <code>match</code> will only return the first index in this case <code>4</code></p>
<r><match>
2016-08-21 19:29:28
LQ_CLOSE
39,068,316
Does the location of placing my <script> in html matter? Why does this code only work in one example? (code attached)
<p>This doesn't work:</p> <pre><code> &lt;h2&gt;Dinosaurs are cool.&lt;/h2&gt; &lt;script&gt; document.querySelector('.change-text').addEventListener('click', function () { document.querySelector('h2').innerText = 'I AM A DINOSAUR!!!'; }); &lt;/script&gt; &lt;button class='change-text'&gt;Change Text&lt;/button&gt; </code></pre> <p>But this does:</p> <pre><code> &lt;h2&gt;Dinosaurs are cool.&lt;/h2&gt; &lt;button class='change-text'&gt;Change Text&lt;/button&gt; &lt;script&gt; document.querySelector('.change-text').addEventListener('click', function () { document.querySelector('h2').innerText = 'I AM A DINOSAUR!!!'; }); &lt;/script&gt; </code></pre> <p>Any idea why? I've been told to link my javascript's at the top of the head, and that doesn't make this work either. </p> <p>I'd love some help, thank you so much =)</p>
<javascript><html>
2016-08-21 19:54:25
LQ_CLOSE
39,068,682
Python - Check if a string contains multiple words
<p>I'm wondering if there was a function in Python 2.7 that checks to see if a string contains multiple words (as in words with spaces/punctuation marks between them), similar to how <code>.isalpha()</code> checks to see if a string contains only letters?</p> <p>For example, if something along the lines of this exists...</p> <pre><code>var_1 = "Two Words" if var_1.containsmultiplewords(): print "Yes" </code></pre> <p>And then "Yes" would be the output.</p> <p>Thanks!</p>
<python><python-2.7>
2016-08-21 20:42:51
LQ_CLOSE
39,069,827
Customise/scale axis tick marks for 4 plots independent of each other in facet_wrap (RStudio)
[1]: http://i.stack.imgur.com/0Iq01.png I have created the above plot [1] using the code below: ggplot(data = gdt, aes(x = area)) + geom_histogram(bins = 10, colour = "black", fill = "grey50") + facet_wrap( ~ fires, scales = "free") + labs(x = "Area of Burnt Land (ha)", y = "Fires") + ggtitle("Count of Destructive Fires in Portugal (2007)") I want change the interval occurrence or the location of the tick marks individually for each sub plot, in other words I am trying to achieve a placement of one tick/grid-line at each point the bars meet. I have tried using scale_continuous and scale_x_discrete to no effect, if I set the marks to suit one of the sub plots it negatively affects the others. Is there a way to do this??
<r><plot><ggplot2>
2016-08-21 23:50:15
LQ_EDIT
39,070,091
r - How to make this loop faster?
<p>I am reading the <code>.csv</code> file named <code>cleanequityreturns.csv</code> which looks like this:</p> <p><a href="https://i.stack.imgur.com/c2BR1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c2BR1.png" alt="enter image description here"></a></p> <p>It goes from <code>r1</code> to <code>r299</code> and has 4,166 rows. The following code then creates a new file for each column, compute the approximate entropy using the <code>approx_entropy</code> function, and prints the value. I know creating a new file for each column is very tedious but I could not find another to do it.</p> <pre><code> equityreturn &lt;- read.csv("cleanequityreturns.csv", header=T) for(i in 1:299) { file2 = paste(i, "equityret.csv", sep="") file5 = paste("r", i, sep="") file1 = subset(equityreturn, select=file5) write.table(file1, file2, sep="\t", row.names=FALSE, col.names=FALSE) file3 = paste("equity", i, sep="") file3 = matrix(scan(file = file2), nrow=4166, byrow=TRUE) print(approx_entropy(file3, edim = 4, r=0.441*sd(file3), elag = 1)) } </code></pre> <p>My problem is the following: it takes a long time for the code to perform these tasks. I tried running it for 10 columns and it took about 20 min, which translates in about 10h for all of the 299 columns. Also, this code prints each approximate entropy values, so I still have to copy and paste them in Excel to use them.</p> <p>How could I make this code run faster and write the output in a <code>.csv</code> file?</p>
<r><loops><csv>
2016-08-22 00:45:10
LQ_CLOSE
39,070,310
Checking if command line arguments are empty/null
<p>If i am providing two arguments over the command line args[0] and args[1]. How do individually check if either of the arguments are empty/null? </p>
<java><arguments>
2016-08-22 01:32:52
LQ_CLOSE
39,070,388
How can a move a sprite using the keyboard with pygame,livewires?
Hello: I have tried multiple different ways to make this work. I am making a remake of a video game to learn pygame and livewires. I am using livewires because it seems to be a good way to have the background graphics loaded with a sprite. I am trying to have a pre-loaded sprite move horizontally, while staying mobile on the correct location (in this case it is 50 pixels up). I can get the sprite move using pygame or I can have the background with the sprite loaded in the right position or I can have the sprite move, but both seems to not occur at the same time. For added bonus, I am also going to need the screen to scroll right when the character moves a different position. Here is my code: import pygame, sys from livewires import games from pygame.locals import * games.init(screen_width = 640, screen_height = 480, fps = 50) #setup up the window siz class Mario(games.Sprite): def update(self, pressed_keys): move = 50 #Setup the origianl position of the character if pressed_keys[K_RIGHT]: move += 1 #press right key to move forward if pressed_keys[K_LEFT]: move -= 1 #press left key to move back def main(): pygame.init() screen_image = games.load_image("World 1-1.bmp", transparent = False) #setup the background image games.screen.background = screen_image mario_image = games.load_image("Mario3.bmp") mario = games.Sprite(image = mario_image, x = move, y=370) #setup the position of the character sprites.add(mario) pygame.display.update() while True: for event in pygame.event.get(): if event.type == QUIT: return pygame.quit() #if the player quits keys_pressed = pygame.key.get_pressed() games.screen.mainloop() main()
<python><pygame><livewires>
2016-08-22 01:47:24
LQ_EDIT
39,070,674
Why my project can't launch
August 22, 2016 10:16:15 morning org.apache.catalina.core.AprLifecycleListener init info: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_92\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_92/bin/server;C:/Program Files/Java/jre1.8.0_92/bin;C:/Program Files/Java/jre1.8.0_92/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;C:\Program Files\MySQL\MySQL Workbench 6.2 CE\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files\MongoDB\Server\3.2\bin;C:\Ruby23-x64\bin;C:\Users\MuteKen\AppData\Local\Microsoft\WindowsApps;C:\Users\MuteKen\AppData\Roaming\npm;C:\Users\MuteKen\Downloads\Programs;;. August 22, 2016 10:16:15 morning org.apache.tomcat.util.digester.SetPropertiesRule begin warning: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ife_service' did not find a matching property. August 22, 2016 10:16:17 morning org.apache.coyote.AbstractProtocol init info: Initializing ProtocolHandler ["http-bio-8080"] August 22, 2016 10:16:17 morning org.apache.coyote.AbstractProtocol init info: Initializing ProtocolHandler ["ajp-bio-8009"] August 22, 2016 10:16:17 morning org.apache.catalina.startup.Catalina load info: Initialization processed in 2895 ms August 22, 2016 10:16:17 morning org.apache.catalina.core.StandardService startInternal info: Starting service Catalina August 22, 2016 10:16:17 morning org.apache.catalina.core.StandardEngine startInternal info: Starting Servlet Engine: Apache Tomcat/7.0.56 August 22, 2016 10:16:18 morning org.apache.catalina.util.SessionIdGenerator createSecureRandom info: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [468] milliseconds. August 22, 2016 10:16:18 morning org.apache.catalina.loader.WebappClassLoader validateJarFile info: validateJarFile(C:\Users\MuteKen\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ife_service\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class August 22, 2016 10:16:23 morning org.apache.catalina.core.ApplicationContext log info: No Spring WebApplicationInitializer types detected on classpath August 22, 2016 10:16:23 morning org.apache.catalina.core.ApplicationContext log info: Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. It's the console display when I launched tomcat7.X, so what should I do now?? Please give a more detail response because I am a new here...
<java><eclipse><tomcat7>
2016-08-22 02:38:22
LQ_EDIT
39,072,564
how to make all android library compatible with all android versions?
My android application is not working on android versions like kitkat and below versions. Please any one can help me for a solution.App get unfortunately stopped on kitkat
<android>
2016-08-22 06:25:50
LQ_EDIT
39,072,692
How I redirect dynamic url with query string in php?
<p>I need to redirect dynamic URL like this "<a href="https://test.com?user=abc@gmail.com" rel="nofollow">https://test.com?user=abc@gmail.com</a>" to "<a href="https://test.com" rel="nofollow">https://test.com</a>" </p>
<php>
2016-08-22 06:35:27
LQ_CLOSE
39,072,776
how to change the column format "yyyy-mm-dd" to "yyyy-mm-dd in mysql
i want to change the format of column ENROLLED_ON "yyyy-mm-dd" to "mmm-yy". please help. ENROLLED_ON | ENROLLED_ON ------------| ------ yyyy-mm-dd | mmm-yy
<mysql>
2016-08-22 06:42:01
LQ_EDIT
39,072,965
How do i swap current user sql?
I got a login with multiple user's .How do i swap the current user. for example if i go select current_user it return's 'user1' i would like to become 'user2' how do i do that ? p.s can i add an password to a specific user or only to the login.
<sql-server>
2016-08-22 06:52:58
LQ_EDIT
39,073,518
Getting today date in this formart Sat Aug 22 2016 00:00:00 GMT+0400
How can i get today date in this format `Sat Aug 22 2016 00:00:00 GMT+0400`
<c#><asp.net>
2016-08-22 07:24:24
LQ_EDIT
39,073,624
Comparing two dataframe from history checking in Apache Saprk using scala
I have adataframe with following structure EmployeeDF id name date code 1 John 2015-4-14 C11 2 Roy 2011-5-20 C11 3 John 2010-5-20 C11 4 John 2012-5-20 C10 No i want to check history that if same code is apply to same employee two year ago. How can i do that. It is only sample data i have million of data in the dataframe and i want to achieve performance. Joining the dataframe slow down the performance because row are repeated so i make Cartesian and duplicate the rows during self join. I want to achieve with something like map.
<scala><apache-spark>
2016-08-22 07:30:27
LQ_EDIT
39,075,359
How to open an external webpage on af:commandButton click in Oracle ADF?
How to open an external webpage on click of afcommandButton . I need , on click of a button, a new tab will be opened with a pre-defined webpage address from database.
<jakarta-ee><oracle-adf><jdeveloper>
2016-08-22 09:04:57
LQ_EDIT
39,075,502
Urgent help , please
hello and thank you very very much in advance for helping me with this , i have this array, that is dumped from woocommerce using this lines : $items = $woocommerce->cart->get_cart(); foreach($items as $item => $values) { } array(1) { ["f584d8671586d336d84e8cf9ed43303c"]=> array(11) { ["booking"]=> array(15) { ["_year"]=> int(2016) ["_month"]=> int(8) ["_day"]=> int(28) ["_persons"]=> array(1) { [0]=> int(1) } ["_date"]=> string(9) "2016-8-28" ["date"]=> string(13) "28 août 2016" ["_time"]=> string(5) "21:30" ["time"]=> string(11) "21 h 30 min" ["_qty"]=> int(1) ["Personnes"]=> int(1) ["_start_date"]=> int(1472419800) ["_end_date"]=> int(1472421600) ["_all_day"]=> int(0) ["_cost"]=> int(0) ["_booking_id"]=> int(13013) } ["product_id"]=> int(12856) ["variation_id"]=> int(0) ["variation"]=> array(0) { } ["quantity"]=> int(1) ["line_total"]=> float(0) ["line_tax"]=> int(0) ["line_subtotal"]=> int(0) ["line_subtotal_tax"]=> int(0) ["line_tax_data"]=> array(2) { ["total"]=> array(0) { } ["subtotal"]=> array(0) { } } ["data"]=> object(WC_Product_Booking)#11131 (20) { ["availability_rules":"WC_Product_Booking":private]=> array(0) { } ["id"]=> int(12856) ["post"]=> object(WP_Post)#11132 (24) { ["ID"]=> int(12856) ["post_author"]=> string(2) "14" ["post_date"]=> string(19) "2016-08-16 22:04:09" ["post_date_gmt"]=> string(19) "2016-08-16 20:04:09" ["post_content"]=> string(0) "" ["post_title"]=> string(10) "La Cuchara" ["post_excerpt"]=> string(0) "" ["post_status"]=> string(7) "publish" ["comment_status"]=> string(4) "open" ["ping_status"]=> string(6) "closed" ["post_password"]=> string(0) "" ["post_name"]=> string(12) "la-cuchara-2" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) "" ["post_modified"]=> string(19) "2016-08-16 22:13:52" ["post_modified_gmt"]=> string(19) "2016-08-16 20:13:52" ["post_content_filtered"]=> string(0) "" ["post_parent"]=> int(0) ["guid"]=> string(59) "" ["menu_order"]=> int(0) ["post_type"]=> string(7) "product" ["post_mime_type"]=> string(0) "" ["comment_count"]=> string(1) "0" ["filter"]=> string(3) "raw" } ["product_type"]=> string(7) "booking" ["shipping_class":protected]=> string(0) "" ["shipping_class_id":protected]=> int(0) ["total_stock"]=> NULL ["supports":protected]=> array(0) { } ["price"]=> string(1) "0" ["wc_display_cost"]=> string(0) "" ["wc_booking_base_cost"]=> string(0) "" ["wc_booking_min_duration"]=> string(1) "1" ["wc_booking_cost"]=> string(0) "" ["wc_booking_has_resources"]=> string(2) "no" ["wc_booking_has_persons"]=> string(3) "yes" ["wc_booking_has_person_types"]=> string(2) "no" ["wc_booking_min_persons_group"]=> string(1) "1" ["tax_status"]=> string(7) "taxable" ["stock_status"]=> string(7) "instock" ["manage_stock"]=> string(2) "no" } } } what i need to recover the booking date, time and persons into variables : ["date"]=> string(13) "28 août 2016" ["_persons"]=> array(1) { [0]=> int(1) } ["time"]=> string(11) "21 h 30 min"
<php><wordpress><woocommerce><cart><woocommerce-bookings>
2016-08-22 09:12:03
LQ_EDIT
39,075,958
How to check if a user has administrative privileges by user name/domain
How can I know if a user has administrative privileges if the only information that I have is the user name (and domain if relevant)? I do know how to get this information for the current user. However, in my case, I need to get this information for a user which is not logged in yet (I'm working on Credential Provider). Therefore, I can only use the user name & domain. I'm working with C#/C++.
<c#><c++><windows><winapi><credential-providers>
2016-08-22 09:33:11
LQ_EDIT
39,076,928
How To use variable values from one method to another method in c#?
I have a GUI functioning code, in which I am using two 'button' methods. I want to use values of some variables from first method to another. like- I want to use values of h and w of button1_Click in button2_Click. How is it possible ?? public int h, w; public Form1() { InitializeComponent(); textBox1.Text = "Image Path here ..."; } public void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Select an Image"; dlg.Filter = "jpg files (*.jpg)|*.jpg"; if (DialogResult.OK == dlg.ShowDialog()) { this.pictureBox1.Image = new Bitmap(dlg.FileName); Bitmap img = new Bitmap(dlg.FileName); int w = img.Width; int h = img.Height; pictureBox1.Height = h; pictureBox1.Width = w; textBox1.Text = dlg.FileName; } } public void button2_Click(object sender, EventArgs e) { MessageBox.Show("Height is- " + h.ToString() + " Width is- " + w.ToString(), "Height & Width"); } } }
<c#>
2016-08-22 10:17:32
LQ_EDIT
39,077,651
why is Inline SQL a bad thing to include in an application
<p>I have been doing some research on SQL to boost my knowledge on the topic, I have came across quite a few people saying that Inline SQL is a bad thing but no one is saying why, I was hoping someone could help me to understand; Why inline SQL within an application (Such as c#) is a bad thing, thanks.</p>
<c#><c++><sql><sql-server>
2016-08-22 10:51:53
LQ_CLOSE
39,077,946
select first div of mutliple div with same class name
<p>Anyone know how to select first div of mutliple div with same class name</p> <pre><code>&lt;div class="abc"&gt;&lt;a&gt;&lt;img src=""&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="abc"&gt;&lt;a&gt;&lt;img src=""&gt;&lt;/a&gt;&lt;/div&gt; </code></pre> <p>how can i select first img in css?</p>
<css>
2016-08-22 11:05:55
LQ_CLOSE
39,080,801
What's the difference between IClonable and partial classes
<p>What's the difference between using <code>System.IClonable</code> and <code>partial</code> classes? And if there is one difference, when should one be used over the other? Are there some best practices?</p>
<c#>
2016-08-22 13:24:10
LQ_CLOSE
39,080,872
how can i fix this Error in Wamp_Server?
<p><strong>I have problem in my wamp server . I dont know how to fix that . You can see the Error in photo ??</strong> <a href="https://i.stack.imgur.com/xH0ES.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xH0ES.png" alt="enter image description here"></a></p> <p><em>help me . Thanks</em></p>
<php><mysql><phpmyadmin><wamp><wampserver>
2016-08-22 13:27:21
LQ_CLOSE
39,081,412
Cannot implicity convet type error
Sorry guys, I'm totaly new on this. Trying to fill Combobox with data from a database and I'm using ExecuteReader as below, but when I try to instanciate my connection it shows me the error "Cannot implicity convet type error". My BDConnect class code: public class DBConnect { private SqlConnection connection; private string servername = "10.1.76.109,1433"; private string database = "EngLib"; private string dbuser; private string userpassword; public DBConnect() { } public void doDBConnect(string dbuserform, string userpasswordform) { dbuser = dbuserform; userpassword = userpasswordform; } public void Initialize() { } public bool openConnection() { string connectionString; connectionString = "Server=" + servername + ";Database=" + database + ";user id=" + dbuser + ";Password=" + userpassword; Console.WriteLine(connectionString); connection = new SqlConnection(connectionString); try { connection.Open(); return true; } catch (SqlException ex) { switch (ex.Number) { case 0: MessageBox.Show("Não é possível contactar o servidor. Entre em contato com o administrador"); break; case 18456: MessageBox.Show("Usuário/Senha inválidos, tente novamente"); break; } return false; } } My form code: { public Form2() { InitializeComponent(); } public void Form2_Load(object sender, EventArgs e) { SqlDataReader rdr = null; DBConnect sqlConnection; sqlConnection = new DBConnect(); sqlConnection.doDBConnect(dbuserform: "usertest", userpasswordform: "usertest"); { try { { sqlConnection.openConnection(); SqlCommand sqlCmd; sqlCmd = new SqlCommand("SELECT Material FROM EngLib"); sqlCmd.Connection = sqlConnection; SqlDataReader sqlReader = sqlCmd.ExecuteReader(); while (sqlReader.Read()) { comboBox1.Items.Add(sqlReader["Material"].ToString()); } sqlReader.Close(); } } finally { // close the reader if (rdr != null) { rdr.Close(); } } } } } } The user and password in the code is just temporary.
<c#><executereader>
2016-08-22 13:54:11
LQ_EDIT
39,082,493
gradle build sync failed what should i do?
:app:processDebugResources C:\Users\admin\AndroidStudioProjects\ishan\app\src\main\res\layout\activity_main.xml Error:(11) Error parsing XML: junk after document element Error:Execution failed for task ':app:processDebugResources'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\admin\AppData\Local\Android\Sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1 Information:BUILD FAILED Information:2 errors Information:Total time: 5.789 secs
<android><android-studio><gradle><android-gradle-plugin><build.gradle>
2016-08-22 14:44:19
LQ_EDIT
39,082,999
Object reference is required for non-static field. List<>
<p>I'm a little confused about this fairly typical error. My code is as below. I am trying to add items to a list.</p> <p>The compiler is saying I need an object reference for non-static field, but I can't make the class static because I am not returning a value...?</p> <pre><code> public class ApplicantData { public string Salutation { set; get; } public string FirstName { set; get; } public string LastName { set; get; } } public class ApplicantList : List&lt;ApplicantData&gt; { public void Add(string salutation, string firstName, string lastName) { var data = new ApplicantData { Salutation = salutation, FirstName = firstName, LastName = lastName }; this.Add(data); } } </code></pre> <p>The above is called via:</p> <pre><code>List ApplicantsDetailsData = ApplicantList.Add(salutation, firstname, lastname); </code></pre> <p>I'm sure the answer must be obvious... (!)</p>
<c#>
2016-08-22 15:07:14
LQ_CLOSE
39,083,355
EDI edifabric x12 813 format in C#
Unable to switch Tax Information Amount and Form Group, it should be Form Group first before TIA. Thanks in advance.
<c#><edi><x12><edifabric>
2016-08-22 15:25:12
LQ_EDIT
39,084,097
Closing PHP tags after exit or die functions
<p>Should I close PHP tags after <code>die</code> or <code>exit</code> functions or it is not necessary?</p>
<php>
2016-08-22 16:06:26
LQ_CLOSE
39,084,962
How to read Cell if it has two dashes (-) in it?
<p>I am trying to read the cell and see if the invoice number has two dashes (-).</p> <p>So for example:</p> <p>4-2949493</p> <p>4-9390023-1</p> <pre><code>If (e.Row.RowType = DataControlRowType.DataRow) Then If (e.Row.Cells(1).Text.ToString = (TWO DASHES) Then Else End If End If </code></pre> <p>How would I check to see if it has two dashes? The invoice length changes every time too.</p>
<asp.net><vb.net>
2016-08-22 16:59:08
LQ_CLOSE
39,085,357
in c++ how to declare 3D dimensional vector in a 3D dimensional vector
<p>How can I declare a 3D dimensional vector in C++ such that each element is in turn a 3d vector whose size I would in prior.</p>
<c++><boost><stl>
2016-08-22 17:24:30
LQ_CLOSE
39,085,664
Unknown error in c++ program
<p>I have a c++ program which opens an url depending in what the user inputs.</p> <p>Here's the code:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main(){ int i = 1; string google = "https://www.google.com/search?q="; string input; getline(cin, input); string changeSpace(string input) { for (int i = 0; i &lt; text.length(); i++) { if (text[i] == ' ') text[i] = '+'; } return text; } input = changeSpace(input); cout &lt;&lt; input &lt;&lt; endl; string url = string(google + input); system(string("start " + url).c_str()); cout &lt;&lt; url &lt;&lt; endl; } </code></pre> <p>The error is here:</p> <pre><code>string changeSpace(string input) { </code></pre> <p>In the bracket it says it expected a " ; "</p> <p>And I don't know why ocurrs that error, it may be a simple mistake, but I don't know it.</p> <p>Please help me.</p>
<c++>
2016-08-22 17:44:54
LQ_CLOSE
39,087,058
jQuery(...).autoComplete is not a function
<p>I'm trying to get autoComplete() to work from jQuery-ui. I've created a fiddle to show my code:</p> <p><a href="https://jsfiddle.net/4s4dzwn1/" rel="nofollow">https://jsfiddle.net/4s4dzwn1/</a></p> <p>My JS:</p> <pre><code>jQuery(function(){ jQuery('#autocomplete').autoComplete({ source: ["ActionScript", "Bootstrap", "C", "C++", "Ecommerce", "Jquery", "Groovy", "Java", "JavaScript", "Lua", "Perl", "Ruby", "Scala", "Swing", "XHTML"] }); }); </code></pre> <p>My HTML:</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;form&gt; &lt;input id="autocomplete"&gt; &lt;/form&gt; </code></pre> <p>It's throwing an error that says autoComplete is not a function. My understanding is that autoComplete is a part of jQuery-ui (which is included), and that jQuery-ui should be included <strong>after</strong> jquery. Please correct me where I'm wrong.</p>
<jquery><jquery-ui><autocomplete>
2016-08-22 19:10:38
LQ_CLOSE
39,087,259
php code inside divs inside a php array
<p>Hi guys sorry for the bad english :) i have this code below that echo the some divs defined inside the array i want to include a php page (example below ) inside those divs : </p> <pre><code>&lt;?php $items =array( '&lt;div id="o-31" class="col-sm-6 col-md-4 col-lg-3" &gt; &lt;div id="mydid" &gt; &lt;/div&gt;&lt;/div&gt;', '&lt;div id="o-36" class="col-sm-6 col-md-4 col-lg-3" &gt;&lt;div class="demo-content bg-alt" &gt;.col-sm-8&lt;/div&gt;&lt;/div&gt;', '&lt;div id="o-37" class="col-sm-6 col-md-4 col-lg-3" &gt;&lt;div class="demo-content bg-alt" &gt;.col-sm-8&lt;/div&gt;&lt;/div&gt;', '&lt;div id="o-38" class="col-sm-6 col-md-4 col-lg-3"&gt;&lt;div id="mydid" &gt; &lt;/div&gt;&lt;/div&gt;' ); ?&gt; &lt;?php for($i = 0; $i &lt;= 3; $i++){ echo $items[$i]; } ?&gt; </code></pre> <p>i cant see how i can add a php code inside the div i tried : </p> <pre><code> '&lt;div id="o-31" class="col-sm-6 col-md-4 col-lg-3" &gt; &lt;div id="mydid" &gt; &lt;?php $ccc= "ff"; $tablelink2=$_SESSION['hes_2']; $tabletitle2=$_SESSION['hes_1']; $tableimg2= $_SESSION['hes_3']; include('hes_2.php'); ?&gt; &lt;/div&gt;&lt;/div&gt;', </code></pre> <p>and </p> <pre><code>'&lt;div id="o-31" class="col-sm-6 col-md-4 col-lg-3" &gt; &lt;div id="mydid" &gt;' &lt;?php $ccc= "ff"; $tablelink2=$_SESSION['hes_2']; $tabletitle2=$_SESSION['hes_1']; $tableimg2= $_SESSION['hes_3']; include('hes_2.php'); ?&gt; '&lt;/div&gt;&lt;/div&gt;', </code></pre> <p>also not working :( ? </p>
<php><html>
2016-08-22 19:24:58
LQ_CLOSE
39,088,713
Java - Get Objects to Arraylist and stream it
I want to write Objects from a Jlist(with DefaultListModel) into Arraylist, so that I can use it to save/load (stream) them. How can I get the Objects into the Arraylist? Which is the best way to stream it? (buffered/filewriter,reader) Thanks for answering
<java><object><arraylist>
2016-08-22 21:03:47
LQ_EDIT
39,090,006
Websocket : javascript as client and python as server, and web host on Linux
I need to build the website and use the javascript as client language to communicate with python server. BTW, the webpage need to be host on Linux. and for now, I just only use the command "python -m SimpleHTTPServer" to build a simple server. and the server is also on the Linux and use the python. could anyone kindly to teach me how to build this system. thanks you!
<javascript><python><websocket><server><tcp-ip>
2016-08-22 23:03:41
LQ_EDIT
39,090,551
How do i get the value of text inside of the file using Qt?
the data of my file.txt is below: Student_ID=0001 Student_Name=joseph Student_GradeLevel=2 How do i get the value, let say i want to get the Student_ID using Qt. Thanks.
<c++><algorithm><qt>
2016-08-23 00:23:27
LQ_EDIT
39,091,203
sql grouping and sum claims totals
i am new in sql, I am trying to group the following CLAIM # LINE SEQ AMNT BILLED AMOUNT ALLOWED AMOUNT PAID COPAY LA123456 1 20 18 15 3 LA123456 2 10 5 5 0 LA123456 3 50 30 30 0 MS123456 1 20 18 15 3 MS123456 2 10 5 5 0 MS123456 3 50 30 30 0 I am expecting to see something like this CLAIM # AMOUNT BILLED AMOUNT ALLOWED AMOUNT PAID COPAY LA123456 80 53 50 3 MS123456 80 53 50 3 Any advise on how to do it?
<mysql>
2016-08-23 02:01:14
LQ_EDIT
39,091,533
No ... when text is too long in UIbutton (Swift)
When the text is too long, uibutton will show ..., is it possible to delete ... ?
<ios><swift><uibutton><uikit>
2016-08-23 02:46:00
LQ_EDIT
39,092,161
Javascript Function Call
<p>The question is really simple but i searched everywhere couldn't get an answer.</p> <pre><code>add(); function add() { //function code here } </code></pre> <p>The above code works in JavaScript even though function call is before function definition but wouldn't work in language such as C or C++. Could anyone tell me why?</p>
<javascript><function>
2016-08-23 04:05:00
LQ_CLOSE
39,092,800
JAVA-SQL QUERY TO TO EXTRACT DATA FROM TWO TABLES
Select concat(substr(T_data,1,9),'001 ') AS Test_Data from DB1.T1 ; Select * from DB1.T2 WHERE Test_Data = 'Test_Data'; I need to join the DB1.T1 and DB1.T2 based on Test_Data
<java><sql>
2016-08-23 05:08:34
LQ_EDIT
39,092,896
To fetch distinct record in a table using sql
[enter image description here][1]i have redundancy data in the table where i have to fetch only distinct records in my table . here my table data sample here only unique records should be displayed which means 4th and last record in the table.. please suggest on this [1]: http://i.stack.imgur.com/aGzhB.png
<sql>
2016-08-23 05:16:53
LQ_EDIT
39,094,144
Retrieve next Id from table using specific id from same table
<p>I am working on Blog, If user chooses to read Full Post from home page, it redirects to Details page where only one post gets displayed with all details, where all data being displayed from database table.</p> <p>What I want to implement is, user can redirect to next post from Details page only, using NEXT button placed at bottom of Details page. I have Post ID in in Querystring. Now I want NEXT post's ID so I can redirect user to Next post.</p> <p>Please help me to retrieve Next ID from table using specific ID.</p> <p>Thanks in Advance.</p>
<c#><asp.net><sql-server>
2016-08-23 06:48:12
LQ_CLOSE
39,094,801
Appending new key vale pairs to the existing shared preferences
Please can any one tell me how to append new key value pairs to the already exsisting shared preferences.
<android><sharedpreferences>
2016-08-23 07:22:57
LQ_EDIT
39,095,177
starting with regexes
<p><em>disclaimer: entirely new to regexes</em></p> <p>I am trying to write a simple regex to validate email strings like this:</p> <pre><code>/^\w+@\w+\.\w{1,4}/.test(emailstring); </code></pre> <p>The above should return false for = a@d.abcde but true for a@d.abcd. I need the extension to be limited to four characters {1,4}. But it always returns true for any length of tld extension. What's wrong in the above expression?</p>
<javascript><regex>
2016-08-23 07:40:49
LQ_CLOSE
39,095,375
how to download sample text file when i click the link in d3.js?
<!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <a href="">Please Download Sample file</a> <!-- end snippet --> <!-- begin snippet: js hide: false console: true babel: false --> i have to download following sample.txt file when i click the link.. how to add download option in d3.js <!-- language: lang-html --> sample.txt: hello world... <!-- end snippet -->
<html>
2016-08-23 07:52:18
LQ_EDIT
39,099,808
Java Division Of Integer With Brackets
<p>In my app I ask the user to provide their hourly rate, I then have a Chronometer which I want to work out how much they have earned since the time started. To do this I need to turn their hourly rate into a seconds rate and multiply it by the seconds from the Chronometer.</p> <pre><code> timer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() { @Override public void onChronometerTick(Chronometer chronometer){ long timeElapsed = SystemClock.elapsedRealtime() - timer.getBase(); int hours = (int) (timeElapsed / 3600000); int minutes = (int) (timeElapsed - hours * 3600000) / 60000; int seconds = (int) (timeElapsed - hours * 3600000 - minutes * 60000) / 1000; int hrlyRate = Integer.parseInt(hourlyRate.getText().toString()); secondsRate = (hrlyRate / 60) / 60; moneyEarned = secondsRate * seconds; Log.d("hrlyRate", Integer.toString(hrlyRate)); Log.d("secondsRate", Integer.toString(secondsRate)); } }); </code></pre> <p>Say the user enters 40 into the hourlyRate field which I get from an EditText, why is the calculation of secondsRate = 0? Shouldn't it be (40 / 60) / 60 = $0.01 / second?</p>
<java><android><integer><division>
2016-08-23 11:23:22
LQ_CLOSE
39,101,084
C char array storing a variable
<p>I would like to store 2 variables into char array, and print our the first one as shown below.</p> <pre><code>const char *a[2]; a[0] = getCapital(bufferStore); //"Australia" a[1] = getCurrencyCode(bufferStore); "9876.00" printf("%s", a[0]); </code></pre> <p>However, I did not get any output. The code of getCapital and getCurrencyCode should be redundant here. The main thing I want to find out is how I can print out "Australia". I'm new to C language and pointers are really hard to understand, and my assignment is due in 2 hours. Any help will be greatly appreciated!</p>
<c><arrays>
2016-08-23 12:21:34
LQ_CLOSE
39,101,341
Whats happening in memory when I use references in c++?
<p>Let me start by saying that I understand pointers. I know what they are and how they work. But I know them because I visually imagine how they are being used in memory by saving the address of something else and so on.</p> <p>I'm trying to find information online and I can seem to find any information on how references are treated.</p> <p>Could someone either link or explain how they work having memory management in mind?</p> <p>thx</p>
<c++><reference>
2016-08-23 12:33:49
LQ_CLOSE
39,101,525
MVC model not saving the value
<pre><code> var ticketnumber = TempData["ticketId"] as Ticket; ticketnumber.TicketId = model.TicketId; db.SaveChanges(); HttpPostedFileBase file = Request.Files["ImageData"]; UploadRepository service = new UploadRepository(); int i = service.UploadImageInDataBase(file, model); </code></pre> <p>I have the value inside my tempdata but when i try to assign the value of it to the model value it doesnt save and even in debug it tells me the value hasnt changed so i just dont get what i am doing wrong.</p>
<c#><asp.net><asp.net-mvc>
2016-08-23 12:41:23
LQ_CLOSE
39,101,934
Urgent Help: Recycle View
I have used combination of recycle view E,g When we open Google play store we can scroll them horizontally and vertically to find an application, My problem: When i click on parent view it gives me the position of parent however when i click on child view,i get child position (Note: when i click on child view i need parent position please help with this), Again: I want my functionality should work same as Google play store in mobile so when i click on child view it must give me parent position, Help will really appreciated, Thanks
<android><android-recyclerview>
2016-08-23 12:58:38
LQ_EDIT
39,102,846
Converting Julia jump to Python pulp
I stumbled upon a piece of software that I'd like to convert from Julia to Python (don't have much experience with either). I've spent a good amount of time on this section here and can't seem to get it working no matter what I do. @defVar(m, used_team[i=1:num_teams], Bin) @addConstraint(m, constr[i=1:num_teams], used_team[i] <= sum{skaters_teams[t, i]*skaters_lineup[t], t=1:num_skaters}) @addConstraint(m, constr[i=1:num_teams], sum{skaters_teams[t, i]*skaters_lineup[t], t=1:num_skaters} <= 6*used_team[i]) @addConstraint(m, sum{used_team[i], i=1:num_teams} == 3) If you see any glaring errors here please let me know. I can also add all of the code I'm using if needed. used_team = [LpVariable("y{}".format(i+1), 0, 1,cat = pulp.LpInteger) for i in range(num_teams)] m += sum(u for u in(used_team)) == 3 for j, (x,z) in enumerate( zip(xs, skaters_teams[:])): for i in range(num_teams): m += sum(z[i]*x) >=ut[i] m += sum(z[i]*x) <=6*ut[i]
<python><julia><pulp><julia-jump>
2016-08-23 13:39:14
LQ_EDIT
39,104,167
You get an 'aux ps' output where only 1 terminal was opened and a.out was executed 2 times, but you only called it once. Something in the trend of
<p><a href="https://i.stack.imgur.com/1gKxa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1gKxa.png" alt="enter image description here"></a></p> <p>The questions are as follows:</p> <ol> <li><p>How can we see from the above picture that only one terminal are open?</p></li> <li><p>Is it true that there is one parent process and two child processes? How can you say that? Can we determine the states of parent and the child?</p></li> </ol>
<linux><process><ps>
2016-08-23 14:37:40
LQ_CLOSE
39,105,849
HOW TO ANIMATE UIVIEW WITH A FOR LOOP
I'm a bit new to swift and iOS programming. I would like to move a rectangle within a for loop to create a random walk. But I only get the end position not motion in between. What do I have to do to see the individual steps? import UIKit import PlaygroundSupport class ViewController:UIViewController{ override func viewDidLoad() { super.viewDidLoad() } } class bird: UIView { var x:CGFloat var y:CGFloat override init(frame: CGRect){ self.x=0 self.y=0 super.init(frame: frame) } func stepit(dx: CGFloat, dy: CGFloat ){ self.frame.origin.x += dx self.frame.origin.y += dy } override func draw(_ rect: CGRect) { self.backgroundColor = #colorLiteral(red: 0.960784316062927, green: 0.705882370471954, blue: 0.200000002980232, alpha: 1.0) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } let viewController = ViewController() PlaygroundPage.current.liveView = viewController PlaygroundPage.current.needsIndefiniteExecution = true let b=bird(frame: CGRect(x: 0, y: 0, width: 20, height: 20)) viewController.view.addSubview(b) for i in i... 100 { b.stepit(dx: CGFloat(arc4random_uniform(10)), dy: CGFloat(arc4random_uniform(10) )) }
<ios><swift><uiview><swift3>
2016-08-23 15:58:34
LQ_EDIT
39,106,347
Mysterious Cipher appeared in my news feed
<p>SMK XKL JVWW JWDTDVQVW DWXCC WV GFY</p> <p>I have been trying to decipher this for past hours, but I am not anywhere close to finding the solution. I'd appreciate a clue or starting point, or perhaps a spoilery solution if anyone figures it out. This is seriously getting in the way of my productivity!</p>
<encryption><cryptography>
2016-08-23 16:25:20
LQ_CLOSE
39,106,353
NullReferenceException on DevExpress 16.2.1 XtraReport generation via ReportService on WebForms
<p>When using <code>ReportService</code> as report provider for <code>AspxDocumentViewer</code> in <em>DevExpress 2016 ver.1.2</em> <code>"Object reference not set to an instance of an object"</code> is shown as JS alert in browser when trying to show report.</p> <p>Caught internal exception has next info:</p> <pre><code>Object reference not set to an instance of an object. at DevExpress.XtraReports.Web.Native.ReportRenderHelper.GetPreparedOptions() at DevExpress.XtraReports.Web.Native.DocumentViewer.RemoteReportRenderHelper.CreatePageWebControl(IImageRepository imageRepository, Int32 pageIndex) at DevExpress.XtraReports.Web.Native.ReportRenderHelper.WritePage(Int32 pageIndex) at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportWebRemoteMediator.&lt;&gt;c__DisplayClass2.b__1(PrintingSystemBase printingSystem) at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerRemoteHelper.DoWithRemoteDocument[T](Byte[] bytes, Int32 pageIndex, Int32 pageCount, Func`2 func) at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportWebRemoteMediator.GetPage(ReportViewer viewer, RemoteDocumentInformation documentInformation, Int32 pageIndex) at DevExpress.XtraReports.Web.Native.DocumentViewer.DocumentViewerReportViewer.CallbackRemotePage()\r\n at DevExpress.XtraReports.Web.ReportViewer.GetCallbackResult() at DevExpress.XtraReports.Web.ASPxDocumentViewer.GetCallbackResult() at DevExpress.Web.ASPxWebControl.System.Web.UI.ICallbackEventHandler.GetCallbackResult() </code></pre> <p>During small investigation 've noticed that report generation crashes after request to <code>ReportService.GetPages</code> method somewhere in inner DevExpress code. </p> <p>Pay attention, that same solution works ok using <em>DevExpress 15.2.7</em> so it's some kind of breaking changes between two versions.</p> <p>Same solution also works in current version when report is set directly to <code>AspxDocumentViewer.Report</code> (not using <code>ReportServiceClientFactory</code> and <code>ReportService</code>), so it seems to be a <code>ReportService</code> issue.</p> <p>ASP.Net WebForms application, report is as simple as possible (empty, no data usage).</p> <p>Was created <a href="https://www.devexpress.com/Support/Center/Question/Details/T418299" rel="nofollow" title="Ticket">ticket</a> on DevExpress site and it has in attach sample application to reproduce problem.</p>
<c#><asp.net><devexpress><xtrareport>
2016-08-23 16:25:54
LQ_CLOSE
39,106,376
Passing values from one HTML page to another
<p>I'm currently working on a online catalogue and need help with a specific feature. I have a page manageCards.xhtml which contains a table, which displays card information (this has been hard-coded). There is a button at the bottom of this page which takes them to a new page addNewCards.xhtml where they can fill in the relevant fields to register a new card.</p> <p>My question is, is there a way I can transfer the values between these pages and populate a new instance of the same table back on the manageCards.xhtml page, but for the newly registered card? I'm relatively new to both JavaScript and jQuery but I'm sure there's a way I'm not familiar with yet.</p> <p>Any help would be greatly appreciated</p> <p>Many thanks</p>
<javascript><jquery><html><jsf><xhtml>
2016-08-23 16:27:22
LQ_CLOSE
39,107,170
Converting and integer to a list in python
Is there anyway to convert a string of integers into a list e.g. `1234` to `['1','2','3','4','5']`
<list><python-2.7><integer>
2016-08-23 17:14:29
LQ_EDIT
39,107,654
unicodecsv doesn't read unicode css file
This is the file that I am reading (it is a public dataset free use) http://www.filedropper.com/u_2 This is the way I am reading it import unicodecsv as css def moviesToRDF(csvFilePath): with open(csvFilePath, 'rU') as csvFile: reader = csv.reader(csvFile, encoding='utf-8', delimiter= '|') for row in reader: print row moviesToRDF("u.item") This is the error I am getting: UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 3: invalid continuation byte the value that throws the error is: Misérables, Les What wrong did I do please? (i am using 2.7 python)
<python><python-2.7><unicode>
2016-08-23 17:43:58
LQ_EDIT
39,107,760
Stop people getting my ip from my domain name.?
<p>1st of all YES my domain name is pointed at my ip no hate. The reason that is because i have a minecraft server + teamspeak server + Webserver.</p> <p>NOW, i released a minecraft server 2 days ago, on the 1st day i got taken down from DDOS Attacks, Due to people pulling my ip from the Domain name AKA Host to IP. Is there anyone to create a fake ip that people get from host to ip. Ask Lets say my ip is: 1.2.3.4 and my domain name is: blabla.com and people do the host to ip it will show the wrong ip such as: 2.4.6.8. Is that possible?</p>
<server><vpn><mask><minecraft><ddos>
2016-08-23 17:50:36
LQ_CLOSE
39,107,828
Whats the purpose of "this" wen create object in memory? - android
someone can hellp me with this? i didnt undrerstand two things. one, is that thing: RelativeLayout.LayoutParams center_ob_l = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); what is the meaning of WARP.CONTENT and why shoukd i do this? second thing, is the "this": Button log_b = new Button(this); why should i send "this" in those brackets? and why at all i would want to create by myself the buttons and things instead of just go to the visual device and throw the things i want to the screen?
<android>
2016-08-23 17:55:48
LQ_EDIT
39,107,985
Hello!!! I am trying to convert an apk file to zip file. i have watched videos on youtube but its not working
At first, I have choose an apk named as bdteam. I tried utmost to find the source code. But i can not convert apk file to zip file. How can I solve my problem?
<android><reverse-engineering>
2016-08-23 18:07:12
LQ_EDIT
39,108,492
How can i re-write this haskell function complexity
<pre><code>c:: Integer -&gt; Integer c n | n &lt; 3 = n + 100 | otherwise = c (n-2) + c (n-3) + c (n-2) </code></pre> <p>Complexity of c in this form is exponential. Rewrite function c so that it's complexity is linear. c x should terminate if 1000 &lt; x 100000.</p>
<haskell>
2016-08-23 18:39:32
LQ_CLOSE