Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
3,537,369
3,537,370
Need to set a variable based on the value of the selected item in a dropdown
<p>I'm trying to set a variable to the value of the selected item in a dropdown but can't get it to work properly. Here is the html:</p> <pre><code>&lt;select id="locationChoice" name="WorkflowList"&gt; &lt;option value=" "&gt;-- Please Select --&lt;/option&gt; &lt;option value="14643"&gt;Item A&lt;/option&gt; &lt;option value="14644"&gt;Item B&lt;/option&gt; &lt;option value="14645"&gt;Item C&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Here's the jquery:</p> <pre><code> var rfiSchooldropdown = $('#locationChoice:selected').val(); $("#locationChoice").change(function() { alert(rfiSchooldropdown); }); </code></pre> <p>I know I'm close but it's not grabbing the value properly. I'm using "alert" to test, FYI.</p> <p>Any help is appreciated!</p>
jquery
[5]
357,169
357,170
Android IMEI binding with music file
<p>Is there any possibility to develop an application that binds the IMEI with the music file and should not play that music file if IMEI is not registered.</p> <p>The core idea is to protect the licensed file from transferring to other devices.</p>
android
[4]
5,683,273
5,683,274
Display a Dialog while video is streaming
<p>I have created an application that displays XML data information on the top section of my Linear layout. Below that I have a video that is streaming and takes a while to start playing. How would I set a dialogue to display until the video appears?</p>
android
[4]
946,023
946,024
Chat windows in jsf application
<p>I am developing a web app using java technology (jsf 1.2). Now i would like to provide my app with a chat windows that looks just like the one on facebook for example. I want the user of my app to be able sent instant messages through that windows.</p> <p>My problem is how to make such a windows using jsf. Is there any jsf component that i can use to do it ?</p> <p>Thanks</p>
java
[1]
2,908,035
2,908,036
screen shot for the activity
<p>i want to create a bitmap of whats being currently displayed of my app, one thing i went into is cant read FB buffer requires root, would like to know if it is possible to create a image file for the screen, please i want the help to code this, no 3rd party intents , thanks, answers would be much appreciated</p>
android
[4]
3,792,921
3,792,922
How to decode special character in Request.QueryString?
<p>I am passing '© Alt+ 0169' in my serach fields in query string.</p> <p>When i am getting QueryString in page like Request.QueryString("SearchVal") then value will be : '© Alt 0169' .</p> <p>It reomove '+'. </p> <p>Could u tell me how can i get it..</p> <p>Thanks Pankaj Pareek</p>
asp.net
[9]
2,932,328
2,932,329
What happens to the exectuting threads (other than Main thread) of an App when the user presses the "Home" button
<p>As far as I know the main thread or UI thread will be paused the moment user presses "Home" button as it comes under Activity Life cycle. But what happens to the other exectuting threads of an App when the user presses the "Home" button? Does they be executing like background processes or will be paused? If they continue with execution can I say these can be the replacement for Services?</p> <p>Thanks</p>
android
[4]
5,268,322
5,268,323
please guide me!
<p>hi all i want to use factory class for employees login in a ticket booking system. i have 3 levels of employees : manager,driver and general employee.</p> <p>please guide me.</p>
c#
[0]
4,808,057
4,808,058
How to call setText() using a Float data type?
<pre><code> public void onClick(View v) { switch(v.getId()){ case R.id.save2: s = text.getText().toString(); number = Float.parseFloat(num.getText().toString()); SharedPreferences.Editor editor = shared.edit(); editor.putString("sharedtext",s); editor.putFloat("sharednum",number); editor.commit(); Toast.makeText(this,"save2",Toast.LENGTH_SHORT).show(); break; case R.id.load2: String returner = shared.getString("sharedtext","Returner fail"); float returnnum = shared.getFloat("sharednum",0); text.setText(returner); num.setText(returnnum); //error here Toast.makeText(this,"load2",Toast.LENGTH_SHORT).show(); break; case R.id.page2: intent= new Intent(this,SharedPreferencesActivity.class); startActivity(intent); Toast.makeText(this,"page2",Toast.LENGTH_SHORT).show(); break; } </code></pre> <p>how could i resolve this error?</p> <p>how to make something like setInt(int num);</p> <p>btw the variable num and text are both EditText</p>
android
[4]
652,993
652,994
jQuery variable and object caching
<p>This is something that has been bugging me some time and every time I found myself using different solution for this.</p> <p>So, I have link in my document which on click creates new element with some ID.</p> <pre><code>&lt;a href="#" id="test-link"&gt;Link&lt;/a&gt; </code></pre> <p>For the purpose of easier reusing, I would like to store that new elements ID in a variable which is jQuery object</p> <pre><code>var test = $('#test'); </code></pre> <p>On click I append that new element on body, new element is DIV</p> <pre><code>$('body').append('&lt;div id="test"/&gt;'); </code></pre> <p>And here goes the main "problem" - if I test this new elements length with <em>test.length</em> it first returns 0 and later 1. But, when I test it with <em>$('#test').length</em> it returns 1 from the start.</p> <p>I suppose it is some caching mechanism and I was wondering is there better, all-around solution which will allow to store elements in variables in the start for later repurpose and in the same time work with dynamically created elements.</p> <p>Live, delegate, something else? What I do sometimes is create string and add it to jQuery object but I think this is just avoiding the real issue. Also, using .find() inside another jQuery object.</p> <p>Thanks in advance.</p>
jquery
[5]
2,104,206
2,104,207
How can I highlight the table row on click?
<p>As my project requirement i have to highlight the table row on onClick. There is any way to do this? Or please suggest me the alternative? </p>
android
[4]
4,042,656
4,042,657
Android - Image editing
<p>My app Features:</p> <ul> <li>(done) Take photo from camera or picture gallery;</li> <li>(done) Collection of funny stickers;</li> <li>(done) Share created comical photos via email, mms etc.</li> <li>(done) Save 'stickered' photos in picture gallery;</li> <li>(NOT done) Move, scale and rotate sticker images: I can able to add but I cant able to select the stickers after sticking two or more...</li> </ul> <p>Can anyone suggest me any sample example program or supported lib file. I tried Aviary but it is not suitable for this application.</p>
android
[4]
4,514,196
4,514,197
Setting attributes on anonymous objects
<p>I thought this was possible in c# .net 2.0 ?</p> <pre><code>header.Cells.Add((new TableCell(){Text = "First header"})); </code></pre> <p>unless I am doing it wrong? this produces the following error:</p> <pre><code>CS1026: ) expected </code></pre> <p>Were is the mistake?</p>
c#
[0]
645,497
645,498
scaling current frequency not displaying appropriate result
<p>I am using cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq to extract the current frequency. But whenever I run this command, I get the maximum frequency being set, while when I pull from DDMS, the file shows different frequency. Can you suggest what could be the error?</p> <p>My Code:</p> <pre><code>public String getCurrentCPU() { Process process; try{ Runtime rt = Runtime.getRuntime(); process=rt.exec("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"); BufferedReader reader = new BufferedReader( new InputStreamReader(process.getInputStream())); int read; char[] buffer = new char[4096]; StringBuffer output = new StringBuffer(); while ((read = reader.read(buffer)) &gt; 0) { output.append(buffer, 0, read); } reader.close(); process.destroy(); //process.waitFor(); return output.toString(); } catch (IOException e) { throw new RuntimeException(e); } } </code></pre>
android
[4]
5,843,138
5,843,139
Source code for java.lang.Object
<p>Is there any web site that I could see the source code for the Java standard library? Most so the two classes java.lang.* and java.net.* ??</p>
java
[1]
5,670,768
5,670,769
Why can't I use a member initialization list here?
<p>I just finished creating a "Point" class and was working on a "Line" class that has two Point objects (Point startpoint and Point endpoint) as data members. I created a constructor in my Line class that accepts two Point objects as arguments and had originally created it as follows:</p> <pre><code>Line(const Point&amp; p1, const Point&amp; p2) { startpoint = p1; endpoint = p2; } </code></pre> <p>Everything was fine, but then I decided I would use a member initialization list instead of assigning the members to p1 and p2 in the body, just because... But when I changed it to:</p> <pre><code>Line(const Point&amp; p1, const Point&amp; p2): startpoint(p1), endpoint(p2) { } </code></pre> <p>I get an error saying "no instance of constructor "Point::Point" matches the argument list" and didn't understand what this meant exactly.</p> <p>Why doesn't the member initialization list work here?</p> <p>Thanks.</p> <p>edit: Sorry, I didn't know if the details of my point class was relevant or not:</p> <p>// Point.h</p> <pre><code>class Point { private: double x; double y; public: Point(); Point(Point&amp; p); Point(double x1, double y1); ~Point(); double X() const; double Y() const; void X(double newx); void Y(double newy); }; </code></pre> <p>// Point.cpp</p> <pre><code>#include "Point.h" Point::Point(): x(0), y(0) { } Point::Point(Point&amp; p) { x = p.x; y = p.y; } Point::Point(double x1, double y1): x(x1), y(y1) { } Point::~Point() { } double Point::X() const { return x; } double Point::Y() const { return y; } void Point::X(double newx) { x = newx; } void Point::Y(double newy) { y = newy; } </code></pre>
c++
[6]
5,640,535
5,640,536
php image type detection
<p>Unable to detect mime type. if I remove <code>($mime=="image/jpeg" || $mime=="image/pjpeg")</code>, it could upload the image successfully.</p> <pre><code>$mime = $_FILES['Filedata']['type']; if((!empty($_FILES['Filedata']['tmp_name'])) &amp;&amp; ($_FILES['Filedata']['error'] == 0)) { $filename = basename($_FILES['Filedata']['name']); $ext = pathinfo($filename, PATHINFO_EXTENSION); if (($ext=="jpg" || $ext=="jpeg") &amp;&amp; ($mime=="image/jpeg" || $mime=="image/pjpeg") &amp;&amp; ($_FILES["Filedata"]["size"] &lt; 350000)) { $newname = $filename; if (!file_exists($newname)) { if (move_uploaded_file($_FILES['Filedata']['tmp_name'], "./photo/" . $newname)) { echo "It's done! The file has been saved as: ".$newname; } else { echo "Error: A problem occurred during file upload!"; } } else {echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists";} } else { echo "Error: Only .jpg images under 350Kb are accepted for upload"; } } else { echo "Error: No file uploaded"; } </code></pre>
php
[2]
5,541,590
5,541,591
how to use the same button and text view in the secondary class without calling id in secondary class from xml in android
<p>I am using button and text view in main java class and how to use the same button and text view in the secondary class without calling id in secondary class from xml in android</p>
android
[4]
2,525,172
2,525,173
What is this code: %(var)s ? Python maybe?
<p>There is an option on the backend of a website that I use that allows me to customize the data sent in a CSV file when an order has been placed for a product. There are two columns, the left column is where you assign the header and the right column is where you input the variable. The syntax for the existing variables is similar to <code>%(order.random_variable)s</code> or <code>%(item.random_variable)s</code> This looks similar to the string placeholder <code>%s</code> in Python and I'm fairly confident that it is related, if not the same, but I don't quite understand the syntax. Could someone please elaborate on the purpose of this code?</p> <p>Oh, and for the record, I don't plan on going in and changing variables around right away. Just looking for a good jumping off point for my research into this.</p>
python
[7]
5,030,221
5,030,222
What is gpstate file in ASP.NET
<p>In my project I found a .gpState file in the folder, What is the purpose of gpState file?</p>
asp.net
[9]
4,346,965
4,346,966
how to remove numbers from string in Regex.Replace?
<p>i need Regex.Replace that remove all numbers and sign from string</p> <p>ex. "123- abcd33" and i need to get: "abcd"</p> <p>thank's in advance</p>
c#
[0]
3,298,612
3,298,613
Read 40 bytes of binary data as ascii text
<p>I have some binary data, in hex editor it looks like: s.o.m.e.d.a.t.a</p> <p>with all these dots in between each letter</p> <p>when I read with filehandle.read(40) it shows these dots</p> <p>I know that the dots aren't supposed to be there, is there a way to unpack some ascii data that is 40 bytes long with struct?</p> <p>I tried '40s' and 's' but it shows weird data, or only unpacks 1 character instead of 40.</p>
python
[7]
5,250,155
5,250,156
How do I create named popup windows?
<p>In javascript, the <code>window.open</code> function takes as a second argument the name of a window. I am trying to open Google in a new named window with</p> <pre><code>window.open('http://google.com/', 'myGoogleWindow');​ </code></pre> <p>but nothing happens. However, </p> <pre><code>window.open('http://google.com/'); </code></pre> <p>works. However, I want to name the window since I would like to programmatically close it later. How do I open a popup in a named window?</p>
javascript
[3]
1,236,132
1,236,133
how to create margin moving image view android
<p>please give me sample moving image to my margin destination</p> <p>ilustration</p> <pre><code>image x (margin move image) </code></pre> <p>if image moving with drag image stoped moving to my margin </p> <pre><code>imageView.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub int eid = event.getAction(); switch (eid) { case MotionEvent.ACTION_MOVE: RelativeLayout.LayoutParams mParams = (RelativeLayout.LayoutParams) imageView.getLayoutParams(); int x = (int) event.getRawX(); //int y = (int) event.getRawY(); TextView text = (TextView) findViewById(R.id.editText1); text.setText("1"); mParams.setMargins(0, 0, 70, 0); mParams.leftMargin = x+0; //mParams. imageView.setLayoutParams(mParams); break; default: break; } return true; } } </code></pre>
android
[4]
2,756,856
2,756,857
Can someone please explain .map() in laymans terms?
<p><strong>UPDATE 1:</strong></p> <p>Here is more of the script:</p> <pre><code>$(".favorites").sortable( {update:function() { var that = this; var urls = ""; var texts = ""; $.map($(".favorites a"), function(elt) { urls += "url=" + elt.href + "&amp;"; texts += "text=" + $(elt).html() + "&amp;"; }); $.ajax({ url: 'favorites.asmx/save', type: 'POST', data: { strItems:$(that).sortable("serialize",{key:'item'}), strURLs:urls.substr(0,urls.length - 1), strTexts:texts.substr(0,texts.length - 1) }, error: function(xhr, status, error) { console.log(xhr.responseText); }, success: function() { console.log("Values sent:- strURLs: " + urls.substr(0,urls.length - 1)); } }); </code></pre> <p><strong>ORIGINAL QUESTION:</strong></p> <p>I have the following script which works, but I don't understand it:</p> <pre><code>$.map($(".favorites a"), function(elt) { urls += "url=" + elt.href + "&amp;"; texts += "text=" + $(elt).html() + "&amp;"; }); </code></pre> <p>I understand the basic examples in this link: <a href="http://api.jquery.com/jQuery.map/" rel="nofollow">http://api.jquery.com/jQuery.map/</a>, but I don't understand the script I have posted above.</p>
jquery
[5]
1,152,617
1,152,618
Change image source but then image doesnt appear
<p>I got this code online and wanted to change the image source from an online picture, to the one i have on my root folder. But everytime i change the file location, image doesnt appear.</p> <pre><code>var firstreel=new reelslideshow({ wrapperid: "myreel", //ID of blank DIV on page to house Slideshow dimensions: [1310, 400], //width/height of gallery in pixels. Should reflect dimensions of largest image imagearray: [ ["http://i30.tinypic.com/531q3n.jpg"], //["image_path", "optional_link", "optional_target"] ["http://i29.tinypic.com/xp3hns.jpg", "http://en.wikipedia.org/wiki/Cave", "_new"], ["http://i30.tinypic.com/531q3n.jpg"], ["http://i31.tinypic.com/119w28m.jpg"] //&lt;--no trailing comma after very last image element! ], </code></pre>
javascript
[3]
1,145,144
1,145,145
radio buttons and javascript
<p>i have a form with a radio button group(6 radio buttons),</p> <p>id's are r1,r2,r3,r4,r5,r6 </p> <p>and there are 6 hidden tables(display=none;) in this page, </p> <p>tables id's are t1,t2,t3,t4,t5,t6 .</p> <p>i want to change the table's dispaly property as inline if a radio button checked,</p> <p>if,</p> <p>r1 radio checked show table t1,(other tables should be hidden)</p> <p>r2 radio checked show table t2, (other tables should be hidden)</p> <p>r3 radio checked show table t3,(other tables should be hidden)..so on</p> <p>i tried to do this with document.getElementById ,but my code did not worked correctly since i am new to javascript. so how to do this?</p>
javascript
[3]
322,967
322,968
linked list push front
<pre><code> void push_front(const dataType &amp;item) { head=new dnode&lt;dataType&gt; (item,NULL,head); if (!empty()) head-&gt;next-&gt;prev=head; else tail=head; numItems++; } </code></pre> <p>I have a piece of code here, however I don't really understand it, what is the line <code>head-&gt;next-&gt;prev=head</code> do ? could anyone please explain, thanks</p>
c++
[6]
1,192,746
1,192,747
How can I execute this math operation in PHP?
<p>I am trying to do this operation:</p> <pre><code>$math = 1.30644 - 1.3063 </code></pre> <p>I want the result to be the difference in this way:</p> <p>1.4 (Which is 64,4 - 63) because I am dealing with PIPS. How can I achieve this result.</p> <p>What I tried:</p> <pre><code>$math = 1.30644 - 1.3063 echo $math; // output -0.3063 I want it to output 1.4 </code></pre>
php
[2]
2,408,642
2,408,643
write content to newly open window using jQuery
<p>I have a function written on some another page load event.i want to open new page and write content (such as textbox value) to newly opened page</p> <pre><code>function updateUser() { $("button").on("click", function () { var code = $(this).attr('id'); $.ajax({ url: '/ajaxExecute.aspx?Fn=GETUSERFORUPDT', type: 'POST', context: document.body, data: 'Code=' + code, cache: false, success: function (response) { if (response != 'undefined') { window.location = 'AddEditUser.aspx'; $('#txtUserName').val(response.split("|")[0]); } } }); }); } </code></pre> <p>Textbox with id <code>txtUserName</code> lies in page <code>AddEditUser.aspx</code> &amp; <code>function updateUser()</code> load in another .aspx page</p> <p>My Page loads but not able to get value in <code>textbox</code> as i am able to get value using <code>alert()</code></p> <p>I refer this links but still cudnt figure out</p> <p><a href="http://stackoverflow.com/questions/3841100/write-content-to-new-window-with-jquery">Write Content To New Window with JQuery</a></p> <p><a href="http://stackoverflow.com/questions/1225558/jquery-new-window-with-content-from-modal-content-on-opener-page">jQuery new window with content from modal content on opener page</a></p>
jquery
[5]
4,438,364
4,438,365
basic.types $3.9 /9th point,ISO Standard C++ specification
<p>Point from ISO Standard C++ specification : §3.9 /9th point</p> <blockquote> <p>An object type is a (possibly cv qualified) type that is not a function type, not a reference type, and not a void type.</p> </blockquote> <p>Any one can able to explain this point with programming .(how it fails )</p>
c++
[6]
3,374,839
3,374,840
android location listener question
<p>I am developing an location aware application that needs to know the users location. The problem is that the application doesn't seem to work properly.</p> <p>By properly I mean that every time I have to first open an application (like cardio trainer) in order to get a GPS signal and then run my program, otherwise the GPS icon on the notification bar is blinking like it blinks when the device tries to get GPS signal and after a while it stops and no location is returned!</p> <p>this is really weird because it shouldent stop, is there an interval that android provides the gps to get signal?</p> <p>on the documentation I haven't found anything about that.</p> <p>my code is as follows:</p> <pre><code>lm.isProviderEnabled(LocationManager.GPS_PROVIDER); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 10, locationListenerGps); LocationListener locationListenerGps = new LocationListener() { public void onLocationChanged(Location location) { locationResult.gotLocation(location); Log.e("##################","MyLocation got GPS location accuracy: "+location.getAccuracy()+" Altitute: "+location.getAltitude()+" log: "+location.getLongitude()+" lat: "+location.getLatitude()); } public void onProviderDisabled(String provider) {} public void onProviderEnabled(String provider) {} public void onStatusChanged(String provider, int status, Bundle extras) {} }; </code></pre> <p>That should open the gps provider and register a listener called locationListenerGps that would be called by the location manager every 1 minute or 10 meters right?</p> <p>why I have to open cardioTrainer first to get a GPS signal?</p> <p>thanks in advanced maxsap </p>
android
[4]
5,973,385
5,973,386
Matching strings to arrays
<p>I have a problem with this code:</p> <pre><code>var buyerChoice = prompt("Enter a either apple, orange, or banana:", ""); var fruits = new Array ("apple", "orange", "banana"); for(i=0; i &lt; fruits.length; i++) { if(buyerChoice === fruits[i]) { document.write(buyerChoice); } else if (buyerChoice !== fruits[i]){ document.write("Sorry, " +buyerChoice+ " is out of season."); break; } } </code></pre> <p>I believe the problems lies in the <code>else-if</code> statement because every time I type in an item that exists in my variable, it will return <code>//appleSorry, apple is out of season</code>, thus meeting both conditions.</p> <p>I'm stumped. I guess the bottom line is how to effectively match a string from a prompt to an array, testing each item and how to parse an array if a prompted string doesn't exist.</p>
javascript
[3]
4,937,924
4,937,925
Detect application coming from the background and prompt for PIN in Android
<p>I have an app in which I need to prompt the user to enter the PIN every time the app comes from the background.</p> <p>I looked several answers from stackoverflow from @hackbod and @commonsware I implemented the timeout approach from @commonsware and it worked fine, but my users are not happy with it. They want to prompt for PIN everytime when the app is coming from background.</p> <p>Now I am implemeting the solution from @hackbod by having every activity increment the counter in onStart and decrement the count in onStop. <a href="http://stackoverflow.com/questions/5836843/android-detecting-if-an-application-entered-the-background">Android detecting if an application entered the background</a></p> <p>But the problem is when users changes the Orientation of the current activity the counter sets back to 0 and my app thinks the user is coming from background. my onStart() increments the counter and onStop is decrementing the counter. I want android to take care of the orientation change as I have different layouts for different orientation.</p> <p>I don't want to use GET_TASKS approach for now. All suggestions are appreciated..</p>
android
[4]
4,766,785
4,766,786
Best way of returning a pointer
<p>I have seen at least 5 C++ tutorial sites that return pointers this way:</p> <pre><code>int* somefunction(){ int x = 5; int *result = &amp;x; return result; } </code></pre> <p>Is that not a very, VERY bad idea? My logic tells me that the returned pointer's value can be overwritten at any time. I would rather think that this would be the right solution:</p> <pre><code>int* somefuntion(){ int x = 5; int* result = new int; *(result) = x; return result; } </code></pre> <p>And then leave the calling function to delete the pointer. Or am i wrong?</p>
c++
[6]
5,163,706
5,163,707
How can I get named parameters in Java in static methods?
<p>Should I implement named parameters in Java using Hash tables?</p> <p>I saw this entry:</p> <p><a href="http://stackoverflow.com/questions/1988016/named-parameter-idiom-in-java">http://stackoverflow.com/questions/1988016/named-parameter-idiom-in-java</a></p> <p>: but I did not want to use the builder method which seemed overly verbose</p>
java
[1]
666,850
666,851
How to get active music player -- android
<p>thanks for previous replies,</p> <p>Is it possible to get package name of active and runningin service(background) music player. I can able to get the music actions(metachage or playstateChange) but when i use intent.getPackagename, im getting null. can anyone guide me on how to get the package name of music player. </p> <p>Thanks!</p>
android
[4]
3,682,531
3,682,532
Difference between the Gridview and Datagrid in Asp.net
<p>I am new to asp.net. what is the difference between the Gridview and Datagrid in Asp.net</p> <p>Thanks sivakumar</p>
asp.net
[9]
3,241,653
3,241,654
Compound Boolean Expression Java, evaluate to true
<p>I don't understand how to answer this questions.. <strong>x&amp;&amp; !y || z==x</strong></p> <p>Which two of the following combinations of true and false values would cause the compound Boolean expression to evalute to true?..with a reason please.</p> <p>A. x= false; y=true; z=true;</p> <hr> <p>B. x= false; y=false; z=true;</p> <hr> <p>C. x= false; y=true; z=false;</p> <hr> <p>D. x= true; y=true; z=true;</p> <hr> <p>E. x= true; y=true; z=false;</p>
java
[1]
4,718,288
4,718,289
How can I extract a password protected .zip file from within my PHP application?
<p>How can I extract a password protected <code>.zip</code> file from within my PHP application?</p>
php
[2]
2,991,443
2,991,444
OS Process manager Listener in c#
<p>Is there any operating system's Process Manager library in c#? Forexample when new application started or closed I want to get that process name from my code.</p>
c#
[0]
5,783,156
5,783,157
C++ Constructor Implementation Error
<p>C++ Constructor Implementation Error</p> <p>I have 2 class</p> <pre><code>Map2D(parent) &amp; Map3D(child) </code></pre> <p>So this is what happen...</p> <pre><code>class Map3D : public Map2D { private: int z; public: Map3D(); Map3D(int,int,int); int getZ(); } </code></pre> <p>And below is my Map2D</p> <pre><code>class Map2D { friend ifstream&amp; operator&gt;&gt;(ifstream&amp;, Map2D&amp;); protected: int x; int y; public: Map2D(); Map2D(int,int); }; Map2D::Map2D() { x=0; y=0; } Map2D::Map2D(int xIn,int yIn) { x = xIn; y = yIn; } </code></pre> <p>The problem now is i try to implement Map3D but got issue.. which what i try is below</p> <p>Back on Map3D.cpp</p> <pre><code>Map3D::Map3D() { x=0; y=0; z=0; } Map3D::Map3D(int xIn,int yIn,int zIn) { x=xIn; y=yIn; z=zIn; } map3d.cpp:18:1: error: extra qualification ‘map3D::’ on member ‘map3D’ [-fpermissive] map3d.cpp:18:1: error: ‘map3D::map3D()’ cannot be overloaded map3d.cpp:14:1: error: with ‘map3D::map3D()’ map3d.cpp:25:1: error: extra qualification ‘map3D::’ on member ‘map3D’ [-fpermissive] map3d.cpp:25:1: error: ‘map3D::map3D(int, int, int)’ cannot be overloaded map3d.cpp:15:1: error: with ‘map3D::map3D(int, int, int)’ </code></pre> <p>What should i change to make my implementation correct. Thanks for all help.</p>
c++
[6]
3,786,481
3,786,482
javascript solution to display relavant ads (sth like AdSense)
<p>I would like to place relevant ads on the product pages of an ecommerce site. I know that usually such ads are stored in a database table that links the given product and the ads. But now I wonder if it's possible to code a similar system with javascript. I mean something like a script that is loaded with the page and it parses the given page's content, looks for keywords (relevant words) and uses these keywords to query a database for ads to display. It'd be something like Google AdSense... but I am not sure how that works. Do you think it's possible to develop such a system? Anybody here who ever tried to code it? (Btw is it possible to parse a page with javascript at all?)</p>
javascript
[3]
2,348,807
2,348,808
Formly jQuery Form Plugin, Submitting on Errors
<p>I've followed the instructions for implementing Formly (<a href="http://thrivingkings.com/formly/" rel="nofollow">http://thrivingkings.com/formly/</a>) and all the validation works a treat, it's just when I add the JS code to handle the submit after the validate, the form submits to the server even though errors occur on the form. See the comment on the Formly website by "Faz". Any ideas?</p> <p>Thanks.</p>
jquery
[5]
2,499,994
2,499,995
Auto select a dropdown based off another dropdown when checkbox is checked
<p>I am working on a form with a two different sections. Both sections have a few text fields and a drop down list. There is also a checkbox in the second section that when checked auto fills the text fields with the information from the previous section. I need to have the selected value from the drop down in the first section carry over when the checkbox is check too. Any advice? Thanks.</p> <pre><code>$("input#sh_check").click(function(){ if ($("input#sh_check").is(':checked')) { // Checked, copy values $("input#sh_compname1").val($("input#st_compname1").val()); $("input#sh_compname2").val($("input#st_compname2").val()); $("input#sh_address1").val($("input#st_address1").val()); $("input#sh_address2").val($("input#st_address2").val()); $("select#sh_territory option:selected").val($("select#st_territory option:selected")); } else { // Clear on uncheck $("input#sh_compname1").val(""); $("input#sh_compname2").val(""); $("input#sh_address1").val(""); $("input#sh_address2").val(""); $("#sh_territory").val(""); } }); </code></pre>
jquery
[5]
1,835,429
1,835,430
regarding implementation of camera in android
<p>I am developing an application of android which involves saving image of camera on click of click button.Can anyone give me a guidance of how to implement camera in android??</p>
android
[4]
3,956,656
3,956,657
C++ filereader giving error
<p>I got code for a filereader for C++ from a website but I can't seem to get it to work for me, is there something wrong with the code or should I just use something else to read text form a textfile?</p> <p>The Error I get is: </p> <p>E:\IT-C++\snake.cpp||In function 'int main()':| E:\IT-C++\snake.cpp|11|error: could not convert 'infile.std::basic_ios&lt;_CharT, _Traits>::eof [with _CharT = char, _Traits = std::char_traits]' to 'bool'| E:\IT-C++\snake.cpp|11|error: in argument to unary !| ||=== Build finished: 2 errors, 0 warnings ===|</p> <pre><code>#include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;string&gt; using namespace std; int main () { string STRING; ifstream infile; infile.open ("names.txt"); while(!infile.eof) // To get you all the lines. { getline(infile,STRING); // Saves the line in STRING. cout&lt;&lt;STRING; // Prints our STRING. } infile.close(); } </code></pre>
c++
[6]
3,541,190
3,541,191
Issues with iPhone Http Streaming with concatenated video files
<p>We are seeing this when "tying" two video files together.</p> <p>Example we have Ad video that is segmented and content file which is also segmented. We create a new file which has both Ad and content segment information together. However we are seeing an issue where either the Ad content is truncated or the content starts having A/V sync issues. Both ad and content are segmented the same way , 5 sec segmentation. however since Ads are variable length the result file may have left over segment something like:</p> <pre><code>#EXTM3U #EXT-X-TARGETDURATION:5 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:5, fileSequence6.ts #EXTINF:5, fileSequence7.ts #EXTINF:4, fileSequence8.ts #EXTINF:5, fileSequence0.ts #EXTINF:5, fileSequence1.ts #EXTINF:5, fileSequence2.ts #EXTINF:3, fileSequence3.ts </code></pre> <p>Is this the proper way to play 2 files one after the other without rebuffering? should generate-variant-plist be used to a play list of 2 files?</p>
iphone
[8]
4,456,562
4,456,563
ASP.NET Entry Point?
<p>Just created a blank "ASP.NET Web Application". Where's the entry point?</p> <p>I see "Default.aspx" which seems to be the default template that calls. "Site.Master" which I guess acts as a layout file. "Global.asax" that seems to provide some method stubs for event handling. And then "Web.config" which seems to have some site-specific settings such as a DB connection string, and some authentication stuff.</p> <p>But no where do I see any "routes" or anything to indicate that "Default.aspx" should be called by default, or "Global.asax" should be used to handle events. Where's this stuff specified? Is it baked into the core of ASP? Can't I filter all the requests through one C# method and then delegate how I please? And return some sort of Http response?</p>
asp.net
[9]
5,308,078
5,308,079
Simple script not working in IE7
<p>I have a simple script that toggles between two divs. It works in IE9 but not in IE7. I am not a js guy so any help would be appreciated.</p> <p>Upon load the solutions div shows, when you click on the industry button the expected behavior is for solutions to disapear and industry to be in it's place. What happens is industry appears below solutions.</p> <pre><code>&lt;script type="text/javascript"&gt; function showHide(whitchOne) { var d1 = document.getElementById('solutions'), s1 = d1.style.display; var d2 = document.getElementById('industry'), s2 = d2.style.display; d1.style.display = s1=='block'||whitchOne==2? 'none' : 'block'; d2.style.display = s2=='block'||whitchOne==1? 'none' : 'block'; return false; } &lt;/script&gt; &lt;input class="radioWrap" type="radio" name="toggle" checked="checked" value="solutions" onclick="showHide('solutions')" /&gt; &lt;input class="radioWrap" type="radio" name="toggle" value="industry" onclick="showHide('industry')" /&gt; &lt;div id="solutions" style="display:block;"&gt;Solutions&lt;/div&gt; &lt;div id="industry" style="display:none;"&gt;Industry&lt;/div&gt; </code></pre>
javascript
[3]
3,912,424
3,912,425
How do I get the highest value when using loops?
<p>I want to get the highest value of my array. This are the two ways when I'm working with php functions.</p> <pre><code> $a = array(1,125,1068); 1. $value = max($a); print_r ($value); 2. asort($a); $value = end($a); print_r ($value); </code></pre> <p>I just couldn't figure out how to get the highest value when using loops.</p>
php
[2]
5,265,589
5,265,590
CJ Flashy Slideshow - Requires page reload to work with Internet Explorer
<p>On my <a href="http://firstchoicelegal.co.uk" rel="nofollow">website</a>, I am using the plugin <a href="http://cjboco.com/projects.cfm/project/cj-flashy-slide-show/1.1.3" rel="nofollow">CJ Flashy Slideshow version 1.13*</a> </p> <p>The plugin works fine under all browsers except for Internet Explorer, where you have to reload the page to make it work. </p> <p>How can I make the plugin work on IE, without reloading the page. </p> <p>*I have to use 1.13 as I am using Drupal 7 and newer version of CJ Flashy Slideshow will not work with Drupal 7.</p>
jquery
[5]
3,556,326
3,556,327
Adding days to $Date in PHP
<p>I have a date returned as part of a mySQL query in the form 2010-09-17</p> <p>I would like to set the variables $Date2 to $Date5 as follows:</p> <p>$Date2 = $Date + 1</p> <p>$Date3 = $Date + 2 </p> <p>etc..</p> <p>so that it returns 2010-09-18, 2010-09-19 etc...</p> <p>I have tried </p> <pre><code>date('Y-m-d', strtotime($Date. ' + 1 day')) </code></pre> <p>but this gives me the date BEFORE $Date.</p> <p>What is the correct way to get my Dates in the format form 'Y-m-d' so that they may be used in another query?</p>
php
[2]
4,192,932
4,192,933
The Obsever pattern (or something similar) using a global update() function in C++?
<p>I am creating an MVC application in C++ and I want the lower level model classes to be able to update the GUI with simple text to display output to the reader. I don't want to have to pass around function or object pointers as it would get messy and I would have to pass them around all over the place. What I essentially want is the equivalent to 'cout' for a console GUI - some sort of global function that can be called to update the GUI from anywhere without having to know anything about the GUI.</p> <p>I've mentioned the Observer pattern in the title because it sounds a lot like that - the GUI could subscribe to this global object or function in someway and listen for when it is called. However, I'm not specifically looking for a solution using Observer.</p> <p>People have mentioned signals and slots to me but surely, unless global, you are still required to 'pass things around' to allow objects to emit the signals. Again, a global point of reference would be helpful.</p> <p>How can I do this while ensuring that good design principles are adhered to?</p>
c++
[6]
1,057,504
1,057,505
Can I optimize checking for multiple null values in C#
<p>I have the following code: </p> <pre><code>if (Session["CurrentUrl"] != null &amp; Session["CurrentHost"] != null) </code></pre> <p>I use this in many places. I am wondering if anyone can think of a way to optimize the C# code just to make things slight more clear.</p>
c#
[0]
4,768,103
4,768,104
Putting a closure to JS Closures
<blockquote> <p>a closure is the local variables for a function - kept alive after the function has returned.</p> </blockquote> <p>I'm wrapping my head around JS &amp; jQuery Closures. From the definition above my understanding is a closure allows access to variables outside a function without the need for creating globals, eliminating the inherent risk. Is my interpretation correct?</p> <p>As always many thanks. </p>
javascript
[3]
305,990
305,991
Write/Read from property list on iPhone
<p>I know there are thousands of tutorials on the topic however I don't get it to work. What I am trying to do is to read an value from a plist file. Then I check whether or not I have to update the value. This part is ok. However I don't managed to get the value saved in plist file. I have a Settings.Bundle and it is where I am trying to read/store. </p> <p>It is just a simple string.</p> <p>Thanks in advance</p>
iphone
[8]
21,813
21,814
Using a subclass method on a base class object
<p>Let's say I have declared the following classes:</p> <pre><code>class BaseClass{ /* properties, constructors, getters, setters etc. */ public static BaseClass Create(string url){ /*will return, depending on url, a BaseClass or a SubClass object*/ } public void Method(){ /* some code here */ } } class SubClass: BaseClass{ /* other properties, constructors, getters, setters etc. */ new public void Method(){ /* some other code here */ } } </code></pre> <p>Now in my Main method I would like to do something along the lines of:</p> <pre><code>BaseClass baseClass = BaseClass.Create(url); if(baseClass.GetType()==typeof(SubClass)){ baseClass.Method(); } </code></pre> <p>The idea here, of course, is to use <code>Method</code> as it is implemented in <code>SubClass</code>. It may be a silly question but how do I do that? I can't cast a base class into a subclass so I'm not sure...</p> <h2><strong>EDIT</strong></h2> <p>Clarified my question. Even though baseClass was declared as a BaseClass instance, <code>baseClass is SubClass</code> will return <code>true</code>if <code>url</code> is such that <code>Create</code> returns a <code>SubClass</code> instance.</p>
c#
[0]
2,276,473
2,276,474
Creating note for iphone and ipad
<p>I want to create a note (like iphone note)as a subview to a view-controller,my requirement is when the user tap the button the note have to appear in the screen. How to do this? Thanks in advance.</p>
iphone
[8]
4,704,716
4,704,717
How to get rid of the pause command in the batch file which is opened from the command prompt using c#
<p>Below is the code for running the batch file from the command prompt. The problem is that there is a pause command in the batch file which is stopping the application and I am not able to proceed with the next step. Can some one give me an idea to fix this.</p> <pre><code>Process gacCOMprocess = new Process(); infoPageExecuteBatchFiles.PageText = "Running gacCOM.bat "; infoPageExecuteBatchFiles.Refresh(); ProcessStartInfo gacCOMprocessStartInfo = new ProcessStartInfo(); gacCOMprocessStartInfo.FileName = PRES_TIER_PATH + "\\gacCOM.bat "; gacCOMprocessStartInfo.UseShellExecute = false; gacCOMprocessStartInfo.RedirectStandardOutput = true; gacCOMprocessStartInfo.CreateNoWindow = true; gacCOMprocessStartInfo.RedirectStandardInput = true; gacCOMprocess.StartInfo = gacCOMprocessStartInfo; gacCOMprocess.OutputDataReceived += new DataReceivedEventHandler(ExecuteBatchFilesHandler); gacCOMprocess.Start(); gacCOMprocess.BeginOutputReadLine(); gacCOMprocess.WaitForExit(); gacCOMprocess.Close(); </code></pre>
c#
[0]
1,455,398
1,455,399
how append text and object at once with jquery?
<p>i have 2 text node and 1 jquery object, i want append them into DOM, when i do this:</p> <pre><code>$('&lt;div&gt;') .append("Ajax Failed, ") .append($("&lt;span&gt;").addClass('counter').countDown({ start:o.time, onEnd:function(){$.ajax(o.ajax);}, onRetryEnd:function(){o.onFailed();} })) .append(" Seconds until resend request") .appendTo('#domElement').align({position:'absolute',parent:$('#domElement')}); </code></pre> <p>it will prefect (Result: Ajax Failed, 6 Seconds until resend request), but i want append all this data at once, like:</p> <pre><code> var counter = $("&lt;span&gt;").addClass('counter').countDown({ start:o.time, onEnd:function(){$.ajax(o.ajax);}, onRetryEnd:function(){o.onFailed();} }); $('&lt;div&gt;').append('Ajax Failed, ' + counter + 'Seconds until resend request'); </code></pre> <p>Result: Ajax Failed, [object object] Seconds until resend request.<br /> is possible do it at once and how?</p>
jquery
[5]
3,793,412
3,793,413
how to implement a slide down on a click event with jquery
<p>I know in jquery you can use toggle to display on and off. How do you get a slide down effect similar to what amazon has right now on the home page when you click expand?</p>
jquery
[5]
3,997,793
3,997,794
C# I"m confused with this service routine
<p>So I am using C# with WinForms, My question is what is NewValue in this snippet? e is the event that has occured. So I'm telling the label vsliderecho's text to change to something. </p> <pre><code>private void V_Slider_Bar_scroll(object sender, SCrollEventArgs e) { V_Slider_echo.Text= e.NewValue.ToString(); } </code></pre>
c#
[0]
2,690,614
2,690,615
equivalent to $_SERVER['DOCUMENT_ROOT'] that will work when script is called by cron?
<p>I'm using <code>$_SERVER['DOCUMENT_ROOT']</code> for my include paths so files will figure out where they are running from (i.e. whether they're on live or staging) and it works fine, except for scripts that are run by cron in which I have to hardcode the path. </p> <p>Is there another variable I could use that could work from both cron and the browser?</p>
php
[2]
5,493,386
5,493,387
Checking two events in one html tag
<p>I want to check two things in the form, one is onclick and the other "enter" function. So that, alert will be used by clicking the button or pressing "enter". But, "enter" function is not working(There is no problem with "onclick"). Where is the problem? Codes;</p> <pre><code>&lt;FORM NAME="myform" ACTION="" METHOD="GET"&gt;Enter something in the box: &lt;BR&gt; &lt;INPUT TYPE="text" NAME="inputbox" VALUE=""&gt;&lt;P&gt; &lt;INPUT TYPE="button" NAME="button" Value="Click" onClick="testResults(this.form)" onKeyDown="keyevent(event)"&gt; &lt;/FORM&gt; Javascript &lt;SCRIPT LANGUAGE="JavaScript"&gt; function testResults (form) { var TestVar = form.inputbox.value; alert ("You typed: " + TestVar); } function keyevent(e) { if (e.keyCode == 13) var TestVar2 = form.inputbox.value; alert ("You typed: " + TestVar2); } &lt;/SCRIPT&gt; </code></pre> <p>Thanks</p>
javascript
[3]
4,879,462
4,879,463
How to Expire Asp.net session in time bound
<p>Hi my problem is in my application i want to expire a session when user is in idel for 5 minutes and then the page want to redirect to login page and when user login I Want TO Redirected to Session expired page directly please send me the solution</p> <p>Am using following code to Expire a session my page also redircted to login after user login i want to redirected to the session expired page </p> <pre><code>&lt;sessionState mode="InProc" cookieless="false" timeout="2"&gt;&lt;/sessionState&gt; </code></pre>
asp.net
[9]
1,267,885
1,267,886
Is there a way to tell if a program is still running a method?
<p>I'm running a method from my main that generates data and I also fork a thread that monitors a queue that the method is writing to and if there's data it saves it to a disk.</p> <p>My problem is in the past I would multi-thread it and was able to monitor the life of other threads but I'm not sure how to do that if its just the main method? The issue the method is generating data slowly and using sleep or !queue.empty() doesn't work as as soon as it empties the queue the forked file writer process stops.</p> <p>I know worst case I can write to the file in the method generating the data, but other than that is there anything I can do to monitor if another method is still being executed?</p>
java
[1]
3,629,772
3,629,773
Get image length in iPhone sdk like photoruler
<p>How to measure the image length after taking a picture in iPhone? Example: if I take a picture of FISH then how should I measure the fish actual height and width?</p> <p>Any ideas or sample code would be appreciated.</p>
iphone
[8]
3,578,240
3,578,241
Determine the integrity of a string - PHP
<p>Why are str_rot13() and crypt() inefficient ways to determine the integrity of a string compared to crc32() ? ( according to some zend examination tests ) </p>
php
[2]
1,089,428
1,089,429
How can I prevent decimals being rounded when using DecimalFormat?
<p>Can anyone help how can i prevent rounding decimal value.</p> <pre><code>DecimalFormat df = new DecimalFormat(); Object[] arrayRowResult = (Object[]) rowResult; String a=df.format(arrayRowResult[0]) // [0] contain decimal(2,10) but format results rounded value String b=df.format(arrayRowResult[1]) // [1] contain decimal(2,14) but format results rounded value </code></pre> <p>How can i prevent round off.</p>
java
[1]
3,602,105
3,602,106
echo for style in table row and table data
<pre><code>&lt;tr &lt;?php if($isOverDeadline) { echo ' style="background-color:#CC3300"'; } ?&gt;&gt;&lt;td width="250" &lt;?php if($isOverDeadline) { echo ' style="color:#fff"'; } ?&gt;&gt;&lt;?php echo $something; ?&gt; &lt;/td&gt;&lt;/tr&gt; </code></pre> <p>I find that the nested php blocks inside tr and td do not work. Could someone tell me what is wrong ?</p>
php
[2]
1,004,537
1,004,538
Is there a built in Javascript function to turn the text string of a month into the numerical equivalent?
<p>Is there a built in Javascript function to turn the text string of a month into the numerical equivalent? </p> <p>Ex. I have the name of the month "December" and I want a function to return "12".</p>
javascript
[3]
4,524,272
4,524,273
How to stop the counter from increasing when refreshing the page
<p>Here is my code:</p> <pre><code>$score=0; $sql10=mysql_query("select * from image WHERE fromUser='".$_SESSION['email']."' order by id desc"); $score1=mysql_fetch_array($sql10); $answer=$score1['Correct_answer']; echo $answer; $sql13=mysql_query("select * from image WHERE toUser='".$_SESSION['email']."' order by id desc"); $score2=mysql_fetch_array($sql13); $answer2=$score2['User_answer2']; echo $answer2; strcasecmp($answer,$answer2); if(strcasemp) echo $score +=1; </code></pre> <p>As u can see I am comparing the answers and if both are equal I want the score to increase by one. But the code is not working any hint???</p>
php
[2]
1,365,703
1,365,704
Error checking in a web form
<p>Is there somewhere to see examples of error checking. I have a web form with several controls. Two of the controls are critical to updating a database and also for the reporting in a gridview. </p> <p>I am not looking for extremely complex checking, just something to stop the user before the submitting an update to the database. For example, I have a calendar where the user needs to select a date. If they fail to select a date, I would like to not process the update and instead return a warning like "Are you nuts, enter a date!"</p> <p>TIA</p>
asp.net
[9]
1,401,842
1,401,843
differentiating left and right scroll in gallery
<p>Hie all , is there any method in android that can differentiate the left and the right scrolling actions in android. <img src="http://i.stack.imgur.com/02Lrb.png" alt="enter image description here"> it is actually a customized gallery view so what I am trying to do is that on scroll actions i want to different images. I mean on left scroll I've different images and on right scroll I've different images to show. so i need to differentiate the let and right scroll.</p>
android
[4]
3,240,470
3,240,471
Javascript closure
<p>The following program returns "local" and, according to the tutorial I<code>m reading, it is designed to demonstrate the phenomenon of</code>closure`</p> <p>What I don`t understand is why, at the end, in order to call parentfunction, it assigns it to the variable "child" and then calls "child."</p> <p>Why doesn`t it work by just writing parentFunction(); at the end?</p> <pre><code>var variable = "top-level"; function parentFunction() { var variable = "local"; function childFunction() { print(variable); } return childFunction; } var child = parentFunction(); child(); </code></pre>
javascript
[3]
5,015,408
5,015,409
jQuery: Match a list with less than X items
<p>I want add a class to lists, but only if they have 3 or less items:</p> <pre><code>var ol = $('ol'); var len = ol.children('li').length; //0 based? while(len &lt; 2) { $("ol").addClass("small-list"); } </code></pre> <p><a href="http://jsfiddle.net/hryZ4/2/" rel="nofollow">http://jsfiddle.net/hryZ4/2/</a></p> <p>How would I add such a conditional clause?</p> <p>All I found was something mroe or less unrelated: <a href="http://stackoverflow.com/questions/2179799/fill-list-up-to-10-items">Fill list up to 10 items</a></p>
jquery
[5]
2,001,493
2,001,494
How to get Client IP address in PHP?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1437771/how-can-i-get-the-clients-ip-address-in-a-php-webservice">How can I get the client&rsquo;s IP address in a PHP webservice?</a> </p> </blockquote> <p>How can I get Client IP address using PHP? I want to keep record of the user who logged into my website through his/her IP address.</p>
php
[2]
5,302,771
5,302,772
PHP 5.2.12 - Interesting Switch Statement Bug With Integers and Strings
<pre><code>&lt;?php $var = 0; switch($var) { case "a": echo "I think var is a"; break; case "b": echo "I think var is b"; break; case "c": echo "I think var is c"; break; default: echo "I know var is $var"; break; } ?&gt; </code></pre> <p>Maybe someone else will find this fascinating <em>and</em> have an answer. If you run this, it outputs <code>I think the var is a</code> when <em>clearly</em> it's <code>0</code>. Now, I'm most certain this has something to do with the fact that we're using strings in our <code>switch</code> statement but the variable we're checking is an integer. Does anyone know why PHP behaves this way? It's nothing too major, but it did give me a bit of a headache today.</p> <p>Thanks folks!</p>
php
[2]
3,174,773
3,174,774
Output using innerHTML
<p>I need to output the contents of a Javascript variable which has html code in it:</p> <pre><code>var jsVar = '&lt;div&gt; &lt;p&gt; Sample text &lt;/p&gt; &lt;img src="some image.jpg" alt="" /&gt; &lt;div&gt;'; </code></pre> <p>I want to add it to an object on the page using innerHTML. How do I do it ?</p>
javascript
[3]
4,919,456
4,919,457
Control Caps-Lock of android softkeypad
<p>I have an <code>EditText</code>. The softkeypad should popup as "Caps on" state, when I want to edit the editText. Is there any way to do this ? </p>
android
[4]
1,286,153
1,286,154
javascript regular expressions for password
<p>i have to create a regular expression for password in java script with the following criteria 1. The password should contain atleast one alphabet either upper case or lower case 2. It should contain atleast one number 3. It should contain atlease one special character(`,~,!,@,#,$,%,^,&amp;,*,_,+,=)</p>
javascript
[3]
875,881
875,882
detect and suppress errors loading javascript file
<p>I want to source a javascript file from facebook <a href="http://connect.facebook.net/en_US/all.js" rel="nofollow">http://connect.facebook.net/en_US/all.js</a> </p> <p>The organization I work for has a firewall that blocks access to Facebook, it just goes to an html page that says "Access Denied blah blah blah" </p> <p>I want to be able to put a javascript src tag <code>&lt;script src="http://... "&gt; &lt;/script&gt;</code> and detect and suppress the warnings when the browser tries to evaluate the html as javascript.</p> <p>Anyone know how?</p>
javascript
[3]
5,890,789
5,890,790
Activity.onDestroy does not destroy my view
<p>In part of my Activity's code, I am calling Activity.finish() to close my activity, and the application returns to the main OS "desktop" window.</p> <p>However, if I click on my application icon again, onCreate does not seem to be called and my view remains the same as when finish was called.</p> <p>Perhaps, I'm not understanding the lifecycle correctly, but I thought that destroy completely destroyed the activity, and the next time it was invoked it would call onCreate.</p> <p>Where am I misunderstanding this?</p> <p>Thanks</p>
android
[4]
17,621
17,622
how to get file from SWFObject?
<p>How can I download a file from flash SWF:</p> <pre><code>var s1 = new SWFObject("http://www.sitename.com/player.swf", "ply", "654", "475", "9", "#000000"); s1.addParam("allowfullscreen", "true"); s1.addParam("allowscriptaccess", "always"); s1.addParam("flashvars", "overlay=http://sitename.com/video/thumbs/5/0/5/e/8/505e7de2b63bdVideo%20Name/505e7de2b63bdVideo%20Name.flv-3b.jpg&amp;settings=http://www.sitename.com/playerConfig.php?505e802068f06.mp4|0"); s1.write("myAlternativeContent"); </code></pre>
javascript
[3]
3,646,979
3,646,980
iterating an object properties
<p>is there a way to iterate an object properties and methods. i need to write a utility function like so:</p> <pre><code>function iterate(obj) { //print all obj properties //print all obj methods } </code></pre> <p>so running this function:</p> <pre><code>iterate(String); </code></pre> <p>will print:</p> <pre><code>property: lenght function: charAt function: concat... </code></pre> <p>any ideas?</p>
javascript
[3]
853,810
853,811
How to set locale to TTS engine dynamically?
<p>I have one requirement in which User will have options to select languages for e.g English and French.</p> <p>App will have set of activities and one background service so when app starts,at that time service will start and TTS engine will get initialize with default language as English in service(onInit() method). I have to set the language which will be set by the user when that particular activity starts.</p> <p>So how to configure the selected language locale in TTS engine at runtime? </p> <p>My observation is when service starts at that time only TTS engine get intialize with the default language inside onInit() method and at instance activity is not available so we will not have any configured language details so we can't do that but actual problem what I am facing is second time onwards how to change the locale of TTS engine(When user selects language from the activity) because we can't use mTts.setLanguage(Locale.FRENCH) outside of onInit() method as if you call this also it will not reflect changes in TTS.</p> <p>So please help me out to resolve this issue.</p>
android
[4]
3,824,126
3,824,127
Adding values to a JList
<p>I have 2 classes, a view where all my controls are placed for my gui and another one for my code.</p> <p>But how do I add values to the <code>JList</code>? I can only do it from the GUI class (first class mentioned below) itself, but that's not a suitable spot.</p> <h3>First class</h3> <pre><code>private JList userList; userList = new JList(ce.data); // where data is the datalist model in my 2nd class </code></pre> <h3>Second class (holds all the future calculations, arrays, etc.)</h3> <pre><code>private String[] testList; DefaultListModel data = new DefaultListModel(); public void AddValuesList() { testList = new String[] {"user1", "user2"}; for (int i=0; i &lt; testList.length; i++) { this.data.add(i, testLijst[i]); } } </code></pre>
java
[1]
1,466,065
1,466,066
ASP:Login <LayoutTemplate> always generates a <table>, how can I make it stop?
<p>I've just started tinkering with the ASP:Login control, and want to edit its appearance. So I did the following:</p> <pre><code>&lt;asp:login ID="login" runat="server" onauthenticate="Authenticate"&gt; &lt;LayoutTemplate&gt; &lt;asp:TextBox ID="UserName" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:TextBox ID="Password" runat="server" TextMode="Password"&gt;&lt;/asp:TextBox&gt; &lt;/LayoutTemplate&gt; &lt;/asp:login&gt; </code></pre> <p>Despite the fact that I have no <code>&lt;table&gt;</code> tag anywhere in the document, once I preview the page and view the source, it very clearly shows a <code>&lt;table&gt;</code> there. Ah! How in the world do I prevent this crazy behavior, or am I forced to use tables for layout instead of CSS?</p>
asp.net
[9]
478,724
478,725
Read/Write at the same time
<p>What I am doing is opening my file using fstream at the start of the main and closing it at the end. In between I am writing "Hello World" and after that reading what I wrote but the result is always weired charecters and not the "Hello World". I did do a cast to char but that didnt help. Any way I can do this?</p>
c++
[6]
3,111,738
3,111,739
better ways or editors to handle python indention
<p>so python is fun. I'm on day 2.I love how clean it is, and the libraries, etc. I'm not a big fan of the indention yet, but wanted to get some feedback on ways people deal with this. A big issue for me right now is refactoring and then the consequent re-idention that needs to happen for nested calls. This seems like a real pain. What are the ways people suggest to get around this? Any good ideas, or editors that would make this easier? I'm using ultrastudio and it doesn't seem to handle this very well.</p> <p>example</p> <pre><code>if os.stat(filepath)[0]: do something special </code></pre> <p>now if I want to put another loop around this, I have to break out the space key and pound it again to line everything up</p> <pre><code>if root in thingsIwant: if os.stat(filepath)[0]: do something special </code></pre> <p>Is there a better way? It seems that if you need to add a control statement at the top of a nested block this could be a major pain.</p>
python
[7]
2,926,960
2,926,961
What's the most efficient way to change the last element in a '/' delimited string
<p>I have a string object in c# with a bunch of elements delimited by '/' characters. The string will look something like this:</p> <p>"element1/element2/element3/element4"</p> <p>What's the most efficient way to change the last element in the '/' delimited string?</p> <p>Thanks,</p> <p>helixed</p>
c#
[0]
2,409,020
2,409,021
How to add radio buttons and checkBox in the same ListPreference in android?
<p>HI,</p> <p>How can i add, 4-radiobuttons and 2-checkBoxes in the same ListPreference in Android PreferenceScreen in android ? Need Help. Thanks in adv.</p> <p>rgds, Praween</p>
android
[4]
370,557
370,558
Overllaping view elements
<p>Here's the problem I'm facing : I've got a custom slider that controlls the volume and a label "volume" that I combine together in a liniar Layout to obtain a volume control setting. In the emulator and on a G1 phone these look pretty ok , however , when put on a Xperia mini the label and the slider overlap . What should I do obtain a decent view independent of the device the application runs ?</p>
android
[4]
1,385,424
1,385,425
Populate 2 fields with same data, using Javascript
<p>I have a form field, x_amount, being populated with a static number, based on a selection from a drop down, which for some reason came to me as x_ship_to_address. If 1 or 2 are selected, x_amount is poulated with 25 or 45. If 3 or 4 are selected, the user enters a value into payment_mount and then x_amount becomes payment_amount x 1.03. I want, if a user selects 1 or 2, then both payment_amount and x_amount are populated with 25 or 45. Here is the JS that is working to populate x_amount with a static number:</p> <pre><code>function SI_money(amount) { // makes sure that there is a 0 in the ones column when appropriate // and rounds for to account for poor Netscape behaviors amount=(Math.round(amount*100))/100; return (amount==Math.floor(amount))?amount+'.00':((amount*10==Math.floor(amount*10))?amount+'0':amount); } function calcTotal(){ var total = document.getElementById('x_amount'); var amount = document.getElementById('payment_amount'); var payment = document.getElementById('x_ship_to_address'); if( payment.selectedIndex == 0) total.value = 'select Type of Payment from dropdown'; else if( payment.selectedIndex == 3 || payment.selectedIndex == 4 ) total.value = SI_money(parseFloat(amount.value * 1.03)); else if( payment.selectedIndex == 1 ) total.value &amp;&amp; amount.value = SI_money(25.00); else if( payment.selectedIndex == 2 ) total.value = SI_money(45.00); } </code></pre> <p>I think I want the last two ifs of calcTotal to be something like:</p> <pre><code>else if( payment.selectedIndex == 1 ) total.value &amp;&amp; amount.value = SI_money(25.00); else if( payment.selectedIndex == 2 ) total.value &amp;&amp; amount.value = SI_money(45.00); </code></pre> <p>But adding the &amp;&amp; throw the errors. I think I'm just missing something about the syntax - how do I say both fields get populated with the correct static number?</p>
javascript
[3]
3,602,190
3,602,191
How to build a Json tree
<p>Here's the json I want to build:</p> <pre><code>{ id: 0, item: [{ id: 1, text: "1111" }, { id: 2, text: "222222", item: [{ id: "21", text: "child" }] }, { id: 3, text: "3333" }] } </code></pre> <p>For now I can not build a tree, I can only build something like this:</p> <pre><code>[{"id":1,"text":"1111"},{"id":21,"text":"child"] </code></pre> <p>I'm building it with this code:</p> <pre><code>var serializer = new JavaScriptSerializer(); var jsonString = serializer.Serialize(listOfPairsOfTextAndId); </code></pre> <p>But how can I build the given tree in c#?</p>
c#
[0]
5,953,203
5,953,204
Why do the values of my hashes never match in Java?
<p>I have a <code>.jsp</code> which accepts password input. It will not match the hash of a password inside the application, even though a test using <code>attempt.equals(password)</code> works prior to the hashing.</p> <p>I am passing the string thus:</p> <pre><code>PasswordManager.checkPassword(request.getParameter("password")) </code></pre> <p>This is my hashing code:</p> <pre><code>byte[] password = p.getBytes("UTF-8"); byte[] attempt = a.getBytes("UTF-8"); passwordHash = DigestUtils.md5(password); attemptHash = DigestUtils.md5(attempt); </code></pre> <p>In addition, I have set the encoding in the <code>.jsp</code>:</p> <pre><code>&lt;fmt:requestEncoding value="UTF-8" /&gt; </code></pre> <p>However, the hashes remain stubbornly different. Any ideas?</p>
java
[1]
410,190
410,191
Hiding Important Data
<p>just want to ask what would be the best way to hide sensitive data (ftp accounts, database connectionstring, etc) in .Net desktop applications.. any suggestions please.. :)</p> <p>i was aware of putting data in the application and got in mind that what if the application will be deobfuscated or decompiled the hidden data will be expose.</p> <p>i tried using Application Settings</p> <pre><code>Properties.Settings.Default.MyConnectionString = theConString; </code></pre> <p>but still the data can be seend when decompiled.</p> <p>any suggestions please.</p>
c#
[0]
5,452,231
5,452,232
Dragging and dropping a card
<p>I am developing a card game which includes moving one card from one place to another.The cards are dealt/stored in picture boxes.Once the user clicks a card, I want him to be able to drag and drop the card to another picture box(this is where he wil be playing the card). I also want that when user is dragging the item that item should be stuck into the cursor. I mean mouse cursor should have that specific card stuck to it until it's dropped. Can any body plz help me in getting this done. Thanks in advance.</p>
c#
[0]
1,735,210
1,735,211
Whats the main difference between int.Parse() and Convert.ToInt32
<p>I am using C#,and wanted to know the main difference between the two and which one is preferred to use while coding. </p>
c#
[0]