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
543,113
543,114
How can close the tab when open the new tab in same browser?
<p>I have opened a website in a browser tab. Now, when I open a new tab from this website, I want to close the first tab in that browser.</p>
javascript
[3]
5,653,099
5,653,100
clearInterval not working as expected
<p>I have the following bit of code which is used to rattle divs. </p> <p>I use clearInterval to stop the rattling but it doesn't appear to work.</p> <p>Any idea why please?</p> <pre><code>squares = $('.' + square_class); var rattle; rattle = setInterval(function() { squares.delay(2000).effect('shake', { times:4, distance: 5 }, 100); }, 2000); clearInterval(rattle); </code></pre>
jquery
[5]
1,229,719
1,229,720
Why am i getting 403 error reading a website url on java?
<p>I'm trying to read <a href="http://www.meuhumor.com.br/" rel="nofollow">http://www.meuhumor.com.br/</a> on java using this:</p> <pre><code>URL url; HttpURLConnection connection = null; try{ url = new URL(targetURL); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Language", "en-US"); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); DataOutputStream dataout = new DataOutputStream(connection.getOutputStream()); dataout.flush(); dataout.close(); InputStream is = connection.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line; StringBuffer response = new StringBuffer(); while((line = br.readLine()) != null){ response.append(line); response.append('\n'); } br.close(); String html = response.toString(); </code></pre> <p>I can access the website using any browser, but when i try to get the html with Java im getting java.io.IOException: Server returned HTTP response code: 403 for URL:</p> <p>Someone know a way to get the html?</p>
java
[1]
2,820,714
2,820,715
Android Resource leak try
<p>Below are my codes, I'm having this weird warning: <code>Resource leak: 'br' is never closed</code> . Could anyone help me with this warning. I do not want my app to crash or cause any problems in the future.</p> <pre><code>File sdcard = Environment.getExternalStorageDirectory(); File file = new File(sdcard,"/St/"+ textToPass); StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { text.append(line); text.append('\n'); } }catch (IOException e) { Toast.makeText(getApplicationContext(),"Error reading file!",Toast.LENGTH_LONG).show(); e.printStackTrace(); } TextView output=(TextView) findViewById(R.id.st); // Assuming that 'output' is the id of your TextView output.setText(text); </code></pre>
android
[4]
4,309,684
4,309,685
Asp.net Membership Logged in Users list
<p>I used following in my application to find the list of logged in user. It gives the list of logged in user but when i close the browser and clear the browser history, it shows the user isonline status true. Please can any one tell me where i am wrong?</p> <p><strong>When User signIn am validating user and redirect to url,</strong></p> <pre><code>if (user != null) { if (Membership.ValidateUser(user.UserName, txtUserPassword.Text)) { FormsAuthentication.SetAuthCookie(txtUserName.Text, false); } } </code></pre> <p><strong>List of logged in user code</strong></p> <pre><code> MembershipUserCollection allUsers = Membership.GetAllUsers(); MembershipUserCollection filteredUsers = new MembershipUserCollection(); bool isOnline = true; foreach (MembershipUser user in allUsers) { // if user is currently online, add to gridview list if (user.IsOnline == isOnline) { filteredUsers.Add(user); } } </code></pre>
asp.net
[9]
956,446
956,447
i have to search the string from html files using c# in asp.net, how to get the string from html file
<p>i have to search the string from html files using c# in asp.net, how to get the string from html file? this is the code im having </p> <pre><code> private string getHtml(string key) { StreamReader f = new StreamReader("path"); string htmlTag = key; string str = f.ReadToEnd().ToString(); Match m = Regex.Match(str, "&lt;" + htmlTag + "&gt;" + "(.*)" + "&lt;/" + htmlTag + "&gt;", RegexOptions.Singleline); Console.WriteLine(m.Groups[0]); return str; } </code></pre> <p>Thanks, vasmay</p>
asp.net
[9]
297,787
297,788
Android ListView Item Colour and Scrolling issue
<p>I have a messaging application that displays a list of received messages however I want to highlight the messages that have NOT been read with a colour(Yellow) whereas the other list items remain the default list item colour (White).</p> <p>I have managed to do this using the code below however whenever I scroll the list then all of the list items regardless of whether they have been read or not will then be the "highlight" colour when they scroll out of view and then back into view.</p> <p>My list selector:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_selected="true" android:drawable="@android:color/transparent" /&gt; &lt;item android:state_pressed="true" android:drawable="@android:color/transparent" /&gt; &lt;item android:state_selected="false" android:drawable="@drawable/messageUnreadColour" /&gt; </code></pre> <p></p> <p>My code behind in my array adapter that applies the setting:</p> <pre><code>@Override public View getView(int position, View convertView, ViewGroup parent) { Message_ListItem entry = items.get(position); ....setup list item etc // Get whether the message has been read if (!entry.getHasBeenRead()) { // Set the colour to highlight the listitem convertView.setBackgroundResource(R.drawable.message_listitem_unread); } return convertView; } </code></pre> <p>I have already removed the cacheColorHint setting on the list to see if this helps, but this has no effect.</p> <p>Is there any way I can solve this?</p>
android
[4]
2,369,972
2,369,973
Comparing values in two strings
<p>I'm trying to compare two strings with one another. One contains for example :</p> <pre><code>String x =" aa bb cc dd ee " </code></pre> <p>and the other one :</p> <pre><code>String y =" aa bb " </code></pre> <p>Now I want to do this </p> <pre><code>if (any values from String x EXISTS IN String y) if (y.matches(???)){System.out.println("true");} else{System.out.println("false");} </code></pre> <p>I know that I can to do the opposite by using regex, like this :</p> <pre><code>if (x.matches(".*"+y+".*")){do something} </code></pre> <p>But I'd like to know if there is any way to check if any value in String x matches String y.</p>
java
[1]
1,707,171
1,707,172
How to edit path in a Windows link file
<p>I want to edit the path in a link file which leeds to a file or folder which changes it's path quite often. I found some things in C or other languages but never for C#. </p> <p>Test.lnk -> <code>C:\TestFolder 1.2.3\</code><br> I want to change that link using C# to<br> Test.lnk -> <code>C:\TestFolder 1.2.4\</code></p> <p>Does anyone know how to do so?</p>
c#
[0]
3,110,438
3,110,439
C++: Correct use of stream operations
<p>I am trying to learn to use the file stream correctly. The following is a snippet of code that I am maintaining. It works fine, but I was wondering whether the usage is correct and whether there are better ways to perform these tasks. For example, the use of SEEK_SET and ios::beg together. Also, is ios::ate really needed given that the next seek is to the beginning of file.</p> <p>Could you please help me correct(streamline) the code.</p> <pre><code>ofstream fout(fpath,ios::out| ios::binary | ios::ate); fout.seekp(SEEK_SET,ios::beg); fout.write((char*)&amp;test,sizeof(test)); fout.seekp(sizeof(off_t),ios::beg); fout.write((char*)&amp;temp,sizeof(temp)); //temp is int fout.seekp((sizeof(off_t)+ sizeof(int)),ios::beg); fout.write((char*)o,sizeof(MyClass)); fout.seekp((sizeof(off_t)+ sizeof(int) + sizeof(MyClass)),ios::beg); fout.write((char*)&amp;l,sizeof(int)); fout.close(); </code></pre>
c++
[6]
2,991,651
2,991,652
How to find an object from a List of objects?
<p>I got a list of columns in the variable ParentColumnNames, i need to find a single Column object within this list using the selectedvalue of another combobox. How can i get that? Please help...</p> <pre><code>List&lt;Columns&gt; ParentColumnNames = new List&lt;Columns&gt;(); ParentColumnNames = metadataobj.GetColumns(cbParentTable.SelectedItem.ToString()); </code></pre> <p>within this i need to find single object using cbParentColumn.SelectedValue.</p>
c#
[0]
2,128,135
2,128,136
jquery submit on change with a twist
<p>I have a form with a single select_field that gets submitted via jquery whenever the select field is changed.I use something like this:</p> <pre><code>$('#scope').change(function() { this.form.submit(); }); </code></pre> <p>Where scope is the ID of the select_field. This works as expected. </p> <p>We want to change the view slightly where the select field is hidden until the user clicks a link => then it pops up and you can select as before.</p> <p><strong>The problem:</strong><br> When the user clicks the link to show the select field. It also instantly triggers the change event somehow (even though the value of the select field has not changed). </p> <p>Any easy way around this that I am overlooking?</p> <p>Thanks for your time,<br> Erwin</p>
jquery
[5]
157,063
157,064
JavaScript - How to load external script NON-asynchronously?
<p>I'm looking for code that allows me to use JavaScript to load another JavaScript file NON-asynchronously. I tried this:</p> <pre><code>var script=document.createElement('script'); script.setAttribute("type","text/javascript"); script.setAttribute("src", "jquery.min.js"); document.getElementsByTagName("head")[0].appendChild(script); $("div.whatever").css("color","red"); </code></pre> <p>But that doesn't work. It inserts the script node okay, but it continues to run the rest of the script before jQuery loads. This ends up failing because the jQuery code tries to run when <code>$</code> isn't defined by jQuery yet.</p> <p>Is there a way to load that script non-async using native JS?</p>
javascript
[3]
2,094,619
2,094,620
Difference in if()?
<p>I'm learning C++ and I encountered 2 different types of writing a piece of code, and I wanted to know what the difference is.</p> <p>Is there any difference between:</p> <pre><code> if(z==true) { cout &lt;&lt; "Yes"; } else { cout &lt;&lt; "NO"; } </code></pre> <p>and:</p> <pre><code> if(z==true) cout &lt;&lt; "YES"; else cout &lt;&lt; "NO"; </code></pre>
c++
[6]
2,761,073
2,761,074
Prevent time/memory intensive php script from crashing/slowing continuously
<p>I have a php script that exports out results in excel using PHPExcel plugin. Now since the result has around 40 columns and above 15k+ rows, it seems to be taking a lot of time, which isnt a problem for me.</p> <p>However what I find is that the apache server(of my WAMPserver installation) keeps crashing after certain intervals and it also slows down my machine (the script runs local to my machine).</p> <p>There are 2 things I need help here 1) Stop apache server from crashing down 2) prevent PC from slowing down</p> <p>I have set_time_limit(0);ini_set('memory_limit', '-1'); in my code so I have removed the restriction of the script timing out and also the memory limit imposed.</p> <p>Time to export is not a factor for me...If it takes 20 mins+ to export out the result in excel also, it should be fine (though i would prefer if there is a faster alternative ;) ). Just that the script should execute without slowing my machine (so I can multitask) and apache shouldnt keep crashing</p>
php
[2]
5,883,131
5,883,132
Android expanded list item
<p>How to change the color of groupItem in ExpandableListView when it is expanded? And change to white color when it is not expanded?</p>
android
[4]
4,459,906
4,459,907
Is there an alternative to .load() in jQuery?
<p>Is there an alternative to .load() in jQuery?</p>
jquery
[5]
2,714,282
2,714,283
Learning PHP from beginner to advanced
<p>I've dabbled with PHP for a few years now and I'm capable of most of the basic things, building login forms etc but from my time on here I've noticed there's so much more I need to learn, like best practices, security issues etc and so I want to learn everything from the very basics. </p> <p>In the past I've used forums and browsed the web for snippets of code only I think this has led to my bad practices, can anybody recommend books or Valid, recommended learning sources?</p> <p>Thanks in advance! </p>
php
[2]
716,492
716,493
Reg: Counter Variable in Thread
<p>I have a requirement that should assign a counter variable for each thread that gets invoked. But I am not getting the expected results, actually the counter is duplicating in the threads. I created a dummy table and a proc to insert the counter value into the table. Is there anyway that the code can be changed so that the thread gets an incremented value.</p> <p>In the below code, the variable <code>counter</code> is a <code>static int</code> </p> <pre><code>public synchronized int testSequence(){ System.out.println("testSequence::::: "+counter++); //Random rn = new Random(); CallableStatement cstmt; { try { cstmt = conn.prepareCall("{call insertjtest(?)}"); cstmt.setInt(1,counter); //cstmt.setInt(1, rn.nextInt()); cstmt.execute(); cstmt.close(); conn.commit(); return counter; } catch (SQLException e) { // TODO Auto-generated catch block return 0; } } } </code></pre> <p>But I find the </p>
java
[1]
4,736,316
4,736,317
getSettings().setLoadWithOverviewMode(true) undefined method
<p>I have something like this in my code</p> <pre><code>WebView ourweb; //some code here ourweb = (WebView) findViewById(R.id.webview); ourweb.getSettings().setJavaScriptEnabled(true); ourweb.getSettings().setLoadWithOverviewMode(true); ourweb.getSettings().setUseWideViewPort(true); ourweb.getSettings().setBuiltInZoomControls(true); ourweb.setWebViewClient(new ourView()); ourweb.loadUrl("http://google.pt"); </code></pre> <p>but my ecplise is saying :</p> <blockquote> <p>The method setLoadWithOverviewMode(boolean) is undefined for the type Websettings</p> </blockquote> <p>I remembered 5 months ago, this code would compile with success. What i'm missing?</p>
android
[4]
4,834,195
4,834,196
writing python script on windows
<p>I am new to python scripts .</p> <p>I have few repetative testing tasks such logging to various IM's </p> <p>ex (OCS,different public messengers) etc . </p> <p>Is it possible to automate these tasks using python .</p> <p>If so from where do I start with ? </p> <p>Working on windows 2003 server . </p> <p>I know the basics of python. want to enhance the skills .</p> <p>Thanks, Tazim</p>
python
[7]
4,370,134
4,370,135
how to not allow old browser user view my page?
<p>I want to check if user's browser support query, if it don't the webpage will not show and just show a sentence say your browser can't view the page. but without Jquery , I don't know much about original javascript how to do <code>#('body').html('u cant view the page');</code> something like that.</p>
javascript
[3]
4,991,229
4,991,230
100K curl requests
<p>I am using curl_multi_exec to process over 100K requests. I do 100 requests at a time because curl_multi_exec can only handle 100 requests at a time to eventually get to 100K requests. We have added multiple servers to this system to spread the load [we are using load balancing]. What is the best way to have curl handle 100K requests and make use of these additional servers? What is the downside (other than time) of handling that many requests on one server? How can I use the additional servers to help handle those requests?</p> <p>I was thinking about having each server handle a batch of requests (like one server handles 500 requests, another 500, another 500, etc.. </p> <p>To elaborate- basically, we are using curl to send out over 100K requests to third party servers. The problem with only using 1 server is that there is a memory limit in the number of requests 1 server can handle. So we decided to add additional servers, but we are not sure how to design this system to use curl to handle that many requests..</p> <p>The third party server is an API like Facebook; they are aware that we will be making that many requests to their servers.</p> <p>For load balancing, we use Rackspace cloud server, basically the load balancer directs incoming requests to separate servers. </p>
php
[2]
1,515,647
1,515,648
Strategy to auto-generate PHP code?
<p>I'm developing a framework which programs parts of itself dynamically after creating ER-Diagrams in the backend. As a PHP newbie I wonder if there's anything much fancier than just opening a plain xyz.php text file and then adding the dynamically generated code to that file?</p>
php
[2]
5,672,014
5,672,015
How to copy a file in filesystem?
<p>I would like to know the best way to copy a file in the filesystem? (android java function )</p> <p>(sdcard/video/test.3gp -----> sdcard/video_bis/test2.3gp)</p> <p>Is there an example somewhere? </p> <p>Regards</p>
android
[4]
168,027
168,028
Add item to menu wich pops up when i click on contact
<p>So, is there a way i can select contact in Androids default contact list and import that contact to my Android aplication?</p> <p>I have looked trough <a href="http://stackoverflow.com/questions/2833270/how-to-add-button-or-menu-in-contacts-list">How to add button or menu in contact list</a> and <a href="http://stackoverflow.com/questions/4992564/open-device-contacts-list-at-button-click-event">Open device contact list</a> the question is: How to get the data to my app? Or how to add menu item(My app) in the menu which pops up when i click on the contact.</p> <p>I would be pleased if you could tell me how to do this or at least point me in the right direction.</p>
android
[4]
5,400,935
5,400,936
I have a list of integers , how to sort it?
<p>Have a list of integers like</p> <pre><code>List&lt;Integer&gt; l = new ArrayList&lt;Integer&gt;(); </code></pre> <p>I think calling <code>l.contains</code> is slow, how to sort the list. After sorting, will <code>l.contains</code> behave faster?</p> <p>Is there any sortedList I can use directly?</p>
java
[1]
2,696,764
2,696,765
JavaScript closure problem please explain
<p>This is a function taken from Pro JavaScript techniques that I'm trying to understand, but don't. The purpose of the function is to slowly reveal a hidden element by increasing its height over a matter of one second. The comments in the code are provided by the author of the book. I don't understand anything starting from where the author says in a comment "a closure to make sure we have the right 'i'. </p> <p>Could you please explain in as much detail as possible</p> <p>a) how does this closure work in this function. I.e. how does it make sure that it has the right 'i' and what in the code makes that important.</p> <p>b) why is there a comma near the end of the program after elem in the code <code>elem,.style.height</code></p> <p>c) what is the purpose of this part of the code ( pos + 1) * 10). How does it work with the setTimeout function?</p> <pre><code>function slideDown(elem) { //start the slide down at 0 elem.style.height = '0px'; //Show the element, but can`t see it because height is 0 show(elem); //find the full potential height of the element var h = fullHeight(elem); //We`re going to do a 20 frame animation that takes place over one second for (var i = 0; i &lt;= 100; i +=5 ) { //a closure to make sure that we have the right 'i' (function() { var pos = i; //set the timeout to occur at the specified time in the future setTimeout(function() { //set the new height of the element elem,.style.height = (pos/100) * h) + "px"; }, ( pos + 1) * 10); })(); } } </code></pre>
javascript
[3]
4,836,121
4,836,122
Txt file input error Java
<p>I'm getting the error </p> <pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: "scores.txt" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222) at java.lang.Double.parseDouble(Double.java:510) at ExamAverage.main(ExamAverage.java:30) C:\Users\Peter\AppData\Local\Temp\codecomp5461808896109186034.xml:312: Java returned: 1 </code></pre> <p>for my code listed below what does this error mean? I'm trying to go line by line from a given text file path and output it in a certain format.</p> <pre><code> import java.io.FileReader; import java.io.FileNotFoundException; import java.util.Scanner; import java.io.PrintWriter; public class ExamAverage { public static void main(String[] args) throws FileNotFoundException { String inputFileName = "scores.txt"; String outputFileName = "examScoreAverage.txt"; Scanner console = new Scanner(System.in); Scanner in = new Scanner(inputFileName); PrintWriter out = new PrintWriter(outputFileName); int TestNumber = 1; double totalPoints = 0; double avg = 0; double test = 0; while (in.hasNextLine()) { String line = in.nextLine(); test = Double.parseDouble(line); out.println("Score" + TestNumber + " : " + test); totalPoints += test; TestNumber++; } avg = totalPoints/TestNumber; out.println("Number of scores read: " + TestNumber ); out.println("Average Score " + avg ); in.close(); out.close(); </code></pre> <p>} }</p>
java
[1]
171,051
171,052
PHP Cannot Write to File - 777 Permissions!
<p>Help! PHP cannot write to any files in my web directory. I don't know why! I have the permissions of the file set to 777, but it is not working! Here is the code in question:</p> <pre><code>&lt;?php if ($f=fopen('test.txt', 'a')) echo 'file opened'; fclose($f); </code></pre> <p>Nothing is being echoed! I don't know why :(.. the userid and gid is 0:0 from the script, and if I try to chown to that it doesn't work.</p> <p>Please help I need this fixed asap this should be an easy thing to do but the damn server is being difficult.</p> <p>And its running on Cent OS if thats any help..</p>
php
[2]
322,970
322,971
Hover and mouse over simultaneous jquery effects
<p>I have a button with a hover effect:</p> <pre><code>$('.donations').hover(function() { $(this).find('#donate_expand_top').hide().stop(true, true).animate({ height: 'toggle' }, { duration: 200 }); </code></pre> <p>I now need to add a click effect on the same button so that it's touch-friendly. I understand the concept easy enough using <code>$('.donations').click(function(){...</code> but the problem is in combining these two effects it doesn't work correctly. As soon as I click on the button, i'm also hovering, so it tries to fire both and neither works. </p> <p>Is there an easy solution to this?</p>
jquery
[5]
4,199,194
4,199,195
android developer training errors in sample code for network connection
<p>I am going through the android developer training material here - <a href="http://developer.android.com/training/basics/network-ops/index.html" rel="nofollow">http://developer.android.com/training/basics/network-ops/index.html</a>. I downloaded the sample code NetworkUsage.zip and imported it to eclipse. The code has error in SettingsActivity.java when I open it, "The method onSharedPreferenceChanged(SharedPreferences, String) of type SettingsActivity must override a superclass method".</p> <p>As far as I can see it is correctly defining the method and implementing the interface, why is there an error? From the android api I can see that this interface still exists and has not be deprecated or anything.</p> <p>Thanks!</p>
android
[4]
2,099,475
2,099,476
Use MergeSort to process user input
<p>I want to sort an input(from command line arguments) set of numbers, been stucking here for 3days without finding the error of my codes...really desperate...</p> <p>Will anyone please give me a hint?</p> <pre><code>import java.util.Arrays; public class MergeSorter { public MergeSorter(int[] anArray) { a = anArray; } public void sort() { if (a.length &lt;= 1) return; int[] first = new int[a.length / 2]; int[] second = new int[a.length - first.length]; System.arraycopy(a, 0, first, 0, first.length); System.arraycopy(a, first.length, second, 0, second.length); MergeSorter firstSorter = new MergeSorter(first); MergeSorter secondSorter = new MergeSorter(second); firstSorter.sort(); secondSorter.sort(); merge(first, second); } private void merge(int[] first, int[] second) { int iFirst = 0; int iSecond = 0; int j = 0; while (iFirst &lt; first.length &amp;&amp; iSecond &lt; second.length) { if (first[iFirst] &lt; second[iSecond]) { a[j] = first[iFirst]; iFirst++; } else { a[j] = second[iSecond]; iSecond++; } j++; } System.arraycopy(first, iFirst, a, j, first.length - iFirst); System.arraycopy(second, iSecond, a, j, second.length - iSecond); } private int[] a; public static void main(String[] args) { int[] a = new int[args.length]; for (int i = 0; i &lt; args.length; i++) { a[i] = Integer.parseInt(args[i]); } MergeSorter sorter = new MergeSorter(a); sorter.sort(); System.out.println(Arrays.toString(a)); } } </code></pre>
java
[1]
4,475,640
4,475,641
Connecting Android Application with any Database
<p>How would i go on connecting my Android application with my local database?</p>
android
[4]
579,185
579,186
jquery .click being called multiple times
<p>I am getting unexpected results with jQuery trying to set the "click" method of a div. Please see <a href="http://jsfiddle.net/fkMf9/" rel="nofollow">this jsfiddle</a>. Be sure to open the console window. Click the word a few times and watch the console output. The click function gets called multiple times when it should only be called once.</p> <p>The commented out code at the end works just fine. Am I doing something wrong? I'm new to jQuery.</p> <p>Here's the code:</p> <pre><code>function toggleDiv(status) { console.log("toggleDiv(" + status + ")"); if (status) { $("#test").html("Goodbye"); } else { $("#test").html("Hello"); } $("#test").click(function() { toggleDiv(!status); }); // Non-jquery method works fine.... //document.getElementById("test").onclick = function () { // toggleDiv(!status); //} }​ </code></pre> <p>Update: looks like there are lots of ways to skin this cat. The real issue here was my not understanding that the jQuery "click" functions ADDS another handler. I thought it REPLACED the current handler.</p>
jquery
[5]
837,739
837,740
$_GET php setting gets and calling functions
<p>can any one explain me about $_GET? give any tutorial on it, on functional approach or GET calling functions ?</p>
php
[2]
5,168,792
5,168,793
which method gets control when you do a search and don't specify android:launchMode="singleTop"
<p>I am invoking a standard search, with the Activity that invokes the search being the same as the activity that processes the search (the 'searchable activity'). If I include android:launchMode="singleTop" in the Activity definition, the search invokes the Activity's onNewIntent method and I pick up the search parm specified: no problem. If you don't specify android:launchMode, or specify a different value for launchMode, which method of the Activity gets invokes, or do you always specify android:launchMode="singleTop" in the searchable activity definition in the Manifest file? Here's what I have specified:</p> <p> </p> <p>/res/xml/searchable.xml: </p>
android
[4]
5,317,995
5,317,996
StartInfo.Arguments in c#
<p>I found the following snippet of the code:</p> <p>using System; using System.Diagnostics;</p> <pre><code>public class RedirectingProcessOutput { public static void Main() { Process p = new Process(); p.StartInfo.FileName = "cmd.exe"; p.StartInfo.Arguments = "/c dir *.cs"; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); Console.WriteLine("Output:"); Console.WriteLine(output); } } </code></pre> <p>but I can't figure out what this <code>p.StartInfo.Arguments = "/c dir *.cs";</code> is doing? thanks in advance for any explanation</p>
c#
[0]
1,400,569
1,400,570
tracking completion status in loop
<p>In this loop, the output i am expecting is a '.' to be printed after each url in the tuples list gets downloaded . The idea is a sort of progress bar to tell me that the script hasn't crashed or anything. But while running, all the '.'s are getting printed together after all the files have been downloaded. why?</p> <pre><code>for tuple in tuples: urllib.urlretrieve(tuple[0],'/media/aux1/pythonary/getxkcd_files/strip'+str(number)) print'.', hypertext='&lt;h2&gt;'+tuple[2]+' xkcd no.-'+str(number)+'&lt;/h2&gt;&lt;p&gt;&lt;img src="getxkcd_files/strip'+str(number)+'" title="'+tuple[1]+'"/&gt;&lt;/p&gt;' f.write(hypertext) number+=1 </code></pre>
python
[7]
1,080,860
1,080,861
is it possible to create support multiple screen size in android 3.1 using support library for devices
<p>is it possible to create support multiple screen size in android 3.1 using support library for devices .I have created four layout layout-large layout-small layout-xlarge layout-xlarge design is not coming properly in some device .I have used dp in my layout</p> <p>Thanks</p>
android
[4]
334,219
334,220
Parse table into array
<p>i have this table:</p> <pre><code>List&lt;string&gt; Total HTTP Packets 727 0.004459 HTTP Request Packets 372 0.002281 51.17% GET 372 0.002281 100.00% HTTP Response Packets 353 0.002165 48.56% ???: broken 0 0.000000 0.00% 1xx: Informational 0 0.000000 0.00% 2xx: Success 337 0.002067 95.47% 200 OK 331 0.002030 98.22 204 No Content 5 0.000031 1.48 206 Partial Content 1 0.000006 0.30 3xx: Redirection 10 0.000061 2.83% 302 Found 3 0.000018 30.00 304 Not Modified 7 0.000043 70.00 4xx: Client Error 6 0.000037 1.70% 408 Request Time-out 6 0.000037 100.00 5xx: Server Error 0 0.000000 0.00% Other HTTP Packets 2 0.000012 0.28% </code></pre> <p>i want to parse this table into array (each line into 4 parts) but my problem is the first column because the string length changed. i tty to split each line with Tab but unfortunately i did dot contain Tabs. what is the best way to do it ?</p>
c#
[0]
46,618
46,619
Accessing object's properties in an array
<pre><code>for(i=0;i&lt;=rowData.length;i++){ alert(rowData[i].title); } </code></pre> <p>i have a some five objects in an array. those objects have title, but when i try to access them, it says <code>cannot read property title from sundefined</code>.</p> <p>How can i differentiate these objects, when i don't have the index or the name of object.</p> <p>Let's take <code>rowData = [object,object,object];</code></p> <p>Now i want to access a specified object, but how can i know that this object is what i am looking for.</p>
javascript
[3]
2,748,022
2,748,023
The return value should be a list but doesn't return as expected?! - Python newbie
<p>This must be a very simple solution that has eluded me this last hour. I've tried to build this test function where the return value of the test_cases list should match the values in the test_case_answers list but for some reason, test case 1 and test case 2 fail. When I print the return values for the test cases they return the correct answers, but for some reason test case 1 and test case 2 return False. </p> <pre><code>import math test_cases = [1, 9, -3] test_case_answers = [1, 3, 0] def custom_sqrt(num): for i in range(len(test_cases)): if test_cases[i] &gt;= 0: return math.sqrt(test_cases[i]) else: return 0 for i in range(len(test_cases)): if custom_sqrt(test_cases[i]) != test_case_answers[i]: print "Test Case #", i, "failed!" custom_sqrt(test_cases) </code></pre>
python
[7]
5,133,182
5,133,183
Asp.Net inline coding
<pre><code>&lt;% int i = Eval("NAME").ToString().IndexOf("."); string str = Eval("NAME").ToString().Substring(i + 1); %&gt; &lt;img src="../images/img_&lt;%= str %&gt;.gif" alt="" /&gt; </code></pre> <p>EVAL("test.txt")</p> <p>I need "txt" how to make ?</p>
asp.net
[9]
5,627,584
5,627,585
getting xml child in javascript
<p>I'm trying to get to to the items child in XML using javascript. </p> <p>The rss file is: Can i use dot syntax? item.title? I'mg etting undefined in the code below</p> <p><code>&lt;item&gt; &lt;title&gt;&lt;link&gt;</code> </p> <blockquote> <p>$(document).ready(function(){ alert = console.log; </p> <pre><code> var ns = { </code></pre> </blockquote> <pre><code> init : function(){ $.ajax({ url: '/calendar/RSSSyndicator.aspx?type=N&amp;number=15&amp;category=8-0%2c4-0%2c6-0%2c10-0%2c7-0%2c17-0%2c16-0%2c9-0%2c5-0%2c3-0%2c2-0&amp;department=3&amp;numdays=31&amp;ics=Y&amp;rsstitle=Annandale+-+Event+Listing&amp;rssid=11', success: this.loaded }); }, loaded: function(data){ // Get access to the events id in the DOM var events = document.getElementById('events'); // Get item from the RSS document var items = data.getElementsByTagName('item'); alert('test'); } } ns.init(); </code></pre> <p>});</p>
javascript
[3]
4,060,453
4,060,454
Java program divisible by three without using modulus
<p>I'd like to create a program wherein a user will type a number and the program will tell if it is divisible by 3 or not. But %, /, +, * can't be used in the program. Anybody here got some ideas how to do that?</p>
java
[1]
3,380,130
3,380,131
Queing Messages For SMS Gateway API
<p>I am developing an application that sends different messages to different recipients.The phone numbers and messages are stored in a table,and i use the curl function in a loop to call the API url.The issue is that after the first 10 (or so numbers),the maximum execution time parameter is exceeded,and not all numbers are sent.The support staff of the gateway company said i should try queuing the messages so that i could send them in bulk instead of looping.From the API i know that i can send messages to multiple recipients by separating each number with a comma,so i figure that issue is handled if i implode the array containing the phone numbers.The issue is how to handle the messages in the message array to deliver different messages to different numbers.Or rather,how do i que the numbers and messages so that everything is delivered in bulk to the API?. Below is an excerpt from my code:</p> <pre><code>while($launch_row=mysqli_fetch_assoc($launch_result)) { $number=$launch_row['phone_number']; $message=$launch_row['message']; $url="http://xxxxxxxxxxx?username=yy&amp;password=yyy&amp;type=0&amp;dlr=1&amp;destination=".urlencode($number)."&amp;source=xxx&amp;message=".urlencode($message); $ch = curl_init(); _setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); $results = curl_exec($ch); } </code></pre>
php
[2]
709,262
709,263
use javascript to read a link resource without ajax
<p>Not sure if it's possible but how do I read a resource from a url using javascript without ajax?</p> <p>for example, the following url is a static text file containing json encoded text</p> <p><a href="http://mysite.s3.amazonaws.com/jsonencodedcontent.txt" rel="nofollow">http://mysite.s3.amazonaws.com/jsonencodedcontent.txt</a></p> <p>I'd like to use javascript to read the content from above link, read the json content into a javascript variable.</p> <p>I can't use ajax because of cross site and I have no control over amazon S3 domain.</p> <p>anyway to achieve this?</p>
javascript
[3]
2,625,848
2,625,849
semaphore for a datarow
<p>I am writing a web application that allows the user basic CRUD operations against a database. The tables that are being updated have less than 200 records and there may be multiple users using this applications there is a need for some sort of locking mechanism to avoid the 2 users from overwriting each others changes.</p> <p>I have looked into semaphores but that seems to only limit the number of users executing the same code. In my data layer I have a class file for each table so I can certainly employ this on a specific table's class file but can I somehow limit the locking to the key fields?</p>
asp.net
[9]
3,552,466
3,552,467
PHP and External Scripts
<p>I am working on a website and I came to a point where I have been playing with the idea of referencing external scripts. I have broken up other scripts this way before, dropping in lines of code like</p> <pre><code>include('scriptX.php'); </code></pre> <p>I understand using this technique for larger chunks of complicated code but I was wondering what the standard or best practice was when doing small bits like querying for user information or smaller bits.</p> <p>What are the pros and cons here so that I can make the decision in the future as I build out.</p>
php
[2]
2,523,045
2,523,046
Clearing an array which is global context
<pre><code>var obj = { obj.arr1 = [], obj.arr2 = [] }; </code></pre> <p>I have this object in the global context, now each time when i add a new user the <code>obj1.arr[]</code> is used for some manipulation. Now when i add another user, the value obj.arr1[] holds the previous data. </p> <p>I tried using <code>obj.arr1=[];</code> but this does not work. I feel my object is in global context, how can i clear it. </p>
javascript
[3]
576,802
576,803
PHP Object Variable variables name?
<p>I have a loop that goes from 1 to 10 and prints values in</p> <p><code>$entity_object-&gt;field_question_1</code> through 10 so...</p> <p><code>$entity_object-&gt;field_question_1</code>, <code>$entity_object-&gt;field_question_2</code>, etc</p> <p>And I want to print this in this loop, how can I get the variable? I tried doing the</p> <pre><code>$var = "entity_object-&gt;field_question_".$i; print $$var; </code></pre> <p>But that did not work...</p> <p>How can I get these values?</p>
php
[2]
3,353,788
3,353,789
Android Tab bar
<p>I have a tab bar based application in android. In the second tab I show a list, when the user clicks a row in the list it goes to a detail page and the page tab bar becomes invisible. When I come back using a button in the activity the tab bar is in invisible state. How do I start that tab activity after returning from the detail page?</p> <p>Thanks</p>
android
[4]
5,195,168
5,195,169
Code error when submitting search query
<p>I'm getting error on this:</p> <blockquote> <p>Deprecated: Function split() is deprecated in C:\xampp\htdocs\tet\search_motifasni2.php on line 10</p> <p>Notice: Undefined variable: sql in C:\xampp\htdocs\tet\search_motifasni2.php on line 18</p> <p>Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\tet\search_motifasni2.php on line 32 doc with term: </p> </blockquote> <p>Codes:</p> <pre><code>if (isset($_POST['Submit'])) { //retrieve search word, trim, remove duplicate $find = $_POST['find']; $find = ltrim($find); $find = rtrim($find); $find = split(" ",$find);//line 10 $find = array_unique($find); </code></pre> <p>. . .</p> <pre><code> if($val&lt;&gt;" " and strlen($val)&gt;0) { $sql .=" Terms = '$val' or";//line 18 } } </code></pre> <p>. . .</p> <pre><code> $query = "SELECT * FROM document"; $result = mysql_query($query); $num = mysql_num_rows($result);//line 32 </code></pre> <p>Tried many ways but still getting the same result when searched a query.</p>
php
[2]
5,119,138
5,119,139
Javascript double click text transform into textbox
<p>What is the javascipt code that will edit a text on double click. The process is I have a text and if I double click it, a text box will appear, and if I press enter the word will change depends on what you've type.</p> <p><b>Sample</b><pre> This is sample text. $nbsp;$nbsp; --> if I double click it a textbox will appear.<br /> &lt;input type=&quot;text&quot; value="This is sample text." name=&quot;&quot; /&gt; </pre><br /></p> <p><b>Sorry for asking this. I am a newbie in javascript</b></p>
javascript
[3]
2,160,277
2,160,278
Confusion with a class level and instance level
<p>I have the following class:</p> <pre><code>public class B { public void print() { } public static void main(String[] args) { B B = new B(); B.print(); } } </code></pre> <p>I was wondering why the compiler didn't give an error saying it's not a static method. How will it distinguish between the class level and instance level when we have the object with the same as the class?</p>
java
[1]
1,283,237
1,283,238
I can't get the Union of two arrayLists
<pre><code>public static &lt;E&gt; ArrayList&lt;E&gt; union (ArrayList&lt;E&gt;array1, ArrayList&lt;E&gt;array2) { //arrayUnion will be the arrayList that will be returned ArrayList &lt;E&gt; arrayUnion = new ArrayList &lt;E&gt;(array1); arrayUnion.addAll(array2); E current; for(int i = 0; i &lt; arrayUnion.size(); i++) { for(int j = 0; j &lt; arrayUnion.size(); j++) { current = arrayUnion.get(i); if(current.equals(arrayUnion.get(j))) { arrayUnion.remove(j); } } } return arrayUnion; } </code></pre> <p>For my test of this method, this was the output:</p> <blockquote> <p>The first list is [ww, ee, rr, t, yy] </p> <p>The second list is [ww, ss, ee, dd] </p> <p>The union of both ArrayLists is: [ee, t, ww, dd]</p> </blockquote> <p>What went wrong..? I've been stuck on this for far too long and I never want to hear the word Union again. Plz help</p>
java
[1]
2,134,799
2,134,800
Determine if a key is currently pressed
<p>I have a need to determine if a key is currently being pressed. I do not need an event to fire, I simply need to determine if a key is being pressed to decide a code path. I looked around and there are some great GlobalKeyHook classes however they are event based.</p> <p>Little example, basically I need to determine if the user is holding a key down when my app starts and if so then the app does one thing, other wise it starts up as normal. Does anyone have any idea's? I am using C#.</p> <p>Thanks Patrick</p>
c#
[0]
2,268,600
2,268,601
C#. Windows media player
<p>We're using an embedded AxWMPLib.AxWindowsMediaPlayer to play various audio files in our application (C# code). I'd like to change, programmatically, the destination speakers (output audio device). I can't find any code to accomplish this. I've searched high and low. Nothing tells me how to select and/or change the speakers for audio output. Yet the standard Windows Media Player in Windows XP certainly can change audio devices quite readily via Tools / Options. (i don't want to change the default sound card , only to change it for the this instance of WMP) Can someone show me the light on how to change speakers, in C# code? Thank you!!! </p>
c#
[0]
569,086
569,087
Default value for int in text field
<p>I want to change default value for <code>int</code> property to <strong>empty field</strong> not <strong>0</strong>. How can I do it?</p>
java
[1]
3,413,446
3,413,447
in send() will it be ok to place the flag MSG_NOSIGNAL?
<p>I've asked a previous <a href="http://stackoverflow.com/questions/6162994/send-crashes-my-program">question</a></p> <p>I'm running a server and a client. A SIGPIPE signal crashed my server because of a broken pipe. I read that the above flag prevents that signal from being raised. My program now works and doesn't crash. But, i wonder what will be the over implications. What happens if i prevents SIGPIPE from being raised?</p>
c++
[6]
1,218,579
1,218,580
Problem with vector of objects/pointers (Implementing composite design pattern)
<p>I'm trying to implement the composite design pattern for a uni practical, I have an abstract base class DocumentComponent, and two classes that inherit from it, TextBody and Word. It's supposed to represent a sentence that can contain additional sentences and/or words. My problem arises when I try to implement the TextBody class, which has functions addComponent and Print. They are supposed to add a new DocumentComponent object to the vector using push_back, and to call the print function of each element in the vector, respectively. I'm storing my objects in a vector of DocumentComponent objects/pointers called container, and I can only get one of the two to work at a time (by changing my vector to either be a vector of pointers or a vector of objects). If I do the former my print function works but not my addComponent function, and if the latter the situation is reversed. Here's my code:</p> <p>documentComponent.h:</p> <pre><code>class DocumentComponent { public: virtual void removeComponent(int index){} virtual void addComponent(DocumentComponent&amp; comp){} virtual void print()=0; }; </code></pre> <p>textBody.h:</p> <pre><code>class TextBody : public DocumentComponent { public: TextBody(); virtual void addComponent(DocumentComponent&amp; comp); virtual void print(); private: vector&lt;DocumentComponent*&gt; container; }; </code></pre> <p>textBody.cpp:</p> <pre><code>void TextBody::addComponent(DocumentComponent&amp; comp) { container.push_back(&amp;comp); } void TextBody::print() { if (container.size() == 0) return; for_each(container.begin(), container.end(),mem_fun_ref(&amp;DocumentComponent::print)); } </code></pre> <p>I get the error message</p> <p>"Cannot initialize 'DocumentComponent &amp;' with 'DocumentComponent *' in function for_each <p>which I understand is because I'm giving it a pointer when it wants a reference, but changing my vector to a vector of objects results in</p> <p>"Cannot create instance of abstract class 'DocumentComponent'"</p> <p>in my addComponent function</p>
c++
[6]
3,831,384
3,831,385
JQuery implementing if statement issue
<p>I'm trying to put an if statement in the following code. But since I am new at JQuery, I don't know how to put it there. When I uncomment the lines, I am getting an "missing : after property id" error on FireBug. How can I achieve this? Thanks in advance.</p> <pre><code>$( ".droppable" ).droppable({ //if ((this.firstChild) != "[object HTMLImageElement]") { drop: function( event, ui ) { var dropped = ui.draggable; var droppedOn = $(this); $(dropped).detach().css({top: 0,left: 0}).appendTo(droppedOn); } //} }); </code></pre>
jquery
[5]
4,611,134
4,611,135
Is there a difference between them, if have,what's it?
<pre><code>$a = true; 1,new test($a); 2,new test(true); </code></pre> <p>Is there a difference between them(1,2), if have,what's of it? thank you,.</p>
php
[2]
132,594
132,595
2 errors on my code, Division by zero & Function eregi() is deprecated
<p>Im getting 2 errors on my code.</p> <p>First:</p> <pre><code>[18-Sep-2012 11:54:57] PHP Deprecated: Function eregi() is deprecated </code></pre> <p>And this line is:</p> <pre><code>if ($vidSrc !== false &amp;&amp; eregi('eow-title',$vidSrc)) </code></pre> <p>Second</p> <pre><code>PHP Warning: Division by zero $percent = round($downloaded/$downloadSize, 2) * 100; </code></pre> <p>When I tested on localhost, it worked fine, after moving to my host, its giving this. PHP Version: 5.3+</p>
php
[2]
3,589,538
3,589,539
Adding columns to a DataTable using SetOrdinal
<p>Let's say I have a DataTable with five columns. I am curious as to why the following works:</p> <pre><code>dt.Columns.Add("Blah").SetOrdinal(5); </code></pre> <p>But the following throws an <code>ArgumentOutOfRangeException</code>:</p> <pre><code>dt.Columns.Add("Blah").SetOrdinal(dt.Columns.Count); </code></pre> <p>I also tried</p> <pre><code>dt.Columns.Add("Blah").SetOrdinal(dt.Columns.Count - 1); </code></pre> <p>which works, but I'm not entirely sure why. Does it have something to do with the column being added before the <code>SetOrdinal</code> is executed, thus increasing the count beyond the range of columns?</p>
c#
[0]
5,767,634
5,767,635
Javascript Event Listeners with tooltips
<p>Is it possible to use a javascript event listener to initialize a tool tip for a button who is the target for the listener? I have searched online and found many ways to make a tool tip work but would like to make use of an event listener. I'm going to use onmoveover as the type of event for the target. Is this really possible? </p>
javascript
[3]
3,940,213
3,940,214
Clear all inputs inside row
<p><code>var new_row</code> has type <code>Object[tr]</code>. How can I clear all inputs inside this row?</p>
jquery
[5]
4,434,393
4,434,394
cookies in javascript
<p>i'm trying to save cookie from \http://sample/default.aspx page and i'm trying to retrieve it from \http://sample/_layout/default.aspx is it possible or not? in anyway</p>
javascript
[3]
2,089,993
2,089,994
Database Creation in android
<p>I am creating a table which works on the simulator but not on the device. I get this error message: </p> <pre><code>Failure 1 (near "(": syntax error) on 0x2d69a8 when preparing 'CREATE TABLE request(requestidINTEGER PRIMARY KEY,longitudefromDECIMAL(10,5),lattitudefromDECIMAL(10,5),phoneINTEGER) </code></pre> <p>I am creating the table like this: </p> <pre><code> String CREATE_REQUEST_TABLE= "CREATE TABLE " + TABLE_REQUEST + "(" + KEY_REQUESTID + "INTEGER PRIMARY KEY," + KEY_LONGITUDEFROM + "DECIMAL(10,5)," + KEY_LATTITUDEFROM + "DECIMAL(10,5)," + KEY_TO + "TEXT," + KEY_DEPARTURETIME + "TIME," + KEY_ARRIVALTIME + "TIME," + KEY_DESCRIPTION + "TEXT," + KEY_PHONE + "INTEGER" + ")"; db.execSQL(CREATE_REQUEST_TABLE); </code></pre>
android
[4]
1,297,089
1,297,090
Calculating a 2D Transformation Matrix from an Initial and Resultant 2D Matrix
<p>I by no means profess to be a genius when it comes to programming and my current problem has me stumped.</p> <p>I have found this question <a href="http://stackoverflow.com/questions/1856210/trying-to-derive-a-2d-transformation-matrix-using-only-the-images">Trying to derive a 2D transformation matrix using only the images...</a> that seems to at least partially answer my question but the image that should show the solution is no longer available :S</p> <p>I'm working in C# and not using WPF as neither my input or output needs to be displayed graphically.</p> <p>In my program I have 2 quadrilaterals, lets call them an input and an output quadrilateral.</p> <p>The input quad has the co-ords of (2,1),(2,3),(4,4),(3,1) from bottom left clockwise.</p> <p>The output quad can have any co-ords and will be again listed in order from bottom left clockwise.</p> <p>Given these 8 co-ordinate pairs, is it possible to calculate a transformation matrix that I could apply to any single co-ordinate pair?</p> <p>I'm not too hot on Matrices but I am willing to learn if pointed in the right direction.</p> <p>Many Thanks</p> <p>Josh</p>
c#
[0]
4,662,304
4,662,305
java calculate pathname difference
<p>Is there an open source library that, given ...</p> <pre><code>/a/b/c /a/b/c/d/e </code></pre> <p>would return ../..</p> <p>or for that matter given</p> <pre><code>/a/b/c/d /a/b/c/e </code></pre> <p>would return ../d</p> <p>?</p>
java
[1]
2,150,881
2,150,882
Building iPhone App for Distribution
<p>I have a question on how exactly to do the final distribution build for my app. I have actually successfully built this app already but now I am trying to make an updated version and to remember what I did right the first time. It all seemed to go wrong when my provisioning profile expired....</p> <p>Anyway, I have my distribution certificate and distribution provisioning profile. I have followed the instructions from Apple, an iPhone programming book and several online sources to create a build that checks against the right certificate etc. But the build always fails unless I connect a device, which is strange as the distribution provisioning profiles do not allow the inclusion of a device (which makes perfect sense in itself). However when I build with a device connected I am asked </p> <blockquote> <p>'Can’t run XXX on the iPod “iPod touch”</p> <p>The iPod “iPod touch” doesn’t have the provisioning profile with which the application was signed.</p> <p>Click “Install and Run” to install the provisioning profile XXX on “iPod touch” and continue running XXX.'</p> </blockquote> <p>When I click install and run it fails with the message that </p> <blockquote> <p>A valid provisioning profile for this executable was not found.</p> </blockquote> <p>So my basic question is how exactly should the final distribution build be done? An new executable appears, but it has a forbidden symbol on top of the application icon suggesting the build was unsuccessful. </p> <p>Any help massively appreciated.</p>
iphone
[8]
4,246,104
4,246,105
jQuery onload function
<p>HI,</p> <p>I m using the following script to call a onload function but it does not works in IE</p> <p><code>("#body").attr({onload : "calFact();"});</code></p>
jquery
[5]
1,230,791
1,230,792
What is wrong with this simple char filler?
<p>It seems and looks really simple but a seemingly random spot of the char array is not filling correctly with 8's. There are no compiler errors either. I'm sorry that this is such a noob question but when I designed a sudoku solver a month ago I didn't have any problems running codes almost identical to this.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main () { //Initiates initial board. char board[30][27]; //Fills entire board with b's to represent the edges of the board where the pac-man cannot go. for (int control=0; control&lt;31; control++) { for (int control2=0; control2&lt;28; control2++) { board[control][control2]='8'; } } //Code here filling the board with spaces representing where the pac-man can go. //Temporary render of board. for (int control=0; control&lt;31; control++) { for (int control2=0; control2&lt;28; control2++) { cout &lt;&lt; board[control][control2]; } cout &lt;&lt; endl; } return 0; } </code></pre> <p>It apparently has a random segmentation fault.</p>
c++
[6]
3,439,090
3,439,091
jQuery - change/add an event on a link
<p>I have this link :</p> <pre><code>&lt;a href="#" onClick="addSide('1');return false"&gt;Link&lt;/a&gt; </code></pre> <p>and I want that, when I click on a button (for example), the value of addSide in that link grow. Such as first click on the button I want to pass to the addSide function 1, second click addSide('2'), and so on...</p> <p>So, is it possible change value of the addSide function, trought jQuery, by editing this and replace with somethings like <code>addSide('another_value')</code>?</p> <p>EDIT I see is not so clear my question. So I give an example :)</p> <p>This is the code I want to edit :</p> <pre><code>&lt;div class="trackon" id="trackline"&gt; &lt;span class="trackbotton1"&gt; &lt;a class="lblueb" href="#" onClick="addSide('');return false"&gt;Add Side&lt;/a&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>I wrote this :</p> <pre><code>$('#trackline').find('.trackbotton1').children().attr('onclick', 'alert("example");return false'); </code></pre> <p>but the function doesnt change...</p>
jquery
[5]
5,015,627
5,015,628
call a jquery method on page submit with multiple iframes
<p>I have multiple iframes in a page .The inner most one has a jquery attached to it.I need to call a function from the inner most iframe when the page submits.The script i am using now is not intiating the call.</p> <pre><code>$(iframe).parents('form').submit(function() { disableDesignMode(iframe, true); }); </code></pre> <p>Any help is very much appreciated.</p>
jquery
[5]
3,210,213
3,210,214
How to create customized Views for AppWidgets?
<p>There is a given set of predefinied Views that can be used in layouts for AppWidgets. How can a customized View added to this list? The minimum requirement is that the class is annotated with RemoteView. What else is necessary to be acceptable as view in the layout.xml?</p>
android
[4]
2,682,802
2,682,803
how to create directory in mnt/sdcard in android 2.2
<pre><code> File dir = Environment.getExternalStorageDirectory(); if (dir.exists() &amp;&amp; dir.isDirectory()) { String exStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); File appPath = new File(exStoragePath + "/mbrc/"); appPath.mkdirs(); String tempFilename = "tmp.wav"; String tempDestFile = appPath.getAbsolutePath() + "/" + tempFilename; return tempDestFile; } </code></pre> <p>I try this on HTC with Android 2.2 but directory is not created and file also not. If i try this on SAMSUNG S2 wuth android 4 then works. </p> <p>Why this not working on HTC and android 2.2?</p>
android
[4]
2,809,059
2,809,060
How do I know if a mouse pointer is over a particular element on the page?
<p>With the help of JavaScript, of course.</p>
javascript
[3]
4,644,454
4,644,455
JQuery Change Event Problem
<p>I have a problem with Change event . I want to do a request using ajax every time that the input value changes = keyup , past , cut.... the change event in jQuery is too slow !!</p> <pre><code>$("#Password").change(function (){ $.post("register.php", {do : 'password', pass : $(this).val()}, function (data){ alert(data); }); }); </code></pre> <p>Thx Every One I Opened A Plugin Called <strong>Elastic</strong> and I find what I am looking for :</p> <pre><code>$(Your Selectors).bind('keyup change cut paste', function(){ //do things }); </code></pre> <p>It's Perfect ^^ !!</p>
jquery
[5]
1,653,234
1,653,235
How to filter gridview records faster way?
<p>I have a gridview which contains 100 records i have set paging to 10. At page_load it fills the grid so the records are not going to change so i dont need to hit to database again. <br> There is a filter textbox availble at the top of 'Name' Column when user types some key it should filter the 100 records &amp; should return the matched records (e.g using Contains filter).<br> It is not very difficult task if i user update panel. But, It takes time becoz i am fetching records on each key. Even i use viewstate it slows down the performance. Is there any alternative way to achieve this? I am wondering if u could use some javascript logic </p>
asp.net
[9]
2,531,443
2,531,444
Convert UTC time to javascript date
<p>I am using highcharts a JS library it gives me the time of a point in UTC format: 2592000000 which should correlate to a date somewhere in 2011.</p> <p>How do I get the actual date of this? </p>
javascript
[3]
4,398,900
4,398,901
change form field value with javascript
<pre><code>&lt;script type="text/javascript"&gt; function up(d,mul) { alert(d); form1.d.value=mul; } &lt;/script&gt; </code></pre> <p>up is a function name with which i am trying to update the value of field(field name=d). But its not working. plz somebody help me.</p>
javascript
[3]
194,406
194,407
iPhone:Convert NSString 123-123-1234 into (123) 123-1234
<p>I have string like 123-123-1234 so I want to convert string into this format (123) 123-1234 so any idea to develop this functionality.</p> <p>Thanks in advance.</p>
iphone
[8]
4,220,597
4,220,598
IE issue (function not being called document.ready)
<p>I've been wading through all of the other questions regarding IE challenges, but I'm no closer to understanding why my Ajax function is called in Chrome and Firefox but not IE8. </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="/jQuery/jQuery.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="messageList"&gt; &lt;/div&gt; &lt;script&gt; $(document).ready(function(){ loadMessages(); }); function loadMessages() { var myInbox = "https://x/SecComm/ajax_inboxResults.cfm?folderID=0"; $.get(myInbox,function(data){ $("#messageList").html(data); }); } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I'm sure I'm doing something really stupid, but since I've only been at this a week or so, I'm a bit stumped! </p> <p>Awaiting the arrival of "Irene", thx for your time, KW</p>
jquery
[5]
1,577,481
1,577,482
Please remove this problem:: javax.servlet.ServletException: Servlet execution threw an exception
<p>HTTP Status 500 -</p> <p>type Exception report</p> <p>message</p> <p>description The server encountered an internal error () that prevented it from fulfilling this request.</p> <pre><code>exception javax.servlet.ServletException: Servlet execution threw an exception `root cause` java.lang.Error: java.lang.RuntimeException: '\usr\crt\Documentum' is an invalid value for the property dfc.data.dir com.documentum.fc.client.DfClientSupport.&lt;init&gt;(DfClientSupport.java:115) com.documentum.fc.client.DfClient.&lt;init&gt;(DfClient.java:32) com.documentum.fc.client.DfClient.getLocalClientEx(DfClient.java:71) com.documentum.fc.client.DfClient.getLocalClient(DfClient.java:57) itgi.hcl.help.SearchDocument.&lt;init&gt;(SearchDocument.java:42) itgi.hcl.action.PolicySearchAction.searchDocumentum(PolicySearchAction.java:271) itgi.hcl.action.PolicySearchAction.execute(PolicySearchAction.java:58) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) </code></pre> <p>note The full stack trace of the root cause is available in the<code>Apache Tomcat/6.0.29 logs</code>. Apache Tomcat/6.0.29</p>
java
[1]
5,541,251
5,541,252
how to run vibrate continuously in iphone?
<p>In my application I m using following coding pattern to vibrate my iPhone device</p> <pre><code>Header File:- AudioServices.h AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); </code></pre> <p>My problem is that when I run my application it gets vibrate but only for second but I want that it will vibrate continuously until I will stop it.</p> <p>How it could be possible .Please help me out its urgent</p> <p>Thanks in Advance</p>
iphone
[8]
267,943
267,944
PHP - Insert content at specific point in HTML
<p>I have the following <code>&lt;DIV&gt;:</code></p> <pre><code>&lt;div class="general"&gt; Some content here &lt;/div&gt; </code></pre> <p>I want to do a PHP include just before </p> <p>Is this possible in PHP?</p>
php
[2]
1,517,904
1,517,905
Passing ofstream object from main program to a class
<p>Here is what I am trying to do:<br /> 1) Open an ofstream object in my main body. I can do this no problem.<br /> 2) Associate this object with a filename. No problem.<br /> 3) Pass this object to a class and send output within this class. I can't do this.<br /> Here is my code. I would appreciate any help. Thanks!</p> <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt; using namespace std; typedef class Object { public: Object(ofstream filein); } Object; Object::Object(ofstream filein) { filein &lt;&lt; "Success"; } int main (int argc, char * const argv[]) { ofstream outfile; outfile.open("../../out.txt"); Object o(outfile); outfile.close(); return 0; } </code></pre>
c++
[6]
5,224,079
5,224,080
Using [] after string in javascript
<p>The following alerts 100. I would like it to alert 200 but obviously I'm missing something.</p> <pre><code>$blah[1] = 100; function updateBlah(e) { $blah[e] = 200; alert($blah[e]); } updateBlah(1); </code></pre>
javascript
[3]
3,396,918
3,396,919
android manifest file & activies - does eclipse suck or am I missing something?
<p>I've seen a number of people have problems because they don't add the activity to the manifest file. I've suffered from this myself. This seems like such a simple/common problem yet I have no clue how I'm supposed to figure that out from the eclipse IDE. Is the debugging output of eclipse totally useless or is there something I'm missing?</p>
android
[4]
1,362,398
1,362,399
How to fill a path with gradient
<p>I have a graph view that draws a path to some points like this: <img src="http://i.stack.imgur.com/Tryrl.png" alt="enter image description here"></p> <p>now I want to fill the inner area of graph with a gradient color how can I achieve this ?</p> <p>Thanks</p> <p><strong>Edit:</strong> @Lumis I added another closed path and set the shader and it was like this: <img src="http://i.stack.imgur.com/ors50.png" alt="enter image description here"></p> <p>but there is a gradient color in the outer area of the graph, how can I avoid this ?</p>
android
[4]
3,345,934
3,345,935
Programmically create glossy 3d button
<p>I have googled it already but can't find a good hint on how to create buttons in android that look like glossy shiny buttons with a slight 3d effect. See pic:</p> <p><a href="http://dl.dropbox.com/u/31958099/buttons.jpg" rel="nofollow">http://dl.dropbox.com/u/31958099/buttons.jpg</a></p> <p>How can I programmically do this? Any hints? Thanks!</p>
android
[4]
5,248,395
5,248,396
Why can't document.write be used to load a module using Dom-scripting?
<p>In <a href="http://stackoverflow.com/questions/4044259/in-javascript-what-is-a-constructor-and-what-isnt">this question</a>, I got the following answer:</p> <p>Looking at Google's maps script it's failing to load the Geocoder module because it's using document.write to do so, a method that has to be run from a included in the HTML document at parse time, not imported by use of DOM scripting as you're doing here.</p> <p>Which is a method that has to be run from a included in the html at pare time? How do I do this? What is being imported by the use of DOM-scripting? How do I recognize DOM-scripting?</p> <p>I'm pretty new to javascript and I don't really understand the reference here. </p>
javascript
[3]
4,340,171
4,340,172
What is the best way to start learning C#?
<p>I have a little programming experience with vb 6 and vb.net not much. Please tell me the best way to become an expert C# programmer and I know it will take a long time.</p>
c#
[0]
6,003,767
6,003,768
playing a sound
<p>I'm very beginner in Java, so ...</p> <p>I've written a simple Java code to display images from my hard drive wherever I click the mouse, not on the applet, on panel, now how can I make a sound play automatically when I view 6 pictures ?</p> <pre><code>public void mouseClicked(MouseEvent e) { if (count == images.length - 1) { ??????????????????????? } else { count++; } x = e.getX(); y = e.getY(); frameTest.repaint(); } </code></pre> <p>I want to play a sound file from the Hard drive, in the place of question marks ..</p> <p>can some one help plz ?</p>
java
[1]
1,087,076
1,087,077
How do you fill a Java HashMap with multiple instances of related subclasses?
<p>I have a superclass called "Canvas," from which I create several subclasses. I want to store instances of those subclasses in a dictionary. So I tried setting up my code as follows:</p> <pre><code>public class Main { public static void main(String[] args) throws Exception{ Canvas canvas = new Canvas(); Menu menu = new Menu(); Instructions instructions = new Instructions(); Map&lt;String, Canvas&gt; screens = new HashMap&lt;String, Canvas&gt;(); screens.put("menu", menu); screens.put("instructions", instructions); </code></pre> <p>So, being that the things I want to add to the dictionary are all subclasses of my Canvas class, I set up the hashtable to accept that Type. And this works.. for the most part. However, the big problem is that I cannot access any of the subclass' methods. I can only call methods that exist in the superclass.</p> <p>If I attempt to do something like, </p> <pre><code>screens.get("menu").some_func_in_subclass(); </code></pre> <p>The compiler spits out a "Can not find symbol" message. </p> <p>So, if I have something like this: </p> <pre><code>SuperClass | | +------------------------------------ | | | SubClass1 SubClass2 SubClass3 </code></pre> <p>How would I store instances of those subclasses in a HashMap? </p>
java
[1]
5,153,601
5,153,602
explanation about activity re-creation on configuration change and context
<p>I'm pretty new to Android development and I'm looking for explanation about a problem I'm facing, for gaining deeper understanding of Android.</p> <p>I have this piece of code:</p> <pre><code>someAutoCompleteTextView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) ((AutoCompleteTextView)v).showDropDown(); else ((AutoCompleteTextView)v).dismissDropDown(); } }); </code></pre> <p>if the dropdown list is visible and the configuration changes (screen orientation) I'm getting a BadTokenException.</p> <p>I understand that the activity is destroyed and a new one is created to replace it, but I don't quite understand what's really going on and why am I getting that exception, after all, a new activity is created with new listeners registered to the new views and the old ones are destroyed.</p> <p>I know that I can fix this by telling the manifest that I'll be handling configuration changes by myself, but I'm looking into deeper understanding.</p> <p>thanks!</p>
android
[4]
4,753,904
4,753,905
C++ why bitvec[0].flip() works
<p>Based on C++ Primer 4th edition (i.e. pp 105),</p> <pre><code>bitset&lt;32&gt; bitvec; bitvec[0].flip(); // reverses the first bit. </code></pre> <p>My question is why the second line works? Based on </p> <pre><code>http://www.cplusplus.com/reference/stl/bitset/operator[]/ bool operator[] ( size_t pos ) const; reference operator[] ( size_t pos ); </code></pre> <p>How can bitset::flit can be used on bool or reference?</p> <p>Thank you</p>
c++
[6]