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
5,916,961
5,916,962
Is there a way to make native function chainable?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1099628/how-does-basic-object-function-chaining-work-in-javascript">How does basic object/function chaining work in javascript?</a> </p> </blockquote> <p>Is there a way to make native function chainable?</p> <p>For example, I want to do this:</p> <pre><code>var ele = document .createElement("div") .setAttribute("id", "foo") .focus(); </code></pre> <p>instead of this:</p> <pre><code>var ele = document.createElement("div"); ele.setAttribute("id", "foo"); ele.focus(); </code></pre> <p>Is there a way to do that? If it is possible, then it will definitely save me a lot of typing works.</p>
javascript
[3]
2,180,759
2,180,760
SQL stored procedure parameters when calling from code
<p>Does the order of parameters being passed to a stored procedure matter from the C# function?</p> <p>Thank you</p>
c#
[0]
4,550,610
4,550,611
How display scroll-bar for UITextView always?
<p>UITextView seems display scroll bar just as the following conditions 1 The contents of view is more than View can display 2 User scroll UITextView's scroll-bar</p> <p>Am I right? Is there any smart way to display scroll-bar anytime?</p>
iphone
[8]
4,127,456
4,127,457
JavaScript speed monitoring tool?
<p>First I'd like to say that I did my research and haven't found any tools that do what I am looking for.</p> <p>So my question is, is there a tool that records how the JS performs on a website? For example, I am working on a plugin and I am making various changes, but I need some feedback in order to decide if I am actually making optimizations or not. A simple monitoring of the time it takes to execute the JS file would be perfect.</p> <p>So anyone know such a tool?</p> <p>Thanks!</p>
javascript
[3]
5,299,089
5,299,090
string argument for array static method header help for java
<p>I have placed string argument in the method header called methodASet. Is it possible to use this string argument in the body and returns the words in the argument as a set? If so how do I do this? Thanks. </p> <pre><code>public class MyMates { private static Set&lt;String&gt; names; private static String[] name1 = null; private static String[] name2 = null; private static String[] name3 = null; public MyMates() { methodASet(); // (2) but I then get a error message "methodASet(java.lang.String) in myMates cannot applied to () names = new TreeSet&lt;String&gt;(); } public static void methodASet(String aTemp) { name1 = new String[]{"Amy", "Jose", "Jeremy", "Alice", "Patrick"}; name2 = new String[]{"Alan", "Amy", "Jeremy", "Helen", "Alexi"}; name3 = new String[]{"Adel", "Aaron", "Amy", "James", "Alice"}; return aTemp; // (1) is it like this? } </code></pre>
java
[1]
1,235,571
1,235,572
regex preg replace for specific names
<p>I have some file names in my database that start with dot like<br> .file456 .file593</p> <p>I was wondering how can I filter those files that start with dot in php</p> <p>thanks</p>
php
[2]
3,143,187
3,143,188
Android UI Layout Different sizes
<p>To support multiple screen sizes I should have layouts in layout-small, layout-normal, and layout-large. If there is for example a main layout in large but not in the normal folder, will a normal screen size phone default to the layout in the large folder? Is this true for drawable also?</p>
android
[4]
3,428,002
3,428,003
Unable to capture content of drawing using getRootView
<p>I am using MyView for drawing content on a canvas using FingerPaint API demo app. I want to capture whatever I have written on the canvas. But when I use View v1 = myview.getRootView() it is returning only the blank canvas and not the content. I want to save my drawing in SDCard. Following is my code. Let me know what do i need to change</p> <pre><code>v1 = myview.getRootView(); System.out.println("v1 value = "+v1); v1.buildDrawingCache(true); v1.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); //v1.layout(0, 0, v1.getMeasuredWidth(), v1.getMeasuredHeight()); v1.layout(0, 0, 100, 100); //Bitmap b = Bitmap.createBitmap(v1.getDrawingCache()); myview.mBitmap = Bitmap.createBitmap(v1.getDrawingCache()); System.out.println("BITMAP VALue = "+myview.mBitmap); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); //b.compress(Bitmap.CompressFormat.JPEG, 40, bytes); File f = new File(Environment.getExternalStorageDirectory()+ File.separator + "rashmitest.jpg"); try { f.createNewFile(); FileOutputStream fo = new FileOutputStream(f); fo.write(bytes.toByteArray()); } catch (Exception e) { e.printStackTrace(); } v1.setDrawingCacheEnabled(false); </code></pre> <p>myview is an object of class MyView that extends View. </p> <p>The screenshots look like this </p> <p><img src="http://i.stack.imgur.com/hf8uX.png" alt="enter image description here"> and I get Only this one</p> <p><img src="http://i.stack.imgur.com/vZrqK.png" alt="enter image description here"></p>
android
[4]
1,234,523
1,234,524
Class Declaration Questions
<p>From this code snippet:</p> <pre><code>CClassA&amp; CClassA::operator =(const CClassA&amp; rhs) { return; } </code></pre> <p>I have the following questions:</p> <ol> <li>Is it a class member?</li> <li>What does <code>&amp;</code> mean?</li> <li>What does <code>rhs</code> mean? (I only know it means "right hand side")</li> <li>What does <code>const</code> mean?</li> </ol>
c++
[6]
922,028
922,029
Tool for Analyze the class diagram of big C++ framework
<p>Can you please tell me which is the best tool that generate the pictorial representation of the C++ source code. I have big C++ framework code and i want to understand that code so i need some tool that generate some graphs, class diagram or some pictorial representation of all class to understand the code. Can you please tell me tool or any other way to understand the big C++ framework code ?</p>
c++
[6]
2,483,166
2,483,167
is window.document.element a valid object?
<p>Just as window and document objects in JS corresponds to window(?) and &#60;body&#62; elements in HTML, can you refer to more nested elements of the &#60;body&#62; simply by appending with dots(.)? (like window.document.p)</p> <p>I haven't seen it anywhere but I don't know since <em>I haven't seen it anywhere</em>. It just seemed intuitive to me that nested elements in HTML be represented as nested objects in JavaScript instead of having to getElementByID but somehow this chain seems broken after window.document</p>
javascript
[3]
5,469,730
5,469,731
how to make android transparent keyboard?
<p>I am writing an Android application for API 2.2, where I need to use transparent keyboard and I have a problem. I can't find how to make keys for the keyboard. I can set alpha for key icon by setting this.</p> <pre><code>mQwertyKeyboard.getKeys().get( i ).icon.mutate().setAlpha( 0 ); </code></pre> <p>where <code>mQwertyKeyboard</code> is <code>QWERTYKeyboard extends Keyboard</code>, but how do I set alpha for key background? Thank you for help.</p>
android
[4]
2,582,813
2,582,814
Is it safe to make the assumption that generic data column is not used by any other application for storing it own contact data
<p>I am using the generic columns DATA1 to Data15 to store some data. My question is whether it is safe to assume that these columns are not being used by other android applications to store their own data. IF not how would I make sure that a particular column is not being used by any other application? </p> <pre><code>ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI) .withValue(Data.DATA10,"Data") </code></pre> <p>Retrive data:</p> <pre><code>ContentResolver cr=context.getContentResolver(); Cursor emailCur = cr.query( ContactsContract.Data.CONTENT_URI, null, ContactsContract.Data._ID + " = ?", new String[]{str_id}, null); while (emailCur.moveToNext()) { String name=emailCur.getString( emailCur.getColumnIndex(Data.DATA10)); } </code></pre>
android
[4]
354,806
354,807
How do I get an image to display on a page when the path for the image is in a MySql database?
<p>Here is the 'id' and (path) 'name' in the MySql table called "upload":</p> <pre><code> rec_id | name --------+------------------------------------------------------ 1 | C:\Apache Tomcat 5.0.28\htdocs\ajax\images\blob1.jpg 2 | C:\Apache Tomcat 5.0.28\htdocs\ajax\images\blob3.jpg 3 | C:\Apache Tomcat 5.0.28\htdocs\ajax\images\blob2.jpg </code></pre>
php
[2]
2,720,236
2,720,237
ASP.NET create printable forms
<p>i have a number of word documents (forms) that i need to publish it as interactive web form(no database connection just form with text entries fields) on the site to be printable, is there a way to publish them with the least effort.</p> <p>thank you, </p>
asp.net
[9]
3,744,870
3,744,871
Why Should You Use The C# Predefined Types Rather Than The Aliases In The System Namespace
<p>In the "C# Coding Standard" by Juval Lowy available from www.idesign.net, the recomendation is made to use the C# predefined types instead of the aliases in the <code>System</code> namespace.</p> <pre><code>object NOT Object string NOT String int NOT Int32 </code></pre> <p>What is the benefit of this? How do they differ? I have followed this advise in my own coding but never knew how they differed.</p>
c#
[0]
2,051,262
2,051,263
how to declare a string global in iphone programing
<p>I want to make a string global in the iphone application can any help me on this problem I have use extern and other things but these are not working on the xcode. They are giving the error.</p>
iphone
[8]
4,358,613
4,358,614
Create add-on system
<p>Many applications in the android market offer a free add-ons like the paid version and after installation, they simply add functionality, but is not in the installed programs and does not be in the process. Question: how to implement just such a system add-ons myself .apk, which is something to unlock the application, but it did't install to device (in many cases still download content for playback).</p>
android
[4]
3,316,948
3,316,949
Only allow 1 instance of a python script
<p>What is the best way to insure that only 1 copy of a python script is running? I am having trouble with python zombies. I tired creating a write lock using <code>open("lock","w")</code>, but python doesn't notify me if the file already has a write lock, it just seems to wait. </p>
python
[7]
3,560,717
3,560,718
Get original indices of a sorted numpy array
<p>Hi I have an array of distances <code>a= np.array([20.5 ,5.3 ,60.7 ,3.0 ], 'double')</code> and I need the indices of the sorted array (for example <code>[3, 1, 0, 2]</code>, for <code>a.sort()</code>). There is a function in numpy to do that?</p> <p>Thanks</p>
python
[7]
2,827,772
2,827,773
step by step jquery elements fadeIn
<p>I need to fadeIn elements with data received after ajax request. It works ok, but all of elements becomes visible at same time. Is it possible to implement small delay between visibility changes for each element to be showed?</p> <pre><code> $.ajax({ type: "POST", url: "get_values.php", dataType: "json", data: { prm_listArray : prm_list}, success: function(res) { $.each(res, function(key, value) { var cell = $('table tr:eq(' + value.prm_row + ') td:eq(' + value.prm_column + ')'); $(cell).find(".cell_text").html(value.prm_value).fadeIn('slow'); }) } }); </code></pre> <p>i tried to insert delay(3000) without success:</p> <pre><code>$(cell).find(".cell_text").html(value.prm_value).delay(3000).fadeIn('slow'); </code></pre> <p>And timeout with the same behavior:</p> <pre><code>$(cell).find(".cell_text").html(value.prm_value); setTimeout(function() { $(cell).find(".cell_text").fadeIn('slow'); }, 3000); </code></pre>
jquery
[5]
466,946
466,947
Sending Messages from my Service to my Activity?
<p>I have an Android Service which copies files to an ftp server.</p> <p>While it is doing that, I want to send feedback to my Activity so the user knows what happens.</p> <p>I tried implementing it using the <a href="http://developer.android.com/reference/android/app/Service.html#RemoteMessengerServiceSample" rel="nofollow">RemoteMessengerServiceSample</a> code, but I have a problem ... All messages I send during the ftp transfer arrive at my Activity the moment the copy operation is finished ... not message by message while the copy job runs as I would like.</p> <p>Is there any way to fix this? Maybe i'm using the wrong method for sending messages to my activity?</p>
android
[4]
5,990,768
5,990,769
Javascript EventKey function restriction between language switching
<p>I have a javascript function that works on EventKey.the function is written in a way that ";" and dot "." are disabled on the keyboard but there is a problem when i switch to arabic keyboard the letters that are placed on the place of ";" ". " are also disabled but i need to enable them.I need to know how to mention that we are using an arabic keyboard in way that when i click these two keycodes the arabic letters should be enabled so when i press these two keys the arabic letters would be written but in english these same two keys are disabled. any help ?</p>
javascript
[3]
341,608
341,609
How do I check if an image has preloaded successfully?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1977871/check-if-an-image-is-loaded-no-errors-in-javascript">Check if an image is loaded (no errors) in JavaScript</a> </p> </blockquote> <p>After being loaded by javascript by setting img.src.</p> <p>Thanks...!</p>
javascript
[3]
2,102,185
2,102,186
Swap default selected select options with pure Javascript
<p>I have a select box as follows</p> <pre><code>&lt;select&gt; &lt;option value="yes"&gt;Yes&lt;/option&gt; &lt;option value="No" selected="selected"&gt;No&lt;/option&gt; &lt;option value="Maybe"&gt;Maybe&lt;/option&gt; &lt;option value="So"&gt;So&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I would like</p> <pre><code>&lt;select&gt; &lt;option value="yes"&gt;Yes&lt;/option&gt; &lt;option value="No"&gt;No&lt;/option&gt; &lt;option value="Maybe" selected="selected"&gt;Maybe&lt;/option&gt; &lt;option value="So"&gt;So&lt;/option&gt; &lt;/select&gt; </code></pre> <p>*note default selection is now "Maybe" instead of "No"</p> <p>I learned jquery before really getting comfortable with pure JavaScript. So im trying to learn it.</p>
javascript
[3]
3,981,437
3,981,438
Simulating Horizontal Scrolling of GridView using Gallery but scrolling Tables not Images android
<p>I've come to the conclusion there is no Horizontal Scrolling for gridView. The work-around solutions online are to use Gallery in a multi-row format.</p> <p>However, from what I understand, Gallery requires image files. (Please correct me if I'm wrong.)</p> <p>I want a work around that can scroll tables (aka a grid view) . I'm basically making a Calendar where I'd like to scroll horizontally. It doesn't have to be as fluid where scrolling vertically shows each additional week that comes into view. Horizontal scrolling can simply scroll month by month. </p> <p>Nevertheless, I'm wondering if there is some sort of work-around with Gallery? Or does Gallery absolutely require images?</p>
android
[4]
3,937,430
3,937,431
php code that gather all form input and post it together
<p>In my pages i have form that has several textarea, i need a method to gather all of the textareas in one email and then send it.</p> <p>I need a method that i can add it to each page and do this automatically instead of referencing each textarea by name.</p> <pre><code>$email_body = "You have received a new message from the user $name. \r\n". "Here is the answer to the $step. \r\n $message \r\n Comments:$comments.\r\n". </code></pre> <p>Instead of <code>$message</code> i want all textareas.</p>
php
[2]
1,819,307
1,819,308
How can i make my animation will take same time duration for all system and browser?
<p>I am doing a animation, as a sample ( actually it needs for my project), In that animation i am moving a box from left to end of the page. it all works fine.</p> <p>the problem is, it is differing from one browsers to another. ( the time duration of total journey). i made a function and i calculated the starting time and minus to current settimeout call, but i am confused whether it work correct of not. some different i found between firefox and chrome...</p> <p>i red no.of articles, and i find out delta timing is the good option, but seriously i unable to understand how to calculate the delta time. with my understanding, i made this function :</p> <pre><code>$(document).ready(function(){ var startTime = +new Date(); var wide = $(document).width(); var add = 0; var boxWidth = 100; var moveBox = function(){ if($('#box').offset().left &lt; boxWidth){ add++; }else{ clearTimeout(moveIt); console.log(+new Date() - startTime); return false; } var diff = +new Date() - startTime var elapsed = 1000/diff; console.log(1000-elapsed); $('#box').css({left:add+'px'}); var moveIt = setTimeout(moveBox, (1000-elapsed)); } moveBox(); }) </code></pre> <p>Can any one help me which i made this function is correct or incorrect? if so any one alter my code? else can any one explain me with a small function that how delta time has to calculate?</p> <p>i am in confused state now, any one help me?</p>
jquery
[5]
3,932,918
3,932,919
C# find first match of string in string array
<p>I have to search for the first match of any string in an string array in a textbox starting from a certain position. Like if I have this string array: </p> <pre><code>string[] s = { "RTS", "RTL" }; </code></pre> <p>And this code:</p> <pre><code>LDA #$43 STA $1000,x CMP $00 BEQ .main .return RTS .main add $01 RTL </code></pre> <p>It should return RTS since that's the first match (not the RTL). How can I do this? Additionally, would there be a better way of doing this rather than using an array?</p> <p>Edited since I gave a bad example of what I was trying to do.</p>
c#
[0]
2,968,375
2,968,376
PHP connection Fatal Error
<pre><code>Warning: mysqli_close() expects parameter 1 to be mysqli, object given in /home/mjcrawle/public_html/toga/homefile/processlogin.php on line 63 </code></pre> <p>I am trying to connect a database and I am getting the above error. I I am using 4 different includes in this file and the include are before I try to connect to the database.</p> <p>Sample of one of my includes</p> <pre><code>require_once('../homefile/class/database.class.php'); </code></pre> <p>The include work fine and this is my line of code to connect my db.</p> <pre><code>/*New database Object*/ $db = new Database; </code></pre> <p>I am kind at a loss... The database is closed.</p> <pre><code>mysqli_close($db); </code></pre> <p>There is a ton of code but I am not sure anyone would want to wade though it. If you can thing of anything let me know.</p>
php
[2]
3,787,311
3,787,312
DashPathEffect doesn't work on IconBIT NetTAB MATRIX with drawLine
<p>I tested DashPathEffect in my program on 6 devices (Samsung Galaxy Tab 10, Samsung Galaxy S2 (Android 4.0.3), HTC Wildfire S, HTC Aria, CUBE U8GT and IconBIT NetTAB MATRIX (Android 4.0.3)), but only on IconBit this method doesn't work in this code:</p> <pre><code>Paint paint = new Paint(); paint.setPathEffect(new DashPathEffect(new float[]{dashWidth, dashGap}, phase)); canvas.drawLine(x1,y1,x2,y2, paint); </code></pre> <p>But then I use drawOval it works. Then I use DashPathEffect with drawLine in new project, it works fine too. In AndroidManifest hardwareAcceleration does not affect the bug.</p> <p>Why doesn't it work? How can I fix it?</p>
android
[4]
5,752,061
5,752,062
JQuery click+this not working
<p>I have copied a snippet of code over. I am very new to web languages and come from a java background.</p> <p>JQuery seems great but I just can't figure out how to solve this.</p> <p><a href="http://jsfiddle.net/MMf9Q/2/" rel="nofollow">http://jsfiddle.net/MMf9Q/2/</a></p> <p>thank you.</p>
jquery
[5]
589,114
589,115
Is ini_set('max_execution_time', 0) a bad idea?
<p>Is there a good reason not to set the PHP configuration variable <a href="http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time"><code>max_execution_time</code></a> to 0?</p> <p>A coworker recently checked in a change to a file that added:</p> <pre><code>ini_set('max_execution_time', 0); </code></pre> <p>The default value had been too low for a page that did some complex processing before returning the output to the user.</p> <p>The manual states that the main purpose of the setting is to:</p> <blockquote> <p>prevent poorly written scripts from tying up the server.</p> </blockquote> <p>But also goes on to state:</p> <blockquote> <p>Your web server can have other timeout configurations that may also interrupt PHP execution. Apache has a <em>Timeout</em> directive and IIS has a CGI timeout function. Both default to 300 seconds. See your web server documentation for specific details.</p> </blockquote> <p>We're running under Apache, so that <em>Timeout</em> setting applies. Is there any reason not to set <code>max_execution_time</code> to zero globally? I'm mainly curious as to whether there are benefits I'm overlooking when <strong>not</strong> setting it to zero.</p>
php
[2]
5,412,763
5,412,764
Only one asp.net page through out
<p>I have created a web page but i want to restrict only one instance of the page should be running at all times. The scenarios are given as below.</p> <ol> <li>First time - User launches the page by URL and page loads.</li> <li>User types URL again in another window and it should say that a page is already open OR refresh the existing page.</li> <li>User closes the window and tries again - new fresh page will be loaded.</li> </ol> <p>Additional Details : I have a database, user authentication.</p> <p>Tried So Far : Set a flag in DB-->> This method how do i redirect the user back to the page which is already opened.</p> <p>Any ideas to implement this.?</p> <p>Thanks in Advance for your opinions and suggestions.</p>
asp.net
[9]
3,748,693
3,748,694
Best dataype to store a 1000 digit number in java
<p>I am new to java, trying to solve Euler problems with it. I am having a 1000 digit number, what could be the best datatype?</p> <p>Sorry, guys. I didn't expect the answer to be this quick. Thanks for you guys:) can anybody could write a piece of code and show how to declare this integer using <code>BigInteger</code> datatype.?</p> <pre><code>73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450 </code></pre>
java
[1]
5,310,111
5,310,112
Consequences of Dynamically rewriting a function in javascript?
<p>In javascript, you can rewrite a function, like so:</p> <pre><code>function foo() { setTimeout(function() { alert('sup stallion'); foo = function() { //rewrite foo to nolonger wait 4 seconds to alert. alert('sup stallion'); } }, 4000); } </code></pre> <p>Obviously this is a contrived example, but is there anything conceptually wrong with this approach (<strike>other than a race condition</strike>).</p>
javascript
[3]
1,814,137
1,814,138
How to play a custom sound after the countdown timer ends?
<p>I am trying to implement the following functionality in my application</p> <ol> <li>The user selects a music file in one input field and time duration ( Seconds only ) in the other. </li> <li>After the user presses ok, the count down timer starts and runs till the entered time duration expires and then the chosen music file should start playing.</li> </ol> <p>Can anybody please advise me on the best way to implementing this other than using the alarm manager?</p>
android
[4]
1,961,145
1,961,146
Disable the save option from downloading window? In Asp.net?
<p>In web application, i am trying to disable or remove the save dialog , when user click the download option. Can you help me. Thank you. LIke Do You want to Open or save this file? in this option i want only Open option not save option.</p>
asp.net
[9]
1,734,829
1,734,830
Linked list with different elements , possible?
<p>Hya, </p> <p>Lemme explain my point .</p> <pre><code>template&lt;typename T&gt; class node{ T data; template&lt;typename X&gt; node&lt;X&gt;* right; // can point to any node&lt;typename&gt; i know its wrong } </code></pre> <p>so that i can do something like :</p> <pre><code>node&lt;int&gt; a; a.data = 23; node&lt;float&gt; b; b.data =43.6; a.right= b; std::cout&lt;&lt; a.data &lt;&lt;a.right-&gt;data; </code></pre> <p><strong>Another example:</strong></p> <pre><code>template &lt;class Type&gt; struct vnode { Type data; vnode&lt;Type&gt; * vnodenext; // vrow what_to_put_here // **i don't want to use void ptrs neither want to cast back manually** } </code></pre> <p>And in main function if i define vnode struct of type type string and another vnode of int ,then what pointer def should i replace with vrow in vnode struct definition , so that it can point to vnode of type int or other type of vnode e.g</p> <pre><code>vnode&lt;string&gt; mystring; vnode&lt;int&gt; myint; myint.vrow = &amp;mystring </code></pre> <p>Thanks alot)</p>
c++
[6]
1,481,613
1,481,614
jQuery.animate() with css class only, without explicit styles
<p>Using JQuery animate I would like to operate with css classes, defined somewhere in .css file, not to have to give all styles params to jquery.animate() explicitly.</p> <p>I can create a fake (e.g. invisible) element with such a class, read its css properties and give them to jquery.animate() - does anybody know a better way?</p>
jquery
[5]
4,692,678
4,692,679
Double ternary in JavaScript
<p>I was going through some stuff in the jQuery source, specifically the <code>inArray</code> method and I found this line of code:</p> <pre><code>i = i ? i &lt; 0 ? Math.max( 0, len + i ) : i : 0; </code></pre> <p>What I am seeing is two ternary operators, but I have no idea how this is used. I understand how the ternary operator works, but I have never seen it used like this before. How does this piece of code work??</p>
javascript
[3]
3,701,113
3,701,114
jquery script refuse to execute again after making one round
<p>I have set of few thumbnails, each time user click on thumbnail I show big picture on the middle, and animate/hide thumbnail, delete if from the top and insert it on the end of thumbnail set. But after making full round - clicking on the first picture again - script doesn't execute anymore. The script:</p> <pre><code>$(".loadMainPhoto").click(function (event) { event.preventDefault(); var $this=$(this).children(":first"); var html="&lt;div class='filmStripOuter'id='div_"+$this.attr('id')+"'&gt;"+$("#div_"+$this.attr('id')).html()+"&lt;/div&gt;"; var parent=$("#div_"+$this.attr('id')).parent(); $("#div_"+$this.attr('id')).animate({ opacity: 0.25, height: 'toggle' }, 500, function() { $("#div_"+$this.attr('id')).remove(); parent.append(html); }); </code></pre> <p>I'm not sure if my explanation is enough, I'll provide other info as needed. Any help appreciated. <br/><br/> [edit]<br/> Thanks to Stefan and Mark it is fixed right now, the problem was that I try to match element that was added after page was loaded, and bind does't work then. The solution is to use the same element (not new one) or to use live() <a href="http://api.jquery.com/live/" rel="nofollow">http://api.jquery.com/live/</a> you can see how it works on my playground ;) <a href="http://papiez.me" rel="nofollow">http://papiez.me</a></p>
jquery
[5]
3,018,996
3,018,997
change the value of a qantity field with jquery
<p>I have form with multiple qty fields,I'd like to add the qty but pressing the add button and subtract the qty by pressing minus button, I got it working for one but I can not make it work for multiple qty fields,I have 24 qty fields, any help would be appreciate it.</p> <pre><code> &lt;form&gt; &lt;input name="minus1" type="button" class="button" id="minus1" value=" - " /&gt; &lt;input name="textfield1" type="text" id="textfield1" size="2" maxlength="2" value="0" /&gt; &lt;input name="add1" type="button" class="button" id="add1" value=" + " /&gt; &lt;input name="minus2" type="button" class="button" id="minus2" value=" - " /&gt; &lt;input name="textfield2" type="text" id="textfield2" size="2" maxlength="2" value="0" /&gt; &lt;input name="add2" type="button" class="button" id="add2" value=" + " /&gt; ...... &lt;/form&gt; $(function() { $("#add1").click(function(){ var newQty = +($("#textfield1").val()) + 1; $("#textfield1").val(newQty); }); $("#minus1").click(function(){ var newQty = +($("#textfield1").val()) - 1; if(newQty &lt; 0)newQty = 0; $("#textfield1").val(newQty); }); }); </code></pre>
jquery
[5]
4,461,193
4,461,194
Insert variable into string at random position
<p>See this code:</p> <pre><code>&lt;?php $a = rand(1, 10000000000); $b = "abcdefghi"; ?&gt; </code></pre> <p>How can I insert <code>$b</code> into a random position of <code>$a</code>?</p>
php
[2]
122,774
122,775
Show tooltip when selecting item on asp:DropDownList
<p>I have an asp:DropDownList on a page that, due to the 1024x768 development standard can truncate some of the text values in the dropdown (not enough of them, apparently, to redesign the layout ), so I need to display a tooltip of the selected value <em>when</em> a dropdown item is being selected (i.e. when the dropdown is shown and an item is being hovered over), preferably only when the text for that item is being truncated.</p> <p>Is this possible by default, javascript hacking or only my imagination?</p>
asp.net
[9]
1,736,049
1,736,050
Returning a flexible datatype from a C++ function
<p>I'm developing for a legacy C++ application which uses ODBC for it's data access. Coming from a C# background, I really miss the ADO style of data access.</p> <p>I'm writing a wrapper (because we can't actually use ADO) to make our data access less painful. This means no <code>char</code> arrays, no manual text blob streaming, and no declaritive column binding.</p> <p>I'm struggling with how to store / return data values. In C# at least, you can declare an <code>object</code> and cast it to whatever (as long as the type is convertable).</p> <p>My current C++ solution is to use <code>boost::any</code> to store the data value in a custom <code>DataColumnValue</code> object. This class has conversion and assignment operators to the various types used in our app (more than 10). There's a bit of complexity here because if you store an <code>int</code> in the <code>boost::any</code> and try to <code>boost::any_cast&lt;long&gt;</code> you get a <code>boost::bad_any_cast</code>. Client objects shouldn't have to know how the value is stored internally.</p> <p>Does anyone have any experience trying to store / return values whose types are only known at runtime? Is there a better / cleaner way?</p>
c++
[6]
4,553,213
4,553,214
How can check the table records
<p>I have a table and i want to check that whether it is empty or it has some records.. How can i check?</p>
android
[4]
4,827,330
4,827,331
How to use jquery .animate() to mock 'text-align:right'
<p>I am building a very simple jquery menu. On hover, I have a menu on the right easing to the left margin of my menu container. This is easy, as the text is left aligned within said container.</p> <p>However, I also have a menu on the left, and because the links (left justified) are of differing length, the best I can do is adjust the padding to ease the text a uniform amount between links. Therefore, long link text goes to the right edge of the container, buy short text only makes it about half way.</p> <p>In reading about this, I have learned that you can not modify the text align property as it is non numeric. Is there any other way to do this?</p> <p>I of course tried to go with:</p> <pre><code>$('#selector').css('text-align':'right') </code></pre> <p>but that made the text jump to the right instead of ease.</p> <p>Is there any way to ensure all links ease to the rightmost margin of the container?</p>
jquery
[5]
2,994,691
2,994,692
Global time and globle date converting in php
<p>in my web application, user has to enter a time and select a date.so i want to save that time and date in globle time and date.when it get it should appear in user's country time.so simply the requirement is to convert a string into globl time and globle date when saving and globle time and date convert into a string when retrieving.so please let me know if someone know the PHP functions for this.thank you!!!</p>
php
[2]
5,480,836
5,480,837
Java "Unreachable Code" Errors
<p>I am currently using Eclipse to code a new plugin. I have been following tutorials online, however have ran into an error. My friend has been helping with the code, however he is unsure of this fix. I am running into an "Unreachable code" error. I have marked the location of the error. Thanks for any help!</p> <p><a href="http://pastebin.com/tpeFWsas" rel="nofollow">http://pastebin.com/tpeFWsas</a></p>
java
[1]
334,920
334,921
How to use background thread for inline operation in android
<p>I have the following program flow:</p> <ol> <li>User fills in form</li> <li>My app generates a number of records via a content provider which may take some time (say 10 seconds)</li> <li>The user can then continue with the program</li> </ol> <p>I have 2 questions:</p> <ol> <li><p>Why use a non-UI thread to perform step 2 - given that the user can do nothing in my application until this process has been completed, why don't I just use a waiting widget?</p></li> <li><p>If I should use a non UI thread - which type of asynchronous thread approach would make the most sense?</p></li> </ol>
android
[4]
4,005,766
4,005,767
How to display a multiple values in textfield?
<p>I'm new to the iPhone. I have four number buttons like 1,2,3,4. When I click any button the value is displayed in a textfield, but when I click two buttons only one value is displayed in textfield.</p> <p>How to display in multiple values in textfield?</p>
iphone
[8]
808,820
808,821
Java applet pane movable by arrow keys?
<p>How can I make my java applet unlimited or set to a certain size where I can move the thing (not the window) with the arrow keys and the images And stuff will stay in place?</p>
java
[1]
3,382,806
3,382,807
Broken Pipe from subprocess.Popen.communciate() with stdin
<p>I'm having a strange issue when using subprocess.Popen.communicate(). For background, I want to execute an application from my python script. When I run the program from the command line, I do it like this (UNIX):</p> <pre> $ echo "input text" | /path/to/myapp </pre> <p>From my script, I also want to pipe the input into the application. So, I tried the following. But I get a "broken pipe" error when I try to send the input with communicate():</p> <pre> >>> cmd = ['/path/to/myapp'] >>> p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) >>> out,err = p.communicate('input text') Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.5/subprocess.py", line 670, in communicate return self._communicate(input) File "/usr/lib/python2.5/subprocess.py", line 1223, in _communicate bytes_written = self._write_no_intr(self.stdin.fileno(), buffer(input, input_offset, 512)) File "/usr/lib/python2.5/subprocess.py", line 1003, in _write_no_intr return os.write(fd, s) OSError: [Errno 32] Broken pipe </pre> <p>To make matters stranger, if I leave out the input data, I don't get any errors. However, this isn't really a good workaround because the application needs input to work.</p> <pre> >>> p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) >>> out,err = p.communicate() >>> print out [error from myapp regarding lack of input] </pre> <p>Any idea what I'm missing?</p>
python
[7]
2,120,121
2,120,122
C# creating an array with in an array of objects
<pre><code>using System; using System.IO; using System.Text; public class Movies { public string moviename { get; set; } public int cast { get; set; } public string[] castmember { get; set; } public override string ToString() { return string.Format("Movie: {0} \nCast #: {1} \nCast Member: {3}", moviename.ToString(), cast, castmember.ToString()); } } public class MovieData { public int NumberOfLines = 0; public string UserInput; public void ManageData() { string[] text = File.ReadAllLines("@File Path"); NumberOfLines = text.GetUpperBound(0); Movies[] movies = new Movies[NumberOfLines]; int i = 0; foreach (string line in text) { movies[i] = new Movies(); movies[i].moviename = Convert.ToString(line.Trim()); movies[i].cast = Convert.ToInt32(line.Trim()); int ii = movies[i].cast; //Here I want to create a movies[i].castmember[ii] with ii being the length } </code></pre> <p>I am trying to store data that is basically in line format, but there is a particular set of lines that would be more logical to store in an array. How would I go about creating a movies[i].castmember array with length of ii (cast)?</p>
c#
[0]
5,266,500
5,266,501
when to use self.property in init methods in objective-c, how to initialize arrays in init methods
<p>I'm confused on what the proper way to write custom init methods for youw own subclass in terms of memory management, custom subclasses, and arrays. If I have properties like:</p> <pre><code>@property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSMutableArray *array; @property (nonatomic, retain) SomeSubclassOfNSObject *object; @interface SomeSubclassofNSObject @property (nonatomic, retain) NSString *category; </code></pre> <p>How do I write my init method?</p> <p>do you do: </p> <pre><code>initWithName:(NSString *)aName object:(SomeSubclassOfNSObject *)anObject { if (self = [super init]) { self.name = aName; // or do you do name = aName or name = [aName copy] autorelease] or name = [NSString alloc] initWithFormat:@"%@", aName] self.object = anObject; // do I need to make a copy of this object so they don't point to the same object? // loop through NSMutableArray and copy the objects? // not really sure what to do for arrays. } return self; } </code></pre>
iphone
[8]
1,908,862
1,908,863
javascript file talk to script in html file
<p>Is there a way of calling a function that exists in a HTML file from a .js file?</p> <p>Something like this:</p> <p>HTML file:</p> <pre><code>&lt;script type="text/javascript" src="javaFile.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function doSomething() { }; &lt;/script&gt; </code></pre> <p>javaFile.JS file:</p> <pre><code>htmlFile.doSomething(); </code></pre> <p>? Thanks :)</p>
javascript
[3]
939,107
939,108
jQuery defining click function overrides all click functions
<p>Here is my code:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" &gt;&lt;/script&gt; &lt;script type="text/javascript" &gt; $(document).ready(function() { var qtypes = ['Text','Area']; for(qt in qtypes){ console.log('#submitQuestion' + qtypes[qt] + ' ' + qt); var name = '#submitQuestion' + qtypes[qt]; $(name).click(function(){ console.log('clicked ' + name); }); $('#submitQuestion' + qtypes[0]).click(); } $('#submitQuestion' + qtypes[0]).click(); $('#submitQuestion' + qtypes[1]).click(); }); &lt;/script&gt; &lt;input type="button" id="submitQuestionText" value="submit Question" /&gt; &lt;input type="button" id="submitQuestionArea" value="submit Area" /&gt; </code></pre> <p>Results in the console output:</p> <pre><code>#submitQuestionText 0 clicked #submitQuestionText #submitQuestionArea 1 clicked #submitQuestionArea clicked #submitQuestionArea clicked #submitQuestionArea </code></pre> <p>Why is using a for loop overriding all click() functions? I would expect to see the last two lines of the output to be:</p> <pre><code>clicked #submitQuestionText clicked #submitQuestionArea </code></pre>
jquery
[5]
1,297,751
1,297,752
Can we multiply two bytes directly by using * operator directly
<p>I need to perform the following operation on a byte <code> (2*x*x)+x </code> where x is a single byte. Can i perform that operation directly as we will do for int. If no how can we perform above operation.</p>
java
[1]
4,239,161
4,239,162
Java Percentage to show decimals
<p>I wrote a program today and I need to show percentage in my output but if I have an input of .05375 I need it to display as 5.375% I thought I could do that by using a NumberFormat but my final display is simply 5%. Is there a a way to make it show the decimals? Or how would I code around this? The program functions properly it's just that one output that needs to be formatted differently. Below is what I have for my output for that line of code right now.</p> <pre><code> System.out.println("Interest Rate: " + percent.format(InterestRate)); </code></pre>
java
[1]
5,780,237
5,780,238
What is the most memory-effective way of storing binary matrix in c#?
<p>How to store 2-dimensional arrayof logical values in c#, so that it takes least space?</p>
c#
[0]
1,489,895
1,489,896
problem with creation DLL file
<p>I try to convert cs file to DLL file .. </p> <p>when I am using Class Library project ... it works and create DLL file when I built the project , but when I create new file , as class file , and built it I don't found new dll file in project folder !! why ?? and when I am using the namespace , that is in the new file , in new project I don't found it . </p> <p>second , can I convert Any cs file in Any type of project like " Console project " into dll file ?? How ?? I am try to built it but any Dll file created !! </p>
c#
[0]
5,183,995
5,183,996
Java null pointer exception while using google maps in Android
<pre><code>package com.crumbin.tabs; import java.util.ArrayList; import java.util.HashMap; import org.apache.http.client.HttpClient; import android.content.Context; import android.database.Cursor; import android.location.Location; import android.location.LocationManager; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; import android.provider.ContactsContract.Contacts; import android.webkit.WebView; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; public class ExploreActivity extends MapActivity { public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(com.app.main.R.layout.user_main_tab_explore); MapView mv = (MapView)findViewById(com.app.main.R.id.myMapView); mv.setBuiltInZoomControls(true); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;com.google.android.maps.MapView android:id="@+id/myMapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="Mykey"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>This code gives me a java null pointer exception. I debugged it and found out that Mapview mv is null. </p> <p>Shouldn't this code just display the map and no overlay/data on it? Or am I missing something here?</p>
android
[4]
3,653,739
3,653,740
Application for reading the numbers from a scratch card in android (like a bar code reader)
<p>I want to create an application for android that is similar to a bar code reader app. but instead of reading the code it will read a 16 digit long number from a scratch card.</p> <p>(The scratch card number will be used for reloading the credit in the mobile.)The app will open the camera, read the 16 digit long number and will put that number in the dialer.</p> <p>Can any one help about from where should i start and how it can be achieved...?</p>
android
[4]
3,534,432
3,534,433
Dependency tree development for answer extraction
<p>I am working on a Question Answering System . I am planning to use the Syntactic and semantic tree kernels for extracting features of sentences and to finally extract the correct answer from a list of documents . I want to know what all tools/APIs I can use for developing the dependency parse tree kernel for applying the method proposed by Moschitti (2005) . I am working with the Java Platform . </p> <p>I have already found tools like Gate and SVM-light-TK 1.2 which do the same , but am not sure how to use them . If anyone has used them before or has information on how to use it and can suggest other tools , please help . Thanks in advance.</p>
java
[1]
189,833
189,834
python: printing horizontally rather than current default prining
<p>I was wondering if we can print like rowwise in python. I know its kinda stupid question.. or maybe not even important.. Basically I have a loop which might go on million times and i am printing out some strategic counts in that loop.. so it would be really cool if I can print like rowwise</p> <pre><code>print x # currently gives # 3 # 4 #.. and so on </code></pre> <p>and i am looking something like</p> <pre><code>print x # 3 4 </code></pre> <p>Any help and suggestion would be highly appreciated. :) Thakns alot</p>
python
[7]
760,836
760,837
python for loops and variables
<p>My first question, sorry if i've made a mistake or this has been answered before, I couldn't find it anyway.</p> <p>Here's a generic version of my code:</p> <pre><code>count = 0 classlist = [] for i in xrange(0,100): if random.random() &lt; 0.5: var_1 = 1 else: var_1 = 2 count += 5 classlist.append(Class(var_1,count)) </code></pre> <p>My problem is that after this loop has run, every instance of class has the final value of count (5*100 = 500 in this example).</p> <p>How can I create a list of class instances with different values of count?</p> <p>EDIT: indentation was correct.</p>
python
[7]
1,114,954
1,114,955
Order entitydatasource records
<p>I'm trying to order entitydatasource records like this: <code>orderby="Product_Num"</code> but it says: </p> <blockquote> <p>'Product_Num' is not a member of 'Transient.collection[productmodel.Products(Nullable=True,DefaultValue=)]'. To extract a property of a collection element, use a subquery to iterate over the collection.</p> </blockquote> <p>So, it means that It cannot order collection of Products. It needs some kind of subquery, but I'm not sure what exactly does it need.</p>
asp.net
[9]
1,050,122
1,050,123
Detect an application is installed or not?
<p>I have a application that registers a handler for custom URI on the Phone. I am able to launch the application by making a link to "myapp://act/launch" from my phone web pages. This works only if my application is installed on the device. What I want to do is detect if the URI Scheme is supported from the browser and then prompt my own message saying "please download the app etc..." if the handler for the URI scheme is not found.</p> <p>Is there a way I can detect or find the list of URL Scheme handlers on the Phone from the Web Browser ?</p>
android
[4]
5,262,800
5,262,801
whats wrong with this php hyperlinking validation script
<p>I have a website were users enters articles and their reference(like wikipedia). The reference which were saved in the database includes both web address and non web addresses.I got a hyperlink validation script from net ,below is the script and this is my similar but not same query in this site <a href="http://stackoverflow.com/questions/7789562/how-to-hyperlink-a-web-address-or-a-non-web-address-in-php">How to hyperlink a web address or a non web address in php</a></p> <pre><code> //url validation if (preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url)) { echo("&lt;br&gt;&lt;a rel=nofollow target=_blank href=". urlencode($row['ref'])." class=art&gt;$row[ref]&lt;/a&gt;"); } //if it is not a url else { echo("&lt;br&gt;&lt;a rel=nofollow target=_blank href='http://www.google.com/search?q=".urlencode($row['ref'])."' class=art&gt;$row[ref]&lt;/a&gt;"); } </code></pre> <p>script is working properly..but it seems the hyperlinking of webaddress is not happening(non webaddress working fine)</p> <pre><code> eg: if $url is http://www.washingtonpost.com </code></pre> <p>this script is hyperlinking as</p> <pre><code> www.mywebsite.com/http://www.washingtonpost.com </code></pre> <p>i actually want</p> <pre><code> http://www.washingtonpost.com </code></pre> <p>can you please help me and also advanced thanks for your help.</p>
php
[2]
5,290,936
5,290,937
Web Config Connection Setting
<p>I heve designed a website in which every pages are given connection with SQL server by writing the codes in each page....Can anybody helps me out to do this job only in the web config file at once...</p> <p>Thanks in advance..!</p>
asp.net
[9]
1,110,716
1,110,717
Call a function based on the device's screen size (hdpi/ldpi/mdpi)
<p>On mdpi device I would like to call this method:</p> <pre><code>final float scale = getResources().getDisplayMetrics().density; double height_px = 45 * scale + 0.5; </code></pre> <p>but I want to ignore the method when the app is run on hdpi devices, how am I able to determine the screen size on my class?</p>
android
[4]
1,022,363
1,022,364
Jquery to fade in .after()?
<p>Simple really but cannot get it to work, here is my script...</p> <pre><code>$('body').after('&lt;div id="lightBox" style="height: ' + htmlHeight + 'px;"&gt;&lt;/div&gt;'); </code></pre> <p>How can I get it to fade in rather than just pop up? putting fadeIn after or before .after() doesn't work?</p>
jquery
[5]
4,762,943
4,762,944
Jquery Animation to percent of page
<p>I'm using a simple jquery animation to display 4 div's onto the screen:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $("#boxa").animate({left: "+=100"}, 1000); $("#boxb").animate({left: "+=300"}, 1000); $("#boxc").animate({left: "+=600"}, 1000); $("#boxd").animate({left: "+=900"}, 1000); }); &lt;/script&gt; </code></pre> <p>is it possible to set the position move the boxes so that they move to their final positions distibuted evenly to the page width, so if the divbox width is set to 25% then the animations for each box animate to the correct position automatically?</p> <p>Thanks </p>
jquery
[5]
1,508,403
1,508,404
jQuery - find all elements without someone between
<p>For example we have such dom:</p> <pre><code>&lt;div id="main" class=".container"&gt; any other elements &lt;div&gt; &lt;span class="edit" /&gt; &lt;/div&gt; &lt;div class=".container"&gt; &lt;div class="edit"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How to make query, to select only first edit</p> <p>Something like $('#main .edit:not(.container between)')</p>
jquery
[5]
759,606
759,607
What is the best way to show contact details selected from phonebook
<p>Being the new one to android, I am asking this for your expert opinion,</p> <p>I am selecting Contact from Phone book and want to show its Phone no(user should choose one if many) &amp; email address.</p> <p>User can add three users.</p> <p>Want to store this. (Advise best way. Prefferences, DB or File Sharing)</p> <p>Urgent reply is requested</p>
android
[4]
3,063,038
3,063,039
PHP calender with Checkbox: How to populate checkbox from mysql
<p>I am trying to develop a calender with checkboxes for each date. By checking the check boxes users can insert dates into the database. For that I have written some codes which I have shown below and it is working okay. Now, the problem I am facing is to populate the inserted data in check boxes when people visit the page. I mean I want to have those check boxes selected if their information is already exist in database otherwise I want those to appear as unchecked. I want to show the data in the same page by which users can insert dates. Would you please kindly help me with this. Thanks in Advance.</p> <pre><code>&lt;form name="form1" method="post" action="show.php"&gt; &lt;?php $year = "2011"; $month = "8"; $d = cal_days_in_month(CAL_GREGORIAN, 1, 2011); $i=1; while ($i &lt;= $d) { ?&gt; &lt;input type="checkbox" name="date[]" value="&lt;? echo " $year-$month- " . $i . ""; ?&gt;"&gt; &lt;? echo " $year-$month- " . $i . "" . "&lt;br&gt;"; ?&gt; &lt;? $i++; } ?&gt; &lt;input type="submit" name="Submit" value="Submit"&gt; &lt;/form&gt; </code></pre>
php
[2]
2,905,664
2,905,665
Javascript: Assign value from the child page to parent page
<p>I have created a pop-up window using the following script.</p> <blockquote> <p>var CarricularWindow = window.open("AddCarriculars.aspx", "Extra Carriculars", "height=200, width=200");</p> </blockquote> <p>This pop-up window contains a TextBox and a button. Now, when the user enters some data on that textbox and clicks on the button. I want the data to be copied to a TextBox which is there on the calling page.</p> <p>How can I accomplish this?</p>
javascript
[3]
3,316,297
3,316,298
How to Run queries on datasets
<p>I wish to run query on datasets.</p> <p>Is it possible.</p> <p>If yes please give me an example and if not please suggest alternative solution. Thanks in advance</p>
c#
[0]
5,692,952
5,692,953
document.getElementByIdContains?
<p>Is there, by any chance, a way to solve this problem:</p> <p>I have elements that have IDs such as "x_y_z". The unique part is "x_y", thus there is no two items that have the same combination of x and y..</p> <p>However, using getElementById won't work because when I do it I only have the "x" and "y" part and not the Z (think of Z as a random incremental counter).</p> <p>Is there a way around this? So that when I have the "x" and "y" I say something like getElementByIdContains("x_y")?</p> <p>Thanks!</p>
javascript
[3]
4,386,163
4,386,164
Starting out with Objective C; need some guidance
<p>I have started learning Objective C with no prior programming experience from the 'Become an X-Coder' eBook (http://download.cocoalab.com.s3.amazonaws.com/BecomeAnXcoder.pdf). My question is, if I want to be doing iPhone development, am I going in the right direction? Am I learning the wrong language, or should I be learning Cocoa Touch? As I said, I have no prior experience, and just need someone to point me in the right direction. Apoligies if I have put this in the wrong place. Thanks very much for your time. </p>
iphone
[8]
1,587,150
1,587,151
Jquery sliding display built around moving a vertical stack of images
<p>How would I scroll a stack of images, horizontally, through a vertically aligned space? Imagine a layout like this:</p> <p>I have a viewable area, say a div, with a fixed size (50px wide by 300px tall) and overflow set to none to hide anything outside of it...</p> <p>That div has three images stacked vertically displayed inside it...</p> <p>On click of a button I want to move those three images off to the left while moving in another set of three images from the right.</p> <p>How do you do this? Should I create an unordered list for each set of three images and then move those UL's using javascript? This seems to make layout difficult. How would you approach this?</p>
jquery
[5]
4,062,312
4,062,313
Passing parameters to eventListener function
<p>I have this function check(e) that I'd like to be able to pass parameters from test() when I add it to the eventListener. Is this possible? Like say to get the mainlink variable to pass through the parameters. Is this even good to do?</p> <p>I put the javascript below, I also have it on jsbin: <a href="http://jsbin.com/ujahe3/9/edit" rel="nofollow">http://jsbin.com/ujahe3/9/edit</a></p> <pre><code>function test() { if (!document.getElementById('myid')) { var mainlink = document.getElementById('mainlink'); var newElem = document.createElement('span'); mainlink.appendChild(newElem); var linkElemAttrib = document.createAttribute('id'); linkElemAttrib.value = "myid"; newElem.setAttributeNode(linkElemAttrib); var linkElem = document.createElement('a'); newElem.appendChild(linkElem); var linkElemAttrib = document.createAttribute('href'); linkElemAttrib.value = "jsbin.com"; linkElem.setAttributeNode(linkElemAttrib); var linkElemText = document.createTextNode('new click me'); linkElem.appendChild(linkElemText); if (document.addEventListener) { document.addEventListener('click', check/*(WOULD LIKE TO PASS PARAMETERS HERE)*/, false); }; }; }; function check(e) { if (document.getElementById('myid')) { if (document.getElementById('myid').parentNode === document.getElementById('mainlink')) { var target = (e &amp;&amp; e.target) || (event &amp;&amp; event.srcElement); var obj = document.getElementById('mainlink'); if (target!= obj) { obj.removeChild(obj.lastChild); }; }; }; }; </code></pre>
javascript
[3]
1,496,312
1,496,313
Is it possible to use too many functions in Python?
<p>This kind of a broad question.</p> <p>As I find myself having to write longer and longer scripts, I find that my instinct is to break everything up into bite-sized functions; however, this ultimately results in functions calling functions calling functions calling functions.... and I'm wondering if I'm completely thinking about this the wrong way.</p> <p>Here's what an abridged script might look like. Sorry it's kind of contrived.</p> <pre><code>def simple_task_1(): return def simple_task_2(): return def simple_task_3(): return def simple_task_4(): return def complex_task_1(): simple_task_2() simple_task_3() simple_task_4() return def startup(): simple_task_1() complex_task_1() simple_task_4() def finish(): # other function calls return def main(): startup() finish() </code></pre> <p>So, is this the correct way to be using functions? Is there an objective point where you can say you've made too many function calls inside each other? Should I even be making functions for tasks that only end up being done once?</p>
python
[7]
2,811,650
2,811,651
jQuery-Select list option hover
<p>I want to alert an option when the mouse-cursor is over it. I use this code:</p> <pre><code>$("select &gt; option").hover(function () { alert($(this).attr("id")); }); </code></pre> <p>Unfortunately, this is neither working in IE nor in FF.</p> <p>Can someone give me a hint please?</p>
jquery
[5]
1,801,444
1,801,445
php: equivalent of $_FILES upload?
<p>I have to send a file to an API. The <a href="http://developer.brightcove.com/en/articles/easy-video-uploads-echove-sdk" rel="nofollow">API documentation</a> provides an example of how to do this through a file upload script ($_FILES). But, I have the files on the same machine, so would like to skip this step and just read in the file directly to save time.</p> <p>How can I read in the file (a video) so that it will work with this code snippet?</p> <p>I understand that FILES is an array, but I could set the other parts of it (the filename) seperately, I just really need the data part of it to be read in the same format to work with this code (do I use fread? file get contents?)</p> <pre><code>&lt;?php # Include &amp; Instantiate require('../echove.php'); $bc = new Echove( 'z9Jp-c3-KhWc4fqNf1JWz6SkLDlbO0m8UAwOjDBUSt0.', 'z9Jp-c3-KhWdkasdf74kaisaDaIK7239skaoKWUAwOjDBUSt0..' ); # Create new metadata $metaData = array( 'name' =&gt; $_POST['title'], 'shortDescription' =&gt; $_POST['shortDescription'] ); # Rename the video file $file = $_FILES['video']; rename($file['tmp_name'], '/tmp/' . $file['name']); $file_location = '/tmp/' . $file['name']; # Send video to Brightcove $id = $bc-&gt;createVideo($file_location, $metaData); </code></pre> <p>?></p> <p>Thanks in advance for any help!</p>
php
[2]
5,843,593
5,843,594
How to create Own media player in android
<p>I am new in android, could anyone help me to how to create my own media player in android</p> <p>Thanks in advance</p>
android
[4]
4,740,326
4,740,327
PHP Constants with variables
<p>I know this is probably a newbie question, but is it possible to do this?</p> <pre><code>unserialize(LOG_ACTIONS_.''.strtoupper($language)); </code></pre> <p>I have list of constants with _LANGUAGE which I want to use the variable $language with. </p> <p>Example:</p> <pre><code>unserialize(LOG_ACTIONS_ENGLISH); </code></pre> <p>Here's the error I get:</p> <pre><code>Fatal error: Call to undefined function LOG_ACTIONS_strtoupper() </code></pre>
php
[2]
1,973,367
1,973,368
finding the centre of dynamically generated divs
<p>I have a page that contain n amount of divs in columns of 3. The divs are potentially different widths, and some divs will contain one image, whereas some will contain two. Image number one is always centred in the div. Unfortunately, the way the page is generated it's impossible to have image number 2 sit a certain and consistent distance from image number one - which is what I'm trying to achieve.</p> <p>Each image number 2 has a unique asp.net client Id followed by icon e.g. ctl00_icon.</p> <p>Each image one has the same name - not my doing!</p> <p>Non of the divs have an id</p> <p>So what I thought about doing was - get the width of each div, divide it my 2, and use this to give my image 2 a reference point for positioning.</p> <p>Any pointers on how I might go about achieving this? Or is there a better way? Thanks Stu</p>
jquery
[5]
3,811,256
3,811,257
PHP optimization - include() or not
<p>I have two optimization question about the function include.</p> <ol> <li><p>Is it better to use a single php file and include it or use several little files and include them? Which one will be faster?</p></li> <li><p>For example, I use a PHP file with <code>mysql_connect</code> and all the db connection stuff. Then I include it when I need it. But will it be faster to just write the code when I need it and not include anything?</p></li> </ol> <p>Also if someone has the actual numbers, I will be a nice plus.</p>
php
[2]
759,339
759,340
how to write a random code in c#
<p>… I'm working on random in C# . I want to use a random to view string move in random &amp; this is the code which i write but it dosen't work i want to know what wrong i do </p> <pre><code>using system ; namespace work { static random random =new random(); static int max_X=console.windowwidth; static int max_Y=console.windowheight; static void main(string[] args) { int x=random.next(max_X); int y=random.next(max_Y); console.setcursorposition(x,y); console.write("walaa"); } } } </code></pre>
c#
[0]
1,629,613
1,629,614
while calculting the total of gridview cells using javascript getting exception
<p>I am calculating the total of one gridivew cells using javascript and displaying the resul in gridivew footer. but i am getting this exception <strong>Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object</strong></p> <p>Here is my code:</p> <pre><code>&lt;asp:GridView ID="gv" runat="server" AutoGenerateColumns="false" ShowFooter="true"&gt; &lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID="TextBox1" runat="server" onkeyup="Calculate('gv')" /&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;asp:TextBox ID="total" runat="server" Text="0" Width="83px"&gt;&lt;/asp:TextBox&gt; &lt;/FooterTemplate&gt; &lt;/Columns&gt; </code></pre> <p></p> <pre><code>&lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.5.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.10/jquery-ui.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function Calculate(GridView) { var total = 0; var gridview = document.getElementById(GridView); for ( i = 0; i &lt; gridview.rows.length; i ++) { var node = gridview.rows[i].cells[1].childNodes[1]; //textbox if (node != undefined &amp;&amp; node.type == "text") //check only textbox, ignore empty one if (!isNaN(node.value) &amp;&amp; node.value != "") //check for valid number total += parseInt(node.value); } document.getElementById("total").value = total.toString(); //display </code></pre> <p>} </p>
javascript
[3]
1,736,735
1,736,736
php if else & URL vars
<p>URL</p> <blockquote> <p>x.php?foo=100</p> </blockquote> <p>x.php</p> <pre><code>$x = $_GET['foo']; if ($x = 100) { echo "yeah"; }else{ echo "no"; } </code></pre> <p>My code doesnt work, where is error?</p>
php
[2]
5,524,614
5,524,615
Is it possible to get data from another application in android?
<p>I have downloaded an application from the android market. I just have to enter a number and on click of enter, that app generates a table with some contents.</p> <p>I want my application to copy the contents of the table. My application invoked that application. The user has to put the data in the edit text manually and then hit enter. My application would be running in the background till then.</p> <ol> <li>Is this possible?</li> <li>How?</li> </ol> <p>Another Question: Can i just take a screenshot of the 2nd application's screen and then use a image to text decoder to get the data on that screen?</p>
android
[4]
4,919,940
4,919,941
how can copy file to dictionary in c#
<p>how can copy file to dictionary in c#</p>
c#
[0]
371,795
371,796
Compare file extension to file header
<p>I'm starting to design an application, that will, in part, run through a directory of files and compare their extensions to their file headers.</p> <p>Does anyone have any advice as to the best way to approach this? I know I could simply have a lookup table that will contain the file's header signature. e.g., <code>JPEG: \xFF\xD8\xFF\xE0</code></p> <p>I was hoping there might be a simper way.</p> <p>Thanks in advance for your help.</p>
java
[1]
5,273,220
5,273,221
PreSaveAction is not firing
<p>Any idea why the PreSaveAction is not firing. I am trying to take the user to a thankyou page when they complete a survey. I added this js thru SP Designer to NewForm.aspx.</p> <pre><code>&lt;script type="text/javascript" src="'/_layouts/jQuery/jquery-1.6.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ // old handler: var buttonID = document.getElementById("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem"); var oldHandler = function() { if (!PreSaveItem()) return false; WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true)); }; // remove old and add new handler: var newHandler = function() { if (!PreSaveItem()) return false; &lt;input type="button" value="Finish" name="Submit" onclick="if (!PreSaveItem()) return false;{ddwrt:GenFireServerEvent('__commit;__redirect={/thankyou.aspx}');}" /&gt; //WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem", "", true, "", "", false, true)); //window.location.replace("/ThankYou.aspx"); return true; }; $("#ctl00_m_g_f46a290b_d993_4347_a2da_868aff18de82_ctl00_toolBarTbltop_RightRptControls_ctl01_ctl00_diidIOSaveItem").unbind("click", oldHandler).click(newHandler); }); &lt;/script&gt; </code></pre>
javascript
[3]
673,903
673,904
how show the data from array list in php
<p>i want to store retrieved data from database into an array list with limit.And display the data from that array list one by one with next button.have any answer for this? </p>
php
[2]
4,241,126
4,241,127
Short-circuit for If-else statement
<p>So I know </p> <pre><code>variable &amp;&amp; runTrue(); </code></pre> <p>really means</p> <pre><code>if(variable){ runTrue(); } </code></pre> <hr> <p>Then is there a more simplified way to write</p> <pre><code>if(variable){ runTrue(); }else{ runFalse(); } </code></pre> <p>instead of <code>if-else</code>?</p>
javascript
[3]
116,609
116,610
digital signature on android
<p>I am developing an android application which generates a type of document and this document requires a signature. need to know how I can capture a digital signature by a person for this document.</p>
android
[4]