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
34,990,186
How do I properly insert multiple rows into PG with node-postgres?
<p>A single row can be inserted like this:</p> <pre><code>client.query("insert into tableName (name, email) values ($1, $2) ", ['john', 'john@gmail.com'], callBack) </code></pre> <p>This approach automatically comments out any special characters.</p> <p>How do i insert multiple rows at once?</p> <p>I need to implement this:</p> <pre><code>"insert into tableName (name, email) values ('john', 'john@gmail.com'), ('jane', 'jane@gmail.com')" </code></pre> <p>I can just use js string operators to compile such rows manually, but then i need to add special characters escape somehow.</p>
<javascript><sql><node.js><postgresql><node-postgres>
2016-01-25 10:24:06
HQ
34,990,291
Swashbuckle Swagger - How to annotate content types?
<p>How do I annotate my ASP.NET WebAPI actions so that the swagger metadata includes the content-types that my resources support?</p> <p>Specifically, I want the documentation to show that one of my resources can return the 'original' <code>application/json</code> and <code>application/xml</code> but also now returns a new format, <code>application/vnd.blah+json</code> or <code>+xml</code>.</p>
<asp.net-web-api2><swagger-2.0><swashbuckle>
2016-01-25 10:28:04
HQ
34,990,652
why do we need np.squeeze()?
<p>Very often, arrays are squeezed with <code>np.squeeze()</code>. In the documentation, it says </p> <blockquote> <p>Remove single-dimensional entries from the shape of a.</p> </blockquote> <p>However I'm still wondering: Why <em>are</em> zero and nondimensional entries in the shape of a? Or to put it differently: Why do both <code>a.shape = (2,1)</code> <em>and</em> <code>(2,)</code> exist?</p>
<python><numpy>
2016-01-25 10:45:02
HQ
34,992,668
Why date value added from java to Sqlite database in Android is always null?
I am absolute beginner to Android. But I am having a problem with working with date in Android. Now I am inserting a value from EditText field to a Sqlite table column that is date database date. It is always null when it is added to database. Please help me. What is wrong with my code ? > My DatabaseHelper class public class DatabaseHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "todo.db"; private static final String TABLE_NAME = "task"; private static final String COLUMN_ID = "id"; private static final String COLUMN_DESCRIPTION = "description"; private static final String COLUMN_DATE ="date"; private static final String COLUMN_DONE = "done"; private static final String CREATE_TABLE = "CREATE TABLE "+TABLE_NAME+" ("+COLUMN_ID+" INTEGER PRIMARY KEY AUTOINCREMENT,"+COLUMN_DESCRIPTION+" TEXT,"+ COLUMN_DATE+" DATE,"+COLUMN_DONE+" BOOLEAN)"; SQLiteDatabase db; public DatabaseHelper(Context context) { super(context,DATABASE_NAME,null,DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { this.db = db; db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { String query = "DROP TABLE IF EXISTS "+TABLE_NAME; db.execSQL(query); this.onCreate(db); } public void insertTask(Task task) { db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put(COLUMN_DESCRIPTION,task.getDescription()); values.put(COLUMN_DATE,task.getDate().toString()); values.put(COLUMN_DONE,Boolean.FALSE.toString()); db.insert(TABLE_NAME, null, values); db.close(); } } > This is my save method in Fragment public void saveTask() { String description = tfDescription.getText().toString(); String date = tfDate.getText().toString(); if(description.isEmpty()) { Toast.makeText(getActivity().getBaseContext(),"Description is required",Toast.LENGTH_SHORT).show(); } else if(date.isEmpty()) { Toast.makeText(getActivity().getBaseContext(),"Date is required",Toast.LENGTH_SHORT).show(); } else if(description.length()<getResources().getInteger(R.integer.min_description_length)) { String minChar = String.valueOf(getResources().getInteger(R.integer.min_description_length)); Toast.makeText(getActivity().getBaseContext(),"Description should be minium "+minChar+" characters",Toast.LENGTH_SHORT).show(); } else{ //check date SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); boolean parseOk = false; Date taskDate = new Date(); try{ taskDate = format.parse(date); Task task = new Task(); task.setDescription(description); task.setDate(taskDate); dbHelper.insertTask(task); parseOk = true; } catch(ParseException e) { parseOk = false; } if(parseOk) { //insert task to database Toast.makeText(getActivity().getBaseContext(),"Task saved",Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getActivity().getBaseContext(),"Invalid date format",Toast.LENGTH_SHORT).show(); } } } > This is my Task class public class Task { private int Id; private String Description; private java.util.Date TaskDate; private boolean Done; public void setId(int Id) { this.Id = Id; } public int getId() { return this.Id; } public void setDescription(String Description) { this.Description = Description; } public String getDescription() { return this.Description; } public void setDate(Date taskDate) { this.TaskDate = taskDate; } public Date getDate(){ return this.TaskDate; } public void setDone(Boolean done) { this.Done = done; } public Boolean getDone() { return this.Done; } } Please help me why my date value is always null in database. The input format of the text field is MM/dd/yyyy for date. Please what is wrong with my code ?
<java><android><sqlite><android-sqlite>
2016-01-25 12:30:29
LQ_EDIT
34,992,707
Can you please help me with this quiz program?
This is a java program for making a quiz and you have 10 questions and if you get one answer correct you will get 1 point however there is no negative marking and when I compile it it throws this: 'else' without 'if' error enter code here import java.io.*; import java.util.*; /** * Write a description of class program1 here. * * @author (your name) * @version (a version number or a date) */ public class Project { public static void main(String[]args) { Scanner sc = new Scanner(System.in); char ans; int score=0; System.out.println("1.What was the first mouse created?"); System.out.println("(a)Glass "); System.out.println("(b) Wood"); System.out.println("(c) Steel"); System.out.println("(d) Paper"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='b') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("2. Who is the father of the 'Internet'?"); System.out.println("(a)Alan Peris "); System.out.println("(c) Vint Cerf"); System.out.println("(d) Steve Lawrence"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='c') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("3.What search engine provides "instant answers" for certain types of queries?"); System.out.println("(a)Google "); System.out.println("(b) Yahoo"); System.out.println("(c) Bing"); System.out.println("(d) Dogpile"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='c') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("3.4K might be used synonymously with what acronym?"); System.out.println("(a)UHD "); System.out.println("(b) VGA"); System.out.println("(c) PCI"); System.out.println("(d) HDR"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='a') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("4. A zero day exploit is a type of what?"); System.out.println("(a) Malware "); System.out.println("(b) Shareware"); System.out.println("(c) Freeware"); System.out.println("(d) Adware"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='a') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("5.What adjective describes an image that only contains shades of gray?"); System.out.println("(a) Saturated "); System.out.println("(b) Grayscale"); System.out.println("(c) Hueless"); System.out.println("(d) Black and White"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='b') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("6.What does it mean if a device is erg onomic?"); System.out.println("(a) It is upgradeable"); System.out.println("(b) It is enviromentally friendly"); System.out.println("(c) It is compatible with multiple platforms"); System.out.println("(d) It is designed to be comfortable to use"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='d') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("7. Which of the following can be synced with iCloud?"); System.out.println("(a) Reminders "); System.out.println("(b) Contacts"); System.out.println("(c) Calendar"); System.out.println("(d) Websites"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='d') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("8.What is the term "Wi-Fi" short for?"); System.out.println("(a) Wireless Fidelity"); System.out.println("(b) Wireless Finder"); System.out.println("(c) Wireless Frequency Inte lligence"); System.out.println("(d) Nothing"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='d') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("9. What do keystrokes measure?"); System.out.println("(a) Login attempts"); System.out.println("(b) Secure socket connections"); System.out.println("(c) Keys pressed on a keyboard"); System.out.println("(d) Nothing"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='c') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("10.The veronica search engine is used to search what service?"); System.out.println("(a) Gopher"); System.out.println("(b) Telnet"); System.out.println("(c) BBS"); System.out.println("(d) FTP"); System.out.print("Enter Your Choice => "); ans=sc.next().charAt(0) ; if(ans=='a') System.out.println("That's correct!"); score+=1; else System.out.println("Sorry it is wrong..."); System.out.println("Your total score is:"+score); } } }
<java>
2016-01-25 12:32:40
LQ_EDIT
34,993,022
Add sequence number to fasta headers
Hi I have a set of fasta sequences starting with a different header. I need to add sequence number with increasing count (Seq1, Seq2, Seqn...) for each sequence header. Here is the first one: input: >[organism=Fowl Adenovirus] Fowl Adenovirus FAdV hexon gene, isolate FAdV/SP/1184/2013 output: >Seq1 [organism=Fowl Adenovirus] Fowl Adenovirus FAdV hexon gene, isolate FAdV/SP/1184/2013
<perl><shell><awk>
2016-01-25 12:47:44
LQ_EDIT
34,993,076
Java Lambda create a filter with a predicate function which determines if the Levenshtine distnace is greater than 2
With my low knowledge in lambda, I would appreciate if someone could help me to change my "query". I have a query to get the most similar value. Well I need to define the minimum Levenshtine distnace result. If the score is more than 2, I don't want to see the value as part of the recommendation. String recommendation = candidates.parallelStream() .map(String::trim) .filter(s -> !s.equals(search)) .min((a, b) -> Integer.compare( cache.computeIfAbsent(a, k -> StringUtils.getLevenshteinDistance(Arrays.stream(search.split(" ")).sorted().toString(), Arrays.stream(k.split(" ")).sorted().toString()) ), cache.computeIfAbsent(b, k -> StringUtils.getLevenshteinDistance(Arrays.stream(search.split(" ")).sorted().toString(), Arrays.stream(k.split(" ")).sorted().toString())))) .get(); Thank you!
<java><lambda><filtering><levenshtein-distance>
2016-01-25 12:50:13
LQ_EDIT
34,993,200
Copy complete virtualenv to another pc
<p>I have a <code>virtualenv</code> located at <code>/home/user/virtualenvs/Environment</code>. Now I need this environment at another PC. So I installed <code>virtualenv-clone</code> and used it to clone <code>/Environment</code>. Then I copied it to the other PC via USB. I can activate it with <code>source activate</code>, but when I try to start the python interpreter with <code>sudo ./Environment/bin/python</code> I get</p> <pre><code>./bin/python: 1: ./bin/python: Syntax Error: "(" unexpected </code></pre> <p>Executing it without sudo gives me an error telling me that there is an error in the binaries format. But how can this be? I just copied it. Or is there a better way to do this? I can not just use <code>pip freeze</code> because there are some packages in <code>/Environment/lib/python2.7/site-packages/</code> which I wrote myself and I need to copy them, too. As I understand it <code>pip freeze</code> just creates a list of packages which pip then downloads and installs.</p>
<python><copy><pip><virtualenv>
2016-01-25 12:55:51
HQ
34,993,429
Why does using a virtual base class change the behavior of the copy constructor
<p>In the following program the <code>a</code> member variable is not copied when B is virtually derived from A and instances of C (not B) are copied.</p> <pre><code>#include &lt;stdio.h&gt; class A { public: A() { a = 0; printf("A()\n"); } int a; }; class B : virtual public A { }; class C : public B { public: C() {} C(const C &amp;from) : B(from) {} }; template&lt;typename T&gt; void test() { T t1; t1.a = 3; printf("pre-copy\n"); T t2(t1); printf("post-copy\n"); printf("t1.a=%d\n", t1.a); printf("t2.a=%d\n", t2.a); } int main() { printf("B:\n"); test&lt;B&gt;(); printf("\n"); printf("C:\n"); test&lt;C&gt;(); } </code></pre> <p>output:</p> <pre><code>B: A() pre-copy post-copy t1.a=3 t2.a=3 C: A() pre-copy A() post-copy t1.a=3 t2.a=0 </code></pre> <p>Note that if B is normally derived from A (you delete the <code>virtual</code>) then <code>a</code> is copied.</p> <p>Why isn't <code>a</code> copied in the first case (<code>test&lt;C&gt;()</code> with B virtually derived from A?</p>
<c++>
2016-01-25 13:07:52
HQ
34,993,756
what is the c parameter in this source code?
<p>I want to know what is the c in the below source code . can you explain me what is it doing ???</p> <pre><code> private void txtFamilytoSearch_TextChanged(object sender, EventArgs e) { var db = new LINQDataContext(); if (txtFamilytoSearch.Text == "") gvTable.DataSource = db.MyTables; else gvTable.DataSource = db.MyTables.Where(c =&gt; c.Family.Substring(0, txtFamilytoSearch.Text.Length) == txtFamilytoSearch.Text).Select(c =&gt; c); } </code></pre> <p>this is some part of C# code in linq tecnology. </p> <p>thank you ;-)</p>
<c#><linq><linq-to-sql>
2016-01-25 13:24:51
LQ_CLOSE
34,994,252
How to rename multiple directory from DOS prompt with different names
How to rename multiple directory from DOS prompt with different names like below : > alnaddy.com-7-5-2014 -> alnaddy.com > > cairoscene.org-7-5-2014 -> cairoscene.org > > elshaab.org-7-5-2014 -> elshaab.org > > goal.com-7-5-2014 -> goal.com I have a list of thousands of directories . thanks
<batch-file><cmd>
2016-01-25 13:50:09
LQ_EDIT
34,995,720
Button won't stay OFF
<p>I have this set up so when the hint button is “ON “the target are will highlight when you start to drag the item. This works fine. But when I switch the button to “OFF” as soon as I start to drag an item the button returns to the “ON” position and highlights the target area. How can the button stay “OFF” so no highlighting occurs? Here's the button code (full code in fiddle)</p> <pre><code>function onoff() { currentvalue = document.getElementById('onoff').value; if (currentvalue == "Off") { document.getElementById("onoff").value = "On"; } else { document.getElementById("onoff").value = "Off"; } } </code></pre> <p>Here's jsfiddle <a href="https://jsfiddle.net/aceuk007/8mw1s2zj/" rel="nofollow">Button won't stay OFF</a></p>
<javascript><html>
2016-01-25 15:04:09
LQ_CLOSE
34,996,455
Image processing in Android/Java
<p>I was working on a project name symptom based disease diagnosis in android. As android is java based, so I am implementing the the color matching algorithm directly in java first using image processing libraries like OpenCV etc. I was wondering if I completed the matching process and after that when I embed it into my android code, what if it didn't embed? That's why I am posting this question if I am going right with FIRST developing method in java then embed it into android or should I continue it directly with android??</p>
<java><android><opencv><image-processing>
2016-01-25 15:39:24
LQ_CLOSE
34,996,873
R: Writing list with elements of different classed into a text file
How to write a list of different class variables into a text file consequently using R base functions? `write` and `cat` can't handle data.frames and `write.table` is specific to tables only. None of them handles lists properly. Sample list: > test [[1]] [1] "a" "b" "c" [[2]] [1] "d" "e" "f" [[3]] [1] 1 2 3 [[4]] X.g. X.h. X.i. 1 g h i [[5]] [[5]][[1]] [1] "k" [[5]][[2]] [1] "l" [[5]][[3]] [1] "m" "n" [[6]] [1] "2015-03-23 11:15:00 CET" It consists of character, numeric, POSIXlt time variable and another list. Desired result - a text file like that: a b c d e f 1 2 3 X.g. X.h. X.i. 1 g h i k l m n 2015-03-23 11:15:00
<r>
2016-01-25 15:59:37
LQ_EDIT
34,997,678
Why Debug.Writeline is printing my message in reverse
<p>I write something like this:</p> <pre><code>Debug.WriteLine("RefKey value was {0}", refKey); </code></pre> <p>And then in output window I see:</p> <p><strong>200002V0dH: refInterfaceKey was {0}</strong></p> <p>Why is it kind of printing it right to left? </p>
<c#><debugging>
2016-01-25 16:40:00
LQ_CLOSE
34,999,774
Android Application connecting to an existing database
<p>I am working on an android application for my institute. I have to connect my app to the existing database of the college, although there is no API written. When I contacted the administration for help then they only handed me a SQL connection string and told me to write the API myself. I want to focus on the application only. Is there any way I can skip the API writing and still connect to the database easily and quickly??</p>
<android><database>
2016-01-25 18:34:04
LQ_CLOSE
34,999,832
Java - best merging tool for multiple project in svn
<p>I have a svn branch which holds multiple projects. I want to merge specific revisions of the branch to trunk. What is the best program to do this with? It has to show me the dif and let me resolve any conflicts if there are any. I usually use eclipse but i dont think eclipse supports mergeing a revision of a branch into multiple projects? Are there any alternatives?</p>
<java><svn><merge>
2016-01-25 18:37:27
LQ_CLOSE
35,000,018
Implementing Binary tree in java
<p>I am new to datastructure.I am trying to implement Binary tree using Linked List.</p> <p>I need a few clarifications in implementing it.</p> <p>i)For inserting a new value in tree,Whether we should backtracking and Tree traversal in implementing it.</p> <p>ii)Please suggest me cases for Searching and Deleting a value also.</p> <p>iii)Please suggest me the correct material for implementing all type of Trees.</p>
<data-structures>
2016-01-25 18:48:44
LQ_CLOSE
35,000,113
I get an error when I'm trying to use Firefox In Debian Vagrant
<p>I installed firefox in my debian vagrant using these commands:</p> <pre><code>sudo nano /etc/apt/sources.list Add line in this file: deb http://packages.linuxmint.com debian import sudo apt-get update sudo apt-get install firefox </code></pre> <p>When I trying to use firefox I get error:</p> <pre><code>vagrant@packer-debian-7:~$ firefox -v XPCOMGlueLoad error for file /opt/firefox/libxul.so: libXdamage.so.1: cannot open shared object file: No such file or directory Couldn't load XPCOM. </code></pre> <p>What can I do with this problem?</p>
<firefox><debian><vagrant>
2016-01-25 18:53:36
LQ_CLOSE
35,000,524
php video upload doesn't work
<p>I have a php script. The script can't upload a video.</p> <p>When I submit the form, I get the error: Warning: getimagesize(): Filename cannot be empty. I have search on the internet, I change getimagesize in file() and $_FILES["uploaded_file"]["type"]; But this doesn't work.</p> <p>Can someone help me? How can I upload a video to the upload_video folder? The insert into in de database is working.</p> <p>my script is:</p> <pre><code>include 'connect.php'; $target_dir = "upload_video/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION); var_dump($imageFileType); if(isset($_POST["submit"])) { $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);//this is wrong } if (file_exists($target_file)) { echo "Sorry, file already exists."; $uploadOk = 0; } if($imageFileType != "mp4" ) { echo "only mp4 extensions"; $uploadOk = 0; } if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "the video ". basename( $_FILES["fileToUpload"]["name"]). " is upload."; } else { echo "Sorry, there was an error uploading your file."; } } $sql = "INSERT INTO upload_video (file, description)VALUES (?, ?)"; $stmt = $link-&gt;prepare($sql); $stmt-&gt;bind_param("ss", $target_file, $description ); $beschrijving = $_POST['beschrijving']; $stmt-&gt;execute(); if ($sql) { } else{ echo "Data not add"; } $stmt-&gt;close(); mysqli_close($link); </code></pre>
<php><mysql>
2016-01-25 19:16:16
LQ_CLOSE
35,001,011
Infinite loop in C, codeblock
<p>Here is my code. </p> <pre><code>#include&lt;stdio.h&gt; main() { float H,U,D,F; int x=0,i=0; scanf("%f %f %f %f",&amp;H,&amp;U,&amp;D,&amp;F); while(H&gt;x){ x=x+U-D; U=U-(F/100*U); i++; printf("%d\t%d\t%2lf\t%2lf\t%2lf\n",i,x,U,D,F); } printf("%d",i); } </code></pre> <p>It has fallen in an infinite loop. What's the problem here?</p>
<c>
2016-01-25 19:46:24
LQ_CLOSE
35,001,381
Is there a way to get an email when your HTML5 site goes down like Wordpress?
<p>I have wordpress sites that go down at around 12am because of my web host provider. I get emails every time they shut down. With my HTML5 sites I do not know if you can do the same thing? Is there a free service or something I can make from scratch that can do the same thing.</p> <p>Thanks!</p>
<html><wordpress><server>
2016-01-25 20:08:42
LQ_CLOSE
35,002,010
Would it be possible to convert a NodeJS function to plain Javascript
<p>Im currently playing with the following thing: <a href="http://cgbystrom.com/articles/deconstructing-spotifys-builtin-http-server/" rel="nofollow">http://cgbystrom.com/articles/deconstructing-spotifys-builtin-http-server/</a>, I want to be able to access the SpotifyWebHelper with Javascript, people have build this in NodeJS but I wonder if this is possible in plain JavaScript. Can anyone give me some pointers to start with? Or is this not possible at all?</p> <p>NodeJS version: <a href="https://github.com/onetune/spotify-web-helper/blob/master/index.js" rel="nofollow">https://github.com/onetune/spotify-web-helper/blob/master/index.js</a></p>
<javascript><node.js><spotify>
2016-01-25 20:45:08
LQ_CLOSE
35,002,737
why my js cannot be linked to html?
<p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; var instock=true; var shipping=false; var elstock= document.getElmentById('stock'); elstock.className=instock; var elship= document.getElmentById('note'); elship.className=shipping; //the text should be updated by values stored //in these variables. &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Elderflower&lt;/h1&gt; &lt;div id="content"&gt; &lt;div class="message"&gt;Available: &lt;span id="stock"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="message"&gt;Shipping: &lt;span id="shipping"&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>why js cannot be linked to html??? and how i can link css images to js as well? For example, if it is true, show circle image. If it is false, show cross image.</p>
<javascript><html>
2016-01-25 21:28:18
LQ_CLOSE
35,003,332
How to create a subfolders for each items when having a database
I was a hard time giving this a title as I am not sure what this is called. Anyhow, my question is how can do folders for each item when a have a database. Take this site as an example, whenever you click on a question it takes you to a new page with the following format: http://stackoverflow.com/questions/some_id_number/question_title I originally thought the way to go about this is to programmatically create a folder and a file (the page for this particular new item, a .php page per se) on the insertion of a new item on my table and then inside my php page require the page to filled out with the info retrieved. Help pointing me in the right direction, as well as comments. Oh and you are one of those who like to down vote please at least tell me why, don't just down vote and run.
<php><asp.net><ruby>
2016-01-25 22:06:31
LQ_EDIT
35,004,129
Get new ArrayList<String> of obtained Strings after searching from an ArrayList<String> using TextWatcher Android
**How can I get a new ArrayList<String> of search results after searching from an ArrayList<String> using TextWatcher in android?**<br> The following is my code for searching from an ArrayList<String> using EditText >> **edtSearch**. The search function is working well. Need to put the obtained data into a new ArrayList<String>: > edtSearch.addTextChangedListener(new TextWatcher()){ > > @Override > public void beforeTextChanged(CharSequence s, int start, int count, int after) { > > } > > @Override > public void onTextChanged(CharSequence s, int start, int before, int count) { > MainActivity.this.adapter.getFilter().filter(s); > } > > @Override > public void afterTextChanged(Editable s) { > > } > });
<java><android><arraylist><android-textwatcher>
2016-01-25 23:02:02
LQ_EDIT
35,004,948
Maze game adding player issue
<blockquote> <p>Giving me a Syntax error that "cannot find MyKeyListener". I am trying to add it so player class can be implemented into the grid.So far i have created both player and maze but cant seem able to add player to maze because of this syntax error. Can anyone point out what mistake i am making.</p> </blockquote> <pre><code>import java.awt.*; import javax.swing.*; import java.awt.event.*; // Needed for ActionListener import javax.swing.event.*; // Needed for ActionListener import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.ActionListener; import javax.swing.JPanel; import javax.swing.Timer; public class www extends JFrame { static Maze maze = new Maze (); static Timer t; //======================================================== constructor public www () { // 1... Create/initialize components // 2... Create content pane, set layout JPanel content = new JPanel (); // Create a content pane content.setLayout (new BorderLayout ()); // Use BorderLayout for panel JPanel north = new JPanel (); north.setLayout (new FlowLayout ()); // Use FlowLayout for input area DrawArea board = new DrawArea (500, 500); // 3... Add the components to the input area. content.add (north, "North"); // Input area content.add (board, "South"); // Output area // 4... Set this window's attributes. setContentPane (content); pack (); setTitle ("MAZE"); setSize (490, 500); setKeyListener(new MyKeylistener()); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); setLocationRelativeTo (null); // Center window. } public static void main (String[] args) { www window = new www (); window.setVisible (true); //jf.setTitle("Tutorial"); //jf.setSize(600,400); } class DrawArea extends JPanel { public DrawArea (int width, int height) { this.setPreferredSize (new Dimension (width, height)); // size } public void paintComponent (Graphics g) { maze.show (g); // display current state of colony } } } class Maze { private int grid [][]; public Maze () { int [][] maze = { {1,0,1,1,1,1,1,1,1,1,1,1,1}, {1,0,1,0,1,0,1,0,0,0,0,0,1}, {1,0,1,0,0,0,1,0,1,1,1,0,1}, {1,0,0,0,1,1,1,0,0,0,0,0,1}, {1,0,1,0,0,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,0,0,1}, {1,0,1,0,1,0,0,0,1,1,1,0,1}, {1,0,1,0,1,1,1,0,1,0,1,0,1}, {1,0,0,0,0,0,0,0,0,0,1,0,1}, {1,1,1,1,1,1,1,1,1,1,1,0,1}}; grid = maze; } public void show (Graphics g) { for (int row = 0 ; row &lt; grid.length ; row++) for (int col = 0 ; col &lt; grid [0].length ; col++) { if (grid [row] [col] == 1) // life g.setColor (Color.black); else g.setColor (Color.white); g.fillRect (col * 30 + 30, row * 30 + 30, 30, 30); // draw life form } //g.setColor(Color.RED); //g.fillRect(60,30,30,50); } class MyKeyListener extends KeyAdapter { int x = 0, y = 0,velX = 0, velY = 0; public void keyPressed(KeyEvent e) { int c = e.getKeyCode(); if(c == KeyEvent.VK_LEFT) { velX = -1; velY = 0; } if (c == KeyEvent.VK_UP) { velX = 0; velY = -1; } if( c==KeyEvent.VK_RIGHT) { velX = 1; velY = 0; } if(c==KeyEvent.VK_DOWN) { velX = 0; velY = 1; } } public MyKeyListener () { tm.start (); addKeyListener(this); setFocusable(true); setFocusTraversalKeysEnabled(false); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.RED); g.fillRect(x,y,50,30); } public void actionPerformed(ActionEvent e) { x = x+velX; y = y +velY; repaint(); } } // public void player () // { // // Timer tm = new Timer(5,this); // int x = 0; // int y = 0; // int velX = 0 ; // int velY = 0;tm.start(); // addKeyListener(this); // setFocusable(true); // setFocusTraversalKeysEnabled(false); // } // public void actionPerformed(ActionEvent e) // { // x = x+velX; // y = y +velY; // repaint(); // } // public void keyPressed(KeyEvent e) // { // int c = e.getKeyCode(); // if(c == KeyEvent.VK_LEFT) // { // velX = -1; // velY = 0; // } // if (c == KeyEvent.VK_UP) // { // velX = 0; // velY = -1; // } // if( c==KeyEvent.VK_RIGHT) // { // velX = 1; // velY = 0; // } // if(c==KeyEvent.VK_DOWN) // { // velX = 0; // velY = 1; // } // } // // public void keyTyped(KeyEvent e){} // // public void keyReleased(KeyEvent e){} } </code></pre>
<java>
2016-01-26 00:18:29
LQ_CLOSE
35,005,438
Are addslashes() and prepared statements redundant
<p>Do i need to escape characters when inserting into prepared statements? Do prepared statements escape the code for me?</p>
<php><sql><prepared-statement>
2016-01-26 01:11:21
LQ_CLOSE
35,005,450
Im Getting an Error:Illegal Expression
im still kinda new to pascal but im getting an error thats torturing me a bit can u guys help? i get a error:illegal expression and Fatal: Syntax error, ; expected but : found The Pascal Piece is below: Program PaidUp; const size=30; var payment,totm1,totm2,totm3:real; section1,section2,section3,i,j,idnum:integer; IDNUMARR:array[1..999] of integer; PAYMENTARR:array[1..size] of real; Procedure InitialiseVariables; {This procedure initialises all variables used in the program} Begin idnum:=0; payment:=0; totm1:=0; totm2:=0; totm3:=0; section1:=0; section2:=0; section3:=0; i:=0; j:=0; End; {Initialise Variables} Procedure DeclareandInitialiseArrays; {This procedure declares and initialises all arrays used in the program} Begin IDNUMARR:array[1..999] of integer; PAYMENTARR:array[1..size] of real; For i:=1 to size do begin idnum[i]:=0; payment[i]:=0; end; {ends for statment} End; {Declare and Initialise Variables} Procedure PutDataIntoArray; {This procedure puts the data into the arrays} Begin while(idnum<>0 and payment<>0 and payment=1350 and payment=1620 and payment=1800 and payment=1650 and payment=1980 and payment=2200) do begin writeln('Invalid value, please enter another value'); readln(idnum); readln(payment); end;{ends while statement} set j:=j+1; idnum[j]:=idnum; payment[j]:=payment; End; {Put Data Into Array} Procedure DetermineStatisticsInformation; {This procedure determines which masqueraders belong to which group, tallys the total persons in a section and totals the amount of money paid in each section for costumes} Begin For j:=1 to size do begin if(payment[j]=1350 and payment[j]=1650) then begin writeln('Masquerader with memid:idnum[j] belongs to section1'); section1:= section1+1; totm1:= totm1+payment[j]; end;{ends if statement} if(payment[j]=1620 and payment[j]=1980) then begin writeln('Masquerader with memid:idnum[j] belongs to section2'); section2:= section2+1; totm2:=totm2+payment[j]; end;{ends if statement} if(payment[j]=1800 and payment[j]=2200)then begin writeln('Masquerader with memid:idnum[j] belongs to section3'); section3:= section3+1; totm3:=totm3+payment[j]; end;{ends if statement} End. {Determine Statistics Information} Procedure PrintResults; {This procedure outputs all information} Begin writeln('The number of masqueraders in section 1 is:', section1); writeln('The number of masqueraders in section 2 is:', section2); writeln('The number of masqueraders in section 3 is:', section3); writeln('Total Amount of money paid in section 1 is:', totm1); writeln('Total Amount of money paid in section 2 is:', totm2); writeln('Total Amount of money paid in section 3 is:', totm3); End. {Print Results}
<pascal>
2016-01-26 01:12:36
LQ_EDIT
35,005,916
C Simple RingBuffer - Multithreading - Finding Critical Sections
<p>so I wrote a simple C Ring Buffer that I'm now testing using multiple threads and I'm having a hard time trying to get the code to fail so that I can identify critical sections.</p> <p>Note: The code is in C, but i'm testing it in C++ files because its easier to create threads mutexes etc.</p> <p>Header File:</p> <pre><code>#ifndef _C_TEST_H_ #define _C_TEST_H_ #include &lt;stdio.h&gt; #include &lt;mutex&gt; /////////////////////////////////////////////////////////////////////////////// // Defines and macros /////////////////////////////////////////////////////////////////////////////// #ifndef __cplusplus typedef enum { false, true } bool; #endif #define RING_BUFFER_SIZE 2000 /////////////////////////////////////////////////////////////////////////////// // Structures, Enumerations, Typedefs /////////////////////////////////////////////////////////////////////////////// typedef struct Node { int val; struct Node *next; struct Node *previous; } Node_T; typedef enum RB_ERC { RB_ERC_NO_ERROR, RB_ERC_NULL_PTR, RB_ERC_UNDERFLOW, RB_ERC_OVERFLOW } RB_ERC_T; typedef enum RB_HANDLE_OVERFLOW { RB_DECIMATE, RB_IGNORE_AND_RETURN_ERROR } RB_HANDLE_OVERFLOW_T; typedef enum RB_READ_MODE { RB_FIFO, RB_LIFO } RB_READ_MODE_T; typedef struct RingBuffer { int curSize; RB_HANDLE_OVERFLOW_T handleOverflow; struct Node *Write; struct Node *Read; Node_T buffer[RING_BUFFER_SIZE]; } RING_BUFFER_T; /////////////////////////////////////////////////////////////////////////////// // Prototypes /////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus extern "C" { #endif RB_ERC_T RB_InitRingBuffer(RING_BUFFER_T *rb_, RB_HANDLE_OVERFLOW_T ifOverflow_); //Return true if the queue has no elements; false if there are elements on the queue bool RB_IsEmpty(RING_BUFFER_T *rb_); //Return true if the queue is full; false if there are seats available bool RB_IsFull(RING_BUFFER_T *rb_); //Write N elements (length of the array) to the queue //Note: array values will be read from element 0 to array length RB_ERC_T RB_WriteArray(RING_BUFFER_T *rb_, int values_[], int length_); //Write 1 element RB_ERC_T RB_Write(RING_BUFFER_T *rb_, int val_); //Dequeue and read N elements (length of the array) into an array RB_ERC_T RB_ReadArray(RING_BUFFER_T *rb_, int values_[], int length_, RB_READ_MODE_T readMode_); //Dequeue and read 1 element RB_ERC_T RB_Read(RING_BUFFER_T *rb_, int *readVal_, RB_READ_MODE_T readMode_); #ifdef __cplusplus } #endif #endif //_C_TEST_H_ </code></pre> <p>Source:</p> <pre><code>#include "CTest.h" static std::mutex m; RB_ERC_T RB_InitRingBuffer(RING_BUFFER_T *rb_, RB_HANDLE_OVERFLOW_T handleOverflow_) { //m.lock(); RB_ERC_T erc = RB_ERC_NO_ERROR; int i; if(rb_ == 0) { return RB_ERC_NULL_PTR; } //Initialize this instance of the ring buffer //Both the read/write pointers should start at the same location rb_-&gt;curSize = 0; rb_-&gt;Read = &amp;rb_-&gt;buffer[0]; rb_-&gt;Write = &amp;rb_-&gt;buffer[0]; rb_-&gt;handleOverflow = handleOverflow_; //Build the circular doubly-linked list for(i = 0; i &lt; RING_BUFFER_SIZE; i++) { rb_-&gt;buffer[i].val = 0; if(i == 0) { //Sentinal Node found. Point the first node to the last element of the array rb_-&gt;buffer[i].previous = &amp;rb_-&gt;buffer[(RING_BUFFER_SIZE - 1)]; rb_-&gt;buffer[i].next = &amp;rb_-&gt;buffer[i + 1]; } else if(i &lt; (RING_BUFFER_SIZE - 1) ) { rb_-&gt;buffer[i].next = &amp;rb_-&gt;buffer[i + 1]; rb_-&gt;buffer[i].previous = &amp;rb_-&gt;buffer[i - 1]; } else { //Sentinal node found. Reached the last element in the array; Point the sentinal //node to the first element in the array to create a circular linked list. rb_-&gt;buffer[i].next = &amp;rb_-&gt;buffer[0]; rb_-&gt;buffer[i].previous = &amp;rb_-&gt;buffer[i - 1]; } } //m.unlock(); return erc; } bool RB_IsEmpty(RING_BUFFER_T *rb_) { //m.lock(); //Note: assume rb is valid. if(rb_-&gt;curSize == 0) { return true; } else { return false; } //m.unlock(); } bool RB_IsFull(RING_BUFFER_T *rb_) { //m.lock(); //Note: assume rb is valid. if(rb_-&gt;curSize == RING_BUFFER_SIZE) { return true; } else { return false; } //m.unlock(); } RB_ERC_T RB_WriteArray(RING_BUFFER_T *rb_, int values_[], int length_) { //m.lock(); RB_ERC_T erc = RB_ERC_NO_ERROR; int i; if(rb_ == 0 || values_ == 0 || length_ == 0) { return RB_ERC_NULL_PTR; } switch(rb_-&gt;handleOverflow) { //Increment through the array and enqueue //If attempting to write more elements than are available on the queue //Decimate - overwrite old data //Ignore and return error - Don't write any data and throw an error case RB_DECIMATE: for(i = 0; i &lt; length_; i++) { RB_Write(rb_, values_[i] ); } break; default: case RB_IGNORE_AND_RETURN_ERROR: { int numSeatsAvailable = (RING_BUFFER_SIZE - rb_-&gt;curSize); if( length_ &lt;= numSeatsAvailable ) { //Increment through the array and enqueue for(i = 0; i &lt; length_; i++) { RB_Write(rb_, values_[i] ); } } else { //Attempted to write more elements than are avaialable on the queue erc = RB_ERC_OVERFLOW; } } break; } //m.unlock(); return erc; } RB_ERC_T RB_Write(RING_BUFFER_T *rb_, int val_) { //m.lock(); RB_ERC_T erc = RB_ERC_NO_ERROR; if(rb_ == 0) { return RB_ERC_NULL_PTR; } if( !RB_IsFull(rb_) ) { //Write the value to the current location, then increment the write pointer //so that the write pointer is always pointing 1 element ahead of the queue rb_-&gt;Write-&gt;val = val_; rb_-&gt;Write = rb_-&gt;Write-&gt;next; rb_-&gt;curSize++; } else { //Overflow switch(rb_-&gt;handleOverflow) { case RB_DECIMATE: //Set the value and increment both the read/write pointers rb_-&gt;Write-&gt;val = val_; rb_-&gt;Write = rb_-&gt;Write-&gt;next; rb_-&gt;Read = rb_-&gt;Read-&gt;next; break; default: case RB_IGNORE_AND_RETURN_ERROR: erc = RB_ERC_OVERFLOW; break; } } //m.unlock(); return erc; } RB_ERC_T RB_ReadArray(RING_BUFFER_T *rb_, int values_[], int length_, RB_READ_MODE_T readMode_) { //m.lock(); RB_ERC_T erc = RB_ERC_NO_ERROR; if(values_ == 0) { return RB_ERC_NULL_PTR; } //Verify that the amount of data to be read is actually available on the queue if( length_ &lt;= rb_-&gt;curSize ) { //Increment through the array and dequeue int i; for(i = 0; i &lt; length_; i++) { //Note: Error conditions have already been checked. Skip the ERC check (void) RB_Read(rb_, &amp;values_[i], readMode_); } } else { //Attempted to read more data than is available on the queue erc = RB_ERC_UNDERFLOW; } //m.unlock(); return erc; } RB_ERC_T RB_Read(RING_BUFFER_T *rb_, int *readVal_, RB_READ_MODE_T readMode_) { //m.lock(); RB_ERC_T erc = RB_ERC_NO_ERROR; if(rb_ == 0 || readVal_ == 0) { return RB_ERC_NULL_PTR; } if( !RB_IsEmpty(rb_) ) { switch(readMode_) { case RB_LIFO: //Use the head (Write) to read the most recently written value (newest data) //Note: The write pointer is always pointing 1 position ahead of the current queue. rb_-&gt;Write = rb_-&gt;Write-&gt;previous; //Decrement write pointer //Read the data *readVal_ = rb_-&gt;Write-&gt;val; rb_-&gt;Write-&gt;val = 0; //Reset read values to 0 break; default: case RB_FIFO: *readVal_ = rb_-&gt;Read-&gt;val; rb_-&gt;Read-&gt;val = 0; //Reset read values to 0 rb_-&gt;Read = rb_-&gt;Read-&gt;next; //Increment read pointer break; } rb_-&gt;curSize--; } else { //Attempted to read more data but there is no data available on the queue erc = RB_ERC_UNDERFLOW; } //m.unlock(); return erc; } </code></pre> <p>Main CPP using for tests:</p> <pre><code>#include "CTest.h" #include &lt;iostream&gt; #include "windows.h" #include &lt;thread&gt; using namespace std; static RING_BUFFER_T test1; const int dataSize = 300; const int dataSizeout = 1000; int sharedValue = 0; static std::mutex m; void function1() { int data[dataSize]; RB_ERC_T erc = RB_ERC_NO_ERROR; for (int i = 0; i &lt; dataSizeout; i++) { erc = RB_Write(&amp;test1, i); if (erc != RB_ERC_NO_ERROR) { printf("Count down errrror %d\n", erc); } } //RB_WriteArray(&amp;test1, data, dataSize); } void function2() { RB_ERC_T erc = RB_ERC_NO_ERROR; for (int i = 0; i &gt; -dataSizeout; i--) { erc = RB_Write(&amp;test1, i); if (erc != RB_ERC_NO_ERROR) { printf("Count down errrror %d\n", erc); } } } int main() { RB_InitRingBuffer(&amp;test1, RB_DECIMATE); thread p1(function1); //Sleep(1000); thread p2(function2); p1.join(); p2.join(); //Read out 5 at a time int out; int cnt = 0; while(cnt &lt; (2 * dataSizeout) ) { if (RB_Read(&amp;test1, &amp;out, RB_LIFO) == RB_ERC_NO_ERROR) { printf("out[%d] = %d\n", cnt, out); cnt += 1; } } system("Pause"); return 0; } </code></pre> <p>I'm thinking that everything in the main RING_BUFFER_T instance would be shared variables, so everywhere they are used, which is pretty much everywhere, they would have to be enclosed in mutexes.</p> <pre><code>typedef struct RingBuffer { int curSize; RB_HANDLE_OVERFLOW_T handleOverflow; struct Node *Write; struct Node *Read; Node_T buffer[RING_BUFFER_SIZE]; } RING_BUFFER_T; </code></pre> <p>I suppose NODE_T would be as well, but only for initialization. Am I wrong or shouldn't the elements being stuffed in the ring buffer be placed out of order, since there is no mutex being used right now?</p>
<c++><c><multithreading><doubly-linked-list><circular-buffer>
2016-01-26 02:05:02
LQ_CLOSE
35,006,867
Sql Server Sorting Date With Hours/Mins
I have a complex date column that I need to sort by. SQL Server 2008 **My Query:** SELECT DivisionName as Division, StoreNum as Store, LeadName as Lead, Type, ChangeType,Changes, UpdatedBy, convert(varchar(10),UpdatedDate, 101) + right(convert(varchar(32), UpdatedDate,100),8) as UpdatedDate FROM m WHERE DivID!=0 ORDER BY convert(varchar(10),UPDATEdDate, 101) desc, right(convert(varchar(32), UPDATEdDate,100),8) asc **The format:** in the database: smalldatetime 2016-01-25 16:50:00 **And to the display value, I use:** convert(varchar(10),UpdatedDate, 101) + right(convert(varchar(32), UpdatedDate,100),8) as UpdatedDate **My issue:** (Hour/Minute Sorting), I need the 7:40PM row at top. [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/lB6zb.jpg
<sql><sql-server>
2016-01-26 04:00:36
LQ_EDIT
35,006,966
can not be asigned to a variable error in eclipse (homework)
I am building on a ordering program for java for a class in school and I am getting quantityInput can not be resolved to a variable error I also get the error the method showInputDialog(Component, Object, Object) in the type JOptionPane is not applicable for the arguments (String, int, int) any help in resolving the 2 errors would be much aprecated. public static int getQuantity(int lowValue, int highValue) throws Exception { // quantity must be between 1-99 int quantity; int counter = 0; do { quantityInput = JOptionPane.showInputDialog("How many bracelets would you like to order? (1-99)"); counter = counter + 1; } while (quantityInput < lowValue || quantityInput > highValue && counter < 3); if (quantityInput < lowValue || quantityInput > highValue) { throw new Exception("Invalid responce please enter a number between 1 and 99"); } quantity = Integer.parseInt(quantityInput); return quantity; }
<java><eclipse>
2016-01-26 04:15:41
LQ_EDIT
35,007,068
Can anyone see a mistake in this code?
<p>I'm trying to make some plots of distributions in R and i have the code but it just won't run, it says there's an unexpected symbol. </p> <pre><code>curve(dexp(x, rate=3) xlim=c(0,40), main="exp(rate=3) population distribution", xlab="X", ylab="f(x)") </code></pre> <p>Im trying to plot an exponential random variable with rate 3.</p>
<r>
2016-01-26 04:28:14
LQ_CLOSE
35,007,227
In Android activity lifecycle, do onStop() and onDestroy() always called? Why?
<p>In Android activity lifecycle, do onStop() and onDestroy() always called? Why? Moreover, please named the state definitely called in activity lifecycle? Many thanks</p>
<android><android-activity><lifecycle>
2016-01-26 04:51:11
LQ_CLOSE
35,008,917
Crud operation in single Store procedure in c#
ALTER PROCEDURE dbo.bicrudlogin ( @id int, @username nvarchar(50), @password nvarchar(50), @type varchar(50), @status varchar(50) ) AS if(@status='insert') Begin insert into tbllogin values(@username,@password,@type) End if(@status='select') Begin select username,password,type from tbllogin where id=@id End if(@status='update') Begin update tbllogin set username=@username,password=@password,type=@type where id=@id End if(@status='delete') Begin delete from tbllogin where id=@id End RETURN and code for accessing data using store procedure cmd = new SqlCommand("bicrudregistration",con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@username",txtusername.Text); cmd.Parameters.AddWithValue("@password",txtpassword.Text); cmd.Parameters.AddWithValue("@status","find"); dr=cmd.ExecuteReader(); if this is wrong way, then tell me how to do it. rather than writing separate store procedure for every operation.
<c#><sql>
2016-01-26 07:41:02
LQ_EDIT
35,009,143
How I can calculate date weekend in php
hy all.. i have date like this $start = strtotime('2010-01-01'); $end = strtotime('2010-01-25'); my quetion:<br> how I can calculate or count weekend from $start & $end date range..??
<php><laravel-4>
2016-01-26 07:56:31
LQ_EDIT
35,009,374
as in excel, an formulae are used to refer to cells, i'd like to know how to replicate that in R
<p>trying to keep it as simple as possible</p> <p>Consider this simple excel formula. Lets presume that I'm in cell C2 currently and it holds this formula. =if(A2=1,B2,<strong>C1</strong>)</p> <p>i'm stuck at the referencing part. is there any way to do it?</p>
<r>
2016-01-26 08:14:24
LQ_CLOSE
35,009,494
I have an issue with my if statement it generates warning?
Hello im trying to make a calculator, but my if statement generate warnings. Im am also new to c. int main(){ float num1; float num2; char input[5]; printf("Hello my name is baymax\n"); printf("Enter either add, sub, mult, div:\n"); scanf("%4s", input); printf("Enter first number\n"); scanf("%f", &num1); printf("Enter second number\n"); scanf("%f", &num2); if(input == 'add'){ printf("%.1f + %.1f = %.1f",num1, num2, num1+num2); .... } return 0; } if the string entered is add it will add the two numbers.
<c>
2016-01-26 08:22:25
LQ_EDIT
35,009,779
Check time that is conflict on javascript
How to check time is conflict I have a enrolment project and user get subject on the list. Now how to check the time is conflict with others: var time1 = 10:00AM-12:00:PM; var time2 = 10:30:AM-11:00:AM; How to check the time2 is conflict with time1 ? Im using javascript and I cant find solution. Or you may suggest jquery libraries please help. Thanks
<javascript><jquery><html><time><time-format>
2016-01-26 08:40:20
LQ_EDIT
35,011,160
android google map current location not getting
<p>i am working on a google map activity. i am trying to get the current location.it works perfectly on emulator but not getting the current location on my phone. here is the code which i am using in my application...</p> <pre><code>locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); if (location != null) { double lat = (double) (location.getLatitude()); double lng = (double) (location.getLongitude()); Constants.lat = String.valueOf(lat); Constants.lng = String.valueOf(lng); } </code></pre> <p>Constants is the class where i have decalred the latitude and longitude static variables declared. This code is written in a function and it is call from onCreate method.I am getting null location everytime.I have declare below code also in manifestfile.</p> <pre><code> &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; </code></pre> <p>Can anybody please help me ? Thanks . </p>
<android><google-maps><location>
2016-01-26 10:00:10
LQ_CLOSE
35,013,179
Java cooperating generic classes
I have two abstract generic classes. They cooperate and hence depend on each other. Occasionally one needs to pass `this` to the other. I am trying to find a type safe way to do this. public abstract class AbstractA<T extends AbstractB<? extends AbstractA<T>>> { void foo(T aB) { aB.bar(this); } } public abstract class AbstractB<T extends AbstractA<? extends AbstractB<T>>> { public void bar(T theA) { // ... theA ... } } I get a compiler error message at the call to `aB.bar()`: The method bar(capture#1-of ? extends AbstractA&lt;T&gt;) in the type AbstractB&lt;capture#1-of ? extends AbstractA&lt;T&gt;&gt; is not applicable for the arguments (AbstractA&lt;T&gt;). I was thinking my problem may be related to the one discussed in http://stackoverflow.com/questions/8021900/java-generics-compilation-error-the-method-methodclasscapture1-of-extends. Inspired from that thread I coded a workaround in `AbstractB`: @SuppressWarnings("unchecked") // Parameter inexactly declared just AbstractA<? extends AbstractB<?>> // because the compiler didn’t accept my call to setA(T theA) public void setA(AbstractA<? extends AbstractB<?>> theA) { // Unchecked cast from AbstractA<capture#1-of ? extends AbstractB<?>> to T // ... (T) theA ... } It works, but it’s not so nice with the inexact parameter type and the unchecked cast. In that other thread I liked the reply by Tom Hawtin - tackling, but I have not found a way to apply it to my situation. Can anyone think of clean solution? (`class AbstractA<T extends AbstractB<? extends AbstractA<T>>>` looks a bit complicated; I think I need it for concrete subclasses to know each other’s exact types.)
<java><generics><compiler-errors>
2016-01-26 11:48:25
LQ_EDIT
35,013,349
How to implement process of getting updates from a server?
<p>I'm working on an application that will often (for example, once per 5 minutes) ask server for updated version of configuration using HTTP requests.</p> <p>What is the best way to implement it?</p> <p>Is <a href="https://developer.android.com/reference/android/app/Service.html" rel="nofollow"><code>Service</code></a> suitable for such case? Or may be just a Thread with a loop would be enough?</p>
<java><android>
2016-01-26 11:57:32
LQ_CLOSE
35,013,732
How can you get python to detect strings from integers
<p>In my program I need a hand in trying to get python to say that a input is invalid, the code asks for numbers, if you input a letter I would like it to say its invalid rather than breaking, is there any way I can do this?</p>
<python><string><integer><detection>
2016-01-26 12:20:25
LQ_CLOSE
35,015,685
What do with Async in node js
I have problem with async. Result of this code from pic should be: First:0 Second:2 Item ADD! First:1 Second:2 Item ADD! First:2 Second:2 Item ADD! And here script should stop. I know that code is to long but I can't put less. connection.query('SELECT `keys`.*,`transaction`.*,`keys`.`id` as kid, `transaction`.`id` as tid FROM `transaction` JOIN `keys` ON `keys`.`id` = `transaction`.`keys_id` WHERE `transaction`.`status_pay`= 1 and `transaction`.`status` = 1').then(function(rows){ rows.forEach(function(record) { var offer = manager.createOffer('76512333220'); inventory.forEach(function(item) { connection.query('SELECT amount_two FROM transaction where id = \'' + record.tid + '\'').then(function(w){ console.log("First: " + w[0].amount_two); console.log("Second: " + record.amount); if(w[0].amount_two <= record.amount) { if(item.market_hash_name == record.real_name) { var asid = item.assetid; connection.query('SELECT count(id) as wynik FROM used where asset_id = \'' + asid + '\'').then(function(wiersze){ if (wiersze[0].wynik == 0) { var employee = { asset_id: asid, trans_id: record.tid }; connection.query('INSERT INTO used SET ?', employee).then(function(rows){ offer.addMyItem(item); console.log('Item ADD!'); connection.query('UPDATE `transaction` SET `amount_two`= `amount_two` + 1 WHERE `id`=\''+record.tid+'\'').then(function(rows){ }); }); } }); } } }); }); }); }); [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/WcilH.png
<javascript><node.js>
2016-01-26 14:05:42
LQ_EDIT
35,016,287
How to find dates between two dates in SqlServer 2005
I need to find the dates between two dates in sql server. 2015-12-04 00:00:00.000 and 2015-12-10 00:00:00.000
<sql><sql-server><sql-server-2005>
2016-01-26 14:32:39
LQ_EDIT
35,019,563
servlet db connection with schema.tableName
My query is select* from "Table"."SampleDB"; My servlet code is String dbURL = "jdbc:postgresql://localhost:5433/Table.SampleDB"; String user = "postgres"; String pass = "pass"; conn = DriverManager.getConnection(dbURL, user, pass); I am not able to connect to the database. How to call a "schema.TableName" in servlet getConnection. Please help me fix the issue.
<java><postgresql><jdbc>
2016-01-26 17:04:56
LQ_EDIT
35,020,299
How to code in php to store a one to many relation in mysql database ? (MySQL)
<p>I have two tables. 1) School 2) Student Each School shall have more than one student. One student can only belong to one school. </p> <p>I am noob. I don't know the proper php/ajax code to store a new records in mysql database. I am using 2 select boxes. If I am going to choose school in 1st select box then 2nd select box only show the student who enrolled in designated school..</p>
<php><mysql><ajax>
2016-01-26 17:41:35
LQ_CLOSE
35,021,096
C# Proceed If File Doesn't Exist
I have the following code: public static void readtext(string pathtoText){ if(File.Exists(pathtoText)) { string[] lines = System.IO.File.ReadAllLines(pathtoText); // Display the file contents by using a foreach loop. foreach (string line in lines) { clearPath(line); } } else{ Console.WriteLine("{0} doesn't exist, or isn't a valid text file"); } } My function reads directories from a text file and passes it to clearPath which checks if the directory exists, and if so, cleans it. My problem is that, if a directory doesn't exist, it stops the program. How do I get it to the next directory even if specific directory doesn't exist?
<c#><io>
2016-01-26 18:26:22
LQ_EDIT
35,021,584
how to pass data from one activity to another in android studio
this is my first activity call CreateMessageActivity were the user is ask to check the ckeckboxes so that it can calculate the total public void myClickHandler(View view) { double fish1 = 0; double chicken1 = 0; double steak1 = 0; double total; String total1; CheckBox fish = (CheckBox) findViewById(R.id.checkFish); CheckBox chicken = (CheckBox) findViewById(R.id.checkChicken); CheckBox steak = (CheckBox) findViewById(R.id.checkSteak); //switch (view.getId()) { // case R.id.checkFish: if (fish.isChecked()) { fish1 = 5; } else { fish1 = 0; } // break; // case R.id.checkChicken: if (chicken.isChecked()) { chicken1 = 2; } else { chicken1 = 0; } // R.id.checkSteak: if (steak.isChecked()) { steak1 = 10; } else { steak1 = 0; } //break; // } total = fish1 + chicken1 + steak1; total1 = Double.toString(total); i need to pass total1 to the other activity call ReceiveMessageActivity. Intent intent = new Intent(CreateMessageActivity.this, ReceiveMessageActivity.class); intent.putExtra("message", total1); startActivity(intent); } this is my second activity that it have to display total in the textview. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_receive_message); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); TextView TXT = new TextView(this); Bundle bundle = getIntent().getExtras(); String status = bundle.getString("message"); TXT = (TextView)findViewById(R.id.textViewactivity2); TXT.setText(status);
<android>
2016-01-26 18:53:10
LQ_EDIT
35,022,482
This code should reverse my input of "123ab 445 Hello" to "ba321 544 olleh", however, I get "olleh 544 ba321" as my output. Why is this happening?
import java.util.StringTokenizer; import java.util.Scanner; public class LessNaiveEncryption { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Provide an input sentence: "); String userInput = keyboard.nextLine(); StringTokenizer strTokenizer = new StringTokenizer(userInput, " ", true); System.out.print("The output sentence is : "); while (strTokenizer.hasMoreTokens()) { strTokenizer.nextToken(); } StringBuilder blob = new StringBuilder(userInput); blob.reverse(); System.out.println(blob); System.out.print("\n"); } }
<java><tokenize><stringbuilder>
2016-01-26 19:42:33
LQ_EDIT
35,024,348
Palindrom function using prolog
I'm new in prolog, and I have an exercise which asks to make a palindrome function that returns a Boolean value? this boolean is true if the list is Palindrome otherwise returns false palindrom([X|Xs],bool) . how I should do it ?
<list><prolog><palindrome>
2016-01-26 21:29:44
LQ_EDIT
35,025,585
Programs that lock the computer
<p>At my school we have started using a new typing software for our exams. This software is called Digiexam: <a href="https://www.digiexam.se/en/" rel="nofollow">https://www.digiexam.se/en/</a> When Digiexam is started the computer freezes so that the program window won't be shut down until the essay is handed in. As I have understood most of the code is written in css and javascript. To my question: How can you freeze the computer like this using code? </p>
<javascript><css><software-design>
2016-01-26 22:51:07
LQ_CLOSE
35,027,570
Hwo to design this site menu style in WPF
I do not speak English well. So, I used Google translator. Sorry... I am trying to implement www.devexpress.com menu. But I do not know what to do to implement the unfolding details below. this is my source file. [enter link description here][1] [1]: https://drive.google.com/open?id=0B2twYdJfAGHHYXUtU0I4YVdRak0 thank you.
<c#><css><wpf><visual-studio-2015>
2016-01-27 02:05:36
LQ_EDIT
35,027,747
Overriding methods in Collection<T>
<p>I am working on a class assignment where I have a collection and it will be filtered out. For example, the filter class, which is an interface is one method (matches) which takes in T element. </p> <p>In my FilterCollection class:</p> <pre><code>public class FilteredCollection&lt;T&gt; extends AbstractCollectionDecorator&lt;T&gt; { Collection&lt;T&gt; filterCollection; Filter&lt;T&gt; currentFilter; private FilteredCollection(Collection&lt;T&gt; coll, Filter&lt;T&gt; filter) { super(coll); this.filterCollection = coll; this.currentFilter = filter; } public static &lt;T&gt; FilteredCollection&lt;T&gt; decorate(Collection&lt;T&gt; coll, Filter&lt;T&gt; filter) { return new FilteredCollection&lt;T&gt;(coll, filter); } </code></pre> <p>From there I have to override methods, such as add, addall, contains, remove, etc.</p> <p>With the add() method</p> <pre><code>@Override public boolean add(T object) { return filterCollection.add(object); } </code></pre> <p>However, I need to see if the object matches whats in the filter and if it does, dont add it, if it doesnt, add it. What is the proper way to go about this?</p>
<java><generics>
2016-01-27 02:24:53
LQ_CLOSE
35,027,970
how to prove O(max{ f (n),g(n)}) = O( f (n)+g(n))?
I find a rule about algorithms for analysis. O(max{f(n),g(n)}) = O(f(n)+g(n)) how to prove it? I know max{f(n),g(n)} <= f(n)+g(n) <= 2 * max{f(n),g(n)} thus max{f(n),g(n)} is O(f(n)+g(n)) max{f(n),g(n)} is O(max{f(n),g(n)}) f(n)+g(n) is O(max{f(n),g(n)}) then?
<algorithm>
2016-01-27 02:52:00
LQ_EDIT
35,028,142
Work Around For Whitespaces
<p>How can I get rid of whitespaces when I don't need them?</p> <p>I have to check checboxes then add them to a listbox then pass them to a textbox(multiline). Then of course I have to put at the end Listbox1.Items.Add(Environment.NewLine);</p> <p>This make the items on the textbox separated. But I want that whitespace to be gone when I'm going to process the data. How to remove it?</p>
<c#><newline>
2016-01-27 03:09:11
LQ_CLOSE
35,028,607
c++ win 32, I want to add list of items into a combo box. how do i do it.
I want the user to select from a drop-down list of items in a combo box. This is what I have CreateWindow (TEXT("STATIC"), TEXT ("MODEL"), WS_VISIBLE | WS_CHILD | WS_DISABLED, 10, 20, 70, 17, hwnd,(HMENU) NULL, NULL, NULL );
<c++><winapi>
2016-01-27 03:56:13
LQ_EDIT
35,029,437
Plotting a text file by using gnuplot in python
I have a text file called data.txt and it looks like this: 0 0.0025 sec 1 0.254 sec 2 0.5654 sec I want to plot it by using gnuplot in python. When I enter gnuplot my command line look like this; gnuplot > What do I have to do now to plot my text file and view it?
<gnuplot>
2016-01-27 05:20:27
LQ_EDIT
35,029,754
How to show a dropdown type of menu on tap of button?
<p>I have made a button on navigation bar and want to show a list kind of view on tap of it. What can I do?</p>
<android>
2016-01-27 05:49:17
LQ_CLOSE
35,030,613
best online tutorials for J2EE and J2ME
<p>I am very new to J2EE and J2ME but I am familiar with core java. Now I have started learning J2EE and J2ME. I request you all to suggest the best online tutorials both (pdf and videos) for J2EE and J2ME. Also please guide me How to start learning the MVC Frame works,which should start first and which is the best?</p> <p>Thank you </p>
<java><jakarta-ee><model-view-controller><frameworks><java-me>
2016-01-27 06:55:16
LQ_CLOSE
35,032,192
android application crashes when call intent
> Android application crashes when call intent give a proper solution public class InformationActivity extends Activity { Button btn_submit; CheckBox iz_check,bc_check,vc_check,ac_check,uc_check; EditText no_et; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_info); btn_submit = (Button) findViewById(R.id.btnsubmit1); iz_check= (CheckBox) findViewById(R.id.check1); bc_check=(CheckBox) findViewById(R.id.check2); vc_check=(CheckBox) findViewById(R.id.check3); ac_check=(CheckBox) findViewById(R.id.check4); uc_check=(CheckBox) findViewById(R.id.check5); no_et=(EditText) findViewById(R.id.edittext7); btn_submit.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub //String str = no_et.getText().toString(); //SMSReceiver receiver = new SMSReceiver(); Intent navigationintent = new Intent(InformationActivity.this, MainActivity.class); startActivity(navigationintent); } }); } } > Please give me a solution
<android>
2016-01-27 08:31:01
LQ_EDIT
35,032,671
Add cognalys sdk to android app
I am making and android app which needs phone no verification. I want to and Cognalys SDK in my application so help me how to add this to my application.
<android>
2016-01-27 08:53:28
LQ_EDIT
35,033,847
SQLite: Geeting value 0 from a select when insert works correct
I have a Table `Notes (_Id, Title, Body, Category)` and a Table `Categories (_Id, Name)`, referencing Category to Categories._Id. Whit this method I create a Note in my SQLite Database. /** * Create a new note using the title and body provided, and associated to * the category with row id provided. If the note is successfully created * return the new rowId for that note, otherwise return a -1 to indicate failure. * * @param title the title of the note * @param body the body of the note * @param category the category associated to the note * @return rowId or -1 if failed */ public long createNote(String title, String body, String category) { if (title == null || title.equals("") || body == null) { return -1; } else { ContentValues initialValues = new ContentValues(); initialValues.put(NOTE_KEY_TITLE, title); initialValues.put(NOTE_KEY_BODY, body); // If it has associated a category if (!category.equals("No Category")) { Cursor idCategory = fetchCategory(category); long catId = idCategory.getLong(idCategory.getColumnIndex("_id")); initialValues.put(NOTE_KEY_CAT, catId); // Else, it has no category } else { initialValues.put(NOTE_KEY_CAT, (Byte) null); } return mDb.insert(DATABASE_NOTE_TABLE, null, initialValues); } } And whit this another I get all the notes of my database. /** * Return a Cursor over the list of all notes in the database * * @param mode - if TITLE, it returns the list ordered by the title of the notes. * - if CATEGORY, it returns the list ordered by the category of the notes. * - it returns null in another case. * @param category - category of the notes to return (No Category if none) * @return Cursor over all notes */ public Cursor fetchAllNotes(String mode, String category) { //// Order String order; // Mode is Title if (mode.equals("TITLE")) { order = NOTE_KEY_TITLE; // Mode is Categories } else if (mode.equals("CATEGORY")) { order = CAT_KEY_NAME; // A forbidden mode } else { return null; } // No category filter if it is No Category String cat; if (category.equals("No Category")) { cat = ""; } else { cat = " WHERE " + CAT_KEY_NAME + "='" + category + "'"; } // Left outer because there are notes without category String query = "SELECT * FROM " + DATABASE_NOTE_TABLE + " LEFT OUTER JOIN " + DATABASE_CAT_TABLE + " C ON " + NOTE_KEY_CAT + "=C." + CAT_KEY_ROWID + cat + " ORDER BY " + order; return mDb.rawQuery(query, null); } When I insert a new Note, `createNote()` returns me the correct rowId. When I realize a `fetchAllNotes()` operation, two things happens: when a Note has a category, it returns the correct note with its proper attributes. When another Note has not Category (value `No Category`), the note with the desired attributes is returned, but not its identifier (a 0 value is returned as _id). Any idea of what is happening?
<android><sqlite><android-studio><left-join><android-sqlite>
2016-01-27 09:47:57
LQ_EDIT
35,033,854
is there a bug in java new String
<p>I try this code:</p> <pre><code>byte[] data = new byte[66000]; int count = is.read(data); String sRequest = new String(data); //will received byte array hello String all = sRequest; all = all.concat("world"); System.out.println(all); </code></pre> <p>It only print to my console: <strong>hello</strong></p> <p><strong>concat</strong> funtion of java have bug? I also used + operator instead concat function but result same :( How can I concat a String with new String from a byte array?</p>
<java><concat>
2016-01-27 09:48:30
LQ_CLOSE
35,033,942
How to count rows before while()
<p>I need to count rows before while(). </p> <p>On page there are 10 questions. 5 questions on left, 5 questions on right. </p> <p>It looks like this: </p> <pre><code>&lt;div class="left"&gt; &lt;div&gt;question 1&lt;/div&gt; &lt;div&gt;question 2&lt;/div&gt; &lt;div&gt;question 3&lt;/div&gt; &lt;div&gt;question 4&lt;/div&gt; &lt;div&gt;question 5&lt;/div&gt; &lt;/div&gt; &lt;!-- /left close --&gt; &lt;div class="right"&gt; &lt;div&gt;question 6&lt;/div&gt; &lt;div&gt;question 7&lt;/div&gt; &lt;div&gt;question 8&lt;/div&gt; &lt;div&gt;question 9&lt;/div&gt; &lt;div&gt;question 10&lt;/div&gt; &lt;/div&gt; &lt;!-- /right close --&gt; </code></pre> <p>Data getting from mysql.</p>
<php><mysql><while-loop><count><rows>
2016-01-27 09:52:58
LQ_CLOSE
35,034,185
assign a unique color to a array number in java
<p>hi guys im new to programming this is my code </p> <pre><code>for (int i = 0; i &lt; V; i++) System.out.print(value[i] +" "); System.out.println(); </code></pre> <p>value of "i" are numbers , instead of printing value of "i" I want to print a unique color for each value for example if this is the value: "1 2 1 1 3" i want to print: "red blue red red green" how can i do this?</p>
<java>
2016-01-27 10:02:42
LQ_CLOSE
35,036,077
Python - How do I fix this speed varible writing back to file?
I've been writing a program, I've run into an error. My current code is: import tkinter as tk speed = 80 def onKeyPress(event, value): global speed text.delete("%s-1c" % 'insert', 'insert') text.insert('end', 'Current Speed: %s\n\n' % (speed, )) with open("speed.txt", "r+") as p: speed = p.read() speed = int(speed) speed = min(max(speed+value, 0), 100) with open("speed.txt", "r+") as p: p.writelines(str(speed)) print(speed) if speed == 100: text.insert('end', 'You have reached the speed limit') if speed == 0: text.insert('end', 'You can not go any slower') speed = 80 root = tk.Tk() root.geometry('300x200') text = tk.Text(root, background='black', foreground='white', font=('Comic Sans MS', 12)) text.pack() # Individual key bindings root.bind('<KeyPress-w>', lambda e: onKeyPress(e, 1)) root.bind('<KeyPress-s>', lambda e: onKeyPress(e, -1)) # root.mainloop() I believe speed = min.... is causing the error? However do you guys have any idea?
<python>
2016-01-27 11:27:44
LQ_EDIT
35,036,101
Understanding Chapter 2 Q 22 of A Little Java, A Few Patterns
<p>In Chapter 2 of <em>A Little Java, A Few Patterns</em>, Question 22 is:</p> <blockquote> <p>Are there only Onions on this Shish^D:</p> <p><strong>new</strong> Skewer()?</p> </blockquote> <p>Answer is:</p> <blockquote> <p>true, because there is neither Lamb nor Tomato on <strong>new</strong> Skewer().</p> </blockquote> <p><a href="http://i.stack.imgur.com/nZuyv.png" rel="nofollow">definitions of classes</a></p> <p>Skewer is a subclass of Shish^D, Onion is also a subclass of Shish^D, I don't understand why there are onions on <code>new Skewer()</code>, could someone explain this a bit further?</p>
<java><design-patterns>
2016-01-27 11:28:29
LQ_CLOSE
35,036,429
C# Linq unique not work on lists
<p>I am trying with the following code to check if a list contains duplicated data:</p> <pre><code> internal class Program { private static void Main(string[] args) { var list = new List&lt;Obj&gt;() { new Obj() { id = "1", name = "1" }, new Obj() { id = "1", name = "1" } }; Console.WriteLine(AllItemsAreUnique(list)); } public static bool AllItemsAreUnique&lt;T&gt;(IEnumerable&lt;T&gt; items) { return items.Distinct().Count() == items.Count(); } } internal class Obj { public string id; public string name; } </code></pre> <p>And the result is true! Why?</p>
<c#><linq>
2016-01-27 11:43:14
LQ_CLOSE
35,038,544
My program cant run accountType as a variable
#include <iostream> #include <iomanip> using namespace std; int main () { int accountNumber; float minimumBalance, currentBalance; char accountType; const float SAVINGS_SERVICE_CHARGE = 10.00; const float CHECKING_SERVICE_CHARGE = 25.00; const float SAVINGS_INTEREST_RATE = 0.04; const float CHECKING_LOW_INTEREST_RATE = 0.03; const float CHECKING_AVERAGE_INTEREST_RATE = 0.05; cout <<"Please the details of your account"<< endl; cin >> accountNumber,accountType,minimumBalance,currentBalance; switch (accountType){ case 's': case 'S': cout <<"Account number"<<accountNumber<<endl; cout <<fixed<<showpoint<<setprecision(2); cout <<"Account type:Savings"<<endl; cout <<"Minimum Balance: $"<<minimumBalance << endl; cout <<"Current Balance: $"<<currentBalance << endl; if (currentBalance < minimumBalance) { cout <<"Service Fee:$"<<SAVINGS_SERVICE_CHARGE<<endl;} else { cout <<"Interest Earned:$"<<currentBalance * SAVINGS_INTEREST_RATE << "at" << SAVINGS_INTEREST_RATE*100<<"p%.a"<<endl; } break; case 'c': case 'C': cout <<"Account number"<<accountNumber<<endl; cout <<fixed<<showpoint<<setprecision(2); cout <<"Account type:Checking"<<endl; cout <<"Minimum Balance:$"<<minimumBalance<<endl; cout <<"Current Balance:$"<<currentBalance<<endl; if (currentBalance < minimumBalance) { cout <<"Service fee:$"<<CHECKING_SERVICE_CHARGE<<endl;} else if (currentBalance <= (minimumBalance+5000.00)){ cout <<"Interest Earned:$"<<currentBalance * CHECKING_LOW_INTEREST_RATE <<"at"<<CHECKING_LOW_INTEREST_RATE*100 <<"%p.a"<<endl; }else { cout <<"Interest Earned:$"<<currentBalance * CHECKING_AVERAGE_INTEREST_RATE<< "at"<< CHECKING_AVERAGE_INTEREST_RATE*100 <<"%p.a"<<endl; } break; default: cout <<"ERROR"<<endl; return 1; break; } system ("pause"); return 0; } My program cant read accountType as a variable what should i do to make it run as a variable? Please tell me what to do step by step and what is my error and what to do to make it work thanks in advance.
<c++>
2016-01-27 13:21:05
LQ_EDIT
35,039,200
How to fill the color inside the shape containing different path like curves,lines in c# using winforms
I have drawn the shape using some path segments points, the shape is drawn but color is not filled inside the shape. I have used the FillPath() method, but the color is filled in outline only .I have added the individual points in the graphicspath object like path.AddLine(), the color is filled inside the shape. whenever I have added the whole points using for loop ,the color is not filled in the shape. Regards, Panjanatham T
<c#><winforms>
2016-01-27 13:50:54
LQ_EDIT
35,040,427
Why is the finally statement needed if there is no catch block? (Java)
My teacher was explaining how the `finally` statement is optional in a `try-catch` blockbut why is it absolutely necessary if there is no `catch` statement? For example: try{ for(int j = 0; j <= i.length; j++) { System.out.println(i[j]); } } catch(ArrayIndexOutOfBoundsException e) { System.out.println("Catch"); }//no errors try{ for(int j = 0; j <= i.length; j++) { System.out.println(i[j]); } }//syntax error Error code: Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error, insert "Finally" to complete TryStatement at Driver.main(Driver.java:12)
<java><exception>
2016-01-27 14:45:41
LQ_EDIT
35,041,258
Why do I get None as a result
<p>I have the following script:</p> <pre><code>import math scores = [3.0,1.0,0.1] sum = 0 i=0 j=0 for s in scores: sum = sum + math.exp(scores[i]) i=i+1 def myFunction(x): math.exp(x)/sum for s2 in scores: print(myFunction(scores[j])) j=j+1 </code></pre> <p>But, the output I get is:</p> <pre><code>None None None </code></pre> <p>Why is that? How can I retrieve the correct values?</p> <p>Thanks.</p>
<python>
2016-01-27 15:21:48
LQ_CLOSE
35,044,134
How to properly extract content from object converted to string c#?
<p>I am writing Unit-Tests and am trying to extract a value from a HttpResponseMessage. I am trying to get the value <code>resultCount</code>. Currenly my string looks like this:<code>"{"resultCount":5,"works":null,"success::false,"errors"null}"</code></p> <p>Any ideas how I can get to the 'resultCount:5'</p>
<c#><unit-testing><object><httpcontext>
2016-01-27 17:29:41
LQ_CLOSE
35,045,364
SQL Duplicated resault messages
I have SQL Query: SELECT m.message_subject, m.message_message, m.message_smileys, m.message_datestamp, u.user_id, u.user_name, u.user_avatar FROM ".DB_MESSAGES." m LEFT JOIN ( SELECT user_id, user_name, user_avatar FROM ".DB_USERS." GROUP BY user_id ) u ON m.message_from=u.user_id WHERE (message_to='".$userdata['user_id']."' AND message_from='108') OR (message_to='108' AND message_from='".$userdata['user_id']."') ORDER BY message_datestamp Resault: [Resault Image][1] What I need: [Needed Resault Image][2] Any advice? Well thank you [1]: http://i.stack.imgur.com/g2Ev5.png [2]: http://i.stack.imgur.com/D7hNb.png
<sql><chat><messages>
2016-01-27 18:35:32
LQ_EDIT
35,045,793
Final variable in java
<pre><code> class Test { public static final int x; public static void main (String[] args) { Test.x = 42; } } </code></pre> <p>I have declared a static final variable, and when i compiled it the following error shown up.</p> <pre><code> error: cannot assign a value to final variable x Test.x = 42; </code></pre> <p>i think i have reached to the solution but i want to check if i am right or not?</p> <p>I know that a static variable if not initialized is provided a default value. As it is a static final int variable it will be assigned a value of 0. later on, i tried to change the value to 42 which is not possible because the variable is final and cannot be changed from 0.</p> <p>am i right or is there some other answer to it?</p>
<java><variables><static><initialization><final>
2016-01-27 19:00:40
LQ_CLOSE
35,046,608
how to generate apk file from source in my app programmatically
I have a project to create app like apk creator lite.I want to know How can I create apk file from my android app using java programmatically.I have search alot about this But could not found any straight forward way. basically task is that I have required Apk Name,Icon Url,WebView Url and Version in editText Now I want to create apk from my app as user provided input Data. Please Help me it's urgent <3 :(. I am very confused about it :(
<php><android><asp.net>
2016-01-27 19:42:05
LQ_EDIT
35,047,817
How call and execute a method present in a .dll file and show your (s) Form (s)?
<p>I had that imported a Form already made for a .dll file, and now want call this Form from of my .exe software and open he normally on .dll file.</p> <p>This is all that have until now, but nothing works :-(</p> <p><strong><em>Dll file with a Form inside</em></strong></p> <pre><code>library test; uses System.SysUtils, Winapi.Windows, UMyForm, // Reference to my Form (traditional VCL Form) System.Classes, StrUtils; {$R *.res} var HProcess: THandle; Hid: Cardinal; b: Boolean = False; procedure Call; begin MyForm := TMyForm.Create(nil); MyForm.ShowModal; end; end; begin HProcess:= OpenProcess(PROCESS_ALL_ACCESS,False,GetCurrentProcessId); CreateRemoteThread(HProcess,nil,0,@call,@call,0,Hid); end. </code></pre> <p><strong><em>My software that call and open the Form of Dll file</em></strong></p> <pre><code>unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm1 = class(TForm) btn1: TButton; procedure btn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btn1Click(Sender: TObject); begin LoadLibraryA(PAnsiChar('test.dll')); end; end. </code></pre>
<delphi><dll>
2016-01-27 20:56:26
LQ_CLOSE
35,048,807
error: incompatible types: void cannot be converted to double
<pre><code>import java.util.*; // This program will estimate the cost to paint a room in your house public class PaintJobEstimator { // square feet per one gallon of paint. public static final double AREA_PER_GALLON = 112.0; // hours of labor needed to paint AREA_PER_GALLON square feet. public static final double HOURS_PER_UNIT_AREA = 8.0; // charge to customer for one hour of labor. public static final double LABOR_COST_PER_HOUR = 35.0; // main declares a Scanner that is passed to // the input methods. main also controls the // order of calculations. public static void main( String[] args ) { Scanner keyboard = new Scanner( System.in ); // How many square feet do we need to paint? double sqft = getInput( keyboard, "Enter the number of square feet: " ); // How much does a gallon of paint cost? double gallonCost = getInput( keyboard, "Enter the price of a gallon of paint: " ); //////////////////////////////////////// // Calculate the cost of this paint job. //////////////////////////////////////// // First, how many gallons of paint do we need? int numGallons = calculateGallons( sqft ); // How long will the job take? double hoursLabor = calculateHours( sqft ); // How much will the paint cost? double paintCost = calculatePaintCost( numGallons, gallonCost ); // How much will the labor cost? double laborCost = calculateLaborCost( hoursLabor ); // What's the total bill? double totalCost = calculateTotalCost( paintCost, laborCost ); // Print the results. generateReport( sqft, gallonCost, numGallons, hoursLabor, paintCost, laborCost, totalCost); } public static double getInput( Scanner input, String prompt ) { System.out.print( prompt ); while ( !input.hasNextDouble() ) { input.nextLine(); // get rid of bad input. System.out.print( prompt ); } double inValue = input.nextDouble(); input.nextLine(); // clear the input line. return inValue; } // Your methods go here: // calculateGallons public static int calculateGallons( double sqft ) { // TO DO return correct value return (int)Math.ceil(sqft / AREA_PER_GALLON); } // calculateHours public static double calculateHours( double sqft ) { // TO DO return correct value return sqft / 14; } // TO DO: calculatePaintCost public static double calculatePaintCost (int numGallons, double gallonCost){ return numGallons * gallonCost; } // TO DO: calculateLaborCost (Hours * Labor/hr) public static double calculateLaborCost( double hoursLabor ){ return hoursLabor * LABOR_COST_PER_HOUR; } // TO DO: calculateTotalCost public static double calculateTotalCost( double paintCost, double laborCost ){ return paintCost + laborCost; } // To Do: generateReport public static double generateReport(double sqft, double gallonCost, int numGallons, double hoursLabor, double paintCost, double laborCost, double totalCost) { return System.out.print("To paint" + sqft + "square feet, with"); System.out.print("paint that costs" + gallonCost + "per gallon,"); System.out.print("you will need" + numGallons + "gallons of paint"); System.out.print("and" + hoursLabor + "hours of labor."); System.out.print("The cost of the paint is: " + paintCost ); System.out.print("The cost of the labor is: "+ laborCost); System.out.print("The total cost of the job is: " + totalCost); System.out.println(); } } </code></pre> <p>I am having with the generateReport method, i don't know how to return it properly. i keep getting the error</p> <pre><code>PaintJobEstimator.java:99: error: incompatible types: void cannot be converted to double return System.out.print("To paint" + sqft + "square feet, with"); ^ </code></pre> <p>what am i doing wrong. or am i just completely missing the point. I am new at this and really need help, i don't want to get the answer but if someone can point me in the right direction that would be great</p>
<java>
2016-01-27 21:54:26
LQ_CLOSE
35,050,122
Bash Script to read a file and add the contents
I have no idea of bash scripting, but I need to write one to do the following: I have the following contents in the file, and I want to filter Executor Deserialize Time and add all the values to get the final result. How can I do that? Thanks in advance! {"Event":"SparkListenerTaskEnd","Stage ID":0,"Stage Attempt ID":0,"Task Type":"ShuffleMapTask","Task End Reason":{"Reason":"Success"},"Task Info":{"Task ID":29,"Index":29,"Attempt":0,"Launch Time":1453927221831,"Executor ID":"1","Host":"172.17.0.226","Locality":"ANY","Speculative":false,"Getting Result Time":0,"Finish Time":1453927230401,"Failed":false,"Accumulables":[]},"Task Metrics":{"Host Name":"172.17.0.226","Executor Deserialize Time":9,"Executor Run Time":8550,"Result Size":2258,"JVM GC Time":18,"Result Serialization Time":0,"Memory Bytes Spilled":0,"Disk Bytes Spilled":0,"Shuffle Write Metrics":{"Shuffle Bytes Written":0,"Shuffle Write Time":4425,"Shuffle Records Written":0},"Input Metrics":{"Data Read Method":"Hadoop","Bytes Read":134283264,"Records Read":100890}}} {"Event":"SparkListenerTaskEnd","Stage ID":0,"Stage Attempt ID":0,"Task Type":"ShuffleMapTask","Task End Reason":{"Reason":"Success"},"Task Info":{"Task ID":30,"Index":30,"Attempt":0,"Launch Time":1453927222232,"Executor ID":"1","Host":"172.17.0.226","Locality":"ANY","Speculative":false,"Getting Result Time":0,"Finish Time":1453927230493,"Failed":false,"Accumulables":[]},"Task Metrics":{"Host Name":"172.17.0.226","Executor Deserialize Time":7,"Executor Run Time":8244,"Result Size":2258,"JVM GC Time":16,"Result Serialization Time":0,"Memory Bytes Spilled":0,"Disk Bytes Spilled":0,"Shuffle Write Metrics":{"Shuffle Bytes Written":0,"Shuffle Write Time":4190,"Shuffle Records Written":0},"Input Metrics":{"Data Read Method":"Hadoop","Bytes Read":134283264,"Records Read":100886}}} {"Event":"SparkListenerTaskEnd","Stage ID":0,"Stage Attempt ID":0,"Task Type":"ShuffleMapTask","Task End Reason":{"Reason":"Success"},"Task Info":{"Task ID":31,"Index":31,"Attempt":0,"Launch Time":1453927222796,"Executor ID":"1","Host":"172.17.0.226","Locality":"ANY","Speculative":false,"Getting Result Time":0,"Finish Time":1453927230638,"Failed":false,"Accumulables":[]},"Task Metrics":{"Host Name":"172.17.0.226","Executor Deserialize Time":5,"Executor Run Time":7826,"Result Size":2258,"JVM GC Time":18,"Result Serialization Time":0,"Memory Bytes Spilled":0,"Disk Bytes Spilled":0,"Shuffle Write Metrics":{"Shuffle Bytes Written":0,"Shuffle Write Time":3958,"Shuffle Records Written":0},"Input Metrics":{"Data Read Method":"Hadoop","Bytes Read":134283264,"Records Read":101004}}}
<bash>
2016-01-27 23:25:50
LQ_EDIT
35,052,460
Time difference calculation in php
<p>Lets suppose start time= 2200 and end time= 0500. In PhP how can we check a given time is between start and end time? I only want to check the time, regardless of the date.</p>
<php>
2016-01-28 03:42:10
LQ_CLOSE
35,052,709
Page crashes with no clue why
<p>I have a webpage weblup(dot)net/templates/template3 (replace (dot) with a '.') and it just crashes when I run it. It was working fine not long ago but I have no clue why it's crashing all of a sudden. The biggest change before this happened was that I changed a picture.</p>
<php><html><crash>
2016-01-28 04:09:00
LQ_CLOSE
35,054,188
ask sql for multiplication two coloms and then division with sum of some rows
i have tables **scores** id name score item_id 1 rikad 90 1 2 rikad 80 2 3 rikad 70 3 4 reza 80 1 5 reza 80 2 6 reza 100 3 ---------- **items** id weight 1 0.5 2 0.2 3 0.3 ---------- i want the output with new column call last_score ( (score x weight ) / "0.5 + 0.2 + 0.3 (sum of all weight that have same name)" ) id name score item_id weight last_score 1 rikad 90 1 0.5 last_score 2 rikad 80 2 0.2 last_score 3 rikad 70 3 0.3 last_score 4 reza 80 1 0.5 last_score 5 reza 80 2 0.2 last_score 6 reza 100 3 0.3 last_score
<mysql><sql>
2016-01-28 06:23:15
LQ_EDIT
35,054,670
how to create website without html and css
<p>I think html and css is terrible.<br> How can I create a website without html and css? </p> <p>like android </p> <pre><code>&lt;LinearLayout&gt;something&lt;/LinearLayout&gt; </code></pre>
<html><web>
2016-01-28 06:55:21
LQ_CLOSE
35,055,440
Clicking a button
How to click the buttton? Can you suggest the code I need to press the button enter <dl class="final unpoint"> <dt> <p>By clicking "Place Order", you agree to create this campaign.</p> </dt> <dd> <button>Place Order</button> </dd> </dl> here
<selenium>
2016-01-28 07:39:35
LQ_EDIT
35,055,984
Is there a quick way to check if there is at least one integer in a list in Python?
<p>I feel like there is definitely a quick way to check it, instead of having to loop through the entire list.</p>
<python><list><numbers>
2016-01-28 08:12:18
LQ_CLOSE
35,056,138
What is the purpose of the default keyword in this scene
<p>I saw a question, which looks like this:</p> <pre><code>public @interface Controller { /** * The value may indicate a suggestion for a logical component name, * to be turned into a Spring bean in case of an autodetected component. * @return the suggested component name, if any */ String value() default ""; </code></pre> <p>}</p> <p>What is the default keyword, and the "" after default?</p>
<java><spring-mvc>
2016-01-28 08:19:51
LQ_CLOSE
35,056,257
Calling methods on a List object of type Class
<p>I have made a List with the type of a child class. Why can't I call on the methods defined in the child class?</p> <pre><code> int desktopID = 0; Random randomID = new Random(); List&lt;MessageHandler&gt; test = null; for(int i = 0; i &lt; 1000; i++){ desktopID = randomID.nextInt(10); System.out.println(desktopID); test.storeMessage("Message Number: "+ i, desktopID); } System.out.println(test.getRecentMessage(desktopID).toString()); </code></pre>
<java>
2016-01-28 08:26:05
LQ_CLOSE
35,058,101
MYSQL Left Join month count from two tables
<p>I want to add columns that represent month base counts from other table.</p> <p>I have 2 tables.</p> <p><b>Leave application</b></p> <pre><code>leaveid Userid 1 3 2 4 3 5 4 1 </code></pre> <p><b>Leave Dates</b></p> <pre><code>dateid leaveid leavedates 1 1 2015-10-06 2 1 2015-10-07 3 2 2015-11-01 4 2 2015-11-02 5 3 2015-01-01 6 4 2015-02-12 </code></pre> <p>I want to end up with total leave count based on months:</p> <pre><code>userid january fabruary march so on... 1 1 3 1 2 2 0 1 2 3 4 1 </code></pre>
<php><mysql>
2016-01-28 09:53:57
LQ_CLOSE
35,058,437
Compile error when using std::cout between if/elseif statements
<p>I was wondering why I get a compile error when I try to use std::cout in between, say, an if statement and else if statement. For example:</p> <pre><code>if (condition) {body} std::cout &lt;&lt; "hello world" &lt;&lt; std::endl; else if (condition) {body} </code></pre> <p>Gives the error </p> <pre><code>error: 'else' without a previous 'if' </code></pre>
<c++>
2016-01-28 10:09:08
LQ_CLOSE
35,058,518
Why does the site add code to my index at run-time
<p>I have a problem with my website. The problem is that the site adds code to my index file when running it.</p> <p>This is the code in my index file:</p> <pre><code>for(i = 0; i &lt; game.length; i++){ $('.games').append('&lt;div class="slide304"&gt;&lt;div class="center"&gt;&lt;div id="gameTicker'+ i +'"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div'); } </code></pre> <p>But at runtime the code becomes this:</p> <pre><code>for(i = 0; i &lt; game.length; i++){ $('.games').append('&lt;div class="slide304"&gt;&lt;div class="center"&gt;&lt;div id="gameTicker'+ i +'"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div');&gt; + h + ":" + m; </code></pre> <p>As you can see it adds <code>&gt; + h + ":" + m;</code> at the end of that jquery. This is a problem because now my site can't run due to syntax error <strong>"unexpected token >"</strong></p> <p>Does anyone know why it adds code at the end of that code and how to prevent it? </p>
<jquery>
2016-01-28 10:12:50
LQ_CLOSE
35,059,491
I want a div to show only when user clicks on a button
<form id="search" action="#" method="post" style="float: left"> <div id="input" style="float: left; margin-left: 10px;" ><input type="text" name="search-terms" id="search-terms" placeholder="Search websites and categories..." style="width: 300px;"></div> <div id="label" style="float: left;margin-right: 10px;"><button type="submit" onclick="searchbox()" for="search-terms" id="search-label" class="glyphicon glyphicon-search"></button></div> </form> when user clicks on div id "label", I want to toggle the display property of div "input". which is working fine. I have used following code to implement the functionality. function searchbox(){ if($("#input").css('display') == 'none'){ $('#input').css('display','block'); } else { $('#input').css('display','none'); } } But I want to to submit the form data via post. But that functionality is not working, neither by pressing enter key nor when submit button is clicked. Please help me with this.
<javascript><jquery><html><css>
2016-01-28 10:55:30
LQ_EDIT
35,059,702
does python has a way to implement C#-like indexers?
<p>how to implement in python c# indexers-like this[int i] {get set}? In other words, how to write the follow code in python?</p> <pre><code>public class foo{ ... List&lt;foo2&gt; objfoo; ... public foo2 this[int i] { get{ return objfoo[i]; }} }//end class foo //in another class or method... ofoo = new foo(); ... foo2 X = ofoo[3]; </code></pre>
<c#><python>
2016-01-28 11:04:06
LQ_CLOSE
35,059,819
can we write better queary than this? to reduce performance issues
select (select OMH_RECV_BIC from sc_omh_m where sc_omh_trans_sno=103) as 'Sender\Receiver', (select OMH_MSG_TRM_DT from sc_omh_m where sc_omh_trans_sno=103) as 'Send\Receivedate', (select omh_msg_type from sc_omh_m where sc_omh_trans_sno=103) as 'Message Type', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=20 and omd_sfld_ord=1 and omd_trans_sno=103) as 'Senders Reference', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=50 and omd_sfld_ord=3 and omd_trans_sno=103) as 'Ordering Customer', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=59 and omd_sfld_ord=3 and OMD_TRANS_SNO=103) as 'Beneficiary Customer', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=32 and omd_sfld_ord=2and omd_trans_sno=103) as 'Currency Code', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=32 and omd_sfld_ord=1and omd_trans_sno=103) as 'Date', (select omd_sfld_val from SC_OMD_T where OMD_FLD_TAG=32 and omd_sfld_ord=3and omd_trans_sno=103) as 'Value'
<sql><sql-server><sql-server-2008>
2016-01-28 11:09:07
LQ_EDIT
35,061,548
Why isn't this function displaying cookie?
I have set the cookie using **document.cookie** but I can't read it. I read on w3schools that you can read it by document.cookie, but it's not working. Maybe I've misunderstood this thing, or maybe I'm trying something wrong, I don't know. What's wrong in following code? Here's my code: <body> <button onclick="one()">Set</button> <button onclick="two()">Read</button> <script> function one() { document.cookie="user=Vikas; expires=Sun, 18 Dec 2016 12:00:00 UTC"; var r= document.cookie; return r; } function two() { var h = one(); var i= h.split(";"); var j= i[0]; alert(j); } </script> </body>
<javascript><function><cookies>
2016-01-28 12:30:37
LQ_EDIT
35,062,779
Java BigInteger OR function
<p>I am using Java and have some problems. I made two BigInteger variables, p and q. In my code, I want to add if function, like if(p=1 \ q=1). I tried many ways but there was error. Do you know how to solve this?</p>
<java><if-statement><biginteger>
2016-01-28 13:25:12
LQ_CLOSE
35,063,487
Macro to generate several instances by editing the master copy
https://www.dropbox.com/…..ure12.JPG?dl=0
<excel><vba>
2016-01-28 13:56:24
LQ_EDIT
35,063,651
I need some assistance writing to a excel file
<p>I am programming a task in which a user will enter a sentence (no punctuation), and the program will store the words in a list, and then replace each word with the position of the word in the list that was created. I do not have much of an idea about how to approach this, as I am new to python, however I am assuming that I should first store the words in an Excel database and then position them in the list. If I could have some help with this I would greatly appreciate it, thanks.</p> <p>For more information about the task, view this screenshot:<a href="http://i.stack.imgur.com/8pQNQ.png" rel="nofollow">Task Details</a></p>
<python><excel><csv>
2016-01-28 14:03:39
LQ_CLOSE
35,064,159
Node.js http: Parse "index of"
<p>I need to write a Node.js function that finds all available Node.js versions on the official website. To do this, I wanted to receive the content of this link: <a href="https://nodejs.org/download/release/" rel="nofollow">https://nodejs.org/download/release/</a>, but in form of an array. Is there a way how I can automagically receive and parse the available URLs via some module or do I need to request the site via <code>http</code> and then somehow parse the content manually, and if so, how?</p>
<javascript><node.js><http>
2016-01-28 14:28:38
LQ_CLOSE
35,064,567
What are width and height parameters for in java.awt.Component.getBaseline(int, int)?
<p>Java API documentation doesn't have a lot of information about this. Could someone shed some light on this question?</p>
<java><swing><awt>
2016-01-28 14:46:43
LQ_CLOSE