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
37,590,981
How to install Cuda in a Vagrant box, for optimus enabled laptops?
<p>I have performed a pci pass through on the vagrant config, enabled 3D acceleration. Installed Cuda, and tried to run the deviceQuery Cuda example, but unfortunately it tells me it can't pick up a device.</p> <pre><code>./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) cudaGetDeviceCount returned 38 -&gt; no CUDA-capable device is detected Result = FAIL </code></pre> <p>The card is a GF 740M, the driver is nvidia-352, I am using Ubuntu 14.04 in the Vagrant box. In vagrant:</p> <p>lspci shows:</p> <pre><code>$ lspci -nn | grep '\[030[02]\]' 00:02.0 VGA compatible controller [0300]: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter [80ee:beef] 01:00.0 3D controller [0302]: NVIDIA Corporation GK107M [GeForce GT 740M] [10de:0fdf] (rev a1) </code></pre> <p>bumblebeed:</p> <pre><code>$ bumblebeed [ 137.087712] [ERROR]No integrated video card found, quitting. </code></pre> <p>What could I be doing wrong? I can't believe how difficult it is to get nvidia drivers/cards working in a virtualization environment.</p>
<ubuntu><cuda><vagrant><vmware><nvidia>
2016-06-02 11:47:26
LQ_CLOSE
37,592,154
Why is this returning Garbage?
<p>I am making a calculator for a game.<br> I usually first make sure the code is working in C++, and then convert it to the desired language. I had made this program. In this program, some of the times, optDura stores the correct value and other times, it stores garbage. <br><br> Here is the code :-</p> <pre><code>#include &lt;iostream&gt; using namespace std; /* cd - current Durability se - smith efficiency in decimal sc - smith charges in decimal sE - smith efficiency in % sC - smith charges in % ic - initial cost md - maximum durability tmd - temporary maximum durability tD - temporary durability td - total durability rc - repair cost cpb - cost per battle */ int main(){ long int currDura, maxDura, tempMaxDura, tempDura, totDura, optDura; double iniCost, repCost; long int smithEffi, smithCharge; double se, sc; double totCostTillNow, costPerBattle = 0, minCPB; int i; long int repCount = 1; iniCost = 25500; currDura = 58; maxDura = 59; repCost = 27414; se = 0.90; sc = 0.85; tempMaxDura = maxDura; tempDura = currDura; totDura = tempDura; totCostTillNow = iniCost; costPerBattle = totCostTillNow / totDura; minCPB = costPerBattle; cout&lt;&lt;"\n Cost without any repair = "&lt;&lt;costPerBattle; for(i=1; i&lt;=maxDura; i++) { totCostTillNow += (double) repCost * sc; tempDura = tempMaxDura * se; totDura += tempDura; costPerBattle = (double) (totCostTillNow / totDura); tempMaxDura -= 1; if ( minCPB &gt;= costPerBattle ) { minCPB = costPerBattle; optDura = tempMaxDura; } } cout&lt;&lt;"\n Minimum cost per battle = "&lt;&lt;minCPB&lt;&lt;" &amp; sell at 0/"&lt;&lt;optDura; return 0; } </code></pre> <p>The problem occurs when repCost is >= 27414. For values less than that, it gives the desired result. I am unable to figure out why this is happening.</p> <p>Thanks a lot</p>
<c++><garbage>
2016-06-02 12:39:42
LQ_CLOSE
37,592,890
How to pass vaule of cell of datagridview to another form
There are two forms.In first form there is a textbox and a picture box.When picture box is clicked it opens the second form which contains a datagridview.What i want is when i clicked on the cell of a datagridview its value should be shown in the textbox of first form.I do not want to create object of first form in second form because data of grid views has to be passed to multiple forms
<c#><winforms>
2016-06-02 13:11:38
LQ_EDIT
37,594,353
What to change for this StringByApppendingPathComponent
My Swift code is not working after converting to Swift2.2. My code : Swift 1.0 code: Class func getPath(filename: String ) -> String { return NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory,NSSearchPathDomainMask.UserDomainMask,true)[0].stringByAppendingComponent(filename) } Please help. Thanks
<swift2>
2016-06-02 14:11:05
LQ_EDIT
37,595,376
Python regex wont match or escape backslashes
<p>So I'm trying to run through a file and match to a line in python, I understand regex but for some reason I can't get this one to work. </p> <pre><code> p1 = re.compile("\s*(service_description)\s*([A-Z]:\\\s*Drive\s*Space)") for x in cfg: #cfg is an array of everyline in the file if p1.match(x): print(p1.match(x).group(2)) </code></pre> <p>it works fine in pythex, but when I run my script I cannot get it to match. it I've tried different combos, but the second I add the \ in (trying to get a literal '\' it stops matching.</p> <p>for reference the line I'm trying to match to is </p> <pre><code> service_description M:\ Drive Space </code></pre> <p>where M could also be any letter caps A-Z </p>
<python><regex><python-2.7>
2016-06-02 14:57:05
LQ_CLOSE
37,595,854
How to implement a switch button with a button
<p>Helllo, i'm new in programming android my question is there a method for let a button create a new switch button with some caratteristic i want to, for example the name and a number.</p>
<android>
2016-06-02 15:17:18
LQ_CLOSE
37,596,185
Why i cant call my function when i put a paramether
Can somebody tell me why when i put "3" for paramether in function a() doesnt work? is that a wrong way or? help please...[Function][1] [function call][2] [1]: http://i.stack.imgur.com/7rq3t.png [2]: http://i.stack.imgur.com/7GNgx.png
<javascript><html>
2016-06-02 15:31:30
LQ_EDIT
37,597,336
Image won't show up on website
<p>So I'm helping my friend with her website. The website is currently up and running but two images won't show up using lightbox on a specific page.</p> <p>The first two images will load properly when clicking the thumbnails. But the two on the bottom won't. I tried to access the images directly and found out that when i tried this <a href="http://www.containerwest.com/extensions/gallery/grandeprairie1.jpg" rel="nofollow">http://www.containerwest.com/extensions/gallery/grandeprairie1.jpg</a> (the link of the first image) it worked but not <a href="http://www.containerwest.com/extensions/gallery/grandeprairie4.jpg" rel="nofollow">http://www.containerwest.com/extensions/gallery/grandeprairie4.jpg</a> (the 3rd image that is supposed to work as well).</p> <p>The html code is like this:</p> <pre><code>&lt;table width="240" border="0" cellpadding="0" cellspacing="4"&gt; &lt;col width="240"&gt; &lt;col width="240"&gt; &lt;col width="240"&gt; &lt;tr valign="top"&gt; &lt;td width="200" style="border:2px solid #FFFFFF; padding: 3px; margin: 2.5px;"&gt; &lt;p align="center"&gt;&lt;a href="../extensions/gallery/grandeprairie4.jpg" rel="lightbox[cnrl]"&gt; &lt;img src="../extensions/gallery/grandeprairie4_200x200.jpg" alt="20' used container" style="width:200px;height:200px;" /&gt; &lt;/td&gt; &lt;td width="200" style="border:2px solid #FFFFFF; padding: 3px; margin: 2.5px;"&gt; &lt;p align="center"&gt;&lt;a href="../extensions/gallery/grandeprairie5.jpg" rel="lightbox[cnrl]"&gt; &lt;img src="../extensions/gallery/grandeprairie5_200x200.jpg" alt="20' used container" style="width:200px;height:200px;" /&gt; &lt;/td&gt; </code></pre> <p>The two images are in two cells in a table. And all the paths should be correct since all the images are under the same folder with the same dimensions(slightly different sizes though but nothing huge). The only difference is the numbers in their names.And the first two images are displayed using the same code. </p> <p>I can't figure out what is wrong here since the code seems right to me. I suspect the web host and not the lightbox.</p> <p>Any help would be appreciated! </p> <p>Thanks a lot!</p>
<html><css><image>
2016-06-02 16:28:49
LQ_CLOSE
37,597,481
Translating HTML/JS/CSS to Ruby on Rails
<p>At the moment I have created a webpage that makes use of HTML, CSS, and Javascript but I need to implement ruby on rails next in order to do back end stuff as well as it's what my boss told me to utilize. Now I have never utilized Ruby on Rails so any guidance will be greatly appreciated. </p> <p>Now I know that CSS has pre-processors such as SASS and others but how exactly do I utilize these. I also understand the basic structure of Rails in that there are different controllers and each one corresponds to different things. </p> <p>Basically I would just like some guidance on how to implement a Ruby on Rails framework.</p> <p>If you need any other information, I would be glad to oblige you with it. </p>
<javascript><html><css><ruby-on-rails><ruby>
2016-06-02 16:35:29
LQ_CLOSE
37,597,487
Database for .net web api
<p>I'm looking for a tip on what database I should use for my api.</p> <p>The api will be querying one table with maximum of 10 million rows. I'm looking for a free and easy DB which can interact well with c# .net.</p> <p>Any suggestions?</p>
<c#><.net>
2016-06-02 16:35:56
LQ_CLOSE
37,597,532
ajax post is not sending param
Req :in web application using struts/velocity javascript need to pass parameter to a method in java class. I have used ajax post call to servlet. But not able to receive the parameter in action class. javascript function ---------------------- funtion posttoservlet(){ var id=2 var param="Count="+id; var xmlhttp= new XMLHttpRequest(); xmlhttp.open("POST","DataServlet.action",true); xmhttp.setrequestheader('contenttype','plain/text'); xmlhttp.send(param); } struts.xml __________________________ <action name="DataServlet" method="getfromjs" class=com.test.servletpost> </action> servletpost.java ---------------------- public void getfromjs(){ syso(servletactioncontext.getrequest().getparameter("Count")); // This is printing null instead of printing "2". Please advise. } Iam confused why the parameter are not posted properly
<javascript><ajax>
2016-06-02 16:38:48
LQ_EDIT
37,598,226
How to create and validate forms in Javascript / JQuery?
<p>I'm currently developing a checkout form for an e-commerce site, as any other checkout there are a lot of validations on its fields, things like: </p> <ul> <li>If the user selects the radio buton 'I'm Company' show the VAT field.</li> <li>If the user has no billing address show the inputs to create a new shipping address. </li> <li>If the user has billing addresses list them as radio buttons.</li> </ul> <p>And a lot more, currently I'm using thinks like <code>addClass('hide')</code> or <code>removeClass('hide')</code>, in other cases I use <code>toggle()</code>, it works but somehow I feel that this is not a solid approach.</p> <p>Is there any 'Best Practices' to create forms and validate them?</p> <p>Best Regards.</p>
<javascript><jquery><html><validation>
2016-06-02 17:14:54
LQ_CLOSE
37,598,360
How do I separate out a sub-series in R?
I've got a csv file: id,device_id,type,value,timestamp 1432,4,temperature,21,2015-06-01T00:00:00Z 1433,4,motion,0,2015-06-01T00:00:15Z 1434,4,power,0,2015-06-01T00:00:30Z 1435,4,battery,4.16,2015-06-01T00:00:46Z 1448,4,temperature,21,2015-06-01T00:17:00Z 1449,4,motion,0,2015-06-01T00:17:15Z 1450,4,power,0,2015-06-01T00:17:30Z 1451,4,battery,4.16,2015-06-01T00:17:45Z 1464,4,temperature,21,2015-06-01T00:33:57Z ...... containing various sensor readings. It looks as though it represents four different time series, temperature, motion, power, and battery, with each reading taken at a slightly different time. Can I easily read in this file in R, and manipulate the data, say to plot the four graphs against the time? Or should I just pre-process it (e.g. in python or with grep) to make four different time series csvs first?
<r>
2016-06-02 17:22:16
LQ_EDIT
37,598,384
C do{} while(function(argumen)==1) in I/O FILES
<p>So i need to enter ID(int)(it has to be a 3 digit format) argument and make a check function if there is same ID in FILE datoteka.txt that i made. Thanks for help</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; struct struktura{ int ID; char imeprezime[20]; int placa; int godina; }; int clear_input_buffer(void) { int ch; while (((ch = getchar()) != EOF) &amp;&amp; (ch != '\n')) /* void */; return ch; } </code></pre> <p>ID check :cant get it to return flag = 1;</p> <pre><code>//function that should check if there is same ID as the one you enter //returning 1 if there is same ID or 0 if there is not int provjera(int IDprovjera){ int flag=0; int datID; FILE *datprovjera = NULL; datprovjera = fopen("datoteka.txt","r"); if(datprovjera == NULL){ printf("Nema datoteke!"); exit(2); } while(fscanf(datprovjera,"%d#%[^#]#%d#%d#",&amp;datID)==4){ if (datID == IDprovjera){ flag=1; break; } } fclose(datprovjera); return flag; } </code></pre> <p>Main</p> <pre><code>int main() { int i,M; int provjera_2; struct struktura radnik; FILE *datoteka = NULL; datoteka = fopen("datoteka.txt","w"); if (datoteka == NULL){ printf("Greska!"); exit(1); } printf("Unesi broj radnika:\n"); scanf("%d",&amp;M); for(i=0;i&lt;M;i++){ //ID do{ do{ printf("Unesi ID\n"); scanf("%d",&amp;radnik.ID); clear_input_buffer(); }while( provjera(radnik.ID)!=0); }while( radnik.ID/100&gt;9 || radnik.ID/100&lt;1); fprintf(datoteka,"%d",radnik.ID); fprintf(datoteka,"%c",'#'); //Ime Prezime printf("Unesi ime i prezime radnika:\n"); gets(radnik.imeprezime); fprintf(datoteka,"%s",radnik.imeprezime); fprintf(datoteka,"%c",'#'); //Placa printf("Unesi placu radnika:\n"); scanf("%d",&amp;radnik.placa); fprintf(datoteka,"%d",radnik.placa); fprintf(datoteka,"%c",'#'); //Godine do{ printf("Unesi godinu pocetka rada:\n"); scanf("%d",&amp;radnik.godina); clear_input_buffer(); }while( radnik.godina&lt;1970 || radnik.godina&gt;2016); fprintf(datoteka,"%d",radnik.godina); fprintf(datoteka,"%c\n",'#'); } fclose(datoteka); </code></pre>
<c>
2016-06-02 17:23:34
LQ_CLOSE
37,598,963
How do I have an array that has a set of coordinates in c++?
<p>I'm trying to record the coordinates in an array. So I want to record something like {{0,0},{0,1},{1,1}}. I thought about separating both integers by a space, and have the entire thing as a string, so (15 5) would be different than (1 55). I assume it's not very efficient, and using string arrays are very difficult.</p> <p>Here's the (bad) code I have so far:</p> <pre><code>#include &lt;string&gt; #include &lt;iostream&gt; using namespace std; int main(int argc, const char * argv[]) { bool going=true; int x=0; int y=0; string coordinates[] = {}; while (going==true){ to_string(y)+","+to_string(x) &gt;&gt; coordinates; x++; } return 0; } </code></pre> <p>What do I use?</p>
<c++><arrays>
2016-06-02 17:55:51
LQ_CLOSE
37,599,548
Mysql with ajax
<p>Here is my code that I'm using.</p> <p><strong>ajax</strong></p> <pre><code>$.ajax({ type: "GET", url: "process.php", dataType: "html", success: function(data){ $(".content").html(data); } }); $("#submit").click(function(){ $.ajax({ type: "POST", url: "post.php", dataType: "html", success: function(data1){ $(".content").html(data1); } }); }); </code></pre> <p><strong>process.php</strong></p> <pre><code>&lt;?php $db = mysqli_connect("localhost","root","","webcap"); $query = mysqli_query($db,"SELECT * FROM test"); while($row = mysqli_fetch_assoc($query)){ echo $row['num']; } </code></pre> <p><strong>post.php</strong></p> <pre><code>&lt;?php $db = mysqli_connect("localhost","root","","webcap"); $num_query = mysqli_query($db,"SELECT * FROM test"); $num_row = mysqli_fetch_assoc($num_query); $number = $num_row['num']; $new_number = $number + 1; $query2 = mysqli_query($db,"UPDATE test SET num='$new_number'"); echo $new_number; </code></pre> <p>The idea is when i click button it add plus one to my database and i can see it without refreshing but others don't.</p> <p>I want that everyone in my website see it in real time without refreshing</p>
<php><jquery><mysql><ajax><mysqli>
2016-06-02 18:28:25
LQ_CLOSE
37,602,368
Assistance with inheritance issue in C++
<p>I have a 2 C++ classes(A and B), let's say B inherits from A. </p> <p>They both need to have a toString() function. They are being called from a function that returns the base class type. After returning, I want to call the tostring() function for the correct type of class. If the function returns a B type object, I want to call the toString() from the B class.</p> <p>I think my problem is coming from the fact that the function returns a reference to the base class so it is calling the function from the base class.</p> <p>Example classes:</p> <pre><code>class A { std::string toString(); }; class B : public A { int extraThingToPrint; std::string toString(); //prints a different message than the A version }; </code></pre> <p>Example function:</p> <pre><code>A otherClass::scan() { if(otherVar == 'a') return A(); else if(otherVar == 'bb') return B(); } std::cout &lt;&lt; scan().toString(); //if bb plz print B.toString() and not A.toString() (but if a, use A.toString()) </code></pre>
<c++><inheritance>
2016-06-02 21:24:02
LQ_CLOSE
37,602,801
Is there a way for other classes to recongnize a public variable in another class?
I am very new to this language and i am not too sure how to effectively use it.The coding language i am using is AS3 with flash Devlop. What i am trying to do is to allow the class Chapter to access a public variable in the class Main Menu. The variable is named YesNo and when i try to access it in the class Chapter it doesn't work. I had downloaded something called Flashpunk that came with presets for multiple different classes that helps with making games,i will show my Code below. Main Menu package { import net.flashpunk.Entity; import net.flashpunk.graphics.Image; import net.flashpunk.utils.Input; import net.flashpunk.utils.Key; import net.flashpunk.FP; public class MainMenu extends Entity { [Embed(source = "net/MainScreen.png")] private const SPRITE1:Class; private var sprite1:Image = new Image(SPRITE1); public var YesNo:int = 0 public function MainMenu() { graphic = sprite1; sprite1.centerOrigin(); x = 200 y = 150 layer = 150 } override public function update():void { if (Input.pressed(Key.DIGIT_1)) { YesNo = YesNo + 1 } if (Input.pressed(Key.DIGIT_2)) { YesNo = YesNo + 2 } } } } Chapter package { import net.flashpunk.Entity; import net.flashpunk.World; public class Chapter extends World { public function Chapter() { add(new MainMenu()) } } }
<actionscript-3><global-variables>
2016-06-02 21:55:10
LQ_EDIT
37,603,023
Input data to a shell script
<p>How could I create a shell script with input data ?</p> <p>Please enter names separated by a blank: John Marry Sanford Saunders</p> <pre><code>read names </code></pre>
<bash><shell>
2016-06-02 22:13:57
LQ_CLOSE
37,603,156
How to create variables in a loop in Python
<p>how would I be able to make something like this that actually works?</p> <pre><code>choices = input('Enter choices. ') i = 0 while i &lt; 10: number_of_{}s.format(i) = choices.count(str([i])) i += 1 </code></pre>
<python>
2016-06-02 22:28:18
LQ_CLOSE
37,603,407
C++ Erase not working as expected
<p>Consider this following program:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;algorithm&gt; // std::remove int main () { std::string str ("This is an example sentence blah"); std::remove(str.begin(), str.end(), '\t'); std::cout &lt;&lt; str ; return 0; } </code></pre> <p>There is a tab between the words (is,an) and (an,example), others are spaces. </p> <p>I expected the output to be :</p> <blockquote> <p>This isanexample sentence blah</p> </blockquote> <p>Instead, i am getting the following output:</p> <blockquote> <p>This isanexample sentence blahah</p> </blockquote> <p>Is there a buffer overrun somewhere for the extra '<strong>ah</strong>'?</p> <p>More: I noticed after several runs that, the number of trailing letters at the end is proportional to number of tabs being removed. In this case there are 2 tabs in the string, hence 2 extra trailing characters. I can take care of it by using erase, but why does it happen? I am not sure if it's a design flaw or am i missing something?</p>
<c++>
2016-06-02 22:54:29
LQ_CLOSE
37,603,830
Error 503 doing GET operation on survey
<p>I am using the API to GET and FETCH data from my 150 or so Google surveys. For some surveys I find the FETCH works OK but the GET is rejected with error 503. For instance:</p> <p><code>HttpError 503 when requesting https://www.googleapis.com/consumersurveys/v2/surveys/6mndemyqw5b5k?alt=json returned "Survey is configured in a way not supported by the API, i.e. contains unsupported question types or options Request Id: 5750b15c00ff025d5da8b9f4b00001737e3430322d747269616c320001707573682d30362d30322d7231330001010a</code></p> <p>The surveys are nearly all one single response questions and were created with the web interface. The common factor I notice is that the failing surveys I have looked at all contain an answer with a non-Latin character, e.g. <code>Siân Berry (Green)</code>.</p> <p>Whatever the reason, this is quite a problem because the GET operation is the only one that returns a full list of answers in the originally specified order. Also, the question text itself is only otherwise available by scraping the Overview sheet of the exported XLS file. I say scraping because so far as I can tell the spreadsheet format is neither documented nor stable - for instance the response data used to be in worksheet "1" but more recently seem to be in worksheet "Complete responses".</p>
<google-surveys>
2016-06-02 23:42:34
LQ_CLOSE
37,604,767
(learning java) Initialized variable reports it not initialed
<p>Having trouble finding whats wrong with my code. This is the only section that returns the error "error: variable assignmentTotal might not have been initialized". and "error: variable assignmentMaxTotal might not have been initialized" Any insight would be great!</p> <pre><code>import java.util.*; public class Grade { public static void main(String[] args) { homework(); } public static void homework() { int assScore; int assMax; int assignmentMaxTotal; int assignmentTotal; Scanner console = new Scanner(System.in); System.out.println("Homework and Exam 1 weights?"); System.out.print("Using weights of 50 20 30 "); int weights = console.nextInt(); System.out.println("Homework:"); System.out.print("Number of assignments? "); int n = console.nextInt(); for (int x = 0; x &lt; n; x++) { System.out.print("Assignment " + (x + 1) + " score and max? "); assScore = console.nextInt(); assMax = console.nextInt(); assignmentMaxTotal =+ assMax; assignmentTotal =+ assScore; } System.out.print("Sections attended? "); int sections = console.nextInt(); int sectionMax = 20; int sectionPoints = (sections * 4); int maxPoints = (assignmentMaxTotal + sectionMax); int totalPoints = (sectionPoints + assignmentTotal); System.out.println("Total Points = " + totalPoints + "/" + maxPoints); } } </code></pre>
<java>
2016-06-03 01:57:54
LQ_CLOSE
37,605,265
C++ How to delete an array with an int ptr pointing to it
Hi so I have something like: int *p=new int[3]; *p=1; p++; *p=2; delete [] p; Is this the correct way to delete the array that p is pointing to?
<c++>
2016-06-03 03:00:29
LQ_EDIT
37,605,848
Sum of Factorials numbers in javascript
I am beginner in programing and I want to sum the given factorials numbers in javascript '1! + 2! + 3! + ... + n!' Please help
<javascript><numbers><factorial>
2016-06-03 04:18:25
LQ_EDIT
37,607,072
android app button thats save the predefined contact to address book
<p>I need to add contact button in app, if user clicks on that a contact is stored in the user address book, with or without prompt.</p> <pre><code>Name:- sharukh khan website:- www.google.com Phone:- 9999999999 Phone:- 8888888888 email:- s@p.com skype:- linkedin:- etc </code></pre> <p>can anyone help? thanks naina</p>
<java><android><android-studio>
2016-06-03 06:10:11
LQ_CLOSE
37,607,403
Animation Proble m CSS
Hover doesnt work. https://jsfiddle.net/j52qz6v4/ .When mouse hover the div , animation must stop and never start again.I dont want to use jquery .box:hover { -webkit-animation-play-state: paused;}
<css><animation>
2016-06-03 06:30:55
LQ_EDIT
37,607,760
How to calculate how many time passed from the date with timezone?
I get from the server date with this format: 2016-05-27 17:33:43+0400 Now, I want to detect, how many time passed since that date? For example `1 day 5 hours 10 minutes 20 seconds`. How can I do it? I know how to calculate this from the timestamp, but do not know how to convert this to timestamp. Can anyone help me with it?
<ios><swift><swift2><nsdate>
2016-06-03 06:50:47
LQ_EDIT
37,607,875
Create directory structure in unix
<p>I want to create directory structure based on year, month and julian day as given below.</p> <pre><code>/home/applications/app_name/year/month/julian day e.g.: /home/applications/app_name/2016/June/155 </code></pre> <p>I am writting a script to create such directories for next entire month and script will be scheduled monthly. if I am running the script on 01st of June, script should create all directories for month of July.</p> <pre><code>e.g: /home/applications/app_name/2016/July/(julian days) </code></pre> <p>Thanks in Advance</p>
<linux><shell><unix>
2016-06-03 06:57:14
LQ_CLOSE
37,609,323
How to change 201509122150 to YYYY-MM-DD hh:mm
Would like to know what is the bext way to change 201509122150 (numeric) to Date class in YYYY-MM-DD hh:mm format.
<r><date><datetime>
2016-06-03 08:15:19
LQ_EDIT
37,609,506
Fix div on scroll
I'm trying to fade in/out and fix the blue div on the left when scrolled relative to the image blocks on the right. http://www.warface.co.uk/#/testing/ pass: squared meta { /*This is the block I'm trying to stick/* background: blue; position: fixed; width: 372px; float: left; z-index: 3; right: 100%; }
<javascript><css><squarespace>
2016-06-03 08:25:46
LQ_EDIT
37,610,711
Convert String "MM/dd/yy" in to date MM/dd/yyyy
<p>I am try to convert string 11/08/91(MM/dd/yy) into 11/08/1991(MM/dd/yyyy) but it is give wrong output link <strong>Date is :0091-11-07 18:06:32 +0000</strong></p> <ul> <li>My original output is 11/08/1991</li> </ul> <p>My Code</p> <pre><code>NSString *strdate = @"11/08/91"; NSDateFormatter *dateformate=[[NSDateFormatter alloc]init]; [dateformate setDateFormat:@"MM/dd/yyyy"]; NSDate *date = [dateformate dateFromString:strdate]; NSLog(@"Date is :%@",date); </code></pre>
<ios><iphone><nsdate><nsdateformatter>
2016-06-03 09:28:17
LQ_CLOSE
37,611,378
complex case statement in sql where clause
i have this code but i cannot make it work: AND CASE DO11_DOCUM_MG36 WHEN 'TSC-ORDINE-RIC' THEN (CONVERT(DATE,ISNULL(dbo.DO31_DOCCORPOORD.DO31_DATACONS,DATEADD(day,ISNULL(dbo.DO17_DOCTESTAPERS.DO17_NUMPERS4,15),dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF)),102) <= '2016-02-29' AND dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF is not null) AND (dbo.DO36_DOCCORPOEST.DO36_DATAST1 is null or CONVERT(DATE,dbo.DO36_DOCCORPOEST.DO36_DATAST1,102) >= '2016-02-01') ELSE (CONVERT(DATE,ISNULL(dbo.DO31_DOCCORPOORD.DO31_DATACONS,DATEADD(day,ISNULL(dbo.DO17_DOCTESTAPERS.DO17_NUMPERS4,15),dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF)),102) BETWEEN '2016-02-01' AND '2016-02-29' AND dbo.DO12_DOCTESTARIF.DO12_DATAVSCONF is not null) END Thanks
<sql-server>
2016-06-03 10:01:04
LQ_EDIT
37,611,815
An error about "make_shared",I can't understand
<pre><code>#include&lt;algorithm&gt; #include&lt;string&gt; #include&lt;new&gt; #include&lt;memory&gt; #include&lt;vector&gt; using std::vector; using namespace std; int main() { shared_ptr&lt;vector&lt;int&gt; &gt; pointer=make_shared&lt;vector&lt;int&gt;&gt; ({2,3,5,8}); cout&lt;&lt;(*pointer)[3]; return 0; </code></pre> <p><strong>so make_shared can't initialize like ({2,3,5,8}),why?</strong> }</p>
<c++>
2016-06-03 10:21:38
LQ_CLOSE
37,613,119
how is docker-compose better than normal docker?
<p>i'm currently using normal docker in my django-react application and have been asked to switch to docker compose. Please tell me how is it better than normal docker for testing and production.</p>
<django><docker-compose>
2016-06-03 11:24:44
LQ_CLOSE
37,613,210
EXCEL, If column terms match text In range b equal to or less then, the insert other column
I racking my brain, the attached photo illustrates roughly what Im trying to do, top and bottom images illustrates a collection if 12k pictures I need to associated the id depicted in the middle portion of the attached image.... what I have ... i know im going the wrong way and my job is kinda depending on this... lol HELP! I know ive been going VBA but if a formula would work... I just need this bad. Buy ya a coffee if you can help me out in anyway. [What Im trying to accomplish][1] Sub Find_Matches() Dim CompareRange As Variant, ToCompare As Variant, x As Variant, y As Variant Set CompareRange = Worksheets("ID_proptitle").Range("B1:A500") Set ToCompare = Worksheets("pictures").Range("B1:C500") For Each x In ToCompare For Each y In CompareRange If x = y Then [1]: http://i.stack.imgur.com/c1BXe.png
<excel><excel-formula><vba>
2016-06-03 11:28:24
LQ_EDIT
37,613,215
How to make such database record in php mysql such that A inform B,B inform C,and C inform D such that when I look at who A answer should be B,C,D?
<p>How to make such database record in php mysql such that A inform B,B inform C,and C inform D such that when I look at who A answer should be B,C,D?</p>
<php><mysql><sql><database>
2016-06-03 11:28:39
LQ_CLOSE
37,613,851
Sending all aspx page as an e-mail body
<p>I have an aspx page that give an exam result. I would like to send copy of this page as an e-mail body. I did a lot of search about this situation but i can not find any solution.</p>
<c#><asp.net>
2016-06-03 12:00:37
LQ_CLOSE
37,615,332
Get Selector of found elment
Short question, I'm iteration through a list of li's to get the li which is in the center of the screen (on scroll) with this function: var findMiddleElement = (function(docElm){ var viewportHeight = docElm.clientHeight, elements = $('li'); return function(e){ var middleElement; if( e && e.type == 'resize' ) viewportHeight = docElm.clientHeight; elements.each(function(){ var pos = this.getBoundingClientRect().top; // if an element is more or less in the middle of the viewport if( pos > viewportHeight/2.5 && pos < viewportHeight/1.5 ){ middleElement = this; return false; // stop iteration } }); console.log(middleElement); } })(document.documentElement); This works great so far. The Problem is that 'middleElement' will return something like this: <li style="padding-top: 12.8438px; padding-bottom: 12.8438px;">Menu Item 8</li> I need to add a CSS style to it. Since middleElement.css doesn't work, I need a way to get the selector of the found element. Any Ideas? Thank you very much!
<javascript><jquery>
2016-06-03 13:11:15
LQ_EDIT
37,619,339
Character functions vs string functions
<p>I just found a short code here, which would detect blank lines in a file. It used fgets() function in C library.<br> I wonder if character functions are better suited for files which have tabs, and perhaps continous spaces. My qustion is what is the best way to parse a file for blank lines?</p>
<c>
2016-06-03 16:28:20
LQ_CLOSE
37,620,447
Is there any code line which can only show installed Games in my android app?
I have heard about getInstalledApplication() but it shows all app. I want only games . Please help i have to complete my android app development project
<android>
2016-06-03 17:37:41
LQ_EDIT
37,621,156
I am getting "Notice: Undefined property: stdClass::$id i in mentioned bold italic line when i call below function
public function userlogin() { $sql = 'select id, username from login_user where email="'.$this->email.'"and password="'.$this->password.'"'; $result = mysqli_query($this->cn,$sql); $numrows = mysqli_num_rows($result); if($numrows == 1) { $data = mysqli_fetch_field($result); ***$uid = $data->id; $uname = $data->username;*** $_SESSION['login'] = 1; $_SESSION['uid'] = $uid; $_SESSION['uname'] = $uname; $_SESSION['login_msg'] = 'Login Successfully...'; } }
<php><function><session>
2016-06-03 18:25:23
LQ_EDIT
37,621,686
Never saw this operator before
<p>I was reading a source from laravel project and then i found this line:</p> <pre><code>$this-&gt;crawler() ?: $this-&gt;response-&gt;getContent() </code></pre> <p>Does <code>?:</code> do something special? In php?</p> <p>I dont remember seeing that in any other place</p>
<php><operators>
2016-06-03 19:01:34
LQ_CLOSE
37,622,664
C++ Class won't execute function
<p>I want to write a simple backup program. Its not finished yet, but i've encountered a problem: My class responsible for setting the right path wont execute the worker which will copy the file. I don't know why and yes - i already looked up on any helping site i know. Here is my filecopy h code:</p> <pre><code>#ifndef __FILECOPY_H_INCLUDED__ #define __FILECOPY_H_INCLUDED__ #include&lt;iostream&gt; #include&lt;fstream&gt; #include&lt;ctime&gt; class filecopy { std::string dest_path; std::string src_path; public: filecopy(std::string, std::string); void filecopy_worker() { std::cout &lt;&lt; "FILECOPY PROCESS STARTED" &lt;&lt; std::endl; std::ifstream source(src_path); std::ofstream dest(dest_path); dest &lt;&lt; source.rdbuf(); source.close(); dest.close(); } }; filecopy::filecopy(std::string a, std::string b) { dest_path = a; src_path = b; } #endif </code></pre> <p>And here my main.cpp code:</p> <pre><code>#include&lt;iostream&gt; #include&lt;stdlib.h&gt; #include"filecopy.h" int main(int argc, char *argv[]) { if(argc != 3) { std::cout &lt;&lt; "USAGE: " &lt;&lt; argv[0] &lt;&lt; " &lt;filesource&gt;" &lt;&lt; std::endl; return 1; } else { filecopy target1(argv[2], argv[1]); std::cout &lt;&lt; "TARGET ASSIGNED" &lt;&lt; std::endl; std::cout &lt;&lt; "EXECUTE FILEWORKER" &lt;&lt; std::endl; } return 0; } </code></pre>
<c++><function><class><member>
2016-06-03 20:14:03
LQ_CLOSE
37,623,415
why new websites are using .io domain these days?
<p>A number of startups and technology websites are using .io domain these days in lieu of .com or .org; Is there any specific reason for that ? Like:</p> <pre><code>github.io mean.io angular.io </code></pre>
<dns><angular><startup><github-pages>
2016-06-03 21:06:44
LQ_CLOSE
37,624,678
C programming ASCII basic
<p>I have char like </p> <pre><code> char testniPodatak[14] = "1234567890"; </code></pre> <p>I want to test that every c in string is value from 0-9 according ascii table..</p> <p>I do like this:</p> <pre><code>for (int i = 0; i &lt; 9; i++) { if (ISBN10[i] &lt; 48 || ISBN10[i] &gt;57) { return 3; } } </code></pre> <p>If is out of range function need to return 3 , but in above string there is all chars 0-9, function return 3 on first iteration..</p> <p>Here is table with ascii values <a href="https://allrounder163.files.wordpress.com/2014/09/ascii.png" rel="nofollow">https://allrounder163.files.wordpress.com/2014/09/ascii.png</a></p> <p>Thanks</p>
<c><loops><ascii>
2016-06-03 23:06:51
LQ_CLOSE
37,624,721
How can I convert variable float type data to string in c?
For example: f= ((100+x)/x)*1.5. So my float is variable type. then how can I make it to string with having precision. I am new in C. Please help.
<c>
2016-06-03 23:12:10
LQ_EDIT
37,625,677
Assigning a dynamically allocated 2-d array to a double pointer within a struct
I am creating a game with a 2d array as the board. Originally, I tried to dynamically allocate the board to the struct in one function, but figured I would create the board, and then assign this newly created board to the double point within the struct. typedef struct Game_State{ int num_rows; int num_cols; int num_mines; char** board; char MINE; char hidden_tile; char marked_tile; char flagged_tile; char revealed_tile; }game; This is my delcaration of the struct, Now when I run my create board function, everything works out, but when I print to it there is a seg fault, so I am going to assume I haven't allocated enough space and there is an issue with my pointers. void create_board(struct Game_State game){ //intitialization int i; int j; int num_rows = game.num_rows; int num_cols = game.num_cols; char hidden_tile = game.hidden_tile; char **board = game.board; printf("Create Board Rows: %d\n", num_rows); printf("Create Board Cols: %d\n", num_cols); printf("Create Board Hidden Tile: %c\n", hidden_tile); //dynamically allocates space for the board (2x2) board = (char**)malloc(num_rows *sizeof(char*)); for(i = 0; i < num_rows; ++i){//for each row board[i] = (char*) malloc(num_cols * sizeof(char)); for(j = 0; j < num_cols; ++j){ board[i][j] = hidden_tile; } } } This is the code I used to create a dynamically allocated board depending on the command line arguments of rows and columns, yet when I print the board, there is a seg fault! Please help!
<c><pointers><memory-management><struct><segmentation-fault>
2016-06-04 02:11:15
LQ_EDIT
37,625,790
Few questions about Visual Studio 2015 Git
<p>I started to use Git provided in Visual Studio 2015 Update 2. My team consists of only me. My needs are simple: to have history of changes, and possibility to revert them. Visual Studio created automatically local repository in my solution directory. My questions are:</p> <ol> <li><p>Is it valid way to use only local repository? Will it create any problems when I never set up remote repository?</p></li> <li><p>Is .git folder created in solution directory independent? I mean, does it have complete git information, so when I copy to another directory or machine, it will have its own full state?</p></li> <li>In case of backups, will be there any difference between: a) simply setting a 3rd party program to backup whole solution directory to remote server. b) setting up server for remote repository, and backuping by commiting changes.</li> <li><p>Why .git folder is hidden?</p></li> <li><p>How can I hide field showing number of unpublished commits, which is located on the right bottom in Visual Studio 2015 Update 2? If I will never set up remote server, this number will increase to huge numbers, and reminds me about elapsing time.</p></li> </ol>
<git><visual-studio><visual-studio-2015>
2016-06-04 02:36:06
LQ_CLOSE
37,626,587
Identify negative sentence By using NLP
<p>I want to check below sentence is either positive or negative please help me </p> <p>Sentence -I don't remember anything </p>
<python><nlp>
2016-06-04 05:05:19
LQ_CLOSE
37,627,766
HTML files don't refresh unless they are accessed
<p>I have a setup in which I make AJAX calls to load the html files containing to be displayed data. Let's say the main page is index.html and I have two other pages: pages/1.html and pages/2.html. In index.html either 1 or 2 is set as content. My browser however caches both 1 and 2 and when I change either of them and reload the page it won't display the changes I've made because I didn't actually refresh 1.html or 2.html. How can I make it so that this is not an issue?</p>
<javascript><jquery><html><ajax>
2016-06-04 07:46:12
LQ_CLOSE
37,629,081
IOS Get content from Web page
I need help.I'm trying to get one value from my web page. When i execute first time returns value null but if I execute another time returns correct value... NSString *urlString = @"http://localhost/app/check.aspx"; NSURL *url = [NSURL URLWithString:urlString]; NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url]; [_WebView loadRequest:urlRequest]; NSString *html = [_WebView stringByEvaluatingJavaScriptFromString: @"document.getElementById('Contador').textContent"]; UIAlertView *alert = [[UIAlertView alloc]initWithTitle: @"Avisos Activos" message:html delegate: self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK",nil]; [alert setTag:1]; [alert show]; Thank's for your help
<ios><objective-c><uiwebview>
2016-06-04 10:26:12
LQ_EDIT
37,629,819
Printing out all the numbers in a list if the sum of those numbers exceed 100.
<p>List of numbers nums and prints all the numbers from nums in order until the sum of the numbers printed exceeds 100. I need to rewrite the function using a while loop and <strong>I cannot use for, break or return.</strong><br> if the sum of the numbers is less than or equal to 100 then all numbers in the list are printed. Below includes my attempt of the question (which is wrong...), and the outputs I would like to achieve. I would like to know your ideas on how you would try to solve the problem or your advice on the logic of my code. Many thanks in advance :D </p> <pre><code>def print_hundred(nums): """ Hundy club """ total = 0 index = 0 while index &lt; nums[len(nums)]: print(nums) total += nums[index] else: if total &gt; 100: print(total) print_hundred([1, 2, 3]) print_hundred([100, -3, 4, 7]) print_hundred([101, -3, 4, 7]) test1 (Because the sum of those numbers are still less than 100) 1 2 3 test2 (100 - 3 + 4 = 101, so the printing stops when it exceeds 100) 100 -3 4 test3 (Already exceeds 100) 101 </code></pre>
<python><python-3.x>
2016-06-04 11:44:32
LQ_CLOSE
37,630,044
New Array Mips Full Code
<p>i got problem. I'm not good at MIPS and i need to read from user size of new array, then read from user int to get this array full of values and after i get all in, I need to write them out in order A[0]->A[n] (like FIFO queue). Can anybody write me full code? (without hard things) Thanks!</p>
<arrays><mips>
2016-06-04 12:06:06
LQ_CLOSE
37,630,172
jquery click funtion order
I would like to know how can I change the background-image of another div element, when I click on it. I would like to see images one after another in order but what I get is the last one. Here is some code: $(document).ready(function () { // console.log('ready!'); $('.right').click(function () { $('.zur-gda-img').css('background','url(images/sail-boat.jpg)'); }).click(function() { $('.zur-gda-img').css('background','url(images/sad_ostateczny.jpg)'); }) }).click(function() { $('.zur-gda-img').css('background','url(images/twierdza_wisloujscie.jpg)'); });
<javascript><jquery><css>
2016-06-04 12:21:31
LQ_EDIT
37,631,415
How to Retrieve a value From Website With Password Protected Login
##Problem I want to be able to retrieve a value from a website protected by a password. In particular, I want to retrieve the number of problems I have solved from Project Euler - which requires a confirmation code to login. Now, I know how to retrieve a value from a particular web page. However, I am not sure how to retrieve a web page that requires a login with a confirmation system. ##My Code Disclaimer: code taken and adapted from: http://stackoverflow.com/questions/4573498/get-value-from-external-webpage-php-or-java I have the following code to retrieve the next value I want from a web page: <?php // Read the whole file. $lines = file('https://projecteuler.net/progress'); // Go through every line .. while ($line = array_shift($lines)) { // Stop when you find the label we're looking for. //NOTE: The word 'Solved' only exists on the web page when you are logged into an account. if (strpos($line, 'Solved') !== false) break; } // The next line has your value on it. $line = array_shift($lines); // Print the first word on the line. $values = explode(' ', $line); echo $values[0]; ?> ##What this Code Actually Does This code will go to the web page https://projecteuler.net/progress as it states. However, since this web page can be accessed without logging into the account, it will retrieve the values from that web page, instead of the web page that is accessed from logging in. Essentially, there are **two** /progress pages - one for when you login, and one for when you are not logged in. I want to be able to access the /progress page for when you are logged into your account. I have tried: ##Things I've tried I tried to use the information at this link: http://stackoverflow.com/questions/5420506/reading-information-from-a-password-protected-site With no success. Also, since Project Euler requires you to enter a 'Confirmation Code' before logging in, I am not sure how this will work. How might I do this?
<php>
2016-06-04 14:34:56
LQ_EDIT
37,631,669
My programme cannot run i have been trying 3days already
<p>I need to store all car information using array in class and print it out. Can anyone help me edit it T.T. I am using switch after they have register their car that how many car they want to register. It need to get back to menu and led them to the second choice to update their information. 3rd is to print out which one they wanted to print out and they can key in without printing out all 4th, but for this 4th is to print out all.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; using namespace std; class Vehicle { protected: string Manufacturer; string Type; int Seatnumber; public: Vehicle() { Manufacturer=""; Type=""; Seatnumber=1; }; Vehicle(string manufacturer,string type,int seatnumber) { Manufacturer=manufacturer; Type=type; Seatnumber=seatnumber; }; void setmanufacturer(string manufacturer) { Manufacturer=manufacturer; }; void settype(string type) { Type=type; }; void setseatnumber(int seatnumber) { Seatnumber=seatnumber; }; string getmanufacturer() { return Manufacturer; } string gettype() { return Type; }; int getseatnumber() { return Seatnumber; }; }; class Car: public Vehicle { protected: string Carplatenumber; string Model; public: Car():Vehicle() { Carplatenumber=""; Model=""; }; Car(string carplatenumber, string model) { Carplatenumber=carplatenumber; Model=model; }; void setcarplatenumber(string carplatenumber) { Carplatenumber=carplatenumber; }; void setmodel(string model) { Model=model; }; string getcarplatenumber() { return Carplatenumber; }; string getmodel() { return Model; }; void display(); }; inline void Car::display(){ cout&lt;&lt;Manufacturer; cout&lt;&lt;Type; cout&lt;&lt;Seatnumber; cout&lt;&lt;Carplatenumber; cout&lt;&lt;Model; }; int main () { char choice; int size=0,seats; Car car[size]; string manufacturer,type,carplatenumber,model; cout&lt;&lt;"Please choice a selection: "; cin&gt;&gt;choice; bool True=true; while(True){ switch(choice){ case 'A': True=false; cout&lt;&lt;"How many cars information do you want to store in it : "; cin&gt;&gt;size; cout&lt;&lt;"\n"; for(int i=0;i&lt;size;i++){ cout &lt;&lt; "Enter car "&lt;&lt;i+1&lt;&lt;" Manufacturer : "; getline (cin,manufacturer); cin.ignore(); car[size].setmanufacturer(manufacturer); cout &lt;&lt; "Enter car "&lt;&lt;i+1&lt;&lt;" Type : "; getline (cin,type); cin.ignore(); car[size].settype(type); cout &lt;&lt; "Enter car "&lt;&lt;i+1&lt;&lt;" Seatsnumber of the car : "; cin &gt;&gt; seats; cin.ignore(); car[size].setseatnumber(seats); cout &lt;&lt; "Enter car "&lt;&lt;i+1&lt;&lt;" Model : "; getline (cin,model); cin.ignore(); car[size].setmodel(model); True=true; } break; case'B': True=false; cout &lt;&lt; "Hi,there please update your carplatenumber after u have gone through your new car!"; getline(cin,carplatenumber); car[size].setcarplatenumber(carplatenumber); True=true; break; case'c': True=false; for(int i=0;i&lt;size;i++){ car[i].display(); } True=true; break; default:cout&lt;&lt;"Invalid input"; } } return 0; } </code></pre>
<c++>
2016-06-04 15:01:36
LQ_CLOSE
37,631,835
'vertical-align: middle' does not work
<p><a href="http://codepen.io/abdulahhamzic/pen/rLBoOj" rel="nofollow">http://codepen.io/abdulahhamzic/pen/rLBoOj</a></p> <p>I'm trying to get the paragraphs (the name and other info of the stream) to be vertically aligned in the middle of their div parents. I'm trying this CSS code and it is not working:</p> <pre><code>.col-sm-4{ text-align: right; vertical-align: middle; } </code></pre>
<html><css>
2016-06-04 15:19:00
LQ_CLOSE
37,632,452
Bootstrep forms to HeidiSQL
Can you give me some tips whit this. I made a form with bootstrep and i don't know how to make this: when i complete all steps (firstname, secondname, email, password, gender, status(student/profesor)) and press submit to save this information into my database (i use HeidiSQL). <div class="container"> <h2> Completati formularul</h2> <form role="form"> <div class="col-md-4"> <div class="form-group"> <label for="prenume">Prenume</label> <input type="prenume" class="form-control" id="prenume" placeholder="Enter prenume"></input> </div> <div class="form-group"> <label for="name">Name</label> <input type="name" class="form-control" id="name" placeholder="Enter name"></input> </div> <div class="form-group"> <label for="cnp">CNP</label> <input type="cnp" class="form-control" id="cnp" placeholder="Enter the cnp"></input> </div> <div class="form-group"> <label for="email">E-mail</label> <input type="email" class="form-control" id="email" placeholder="Enter E-mail"></input> </div> <div class="form-group"> <label for="password">Parola</label> <input type="password" class="form-control" id="password" placeholder="Enter password"></input> </div> <p>Sex</p> <div class="radio"> <label><input type="radio" name="m">Masculin</label> </div> <div class="radio"> <label><input type="radio" name="f">Feminin</label> </div> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">Statut <span class="caret"></span></button> <ul class="dropdown-menu"> <li> </li> <li><a href="#">Student</a></li> <li><a href="#">Profesor</a></li> <li><a href="#">Suport tehnic</a></li> </ul> </div> <br/> <p>Necesar</p> <div class="checkbox"> <label><input type="checkbox" value="">Videoproiector</label> </div> <div class="checkbox"> <label><input type="checkbox" value="">Flipchart</label> </div> <div class="checkbox"> <label><input type="checkbox" value="">Marker</label> </div> <p>Observatii</p> <div class="form-group"> <textarea class="form-control" placeholder="Message"></textarea> </div> <div> <button type="submit" class="btn btn-default">Submit</button> </div>
<php><mysql><database><forms><twitter-bootstrap>
2016-06-04 16:19:49
LQ_EDIT
37,634,538
Unable to predict test dataset
I have a training data set with the below variables > str(PairsTrain) 'data.frame': 1495698 obs. of 4 variables: $ itemID_1 : int 1 4 8 12 15 19 20 20 22 26 ... $ itemID_2 : int 4112648 1223296 2161930 5637025 113701 $ isDuplicate : int 1 0 1 0 0 0 0 0 1 0 ... $ generationMethod: int 1 1 1 1 1 1 1 1 1 1 ... I have learned from this dataset using the logistic regression glm() function `mod1 <- glm(isDuplicate ~., data = PairsTrain, family = binomial)` Below is the structure of m y test dataset > str(Test) 'data.frame': 1044196 obs. of 3 variables: $ id : int 0 1 2 3 4 5 6 7 8 9 ... $ itemID_1: int 5 5 6 11 23 23 30 31 36 47 ... $ itemID_2: int 4670875 787210 1705280 3020777 5316130 3394969 2922567 I am trying to make predictions on my test data set like below > `PredTest <- predict(mod1, newdata = Test, type = "response")` Error in eval(expr, envir, enclos) : object 'generationMethod' not found I get the above error, I am thinking that the reason for the error I am getting is the number of features in my test dataset which doesn't match the training dataset. I am not sure if I am correct and I am stuck here and don't know how to deal this situation. Any help is much appreciated. //Sam
<r><regression><glm><lm><predict>
2016-06-04 20:07:11
LQ_EDIT
37,634,711
jQuery not working straight away
<p>I am working on Ruby on Rails and a simple jQuery won´t execute over an element like this:</p> <pre><code>$("header").hide(); </code></pre> <p>However, if i wrap it into a function and call it with document.ready it does the right thing:</p> <pre><code>function myCode() { $("header").hide(); } $(document).ready(myCode); </code></pre> <p>Why it does not work straight forward?? I have installed gem jquery-rails and even have //=required jquery.min.js in the application.js file.</p> <p>Thanks for the help!</p>
<javascript><jquery><ruby-on-rails-4>
2016-06-04 20:29:30
LQ_CLOSE
37,634,757
.on() doesn't work properly with dynamic content
<p>I have a simple js script which gets backgrounds of the following elements: <div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;ul class="vk_image_grid"&gt; &lt;li style="background-image: url(https://name.com/image1.jpg)" class="block"&gt; &lt;/li&gt; &lt;li style="background-image: url(https://name.com/image2.jpg)" class="block"&gt; &lt;/li&gt; &lt;li style="background-image: url(https://name.com/image3.jpg)" class="block"&gt; &lt;/li&gt; &lt;/ul&gt; &lt;script&gt; $("ul li").on( "click", function() { var bg = $(this).css('background-image'); alert(bg); &lt;/script&gt;</code></pre> </div> </div> </p> <p>It works perfectly with the first two <code>li</code> which are generated by php. But it doesn't show the background of the third <code>li</code> which is generateed by another jQuery script. How can I fix the issue?</p>
<javascript><jquery>
2016-06-04 20:34:36
LQ_CLOSE
37,636,635
How to return -1 value?
<p>Write a function called day_diff that takes four scalar positive integer inputs, month1, day1, month2, day2. These represents the birthdays of two children who were born in 2015. The function returns a positive integer scalar that is equal to the difference between the ages of the two children in days. Make sure to check that the input values are of the correct types and they represent valid dates. If they are erroneous, return -1. An example call to the function would be</p> <blockquote> <blockquote> <p>dd = day_diff(1,30,2,1); which would make dd equal 2. You are not allowed to use the built-in function datenum or datetime.</p> </blockquote> </blockquote> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function dd = day_diff(month1, day1, month2, day2) if (month1 &amp;&amp; month2 &gt; 0) || (month1 &amp;&amp; month2 &lt;= 12) if month1 == 1 &amp;&amp; month2 == 1 if day1 == day2 total1 = day1; total2 = day2; elseif day1 ~= day2 total1 = max(day1,day2); total2 = min(day1,day2); end elseif month1 == 1 &amp;&amp; month2 == 2 total1 = day1; total2 = day2 + 31; elseif (month1 == 2 &amp;&amp; day1 &lt;= 28) &amp;&amp; month2 == 1 total1 = day1 + 31; total2 = day2; elseif month1 == 1 &amp;&amp; month2 == 12 total1 = day1; total2 = day2 + 334; elseif month1 == 2 &amp;&amp; month2 == 3 total1 = day1 + 31; total2 = day2 + 59; elseif month1 == 7 &amp;&amp; month2 == 9 total1 = day1 + 181; total2 = day2 + 243; else return end end dd = (max(total1,total2)) - (min(total1,total2));</code></pre> </div> </div> </p>
<matlab>
2016-06-05 01:39:21
LQ_CLOSE
37,636,708
Error in global variable
<p>When I start my game and it opens to the menu I keep getting the error. "SyntaxWarning: name 'finishes' is assigned to before global declaration". I doesn't disrupt the game but it is just annoying, any ideas on how to fix it?</p> <pre><code>def load_level(level): walls = [] players = [] finishes = [] x = y = 0 for row in levels[level]: for col in row: if col == "W": walls.append(Wall((x, y))) if col == "P": players.append(Player((x, y))) if col == "F": finishes.append(Finish1((x, y))) if col == "G": finishes.append(Finish2((x, y))) if col == "H": finishes.append(Finish3((x, y))) if col == "I": finishes.append(Finish4((x, y))) x += 40.96 y += 30.72 x = 0 return walls, players, finishes walls, players, finishes = load_level(currentLevel) def Menu(): runnin = True while runnin: clock.tick(60) screen.fill(BLACK) mouseclick = pygame.mouse.get_pressed() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit(0) if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit(0) for option in options: if option.rect.collidepoint(pygame.mouse.get_pos()): option.hovered = True if mouseclick[0] == 1: if option.text == "Easy": walls, players, finishes = load_level(0) global currentlevel, walls, players, finishes currentlevel = 0 main() elif option.text == "Medium": walls, players, finishes = load_level(1) global currentlevel, walls, players, finishes currentlevel = 1 main() elif option.text == "Hard": walls, players, finishes = load_level(2) global currentlevel, walls, players, finishes currentlevel = 2 main() else: runnin = False else: option.hovered = False option.draw() pygame.display.update() pygame.quit() sys.exit(0) </code></pre>
<python><python-3.x><pygame>
2016-06-05 01:52:14
LQ_CLOSE
37,637,841
Scopes and Pointers
<p>This is the code that I have a question about: </p> <pre><code>int* getPtrToFive() { int x = 5; return &amp;x; } int main() { int *p = getPtrToFive(); cout &lt;&lt; *p &lt;&lt; endl; // ??? } </code></pre> <p>The lecture slides say that *p wouldn't give a valid result because as getPtrToFive is returned, x goes out of scope. However, I thought that getPtrToFive would already contain the value of 5, which would validate *p? Is it because of the pointer trying to direct me to getPtrToFive which has an out of scope x? </p>
<c++><pointers><scope>
2016-06-05 02:22:41
LQ_CLOSE
37,638,199
How can I write condition in Php if $x=0 then $y=$z
**How can I write condition in Php** **if $x=0 then $y=$z**
<php>
2016-06-05 03:32:43
LQ_EDIT
37,638,210
While regecting call i am getting an error
06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:37.965 824-824/it.bikemode.sharwin.com.bikemode E/INCOMING: +918500549640 06-05 08:56:37.970 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:38.131 824-824/it.bikemode.sharwin.com.bikemode W/System.err: java.lang.SecurityException: Neither user 10110 nor current process has android.permission.MODIFY_PHONE_STATE. 06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004A, flags=0x0, dataLen=0x9 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004B, flags=0x0, dataLen=0x9 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.033 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Parcel.readException(Parcel.java:1425) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Parcel.readException(Parcel.java:1379) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.telephony.ITelephony$Stub$Proxy.silenceRinger(ITelephony.java:1983) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at it.bikemode.sharwin.com.bikemode.IngoingReceiver.onReceive(IngoingReceiver.java:44) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2550) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:162) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Looper.loop(Looper.java:194) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5371) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at java.lang.reflect.Method.invoke(Method.java:525) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at dalvik.system.NativeStart.main(Native Method) 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.052 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:39.078 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: LOAD_URL arg1=0 arg2=0 obj=android.webkit.WebViewCore$GetUrlData@4169d870 06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: CORE loadUrl javascript:AFMA_updateActiveView({"units":[{"viewBox":{"bottom":533,"right":320,"left":0,"top":0},"isScreenOn":true,"isPaused":false,"adFormat":"320x50_mb","localVisibleBoxVisible":false,"activeViewJSON":{"click_string":"BjD8MvZtTV4-AK5e9oAP6sLHQBgCFkcCSrgIAABABOAGgBjk","active_experiment_ids":"","is_active_view_immediate_enabled":true,"activeview_cpm_urls":[]},"isNative":false,"hashCode":"abd2bfc2-8ada-4aca-b94a-74ff268ec3a4","afmaVersion":"afma-sdk-a-v9082034.8487000.1","windowVisibility":8,"screenDensity":1.5,"localVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isAttachedToWindow":true,"timestamp":54853252,"globalVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isVisible":true,"adBox":{"bottom":-146,"right":320,"left":0,"top":-196},"hitBox":{"bottom":50,"right":320,"left":0,"top":0},"isMraid":false,"globalVisibleBoxVisible":false,"isStopped":false}]}); 06-05 08:56:39.079 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.080 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004C, flags=0x0, dataLen=0x9 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004D, flags=0x0, dataLen=0x9 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004E, flags=0x0, dataLen=0x9 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 public class IngoingReceiver extends BroadcastReceiver { int previousState = 2; public void onReceive(final Context context, Intent intent) { ITelephony telephonyService; TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try { Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod("getITelephony"); m.setAccessible(true); telephonyService = (ITelephony) m.invoke(tm);`enter code here` Bundle bundle = intent.getExtras(); String phoneNumber = bundle.getString("incoming_number"); Log.e("INCOMING", phoneNumber); if ((phoneNumber != null)) { telephonyService.silenceRinger(); telephonyService.endCall(); Log.e("HANG UP", phoneNumber); } } catch (Exception e) { e.printStackTrace(); } } } package com.android.internal.telephony; public interface ITelephony { boolean endCall(); void answerRingingCall(); void silenceRinger(); }
<android><telephony>
2016-06-05 03:34:59
LQ_EDIT
37,638,315
Sorting An Array And Updating Its Corresponding Arrays From Which It Was Calculated According To It
I have 3 arrays > a , b ,c of size n. a and b arrays are entered by the user and c is calculated as > c[i] = b[i] - a[i] + 1 Sorting the c array is easy but i want to make amends in a and b also such that the a [i] and b[i] corresponds to the new sorted c[i]. For Example - > a[5] ={1 , 3 , 5 , 7 , 9 } > b[5] ={5 , 4 , 7 , 8 , 10 } Then > c[5] ={5 , 2 , 3 , 2 , 2} Now sorting the c array, it results in > c[5] = { 2 , 2 , 2 , 3 , 5 } Now i also want a and b as > a[5]={ 3 , 7 , 9 , 5 , 1 } > b[5]={ 4 , 8 , 10 , 7 , 5 }
<java><arrays><sorting>
2016-06-05 03:59:07
LQ_EDIT
37,639,243
I have a very huge while wend loop in my excel vba
I have a very huge while wend loop in my excel vba previous in the code I set a variable (strMode) to true or false if it is false then in my while condition I want to set while var1 + var1previous > 1 and if it is true while var1 + var1previous > 1 or var1previous + var1 > 1 How can I do that, if I don't what to "double" the while wend code, for my if statement?
<excel><loops><code-duplication><vba>
2016-06-05 06:51:47
LQ_EDIT
37,639,437
Java JWindow Inject in Desktop
Can anyone show example on how to make a JWindow always on Desktop? I cannot set the "AlwaysOnTop" since I do not want it to be on top of other applications, but I want it to stay on Desktop. Whenever I click the show Desktop button or Windows Key + M to minimize all, it disappears also. When i return to any window, it will be visible again. I wanted to inject the JWindow in the Desktop. Thanks in advance~
<java><swing><jwindow>
2016-06-05 07:19:03
LQ_EDIT
37,640,220
Visual studio SDL
I installed recently sdl2 of visual studio but I'm having problems when I have to load an image. Practically the window closes immediately without regard to whether the image is loaded. I used the code on lazyfoo.net. http://lazyfoo.net/tutorials/SDL/02_getting_an_image_on_the_screen/index.php+ Can you help me?
<c++><visual-studio-2015><sdl-2>
2016-06-05 09:09:37
LQ_EDIT
37,641,594
What does solid in border-style:solid mean? CSS
<p>I have an exam tomorrow and it's about CSS, we have always had border-style:solid; but I don't really know what it exactly does. It sure shows a border but why is it called "solid"? W3S doesn't really give me the answer...</p> <p>Does solid mean e.g. the paraghraph's border is not movable?</p> <p>Or does it mean the border's size cant change?</p>
<html><css>
2016-06-05 11:55:31
LQ_CLOSE
37,642,826
When to use concat and append?
<p>I started learning java and always had this bugging my mind.<br> When to use concat() and when to use append() operations.<br> Do they perform the same operation and what of their return types?</p>
<java><string>
2016-06-05 14:06:55
LQ_CLOSE
37,642,912
Stopping .bat files dinamically using java
I need to write a Java app in which I have several .bat files which run in continuous loops. I have 4 of them, and only one of them can run at one time. I need to stop the other 3. Something like if condition -stop the other 3 .bat files ( well normally one of them would run but not knowing which, I try to stop all 3); -start the .bat file which satisfies the condition. -when other condition of a different .bat file is satisfied, the other 3 (again, one actually) would be stopped + this .bat file starts running (continuous loop) I am struggling to get to how to stop these .bat files from my java code..is there anything that I can use in command line to stop one particular .bat file from running, identifying it by name or something? Because running commands from cmd using Java is something that I know how to do.
<java><batch-file><command-line>
2016-06-05 14:16:31
LQ_EDIT
37,644,855
Cake PHP Godaddy installation issues
I just started using Cake PHP. I installed through the Godaddy app "installatron". I am accessing the command line through Putty as they recommend, which works fine. Changed .htpaccess as instructed etc.. When ever I try to enter bin/cake bake it tells me "Permission Denied" Anyone know how to fix this issue?
<php><cakephp-3.0><putty>
2016-06-05 17:37:48
LQ_EDIT
37,645,068
Print all arrays with m number of -1 and n-m number of 1
<p>Given the number of elements n and m i have to print all different arrays with m number of -1 values and n-m values of 1.</p>
<python><algorithm>
2016-06-05 18:00:00
LQ_CLOSE
37,647,690
Why my html and js only works on codepen
<p>Here is the link of my work, it works perfectly on Codepen, but when i move it to my github personal page, it won't work. There is no response when i push my search botton. <a href="https://gist.github.com/Airhaoran/eec810eda0299297a59d83d353d732ea" rel="nofollow">https://gist.github.com/Airhaoran/eec810eda0299297a59d83d353d732ea</a></p>
<javascript><html>
2016-06-05 23:11:34
LQ_CLOSE
37,648,210
Unexpected NullpointExpection inside a setter
<p>I'm trying to do a simple operation: click a button and show a custom DialogFragment, but I'm getting a NullPointExpection and I can't figure out why.</p> <p><strong>mAlertDialog.java:</strong></p> <pre><code>public class mAlertDialog extends DialogFragment { TextView title; @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_invalid_time, container, false); title = (TextView)view.findViewById(R.id.titleText); return view; } public void setTheTitle(String title) { this.title.setText(title); } } </code></pre> <p><strong>Showing mAlertDialog:</strong></p> <pre><code>mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); dialog.show(fm, "InvalidTime"); </code></pre> <p><strong>Error message:</strong></p> <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference at m.inschool8.Objects.mAlertDialog.setTheTitle(mAlertDialog.java:20) at m.inschool8.bSubjects.Fragment_Subjects$55.onClick(Fragment_Subjects.java:2654) at android.view.View.performClick(View.java:4780) at android.view.View$PerformClick.run(View.java:19866) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) </code></pre>
<java><android><nullpointerexception>
2016-06-06 00:47:26
LQ_CLOSE
37,648,531
Microsoft Excel Macro: Bulk Reading and Writing First Line and Rest of File
<p>I am trying to make a macro that will bulk perform on all .txt files in a given directory. I would like the first line to be copied into the first cell (A1). And then I would like the rest of the contents to be pasted into B1. </p> <p>The macro would perform that for all the .txt files in a directory, except it would go to A2, B2...A3,B3 etc</p> <p>Can anyone help?</p>
<vba><excel><macros>
2016-06-06 01:44:52
LQ_CLOSE
37,648,715
php, show position between students
I have school project which I have done almost to finish, but am stacking on how to show position of student in class according to highest total marks gets. Here the table `(exam_record)` which contain some of records of marks. In this result I want to say John is in position `1` out of `3` students that all. any help please. id name math history history geo pds average total_marks 003 John 90 100 90 100 88 93.6 468 002 Joan 100 60 70 83 90 60.6 403 005 Wily 80 58 90 60 90 75.6 378
<php><mysql>
2016-06-06 02:16:02
LQ_EDIT
37,651,984
Read txt file from drawable folder in android
<p>How to read .txt file from drawable or any other folder in android using FileInputStream?</p> <p>I have a .txt file in my drawable folder. How can i read the file and set it in Textview?</p>
<android><android-file>
2016-06-06 07:39:56
LQ_CLOSE
37,652,353
Json Parser using Url
<p><a href="http://flightia.co.uk/flight_json.json" rel="nofollow">My json file</a></p> <p>I want to get the name of city,airport,carrier in android but it gives error that no value for city or airport as i use in the code given below</p> <pre><code> // get json string from url JSONObject json = jParser.getJSONFromUrl(yourJsonStringUrl); //get the array of users dataJsonArr = json.getJSONArray("data") </code></pre>
<android><json>
2016-06-06 08:03:47
LQ_CLOSE
37,653,258
How to play audio while animation in unity 3D?
<p>I'm new unity 3D developer i want to play audio while animation at the time set. How to play audio while animation in unity 3D?</p>
<android><ios><unity3d>
2016-06-06 08:56:39
LQ_CLOSE
37,654,244
How do I set prompt value using querySelector I want to set input value of max
**How do I set prompt value using querySelector** **I want to set input value of max** > **var max = prompt(""); // prompt value** > **> var selector = '#list > listitem > label[value=here i want prompt > value]';** var max = prompt(""); var selector = '#list > listitem > label[value=max]'; var node = document.querySelector(selector);
<javascript><css-selectors>
2016-06-06 09:46:34
LQ_EDIT
37,655,381
How to group invoices by total amount and line number with SQL server 2008
I have a table look like this: [enter image description here][1] [1]: http://i.stack.imgur.com/j1YkF.jpg I want to auto fill group invoice number if totord accumulation is about 20,000,000 or count distinct invtid maximum is 16. the grouped invoice has to contain all rows of an order or that order will be eliminated. The grouped invoice number will be reset by promdate. Please help me to create a query or a sample SQL code to do it.
<sql><sql-server><sql-server-2008>
2016-06-06 10:44:09
LQ_EDIT
37,655,415
How to remove rows with non unique fields in django by timestamp?
TLDR: How to filter models which have duplicated `hash` field and remove the ones have latest timestamp? I'm creating models with `bulk_create` in django. The thing is one field which I want to be `unique=True` can't be set like this due to encryption applied by `fernet_fields` extension to this field. So I came up with a solution to create additional hash field by which I can determine uniqueness of specified model. One more problem is `bulk_create` does not run with SQL `IGNORE` statement and throws `IntegrityError` if there is non unique record to be recorded. At this point I have an idea just leave hash field with `unique=False` setting and remove non unique records which were added latest after `bulk_create` has been called.
<mysql><sql><sqlite>
2016-06-06 10:46:16
LQ_EDIT
37,656,452
Strings as key in Hashmap
<p>I'm newbie with Java Is it possible to convert a String, or a String[] as the keys of an Hashmap? I mean:</p> <pre><code>String keysToConvert = "key1,key2,key3"; </code></pre> <p>into</p> <pre><code>HashMap&lt;String, Double&gt; hashmap = new HashMap&lt;String, Double&gt;(); [apply in some way the keys of the string] hashmap.get("key2"); </code></pre> <p>I know that <code>hashmap.get("key2");</code>has no value in this moment. I just would know if there is a way to load the keys in an HashMap.</p>
<java><string><hashmap>
2016-06-06 11:38:24
LQ_CLOSE
37,656,525
Eliminate the white body border
<p><a href="http://i.stack.imgur.com/dixSV.png" rel="nofollow">Web Page</a></p> <p>In the above web page photo I have taken a <code>&lt;div&gt;</code> with <code>height : 100vh;</code> and <code>width : 100%;</code></p> <p>I don't want the white body border.</p> <p>Someone please help !!!</p>
<css><html>
2016-06-06 11:41:50
LQ_CLOSE
37,656,664
This is my code for a simple java game. How can I display the letters already guessed so they cannot guess the same letter twice.
//import java.util; import java.util.Scanner; public class HangmanJava { public static void main(String[] args) //creates an array { String input; boolean NotFullMan = true; */runs when NotFullMan is true- all letters haven't been guessed/* char guessedLetter = ' '; Scanner hm = new Scanner(System.in); System.out.println("Enter the hangman word"); input = hm.nextLine(); */after word is entered, moves to next line and game begins/* //Convert String to CharArray char[] charArray = input.toCharArray(); //array tests characters StringBuffer buffer = new StringBuffer(input.length()); //stringbuffer so it can modified as needed int totalCorrect = 0; >>//created totalCorrect variable to help program end at the right time for (int i = 0; i < input.length(); i++) >>//buffer can be used as long as int is less than total length of word buffer.append('_'); while (NotFullMan) { System.out.println("Enter a letter"); guessedLetter = hm.nextLine().charAt(0); //starts game, player must guess a letter int correct = 0; for ( int i=0; i < charArray.length; i++) { //Checks each letter if(guessedLetter == charArray[i] && buffer.charAt(i) == '_') { correct++; totalCorrect++; > //totalCorrect so it can keep track buffer.setCharAt(i, guessedLetter); } } System.out.println("You got " + correct + " correct!"); System.out.println(buffer.toString()); if (totalCorrect == input.length()) > //ends when totalCorrect is equal to the number of characters in word return; } } }
<java>
2016-06-06 11:48:12
LQ_EDIT
37,656,845
How to modify the Verilog code?
module make_counter(h, clk, P); input wire h; input wire clk; output wire P; reg r=1'b1; reg[9:0] n=0; always @(negedge clk) always @(posedge h) begin n=0; end begin if(n<600) n=n+1'b1; if(n==106) r<=1'b0; else if(n==517) r<=1'b1; else ; end assign P=r; endmodule Error (10170): Verilog HDL syntax error at main.v(115) near text "always"; expecting ";" Error (10170): Verilog HDL syntax error at main.v(119) near text "begin"; expecting "endmodule"
<verilog><fpga>
2016-06-06 11:57:27
LQ_EDIT
37,657,341
Design Of SignIn Screen
I Have a problem with the Login Page.Don't know to arrange views as I am posting the code that I tried both in Mobile and Tab. Thanks in advance. Any help will be appreciated. Below I am posting the code of Layout. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/activity_sign_in_back"> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/rlBottomLayout"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android:id="@+id/ivLogo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:src="@drawable/activity_sign_in_logo" /> <EditText android:id="@+id/etUsername" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/ivLogo" android:layout_margin="20dp" android:background="@drawable/edittext_unfocus_background" android:padding="15dp" /> <EditText android:id="@+id/etPassword" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/etUsername" android:layout_margin="20dp" android:background="@drawable/edittext_unfocus_background" android:padding="15dp" /> <LinearLayout android:id="@+id/llRemember" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/tvNoAccount" android:layout_below="@+id/etPassword" android:visibility="invisible" > <ImageView android:id="@+id/ivCheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="right" android:src="@drawable/activity_check_box_remember_me" /> <TextView android:id="@+id/tvRememberView" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="10dp" android:layout_weight="1" android:gravity="" android:text="@string/text_message_remember_me" android:textColor="@color/white" android:textSize="@dimen/text_small_size" /> </LinearLayout> <TextView android:id="@+id/tvSignIn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/llRemember" android:layout_centerHorizontal="true" android:layout_marginTop="15dp" android:background="@drawable/view_white_border" android:paddingBottom="10dp" android:paddingLeft="40dp" android:paddingRight="40dp" android:paddingTop="10dp" android:text="@string/text_message_sign_in" android:textColor="@color/white" android:textSize="@dimen/text_large_size" android:onClick="signIn"/> <TextView android:id="@+id/tvForgotPassword" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvSignIn" android:layout_centerHorizontal="true" android:layout_marginBottom="10dp" android:layout_marginTop="20dp" android:text="@string/text_message_forgot_password" android:textColor="@color/white" android:textSize="@dimen/text_large_size" /> </RelativeLayout> </ScrollView> <LinearLayout android:id="@+id/rlBottomLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginTop="15dp" android:orientation="vertical"> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/tvNoAccount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_gravity="center" android:gravity="center" android:text="@string/text_message_no_account" android:textColor="@color/white" /> <TextView android:id="@+id/tvSignUp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvNoAccount" android:layout_centerHorizontal="true" android:layout_gravity="center" android:layout_marginBottom="15dp" [enter image description here]android:background="@drawable/view_white_background" android:padding="15dp" android:text="@string/text_message_sign_up" android:onClick="signUpActivity"/> </RelativeLayout> </ScrollView> </LinearLayout> </RelativeLayout> I have attached the images one is real and other that I made.I tried to make the image as real but unable to succeed.If anyone have some idea that how to make this then please help me.I am actually trying this from last 4 hours. [enter image description here][1] [1]: http://i.stack.imgur.com/bGSIY.png
<android>
2016-06-06 12:21:13
LQ_EDIT
37,657,838
I am suffering from owin start up issue
[enter image description here][1] [1]: http://i.stack.imgur.com/XRU7M.png Please anyone help me and Please find attachments for error file.
<asp.net><asp.net-mvc-5><owin>
2016-06-06 12:44:49
LQ_EDIT
37,658,686
android studio setting string to intent
String c="MainActivty.class"; Intent ints =new Intent(getApplication(),c); startActivity(ints); How can i do this on the click of the button i.e specify c to an Intent
<java><android><android-studio><android-intent>
2016-06-06 13:24:20
LQ_EDIT
37,659,011
how to use data controls in Cocoa
I am using Xcode(7.3.1) and MacOS EICaptian(10.11.4) and Trying to create a sample project using with "date Controls" In that i tried below mentioned things but i am getting errors, like "dateWithNaturalLanguageString is deprecated in os x 10.10"Instead of this What can i use. var book:Book override init() { book = Book() book.author = "Mr. Author" book.title = "The Book's Title" book.pageCount = 350 book.publishDate = NSDate.dateWithNaturalLanguageString("03/20/1979") as! NSDate and i created custom class and i wrote like this Code: var author:String var title:String var pageCount:Int var publishDate: NSDate override init() { author = "author" title = "title" pageCount = 0 publishDate = NSDate.date() the error: "date() is unavailable:use object Construction NSDate()". Please help me out.
<cocoa>
2016-06-06 13:39:48
LQ_EDIT
37,659,679
C# - Selecting SQL Table contends into textbox
Trying to get table contents into textBoxes seperately by the prefered ID number when button_click event occours. I've found some videos about the situation but dataGrids were used in those. I'm a complete newbie in C# btw, and i'm not even sure what i'm doing. Question is, i cant figure how to write a read-only object that is stated below in code into a textBox. I'm %90 sure that it's truly a simple thing, and i'm missing it. private void button2_Click(object sender, EventArgs e) { SqlCommand rcmd = new SqlCommand("SELECT ID, Column1, Column2 FROM [TEST].[dbo].[Table_1] where ID=@ID", connection); rcmd.Parameters.AddWithValue("@ID", textBox3.Text); connection.Open(); SqlDataReader reader = rcmd.ExecuteReader(); while (reader.Read()) { //reader["Column1"] = textBox4.Text; //reader["Column2"] = textBox5.Text; //These wont work, says reader["Column1"] and reader["Column2"] are read-only. What to do? } connection.Close(); Lines with error are intentionally commented. No mistake there. I was trying to figure something else while keeping those in my sight. Thanks in advance.
<c#><sql><select>
2016-06-06 14:10:52
LQ_EDIT
37,660,538
c# double rounding for xx.5
Is it a good idea to write an extension method for my application , and specify precision or is there any other good idea or other way to achieve **expected** results? Due to the behavior of Convert.ToInt32 to truncate , I am doing something like **below** to achieve expected results > **Note:** Application requirement is to have percentages as **Integer** and not **decimals** eg 50.50 is 51 and not 50.5 public decimal TotalScore { get; set; } public int TotalCount { get; set; } [DataMember(Name = "currentScore")] public int? CurrentScore { get { if (TotalCount > 0) { //eg 0.8149863 * 100 = 81.50 ~ 82 //Convert.ToInt32 use Math.Truncate , so better to round it first //default MidpointRounding.Toeven SO : 2.5 ~ 2 and 3.5 ~ 4 return Convert.ToInt32((Math.Round(Math.Round(TotalScore * 100, 2, MidpointRounding.AwayFromZero), MidpointRounding.AwayFromZero)) / TotalCount); } else { return null; } } set { //Due to the fact WCF will fail with ReadOnly properties. } } example: `'0.8149863 * 100 = 81.50 ~ 82'` `'0.2021111 * 100 = 20.21 ~ 20'` `'0.5889681 * 100 = 58.89 ~ 59'` > **Note:** The behavior for Math.Round is as expected when closer to '0' or '10' , but above double rounding is done specially for 'xx.5'(and works for other cases) **Convert.ToInt32** uses truncate and makes no expense in getting accurate results I need above behavior quiet a lot , so decided to write an extension as **below** , so to call the extension when calculating percentages on decimal and expecting integer value in return /// <summary> /// /// </summary> /// <param name="value"></param> /// <param name="count"></param> /// <param name="decimals">Number of decimal places </param> /// <returns></returns> public static int ToIntPercentageWithPrecision(this decimal value , int count , int decimals ) { return Convert.ToInt32((Math.Round(Math.Round(value * 100, decimals, MidpointRounding.AwayFromZero), MidpointRounding.AwayFromZero)) / count); } However above solution is not readable and looks confusing . Need a clean and readable solution with accuracy.
<c#><rounding>
2016-06-06 14:53:10
LQ_EDIT
37,661,493
how to use this subquary
i want to see if time is below 0 with this quary select * from voorwerp WHERE (Select (((Cast(((DATEADD(dd, looptijd, datum)) - getdate()) as float) * 24.0)*60.0)*60.0) AS tijd from voorwerp) <= 0 i get this error : Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
<sql><sql-server>
2016-06-06 15:38:58
LQ_EDIT
37,664,394
Hello, i have 2 pages and how can i make invisible the frame but from the another page
> Hello, i have 2 pages and how can i make invisible the frame but from > the another page. public class test{ public static void main(String[] args){ JButton b = new JButton("Blinky"); JFrame f = new JFrame("Blinkly Frame"); f.add(b); f.setSize(100, 100); f.setVisible(true); } }
<java><swing><jframe>
2016-06-06 18:26:29
LQ_EDIT
37,665,277
SQLSTATE[28000] [1045] - I'm sorry to ask this as a complete newb
My tech/web/developers are asleep for 7 more hours ($)#(*@) While a terribly noob, I'm dangerous enough to understand steps you tell me to take! SQLSTATE[28000] [1045] Access denied for user 'XXXXX'@'localhost' (using password: YES) I created this user with appropriate privileges in myphpadmin. I'm just hoping to have someone with some helpful tips: https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw I've read that and have questions: 1) Will the error message be the same if I have a user name but the password is different or will it give me a different error (methinks the error is the same regardless) but need to be sure. 2) Could this issue have anything whatsoever to do with too little hard drive space? 3) GRANT ALL PRIVILEGES ON `XXXXXXX_%`.* TO 'XXXXXXX'@'localhost'WITH GRANT OPTION; I ran this query, this user has full privleges: REVOKE ALL PRIVILEGES ON `XXXXXXX_%` . * FROM 'XXXXXXX'@'localhost'; REVOKE GRANT OPTION ON `XXXXXXX_%` . * FROM 'XXXXXXX'@'localhost'; GRANT ALL PRIVILEGES ON `XXXXXXX_%` . * TO 'XXXXXXX'@'localhost'; Was this the right thing to do? 4) I have access to the app/etc/local.xml file, what - if anything should I check in there to see if I'm on the right track? I see the user name appropriately listed there but... I cannot seem to find a reference to the livedb for dbname anywhere in myPHPadmin, where could I look? <connection> <host><![CDATA[localhost]]></host> <username><![CDATA[XXXXXXX]]></username> <password><![CDATA[XXXXXXXXXX]]></password> <dbname><![CDATA[XXXXX_livedb]]></dbname> <initStatements><![CDATA[SET NAMES utf8]]></initStatements> <model><![CDATA[mysql4]]></model> <type><![CDATA[pdo_mysql]]></type> <pdoType><![CDATA[]]></pdoType> any advice would help:)
<mysql><sql>
2016-06-06 19:20:33
LQ_EDIT
37,679,995
Convert JsonArray to Model(using wrapper class)(Json deserialization)
I want to deserialize a jsonarray into list of object. please advice. json string is here: [{ id: 1, customer: "Joe Black", items: { id: 1, description: "One", unit_price: 1.00, quantity: 1 } },{ id: 2, customer: "Joe", items: { id: 2, description: "two", unit_price: 1.00, quantity: 4 } }] and JsonConvert.DeserializeObject<List<rootClass>>(jsonString) Thanks and Regards Muthukumar
<c#><json>
2016-06-07 12:54:25
LQ_EDIT