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
2,414,471
2,414,472
PHP select closest to variable
<p>Just wondering how I would select the closest variable. I have a set list of military times, i.e: 0030 0100 0130 0200 etc...</p> <p>All in half hour increments. How would I select the closest time to now. For example. User clicks on the button, php gets the time it is now, and selects the closest time variable. So if it's 0144, it would pick 0130. and if it's 0146, it would pick 0200.</p>
php
[2]
4,059,949
4,059,950
Confused about activity lifecycle usage in the notepad example
<p>I am confused about activity lifecycle usage in the notepad example,notepad example use "edit in place" user model,inserting new record in onCreate method, saving persistent state in onPause method,and save away the original text in onSaveInstanceState method. I am a J2EE programer,I can not understand the logic described above. why not make things simple as following:</p> <p>1.Not inserting new record in onCreate method. 2.When user pressing BACK,it is equal as pressing save button in the editorform,so execute inserting or updating in onPause method if activity.isFinishing() is true. don't persiste use data if activity.isFinishing() is not true. 3.Not save the original text in onSaveInstanceState method,It is no necessary.If the activity is killed and back,restore user inputing data in the editorForm is adequately.</p> <p>I think this logic is more traditional and natural. Maybe I not understand the essence of the activity lifecycle.Please air your's opinion.</p> <p>Thanks</p> <p>L.J.W</p>
android
[4]
5,506,655
5,506,656
onKeyDown() or onBackPressed()
<p>Hello every one i am new in android and i want to implement the back button functionality in my application because in application whenever i am clicking on back button in middle my control is going to login page directly ,so can any body tell me where to override <code>onKeyDown()</code> or <code>onBackPressed()</code> methods?</p> <pre><code> public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { Log.e("back key pressed","Back key pressed"); return true; } return super.onKeyDown(keyCode, event); } </code></pre> <p>because i am writing this inside oncreate and out side oncreate also but its not working ......</p>
android
[4]
4,695,523
4,695,524
Filter elements that has ul not only with specific children
<p>How do I write jQuery selector to test if li has ul that has at least one li that is not .disabled (may be other classes or without class at all).</p> <p>Yes sounds complex but it's simple - I need to know if there're uls that do not have "disabled" class on inner lis.</p> <p>Something like </p> <pre><code>$("li").filter("*:has(ul:has(li:not(.disabled)))") </code></pre>
jquery
[5]
2,688,705
2,688,706
Back button works like home
<p>This is possible to do in this code:</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { } return super.onKeyDown(keyCode, event); } </code></pre> <p>to when I click on back button he work like home button?</p>
android
[4]
4,174,226
4,174,227
ServletContext and Session object
<p>Is the ServletContext and Session object which we get from request object (HttpServletRequest) behave the same ?</p>
java
[1]
6,011,684
6,011,685
Display Image in Visual c++ windows application
<p>I am a beginner to visual c++ Windows application programming and I want to display an image on the screen but I don't know how. Can anyone help me? </p> <p>Most of the stuff I found on the net was about MFC application which I'm not interested in. I want this application to be as simple as possible so it's not surprise that I'm not interested in using any additional library like OpenCV or use of Direct2D, OpenGl.</p>
c++
[6]
2,745,933
2,745,934
How to use the toString method in Java?
<p>Can anybody explain to me the concept of the <code>toString()</code> method? How is it used, and what is its purpose? <code>toString()</code> method define in the Object class this method is in java when get data and print data. this methodcall by default. the purpose of this method convert primitive data into object data or String data.</p>
java
[1]
5,073,988
5,073,989
Accessing a service/thread from different activities
<p>I'm writing a Bluetooth remote control application to control my Bluetooth enabled robot, but I have a hard time understanding the workflow of an Android application. I know what I want, but it's not very easy to do. Other responses haven't been satisfactory.</p> <p>Here's a rough application layout I want:</p> <p><img src="http://i.stack.imgur.com/uqVDK.png" alt="enter image description here"></p> <p>If you have a better idea of how to do this thing I'd be happy to consider.</p> <p>Mainly my problem is accessing the connection thread/service (whatever the name is) from the connect method of the main activity and from the control activity, how do I pass the reference? I know that the main activity can disappear when in a sub-activity of the application, so I'd have to pass the reference by <code>getExtra()</code> probably, but it only takes a <code>String</code> variable...</p>
android
[4]
4,764,865
4,764,866
Resetting animation in Android without starting it
<p>I have an <code>AnimationDrawable</code> that is running. How to stop &amp; reset it so that it does not start again until <code>start()</code> is called? Calling <code>setVisible(true, true)</code> resets it, but also immediately starts animation, and I'd like to avoid it.</p>
android
[4]
2,924,616
2,924,617
How to find the object a function belongs to?
<p>Given a function, is there a way to find out the object that holds it?</p> <pre><code>var dog = { bark: function() { alert('dfd') }, name: 'Bill' } function getNameFromBark(barkFunc){ //How to implement this method? } getNameFromBack(dog.bark); //I would like this to return Bill. </code></pre>
javascript
[3]
2,183,494
2,183,495
How to add DataRow in string of arrray
<p>In the DataTable i have n number rows want add those rows in array?</p>
c#
[0]
4,187,101
4,187,102
Php Magic Methods and Empty
<p>Having the following code</p> <pre><code>class test { private $name; public function __get($name){ return $name; } public function __set($name,$value){ $this-&gt;name = $value; } } $obj = new test(); $obj-&gt;a = 2; if (!empty($obj-&gt;a)) { echo 'not empty'; } </code></pre> <p>This is calling __isset. But this is not being defined so it always return empty. What is the best way to check for a non empty property?</p> <p>Update :changing the class is not a solution because it's a 3th party component and it has to remain intact.</p>
php
[2]
5,576,366
5,576,367
how would you implement an interface in java example calculator
<p>I've got a Calculator interface that contains</p> <pre><code>public interface Calculator { public void setOperator(char operator); public void setOperand (double operand); public double getResult(); } </code></pre> <p>How would i implement this in another class, for a basic calculator???</p>
java
[1]
4,057,648
4,057,649
javascript - set speed / pace
<p>I have a script which loops through an array of words, but how do I add a speed element to this?</p> <pre><code>words = ["Doe", "Ray", "Mee"]; count = words.length; currentWord = random(0, parseInt(count)); words[parseInt(currentWord)]; </code></pre>
javascript
[3]
690,885
690,886
Need help display indian city's current time using android
<p>Dear Friends,</p> <p>I am developing on android application for one Indian city,In my application contain information about some Indian city like weather,some place and current time. I need solution for wherever user launch my application ,my application will display Indian city's current time.How is possible to applicable this logic,Basically i display time for device's current time in my app.so i am struggle with this part.please give solution for that.</p> <p>Thanks Friends</p>
android
[4]
2,247,145
2,247,146
Update WallPaper with text using c#
<p>I am doing an application that runs in background. Since there are no forms, I need to show some info on the desktop wallpaper. how can i achieve this ? The application need to update the info on wallpaper.</p>
c#
[0]
1,420,624
1,420,625
How to make recursive call (getTotalFiles) thread-safe?
<p>Im making a recursive file checking, the problem is i cant have counter inside the method itself, so that i declared it outside. But the problem is, this isnt thread safe.</p> <pre><code>private int countFiles = 0; private int getTotalFiles(String path) { File file = new File(path); File listFile[] = file.listFiles(); for (File f : listFile) { if (f.isFile()) { countFiles++; } if (f.isDirectory()) { getTotalFiles(f.getAbsolutePath()); } } return countFiles; } </code></pre> <p>Class variable countFiles is not thread safe. How to make this thread safe ?</p>
java
[1]
5,306,065
5,306,066
how do you remove the navigation bar on Android?
<p>When I listen to a YouTube video fullscreen in landscape on my Galaxy Nexus, the navigation bar on the right disapear after a few seconds (the bar which contains the "back", "home" and "recent apps" buttons ). </p> <p>I want to do the same thing when a user watch a video in my app. What is the code to hide the navigation bar?</p> <hr> <p>[UPDATE] Here is the bar I want to hide. Not the title bar, nor the action bar. The navigation bar. (the bar which contains the "back", "home" and "recent apps" buttons ). I also don't want to "dim" the buttons. I'm looking into removing the bar entirely (like the YouTube app does when you plan a video fullscreen in landscape mode)</p> <p><img src="http://i.stack.imgur.com/uv34G.png" alt="enter image description here"></p>
android
[4]
4,349,465
4,349,466
Is it possible to upload Image to a website from Safari on iPhone?
<p>I'm trying to upload a photo from my iPhone to a website. However, the browse button to display the select file dialog is disabled. Normally this works fine on my HTC Mobile and all Android Mobiles. Should I be able to select image files to upload from Safari on iPhone?</p>
iphone
[8]
4,005,062
4,005,063
Alternative to Html.EditorFor in MVC 1
<p>I am following the mvcMusicStore tutorial and it is very good but the problem is that it asks me to include a html helper known as "<code>Html.EditorFor</code>". This html helper is not in MVC 1 which is what I am using. What else can I use to go around this? This helper is suppose to allow me to link the Edit View to an edit template know as Album which I have created. This is the coding which is included in the tutorial: </p> <pre><code>&lt;%: Html.EditorFor(model =&gt; model.Album, new { Artists = Model.Artists, Genres = Model.Genres}) %&gt; </code></pre> <p>Please look at the MvcMusicStore Tutorial from page 40 onwards to help you understand the situation. This can be download from Microsoft's MVC website.</p>
c#
[0]
2,097,103
2,097,104
Why my .NET error log file is showing lots of NUL characters in it
<p>I am using c#, and I have got Logging in my project.</p> <p>When I see my log file, it is showing lots of <strong>'NUL'</strong> characters, just to correct you <strong>it is not 'NULL'</strong>.</p> <p>Please suggest what could be the reason of showing 'NUL' characters.</p> <p>Thanks.</p>
c#
[0]
2,122,681
2,122,682
Problem with my Javascript Code
<p>Could anyone tell me why this code doesn't work? I can't even get the alert(); in init() to work right...</p> <pre><code>window.onload = init; var downloadedstuff; function init() { alert(); $.get('example.php' + '?v=' + Math.random(), success: function (data) { downloadedstuff = data; }); doTimer(); } var t; var timer_is_on=0; function timedCount() { $.get('example.php' + '?v=' + Math.random(), success: function (data) { if(data != downloadedstuff) { alert('SOMETHING HAPPENED!!!!'); location.reload(true); } else { alert(data); } }); t=setTimeout("timedCount()",5000); } function doTimer() { if (!timer_is_on) { timer_is_on=1; timedCount(); } } </code></pre> <p>once again, really sorry for all the questions, i just don't know what's wrong.</p>
javascript
[3]
313,824
313,825
Pass variables with PHP that have '&' on them
<p>I'm passing this URL with Ajax to a PHP file: <code>amazon.com/?ie=UTF8&amp;showViewpo</code></p> <p>My problem is with the '&amp;' on the URL.</p> <p><code>$_POST['site']</code> will echo <code>amazon.com/</code></p> <p>How can I pass the variable so as to be able to get it whole on my PHP file?</p>
php
[2]
4,365,069
4,365,070
Using jQuery, how do I create a clone of a record sent to a database and apend it to a dom object?
<p>So, I have an "add item" script that creates an object in a database. Works great.</p> <p>I'd like to, once the object is successfully saved to the database, create a clone of that object in the view that will append to the list view. It will receive the id form the DB so it can be edited, but the rest can just be cloned from the input fields.</p> <p>Any examples of how to do this? Specifically, I need help thinking about what to trigger in success.</p> <p>Thanks!</p>
jquery
[5]
1,712,409
1,712,410
PHP teaching supplements?
<p>I have a friend who has wanted to learn PHP for a while. She is very bright and picks things up quickly, so what I have been able to show her has helped quite a bit.</p> <p>I have been coding in PHP for ten years or so. The problem is that I can answer most any questions she has, but I do not have time to sit down and put together a line of projects increasing in complexity for her to build and learn from.</p> <p>What I am looking for is a site/blog/etc which has an open/free base curriculum of sorts, that has projects going from simple to difficult, that teach coding concepts and introduce sections of the language in an easy to consume manner.</p> <p>It doesn't need to have a lot of explanation, or hand holding. I can do that. Just projects with goals, requirements, etc.</p> <p>Anyone aware of something like this?</p> <p>Thanks in advance!</p>
php
[2]
1,751,166
1,751,167
Android TabActivity and setContent(int idView) ---> RuntimeException
<p>I have created this little testcase:</p> <pre><code>public class MainActivity extends TabActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost tabHost = getTabHost(); TabSpec spec; spec = tabHost.newTabSpec(getString(R.string.service)); spec.setIndicator(getString(R.string.service)); spec.setContent(R.id.first_tab); tabHost.addTab(spec); } } </code></pre> <p>and this is the relative layout document:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/first_tab"&gt; &lt;ToggleButton android:id="@+id/serviceButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textOn="@string/service_on" android:textOff="@string/service_off"&gt; &lt;/ToggleButton&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Anyone know why i get this exception at runtime: java.lang.RuntimeException: Could not create tab content because could not find view with id 2131034112 ?</p> <p>The code seems to be right!</p> <p>Thanks you for any reply.</p>
android
[4]
295,411
295,412
How to store an array in a javascript cookie?
<p>Does anyone have a piece of javascript code that creates a cookie and stores an array in it? If you also have the code to read through through cookie and delete it, that would be great as well. Thanks!</p>
javascript
[3]
2,489,350
2,489,351
Select Different Div on JFlow Load
<p>I am using JFlow for my content slider and would like to select one particular slide on page load. It can be the 5th slide or the second one but I don't want to re-order the slides.</p> <p>Any ideas? <a href="http://www.webdesignbooth.com/step-by-step-to-create-content-slider-using-jflow-a-minimalist-jquery-plugin/" rel="nofollow">link text</a></p>
javascript
[3]
918,272
918,273
meaning of error message
<p>what does this error message mean? destination of memory copy is too small</p>
c++
[6]
3,730,746
3,730,747
Inject New Methods and Properties into Classes During Runtime
<p>Is there any way we can inject new methods and properties into classes during run-time.</p> <p><a href="http://nurkiewicz.blogspot.com/2009/09/injecting-methods-at-runtime-to-java.html" rel="nofollow">http://nurkiewicz.blogspot.com/2009/09/injecting-methods-at-runtime-to-java.html</a> states we may do that by using Groovy. </p> <p>Is it possible by just doing using Java?</p>
java
[1]
3,718,499
3,718,500
Android 2.1GuessContentTypeFromName not working
<pre><code>String filename = Environment.getExternalStorageDirectory()+"/word.docx"; try{ File file = new File(filename); Uri path = Uri.fromFile(file); Intent viewDoc = new Intent(Intent.ACTION_VIEW); Log.i(TAG, "mime type "+URLConnection.guessContentTypeFromName(filename).toString()); viewDoc.setDataAndType(path, URLConnection.guessContentTypeFromName(filename)); PackageManager pm = getPackageManager(); List&lt;ResolveInfo&gt; apps = pm.queryIntentActivities(viewDoc, PackageManager.MATCH_DEFAULT_ONLY); if (apps.size() &gt; 0){ startActivity(viewDoc); } }catch(Exception e){ Log.i(TAG, "oh exception "+e.getMessage()); } </code></pre> <p>That is my code and I'm not getting the mime type in Android 2.1, I get null in that Log.</p> <p>Though, I'll able to get it in the Android 2.3.3 with the same code same app.</p>
android
[4]
2,865,817
2,865,818
restaring slide show
<p>can anyone know stop and restating slideshow created using jquery. the following code makes problem while random selection. </p> <p>$('#left_actual').cycle('stop'); //slide show 1</p> <p>$('#right_col').cycle('stop'); //slide show 2</p> <p>$('#left_actual').cycle({ fx: 'all',</p> <pre><code> timeout: 6010, startingSlide:slide_no // changing slide no }); </code></pre> <p>$('#right_col').cycle({ fx:'scrollRight',</p> <pre><code> timeout: 6000, startingSlide:slide_no, // changing slide no before:button_chg }); </code></pre> <p>find the code <a href="http://122.165.56.88/jquery192.html" rel="nofollow">here</a></p>
jquery
[5]
2,124,450
2,124,451
How to get the value from a form in php
<pre><code>&lt;? if('POST' == $_SERVER['REQUEST_METHOD'] { $_SESSION['update'] = trim($_POST("wasUpdateClicked")_; } $wasUpdatedClicked = $_SESSION['wasUpdatedClicked']; if(isset($wasUpdateClicked)) { ..do something here like an update method } ?&gt; &lt;form name="x" method="post" action="samePage.php"&gt; ...do some stuff here that isnt important &lt;input type="submit" value="update" onclick="$wasUpdateClicked = 2" /&gt; &lt;/form&gt; </code></pre> <p>My beef is that I cant get the right value for the wasUpdateClicked variable. Is there any way to do this???? It seems that when my action is to the same page I can't get my variables. Please help me!!!</p>
php
[2]
4,832,682
4,832,683
Google.visualization.DataTable filtering not working
<p>I have a <a href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable" rel="nofollow">DataTable</a> with 3 columns.<br> The method <a href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable_getFilteredRows" rel="nofollow"><code>getFilteredRows</code></a> is working on two columns one of string type and other of number.<br> But it isn't working on third column that is also of string type.<br> It shows empty table. Can you help to know the reason?</p>
javascript
[3]
5,804,657
5,804,658
Code Vs. Interface Builder Iphone
<p>I'm going through the Beginning Iphone Development Apress book and I'm constantly getting problems when building my NIB files. My practice apps crash because of the NIBS. I now this because I'll just trade out mine for the sample ones and the app will work. I'll look at the sample nib and all of my connections will be the same. I'm having problems debugging my NIBS and figuring out exactly what's wrong. So...</p> <p>1) Can you just design your interface in IB and do all the wiring in Code? </p> <p>2) What's the best way to figure out what's wrong with your NIB's?</p> <p>3) Anybody else have the same problems with doing the examples in the Apress book?</p>
iphone
[8]
1,636,033
1,636,034
String difference with new additions and deletions
<p>I want to find the difference between two strings in java. The difference should be close to any file comparison tools. I have used longest common subsequence algorithm but still it is not pointing the exact expected difference. Any help with this regard will be much appreciated.</p>
java
[1]
3,644,891
3,644,892
Mapkit Array of Pins with Custom images and Details?
<p>Hello i have been trying to find a tutorial that show how to setup an array of locations with details and images and drop the array of pins on the map. </p> <p>would someone have a simple way of doing this this? links would be helpful.</p>
iphone
[8]
3,071,536
3,071,537
How to get position of a certain element in strings vector, to use it as an index in ints vector?
<p>I am trying to get the index of an element in a vector of strings, to use it as an index in another vector of int type, is this possible ?</p> <p>example: </p> <pre><code>vector &lt;string&gt; Names; vector &lt;int&gt; Numbers; .. if(( find(Names.begin(), Names.end(), old_name_)) != Names.end()) // condition to check whether the name exists or no { // if yes cout &lt;&lt; "Enter the new name."&lt;&lt;endl; cin &gt;&gt; name; replace(Names.begin(), Names.end(), old_name_, name ); } </code></pre> <p>now I want to get the position of old_name in the Names vector, to use it in accessing certain element in Numbers vector. so that I can say :</p> <pre><code>Numbers[position] = 3 ; // or whatever value assigned here. </code></pre> <p>I tried using :</p> <pre><code>vector &lt;string&gt; :: const_iterator pos; pos = ( find(Names.begin(), Names.end(), old_name_)) Numbers[pos] = 3; </code></pre> <p>but obviously this doesn't work since pos is of type string !</p>
c++
[6]
717,473
717,474
Can one autoscroll NiceScroll JQuery Plugin?
<p>I have the <a href="http://areaaperta.com/nicescroll/" rel="nofollow">nicescroll</a> plugin working perfect, but what I need it to do is scroll to the BOTTOM of the latest update automatically. I don't need a <code>resize()</code> lesson, that works fine. It appears the plugin has no methods. </p> <p>Is there is a like plugin that does??</p>
jquery
[5]
4,100,932
4,100,933
Android Assetmanager string parsing
<p>I am attempting to parse an xml file referenced by a string using assetmanager, I have had a lot of help thanks to SO and this is what I have so far. </p> <pre><code>Document doc = db.parse(assetManager.open(Resources.getSystem().getString(R.string.FileName))); </code></pre> <p>String filename is my questions.xml file, I'm doing this so ultimately I can enforce localization on my app for multiple xml files. However my app is not able to read R.string.FileName, and errors out the application. Can anyone help me out here? </p>
android
[4]
3,275,801
3,275,802
Adding a color filter to a Drawable changes all Buttons using the same Drawable
<p>I have a screen where multiple Buttons use the same background Drawable. I have reusable code I use in various projects to add an OnTouch listener that adds a gray color filter while a button is being touched. That usually works fine, but in this case ALL the buttons are tinted when any of them is pressed.</p> <p>I see an explanation in <a href="http://developer.android.com/guide/topics/graphics/2d-graphics.html" rel="nofollow">http://developer.android.com/guide/topics/graphics/2d-graphics.html</a>:</p> <pre><code>Note: Each unique resource in your project can maintain only one state, no matter how many different objects you may instantiate for it. For example, if you instantiate two Drawable objects from the same image resource, then change a property (such as the alpha) for one of the Drawables, then it will also affect the other. </code></pre> <p>The suggested solution is to use a TweenAnimation, which does not seem to work with color filters.</p> <p>I also saw <a href="http://stackoverflow.com/questions/7979440/android-cloning-a-drawable-in-order-to-make-a-statelistdrawable-with-filters">Android: Cloning a drawable in order to make a StateListDrawable with filters</a> which suggests using drawable.getConstantState().newDrawable(). This does not seem to make a difference. I'm guessing that as long as the same physical image file is used, all Drawables will be affected by a change to any other Drawable using the same resource.</p> <p>What solution is there, other than creating a second background image to show the pressed state? It would be nice to have a simple programmatic solution I can add to my code and use in every project.</p>
android
[4]
5,418,148
5,418,149
Can someone give me an overview of ASP.net and how it's different from technologies such as php?
<p>I've been doing the html and css for a site, sending it off to a guy to implement in a web server. I get a call from the designer freaking out about the progress, saying the clients aren't happy. He wants me to personally integrate my css with what's on the site. The site is done in ASP.net, time is short, and I'm a little in over my head. I have an understanding of how php works, but have never worked extensively with it.<br> Looking at the stuff on the ftp, I can't even find equivalent of the index.html file (I know that when I go to the site itself, there is nothing after the base url, i.e., www.site.com/ brings me to the homepage.)</p> <p>Can anyone give me a few tips or links as to what I am to do with this, or where to even being navigating this site? </p> <p>EDIT: It's -not- a .Net Web Application, from the looks of it. </p>
asp.net
[9]
5,023,132
5,023,133
Can I add parameters to a python property to reduce code duplication?
<p>I have a the following class:</p> <pre><code> class Vector(object): def __init__(self, x=0, y=0, z=0): self.x = x self.y = y self.z = z def _getx(self): return self._x def _setx(self, value): self._x = float(value) x = property(_getx, _setx) def _gety(self): return self._y def _sety(self, value): self._y = float(value) y = property(_gety, _sety) def _getz(self): return self._z def _setz(self, value): self._z = float(value) z = property(_getz, _setz) </code></pre> <p>The three getters and setters are all identical except for the object property they are modifying (x, y, z). Is there a way that I can write one get and one set and then pass the variable to modify so that I don't repeat myself?</p>
python
[7]
1,644,564
1,644,565
Android:How to move Ball on maze using accelerometer?
<p>Am developing game in android i did maze and ball is moving on maze using keyboard but am tryng to move ball by using Accelerometer please help me.........</p> <p>Thank You</p>
android
[4]
4,891,144
4,891,145
URL as a Variable in PHP
<p>I have a cool project where I need to upload an image via php/my_sql. That I can handle, but the images need to be linking to a certain url out of 100. In php can I save a url as a variable, then allow a drop-down menu of the 100 choices which point to a variable with a url?</p>
php
[2]
4,890,088
4,890,089
cannot define constructor as protected or private! why?
<pre><code>--- A.php ---- require_once 'B.php'; class A { public function __constructor($x){...} public function foo() { $b = B::getInstance(); ... } } --- B.php ---- require_once 'A.php'; class B extends A { protected static $_instance = null; protected function __construct(){} public static function getInstance() {....} } </code></pre> <p>PHP just stops interpreting the code as soon as it reaches line</p> <pre><code>protected function __construct(){} </code></pre> <p>and outputs everything before and nothing that would have been sent to the browser afterwards.</p> <p>And as soon as I just take that line out, by changing it to</p> <pre><code>// protected function __construct(){} </code></pre> <p>everything works fine!?</p> <p>I don't get that.</p> <p>Any ideas?</p>
php
[2]
1,628,108
1,628,109
Need Help Parsing Text Between HTML Tags
<p>Ok, the problem it's that i have string with HTML. I need to find an specific format like this: </p> <p><code>&lt;span class="fieldText"&gt;some text&lt;/span&gt;</code></p> <p>of that HTML, I need to extract <code>some text</code> and save it into a list. How can accomplish my goal.</p> <p>note that the text can appear like this</p> <pre><code>&lt;p&gt; Central: &lt;span class="fieldText"&gt;Central_Local&lt;/span&gt;&lt;br&gt;Area Resolutoria: &lt;span class="fieldText"&gt;Area_Resolutoria&lt;/span&gt;&lt;br&gt;VPI: &lt;span class="fieldText"&gt;VIP&lt;/span&gt;&lt;br&gt;Ciudad: &lt;span class="fieldText"&gt;Ciudad&lt;/span&gt; &lt;br&gt;Estado: &lt;span class="fieldText"&gt;Estado&lt;/span&gt;&lt;br&gt;Region &lt;span class="fieldText"&gt;Region&lt;/span&gt; &lt;/p&gt; </code></pre>
c#
[0]
4,435,468
4,435,469
Determining the favicon file (.ico extension) on the client side?
<p>I know this is possible because this is how bookmarklets work for social bookmarking sites like delicious.</p> <p>1.) Google has an API that will pull it for you but it only works about 80% of the time.</p> <p>2.) Checking the default location host.com/favicon.ico does not work very often, maybe 50%.</p> <p>The links I'm looking for look like this:</p> <pre><code>&lt;link href="/static/27009/images/favicon.ico&gt; &lt;link rel="shortcut icon" href="/static/favicon.ico" /&gt; </code></pre> <p>One idea was to load the site into a <code>visibility:none</code> iframe and pull the info. out, by searching the text for xxxx.ico.</p> <p>Or if it is possible to access the iframe dom and just grab it that way.</p> <p>How do I pull the favicon location client side?</p>
javascript
[3]
5,191,873
5,191,874
jQuery alert/output out elements help
<p>I need some help understanding how jQuery stores elements. Please have a look at this link: <a href="http://jsfiddle.net/NubWC/" rel="nofollow">http://jsfiddle.net/NubWC/</a></p> <p>I am trying to get the element id from all the heading tags that have a specific class and put that into an array so I can do something with it. In the link you will see I tried to do that and alert out but it only alerts the first ID returned and not all of them. How do I go about something like this?</p> <p>Thanks in advance.</p>
jquery
[5]
2,263,275
2,263,276
JavaScript, getting value of a td with id name
<p>Originally I was using input with an id and grabbing it's value with getElementById. Currently, I'm playing with <code>&lt;td&gt;</code>s. How can I grab the values of the <code>&lt;td&gt;</code>?</p> <p>Originally I used:</p> <pre><code>&lt;input id="hello"&gt; document.getElementById("hello").value; </code></pre> <p>Now I want to get value of <code>&lt;td&gt;</code>, but I don't know how;</p> <pre><code>&lt;td id="test"&gt;Chicken&lt;/td&gt; &lt;td&gt;Cow&lt;/td&gt; </code></pre> <p><strong>Edit:</strong> What's the difference between <code>textContent</code>, <code>innerHTML</code>, and <code>innerText</code>?</p>
javascript
[3]
3,893,306
3,893,307
Creating a javascript object with initial values, how?
<pre><code> objCar = function(values){ this = values; race = function(){ alert('car model:'+this.model+' car brand: '+this.brand+' was joined the race'); }; }; car = new objCar({'brand':'ford','model':'fiesta'}); car.race; </code></pre> <p>I want to objCar be started with a json values for example and that these values can be passed in constructor and after that i can call the race function that is created inside the constructor of objCar, is that possible? when i try to do this i receive it: </p> <blockquote> <p>invalid assignment left-hand side error source line: [Parar neste erro] this = values;</p> </blockquote> <p>tnx.</p>
javascript
[3]
4,314,738
4,314,739
Get a vaule by key from nested hashtable
<p>I have a nested Hashtable that looks like this.</p> <pre><code> Hashtable table = new Hashtable(); Hashtable subtable = new Hashtable(); Hashtable options = new Hashtable(); options.Add("file","foo"); subtable.Add("post_option",options); table.Add(0,subtable); //foreach here </code></pre> <p>This is what I have to work with, and I can't get any father up the chain to change what it is. So what I need to be able to do is get "foo" by calling for the key "file" starting from the "table" hashtable. I have tried every combo of foreach and .Keys and .Values. I just can't seem to get it lol. Thank you </p>
c#
[0]
1,411,445
1,411,446
Can an EditText be focused without having the cursor in it?
<p>When an EditText is focused, the cursor is visible in the text box. Can I make it disappear?</p>
android
[4]
5,188,136
5,188,137
What will this method return, true or false?
<pre><code>bool isValid = false; string username = "someadmin"; If( !String.IsNullOrEmpty(username) &amp;&amp; !( username.IndexOf("admin") != -1) isValid = true; </code></pre> <p>The second part with the double negatives is crossing me up!</p>
c#
[0]
5,372,233
5,372,234
run from a separate class
<p>So i need to run this class from a second class. How do I do that? Here's the code I want to run from a separate class: </p> <pre><code>import java.util.*; public class Numbers { int min(int a, int b, int c, int d, int e) { int min1 = Math.min(a, b); int min2 = Math.min(c, d); int min3 = Math.min(min1, min2); int min4 = Math.min(min3, e); return min4; } int max(int a, int b, int c, int d, int e) { int max1 = Math.max(a, b); int max2 = Math.max(c, d); int max3 = Math.max(max1, max2); int max4 = Math.max(max3, e); return max4; } double avg(int a, int b, int c, int d, int e) { double average = (a+b+c+d+e)/5; return average; } double stddev(int a, int b, int c, int d, int e) { double average = (a+b+c+d+e)/5; double a1 = Math.pow((a-average),2); double b1 = Math.pow((b-average),2); double c1 = Math.pow((c-average),2); double d1 = Math.pow((d-average),2); double e1 = Math.pow((e-average),2); double average2 = (a1+b1+c1+d1+e1)/5; double x; x = Math.sqrt(average2); return x; } } </code></pre>
java
[1]
4,517,264
4,517,265
Difference between the use of double quote and quotes in python
<p>Is there any difference between the use of double quotes to single quotes in Python? </p> <pre><code>"A string with double quotes" 'A string with single quotes' </code></pre> <p>Are they identical? Are there differences in how python interprets these strings?</p>
python
[7]
3,334,484
3,334,485
why it can add active to the a label?
<pre><code>&lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="/about/"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/contact/"&gt;Contact Us&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/archives/"&gt;Our Archives&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="/free/"&gt;Free Stuff&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>js code:</p> <pre><code>function setActive() { aObj = document.getElementById('nav').getElementsByTagName('a'); for(i=0;i&lt;aObj.length;i++) { if(document.location.href.indexOf(aObj[i].href)&gt;=0) { aObj[i].className='active'; } } } </code></pre> <p>i can't understand it well. 1, first <code>aObj</code> is get all the a label in nav</p> <p>2,<code>aObj.length</code> equals 4, </p> <p>3,<code>document.location.href.indexOf(aObj[i].href</code> what's this line meanig?</p> <p>4,why the loop can add <code>active</code> to the current a?</p>
javascript
[3]
5,033,363
5,033,364
jQuery - how to simplify the code
<pre><code>&lt;script&gt; $(document).ready(function () { var lnkAgreement = $('#lnk-agreement'); if ($('#IsConsultant').attr('checked')) { lnkAgreement.attr('href', '@Url.Action("ServiceProviderAgreement", "Home")'); lnkAgreement.text('service provider agreement'); } else { lnkAgreement.attr('href', '@Url.Action("UserAgreement","Home")'); lnkAgreement.text('user agreement'); } $('#IsConsultant').click(function () { if ($('#IsConsultant').attr('checked')) { lnkAgreement.attr('href', '@Url.Action("ServiceProviderAgreement", "Home")'); lnkAgreement.text('service provider agreement'); } else { lnkAgreement.attr('href', '@Url.Action("UserAgreement","Home")'); lnkAgreement.text('user agreement'); } }); }); &lt;/script&gt; &lt;a href="#" id="lnk-agreement"&gt;&lt;/a&gt; </code></pre> <p>How to avoid from iterative blocks of the code?</p>
jquery
[5]
2,313,888
2,313,889
const int = int const?
<p>For example, is</p> <pre><code>int const x = 3; </code></pre> <p>valid code?</p> <p>If so, does it mean the same as</p> <pre><code>const int x = 3; </code></pre> <p>?</p>
c++
[6]
5,360,883
5,360,884
C# Could not find file (any file) Windows 7 64bit
<pre><code>string[] targetFile = File.ReadAllLines(@"C:\d.txt"); </code></pre> <p>I get "Could not find file".</p> <p>I'm sure there is a d.txt at the root of C, any suggestions? i made a subdirectory called apples so c:\apples\d.txt i could still not read it.</p> <p>this guy had the same exact problem <a href="http://www.pcreview.co.uk/forums/system-io-file-exists-windows-7-a-t3915728p2.html" rel="nofollow">http://www.pcreview.co.uk/forums/system-io-file-exists-windows-7-a-t3915728p2.html</a></p> <p>I've tried running as administrator.</p>
c#
[0]
2,400,963
2,400,964
TextBox text, into html page using asp.net?
<p>In webapplication, I am trying to convert the text in textbox to html page and it save in my solution explore. can you help me. Thank you.</p>
asp.net
[9]
3,240,035
3,240,036
QList<double> in QT with Visual Studio add in
<p>I am working on creating a simple List Widget that displays "double" values when a "run" button is clicked. The widget contains 20 rows and 6 columns. Right now, I would just like for the values to all be the same number. I have the widget displaying how I want it, however, I am new to C++ and am not sure how to get the values to display in the widget when I click a pushbutton "run". Here is my code thus far:</p> <pre><code>qlistdouble.cpp #include "qlistdouble.h" #include &lt;QList&gt; #include &lt;QTableWidgetItem&gt; Qlistdouble::Qlistdouble(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); } Qlistdouble::GetNumbers() { } void Qlistdouble::MyClass(QList&lt;double*&gt; *slotString) { connect(ui.getNumber, SIGNAL(clicked()), this, SLOT(clear())); for( int row = 0; row &lt; 20; row++ ) { for( int column = 0; column &lt; 6; column++ ) { slotString = new QList&lt;double*&gt;; QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(5)); ui.tableWidget_values-&gt;setItem(row, column, newItem); } } } qlistdouble.h #ifndef QLISTDOUBLE_H #define QLISTDOUBLE_H #include &lt;QtGui/QMainWindow&gt; #include "ui_qlistdouble.h" class Qlistdouble : public QMainWindow { Q_OBJECT public: Qlistdouble(QWidget *parent = 0, Qt::WFlags flags = 0); ~Qlistdouble(); void MyClass(QList&lt;double*&gt; *slotString); private: Ui::QlistdoubleClass ui; }; #endif // QLISTDOUBLE_H </code></pre> <p>I know that this is a simple question, but if someone could give me some suggestions on how to go about this, I would really appreciate it. Thanks in advance.</p>
c++
[6]
121,051
121,052
Java Covariants
<pre><code>public class CovariantTest { public A getObj() { return new A(); } public static void main(String[] args) { CovariantTest c = new SubCovariantTest(); System.out.println(c.getObj().x); } } class SubCovariantTest extends CovariantTest { public B getObj() { return new B(); } } class A { int x = 5; } class B extends A { int x = 6; } </code></pre> <p>The above code prints 5 when compiled and run. It uses the covariant return for the over-ridden method. </p> <p>Why does it prints 5 instead of 6, as it executes the over ridden method getObj in class SubCovariantTest. </p> <p>Can some one throw some light on this. Thanks.</p>
java
[1]
1,304,675
1,304,676
How to execute the "if" and "else" at the same time?
<p>Interesting problem:</p> <p>Change if statement and print out "Hello World" </p> <pre><code> public static void main(String[] args) { if(){ System.out.println("Hello"); }else{ System.out.println("World"); } } </code></pre> <p>My solution is to add "!System.out.println("Hello")" in the if statement,But it doesn't work, any ideas?</p> <pre><code> public static void main(String[] args) { if(!System.out.println("Hello")){ System.out.println("Hello"); }else{ System.out.println("World"); } } </code></pre> <p>UPDATE: I think this works:</p> <pre><code> public static void main(String args[]) { if(System.out.append("Hello ")==null){ System.out.print("Hello "); }else{ System.out.println("World"); } } </code></pre> <p>In C:</p> <pre><code>main() { if(printf("Hello"),0) printf("Hello"); else printf(" world!\n"); getch(); } </code></pre>
java
[1]
4,496,974
4,496,975
Grab Text-Node after find()-usage
<p>I am using JQuery to show a tooltip-Box after clicking an image. So far, I can select the correct div(s) and then I can identify the correct sub-div which contains the text-node as well. Unfortunately I am not able to get the text node of the sub-div. What is wrong - I am getting 'null' after calling html() on currentDescriptionContainer? Thanks in advance!</p> <pre><code>var tooltipItems = jQuery('.tooltipContainer').length; var i=0; for (i=0; i&lt;tooltipItems; i++){ jQuery('.tooltipContainer').eq(i).bind('click', function(){ var currentContainer = jQuery('.tooltipContainer').eq(i); var currentDescriptionContainer = currentContainer.find('div'); var currentDescriptionText = currentDescriptionContainer.html(); console.log(currentDescriptionText); showRendererToolTipForIpad(this, currentDescriptionText); hideRenderedToolTipAfterTimeout(); }); } </code></pre>
jquery
[5]
5,962,143
5,962,144
Can I Use C++ vector insted of queue for FIFO order
<p>Hi all Can I use vector instead of queue ?. I just want to push and pop to and from memory using different thread . And also I need to delete data after pop. Is there any advantage using vector over queue ?</p> <p>Thanks in advance.... </p>
c++
[6]
4,475,714
4,475,715
JQuery clickin' buttons
<p>I'm making a small game for a school project, and basically there are 20 boxes. 10 boxes have a value of -2, 5 boxes have a value of 2, 3 boxes have a value of 0, and 2 boxes have a value of -5 and 5. So my question is, how can I determine which box was clicked with which value?</p> <p>Code to initialize my boxes:</p> <pre><code>shuffle(numbers); // number.length is 20 for(var i = 0; i &lt; numbers.length; ++i) { $('#buttons').append('&lt;button class="boxes" id="' + numbers[i] + '"&gt;' + numbers[i] + '&lt;/button&gt;'); } </code></pre> <p>Code that I have tried:</p> <pre><code>$('#buttons').append('&lt;button class="boxes" id="' + numbers[i] + '" onclick="clicked(this);"&gt;' + numbers[i] + '&lt;/button&gt;'); // made function called clicked with alert in return $('button#-2).click(function () { alert('Clicked on -2 box'); }); </code></pre> <p>But it seems like none of this code seems to show me an alert for which box I clicked. Am I missing something?</p>
jquery
[5]
5,375,025
5,375,026
C# for loop with already defined iterator
<p>I want to make a loop using an already-defined iterator. </p> <p>At present I am using </p> <pre><code>int i; while (i&lt;10) { Console.Writeline(i); i++; } </code></pre> <p>This is ugly because someone else might later remove the i++. If it is separated from the while statement by a large block of code, it will not be clear what it is for. </p> <p>What I'd really like is something like</p> <pre><code>int i; for (i&lt;10; i++) { Console.Writeline(i); } </code></pre> <p>This makes it clear what's going on, but it's not valid C#. </p> <p>The best I've come up with so far is </p> <pre><code>int i; for (int z; i&lt;10; i++) { Console.Writeline(i); } </code></pre> <p>But that's ugly. Does C# give me an elegant way of doing it? </p>
c#
[0]
1,089,832
1,089,833
Do I have to re-query the DOM to get the jQuery selector within .blur()?
<p>I've searched a bit, but I'm not sure how to write the question to find the answer I want. </p> <p>Given the following jQuery snippet:</p> <pre><code>$('input').blur(function(e){ //can i get $('input') from within e? $('input').val(''); }); </code></pre> <p>How can I re-use the <code>$('input')</code> selector - typically it's available within <code>this</code> ?</p>
jquery
[5]
1,298,087
1,298,088
ASP.net : What is the interest of <asp:?
<p>I have a very simple question for which I can't seem to find an explicit answer : What is the purpose of the <code>&lt;asp:</code> tag ?</p> <p>I mean, if I am building a form for example, what will be the difference between a <code>&lt;label&gt;</code> (html tag) and a <code>&lt;asp:label&gt;</code> (asp tag I guess) (same question applies for other items) ?</p> <p>Thanks in advance !</p>
asp.net
[9]
1,766,985
1,766,986
Adding Background image to UILabel
<p>How can i add a background image to a UILabel in an iPhone Application. I've tried to do it through IB but with no result.</p> <p>Can anybody help me..</p> <p>Looking forward to your reply.</p>
iphone
[8]
6,006,124
6,006,125
jQuery multiply and addition not adding total value
<p>Please take a look at the following URL: <a href="http://jsfiddle.net/XBtgD/2/" rel="nofollow">http://jsfiddle.net/XBtgD/2/</a>.</p> <p>The additions are working fine, however the multiplication part doesn't add up at all.</p> <p>Any ideas on how to get the multiplication working along with the additions?</p> <p>Any help would be greatly appreciated.</p>
jquery
[5]
5,706,717
5,706,718
Duplicate iframe: Copy head and body from 1 iframe to another
<p>Simple question which I can't seem to find an answer of: I have two iframes on a page and I'd like to copy the content of the first one to the second. But I can't do it by just copying the url of the first iframe to the second since the containing page is a dynamic one.</p> <p>This code does do it, but a lot of the page-formatting seems to get lost. And I don't know if it's cross-browser either.</p> <pre><code>iframe2.contentWindow.document.write(iframe1.contentWindow.document.body.innerHTML); </code></pre> <p>Can this be done?</p>
javascript
[3]
3,822,606
3,822,607
first row only from multiple rows - form
<p>Using the following code I am only getting the first row into the database. Looked at many examples but I still cannot see where I am going wrong.</p> <pre><code>// one box for each // &lt;input class="bginput" name="album_name[]" size="30" type="text"&gt; &lt;imput type="submit" Value="submit"&gt; &lt;?PHP foreach($_POST['artist_id'] as $row=&gt;$val) { $artist_id = mysql_real_escape_string($val); $album_name = mysql_real_escape_string($_POST['album_name'][$row]); $image_album_id = mysql_real_escape_string($_POST['image_album_id'][$row]); $track = mysql_real_escape_string($_POST['track'][$row]); $song_name = mysql_real_escape_string($_POST['song_name'][$row]); $duration = mysql_real_escape_string($_POST['duration'][$row]); $sql = mysql_query("INSERT INTO songs (`image_album_id`, `member_id`, `artist_id`, `album_name`, `track`, `song_name`, `duration`, `timestamp`) VALUES ('$image_album_id', '".$_SESSION['member_id']."','$artist_id','$album_name', '$track', '$song_name', '$duration', UNIX_TIMESTAMP() )") or die(mysql_error()); header ('Location: song_details_add.php?success'); exit(); ?&gt; </code></pre> <p>Thanks.</p>
php
[2]
5,359,316
5,359,317
How to write a Loop
<p>I am working on something and I am stumped with 2 things. </p> <p>The first is, I am trying to make a sort of counter that uses <code>PostMessage</code> to type from 0000 to 3600. I need it to stop every few times it PostMessage the number and execute another part of the code, then after that code is done continue for another say 10 times then execute that same code, and so on. </p> <p>Second: I need a function that will detect if a certain color is in a certain pixel, and if it is then it will execute some more code.</p> <p>Here's the code that I tried, but failed with: </p> <pre><code>void loop() { int start = Convert.ToInt32(textbox1.Text); for (int i = start;i == 9999; i++) if(i == 0004) PostMessage(hWnd, WM_CHAR, i, 0); } </code></pre> <p>Here's the last version, which also does not work:</p> <pre><code>void function() { for (int i = 0000; i &lt;= 3600; i++) { PostMessage(hWnd, WM_CHAR, i, 0); //PostMessage i PostMessage(hWnd, WM_KEYDOWN, 0x0d, 0x1c0001); //Press Return Sleep(1000); //System.Threading.Thread.Sleep if ((i % 4) == 0) { Execute(); //My Code Block to execute after i tries 4 times. } } } </code></pre>
c#
[0]
4,265,185
4,265,186
How to retweet a specific tweet?
<p>I wanna make a simple software that does the following:</p> <ol> <li>I tweet from a twitter account (eg 5 times a day)</li> <li>The software should retweet my tweets from the accounts that I am following my primary account</li> </ol> <p>This is all.</p> <p>What I did:</p> <p>I made a software to tweet from it. Basicly you input, username password of primary account and your tweet that you wanna tweet. It will tweet on twitter, what you wrote (I made this just to have the text [tweet], not to search for the text in the twitter page). </p> <p>So basicly, I have the tweet that I am looking for, but don't know how to tell him, search for that text, and click retweet.</p> <p>Any ideeas ?</p> <p>I made this in C# and I am doing it now in winautomation, will try my luck.</p> <p>Any ideeas are appreciated.</p> <p>Thanks</p>
c#
[0]
1,993,769
1,993,770
Finding a list item within a list item
<p>I'm a bit confused on how this works.</p> <pre><code>class TestClass { public int ID {get;set;} public List&lt;Stuff&gt; StuffList {get; set;} } class Stuff { public int ID {get;set;} public string Description {get;set;} } </code></pre> <p>So each <code>TestClass</code> has a list of <code>Stuff</code> in them. What I want to do is find a <code>TestClass</code> that contains any <code>Stuff</code> with an <code>ID</code> of <code>0</code></p> <pre><code>List&lt;TestClass&gt; TestList = RetrieveAllTestLists(); //Pseudocode: // // Find all TestClass in TestList that contain a Stuff with ID == 0; </code></pre> <p>I've tried this but it didn't work:</p> <pre><code>List&lt;TestClass&gt; TestList = RetrieveAllTestLists().Where(x=&gt; x.StuffList.Where(y=&gt; y.ID == 0)).ToList(); </code></pre> <p>Can anyone explain to me what I did wrong?</p>
c#
[0]
1,938,398
1,938,399
jquery toggle between inputs
<p>I need to find a way to switch between four text inputs.</p> <p>Example Usage: </p> <p>Input Names:</p> <pre><code>input1a input1b input2a input2b </code></pre> <p>A user can only enter text in either inputs a or inputs b. </p> <p>If user clicks on input1a then he can only enter text in input1a and input2a. Input1b and input2b will have their values deleted and faded (ie: text input turns into regular labels) and vice-versa.</p> <p>A user can also toggle between inputs a and b.</p> <p>Is there a jquery code that does this? any help is appreciated.</p>
jquery
[5]
4,555,824
4,555,825
jQuery mouseenter mouseleave animation queue
<p>So I have a problem with a mouseenter mouseleave animation. Basicly it just builds up and acts all weird.</p> <p>I know that with .animate to solve this problem you have to use a .stop() before hand, I have tried this on the mouseenter mouseleave and the fadein fadeout, but it doesn't work correctly.</p> <p>Here is my code: </p> <pre><code> $('.1').mouseenter(function() { $(this).find('div').fadeIn(); }); $('.1').click(function() { $(this).unbind('mouseleave'); $('.2 .hidden, .3 .hidden, .4 .hidden').fadeOut(); }); $('.1').click(function() { $(this).unbind('mouseleave'); //Load image video grand $('.2 .hidden').fadeOut(); $('.2, .3, .4').mouseleave(function() { $(this).find('div').fadeOut(); }); }); $('.2').mouseenter(function() { $(this).find('div').fadeIn(); }); $('.2').mouseleave(function() { $(this).find('div').fadeOut(); }); $('.2').click(function() { $(this).unbind('mouseleave'); //Load image video grand $('.1 .hidden, .3 .hidden, .4 .hidden').fadeOut(); $('.1, .3, .4').mouseleave(function() { $(this).find('div').fadeOut(); }); }); </code></pre> <p>Any help would be great, thanks a lot !</p>
jquery
[5]
1,289,119
1,289,120
Enable Media Volume Slider in Android application
<p>Some Android programs trigger the "media volume" slider when the hardware volume up/down buttons are pressed. My application seems to set the ringer volume when the hardware buttons are pressed.</p> <p>How would I enable the media volume slider? </p> <p>I would hate for users to have to go into their settings to change the media volume when they use my application.</p>
android
[4]
2,078,702
2,078,703
Decoding of QR code using Google Chart API
<p>I am making an app in which i have to encode and decode text into QR code. I have encoded the text using google chart API <a href="http://chart.apis.google.com/chart?chs=50x50&amp;cht=qr&amp;chl=abcdef" rel="nofollow">http://chart.apis.google.com/chart?chs=50x50&amp;cht=qr&amp;chl=abcdef</a>".</p> <p>If someone can help me how to decode QR Bitmap image again into text using Google Chart API</p>
android
[4]
3,603,663
3,603,664
return in jQuery.each
<p>can i have the implmentation for jQuery.each wherein if i find any match within the array which is been processed in jQuery.each, then i can break / return without further process the remaining elements.</p> <pre><code>&lt;ul&gt; &lt;li&gt;foo&lt;/li&gt; &lt;li&gt;bar&lt;/li&gt; </code></pre> <p> You can select the list items and iterate across them:</p> <pre><code>$( "li" ).each(function( index ) { //if($(this).text() == 'foo') , i.e if foo is found , //then return instead of processing bar. }); </code></pre>
jquery
[5]
83,048
83,049
pass reference to array in C++
<p>Can any one help me understand the following code</p> <pre><code>#include &lt;iostream&gt; void foo(const char * c) { std::cout &lt;&lt; "const char *" &lt;&lt; std::endl; } template &lt;size_t N&gt; void foo(const char (&amp;t) [N]) { std::cout &lt;&lt; "array ref" &lt;&lt; std::endl; std::cout &lt;&lt; sizeof(t) &lt;&lt; std::endl; } int main() { const char t[34] = {'1'}; foo(t); char d[34] = {'1'}; foo(d); } </code></pre> <p>The output is </p> <pre><code>const char * array ref 34 </code></pre> <p>Why does the first foo calls the <code>const char *</code> version ? How can I make it call the reference version ?</p>
c++
[6]
3,997,440
3,997,441
How to use special characters in PHP in a command shell?
<p>For school we are forced to write a small program in BASIC or "any other language" so I will be doing it in PHP.</p> <p>I have to run it through command prompt, so thought I'd make a few improvements to the "UI" of the shell with lines etc. I used ALT+nnn to insert them into my code, but when I execute it in the shell I get weird characters in it's place.</p> <p>Does anyone know how to fix this?</p> <p>Thanks</p>
php
[2]
1,924,736
1,924,737
Android Keystore Rebuild? is it possible
<p>Actually, I have lost my keystore of some of my apps. But I know the exact information which was into that keystore, I used same info written in .txt file for every keystore.</p> <p>Is there any way to restore, rebuild by using the info were into that keystore?</p> <p>Any ways to recover keystore?</p> <p>You help will highly be appreciated. </p>
android
[4]
3,241,034
3,241,035
unable to connect to https site on via both code and native browser
<p>I have an android application that makes a https connection to a backend. I have successfully added the required certificate (obtained from the backend and converted to bks format) and the app can connect when running on 2.2, 2.3 and 4.0.2 emulators. However on my huawei u8860 (honor) with ics 4.0.3, the app doesn't connect and worst of all it doesn't give any exceptions in the log. On the phone also, I can't point the native browser to the backend but i can using google-chrome for android. I've searched high and low on but found no explanation for this behaviour. any ideas?! Thanks in advance</p>
android
[4]
4,633,124
4,633,125
flajaxian FileUpload triggered from the server side?
<p>In my asp.net webpage, it is required to view the progress of the uploading process. After some research, I found <a href="http://www.flajaxian.com/" rel="nofollow">http://www.flajaxian.com/</a> - a free asp.net with progress tool. </p> <p>However, If I have to specify different files to upload:</p> <pre><code>&lt;cc1:FileUploader ID="FileUploader_Excel" IsSingleFileMode="true" AllowedFileTypes="Excel file:*.xls;*.xlsx" UseInsideUpdatePanel="true" runat="server" /&gt; &lt;cc1:FileUploader ID="FileUploader_XML" IsSingleFileMode="true" AllowedFileTypes="Excel file:*.xml" UseInsideUpdatePanel="true" runat="server" /&gt; </code></pre> <p>By default, each FileUploader contains an Upload button, would it be possible to:</p> <p>1- Hide the upload buttons 2- I have another button "Save" - when this button is pressed, it will start to trigger the upload progress of the two fileuploaders, would it be doable?</p> <p>thanks in advance.</p>
asp.net
[9]
1,386,998
1,386,999
accordian menu slideToggle not sliding up
<p>I have created a super simple accordian menu. But I have run into a problem. The slideToggle is not working. I am not sure if it is because I am hiding the element on click and that is creating the confusion. If anyone could take a look, I woiuld greatly appreciate it. But I really am trying yo keep the code as SIMPLE as possible. Thanks!!</p> <p>See here: <a href="http://jsfiddle.net/liveandream/Yd2Pd/" rel="nofollow">http://jsfiddle.net/liveandream/Yd2Pd/</a></p>
jquery
[5]
1,090,643
1,090,644
use microphone to receive an inaudible tone?
<p>I am doing a project. I want to use the speaker of computer to generate an inaudible tone and microphone on smartphone to receive this tone. </p> <p>1.what software that can generate the inaudible tone (18- 20 Khz) through the speaker in PC ?</p> <p>2.A code android to receive and analyse some features (frequency, amplitude,…) of this tone?</p>
android
[4]
4,503,223
4,503,224
conditional functionality for ie7 in javascript
<p>There is anyway to find write a function that should work only for iexplorer7 and not for the other browser using javascript.</p>
javascript
[3]
4,714,156
4,714,157
custom windows form properties
<p>I have created a customize windows form and I just don't know how should I set properties to it.</p> <p>for example I've created a form with a progress bar, button, and a label and want to set the text of the label, the value of the progress bar, <strong>and to get access to the buttonClick Event method</strong> form the windows form application that uses the control.</p> <p>In other words just get access to all the default properties of each control inside.</p> <p>Is it possible? and how should I do it?</p> <p>thanks very much!</p> <p>If I want to to get access to the buttonClick Event method how should I do it?</p>
c#
[0]
5,045,778
5,045,779
jquery animate function option with opacity,height,width,left and top together
<p>can we use opacity,height,width,left and top together with jquery animate function</p> <pre><code>$('#div').animate({ opacity : 1, height : 300, // You desired height. width : 400 }); $('#div').animate({ opacity : 1, height : 0, width : 0 }); </code></pre> <p>if anyone has any idea then please share with me. thanks</p>
jquery
[5]
2,013,493
2,013,494
copy a 2d array in java
<p>i have a 2d array called matrix of type int that i want to copy to a local variable in a method so i can edit it </p> <p>whats the best way to copy the array, i am having some troubles</p> <p>for example</p> <pre><code> int [][] myInt; for(int i = 0; i&lt; matrix.length; i++){ for (int j = 0; j &lt; matrix[i].length; j++){ myInt[i][j] = matrix[i][j]; } } //do some stuff here return true; } </code></pre>
java
[1]
955,793
955,794
iPhone problem with loading view with button
<p>In one of my classes I have a button that when pressed loads another view controller and view. This is what I use:</p> <pre><code>FormController *formController1=[[FormController alloc]initWithNibName:nil bundle:nil]; [self presentModalViewController:formController1 animated:YES]; </code></pre> <p>The problem is that it loads the full view, but not the navigation bar that comes with all the other views. What am I doing wrong?</p>
iphone
[8]
2,959,929
2,959,930
Avoid Tabs from disappearing when searching
<p>i've got a tabbed layout, and on one of the tabs i have a search functionality. When the user makes a new search, i need to show the results. However, doing so involves starting another <code>activity</code> to handle the search results. </p> <p>this causes the tabs at the bottom to disappear. The user can get the tabs back by clicking on the '<code>back</code>' button. But somehow, in the context of my application this can be a bit counter-intuitive and seems to be break the common layout flow.</p> <p>is there any way to prevent the tabs from disappearing when invoking the search from one of the tabs?</p> <p>thanks for any help/suggestions.</p>
android
[4]
354,966
354,967
How to drag multiple images in android
<p>I can drag one image on canvas.Now I want to drag more than one image. Is there any possibility to do that?</p>
android
[4]
4,520,414
4,520,415
singleton config file
<p>Hey Guys I have a problem with a class and singleton method: I make this class whith the intention of use config values inside others class:</p> <pre><code>&lt;? class Config { public $values=array(); protected static $_instance = null; //Getters function __get($prop) { return $this-&gt;values[$key]; } //Setters function __set($key, $value) { $this-&gt;values[$key]=$value; } //Singleton public static function getInstance() { if (self::$_instance === null) { $c = __CLASS__; self::$_instance = new $c; } return self::$_instance; } }?&gt; </code></pre> <p>I make a instance whith values of my conection:</p> <pre><code>$config=new Config(); $config-&gt;conex=array( 'database' =&gt; 'lala', 'user' =&gt; 'lala', 'password' =&gt; 'lala', 'server' =&gt; 'localhost' ); </code></pre> <p>But when I call singleton method inside database class the values are lost:</p> <pre><code>$config = Config::getInstance(); print_r($config-&gt;conex); </code></pre> <p>Why is the problem?</p>
php
[2]
2,441,798
2,441,799
python writing to a file
<p>I keep getting this "writing to a closed file error" while trying to compile the following code:</p> <pre><code>fout = open('markov_output.txt', 'w') for i in range( MAXGEN ) : # get our hands on the list key = (w1,w2) sufList = table[key] # choose a suffix from the list suf = random.choice( sufList ) if suf == NONWORD : # caught our "end story" marker. Get out if len( line ) &gt; 0 : fout.write(line) break if len( line ) + len( suf ) &gt; MAX_LINE_LEN : fout.write(line) line = "" line = line + " " + suf w1, w2 = w2, suf fout.close() </code></pre>
python
[7]
5,601,724
5,601,725
PHP Date not calculating properly
<p>I have this code, and it prints out as '01/01/1970'</p> <pre><code>$dob = mktime(0, 0, 0, date("m"), date("d")-1, date("y")-18); echo "DOB is ".date("d/m/y", $dob); </code></pre> <p>Why is the year not 18 years less than today?</p>
php
[2]