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
4,395,638
4,395,639
Fix a id in JQuery
<p>I am using JQuery for my application.. Having a doubt on how to add a id to my element tr.</p> <p>My code is </p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function(){ var tr = document.createElement('tr'); var td1=document.createElement('td'); tr.appendChild(td); }); &lt;/script&gt; </code></pre> <p>I am trying to add an id to the tr element </p> <p>like </p> <p>EDIT : by $(tr).attr('id', 'entryRow'+increment); And resolved..Thanks</p>
jquery
[5]
158,001
158,002
fade and replace images without a fixed size
<p>I need to make a slideshow on a client's website, and am having troubles getting it right. The div cannot be a fixed size because the images auto resize inside a div which is the full width of the page. I have working code that does it with JavaScript, but I need to fade the images as well. I've played with adding the fadeIn function and it doesn't give me consistent results. Some help with this would be soo appreciated. Here's what I have:</p> <pre><code>(function() { var imageDir = 'images/'; var delayInSeconds = 6; var images = ['extensions.jpg', 'extensions2.png', 'girl.png']; var num = 0; var rotator = document.getElementById('slideimage'); var newImage = document.getElementById('slideimage'); var changeImage = function() { var oldImage = document.getElementById('slideimage'); var len = images.length; rotator.src = imageDir + images[num++]; if (num == len) { num = 0; };}; setInterval(changeImage, 5000); })(); </code></pre>
javascript
[3]
4,412,501
4,412,502
Display a sentence, one character at a time
<p>I want to display a sentence one character at a time, one by one, with jQuery. Is there a plugin that can do this Or how could I get this effect?</p>
jquery
[5]
3,769,192
3,769,193
Most efficient way to remove an element from an array, then reduce the size of the array
<p>Say I have an array of 10 elements. Another part of my program determines I must remove the item at index 4. </p> <p>What is the most efficient method to remove the item and shorten the array? </p> <p>I wrote the following method, however it does not seem to work properly. Am I missing something, for example if the index to remove is 0? The method is called by sending an array and the index to be removed.</p> <p>I realize there are Array Lists and other types of lists. However this is an assignment for a programming course and MUST use ARRAYs.</p> <pre><code>//Removes the index from the array and returns the array. NumberTile[] removeAndTrim(NumberTile[] array, int index){ NumberTile[] save = array; array = new NumberTile[save.length-1]; for (int i=0; i&lt;index; i++){ array[i]=save[i]; }//end for loop for (int j=index; j&lt;save.length-1; j++){ array[j]=save[(j+1)]; } return array; }//end removeAndTrim </code></pre>
java
[1]
1,437,249
1,437,250
How to make a TextView Text vertical
<p>I want a vertical label for my app. Is there a property to make text vertical? Here's what I mean vertical label: </p> <pre><code>S t a c k o v e r f l o w </code></pre> <p>thanks ahead.</p>
android
[4]
491,571
491,572
javascript not showing image in imgsrc
<p>i am using javascript to change the value of img src at run time.. i am using fileupload in html to take the input from use and i want that image to be uploaded in the "Image1" image tag.. but it is not uploading the image.. i am using:</p> <pre><code> function upl(obj) { filename = obj.value; alert(filename); document.getElementById('Image1').src = '"' + filename + '"'; alert(document.getElementById('Image1').src); } </code></pre> <p>in the alert it is showing image name along with the local url.. where i am calling upl() onchange of fileupload. can someone help me out.. thanks..</p>
javascript
[3]
3,336,501
3,336,502
How many halfscreen images can I add to an animated UIImageView before performance would start to suck?
<p>Does anyone have experience with this? I didn't try because I have no appropriate imagery for this, right now. But I wonder if the iPod touch is capable of displaying a fluid, movie-like animation out of fullscreen images (300 x 270)? I fear performance would suck dramatically.</p>
iphone
[8]
4,414,116
4,414,117
Take photo automatically
<p>In my app I want to take photo automatically every several seconds, so I tried to startActivity using the google IMAGE_CAPTURE intent and inject some key events. But I cant find the way to intent keyevent to activity not written by me. Anyone can suggest any other method?</p> <p>Or else I have to write my own photo taking activity(it would cause a lot of time...)</p>
android
[4]
858,894
858,895
Benefits of JavaScript anonymous function with namespaces
<p>Is there any benefit when writing JavaScript classes and namespaces of this...</p> <pre><code>if(typeof MyNamespace === 'undefined'){ var MyNamespace = {}; } (function(){ MyNamespace.MyClass = function(){ this.property = 'foo' return this; } }()); </code></pre> <p>Versus just this...</p> <pre><code>if(typeof MyNamespace === 'undefined'){ var MyNamespace = {}; } MyNamespace.MyClass = function(){ this.property = 'foo' return this; } </code></pre> <p>I have seen the first pattern implemented in a few libraries, and was trying to find how out if there is any added benefit unless some sort of other function was declared inside of the anonymous function in the first example.</p>
javascript
[3]
5,380,771
5,380,772
Why does a method with the same name as the class not need a return type?
<p>Why is this legal?:</p> <pre><code>public class TwoFrames extends JFrame { public TwoFrames() { return; }; } </code></pre> <p>And this isn't (NetBeans IDE saying <strong>invalid method declaration; return type required</strong>)?:</p> <pre><code>public class TwoFrames extends JFrame { public firstFrame() { return; }; } </code></pre>
java
[1]
3,324,574
3,324,575
Bug in bassistance form validation
<p>I'm trying to use bassistance form validation plugin</p> <p>I want to use the code demonstrated in <a href="http://jquery.bassistance.de/validate/demo/custom-methods-demo.html" rel="nofollow">this demo</a>.</p> <p>In the first <code>textbox</code>, it shows error until i type 3-digit value, then it shows OK, the bug starts to show when I delete some characters and make it less than 3 digits again, it shows an error message with an <em>ok</em> icon</p> <p>I checked the generated element with firebug and I noticed that it has both <code>error</code> and <code>sucess</code> css classes, it should have one of them at a time</p> <p>I tried to modify the success function in the demo source code as follows:</p> <pre><code>success: function(label) { label.text("ok!").addClass("success"); label.removeClass("error"); } </code></pre> <p>But it didn't work. I find this example really powerful and I hope to fix it and use it in my work.</p> <p>Any help is appreciated.</p>
jquery
[5]
237,414
237,415
Date.parse sends three extra zeroes when converting from utf-timecode
<p>I have a variable called</p> <pre><code>posts_object[i].updated_time </code></pre> <p>It's always an utf-timecode. It seems to always send three zeroes too much. A few examples:</p> <pre><code>Unix Date 1339705666000 · 2012-06-14T20:27:46+0000 1280403912000 · 2010-07-29T11:45:12+0000 1338635118000 · 2012-06-02T11:05:18+0000 </code></pre> <p>The code:</p> <pre><code>postobj.created=posts_object[i].updated_time.substring(0,10); var sortvar= (posts_object[i].updated_time); postobj.sort=Date.parse(sortvar); </code></pre>
javascript
[3]
3,128,725
3,128,726
Is JS autocomplete diff from other functions?
<p>I have this code:</p> <pre><code>$("input#autocomplete").autocomplete({ source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] }); </code></pre> <p>and it works. If I try to put anything else in there like:</p> <pre><code>$("input#autocomplete").autocomplete({ alert ("test"); source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"] }); </code></pre> <p>then it doesn't work and gives this error: syntax error: unexpected string.</p> <p>I was hoping to make an AJAX call before the source: call so that I can get the data to display to the user. Am I misunderstanding something in how this is supposed to work?</p> <p>Thanks!!</p>
jquery
[5]
606,889
606,890
Rookie C# problem
<p>I am a rookie to C# and here is my question</p> <hr> <pre><code>class myClass { int start; int end; ....... } class program { public void main() { myClass[] a= new myClass[10]; for (int i = 1; i &lt; a.length; i++) { myClass b = new myClass(); a[i] = b; a[i].start = 1; ... (keep populating) ... } console.writeline(a[1].start) // NO PROBLEM WITH THIS LINE, THE VALUE WAS OUTPUTED subMethod(a); } public void subMethod(myClass[] a) { console.write(a[1].start); // NO PROBLEM WITH THIS LINE, OUTPUT NORMALLY for (int i = 1; i &lt; a.length, i++) { int h = a[i].start; ????? OBJECT NOT INSTANTIATED } } } </code></pre> <hr> <p>The error is as indicated above and I have difficulty to understand it. Anyone can help me out. Thanks in advance</p>
c#
[0]
1,616,794
1,616,795
Encode URL parameters using Java
<p>I want to encode part of URL paramter in JAVA</p> <pre><code>http://statebuild-dev.com/iit-title/size.xml?id=(102T OR 140T) </code></pre> <p>to </p> <pre><code>http://statebuild-dev.com/iit-title/size.xml?id=(102%20OR%20140) </code></pre> <p>have tried using URI to encode but it also encodes ? which I do not want. In the URL I want to encode the part after '=' </p> <pre><code>URI uri = new URI("http", "statebuild-dev.com/iit-title", "/size.xml?id=(102 OR 140)", null); //URL url = uri.toURL(); System.out.println(uri.toString()); System.out.println(url1); </code></pre> <p>Thank You</p>
java
[1]
2,402,358
2,402,359
fingerprint reader
<p>i have a fingerprint reader device for pc but now i want to connect that fingerprint reader to my android mobile ?anyone help me which is the usb connector for this???</p>
android
[4]
2,454,037
2,454,038
Value stored to seconds during its initialization is never read
<pre><code>float seconds = audioPlayer.currentTime; if ((seconds = 11)){ [self performSelector:@selector(viewController) withObject:nil]; } else { if ((seconds = 23)){ [self performSelector:@selector(secondViewController) withObject:nil]; } else { } </code></pre> <p>Anyidea how to fix this message in blue when i just want to see if audioplayer current playback time is 11 then do this or 23 then do that</p>
iphone
[8]
924,471
924,472
Is the "X-Mailer: PHP/<phpversion>" header required to send a mail in PHP?
<p>A lot of examples I found online about sending emails with php set the header</p> <pre><code>"X-Mailer: PHP/" . phpversion() </code></pre> <p>But I find disclosing I'm using php and its version a very bad security practice.</p> <p>Is this a required header?</p>
php
[2]
934,263
934,264
Do If statements stop code after it being executed?
<p>I have an order form script with a function in which says if the job will take longer than x flash up a message. Script works fine if i leave my if statement out, but If i put it in it only executes if X variable meets the if condition, does this make sense? </p> <p>My Script is...</p> <pre><code>if (EstimatedCoreHours &gt;= 50000) { document.getElementById("AccountManagement").innerHTML='You have a big Job on your hands - Contact Us!'; document.getElementById("AccountManagement").style.backgroundColor="yellow"; } else { document.getElementById("AccountManagement").innerHTML=''; document.getElementById("ContBtn").style.display=""; } if (EstimatedCoreHours &gt;= 100000) { document.getElementById("LeadTimes").innerHTML='5 Business Days!'; document.getElementById("LeadTimes").style.backgroundColor="yellow"; } else if (EstimatedCoreHours &gt;=25000) { document.getElementById("LeadTimes").innerHTML='2 Days'; document.getElementById("LeadTimes").style.backgroundColor="yellow"; } else { document.getElementById("LeadTimes").innerHTML='Right Away'; document.getElementById("LeadTimes").style.backgroundColor="yellow"; } </code></pre>
javascript
[3]
4,525,907
4,525,908
Specifying startup window/form location on multiple displays
<p>I have two displays (two monitors) connected to my machine, and I noticed a strange thing happening today. I had an Explorer window open with my compiled exe on my primary display, and when I double-clicked it, it opened in the primary display (left monitor). However if I pressed enter to launch the executable, it started in the secondary display (right monitor). The window state of the initial form is maximized. Is there a way to tell C# to open the initial form in the primary display?</p>
c#
[0]
1,796,670
1,796,671
Update Label text from XML
<p>I have an XML will is parsed and then fed to a bunch of Labels. </p> <p>I am trying to add a live element so that the labels refresh automatically from the XML.</p> <p>From what I've read this is possible using a tableView and [tableView reloadData] but the design dictates the use of labels. At the moment the labels only get updated on restarting the app, which is not ideal.</p> <p>Using ViewWillAppear is one option, but want to stick to using lables.</p>
iphone
[8]
5,401,141
5,401,142
How do I compare file's signature to a database of signatures?
<p>I have a database stored in memory of different files headers. I would like to test the signature of a given file for example a .jpg to those signatures in the database. </p> <p>Consider that scenario, the signature of the file to be tested is FFD8FFE0, but in the database, there is only a partially matched signature of FFD8FF, and some times, the database has also a signature of FFD8, but to a different type but to the same file format. How do I correctly retrieve the correct matched signature of the tested file ?</p> <p>I wrote the following function but it doesn't work in all file formats. </p> <pre><code> public static boolean searchSignature(File file, List&lt;FileSignature&gt; db) throws FileNotFoundException, IOException { byte[] buffer = new byte[MAX_SIGNATURE_SIZE]; InputStream in = new FileInputStream(file); int n = in.read(buffer, 0, MAX_SIGNATURE_SIZE); String hex = toHex(buffer); boolean b = true; // for each signature in the database, compare it with file's siganture for (FileSignature fs : db) { if (!fs.getSignature().contains(hex)) { b = false; } } return b; } </code></pre>
java
[1]
3,158,357
3,158,358
Where to store data used in different Android activities?
<p>In my application, I have one activity, which connects to the server and gets certain user information from it. Then, it launches another activity where that information should be processed.</p> <p>What is the correct way to pass data between activities in Android?</p>
android
[4]
5,966,550
5,966,551
Input fields won't allow some operators to be printed
<p>I have an input form which I use in order to post some data in the database, the issue is it won't allow me to post characters like "+", "&amp;" etc..</p> <p>Now I've used this format:</p> <pre><code>$postPagesashtepi = $_POST["postPagesashtepi"]; </code></pre> <p>The form looks like this:</p> <pre><code>&lt;input id="pagesashtepi" name="pagesashtepi" type="text" size="40" value="&lt;?php echo $row['pagesashtepi'];?&gt; </code></pre> <p>I've also used <code>filter sanitized</code> too but no success again.. Can someone help me with this?</p>
php
[2]
1,260,280
1,260,281
C# Interfaces Question
<p>I'm trying to understand interfaces. </p> <p>From what I know about interfaces is that they are used along with classes and allows a class to be attached to an interface class? I don't quite understand the concept. When and why would I want to use this? I'm reading from a book it was to put behaviors into classes then by interfacing a common object can have multiple behaviors? </p> <p>creating something like </p> <pre><code> Vehicle myObject = new Vehicle(); Interface1 something = myObject; something.someFunc(); Interface Interface1 { void someFunc(); } </code></pre>
c#
[0]
235,992
235,993
Java equals ordo value
<p>What is the Ordo for a java equals method? We dont know what type the objects that are being compared are. Does it make it a O(1) because its constant time for comparing object?</p> <p>example: X.equals(Y)</p>
java
[1]
5,200,142
5,200,143
How can I found a specific data in jpg image file by PHP
<p>I have a very much of jpg images, these images are copy of contract. and i need PHP script that can check these images if it had a fingerprint and stamp and barcode and image of person. Thanks in advance.</p>
php
[2]
1,758,532
1,758,533
UITextField lose focus event
<p>I have an UITextField in a MyCustomUIView class and when the UITextField loses focus, I'd like to hide the field and show something else in place.</p> <p>The delegate for the UITextField is set to MyCustomUIView via IB and I also have 'Did End On Exit' and 'Editing Did End' events pointing to an IBAction method within MyCustomUIView.</p> <pre><code>@interface MyCustomUIView : UIView { IBOutlet UITextField *myTextField; } -(IBAction)textFieldLostFocus:(UITextField *)textField; @end </code></pre> <p>However, neither of these events seem to get fired when the UITextField loses focus. How do you trap/look for this event?</p> <p>The delegate for the UITextField is set as 'MyCustomUIView' so I am receiving 'textFieldShouldReturn' message to dismiss the keyboard when done. </p> <p>But what I'm also interested in is figuring when the user presses some other area on the screen (say another control or just blank area) and the text field has lost focus.</p>
iphone
[8]
5,572,518
5,572,519
Change Background Color with mouse Over reference by class JQuery
<p>I have given class to a group of div's and want to change the background color of a div on mouse over it. What I did is this : <br> <strong>HTML</strong></p> <pre><code>&lt;div class="menu_top"&gt; &lt;div id="1" class="menu_top_menu"&gt;Home&lt;/div&gt; &lt;div id="2" class="menu_top_menu"&gt;About Us&lt;/div&gt; &lt;div id="3" class="menu_top_menu"&gt;Register&lt;/div&gt; &lt;div id="4" class="menu_top_menu"&gt;Contact Us&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>JQuery</strong></p> <pre><code>$(document).ready(function() { $('.menu_top_menu').mouseover(function(){ $('this').attr('style','background-color:yellow;'); }); }); </code></pre> <p>This do work with ID reference but I want to work with class. What am I doing Wrong ?</p>
jquery
[5]
3,238,727
3,238,728
c++ call a method from one class of other class
<p>I have two classes </p> <pre><code>Class A { char * param1; char * param2; void SetParam1(const char * ptr) { param1 = new char[strlen(ptr) + 1]; strcpy(param1,ptr); } void SetParam2(const char * ptr) { param2 = new char[strlen(ptr) + 1]; strcpy(param2,ptr); } void DoWork() { B obj; //use this object to do some work } }; </code></pre> <p>Now there is a class B which is</p> <pre><code> Class B { char * param3; char * param4; void Exec(); }; </code></pre> <p>How can i use <code>param1</code> and <code>param2</code> in class B's <code>Exec</code> method without having to make them a member of class B and allocate memory as was done for "class A".</p>
c++
[6]
1,981,075
1,981,076
Javascript validation
<p>My issue is i need to validate the Card(Master, Visa, etc). In this i have to check different condition for different cards.. and i am using the following way to validate..</p> <pre><code>"CardNumber" : ["CardNumber", /^[51-55]{16}$/, true, "Please enter the valid card number."] </code></pre> <p>here i can check only master card and i need to check many card.. and the card number is the name of the text box of card number which we get from the user and the Card types are shown in a drop down and its name would be Card type,,, so how i need to use the above validation for all all card type....</p>
javascript
[3]
4,414,692
4,414,693
Clear shared preference by hand
<p>I'm writing login capability using share preference. I use SharedPreferences.Editor::commit() to store username and password; read it from shared_prefs to check login. After logging in, I cd to /data/data/com.&lt; my_package >/shared_prefs/ and remove the "shared_prefs" folder. The problem is the application screen is still in login status. <strong>I tried to Back and restart the application but it's still in login status. Does removing the "shared_prefs" by hand clear the prefs completely?</strong> Why is my app still in login status?</p>
android
[4]
5,609,876
5,609,877
Bookmarklet to populate form?
<p>I would like to create a bookmarklet that would take the current URL that the person is on and pass it to a form on another website. The form is a POST and cannot be converted to a GET. Sounds similar to: <a href="http://stackoverflow.com/questions/11024021/bookmarklet-to-pass-url-to-form-field">Bookmarklet to pass URL to form field</a> but that did not work for me (page did not change at all). The form I am trying to populate is very simple and only has 1 field that is requesting the URL.</p> <p>Thanks in advance!</p>
javascript
[3]
5,462,463
5,462,464
Problem reading file from URL - permission denied
<p>I was trying to connect to some host like this</p> <pre><code> url = new URL(urlString); BufferedReader in = new BufferedReader( new InputStreamReader( url.openStream())); </code></pre> <p>but I always get MalformedException - permission denied, I need to provide username and password ( which I know ) but I don't know how, there is no constructor in URL with those parametere neither setusername/password methods. Where to put username and password ?</p>
java
[1]
4,982,372
4,982,373
Why passing an integer matches an object method rather than premitive type method
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3674368/overload-resolution-and-virtual-methods">Overload resolution and virtual methods</a> </p> </blockquote> <p>If i call this , why object method is being called?</p> <pre><code>Classes.Class2 c = new Classes.Class2(); c.GetJ(1); public class Class1 { public virtual void GetJ(int j) { } } class Class2:Class1 { public override void GetJ(int j) { int j3 = 8; } public void GetJ(object j) { int j1 = 82; } } </code></pre>
c#
[0]
97,903
97,904
How to set the language as French of my android application?
<p>I have to change my application's language to French programmatically, so all texts a should be displayed in french.My app has set of activities and one background service so activity can registered with service and send and receive information from the server. Server will send data in French language so i need to display the same as well as if user wants to update any text on edit text then it should popup the Querty key pad with french characters support.</p> <p>Please help me to resolve it.</p> <p>Regards, Piks. </p>
android
[4]
2,445,918
2,445,919
Get the URL of the file where is declared the function
<p>I can't find anything on the web. The keyword I used all give me more traditional answers.</p> <p>I am working on an embeder for a Flash file. I want to have a folder with the flash file and the javascript code to embed it properly.</p> <p>My question is, how do I get the path to my Flah file? I have the relative URL from the js file, but if I make a request from the js it will take the URL of the html page, right?</p> <p>In Flash, the behaviour is the same, but you can get the url where the SWF file is hosted. I this it also exists with PHP. How do you do that with a javascript file?</p> <p>I know I must have the URL in the HTML anyhow, since I load the js file. And I can send it to the function I call as a parameter. But I am trying to make it as simple as possible to instal, so if this function exist I'd like to know of it.</p> <p>Thanks.</p> <p>EDIT:</p> <p>Finaly, I used some PHP, who can locate himself easily using $_SERVER["PHP_SELF"], to add some parameter to a javascript file.</p> <p>You embed the PHP request the same way you would a javascript file.</p> <p>Works like a charm.</p>
javascript
[3]
1,696,552
1,696,553
check whether a $_POST exists and value
<p>i am trying to check if $_POST exists and check only for a specific value. in my code i am trying to check for data header=h1. the code works, it checks for data header but i do not know how to specify for value of header i.e check for header=h1</p> <pre><code>if ($_POST['data']['header']){ $myBuildPath = Config::$buildPath.Users::$userid.'/'.$item[$this-&gt;mainModel-&gt;primaryKey].'/'; foreach (Config::$repository['headersCustomDest'] as $file =&gt; $fileDestPath){ $dest_file = $myBuildPath.$fileDestPath; if(file_exists($file)) full_copy($file,$dest_file); else echo $file.' does not exist.'; } </code></pre> <p>all assistance appreciated...thanx!</p>
php
[2]
3,926,325
3,926,326
how to implement color picker in java swing
<p>i have used JColorChooser but look and feel is not that much great, any other way to implement color picker using java swing</p>
java
[1]
1,033,035
1,033,036
What is the difference between INT, INT16, INT32 and INT64?
<p>I need to know about the difference of <code>INT</code>, <code>INT16</code>, <code>INT32</code> and <code>INT64</code> other than its size?</p>
c#
[0]
4,926,016
4,926,017
Function references - Please enlighten!
<p>Could anyone explain why the two below are not equal? I'm basically trying to figure out what's happening behind the scenes. My understanding was that they'd both refer to the same function but that doesn't seem to be the case.</p> <pre><code>var foo = function bar() {} typeof foo //"function" typeof bar //"function" foo === bar //false foo == bar //false </code></pre>
javascript
[3]
766,119
766,120
jQuery plugin for contextual menu
<p>Hello i need to have a fancy jQuery contextual menu for my web app; when the user clicks a point i would like to show a menu as a ballon or other graphical items with different options.</p> <p>Can anyone point me toward a similar example?</p> <p>Thanks and greetings c.</p>
jquery
[5]
4,033,854
4,033,855
asp.net - change column to hyperlink column
<p>I have the following column:</p> <pre><code> &lt;asp:BoundField DataField="ProID" HeaderStyle-BackColor="#0066cc" HeaderStyle-Font-Size="7pt" HeaderStyle-HorizontalAlign="center" HeaderText="ProID" ItemStyle-HorizontalAlign="center" /&gt; </code></pre> <p>How do I make this into a hyperlink column?</p> <p>I tried the following:</p> <pre><code> &lt;asp:HyperLinkColumn DataNavigateUrlField="ProID" DataNavigateUrlFormatString="pro.aspx?pro={0}" DataTextField="ProID" HeaderText="ProID" SortExpression="ProID"&gt; &lt;HeaderStyle HorizontalAlign="Left" /&gt; &lt;ItemStyle HorizontalAlign="Left" /&gt; &lt;/asp:HyperLinkColumn&gt; </code></pre> <p>Not sure why it is giving me this message. My goal is simply to make that column into a hyplink so that I can have the user to to the designated page.</p> <p>but getting HyperLinkColumn' is not a known element. This can occur if there is a compilation error in the Web site</p>
asp.net
[9]
2,814,893
2,814,894
Application Variable Vs Web.Config Variable
<p>Which is better from a performance perspective?</p> <ul> <li>Accessing a Global Application Variable (Application["foo"])</li> </ul> <p>versus</p> <ul> <li>Accessing an AppSetting variable from the web.config</li> </ul> <p>Does .NET Cache the AppSetting variables so that it is not accessing the web.config file with every use?</p>
asp.net
[9]
4,289,820
4,289,821
In javascript, alias namespace?
<p>In javascript, shouldn't I alias a namespace?</p> <p>In the <em>Naming</em> chapter of <em><a href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Naming#Naming">Google JavaScript Style Guide</a></em>, it says:</p> <pre><code>//Do not alias namespaces. myapp.main = function() { var namespace = some.long.namespace; namespace.MyClass.staticHelper(new namespace.MyClass()); }; </code></pre> <p>But I cannot fully understand this issue. Why not alias a namespace for brevity?</p>
javascript
[3]
4,374,922
4,374,923
I want to get property value from code behind
<p>I have a case that I need to set the Text property for an asp label in the aspx page not from code behind. More exactly, I need to set a value to asp control in aspx page and this value is set by a property in the same page code behind.</p> <p>so I need to use an expression to do that like:</p> <pre><code>&lt;asp:Label Text="&lt;%= MyProperty %&gt;" ..../&gt; </code></pre> <p>I use:</p> <pre><code>&lt;%= MyProperty %&gt; doesn't work. &lt;%# MyProperty %&gt; doesn't also. </code></pre>
asp.net
[9]
4,365,706
4,365,707
How do I get around uninitialized global variables in another module in Python?
<p>I have a problem where I'm trying to use a function from another module but that function calls a debug function which checks if a global variable has a certain attribute. This global variable is not set (otherwise set using <code>parser.parse_args</code>) when I import the function so the function complains that the attribute doesn't exist. For clarification: </p> <p>File <code>findfile.py</code>:</p> <pre><code>_args = {} def _debug(msg): if _TEST and _args.debug: print msg def findfile(filename): ... _debug("found file") ... if __name__ == "__main__": ... _args = parser.parse_args() ... </code></pre> <p>File <code>copyafile.py</code></p> <pre><code>import findfile findfile.findfile("file1") </code></pre> <p>This gives me</p> <pre><code>AttributeError: 'dict' object has no attribute 'debug' </code></pre> <p>Now I understand that <code>parser.parse_args()</code> returns a namespace (??) and that <code>_args.debug</code> isn't really looking in the <code>dict</code>. But my question is: How can I in this situation properly assign something to <code>_args</code> to set the <code>_args.debug</code> to <code>False</code>?</p> <p><strong>I can not change <code>findfile.py</code> but I can change <code>copyafile.py</code>.</strong></p> <p>How are these things usually handled otherwise? What is the pythonic way of enabling debug flags in a script?</p>
python
[7]
844,347
844,348
Convert a ResultSet value into XML?
<p>Is it possible to convert the value of a ResultSet (result of a query execution) into XML??! If so which API would deal with this?!</p>
java
[1]
5,793,893
5,793,894
Best option to access youtube videos in android application?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/574195/android-youtube-app-play-video-intent">Android YouTube app Play Video Intent</a> </p> </blockquote> <p>I am going to implement the application which access the youtube video. Am new to android and kindly give me some links of sample programs related to my application.</p> <p>Thanks in advance.</p>
android
[4]
95,382
95,383
GridView values not changing on value change of the combobox it is bound to
<p>I have two 2 dropdown lists D1 and D2 and a griview G1. D2 gets updated when selected value in D1 changes, through a postback. G1 gets updated when selected value in D2 changes.</p> <p>The problem is, Data in G1 gets refreshed only if I explicitely change the value in D2. When I change value in D1, D2 automatically gets refreshed, but G1 shows the old value. How to make G1 refresh? </p> <p>I added a G1.DataBind() inside D1_SelectedIndexChanged, but still it retains the old value.</p>
asp.net
[9]
4,690,240
4,690,241
Displaying loading image for a long time in jquery
<p>Hi I want to know is there any technique through which I can control the time for which the loading image using jquery can be displayed for a long time. For example:</p> <pre><code>$('#ajax').html('&lt;img src="ajax.gif"/&gt;'); $('#iframe').load('file.php'); </code></pre> <p>Now I want to know is there any way through which I can display the ajax.gif for a specified amount of time? Please let me know.</p>
jquery
[5]
3,097,525
3,097,526
startActivity and startSubActivity
<p>Can anyone tell me the Difference between startActivity and startActivityForResult</p> <p>is startActivity is used to call activity asynchronously and startActivityForResultfor synchronous call ? </p> <p>startActivity(intent) and startActivityForResult(intent,-1) are same ?</p>
android
[4]
62,930
62,931
How to possible user subscription in i-contact in android?
<p>I make user subscription in my android application.Also made this user subscription in php example at this link </p> <p><a href="http://www.softwareprojects.com/resources/programming/t-icontact-20-api-integration-php-example-1925.html" rel="nofollow">http://www.softwareprojects.com/resources/programming/t-icontact-20-api-integration-php-example-1925.html</a> </p> <p>please give me android source code example.</p>
android
[4]
3,599,844
3,599,845
How to make two WORD to DWORD
<pre><code> short val1 = short.MaxValue; short val2 = short.MaxValue; int result = val1; result |= val2 &lt;&lt; 16; Console.WriteLine( "Result =\t" + result ); //2147450879 Console.WriteLine( "Expected =\t" + int.MaxValue ); //2147483647 </code></pre>
c#
[0]
1,502,511
1,502,512
Method-Chaining in C#
<p>I have actually no idea of what this is called in c#. But i want to add the functionallity to my class to add multiple items at the same time.</p> <pre><code>myObj.AddItem(mItem).AddItem(mItem2).AddItem(mItem3); </code></pre>
c#
[0]
360,954
360,955
Prevent a method from being called if it is incorrect using __getattr__
<p>I am trying to prevent an instance from throwing an exception if a method that does not exist for the instance is called. I have tried the following:</p> <pre><code>class myClass(object): def __init__(self): pass def __getattr__(self,name): print "Warning - method {0} does not exist for this instance".format(name) o = myClass() var = o.someNonExistantFunction() </code></pre> <p>The problem is that I get the following error:</p> <pre><code>TypeError: 'NoneType' object is not callable </code></pre> <p>The two things I want to make sure of doing is:</p> <ol> <li>Return <code>None</code> as my code can deal with variables being set to <code>None</code></li> <li>Perform a function (printing a warning message)</li> </ol> <p>What is the cleanest way to do this?</p>
python
[7]
5,288,763
5,288,764
how to add a Ymail/Gmail share button in android app?
<p>hi friends i have a custom list coming from server and i want to add two share buttons for Gmail and Ymail resp. in that , its like when i click the Ymail share button it asks for username and password and then redirects me into the compose message section with message body as the link of the respective list and then i can access my contacts to send it to anyone i like. 1. please tell me how to do this?? 2. is there any sdk available for Ymail/gmail</p> <p>please suggest something..thanks in advance</p>
android
[4]
5,656,067
5,656,068
Is it possible to access UIBarButtonItem using tag?
<p>I hope to access UIBarButtonItem on an UIToolbar using tag. The codes show below</p> <pre><code>UIBarButtonItem *myBarButtonItem=(UIBarButtonItem*)myUIToolBar.items[i]; </code></pre> <p>but myBarButtonItem returns no object(0x0)</p>
iphone
[8]
4,869,388
4,869,389
jQuery: how to select the text in a text input
<p>I'm trying to create a button linked to a text field that will let me select all the text in a textarea so the user can copy it to the clipboard. I've tried this:</p> <pre><code>$('#selectCode').click(function() { var input = $('#MyTextBox'); input.focus(); input.select(); }); </code></pre> <p>based on several examples I found online where you focus on the input and then select it. But this doesn't seem to work in jQuery -- at least the way I'm doing it. Can someone help?</p>
jquery
[5]
141,730
141,731
FIPS County Code Lookup
<p>I'm looking for a library, or some sort of method in Python to return a county name from a <a href="http://en.wikipedia.org/wiki/FIPS_county_code" rel="nofollow">county code</a> such as 48235 which is Irion County, TX.</p>
python
[7]
5,353,008
5,353,009
store image and audio file in android internal storage
<p>how to store image and audio files in android internal storage</p> <p>and how to retrieve back to display image imageview </p> <p>Thanks in advance</p> <p>Aswan </p>
android
[4]
4,065,337
4,065,338
Unlock without pressing hard key in android
<p>Can anybody know how to unlock a screen without pressing hard key..? or how to wake a screen without pressing hard key when phone is in locked state.</p> <p>Thanks in advance</p>
android
[4]
1,221,736
1,221,737
Javascript Date (Year)
<pre><code>&lt;script language="JavaScript"&gt; &lt;!-- Hide from older browser var x= new Date() var y= x.getYear() var m= x.getMonth()+1 // added +1 because javascript counts month from 0 var d= x.getDate() var h= x.getHours() var mi= x.getMinutes() var s= x.getSeconds() document.write("Today's date is: ") document.write(m+'/'+d+'/'+y+' '+h+'.'+mi+'.'+s) //--&gt; &lt;/script&gt; </code></pre> <p>E.g Today date is 10 - 10 - 2011 ( d-m-Y) format When i tested in Firefox 6.02 and Chrome 14 .0385 and opera 10.53 safari 5 : Today's date is: 10/10/111 18.1.6 On internet explorer ie8 :Today's date is: 10/10/2011 18.3.47 ** i testing other thing.. but don't know why year getting wrong output except internet explorer.Or other browser had different implementation getting year. ?? ** print screen of the browser available if required.. link image <a href="http://imageshack.us/photo/my-images/502/javascriptdate.png/" rel="nofollow">http://imageshack.us/photo/my-images/502/javascriptdate.png/</a></p>
javascript
[3]
4,877,699
4,877,700
import error while bundling using py2exe
<p>I bundled a small script written in python using py2exe. The script uses many packages and one of them is reportlab. After bundling using py2exe I tried to run the executable file and it is returning following error:</p> <pre><code>C:\Python26\dist&gt;DELchek.exe Traceback (most recent call last): File "DELchek.py", line 12, in &lt;module&gt; File "reportlab\pdfgen\canvas.pyc", line 25, in &lt; File "reportlab\pdfbase\pdfdoc.pyc", line 22, in File "reportlab\pdfbase\pdfmetrics.pyc", line 23, File "reportlab\pdfbase\_fontdata.pyc", line 158, ImportError: No module named _fontdata_enc_winansi </code></pre> <p>But I could see the '_fontdata_enc_winansi' module in reportlab folder. Could someone help me to fix this.</p>
python
[7]
4,552,335
4,552,336
Heap sizes for different Android devices
<p>Hi this question was asked a while ago, I'm wondering if the situation has changed.</p> <p>Is there a comprehensive list of (or any way to find out) the size of heap for various Android devices.</p> <p>I understand they range from 16mg to 48mg+. If you can't tell in advance is there anyway to tell from the market, so that your app is only available to be downloaded by devices with a sufficient size heap.</p> <p>The reason I ask is that I'm writing a game which is "graphics heavy". This means that there is scope to easily create different versions of the game with different memory requirements. But of course you need to be able to organise your versions so that they are available to the correct devices.</p>
android
[4]
5,234,853
5,234,854
Map actors and their movie onto a dictionary
<pre><code>def parse_actor_data(actor_data): while 1: line = actor_data.readline().strip() if line.count('-') &gt; 5: break actor_movie = {} values = [] actor_name = '' running_list = [] movie = [] for line in actor_data: position = line.find(')') running = line[:position + 1] value = running.split('\t') for k in value: if k != '': running_list.append(k) actor_name_list = value[0].split(',') actor_name = actor_name_list[0] + actor_name_list[-1] for i in range(len(running_list)): if value[0] == running_list[i]: position2 = i movie = running_list[position2+1:] actor_movie[actor_name] = movie check = actor_movie.keys() for c in range(len(check)): if len(check[c]) &lt; 1: actor_movie.pop(check[c]) return actor_movie </code></pre> <p>Problem I'm having now is that only the first item of movie is added into the actor_movie anyone can help? i tried so long for this already i seriously have no idea why isn't this working...</p>
python
[7]
673,616
673,617
Starting an activity from a random class
<p>I've adapted the <code>GridInputProcessor</code>-class of the 3D-Gallery ( <a href="http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git;a=blob;f=src/com/cooliris/media/GridInputProcessor.java;h=91dfd4783be6b21ec8ff2518a5c244752570e90d;hb=HEAD" rel="nofollow">http://android.git.kernel.org/?p=platform/packages/apps/Gallery3D.git;a=blob;f=src/com/cooliris/media/GridInputProcessor.java;h=91dfd4783be6b21ec8ff2518a5c244752570e90d;hb=HEAD</a> ) so that it detects upward/downward swipes.</p> <p>The detection of swipes works, but I now want to start another activity (or draw a bitmap on the currently displayed activity), but I seemingly can't use <code>startActivity(mContext, myIntent)</code>, because the class declaration is <code>public final class GridInputProcessor implements GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {</code> so it doesn't extend <code>Activity</code>...</p> <p>Can I still start an Activity through this class, or how would I go about doing this? I have also tried sending a broadcast, but this is also not "implemented".</p> <p>Thanks, Nick</p>
android
[4]
1,519,503
1,519,504
How To switch between themes?
<p>I want to change CSS file due the user choice in select list :</p> <pre><code>&lt;select&gt; &lt;option&gt;light&lt;/option&gt; &lt;option&gt;dark&lt;/option&gt; &lt;/select&gt; </code></pre> <p>so when chosen light the css file will be light.css and when Dark so dark.css And save this coice in the cookies or whatever . Thanks !</p>
php
[2]
185,259
185,260
How To hide status bar and disable home button at the same time?
<p>I'm new here in this forum. And I have the same question with @MindWire at this following link.<a href="http://stackoverflow.com/questions/8422204/disable-home-button-and-have-application-full-screen-with-no-title-no-status-ba">The link</a></p> <p>I'm developing a screen lock on Android in a project.The question is when I prevent home button, the title bar will be enabled and appear. Just like what the problem MindWire met. </p> <p>I don't know how to connect with him and home someone can help me with this question.</p>
android
[4]
525,153
525,154
Java Cloning - deep copy and shallow copy
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/2657810/deep-copy-vs-shallow-copy">Deep copy vs Shallow Copy</a><br> <a href="http://stackoverflow.com/questions/1175620/in-java-what-is-a-shallow-copy">In Java, what is a shallow copy?</a><br> <a href="http://stackoverflow.com/questions/184710/what-is-the-difference-between-a-deep-copy-and-a-shallow-copy">What is the difference between a deep copy and a shallow copy?</a> </p> </blockquote> <p>Can you please tell me what does it mean by cloning in java? what is deep copy and shallow copy, please explain with examples</p>
java
[1]
2,685,365
2,685,366
Finding File size in bit
<p>I need Exact size of File.</p> <p>is there anyway to find file size in bits (not byte).</p> <p>I do not want to find System.IO.FileInfo.Length and convert it to bits. Because this lose one byte information .</p>
c#
[0]
5,611,685
5,611,686
javascript odd syntax: c.name=i+ +new Date;
<p>colorbox v1.3.15 from colorpowered.com has this javascript in it's minified code:</p> <pre><code>c.name=i+ +new Date; </code></pre> <p>this seems to run perfectly, should it?</p>
javascript
[3]
2,698,136
2,698,137
jquery, is it possible to store information in a variable, rather than an input field?
<p>I want to store the current page number in a jquery variable, but I am not sure if it is possible, so I am storing it in an input field. Am I doing it the most efficient way?</p> <pre><code>&lt;input type='hidden' id='current_page' /&gt; $('#current_page').val(0); </code></pre> <p>if page is changed,</p> <pre><code>function (newpage){ $('#current_page').val(page_num); } </code></pre>
jquery
[5]
1,314,224
1,314,225
Using mysql to query a table with a product code which is part of a filename
<p>I am trying to query a table which has a column called "filename".</p> <p>The actual filename is made up of "productcode-category.jpg"</p> <p>If i have the product code posted to a php page, how could i then take the value and search in the filename column where it equals the product code?</p> <p>It would be great if it wasnt case sensitive as well. </p>
php
[2]
773,825
773,826
How to implement Registration module in android applications?
<p>I want to implement registration module in my android application. Can anyone please let me know the procedure. I mean, how can I use HttpRequestHandlerRegistry, SQLite connectivity etc</p> <p>Thanks in advance.</p> <p>Regards, serenity.</p>
android
[4]
416,789
416,790
convert std::wstring to const *char in c++
<p>How can i convert std::wstring to const *char in c++?</p>
c++
[6]
349,237
349,238
How to fall back if elements are missing for a certain index
<p>Is there a way to fall back to an empty value if there are no elements in a certain index of the array</p> <pre><code>foo_val = int(data_arr[3]) </code></pre> <p>IndexError: list index out of range</p>
python
[7]
2,024,740
2,024,741
Character counter for various textarea that are loaded dynamically, how to do it?
<p>I've found a javascript code that counts the characters on a textarea. <a href="http://edrackham.com/javascript/how-to-create-a-textarea-character-counter-limiter-using-jquery/" rel="nofollow" title="This is the code">This is the code</a>.</p> <p>My problem is that I'm doing a backend where the user can load various textareas like <code>&lt;textarea name="description[]"&gt;&lt;/textarea&gt;</code>. How I can create a script that runs on all textareas BUT with different counts?</p> <p>Thank you in advance!</p>
jquery
[5]
3,584,121
3,584,122
How can I force Python to create a new variable / new scope inside a loop?
<p>Today I explored a <em>weird</em> behavior of Python. An example:</p> <pre><code>closures = [] for x in [1, 2, 3]: # store `x' in a "new" local variable var = x # store a closure which returns the value of `var' closures.append(lambda: var) for c in closures: print(c()) </code></pre> <p>The above code prints</p> <pre><code>3 3 3 </code></pre> <p>But I want it to print</p> <pre><code>1 2 3 </code></pre> <p>I explain this behavior for myself that <code>var</code> is always the same local variable (and python does not create a new one like in other languages). How can I fix the above code, so that each closure will return another value?</p>
python
[7]
2,607,669
2,607,670
How to hide the outer parents in Jquery
<p>Below is my code, my goal is when the user click the <code>&lt;a&gt;</code> which is in 'child_2', I want to hide $(this) class="parent". How can I achieve this? </p> <pre><code>&lt;div class="parent"&gt; &lt;div class="child_1"&gt; &lt;/div&gt; &lt;div class="child_2"&gt; &lt;div&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Click Me&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="child_3"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
5,078,398
5,078,399
Python doesn't show anything
<p>It's my first Python program and my first excercise is that I just need to swap places in a tuple:</p> <pre><code>stamboom = [("Frans","Eefje"), ("Klaar","Eefje"), ("Eefje","Mattho"), ("Eefje","Salammbo"), ("Gustave","Mattho"), ("Gustave","Salambo")] </code></pre> <p>Is the tuple, and I need to swap Frans with Eefje (those are just names) and then swap the second tuple.</p> <p>I read the whole data structure tutorial off Python and I thought I could do this like this:</p> <pre><code>#!/path/to/python stamboom = [("Frans","Eefje"), ("Klaar","Eefje"), ("Eefje","Mattho"), ("Eefje","Salammbo"), ("Gustave","Mattho"), ("Gustave","Salambo")] def switchplace(x): stamboom[x], stamboom[x + 1] = stamboom[x + 1], stamboom[x] return stamboom map(switchplace, range(0, len(stamboom))) </code></pre> <p>It doens't give syntax errors but it doesn't show anything.</p>
python
[7]
1,238,143
1,238,144
file_get_contents prints text not sound
<p>I'm trying to get a sound file to be printed on a php page. I'm using the code below. I thought when I run this script it would have shown a sound file to download but it prints some text. What do you think I should do to fix this?</p> <pre><code>&lt;?php $mylanguage=$_GET["mylanguage"]; $soundtext=$_GET["soundtext"]; echo stream_get_contents("http://api.microsofttranslator.com/V2/http.svc/Speak?appId=9CF5D9435A249BB484EC6DB50FFFB94C6733DEFB&amp;language=$mylanguage&amp;format=audio/wav&amp;text=$soundtext"); ?&gt; </code></pre>
php
[2]
1,862,564
1,862,565
Why do a lot of ASP.NET CMSs use individual pages, rather than one page with parameters?
<p>I've noticed a trend in blogs, online newspapers written in ASP.NET, where rather than having one page serve content (something like <code>/Article.aspx?ID=foo-bar</code>), a new (physical) page serves one article (eg <code>/Articles/Foo-bar.aspx</code>). It looks unnecessarily complicated, especially if an article was deleted/edited, and kind of defeats the purpose of a dynamic CMS. Also, if "pretty URLs" were desired, they could just be rewritten using the IIS URL rewriter.</p> <p>Is this some sort of convention used in ASP.NET?</p> <p><strong>Edit:</strong> Here are some example URLs I've seen:</p> <p><a href="http://www.itnews.com.au/News/322888,nab-splits-cio-role-in-two.aspx" rel="nofollow">http://www.itnews.com.au/News/322888,nab-splits-cio-role-in-two.aspx</a> http://www.thedailywtf.com/Articles/Classic-WTF-The-Abstract-Candidate.aspx</p>
asp.net
[9]
1,052,085
1,052,086
I want to create an inbox to retrieve all sms from the custom inbox and display in my app? I dont understand from where to start coding this?
<p>I am trying to develop a sms application in android. I'm done with sending and receiving sms . I want to create an inbox to retrieve all sms from the custom inbox and display in my app? I dont understand from where to start coding this? I have to continue with creating a lock for the application and an auto responder. Can someone pls help me about how to create an inbox and retrieve all sms from the default app?</p>
android
[4]
3,036,471
3,036,472
Setting up launch icon, but shows only android default
<p>I Have setted on my AndroidManifest on tag Application the attribute android:icon, but it's not working. I have added an image with name icon.png on folder drawable-hdpi,drawable-ldpi, drawable-mdpi, but it insists to show default android icon.</p> <p>What Am I doing wrong?</p> <p>Thanks</p> <p>My AndroidManifest is just like this:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="..." android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;application android:icon="@drawable/icon" android:label="My App Name" android:theme="@style/notitle" android:persistent="true" &gt; </code></pre> <p>I Have also added an external libray, and it's AndroidManifest is:</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="....lib" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;application android:icon="@drawable/icon"&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre>
android
[4]
4,373,360
4,373,361
android input problem
<p>I have an android problem which generates a pie chart. There are two files in my project, mainActivity and drawChart. In mainActivity I put all the variables and the algorithm in. In drawChart I put the onDraw function. For now I want to generate some input areas. The problems are, How should I generate the input? use XML or JAVA? How should I pass the data we type in to the program?</p> <p>Because I am a obsolutely beginner, so please teach me a little bit specifically. Thank you very much.</p>
android
[4]
5,354,129
5,354,130
python's glob only returning the first result
<p>I am really stumped on this one.</p> <p>I have a simple python wrapper which looks something like this:</p> <pre class="lang-py prettyprint-override"><code>import glob for found in glob.glob(filename): if not os.path.isdir(found): my_module.do_stuff(found) </code></pre> <p>where <code>filename</code> has been read in from <code>sys.argv</code>.</p> <p>When I try <code>glob</code> in an interactive shell, or a hello world script, I get the full list of (in this case 5) files. However, when I use it in this context, I only get the first one (alphabetically).</p> <p>I've checked by catching the result of <code>glob.glob</code> in an array and sure enough, it's only got a <code>len()</code> of 1, even when the filename is just <code>'*'</code>.</p> <p>What could I possibly be doing that breaks <code>glob</code>?!</p> <p>Full code file, just in case you can spot my gotcha:</p> <pre class="lang-py prettyprint-override"><code>#! /usr/bin/python import pynet.quadrons as q import os, glob def print_usage(): print """ (blah blah big long string.) """ if __name__ == "__main__": import sys if len(sys.argv) &lt; 2: print_usage() exit() filename = '' try: filename = sys.argv[1] except: print "error parsing arguments." print_usage() exit() for found in glob.glob(filename): if not os.path.isdir(found): q.load_and_analyse_file(found) </code></pre>
python
[7]
1,288,396
1,288,397
Restrict Duplicate entry in android listview
<p>my Android project is that i have made contact list into Spinner and after that i put one by one my contacts into Listview.i want that my spinner contact will not be repeated in the listview.i want to put some check point before to listview execute.what should i have to do?? PLEASE HELP ME </p>
android
[4]
2,191,393
2,191,394
error: ISO C forbids declaration of `test' with no type
<p>I'm learning C++ by myself and I ran into this problem. I wrote several lines of simple code just wanted to test "auto", and it seems that it no longer works. I pasted my code below:</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main(int argc, char** argv) { auto test=1; return 0; } </code></pre> <p>Then the error in the title is reported. I use NetBeans IDE. Any advice would be appreciated. </p>
c++
[6]
2,250,932
2,250,933
iPhone, if possible to get a photo from album without use UIImagePickerController?
<p>as topic, I want iPhone app can access the photo album and got a photo but without popup the UIImagePickerController, does it possible ? </p> <p>thanks for tip </p>
iphone
[8]
4,624,752
4,624,753
What do I need jQuery for?
<p>What do you think of killing jQuery in the public facing WP site? Isn't it useless and making for slower page loading? What's the best way to get rid of it?</p>
jquery
[5]
4,929,271
4,929,272
how to store fetched data from database in session?
<pre><code> $data_query = mysql_query("Select id, reminder_name From user_reminder WHERE user_name= '".$_SESSION['user_name']."'") or die(mysql_error()); $_SESSION['table_name']= $reminder_name; </code></pre>
php
[2]
5,472,356
5,472,357
jquery hover triggering on element under absolute element
<p>Is it possible to have the jQuery hover event (or mouseenter or mouseover events) trigger on an element that is positioned under a fixed or absolutely positioned div that covers the triggering element? Hopefully this makes sense. Thanks in advance</p> <p><strong>EDIT</strong> This is the solution I came up with. Are there any more efficient ways of doing what this code accomplishes? <a href="http://jsfiddle.net/GQugb/5/" rel="nofollow">http://jsfiddle.net/GQugb/5/</a> Only problem with it is if the user goes really fast over the boxes, eventually they will all get stuck yellow. Any suggestions?</p>
jquery
[5]
5,952,152
5,952,153
browsing of local server through iphone app
<p>can anyone help me to make the iphone app which can browse the files of the computer which is available on local network?</p>
iphone
[8]
296,634
296,635
Android switching between activities
<p>I currently have an activity called RaceActivity in my app which performs a setContentView() to display a surface view. Inside of my surface view I am checking to see if the user has won my game and when he/she has I would like to switch to another view that shows a simple game finished message. I have tried using:</p> <pre><code>Intent intent = new Intent(); intent.setClass(getContext(), RaceActivity.class); intent.putExtra("code", 3); ((Activity)getContext()).startActivityForResult(intent, 5); </code></pre> <p>But this doesn't work for me. It shows the new view for a second then the screen goes black and it continues to execute the code on the previous surface view (I have a log statement so that I can see what it's doing).</p> <p>How do I switch to the finish view and make it stop the previous view?</p>
android
[4]
4,754,337
4,754,338
php fetchpage() function help, identifying image sizes from a url in php
<p>hey guys so im building an application and one of teh features it will have is the ability to show photo links from twitter inline sort of like what tweetdeck has done in their chrome browser version and sites like crowdreel have been able to do, i spent some time researching how to grab image tags from urls on google and found this fantastic script <a href="http://www.bitrepository.com/extract-images-from-an-url.html" rel="nofollow">http://www.bitrepository.com/extract-images-from-an-url.html</a></p> <p>the script is great and does exactly what i need, however now my challenge is that the array returned from the links returns every image in the page including thumbnails ads etc, so a link to a page like this: <a href="http://lockerz.com/s/69901787" rel="nofollow">http://lockerz.com/s/69901787</a></p> <p>will return an array with quite a few image links to sort through, however what i need is a link to the main image so that i can display it inline with tweets, my idea is that i run some sort of code to figure out which of the images in the page is the largest? what are your thoughts on this? is this the right method or is there something easier thats built into php perhaps? thanks for all your help guys!</p>
php
[2]
5,189,663
5,189,664
date.timezone switch not found in php.ini file
<p>i have a problem with php.ini file.<br> i need to change current date and time in wamp server in local.<br> i know that for this should change <strong>date.timezone</strong> switch in <strong>php.ini</strong> file. i want change it like this that is my time zone location</p> <pre><code>date.timezone = "Asia/Tehran" </code></pre> <p>but i do not find this switch in php.ini for change when open in notepad.<br> i am using <strong>wamp 1.7.3</strong>.<br> please help me for find and change it.</p>
php
[2]
4,546,163
4,546,164
Strange rounding of numbers when reading in from text file C++
<p>I have a text line containing only the following lines. </p> <pre><code>0.01180994648909809 0.0118339243907452 0.01153905217670122 0.0376759911531237 0.03771224865527065 0.03765957194275842 </code></pre> <p>I used the following code to read this data and output it to terminal</p> <pre><code>using namespace std; int main(int argc, char *argv[]) { ifstream infile(argv[1]); string line; double a,b,c; while(getline(infile,line)) { istringstream iss(line); iss &gt;&gt; a &gt;&gt; b &gt;&gt; c; cout&lt;&lt;a&lt;&lt;"\t"&lt;&lt; b &lt;&lt; "\t"&lt;&lt;c&lt;&lt;endl; } return 0;} </code></pre> <p>The output I got was </p> <pre><code>0.0118099 0.0118339 0.0115391 0.037676 0.0377122 0.0376596 </code></pre> <p>Why is it that in the output the numbers have been rounded to 7 digits after the decimal? Is this rounding performed only while displaying to standard output? </p>
c++
[6]
158,931
158,932
Why static fields (not final) is restricted in inner class in java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1953530/why-does-java-prohibit-static-fields-in-inner-classes">Why does Java prohibit static fields in inner classes?</a> </p> </blockquote> <p>I was going through the specification and got that it is not possible to have the static member in the inner class which is not final compile time constant . </p> <pre><code>class HasStatic { static int j = 100; } class myInnerClassTest { class Inner extends HasStatic { static final int x = 3; // OK: compile-time constant static int y = 4; // Compile-time error: an inner class } static class NestedButNotInner{ static int z = 5; // OK: not an inner class } interface NeverInner {} // Interfaces are never inner } </code></pre> <p>Whereas i got from the <a href="http://stackoverflow.com/questions/2482327/why-can-we-have-static-final-members-but-cant-have-static-method-in-an-inner-cla">here</a> that it can inherit the static member from its owner class . But why it shouldn't . what OOPs Prinicipal it hurts . </p>
java
[1]
192,512
192,513
How to add or remove (if already exists) a key=>value pair to an array?
<p>I would like to do this with a single function.</p> <p>I have a key=>value pair:</p> <pre><code>14=&gt;1 </code></pre> <p>I have an array containing many such pairs:</p> <pre><code>array(15=&gt;2, 16=&gt;7, 4=&gt;9) </code></pre> <p>I want a function which will add the key=>value pair to the array in case it is not already there but it will remove it from the array if it is already there.</p> <p>I would like to have a single function for this.</p>
php
[2]