Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
3,686,628
3,686,629
javascript-Detect double tap on ipad or iphone screen
<p>I'd like to detect if a user has double tapped on an ipad or iphone. Does a javascript-event exist that would provide this functionality?</p> <p>Thanks in advance,</p> <p>enne</p>
javascript
[3]
2,757,115
2,757,116
Detecting computer/program shutdown in Python?
<p>I have a Python script that runs in a loop regularly making adjustments to my lighting system. When I shut down my computer, I'd like my script to detect that, and turn off the lights altogether.</p> <p>How do I detect my computer beginning to shut down in Python?</p> <p>Or, assuming Windows sends Python a "time to shut down" notice, how do I intercept that to kill my lights and exit the loop?</p>
python
[7]
2,527,695
2,527,696
Add/delete controls on button click
<p>I am new to android development. I am working on a sample application. I need to add a button with context menu, edit text and delete button for each click of a button. and delete all when I click on delete button for adding contact. I have searched a lot and still didn't get any idea. Please help me.</p>
android
[4]
1,026,260
1,026,261
jquery faq for table
<p>when i pressed a link all the td's are shown. how can i hide and show each td when pressed?</p> <pre><code> &lt;head&gt; &lt;style type="text/css"&gt; .details{display:none;} &lt;/style&gt; &lt;script type="text/javascript"&gt; $().ready(function() { $('a.buy').click(function() { $('.details').slideToggle('fast', function() { }); }); }); &lt;/script&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;a class="buy" href="#"&gt;more details&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="details"&gt;text 1 text 1 text 1 text 1 &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a class="buy" href="#"&gt;more details&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="details"&gt;text 2 text 2 text 2 text 2 &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a class="buy" href="#"&gt;more details&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="details"&gt;text 3 text 3 text 3 text 3 &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
1,377,111
1,377,112
how to delete row from tableview without using editmode?
<p>hi to all i am new to iphone,in tableview displayed data access from database and provide delete data option when button clicked,my problem is when i clicked that button data delete from database at that time row is not delete from tableview after rerun the program deleteed data don't display it worked correctly but i want delete row from tableview also when button clicked but table not in edit mode.</p>
iphone
[8]
5,447,230
5,447,231
Remapping key names in a list of dictionaries
<p>What is a pythonic way to remap each dictionary key in a list of identically-keyed dictionaries to different key names? E.g., </p> <pre><code>[{'type_id': 6, 'type_name': 'Type 1'}, {'type_id': 12, 'type_name': 'Type 2'}] </code></pre> <p>must transform into</p> <pre><code>[{'type': 6, 'name': 'Type 1'}, {'type': 12, 'name': 'Type 2'}] </code></pre> <p>(I need to do the transformation in order to match an output specification for an API I'm working on.)</p>
python
[7]
4,851,686
4,851,687
Video frame capture
<p>Is it possible to capture a frame from a video in android and save it or use it in any way in the application?</p>
android
[4]
363,236
363,237
PHP Temporarily Banning An IP
<p>I'm creating a contact form for my company and I want to make it as spam-proof as possible. I've created a honey pot + session checking, but I also want to make it so that it's only possible to submit the form once every x minutes. In other words, banning the IP from using the form for x amount of time.</p> <p>What is the best solution to do this?</p> <p>I can think of a few but none of them seem ideal.</p>
php
[2]
3,741,660
3,741,661
Android get Image source from an https url?
<p>i am trying to get an image from a https url but it doesnt seem to display and get the image correctly but works fine on my computer browser.</p> <p>i have tested out a http url pointing to a different image and it works fine.</p> <p>my code is below:</p> <pre><code>public Bitmap getContactPhoto(String url) { Bitmap pic = null; try { pic = BitmapFactory .decodeStream((InputStream) new URL( "https://mail.google.com/mail/photos/static/AD34hIjbK2m-Lj333E4nBcCkBC3MYl2tTs0xizuSqUOP3-Jd6DOrpFg1M5HG8jXh0MuPbeFepInZZDu92Dx8ST4b59EbOKmfYTortuuO3P1_Ohyu7b7a3gc") .getContent()); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return pic; } </code></pre> <p>here is the code from the activity class that calls the method above:</p> <pre><code>private ImageView mContactPhoto; private ContactDetailsViewHelper mViewHelper; mContactPhoto = (ImageView) findViewById(R.id.contact_photo); mViewHelper = new ContactDetailsViewHelper(mContext); mContactPhoto.setImageBitmap(mViewHelper.getContactPhoto(mDetail.getImageRef())); </code></pre> <p>ignore the mDetail.getImageRef, that passes the real url value but for this case i tried hard coding the url as you can see from the getContactPhoto method.</p> <p>thanks</p>
android
[4]
4,946,327
4,946,328
stack view - explanation
<p>I'm developing something with the ffmpeg lib and x264. Actually, I'm debugging x264 lib for Windows.</p> <p>Debug version doesn't work good. It creates video with gray frames. The same release build crashes. What you see below is the stack view from the Eclipse - Indigo. I didn't strip the simbols... But, I have to admit, I didn't check if they are present or not.</p> <p>Can someone please explain this zero below x264_cabac_block_residual_8x8() call?</p> <pre><code>ffmpeg_debugging Debug [C/C++ Application] C:\krmak\workspace\ffmpeg_debugging\Debug\ffmpeg_debugging.exe [772] Thread [5] 0 (Suspended : Container) Thread [4] 0 (Suspended : Signal : SIGSEGV:Segmentation fault) x264_coeff_last64_sse2() at 0x9999a9 x264_cabac_block_residual_8x8() at 0x90f6f7 0x0 ==&gt; WHAT DOES THIS MEAN??? Call came from a NULL pointer?? Thread [3] 0 (Suspended : Container) Thread [2] 0 (Suspended : Container) Thread [1] 0 (Suspended : Container) gdb </code></pre>
c++
[6]
2,394,443
2,394,444
Javascript - Why is alert() ignored in my program
<p>I'm just learning javascript using a book and they give this example:</p> <pre><code>&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt; &lt;html xmlns=”http://www.w3.org/1999/xhtml”&gt; &lt;body&gt; &lt;script language=”JavaScript” type=”text/javascript”&gt; var firstNumber = 15; var secondNumber = 10; var answer; answer = 15 / 10; alert(answer); alert(15 / 10); answer = firstNumber / secondNumber; alert(answer); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When I load it, alert only pops up twice instead of three times. Why is this?</p>
javascript
[3]
2,144,939
2,144,940
Append to the python's dictionary key:value
<p>I have a question about the dictionary in python, in the reference page: <a href="http://docs.python.org/tutorial/datastructures.html#dictionaries" rel="nofollow">http://docs.python.org/tutorial/datastructures.html#dictionaries</a> . </p> <blockquote> <p>"You can’t use lists as keys, since lists can be modified in place using index assignments, slice assignments, or methods like append() and extend()."</p> </blockquote> <p>But what does it mean to append the value of a python dictionary?</p> <pre><code># A simple program that keep track of the line number(s) a word appeared in the novel myDictionary = {} with open('novel.txt') as book: lineNumber = 1 for line in book: # cleaned is a helper function to clean up the line for word in cleaned(line).split(): if word in myDictinoary: myDictionary[word].append(lineNumber) else: myDiciontary[word]=[lineNumber] lineNumber += 1 </code></pre> <p>What exactly is going on when <code>myDictionary[word].append(lineNumber)</code> ? It seems to me a list, I want to be sure, the value of a key can be list (or in this case it is an Tuples)? <strong>What kind of data type exactly can be used as a value? When I want the key to store multiple values.</strong></p>
python
[7]
965,658
965,659
Getting a value from a different class
<p>I have a main class named <code>main.java</code> and 3 classes in a package <code>f.java</code>, <code>graphics.java</code> and <code>image.java</code></p> <p>I have a private int R in f.java, with <code>setR()</code> and <code>getR()</code> there</p> <p>Now i need to get that value (from getR()) in <code>graphics.java</code></p> <p>I need to get an interface linking those 2, or is just a cast problem?</p> <p>Try to get me some code for graphics.java so i can get that value!</p>
java
[1]
3,154,910
3,154,911
Compiling and Executing Java Remotely
<p>In my company I have many guys who want to learn Java. They don't have the admin rights to install anything. They don't even have the JRE.</p> <p>Is it possible for them to compile and execute their Java programs from a PC which has the JDK and JRE?</p> <p>Thanks a bunch in advance!</p>
java
[1]
554,988
554,989
Array count Should be Show in table view
<p>i want show my NSMutableArray Count in a UILabel ,,,,,,,,,,</p> <p>can any one help me</p>
iphone
[8]
3,250,579
3,250,580
JQuery .html vs .attr('innerHTML')
<p>If i am setting the contents of a DIV element in my dom:</p> <pre><code>$("#myE").html(contents); </code></pre> <p>Is there ANY difference at all between the above and:</p> <pre><code>$("#myE").attr('innerHTML', contents); </code></pre> <p>? Thanks!</p>
jquery
[5]
722,673
722,674
How Awful is My Decorator?
<p>I recently created a @sequenceable decorator, that can be applied to any function that takes one argument, and causes it to automatically be applicable to any sequence. This is the code (Python 2.5):</p> <pre><code>def sequenceable(func): def newfunc(arg): if hasattr(arg, '__iter__'): if isinstance(arg, dict): return dict((k, func(v)) for k, v in arg.iteritems()) else: return map(func, arg) else: return func(arg) return newfunc </code></pre> <p>In use:</p> <pre><code>@sequenceable def unixtime(dt): return int(dt.strftime('%s')) &gt;&gt;&gt; unixtime(datetime.now()) 1291318284 &gt;&gt;&gt; unixtime([datetime.now(), datetime(2010, 12, 3)]) [1291318291, 1291352400] &gt;&gt;&gt; unixtime({'start': datetime.now(), 'end': datetime(2010, 12, 3)}) {'start': 1291318301, 'end': 1291352400} </code></pre> <p>My questions are:</p> <ul> <li>Is this a terrible idea, and why?</li> <li>Is this a possibly good idea, but has significant drawbacks as implemented?</li> <li>What are the potential pitfalls of using this code?</li> <li>Is there a builtin or library that already does what I'm doing?</li> </ul>
python
[7]
1,431,834
1,431,835
Set Focus at end of text in textbox
<p>Hey, Is it possible with easy options in ASP.NET to set the focus at end of text in a textbox-element ? Without JavaScript ?</p>
asp.net
[9]
2,615,344
2,615,345
Coud I pass a StringIO object as a "file" argument to a Linux command line?
<p>Some commands on Linux receive a file as an argument. (cat, grep, sed, awk,...) How can i pass a StringIO object as a "file" argument? (because i don't want to write it to file on disk, then explicitly pass to these commands) Or i need other kind of "in-memory file" object?</p> <p>Thanks you!</p>
python
[7]
5,062,207
5,062,208
Why are instance methods defined in the prototype but instance fields are defined in the constructor?
<p>When doing inheritance in JavaScript, the pattern that I always see defines instance methods in the prototype, but instance fields in the constructor (see example below). What is the motivation for this? Why not be consistent and define both in the prototype?</p> <pre><code>function MyClass() { this.myField = 0; // why this... } MyClass.prototype.myField = 0; // ...instead of this? </code></pre>
javascript
[3]
1,381,513
1,381,514
Issue with textfields and scrollview
<p>I am observing a weird behavior in my app: My app contains multiple textfields in a scrollview. Now when I click on one textfield to modify it, my "textFieldDidBeginEditing" is called and if I click on Return key of my keyboard "textFieldDidEndEditing" is called and during these operations I am getting my full view in perfect frame of scrollview. But problem comes when instead of return button, I click on another textfield in my view then strangely my "textFieldDidEndEditing" is not called and some of my view in scrollview is not scrollable. Something happened to my scrollview's frame. Any clue?</p>
iphone
[8]
783,538
783,539
How to get the particular values in php form using get method
<pre><code>&lt;i&gt;function myFunction() { var name=document.myform.name.value; var color=document.myform.color.value; var made=document.myform.made.value; // alert('example.com/search.php?name='+name+'&amp;color='+color+'&amp;made='+made); alert('http://www.example.com/search.php?name='+name+'&amp;color='+color); //echo "window.location='http://www.example.com/search.php?name='"; }&lt;/i&gt; </code></pre> <p>I just want to get <code>name</code> and <code>color</code> field value to be inserted into my url ... How can I do that? Please help me.</p> <p>Thanks.</p>
php
[2]
2,680,501
2,680,502
Difference between if statement ways...?
<p>I am trying to use the shorthand notation for an if statement to shorten the following:</p> <pre><code>if (DCC.systemFlags[1]) { sf0CheckBox.Checked = true; } else { sf0CheckBox.Checked = false; } </code></pre> <p>And to use the following instead:</p> <pre><code>DCC.systemFlags[1] ? sf1CheckBox.Checked = true : sf1CheckBox.Checked = false; </code></pre> <p>However, I am not sure why I am getting the following error:</p> <p><code>Only assignment, call, increment, decrement, and new object expressions can be used as a statement</code></p> <p>What is the correct way to write this?</p> <p><code>DCC.systemFlags[]</code> is an array of <code>bools</code>.</p> <p>Thank you.</p>
c#
[0]
2,557,282
2,557,283
execute addObject, but NSMutableArray has no object
<p>I try to use to codes below to add object to <code>NSMutableArray</code></p> <pre><code>NSMutableArray* multipartData; - (void)processDataChunk:(NSData *)postDataChunk { if (!postHeaderOK) { UInt16 separatorBytes = 0x0A0D; NSData* separatorData = [NSData dataWithBytes:&amp;separatorBytes length:2]; for (int i = 0; i &lt; [postDataChunk length] - l; i++) { NSRange searchRange = {i, l}; if ([[postDataChunk subdataWithRange:searchRange] isEqualToData:separatorData]) { NSRange newDataRange = {dataStartIndex, i - dataStartIndex}; dataStartIndex = i + l; i += l - 1; NSData *newData = [postDataChunk subdataWithRange:newDataRange]; if ([newData length]) { [multipartData addObject:newData]; //A:set break point here } } } } } </code></pre> <p>I set breakpoint at A:, and found that newData is not nil.</p> <p>What is wrong with my codes?</p> <p>Welcome any comment</p>
iphone
[8]
1,936,266
1,936,267
Javascript hex_md5 pin number
<p>I have the following script which ask's for a pin number, it is encrypted as md5, but when i type in any value it validates, it should only do it for 1234 or 4321,i have to run 2 different if statements as im getting the pin number from the database and using a PHP foreach statement to echo them out.</p> <pre><code>&lt;script&gt; function pinSave() { var validate=prompt("Enter your PIN","Enter your PIN"); if (validate != '' &amp;&amp; validate != null) { if (hex_md5(validate) == '81dc9bdb52d04dc20036dbd8313ed055') return true; else { alert('The PIN you entered is not correct.'); return false; } if (hex_md5(validate) == 'd93591bdf7860e1e4ee2fca799911215') return true; else { alert('The PIN you entered is not correct.'); return false; } } else { return false; } } </code></pre> <p></p>
javascript
[3]
732,268
732,269
Need to display streaming video occupying the fullscreen
<p>I am using <strong>VideoView component for streaming video in Android</strong> , but the streaming video is <strong>occupying only a part of the screen of the mobile device both in portrait/landscape mode</strong>.</p> <p>Kindly provide the code to so that the <strong>streaming video is displayed covering the full screen in portrait/landscape mode.</strong></p>
android
[4]
487,580
487,581
Need to show and hide a div by clicking the same button in jquery
<p>I'm new at query and this is probably really simple : ) Right now it's setup to show a popup div when you click on the details button, which works fine. Now I'm trying to figure out how I can hide that popup div if the user clicks again on that same details button. Any help would be appreciated!</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function() { $(".details").click(function() { $(this).parents('h1').next('.popup').fadeIn(1000); }); }); &lt;/script&gt; &lt;h1&gt;We look good together&lt;span class="details"&gt;Details&lt;/span&gt;&lt;/h1&gt; &lt;div class="popup"&gt; &lt;ul&gt; &lt;li&gt;852&lt;/li&gt;&lt;!--Square Foot goes here--&gt; &lt;li&gt;2&lt;/li&gt;&lt;!--Bedrooms goes here--&gt; &lt;li&gt;1&lt;/li&gt;&lt;!--Bathrooms goes here--&gt; &lt;li&gt;$134,900&lt;/li&gt;&lt;!--Price goes here--&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
jquery
[5]
323,835
323,836
Ways to improve foll. Java code
<p>Any ways to improve the foll. code block :</p> <pre><code>public class MyUnits { public static String MILLSECONDS = "milliseconds"; public static String SECONDS = "seconds"; public static String MINUTES = "minutes"; public static String HOURS = "hours"; public int quantity; public String units; public MyUnits(int quantity, String units) { this.quantity = quantity; this.units = units; } public String toString() { return (quantity + " " + units); } // Test code public static void main(String[] args) { System.out.println(new MyUnits(1, MyUnits.MILLSECONDS)); System.out.println(new MyUnits(2, MyUnits.SECONDS)); System.out.println(new MyUnits(3, MyUnits.MINUTES)); System.out.println(new MyUnits(4, MyUnits.HOURS)); } } </code></pre> <p>Any help will be appreciated.</p>
java
[1]
1,500,786
1,500,787
Is there a simple way to generate a un-duplicate string?
<p>I know I can use GUID to generate a unique string, but it's too long. Now I only need generate un-duplicate string within an website, how can I do? Thanks!</p> <p>For example: In the website <a href="http://mathurl.com/" rel="nofollow">http://mathurl.com/</a>, you can generate a permanent URL, such as <a href="http://mathurl.com/75ujy7b" rel="nofollow">http://mathurl.com/75ujy7b</a> and 75ujy7b is very short and un-duplicate.</p>
asp.net
[9]
140,462
140,463
C# storing updated values in datatable so that it can also be stored in datagridview
<p>How to update datatable values through datagridview which will be stored in excel sheet... so that the changes will updated in datagridview when loading excel file next time</p>
c#
[0]
5,068,202
5,068,203
Implementation of the board in an Android board game
<ol> <li>How can I implement a board for a board game on Android, with the board having clickable cells and movable pieces in it? </li> <li>Can I use map editors like TiLed? How?</li> </ol>
android
[4]
4,468,205
4,468,206
Is there a more pythonic way of storing parameters so they can be used in a function call?
<p>I'm currently writing a small script using pygame, but I don't believe this question to be related strictly to pygame.</p> <p>I have a class that holds a dictionary of function parameters contained in tuples:</p> <pre><code>self.stim = {1:(firstParam, secondparam, thirdparam), 2:(firstParam2, secondparam2, thirdparam2), 3:(firstParam3, secondParam3, thirdParam3)} </code></pre> <p>In the same class, I have a function that issues a call to another function using these parameters:</p> <pre><code>def action(self, stimType): pygame.draw.rect(self.stim[stimType][0], self.stim[stimType][1], self.stim[stimType][2]) </code></pre> <p>It works, but it's a bit ugly to read. I was wondering if there was a more elegant way of storing these parameters such that a function can be called using them?</p> <p>Thanks!</p>
python
[7]
5,791,683
5,791,684
How to pass a dynamic number of arguments to a function?
<p>I have a dictionary that could have a varying number of keys. The value of the keys is a list of numbers. I want to compare each of these lists and get the list that is the maximum of all of the items in the list.</p> <p>built in max() function will give me the maximum of all the items if I passed it in the way below:</p> <p>max(lista, listb, listc)</p> <p>The number of lists varies and my dictionary looks something like this:</p> <p>myDict = {1:lista,2:listb:3:listc,...}</p> <p>I was thinking or something like this:</p> <p>maxlist = max(for item in myDict.keys(): myDict[item])</p> <p>But I don't think this works. Please help!</p>
python
[7]
5,251,052
5,251,053
Eclipse's Android 'hover assist' not always working
<p>I apologise if if 'hover assist' isn't the right terminology but I'm referring to the feature in Eclipse where if the use hovers the pointer over a method, a popup box appears with javadoc type information and invites the user to press F2 for focus. I see inconsistent behaviour for different methods, in that sometimes the browser gives me a file not found error when I click on a highlighted subject in that box.</p> <p>I can best illustrate this by means of a snippet of code from a test project. I have the method:</p> <pre><code>@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); ... etc ... } </code></pre> <p>If I hover over 'getSystemService' I see:</p> <p><img src="http://i.stack.imgur.com/3uMKZ.jpg" alt="enter image description here"> .</p> <p>and then click on <strong>'String'</strong> it takes me to the javadocs page</p> <p>file:///C:/dev/tools/android-sdk-windows4.0/docs/reference/java/lang/String.html</p> <p>on my machine in the browser. (I use the Firefox external browser) and this is just what I want.</p> <p>However if I hover over the onCreate, I see:</p> <p><img src="http://i.stack.imgur.com/fuorc.jpg" alt="enter image description here"></p> <p>Then if I click on the <strong>'Bundle'</strong> link, I get this in the browser:</p> <p>**File not found</p> <p>Firefox can't find the file at /C:/dev/projects/EclipseIndigo/AndroidWorkTwo/CompassTwo/src/reference/android/os/Bundle.html.**</p> <p>I have built the project with Android 2.3.3 jar and the javadoc properties show</p> <p><img src="http://i.stack.imgur.com/iAveB.jpg" alt="enter image description here"></p> <p>which validates OK. I don't understand this inconsistent behaviour. Any help will be much appreciated.</p>
android
[4]
3,389,743
3,389,744
Android issue: how to turn webview to an other Activity by js code
<p>I have a problem. In my webview, there is a html file. A button binds with js code to trigger the java code.</p> <pre><code>&lt;img src="start.png" id="pic1" onClick="window.intent.clickOnAndroid()"/&gt; </code></pre> <p>In my java file.</p> <pre><code>webview.addJavascriptInterface(new Object(){ public void clickOnAndroid(){ handler.post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub Intent intent = new Intent(start.this, ImgTest0201Activity.class); startActivity(intent); } }); } }, "intent"); </code></pre> <p>Everytime I clicked the image --> crashed. I think the js triggered the java code, the crash might be caused by java code. But I can not solve it. Could someone help me? Many thanks.</p>
android
[4]
5,618,714
5,618,715
c# easiest way to extract substring
<p>i have a string:</p> <pre><code>string somestring = "\\\\Tecan1\\tecan #1 output\\15939-E.ESY" </code></pre> <p>i need to extract <code>15939</code></p> <p>it will always be a 5 digit number, always preceeded by '\' and it will always "-" after it</p>
c#
[0]
2,277,713
2,277,714
what is appvars.php?
<p>I was writing some php code with a couple friends of mine a while back. I decided to look at some of the code we had written and noticed that almost all the php documents had the line: <code>require_once('appvars.php');</code> at the top. I know that this isn't a built in php file, but one that they had created. I figure it is probably something that they had copied from a tutorial or beginners book so I assume it is a common practice of sorts. </p> <p>in short: <strong>what are the contents of appvars.php</strong> and <strong>what is its purpose?</strong></p> <p>note: The server has been offline for several months now so I don't have access to it and thus can't look at the source its self</p> <p>many thanks stackoverflow</p>
php
[2]
988,086
988,087
options[Text] is null or not an object in javascript
<p>I am getting options[text] is null or not an object error. What i am trying to do here is i am checking what all multi select lookup column values are selected , comparing them with the value in an array and then removing them</p> <pre><code> var responsibleselected = returntags("select","Responsibility selected values"); for(var i=0;i&lt;responsibleselected.options.length;i++) { if(responsibleselected.options[i].selected == true) { for(var j=0;j&lt; ResponsibleArray.length;j++) { if(responsibleselected.options[i].text == ResponsibleArray[j])//throws error here { GipRemoveSelectedItems(ctl00_m_g_6ad915a8_68ea_4c76_b67a_ad1215320288_ff391_ctl00_ctl00_MultiLookupPicker_m); } } } } </code></pre>
javascript
[3]
4,335,089
4,335,090
Comparing Dates on Java
<p>could everyone help me with if statement below so that it will be true when the date in the GregorianCalendar instance myGC1 is not later than the date of the GregorianCalendar instance myGC2: </p> <pre><code>if ( ) { ... } </code></pre>
java
[1]
5,144,541
5,144,542
How to make InfoButton Bordered
<p>How to make infobutton bordered? </p> <pre><code>UIButton *button = [UIButton buttonWithType:UIButtonTypeInfoLight]; UIBarButtonItem *infoItem = [[UIBarButtonItem alloc] initWithCustomView:button]; [button addTarget:self action:@selector(infoPressed:) forControlEvents:UIControlEventTouchUpInside]; </code></pre> <p>I have tried </p> <pre><code>infoItem.style = UIBarButtonItemStyleBordered; </code></pre> <p>as well as </p> <pre><code>button.style = UIBarButtonItemStyleBordered; </code></pre> <p>But none of them is working. Will appreciate help.</p>
iphone
[8]
3,363,644
3,363,645
Javascript Focus Is Not Working on Aspx Page
<p>Hy Guys,</p> <p>Please Look at the code and Try to Help Out. The function ive written is not working but its RUNNING properly. Its about To set focus on next content on page im using it on an ASPX page. Heres my code Below :</p> <pre><code>function SetFocusOnSave(CTag,NTag) { alert('Running'+CTag+NTag); var CurrentTag=document.getElementById(CTag); var NextTag = document.getElementById(NTag); if ( (event.keyCode==13)||(event.keyCode==9) ) { if(CurrentTag.value=="") { alert("Please Enter Detail First"); CurrentTag.focus(); } if(CurrentTag.value!="") { event.returnValue=true; document.getElementById(NextTag).focus(); } } } snametxt.Attributes.Add("onkeypress", SetFocusOnSave('&lt;%=snametxt.ClientID%&gt;','&lt;%=sdesctxt.ClientID%&gt;');"); </code></pre>
javascript
[3]
251,013
251,014
Time divided by hours/minutes
<p>How can I divide time by using intervals?</p> <p>like 01:00 divided by 20 mins = 3?</p> <p>06:00 divided by 2 hours = 3?</p> <p>/M</p>
c#
[0]
3,183,928
3,183,929
Multiple PHP file read to produce alternating rows for html table
<p>I have to create a multiple alternating rows that contain different sets of data from different text documents. I can read text files okay I just cant figure out how I would do the alternating rows using the different queries in one html table.</p> <p>I have thought about storing the data in a database, might this be a better way to go rather than reading in a text file every time the page loads?</p> <p>What other ways could I achieve the output, I have currently looked at a previous thread <a href="http://stackoverflow.com/questions/13419264/selecting-alternating-records-from-two-tables">Selecting alternating records from two tables</a> but it didn't seem applicable due to it using a database to produce the results.</p>
php
[2]
5,202,161
5,202,162
Retrieve Files from remote server based on yesterday's date
<p>I need to modify this script to retrieve only the files with yesterday's date. Here is what I have:</p> <pre><code>&lt;?php $username = 'XXXXXX'; $password = 'XXXXXX'; $ftp_server = 'data.mywebsite.com'; $conn = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); if(ftp_login($conn, $username, $password)) { echo 'Logged in'; } else { echo 'FTP Error:Could not log in to '.$ftp_server; exit(); } ftp_pasv ($conn, true); if (ftp_chdir($conn, "../Photos/Hi-res")) { echo "Current FTP directory is now: " . ftp_pwd($conn) . "\n"; } else { echo "Couldn't change to Photos directory\n"; } $list = ftp_nlist($conn, '.'); function is_img($file) { if(preg_match('/.*\.png/', $file)) { return preg_match('/.*\.png/', $file) &gt; 0; } if(preg_match('/.*\.jpg/', $file)) { return preg_match('/.*\.jpg/', $file) &gt; 0; } if(preg_match('/.*\.gif/', $file)) { return preg_match('/.*\.gif/', $file) &gt; 0; } } $filtered = array_filter($list, is_img); foreach($filtered as $img) { if (ftp_get($conn, $img, $img, FTP_BINARY)) { echo "Successfully written to $img\n"; } else { echo "There was a problem\n"; } } ftp_close($conn); </code></pre> <p>When I run the script, it is grabbing all files not already on my server which is not what I want. I just want it to grab all the files with yesterdays date. Thanks</p>
php
[2]
324,586
324,587
Javascript setTimeout function
<p>I am calling this function</p> <pre><code>function drawLayers() { //setTimeout(drawBlueSky,500); //setTimeout(drawCircle1,1250); setTimeout(drawMoon,800); setTimeout(drawCircle1,2300); setTimeout(drawCircle2,2700); setTimeout(drawCircle3,3100); setTimeout(drawCircle4,3500); setTimeout(drawCircle5,3900); setTimeout(drawtext2,4300); setTimeout(drawtext,4700); setTimeout(drawtext3,5100); setTimeout(drawtext4,5500); setTimeout(drawtext5,5900); setTimeout(drawtext6,6300); setTimeout(drawtext7,6700); setTimeout(drawtext8,7100); setTimeout(drawtext9,7500); setTimeout(drawtext10,7900); } </code></pre> <p>which calls many other functions fox ex <code>drawMoon</code>,<code>drawCircle1</code> etc I am calling <code>drawLayers()</code> function on click of play button. What I need is if someone clicks on stop button the <a href="https://developer.mozilla.org/en/window.setTimeout" rel="nofollow"><code>setTimeout</code></a> function should stop calling all other functions or stop wherever it is. For ex if <code>drawMoon</code> function is called and someone clicks on stop all other functions <code>drawCircle1</code>,<code>drawCircle2</code> shouldnt be called.</p> <ol> <li>pause button also there would be third button which when clicked will pause the setTimeout function as above. when i click on same button again it should call function from where it has stopped.</li> </ol> <p>Is this possible?</p>
javascript
[3]
2,437,883
2,437,884
Change default java installation
<p>I have many Java versions installed on a Windows 7 machine. Some of them are 32 bits, some are 64 bits. Now as default it starts one of those last versions (1.7 64 bits). How do I tell my Windows 7 machine to use another version of Java? One of the reasons is that I'm developing a JNI project from Microsoft Visual Studio C++ - it uses also java 1.7 64 bits.</p> <p>Best regards, Andrej</p> <p>I have set: </p> <p>User variable: JAVA_HOME=C:\j2sdk1.4.2_04 PATH=%JAVA_HOME%\bin;%PATH%</p> <p>and system variable: JAVA_HOME=C:\j2sdk1.4.2_04 PATH=...a_lot_of_paths...;%JAVA_HOME%\bin;%PATH%</p> <p>I had no idea which is better to set - for user or system settings. Done both.</p> <p>System restart.</p> <p>And...it didn't helped :( When I run "java -version" from cmd i have java 1.7, but not java 1.4 like defined in PATH.</p> <p>after run C:>where java I got two results:</p> <p>C:\Windows\System32\java.exe C:\j2sdk1.4.2_04\bin\java.exe</p> <p>Who let Java go to my windows directory ???!!! </p> <p>How to deal with that?</p>
java
[1]
5,606,392
5,606,393
Remove and add specific classes - Jquery
<p>I need to remove existing class of an element and add another class...or shortly I want to replace a specific class having letters 'border' as substring by another class with letters 'border' as substring. I have to toggle among 8 classes. I tried to select previous class like strClass=$("#"+styleTarget[class*='border']), but it failed. Will "toggle" help me in this. Its very urgent. Thanks</p>
jquery
[5]
5,297,759
5,297,760
iPhone, how to fire a button event in programmatically
<p>I want fire a button event(or maybe method) in code,the button was generate by iPhone SDK , I can not update it, so I add the action to the button, the code likes as follows:</p> <pre><code>[theButton addTarget:self action:@selector(onButtonEvent:) forControlEvents:UIControlEventAllTouchEvents]; -(void) onButtonEvent:(id)sender { AppTrace2(self, @"onButtonEvent", sender); } </code></pre> <p>and when I tap the button, the app will execute a function that was produce by iPhone sdk, also the new method 'onButtonEvent' will be executed, and then I try to add some code as follows:</p> <pre><code>[theButton sendActionsForControlEvents: UIControlEventTouchDown]; [theButton sendActionsForControlEvents: UIControlEventTouchDownRepeat]; [theButton sendActionsForControlEvents: UIControlEventTouchDragInside]; [theButton sendActionsForControlEvents: UIControlEventTouchDragOutside]; [theButton sendActionsForControlEvents: UIControlEventTouchDragEnter]; [theButton sendActionsForControlEvents: UIControlEventTouchDragExit]; [theButton sendActionsForControlEvents: UIControlEventTouchDragInside]; [theButton sendActionsForControlEvents: UIControlEventTouchDragOutside]; [theButton sendActionsForControlEvents: UIControlEventTouchUpInside]; [theButton sendActionsForControlEvents: UIControlEventTouchUpOutside]; [theButton sendActionsForControlEvents:UIControlEventTouchDown]; [theButton sendActionsForControlEvents:UIControlEventAllEvents]; </code></pre> <p>but it does not call the original functions which was produced by iphone sdk, although the new method 'onButtonEvent' also was executed when above sendActionsForControlEvents executed .... my goal is to invoke the original function ... sdk does not provide tip on this , so I have to simulate the tap event to invoke the function to executed .... </p> <p>any one can give a tip on this problem ?</p> <p>Thanks for your time!</p> <p>Regards</p>
iphone
[8]
536,427
536,428
static method cannot implement interface method, why?
<pre><code>interface IXXX { void Foo(); } class XXX : IXXX { public static void Foo() { Console.WriteLine("From XXX"); } } class Program { static void Main(string[] args) { XXX.Foo(); } } </code></pre> <p>Compiler error: XXX.Foo() cannot implement an interface member because it is static.</p> <p>Why can't a static method implement an interface method?</p>
c#
[0]
1,058,844
1,058,845
PHP "You have () new comments on your clip", how?
<p>I want to do a function to my users, so on index.php there is e.g: </p> <p>You have 2 new comments on your clip</p> <p>How should i do this? I mean i want ideas to do this the easiest way. Table for the videos is member_videos, and tables for the comment is member_videocomments, a comment inside the table is connected by their "videoID", which is the id of the column in member_videos.</p> <p>Should i do the classic, making a field, which all is 0, until it has been seen by the user its 1 or what should i do.</p>
php
[2]
2,331,111
2,331,112
Why display UIAlertView must be at the end of Thread
<p>Hi everybody I'm confused, I want to popup a UIAlertView on the screen. But I find UIAlertView popup just after the whole codes complete or I invoke NSTimer. I want to know the reason about it. Is there anyway let me to control the view visiblility?</p>
iphone
[8]
725,389
725,390
Is it OK to define constants on the fly?
<p>In php, is it ok to define constants on the go. All these years, I used them only to store database login information. They were set in a file that was never touched.</p> <p>But is it ok if I do:</p> <pre><code>if ($userName == $dbUserName) { define('userName', 'myUserNameHere'); } </code></pre> <p>then:</p> <pre><code> myFunk(); function myFunk() //I'm actually trying to avoid tons of arguments here. If it's a constant, it's available without having to use global or pass it through args. { echo userName; } </code></pre>
php
[2]
4,563,499
4,563,500
How to convert an unsigned int value into an IP address like 255.255.255.255?
<p>I'm working with an API that returns a server's IP address as an <code>unsigned int</code> value. What's the simplest way to generate an <code>NSString</code> from this that displays the IP address in the format "255.255.255.255"?</p>
iphone
[8]
2,623,620
2,623,621
Using a variable as part of a javascript array
<p>I have an object (that I can change!) that looks like this:</p> <pre><code>var pageContent = { "contact_us":[{ "content":"&lt;p&gt;Lots of content here.&lt;/p&gt;", "title":"Contact Us" }], "index":[{ "content":"&lt;p&gt;Some other content here.&lt;/p&gt;", "title":"Home Page" }], "gallery":[{ "content":"&lt;p&gt;Some more content&lt;/p&gt;", "title":"Gallery" }], } </code></pre> <p>To access properties, I'm doing this:</p> <pre><code>pageContent.gallery[0]['title']; </code></pre> <p>To get the value "Gallery".</p> <p>What I want to do is something like this:</p> <pre><code>var newPage = "gallery"; pageContent.newpage[0]['title']; </code></pre> <p>But, obviously that fails. How can I do what I want? Changes to anything are welcome, nothing is set in stone here.</p>
javascript
[3]
3,167,495
3,167,496
EditView in ListView row: focus lost when soft keyboard shows
<p>I have some EditViews in the rows of a ListView. This works just fine except when the soft keyboard raises and lowers.</p> <p>When I touch the EditView within the ListView with the soft keyboard down, focus jumps to the EditView, then the keyboard comes up, removes focus from the EditView and sets focus to the ListView, resulting in an odd user experience with the focus no-where visible.</p> <p>Touching the EditViews with the keyboard already showing works as you would expect. The problem seems to be with the soft keyboard lowering and raising and the ListView getting confused about where focus should be placed.</p> <p>I do have listView.setItemsCanFocus(true) for the ListView</p>
android
[4]
3,367,241
3,367,242
How do you fade in/out a background color using jquery?
<p>You know how some sites fade in /out color on a error message, how can you dothat with jquery?</p> <p>The point is to draw attention to the user about the message.</p>
jquery
[5]
5,932,276
5,932,277
Searching for childNodes returns undefined
<p>I have this in my html page:</p> <pre><code>&lt;nav&gt; &lt;a&gt;&lt;/a&gt; &lt;a&gt;&lt;/a&gt; &lt;/nav&gt; </code></pre> <p>but when I run <code>var menuitem = document.getElementsByTagName('nav').childNodes;</code> it returns "undefined".</p> <p>Here is the entire javascript file with the relevant part at the end: <a href="http://pastebin.com/bVj2Ug4e" rel="nofollow">http://pastebin.com/bVj2Ug4e</a></p> <p>What did I do wrong?</p> <p>Thanks for the help guys!</p>
javascript
[3]
5,272,039
5,272,040
Iphone SDK UITextView text length
<p>How can I know that the text is out of fit (that the text is need to be scrolled)? Does it have any methods or something to do this?</p> <p>Thanks.</p>
iphone
[8]
4,966,466
4,966,467
Showing tabbar on next screen in Android
<p>Initially I have 3 screens in a tab bar...but when I navigate from any of these activities to any other activity the tab bar disappears...I want this tab bar to appear even on that screen...How to do that??</p>
android
[4]
4,404,457
4,404,458
How to simplify this mass of similar ifs
<p>I am trying to figure out how to simplify this piece of code. The logic for every if condition is basically the same so I want to get rid of the duplicate ifs:</p> <pre><code> if "video_codec" in profile: self.video_codec = profile["video_codec"] if "resolution_width" in profile: self.resolution_width = profile["resolution_width"] if "resolution_height" in profile: self.resolution_height = profile["resolution_height"] if "ratio" in profile: self.ratio = profile["ratio"] if "video_bitrate" in profile: self.video_bitrate = profile["video_bitrate"] if "profile" in profile: self.profile = profile["profile"] if "audio_codec" in profile: self.audio_codec = profile["audio_codec"] if "audio_channels" in profile: self.audio_channels = profile["audio_channels"] if "audio_bitrate" in profile: self.audio_bitrate = profile["audio_bitrate"] </code></pre> <p>I hope this can be done in 3-4 lines instead of my 18 lines.</p>
python
[7]
1,707,400
1,707,401
PHP beginner design patterns and frameworks
<p>I am planning to start learning PHP and MySQL for developing e-commerce type websites. I have 3 months of free time to start doing this, and a programming background of Java and javascript of 1 year of practical experience. </p> <p>I have already selected 2 books that will get me started and get me on an intermediate level : <a href="http://rads.stackoverflow.com/amzn/click/0672329166" rel="nofollow">PHP and MySQL Web Development 4th Edition</a> and <a href="http://www.apress.com/9781590598641" rel="nofollow">Beginning PHP and MySQL E-Commerce From Novice to Professional</a>.</p> <p>I am interested in developing e-commerce websites and I want to do it right since I will also be doing it for other people in the near future (6-8 months from the moment I start). </p> <p>While I am sure about the first book that will help me achieve what I need for the second I am open to suggestions.</p> <p>My first problem is that these 2 books won't be enough for what I need. I have no experience in using MVC architecture which seems to be the main architecture these days for writing big and sustainable projects and also no knowledge of any other design pattern which is used these days. </p> <p>Can anybody recommend a good book or resource for understanding and writing MVC projects and getting familiar with good OOP design patterns?</p> <p>My second problem is that I am undecided if I should learn a PHP framework immediately or I should try working with it as it is. If I am going to learn a framework, I decided on Codelgniter. Is it a good choice for e-commerce development?</p> <p>I mostly chose it because it is considered one of the fastest frameworks. I am not seeking to start a holy war on wether is best to use a framework or not what I want is to know if it is a good idea to learn a framework immediately after I learned PHP ? If it is or not a good idea I would like some arguments so I can better decide.</p> <p>I already decided I will use a framework on some point so I can increase productivity so I am not seeking a debate.</p>
php
[2]
1,733,566
1,733,567
Fit UITableview within Scrollview
<p>I created an application using a <code>UITableview</code>.</p> <p>But when I scroll the table view, I see a white space view before and after the table view.</p> <p>How can I fit the <code>UITableview</code> so it doesn't show that empty view?</p> <p>Here's an image of what happens when I scroll the UITableview.</p> <p><img src="http://i.stack.imgur.com/Jp5WS.png" alt="alt text"></p> <p>If anyone has some code for this, please help.</p> <p>Thanks.</p>
iphone
[8]
5,579,608
5,579,609
Hindi Font Support
<p>I am developing an android application that is in Hindi. </p> <p>The major issue with that application is that it is working on Samsung devices, but fails to work on Motorola devices. </p> <p>Please suggest me solution for this issue.</p>
android
[4]
2,321,237
2,321,238
How to store the ID of the object being hovered
<p>I have this bit of code:</p> <pre><code>$('.div').mouseover(function() { alert(this.id); }); </code></pre> <p>This gets me the ID of the object that I'm hovering, but I'd like to store it in a variable. I'm not sure how to do this; I know this is probably overly simple, but can someone help? Thanks! </p>
jquery
[5]
1,495,329
1,495,330
If my struct implements IDisposable will it be boxed when used in a using statement?
<p>If my struct implements IDisposable will it be boxed when used in a using statement?</p> <p>Thanks</p> <p>Edit: this timedlock is a struct and implements Idisposable. <a href="http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking" rel="nofollow">http://www.interact-sw.co.uk/iangblog/2004/04/26/yetmoretimedlocking</a></p> <p>Edit 2: Looking at the IL it seems If your struct exposes Dispose() as public, the compiler calls Dispose when an instance of the struct goes out of scope if you forget to call Dispose() (for example, you are not using the "using" statement)? Sooo it seems most of you guys are wrong !!</p>
c#
[0]
2,247,697
2,247,698
file shredder in android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4448772/safely-wipe-file-content">Safely wipe file content</a> </p> </blockquote> <p>hi group, please tell me which algorithm use for file shredding.</p>
android
[4]
4,491,953
4,491,954
Compling a c# application : an error : Identifier expected
<p>Can anyone please tell me why compiling a C# application with a .cs file containing the following piece of code is giving me an error . See below.</p> <pre><code>namespace defintions { unsafe public struct name { char* firstname; char* lastname; } ; class Functions { [DllImport("C++Dll.dll")] public unsafe static extern long func(name *); //error : Identifier expected } } </code></pre>
c#
[0]
4,517,615
4,517,616
how to check image is visible or not?
<p>The code below can checks if the image is visible or not.</p> <pre><code>$('#div1 img:visible') </code></pre> <p>Which selects all image descendants and:</p> <pre><code>$('#div1 &gt; img:visible') </code></pre> <p>I just need to know that when I iterate over every image in a container like dgImages <code>$("#dgImages] img").each(function () {}</code> how I can determine that the image is visible or not ? Can I write something like <code>if($(this:visible)){//Do something}</code>?. Thanks.</p>
jquery
[5]
1,229,736
1,229,737
Which Internet places are popular for commercial Java product announcements?
<p>For Java libraries (which I wrote in the past years) I found not so many places iin the Internet where developers could announce new releases. So I use paid advertising (banner campaigns) at the moment.</p> <p>Are there known and popular online forums or newsgroups which welcome advertising for product for the Java platform?</p>
java
[1]
3,039,859
3,039,860
printing out an array alphabetically
<p>hi i have the following code from a template. </p> <pre><code>&lt;ul class="sub-categories"&gt; &lt;?php foreach ($category-&gt;getChildren() as $child) { if (!$child-&gt;totalItemCount()) continue; $link = $this-&gt;app-&gt;route-&gt;category($child); $item_count = ($this-&gt;params-&gt;get('template.show_sub_categories_item_count')) ? ' &lt;span&gt;('.$child-&gt;totalItemCount().')&lt;/span&gt;' : ''; echo '&lt;li&gt;&lt;a href="'.$link.'" title="'.$child-&gt;name.'"&gt;'.$child-&gt;name.'&lt;/a&gt;'.$item_count.'&lt;/li&gt;'; } ?&gt; &lt;/ul&gt; </code></pre> <p>I would like to sort the sub category items (which are cities subdivided by state further up in the code.</p> <p>i thought i could just sort the following array $category->getChildren() but it doesnt work. so i did an echo on it and it said array, so i did var_dump on that array and got a bool(true) on it. when i tried other ways (print_r) of outputting it it crashed the page.</p> <p>i dont understand arrays very well so could someone explain what is this array that is not an array? how can i sort the city list?</p> <p>thanks!</p>
php
[2]
4,752,970
4,752,971
Why is 'int i = i;' legal?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3173462/int-var-1-void-main-int-i-i">int var = 1; void main() { int i = i; }</a> </p> </blockquote> <p>The following code can pass compiling under both g++ and Visual C++. Why is it legal? It looks unreasonable, and may cause hidden bugs.</p> <pre><code>int main() { int i = i; } </code></pre>
c++
[6]
5,683,396
5,683,397
Diary API or source code
<p>I want to develop an application that creates a customized diary, with graphical events in it. Something like a calendar of the past, that should be browsable with daily, weekly, monthly or yearly formats. Before programming every detail of something I suppose that must already exist, as you know, is there some api or some source code that I can use?</p> <p>Can I use the default Calendar to add graphics and maintain past events, with graphics and text, instead of its obvious role of programming future events?</p> <p>Thank you.</p>
android
[4]
3,509,376
3,509,377
Buttons appear transparent when I set a background image. I want Solid buttons
<p>When using a small gif to be used as a background tile for a layout, I have found that my buttons appear transparent which is NOT what I want and I have not set any transparency parameters either (unless the background gif is transparent?)</p> <p>My XML is:</p> <pre><code>&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" android:weightSum="2" android:background="@drawable/backgroundrepeat" &gt; &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="vertical" android:id="@+id/scrollview1" android:layout_weight="2" android:layout_marginLeft="20dp" android:layout_marginRight="20dp"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="match_parent" android:id="@+id/textview" android:scrollbars="vertical" android:textColor="@android:color/black" /&gt; &lt;/ScrollView&gt; &lt;Button android:text="Connect To Phidget" android:id="@+id/connect_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:enabled="false" android:layout_weight="0" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:background="@null" &gt;&lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre> <p>And the drawable tile is:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/original10" android:tileMode="repeat" /&gt; </code></pre> <p>Can anyone help? Thanks</p>
android
[4]
5,847,646
5,847,647
Upgrading PHP 5.2.17 to 5.3
<p>Our server currently runs PHP installed as CGI in Apache on Cent-OS.</p> <p>What are the advantages/possible problems with upgrading from 5.2.17 to 5.3? My dedi host says that it will most likely break my sites, but hasn't given any actual things that could break.</p> <p>Our server is 98% WordPress with a bunch of custom functionality. Where can I find a list of deprecated/changed functions, changed format, etc.</p>
php
[2]
2,213,772
2,213,773
Creating objects in for loop. I missing the mark a bit
<p>I would like to have a for loop create objects as the children of a parent object. Usually, I would declare the object without using the for loop like this:</p> <pre><code> var mObj = {}; mObj.obj1 = {}; mObj.obj2 = {}; mObj.obj3 = {}; mObj.obj3.firstname = "john"; mObj.obj3.lastname = "superfly"; </code></pre> <p>Now lets say I would like to employ a for loop to create the children objects of a parent object "mObj".</p> <p>This is where I am going wrong:</p> <pre><code>var mArr = ["firstname","lastname","email"]; // This array holds the keys for the objects var mObj = {}; var len = (mArr.length); for(var i=0; i&lt;len; i++){ var obj+i = {} mObj = obj+i; mObj.obj + i.mArr[i] = "" } </code></pre> <p>So the outcome of this would be:</p> <pre><code> mObj.obj1.firstname = ""; mObj.obj2.lastname = ""; mObj.obj3.email = ""; </code></pre> <p>I just cannot seem to name the object with counter that is being created within for loop like:</p> <pre><code>obj1 obj2 obj3 </code></pre> <p>Any help would highly be appreciated.</p> <p>Thanks.</p>
javascript
[3]
5,127,758
5,127,759
How do I dynamically create properties in Python?
<p>Suppose I have a class like this:</p> <pre><code>class Alphabet(object): __init__(self): self.__dict = {'a': 1, 'b': 2, ... 'z': 26} @property def a(self): return self.__dict['a'] @property def b(self): return self.__dict['b'] ... @property def z(self) return self.__dict['z'] </code></pre> <p>This would be a long and cumbersome task to define and it seems highly redundant. Is there a way to dynamically create these properties? I know you can dynamically create attributes with the built-in setattr, but I want to have control over read/write/delete access (for this reason I want to use a property). Thanks!</p>
python
[7]
1,720,626
1,720,627
How to use WebClient.UploadFileAsync to upload files and POST Params as well?
<p>I am using <code>WebClient.UploadFileAsync</code> to upload local files to a web server and I would also like to pass some parameters with the post as well. I would like to send a few fields that will tell the PHP code on the server specific locations on where to save the uploaded files.</p> <p>I tried to put the fields directly into the url, for example:</p> <pre><code>WebClient client = new WebClient(); Uri uri = new Uri("http://example.com/upload.php?field1=test"); client.UploadFileAsync(uri, "POST", "c:\test.jpg"); </code></pre> <p>The PHP code returns false for <code>isset($_REQUEST['field1'])</code>.</p> <p>Thank you for any suggestions.</p> <p><a href="http://stackoverflow.com/questions/4615507/pass-post-params-to-webclient-uploadfileasync">NOTE: this question was also asked in very similar format for vb.net a while back, but it did not get any answers,</a></p>
c#
[0]
839,099
839,100
C++: Problem with overloading mathematical operators
<p>I am looking to overload, let's say, the addition operator and have it add two objects of the same class. When I declare this "operator+" prototype function in the class declaration in the header file, I pass in both objects as parameters. I get a compiler error saying that "binary 'operator +' has too many parameters". I was searching around for an answer online and found out that declaring an inline function just outside the class declaration in the header file compiled out. I'm wondering what I was doing wrong or if I'm missing something here. Here is the code I am using in the header file.</p> <pre><code>class Person { private: int age; double weight; public: Person::Person(); //default constructor Person::~Person(); //default desctructor Person operator+(Person r, Person i); }; </code></pre> <p>This compiles with the error I mentioned above. Below is the code that compiles fine.</p> <pre><code>class Person { private: int age; double weight; public: Person::Person(); //default constructor Person::~Person(); //default desctructor }; inline Person operator+(Person r, Person i) { return Person(0,0); } </code></pre>
c++
[6]
3,958,492
3,958,493
conversion - ASCII hex to float in c++
<p>I have a string containing, for example "3F800000".</p> <p>This is a hexadecimal representation of the float 1.0 Only I can't seem to find any convenient way of making this conversion in C++. Suggestions?</p>
c++
[6]
4,327,447
4,327,448
Selector drawable in ImageSpan does not work?
<p>Is it possible to use <code>selector</code> drawable in <code>ImageSpan</code>?</p> <p>I have <code>TextView</code> with selector text color, and add ImageSpan with selector resource. Text color change works fine, and image does not changes. Is it a bug or there is a way to make selector spans?</p> <p>My <code>TextView</code>:</p> <pre><code>&lt;TextView android:id="@+id/text" android:ellipsize="end" android:layout_height="fill_parent" android:duplicateParentState="true" // parent of this text view can be selected android:gravity="center_vertical" android:lines="1" android:textColor="@color/message_content_simple_text" // here is selector - it works fine android:textSize="15dp" /&gt; </code></pre> <p>Selector:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@drawable/ic_active" android:state_focused="true"/&gt; &lt;item android:drawable="@drawable/ic_active" android:state_selected="true"/&gt; &lt;item android:drawable="@drawable/ic_active" android:state_pressed="true"/&gt; &lt;item android:drawable="@drawable/ic_passive"/&gt; &lt;/selector&gt; </code></pre> <p>And code of adding span:</p> <pre><code>SpannableString text = new SpannableString(" some text"); ImageSpan span = new ImageSpan(context, R.drawable.icon, ImageSpan.ALIGN_BASELINE); text.setSpan(span, 0, 1, SpannableString.SPAN_INCLUSIVE_INCLUSIVE); textView.setText(text); </code></pre> <p>When I select this text view "some text" change it's color as necessary, but image does not change.</p> <p><strong>EDIT</strong></p> <p>If there is some android bug, could you offer any way to achieve the same result?</p>
android
[4]
2,800,431
2,800,432
Can we call method that exist on aspx page through web service
<p>Can we call a Method that exist on a aspx page through Web Services.</p> <p>It is like Reflection that method exists in dll form , but is it possible to call method from Aspx page if yes then please tell me how is it?:confused:</p>
asp.net
[9]
5,704,340
5,704,341
2d games in openGL
<p>hai I am new to iphone development. I used NSTimer scheduledTimerWithTimeInterval 0.01 seconds for game loop. The game consists drawscreen function inwhich I use CGContextClipToRect to clip the large images for animation. But the speed 0.01 seconds is working in simulator only not in the iphone(device). How can i overcome this problem? I respect your reply......you have told about it in previous post. But i could not understand..... can anyone give tutorial to do this in openGL like (CGContextClipToRect in openGL),animation of 2d images,drawing,clipping etc,sample source code.....</p>
iphone
[8]
1,738,450
1,738,451
Can I run Android App on PC with Android OS?
<p>I am working on an application where I am replying people using SMS facility. Application consumes web service as well.</p> <p>I want to install Android OS on my Windows PC and run this app on it so that it will use PC hardware and its performance can be increased. </p> <p>I have goggled and found that Android OS can be installed on PC. But, I am not sure that I can install my app on PC and run it there.</p> <p>Is this possible? Can I send SMS from my app while it is running on PC?</p> <p>Please, give me some guidelines to sort out this.</p> <p>Any help is appreciated. Thanks a lot in advance.</p>
android
[4]
4,358,416
4,358,417
Generated web services client classes with no setters
<p>I've created a client for SOAP web service, but in the generated code some classes miss setter methods. </p> <p>WSDL for the objects looks like: </p> <pre><code>&lt;xsd:complexType name="UserDefinedFieldArray"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="userDefinedField" minOccurs="0" maxOccurs="unbounded" type="ns0:UserDefinedField"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; &lt;xsd:complexType name="UserDefinedField"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="fieldName" type="xsd:string"/&gt; &lt;xsd:element name="fieldValue" type="xsd:string"/&gt; &lt;xsd:element name="listId" type="xsd:string"/&gt; &lt;/xsd:sequence&gt; &lt;/xsd:complexType&gt; </code></pre> <p>Those objects have only setXXX(), and Java Docs insist on this: </p> <p>"This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a set method for the testSuiteUdfs property. For example, to add a new item, do as follows: getTestSuiteUdfs().add(newItem); "</p> <p>Though my logic says to me, that the updated list cannot get to the server until u send it there?</p> <p>The only related thing I managed to find: <a href="http://www-01.ibm.com/support/docview.wss?uid=swg21440294" rel="nofollow">http://www-01.ibm.com/support/docview.wss?uid=swg21440294</a>. But it was not helpful at all.</p> <p>Can anyone, please, tell me which way to dig? Cause I don't understand at all how this is supposed to work. Thanks!</p>
java
[1]
641,600
641,601
How to read Varian hnd files using java
<p>I have these "Varian hnd" files in my computer and I want to know if there is a way that I can open these files using eclipse or netbeans in java?. I think that these files have some images and I want to show them on my computer but I have no idea how to proceed. Also, can anyone explain to me about the format/extension of "Varian hnd" files. Your help will be much appreciated.</p>
java
[1]
1,107,146
1,107,147
Access "th" in Listview
<p>Is there a way to access the "th", in the code behind. I would like to add padding to the header depending on the item value.</p> <pre><code>&lt;LayoutTemplate&gt; &lt;table runat="server" &gt; &lt;tr runat="server"&gt; &lt;td runat="server"&gt; &lt;table ID="itemPlaceholderContainer" runat="server" border="0" class="UserLayoutTbl"&gt; &lt;tr runat="server" style=""&gt; &lt;th runat="server" width="140" align="left"&gt; Date&lt;/th&gt; &lt;th runat="server" width="140" align="left"&gt; Ref. No.&lt;/th&gt; &lt;th runat="server" width="270" align="left"&gt; Description&lt;/th&gt; &lt;%-- &lt;th runat="server" width="90" align="right" style = '&lt;%# GetAmountLabelStyle() %&gt;'&gt; Amount&lt;/th&gt;--%&gt; &lt;th id="Th1" runat="server" width="90" align="right"&gt; Amount&lt;/th&gt; &lt;/tr&gt; &lt;tr ID="itemPlaceholder" runat="server"&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre>
asp.net
[9]
458,136
458,137
How to show random images on Android?
<p>I have a number of images in my directory. I want to show random images in ANDROID. Please anyone provide me with an example.</p>
android
[4]
4,608,834
4,608,835
external sorting of 2GB file using merge sort
<p>I am trying to write a program to create a 2gb (approximately) sized file of English words. And from this 2gb file trying to print the frequency of words using external sorting. After external sorting it can just print the count(frequency) How to do external sorting in python</p>
python
[7]
2,449,556
2,449,557
Getting element node based on Javascript element based on position
<p>I am experimenting with a Javascript function which stuffs nodes into a position. Something like <code>appendChild(document.getElementById("foo"))</code> . However, I do not have full control over the surrounding code and it is likely that some elements will have identical IDs. Consider the following:</p> <pre><code>&lt;div id="foo"&gt; &lt;span id = "bar"&gt;456&lt;/span&gt; &lt;script type="text/javascript"&gt;document.write(document.getElementById("bar").innerText);&lt;/script&gt; &lt;/div&gt; &lt;hr&gt; &lt;div id="foo"&gt; &lt;span id = "bar"&gt;123&lt;/span&gt; &lt;script type="text/javascript"&gt;document.write(document.getElementById("bar").innerText);&lt;/script&gt; &lt;/div&gt; </code></pre> <p>In most browsers, the output will be:</p> <pre><code>456 456 123 456 </code></pre> <p>rather than what I want, which is</p> <pre><code>456 456 123 123 </code></pre> <p>This result is totally unsurprising to me; I do understand why this is happening. I was hoping I could do a javascript call more like </p> <pre><code>document.write(myscriptnode.parent.childnodes['bar'].innerText) </code></pre> <p><strong>Assuming I do not have control over anything except the contents of the script tags</strong>, is there a way to accomplish this?</p>
javascript
[3]
5,198,820
5,198,821
Is there a way I can perform one PHP function first and then execute another function after the first function?
<p>Is there a way I can perform one PHP function first and then execute another function after the first function?</p>
php
[2]
2,591,187
2,591,188
Attempting to swap my tr tags with the prev sibling
<pre><code>$("tr #contactus_"+id).before($("tr #contactus_"+id).prev()); </code></pre> <p>I know you can swap the position of the tr tags using this method, however I don't know the id name of the previous tr tag. What is the proper way of identifying the prev or next sibling?</p>
jquery
[5]
1,612,291
1,612,292
Android update ONE marker ONLY in Mapview, how?
<p>Is there a way to update one of my marker's position on a mapview?</p> <p>How?</p> <p>thanks, Leslie</p>
android
[4]
5,216,283
5,216,284
bitmap compression
<p>hi programmers i'm trying to send a bitmap screenshot over network , so i need to compress it before sending it, so if anyone have a librery or methode just tell me , thanx a lot </p>
c#
[0]
5,344,532
5,344,533
How to determine file kind effectively?
<p>The program i am working on looks at various ASCII text files and does some processing. In order to know how to handle things, it needs to know whether file </p> <pre><code>- IS_EMPTY // done - IS_JSON // done via parsing, using gson - IS_XML // done via parsing, using dom4j - IS_PROPERTIES - IS_SCRIPT </code></pre> <p>I wonder if there is an effective way to determine whether file is of type properties without reading each line to see if it contains <code>Key=Value</code> pair?</p> <p>Additionally, is there an effective way to determine whether file is a shell script?</p> <p>Are there any parsers available to check this?</p>
java
[1]
4,724,363
4,724,364
Why doesn't line 4 generate an unchecked exception?
<pre><code>/*1.*/ List l = new ArrayList&lt;Number&gt;(); /*2.*/ List&lt;String&gt; ls = l; // unchecked warning /*3.*/ l.add(0, new Integer(42)); // another unchecked warning /*4.*/ String s = ls.get(0); </code></pre> <p>If the lines 2 and 3 produce an unchecked warning then why doesn't the 4th line generate a unchecked warning since compiler does not know what 'ls' is referring to (<code>List&lt;String&gt;</code> or <code>List&lt;Integer&gt;</code>).</p> <p>(Note: edited from the OP's original post to make the code display as presumably intended - notably include the type parameters for <code>List&lt;E&gt;</code> everywhere.)</p>
java
[1]
606,216
606,217
Are Python inner functions compiled?
<p>So AFAIK in CPython, function definitions are compiled into function objects when executed at parse time. But what about inner functions? Do they get compiled into function objects at parse time or do they get compiled (or interpreted) every single time the function is called? Do inner functions incur any performance penalty at all?</p>
python
[7]
1,668,852
1,668,853
animationDrawable is not playing in Actionbar?
<p>I am using the developer guide(<a href="http://developer.android.com/guide/topics/graphics/drawable-animation.html" rel="nofollow">http://developer.android.com/guide/topics/graphics/drawable-animation.html</a>) to create a animating record button, Making minor changes to accomadate an actionbar menuitem instead of an imageView. When I call the onStart it does not play?</p> <p>Here is the code im using</p> <pre><code> RecordButton.setIcon(R.drawable.recordbutton); recordAnimation = (AnimationDrawable) RecordButton.getIcon(); recordAnimation.start() </code></pre> <p>Does anyone know why its not playing?</p>
android
[4]
2,182,104
2,182,105
Gyroscope gives differents values on differents devices
<p>I have strange gyroscope behavior:</p> <p>I have values[0] from gyroscope sensor: Angular speed around the x-axis. On Samsung Galaxy Nexus this value is from -10 to 10. In Samsung Galaxy Tab(old) - from -100 to 100.</p> <p>So, why? I can't understand. I write application which use gyroscope. On Galaxy Nexus everything is ok, but on Galaxy Tab because of greater values i have problems.</p> <p>Thanks for your answer.</p>
android
[4]
5,220,982
5,220,983
How does "if(new Integer(1) == new Integer(1))" work in Java?
<pre><code>if(new Integer(1) == new Integer(1)) return true; </code></pre> <p>I need to code/implement this so that this test:</p> <pre><code>//door is a class and the constructor takes length, breadth, width if(new Door(10,10,10) == new Door(10,10,10)) </code></pre> <p>will return true.</p> <p>Does the Java compiler have any interface for wrapper classes to get their value and compare them?</p> <p>Or simply: how does one check that <code>some object &gt; other object</code> (user defined object but not by some primitive value/wrapper class)?</p>
java
[1]
2,853,530
2,853,531
read google spreadsheet in python using key, without sign-in
<p>i have used the gspread lib to read the csv file from the google docs but it first requires to login.</p> <pre><code>gc = gspread.login('email','password') sheetData = gc.open("NSEport").sheet1 </code></pre> <p>I want to directly open a spreadsheet using the key generated when we share the spreadsheet. without login into google account.</p>
python
[7]