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
3,718,155
3,718,156
Reverse IP Lookup with Python
<p>How can I lookup all hosts hosted on an IP Address? I have checked Bing's API, but I don't think they provide free API key anymore to make a query with an IP Address. Google probably would block after searching first 2-3 pages. I was also looking at the <a href="http://docs.shodanhq.com/python/reference.html" rel="nofollow">shodanhq api</a>, but I think shodan doesnt support a reverse lookup! </p> <p>I am using python 2.7 on Windows.</p>
python
[7]
1,695,204
1,695,205
UINavigationcontroller at the bottom of UIViewcontroller to hold multiple views
<p>In the appDelegate.m i have created <code>navigationController</code> <code>initWithRootviewcontroller</code> so that when my application launches <code>UIViewController</code> loads with <code>navigationController</code> and i want to display this <code>navigationBar</code> of the <code>navigationController</code> at the bottom of the <code>UIViewController</code>. But with this code it is showing at the top eventhough defined the frame.</p> <pre><code> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController *myViewController = [[MainViewController alloc] init]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController]; navigationController.navigationBar.tintColor = [UIColor blackColor]; [navigationController.navigationBar setFrame:CGRectMake(0, 435, 320,25)]; _window.rootViewController = navigationController; [_window makeKeyAndVisible]; return YES; } </code></pre> <p>Anyone knows how to show navigationcontroller at the bottom of the <code>UIViewController</code>.</p> <p>Thanks for help.</p>
iphone
[8]
1,112,916
1,112,917
Determining audioformat of audio files in Android
<p>Is there a way to determine the audio format of an audio file in Android? On normal java I do it like this:</p> <pre><code>File file= new File(...); AudioInputStream stream = AudioSystem.getAudioInputStream(file); AudioFormat format= stream.getFormat(); </code></pre>
android
[4]
5,287,290
5,287,291
Are the -client and -server command line options ignored in java7 JRE?
<p>I've installed java7 jre: java -version</p> <blockquote> <p>java version "1.7.0_02"</p> <p>Java(TM) SE Runtime Environment (build 1.7.0_02-b13)</p> <p>Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)</p> </blockquote> <p>I want to test if the -server option works in the JRE. That seems to be the default on my machine. I also want to check if both the -server and the -client options are supported. So I wrote the following program:</p> <pre><code>public class Info { public static void main(String... args) { System.out.println(System.getProperty("java.vm.name")); System.out.println(System.getProperty("java.vm.version")); System.out.println(System.getProperty("java.vm.info")); } } </code></pre> <p>If I issue the command java -client -cp e:\temp Info from the jre7\bin installation folder the program prints:</p> <blockquote> <p>Java HotSpot(TM) 64-Bit Server VM</p> <p>22.0-b10</p> <p>mixed mode</p> </blockquote> <p>It prints the same for -server.</p> <p>Are -client and -server ignored in the java7 jre? Is there online documentation about this behavior? </p> <p>P.S. I know that there is now tiered compilation.</p>
java
[1]
3,368,202
3,368,203
How to run a function in php at a certain time?
<p>Is there any trick to making php run a function at a certain time or is CRON job the only way to do this?</p>
php
[2]
822,801
822,802
How do I initialize a 2-D dynamic memory array of pointers with all elements 0
<p>I want to initialize values of 2-D array to 0. But it seems not to work. Can I initialize values of my **array in constructor to be 0. If yes the How. My code is.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(){ int row, col; cin&gt;&gt;row; cin&gt;&gt;col; int **array=new int*[row]; for (int i=0; i&lt;row; i++){ array[i]=new int[col]; } for (int i=0; i&lt;row;i++){ for (int j=0; j&lt;col; j++){ array[i][j]={'0'}; cout&lt;&lt;array[i][j]&lt;&lt;" "; } cout&lt;&lt;endl; } </code></pre> <p>}</p> <p>Further can someone explain if I have to replace ith elem from the array with some other element, how would I deal with memory allocation. </p>
c++
[6]
1,812,567
1,812,568
Passing DataKeys between pages
<p>Using a GridView on the default page and want to show details of the row selected on another page. The code for capturing and sending the datakey is -</p> <pre><code>protected void SelectedIndexChanged(object sender, EventArgs e) { int index = GridView1.SelectedIndex; Response.Redirect("InvoicePage.aspx? EntityID= " + GridView1.DataKeys[index].Value.ToString()); } </code></pre> <p>And the code for retrieving the value is -</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { string id = Request.QueryString["EntityID"]; } </code></pre> <p>My problem is that the id variable is a null on the receiving page. What am I missing?</p>
asp.net
[9]
4,435,749
4,435,750
cin not working in my code
<p>Error in line 9, 10 and 13 "no operator found which takes a left-hand operand of type 'std:istream' (or there is no acceptable conversion'"</p> <pre><code>#include &lt;stdafx.h&gt; // I should have put #include "stdafx.h" instead #include &lt;iostream&gt; // My mistake was I didn't #include &lt;string&gt; using namespace std; int main() { cout &lt;&lt; "This is the left step bitwise operation\n"; string x; cin &gt;&gt; x; // line 9 cout &lt;&lt; "You typed" &lt;&lt; x; //line 10 string y; cout &lt;&lt; "Enter second number please!"; cin &gt;&gt; y; // line 13 cin.get(); return 0; } // line </code></pre> <p>My vague guess is that I didn't #include something</p>
c++
[6]
4,952,544
4,952,545
Defaulting NAME_RAW_CONTACT_ID to locally stored phone contacts
<p>I want to know if there is a way to display contact names from Phone by default. Currently, it seems that <code>DISPLAY_NAME_PRIMARY</code> is used as the aggregated contacts display name and it gets the value from <code>NAME_RAW_CONTACT_ID</code>. From Android manual, the way this field is populated is </p> <blockquote> <p>The ID of the raw contact that contributes the display name to the aggregate contact. During aggregation one of the constituent raw contacts is chosen using a heuristic: a longer name or a name with more diacritic marks or more upper case characters is chosen.</p> </blockquote> <p>Is there a way to force <code>NAME_RAW_CONTACT_ID</code> to locally stored phone contacts? I want the display name to be same as phone contact display name even if the contact is aggregated with Google/Facebook/LinkedIn account. Is there any settings in Android UI which enables this directly? </p>
android
[4]
3,475,332
3,475,333
why C++ uses DOT to access structure members and -> to access method?
<p>I come from a Delphi/Pascal programming world but I also "play" around with C++ or C once in a while, there is a question that bothers me the most: why does C++ use "." to access a structure member and "->" to access method? in Delphi/Pascal we use "." for any of those even properties...</p> <p>Someone told me it has something to do with how C++ accesses memory, however that answer is NOT enough to help me understand.</p> <p>Thank you.</p>
c++
[6]
5,685,392
5,685,393
C# NullReferenceException on GetElementById HtmlElement
<p>this is inside my sample.html</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="testingID"&gt;hello&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and i have this code in c# that i want to prompt is the world "hello" inside the <strong><em>div</em></strong> element with the id <strong>testingID</strong></p> <pre><code>private void btnGetData_Click(object sender, EventArgs e) { string url = string.Format("{0}/sample.html", Environment.CurrentDirectory); WebBrowser webb = new WebBrowser(); webb.Navigate(url); var doc = webb.Document; HtmlElement elem = doc.GetElementById("testingID"); MessageBox.Show(elem.InnerText); } </code></pre> <p>but i get <em>Object reference not set to an instance of an object.</em> on <em>MessageBox.Show(elem.InnerText);</em></p> <p>a little help here.. </p>
c#
[0]
3,605,369
3,605,370
An extender can't be in a different UpdatePanel than the control it extends asp.net
<p>I am getting this error "An extender can't be in a different UpdatePanel than the control it extends". what could be the reason and how to tackle this problem.</p> <p>Thank you very much</p>
asp.net
[9]
3,015,592
3,015,593
Can I used a dll file in JAVA?
<p>is there a way that functions in a dll file can be called and used in java? I've been searching for a better way to do it and most of the times it pointed me out to using JNI. But my problem with that is, it will be using c++. I'm wondering if there's still another way to do it. Thanks!</p>
java
[1]
4,666,286
4,666,287
Android application put admin control for each registration?
<p>I want put admin control for each registration if admin will give yes then and then only user register the application. please help me out.How to achieve this?</p>
android
[4]
421,270
421,271
Remove root directory from a directory path string - PHP
<p>I have a variable like <code>$path = "dir1/dir2/dir1/dir4/";</code> etc.. etc..</p> <p>I want to remove the first member <code>dir1/</code> and want result like <code>dir2/dir1/dir4/</code>.</p> <p>I think it is possible by making the variable an array by <code>explode('/', $path)</code>. How can I remove the first member vrom array and reconstruct that array into a text variable??</p> <p>How can I achieve this in PHP?</p>
php
[2]
2,325,759
2,325,760
How to get email from pop.gmail.com using c#?
<p>i want to read email from pop.gmail.com using console application.</p> <pre><code>Pop3 client = new Pop3(); client.Connect("pop.gmail.com",995); client.Login("xyz@searce.com", "12345"); //client.IsAuthenticated = true; // get message list Pop3MessageCollection list = client.GetMessageList(); if (list.Count == 0) { Console.WriteLine("There are no messages in the mailbox."); } else { // download the first message MailMessage message = client.GetMailMessage(list[0].SequenceNumber); } client.Disconnect(); } </code></pre> <p>i got error server has closed the connection. i have already disable firewall and antivirus.</p> <p>plz help me.</p>
c#
[0]
533,448
533,449
Retrieving Only File Name from a Directory
<p>Using Directory class library I am trying to retrieve all files Name existing in a Folder as below:</p> <pre><code> private void button1_Click(object sender, EventArgs e) { string[] filePaths = Directory.GetFiles(@"d:\Images\", "*.png"); foreach (string img in filePaths) { listBox1.Items.Add(img.ToString()); } } </code></pre> <p>As you know this method returns Full path and name of the file but I need to get ONLY the name of files.Is it possible to do this in Directory Class? Do I have to use the Path class for this? if yes, how I can assign a path to a variable without file name? Thanks, </p>
c#
[0]
4,576,876
4,576,877
Select HTML elements by variable substring of a property
<p>I have several groups of elements, each group of which is related to a particular number. I want to add a mouseover to each element that adds a class to all the elements in its group, and a mouseout that removes that class. jQuery's attributeStartsWith selector works great for this as long as I give it a string literal, but I'm trying to write a function to do this with any group, so I need the selection to take a parameter as the substring. Is there a way to do this with attributeStartsWith, or should I try some other technique?</p> <p>Here's what I have that works:</p> <pre><code>function highlight(numberString) { $('p[id^="321"]').addClass("highlighted"); } </code></pre> <p>I need to replace "321" with the parameter numberString. The following doesn't seem to do that. I gather that's because attributeStartsWith treats numberString as an unquoted single-word string and not a variable name.</p> <pre><code>function highlight(numberString) { $('p[id^=numberString]').addClass("highlighted"); } </code></pre>
jquery
[5]
3,933,956
3,933,957
how to check if a std::map insert fails in c++?
<p>I have a custom data structure <code>Class Client</code> and <code>ClientList</code>.</p> <p>In ClientList I do</p> <pre><code>map&lt;ULONG, Client*&gt; list; </code></pre> <p>and then I add elements by </p> <pre><code>void ClientList::add(Client *client) { list.insert(std::pair&lt;ULONG,Client*&gt;(client-&gt;getID(),client)); } </code></pre> <p>how to check if <code>insert</code> fails?</p>
c++
[6]
5,853,697
5,853,698
Sub domain file not found
<p>I am making a sub domain. I have made the adjustments to the IIS and get no error with a simple htm page but get this Error.htm?aspxerrorpath=/server/default.aspx when I try to put an aspx page there in the sub folder. 'server' is the sub domain.</p> <p>What am I missing? </p>
asp.net
[9]
3,651,212
3,651,213
Need Help in Displaying Image correctly in WebView in Android?
<p>Hai Freinds, I had parsed the image from the url, and displayed in the webview, when i am displayed it in webview, a few images were streched, so i displayed the image with the help of Imageview, but the problem is the Images are not displayed in Imageview when they Color format is CMYK format, so pls tell me how to display the image in a webview without strecth of the image,or how can i display all format of images in ImageView.</p> <p>My xml code is </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout02_img" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"&gt; &lt;WebView android:id="@+id/ads_content" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/WebView&gt; &lt;/LinearLayout&gt; </code></pre> <p>and My java code is</p> <blockquote> <p>private WebView ads_content; ads_content = (WebView) findViewById(R.id.ads_content); ads_content.loadUrl(url);</p> </blockquote> <p>Refer the screenshot which shows my output <img src="http://i.stack.imgur.com/18MWe.png" alt="alt text"></p> <p>i have to show the image upto the device level, thai is to block that white and black empty spaces Thanks</p>
android
[4]
2,067,812
2,067,813
How can I rotate my any view such as UIView, UITableview, UIScrollview from portrait to landscape through code?
<p>How can I rotate my any view such as UIView, UITableview, UIScrollview from portrait to landscape through code?</p>
iphone
[8]
1,324,676
1,324,677
ExpandabeListView auto collapse
<p>I am not able to close a previously expanded group on expanding a new group. I have read similar questions, but I'm unable to extract concept from them. I tried using the collapseGroup (groupPosition) method, but it is not working.</p>
android
[4]
2,504,907
2,504,908
How to change src of a frame from another page using javascript?
<p>Here i want to change the src property of my frame which has id="bodyFrame" and that is on a seperate html docement. How can I refer it through javascript. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function loadpage() { var s=document.getElementById('selection'); //alert(s.value); var k=document.getElementById('bodyFrame'); alert(k); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; Select the page to visit : &lt;select id="selection" onchange="loadpage()"&gt; &lt;option value="Home"&gt;Home&lt;/option&gt; &lt;option value="Staff"&gt;Staff&lt;/option&gt; &lt;option value="Table"&gt;Table&lt;/option&gt; &lt;option value="Video"&gt;Video&lt;/option&gt; &lt;/select&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here I am looking for a solution instead of <code>document.getElementById('bodyFrame');</code></p>
javascript
[3]
622,574
622,575
Creating barcodes locally in iOS
<p>I've been searching all day for a library that makes barcodes, but they're all readers not creators. </p> <p>I've found a few that (maybe) work. Jeff LaMarche's works, but for some reason it can't be detected by any readers. The other ones were very expensive to license and didn't fit my needs.</p> <p>Does anyone know of a good way to implement barcodes into an iOS app?</p>
iphone
[8]
2,866,700
2,866,701
Create Sub Menu in android
<p>I want to create a <strong>Sub Menu</strong> in existing <strong>Menu Item</strong> in <strong>Android</strong>.</p> <p>How I can achieve it ?</p> <p>Thanks.</p>
android
[4]
967,451
967,452
How to get native source code of send a mail in andorid?
<p>I am new to android.</p> <p>I want to get the native source code of send email.</p> <p>For example in our android we have a icon like email.</p> <p>Then any one click the email icon the mail application will open.</p> <p>so I want that source code.</p>
android
[4]
5,376,282
5,376,283
Dynamically Adding Table Rows Using jQuery
<p>I have a footer row which is used to add new rows to an HTML table. For some reason when I add a new row it deletes the footer row. I want the new row to be added before the footer. </p> <p>Example: </p> <pre><code>Row 1 Row 2 Row 3 Footer Row with Add new row button </code></pre> <p>When the add button is clicked it should look like this: </p> <pre><code>Row 1 Row 2 Row 3 New Row added Footer Row </code></pre> <p>Here is my code: </p> <pre><code>function addAddHocRow(tr) { $('#tblBuilder_Body tr:last').before(tr); } </code></pre> <p>tr is passed from the button click method. The above code removes the footer row.</p> <p>The tr comes from the link button which is added as a column of the html table dynamically. </p> <pre><code>function addAddHocRowLink(td) { var addLink = $("&lt;a/&gt;").click(function() { addAddHocRow($(td).parent()); }).text("Add"); $(td).append(addLink); } </code></pre> <p>Actually I am making a new TR object and then populating the TD's. Each td has certain element like checkbox, dropdownlist etc. And after that the tr is added to the table.</p> <p><strong>UPDATE 2:</strong> </p> <p>Here is some code that shows how the tds are populated. </p> <pre><code>var addHocRowTds = $(addHocRow).find('td'); // append add button addAddHocRowLink(addHocRowTds[6]); </code></pre>
jquery
[5]
1,150,185
1,150,186
how to clear a graphic object without using clear() method in c#?
<p>is it possible to clear the graphic object without a clear method?</p>
c#
[0]
5,227,637
5,227,638
need to select atleast one checkbox using javascript
<p>I am using this javascript code. and on button click I want that atleast one checkbox selection is required. do anyone have idea what I am doing wrong. I don't want to use jquery. </p> <pre><code>function check() { var flag = false; for(var i=1;i&lt;=4;i++) { var checkb = document.getElementById("check"+i); if(checkb.checked) { flag = true; break; } } if(!flag) alert("What is your interest \n(select at least one option)"); return flag; } &lt;/script&gt; </code></pre> <p>Button Click Code is </p> <pre><code>&lt;input type="submit" name="submit" value="Submit" onclick="return check();"&gt; </code></pre>
javascript
[3]
131,180
131,181
trouble in deletion from the database
<p>Getting the contacts from the phone and displaying it in a list view, and marking the contacts and adding it to the list view, from there marked list view is adding and unmarked list view is deleteing.</p> <p>The code I used for this is..</p> <pre><code> @Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { x= position; LayoutInflater inflator = context.getLayoutInflater(); view = inflator.inflate(R.layout.contactliststyle, null); final ViewHolder viewHolder = new ViewHolder(); viewHolder.txtName = (TextView) view.findViewById(R.id.txtView_Name); viewHolder.txtNumber = (TextView)view.findViewById(R.id.txtView_Number); viewHolder.selection = (CheckBox)view.findViewById(R.id.checkbtn_selectContact); viewHolder.selection .setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ContactModel element = (ContactModel)viewHolder.selection .getTag(); element.setSelected(buttonView.isChecked()); if(buttonView.isChecked()) { String selectedName=element.getName(); String selectedNumber=element.getNumber(); System.out.println("etrtrt"+element.getName()); DatabaseHandler db = new DatabaseHandler(context); Log.d("Insert: ", "Inserting .."); db.addContact(new Contact(selectedName, selectedNumber)); } else { String selectedName=element.getName(); String selectedNumber=element.getNumber(); System.out.println("Number"+selectedNumber); System.out.println("Name"+selectedName); DatabaseHandler db = new DatabaseHandler(context); db.deleteContact(new Contact(selectedName,selectedNumber)); } } }); </code></pre> <p>The code in the openHelper class for deleting the contact is</p> <pre><code>// Deleting single contact public void deleteContact(Contact contact) { SQLiteDatabase db = this.getWritableDatabase(); db.delete(TABLE_CONTACTS, KEY_ID + " = ?", new String[] { String.valueOf(contact.getID()) }); System.out.println("Deleted"); db.close(); } </code></pre> <p>the contact is adding to the database perfectly but not deleting from the database...</p>
android
[4]
1,925,572
1,925,573
System.exit() in android
<p>I know system.exit(0) should not be used. I have read plenty of tutorials as well stating why it's not recommended for exiting applications and finish() is a better alternative ,but in very rare case when this dirty workaround is used than my main question is <strong>can it harm the android device or any aspect of device if used?</strong></p>
android
[4]
384,614
384,615
Converting from server image URL to absolute address
<p>I guess this is a simple question but I really can't find anything that would help me.</p> <p>I'm using an image download script and for that I need an image URL that looks like: "/home/clients/websites/w_apo/public_html/apo/wp-content/uploads/2012/05/Beautiful.jpg" [type1]</p> <p>but what I have is: "http://www.apo.com/wp-content/uploads/2012/05/Beautiful.jpg" [type2]</p> <p>I tried to write a function that returns the URL of type 1 to the URL of type 2 but it doesn't work all that great. This is how it looks:</p> <pre><code>function relativeToServerAddress($relativeURL) { $paths = explode('wp-content/', $relativeURL); $thePath = getcwd()."/wp-content"."/".$paths[1]; return $thePath; } </code></pre> <p>Is there any better way to do this? I tried to find a predefined function but failed.</p> <p>Thanks</p>
php
[2]
1,625,423
1,625,424
Reading/writing a list of nested dictionaries to/from a CSV file (Python)
<p>I have a data structure that looks like this:</p> <pre><code>data =[ {'key_1': { 'calc1': 42, 'calc2': 3.142 } }, {'key_2': { 'calc1': 123.4, 'calc2': 1.414 } }, {'key_3': { 'calc1': 2.718, 'calc2': 0.577 } } ] </code></pre> <p>I want to be able to save/and load the data into a CSV file with the following format</p> <pre><code>key, calc1, calc2 &lt;- header key_1, 42, 3.142 &lt;- data rows key_2, 123.4, 1.414 key_3, 2.718, 0.577 </code></pre> <p>What's the 'Pythonic' way to read/save this data structure to/from a CSV file like the one above?</p>
python
[7]
2,215,232
2,215,233
Is there a way to dynamically change the preference screen font color?
<p><a href="http://stackoverflow.com/questions/5334828/how-can-i-change-font-size-in-prefernce-screen">This</a> works lovely for doing it once statically.</p> <p>But what if I have a font color preference, and I want the preference screen itself to update based on that?</p>
android
[4]
50,128
50,129
How to detect whether screen is on or off if API level is 4?
<p>I am wondering to know how to detect screen dim or brightness on Android 1.6.</p> <p>I've found a solution on API Level 7. It is easy to develop :</p> <pre><code>PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); boolean isScreenOn = pm.isScreenOn(); </code></pre> <p>But I need a solution for Android 1.x.</p> <p>Can you suggest me ?</p> <p>Thanks.</p>
android
[4]
790,579
790,580
How to get missed call event in Android?
<p>How to capture a missed call event in Android?. The notification bar can show the missed call. Using telephony manager and phone state listener, its possible to read the phone state as IDLE, RINGING and OFFHOOK. But how to know whether it was a missed call?. Please help</p>
android
[4]
3,771,800
3,771,801
how can i send mail with out composer splash screen
<p>i need to send mail in my application.</p> <p>for that my code is,</p> <pre><code>MFMailComposeViewController * mailView = [[MFMailComposeViewController alloc] init]; [mailView setMailComposeDelegate:self]; [mailView setSubject:@"Some Subject"]; [mailView setToRecipients:self.selectedArray]; [self presentModalViewController:mailView animated:YES]; [mailView release]; - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { [controller dismissModalViewControllerAnimated:YES]; } </code></pre> <p>for that i am getting the splash screen <a href="http://www.freeimagehosting.net/uploads/e2fbf214c6.gif" rel="nofollow">like this</a>.</p> <p>is it possible to send mail without this splash screen.</p> <p>i need to send mail in background.</p> <p>can any one please suggest me.</p> <p>Thank u in advance.</p>
iphone
[8]
5,824,826
5,824,827
jQuery: change the order of two rows of a table
<p>I want to change the order of two rows in a table.</p> <p>I have this code:</p> <pre><code>console.log(position.parent().parent().prev()); console.log(position.parent().parent()); //I expected this line do the work, but no... $(this).parent().parent().prev().insertAfter($(this).parent().parent()); </code></pre> <p>That is printing this:</p> <pre><code>&lt;tr&gt;​ &lt;td&gt;​Element 1​&lt;/td&gt;​ &lt;td&gt;​…​&lt;/td&gt;​ &lt;td&gt;​2008-02-02​&lt;/td&gt;​ &lt;td class=​"jander" data-pos=​"0" data-category=​"1"&gt;​…​&lt;/td&gt;​ &lt;/tr&gt;​ &lt;tr&gt;​ &lt;td&gt;​Element 2​&lt;/td&gt;​ &lt;td&gt;​…​&lt;/td&gt;​ &lt;td&gt;​2007-02-02​&lt;/td&gt;​ &lt;td class=​"jander" data-pos=​"1" data-category=​"1"&gt;​…​&lt;/td&gt;​ &lt;/tr&gt;​ </code></pre> <p>Any idea?</p> <p>Regards</p> <p>Javi</p>
jquery
[5]
4,994,055
4,994,056
stop php processing file
<p>Is there any way to make php stop processing a file and make it just work with the part it already parsed. I mean like this:</p> <pre><code>&lt;some data here&gt; &lt;?php phpinfo(); [IS THERE ANY THING I CAN PUT HERE] ?&gt; &lt;more data&gt; [IS THERE ANY THING I CAN PUT HERE] &lt;?HOW CAN I MAKE PHP NOT PARSE THIS?&gt; </code></pre> <p>is there anyway to make php ignore data after the first php part?</p>
php
[2]
3,205,402
3,205,403
Application not installing on Android simulator
<p>I have developed an Android application. I have implemented all the functionality of the application. When I run the application in emulator it shows this message:</p> <blockquote> <p>[2011-02-01 11:36:39 - Test] WARNING: Application does not specify an API level requirement! [2011-02-01 11:36:39 - Test] Device API version is 9 (Android 2.3)</p> </blockquote> <p>How can I resolve this?</p>
android
[4]
4,580,447
4,580,448
How can I do a "back" link on PHP pages?
<p>How can I link to the previous page that was visited using PHP?</p>
php
[2]
1,954,420
1,954,421
How to prevent View Source of page using Javascript?
<p>How to prevent to download the source code of page using File > Save as?</p>
javascript
[3]
3,193,857
3,193,858
JQuery: select an HTML table that contain a given element
<p>Let's say I have the following HTML</p> <pre><code>&lt;table id = "mytable"&gt; &lt;tr&gt; &lt;th&gt;Hiring Manager&lt;/th&gt; &lt;td&gt;&lt;textarea id = "textComments" cols = "15"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>From the above markup, I'd like to append the following row</p> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt; &lt;span class = "CharCounter"&gt; &lt;span id="lblCharCounter"&gt;Label&lt;/span&gt; characters (500 max) &lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I want to be able to select the table, from the <strong>textarea</strong>.</p> <p>Thank for helping</p>
jquery
[5]
4,712,224
4,712,225
Display view in a scroll view on screen
<p>In my activity I have a scroll view which contains a linear layout that has many views. Is there a way I can display a specific view (from the linear layout) when starting this activity? By default this view is hidden, so I must scroll the scroll view to make it visible.</p> <p>Thanks a lot, Gratzi</p>
android
[4]
4,906,598
4,906,599
Graphic dimensions for hdpi/ldpi/mdpi
<p>I have a button graphic with dimensions 300*90.How must be the dimensions for hdpi/mdpi/ldpi?Thanks</p>
android
[4]
4,266,201
4,266,202
cant figur how to find a greater or less than for a variable
<p>I have tried muiltiple strings of code to find the awswer please help me out, here's the code</p> <pre><code> $rating = $row['rating_total'] / $row['number_ratings']; if($rating &lt; 2 &amp;&amp; $rating =&gt; 1) { $rating = ' &lt;img src="rating.png" /&gt; '; } if($rating &lt; 3 &amp;&amp; $rating =&gt; 2) { $rating = ' &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; '; } if($rating &lt; 4) &amp;&amp; ($rating =&gt; 3) { $rating = ' &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt;'; } if($rating &lt; 5) &amp;&amp; ($rating =&gt; 4) { $rating = ' &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt;'; } if($rating &lt; 6) &amp;&amp; ($rating =&gt; 5) { $rating = ' &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; &lt;img src="rating.png" /&gt; '; } </code></pre>
php
[2]
4,917,610
4,917,611
Featching mobile no by Contact_name
<p>I am novice in android development.i want to retrive contact number from contact name.I use android 2.1.my contact name retrive easily in spinner and i want to get phone no from contact name how can i do that please help me.</p> <p>Thanks in advance</p> <p>Regards Abhishek Soni</p>
android
[4]
4,151,447
4,151,448
AlarmManager not set from Bootreceiver
<p>because of the fact that the AlarmManager is being cleared when the phone is booted, I created a BootReceiver class that should reset the alarms in this case. But even though the other code form this class is executed somehow the AlarmManager doesn't get set, so the AlarmReceiver class is never called. Here is part of my code from the BootReceiver class:</p> <pre><code> Calendar Od = Calendar.getInstance(); Od.set(yearOd, monthOd, dayOd, hourOd, minuteOd); </code></pre> <p>AlarmManager am = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);</p> <pre><code> int id= rebootCursor.getInt(ToDoDBAdapter.ID_COLUMN); Intent i = new Intent(context, AlarmReceiver.class); i.putExtra("alarm_message", "stavi_vibracii"); i.putExtra("doVreme",vremeDo); i.putExtra("doDatum",dateDo); PendingIntent sender = PendingIntent.getBroadcast(context, id, i, PendingIntent.FLAG_UPDATE_CURRENT); am.set(AlarmManager.RTC_WAKEUP, Od.getTimeInMillis(), sender); </code></pre> <p>I should note that I have registered the BootReceiver and AlarmManger in the Manifest file, and everyhting worked fine when setting the alarms within my app. If somebody had similar problems or have the answer to my question, please let me know.. Thank u</p>
android
[4]
1,618,177
1,618,178
Boolean operators in if statement not working
<p>Could someone explain what's happening here? I'm trying to use the javascript <code>!!</code> (double-bang) operator <a href="http://stackoverflow.com/questions/784929/what-is-the-not-not-operator-in-javascript">as described here</a> in conjunction with <a href="http://diveintohtml5.info/storage.html" rel="nofollow">HTML5 local storage</a> (I'm storing 0 and 1 values and testing for truthiness, but I also need a missing key to be false, hence the undefined at the start.</p> <p>Although it echos to the console as false when typecast, it doesn't in the 'if' statement.</p> <pre><code>var foo = undefined; // outputs undefined console.log(foo) // typecast to non-inverted boolean console.log(!!foo); if (!!foo) { console.log("If was false before, why won't this execute?"); }​ else { console.log("It didn't work"); }​​​​​​​​​​​​​​​ </code></pre> <p>Produces:</p> <pre><code>undefined false It didn't work </code></pre> <p><a href="http://jsfiddle.net/YAAA7/" rel="nofollow">http://jsfiddle.net/YAAA7/</a><br> (Chrome v 23.0.1271.97 &amp; Firefox 16.0.1, OS X 10.8.2)</p> <p><strong>Edit - corrected code:</strong></p> <p>(The previous 'if' statement was just evaluating as false, so that branch would never run.)</p> <pre><code>var foo = false; // outputs undefined console.log(foo) // typecast to non-inverted boolean console.log(!!foo); if (!!foo == false) { console.log("Matches for foo undefined, foo = 0 and foo = false"); } else { console.log("Matches for foo = 1 and foo = true"); }​ </code></pre> <p><a href="http://jsfiddle.net/YAAA7/1/" rel="nofollow">http://jsfiddle.net/YAAA7/1/</a></p>
javascript
[3]
1,492,287
1,492,288
Android4.2 multi-user and download
<p>In Android4.2 was a new attribute <strong>multi-user</strong>.</p> <p>I found the file path was problem When I Download some media ;</p> <p>example:</p> <p>When I download a picture form website,this line was the useful log info.</p> <p><code>I/DownloadThread( 1306): mInfo.mHint = file:///storage/emulated/0/Download/girl.jpg</code></p> <p>However,I can't find the <strong>0</strong> directory under <em>/storage/emulated/</em> Use <strong>adb shell</strong></p> <p>That means,I can't use this path <em>/storage/emulated/0/Download/girl.jpg</em> with C/C++ open function </p> <p>Android download file step by step :</p> <ol> <li>Browser get the information about what we needed to download(DownloadHandler.java)</li> <li>Browser trigger the DownloadManagerService inset the information to <em>downloads.db</em></li> <li>When the <em>downloads.db</em> change,to new a new Downloadthread to Download the file!</li> </ol> <p>Question:</p> <ol> <li>Why exist <strong>/storage/emulated/0/</strong> directory (multi-user?),Why could I find it with <strong>adb shell</strong> ?</li> <li>is <strong>/storage/emulated/0/</strong> rather than <strong>/storage/sdcard0/</strong> or <strong>/storage/sdcard1/</strong>,why?</li> <li>Android4.1 VS Android4.2 with the different branch Environment.UserEnvironment(int userId)(Environment.java)</li> </ol> <p>Thanks</p> <p>CaoPeng</p>
android
[4]
5,743,930
5,743,931
What to do to improve my skill and knowledge on javascript?
<p>Currently I've finish studying the book name "beginning javascript 3rd edition",so i just wonder what should be my next step in order to strengthen myself on using and manipulating this language?Besides,how to improve myself in programming in javascript??Is it by thinking something cool myself,and start coding it??Or googling around the internet to find some task and question offered??Besides,is there any book that teaches the correct method of coding?? Thanks you</p>
javascript
[3]
3,724,300
3,724,301
iphone navigation tutorial with simple form
<p>I'm looking to create quite a basic app with a very simple navigation system but each of the tutorials I've come across so far go into too much depth or just involve lots of different form elements. I want to keep it as straight forward and simple as I can.</p> <p>If anyone knows of any tutorials that can show me how to create a root view with say 5 or 6 sub views each displaying a form for collecting different types of data I would be very grateful. This seems like quite a simple thing to achieve but so far I havent found anything that specifically relates to what I want to do.</p> <p>thanks in advance!</p>
iphone
[8]
2,217,409
2,217,410
How to change DataField of BoundField
<p>When using the <code>asp:boundfield</code>, can I call a C# function that return a string which corresponds to the column name instead of writing the column itself?</p> <pre><code> &lt;asp:BoundField DataField="Notes" HeaderText="Notes"/&gt; </code></pre> <p>Instead of having <code>DataField="Notes"</code>, I want to have <code>DataField=FUNCTION_NAME</code>.</p> <p>I tried using the following but it didn't work:</p> <pre><code>DataField=&lt;% FUNCTION_NAME %&gt; </code></pre>
asp.net
[9]
3,150,543
3,150,544
Gridview column display order
<p>I am binding a Gridview to a custom object. But the order of fields displayed is not correct. Is there any way to set the fields display order when binding a Gridview to a custom object?</p> <p>Thanks in advance.</p>
asp.net
[9]
4,936,118
4,936,119
how to fix "'System.AggregateException' occurred in mscorlib.dll"
<p>I receive such problem in debugger and program stops executing. Debugger doesn't show me the line so I don't know what to fix.</p> <blockquote> <p>An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll</p> <p>Additional information: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.</p> <p>Cannot obtain value of local or argument '' as it is not available at this instruction pointer, possibly because it has been optimized away. System.Threading.Tasks.TaskExceptionHolder</p> </blockquote> <p>How to troubleshoot my problem?</p> <p>I also found this question which is pretty similar <a href="http://stackoverflow.com/questions/8311303/cannot-obtain-value-of-local-or-argument-as-it-is-not-available-at-this-instruct">Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away</a></p>
c#
[0]
5,766,830
5,766,831
core plot graph draw issue in iphone
<p>when i use this line to draw graph my app quits</p> <pre><code>CPGraphHostingView *hostingView = (CPGraphHostingView *)self.view; hostingView.hostedGraph = barChart; </code></pre> <p>error </p> <pre><code>[UIView setHostedGraph:]: unrecognized selector sent to instance 0x595fb20 2011-06-11 11:00:14.452 CGH[4909:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setHostedGraph:]: unrecognized selector sent to instance 0x595fb20' </code></pre> <p>how to fix this issue , i have included all lib correctly </p> #### Update <p>i am using it again but i am getting this error , i have connected the class in nib file</p> <pre><code>2011-09-28 14:53:06.791 Ihope_test_sql[9307:707] Unknown class CPTGraphHostingView in Interface Builder file. 2011-09-28 14:53:06.795 Ihope_test_sql[9307:707] Unknown class CPTGraphHostingView in Interface Builder file. 2011-09-28 14:53:06.797 Ihope_test_sql[9307:707] Unknown class CPTGraphHostingView in Interface Builder file. 2011-09-28 14:53:06.800 Ihope_test_sql[9307:707] Unknown class CPTGraphHostingView in Interface Builder file. 2011-09-28 14:53:06.847 Ihope_test_sql[9307:707] -[UIView setHostedGraph:]: unrecognized selector sent to instance 0x1cd920 2011-09-28 14:53:06.875 Ihope_test_sql[9307:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setHostedGraph:]: unrecognized selector sent to instance 0x1cd920' *** Call stack at first throw: </code></pre>
iphone
[8]
3,959,328
3,959,329
Handle last iteration of asp.net repeater differently
<p>Is it possible to detect or use a different template in the asp.net repeater for the last iteration in the repeater?</p> <p>If not I could just use a for loop but I'm curious if it can be done.</p>
asp.net
[9]
4,077,951
4,077,952
firefox plugin inorder to get the data from textbox
<p>my problem is that, i what to develop a firefox plugin that extract data from the textbox and it has to be stored in some temporary memory. i didn't have any idea about plugin's So please give the solution in a detailed manner</p> <p>thank u.......!</p>
javascript
[3]
555,194
555,195
How can I read this parameters inside my software? (c#)
<p><br/> I have created a shortcut of my .exe file.<br/> I want add to '.exe' extra parameters.(on shortcut: Target attribute)<br/> <strong>Example</strong><br/> Target:<br/> "C:\Documents and Settings\dezigo\My Documents\c# programm\DirectoryScanner\DirectoryScanner\DirectoryScanner\bin\Debug\DirectoryScanner.exe" + extra parrams(like a method=1) <br/> <strong>How can I read this parameters inside my software? (c#)</strong><br/> Then ,when starting .exe <br/> check <br/></p> <pre><code>if(method == 1) { //do something } else { //do something } </code></pre>
c#
[0]
390,130
390,131
How to Do User Management in my Website?
<p>We are doing a web project for Container transaction Company. One of their requirement is User Management.The admin can set the permissions for the users. The users can only do anything according to the permissions given by the admin . How can Implement this feature.</p>
asp.net
[9]
4,424,740
4,424,741
Problem with function in python
<p>I am a newbie in python. I am trying to code a very basic function but getting errors. I dont know the reason behind it. Example code:</p> <pre><code>def printme( str ): print str; return; printme("My string"); </code></pre> <p><strong>This should execute logically but it gives me the following error:</strong></p> <p>Traceback (most recent call last): File "stdin", line 1, in "module"<br> NameError: name 'printme' is not defined</p> <p>Any suggestions are welcome...</p>
python
[7]
5,083,568
5,083,569
Switch case as string
<pre><code>$(document).ready(function(){ createForm("text,password",".content"); }); function createForm(types,object){ typ = types.split(','); //var source = ""; $.each(typ,function(){ switch(this){ case "text": console.log('text');break; default: console.log('default');break; } }); //$(object).html(source); } </code></pre> <p>I have this code an in console it return 2xdefaults. Why?</p> <p>I try to return a input for each type as text or password but my switch does not recognize the "typ"</p>
javascript
[3]
1,151,308
1,151,309
How to write this program in Python?
<pre><code>def scaleImage(image): """ A function that takes an image and makes each pixel grayscale: the red, blue, green components are the average of the respective components in each original pixel. """ pix = image.getPixels() # How can I condense the following loop? newimage = Image() for pixel in pix: newpixel = ((int(pixel[0]) + int(pixel[1]) + int(pixel[2]))/3, (int(pixel[0]) + int(pixel[1]) + int(pixel[2]))/3, (int(pixel[0]) + int(pixel[1]) + int(pixel[2]))/3, int(pixel[3])) newimage.setPixels(newpixel) return newimage </code></pre> <p>My task is to write a function showScale() that asks the user for an image filename, then displays both that image and its grayscale version in a window.</p> <pre><code>def showScale(): filename = raw_input("The name of the image file? ") picture = Image.open(filename) newpicture = Image.open(scaleImage(picture)) newpicture.show() </code></pre> <p>Question1. Should I use cs1graphics module to make it work?</p> <p>Question2. How should I change my code to answer my task?</p>
python
[7]
1,689,005
1,689,006
comparing Python code for equivalence
<p>Is there a reliable, automatic way (such as a command-line utility) to check if two Python files are <strong>equivalent</strong> modulo whitespace, semicolons, backslash continuations, comments, etc.? In other words, that they are identical to the interpreter?</p> <p>For example, this:</p> <pre><code>import sys sys.stdout.write('foo\n') sys.stdout.write('bar\n') </code></pre> <p>should be considered equivalent to this:</p> <pre><code>import sys sys.stdout.\ write('foo\n'); sys.stdout.\ write( 'bar\n') # This is an unnecessary comment </code></pre>
python
[7]
317,895
317,896
If variable is false will it be passed over in Javascript
<p>If <code>co.chkShowRSB</code> is false, what is the expected result? I would expect it to be false, but is this the way it works? And why?</p> <p><code>var test = chkShow:co.chkShowRSB || true;</code></p>
javascript
[3]
5,084,881
5,084,882
PHP $_GET URL's
<p>I'm trying to do something with PHP with the <code>$_GET</code> values but I it seems impossible, for example:</p> <pre><code>?id=15&amp;lang=en </code></pre> <p><code>?id=15</code> is the page <code>&amp;lang=en</code> site language</p> <p>I would like this one</p> <p><code>?id=15,en</code> instead of using <code>&amp;lang=en</code> I want to replace the <code>&amp;lang=</code> with comma (<code>,</code>)</p> <p>How can I do this in PHP or is it possible to try with a .htaccess configuration?</p>
php
[2]
2,382,609
2,382,610
iPhone - Can I look at the directory file
<p>Once I connect my iPhone to my computer, is there anyway I can look at the directory structure on the phone?<br> Would it work like a USB device for example and let me copy files without using iTunes but just drag and drop through the Finder on a Mac?</p> <p>Thanks,<br> Tee</p>
iphone
[8]
800,232
800,233
Forming Communication Between Server and an iPhone application
<p>Is there any tutorial or blog or some documents which helps in learning how to communicate server from my iPhone application.</p> <p>I just want to do a simple thing. Which is a page update.</p> <p>Like I have a Label which needs to update to one particular name stored in my database and this database resides on a server.</p> <p>So how to do this.</p>
iphone
[8]
611,715
611,716
iPhone - knowing the keyboard size when it is already shown
<p>OK, I know I can read the keyboard size using the notification <strong>UIKeyboardWillShowNotification</strong> and this</p> <pre><code>keybSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size; </code></pre> <p>but this will just be available when the keyboard shows.</p> <p>but the problem is this: I have a window that has to adjust itself to a new position when the keyboard is visible and when iPhone rotates. When I rotate the iPhone both delegates method <strong>willRotateToInterfaceOrientation</strong> and <strong>didRotateFromInterfaceOrientation</strong> run and handle the rotation. Inside these methods I need to know the current keyboard height, so I can position the view properly. The problem is that the method fired by the UIKeyboardWillShowNotification notification runs after the rotation was handled by the delegate methods.</p> <p>The order the methods run is:</p> <ol> <li>willRotateToInterfaceOrientation</li> <li>didRotateFromInterfaceOrientation</li> <li>UIKeyboardWillShowNotification method</li> </ol> <p>In other words, the keyboard height is just read at the end, what means both methods 1 and 2 will use the old keyboard height.</p> <p>My question is: is there a way to read the keyboard height of a visible keyboard directly instead of relying in methods fired by notifications?</p> <p>thanks</p>
iphone
[8]
1,274,068
1,274,069
verify and acess Micro SDCARD
<p>How can i check Micro SDCARD is present in device and how i can access that to write some files.</p>
android
[4]
1,265,652
1,265,653
Why is the Cancel button is not showing up in the asp:Wizard control?
<p>Here is a code snippet for an asp:Wizard control I have on an aspx page, but the Cancel button is not showing up. Only next and previous buttons are showing. Does anyone know how to resolve this?</p> <pre><code>&lt;asp:Wizard runat="server" OnFinishButtonClick="wizCreateUser_Finish" OnNextButtonClick="wizCreateUser_StepChange" HeaderText="SpecEx Application Form" Font-Names="Arial" BackColor="#336699" ForeColor="White" ID="wizCreateUser" Font-Bold="False" Style="border: outset 1px black;" Height="320px" Width="861px" ActiveStepIndex="0" DisplaySideBar="False" StartNextButtonImageUrl="~/images/next-btn.PNG" StepNextButtonImageUrl="~/images/next-btn.PNG" StepNextButtonType="Image" StartNextButtonText="" StartNextButtonType="Image" StepNextButtonText="" FinishCompleteButtonImageUrl="~/images/finish-btn.png" FinishCompleteButtonType="Image" FinishPreviousButtonImageUrl="~/images/previous-btn.png" FinishPreviousButtonText="" FinishPreviousButtonType="Image" StepPreviousButtonImageUrl="~/images/previous-btn.png" StepPreviousButtonText="" StepPreviousButtonType="Image" CancelButtonImageUrl="~/images/cancel-btn.png" CancelButtonText="" CancelButtonType="Image"&gt; &lt;/asp:Wizard&gt; </code></pre>
asp.net
[9]
5,082,000
5,082,001
How to redirect link in php code
<p>I'm newbie in PHP.I got this code.</p> <pre><code>&lt;? $connection=mysql_connect("","",""); if(!$connection) { die("Database Connection Failed: " . mysql_error()); } //Select a database to use $db=mysql_select_db('vss',$connection); if(!$db) { die("Database Selection Failed: " . mysql_error()); } $class=$_POST['class']; $section=$_POST['section']; $roll=$_POST['roll']; mysql_query("INSERT INTO student_class SET class='$class', section='$section', roll='$roll'"); print"Data Saved";//If data saved,I want to redirect link to a another page mysql_close(); ?&gt; </code></pre> <p>==================================================================================</p> <p>If data saved,I want to redirect link to a another page.is this possible??</p> <p>Thanks in advance.</p>
php
[2]
1,194,427
1,194,428
Datagram Socket "must be caught or declared to be thrown"
<p>The following code is producing an error</p> <pre><code>DatagramSocket socket = new DatagramSocket(); </code></pre> <p>The java.net.* is included at the top</p> <p>The error is <code>unreported exception java.net.SocketException; must be caught or d eclared to be thrown</code></p> <p>It's in a method run() in a class that uses a thread.</p> <p>Any ideas?</p>
java
[1]
3,832,077
3,832,078
IntSetArray implementation in c++
<p>i have trying to imlement IntSetArray in c++ it compiles fine but result is wrong first 300 is ok and other numbers are below zero something very strange numbers .e.g -8231313 something like this) what is wrong? it is code</p> <pre><code>#include &lt;iostream&gt; using namespace std; int quantity=10; class Set { private : int n,*x; public: Set(int maxval){ x=new int[quantity+1]; n=0; x[0]=maxval; } int size(){ return n;} void insert(int t){ for (int i=0;x[i]&lt;t;i++) { if (x[i]==t) return ; for (int j=n;j&gt;=i;j--) x[j+1]=x[j]; x[i]=t; } n++; } void display() { for (int i=0;i&lt;n;i++){ cout&lt;&lt;x[i]&lt;&lt;" "&lt;&lt;"\n"; } } }; int main(){ Set s(300); s.insert(123); s.insert(45); s.insert(89); s.insert(50); s.insert(13); s.insert(19); s.display(); return 0; } </code></pre>
c++
[6]
5,824,319
5,824,320
regular expression for matching two ip address with a hyphen symbol between it
<p>i have tried it using the following regular expression but couldn't match my requirement. Can anyone help me pls.... must match the ip addresses in the below example format Example- 111.222.222.111- 222.112.1.2 (assume) or single ip address. here's my regular expression:</p> <pre><code>(^((([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*)\\.){3}(([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*)$) | ^((([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*)\\.){3}(([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*))(\\-)^(([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*)\\.){3}(([0-9]{1,2})|(1[0-9]{2,2})|(2[0-4][0-9])|(25[0-5])|\\*)$") </code></pre>
jquery
[5]
5,669,579
5,669,580
set dropdownlist based on value or text
<p>how do i set my dropdownlist to an index based on the value or text?</p>
jquery
[5]
5,354,293
5,354,294
move_uploaded_file not working as it should
<p>I've searched around but I can't find my issue. I have a simple script that uploads a file to the target-folder.</p> <pre><code>$target = "img/fotos-artikels/"; $target .= basename($_FILES["uploadBron"]["name"]); if(move_uploaded_file($_FILES["uploadBron"]["tmpname"], $target)) { echo "The file " . basename($_FILES["uploadBron"]["name"]) . " has been uploaded."; } else { echo " Sorry there was a problem"; } </code></pre> <p>And this is the form:</p> <pre><code>&lt;form enctype="multipart/form-data" action="" method="post"&gt; &lt;label for="txtBronNaam"&gt;Naam:&lt;/label&gt; &lt;input type="text" name="txtBronNaam" id="txtBronNaam" value="" /&gt;&lt;br /&gt; &lt;label for="uploadBron"&gt;File:&lt;/label&gt; &lt;input type="file" name="uploadBron" id="uploadBron" value="" /&gt;&lt;br /&gt; &lt;input type="submit" name="" value="Voeg bron toe" /&gt; &lt;/form&gt; </code></pre> <p>Do I have to enable something in apache maybe?</p>
php
[2]
2,040,671
2,040,672
ExpandableListActivity get Text
<p>I have <code>ExpandableListActivity</code> with <code>Text</code> in each item. How can I get text of clicked listitem?</p> <p>Here`s how I do:</p> <pre><code> groupData = application.getFirstLayer(); String groupFrom[] = new String[] {"groupName"}; int groupTo[] = new int[] {android.R.id.text1}; childData = application.getSecondLayer(); String childFrom[] = new String[] {"levelTwoCat"}; int childTo[] = new int[] {android.R.id.text1}; adapter = new SimpleExpandableListAdapter( this, groupData, android.R.layout.simple_expandable_list_item_1, groupFrom, groupTo, childData, android.R.layout.simple_list_item_1, childFrom, childTo); public boolean onChildClick(android.widget.ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {} </code></pre> <p>What I have to write in <code>onChildClick</code> in order to see the text of current item?</p>
android
[4]
4,006,184
4,006,185
jquery selector
<p>How can I select id of anchor tag within onclick function with jquery?</p> <pre><code>&lt;a id="123" href="#" onclick="javascript: showDialog( select id of this anchor )"&gt; Click it &lt;/a&gt; </code></pre> <p>Thanks in advance.</p>
jquery
[5]
732,902
732,903
execute the first time the setInterval without delay
<p>It's there a way to configure the <code>setInterval</code> method of javascript to execute the method immediately and then executes with the timer</p>
javascript
[3]
5,431,721
5,431,722
How do I get the correct ID (html) a control in ASP.net?
<p>Everyone knows that the ID for all user controls changes upon the asp.net page is created. </p> <pre><code>&lt;div id="ID-value" runat="server"&gt;&lt;/div&gt; </code></pre> <p>becomes:</p> <pre><code>&lt;div id="ct100$ID-value"&gt;&lt;/div&gt; </code></pre> <p>This could be a pain in the ass I think, especially when you try to bind objects to javascripts. So.</p> <p>Is there a way to get the correct ID as it is shown in the html page? so that I can manually bind this object to the java script? (in other words: I want the "ct100$.....") Thanks!</p>
asp.net
[9]
1,047,907
1,047,908
ASP.NET Event OnAuthenticationFailed?
<p>Is there an event that gets fired right after ASP.NET authentication has failed to identify the user? I need to trigger an alarm every time that happens. Don't offer to implement custom membership provider nor to do it from the Login form's controller. I'm looking for native ASP.NET pipeline event. HttpApplication has two events: one for <strong>before</strong> Authentication and one <strong>after</strong>, but nothing for <strong>failure</strong>.</p>
asp.net
[9]
3,550,169
3,550,170
How to store a reference to an object on a dom elements data property?
<p>I want to save a reference to a specific object reflecting properties for the current dom element for some elements of the dom tree. Each element could have a different reference to another object or they could reference the same. Is it possible to use html5's data property therefore or is there another way to do that in plain javascript (not jquery).</p> <p>Thanks for help!</p>
javascript
[3]
3,971,998
3,971,999
Getting error while installing application
<p>I have made an application. I have used google API target 4.0 but when I run the activity ,instead of getting install it gives me error. I have also kill the server and then start it but still I am getting same error.</p> <pre><code>installation error: install_failed_missing_shared_library </code></pre>
android
[4]
4,578,727
4,578,728
isolating part of a url with php
<p>If I have the following url:</p> <pre><code>http://URL/products/38/293/bannana_cake/ </code></pre> <p>or</p> <pre><code>htp://URL/products/38/293/fruit_cake/ </code></pre> <p>How can I isolate just <code>bannana_cake</code> and <code>fruit_cake</code> from the examples above?</p>
php
[2]
4,414,612
4,414,613
Define once an event listener for multiple widgets
<p>Given <em>N</em> widgets of the same 'kind' (intentionally avoiding the <em>class</em> or <em>type</em> terms here for avoiding confusion), I'd like to assign the same event listener to all of them in an idiomatic way.</p> <p>For clarity, it'd be something akin to <code>$(".foo").click(...);</code> in jQuery. Notice the class selector.</p> <p>Right now I can code it in a fairly concise way, but I was wondering whether there is an specific mechanism in Android for achieving this.</p> <p><strong>Update</strong> - example:</p> <pre><code> button1 = (Button) findViewById(R.id.button1); button2 = (Button) findViewById(R.id.button2); ... buttonN = (Button) findViewById(R.id.buttonN); buttons = new Button[]{button1, button2, ..., buttonN}; // Pretty imperative. // Would't it be better to specify that all buttons belong to the same 'kind', // and set a listener to that 'kind'? for (int i = 0; i &lt; buttons.length; i++) buttons[i].setOnClickListener(...); </code></pre>
android
[4]
4,945,204
4,945,205
Call a method at fixed time in Java
<p>How do I call a method at a particular time?</p> <p>For example to call the method at 6:00 and 13:00.</p> <p>I'm working at a desktop application for Windows.</p>
java
[1]
5,777,599
5,777,600
HttpWebResponse difference between Headers and GetResponseHeader
<p>When i've got a HttpWebResponse object, there are two ways to access the response headers:</p> <pre><code>string dateHeader = webResponse.Headers["Date"]; string dateHeader = webResponse.GetResponseHeader("Date"); </code></pre> <p>They both return the same value, so why there are two ways to obtain header information? Looking at the .NET sources, if found the implementation for both in HttpWebReponse:</p> <pre><code> // retreives response header object /// &lt;devdoc&gt; /// &lt;para&gt; /// Gets /// the headers associated with this response from the server. /// &lt;/para&gt; /// &lt;/devdoc&gt; public override WebHeaderCollection Headers { get { CheckDisposed(); return m_HttpResponseHeaders; } } /// &lt;devdoc&gt; /// &lt;para&gt; /// Gets a specified header value returned with the response. /// &lt;/para&gt; /// &lt;/devdoc&gt; public string GetResponseHeader( string headerName ) { CheckDisposed(); string headerValue = m_HttpResponseHeaders[headerName]; return ( (headerValue==null) ? String.Empty : headerValue ); } </code></pre> <p>Only thing i can see is, that with the Headers property i can enumerate through all availiable headers. Any ideas?</p> <p>Thanks!</p>
c#
[0]
446,654
446,655
Short-circuit for If-else statement
<p>So I know </p> <pre><code>variable &amp;&amp; runTrue(); </code></pre> <p>really means</p> <pre><code>if(variable){ runTrue(); } </code></pre> <hr> <p>Then is there a more simplified way to write</p> <pre><code>if(variable){ runTrue(); }else{ runFalse(); } </code></pre> <p>instead of <code>if-else</code>?</p>
javascript
[3]
1,287,668
1,287,669
Print everything in iFrame using javascript
<p>I using below JavaScript code to print the content of my iFrame. but this print function just print the visible area of my iFrame it does not print whole content of my Iframe.</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;!-- function PrintF(){ var IFRAME = document.getElementById("MyIframe"); IFRAME.print(); } //--&gt; &lt;/script&gt; </code></pre>
javascript
[3]
3,793,515
3,793,516
Get contact name of the sender from the sms table?
<p>I am using the following to get the SMS from inbox </p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cur = cr.query(Uri.parse("content://sms"), null,null,null, null); DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); cursor_count=cur.getCount(); if(cur.moveToFirst()) { do { sender.add(cur.getString(2)); msg.add(cur.getString(11)); date.add(formatter.format(Long.parseLong(cur.getString(4)))); } while (cur.moveToNext()); </code></pre> <p>I get the address of the person from the address field, but I also want to get the contact name of the sender, if stored in my contacts.<br> The person field always returns null, why?</p>
android
[4]
5,401,996
5,401,997
Displaying 5 images in random order in C++
<p>I am creating a game called Simon Says in C++ and want to be able to hit the space bar and display 5 random images that i have already loaded to my game. And every time i hit the space bar i want the images to be in a different order than the previous time therefore i need to be able to have a command to randomly display the 5 different images once i hit the space bar. Here is the code i have to display the images in a set order:</p> <pre><code> if(key_down(VK_SPACE)) { clear_screen(); a(); refresh_screen(); delay(1000); clear_screen(); b(); refresh_screen(); delay(1000); clear_screen(); e(); refresh_screen(); delay(1000); clear_screen(); d(); refresh_screen(); delay(1000); clear_screen(); g(); refresh_screen(); delay(1000); clear_screen(); c(); refresh_screen(); delay(1000); clear_screen(); refresh_screen(); } </code></pre>
c++
[6]
5,510,885
5,510,886
php random image file name
<p>Okay im using a snippet I found on google to take a users uploaded image and put it in my directory under Content</p> <p>But Im worried about duplicates so I was going have it upload the image as a Random number </p> <p>well here is my code you can probably understand what im going for through it anyways</p> <pre><code>&lt;label for="file"&gt;Profile Pic:&lt;/label&gt; &lt;input type="file" name="ProfilePic" id="ProfilePic" /&gt;&lt;br /&gt; &lt;input type="submit" name="submit" value="Submit" /&gt; $ProfilePicName = $_FILES["ProfilePic"]["name"]; $ProfilePicType = $_FILES["ProfilePic"]["type"]; $ProfilePicSize = $_FILES["ProfilePic"]["size"]; $ProfilePicTemp = $_FILES["ProfilePic"]["tmp_name"]; $ProfilePicError = $_FILES["ProfilePic"]["error"]; $RandomAccountNumber = mt_rand(1, 99999); echo $RandomAccountNumber; move_uploaded_file($ProfilePicTemp, "Content/".$RandomAccountNumber.$ProfilePicType); </code></pre> <p>And then basicly after all this Im going try to get it to put that random number in my database </p> <p>Someone gave me a new snippet that looks like it will do what I want but now the file isnt making it all the way to my directory </p> <pre><code>$RandomAccountNumber = uniqid(); echo $RandomAccountNumber; move_uploaded_file($ProfilePicName,"Content/".$RandomAccountNumber); </code></pre>
php
[2]
5,967,947
5,967,948
javascript time() using more Zero values?
<p>iam working on this javascript Jquery plugin</p> <p><a href="http://code.google.com/p/flot/" rel="nofollow">http://code.google.com/p/flot/</a></p> <p>for example its using time line to convert it to real time </p> <p>like</p> <pre><code>var data = [ { label: "United States", data: [[1220565600000, 0], [1320565600000, '13']] } ]; </code></pre> <p>does this time lines same as php <code>time()</code> value ?</p> <p>because when i replace them with php <code>time()</code> value its show 2 years later</p>
javascript
[3]
5,720,881
5,720,882
is there way for programmatically storing an 'address' of properties for an objects in PHP?
<p>Suppose I have an object in PHP $o, about which I can get $o->a->b, or maybe $0->c['d'].</p> <p>Is there a way of storing these as sort of address for handling elsewhere?</p> <p>What I have is that at several different places I need to process different properties of the object, but in the same way.</p> <p>So what I'd like to do is build a collection of addresses as I go along, and then hand them all to a single function which goes through them all and does the processing.</p> <p>Eg:</p> <p>$o->a = 'red';</p> <p>$o->b->c = 'red';</p> <p>$o->d['e'] = 'red';</p> <p>... and I want to change all 'red' to 'green', but those particular keys and properties may change depending on circumstances.</p>
php
[2]
5,303,112
5,303,113
Android: Resume on Count Down Timer
<p>I am a beginner in Java and Android programming. And I am confused on how to resume my Count Down Timer after the <code>pause. counter.ontick(milisUntilFinished);</code> is not working in my code.<br> Please help me I am bit rushed. </p> <p>This is my code: </p> <pre><code>@Override protected void onRestoreInstanceState(Bundle cute) { super.onRestoreInstanceState(cute);} @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState);} Timer.setOnClickListener(TimerClickListener); counter = new MyCount(orig, 1000); private OnClickListener TimerClickListener = new OnClickListener() { public void onClick(View v) { if (p1&lt;=4){ if (decision==0){ counter.start(); decision=1;} else if(decision==1){ //pause counter.cancel(); decision=2; } else{ //resume counter.onTick(orig); decision=1; } //end if } } }; class MyCount extends CountDownTimer { public MyCount(long millisInFuture, long countDownInterval) { super(millisInFuture, countDownInterval); public void onFinish() { //do stuff }//end if }//finish public void onTick(long millisUntilFinished) { . . . . . . orig = millisUntilFinished; Timer.setText(String.format("%02d", minutes) + ":" + String.format("%02d", seconds)); }//class MyCount </code></pre> <p>Any help would be appreciated! </p>
android
[4]
1,555,663
1,555,664
aspx.net gives blank error message
<p>What could this blank error message mean? I get it randomly in my LOGS. I am using non-cookie sessions. it occurs randomly in all aspx files..</p> <p>code handler outputs: objErr = Server.GetLastError().GetBaseException() Server.ClearError()</p> <pre><code>Error Message: &amp; objErr.Message.ToString()) Stack Trace: &amp; objErr.StackTrace.ToString()) </code></pre> <p>output</p> <pre><code> Error Message: Stack Trace: at System.Web.CachedPathData.GetConfigPathData(String configPath) at System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) at System.Web.HttpContext.GetFilePathData() at System.Web.HttpContext.GetConfigurationPathData() at System.Web.HttpContext.get_ImpersonationToken() at System.Web.ClientImpersonationContext.Start(HttpContext context, Boolean throwOnError) at System.Web.HttpApplication.ThreadContext.Enter(Boolean setImpersonationContext) at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext) at System.Web.HttpApplication.ApplicationStepManager.ResumeSteps(Exception error) </code></pre>
asp.net
[9]
4,251,080
4,251,081
Best practice for message activity
<p>Is there some android activity for message view, like how whatsapp and android SMS show the messages (and even talk box show)?</p> <p>I mean so that my message is on the left side and my partner's message is on the right side of the screen?</p> <p><img src="http://i.stack.imgur.com/oCBxb.jpg" alt="enter image description here"></p>
android
[4]
2,933,237
2,933,238
select() does not give timeout inside a bash script
<p>I have a problem that the select() does not give timeout when I run the program inside a bashscript file. This is my implementation:</p> <pre><code>#include &lt;sys/select.h&gt; bool checkKeyPressed() { struct timeval tv; tv.tv_sec = 1; tv.tv_usec = 0; fd_set descriptor; const int input = 0; FD_ZERO(&amp;descriptor); FD_SET(input, &amp;descriptor); return select(1, &amp;descriptor, NULL, NULL, &amp;tv) &gt; 0; } </code></pre> <p>// strace result after running the program directly (correct that there is a timeout)</p> <pre><code>select(1, [0], NULL, NULL, {1, 0}) = 0 (Timeout) </code></pre> <p>// strace result to run the application inside a bash script file (no timeout)</p> <pre><code>select(1, [0], NULL, NULL, {1, 0}) = 1 (in [0], left {0, 999996}) read(0, "", 1) = 0 </code></pre> <p>How can I change the function to get it working with also running under the bashscript?</p> <p>Thanks in advance.</p>
c++
[6]