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
380,641
380,642
jquery displaying an unnested div using nextall
<p>having read through how to use nextall() i'm still a little stumped with the following: I have a loop that will be outputting the following code.</p> <pre><code>&lt;div id="placement" style="float:right"&gt; &lt;a class="eng-sum"&gt;&lt;img src="/flags/en.png"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="tool-summary" id="tool-summary" style="clear:both; display:none"&gt; blar blar &lt;/div&gt; </code></pre> <p>I looking to click on uk flag and display the next div.tool-summary</p> <p>Here is the jquery script I'm using:</p> <pre><code>$('.eng-sum').click(function() { $(this).nextAll(".tool-summary:first").slideToggle(); }); </code></pre> <p>This script only works if I wrap the .tool-summary div within the #placement div which is undesirable - I thought that the nextall() function would take care of this, but it seems not to?</p>
jquery
[5]
2,427,710
2,427,711
Sending tweets using Android
<p>Can anyone tel me how to tweet using Android? How can i send tweets using Android?</p>
android
[4]
4,494,224
4,494,225
How to interact with android keyboard enter and rest of the button
<p>I have an edit box which popup an android keyboard. What i want is on click of done button in the keyboard i want to display a message in the and if the user click rest of the buttons in-spite of done button the message should be clear. I have used this code but it doesn't work. Please help me to solve this out.</p> <p><strong>Code i have used</strong></p> <pre><code>m_passwrdEditText.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ENTER) { m_passwrdErrorText.setText("Test Project"); } else { m_passwrdErrorText.setText(""); } m_passwrdEditText.setTypeface(face); return false; } }); </code></pre>
android
[4]
3,457,128
3,457,129
How to open form2 on the second monitor?
<p>I create Form2 from Form1. I want that Form2 opens on the second monitor. How I can do this? I use this code:</p> <pre><code>private void button1_Click(object sender, EventArgs e) { Form2 dlg = new Form2(); dlg.Show(); } </code></pre> <p>How to change this code for this? Thanks for all.</p>
c#
[0]
1,665,159
1,665,160
Javascript Function Scope
<p>This is perhaps a dumb question, but I am new to Javascript and desperate for help.</p> <p>If the Javascript engine will look for global variables outside of a function, then what is the point of passing parameters to it? What do you gain?</p> <p>I understand that global variables are generally frowned upon, but I still don't understand the purpose of passing variables. Does it have something to do with data encapsulation?</p>
javascript
[3]
4,765,927
4,765,928
parsing error with android app
<p>I know this has been asked before, but nothing is working.</p> <p>I have signed my app. </p> <p>I sent the signed apk as an email attachment.</p> <p>I click on the email attachment to install it and I get a parsing error.</p> <p>What am I doing wrong?</p> <p>Thanks DeanO</p> <p>screen shot link <a href="http://picasaweb.google.com/lh/photo/EAdwMYNAPXSoY9BU8VJRhw?feat=directlink" rel="nofollow">http://picasaweb.google.com/lh/photo/EAdwMYNAPXSoY9BU8VJRhw?feat=directlink</a></p>
android
[4]
5,556,218
5,556,219
Page curl/turn effect in Android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3912849/implement-page-curl-on-android">Implement page curl on android?</a> </p> </blockquote> <p>I am new to Android. I need a sample code for page flip/curl/turn effect in Android. </p>
android
[4]
4,594,968
4,594,969
Is null in catch block required?
<pre><code>A a = null; try { a = setA(); // set A throws exception } catch (AException e) { a = null; } </code></pre> <p>In the code above, do I need use <code>a = null</code> in the catch block to ensure that <code>a</code> is null if an exception occurs?</p>
java
[1]
3,773,818
3,773,819
Android Developer account issue
<p>I am Indian Android Developer. I want to know whether I can pay the Developer fee using my Debit card.</p>
android
[4]
5,420,004
5,420,005
I am moving selected data from one listbox to another but I am getting an error "Object reference not set to an instance of an object."
<pre><code> ListItem item = new ListItem(); item.Text = ListBox1.SelectedItem.Text;////(error occured here) ListBox2.Items.Add(item.Text); ListBox1.Items.Remove(item.Text); string usrid = null; string usridselect = "select user_id from user_membership where email_id ='" + ListBox1.SelectedItem.Text + "'"; SqlConnection sqcon = DBConnection.connectDB(); sqcon.Open(); SqlDataReader sqldr = DBConnection.SelectData(usridselect, sqcon); if (sqldr.HasRows) { while (sqldr.Read()) { usrid = sqldr[0].ToString(); } } sqldr.Close(); </code></pre>
c#
[0]
4,624,548
4,624,549
Using a DiffGram in Java
<p>I'm trying to build a web portal in Java that supports incremental changes to an XML document. I really like the <a href="http://msdn.microsoft.com/en-us/library/ms172088%28VS.71%29.aspx" rel="nofollow">diffgram</a> technology in .Net, but I must use Java for this project. Is there a Java library that can modify an XML document object using diffgrams? We will likely be using JAXB, but I can always marshal data to build the original XML document.</p>
java
[1]
618,317
618,318
How to determine which PHP is being used?
<p>How to determine which PHP is being used?</p> <p>For example, if there are <code>/usr/local/bin/php</code> and <code>usr/local/bin/php5</code>, how do I know which one is being used by my PHP scripts?</p>
php
[2]
5,997,168
5,997,169
Android Frame Animation
<p>I would like to know if it is possible to remove one of the frames I added using addFrame in Android?</p> <p>Thanks</p> <p>Kelvin</p>
android
[4]
5,211,503
5,211,504
Simplified Object Data Source Control
<p>Is there any simplified Data Source Control that would allow binding to a local (code behind) page method? Any way to accomplish this with an ODS?</p> <p>The ODS requires the TypeName parameter which I can't figure out to to point to the local page (code behind) in a Web Site Project.</p> <pre><code>&lt;asp:DropDownList ID="DropDownListMain" runat="server" DataTextField="Text" DataValueField="Value" DataSourceID="DataSourceMain" /&gt; &lt;asp:ObjectDataSource ID="DataSourceMain" runat="server" SelectMethod="GetMyRecords" /&gt; protected IEnumerable&lt;MyRecord&gt; GetMyRecords() { yield return new MyRecord("Red", "1"); yield return new MyRecord("Blue", "2"); yield return new MyRecord("Green", "3"); yield return new MyRecord("Black", "4"); } protected class MyRecord { public MyRecord(string text, string value) { this.Text = text; this.Value = value; } public string Text { get; set; } public string Value { get; set; } } </code></pre>
asp.net
[9]
3,111,592
3,111,593
Java: Cannot print the value of textbox in loop
<p>i have 3 textboxes. One textbox contains the some integer, eg:2 What i want to do is i want to iterate the loop 2 times.. in every iteration i want to print the value in textboxes. I am clearing the textbox before going to the next iteration. After 2 iterations i want to make the textboxes editable false. But the problem is the loop iterates 2 times but the value in textbox is printed only for the 1st iteration. I wrote the following code</p> <pre><code>int i=1; do { System.out.println(ext_people_name.getText()); System.out.println(ext_contact_num.getText()); System.out.println(i); ext_people_name.setText(""); ext_contact_num.setText(""); i++; if(i&gt;nop1) { ext_people_name.setEditable(false); ext_contact_num.setEditable(false); break; } }while(i&lt;=nop1); </code></pre> <p>The output i get right now is</p> <pre><code>neha 8798 1 2 </code></pre> <p>Can anyone tell any alternative to this or please help</p>
java
[1]
3,341,556
3,341,557
confused on how my code work and want to understand the logic in it
<p>Please dont discourage this question..I am very new to c++ and really want to understand the code I work on.</p> <pre><code>// bintodec.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main(){ string inp; int dec = 0; char base; cout &lt;&lt; "Input a number: "; cin &gt;&gt; inp; cout &lt;&lt; "Input the base your number is in: "; cin &gt;&gt; base; for(int i = inp.length()-1, j = 0; i &gt;= 0; i--, ++j) dec += (inp[i]-48) * pow((float)base-48, j); cout &lt;&lt; "Your number in base 10 is: " &lt;&lt; dec &lt;&lt;endl; system("pause"); return 0; } </code></pre> <p>I really want to understand how this FOR LOOP runs the INPUT NUMBER and BASE, to then get an answer.</p> <p>so lets say I INPUT 110 BASE 2 PRINT: 6</p> <p>*How the for loop is doing it</p> <p>thanks all!</p>
c++
[6]
244,302
244,303
Listening to outgoing/incoming calls
<p>I'm a newbie android developer, I'm trying to develop an application; a background service which listens to incoming/outgoing calls/messages. I want to learn how to:</p> <ul> <li>I want to end the phone calls from specific numbers</li> <li>Delete the messages from Inbox/drafts/sent items </li> </ul> <p>May I get some leads to achieve this?</p>
android
[4]
3,901,016
3,901,017
Verifying the existence of a method
<p>Is possible to verify the existence of a method without instantiating the class in php? How I do it?</p> <p>I need to check in real time the existence of a method to build my links, but instantiate the classes is very expensive and unnecessary (don't need the classes at the time), so <code>is_callable</code> and <code>method_exists</code> are not an option.</p>
php
[2]
5,090,493
5,090,494
Android checkbox checked in one activity and then text appears in another activity that notifies that checkbox has been checked
<p>So I have one activity with a checkbox and a button and another activity with a textview. When I check the checkbox and click the button, the button calls startActivty(intent) which starts the other activity with the textview and should inform the user with a text that the checkbox was checked. How do I do this?</p>
android
[4]
4,840,434
4,840,435
Append before parent after getSelection()
<p>I have one question. I try to develop a little WYSIWYG editor. </p> <p>I would like create a <code>&lt;h1&gt;</code> button which allows me to generate a <code>&lt;h1&gt;</code> title (by clicking on button after text selection in <code>&lt;p&gt;</code> element).</p> <p>I obtain the selection with <code>window.getSelection()...</code>. But now, I would like to put my <code>append("&lt;h1&gt;my text selected&lt;/h1&gt;")</code> just before the <code>&lt;p&gt;</code>. It’s my problem, because my <code>&lt;p&gt;</code> elements don’t have <code>id</code> or <code>class</code>. So do you know a means to put my append just before the <code>&lt;p&gt;</code> where my text has been selected?</p> <p>I don’t know if with my bad English you’ll understand me!</p> <p>Thanks very much for your help. </p>
javascript
[3]
4,321,532
4,321,533
Setting column header text for a UITableView in iPhone
<p>How do I make a UITableView column header text, like a C#/.NET grid?</p> <p>I make only records, but I can't set the UITableView column header text. And I want proper formating in UITableView..</p>
iphone
[8]
2,953,980
2,953,981
C# convert DOMAIN\USER to USER@DOMAIN
<p>I currently have the following code:</p> <pre><code>string user = @"DOMAIN\USER"; string[] parts = user.Split(new string[] { "\\" }, StringSplitOptions.None); string user = parts[1] + "@" + parts[0]; </code></pre> <p>Input string <code>user</code> can be in one of two formats:</p> <pre><code>DOMAIN\USER DOMAIN\\USER (with a double slash) </code></pre> <p>Whats the most elegant way in C# to convert either one of these strings to:</p> <pre><code>USER@DOMAIN </code></pre>
c#
[0]
4,836,909
4,836,910
Android - how can I create inapp products without making the app live?
<p>I am reading instructions here: <a href="http://developer.android.com/training/in-app-billing/test-iab-app.html" rel="nofollow">http://developer.android.com/training/in-app-billing/test-iab-app.html</a></p> <p>and it says to upload your app (which I did) and then I would be able to create billing items for it. But I do not see a way to create the items for users to purchase. Could someone please list the steps to do that?</p> <p>Thank you!</p>
android
[4]
5,695,019
5,695,020
In python beyond 'exec string' is there a way to 'import' using the db as a filesystem
<p>Although it does not seem possible, I wanted to put this out there to see if others had some innovative solutions to 'dynamically loading and executing code in python'</p> <p>So if one saved code in a database, one could read it and 'exec it', however if one wanted to use it in a similar fashion to the filesystem, one would need to </p> <ol> <li>'save and load the compiled .pyc' </li> <li>create an 'import dbimp' ala 'import imp' etc.</li> </ol> <p>any pointers? ideas? thoughts?</p>
python
[7]
3,531,006
3,531,007
PHP source code for inbuilt functions
<p>Are PHP functions such as <code>in_array()</code> written in PHP Or C ? Where can i find the source code for these ? Or do i need to be part of the PHP team to get get access to these ? After several googling attempts i am unable to locate any documentation on the matter. </p> <p>Edit: I'm fully aware that PHP is open source, the question is more about whether they are written in PHP or native C and how i can get access to the code. </p>
php
[2]
5,847,067
5,847,068
javascript--can't get textContent of [Object Text]?
<p>I want the script to find where it says, "anyword" in the xml (within the tag of course), and stop on that. the below accomplishes that fine. </p> <pre><code> var xmlDoc = loadXMLDoc("nhl.xml"); var x = xmlDoc.getElementsByTagName("tagname"); for (var i=0;i&lt;=x.length;i++){ if (x[i].textContent = "anyword") { var variable = x[i].textContent; } } </code></pre> <p>However I want to take it one step further and be able to set 'variable' to the next node after it finds 'anyword'. so i tried something like this and it came back with the very last element in the collection, instead of the next one.</p> <pre><code>var xmlDoc = loadXMLDoc("nhl.xml"); var x = xmlDoc.getElementsByTagName("tagname"); for (var i=0;i&lt;=x.length;i++){ if (x[i].textContent = "anyword") { var variable = x[i+1].textContent; } } </code></pre> <p>so i edited the last line again and made it</p> <pre><code>var variable = x[i].nextSibling.textContent; </code></pre> <p>this came back null. ripping my hair out here. if it helps to answer any, if i just put it <code>x[i].nextSibling</code> it comes back <code>[Object Text]</code> </p> <p>any help?</p>
javascript
[3]
3,146,834
3,146,835
what is the uses cases in which order in key value associative container is useful
<p>I am wondering in which uses cases, we can be interested by having an ordered associative container.</p> <p>In other terms, why use <code>std::map</code> and no <code>std::unorderd_map</code></p>
c++
[6]
172,362
172,363
jQuery: Ajax Sorting JSON
<p>For some reason, I'm having problems sorting an AJAX Request. </p> <p>First, Here is my controller data (this returns sorted):</p> <pre><code>public function get_agents() { $this-&gt;autoRender = false; $this-&gt;Agent-&gt;contain(); $agents = $this-&gt;Agent-&gt;find('list', array('conditions' =&gt; array('referral_partner' =&gt; 0), 'order' =&gt; array('name'))); echo json_encode($agents); } </code></pre> <p>This is my jQuery code to retrieve/sort (and fill a SELECT box):</p> <pre><code>$.ajaxSetup({ async: false }); $.getJSON("/agents/get_agents",{ajax: 'true'}, function(j) { var agents_options = ''; $.each(j, function(key, value){ agents_options += '&lt;option value="' + key + '"&gt;' + value + '&lt;/option&gt;'; }) $('#t' + agents_counter).html(agents_options); }); </code></pre> <p>The jQuery is not keeping the same sort order.</p>
jquery
[5]
4,549,195
4,549,196
noob python question, extract letter from list
<p>not sure why this isn't working. error I'm getting: <code>ord() expected a character, but string of length 0 found</code></p> <p>code: </p> <pre><code>phrase = 'test' number = 0 text = 0 random1 = '' while (number &lt;= len(phrase)): letter = phrase[number:number+1] text = ord(letter) - ord('a') .... number = number + 1 </code></pre> <p>if a print letter, i get the <code>t</code> for the first iteration</p> <p>thanks,</p>
python
[7]
474,801
474,802
How can I calculate the age of a person in year, month, days in PHP?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/453208/how-can-i-calculate-the-age-of-a-person-in-year-month-days">How can I calculate the age of a person in year, month, days?</a> </p> </blockquote> <p>I want to calculate the age of a person given the date of birth and the current date in years, months and days relative to the current date.</p> <p>For example:</p> <pre><code>&gt;&gt;&gt; calculate_age(2008, 01, 01) 1 years, 0 months, 16 days </code></pre>
php
[2]
4,033,525
4,033,526
Java library for managing primary - secondary entities
<p>I am looking for a generic java library that solves the problem of primary - secondary entities (like a connection manager that manages connections to primary and secondary servers and returns connection object accordingly depending on availability). I searched but couldn't find relevant answers. Can some one give me a lead as to whether there exist such a library and if so please specify. Thank you</p>
java
[1]
716,228
716,229
Python Parsing fasta format to line-based sequence
<p>I need a python script to parse fasta format to line-based sequence. </p> <p><strong>I need to change this:</strong></p> <pre><code>&gt;GeneID12345 ATTACATATACCATACC CCATATTAATCCGAGGG TTACCTATAGGTATACC &gt;GeneID12346 TTGATACCATATATCCC ATATGCCCTATATTCCT TTACCTATC </code></pre> <p><strong>To this:</strong></p> <pre><code>GeneID12345 ATTACATATACCATACCCCATATTAATCCGAGGGTTACCTATAGGTATACC GeneID12346 TTGATACCATATATCCCATATGCCCTATATTCCTTTACCTATC </code></pre>
python
[7]
25,650
25,651
How to get sections using CoredataTableViewController?
<p>I need to display data as two sections which is coming from Core data &amp; I want to display the data using CoredataTableViewController. How can I do this? </p>
iphone
[8]
2,909,064
2,909,065
python re match string in a file
<p>I want to match all the lines in a file either starting with <code>0D</code> and has 15 <code>Characters</code> or just having 15 digits. How can i do this</p> <pre><code>p_number = re.compile(r'(\d{15})') f=open(infile) for l in f: aa=re.findall(p_number,l) if aa &gt; 0: print aa f.close() </code></pre> <p><code>EDIT</code></p> <p>If only the pattern is in the starting of the line.</p>
python
[7]
3,681,480
3,681,481
python, break function after 3 seconds
<p>Sometimes, my function will hang. If the function is longer than 3 seconds. I want to quit from this function, how to do this?</p> <p>Thanks</p>
python
[7]
5,283,209
5,283,210
light confirm script
<p><a href="http://lalalafactory.blogspot.com/2008/02/light-alet-lightalertjs.html" rel="nofollow">http://lalalafactory.blogspot.com/2008/02/light-alet-lightalertjs.html</a></p> <p>Can anyone tell me what to change that JS confirm button will also work. I add </p> <pre><code>function confirm(obj){ new LightAlert(obj); } </code></pre> <p>but still works like alert not confirm.</p>
javascript
[3]
4,663,000
4,663,001
Cannot access android.R.drawable.timepicker_input
<p>Hello there i'm trying to write a layout similar to the timepicker widget layout.</p> <p>So i decided to use the android framework layouts but i can't use them It seems that if i write android.R.drawable.timepicker_input or other timepicker related drawables i get them this Eclipse error:</p> <blockquote> <p>android.R.drawable.timepicker_up_btn cannot be resolved</p> </blockquote> <p>So i tried to import all the pngs and xml from the android source but eclipse says there is an error in the manifest regarding the icon.</p> <p>Ideas? </p>
android
[4]
1,922,202
1,922,203
Is it possible to do object initialization in JavaScript similar to C#?
<p>More specifically, for a random class with two public properties, in C# you can do something like this : </p> <pre><code>new Point() { Y = 0, X = 0 } </code></pre> <p>Is it possible to do something similar in JavaScript? I was thinking of something along the line of :</p> <pre><code>{ prototype : Object.create(Point.prototype), X : 0, Y : 0 } </code></pre> <p>but I don't think it works as intended. Or a simple copy function : </p> <pre><code>function Create(object, properties) { for (p in properties) object[p] = properties[p]; return object; } </code></pre> <p>so the object initialization would become : </p> <pre><code>Create(new Point(), {X : 0, Y : 0}); </code></pre> <p>but there is an extra object creation. Is there a better way of achieving this?</p>
javascript
[3]
4,705,031
4,705,032
Deleting in C++
<pre><code>struct item { unsigned int a, b, c; }; item* items[10]; delete items[5]; items[5] = NULL; </code></pre> <p>The above code works </p> <p>But the below method is not working</p> <pre><code>int * arr1[30]; delete (arr1+5); </code></pre> <p>I am a beginner, Please tell me why I am able to delete in case of structure pointer but not in case of int pointer</p>
c++
[6]
947,575
947,576
c# assign string value based on bool value which can be nullable
<p>Here is my code:</p> <pre><code> stringValue = microData.BoolValue.HasValue ? "True" : "False"; </code></pre> <p>What I am trying to do is assign a stringvalue based on a Boolvalue. if BoolValue has a value I like to do the following:</p> <p>Assign stringValue = "True" if BoolValue is true. Assign stringValue = "False" ib BoolValue is false.</p> <p>If Boolvalue does not have a value, assign it to null. </p> <p>What i have above does not seem to work. </p>
c#
[0]
2,213,866
2,213,867
How to display child page from specific parent page in homepage?
<p>How to display child page from specific parent page in homepage ?</p> <p>This is my page structure</p> <pre><code>Home About Us Hotel Category Hotel A Room 1 Room 2 Hotel B Room 1 Room 2 Hotel C Room 1 Room 2 Contact Us </code></pre> <p>And i try to achieve this at homepage(parent page is Hotel Category : id=8)</p> <pre><code>Hotel A Hotel B Hotel C </code></pre> <p>List Hotel A, Hotel B and Hotel C with some except and thumbnail image(this magic field)</p>
php
[2]
101,196
101,197
PHP - DYNAMIC PAGE counter increment
<p>I have a dynamic page , which fetch data from database . Say for eg there are 2 record which is generated depending on query . So what i want to do is when some one click the Home link on 1st record , it should go to next page and over there php code is there which will increment the counter that is how many times the page is visted </p> <p>Similarly when 2nd record Home link is clicked it should go to some page and then again again counter for that page is incremented </p> <p>so say eg </p> <p>Home Page - 1st Record - Page : <a href="http://www.abc.com/Wakad-T4248349" rel="nofollow">http://www.abc.com/Wakad-T4248349</a></p> <p>Home Page - 2nd Record - Page : <a href="http://www.abc.com/Himn-T3333333" rel="nofollow">http://www.abc.com/Himn-T3333333</a></p> <p>Or another way of doing this , please help </p> <pre><code>&lt;div id="menubar"&gt; &lt;ul&gt; &lt;li class="current_page_item"&gt; &lt;a href="count.php" name="abc&lt;?php $i; ?&gt;"&gt;Home&lt;/a&gt; &lt;?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="menubar"&gt; &lt;ul&gt; &lt;li class="current_page_item"&gt; &lt;a href="count.php" name="abc&lt;?php $i; ?&gt;"&gt;Home&lt;/a&gt; &lt;?php $_SESSION['Home']=$row['ID']; echo $_SESSION['Home'];?&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
php
[2]
4,403,423
4,403,424
Javascript to replace text in Gmail message (Chrome Extension)
<p>I'm trying to write a Chrome Extension which will replace a string of text in Gmail messages.</p> <p>If I open a Gmail message and click the print button to see it in print view and run the extension it works well and replaces all instances of the string.</p> <p>However, if I run the extension in the normal Gmail discussion view it causes the page to refresh and it does not actually replace any of the text.</p> <p>Here is the code I'm using. Any ideas what I'm doing wrong?</p> <pre><code>function doIt(){ findAndReplace("Father","Mother"); } var haystackText = ""; function findAndReplace(needle, replacement) { if (haystackText.length == 0) { haystackText = document.body.innerHTML; } var match = new RegExp(needle, "ig"); var replaced = ""; if (replacement.length &gt; 0) { replaced = haystackText.replace(match, replacement); document.body.innerHTML = replaced; } } doIt(); </code></pre> <p><strong>Update:</strong> Here is the updated code I'm using after Felix Kling's help. Similar issue to the one above, it works in print preview but not in the regular Gmail view. It does not however reload the page.</p> <pre><code>function findAndReplace(root, needle, replacement) { var children = root.childNodes; var pattern = new RegExp(needle, 'ig'); var node; for(var i = 0, l = children.length; i &lt; l; i++) { node = children[i]; if(node.nodeType === 3) { // we have a text node node.nodeValue = node.nodeValue.replace(pattern, replacement); } else if(node.nodeType === 1) { // Element node findAndReplace(node, needle, replacement); } } } function doIt(){ findAndReplace(document,"Father","Mother"); } doIt(); </code></pre>
javascript
[3]
4,989,725
4,989,726
how to customize DatePickerDialog?
<p>i want to customize DatePickerDialog. My core objective is to change the theme of whole DatePickerDialog. </p> <p>is this possible to customize the theme of DatePickerDialog.</p> <p>if this not possible then i want the sample code for any date picker.</p>
android
[4]
1,012,199
1,012,200
Find if HashMap contains chosen value and return key
<p>Sorry, Is there any way to find if my HashMap contains entry ( key,value) with value="x" and to go through all entries sequentially ?</p>
java
[1]
2,929,753
2,929,754
wait , notify and notifyall in java?
<p>Please let me know that where i can find the suitable and simple example to use wait(),notify() and notifyall() metods in java.....</p>
java
[1]
63,134
63,135
Java collections that spool to disk
<p>I'm running out of memory in Java due to some very large Lists and Sets built up over the course of a transaction and iterated over just once at transaction's end. Are there any libraries that provide Java collections that can spool their serializable contents to disk when the collection size exceeds a given threshold?</p>
java
[1]
2,092,897
2,092,898
Regex for filtering input in post field
<p>The only possible value this field can have is <code>P</code> followed by a <code>0,1,2,3,4</code> and <code>0,1,2,3,4</code></p> <pre><code>$option_print = $this-&gt;input-&gt;post('print'); if (!preg_match('^/p[0-4][0-4]/', $option_print)) { redirect('#example'); } else { ... } </code></pre> <p>Example of VALID inputs: </p> <ul> <li><code>p00</code> -> valid</li> <li><code>p10</code> -> valid</li> </ul> <p>Example of INVALID inputs: </p> <ul> <li><code>v00</code> -> invalid</li> <li><code>f10</code> -> invalid</li> <li><code>ffs</code> -> invalid</li> </ul> <p>So how should my <code>regex</code> be properly structured to filter for VALID inputs?</p>
php
[2]
1,029,582
1,029,583
Passing C# custom objects in Session between asp.net web pages
<p>I have a frustrating issue when trying to pass a custom object from 1 page of a web site to another. When I try to use the object from session on the page 2 it is null. I believe that my syntax is correct as when I take the code out of my larger solution and run it on it's own it works fine.</p> <p>I am wondering if there are any settings in visual studio, aspx files, project properties that may be set on my project that may be causing this session object not to work?</p> <p>Simplied syntax that I am using is; on page1</p> <pre><code>Person p = new Person; p.name = "john"; p.secondName = "doe"; Session["person"] = p. Response.Redirect("Page2.aspx") </code></pre> <p>Page 2 on page load method</p> <pre><code>Person p = (person)Session["person"] textbox1.Text = p.name; textbox2.Text = p.Secondname; </code></pre> <p>As I said this code works fine on it's own but not as part of my larger works project. Any ideas on why this may not be working would be greatly appreciated</p>
asp.net
[9]
1,133,782
1,133,783
Is ASP.NET Web Forms source code available for download anywhere?
<p>I noticed this site <a href="http://aspnetwebstack.codeplex.com/" rel="nofollow">http://aspnetwebstack.codeplex.com/</a>. Is web forms source available?</p>
asp.net
[9]
4,791,412
4,791,413
iPhone drop down list
<p>I didn't find the drop down list in the iPhone library. Instead of drop down list, is there any other alternative. Please let me know.</p> <p>Thanks</p>
iphone
[8]
845,597
845,598
asp.net event related problem
<p>hello friends i have a check box list which contains all the courses kept in the data base(on page load) now i want that on some event of check box list all branches corresponding to each checked box of course check box list should be list in another check box list(that is the business logic i will do my own) but the problem is that i am not finding any event where i can send all selected check box list value and can generate appropriate result, if any alternate control or solution you can suggest then please suggest me this.</p>
asp.net
[9]
903,189
903,190
implementation of string class
<p>I'm interested in the implementation of the <code>reverse iterator with rbegin(), rend() and operator++ of the class string</code>, I can't find it in google, how can I do it? thanks in advance for any help or any link</p>
c++
[6]
1,366,827
1,366,828
Should I use getApplicationContext or Activity.this in a long running AsyncTask
<p>I have a long running Async Task that sends some data to my server and then stops. The whole process may involve a few requests and response. I have to read data from database, send it and handle the response and update my database accordingly. I am using content providers to read and update data from database.</p> <p>Now to use the Content Provider, I have to call the getContentResolver() method on context. So I am wondering of I have to use getApplicationContext or just pass the Activity.this to my methods. </p> <p>I saw a few posts <a href="http://stackoverflow.com/questions/1026973/android-whats-the-difference-between-the-various-methods-to-get-a-context">like this</a> explaining the difference between the two and in most of them they advice us to not use getApplicationContext if possible. I although do not want my AsyncTask to lose the context from Activity.this when the Activity is destroyed or when orientation changes. So I am wondering if I can use getApplicationContext in my case or will using Activity.this fit my requirement.</p>
android
[4]
1,209,445
1,209,446
Why is there an out keyword for arguments when there is already ref?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/388464/c-whats-the-difference-between-the-ref-and-out-keywords">C# Whats the difference between the &#39;ref&#39; and &#39;out&#39; keywords</a> </p> </blockquote> <p>I am a C++ programmer refreshing my knowledge on C# - it is proving to be a mindf*** at times.</p> <p>I cannot see the point of an out parameter, when the ref keyword already allows one to directly manipulate the passed in variable rather than a (presumably stack allocated) copy?</p> <p>The implementors of the language are smarter than I am. Ergo, there must be a reason why the out keyword exists. However, I cannot fathom why it would be needed. Is it superfluous or is it really useful in some scenarios? (which scenarios?).</p> <p>On the subject of passing by ref, I also don't understand the imposed restriction of the variable being non-const. It seems like an unnecessary imposition - if you have a heavy const object (say a massive hashtable) that you want to pass to a function. There must be a reason for this (unless its too much "hand holding" to prevent newbies from shooting themselves in the foot).</p> <p>Can someone shed some light on why this restriction exists?</p>
c#
[0]
179,675
179,676
How do I append a string to a char?
<p>How do I append a string to a char? strcat(TotalRam,str); is what i got but it does not support strings</p>
c++
[6]
2,374,468
2,374,469
Add a runnable thread inside an Async Task for splash screen delay
<p>Hi I wanted to add a delay on my splash screen using a Async Task but I can't figure out how should I do it. Here's my DoInBackground code so far:</p> <pre><code>@Override protected Integer doInBackground(String... params) { Thread SplashThread = new Thread() { @Override public void run() { try { int waited = 0; while(running &amp;&amp; (waited &lt; delayTime)) { sleep(100); if(running) { waited += 100; } } } catch(InterruptedException e) { // do nothing } finally { finish(); stop(); } } }; SplashThread.start(); return null; } </code></pre> <p>I think the part of the return null is the main cause of problem since it's ending up my Async Task even my SplashThread is still running in background leaving a leak on thins part onwards which lead to error. I also tried to use counDownTimer as a subtitute but this leads in the same problem. Any ways to do this properly?</p>
android
[4]
3,224,340
3,224,341
How to: Define theme (style) item for custom widget
<p>I've written a custom widget for a control that we use widely throughout our application. The widget class derives from ImageButton and extends it in a couple of simple ways. I've defined a style which I can apply to the widget as it's used, but I'd prefer to set this up through a theme. In R.styleables I see widget style attributes like "imageButtonStyle and "textViewStyle". Is there any way to create something like that for the custom widget I wrote?</p> <p>Thanks,</p> <p>J</p>
android
[4]
5,135,532
5,135,533
Image has to change on browser continuously and automatically when image is changed on web server (ASP.NET)
<p>I have created a desktop application which continuously changes the image on a fixed path and fixed filename 00.jpg. The image is in the path of my web site folder. The image is viewed on browser by . But the image is not changing continuously on the browser.</p> <p>I tried using both client (javascript) and server (asp.net) timers but It does not result. Here is my ASP.net AJAX Timer code and markup:</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ScriptManager runat="server"&gt;&lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel ID="up1" UpdateMode="Conditional" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Image ImageUrl="00.jpg" ID="img1" runat="server" /&gt; &lt;asp:Timer ID="Timer1" runat="server" Interval="100" ontick="Timer1_Tick"&gt;&lt;/asp:Timer&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;/form&gt; protected void Timer1_Tick(object sender, EventArgs e) { string xx = Request.Url.AbsoluteUri; xx = xx.Replace ("Default.aspx","00.jpg"); img1.ImageUrl = xx; up1.Update(); } </code></pre>
asp.net
[9]
3,035,823
3,035,824
After spliting a string using stringspilt how will I store it in an arraylist?
<p>I have a string variable similar to</p> <pre><code> String my = "split it"; </code></pre> <p>I split this using <code>split()</code>.</p> <pre><code> java.util.Arrays.toString(my.split("\\s+")) </code></pre> <p>The output is [split it]. But I want to store this in an arraylist, in FIRST index split and in SECOND index. Pls let me know how will I can achieve this.Thanks in advance.</p>
java
[1]
1,256,619
1,256,620
Expecting some solution for implemeting listview with checkboxes .....
<p>I want to implement a listview with textview and checkbox per row of a list. I am doing that using LayoutInflator. By this I am getting whatever I want in a list. But whenever I scroll the list, functions from my listviewadapter class calls again and again and recycles the list every time.</p> <p>Because of this my checkbox state is not maintaining and also if I checked first item of list it will also checks the second last item of a list itself. I tried to find out by debugging my code. I came to know that once my all items from arraylist got its view this getView() function picks some random position and replace the view on that position.</p> <p>I am totally confused ........ has anybody implemented such kind of listview please tell me the solution.</p> <p>Thanks.</p>
android
[4]
1,409,993
1,409,994
Android:Multi touch doesn't work as expected?
<p>Help me in resolving the below issue. </p> <p>I have three image buttons on screen. All these three buttons controlled under ontouchlistner as below. </p> <p>buttonOne.setOnTouchListener(this); buttonTwo.setOnTouchListener(this); buttonThree.setOnTouchListener(this); </p> <p>I override "public boolean onTouch(View v, MotionEvent event)". Under this i check for these three image buttons touch events like below. </p> <pre><code>ImageButton imageBtn = (ImageButton) v; if ( imageBtn == buttonOne ) // first button touch ..Log.. else if ( imageBtn == buttonTwo ) ..Log.. else if ( imageBtn == buttonThree ) // first button touch ..Log.. </code></pre> <p>My problem is, as it is under multi touch event handler like above, it does not detect when touch all three button at a time to try to produce multi touch effect, instead it detects only one imagebutton touch at a time even though i touch all three image buttons. As i am developing this project on Android 1.6 SDK, is there any problem accessing my requirement(multi touch) (or) it is a known issue? I am hoping that, when it works for single button touch, why shouldn't it work when clicking three imagebuttons at a time to produce three logs printed as per my above code? </p> <p>How do i resolve it for my case? </p> <p>Please don't question me why i am still developing on 1.6 for such a requirement. </p> <p>Thank you. Appreciate your suggestions !</p>
android
[4]
2,891,482
2,891,483
Increase size of menu item
<p>I have created menu using xml.I want to change the size of the menu items and also the </p> <p>background color. Is it possible to make changes in the menu.Please suggest me,any help </p> <p>would be appreciable.</p>
android
[4]
3,846,660
3,846,661
Change <layer-item> items by Java code
<p>I have the following XML:</p> <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@+id/customPlayerProgressBg"&gt; &lt;shape&gt; &lt;gradient android:startColor="#FF999999" android:endColor="#FF999999" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:id="@+id/customPlayerProgressSecondary"&gt; &lt;clip&gt; &lt;shape&gt; &lt;gradient android:startColor="#FF5C3C68" android:endColor="#FF5C3C68" /&gt; &lt;/shape&gt; &lt;/clip&gt; &lt;/item&gt; &lt;item android:id="@+id/customPlayerProgress" &gt; &lt;clip&gt; &lt;shape&gt; &lt;gradient android:startColor="#FF5C3C68" android:endColor="#FF5C3C68" /&gt; &lt;/shape&gt; &lt;/clip&gt; &lt;/item&gt; &lt;/layer-list&gt; </code></pre> <p>I want to change the "customPlayerProgress" and the "customPlayerProgressSecondary" by Java code. How can that be accomplished?</p>
android
[4]
5,493,951
5,493,952
Existing SQL database android help
<p>I am new to android programming and i am trying to make an app that will interface with a website i have. It is a movie website with all of its information stored in SQL database. I know how to write the requests and queries in .asp but dont know how to get information from the database in my app. I want the user to be able to enter a movie title, and through a couple of stored procedures that are in my SQL database, return the info on that movie(actor, budget, genre....). I would like to have little info stored on the device, have all of the queries being sent to my SQL server and just have the info being returned.</p> <p>So my question boils down to, how do i link my existing SQL database with an android app.</p> <p>Any help would be great.</p> <p>Thanks Basketball4567</p>
android
[4]
1,203,497
1,203,498
find element and set the value
<p>i have a div element with id <code>hover-1</code>, within the div i have a hidden form element having class name <code>text_page_title</code> in the hierarchy. i got the parent div element id dyanamically in a variable, now i want to find the hidden element having class name <code>text_page_title</code> and set its value to 'foo'</p> <p>structure is like:</p> <pre><code>&lt;div id="hover-1"&gt; &lt;input type="hidden" class="text_page_title"&gt; &lt;/div&gt; &lt;div id="hover-2"&gt; &lt;input type="hidden" class="text_page_title"&gt; &lt;/div&gt; </code></pre> <p>I m trying to do it like:</p> <pre><code>$($parentId).find('input.text_page_title').val('foo'); </code></pre> <p>but it doesnt work, m i missing something?</p>
jquery
[5]
5,105,581
5,105,582
Android: Why not make every method Synchronized?
<p>Is there any downside to making every one of your methods synchronized in Android?</p>
android
[4]
2,058,777
2,058,778
Open default gallery only
<p>I want to select files i.e images, video ..from the default gallery but when i open gallery using following function its also gives me some unnecessary option for file selection like "File Manager, OI file Manager". Those application are installed on my phone and i dont want those application when i open and select media files.</p> <p>plz help</p> <pre><code>Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("video/*, images/*"); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); intent.setAction(Intent.ACTION_GET_CONTENT); tartActivityForResult(Intent.createChooser(intent, "Select File"), REQUEST_CODE); </code></pre>
android
[4]
1,550,817
1,550,818
JavaScript special characters/regular expressions
<p>I'm trying to learn from reading Mozilla documentation for regular expressions, but there's one thing I don't get. For the special character <code>\s</code> it gives the following example</p> <p>/\s\w*/ matches ' bar' in "foo bar."</p> <p>I understand that \s is the special character for white space, but why is there a w* in the example?</p> <p>doesn't <code>/\s/</code> also match ' bar' in "foo bar."?</p> <p>What's with the <code>w*</code>?</p>
javascript
[3]
623,629
623,630
checking whether device is connected to web
<p>I'm trying to develop an app which first checks if the device is connected to web or not.</p> <p>If yes, then certain activity is started else other activity will start.</p> <pre><code>ConnectivityManager cm =(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); boolean isConnected = ni.isConnected(); if (isConnected) { //connected, do something online. } else { //Not connected. } </code></pre> <p>I have written the above code as an event when the particular button is pressed. But when i run it on the emulator and press that button, i'm getting a force close message. </p> <p><strong>Note:</strong> I have added the activities in the manifest file and also have declared following user-permissions:</p> <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; </code></pre> <p>Can anyone please help me with this problem and point in the right direction?</p>
android
[4]
2,939,034
2,939,035
In python, how can I do a non-blocking system call?
<p>In Python, is it possible to do a non-blocking system call without forking off a thread? i.e., can I avoid:</p> <pre><code>import thread thread.start_new_thread(os.system,('cmd',)) </code></pre>
python
[7]
3,223,872
3,223,873
jQuery selector with context passing
<p>I am working on a jQuery tutorial and there's something that I don't quite understand why. Below is the section that I cut out of the tutorial. The sentence in bold is the part that I don't understand and would like some expert to explain it to me. Much appreciated!</p> <p>"A very common problem encountered when loading content by Ajax is this: When adding event handlers to your document that should also apply to the loaded content, you have to apply these handlers after the content is loaded. To prevent code duplication, you can delegate to a function. Example:</p> <pre><code> function addClickHandlers() { $("a.remote", this).click(function() { $("#target").load(this.href, addClickHandlers); }); } </code></pre> <p>$(document).ready(addClickHandlers); Now addClickHandlers is called once when the DOM is ready and then everytime when a user clicked a link with the class remote and the content has finished loading.</p> <p>Note the $("a.remote", this) query, this is passed as a context: For the document ready event, this refers to the document, and it therefore searches the entire document for anchors with class remote. <strong>When addClickHandlers is used as a callback for load(), this refers to a different element: In the example, the element with id target.</strong> This prevents that the click event is applied again and again to the same links, causing a crash eventually."</p>
jquery
[5]
2,609,977
2,609,978
The simplist jQuery menu to select the html for an empty div
<p>I have a with about six <code>&lt;li&gt;</code>'s ... I want each to be a menu choice, you know, as usual with a link color and a hover color. Any selected <code>#ThisStory</code> clicked loads ThisStory.html into an empty division called <code>#storyDiv</code>.. Upon making another selection, html of the new id overwrites the previous content of <code>#storyDiv</code>.</p> <p>I know this is basic, but I seem to be lower than basic.. </p> <p>I've seen something like this done by wrapping each menu item with a , I think, and giving the span an id?? or some such... Must it be done so round about? Can't each element <code>&lt;li&gt;</code> directly be given an id?</p> <p>Many thanks in advance!!</p>
jquery
[5]
5,373,602
5,373,603
Check if an element is a child of a parent
<p>I have the following code.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;div id="hello"&gt;Hello &lt;div&gt;Child-Of-Hello&lt;/div&gt;&lt;/div&gt; &lt;br /&gt; &lt;div id="goodbye"&gt;Goodbye &lt;div&gt;Child-Of-Goodbye&lt;/div&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; &lt;!-- function fun(evt) { var target = $(evt.target); if ($('div#hello').parents(target).length) { alert('Your clicked element is having div#hello as parent'); } } $(document).bind('click', fun); --&gt; &lt;/script&gt; &lt;/html&gt; </code></pre> <p>I expect only when <code>Child-Of-Hello</code> being clicked, <code>$('div#hello').parents(target).length</code> will return >0.</p> <p>However, it just happen whenever I click on anywhere.</p> <p>Is there something wrong with my code?</p>
jquery
[5]
2,424,146
2,424,147
Can't write text into textbox in ASP.NET web app
<p>I have an ASP.NET web application.</p> <p>In the codebehind for the .ascx page (which I embed as below), I attempt to write a string to a textbox in a method like this:</p> <p>Code for embedding control:</p> <p>Control ctrl = Page.LoadControl("/RackRecable.ascx"); PlaceHolder1.Controls.Add(ctrl);</p> <p>Method to make string for inserting into textbox:</p> <pre><code> string AppendDetails() { StringBuilder sb = new StringBuilder(); sb.Append("msg" + " " + textbox1.Text etc etc ); return sb.ToString(); } </code></pre> <p>Called as (in codebehind event handler for button click):</p> <pre><code> this.TextBox4.Text = AppendDetails(); </code></pre> <p>I call it by using ATextBox.Text = AppendDetails (in the button click event handler). The textbox TextBox4 is in the designer file so I am confused why the text does not get written into this textbox (it is readonly and enabled).</p> <p>When stepping through, the textbox4 control will successfully show the text I want it to display in quick watch but not in the actual page, it won't.</p> <p>Any ideas?</p> <p>Thanks</p>
asp.net
[9]
2,876,862
2,876,863
Javascript for adding a custom attribute to some elements
<p>Given a section of HTML, can I selectively pick some types of elements (ex: input type) and add a custom attribute using Javascript. I would also need to remove this attribute if it exists.</p> <p>I have done this earlier using JQuery but am unable to use JQuery for this particular task.</p>
javascript
[3]
4,085,200
4,085,201
fadeIn after jQuery post
<p>I have three forms on one page - "callback", "contact us" and "newsletter subscription".</p> <p>Each has it's own jQuery function to "post" the data (using <code>.post</code>) and then display any returned PHP. These forms only output simple error and successes depending on the form and the process.</p> <p>Now, here is where it gets a bit odd... all three of my forms work but only two work as expected:</p> <ol> <li>Response DIV hides</li> <li>Response DIV fills with returned HTML</li> <li>Response DIV fades in nicely.</li> </ol> <p>My main "contact us" form, however, is the odd one out... the response DIV immediately appears with no fade effects.</p> <p>I have read that I should first "hide()" the DIV - which I have tried without any success and nothing seems to work.</p> <p>I have noticed that if I return purely text (echoed by PHP) then the fade works.... but when I try to get it to output any HTML tags then it all fails and the DIVs appear immediately...</p> <p>My Form response:</p> <p><code>&lt;div&gt;&lt;span id="contactUsAjaxResponse"&gt;&lt;/span&gt;&lt;div&gt;</code></p> <p>My jQuery function</p> <pre><code>$(document).ready(function(){ $("#contactUsForm").submit(function(){ var responseDiv = '#contactUsAjaxResponse'; // add ajax-loader class to response div $(responseDiv).html('').addClass('ajax-loader'); // get form actiom var formAction = $(this).attr('action'); $.post(formAction, $("#contactUsForm").serializeArray(), function(data){ $(responseDiv).removeClass('ajax-loader').html(data).fadeIn('slow'); }); return false; //prevent default form action }); }); </code></pre> <p>Any echoed HTML is <code>&lt;php echo '&lt;div class="error"&gt;Content...&lt;/div&gt;'; ?&gt;</code> etc.</p> <p>I have a feeling it could be my CSS (could any <code>display: block;</code> or other entries be causing the problem?)</p> <p>Many Thanks</p>
jquery
[5]
5,385,692
5,385,693
custom iterator and insert_iterator
<p>I recently wrote my first custom iterator (Yay!) It's operating on top of a container (buffer), currently an std::vector buffer but should at least in theory work with any other standard container, of variable length byte encoded data. Nothing fancy. Basically what my iterator does is calculating how far to step to get to the next entry in the buffer. I'm using th std::bidirectional_iterator_tag for my iterator.</p> <p>Anyway I've been testing it a bit and it works perfectly when using it for iterating and some standard operations like std:distance or std::copy. </p> <p>Then I got the idea that it would be pretty neat to be able to insert new items into the buffer. How do we do that? Well I figuerd that as I now have an iterator I could use some std::insert function. Didn't find one, std::insert_iterator/std::inserter seems to be the way to go.</p> <p>Well that didn't work.</p> <pre><code>std::vector&lt;unsigned char&gt; dataBuffer; std::vector&lt;unsigned char&gt; otherDataBuffer; //*Fill dataBuffer with data* ByteCrawlerIterator&lt;std::vector&lt;unsigned char&gt; &gt; insertionPoint(dataBuffer.begin()); //*pick an insertion point (this works)* std::advance(insertionPoint, 5); //*this will produce a lot of really ugly and confusing compiler errors* std::insert_iterator&lt;std::vector&lt;unsigned char&gt; &gt; insert_itr(dataBuffer, insertionPoint); //*Well we don't get this far, but I intended to use it something like this* std::copy(ByteCrawlerIterator(otherDataBuffer.begin()), ByteCrawlerIterator(otherDataBuffer.end()), insert_it); </code></pre> <p>I was under the assumption that an insertion iterator was an adapter able to work with any iterator, even custom one. But I guess that was incorrect, what do I have to do to get my custom iterator to work with std::inserter? Or am I supposed to implement a custom insert_iterator? And when we are on the topic what about the reverse_iterator?</p>
c++
[6]
1,488,138
1,488,139
Accessing all the email IDs for each contact from the iphone contactlist through code
<p>I am new to iphone.presently i am working in project but i have struck in the middle of the project because of don't know how to access all the email id's for each contact from the iphone contactlist through coding.if anybody knows about this concept can you please help me.... </p>
iphone
[8]
632,040
632,041
Installing android SDK in eclipse offline
<p>I want install android on my computer but using the sdk it fails to download the packages due to my speed i think. I have extensively googled for several days but could not find any result i found a page which showed a way using the abyss server to install but lost it due to a powercut and could not find it again. If any one could share a link or a tutorial of installing android sdk and using it with eclipse would be great help.</p>
android
[4]
935,776
935,777
using buttons and textedit
<p>Hi all iam new to android can anybody help me. i have a total of 30 buttons if i click each button i should get a edit dialog with OK button where i will type some name and click OK button then that name should go and sit on that clicked button can anybody suggest how to go about it. Thanks in advance</p>
android
[4]
3,200,615
3,200,616
Is it a good pratice to make constructor explicit
<p>When designing a public API, is it a good practice to make the constructor as explicit?</p> <pre><code>class A { public: //explicit A(int i){} A(int i){} }; void fun(const A&amp; a) {} int main() { // If I use explicit for A constructor, I can prevent this mistake. // (Or shall I call it as feature?) fun(10); } </code></pre> <p>Or shall I allow implicit conversion, to allow user to call my API with less typing?</p>
c++
[6]
1,529,223
1,529,224
Is there any way in Java to access information about a type at runtime without fully loading the class?
<p>I'm trying to get a reference to a java.lang.Class which is on my classpath and look at the members on it with reflection. The trouble is, I'm trying to do this with only an incomplete classpath. By this I mean that the classpath contains all the classes I am interested in, but does not necessarily contain further classes which these classes might depend on. Therefore it is not possible to fully load the class in the normal way.</p> <p>Is this possible?</p>
java
[1]
3,091,424
3,091,425
Changing the GO button (soft keyboard) functionality in Android sdk
<p>I'm developing a login page in the android environment. The app itself consists of a simple webview and I have the login page already developed. Once I click on the textbox, the keyboard shows up as it should, however once I press the Go button on the right hand side of the keyboard, it simply refreshes the page, instead of log me in. On the computer when I press enter on the textbox, it will log me in, however on the app when I press the Go button, it just refreshes the page. Is there a way to fix this? Alternatively, is there a way to override the action of the Go button press? Or even a way to delete the Go button from the keyboard entirely?</p> <p>Any help is appreciated a lot Thanks Gilad</p>
android
[4]
327,017
327,018
Android ImageView.setImageURI scales image
<p>I have a view that I am drawing to a bitmap, saving to disk and then putting in an ImageView via setImageURI. However, when the image is displayed in the ImageView it is not being shown at the correct size. It is about 1/3 smaller than it should be. I'm guessing that this is a density issue, but I can't figure out what's going wrong (my emulator is WVGA). Ideas anyone?</p>
android
[4]
908,311
908,312
PHP - IF/ELSE not displaying the desired results
<p>In this query in looking for comments, and if there are any comments it should be displayed, if there are'nt any comments it should display No comments yet.</p> <p>The comments are displayed correctly but the if function to display that there arent any comments is not working.</p> <pre><code>$comments = mysql_query ("SELECT * FROM comments WHERE post_id = '". $_GET['id']."'"); while ($comment = mysql_fetch_array ($comments)) { //If there are'nt any results if(mysql_num_rows($comment) &lt; 0 ) { echo "No comments yet!"; } else { //If there are any results echo "&lt;p&gt;" . $comment['comment'] . "&lt;/p&gt; &lt;p&gt;&lt;b&gt;" . $comment['author'] . "&lt;/b&gt;, " . date("M j, Y ", strtotime($comment["date"])) . "&lt;/p&gt;"; } } </code></pre>
php
[2]
4,285,259
4,285,260
How to use SOCI C++ Database library
<p>i have an assignment to work with PostGre Database</p> <p>i have searched and found solution SOCI Library built in C++ . which works fin ewith PostGree database.</p> <p>i have no idea how to write a Program in Visual Studio or Visual Studio.Net .. an dhow to import and add SOCI header files reference into my project.</p> <p>i b thankful to you if anybody help me out in thi sregard..</p>
c++
[6]
3,357,386
3,357,387
Image caching and loading in Linear layout
<p>I am searching for fast solution how to cash images. </p> <p>I found many done this in loading in ListView images. </p> <p>However i need to load images into ImageButton which is subview of Linear layout. </p> <p>Maybe someone saw this implemented or could give me some tips how to do this ? </p> <p>Thanks.</p>
android
[4]
335,957
335,958
JSon Parsing error with double quotes
<p>I'm trying to parse the string "quotes":""living d life till i breathe my last"", using json parser but its not parsing.I come to know the problem,its due to these double quotes "quotes":""living… in the string.</p> <p>I have tried these things :</p> <p>str_response = [str_response stringByReplacingOccurrencesOfString:@"\'" withString:@""]; str_response = [str_response stringByReplacingOccurrencesOfString:@"""" withString:@"""]; str_response =[str_response stringByReplacingOccurrencesOfString:@"\"" withString:@""];</p> <p>But no success,nothing alb to replaces the double quotes with single quote I want the result: "quotes":"living d life till i breathe my last"</p> <p>Thanks for the help</p>
android
[4]
608,972
608,973
Convert UK date to US date in PHP with different separator
<p>How would you convert UK date to US date in PHP without much regard to separator:</p> <p>e.g.</p> <pre><code>01/01/2012 to 2012-01-01 </code></pre> <p>Thanks in advance!</p>
php
[2]
4,358,109
4,358,110
Generating graphs on-the-fly with JavaScript with mouseover "captions"
<p>I am developing a backend that requires to have graphs with information associated in a javascript why. The idea is to reproduce something similar to Google Analytics/Webmaster Tools:</p> <p><img src="http://i.stack.imgur.com/qFfXd.png" alt="example of graph"> </p> <p>I also like to reproduce the "hover" caption when someone moves throw the days.</p> <p>Does anybody knows if this is possible to do it with JavaScript? It's not allowed to use jQuery, so no "use jQuery" replies please.</p> <p>Thank you in advance</p>
javascript
[3]
855,096
855,097
How to create a custom browser in android
<p>Hi i am having a activity with a button, on click of the button it has to load a custom browser in a new activity not the default browser of android. and i need a way to exclude the history of the browser such that on back press it comes back to the previous activity without navigating to previous website. I am new to android and any ways to do this</p>
android
[4]
5,967,124
5,967,125
Development guide for ver 2.2 specifically
<p>I own a HTC Desire running 2.2 and I have decided to have some fun with programming apps for it. Some time back I had read an brief intro about Android at developer.android.com but because I wasn't too keen back then I just had it at the back of my mind.</p> <p>However, when I visited today, I see the tutorial upgraded to higher versions since 2.2. I guess stuff explained there won't work on 2.2. As I mentioned, I will be writing my apps for 2.2 and nothing else. So I didn't find it useful to continue reading it.</p> <p>Where can I find development guide for 2.2 specifically? Googling didn't help me at all. </p> <p>Also, I am not too keen on upgrading to any new version (I don't know if Desire would support them seamlessly anyway).</p> <p>Please help.</p>
android
[4]
55,300
55,301
C# Handling a .dat file created by another application
<p>I need to write an application which uses data stored in a .dat file created by another application. Basically the app which creates the .dat is a freeware app which collects info from an online game and stores the info. It also does some processing of the data. What i am planning to do is create a team tool which makes use of the stored data and do some further processing using our personal game knowledge.</p> <p>Now i know what are the possible contents of the .dat file but not sure how i can read the data from it. I would appreciate any help on how to extract all the data from this .dat file. Not asking to be spoon fed with all code but step wise instructions on how to go about this would be really appreciated.</p> <p>If you need any further info please do ask</p> <p>Regards</p> <p>EDIT: Opening the .dat file in wordpad i get the following:</p> <p><a href="http://i.stack.imgur.com/kZ1OH.jpg" rel="nofollow">http://i.stack.imgur.com/kZ1OH.jpg</a></p>
c#
[0]
1,106,822
1,106,823
How could I use the Android LVL in my premium key app?
<p>It seems that the commonly accepted approach to implement a paid "premium key" application is to have a the free app check if the paid one is installed to unlock features. This part is straight forward as is the implementation of the LVL but I cannot figure out how to combine both. If the paid app is never intended to be run, there is no way to call the License Verification Service. Only way I could think of was to have the free app invoke an intent from the paid one and wait for a response. The paid app could do the license verification. Problem with this approach is that when the free app calls the intent, it is paused and can be killed anytime by the OS. So nothing guarantees that the app is still running after the license check.</p> <p>Any ideas or suggestions on how to implement a paid app that would only be an unlock key but also implements the LVL?</p> <p>Thank you</p>
android
[4]
807,996
807,997
Continue the java code at catching the exception
<p>I am writing a java program for parsing an <code>XML</code> file and detecting if its <code>UTF-8</code> compliant. I've gotten that part working but when it catches the first exception (syntax error) it stops the execution. I want it to find all the errors and not just the first one. Is there any way I can log the errors and not stop it on the first one? Here's my code.</p> <pre><code> import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.InputSource; import org.xml.sax.SAXException; //import com.edankert.SimpleErrorHandler; public abstract class Wellformed extends DocumentBuilder { public static void main(String[] args) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(new SimpleErrorHandler()); builder.parse(new InputSource("contacts.xml")); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } import org.xml.sax.ErrorHandler; import org.xml.sax.SAXParseException; public class SimpleErrorHandler implements ErrorHandler { public void warning(SAXParseException e) { } public void error(SAXParseException e) { System.out.println(e.getMessage()); } public void fatalError(SAXParseException e) { System.out.println(e.getMessage()); } } </code></pre>
java
[1]
2,360,465
2,360,466
Download a PDF and rename it?
<p>I'm working on a little script to save some time. My script takes a given URL to a PDF and I want to download the PDF to the local computer, say to /Downloads but I want to rename the file with a name taken from a form. </p> <p>Is this possible with PHP?</p>
php
[2]
753,902
753,903
How do I truncate a string with dynamic length url slug?
<p>On my <code>slug</code> column I set the limit is <code>varchar = 100</code> and the values will store like this</p> <pre><code>how-do-i-truncate-a-string-with-dynamic-length-url-slug </code></pre> <p>I want the slug will be a <code>unique</code> key so I update the <code>slug</code> value with last auto increment id and new slug value is : </p> <pre><code>how-do-i-truncate-a-string-with-dynamic-length-url-slug-10 </code></pre> <p>So here the <code>last auto increment</code> will be a big number at the end..</p> <pre><code>preg_replace('/\s+?(\S+)?$/', '', substr($slugwithautoincrement, 0, 101)); </code></pre> <p>With this <code>preg_replace</code> it will <strong>remove</strong> my <code>auto increment number</code></p> <p>Question :</p> <p>How do I truncate the value fix to 100 characters without remove the last auto increment number?</p> <p>So result should be :</p> <pre><code>how-do-i-truncate-a-string-with-[....remove from here...]10 </code></pre>
php
[2]
1,360,837
1,360,838
jQuery show background image only on startpage
<p>How can i display a fullscreen, resizing background image only an the startpage. I have a div in the background that stretches over the full background, resizing on window.load. How can i hide this div unless the current page is startpage?</p>
jquery
[5]
1,252,350
1,252,351
"this" in JavaScript
<p>I'm trying to understand the syntax of how to put together a JavaScript function as an object.</p> <p>Q: Is this the right way to do it?</p> <p>The reason why I ask is because I'm looking at it in Firebug and I was hoping to be able to drill down and see the value of myVar and myVariable, but instead Firebug only says that "this" is an object Object.</p> <pre><code>var myObject = { init: function() { var myVar = 1; myObject.myVariable = 2; console.log('"this" when called as an object: ' + this); } } myObject.init(); </code></pre> <p>Also, what's the funny little syntax to call it directly upon declaration? Something about (), but when I remove the last line and put () at the end of the declaration, I get a syntax error.</p>
javascript
[3]