Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
152,711
152,712
PHP SESSIONS problem
<p>My php sessions when logged in will not display my links when I type the following url in the browser <code>example.com</code> but will display the links when I type <code>www.example.com</code> how can I fix this problem if possible?</p>
php
[2]
982,702
982,703
Showing ImageView and TextView in Gallery
<p>How to show TextView and ImageView both in a single Gallery View . I want to show Image title for each image just below it.</p>
android
[4]
315,827
315,828
ConnectException thrown using ServerSocket
<p>The following code is correct when compiled, but when run it says: ConnectException the error image:</p> <p><img src="http://i.stack.imgur.com/9YZxh.jpg" alt="error image"></p> <pre><code>import java.net.*; import java.io.*; class TcpChat { public static void main(String[] args) throws Exception { Socket s = new Socket("Ip",20000); ServerSocket ss = new ServerSocket(20000); new Thread(new TcpClient(s)).start(); new Thread(new TcpServer(ss)).start(); } } class TcpClient implements Runnable { Socket s; TcpClient(Socket s) { this.s = s; } public void run() { try { OutputStream out = s.getOutputStream(); out.write("hello javaserver".getBytes()); s.close(); } catch (Exception e) { } } } class TcpServer implements Runnable { ServerSocket ss; TcpServer(ServerSocket ss) { this.ss = ss; } public void run() { try { Socket s = ss.accept(); InputStream in = s.getInputStream(); byte[] buf =new byte[1024]; int length =in.read(buf); String ip =s.getInetAddress().getHostAddress(); String data = new String(buf,0,length); System.out.println(ip+":::"+data); s.close(); ss.close(); } catch (Exception e) { } } } </code></pre> <hr> <p>Additionally, there is no error about the IP address I use, in my PC I use my own IP.</p>
java
[1]
1,347,546
1,347,547
why doesnt statement 1 works and statement 2 doesnt in php during database access?
<p>Why doesnt statement 1 works and statement 2 doesnt in php during database access?</p> <p>Statement 1 :</p> <pre><code>$query="select * from $table_id where name=".$integer2; </code></pre> <p>Statement 2 :</p> <pre><code>$query="select * from $table_id where name='$integer2'"; </code></pre>
php
[2]
897,459
897,460
How to get server-side parameters using jQuery UI remote?
<p>I have a php ajax script that is getting called by some jQuery, and I can not seem to get the parameters that are being passed. Here is the example I am working from: <a href="http://jqueryui.com/demos/autocomplete/#remote" rel="nofollow">http://jqueryui.com/demos/autocomplete/#remote</a></p> <p>In my php side, I did something like this just to see what my parameters are:</p> <pre><code>error_log ("1) ".var_dump($_GET)); error_log ("2) ".var_dump($_POST)); error_log ("3) ".var_dump($_REQUEST)); </code></pre> <p>But they all return empty. Can that be? How can I get at the parameters that are being passed?</p> <p>Thanks!!</p> <p>Here is my js:</p> <pre><code>$(function() { $( "#birds" ).autocomplete({ source: "/problems/get_categories_ajax.php", minLength: 2, select: function( event, ui ) { log( ui.item ? "Selected: " + ui.item.value + " aka " + ui.item.id : "Nothing selected, input was " + this.value ); } }); </code></pre>
php
[2]
2,299,433
2,299,434
Calling jQuery function from from js
<p>I've written a Simple function in Javascript which calls a jQuery function the problem is Why do I need to click button to get the toggle effect </p> <p>html</p> <pre><code>&lt;input id="toggle" type="button" value="Toggle" onclick="toggle()" /&gt; </code></pre> <p>javascript</p> <pre><code>&lt;script type="text/javascript"&gt; function toggle() { new_toggle(); } &lt;/script&gt; </code></pre> <p>jQuery </p> <pre><code>$(function new_toggle2(){ $('#toggle').click(function(){ $('#p1').toggle(); // Simple &lt;p&gt; and &lt;h1&gt; tags $('#h').toggle(); }); new_toggle = new_toggle2; }); </code></pre>
jquery
[5]
3,756,007
3,756,008
How to display list of resource drawables
<p>I would like to display all resource drawables in a list so that the user can select one. Is there any way to loop through all R.drawable items so I don't have to hard code them into my program?</p>
android
[4]
467,086
467,087
SessionCookies n asp.net
<p>I am new to ASP.Net <strong>i dont understand the concept of sessioncookies</strong></p> <pre><code>What is a sessioncookie,what are the advantages of sessioncookie whats is sessioncookie is all about, how to create a sessioncookie, how to retreive values from sessioncookies, how to store values in sessioncookies. </code></pre> <p>i searched in net but i dont get clear idea about the sessioncookie concept can anyone pls clarify whats is sessioncookies and its concepts and provide some code samples if possible.</p> <p>Thanks</p>
asp.net
[9]
3,243,568
3,243,569
How do you convert a string with a comma character to an int in c#?
<p>How do you convert a string with a comma character to an int in c#?</p> <p>I have to convert strings like "1924.912" to int's but the int.Parse() and Convert.ToInt32() methods dont work here.</p>
c#
[0]
5,410,865
5,410,866
How to align pointer
<p>How do I align a pointer to a 16 byte boundary?</p> <p>I found this code, not sure if its correct</p> <pre><code>char* p= malloc(1024); if ((((unsigned long) p) % 16) != 0) { unsigned char *chpoint = (unsigned char *)p; chpoint += 16 - (((unsigned long) p) % 16); p = (char *)chpoint; } </code></pre> <p>Would this work?</p> <p>thanks</p>
c++
[6]
1,468,916
1,468,917
get file modification time
<p>hi all i want to write a code for monitoring file changes and reacting to changes. so i write a TimerTask to periodically check the modification of file but i have a problem: when file is open by other programs such as excel or word and i'm closing the file without any changes,value File.lastModified() is changing. i am also trying to get modification date by running dir shell script, it's work fine but it only has minute accuracy! can any one help me? thanks</p>
java
[1]
3,767,285
3,767,286
C# how to sort a list without implementing IComparable manually?
<p>I have a fairly complex scenario and I need to ensure items I have in a list are sorted. </p> <p>Firstly the items in the list are based on a struct that contains a sub struct. </p> <p>For example:</p> <pre><code>public struct topLevelItem { public custStruct subLevelItem; } public struct custStruct { public string DeliveryTime; } </code></pre> <p>Now I have a list comprised of topLevelItems for example:</p> <pre><code>var items = new List&lt;topLevelItem&gt;(); </code></pre> <p>I need a way to sort on the DeliveryTime ASC. What also adds to the complexity is that the DeliveryTime field is a string. Since these structs are part of a reusable API, I can't modify that field to a DateTime, neither can I implement IComparable in the topLevelItem class. </p> <p>Any ideas how this can be done?</p> <p>Thank you</p>
c#
[0]
921,033
921,034
How do I do this OnClientClick="jpcPrint(<%= this.Controller.JPId %>);"... so that it works
<p>When i try to </p> <pre><code>OnClientClick="jpcPrint(&lt;%= this.Controller.JPId %&gt;);" </code></pre> <p>for a button, &lt;%= this.Controller.JPId %> is literally put into the html rather than being evaluated. How do i write some version of the above such that the html would read:</p> <pre><code>onclick="jpcPrint(49);" </code></pre> <p>for example instead of </p> <pre><code>onclick="jpcPrint(&lt;%= this.Controller.JPId %&gt;);" </code></pre> <p>&lt;%= this.Controller.JPId %> evaluates perfectly well when placed elsewhere on the page including in a gridview above this button. For example this works fine:</p> <pre><code>&lt;cc1:AutoCompleteExtender ID="Autocompleteextender1" MinimumPrefixLength="4" CompletionInterval="1000" CompletionSetCount="10" ServiceMethod="GetCompletionList" ContextKey="&lt;%# this.Controller.JPId %&gt;" TargetControlID="txtLKey" runat="server" CompletionListCssClass="jpcKeyList" &gt; </code></pre> <p>So this.Controller.JPId is not the issue. Seems to be something about the way such statement are evaluated within button attributes.</p>
asp.net
[9]
771,413
771,414
How to record a video from imagepicker controller deletage
<p>I want to record a video from imagepicker controller delegate. I am getting capture image but i am not getting video mode record. </p> <p>Thanks and Regards.</p>
iphone
[8]
1,823,415
1,823,416
iPhone - nil button outside the method?
<p>I am creating a button like this inside a method:</p> <pre><code>UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(0, 0, 100, 50); [btn setTitle:@"Hello, world!" forState:UIControlStateNormal]; [self.view addSubview:btn]; myButton = btn; // I am saving the btn reference to this ivar declared on .h as UIButton. </code></pre> <p>At another point of the code I try to use myButton and it is always nil.</p> <p>I have tried to retain btn after assigning it to myButton on the original method but myButton is always nil.</p> <p>self.view is always there. btn is never released.</p> <p>Why myButton is nil?</p> <p>I know I can create the button using alloc, but I am just trying to understand this.</p> <p>thanks.</p>
iphone
[8]
3,725,362
3,725,363
How to condense over 150 jquery functions that do the same thing to different divs?
<p>im new to jquery and javascript.. Here is the code, this is a sample, on the real page there will be over 150 kinds of drinks, 5 are shown below, is there a way to condense this code? It makes it so when clicking one div another div will bounce. The divs that bounce contain small images, this is used as a giant menu system for finding drinks. thank you for your time and help.</p> <pre><code>$(document).ready(function(){ $("#Pepsi").click(function (){ $("#Pepsi-Div").delay(600).effect("bounce", { times:3, distance:30 }, 300); }); $("#Coke").click(function (){ $("#Coke-Div").delay(600).effect("bounce", { times:3, distance:30 }, 300); }); $("#Crush").click(function (){ $("#Crush-Div").delay(600).effect("bounce", { times:3, distance:30 }, 300); }); $("#7up").click(function (){ $("#7up-Div").delay(600).effect("bounce", { times:3, distance:30 }, 300); }); $("#RootBeer").click(function (){ $("#RootBeer-Div").delay(600).effect("bounce", { times:3, distance:30 }, 300); }); }); </code></pre>
jquery
[5]
28,064
28,065
Application crashes on Windows 2008 m/c when using delete[]
<p>Application crashes on Windows 2008 m/c when using <code>delete[]</code>. But the same works in 2003 m/c. We allocated the memory using <code>new[</code>] and trying to delete using <code>delete[]</code>. Example, </p> <pre><code>x= new char[100]; . delete[] x; </code></pre>
c++
[6]
5,769,912
5,769,913
How do I re-publish an app on the Android Market
<p>How do I re-publish an app on the Android Market, do I have to upload all the screen shots again or can I just upload the app?</p> <p>Cheers,</p> <p>Mike.</p>
android
[4]
4,343,207
4,343,208
What is the difference between a dialog being dismissed or canceled in Android?
<p>Like the title says, what is the difference between a dialog being dismissed or canceled in Android?</p>
android
[4]
1,704,590
1,704,591
Android :webview make make urls clickable even data contain clcikable and non clickable urls
<p>How can I make non click-able urls in webview as click-able if the html data contains boths urls in tag and without tag. There is one way to first make only click-able urls as non click-able using java script(pattern matching) then making all non click-able urls as click-able urls using java script(pattern matching).</p>
android
[4]
1,716,864
1,716,865
Is there a way in JavaScript which clicks an anchor
<p>Is there anyway in JavaScript which emulate user clicks an anchor?</p> <p>Mozilla(Firefox ) does not implement that. <a href="https://developer.mozilla.org/en/DOM/element.click" rel="nofollow">https://developer.mozilla.org/en/DOM/element.click</a></p> <p>But is there any browser which does?</p>
javascript
[3]
1,876,591
1,876,592
Need help understanding some Python code with @, *args and **kwargs
<p>I'm new to Python, and stumped by this piece of code from the Boto project:</p> <pre><code>class SubdomainCallingFormat(_CallingFormat): @assert_case_insensitive def get_bucket_server(self, server, bucket): return '%s.%s' % (bucket, server) def assert_case_insensitive(f): def wrapper(*args, **kwargs): if len(args) == 3 and not (args[2].islower() or args[2].isalnum()): raise BotoClientError("Bucket names cannot contain upper-case " \ "characters when using either the sub-domain or virtual " \ "hosting calling format.") return f(*args, **kwargs) return wrapper </code></pre> <p>Trying to understand what's going on here.</p> <ol> <li>What is the '@' symbol in <code>@assert_case_sensitive</code> ?</li> <li>What do the args <code>*args, **kwargs</code> mean?</li> <li>What does '<code>f</code>' represent?</li> </ol> <p>Thanks!</p>
python
[7]
4,869,897
4,869,898
Call jQuery plugin method on a standard string without using a selector?
<p>I have a <code>parseuri</code> jQuery plugin method that affects the <code>.val()</code> of an input otherwise the element's <code>.text()</code>. Although this question is general, this specific method parses URLs for example:</p> <pre><code>// assume text box contains URL like [ http://example.com:80 ] $('input:text').parseuri().authority; // get the authority of the domain // or if in a div $('div#url').parseuri().port; // get the port of the url </code></pre> <p><strong>How can I call this jQuery method on a standard string without using a selector?</strong> </p> <h2>Context</h2> <p>The plugin is my own, based on the <a href="http://docs.jquery.com/Plugins/Authoring#Maintaining_Chainability" rel="nofollow">jQuery Maintaining Chainability code sample here</a> and it wraps <a href="http://blog.stevenlevithan.com/archives/parseuri" rel="nofollow">this parseUri 1.2 JavaScript method</a>. </p> <p>I pasted my initial attempt here: <a href="http://jsfiddle.net/wyPKH/" rel="nofollow">http://jsfiddle.net/wyPKH/</a></p> <p>I was hoping to have a plugin version of the parseUri JavaScript method that can operate on both elements and plain strings in a consistent manner. </p>
jquery
[5]
71,420
71,421
what isCOMCLASS attribute and how is used
<p>I was checking some code , I found comClass attribute.</p> <p>what is that and what is it used for?</p> <p>is there any good articles about that?</p> <p>Thanks</p>
asp.net
[9]
3,598,894
3,598,895
using jQuery to get other buttons not clicked in a div
<p>I have an HTML div</p> <pre><code>&lt;div id="buttons"&gt; &lt;button type="button" id= "button_1" &gt;I am button one&lt;/button&gt;&lt;/br&gt;&lt;/br&gt; &lt;button type="button" id= "button_2"&gt;I am button two&lt;/button&gt;&lt;/br &gt;&lt;/br&gt; &lt;/div&gt; </code></pre> <p>I have attached the following jQuery handler</p> <pre><code>$("#buttons").click(function(event) { } </code></pre> <p>I want to put in code that colors the clicked button’s label type color to red and the other button or buttons (I may add more) label type color back to black. Using this type of code: </p> <pre><code> $("#button_1").css("color","red”); </code></pre> <p>I thought that using .not would work to get me the unclicked divs, something like: <code>$("#buttons").not(“#” + event.target.id).css("color”,”black”)</code> would set all unclicked buttons- basically those that are not event.target - to black, then I would set the clicked on to red <code>$(“#” + event.target.id).css("color”,”black”)</code> -</p> <p>It is not working- hence my query. Thanks for any answers.</p>
jquery
[5]
2,654,776
2,654,777
How to create another page class in a aspx c# page
<p>Results r = (Results)Page.LoadControl("Results.ascx");</p> <p>In my Page i cannot access USER CONTROL CLASS(Results) Gives error.I cannot resolve.</p> <p>No namespaces at all.</p> <p>Even i cannot access other aspx class in same folder's other page also..</p> <p>Can you please help me.</p>
asp.net
[9]
2,634,541
2,634,542
Is there a way to get both the argument name and value while looping over arguments array?
<p>I an creating a querystring from the supplied arguments to Javascript function. I am looping over the arguments array and want to have argumentName and its value.</p> <p>Thans</p>
javascript
[3]
2,747,264
2,747,265
Java webdevelopment IDE/Server/Documentation
<p>I have been using PHP (OOP) with various Frameworks for all my webdevelopment projects for the last few years. Next year I'll have to learn Java as part of CS university course, so I thought it may be a good idea to switch to Java for some of my smaller webdevelopment projects, so that I can get to know Java in advance.</p> <p>What do I need to use Java for backend web development? What IDE/Server software/etc. should I use? What frameworks are available and which documentations could one recommend?</p> <p>I know this is strictly not a Stackoverflow question, but I'd really like to hear the opinion of the very professional community here at Stackoverflow!</p>
java
[1]
5,095,114
5,095,115
open and save file dialog
<p>i use an openFileDialog to read from a text file and print the values in a listbox and a saveFileDialog to save the changes in textfile.i wrote this code but it doesn't work.if a change the listbox with a textbox works fine.But i need to print and save the items into a listbox.any suggestions?</p> <pre><code> private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { } private void button4_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { label7.Text = openFileDialog1.FileName; listBox1.Text = File.ReadAllText(label7.Text); } } private void button5_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { File.WriteAllText(saveFileDialog1.FileName, listBox1.Text); } } </code></pre>
c#
[0]
1,332,358
1,332,359
can we use .jpg format images for mobile applications I.e iphone and android
<p>i am working on mobile application where i need to display a background image using css sprites. here is the problem image size is 1600px width and 480px height. when i convert this image to png the file size is 400kb. and in jpg format it is 80kb. So, my question is whether can i use the jpg format image in mobile application. especially in iphone and android........?</p> <p>Thanks in Advance....</p>
iphone
[8]
3,989,609
3,989,610
PHP foreach, if statement
<p>I have a table listing several elements, and their expiration date.</p> <p>I need a function that says, "If the expiration date is later than today (for each element), then don't show".</p> <p>It seems pretty simple, but I'm stuck!</p> <hr> <p><strong>Edit</strong></p> <pre><code>&lt;?php foreach($codes-&gt;result_array() as $row):?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php print $row['description']?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php print $row['credits']?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php print $row['code']?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo date("F jS, Y", strtotime($row['exp_date']));?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo date("F jS, Y", strtotime($row['create_date']));?&gt;&lt;/td&gt; &lt;td&gt; &lt;!-- Icons --&gt; &lt;a href="&lt;? echo base_url()?&gt;admin/home/editCode/&lt;?php print $row['id']?&gt;" title="Edit"&gt;&lt;img src="&lt;? echo base_url()?&gt;assets/images/icons/pencil.png" alt="Edit" /&gt;&lt;/a&gt; &lt;a href="&lt;? echo base_url()?&gt;admin/home/deleteCode/&lt;?php print $row['id']?&gt;" title="Delete" class="delete-code"&gt;&lt;img src="&lt;? echo base_url()?&gt;assets/images/icons/cross.png" alt="Delete" /&gt;&lt;/a&gt; &lt;/td&gt; &lt;?php endforeach;?&gt; </code></pre>
php
[2]
1,757,239
1,757,240
How to stop calling the onDraw() function on a View?
<p>Im clearing up the bitmaps i load in one activity before i more into the other activity. </p> <p>eg:</p> <pre><code>pic1 = null; System.gc(); nextActivityIntent = new Intent(ThisActivity,NextActivity.class); ThisActivity.startActivityForResult(nextActivityIntent,123); </code></pre> <p>But the problem is system calls onDraw some times after i call "pic1=null". When it happens the application crashes with pointing a NullPoint Exception.</p> <p>Cab any one suggest me how to stop calling onDraw() after setting the "pic1=null". Can i use synchornized to make this happen. </p>
android
[4]
2,454,844
2,454,845
blur on an image
<p>Please look at this code:</p> <pre><code>jQuery(document).ready(function(){ jQuery("td.setting").click(function(){ text = jQuery(this).text(); jQuery(this).replaceWith("&lt;input class='inputSetting' type='text' value="+text+"&gt;&lt;img class=\"accept\" src='images/accept.png'&gt;"); console.log(text); }); jQuery("img.accept").bind('click',function(){ console.log("blur"); }); }); </code></pre> <p>When I press on the td. The input box appears. But when I clcikc on the accept img nothing happens. There should be amessage on my console "blur" but nothing happens. </p> <p>I also tried: </p> <pre><code>jQuery("img.accept").click(function(){ console.log("blur"); }); </code></pre> <p>But this also doesn't work.</p>
jquery
[5]
4,570,347
4,570,348
Java Socket Closes After Connection?
<p>Why does this port/socket close once a connection has been made by a client?</p> <pre><code>package app; import java.io.*; import java.net.*; public class socketServer { public static void main(String[] args) { int port = 3333; boolean socketBindedToPort = false; try { ServerSocket ServerSocketPort = new ServerSocket(port); System.out.println("SocketServer Set Up on Port: " + port); socketBindedToPort = true; if(socketBindedToPort == true) { Socket clientSocket = null; try { clientSocket = ServerSocketPort.accept();//This method blocks until a socket connection has been made to this port. System.out.println("Waiting for client connection on port:" + port); /** THE CLIENT HAS MADE A CONNECTION **/ System.out.println("CLIENT IS CONENCTED"); } catch (IOException e) { System.out.println("Accept failed: " + port); System.exit(-1); } } else { System.out.println("Socket did not bind to the port:" + port); } } catch(IOException e) { System.out.println("Could not listen on port: " + port); System.exit(-1); } } } </code></pre>
java
[1]
1,160,671
1,160,672
How to share class library for more than two asp.net projects,without duplication
<p>How to share class library for more than two asp.net projects,without duplication. All projects exist on the same server.</p>
asp.net
[9]
1,945,767
1,945,768
how to select specific <span> under <div>
<p>I have a structure something similar to,</p> <pre><code>&lt;div class="div1"&gt; &lt;a class="myimg" href="#"&gt;clickme1&lt;/a&gt; &lt;span&gt;myspan1&lt;/span&gt; &lt;/div&gt; &lt;div class="div2"&gt; &lt;a class="myimg" href="#"&gt;clickme1&lt;/a&gt; &lt;span&gt;myspan2&lt;/span&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>&lt;style type="text/css"&gt; .div1 { border: 1px solid red; } .div2 { border: 1px solid black; } .test { border: 1px solid yellow; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function () { $("a.myimg").click(function () { alert($(this).html()); $("span").addClass("test"); }); }); </code></pre> <p>now when I click on <code>&lt;a&gt;</code> span in both the divs are getting affected, What I want is if I click on div1 <code>&lt;a&gt;</code> then it should affect span1, and same for div 2. How to achive his in jquery.</p> <pre><code> &lt;/script&gt; </code></pre> <p>EDIT: Is it possible by using context, something similar to,</p> <pre><code>$("a.myimg",context).click(function () { </code></pre>
jquery
[5]
5,385,835
5,385,836
Div hide not working
<p>I'm trying to hide a div, and I can't seem to get it working properly. Here's my code:</p> <pre><code>&lt;head&gt; &lt;title&gt;Home - Chrome&lt;/title&gt; &lt;link rel="stylesheet" href="main.css"&gt; &lt;script src="jquery.js"&gt;&lt;/script&gt; &lt;script&gt; function 1Hide() { document.getElementById('div1').style.display = 'none'; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="div1"&gt; &lt;/div&gt; &lt;a onclick="1Hide" href="javascript:void(0);"&gt;Click&lt;/a&gt; &lt;/body&gt; </code></pre> <p>CSS:</p> <pre><code>#div1 { height: 100; width: 700; margin: 30 auto 0 auto; background: #FFFFFF; } </code></pre>
javascript
[3]
564,370
564,371
Copy value from one textbox to another using submit button
<p>I know this can be accomplished by Javascript, and I am learning so please tell me, when I click an update button I want the text from a textbox to be copied into another one.</p>
javascript
[3]
4,812,823
4,812,824
How to make a div element scroll to the top of the page
<p>Assume that I have ten paragraphs of text and there is edit link next to each of paragraph. When I click on 'edit' the contents of the paragraph is available for editing.</p> <p>So I have </p> <pre><code>&lt;p id='p1'&gt;data for p1&lt;/p&gt; &lt;p id='p2'&gt;data for p2&lt;/p&gt; &lt;p id='p3'&gt;data for p3&lt;/p&gt; &lt;p id='p4'&gt;data for p4&lt;/p&gt; </code></pre> <p>If I click on 'edit' to edit p3 then text area appears at the very bottom. So right now I see data for p1, data for p2 and just the top of the form for p3. data for p4 is not visible and is below the viewport.</p> <p>Is there a way in jQuery so that the edit form appears at the top of the page every single time. </p> <p>I am not trying to use fixed position or anything. The order should still be there. However in this case the data for p1 and p2 should be above the page and not visible. The form for p3 and data for p4 should appear on the page.</p>
jquery
[5]
2,400,353
2,400,354
Form live validation has too many alerts on submit
<p>I'm using the live validation form here <a href="http://www.geektantra.com/projects/jquery-form-validate/advanced_demo/" rel="nofollow">http://www.geektantra.com/projects/jquery-form-validate/advanced_demo/</a> and i wanted to add an alert to the submit button. When I do, it pops an alert for every instance of required field i have in the form so I have to click ok a bunch of times. How can I get just one alert? </p> <pre><code>jQuery(this).parents("form").submit(function(){ if (validate_field('#' + SelfID)) return true; else alert('Please go back and fill in all the required fields.'); return false; }); </code></pre>
jquery
[5]
1,841,461
1,841,462
When Features shown on Google IO are available?
<p>When those features shown on Google IO 2011 Android tools are available in Eclipse adt?</p>
android
[4]
5,051,802
5,051,803
Not getting an output from my inputs
<p><a href="http://pastebin.com/YmeB2D1N" rel="nofollow">http://pastebin.com/YmeB2D1N</a></p> <p>Essentially, my program has two EditTexts, a Button, and a TextView. You input a number/string into the EditText, and an output is supposed to be shown in the TextView. However, all i get is a 'There is no Department'. How do i fix this?</p>
android
[4]
3,888,812
3,888,813
Programmatically determine the coordinates of a view(Button) in android?
<p>How to determine the coordinates (position ) of a view in android programmatically? I have a button placed in my xml file .How do i determine the coordinates of that button in java code?</p>
android
[4]
3,746,765
3,746,766
which is the best datepicker for birth date?
<p>Which is the easiest to use/select date of birth?</p>
javascript
[3]
1,203,121
1,203,122
Will I suffer if I learn PHP4 compared to PHP5?
<p>I'm a little interested into delving into PHP, and picked up a book from my library to learn more about it. </p> <p>However, the book covers PHP4 (Library doesn't keep up with the times...), and I know PHP5 is the current standard.</p> <p>Will a PHP4 book teach me things that are depreciated, useless, or just plain wrong? Or could I learn sufficiently enough to be able to jump into PHP5 with no problems?</p>
php
[2]
5,344,979
5,344,980
PHP pass by reference/value - question
<p>I was going to explain to our intern the difference between "pass by reference" and "pass by value" in PHP, and did this simple script:</p> <pre><code>$a=5; $b=&amp;$a; $a=8; echo $b; // prints 8 $a=5; $b=$a; //no &amp; $a=8; echo $b; // prints 5 </code></pre> <p>However, running this in php-cli using php -qa yields: </p> <pre><code>php &gt; $a=5; php &gt; $b=&amp;$a; php &gt; $a=8; php &gt; echo $b; 8 php &gt; // prints 8 php &gt; $a=5; php &gt; $b=$a; //no &amp; php &gt; $a=8; php &gt; echo $b; 8 php &gt; // prints 5 </code></pre> <p>Should not the <code>$b=$a;</code> unlink $a and $b?</p> <p>... so I got curius, and tried: </p> <pre><code>php &gt; $b=3; php &gt; echo $a; 3 </code></pre> <p>So, how did I get this wrong? What's going on here? It seems the reference-setting is somehow sticking, even though it should be cleared at the line <code>$b=$a</code>? I also tried: </p> <pre><code>php &gt; $e=5; $f=$e; $e=6; echo $f; 5 </code></pre> <p>...Which works as expected. </p> <p><code>$a</code> and <code>$b</code> seems linked permanently? Am I missing some big point here? How do I "unlink" the <code>$a</code> and <code>$b</code> variable?</p>
php
[2]
2,998,450
2,998,451
Android PUT Request
<p>Can anyone show me how to make a PUT request in Android ? Some sample code for this would be really helpful.</p>
android
[4]
4,696,286
4,696,287
question on arrays in c++
<p>int java declaration of array like this <code>int a[][]=new int[3][3]</code> works but in c++ not why? please help me i have not used c++ a long time so please help me</p>
c++
[6]
5,035,633
5,035,634
Show text while loading images
<p>I'm making a website with a full background slider, so the images are kinda large. I want a script that shows some text with an animation effect while the background images are loading. I already searched for this, but no success. Can someone help me further?</p> <p>Thanks!</p>
jquery
[5]
581,053
581,054
Repetition algorithm problem, Java
<p>Set an algorithm that reads a undetermined number of values to m, all positive ints, one at a time. If m is even, verify how many divisors there is and write that information. If m is odd calculate and write the factored of m.</p> <p>How do I do that? I'm entirely confused by that problem, I need a light on that subject.</p>
java
[1]
4,461,635
4,461,636
contact exists in contacts
<p>I have phone number. Is there any way to check whether the phone number exists in contacts database in the device or not? Depending on that I need have move further in my app. Please suggest or if any one can have sample code snippet please provide.</p> <p>The below is the code I wrote:</p> <pre><code>public boolean contactExists(Activity _activity, String number) { String[] mPhoneNumberProjection = { PhoneLookup._ID, PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME }; Cursor cur = _activity.getContentResolver().query(number, mPhoneNumberProjection, null, null, null); try { if (cur.moveToFirst()) { return true; } } finally { if (cur != null) cur.close(); } return false; }// contactExists </code></pre> <p>Thanks in Advance...</p>
android
[4]
4,760,283
4,760,284
how to pass parameter with tab?
<p>I am so confused, please tell me how to pass parameters with this tab host. I want to pass parameters in first and second tab. Here's my code:</p> <pre><code>public class TabBarActivity_BalanceInquiry extends TabActivity { /** Called when the activity is first created. */ public static String varbalMessageType; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); setTabs() ; varbalMessageType = getIntent().getExtras().getString("mno"); } private void setTabs(){ addTab("payments", R.drawable.tab_home, AgAppAskPinForTransaction.class); addTab("My Account", R.drawable.tab_home, AgAppMyAccountScreen.class); addTab("Spend Analyzer", R.drawable.tab_home, AgAppPaymentScreen.class); addTab("Notification", R.drawable.tab_home, AgAppPaymentScreen.class); addTab("Help", R.drawable.tab_home, AgAppPaymentScreen.class); } private void addTab(String labelId, int drawableId, Class&lt;?&gt; c) { TabHost tabHost = getTabHost(); Intent intent = new Intent(this, c); TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId); View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false); TextView title = (TextView) tabIndicator.findViewById(R.id.title); title.setText(labelId); ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon); icon.setImageResource(drawableId); spec.setIndicator(tabIndicator); spec.setContent(intent); tabHost.addTab(spec); } } </code></pre>
android
[4]
4,082,475
4,082,476
right click jquery
<p>I am trying to create a context menu,when i right click on text box.I did it when i click,i am able to select using mouse but i need it using key up and key down too.</p> <pre><code> $(window).load(function(){ $(document).bind("contextmenu", function(event) { event.preventDefault(); $("&lt;div class='custom-menu'&gt;Custom menu&lt;/div&gt;") .appendTo("body") .css({top: event.pageY + "px", left: event.pageX + "px"}); }).bind("click", function(event) { $("div.custom-menu").hide(); }); }).bind("keyup",function(event) { $("div.custom-menu").hide(); }); }).bind("keydown",function(event) { $("div.custom-menu").hide(); }); }); </code></pre> <p>html</p> <pre><code> input type="text" name="firstbox" id="firstbox" onclick="append()" </code></pre> <p>here that right click works on whole page bcoz i have given body ,how to make that work on text box.</p>
jquery
[5]
591,641
591,642
C++ program halts after dynamic memory allocation
<p>I'm having problem with a copying method in a simple C++ program. Everytime I call copy:</p> <pre><code>Sudoku::SudokuNode** Sudoku::copy(SudokuNode** sudokuBoard) { SudokuNode** tempSudokuBoard = new SudokuNode*[9]; for(int i = 0; i&lt;9; i++) { tempSudokuBoard[i] = new SudokuNode[9]; for(int j = 0; j&lt;9; j++) { tempSudokuBoard[i][j].currentInteger = sudokuBoard[i][j].currentInteger; for(vector&lt;int&gt;::iterator iter = sudokuBoard[i][j].possibleIntegers.begin(); iter!= sudokuBoard[i][j].possibleIntegers.end();) { tempSudokuBoard[i][j].possibleIntegers.push_back(*iter); } } } return tempSudokuBoard; } </code></pre> <p>The program seems to completely halt, not returning a a visible error. </p> <p>If I try to debug the program, the debugger works fine until I arrive at the copy method. Then the debugger displays a dialog box saying:</p> <p>There is no source code available for the current location.</p> <p>Any idea what is wrong?</p>
c++
[6]
4,777,177
4,777,178
How to set custom REQUEST header in PHP
<p>In creating RESPONSE headers, using header() function will do the trick. How about for request headers? </p> <p>Thanks in advance!</p>
php
[2]
5,145,267
5,145,268
Jquery animating child using destination offset with parent set to position relative
<p>I've some serious problems with animating little image from 1 place to another.</p> <p>I get destination offset and try to animate my image towards desired location using offset content as coordinates. But it always ends up incorrect.</p> <p>I understand the problem is position:relative, position:absolute; But I cannot get rid of these becuase of the the layout I've...</p> <p>Is there a better way to calculate coordinates against window?</p> <p>I made simplified fiddle so you can see what I mean...</p> <p><a href="http://jsfiddle.net/9WMGk/1/" rel="nofollow">http://jsfiddle.net/9WMGk/1/</a></p> <pre><code>$("#thirdBA a").on("click", function(){ $("#thirdBA").append('&lt;p class="animated"&gt;This is me&lt;/p&gt;'); var offset = $("#second").offset(); console.dir(offset.left); console.dir(offset.top); $(".animated").animate({left: offset.left, top: offset.top},"slow"); }); </code></pre> <p>When you click link box is appended. And than it must move to "come here" div.</p> <p>Any ideas how to solve my problem?</p>
jquery
[5]
5,178,897
5,178,898
Can I create AlertDialog into AlertDialog in Android
<p>In my application, I want to create AlertDialog into AlertDialog. Is it possible in Android, If yes then how. Thanks.</p>
android
[4]
1,175,433
1,175,434
Distribution of Android application
<p>I'm in the process of researching if and how an entrerprise Windows Mobile .NET application can be ported to Android. The question that I'm into right now is how to distribute and update the application once it's developed.</p> <p>The current .NET application is "installed" on a device using an approperiate system image. The program then updates itself by downloading new updates from a website during usage and installing those updates on the next startup. So now the question is, how is this task best performed with an android application? I've received indication that the company would like to get away from using images so that more devices can be supported, so using images is not a requirement. However, it is an internal enterprise application and as such no external users are to be able to download it, so simply putting it on android market for anyone to download is not an option. Does anybody know if there is an "easy" solution to this problem in the Android world?</p>
android
[4]
1,584,088
1,584,089
Weird string stripping
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6311968/python-rstrip-removes-one-additional-character">python .rstrip removes one additional character</a> </p> </blockquote> <p>i have a string <code>vtype</code> defined as</p> <pre><code>vtype = "vidis.fit" </code></pre> <p>i want to strip the final <code>dis.fit</code> away, so</p> <pre><code>vtype.rstrip("dis.fit") </code></pre> <p>but the end result is <code>v</code>, rather than <code>vi</code>, the one I expected/wanted. I'm a bit confused about this, anyone?</p> <p><strong>EDIT</strong></p> <p>Thanks everyone. I guess the reason why it confused me in the first place is that, the naming of <code>lstrip</code> and <code>rstrip</code> seems suggesting some sequence, although it only matters to white spaces.</p>
python
[7]
4,378,465
4,378,466
Reset a timer in android
<p>I have a timer running in my android application. I want that after user interaction the timer should reset itself? is there any function like reset() that resets the timer? What is the procedure to reset the timer?</p>
android
[4]
1,307,485
1,307,486
Cannot get length in array
<p>I could not even get the alert prompt. What wrong did I done on IE9?</p> <pre><code>&lt;script type="text/javascript"&gt; var countrieslist=document.sc.s1 var subjlist=document.sc.s2 var subj=new Array() subj[0]="" subj[1]=["New York|newyorkvalue", "Los Angeles|loangelesvalue", "Chicago|chicagovalue", "Houston|houstonvalue", "Austin|austinvalue"] subj[2]=["Vancouver|vancouvervalue", "Tonronto|torontovalue", "Montreal|montrealvalue", "Calgary|calgaryvalue"] subj[3]=["London|londonvalue", "Glasgow|glasgowsvalue", "Manchester|manchestervalue", "Edinburgh|edinburghvalue", "Birmingham|birminghamvalue"] function updateSubj(selectsubj) { if (selectsubj&gt;0){ for (i=0; i&lt;subj[selectsubj].length; i++) { alert("ss"); //s2.options[subjlist.options.length]=new Option(subj[selectsubj][i].split("|")[0], subj[selectsubj][i].split("|")[1]) } } } &lt;/script&gt; </code></pre>
javascript
[3]
4,578,216
4,578,217
Python: how to change (last) element of tuple?
<p>The question is a bit misleading, because a tuple is <em>immutable</em>. What I want is: </p> <p>Having a tuple <code>a = (1, 2, 3, 4)</code> get a tuple <code>b</code> that is exactly like <code>a</code> except for the last argument which is, say, twice the last element of <code>a</code>.</p> <p>=> b == (1, 2, 3, 8)</p>
python
[7]
5,549,950
5,549,951
How to escape new line from string
<p>is there any php method to remove new line char from string?</p> <pre><code>$str =" Hi there "; </code></pre> <p>my string contains a new line char between 'Hi' and 'there' i want output as a "Hi there".I don't want to use regular expression.</p>
php
[2]
4,768,171
4,768,172
Android get points of BitMap when I touch on a Image View
<p>When I touch a screen I get the point of screen, My phone is 320 x 240. But I was touching on a ImageView, with a Image with 1024 x 768. How can I get the point of the BitMap? </p> <p>Sorry, Asked me why the reason of this: Because I need to draw a point over a Image using Canvas, this canvas is in a ImageView, there is a way to put this canvas over the screen?</p>
android
[4]
3,099,841
3,099,842
C++ : Assignment and checking for NULL on new/delete
<p>Is the assignment and check for null explicitly required in the below snippet to achieve the same result. Also, is there anything wrong or can be improved here.</p> <pre><code>class Sample { private: char *bits; public: Sample() { bits = NULL; //should this be explicit? } ~Sample() { if (bits != NULL) { delete [] bits; //should this be explicit? } bits = NULL; //should this be explicit? } }; </code></pre>
c++
[6]
1,604,626
1,604,627
hide a div when clicking on the outer container using jQuery
<p>I have 2 divs, one overlayed on top of another. When I click on the outer div, I want to hide the inner div. When I click on the inner div nothing should happen to the inner Div. At the same time, the links in the inner div should work fine. How to do it using jquery?</p> <pre><code>&lt;div class="outer"&gt; &lt;div class="inner"&gt;&lt;/div&gt; &lt;/div&gt; .outer { background-color: #000; position: fixed; top: 0; left: 0; z-index: 9998; height: 100%; width: 100%; opacity: 0.5; } .inner { background-color: blue; width: 240px; position: fixed; z-index: 9999; left: 50%; top: 50%; margin-left: -300px; margin-top: -150px; } </code></pre> <p>jQuery code that doesn't work as expected:</p> <pre><code>$('.outer').click(function(e){ $('.inner').hide(); }); $('.inner').click(function(e){ return false; }); </code></pre>
jquery
[5]
2,508,593
2,508,594
Android: How to save entry to the calendar automaticly
<p>How can i save entry to the calendar automaticly?If i use this source code,it opens Calendar with filled entrys, but i must click on save button to save it.</p> <p>Source code:</p> <pre><code> while (callCur.moveToNext()){ String Number = callCur.getString(callCur.getColumnIndex(android.provider.CallLog.Calls.NUMBER)); Log.d(TAG, "Value of Number: " + Number); intent.setType("vnd.android.cursor.item/event"); intent.putExtra ("title", Number); intent.putExtra ("description", "test2"); intent.putExtra ("eventLocation", "somewhere"); intent.putExtra ("beginTime", System.currentTimeMillis () + 60 * 60 * 1000); intent.putExtra ("endTime", System.currentTimeMillis () + 2 * 60 * 60 * 1000); startActivity(intent); } </code></pre>
android
[4]
5,882,610
5,882,611
Android: Need help setting view alignment in code
<p>I basically want to have several views aligned with each other using a relative layout. I can do so using xml, but unfortunately I can't find any documentation that tells me what methods I need to call to get the same effect in code (All the examples and things just use xml). Since the imageviews are being made dynamically xml isn't an option for what I want to do. I've looked at layoutparameters which seems to let me change some options, but I'm not seeing a method that will let me change alignment relative to another view. Any help is appreciated.</p>
android
[4]
386,678
386,679
Issue with Custom URL scheme and messages app in iOS
<p>I have registered an Custom URL scheme in my application. From server i send an SMS to the phone with the message starting with the custom URL scheme. example myapp://mymessageToApplication</p> <p>When the SMS reaches the inbox, the messages application does not receognize the above message as a link. So, i am unable to click on the message to start by application. This happens everytime i delete the application and reinstall the application. But, when i restart my phone, the messages application recognizes the message as a link and i can click on the link to start my application. After that it all fine until i delete the current application and re-install it again through xCode on my test phone.</p> <p>Does anyone aced similar issue? can anyone suggest me what could be wrong?</p> <p>To add, i can type the message myapp://mymessageToApplication in browser to launch my application. It works always. So, the custom URL is registered fine. Only the messages application is not picking it up until i restart the phone.</p>
iphone
[8]
4,543,188
4,543,189
How can I use Client ID within a server control?
<p>I was able to do the following in a repeater and it works just fine:</p> <pre><code> &lt;asp:TextBox ID="txtOtherPartyName" Text='&lt;%# Eval("Name") %&gt;' runat="server" /&gt; &lt;asp:RequiredFieldValidator ID="reqLoss" ControlToValidate="txtOtherPartyName" data-valmsg-for='&lt;%# Container.FindControl("txtOtherPartyName").ClientID%&gt;' Display="Dynamic" ErrorMessage="Name of party involved is required." runat="server" /&gt; </code></pre> <p>The data-valmsg-for attribute in the required validator rendered the server control id just fine. How can I do the same for a control that sits on a page and is not within a repeater? I tried similar things without any luck.</p> <p><strong>Update</strong></p> <p>So here's what I'm looking to do exactly:</p> <pre><code>&lt;asp:Textbox id="txtTest" runat="server" /&gt; &lt;asp:RequiredFieldValidator id="reqTest" data-valmsg-for=**[i want the html rendered id of "txtTest" here]** runat="server" /&gt; </code></pre>
asp.net
[9]
1,137,491
1,137,492
jQuery .live() and Document ready
<p>I'm trying to set a CSS style using .live(). The CSS function:</p> <pre><code>$(".data tr:odd").addClass("evenrows"); </code></pre> <p>Is there a way for this to happen automatically on document ready but still happen for future elements? I've got an ajax event on the page that re-orders a table. I need these newly created rows to have the .addClass applied to them.</p> <p>Thanks in advance.</p>
jquery
[5]
440,874
440,875
ideal payment gateway return values
<p>I have implemented iDEAL payment gateway. Issuers list is getting properly. user also getting redirected to selected bank also. Issue is what return values I get from iDEAL after successful payments. how should I add data after successful payments ?</p>
php
[2]
4,674,227
4,674,228
Statically link C++ 2010 failed
<p>My goal is to avoid the installation of Microsoft C++ 2010 by statically link it. Because I don't know if that package will be installed on all the customer computers and his IT department doesn't allow the installation of software.</p> <p>One other alternative would be to avoid the use of administrative privilege. (extract dll in the same directory that my program for example)</p> <p>I found one possible solution <a href="http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/ab187afb-3af0-44ba-a03c-dde9e5208a1a/" rel="nofollow">http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/ab187afb-3af0-44ba-a03c-dde9e5208a1a/</a> and I tryied the parameter /MT. </p> <p>I've 2 errors :</p> <blockquote> <p>Erreur 1 error LNK2019: symbole externe non rÚsolu __CrtDbgReportW rÚfÚrencÚ dans la fonction "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z) C:\Users\philippe\Downloads\Portable Devices COM API Sample\C++\libcpmtd.lib(stdthrow.obj) WpdApiSample</p> <p>Erreur 2 error LNK1120: 1 externes non rÚsolus C:\Users\philippe\Downloads\Portable Devices COM API Sample\C++\Debug\WpdApiSample.exe 1 1 WpdApiSample</p> </blockquote> <p>Am I in the good way ? And how can I resolve that problem ?</p>
c++
[6]
5,860,634
5,860,635
I need to replace a C# switch with something more compact
<p>I have the following code:</p> <pre><code>switch (pk.Substring(2, 2)) { case "00": ViewBag.Type = _reference.Get("14", model.Type).Value; break; case "01": ViewBag.Type = _reference.Get("18", model.Type).Value; break; } </code></pre> <p>It does the job but does not look very clean to me. Is there some way I could make this code a bit smaller. I was thinking to just have the number 14 or 18 as a variable but I am not sure the best way to code if I should use if-else or some other way.</p>
c#
[0]
5,576,676
5,576,677
jQuery click event when an element is inside another element
<p>I have a problem with the jQuery click event when an element is inside another element. The code I am using is similar to the following:</p> <pre><code>&lt;div class="a" id="a"&gt; &lt;a class="b" id="b"&gt;&lt;/a&gt; &lt;/div&gt; $(".a,.b").click(function() { var current_id = $(this).attr("id"); alert(current_id); ...do something... }); </code></pre> <p>When I click on the tag class="b" it returns the encapsulated class="a" id instead of the id of class="b". How do I code it so that when I click on class="a" or class="b" it returns the correct corresponding id value?</p>
jquery
[5]
3,146,096
3,146,097
run-time error and program crash
<p>How can I specify a separate function which will be called automatically at Run-Time error to prevent program crash?</p>
c++
[6]
4,631,779
4,631,780
jquery lightbox view slidershow
<p>I have a list of images. I want to show full size images using lightbox. But i dont want lightbox to work on click of those images. I want lightbox to work with click of some other link saying "Start Slide Show".</p>
jquery
[5]
5,949,232
5,949,233
Java regex to split by comma but ignore comma inside comments
<p>I need regex to split the string by Comma(,) but ignore the comma in commented part I tried a lot after changing your regex.It was not succesful eg.</p> <pre><code>Command=RTRV-EQPT, Completion Code= DENY, Error Code= II:AC, Problem Description= /* Input Inva,lid *******ACcess =iden:tifier */, Comment=null, </code></pre>
java
[1]
4,860,881
4,860,882
C++ Vector of class objects
<p>I have a class called Movie with the following private data members:</p> <pre><code>private: string title_ ; string director_ ; Movie_Rating rating_ ; unsigned int year_ ; string url_ ; vector&lt;string&gt; actor_; </code></pre> <p>It also contains the following copy constructor:</p> <pre><code>Movie::Movie(Movie&amp; myMovie) { title_ = myMovie.title_; director_ = myMovie.director_; rating_ = myMovie.rating_; year_ = myMovie.year_; url_ = myMovie.url_; actor_ = myMovie.actor_; } </code></pre> <p>When I try to create a vector of this class,</p> <pre><code>vector&lt;Movie&gt; myMovies; </code></pre> <p>and then accept all the info from a user into a temp <code>Movie</code> object (<code>myMovie1</code>), and then use push back:</p> <pre><code>myMovies.push_back(myMovie1); </code></pre> <p>I get the following error:</p> <pre><code>1&gt;c:\program files (x86)\microsoft visual studio 9.0\vc\include\vector(1233) : error C2558: class 'Movie' : no copy constructor available or copy constructor is declared 'explicit' </code></pre> <p>Where am I going wrong? It seems it wants a copy constructor but I do have one defined.</p>
c++
[6]
489,769
489,770
how to read task manager list using java program
<p>I am trying to read the processes names from different REMOTE machines' task managers list. i.e., A java program that keep polls into different remote machines task lists.</p> <p>Can any one suggest a good solution for this...?</p> <p>Thanks in advance...</p>
java
[1]
400,488
400,489
How to use plain text and variables in the same Println statement (JAVA)
<p>How is it possible? I have tried:</p> <pre><code>System.out.println("Your answer is: " + answer); </code></pre> <p>and</p> <pre><code>System.out.println("Your answer is: ", answer); </code></pre>
java
[1]
4,996,165
4,996,166
Dynamically adding a variable whose name leads with a numeric value
<p>I noticed that if I try to create an object with a key name that leads with a numeric value, an error is thrown (which goes along with JavaScript naming outlined here: <a href="http://stackoverflow.com/q/1661197/360705">Valid Characters for JavaScript Variable Names</a>). However, I noticed that I can still add such a variable name dynamically if I do so </p> <p>Fails:</p> <pre><code>object.1foo = "bar"; </code></pre> <p>Fails:</p> <pre><code>object = { 1foo: "bar" } </code></pre> <p>Succeeds:</p> <pre><code>object["1foo"] = bar; </code></pre> <p>Why is that?</p>
javascript
[3]
4,237,460
4,237,461
Adjusting screen brightness using WindowManager stops working after inactivity
<p>I'm using this code to change an Activity's brightness by dimming it.</p> <pre><code>WindowManager.LayoutParams layoutParameters = getWindow().getAttributes(); layoutParameters.screenBrightness = 0.0075f; getWindow().setAttributes(layoutParameters); </code></pre> <p>I'm also adjusting the android.provider.Settings.System brightness. </p> <p>My problem is, that after ~8 seconds of inactivity, the screen brightness resorts back to normal (i.e. brightens again). Does anyone know why this is happening and how I could change that setting as well?</p> <p>Thanks!</p>
android
[4]
4,093,505
4,093,506
how to generate a voucher code in c#?
<p>I need to generate a voucher code[ 5 to 10 digit] for one time use only. what is the best way to generate and check if been used?</p> <p>edited: I would prefer alpha-numeric characters - amazon like gift voucher codes that must be unique.</p>
c#
[0]
4,658,544
4,658,545
hoare partition code does not work
<p>The following code for partition:</p> <pre><code>#include&lt;iostream&gt; using namespace std; #define maxn 10000 int x[maxn]; void partition(int x[],int p,int r) { int y=x[p]; int i=p-1; int j=r+1; while(i&lt;j){ do { j=j-1; } while( x[j]&gt;y); do { i=i+1; } while(x[j]&lt;y); if (i&lt;j){ int s=x[i]; x[i]=x[j]; x[j]=s; } if (i&gt;=j) break; } } int main(){ int n=12; for (int i=1;i&lt;=n;i++) cin &gt;&gt;x[i]; partition(x,1,n); for (int i=1;i&lt;=n;i++) cout&lt;&lt;x[i]&lt;&lt;" "; return 0; } </code></pre> <p>does not work. It means that. when I enter some numbers and press enter, it does not write anything, neither partitioned array of course. Please help me.</p>
c++
[6]
3,261,460
3,261,461
Weird segmentation fault when calling virtual method, HELP
<p>Here is my code, I casted the buffer to different type of objects, is this what causes the failure? I really want to know why the <strong>FromBase::find2(int key) works, but not FromBase::find(int key)?</strong></p> <pre><code>class Base { public: virtual int find(int key)=0; int keys[4]; }; class FromBase:public Base { public: FromBase(); int find(int key); int find2(int key); }; FromBase::FromBase() { for(int i=0;i&lt;4;i++) keys[i]=-1; } int FromBase::find(int key) { for(int i=0;i&lt;4;i++){ if(keys[i]==key) return i; } return i; }; int FromBase::find2(int key) { for(int i=0;i&lt;4;i++){ if(keys[i]==key) return i; } return i; }; int main() { FromBase frombase; FILE* fptr=fopen("object.dat","w"); fwrite((void*)&amp;frombase,48,1,fptr); fclose(fptr); char object[48]; fptr=fopen("object.dat","r"); fread((void*)object,48,1,fptr); // looks like this works (FromBase*)object-&gt;find2(7); //These two do not work, I got segmentation fault! (FromBase*)object-&gt;find(7); (Base*)object-&gt;find(7); } </code></pre> <p>The reason I want to do this is because I need to read the object from a file, thus I need to cast the buffer to an particular type then I can call the mothod.</p>
c++
[6]
2,093,219
2,093,220
Read double value from a file C#
<p>I have a txt file that the format is:</p> <pre><code>0.32423 1.3453 3.23423 0.12332 3.1231 9.23432432 9.234324234 -1.23432 12.23432 ... </code></pre> <p>Each line has three double value. There are more than 10000 lines in this file. I can use the ReadStream.ReadLine and use the String.Split, then convert it. I want to know is there any faster method to do it.</p> <p>Best Regards,</p>
c#
[0]
4,064,959
4,064,960
can any one tell me what is wrong in my java code
<pre><code>import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.StringTokenizer; public class shift { @SuppressWarnings("unchecked") public static void main(String args[]) { String speech = "Sentence:NounPhrase VerbPhrase:NounPhrase :Art Noun:VerbPhrase : Verb | Adverb Verb: Art : the | a : Verb :jumps | sings |: Noun:dog | cat | "; HashMap&lt;String, String&gt; hashmap = new HashMap&lt;String, String&gt;(); String a; StringTokenizer st = new StringTokenizer(speech,":"); while (st.hasMoreTokens()) { String key=st.nextToken().trim(); String value=st.nextToken().trim(); StringTokenizer st1 = new StringTokenizer(value,"|"); while (st1.hasMoreTokens()) { a=st1.nextToken().trim(); hashmap.put(key, a); } } Set set = hashmap.entrySet(); Iterator ia = set.iterator(); while(ia.hasNext()) { Map.Entry me = (Map.Entry)ia.next(); System.out.println(me.getKey()+"-&gt;"+me.getValue()); } } } the output is Noun-&gt;cat NounPhrase-&gt;Art Noun Art-&gt;a Sentence-&gt;NounPhrase VerbPhrase Verb-&gt;sings VerbPhrase-&gt;Adverb Verb </code></pre> <p>this code is missing some values to return such as the <code>the jumps etc are not show</code></p>
java
[1]
680,976
680,977
rename image during upload not working with Mysql set
<p>I have the bellow code which I was hoping to change/rename image name on upload to user id so I can avoid file overwrite and insert the name into database sadly after I added rename code the code is not able to upload image or update the database we out showing any error but if I remove the rename code everything was working. Can one help me how to solve it or is there any better way I can do it? </p> <pre><code>&lt;?php $user_id = htmlentities($_SESSION['user']['id'], ENT_QUOTES, 'UTF-8'); $username = htmlentities($_SESSION['user']['username'], ENT_QUOTES, 'UTF-8'); require("connection.php"); if(@$_POST ['submit']) { $file = $_FILES ['file']; $name1 = $file ['name']; $type = $file ['type']; $size = $file ['size']; $tmppath = $file ['tmp_name']; if($type == 'jpeg' || $type == 'png' || $type == 'jpg') { $name1 = $user_id.$type; // rename image if($name1!="") { if(move_uploaded_file ($tmppath, 'users/'.$name1)) { $sql=("INSERT INTO USERS set photo='$name1' WHERE username='$username'"); mysql_query ($sql) or die ('could not updated:'.mysql_error()); echo ("Profile picture updated"); } } } } ?&gt; </code></pre>
php
[2]
2,925,718
2,925,719
Pass pointer to structure
<p>i am used to code in ASM and had the need to switch to C++ for some OpenGL project. Anyway i got the following procedure:</p> <pre><code>glGenBuffers(Size, PointerToBuff); </code></pre> <p>According to what i understand the handles according to the Size argument (Number of buffers) will be stored on PointerToBuff. So i wanted to use an structure to save the 2 handles i will get in case i use:</p> <pre><code>glGenBuffers(2, *PointerToBuff); </code></pre> <p>So i create an struct:</p> <pre><code>struct VertexHandlers { GLuint cubevertex; GLuint trianglevertex; }VBHandlers; </code></pre> <p>And use the proc as this:</p> <pre><code>glGenBuffers(2, &amp;VBHandlers); </code></pre> <p>The error i get its:</p> <pre><code>error C2664: 'void (GLsizei,GLuint *)' : cannot convert parameter 2 from 'main::VertexHandlers *' to 'GLuint *' 2&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 2&gt;C:\Documents and Settings\Owner\My Documents\Downloads\OpenGL-tutorial_v0003\playground\playground.cpp(181): error C2664: 'void (GLsizei,GLuint *)' : cannot convert parameter 1 from 'main::VertexHandlers *' to 'GLsizei' 2&gt; There is no context in which this conversion is possible </code></pre> <p>I am not used to "Typecast" barely know something, but when regarding pointers i tought (&amp;) operator will take addr of the local variable created. Hope i get some help, thanks.</p>
c++
[6]
4,569,390
4,569,391
i have to show organization chart for an organization. in ASP.Net
<p>i have to show organization chart for an organization. i have no idea how to do that,, how can i use system.graphics name space to show this chart can anybody help me with this..?? data is basically coming from data base, the whole hierarchy is there in the database i have to show it graphically on organisation.aspx page.!!!</p>
asp.net
[9]
5,905,472
5,905,473
Launching Traceview
<p>Could you explain to nube how to correctly launch the traceview utility. When I write in command line (beeing in \tools folder) <strong>traceview</strong> I get this message:</p> <p><strong>Usage: java com.android.traceview.MainWindow [-r] trace</strong></p> <p><strong>-r regression only</strong></p> <p>So then I write this Usage string in command line and get ClassNotFoundException. I tried to wrote classname of file I want to explore in traceview using it's package name and it's classname at the end, but get the same exception.</p> <p>Tell me please what am I doing wrong?</p>
android
[4]
341,882
341,883
php to pdf or php to jpeg library or function?
<p>I have trying to achieve like this. I have one page which is written with php. There will be one button, which i click that button, that page will be converted to imageformat or pdf. Which function can i use? Is there any built it ? Which one will be more easier ? Creating imageformat or pdf? Please kindly point me out. Thanks.</p> <p>With Regards,</p>
php
[2]
5,086,990
5,086,991
Territories in a C++ Risk Clone
<p>For fun, I've been programming a Risk clone in C++ and I need some help with the territories/Continents part of it. Setting them up so that they know what territories are adjacent to them, what Continent it is apart of, who currently controls it and of course the amount of armies currently in it. </p> <p>Likewise, the Continent needs to know all the territories that are in it, so a player who controls the whole Continent gets corresponding reinforcement bonus for that Continent. </p> <p>Currently, I think a using <code>std::set</code> may be the best choice, but I need some suggestions on how to set it up.</p>
c++
[6]
6,019,071
6,019,072
Error When running asp.net Application in IIS
<p>I have an application in asp.net.I configured it in IIS.When i running this application in IIS i getting an error;</p> <pre><code>Server "/" error: Resource Cannot be Found Error:404 </code></pre> <p>Some of pages only produce this issues.Other forms are working perfectly.Without running application in IIS Its working perfectly. If any one can answer plz send the answer immediatly. Thank you</p>
asp.net
[9]
4,585,174
4,585,175
retrieving values in array & store in session and calling to other page asp.net c#
<p>Hi I want to store values inside the array in session. I want to use it to another page. How i can do that? I used session to store values of array as follow:</p> <pre><code> int i, randno; int[] a = new int[5]; for ( i = 0; i &lt; 4; i++) { int flag = 0; Random rnd = new Random(); randno = rnd.Next(1, 15); for (int j = 0; j &lt; i; j++) { if (a[j] == randno) flag = 1; } if (flag == 0) { a[i] = randno; } else { i--; } } Session["values"] = a; </code></pre> <p>In other page i used code: </p> <pre><code>int[] a = (int[])Session["values"]; Response.Write(a); </code></pre> <p>This code is right? Because its not giving values. But retrieving to another page then it gives last value of the array, on the same page it gives all the values. I want all the values of the array. Asp.net, c# Thank you. </p>
asp.net
[9]
1,037,817
1,037,818
Can i set up record types and arrays of record types PHP?
<p>In pascal and delphi I am able to set up a custom type such as </p> <pre><code>myrecord = type name : string; number: integer; end; </code></pre> <p>The advantage of this I can then do an array of that type so I can run code like records[i].name = ... ECT. Can I do this in PHP?</p>
php
[2]
4,428,045
4,428,046
Trim line breaks from a string in Javascript without frameworks
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript">How do I trim a string in javascript?</a> </p> </blockquote> <p>While I solved the issue I was experiencing when I was looking for a solution a few moments ago I was not able to find anything that actually worked. This is mostly intended to be an easy-to-find question/answer for others to find as I am surprised by the lack of the absence any on-topic pages on the WWW in general.</p> <p>So <strong><em>using JavaScript without any frameworks how would you trim line breaks</em></strong>? Trim as being defined by PHP, removing the leading and ending line breaks while preserving line breaks after the first non-white-space character and until though not beyond the last non-white-space character.</p> <p>By default most people will want to know how to <strong><em>remove both leading/ending line breaks as well as white-space spaces too</em></strong> though some may want to retain the white-space spaces while trimming just the white-space line-breaks. It also generally helps to see two working examples and how they relate when they both work for people learning code so I'll accept the answer for trimming both white-space line-breaks <em>and</em> white-space spaces while voting up how to trim just the leading/ending line breaks while preserving white-space spaces (which may or may not be included in the main answer).</p>
javascript
[3]
5,991,712
5,991,713
Droid4me app development framework
<p>Can anyone please suggest me some documentation and programming examples using Droid4me application development framework? </p> <p>Thanks in advance,</p> <p>Tim</p>
android
[4]
733,970
733,971
Many submit button for one form
<p>I have this code: <a href="http://jsfiddle.net/xFvrV/2/" rel="nofollow">http://jsfiddle.net/xFvrV/2/</a></p> <pre><code>&lt;form id="formTest" action="#" method="post"&gt; &lt;input type="text" id="textTest"/&gt;&lt;br&gt; &lt;input id="submitButtonDraft" type="submit" value="Save Draft" /&gt;&lt;br&gt; &lt;input id="submitButton" type="submit" value="Save" /&gt; &lt;/form&gt; $(document).ready(function () { $("#formTest").submit(function (e) { e.preventDefault(); alert('toto'); }); }); </code></pre> <p>How to know which button submit the form? and display it in the <strong>alert()</strong></p> <p>Thank you</p>
jquery
[5]