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
4,865,341
4,865,342
CodeSign Error while preparing App for distribution using Distribution certificate
<p>I have created a Distribution certificate, &amp; a Distribution Provisioning Profile for Ad-Hoc Distribution/ AppStore submission. I have made all the necessary changes in Info.plist, Entitlements file, Targets -> Build of the project. I'm getting an error. i've attached screen shot of this error.<img src="http://i.stack.imgur.com/c0XOW.png" alt="enter image description here"> </p> <p>This error seems to be occurring coz I've no profiles currently matching for iphone distribution<img src="http://i.stack.imgur.com/SxThm.png" alt=".">. It displays 'profile doesn't match any valid certificate/ private key pair in default keychain'. I've checked the certificate &amp; its valid. <strong>Can there be some issue with the private key present in the keychain access. If so the case, please suggest a solution.</strong> </p>
iphone
[8]
498,641
498,642
Why i cannot see a View Based Application in my Project Assistant window in XCode
<p>I have just installed XCode 3.1.4. I cannot see the ViewBased Application template when i try to create a View Based application for the iPhone. In fact i cannot see an iPhoneOS there at all. All i can see is Mac OS X. Do i have to install iPhone OS separately? Thank you </p>
iphone
[8]
5,808,017
5,808,018
Recreating "presentModalViewController"?
<p>I'm using a <code>UIImagePickerController</code> set up as a camera with an overlay view.</p> <p>I want to present a modal view controller on top on this. When I do so, though, the camera view "closes". This would be okay, but when I dismissModalViewControllerAnimated, I see the closed camera, and there is a long and annoying delay before it reopens. I would like to avoid this.</p> <p>Unless someone has a better approach, I am planning to simply perform the transition that <code>presentModalViewController</code> would perform myself. However, if I take my modal view from it's controller and add it as a sub view of the camera overlay view, like this:</p> <p><code>[[_imagePickerController cameraOverlayView] addSubview: [viewController view]];</code></p> <p>then the modal view doesn't show up at all, and the application crashes with an <code>EXC_BAD_ACCESS</code> in my "modal" view's layoutSubViews.</p> <p>Where as, if I present it with <code>presentModalViewController</code>, everything works fine. Clearly, <code>presentModalViewController</code> is also doing some other stuff. Does anyone know what this is so that I can recreate it?</p>
iphone
[8]
2,985,957
2,985,958
dynamic vs object type
<p>I have used the dynamic and the object type interchangeably. Is there any difference between these two types? Is there any performance implications of using one over the other? Which one of these is more flexible?</p>
c#
[0]
581,071
581,072
Android Gridview drag and drop example
<p>Can anyone give me some link from where I can learn Drag and Drop inside Android GridView.</p>
android
[4]
239,617
239,618
How to get some elements from html source and convert them to readable text?
<p>I have a page which displays "HeLLo 54292" in ASCII art, using <code>+</code> characters inside <code>&lt;table&gt;</code> tags to produce block letters. I'm generating this with PHP. <a href="http://cmaempreendimentos.com/test/" rel="nofollow">You can check out page's html source code</a>, and see how the ASCII art is constructed. </p> <p>I want to convert the ASCII-art letters to actual text, so I could parse that HTML source and would end up with the string "HeLLo 54292". How would I accomplish this?</p>
php
[2]
1,736,787
1,736,788
xml duplicate detection
<p>i want to know how to extract candidate objects from xml document? for example, "titles" from a publication xml document. "titles" objects are preprocessed and stored into database to detect duplicate MD5 algorithm. Pls,give me any suggesstions. </p>
java
[1]
1,216,927
1,216,928
C# match and export based on listbox textfile and wildcard
<p>I like to thank stackoverflow member AlbertEin for helping with this code. What I have is a file being created from a massive directory listing, and i also have a listbox full of items that are only part of the file name in the directory listing. What I want to do is write out a text file for every listboxitem in listbox1.item based on the item and a wildcard</p> <p>Example Listbox:<br> Apple<br> Orange </p> <p>Results Apple.txt:<br> Apple13.txt<br> Apple15.txt<br> Apple19.txt </p> <p>and just do this foreach item in the listbox. I'd also like to only read the master txt file once to save me from reading it everytime. Any help appricated.</p> <p>Better explaination:</p> <p>I have a listbox of 100 items, and 1 master text file that was created.</p> <p>For all items in the listbox that match the master test file, I want to write out the matching contents of the master text file to a new textfile with the listboxs name.</p> <p>The listbox items needs a wildcard in order to match the master text file.</p>
c#
[0]
2,247,187
2,247,188
How to update a specific cell in a datatable based on search criteria in c#
<p>I am working with a datatable that i would like to update. Here is what i am trying to do. I have a datatable with say 4 rows of data with columns such as Student ID, Student Grade and Absence Count.</p> <p>When i get new information about the absence count, i want to search through the datatable by the student id, isolate that row in the datatable and update the absence count cell with a new count. How can i do this? Here is what i have so far:</p> <pre><code>DataRow[] drr = dt.Select("Student ID='" + id + "'"); drr[0]["Student ID"] = count; </code></pre> <p>But how to commit these changes to the table itself?</p>
c#
[0]
3,367,001
3,367,002
check to see if two ID's are hidden in a conditional
<p>So i have two divs and i want to see if both are currently hidden..Im sure this is really easy but im lost for some reason</p> <p>I have this </p> <pre><code> $j('.btn').click(function(){ //check to see if the divs are currently hidden and if they are show either one of the two }); </code></pre>
jquery
[5]
2,989,468
2,989,469
Avg thinks my program is a hack tool when I include windows.h
<p>I have a blank c++ project and when I include <code>windows.h</code> and try to run it, avg pops up and says it's a hack tool. (I've tested it, just including the header file sets it off.)</p> <p>I've added my programming folder as an exception so I can run it but I wouldn't want to distribute a program like that is there something I can do differently to satisfy avg?</p> <p>Note: I'm trying to follow an OpenGL tutorial.</p> <p>Edit: The program compiles fine without the windows header file and avg pops up when I do include it but how else can a form be made?</p> <p>Here's a screenshot: <img src="http://i.stack.imgur.com/34NAh.png" alt="AVG error"></p>
c++
[6]
288,382
288,383
Using home button on android phone
<p>In iphone when we exit app and start app again by clicking launcher icon the app start from screen which was open last time before exiting app. </p> <p>We can achieve same in <code>android</code> when we exit app using center or <code>home button</code> on android phone. In android app if app is exited by pressing home button and started again by clicking on launcher icon the app start from activity which was open last time before exiting app. </p> <p>Is that functionality similar to iphone in terms of keeping app in memory longer? Will that work in android all time because I think android system will remove app from memory after sometime or will it remain in memory longer? Can I depend on this functionality in android and expect it to work all time. </p> <p>I have a project in android which client has asked me to have iphone like functionality if we exit app and start app again it should open from screen which was opened last time before exiting. Now this is possible in android only if we use centre button. And also if user has exited using centre button and started it again, app should check for user current location and do some other operations. If app is launched and user navigate to any activity is there any way to check if app was exited using back button or centre button so that I can run code if app is exited using center button.</p> <p>Thanks</p>
android
[4]
1,785,821
1,785,822
jquery with javascript conditional statement
<p>I have the following <a href="/questions/tagged/jquery" class="post-tag" title="show questions tagged 'jquery'" rel="tag">jquery</a> code</p> <pre><code>$(document).ready(function() { $('.anipic').hover(function(){ if ($(this).parent().position().left &lt;= 700) { $('.bio').css({ 'height': $(this).height()+2, left: $(this).parent().width() }); } if ($(this).parent().position().left &gt;= 700) { $('.bio').css({ 'height': $(this).height()+2, right: $(this).parent().width() }); } $(this).css({'background-color':'#55CADF'}); $(this).siblings('.bio').animate( { width: '+=160px' }, { easing: 'swing', complete: function() { $('.biotext').fadeIn(); } } ); //endmouseover }, function() { $(this).css({'background-color':'#ffffff'}); $(this).siblings('.bio').stop().hide().css({'width':'0px'}) $('.bio').hide(); $('.biotext').hide(); }) //end //enddocumentready }); </code></pre> <p>You can see the the page here <a href="http://afhboston.com/artists_listnew.php" rel="nofollow">http://afhboston.com/artists_listnew.php</a></p> <p>Basically, the conditional statement gets ignored once I hover over the element that's position is less than 700px in it's parent and the element whose position is greater than 700px animates to the right istead of the left. I'm not having any luck figuring out this bug.</p>
jquery
[5]
4,064,876
4,064,877
Change text with jQuery
<p>I need to change the text within a link on click from 'open' to 'close'.</p> <pre><code>&lt;a href="#" id="clickMe"&gt;&lt;span class="A open"&gt;&lt;/span&gt;open&lt;/a&gt; </code></pre> <p>But how do I change the label after I run an AJAX function on success?</p> <pre><code>success: function(){ $("#clickMe").find("span").toggleClass("open close"); // toggle label } </code></pre>
jquery
[5]
3,020,309
3,020,310
Android button hard to hit in 2.2
<p>Hi in my app contain a Button ,currently i customized using xml for changing the background and it work fine in 2.1 but when am reach to 2.2 ,The button is hard to hit ,how can i solve the issue?</p> <p>my button xml code given below</p> <pre><code> &lt;Button android:id ="@+id/Button_Continue1" android:background="@drawable/continue_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4dp" /&gt; </code></pre>
android
[4]
1,015,490
1,015,491
Portability of std::mem_fun expression
<p>Assuming a correct instantiation in the indicated comment, is the following expression legal and portable C++? Why or why not?</p> <pre><code>std::mem_fun&lt;/*…*/&gt;(&amp;(std::vector&lt;int&gt;::clear)) </code></pre>
c++
[6]
5,150,052
5,150,053
C++ Collections Class
<p>I'm self studying C++. If you're making a <code>Class</code> which only has a member variable that is a collection of "X" objects, (whatever X may be) would having just a default constructor and a deconstructor be enough seems its purely dealing with a collection of objects? Thanks. </p> <p>EDIT: Sorry should have been clearer. For a different example, if you have a class "Aclass" that has an int, a string and a vector of objects of another class, would you advise the "Aclass" class to have a constructor with parameters? ie <code>Aclass(int i, string s);</code> and do you need to have the vector in the constructor too? I'm a little confused. Thanks.</p>
c++
[6]
1,696,194
1,696,195
getElementById with a variable plus an id name
<p>I've almost sussed out this like post function, but one particular thing isn't working. There are multiple posts in the same thread, of course, and so I've assigned the td part the id ".$POST->id."likeunlike, wherein $POST->id calls the post id from a database, using php. This code looks like this:</p> <pre><code> &lt;?php echo "&lt;td id=\"likeunlike".$POST-&gt;id."\" style=\"text-align:left\"&gt;...&lt;/td&gt;"; ?&gt; </code></pre> <p>Now, from a javascript function that gets called from within a js file in the page executing the script, I've put in this function:</p> <pre><code> function stateChangedlike() { if (xmlHttplike.readyState==4 || xmlHttplike.readyState=="complete") { var pid = document.getElementById(x).id; document.getElementById("likeunlike"+pid).innerHTML=xmlHttplike.responseText; } } </code></pre> <p>Basically I'm trying to make the likeunlike unique to every post on the page, because if i just use the likeunlike with nothing else, all the javascript output goes to the first instance of that likeunlike id. Except now, the function just isn't working...</p> <p>Basically what I'm wondering is how can I make this javascript function that uses the same basic id for all posts on the same page, work for each post uniquely?</p> <p>I hope this makes some semblance of sense, otherwise please let me know and I'll try to rephrase it...</p>
javascript
[3]
4,440,558
4,440,559
Get Version of exe via PHP
<p>Is getting the version of a exe possible with php? I'd like to print the version of a file that can be downloaded...</p> <p>Windows exe and php is running on linux server</p>
php
[2]
1,035,270
1,035,271
Content Provider for SMS (cached name too)
<p>When I need get call log, i use this projection: </p> <pre><code> String[] projection = new String[] { CallLog.Calls.NUMBER, CallLog.Calls.DATE, CallLog.Calls.DURATION, CallLog.Calls.CACHED_NAME, CallLog.Calls.TYPE }; </code></pre> <p>In Messages (SMS) Content Provider doesn't support like CACHED_NAME? </p> <p>Thanks, Mateus</p>
android
[4]
3,232,390
3,232,391
Populating an array of objects in javascript
<p>Let us say I have an object Airport with members airportCode and airportCity like this: </p> <pre><code>function Airport(airportCode, airportCity) { this.airportCode = airportCode; this.airportCity = airportCity; }; </code></pre> <p>How can I create an array of objects Airport to which I can add. In Java, this would work like this: </p> <pre><code>while(st.hasMoreTokens()) { Airport a = new Airport(); a.airportCode = st.nextToken(); a.airportCity = st.nextToken(); airports.add(a); } </code></pre>
javascript
[3]
2,869,651
2,869,652
how do i check if a method has already been called?
<p>I have a class that loads certain parts of my page. What I want to do is this</p> <pre><code>index.php $obj-&gt;load('admin'); </code></pre> <p>In my class in the constructor I have a check to see if the URI contains the segment <code>/admin/</code> and if it does then it auto loads the admin page:</p> <p><code>$this-&gt;load('admin');</code></p> <p>now both work fine, I just realized that if I have both entries in my project then it will load the <code>admin</code> initialization twice.</p> <p>Is there a way for my to check if the <code>load()</code> method has already been called and if the parameter is <code>==</code> to <code>admin</code>?</p>
php
[2]
4,448,968
4,448,969
Escaped Backslash Characters in PHP Single Quoted Strings
<p>I took these sentences from the PHP manual:</p> <pre><code>'this is a simple string', 'Arnold once said: "I\'ll be back"', 'You deleted C:\\*.*?', 'You deleted C:\*.*?', 'This will not expand: \n a newline', 'Variables do not $expand $either' </code></pre> <p>I would like to echo them using PHP code, exactly as they appear, with escaped single quotes (like in the second sentence) and double backslashes (like in the third sentence). This is what I have so far:</p> <pre><code>&lt;?php $strings = array( 'this is a simple string', 'Arnold once said: "I\'ll be back"', 'You deleted C:\\*.*?', 'You deleted C:\*.*?', 'This will not expand: \n a newline', 'Variables do not $expand $either'); $patterns = array('~\\\'~', '~\\\\~'); $replacements = array('\\\\\'', '\\\\\\\\'); foreach($strings as $string) { echo '\'' . preg_replace($patterns, $replacements, $string) . '\'' . '&lt;/br&gt;'; } ?&gt; </code></pre> <p>The output is:</p> <pre><code>'this is a simple string' 'Arnold once said: "I\\'ll be back"' 'You deleted C:\\*.*?' 'You deleted C:\\*.*?' 'This will not expand: \\n a newline' 'Variables do not $expand $either' </code></pre> <p>but I would like to echo the strings exactly as they are listed in my code if possible. I am having trouble with double backslash characters (\). My second pattern ('~\\~') seems to replace both single and double backslashes. I also tried using addcslashes() with the same results.</p> <p>(I have asked this question elsewhere recently but without a solution)</p> <p>Thanks in advance.</p>
php
[2]
3,847,986
3,847,987
How to run a script in python
<p>I am new to python and have no previous programming experience. I want to run a script on python. I have read that I must write the script in a program like notepad++ and save it as a .py file. But what command do I use to run it after that? PLEASE HELP I have looked everywhere and I think the problem is that the question is too basic. I am on windows 7, running python 2.</p> <p>thanks and sorry if this is not enough information.</p>
python
[7]
5,075,265
5,075,266
date format convertion
<pre><code>string date = calarc.SelectedDate.ToString("MM/dd/yyyy"); </code></pre> <p>where calarc is calender control.</p> <p>It returns a date in 03-14-2009 format but i want it in 03/14/2009 format.</p> <p>so how do i do above?</p>
asp.net
[9]
2,308,273
2,308,274
App crashes when adding clickListener
<p>I have an app that is setting the contentView when images are clicked.This one from my main.xml loads the options.xml fine.</p> <pre><code>settings.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { setContentView(R.layout.options); } }); </code></pre> <p>But when I add a listener to an image that is inside the options.xml the app crashes upon launch.I am referencing the image via the code below and showing the clickListener I am adding.</p> <pre><code>//ReturnHome is inside options.xml //Adding this in my mainapp.java returnHome = (ImageView)findViewById(R.id.returnHome); returnHome.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { ***APP CRASHES EVERY TIME WHEN I ADD THIS**** } }); </code></pre> <p>Trying to see if there was an error thrown but LogCat does not seem to show anything.</p>
android
[4]
6,009,486
6,009,487
C#-like properties in native c++?
<p>In c# / .Net you can do something like this:</p> <pre><code>someThing.text = "blah"; String blah = someThing.text; </code></pre> <p>However the above code does not actually interact with the someThing's text String directly, it uses a get and set property.</p> <p>Similarly, read-only properties can be used.</p> <p>Is there a way to do something similar in native c++? (not c++ .net)</p> <p>Thanks</p>
c++
[6]
4,359,477
4,359,478
how make a selection glow and then off in uitableviewcell
<p>hi i have a problem with the selection when I select a row in uitableviewcell it selects and turns to blue with out making any animation i mean normally when a row in table is selected it turns into blue and go off immediately like an animation. How to achieve that? Not deslecting a row....it is like highlight the cell and go off when cell is selected by user...Can any one help please.... </p>
iphone
[8]
587,655
587,656
Copy from list to textarea but prevent duplicates
<p>I have this code, it helps to select values from a list and pass them to a textarea but, I don't want to duplicate in case accidentally pressing the same list value.</p> <p>Heres is what i got:</p> <pre><code>window.onload = btnsInit; function btnsInit() { var i, a = document.getElementById('btns').getElementsByTagName('a'); for (i = 0; i &lt; a.length; ++i) { a[i].onclick = btnClick; } } function btnClick(e) { document.getElementById('ta').value += '' + this.firstChild.nodeValue + '\n'; xPreventDefault(e); trim(); return false; } function xPreventDefault(e) { if (e &amp;&amp; e.preventDefault) e.preventDefault(); else if (window.event) window.event.returnValue = false; } </code></pre> <p>Any idea anyone?</p> <p>Thank's</p>
javascript
[3]
5,737,015
5,737,016
new DateTime() vs default(DateTime)
<p>Is there a reason to choose one of these over the other?</p> <pre><code>DateTime myDate = new DateTime(); </code></pre> <p>or</p> <pre><code>DateTime myDate = default(DateTime); </code></pre> <p>Both of them equal 1/1/0001 12:00:00 AM</p>
c#
[0]
1,697,009
1,697,010
The type or namespace name 'form2' could not be found (are you missing a using directive or an assembly reference?)
<pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 myform = new Form2(); myform.ShowDialog(); } } } </code></pre> <p>The following code should "launch" form2. They are in the same project, and have the same namespace. I don't understand. I have tried changing the .NET framework from version 4 client to version 4.</p> <p>Any other ideas?</p>
c#
[0]
4,047,350
4,047,351
Javascript IE7/IE8 Discrepancy
<p>When I use <code>document.getElementById('checkbox1').checked == true</code> in IE8 it does not work but works in IE7, any solutions please? </p> <pre><code>&lt;script language="Javascript" type="text/javascript"&gt; function swap(){ if(document.getElementById('checkbox1').checked == true ){ document.getElementById('captionrow1').style.display = "none"; document.getElementById('captionrow2').style.display = "inline"; document.getElementById('show').style.display = "inline"; if (location.href.indexOf("CheckBox1=1") == -1) location.href = "employees_commends1a.asp?CheckBox1=1"; } if(document.getElementById('checkbox1').checked == false ){ document.getElementById('captionrow1').style.display = "inline"; document.getElementById('captionrow2').style.display = "none"; document.getElementById('show').style.display = "none"; } } &lt;/script&gt; </code></pre>
javascript
[3]
1,116,669
1,116,670
Drag and Drop a card using the DragDrop method
<p>Below is my code for trying to drag a card from a picture box to a panel but it does not work. Can anyone please help me out. When you click on the card and try to move it the cursor changes(like when you select text and move it) but the card doesnt move and it doesnt display when you drop it on the panel.</p> <pre><code>private void Card_MouseDown(object sender, MouseEventArgs e) { Card.Card source = (Card.Card)(sender); DoDragDrop(source,DragDropEffects.Move); } private void panel1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(Card.Card))) { e.Effect = DragDropEffects.Move; } else { e.Effect = DragDropEffects.None; } } private void panel1_DragDrop(object sender, DragEventArgs e) { Card.Card dragCard = (Card.Card)sender; dragCard = (Card.Card)e.Data.GetData(typeof(Card.Card)); } </code></pre>
c#
[0]
5,066,367
5,066,368
Adding rows in matrix using java
<p>I have created a matrix in java using only loops. But I wanted to show the total of the row at the end. I have been trying to figure this out and I cannot come up with a solution. Any help would be appreciated.</p> <p>This is the code I have so far</p> <pre><code>public class Main { public static void main(String[] args) { int num = 4; int product = 0; for (int i = 1; i &lt;= num; i++) { for (int j = 1; j &lt;= num; j++) { product = j * i; System.out.printf("\t" + product); } System.out.println(); } } } </code></pre>
java
[1]
4,622,089
4,622,090
Windows form applciation - text Highlighting
<p>I am using a WFA which has a <em>ToolStripMenuItem</em> that is supposed to search for a word in a textBox and highlight it. This is the highlighting code.</p> <p>first = first index to be highlighted , length= number of characters to be highlighted.</p> <pre><code> textBox2.SelectionStart = first; textBox2.SelectionLength = length; //scroll to the caret textBox2.ScrollToCaret(); </code></pre> <p>everything seems to be working well. However, If the mouse cursor isn't inside textBox2 (say in another textBox). The highlighting doesn't work. Is there a way to make it work regardless of the position of the mouse cursor? in other words, is there a way to change my code to make it highlight the text in textBox2 even if the mouse cursor wasn't inside textBox2 before hitting the <em>ToolStripMenuItem</em>?</p> <p>Thanks!</p> <p>P.S. It's worth mentioning that I am using c# in VS 2010</p>
c#
[0]
2,325,700
2,325,701
Multiple value checks using 'in' operator (Python)
<pre><code>if 'string1' in line: ... </code></pre> <p>... works as expected but what if I need to check multiple strings like so:</p> <pre><code>if 'string1' or 'string2' or 'string3' in line: ... </code></pre> <p>... doesn't seem to work.</p>
python
[7]
2,707,900
2,707,901
send Email automatically when new data with specific criteria inserted
<p>I have website in the internet with many data in it. user search in data and filter it. user save that filtering criteria. i want send email notification automatically to that user when new data inserted in site that match with saved filtering criteria. <br/> i use asp.net and sql server 2008. i dont have dedicated server. is there any solution for me?</p> <p>best regards</p>
asp.net
[9]
5,400,921
5,400,922
iphone 4 higher resolution pics vs 3gs
<p>i just have a 3gs for testing (here in romania i still cant get a iphone 4)</p> <p>When I just create full screen images for iPhone 4 .. would they be displayed resized on the 3gs?</p> <p>I just cant make a bundle version for 3gs and 4 with 2 times my images, they are already a lot. Do I have to make now 2 Apps ??</p> <p>Could this be a trick: In my xib i define a 320x480 UIImageView (it will be resized automaticly on the iPhone4) when I there define "scale to fill" and make high resolution images, would they come more sharp on the iPhone 4?</p> <p>Now I am just wondering how to work best right now for big animations. thx</p>
iphone
[8]
2,681,003
2,681,004
Javascript replace with regular expression - Replace only part of string found
<p>I have a string that looks like the following:</p> <p><em>"01/11/2012 (Last, First) - Notes,02/11/2012 (Last, First) - More Notes,03/11/2012 (Last, First) - Even More Notes,09/12/2012 (Last, First) - You get the idea"</em></p> <p>I would like each note to fall on a new line by replacing any comma followed by a number with '\n'. </p> <p>I have tried <code>.replace(/,/g, '\n')</code> but I get a newline in the middle of the name.<br> So I do <code>.replace(/,\d/g, '\n')</code>, however then I loose the first number of the date.</p> <p>How can I search for ,# and replace it with \n# where the number is the same as it was previously?</p> <p>I want the result to look like this: </p> <pre><code>01/11/2012 (Last, First) - Notes 02/11/2012 (Last, First) - More Notes 03/11/2012 (Last, First) - Even More Notes 09/12/2012 (Last, First) - You get the idea </code></pre>
javascript
[3]
4,466,159
4,466,160
Splitting a string into words in Java
<p>Could you please assist me with the code for splitting this string. I am using <strong>"|"</strong> as a special character to mark how the splitting is to be done</p> <p>The string is "<strong>The|value|is|infinite</strong>" so that after splitting I have 'the','value','is' and 'infinite' as separate strings. Thank you.</p>
java
[1]
5,788,888
5,788,889
'too many values to unpack', iterating over a dict. key=>string, value=>list
<p>I am getting the <code>'too many values to unpack'</code> error. Any idea how I can fix this?</p> <pre><code>first_names = ['foo', 'bar'] last_names = ['gravy', 'snowman'] fields = { 'first_names': first_names, 'last_name': last_names, } for field, possible_values in fields: # error happens on this line </code></pre>
python
[7]
1,744,545
1,744,546
which one is better in printing out a function output in php?
<p>In PHP, i have a function that fetch some data from database and output them.<br> Which one is better ?</p> <ol> <li><p>store output in a variable, for example <code>$output</code> and <code>echo $output</code> at the end of the function </p> <p>OR </p></li> <li><p>echo data instead of putting in <code>$output</code>, this causes having more than one echo statement.</p></li> </ol>
php
[2]
1,177,065
1,177,066
jquery remote validation - async?
<p>Can someone explain the difference between setting <code>async = true</code> and <code>async = false</code> in the snippet below? I understand the concept of <code>asynchronous</code> (validating in the background) but don't understand what the implications are in form validation. </p> <pre><code>'data[orderPrefix]': { required: true, alphanum: true, remote: { url: site_url+"shops/validate", async: true, data: { task: function() { return $("#task").val(); }, shopID: function() { return $("#shopID").val(); } } } }, </code></pre> <p>I had a form where multiple fields have js validation (both standard and remote) and certain rules simply didn't catch invalid data. After changing async from false to true, everything works fine.</p> <p>The jquery docs don't really explain much regarding this and I want to understand why my changes "work".</p> <p>EDIT: I'm using 1.9 of the bassistance.de plugin with jquery 1.7.2. </p>
jquery
[5]
595,180
595,181
Writing a program to find out the sum of the negative elements and positive elements of the array
<p>My code runs well up until the point it is expected to return the result - it does not add up any of the values entered by the user. Any help please?</p> <pre><code>a = (prompt("a:")); b = (prompt("b:")); c = (prompt("c:")); negativeSum = Number(0); positiveSum = Number(0); var test = [a, b, c]; for (i = 0; i &lt; test.length; i++) { if (isNaN(test[i])) { alert(test[i] + " : incorrect input."); } else if (test[i] &lt; 0) { alert(test[i] + " : positive.") negativeSum = Number(test[i]++); } else { alert(test[i] + " : positive.") positiveSum = Number(test[i]++); } } alert(positiveSum + " : sum of +ve elements"); alert(negativeSum + " : sum of -ve elements"); </code></pre>
javascript
[3]
1,694,473
1,694,474
For loop of an array
<p>I want to make check of array by using <strong>for</strong> loop. The check is if selected value display it also display its index.</p>
php
[2]
4,288,045
4,288,046
Is modern C++ becoming more prevalent?
<p>When I first learned C++ 6-7 years ago, what I learned was basically "C with Classes". <code>std::vector</code> was definitely an advanced topic, something you could learn about if you <em>really</em> wanted to. And there was certainly no one telling me that destructors could be harnessed to help manage memory. Today, everywhere I look I see RAII and <a href="http://en.wikipedia.org/wiki/Substitution%5Ffailure%5Fis%5Fnot%5Fan%5Ferror">SFINAE</a> and STL and Boost and, well, Modern C++. Even people who are just getting started with the language seem to be taught these concepts almost from day 1.</p> <p>My question is, is this simply because I'm only seeing the "best", that is, the questions here on SO, and on other programming sites that tend to attract beginners (gamedev.net), or is this actually representative of the C++ community as a whole?</p> <p>Is modern C++ really becoming the default? Rather than being some fancy thing the experts write about, is it becoming "the way C++ just is"? Or am I just unable to see the thousands of people who still learn "C with classes" and write their own dynamic arrays instead of using <code>std::vector</code>, and do memory management by manually calling new/delete from their top-level code?</p> <p>As much as I want to believe it, it seems incredible if the C++ community as a whole has evolved so much in basically a few years. What are your experiences and impressions?</p> <p>(disclaimer: Someone not familiar with C++ might misinterpret the title as asking whether C++ is gaining popularity versus other languages. That's not my question. "Modern C++" is a common name for a dialect or programming style within C++, named after the book "<a href="http://rads.stackoverflow.com/amzn/click/0201704315">Modern C++ Design: Generic Programming and Design Patterns Applied</a>", and I'm solely interested in this versus "old C++". So no need to tell me that C++'s time is past, and we should all use Python ;))</p>
c++
[6]
2,528,293
2,528,294
How do I create an HTML template that I can copy dynamically?
<p>What's the correct way to do the (pseudo) following:</p> <pre><code>&lt;div id="myTemplate"&gt; &lt;div id="child1"&gt;&lt;/div&gt; &lt;span id="child2"&gt;&lt;/span&gt; &lt;/div&gt; &lt;script&gt; var templateCopy = document.getElementById("myTemplate") var copy1 = document.createElementFromTemplate(templateCopy); document.appendChild(copy1); &lt;/script&gt; </code></pre> <p>TIA</p>
javascript
[3]
3,903,048
3,903,049
How To create On/off button in Javascript
<p>I am newbie so this question may be sound stupid. I want to load a javascript function using <code>&lt;body onload="function()"&gt;</code> but i want to handle this event through on/off switch so if the switch is on(by default) the "onload" event will call the function and if the switch is set to off it will not. Thanks in advance!</p>
javascript
[3]
3,334,807
3,334,808
How to create a "virtual device environment" in Java to work with multiple monitors?
<p>The method getScreenDevices() of GraphicsEnvironment must return a list of GraphicsDevice in my system. How can I configure my system to work with these GraphicsDevice, beforehand?</p>
java
[1]
4,152,959
4,152,960
Is Intent.ACTION_SEND a valid intent protocol for startActivityForResult()?
<p>I want the users of my app to be able to send an email and then return to my app.</p> <p>I've implemented this feature like below</p> <pre><code>Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL , new String[]{"test@gmail.com"}); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Message subject"); emailIntent.putExtra(Intent.EXTRA_TEXT , "Message text"); try { startActivityForResult(Intent.createChooser(emailIntent, "Send mail..."), 42); } catch (android.content.ActivityNotFoundException ex) { Toast toast = Toast.makeText(getApplicationContext(), "There are no email clients installed.", Toast.LENGTH_SHORT); toast.show(); } </code></pre> <p>I have tested the implementation on a HTC Sensation, and it works fine, at least when selecting the Gmail app.</p> <p>My problem is this section in the documentation for startActivityForResult() "Note that this method should only be used with Intent protocols that are defined to return a result. In other protocols (such as ACTION_MAIN or ACTION_VIEW), you may not get the result when you expect. For example, if the activity you are launching uses the singleTask launch mode, it will not run in your task and thus you will immediately receive a cancel result."</p> <p>I have searched for a list of intent protocols that is intended to be used from startActivityForResult() but havent found any.</p> <p>Is there such a list?</p> <p>Is it OK to use Intent.ACTION_SEND from startActivityForResult()? Can I expext the same behavior on all devices?</p> <p>Thanks</p> <p>/Mathias</p>
android
[4]
75,505
75,506
Force parameter evaluation for anonymous function
<p>I wonder if there's easy way to force parameter evaluation for anonymous function? It is significant </p> <p>for multithread programming. For example when i wrote</p> <pre><code> for(int i=0; i&lt;5; ++i) { Task.Factory.StartNew(() =&gt; Console.WriteLine(i)); } </code></pre> <p>Most people would get "5" five times. In fact the code snip is more likely expected to ouput 0 to 5.</p> <p>One quick solution is following:</p> <pre><code> for(int i=0; i&lt;5; ++i) { var local = i; Task.Factory.StartNew(() =&gt; Console.WriteLine(local)); } </code></pre> <p>I think life is better if following method existed to evaluate all parameters for anonymous function and return one as same logic as the origin:</p> <pre><code> Action EvaluateParameters(Action action) </code></pre> <p>Any ideas?</p> <p>Thanks.</p>
c#
[0]
2,861,897
2,861,898
to insert() or to make new
<p>I'm writing some code that has a lot of substitution.</p> <p>There's a <b>list&lt;char&gt; productions</b> which has a bunch of characters in it.</p> <p>I repeatedly need to replace every character in <b>productions</b> with the rules corresponding to it in a <b>map&lt;char,char*&gt; productionRules</b>. So every character in <b>productions</b> might be replaced by zero or more characters as indicated by <b>productionRules</b>.</p> <p>I'm thinking there's 2 ways to do it:</p> <ol> <li><p>iterate over <b>productions</b> and .insert() all replacement characters in <b>productions</b> before <a href="http://stackoverflow.com/questions/1038708/erase-remove-contents-from-the-map-or-any-other-stl-container-while-iterating#1038757">.erase()'ing</a> each element</p></li> <li><p>Create a NEW <b>list&lt;char&gt; newProductions</b> then reassign productions to refer to <b>newProductions</b>.</p></li> </ol> <p>Which is better? To .insert() and .erase() a whole lot or to just create a new one?</p>
c++
[6]
631,143
631,144
ThreadPool.QueueUserWorkItem Error when run method in separate thread in c# 2.0
<p>i got a code to invoke any method through thread.</p> <pre><code>System.Threading.ThreadPool.QueueUserWorkItem(Export()); </code></pre> <p>here i tried to run Export() method through thread and got compilation error. what is wrong in the code. i am using c# 2.0 version. please help. </p>
c#
[0]
215,158
215,159
How to use arrays in addding numbers?
<p>Hey Can anyone tel me how to use arrays in Android.I need to add the numbers given by the user...Pls help me</p>
android
[4]
2,776,945
2,776,946
Is there a way to check a function's signature in Python?
<p>I'm looking for a way to check the number of arguments that a given function takes in Python. The purpose is to achieve a more robust method of patching my classes for tests. So, I want to do something like this:</p> <pre><code>class MyClass (object): def my_function(self, arg1, arg2): result = ... # Something complicated return result def patch(object, func_name, replacement_func): import new orig_func = getattr(object, func_name) replacement_func = new.instancemethod(replacement_func, object, object.__class__) # ... # Verify that orig_func and replacement_func have the # same signature. If not, raise an error. # ... setattr(object, func_name, replacement_func) my_patched_object = MyClass() patch(my_patched_object, "my_function", lambda self, arg1: "dummy result") # The above line should raise an error! </code></pre> <p>Thanks.</p>
python
[7]
4,657,131
4,657,132
ListFragment Selected Item
<p>i have a ListView on a ListFragment that use SimpleCursorAdapter to generate my list. i wanted to highlight selected item in my ListView, i've tried :</p> <pre><code>v.setBackgroundResource(R.color.listselect_light_blue); </code></pre> <p>in onListItemClick but it works odd and it selects two row when i click one of items and i want it to be single , i also set Choice Mode</p> <pre><code>&lt;ListView android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:choiceMode="singleChoice" android:cacheColorHint="#00000000" /&gt; </code></pre> <p>i've tried ListSelector but when i click on an item it doesn't highlight until i scroll the list and it turn highlighted.</p> <pre><code>@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); getListView().setSelector(R.drawable.listview_selector); } </code></pre> <p>and : </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_focused="false" android:drawable="@color/listselect_light_blue" /&gt; &lt;/selector&gt; </code></pre> <p>any help would be appreciated</p>
android
[4]
5,567,322
5,567,323
how to configured nfc in blackberry 10 simulator
<p>there is no option for NFC in blackberry10 simulator, so can anyone please tell me how to configured NFC in blackberry10 simulator so that i can view the option for NFC inside the network and connection option in settings.</p>
java
[1]
5,919,095
5,919,096
How to scroll programatically a ScrollView?
<p>I have a little problem with a ScrollView.</p> <p>I have a layout for an activity which is made with a ScrollView. This scrollview contains two ListViews.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; </code></pre> <p> </p> <pre><code> &lt;ListView android:id="@+id/accountsListView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" /&gt; &lt;ListView android:id="@+id/cardsListView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollbars="none" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>In onCreate method of my activity I compute ListViews height according there contents.</p> <p>During execution, on activity launch, ScrollView is already scrolled a bit.</p> <p>So I tried, at the end of onCreate to call method scrollTo(0, 0), but it does not change anything.</p> <p>Any idea ?</p> <p>Regards, Quentin</p>
android
[4]
1,922,933
1,922,934
running several system commands in parallel
<p>I write a simple script that executes a system command on a sequence of files. To speed things up, I'd like to run them in parallel, but not all at once - i need to control maximum number of simultaneously running commands. What whould be the easiest way to approach this ?</p>
python
[7]
5,109,240
5,109,241
Invoking one application in the other
<p>I have one solution with web forms approach (soln1) and the other one in MVC 2.0 (soln2). On a page page1.aspx in soln1, I want to render soln2. I used iFrame and in src atribute, I provided starting URL of soln2. Is there any other approach to this? Basically I dont want to use iFrame because of some styling issues.</p> <p>Thanks</p>
asp.net
[9]
234,744
234,745
How to navigate to nested PreferencesScreen
<p>in my app I have nested PreferencesScreen's</p> <pre><code>&lt;PreferencesScreen&gt; &lt;PreferencesScreen android:key="application"&gt; &lt;/PreferencesScreen&gt; &lt;/PreferencesScreen&gt; </code></pre> <p>Now I want to fire <code>Intent</code> to take me from currrent <code>Activity</code> directly to application preferences subscreen. How can I do this?</p>
android
[4]
5,263,912
5,263,913
The type or namespace name 'DefaultTemplateLexer' could not be found
<p>The official tutorial from <a href="http://www.antlr.org/wiki/display/ST/Five+minute+Introduction" rel="nofollow">http://www.antlr.org/wiki/display/ST/Five+minute+Introduction</a> doesn't work because of DefaultTemplateLexer, how to fix ?</p> <pre><code>using System; using Antlr.StringTemplate; class Script { static public void Main(string[] args) { StringTemplateGroup group = new StringTemplateGroup("myGroup", @"C:\Tutorials\stringtemplate", typeof(DefaultTemplateLexer)); StringTemplate helloAgain = group.GetInstanceOf("homepage"); helloAgain.SetAttribute("title", "Welcome To StringTemplate"); helloAgain.SetAttribute("name", "World"); helloAgain.SetAttribute("friends", "Terence"); helloAgain.SetAttribute("friends", "Kunle"); helloAgain.SetAttribute("friends", "Micheal"); helloAgain.SetAttribute("friends", "Marq"); Console.Out.WriteLine(helloAgain.ToString()); } } </code></pre>
c#
[0]
5,399,646
5,399,647
Syntax Question IF ELSE (Java)
<p>what is the java syntax for saying</p> <p>if x is not equal to a or b </p> <p>I am trying to write an if else statement .. if a certain value is not equal to say 2 or 3 then do something else do something else :) thats confusing lol</p>
java
[1]
224,620
224,621
Problem with applicationShouldTerminate on iPhone
<p>I'm having a problem with applicationShouldTerminate.</p> <p>What ever I do it seams that has no effect. Any help would be appreciated.</p> <p>I'm well versed in programing but this just gives me headache. Im going over some basic tutorials for xcode , as I'm new to mac in general, and am currently looking at a simple flashlight app.</p> <p>It exists but I would like to add a alert box here with option not to quit.</p> <pre><code>(void)applicationWillTerminate:(UIApplication *)application { [application setIdleTimerDisabled:NO]; } </code></pre> <p>this has no effect, alert is closed even before its created.</p> <pre><code>(void)applicationWillTerminate:(UIApplication *)application { [application setIdleTimerDisabled:NO]; UIAlertView *alertTest = [[UIAlertView alloc] initWithTitle:@"This is a Test" message:@"This is the message contained with a UIAlertView" delegate:self cancelButtonTitle:@"Button #1" otherButtonTitles:nil]; [alertTest addButtonWithTitle:@"Button #2"]; [alertTest show]; [alertTest autorelease]; NSLog(@"Termination"); } </code></pre> <p>I did some reading online and found that it should be possible to do this with</p> <pre><code>(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender </code></pre> <p>But no mater where I put that declaration I get error: syntax error before NSApplicationTerminateReply.</p> <p>There is no syntax error except that xcode seems not to recognize NSApplicationTerminateReply as valid input. </p> <p>Any sample code would be greatly appreciated. </p>
iphone
[8]
5,720,327
5,720,328
Javascript: how to map a var to a function under jquery? (Resolved)
<p>I'm tweaking an existing open source tool...</p> <p>Its current js code has the following line, that opens up a new window to dump output, and the user takes an action or not.</p> <pre><code>var win = window.open(...); </code></pre> <p>What I'd like to do is to redirect the var win ... part so that it would send the {data} via a FORM element and let a web server script to process it,</p> <p>My following attempt failed without error</p> <pre><code>// var data is known // page that calls/includes the js code has a FORM with a field // named 'workspace' win = function() { document.forms[0].getElementById('workspace').value='+data+'; document.forms[0].action = "serverSideScript2processData"; document.forms[0].method = "post"; document.forms[0].submit(); } </code></pre> <p>Also, the current javascript uses jquery.</p> <p>How to do it?</p> <p>Thanks. </p>
javascript
[3]
4,678,107
4,678,108
connect switches to audio input-software/firmware
<p>We need to connect buttons to the iphone audio jack, so they can control our apps. I know the apple headphones has 3 buttons,so it can be done somehow.</p> <p>I couldnt find anyone who did that / any example or something about that, but i know there are so many products that connects to audio jack and control things.</p> <p>so any hardware explanation / xcode examples would be good .</p> <p>I think the switches are just a short between 2 points that software can detect. any help ?</p> <p>Can i do audio input simulation on xcode via the mac audio jack ??</p>
iphone
[8]
2,364,259
2,364,260
Is this function's use of vector useless?
<p>I saw this earlier and it doesn't make any sense to me:</p> <pre><code>void generate(std::vector&lt;float&gt; v) { float f = generate_next_float(); v.push_back(f); } </code></pre> <p>If <code>v</code> was sent as a reference or a pointer, that would make sense. But instead it is sent by value, and therefore copied into the function, right? So anything done to <code>v</code> is immediately useless once the function terminates this <code>v</code> is out of scope, deleted. </p> <p>Am I right?</p> <p>That is, the function <code>generate_next_float()</code> might do something, so not useless, but the use of the <code>vector</code> here seems pointless. <code>f</code> does not depend on it, and nothing is returned.</p>
c++
[6]
3,771,006
3,771,007
string replace with exception on certain strings
<p>I have this line of code that I'm using to prepare some CSS file:</p> <pre><code>TheMinifiedCSS = TheMinifiedCSS.Replace("white", "#FFF"); </code></pre> <p>The problem is that in CSS, I have this declaration:</p> <pre><code>.SomeClass{white-space:pre-wrap;} </code></pre> <p>How do I change the <code>.Replace</code> statement to replace <code>white</code> with <code>#FFF</code> but to leave <code>white-space</code> alone?</p> <p>Thanks.</p> <p>Note, I know I can add <code>TheMinifiedCSS = TheMinifiedCSS.Replace("#FFF-space", "white-space");</code> but I'm looking for something cleaner.</p>
c#
[0]
3,261,212
3,261,213
android how to select the some part of the photo (crop in different types /different shapes)
<p>I want to know how to select different shapes selection of image. When i am cropping the image it is only accepting the rectangle/square shape model not more than that. i want to accept the in different shapes. is there is any way? Thanks in advance</p>
android
[4]
5,723,504
5,723,505
Unsetting an enum flag
<p>Consider</p> <pre><code> [Flags] public enum State { IsCool = 0x1, SomethingElse = 0x2 } </code></pre> <p>I have a <code>State someState</code> and if some expression evaluates to true, I want to unset the <code>IsCool</code> flag of <code>someState</code> <em>regardless</em> of it being already set or unset. This means that I can't really use <code>someState ^= State.IsCool</code> but what can I use instead?</p>
c#
[0]
4,979,978
4,979,979
How to get the list of running applications?
<p>I am working on an app which needs the information of the apps running at the system up to now. Is there an API/method to retrieve that kind of information?</p>
android
[4]
5,808,929
5,808,930
Prepare statement for byte [] in java
<p>I have one database table in which one column (declatationform) is of type "bytea" i want to store images in this column so i have return one method which is </p> <pre><code>public void uploadRentProofDeclaration(final MultipartFile declarationForm, final int rentProofInfoId, int year) { String updateSql = "update plit_landlordinfo" + year + " set filename=?,declarationform=? where cid=?"; getJdbcTemplate().execute(updateSql, new PreparedStatementCallback() { public Object doInPreparedStatement( final PreparedStatement pSstatement) throws SQLException, DataAccessException { pSstatement.setString(1, declarationForm.getOriginalFilename()); try { pSstatement.setBinaryStream(2, new ByteArrayInputStream( declarationForm.getBytes()), declarationForm .getBytes().length); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } pSstatement.setInt(3, rentProofInfoId); pSstatement.execute(); return null; } }); } </code></pre> <p>Here what is happening is file name is getting save but byte [] is not save still that column is blank in my table and it is not giving any error can any one help me what is the problem</p>
java
[1]
3,645,398
3,645,399
How to do: Shake your iphone to refresh feature
<p>I want to know, how to implement shake to refresh feature. For example, facebook app, they dont have refresh button, on shaking the phone it refreshes the data.</p> <p>i want to include it in my app. but i dont know what is the name for this feature and how to implement it.</p> <p>can any one help me with this. </p> <p>thanks</p>
iphone
[8]
4,267,376
4,267,377
Simple PHP strpos function not working, why?
<p>Why isn't this standalone code working:</p> <pre><code>$link = 'https://google.com'; $unacceptables = array('https:','.doc','.pdf', '.jpg', '.jpeg', '.gif', '.bmp', '.png'); foreach ($unacceptables as $unacceptable) { if (strpos($link, $unacceptable) === true) { echo 'Unacceptable Found&lt;br /&gt;'; } else { echo 'Acceptable!&lt;br /&gt;'; } } </code></pre> <p>It's printing acceptable every time even though https is contained within the $link variable.</p>
php
[2]
5,190,161
5,190,162
How to call methods of another Activity
<p>I am using 3 classes A, B and C. In class A I created a method clickButton() and In class B I used onClick() for a button. while clicking on the button it has to call the method clickButton() in Class A, and inside the clickButton() i wrote intent for initiating the class C. </p> <p>The problem is I couldn't able to call the Class A method in class B.</p>
android
[4]
3,739,682
3,739,683
jQuery test for whether an object has a method?
<p>Is it possible to test whether a jQuery object has a particular method? I've been looking, but so far without success. Thanks!</p>
jquery
[5]
5,384,270
5,384,271
How can I display and use the android default search field within my android app?
<p>I have an android app which needs a search feature. So I was thinking instead of creating a new layout with an editext, a button, and a listview, why not use the android default search field for searching within my app. I've seen it being implemented in other android apps.</p> <p>For example, let's say I've my android app running on my phone and when I press the search button on my phone, I want my app to open the android built-in search field from the top. And when I enter a search string It would search through some string-arrays and list them using a listview. My first challenge is to have the built-in search field slide open from the top just like any menu slide open from the bottom.</p> <p>THanks.</p>
android
[4]
1,468,240
1,468,241
Session Regeneration
<p>I have some confusion with session handling in PHP. I know how to regenerate new session ID in PHP using <code>session_regenerate_id();</code>, but I don't understand why and when I should regenerate a new session ID.</p> <p>I have been googling for some time without avail. No one explains why I need to regenerate a new session ID.</p> <p>Can someone explain why and when I would need to regenerate a new session ID?</p>
php
[2]
3,294,658
3,294,659
To pass parameters to Result handler function in javascript
<p>I am making <code>XMLHttpRequest</code> to call Google search API URL. And on getting the response I want to call another result Handling function. But I also want to pass the parameter to it.</p> <pre><code>request = new XMLHttpRequest(); if(request) { var url = "http://localhost:8080/final_project/SearchService"; url += "?user_query=" + getQueryString(); request.onreadystatechange = handleSearchResult; request.open("GET", url, true); request.send(null); } </code></pre> <p>Here <code>handleSearchResult</code> is <code>resultHandler</code> and I want to pass parameter to this function. But if I do so the function gets called directly.</p> <p>What can be done to solve this problem?</p>
javascript
[3]
5,171,132
5,171,133
Android Webview for videosteams?
<p>I am using a webview to connect to an ip camera. It works when I need snapshots , but i get a white screen when I try to get videostreams. I tried .getPlugins as well. What could be the possible reason?</p> <pre><code>mWebView = (WebView) findViewById(R.id.webView1); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("http://&lt;ipaddress&gt;/videostream.cgi?user=&amp;pwd="); </code></pre>
android
[4]
5,138,820
5,138,821
Plz help, I'm stuck with @SuppressLint("NewApi") (developer.android.com/training/basics/firstapp/starting-activity)
<p>I'm a begginer with Android and currently stuck with the lession: <a href="http://developer.android.com/training/basics/firstapp/starting-activity.html" rel="nofollow">http://developer.android.com/training/basics/firstapp/starting-activity.html</a></p> <p>In the part <strong>Create the Second Activity</strong>, when I try to use the code:</p> <pre><code>public class DisplayMessageActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Make sure we're running on Honeycomb or higher to use ActionBar APIs if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { // Show the Up button in the action bar. getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } </code></pre> <p>I get the error below:</p> <p><strong>@SuppressLint("NewApi")</strong> -> The attribute value is undefined for the annotation type SuppressLint.</p> <p>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.<strong>HONEYCOMB</strong>) -> HONEYCOMB cannot be resolved or is not a field.</p> <p><strong>getActionBar</strong>().setDisplayHomeAsUpEnabled(true); -> The method getActionBar() is undefined for the type DisplayMessageActivity.</p> <p><strong>NavUtils</strong>.navigateUpFromSameTask(this); -> NavUtils cannot be resolved</p> <p>Someone let me know how to solve? Here is what I imported:</p> <pre><code>import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.view.MenuItem; </code></pre> <p>Many thanks!</p>
android
[4]
2,212,906
2,212,907
Select an element by its index without jquery
<p>I have nothing but only this useless code:</p> <pre><code>document.getElementsByClassName('dynamic_area').index(input+4); </code></pre> <p>What is my mistake?</p> <p>Important:</p> <ul> <li><p>Don't use jQuery,</p></li> <li><p><code>input</code> is a variable</p></li> </ul>
javascript
[3]
2,006,669
2,006,670
how to use android mobile like emulator means how to connect my mobile via usb and run app. on it
<p>I want to run an android application on my mobile. If it works on the emulator, then how would I connect my mobile via usb and make it work like the emulator out put?</p>
android
[4]
4,660,211
4,660,212
c# add new namespace to project
<p>How can I add a namespace to a c# project? I am a beginner.</p> <pre><code>if(!string.IsNullOrEmpty(result)) { CoderBuddy.ExtractEmails helper = new CoderBuddy.ExtractEmails(result); EmailsList = helper.Extract_Emails; } </code></pre> <p>My Form1 needs to use the namespace below:</p> <pre><code>// this is the file that I need to add using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Coderbuddy { public class ExtractEmails { private string s; public ExtractEmails(string Text2Scrape) { this.s = Text2Scrape; } public string[] Extract_Emails() { string[] Email_List = new string[0]; Regex r = new Regex(@"[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}", RegexOptions.IgnoreCase); Match m; //Searching for the text that matches the above regular expression(which only matches email addresses) for (m = r.Match(s); m.Success; m = m.NextMatch()) { //This section here demonstartes Dynamic arrays if (m.Value.Length &gt; 0) { //Resize the array Email_List by incrementing it by 1, to save the next result Array.Resize(ref Email_List, Email_List.Length + 1); Email_List[Email_List.Length - 1] = m.Value; } } return Email_List; } } } </code></pre>
c#
[0]
1,019,162
1,019,163
jQuery message box close timeout
<p>I'm using a jQuery message box plugin from <a href="http://jquerymsgbox.ibrahimkalyoncu.com/" rel="nofollow">jquerymsgbox</a>. What I'm trying to do is to display a message box and close it automatically using timeOut = 30sec.</p> <pre><code>$.msgBox({ title: "Ooops", content: "Ohh dear! You broke it!!!", type: "error", showButtons: false, opacity: 0.9, timeOut:30000 }); </code></pre> <p>The code posted isn't working. I'm just a beginner and don't know what to do.</p>
jquery
[5]
4,162,142
4,162,143
Using existing cookies from outside the browser
<p>Ii want to download a file from site that need to be log-in. </p> <p>So i think if i use my browser to log-in and store cookie on hdd.</p> <p>Is it possible to download file with that cookie ?</p> <p>(its impossible to get cookie with program, anti-bot, etc)</p>
c#
[0]
1,806,077
1,806,078
Java ACM JTF Package
<p>I have a doubt in the below piece of code. I wanted to know why does the code compile and run correctly even though main method is not present?</p> <pre><code>import acm.program.*; public class HelloConsole extends ConsoleProgram { public void run() { println("hello, world"); } } </code></pre> <p>Thanks.</p>
java
[1]
3,053,603
3,053,604
Why there is no method to get Resource Name from Drawable object
<p>To create Drawable object from any resource we can use the following code (my image name is arrow_selected.png)</p> <pre><code>Drawable d =getResources().getDrawable(R.drawable.arow_selected); </code></pre> <p>But later in the application I want to get the resource name from this drawable object. I didnot find any method to get resource name like the following</p> <pre><code>d.getResourceName(); </code></pre> <p><strong>Why there is no such method in android API.</strong> <strong>How can I get Resource Name from Drawable object?</strong></p>
android
[4]
2,851,874
2,851,875
Does Thread.sleep() make the execution to cease for accurate an interval
<p>Here is my code</p> <pre><code>try{ System.out.println("Before"); thread.sleep(10000);//sleep for 10000 ms System.out.println("After"); } catch(ItrerruptedException ie){ //If this thread was intrrupted by nother thread } </code></pre> <p>I just want to know whether the thread will sleep for exaclty 10 seconds and then print <code>After</code> or there is some delay?</p>
java
[1]
105,753
105,754
how to capture the clear event when clear button is pressed in notification bar in android
<p>HI, in Android when the clear button is pressed on the notification screen i want to capture that in my application and do some stuff. please help me in how to achieve this.</p>
android
[4]
2,967,912
2,967,913
What is causing this behavior, in our C# DateTime type?
<pre><code>[Test] public void Sadness() { var dateTime = DateTime.UtcNow; Assert.That(dateTime, Is.EqualTo(DateTime.Parse(dateTime.ToString()))); } </code></pre> <p>Failed :</p> <pre><code> Expected: 2011-10-31 06:12:44.000 But was: 2011-10-31 06:12:44.350 </code></pre> <p>I wish to know what is happening behind the scenes in ToString() etc to cause this behavior.</p> <p>EDIT After seeing Jon's Answer :</p> <pre><code>[Test] public void NewSadness() { var dateTime = DateTime.UtcNow; Assert.That(dateTime, Is.EqualTo(DateTime.Parse(dateTime.ToString("o")))); } </code></pre> <p>Result :</p> <pre><code>Expected: 2011-10-31 12:03:04.161 But was: 2011-10-31 06:33:04.161 </code></pre> <p>Same result with capital and small 'o' . I'm reading up the docs, but still unclear.</p>
c#
[0]
5,587,076
5,587,077
What does *array[] mean?
<p>What does this mean? I see it all the time in programs and I don't get it:</p> <pre><code>int *array[9]; </code></pre> <p>Why is the asterisk there. What is the difference between this declaration and this:</p> <pre><code>int array[9]; </code></pre>
c++
[6]
3,783,985
3,783,986
error_reporting in PHP 4 and PHP 5
<p>I migrated my website from PHP 4.4 to PHP 5.2 The error_reporting level in both cases is E_ALL. On PHP 4 the site was working fine but after migrating to PHP 5 i found that one page is throwing error. <strong>Cannot redeclare ClassName:varName</strong> I found that the variable was indeed re declared in the file. I want to know that why it was working in PHP4.4 Does PHP 4 E_ALL not include "class variable redeclare errors"? </p>
php
[2]
3,036,956
3,036,957
Android auto installation
<p>We want to install our application on to (thousands of)phones and these phones will be later delivered to clients. Do we have to do this manually? Is there a faster way to do this? </p> <p>For example, in Windows Mobile, if you put your installation files in a certain folder on SD card and when you insert that SD card to the phone the app is installed automatically to the device. Any similar mechanism on Android?</p> <p>Thanks in advance.</p>
android
[4]
5,576,978
5,576,979
jQuery Firebug console output question
<p>Here is the contradictory output printed by jQuery in the Firebug console, when I was doing some debugging on a page that did not behave the way I had intended:</p> <pre><code>&gt;&gt;&gt; $("input.rtnBtn") null &gt;&gt;&gt; $('rbtn_4') &lt;input id="rbtn_4" class="rtnBtn" type="submit" value="Rate" name="rate4"&gt; </code></pre> <p>as can be seen from the above, $("input.rtnBtn") is not finding anything - whilst the element with id 'rbtn_4' should clearly have been matched. Am I missing a trick here?</p> <p>As an aside, although I am matching by class (because the id is generated at runtime), there is only one instance on the page - so I don't understand why jQuery can't match the element. Any ideas?</p>
jquery
[5]
3,424,904
3,424,905
useing __FILE__ and locating root folder in php ? how do i do this?
<p>lets say we have a directory.</p> <p>project/index.php</p> <p>in index.php</p> <pre><code>&lt;?php require 'config/config.php'; echo ROOTPATH; ?&gt; </code></pre> <p>project/config/config.php</p> <pre><code>&lt;?php define('ROOTPATH', rtrim(dirname(__FILE__), '\\/')); ?&gt; </code></pre> <p>it will return like D:\Project Storage\Web Projects\www\project\config.</p> <p>question:</p> <ol> <li><p>is there an easy way to get the rootpath without puting it on the project folder ? ( i know this is supid but i cant stand to ask )</p></li> <li><p>is there a way to get the \project\ ( root folder ) ? even if we change the folder location ?</p></li> </ol> <p>Thanks</p> <p>Adam Ramadhan</p> <p>ps* please leave a comment if you dont understand what i mean.</p>
php
[2]
1,361,820
1,361,821
What's the logic flaw in this conditional?
<p>I've created this code branch so that if the permalink settings do no match at least one of the OR conditions, I can execute the "do something" branch. However, I believe there is a flaw in the logic, since I've set permalinks to /%postname%.html and it still tries echo's true;</p> <p>I believe I need to change the ORs to AND, right?</p> <pre><code>if (get_option('permalink_structure') !== "/%postname%/" || get_option('my_permalinks') !== "/%postname%/" || get_option('permalink_structure') !== "/%postname%.html" || get_option('my_permalinks') !== "/%postname%.html")) { //do something echo "true"; } </code></pre>
php
[2]
3,432,920
3,432,921
Fetching columns from DB and creating an HTML table with the retrieved data in PHP
<p>I have a table in database namely 'reg' with columns date and name. I want to select the name column and month_name and year from date column and create a corresponding html table with columns (serial number, name, month, year). How do I do this in PHP?</p>
php
[2]
2,908,236
2,908,237
javascript's substr strange behaviour?
<p>I need to extract the date from json : </p> <pre><code>/Date(1224043200000)/ </code></pre> <p>I <a href="http://stackoverflow.com/questions/206384/how-to-format-a-json-date">saw</a> That I can do it by : </p> <pre><code>var date = new Date(parseInt('/Date(1224043200000)/'.substr(6))); ^ | ------------------------------0123456 </code></pre> <p>But how does <code>substr</code> knows to ignore the last chars ? [)/]</p> <p>I've searched at <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr" rel="nofollow">mdn</a> , but couldn't find the documented behaviour.</p>
javascript
[3]
5,573,464
5,573,465
asp.net page closed before response sent
<p>What happens if a long running page is closed by the user before he has received a response?</p> <p>Does the page continue to run in the it's thread or is the thread terminated as soon as the user closes the page?</p>
asp.net
[9]