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
369,617
369,618
how to insert the text of a select box into a hidden field
<p>I need to insert the text of a selected text box into a hidden field, I'm not quite sure how to achieve that,</p> <p>any help would be appriciated.</p> <pre><code>&lt;form id="select"&gt; &lt;select name="select" id="select"&gt; &lt;option&gt;NY, 10&amp;quot;, £6.65&lt;/option&gt; &lt;option&gt;NY, 12&amp;quot;, £8.95&lt;/option&gt; &lt;option&gt;NY, 16&amp;quot;, £11.95&lt;/option&gt; &lt;option&gt;Chicago, 7&amp;quot;, £3.45&lt;/option&gt; &lt;option&gt;Chicago, 10&amp;quot;, £6.65&lt;/option&gt; &lt;option&gt;Chicago, 12&amp;quot;, £8.95&lt;/option&gt; &lt;option&gt;Chicago, 16&amp;quot;, £11.95&lt;/option&gt; &lt;option&gt;Chicago, Beast 24&amp;quot; x 18&amp;quot;, £19.95&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; &lt;form id="add-pizza"&gt; &lt;input type="hidden" name="my-item-name" value="" /&gt; &lt;/form&gt; </code></pre> <p>I need to insert the text of the text box into the hidden field value="".</p> <pre><code> $(function() { var str=""; $("#select option:selected").each(function() { str += $this.text() + ""; }); }); </code></pre> <p>thanks</p>
jquery
[5]
5,718,366
5,718,367
how to use java stringtokenizer?
<p>how to use java stringtokenizer for the below string</p> <p>|feild1|field2||field4|...</p> <p>i want java to take the blank as a field too, but stringtokenizer is skipping it.</p> <p>Any option to get it?.</p>
java
[1]
1,862,295
1,862,296
Java: check for null or allow exception handling
<p>I'm wondering about the cost of using a try/exception to handle nulls compared to using an if statement to check for nulls first.</p> <p>To provide more information. There's a > 50% chance of getting nulls, because in this app. it is common to have a null if no data has been entered... so to attempt a calculation using a null is commonplace. </p> <p>This being said, would it improve performance if I use an if statement to check for null first before calculation and just not attempt the calculation in the first place, or is less expensive to just let the exception be thrown and handle it?</p> <p>thanks for any suggestions :-)</p> <p>Thanks for great thought provoking feedback! Here's a PSEUDOcode example to clarify the original question: </p> <pre><code>BigDecimal value1 = null //assume value1 came from DB as null BigDecimal divisor = new BigDecimal("2.0"); try{ if(value1 != null){ //does this enhance performance?... &gt;50% chance that value1 WILL be null value1.divide(divisor); } } catch (Exception e){ //process, log etc. the exception //do this EVERYTIME I get null... or use an if statement //to capture other exceptions. } </code></pre>
java
[1]
4,186,560
4,186,561
psycopg2. Ident Authentication failed for user 'clutch'
<p>I have tried many links with the same error but when I try to connect to clutchio server, this error is displayed and the following message displays Starting clutchrpc on 0.0.0.0:41674... It takes long time and server never starts</p> <p>Could anyone please help me with the issue.</p> <p>This is my pg_hba.conf file:</p> <p>local all all md5</p> <h1>IPv4 local connections:</h1> <p>host all all 127.0.0.1/32 peer host all all 0.0.0.0/0 md5</p> <h1>IPv6 local connections:</h1> <p>host all all ::1/128 md5</p> <p>Thanks.</p>
android
[4]
1,818,584
1,818,585
Using PHP and MySQL to develop website
<p>I want to develop a professional website using PHP and MySQL. Can i do it in Windows 7 (64-bit) or i need to install linux based OS. How to go for it.</p>
php
[2]
3,114,155
3,114,156
How do I add white space between word
<p>I want to add space to word something like this</p> <pre><code>CountryName RegionName ZipPostalCode </code></pre> <p>to be</p> <pre><code>Country Name Region Name Zip Postal Code </code></pre> <p>Let me know how can be done with php</p>
php
[2]
786
787
Guard code after switch on enum is never reached
<p>I have just hit a confusing problem when trying to compile some code using g++ 4.4.3.</p> <p>The code below compiles fine, but instead of hitting the expected assert when I pass an 'invalid' enum value, the function just returns 1. What I find even stranger is that when I uncomment the lines pertaining to the E3 enum value, things start working as expected.</p> <p>The fact that there is no default entry in the switch block is by design. We compile with the -Wall option to get warnings of unhandled enum values.</p> <pre><code>enum MyEnum { E1, E2, //E3 }; int doSomethingWithEnum(MyEnum myEnum) { switch (myEnum) { case E1: return 1; case E2: return 2; //case E3: return 3; } assert(!"Should never get here"); return -1; } int main(int argc, char **argv) { // Should trigger assert, but actually returns 1 int retVal = doSomethingWithEnum(static_cast&lt;MyEnum&gt;(4)); std::cout &lt;&lt; "RetVal=" &lt;&lt; retVal &lt;&lt; std::endl; return 0; } </code></pre>
c++
[6]
1,201,736
1,201,737
How to replace words in file?
<p>In test.txt:</p> <pre><code>rt : objective tr350rt : objective rtrt : objective @username : objective @user_1236 : objective @254test!! : objective @test : objective #15 : objective </code></pre> <p>My codes:</p> <pre><code>import re file3 = 'C://Users/Desktop/test.txt' rfile3 = open(file3).read() for altext in rfile3.split("\n"): saltext = altext.split("\t") for saltword in saltext: ssaltword = saltword.split(" ") if re.search(r'^rt$', ssaltword[0]): print ssaltword[0], ssaltword[2] testreplace = open(file3, 'w').write(rfile3.replace(ssaltword[0], "")) if re.search(r'^@\w', ssaltword[0]): print ssaltword[0], ssaltword[2] testreplace = open(file3, 'w').write(rfile3.replace(ssaltword[0], "")) </code></pre> <p>I got:</p> <pre><code> : objective tr350 : objective : objective @username : objective @user_1236 : objective @254test!! : objective : objective #15 : objective </code></pre> <p>I am trying to replace only "rt" and all @ with space</p> <p>But from my codes all "rt" were replaced and only one @ was replaced.</p> <p>I would like to get:</p> <pre><code> : objective tr350rt : objective rtrt : objective : objective : objective : objective : objective #15 : objective </code></pre> <p>Any suggestion?</p>
python
[7]
5,852,486
5,852,487
SharedPreferences file not being removed on uninstall
<p>I have a suspicion that this might be due to my running a custom rom... but I figured I should at least come by and ask here.</p> <p>I'm working on an app that uses some SharedPreferences. Everything in that aspect works fine, but after completely uninstalling and then installing again, I found that my SharedPreferences values were still being picked up. I ended up uninstalling and then pulling up an adb shell and found that indeed... under /dbdata/databases/mypackagename/shared_prefs/ there were still files there. I would assume that they should have been removed...</p> <p>I'm using a Samsung Captivate running the Serendipity rom... Again, I can only imagine that that has something to do with it, but I'm not certain.</p> <p>Edit - I just completely wiped clean and put on the Firefly Rom and tested this out, experiencing the same thing. Is this possibly a Froyo bug (both have been 2.2 Roms)?</p>
android
[4]
1,539,959
1,539,960
Is there any way to track the server is going offline during ftp file download process via php
<p>Is there any way to track the server is going offline during ftp file download process via php?</p> <p>I've only found this function ftp_nb_continue() which has a returning value FTP_FAILED. Now it's seems to me that we only gonna receive this value if something goes wrong during the download, except the ftp server is shutting down or we lost connection. </p> <p>So my question is: Is there any way that i can log in file that the download is failed because of the server went offline.</p>
php
[2]
2,038,329
2,038,330
iPhone standard UI details
<p>Are there any UI standards with respect to font size, color, height of a section header in table view, padding, image size in a table cell etc. If yes, can you please guide me where can I found them.</p>
iphone
[8]
187,080
187,081
python:send class object in socket.sendto()
<p>I want to send a class object in socket.sendto(classObject , (host , port)).</p> <p>Basically I want to send some more information with the message.How can I do this.</p>
python
[7]
3,901,792
3,901,793
How to open pdp context(2G, 3G) in the libraries layer without using httpclient directly
<p>I usually make functions used in libraries layer in android. These day, I need to make new function using http protocol. So I found httpclient in Java layer. But I want to know how to open pdp context(2G, 3G) in libraries layer without using httpclient in java layer directly.</p> <p>Tthanks in advance mark.</p>
android
[4]
842,780
842,781
How to utilize Asp.net 4.0 native registration
<p>I have created an ASP.net (4.0) website that uses the auto-generated user registration and login. Is there anyway i can utilize the registration method of the app without using the form provided, such that when I manually pass the required data to some function the person could be registered?</p> <p>The generated registration.aspx looks like this</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"]; } protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); string continueUrl = RegisterUser.ContinueDestinationPageUrl; if (String.IsNullOrEmpty(continueUrl)) { continueUrl = "~/"; } Response.Redirect(continueUrl); } </code></pre>
asp.net
[9]
4,615,772
4,615,773
What are the differences between these two javascript cases?
<pre><code>var foo1 = function () { return { init: function () { alert(this+" hello foo1"); } }; }(); var foo2 = { init: function() { alert(this+" hello foo2"); } }; foo1.init() foo2.init() </code></pre> <p>The differences I see are:</p> <ul> <li>the first is "closure-style", while the second is not.</li> <li>the first defined a factory function (*) which creates an object and binds the result of this factory to <code>foo1</code>, the second instead is a plain singleton, and you cannot have more instances unless you do .prototype hacking.</li> </ul> <p>Are there any other differences ? <code>this</code> binding behavior ? unexpected browser detonations ? crying kittens ?</p> <p>(*) In other words, I could do something like</p> <pre><code>var fooFactory = function () { return { init: function () { alert(this+" hello foo1"); } }; } var foo=fooFactory(); var bar=fooFactory(); </code></pre> <p>and <code>foo</code> and <code>bar</code> are now two different instances of the same "class" (actually, they are just two Objects that "happen" (by construction) to have the same interface).</p>
javascript
[3]
3,191,067
3,191,068
Encapsulation in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/114237/considering-object-encapsulation-should-getters-return-an-immutable-property">Considering object encapsulation, should getters return an immutable property?</a> </p> </blockquote> <p>Does encapsulation mandate immutability of the class?</p> <pre><code>Class Employee{ private Date hireDate; public Date getHireDate(){ return hireDate; } } </code></pre> <p>In Some client Method:</p> <pre><code>Employee emp = new Employee(); Date temp = emp.getHireDate(); temp.setTime(...);//The Hiredate of the employee would be corrupted... </code></pre>
java
[1]
1,956,831
1,956,832
PHP regex in simple_html_dom library
<p>I was trying to scrape imdb by following code. </p> <pre><code>$url = "http://www.imdb.com/search/title?languages=en|1&amp;explore=year"; $html = new simple_html_dom(); $html-&gt;load(str_replace('&amp;nbsp;','',$data = get_data($url))); foreach($html-&gt;find('#left') as $total_movies) { $content = $total_movies-&gt;plaintext; if(preg_match("/(?&lt;total&gt;[0-9,]+) titles/",$content,$matches)) { print_r($matches); } echo $content."&lt;br&gt;"; } </code></pre> <p>get_data() is just a curl function i created.</p> <p>The problem is that preg_match is not working. i don't know why but the same thing when used work here. $content contains the text what i scrape in above code.</p> <pre><code>$content = "1-50 of 101 titles."; if(preg_match("/(?&lt;total&gt;[0-9,]+) titles/",$content,$matches)) print_r($matches); </code></pre>
php
[2]
707,870
707,871
How can I balance the load of a UI across several processor cores?
<p>I am running a C# winform application that shows huge number of statistics and charts frequently. This application consist of multiple forms, each form has different output. When I open the task manager and check out the cpu usage, I find that only one core out of my eight cores is over loaded and the rest are doing nothing! Is there a way, for example, to assign each number of forms to a core. I need to improve the perfomance. </p> <p>What I am looking for is to multithread my winforms such that each form would have a different thread that is running on a different core. Is that possible ?</p> <p>The bottleneck is happening from loading the data into the controls.</p>
c#
[0]
2,182,260
2,182,261
Get list of File object of Internal memory
<p>I want to write something like file manager, but don't understand how get begin directory(not SD card), namely all besides sd card. I try like this:</p> <pre><code>File myDir=new File("/"); File myDir=Environment.getDataDirectory(); File myDir=Environment.getRootDirectory(); </code></pre> <p>.. I try to use <code>myDir.getParent()</code>, I don't know what to do, please help me.</p>
android
[4]
2,992,494
2,992,495
Loop array for scrape
<p>I have an array with some values</p> <pre><code>$array = array("Bob","jim","frank","pat"); </code></pre> <p>And i have some scrape code from simple html dom</p> <pre><code>$html = file_get_html('http://somesite.com?search=name'); //itteration and so on </code></pre> <p>I want to be able to give the url the values from the array one at a time so it will scrape the url with search=bob then go to search=jim and so on</p> <p>I tried putting the file_get_html with the itterations and so on in a loop then use</p> <pre><code>foreach($array as $arrays){ $html = file_get_html('http://somesite.com?search=$arrays'); //more code } </code></pre> <p>But this wont work, anyway to do this?</p>
php
[2]
3,521,181
3,521,182
How to detect if an sdcard or mount point will mount as removable storage or MTP?
<p>When an android phone is connected to a computer with a USB cable it may mount as removable storage but some phones might mount it as mtp (media transfer protocol) is there a way to detect this in android whether a sdcard will mount as removable or mtp?</p>
android
[4]
3,298,012
3,298,013
C++ string parsing
<p>All:</p> <p>I got one question in string parsing:</p> <p>For now, if I have a string like "+12+400-500+2:+13-50-510+20-66+20:"</p> <p>How can I do like calculate total sum of each segment( : can be consider as end of one segment). For now, what I can figure out is only use for to loop through and check +/- sign, but I do not think it is good for a Universal method to solve this kind of problem :( </p> <pre><code>For example, the first segment, +12+400-500+2 = -86, and the second segment is +13-50-510+20-66+20 = -573 1) The number of operand is varied( but they are always integer) 2) The number of segment is varied 3) I need do it in C++ or C. </code></pre> <p>I do not really think it as a very simple question to most newbie, and also I will claim this is not a homework. :)</p> <p>best,</p>
c++
[6]
5,798,755
5,798,756
Country wise address validation c#
<p>in my case user will select country in the form and also fill up other detail. user can select any country in the worl i need a api which validate postcode based on country. is there anything available. please share with me.</p>
c#
[0]
1,100,365
1,100,366
ASP.net: What type of application/website is more suitable to Webform or MVC?
<p>I have read all the post regarding the pro and con of ASP.net webform vs mvc.</p> <p>However, I'm wondering under what circumstance does one use webform or mvc? would it come down to what you or your team is more familiar with?</p>
asp.net
[9]
4,270,684
4,270,685
How to stop is_callable from displaying includes
<p>I am trying to use <code>is_callable</code> to check for class and method existence, it goes very well but keeps displaying my include parameters.</p> <p>Here is the code:</p> <pre><code>if(!is_callable(array(self::$classy,self::$action))) { self::$classy = 'index'; self::$action = 'index'; } </code></pre> <p>and here is the result:</p> <pre><code>.;C:\php5\pear;./lib;./model;./helper;./controller;/model/;/helper/;/controller/;/lib. </code></pre> <p>This happens only if the return value is true which means the method is not callable or the class is not in the registered autoloadeds.</p> <p>Any Ideas ???</p>
php
[2]
1,127,021
1,127,022
Listing contents of classes in Java
<p>Folks, is there somewhere on the Net where I can find a list of the contents of standard Java classes? Say I wanted to know what functions the class Math contains. Can someone please point me in the right direction?</p> <p>Just feeling my way as a beginner. Sorry for the dumb question :-)</p> <p>Thanks in advance,</p> <p>Dave</p>
java
[1]
3,573,346
3,573,347
Python reverse list
<p>Im trying to reverse a string and using the below code but the resultant reverse list value is None.</p> <p>Any inputs </p> <p>Code</p> <pre><code>str_a = 'This is stirng' rev_word = str_a.split() rev_word = rev_word.reverse() rev_word = ''.join(rev_word) </code></pre> <p>Error: Typeerror</p>
python
[7]
4,470,871
4,470,872
no icon for alert dialog
<p>even if I don't set icon <code>.setIcon(android.R.drawable.ic_dialog_alert)</code> for dialog box, it is showing info icon.</p> <p>How can I completely remove the icon from dialog box?</p> <pre><code>new AlertDialog.Builder(MyActivity.this) .setTitle(R.string.success_title) .setMessage(R.string.success_msg) .setNeutralButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dlg, int sumthin) { try { dlg.dismiss(); } catch (Exception e) { } } }).show(); </code></pre> <p>Edited: Sorry everyone.. I completely remove .setIcon line from the dialog box. I forget to remove it when I paste the code here. Even I remove that I still can see the icon as information icon.</p>
android
[4]
139,387
139,388
How to categorized results from SQL, display 6 columns and set colorize on every category
<p>I would like to ask for help on how to achieve this. I have this code below that pull records from DB and display it in 6 columns.</p> <p>What I want to achieve is that, I want to display results on 6 columns but I want to categorize and set different color on every category.</p> <p>let say i want to display the whole set of fruits starting from letter A with 6 columns with colors of gray, then below all letters starting with B with 6 columns with white color on background then below is C with gray colors in 6 columns. thanks.</p> <pre><code>&lt;?php fruits = $stmt-&gt;prepare("SELECT * FROM fruits ORDER by fruit_id ASC"); $fruits-&gt;execute(); $cols = 6; do { echo "&lt;tr&gt;"; for ($i = 1; $i &lt;= $cols; $i++) { $row = $fruits-&gt;fetch(PDO::FETCH_ASSOC); if ($row) { $fruit_id = $row['fruit_id']; $fruit_name = $row['fruit_name']; ?&gt; &lt;td&gt; &lt;table&gt; &lt;tr valign="top"&gt; &lt;td&gt; &lt;?php echo '&lt;input type="checkbox" id="fruit_id[]" name="fruit_id[]" value="' . $fruit_id . '"/&gt;' . $fruit_name . "\n"; ?&gt; &lt;/td&gt; &lt;td width="30"&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;?php } else { echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;"; } } } while ($row); ?&gt; </code></pre>
php
[2]
1,632,753
1,632,754
asp.net Response.Write
<pre><code> Response.Write("&lt;script&gt;alert('Konaklama Başarıyla Eklendi')&lt;/script&gt;"); string url = "NewAccommodation.aspx?mID=" + mID; Response.Redirect(url); </code></pre> <p>Hi, on the above code, it does not show the alert box because of the code lines after it. How to fix that?</p>
asp.net
[9]
84,007
84,008
How can I select for an input and a textarea?
<p>I have the following code:</p> <pre><code> $('input.update-grid', $form) .each(function () { var id = this.id.replace('modal', ''); $('#input' + id).val(this.value) }) </code></pre> <p>I would like this to also select for textareas that have a class of upgrade-grid. Is there a way that I can do this without making another selector and code?</p> <p>Also if I want to set the text in a textarea is that just set in the same way as an input with .val()?</p>
jquery
[5]
3,245,420
3,245,421
Error in the use of the function library from JNI
<p>When I run this code:</p> <pre><code>package jni_2; public class Min2 { static { System.loadLibrary("kernel32"); } public native long FlushProcessWriteBuffers(); public static void main(String[] args) { Min2 c = new Min2(); c.FlushProcessWriteBuffers(); } } </code></pre> <p>I get this exception :</p> <pre><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: jni_2.Min2.FlushProcessWriteBuffers()J at jni_2.Min2.FlushProcessWriteBuffers(Native Method) at jni_2.Min2.main(Min2.java:14) Java Result: 1 </code></pre>
java
[1]
536,180
536,181
HTML Source to PHP forms
<p>I have a system that exports data to a HTML page. What i need is to take that data and import it to a PHP page</p> <p>Client="3883561112" Response Type="OnLBSResponse" RefNo="827627628"</p> <p>this is how it is output into the HTML page</p> <p>I need to take the information of say Client and insert it into a PHP page and MYSQL DB</p> <p>Any Suggestions would be greatly appreciated</p>
php
[2]
2,590,966
2,590,967
Javascript Function Events Not Firing in Order
<p>I have a function that is meant to clear a div of all its children with a specific name before refilling said div with a new set of children. </p> <pre><code>function displaySearchResults(resultsList) { var length = resultsList.length; var searchDiv = document.getElementById('search-results'); //CLEAR DIV if(searchDiv.hasChildNodes()) { for(var i=0; i&lt;searchDiv.childNodes.length; i++) { var oldChild = searchDiv.childNodes[i]; if(oldChild.id.indexOf('search-results-row') != -1) { searchDiv.removeChild(oldChild); console.log('Removed Result!'); } } } //ADD CHILDREN for(var i=0; i&lt;length; i++) { console.log('Added Result!'); var element = resultsList[i]; var rowDiv = document.createElement('div'); rowDiv.id = 'search-results-row' + i; rowDiv.className = 'list listRow' + i%2; rowDiv.setAttribute('onclick', 'mapCurrentContact(' + i + ');'); rowDiv.innerHTML = element.firstName + ' ' + element.lastName; searchDiv.appendChild(rowDiv); } } </code></pre> <p>However it starts running the ADD CHILDREN portion of the function before the CLEAR DIV loop has a chance to finish. So for instance, if the function finds 4 childNodes in the div and begins looping through to remove each one with the id of search-results-row, it will only get through 2 or so before it begins appending the new set of results that was initially passed into the function.</p> <p>I know that Javascript runs asynchronously, but I thought that functions themselves at least run top down so the bottom portion should not do anything until we reach that part of the code? I have tried all sorts of other alternatives such as running the CLEAR DIV portion in its own function and then calling the ADD CHILDREN portion at the end, but I always get the same results. What am I missing here!?!</p>
javascript
[3]
3,831,387
3,831,388
How to hide an element, based on its text, with JavaScript?
<p>I'm a beginner developer. I'm trying to hide a div that is dynamically added to the page by a 3rd party JavaScript for aesthetic purposes.</p> <p>The problem is that the div has no <code>id</code> attribute; is this even possible? Do divs have any inherent attributes based on the order in which they load? Or is there any way to search for a string of text and hide the element?</p> <p>For example, removing <code>&lt;div&gt;happy New year&lt;/div&gt;</code> based on its text <code>happy New year</code>.</p>
javascript
[3]
4,237,638
4,237,639
Android: Dismissing one popup window when the next is called?
<p>I have 3 Image buttons and on press they each have a Popup window that opens up. The issue is when i click on button 1, there is a popup, if I DONT dismiss that popup but click on Button 2 instead, the pop-up for Button 1 and Button 2 appear. How do i dismiss any open Pop-up's when a new button is pressed?</p> <p>Here is my code</p> <pre><code>final ImageButton rredButton=(ImageButton)findViewById(R.id.RredButton); rredButton.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { LayoutInflater layoutInflater = (LayoutInflater)getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); View popupView = layoutInflater.inflate(R.layout.popupright, null); final PopupWindow popupWindow = new PopupWindow( popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); Button btnNxtScr = (Button)popupView.findViewById(R.id.nextscreen); btnNxtScr.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View v) { Intent myintent1 = new Intent(colorActivity.this,colorBlueActivity.class); startActivity(myintent1); } }); popupWindow.showAsDropDown(rredButton, 1, -1); }}); </code></pre> <p>And here is the other button (with a similar popup method)</p> <pre><code>final ImageButton ryellowButton=(ImageButton)findViewById(R.id.RyellowButton); ryellowButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { createWrongPop(arg0); }}); </code></pre>
android
[4]
2,512,231
2,512,232
are there any way to input text from user without using editText
<p>i'm newbie in android programming i want to make typing game on android but i don't want to use editText to input text from user. are there any way to input text from user ? </p>
android
[4]
3,915,152
3,915,153
how to display the same value into another class's textfield?
<p>hi all i have implemented code as shown in the below here problem is when i clicked on click event textfield *settextvalue value is not appearing into the next view textfield for this give me the solution in iphone. </p> <p>ClassA.h</p> <pre><code>@classB { UITextField *settextvalue; ClassB *b; } @property(nonatomic,retain)UITextField *settextvalue; @property(nonatomic,retain)ClassB *b; @end ClassA.m { @ synthesize b,settextvalue; -(void)viewDidload{ b = [[ClassB alloc]init]; settextvalue.text=@"333"; } -(IBAction)resultOfvalue{ [self.view addSubview:[b view]]; settextvalue.text = b.resultyear.text; } Class B.h { UITextField *resultyear; } @property(nonatomic,retain)UITextField *resultyear; @end Class B.m { @synthesize resultyear; } </code></pre>
iphone
[8]
2,296,553
2,296,554
Detect if Variable Contains Number Sequence
<p>I have a variable like this:</p> <p>33,100,200</p> <p>I need to detect if it contains a specific number, say</p> <pre><code>if(var contains '33'){ do stuff } </code></pre> <p>But it has to not work if say they didn't have 333 in the variable the above statement shouldn't validate the if statement.</p> <p>Edit: This is a string not an array.</p>
php
[2]
1,726,518
1,726,519
jQuery select and unselect image
<p>i have image set div tag like below</p> <pre><code>&lt;div style="width: 600px; background: #CCC;padding: 50px;" class="jjj"&gt; &lt;img src="http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg" class="ddd" width="200"/&gt; &lt;img src="http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg" class="ddd" width="200"/&gt; &lt;img src="http://www.nasa.gov/images/content/297522main_image_1244_946-710.jpg" class="ddd" width="200"/&gt; &lt;/div&gt; </code></pre> <p>My CSS is</p> <pre><code>&lt;style&gt; .ddd:hover{ transform: scale(1.2); -ms-transform: scale(1.2); /* IE 9 */ -webkit-transform: scale(1.2); /* Safari and Chrome */ -o-transform: scale(1.2); /* Opera */ -moz-transform: scale(1.2); /* Firefox */ } .selectedd{ transform: scale(1.2); -ms-transform: scale(1.2); /* IE 9 */ -webkit-transform: scale(1.2); /* Safari and Chrome */ -o-transform: scale(1.2); /* Opera */ -moz-transform: scale(1.2); /* Firefox */ border:2px inset silver; } &lt;/style&gt; </code></pre> <p>i need to select image when user click on it (change the class), i added the script for this and it working, but how can i deselect this image when user clicks on out side, i mean on div tag. my jQuery</p> <pre><code>&lt;script&gt; $(function(){ $('.ddd').click(function(){ ff=this; $('.ddd').removeClass('selectedd') $(ff).addClass('selectedd') }); }); &lt;/script&gt; </code></pre> <p>Please help me. thank you</p>
jquery
[5]
2,564,179
2,564,180
Is it a good practice to prefix the function definition with namespace in CPP files?
<pre><code>// classone.h namespace NameOne { class ClassOne { public: ... void FuncOne(); ... }; } // *** Method 1 *** // classone.cpp namespace NameOne // always define member functions inside the namespace { void ClassOne::FuncOne() { ... } } // *** Method 2 *** // classone.cpp void NameOne::ClassOne::FuncOne() // always prefix the namespace { ... } </code></pre> <p><strong>Question</strong>> I have seen two methods to handle the namespace in CPP files. Which method is a better practice in a large project(i.e. Method 1 or Method 2)</p> <p>Thank you</p>
c++
[6]
2,933,438
2,933,439
Why is code after document.write() not executed?
<p>I have the follwing JavaScript. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script language="JavaScript"&gt; function fdivisible() { document.write("&lt;h1&gt; Just a javascript demo&lt;/h1&gt;"); var x=document.forms["aaa"]["txt1"].value; alert(x); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="#" name="aaa"&gt; Enter a no. : &lt;input type="text" name="txt1" id="txt1" /&gt; &lt;input type="button" value="Click" onclick="fdivisible();"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The problem is, the first line of the JS function is executing and the rest are ignored. If I comment out the first line the rest of the code is executed. Can anybody explain to me why it is so?</p>
javascript
[3]
182,531
182,532
C2678 error on remove from list of custom datatypes
<p>I'm currently hard at work on an assignment piece, which contains several custom datatypes. I've run into a problem where list is complaining that I am trying to remove a custom data type from a list of that same data type.</p> <pre><code>Error 3 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'customer' (or there is no acceptable conversion) c:\program files (x86)\microsoft visual studio 10.0\vc\include\list 1194 1 Assignment 1 - Video Store MIS </code></pre> <p>The relevant code is here:</p> <pre><code>void customerCollection::removeCustomer(customer person) { customers.remove(person); } </code></pre> <p>and the custom data type does have a == operator defined:</p> <pre><code>bool customer::operator==(customer &amp;other) const { return (l_fullName == other.getName()) &amp;&amp; (l_contactNumber == other.getNumber()) &amp;&amp; (l_password == other.getPassword()) &amp;&amp; (l_username == other.getUsername()); } </code></pre> <p>Is there any reason that the list type can't see the overloaded operator?</p> <p>The customerCollection and customer data types are required parts of the program.</p> <p>[EDIT] The overloaded operator is defined as public in the header file.</p>
c++
[6]
1,188,699
1,188,700
Replace jQuery from div to id
<p>Is there any way to replace a content using jQuery from - let's say,</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div class="information1"&gt; This is the information. &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>to</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="information"&gt; &lt;div class="information1"&gt; This is the information. &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
5,270,986
5,270,987
How to get value using DOM HTML
<p>I have a html:</p> <pre><code>$content = " &lt;tr&gt; &lt;td class="ttl"&gt;&lt;a href="#"&gt;Colors&lt;/a&gt;&lt;/td&gt; &lt;td class="nfo"&gt;Dark Grey, Rose Red, Blue, Brown, Sand White&lt;/td&gt; &lt;/tr&gt;"; </code></pre> <p>And code php:</p> <pre><code>$dom = new DOMDocument(); @$dom-&gt;loadHTML($content); $xpath = new DOMXPath($dom); $attbs = $xpath-&gt;query("//td[@class='ttl']"); foreach($attbs as $a) { print $a-&gt;nodeValue; } $values = $xpath-&gt;query("//td[@class='nfo']"); foreach($values as $v) { print $v-&gt;nodeValue; } </code></pre> <p>How get value of 2 td but only using 1 foreach </p>
php
[2]
1,537,290
1,537,291
Why doesn't my DOM get updated when I change the HTML with jQuery?
<p>I have the following:</p> <pre><code>&lt;div id="info-message"&gt;&lt;/div&gt; </code></pre> <p>I am changing the text in between the DIVs like this:</p> <pre><code>$('#info-message').html = "xxx"; </code></pre> <p>However even though I can step through this in the firebug debugger I don't see any change on the screen and nothing is added when I look with firebug.</p>
jquery
[5]
5,127,151
5,127,152
android game image
<p>Can you help me making a touchable image? And when you place it to its correct place, a pop up message will come and displays text. My game is a body parts game that you will be placing the body parts to its corresponding places... Help me please, I will highly appreciate your responses, thanks a lot....</p> <pre><code>if (event.getAction() == MotionEvent.ACTION_MOVE) { if (droid.isTouched()) { droid.setX((int)event.getX()); droid.setY((int)event.getY()); } if (roid.isTouched()) { roid.setX((int)event.getX()); roid.setY((int)event.getY()); } </code></pre>
android
[4]
509,242
509,243
If string does not contain any of list of strings in python
<p>I have a list of strings, from which I want to locate every line that has 'http://' in it, but does not have 'lulz', 'lmfao', '.png', or any other items in a list of strings in it. How would I go about this?</p> <p>My instincts tell me to use regular expressions, but I have a moral objection to witchcraft.</p>
python
[7]
2,779,000
2,779,001
Error using clientY when vertical scrollbar exists
<p>I am trying to popup a div whenever a span with id <code>toolpopup</code> is clicked (div should appear at those coordinates) and it works fine for the spans which are at the top of the page. But when i scroll down and click the span the div is created but not at the desired coordinates. What could be possibly wrong? I am trying it on <code>Firefox 7.0.1</code></p> <pre><code>$("#toolpopup").live("click", function(event) { var X = event.clientX; var Y = event.clientY; $("#popup").css('position', 'absolute'); $("#popup").css("top", Y); $("#popup").css("left", X); $("#popup").css("display","block"); }); </code></pre>
javascript
[3]
5,344,193
5,344,194
What Advantage Does HasOwnProperty Offer When Checking if a Property Exists As Part of An Object Literal?
<p>The code I'm referencing comes from <a href="http://stackoverflow.com/a/1961068/122164">this</a> answer:</p> <pre><code>Array.prototype.getUnique = function(){ var u = {}, a = []; for(var i = 0, l = this.length; i &lt; l; ++i){ if(u.hasOwnProperty(this[i])) { continue; } a.push(this[i]); u[this[i]] = 1; } return a; } </code></pre> <p>What is the purpose of <code>hasOwnProperty</code> here? I've ran a version of the method that does not use it and it works just the same:</p> <pre><code>Array.prototype.getUnique = function(){ var u = {}, a = []; for(var i = 0, l = this.length; i &lt; l; ++i){ if(u[this[i]] !== undefined) { continue; } a.push(this[i]); u[this[i]] = 1; } return a; } </code></pre>
javascript
[3]
2,556,486
2,556,487
documentBuilder.parse fails under android 4.0.3
<p>I my application, documentBuilder.parse(inputStream) throws the following error in Android 4.0.3.</p> <pre><code>"SAXException : Unexpected token (position:TEXT ?xml version='1....@1:38 in java.io.InputStreamReader@419ae708)" </code></pre> <p>The same code is working in all the older versions of android.</p> <p>following is the initial parts of my inputstream.</p> <pre><code>?xml version='1.0' encoding='UTF-8'?&gt; </code></pre> <p>Any solution?</p>
android
[4]
617,079
617,080
Android Application looks like iphone
<p>I am an experienced iphone developer and recently taken the plunge into android development as well. i came across this app and i wonder how was it developed on android (Cause it looks so much like an iphone app), see link below <a href="http://lh5.ggpht.com/_63_i7B_SEMw/SmhfwhjWx2I/AAAAAAAAAI8/OoA40e42clo/s400/NYTimes-app-comes-to-android-market.jpg" rel="nofollow">http://lh5.ggpht.com/_63_i7B_SEMw/SmhfwhjWx2I/AAAAAAAAAI8/OoA40e42clo/s400/NYTimes-app-comes-to-android-market.jpg</a></p> <p>anyone have any idea how to accomplish that type of look on android</p>
android
[4]
3,574,980
3,574,981
How to display data in android page using Accordion?
<p>In my project I need to <strong>display more number of details</strong> of a customer. So I need to use <strong>Accordion</strong> for that page for displaying the details. Can anybody suggest us how to do that in android? Is it possible? Please help me regarding this.</p> <p>Thank you,</p>
android
[4]
1,082,340
1,082,341
What causes the blackhole effect?
<p>By blackhole I mean, errors in code which throw no error.</p> <p>I made a mistake where I called a method that did not exist like this:</p> <pre><code>NS.doesNotExist(); // NS exists. doesNotExist doe not. </code></pre> <p>and JavaScript did not tell me anything. I had to troubleshoot.</p> <p>Is there a reason the interpreter can not recognize this?</p> <p>Silent Fail</p> <pre><code> NS.time(); </code></pre> <p>Comment Out to make pass</p> <pre><code> // NS.time(); </code></pre> <p><strong>Info.</strong></p> <ul> <li>Verified again that NS.time() does not exist using console.</li> </ul> <p>Called in this NS method.</p> <pre><code>NS.machine = function (pipe) { var pipe_string, times; if (Mo[pipe.model] === undefined) { pipe.state = false; return pipe; } // NS.time('start'); if (Mo[pipe.model].hasOwnProperty("pre")) { pipe = Mo[pipe.model].pre(pipe); } else { pipe.state = false; return pipe; } </code></pre>
javascript
[3]
5,160,484
5,160,485
Console.Write syntax: what does the format string "{0, -25}" mean
<p>I am writing C# code</p> <pre><code>Console.Write("{0,-25}", company); </code></pre> <p>In above code what does this <code>"{0,-25}"</code> thing mean?</p>
c#
[0]
2,030,721
2,030,722
Python - split string into smaller chunks and assign a variable
<p>Is it possible to split a string in python and assign each piece split off to a variable to be used later? I would like to be able to split by length if possible, but im not sure how it would work using len().</p> <p>i tried this but its not getting me what i needed:</p> <pre><code>x = 'this is a string' x.split(' ', 1) print x </code></pre> <p>result: ['this']</p> <p>i want to result to something like this:</p> <pre><code>a = 'this' b = 'is' c = 'a' d = 'string' </code></pre>
python
[7]
1,789,664
1,789,665
Client Side File Generation and Download
<p>Hi as u understand from question title, I want client side file generation and download. I know there is Downloadify that exactly do what I said. But downloadify is using flash + javascript. I just want to do that with jQuery. I have a text and I have a link. When user click the link, it will generate a file with that text and ask user to download it.</p> <p>Best Regards.</p>
jquery
[5]
5,913,842
5,913,843
.Trim() when string is empty or null
<p>I'm receiving some data from the client in the form of json. I'm writing this:</p> <pre><code>string TheText; // or whould it be better string TheText = ""; ? TheText = ((serializer.ConvertToType&lt;string&gt;(dictionary["TheText"])).Trim()); </code></pre> <p>If the variable that's being parsed from json comes back empty, does this code crash when I call the .Trim() method?</p> <p>Thanks.</p>
c#
[0]
1,418,634
1,418,635
JQuery hide priority over show?
<p>I'm having an issue with JQuery show and hide. When I hover over an element, I want to show another element pop out to the right. I have managed that with the following code:</p> <pre><code>var actionHoverInListener = function () { $(this).children('.pop-out').show("slide", { direction:"left" }, 100); }; var actionHoverOutListener = function () { $(this).children('.pop-out').hide("slide", { direction:"left" }, 100); }; // Add a hover listener for actions $(".magic").hover( actionHoverInListener, actionHoverOutListener ); </code></pre> <p>This works fine, but the issue is speed. If I hover over and out of the "magic" div too quickly, it never hides the popout. It's as if the hide call is ignored because the show is still animating the slide.</p> <p>The hover out method is being called correctly: I have put in logging code to make sure it is getting called. So, the problem is that the hide does not cancel the show. Is there a way to do this?</p> <p>Thanks!</p> <p>UPDATE:</p> <p>I have included an example of my problem on jfiddle: <a href="http://jsfiddle.net/Pekf2/" rel="nofollow">http://jsfiddle.net/Pekf2/</a></p> <p>Run your mouse down the red stripes. You will see the green slide out, but not slide back if you're too fast (even with the stop() call).</p>
jquery
[5]
1,893,605
1,893,606
How to remove duplicate values from a list in c++
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4877504/how-can-i-remove-duplicate-values-from-a-list-in-c">How can I remove duplicate values from a list in c++?</a> </p> </blockquote> <p>Hi, I have to remove duplicate values from a list in c++. can any one tell me how to do that as I am new to c++.</p> <p>Any sample code will be highly appreciated.</p> <p>Regards Shekhar</p>
c++
[6]
1,871,693
1,871,694
How can i only apply animation for activity but not for toolbar?
<p>I have several activities which have the same toolbar at bottom of each activity. The problem that i'm encountering is when i apply animation slide in/out for all activities, the whole of activity will be applied this animation. But i don't want toolbar do this animation. I mean that when i move from an activity to another activity ,all other views of activity will be move but the toolbar don't move. </p> <p>How can i achieve this?</p> <p>Thanks you a lot.</p> <p>/<strong><em>*</em>***</strong><em>Edit</em><strong><em>*</em>**<em>*</em>****</strong>/</p> <p>I intend to use TabWidget with activity tabs, but i don't know how to use overridePendingTransition() to make a transition animation between them when i change tabs. I also tried to put overridePendingTransition() in pause event of TabActivity and Activities for tabs, but not work. </p> <p>Please help me.</p>
android
[4]
561,549
561,550
In Java, how do I override the class type of a variable in an inherited class?
<p>In Java, how do I override the class type of a variable in an inherited class? For example:</p> <pre><code>class Parent { protected Object results; public Object getResults() { ... } } class Child extends parent { public void operation() { ... need to work on results as a HashMap ... results.put(resultKey, resultValue); ... I know it is possible to cast to HashMap everytime, but is there a better way? } public HashMap getResults() { return results; } </code></pre>
java
[1]
5,722,194
5,722,195
How can I eliminate an element in a vector if a condition is met
<p>I have a vector of Rect: <code>vector&lt;Rect&gt; myRecVec;</code></p> <p>I would like to remove the ones which are overlapping in the vector:</p> <p>So I have 2 nested loop like this:</p> <pre><code>vector&lt;Rect&gt;::iterator iter1 = myRecVec.begin(); vector&lt;Rect&gt;::iterator iter2 = myRecVec.begin(); while( iter1 != myRecVec.end() ) { Rectangle r1 = *iter1; while( iter2 != myRecVec.end() ) { Rectangle r2 = *iter1; if (r1 != r2) { if (r1.intersects(r2)) { // remove r2 from myRectVec } } } } </code></pre> <p>My question is how can I remove r2 from the myRectVect without screwing up both my iterators? Since I am iterating a vector and modifying the vector at the same time? I have thought about putting r2 in a temp rectVect and then remove them from the rectVect later (after the iteration). But how can I skip the ones in this temp rectVect during iteration?</p>
c++
[6]
3,052,026
3,052,027
Compile an exe file inside c++
<p>I want to create a c++ program in which</p> <ol> <li><p>I can read an external file (that can be exe,dll,apk...etc...etc). That is read the file convert them into bytes and store them in an array</p></li> <li><p>Next,I want to compile the bytes inside the array Now this is the tricky part i want to compile the bytes into an array just to check that if the bytes are working well</p></li> <li>You may say i am converting a file into bytes and then converting those bytes back to the same file....(Yes indeed i am doing so)</li> </ol> <p>Is this possible?</p>
c++
[6]
1,181,972
1,181,973
System service or disable uninstalling?
<p>Is it possible to write an android "service" that cannot be erased/disabled/uninstalled?</p> <p>Thanks</p>
android
[4]
5,862,804
5,862,805
input from the keyboard and print out asterisks
<p>Hi there I'm trying to input 3 integers from the keyboard and print rows of asterisks equal to the integers input from keyboard. I really appreciate if someone could help on this, thanks in advance.</p> <pre><code>public class Histogram1 { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please input the first integer for histogram1: "); int a1 = in.nextInt(); System.out.print("Please input the second integer for histogram1: "); int b1 = in.nextInt(); System.out.print("Please input the third integer for histogram1: "); int c1 = in.nextInt(); histogram1(); } public static void histogram1(){ int n =0; for (int i = 0; i &lt;= n; i++) { for( int j = 1; j &lt;=n; j++) { System.out.println("*"); } System.out.println(); } } } </code></pre>
java
[1]
2,862,437
2,862,438
jQuery change function and IE 7
<p>I know that change() is not working with IE7.</p> <p>Although I still need to find a solution to my problem: Here is my jQuery:</p> <pre><code>$("input[type='checkbox']").change(function () { if ( $("input[type='checkbox']").is(':checked') ) { $(".subbut").show(); } else { $(".subbut").hide(); } }); </code></pre> <p>Simple Function where by "ticking" checkbox I'm truing to show the .subbut and hide when "unticked". And just cant find the solution. Is there a way around it please?</p> <p>Thanks for help in advance in advance</p> <p>Dom</p>
jquery
[5]
3,162,836
3,162,837
Checkout files from tortoise svn using subprocess.Popen
<p>I was using this command to check out the file using Tortise svn</p> <pre><code>work = "F:\Test" exe = "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe" argu = ("/command:checkout /url:https://Test/help /path:" + str(work)) proc1 = subprocess.Popen([exe, argu]) </code></pre> <p>Once I run the this command I can able to see the path in the Checkout directory field in checkout window.</p> <pre><code>F:\Test"\help </code></pre> <p>But if I use ("/command:checkout /url:https://Test/help /path:F:\Test") this command then I can able to see following path in the Checkout directory field in checkout window.</p> <pre><code>F:\Test\help </code></pre> <p>Please let me know do we need to provide the complete path in the path variable </p>
python
[7]
2,792,573
2,792,574
Problem in Multiple button onclick event in iPhone
<p>I have created five buttons in a for loop dynamically. Now I want to associate an OnClick event with every button which do different actions. How I can do this and how can I detect which button is clicked?</p> <pre><code>for (NSUInteger i=0;i&lt;5;i++) { UIButton *myButton1 = [[UIButton buttonWithType:UIButtonTypeCustom] initWithFrame:CGRectMake(5, 57,15, 15)]; [myButton1 setTitle:@"Click Me!" forState:UIControlStateNormal]; [myButton1 addTarget:self action:@selector(buttonClicked1:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:myButton1]; } </code></pre>
iphone
[8]
1,728,887
1,728,888
How to make doubles always contain a . character?
<p>I noticed my doubles contain different precision characters depending on regional settings. </p> <p>For example:</p> <p><code>3,47</code> or <code>3.45</code></p> <p>How can I enforce the double should always contain a <code>.</code> precision character?</p> <p>Problem is once I serialize the class containing this double to XML, it gets shipped to other systems expecting a standard result. </p> <p>So after reading your responses (and thanks), do you guys recommend changing the property to a string, (making the replacements in a string), so that it serializes with the string value (not the double)?</p>
c#
[0]
1,660,751
1,660,752
Toggle the display of a text field with a checkbox
<p>When Unlimited is checked, remove the input box. That works. However, when the checkbox is unchecked the input box wont show back up.</p> <pre><code>&lt;script type="text/javascript"&gt; function getQuantity() { var checkbox = document.getElementById("unlimited"); var qty = document.getElementById("quantityspace"); if(checkbox.checked == true){ qty.style.display = 'none'; }else if(checkbox.checked == false) { qty.stlye.display = '&lt;input type="text" id="quantity" size="4" value="1" name="quantity" /&gt;'; } } &lt;/script&gt; &lt;input type="checkbox" id="unlimited" name="unlimited" value="x" onClick="getQuantity(); " /&gt; Unlimited? &lt;span id="quantityspace"&gt;or specify: &lt;input type="text" id="quantity" size="4" value="1" name="quantity" /&gt;&lt;/span&gt; </code></pre>
javascript
[3]
1,828,119
1,828,120
Parent.FrameName.FunctionName is not working in Mozilla
<p>This is what I am having in the page </p> <pre><code>&lt;frameset border="0" frameborder="0" frameSpacing="0"&gt; &lt;frame name="banner" src="one.aspx?tab=" marginwidth="0" marginheight="0"&gt; &lt;frame name="filter" src="two.aspx" marginwidth="0" marginheight="0"&gt; &lt;/frameset&gt; </code></pre> <p>and I am trying to call </p> <pre><code>Parent.filter.FuntionName. </code></pre> <p>This FuntionName is a javascript function which is in the one.aspx. </p> <p>The issue is, this is working fine in IE while it is not working in MOZILLA. Is there any alternative for this statement.</p>
javascript
[3]
130,983
130,984
Scrollable Canvas or surfaceview
<p>I want to create an application, wherein users can create a design on canvas with bitmaps and lines on it, but i want it to be scrollable i.e. my canvas should be larger than the screen size. I am using sufaceview and using canvas on it. But i have trouble having making it scrollable, what shold be my approach 1) make surfaceview scrollbale using someoffset (i read one tutorial with scrollable map with cells)2) use two canvas (not sure how it works) 3) use scrollview as parent view of sufaceivew (?) Or 4) something else.</p>
android
[4]
2,851,237
2,851,238
How to determine when the text of an html element is changed
<p>I have an error message like this:</p> <pre><code>&lt;span class="errorMessage"&gt;Your input sucks!&lt;/span&gt; </code></pre> <p>and I need to determine when it changes. the validation framework I'm using sets the text when there's an error and removes it when it's complete. I'm hoping to tap into that by watching for changes to the text property of the element using jquery. Any idea of how to go about doing this?</p> <p>Thanks!</p>
jquery
[5]
2,915,966
2,915,967
Reccomended C# book for strictly web programming?
<p>I have Visual Studio 2010 Ultimate, and SQLServer 2008 so tools are not an issue. I'm going to be learning some web C# for work and I would like a recommendation for a total beginner, and then something of an intermediate book (unless there is one that can do them both). Thanks!</p>
c#
[0]
2,463,586
2,463,587
How to get Bitmap image from OI file manager path?
<p>My application requires an image to be selected from gallery.</p> <p>I start activity:</p> <pre><code>Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Picture"), PICK_IMAGE); </code></pre> <p>It will prompt to select from gallery or OI file manager</p> <p>For the OI file manager, I get the path from Uri as follow:</p> <pre><code>Uri selectedImageUri = data.getData(); filemanagerstring = selectedImageUri.getPath(); </code></pre> <p>Now how do I get Bitmap image from the filemanagerstring?</p>
android
[4]
1,119,313
1,119,314
select change event is triggering multiple times
<p>Very strange thing is happening with the 'change' event of the dropdown list.</p> <p>Basically I have a dropdown, on change of which i have to do some cross domain web service call. This call is being made from the javascript itself. </p> <p>For the first time when i change an item in the 'select' list the change event is triggered only once. Next time twice and it grows like this. </p> <p>Any clue why is it behaving like this?</p> <p>If code needed for reference i can share. But its a simple 'select' list and 'change' event handler there.</p> <pre><code>$("#ArtifactSort &gt; select").change(function() { var rankField= ""; rankField = $("#ArtifactSort &gt; select option:selected").text(); alert('within select change event artifact: '+ rankField ); //Making the text little lighter and showing the loading icon. //$("#ArtifactPetalContentUL").css("filter", "alpha(opacity: 30)"); $loadingIconForArtifact = addLoadingIcon("ArtifactPetalContentUL", "Artifact"); var refinedStoresLocal= new Array(); for (var storeIndex in _searchResponseForArtifact.searchResult.searchRequestProcessed.stores) { refinedStoresLocal.push(_searchResponseForArtifact.searchResult.searchRequestProcessed.stores[storeIndex].name); } var refinedFiltersLocal = new Array(); for (var filterIndex in _searchResponseForArtifact.searchResult.searchRequestProcessed.filters) { refinedFiltersLocal.push(_searchResponseForArtifact.searchResult.searchRequestProcessed.filters[filterIndex]); } //rankfield. var rankLocal=new Array(); rankLocal.push(new RankingField(rankField, 1, 0)); //Request object and WS Call. var _searchRequestForArtifactLocal = getArtifactSearchRequestObject(_queryStringLocal, _memberId, _communityId, _pageNumber, _pageSize, propertiesForArtifact, refinedStoresLocal, ClassificationClusteringObjectsForArtifact, refinedFiltersLocal, rankLocal); getSearchResponse("successcallForArtifact", _searchRequestForArtifactLocal); }); </code></pre> <p>Thanks Subrat.</p>
javascript
[3]
1,342,044
1,342,045
How to get a list of available network providers?
<p>I'm trying to get a list of the available cellular network providers. Unfortunately I can't find any service or class that might help me out. Does anyone have an idea on how to manage this? It has to be possible since you can see the list when you go to the settings on your Android device.</p>
android
[4]
695,719
695,720
What control to render dynamic HTML text on an aspx page
<p>Page_Load generates a string of HTML for a dashboard. (html) </p> <p>What control on an aspx page to bind that "text" to so when the page renders you see the tables, and buttons within?</p> <p>Tried </p> <p>With dhtml.Text = html but I don't see the buttons. I do see the tables as well as the borders of cells that I expect. </p> <p>Any ideas? </p> <p>TIA</p>
asp.net
[9]
20,263
20,264
jquery escape character issue?
<p>I have this jquery issue that seems to only break when using background image url. My impression is that it looks like a character escape issue, but i could be wrong.</p> <p>Here's what i have for a working demo version: <a href="http://jsfiddle.net/W4CZG/" rel="nofollow">http://jsfiddle.net/W4CZG/</a></p> <p>Essentially i have some draggable divs with inline style in the html:</p> <pre><code>&lt;div class="dragme" style="background-color:#ccc;"&gt;1&lt;/div&gt; &lt;div class="dragme" style="background-image:url(images/image1.gif);"&gt;2&lt;/div&gt; </code></pre> <p>On the script, i've currently used the following to add a span tag inside the droppable area to set the style:</p> <pre><code>$(this).html('&lt;span style="' + draggable.attr('style') + '"&gt;&lt;/span&gt;'); </code></pre> <p>The first div, with the background color, works fine. Looking in firebug, it creates something like:</p> <pre><code>&lt;span style="background-color: rgb(204, 204, 204);"&gt;&lt;/span&gt; </code></pre> <p>If i use any other style - like margin, font, etc - it works also. But my problem, and hence my question here, is with the background image, the generated span tag doesn't get the background image inline style, it instead gets all messed up? In firebug i see this:</p> <pre><code>&lt;span );="" image1.gif="" images="" style=""&gt;&lt;/span&gt; </code></pre> <p>Is this a charcater escape issue? And more importantly, how do i fix this?</p> <p>Thanks for your time!</p>
jquery
[5]
6,028,217
6,028,218
Insert a row of elements into a multi-dimensional array based on index
<p>Insert a row of elements into a multi-dimensional array based on index</p> <p>For Example:</p> <pre><code>MultiArray = new Array(5); MultiArray [0] = new Array(2); MultiArray [0][0] = "Tom"; MultiArray [0][1] = "scientist"; MultiArray [1] = new Array(3); MultiArray [1][0] = "Beryl"; MultiArray [1][1] = "engineer"; MultiArray [1][2] = "Doctor"; MultiArray [2] = new Array(2); MultiArray [2][0] = "Ann"; MultiArray [2][1] = "surgeon"; MultiArray [3] = new Array(2); MultiArray [3][0] = "Bill"; MultiArray [3][1] = "taxman"; MultiArray [4] = new Array(2); MultiArray [4][0] = "Myrtal"; MultiArray [4][1] = "bank robber"; MultiArray.splice(1,0, new Array(2){"two","one"}); </code></pre> <p>The last line in my code didn't work. I am not sure if the rest of the code is right neither.</p> <p>Now can anyone please let me know whether I can insert a row of elements somewhere in between and move the remaining elements one index down?</p>
javascript
[3]
2,332,112
2,332,113
JQuery click event not targeting div children
<p>I have a problem which seems simple, but I can't seem to find a solution. I basically have a div which triggers a click event. My html is:</p> <pre><code> &lt;li class="infobox"&gt; &lt;a href="#"&gt;&lt;img class="thumb" src="img/2.jpg" alt="image02" /&gt;&lt;/a&gt; &lt;div class="over"&gt; &lt;img src="img/search_icon.png" alt="read more" /&gt; &lt;h6&gt;New business&lt;/h6&gt; &lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit&lt;/p&gt; &lt;/div&gt; &lt;/li&gt; </code></pre> <p>and my jquery code is:</p> <pre><code>$('#news_gallery li .over').click(function(event) { // I have animation code here }); </code></pre> <p>The problem is this: the function works fine, except for the fact the click event does not work on the img or any of the text that is within the div '.over'. Why are the child elements not passed to the click event? Do I need to pass special parameters to the function?</p>
jquery
[5]
4,014,937
4,014,938
android: access local network share
<p>I was wondering, is there any way to get a file/directory listing from a local network share?</p> <p>Iam trying to make an app that shows an overview of all the movies or music on my NAS.</p> <p>Martijn Lenderink</p>
android
[4]
3,103,506
3,103,507
how can i remove script virus from my script
<p>i have following code added automatically into my script...</p> <pre><code>&lt;script type="text/javascript" src="http://obscurewax.ru/Kilobyte.js"&gt;&lt;/script&gt; &lt;!--72628eb2e686638651ad69b6a34a630f--&gt; </code></pre> <p>at the end of my each page when i see source code of my page it shows me the above code but when i open that file in notepad or any editing software it shows me nothing but only my script.. how can i remove that script from all of my files at once...</p> <p>also let me know why it is happening so far..</p>
javascript
[3]
844,183
844,184
Surround outputted email addresses in quotation marks in Python3.2
<p>I have a small script:</p> <pre><code>#!/usr/bin/python3.2 #takes the bad_emails out of full_emails and leaves us with good_emails #This is a manually generated list of bad emails (bounce backs) bad_list = [] with open("bad_emails.txt","r") as bad: for line in bad.readlines(): bad_list.append(line) #this is a list of ALL email addresses output by AcyMailing full_emails = [] with open("full_emails.txt","r") as full: for email in full.readlines(): if email in bad_list: pass else: full_emails.append(email) #this is a final list containing only the email addresses with want good_list = [] with open("good_emails","w") as good: for email in full_emails: good.write(email) </code></pre> <p>What I'm attempting to do is in short: take a list of email addresses from our mailer program called AcyMailing in Joomla and export it out. It has the following format: "[email protected]" "[email protected]" "[email protected]"</p> <p>While my above script works (it gets rid of the 'bad emails' and leaves me with only the 'good emails' I've yet to find a way to make each email surrounded by quotation marks like AcyMailing (Joomla) uses. I've seen that a number of people use regex for such a task. Is that the only way to do this in python? </p>
python
[7]
216,561
216,562
Can an app delete its own internal resources?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4398523/how-we-can-remove-a-file-from-the-assets-folder-at-runtime-in-android">how we can remove a file from the assets folder at runtime in android?</a> </p> </blockquote> <p>I am trying to find a way to delete an internal resource after an app installs. More specifically, I have a zip file included in the apk, that I unzip to the SD Card when the app is first run. But then want to delete the now unneeded zip file (the purpose being to save the user internal phone memory).</p> <p>I access the zip file with,</p> <pre><code>Resources resources = this.getResources(); InputStream is = resources.openRawResource(R.raw.assets); </code></pre> <p>But am uncertain how to then delete the resource (if even possible).</p> <p>I know one may ask why not simply install the app to SD Card at download. But the app includes a screen widget, and installing apps to the SD Card and using a screen widget is problematic.</p> <p>Thanks, Matt</p>
android
[4]
350,068
350,069
Help me understand this Strange C++ code
<p>This was a question in our old C++ exam. This code is driving me crazy, could anyone explain what it does and - especially - why?</p> <pre><code>int arr[3]={10,20,30}; int *arrp = new int; (*(arr+1)+=3)+=5; (arrp=&amp;arr[0])++; std::cout&lt;&lt;*arrp; </code></pre>
c++
[6]
2,400,710
2,400,711
Use of comma with class name in a variable declaration in C#?
<p>I can understand the use of the latter one. Can you explain the use of the following comma? </p> <pre><code>private WaveGestureTracker[,] _PlayerWaveTracker = new WaveGestureTracker[6, 2]; </code></pre>
c#
[0]
546,337
546,338
how to extract plain text from ms word document file in pure c++?
<p>Is there any pure c++ library to extract plain text from .doc file. I'm developing a c++ program to read .doc, .pdf file. And i have to extract plain text from that file and write into a .txt file. If any one know please help me.</p> <p>Thanks.</p>
c++
[6]
5,197,246
5,197,247
Destroying Activity or application itself from another application
<p>I have two applications. One is a receiver and its starting my application. It works fine. Now i want destroy my application from the receiver itself. Is that possible ? Please note that these are my own application</p>
android
[4]
1,949,545
1,949,546
find control and html tags
<p>i have this code in my default aspx file : </p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:PlaceHolder ID="holder1" runat="server"&gt; &lt;asp:Label ID="label1" runat="server" Text="Label"&gt; &lt;/asp:Label&gt; &lt;input type="text" ID="txt" runat="server"/&gt; &lt;asp:TextBox ID="txt2" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button Text="Ok" ID="btnOk" runat="server" onclick="btnOk_Click" /&gt; &lt;/asp:PlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>and my code behind is :</p> <pre><code> TextBox tb1 = holder1.FindControl("txt") as TextBox; Response.Write(tb1.Text); TextBox tb2 = holder1.FindControl("txt2") as TextBox; Response.Write(tb2.Text); </code></pre> <p>my problem is here that findcontrol ("txt") return null value!!! because i used <code>&lt;input&gt;</code> ,how can i handle this control ?</p>
asp.net
[9]
4,248,592
4,248,593
jQuery: checking slideToggle visibility not working?
<p>I am trying to use slide toggle to show a sign in form and if they click outside of the box, I want that form to slide up.</p> <p>I have everything running fine however my check for visibility isn't working and thus clicking outside the form container is not working. Can you spot why?</p> <pre><code>var loginForm = jQuery("#login .login-form"); jQuery("#login a").click(function(e) { e.preventDefault(); loginForm.slideToggle(); }); // below check isn't working why? if (jQuery(loginForm).is(":visible")) { jQuery("body").click(function() { jQuery(loginForm).slideUp(); }); } </code></pre>
jquery
[5]
4,705,355
4,705,356
php oop and mysql
<p>I need to get data, to check and send to db. Programming with PHP OOP.</p> <p>Could you tell me if my class structure is good and how dislpay all data?. Thanks</p> <pre><code>&lt;?php class Database{ private $DBhost = 'localhost'; private $DBuser = 'root'; private $DBpass = 'root'; private $DBname = 'blog'; public function connect(){ //Connect to mysql db } public function select($rows){ //select data from db } public function insert($rows){ //Insert data to db } public function delete($rows){ //Delete data from db } } class CheckData{ public $number1; public $number2; public function __construct(){ $this-&gt;number1 = $_POST['number1']; $this-&gt;number2 = $_POST['number2']; } function ISempty(){ if(!empty($this-&gt;$number1)){ echo "Not Empty"; $data = new Database(); $data-&gt;insert($this-&gt;$number1); } else{ echo "Empty1"; } if(!empty($this-&gt;$number2)){ echo "Not Empty"; $data = new Database(); $data-&gt;insert($this-&gt;$number2); } else{ echo "Empty2"; } } } class DisplayData{ //How print all data? function DisplayNumber(){ $data = new Database(); $data-&gt;select(); } } $check = new CheckData(); $check-&gt;ISempty(); $display = new DisplayData() $display-&gt;DisplayNumber(); ?&gt; </code></pre>
php
[2]
26,823
26,824
Javascript Function always returns wrong value, although variable had correct values before
<p>I have a function that returns the highest value of an attribute in an xml file</p> <p>The Value returned is always 0, so I think the value under the JQuery function doesnt know what happens inside of it. Here is the function:</p> <pre><code>function findHighestValue(url,attr){ var highestValue = 0; $.ajax({ type: "GET", url: url, dataType: "xml", success: function(xml) { $(xml).find("achievement").each(function(){ var value = $(this).find(attr).text(); value = value*1;//typecast console.log("value: "+value);//shows correct value console.log("highestValue in ajax: "+highestValue);//shows correct value if (value &gt;= highestValue){ highestValue = value; console.log("Value higher highesValue detected!");//works as intended } }); } }); console.log("Highest Value: "+highestValue);// is 0 again return highestValue;//always returns 0 } </code></pre>
javascript
[3]
2,659,186
2,659,187
How to extract unique characters from a string?
<p>How to extract unique characters from a string using c#? </p> <p>For example:</p> <p>I have string "aabbcccddeefddg" and I want to extract unique charecters from the string, the result set should be "abcdefg". </p> <p><strong>Note</strong>: I don't want to use string.distinct function in c#.</p> <p>Thanks,</p> <p>Pradeep</p>
c#
[0]
2,290,058
2,290,059
eval-ing a function, performance after being evaled
<p>We all know that the code:</p> <pre><code>var ssum = function(a,b) { return a+b; } </code></pre> <p>is executing faster than</p> <pre><code>eval("var esum = function(a,b) { return a+b; } "); </code></pre> <p>for many reasons. </p> <p>what I want to know is that if a function which was created by eval-ing a string will perform worse than a if it had not been.</p> <p>For the example above it means: will esum(1,1) slower than ssum(1,1) ?</p> <p>I would like an answer which tells me if this depends on the browser implementation (and if so why) and if the performance depends on the variables referenced by the eval-ed function.</p> <p>Many Thanks, Lx</p>
javascript
[3]
5,158,686
5,158,687
How can I open Wifi Connection System Dialog?
<p>I want to write a application list AccessPoints and when you click one, a wifi connection dialog will open. I searched in the Internet and found some hint: startActivity(new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK)) – But I can't do it. Please help.</p>
android
[4]
605,185
605,186
is there a way to view the source of a module from within the python console?
<p>if I'm in the python console and I want to see how a particular module works, is there an easy way to dump the source?</p>
python
[7]
5,118,930
5,118,931
Javascript : repeat function not work
<p>I wrote this function to fly DIV from top right to bottom left:</p> <pre><code>var myObj; function infly() { myObj=document.getElementById('mydiv'); myObj.style.right='0px'; myObj.style.top='0px'; } function flyer() { var x=parseInt(myObj.style.right); var y=parseInt(myObj.style.top); x+=1; y+=1; myObj.style.right=x+'px'; myObj.style.top=y+'px'; } function repeat() { setTimeout(flyer,5000) } </code></pre> <p>And HTML code is:</p> <pre><code>&lt;body onLoad="infly()"&gt; &lt;div id="mydiv"&gt; &lt;/div&gt; &lt;a href="" onClick="javascript:repeat()"&gt;Fly&lt;/a&gt; ... .. . </code></pre> <p>But <code>repeat</code> function not work. When I remove this function in every click my DIV fly correctly.</p> <p>I try with <code>setInterval('fly();', 10);</code> but no success.</p> <p>Thanks for any helps.</p> <hr> <p>Update:</p> <p>I edit the code and correct <code>repeat</code> function but still not work.</p>
javascript
[3]
1,268,370
1,268,371
Some header passing variable?
<p>Im trying to pass some variables from the URL to the PHP script. Now I know that <code>www.site.com/index.php?link=HELLO</code> would require <code>$_GET['link']</code> to get the variable "link". I was hoping there are other ways to do this without the variable. </p> <p>For instance I want a link structure like this: <code>www.site.com/HELLO</code>. In this example I know that I have to create a Directory called Hello place an index file and it should work but I don't want to create a directory and Im hoping there's a way to "catch" that extra part after the domain. I'm thinking of creating a custom HTTP 404 Page that will somehow get the variable of the not found page, but I don't know how to get the HTTP 404 error parameters. Is there another simpler way to get a variable without the use of the extra <code>?link=</code> part? I just want it to be a structure like this <code>www.site.com/HELLO</code>. </p>
php
[2]