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
1,133,789
1,133,790
How to Insert an Animated gif in Java
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2935232/show-animated-gif-in-java">Show animated gif in Java</a> </p> </blockquote> <p>How can I insert an animated gif image in Java?</p> <p>I have already looked at different answers and question. But when I code this, it doesn't show the gif animated.</p> <pre><code>Image image = Toolkit.getDefaultToolkit().getImage("yourFile.gif"); Image image=ImageIO.read(new File("yourFile.gif")); </code></pre> <p>In the end, I use the method <code>drawImage</code>.</p>
java
[1]
1,064,159
1,064,160
repeating function with time
<p>I am trying to display sports scores every 90 seconds in an iframe. I have everything working except for one part. The issue I have is that once the time goes from 90 to 0 it loads the html page into and iframe and continues to reload the same html page forever. How can I make it load one time, and then start the 90 second countdown over again?</p> <pre><code>// variables var timeCountdown = 90, minutesCountdown, secondsCountdown, mainCountdown; // main script countdown mainCountdown = setInterval(function() { // display countdown time document.getElementById("countdown").innerText = mainCountdown + " seconds remaining!"; // if time is 0 or smaller if (timeCountdown &lt;= 0) { // load sports scores document.getElementById("iframe").src = "sports/nba/feed.html"; } else { // convert random time to minutes minutesCountdown= Math.floor(timeCountdown / 60); // convert random time to seconds secondsCountdown = (timeCountdown % 60); // add leading zero to seconds if less than ten if (secondsCountdown &lt; 10) { secondsCountdown = "0" + secondsCountdown; } // add leading zero to minutes if less than ten if (minutesCountdown &lt;= 10) { minutesCountdown = "0" + minutesCountdown; } // display countdown until next search document.getElementById("countdown").innerHTML = "Loading NBA scores in " + minutesCountdown + ':' + secondsCountdown; // reduce countdown time timeCountdown--; } }, 1000); </code></pre>
javascript
[3]
5,517,569
5,517,570
how to test thread safety of a module?
<p>I want to use a module to help serve pages in cherryPy. The module works great in a single thread, and it does not use inter-thread communications (queues, ...). Still, there is a slight possibility that some side effects (e.g. via global) may occur in a multi-threaded environment such as CherryPy.</p> <p>What test strategy or test program can I use to verify the thread safety of the python module / function ? Is there anything better than monkey testing ? Are there any thread-safety testing framework for python ?</p> <p>(I've seen the responses for similar questions in other languages)</p>
python
[7]
429,651
429,652
Eclipse message saying List cannot be resolved to a type
<p>I am trying the following code in eclipse:</p> <pre><code>public class A { List&lt;Integer&gt; intList = new ArrayList&lt;Integer&gt;(); } </code></pre> <p>However it gives me an error saying: List cannot be resolved to a type and ArrayList cannot be resolved to a type. </p> <p>Is there some library I need to add and how do I do that?</p>
java
[1]
4,219,092
4,219,093
Diffrence between x++ and ++x?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1094872/is-there-a-difference-between-x-and-x-in-java">Is there a difference between x++ and ++x in java?</a> </p> </blockquote> <p>I am reading the official Java tutorial and I don't get the difference between postfix and prefix (++x vs x++). Could someone explain?</p>
java
[1]
2,084,476
2,084,477
spliting an array without foreach
<p>So I have an array of items</p> <pre><code> $arr1 = Array(266=&gt;"foo",178=&gt;"bar",3="foobar"); </code></pre> <p>and then I have an of array of numbers like this</p> <pre><code> $arr2 = Array(0 =&gt; 266, 1 =&gt; 178); </code></pre> <p>and so what I want to do is split array one into two arrays </p> <p>where the values of $arr2 that match the index of $arr1 are moved to a new array so I am left with</p> <pre><code> $arr1 = Array(3="foobar"); $arr2= Array(266=&gt;"foo",178=&gt;"bar"); </code></pre> <p>that said I know I could do this with a foreach loop but I wonder if this is a simpler and faster way to do this </p> <p>something like array_diff would be could but I don't think that will work</p>
php
[2]
3,088,593
3,088,594
Possibility of an ANR in Standalone Service
<p>Can an android process that does not contain any activities (i.e. a standalone service) receive an ANR? </p> <p><em>Android mentions: "In Android, application responsiveness is monitored by the Activity Manager and Window Manager system services. Android will display the ANR dialog for a particular application when it detects one of the following conditions:"</em></p> <p>Does this mean a service without a UI interface can or cannot cause an ANR?</p>
android
[4]
5,367,457
5,367,458
Trying to determine if a stream is active php
<p>I have the link to 2 audio streams</p> <p><a href="http://82.35.172.112:88/broadwave.m3u?src=1&amp;rate=1" rel="nofollow">http://82.35.172.112:88/broadwave.m3u?src=1&amp;rate=1</a> and <a href="http://86.28.144.85:88/broadwave.m3u?src=1&amp;rate=1" rel="nofollow">http://86.28.144.85:88/broadwave.m3u?src=1&amp;rate=1</a></p> <p>I need to find out which one is playing and then swap text etc. on the page</p> <p>I've tried various different ways using fopen, fsockopen, curl to check, but nothing has worked</p> <p>below is my latest try</p> <pre><code>$fp = fsockopen("82.35.172.112:88/broadwave.m3u?src=1&amp;;rate=1", 88, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)&lt;br /&gt;\n";; }else{ echo "stream is there"; } fclose($fp); </code></pre> <p>Any help is appreciated</p>
php
[2]
4,038,296
4,038,297
Where did java get the idea for Interfaces from?
<p>I'm aware that most things in modern programming languages are at least <strong>partially</strong> based on features in earlier languages.</p> <p>This leads me to wonder where java got the inspiration for interfaces from. Was it mostly their own creation? Was it based on fully Abstract Base classes(with multiple inheritance) ?</p>
java
[1]
496,015
496,016
jQuery Hide and Show DOM Element
<p>I have the following code:</p> <pre><code>jQuery(document).ready(function ($) { var objModal = '&lt;div id="Modal"&gt;&lt;div class="ModalContent"&gt;&lt;p&gt;please wait&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;'; function JS_Utils_ShowModal() { if (!objModal) { $('body').append(objModal); } } function JS_Utils_HideModal() { if (objModal) { $('body').remove(objModal); } } // Forces the modal to show full height in IE6 if ($.browser.msie &amp;&amp; $.browser.version == "6.0") { $('div#Modal') { var overlayHeight = $('body').height(); $('div#Modal').css({ 'height': overlayHeight }); } } </code></pre> <p>});</p> <p>The basic idea is that when the page loads it builds a modal box, and hides it! When a user makes the JS_Utils_ShowModal function run it will then show the modal. However this doesn't seem to work, any ideas why? And is window.onload the best way to build the modal when the page loads up?</p> <p><strong>EDIT: Changed it so that the modal is a variable that I would like to append and remove from the DOM when user runs one of the functions. I also need to check that the modal doesn't already exist before adding it or removing it!</strong></p> <p>Thanks.</p>
jquery
[5]
2,507,300
2,507,301
repeat tickerText on the notification
<p>Iam running a service, this service downloading a file, and when it finish it notify the user via the notification bar.</p> <p>so when there is a notification the user can see the tickerText, and then it disspear.</p> <p>is there anyway of repeating this tickerText every X time on the notification line, until the user pulling the notification bar?</p> <p>thanks,</p>
android
[4]
2,153,497
2,153,498
How to disable the focus of listheader and footer?
<p>I am working on android applications. In my page I kept listheader,listview and listfooter. I had disabled the focus of listview but when i am trying to disable the header and footer it is not appying ?</p> <p>MyCode:</p> <p>For listview I had disabled the focus by giving</p> <pre><code>lvAdapter adapter = new lvAdapter(this,list){ public boolean areAllItemsEnabled() { return false; } public boolean isEnabled(int position) { return false; } }; </code></pre> <p><strong>listheader.xml</strong> I have changed in my xml file by giving <strong>focusable=false</strong> in <strong>textview</strong></p> <pre><code> &lt;TextView android:id="@+id/text1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textColor="#000000" android:focusable="false" android:clickable="false" android:enabled="false" android:textSize="12dip" &gt; &lt;/TextView&gt; </code></pre> <p><strong>listfooter.xml</strong> I have changed in my xml file by giving <strong>focusable=false</strong> in <strong>textview</strong></p> <pre><code>&lt;TextView android:id="@+id/text2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:textColor="#000000" android:focusable="false" android:clickable="false" android:enabled="false" android:textSize="12dip" &gt; &lt;/TextView&gt; </code></pre> <p>But even then the focus of header and footer had not disabled. Pleae help me regarding this Thanks in advance...</p>
android
[4]
5,127,680
5,127,681
mysqli_stmt_fetch(). Entries exist, but nothing is printed
<p>Am i doing something ridiculously stupid? Everything works up until hello you(2)</p> <p>while (mysqli_stmt_fetch($selectCust)) won't execute. I went through everything step by step and the entries appear in the database. The if statement executes properly if the entry is original.</p> <p>I did this entire form in mysql originally and it worked fine. I just can't get the fetch to work with prepared statements, so I'm sure it isn't a logic error.</p> <pre><code>Creating prepared statements and binding params $insertCust = mysqli_prepare($mysqli, "INSERT INTO `mp434`.`CUSTOMERS` ( `CUST_ID`, `NAME` , `EMAIL` , `PASSWORD` , `ADDRESS` ) VALUES ( ?, ?, ?, ?, ? )"); mysqli_stmt_bind_param($insertCust, 'sssss', $null, $name, $email, $password, $address); $selectCust = mysqli_prepare($mysqli, "SELECT * FROM `CUSTOMERS` WHERE `NAME` LIKE ? AND `EMAIL` LIKE ? AND `PASSWORD` LIKE ? AND `ADDRESS` LIKE ?"); mysqli_stmt_bind_param($selectCust, 'ssss', $name, $email, $password, $address); //Find num Rows to see if cust is preexisting mysqli_stmt_execute($selectCust); mysqli_stmt_store_result($selectCust); $numRows = mysqli_stmt_num_rows($selectCust); mysqli_stmt_close($selectCust); //if preExisting gives Cust ID //if not fetches custId if ($numRows == 0) { mysqli_stmt_execute($insertCust); mysqli_stmt_store_result($insertCust); $custID = mysqli_stmt_insert_id($insertCust); mysqli_stmt_close($insertCust); } else { print "hello1"; mysqli_stmt_execute($selectCust); mysqli_stmt_bind_result($selectCust, $a,$b,$c,$d,$e); print "hello You2"; while (mysqli_stmt_fetch($selectCust)) { print "hello You3"; print "results are: $custID $b $c $d $e &lt;br&gt;"; } mysqli_stmt_close($selectCust); } echo $custID; echo $numRows; </code></pre>
php
[2]
5,520,571
5,520,572
Jquery ul with many li items seperated to a ul with rest of the li items
<p>Whats up peeps..</p> <p>lets say i have a ul with 30 li items</p> <pre><code>&lt;ul class="column"&gt; &lt;li&gt;portfolio items 1&lt;/li&gt; &lt;li&gt;portfolio items 2&lt;/li&gt; ... &lt;li&gt;portfolio items 29&lt;/li&gt; &lt;li&gt;portfolio items 30&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>i need jquery to take li items from 10 into a new ul column and if possible from 20 into a third column</p> <p>so if my ul list had 30 li items it would have only 10 and create a new ul coumn with the rest of the li items.</p> <p>example of what i'm trying to do is within my portfolio <a href="http://www.missionandromeda.com" rel="nofollow">http://www.missionandromeda.com</a></p> <p>i'm basicly migrating to wordpress and i must have all entries within 1 ul. would have been very easy if i only had 1 column but my design require 4 =/</p> <p>Thanks! (;</p>
jquery
[5]
6,034,070
6,034,071
Change CSS using "if" in jQuery
<p>Is there a way to change the CSS of a parent div only if the child is visible? And back again when not??? I've been racking my brains and I'm all Googled and jQuery documentationed out.</p>
jquery
[5]
190,030
190,031
How to get an application's Package name and MainActivity name from another application?
<p>I am developing a android application that hide the app when user select the app from the app drawer. Here one problem occurred I want to get the package name and main activity of that application on which user taps.I researched a more but failed every time I am also a new comer so Friends please help me on this topic.</p> <p>Thanks in advance.</p>
android
[4]
3,548,540
3,548,541
Reading line from text file into C++ system() command
<p>I'm new to C++, and I'm trying to read a string from a text file that only contains one string and use that as input for a system() call. Here's what I have: </p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;fstream&gt; int main(int argc, const char * argv[]) { std::string curlString = "/usr/bin/curl -O "; std::ifstream file("/Users/test/Desktop/test.txt"); if (file) { std::string line; while (std::getline( file, line )); system(curlString + line); } } </code></pre> <p>This is probably a complete and utter mess, so thanks so much for helping out, I really appreciate it.</p> <p>Thanks in advance for any insight! </p>
c++
[6]
5,315,529
5,315,530
jQuery error "uncaught exeption..."
<blockquote> <p>uncaught exception: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.getAllResponseHeaders]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: =1299105704512">http://code.jquery.com/jquery-1.5.min.js?=1299105704512 :: anonymous :: line 16" data: no]</p> </blockquote> <p>My repeating AJAX calls cannot load completely, they are just loading and loading... Is that from the ajax calls - 3, including one that repeats every 5 seconds? How to fix it?</p> <p><strong>Edit:</strong> I use this code for including jQuery</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-1.5.min.js"&gt;&lt;/script&gt; </code></pre> <p>Here are my AJAX requests:</p> <pre><code>$.ajax({ type: "GET", url: "subscribe1.php", data: "feed="+feeded+"&amp;user="+thisuserd , success: function(msged){ $("#csub").html(msged); } }); $(document).ready(function() { setInterval("ajaxd()",5000); }); function ajaxd() { var thisuser = $("#thisusern").text(); $.ajax({ type: "GET", url: "newstitle.php", data: "user="+thisuser, success: function(msg){ $("#edix").html(msg); } }); } $.ajax({ type: "GET", url: "newscontent.php", data: "title="+titled+"&amp;timestamp="+timestampd, success: function(msgd){ var splitups = msgd.split("|"); var titleds = splitups[0]; var content = splitups[1]; $("#whatsup").html(titleds); $("#content").html(content); } }); </code></pre>
jquery
[5]
3,383,314
3,383,315
Splitting factory, super and subs out from a single module
<p>I have a working module that contains a factory function, a super class and two sub classes. The actual module is <a href="https://github.com/natemarks/CiscoXMLPexpect/blob/master/CiscoXMLPexpect/commandler.py" rel="nofollow">here</a>.</p> <p>I split the factory into its own file and put the two subclasses into the commands/ directory so I could get around a recursion problem caused by importing my subs in the module containing my super.</p> <p>Just when I think I have everything importing correctly, the factory is stuck with an empty list of subclasses when I try:</p> <pre><code>for cls in Command.__subclasses__(): </code></pre>
python
[7]
4,050,223
4,050,224
Determining time elapsed between 2 dates
<p>I am trying to determine the time elapsed between 2 dates using javascript. An example would be: "I quit smoking on January 5, 2008 at 3 A.M., how many years, months, and hours has elapsed since I quit?".</p> <p>So my thoughts were:</p> <ol> <li>Get "quit" date</li> <li>Get current date</li> <li>Convert to time (milliseconds)</li> <li>Find the difference</li> <li>Create a new date using the difference</li> <li>Extract the years, months, etc. from that date</li> </ol> <p>Well, it is acting strange and I can't pin point why. Any insight?</p> <pre><code>//create custom test date var d1 = new Date(2012, 8, 28, 13, 14, 0, 0); //create current date var d2 = new Date(); //get date times (ms) var d1Time = (d1.getTime()); var d2Time = (d2.getTime()); //calculate the difference in date times var diff = d2 - d1; //create a new date using the time differences (starts at Jan 1, 1970) var dDiff = new Date(); dDiff.setTime(diff); //chop off 1970 and get year, month, day, and hour var years = dDiff.getFullYear() - 1970; var months = dDiff.getMonth(); var days = dDiff.getDate(); var hours = dDiff.getHours(); </code></pre> <p>You can see it in action at <a href="http://pastehtml.com/view/cdu6voso4.html" rel="nofollow">this temporary host</a>.</p>
javascript
[3]
2,559,898
2,559,899
jQuery > reset popup window 's x and y relative to icon that launched the window
<p>I have a jQuery jPicker colorpicker that is bound to an input text field and opens onclick of a small picker.gif icon. The problem I'm having is that (1) The colorpicker that opens does not appear to be positioned according to the x/y position of the picker.gif (it opens far away from the click point) and (2) The colorpicker does not seem to be aware of the viewport's scroll position (the top of the colorpicker is partially hidden at the top of the window).</p> <p>I'd like to use jQuery to reposition the colorpalette (1) Based on the x/y position of the input that its bound to and (2) reset it's top position based on the viewport's visible Y position.</p> <p>Here is the script where I am creating a new jPicker and binding it to my input text fields for header and sidebar...</p> <pre><code>$('#theme_header_color').jPicker ( {position: { x: $(this).offset.left + $(this).width(), y: ($(this).offset.top - $(window).scrollTop()) + $(this).height() }}, function(color) { $(this).val(color.get_Hex()); }, function(color) { $(this).val(color.get_Hex()); } ); $('#theme_sidebar_color').jPicker ( {position: { x: $(this).offset.left + $(this).width(), y: ($(this).offset.top - $(window).scrollTop()) + $(this).height() }}, function(color) { $(this).val(color.get_Hex()); }, function(color) { $(this).val(color.get_Hex()); } ) </code></pre>
jquery
[5]
3,861,335
3,861,336
Collection of template-heterogeneous types
<p>I have a bunch of <code>boost::property_map</code>s defining costs of edge traversal in a graph. I'm executing an algorithm with differently weighted combinations of these maps, currently by manually doing <code>totalcost = weight1*weight1_factor + weight2*weight2_factor + ...</code>. The number of property maps is rising though, and it's becoming a hassle to sum them up like this.</p> <p>So, I envisioned creating an aggregation class, which contains a collection of some sort of all the maps. However, they are templated differently, as <code>boost::property_map&lt;Graph, PropertyTag&gt;</code>, where the <code>PropertyTag</code> differs among the maps. Since they all support <code>operator[](edge_escriptor)</code>, is there some trick I can use, or am I doomed to use <code>boost::any</code>?</p>
c++
[6]
4,406,372
4,406,373
Rotate Panel in WinForm
<p>How can i rotate (90 degrees) a panel control? i know it is very simple in WPF but i can't use it. Do you know such a way for WinForm panel control? Thanks you all!</p>
c#
[0]
1,778,138
1,778,139
Cannot access memory at address error
<p>I'm getting this error:</p> <pre><code>Program received signal SIGSEGV, Segmentation fault. 0x0000000000407265 in Quadtree::deeper (this=0x7fffffffe430, orig=@0x7fffffffe430, n=@0x7a1da0, tol=Cannot access memory at address 0x7fffff3feffc ) at quadtree.cpp:47 47 int Quadtree::deeper(QuadtreeNode * &amp; orig, QuadtreeNode * &amp; n, int tol, int tolNum) { </code></pre> <p>This is line 47:</p> <pre><code>int Quadtree::deeper(QuadtreeNode * &amp; orig, QuadtreeNode * &amp; n, int tol, int tolNum) { </code></pre> <p>Whats weird is that I am not getting any valgrind errors at all, but only gdb error and seg fault at run time. What can this error possibly mean in a general sense (without having to see the rest of my code)?</p>
c++
[6]
4,076,836
4,076,837
Anyone can help me for example SSH Code for Android?
<p>I want to create android application for SSH to Linux Server. But I can't find a topic with SSH connect to server anyone can help me for SSH Source code to connect SSH Server.</p> <p>Thx</p>
android
[4]
5,918,928
5,918,929
Reading multiple commands from one line of input in c++
<p>Say input can be 'x','y' and 'z' and for each commandX(),commandY() and commandZ() can be executed, respectively. Instead of having to type then pressing enter each time (ie: x (enter) commandX() executed then y (enter) commandY() executed ...) how can I let the user input it into just one line (ie: x y z (enter)) and then the commands are made consecutively in the order of their input? ( ie: in x , y , z the order of execution will be commandX() then commandY() then commandZ())</p>
c++
[6]
3,593,897
3,593,898
Android ant build: how to run android upload and not update build.xml, proguard.cfg
<p>0 down vote favorite</p> <p>I am running the standard ant script 'build.xml' which gets created when you run the 'android create project' command. In order to verify my local.properties is set correctly, I added a task at the beginning of the build.xml script to run the command: android update project -p .</p> <p>I now get this message each time I run the ant script: 'File build.xml is too old and needs to be updated', </p> <p>which clobbers my build.xml file and creates a proguard.cfg file.!!!</p> <p>So, I moved the ant script to a different file that won't get clobbered.</p> <p>Is there a way to run the command 'android update project -p .' that doesn't clobber build.xml and create proguard.cfg?</p>
android
[4]
2,334,550
2,334,551
App crashing after reloading
<p>I am writing my first app that tries to deal with persistent data and am having some major troubles. I finally feel like I am getting close but now the crash is crashing sporadically - I assume it is some sort of memory issue but have no clue how to fix it. If I reset the settings of the iphone simulator and then run the app it works great for quite a while. Then if i close the simulator and re-run the app, it will crash when this method is called:</p> <pre><code>-(IBAction)selectedProfile { NSInteger rowSelected = [profilePicker selectedRowInComponent:0]; NSUserDefaults *profiles = [NSUserDefaults standardUserDefaults]; if(rowSelected == 0) { [profiles setInteger:1 forKey:@"activeuser"]; } else if (rowSelected == 1) { [profiles setInteger:2 forKey:@"activeuser"]; } else if (rowSelected == 2) { [profiles setInteger:3 forKey:@"activeuser"]; } [profiles synchronize]; FormsViewController *rootVC = [[FormsViewController alloc] init]; UINavigationController *theNavController = [[UINavigationController alloc] initWithRootViewController:rootVC]; theNavController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentModalViewController:theNavController animated:YES]; [rootVC release]; [theNavController release]; </code></pre> <p>}</p> <p>I am wondering if it has to do with the way I am dealing with the persistent data because I didn't have this problem prior to implementing it. The user is given a UIPickerView with 3 options and the rest of the app is dependent on which of those 3 options the user chooses. Could it be the persistent data?</p>
iphone
[8]
768,371
768,372
When will one need to create a separate process in a Application?
<p>I was reading a article in Android developer blog <a href="http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html" rel="nofollow">Process and Threads</a> which talks about creating new process for specific component of Application. But I failed to understand when will creating a new process in my application becomes a absolute need. Could you please help me understand following doubts I have in this regard.</p> <ol> <li>When as a developer I should feel I need to have a separate process for a Android component/s?</li> <li>Does introducing a new process has any side effect on application's overall performance?</li> </ol> <p>Any other info is greatly appreciated.</p> <p>Thanks, SKU</p>
android
[4]
3,440,495
3,440,496
How android OS version compatibility works?
<p>If I use the following code in my app together with Android 2.1 library my app won't compile because GINGERBREAD variable is not visible.</p> <pre><code>public static boolean SUPPORTS_GINGERBREAD = android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.GINGERBREAD; </code></pre> <p>On the other hand if use 2.3 library instead of 2.1 my app is compiled and successfuly run on 2.1 device.</p> <p>Why is there no exception if I launch 2.3 compiled build on 2.1 device?</p> <p>For example if I run the same program on 1.5 device there is a crash because Android can not find SDK_INT constant which was introduced only in 1.6. Note that there is no such crash for GINGERBREAD constant which was introduced in Android 2.3</p> <p>Thanks!</p>
android
[4]
1,635,809
1,635,810
Skipping if condition in jquery
<p>I am using following code snippter on button click event. Issue is if I don't select radio button than it gives me alert undefined but if I use same condition that is if I equate value of same in if condition than it escape condition. From below code I am not getting <code>alert("Select action to perform.");</code> as this if condition is skipped.</p> <pre><code> $('#actionbutton').click(function(){ alert('HI SANKALP'); var manageradiorel = $('input[name="managerelradio"]:checked').val(); var parentid = &lt;?php echo $parentid; ?&gt;; var childid = $('#managechild').val(); var sgid = &lt;? echo $_GET["s"]; ?&gt;; var relationship = $('#childsgrel').val(); alert(manageradiorel); if(manageradiorel == "undefined"){ alert("Select action to perform."); return false; } alert("Next time"); }); </code></pre>
jquery
[5]
5,201,100
5,201,101
multiplication result is negative zero
<p>can someone tell me why the output of the code mentioned below is negative zero??</p> <p>a * b = -0</p> <p>here 'a' is of type long, b is an object of decimal class.....and if a=-28 and b=0, then the output is -0 </p>
python
[7]
4,223,346
4,223,347
java subclass method referring to field in superclass help!
<p>I have a subclass called savingsaccount. I want the method(addInterest) in savingsaccount to refer to a field in the superclass called balance. It says that balance has private access. How do i go around getting rid of this? I'm not allowed to set the field in the superclass to anything else other than private. ANy help is appreciated. This is the method in savingsaccount.</p> <pre><code>public void addInterest() { deposit(balance * interestRate / 100); } </code></pre>
java
[1]
1,729,033
1,729,034
Invoke a right click mouse from the keyboard right arrow keydown
<pre><code>$("#element").bind("keydown", function(e) { if (e.which === 39) { //if keyboard right arrow $("#element").trigger({ type: 'mousedown', button: 2 }).trigger({ type: 'mouseup' }); $("#element").bind('mousedown', function(ev) { if (ev.which === 2) { //call method - I need pageX and pageY coordinates //methods.show.apply($this, [ev.pageX, ev.pageY, options.showAnimation]); alert("called"); } }); } });​ </code></pre> <p>What I am trying to do is: Press the keyboard right arrow key, this then emulates the mouse right click trigger and now what I need is a handler so I can launch my context menu which needs X &amp; Y coordinates.</p>
jquery
[5]
1,975,185
1,975,186
Is it possible to remove voice search for edits in Android
<p>I have a requirement to suppress voice recognition button in Android SoftKeyboard. </p> <p>During my research I found the setInputMethodAndSubType which has mode parameter. But I cannot locate how it can be used. </p> <p>Any inputs.</p>
android
[4]
3,505,034
3,505,035
how to use cellValueChanged event in datadrid view to use filter function?
<p>I write a function to filter datagridview(dgv) </p> <pre><code>void filterDataGridView(DataGridView dgv, string columnName, string filterValue) { foreach (DataGridViewRow row in dgv.Rows) { if (row.Cells[columnName].Value.ToString().Contains(filterValue)) { row.Visible = true; } else row.Visible = false; } } </code></pre> <p>I have 2 dgv with same column!<br> . one of them is for searching in the secend dgv.<br> I write this function for dgv1.<br> first dgv has one row to write string in each column secend dgv contains data for searching.</p> <p>please help me how can i use firs dgv ?-->(in each cell of dgv1 i write a string ,in dgv2 it be filter) how can i do that ? how can i set properties og dgv1 and what event will be helpful and how can i use it</p> <p>thanks :)</p>
c#
[0]
3,676,617
3,676,618
What is the proper way to acces a property from an object inside several scopes of a method?
<p>For example, if I have the object:</p> <pre><code>function Website(){ this.images = []; } Website.prototype.getImages = function(){ jQuery('img').each(function(key, val){ this.images.push(val.src); }) } </code></pre> <p>and I try to call <code>website.getImages()</code> I get this error: <code>TypeError: Cannot call method 'push' of undefined</code></p> <p>So, in order to fix this, I would do:</p> <pre><code>Website.prototype.getImages = function(){ var images = this.images; jQuery('img').each(function(key, val){ images.push(val.src); }) } </code></pre> <p>But I don't see this solution as clean, because what if im trying to access several variables.</p> <p>Is there a cleaner and better way to do this?</p>
javascript
[3]
4,156,014
4,156,015
Android: Preference default Value
<p>I have a problem. I have 3 - 4 Activities. One of those is main and a second one is Preference Screen. I have a preference screen with different Preferences like ListPreference etc that have default values. How can i activate default Value of Settings when I start my project ? Because they activated only when I start Settings Activity. Shortly: I need to use default value in main activity without passing Settings Activity.</p>
android
[4]
2,514,116
2,514,117
call async asihttp in different view controller
<p>I try to use UINavigationController to navigate from one view controller to another. In both viewController , the viewWillAppear</p> <p>I call asihttp using async mode.</p> <p>but this always cause the app crash.</p> <p>I try to use the function of asihttp '[request cancel]' in the wiewWillDisaaoear, but the error still exist</p> <p>Welcome any comment</p>
iphone
[8]
3,471,138
3,471,139
Enumerate Java Fields
<p>I have a Java class with ~90 fields. I want to be able to do things to every field (generate an XML element for instance) without writing the same 5 lines of code with slight substitutions 90 times. In Objective C I think you can get to instance variables in ways similar to accessing Dictionary elements (ObjectForKey). Is there anything similar in Java such that I can get an array of the fields then do something to each of them?</p>
java
[1]
4,966,295
4,966,296
Move applications to SD card
<p>In some apps with min sdk 3 (Android 1.5), I can move application to SD card from my Desire HD.(Android 2.2) How to make it programmatically possibility to move application to SD card with Requires Android 1.5 and up. </p>
android
[4]
3,978,079
3,978,080
When is the page send to clients browser?
<p>When i build a set of elements (say 100) with php (in a loop) Is the page send to the client only when the loop is completed or is the page on client side already showing on the client before the loop is completed? Thanks</p>
php
[2]
1,632,949
1,632,950
Private Inheritance and Derived Object to Base reference
<p>As far as I understand the reason that we cannot pass a derived class object to a base class reference for private inheritance is that Since Derived is privately inherited from Base, the default constructor of Base would be called before the constructor of Derived. But because it is private and not inherited to Derived, we get a compiler error.</p> <p>But, if I try to create a public constructor for Base and inherit from Derived privately and then re-assign the public status to Base's constructor will it allow me to pass a derived's instance to Base reference?</p> <p>I tried it as follows,</p> <pre><code>#include &lt;iostream&gt; using namespace std; class base { public: base(){} void print(){ puts("In base"); } }; class derived : private base { public: base::base; /* Throws an error - Declaration doesnt declare anything*/ void print(){ puts("In derived"); } }; void func(base&amp; bRef) { } int main() { derived dObj; func(dObj); /* Throws an error - 'base' is an inaccessible base of derived */ } </code></pre> <p>It throws an error for base::base (publicizing privately inherited constructor to public). Is what I am trying valid? Can anyone please tell me?</p>
c++
[6]
5,452,485
5,452,486
Running the Android example SampleSyncAdapter
<p>I installed the example SampleSyncAdapter from the sdk into eclipse--it runs in the emulator--e.g, if i go to Settings>>Account &amp; Sync, I do see the SamplesyncAdapter Account--but i can't log in when i select it--the Google documentation is next to useless in terms of orienting developers--what should I enter to log in? How do I run the application--I want to run it in debug to walk thru the code.</p> <p>UPDATE: i found answer--if anyone is having same issue:</p> <p><a href="http://groups.google.com/group/android-developers/browse_thread/thread/ac875a97679122f0" rel="nofollow">http://groups.google.com/group/android-developers/browse_thread/thread/ac875a97679122f0</a></p> <p>Refer to the reply by Megha in the above thread--also, refer to the class NetworkUtilities if you are trying to understand how the external server is contacted for the update--in my case I will alter this class to point to a local tomcat/servlet to experiment.</p> <p>It sure is hard to understand why the Google Developer Reference site does not contain the information in the above thread--which was supplied by a google employee over a year ago.</p>
android
[4]
4,881,468
4,881,469
In what version of Python was set initialisation syntax added
<p>I only just noticed this feature today! </p> <pre><code>s={1,2,3} #Set initialisation t={x for x in s if x!=3} #Set comprehension t=={1,2} </code></pre> <p>What version is it in? I also noticed that it has set comprehension. Was this added in the same version?</p> <p><strong>Resources</strong></p> <ul> <li><a href="http://docs.python.org/library/stdtypes.html#set-types-set-frozenset" rel="nofollow">Sets in Python 2.4 Docs</a></li> <li><a href="http://docs.python.org/dev/3.0/whatsnew/3.0.html" rel="nofollow">What's new in Python 3.0</a></li> </ul>
python
[7]
687,432
687,433
Is there some way to introduce a delay in javascript?
<p>Is there some function like <code>delay()</code> or <code>wait()</code> for delaying executing of the JavaScript code for a specific number of milliseconds?</p>
javascript
[3]
5,320,131
5,320,132
Area Chart Graph in android
<p>I want to implement an Area Chart Graph in android.I prefer Area chart graph because i want to color the area of my graph.The Graph is draw using some calcutions.AnyOne have an idea reagrding how to implement the area chart graph??</p>
android
[4]
2,062,372
2,062,373
How to get variable name in PHP?
<p><code>func($name1)</code> should return <code>name1</code></p> <p>Is it possible?</p>
php
[2]
2,999,218
2,999,219
How to solve infinite recursion in java (stack overflow)?
<p>I have problem with infinite recursion. Main method will run, then if I chose 1, it will go to submenu(). But, when I choose a wrong option in submenu(), the program must be loop back to main method. </p> <p>However, this situation can result stack overflow. </p> <p>Do you have any ideas guys related to this problem? How could the it loop back to main method without calling the main()?</p> <p>Thanks a lot guys.</p> <pre><code> public void main() { // variables omitted while (menu) { switch (option) { case 1: subMenu(); break; } } } public void subMenu() { switch (a) { case 1: case 2: default: System.out.println("Invalid Option"); main(); } } </code></pre>
java
[1]
3,847,729
3,847,730
jQuery copy multiple date dropdowns to hidden field
<p>I have a form with 3 dropdown boxes to select Month/Day/Year. I need to submit the info selected in ISO 8601 format (e.g. '2012-05-30') via a hidden field. How can I use jQuery to build the date value based on what's selected in those dropdown boxes?</p> <p>The HTML is something like:</p> <pre><code>&lt;select name=month&gt; &lt;option&gt;01&lt;/option&gt; &lt;option&gt;02&lt;/option&gt; &lt;option&gt;etc...&lt;/option&gt; &lt;/select&gt; &lt;select name=day&gt; &lt;option&gt;01&lt;/option&gt; &lt;option&gt;02&lt;/option&gt; &lt;option&gt;etc...&lt;/option&gt; &lt;/select&gt; &lt;select name=year&gt; &lt;option&gt;2012&lt;/option&gt; &lt;option&gt;2013&lt;/option&gt; &lt;option&gt;etc...&lt;/option&gt; &lt;/select&gt; &lt;input type="hidden" name="date" value=""&gt; </code></pre>
jquery
[5]
89,335
89,336
How to send email with attachment using GmailSender in android
<p>I want to know about how to send email with attachment using GmailSender in android.</p>
android
[4]
4,162,096
4,162,097
Static methods vs instance methods in BLL
<p>Was asked today why I used code like this for my bll classes in an asp.net app:</p> <pre><code>public class StudentBll { public static DataTable GetStudents() { return DBHelper.ExecuteSp("GetStudents"); } public static DataTable GetStudentById(int studentId) { return DBHelper.ExecuteSp("GetStudentById", studentId); } } </code></pre> <p>instead of</p> <pre><code>public class StudentBll { public DataTable GetStudents() { return DBHelper.ExecuteSp("GetStudents"); } public DataTable GetStudentById(int studentId) { return DBHelper.ExecuteSp("GetStudentById", studentId); } } </code></pre> <p>Only thing I could think of was that</p> <p>A) <strong>Performance</strong> A slight increase (not sure of the specifics)</p> <p>B) <strong>Readability</strong> <code>StudentBll.GetStudents();</code> rather than </p> <pre><code>StudentBll studentBll = new StudentBll(); studentBll.GetStudents(); </code></pre> <p>I wasn't too confident in those answers, however. Anyone care to enlighten me?</p>
c#
[0]
5,242,535
5,242,536
Getting the item with the maximun value in list of dicts after grouping the dict by key
<p>I have a list of dicts that looks like this:</p> <pre><code>[{'apples': 99}, {'bananas': '556685'}, {'apples': 88}, {'apples': '2345566'}] </code></pre> <p>I would like to group the items by the key and return the key of the item with the highest value? i.e. sum up the values all the apples and sum up the values of all the bananas ad return the higher one — apple or banana I can't seem to figure out a good way of doing this and I'm trying to avoid using a bunch of loops and counter variables.</p> <p>(Just out of curiosity, is this possible as a one-liner? if so, how?)</p> <p>Thanks</p>
python
[7]
5,619,177
5,619,178
mapp pagination with image in image slider using jQuery
<p>I have slider images &amp; below those I have pagination. Please check url :-</p> <pre><code>http://210.7.76.139:965/dominie/index.php/index &lt;div id="gallery"&gt; &lt;div class="gallary_image"&gt; &lt;a id="tab1" class="" href="#" style="opacity: 0.763923;"&gt; &lt;img width="777" height="441" rel="Diana" alt="Diana" title="Diana" src="http://210.7.76.139:965/dominie/media/Diana.png" class="banner-image-class"&gt; &lt;/a&gt; &lt;a id="tab2" class="show" href="#" style="opacity: 0.236077;"&gt; &lt;img width="777" height="441" rel="Evel" alt="Evely" title="Evely" src="http://210.7.76.139:965/dominie/media/evely.png" class="banner-image-class"&gt; &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="indentmenu" id="pettabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a class="pagination tab1" rel="tab1"&gt;1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a class="pagination tab2 selected" rel="tab2"&gt;2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Now I want that when I will click on 1 pagination then image 1 will show &amp; when click on 2 second image will show.</p> <p>Class <code>show</code> is changing on the basis of image appears &amp; in same way class <code>selected</code> changes based on pagination active.</p> <p>Please help me </p>
jquery
[5]
1,969,250
1,969,251
Android following class could not be found
<p>I'am trying to load a spinner to my layout and keep geting this error:</p> <p>The following classes could not be found: - Spinner (Change to android.widget.Spinner, Fix Build Path, Edit XML)</p> <p>heres my xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;Spinner android:id="@+id/spn_dates" android:layout_width="match_parent" android:layout_height="wrap_content" android:onClick="displayDatesToSpiner" /&gt; &lt;ListView android:id="@+id/LST_bought_products" android:layout_width="match_parent" android:layout_height="302dp" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks</p>
android
[4]
5,191,235
5,191,236
how lightboxes for pics works? they use iframes? how they download pics?
<p>how lightboxes for pics works? they use iframes? how they download pics?</p>
javascript
[3]
1,199,670
1,199,671
NullPointerException at: int start = Math.max(chat.first, chat.last-10);
<p>I have the following Java code in a JSP:</p> <pre><code>21: ChatState chat = (ChatState)application.getAttribute(ChatConstants.APP_STATE); 22: // assert(chat != null); 23: 24: int start = Math.max(chat.first, chat.last-10); 25: for (int i=start; i&lt;chat.last; i++) { 26: out.println(i + "User Says: " + chat.chat.get(i)); 27: } </code></pre> <p>Line 24 throws the following exception:</p> <pre><code>java.lang.NullPointerException org.apache.jsp.chat_jsp._jspService(chat_jsp.java:77) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) </code></pre>
java
[1]
471,374
471,375
packing a c++ project for release with some dependencies like pthread boost curl etc
<p>I am writing an c++ application where i use a lot of libraries like boost curl,pthread etc. I am not sure how to pack the application with all the dependencies for production use. What is the best way to distribute the application with dependencies?</p>
c++
[6]
716,223
716,224
Java bean class
<p>Bean class /encapsulation means variable should be private &amp; getter &amp; setter should be public. Because of the reason data hiding.Anybody can't access this variable out side.</p> <p>My Question is :`With the getter/setter method we can access/set variable from outside class.Then why we need to keep that variable private &amp;&amp; how we can tell this is data-hiding? </p> <p>Actually i like to get some explanation because , without any idea just i am doing project like this. Please if there are any mistake or unclear question, please forgive me. </p> <p>Please anybody explain this. </p> <p>Thanks in advance</p>
java
[1]
5,368,812
5,368,813
Image blur in android
<p>I have taken thumbnail image from gallery which is smaller in size and resized into 300*300 size.</p> <p>By doing that the image looking so blurred.</p> <p><strong>getting image from gallery</strong></p> <pre><code> @Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(requestCode, resultCode, imageReturnedIntent); switch (requestCode) { case 0: if (resultCode == RESULT_OK) { try { flag = 1; Uri selectedImage = imageReturnedIntent.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String filePath = cursor.getString(columnIndex); // file // path // of // selected // image cursor.close(); // Convert file path into bitmap image using below line. yourSelectedImage = download.getResizedBitmap( image.decodeImage(filePath),270,228); // put bitmapimage in your imageview profile_image.setImageBitmap( yourSelectedImage); } catch (Exception e) { e.printStackTrace(); } } } } </code></pre> <p><strong>Image resizing</strong></p> <pre><code>public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { try { if(bm!=null) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // create a matrix for the manipulation Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); // recreate the new Bitmap resizedBitmap = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true); } } catch(Exception e) { e.printStackTrace(); } return resizedBitmap; } </code></pre>
android
[4]
533,054
533,055
php exercises
<p>I'm looking for exercises that will help me to learn php (complex loops, arrays, tricks etc)</p>
php
[2]
575,050
575,051
Can't read SharedPreferences fron another application
<p><strong>EDITED:</strong></p> <p>I have one app that writes to SharedPreferences like that:</p> <pre><code> Context otherAppsContext = null; try { otherAppsContext = createPackageContext("AfroKeyboard.com.rob", Context.CONTEXT_IGNORE_SECURITY); } catch (NameNotFoundException e) { } SharedPreferences sharedPreferences = otherAppsContext.getSharedPreferences("PREFS_PRIVATE", Context.MODE_WORLD_READABLE); Editor prefsPrivateEditor = sharedPreferences.edit(); prefsPrivateEditor.putString("layout02", jString); prefsPrivateEditor.putString("layout02name", "Russian Layout"); prefsPrivateEditor.commit(); </code></pre> <p>and another app that has to read from them</p> <pre><code> Context otherAppsContext = null; try { otherAppsContext = createPackageContext("AfroKeyboard.com.rob", Context.CONTEXT_IGNORE_SECURITY); } catch (NameNotFoundException e) { } SharedPreferences sharedPreferences = otherAppsContext.getSharedPreferences("PREFS_PRIVATE", Context.MODE_WORLD_READABLE); Log.e( "name2" , "name2: "+sharedPreferences.getString("layout02name", "") ); </code></pre> <p>but it returns empty.</p> <p>What do you think might be the problem?</p> <p>Thanks!</p>
android
[4]
5,506,238
5,506,239
Running in IDLE sometimes returns nothing & Optimizing
<p>Sometimes when I run this in IDLE, the shell will only show</p> <blockquote> <p> >></p> </blockquote> <p>However, when I close the window and kill the program, it'll appear as normal for a split second before closing. Most of the time it will work though.</p>
python
[7]
706,753
706,754
c++ - Is there a way to auto-cast values when assigning them to references`?
<p>I'm wondering if there is some way that C++ autocasts values that I want to assign to a reference.</p> <pre><code>class X{ public: X(int x){ } }; int main(){ X x = 5; //works X&amp; y = 6; //doesn't work X&amp; z = (X)7; //works return 0; } </code></pre> <p>As you can see, assigning 6 to the reference y does not work without casting it before. Is there something I can add in the definition of the class X to make this work without the casting, so that the non-working line would work?</p> <p>Basically I want to achieve that, for example a function like this:</p> <pre><code>void doSomething(X&amp; x){ //... } </code></pre> <p>Could be called like this after that:</p> <pre><code>doSomething(7); </code></pre> <p>Is it possible?</p>
c++
[6]
3,747,048
3,747,049
how to get dropdown(select box) all value and write in any div
<p>i have dropdown(select) box Like :</p> <pre><code>&lt;select name="drp_name" id="drp_name"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;/select&gt; </code></pre> <p>i want get all option value and write(print) in any div like :</p> <pre><code>&lt;div id="main_div"&gt; &lt;div&gt;1&lt;/div&gt; &lt;div&gt;2&lt;/div&gt; &lt;div&gt;3&lt;/div&gt; &lt;div&gt;4&lt;/div&gt; &lt;div&gt;5&lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
4,793,901
4,793,902
To detect service idle
<p>How to programmatically detect either my Apache webserver is idle using C#? I already have an open source program that monitors mouse movement. But how can I monitor either the targeted server is idle/up/down?</p>
c#
[0]
4,399,852
4,399,853
How to find address in iPhone using latitude and longitude?
<p>I have a question: How to find address in iPhone using latitude and longitude?</p>
iphone
[8]
4,370,722
4,370,723
Why getItemViewType() is missing in RemoteViewsService.RemoteViewsFactory in Android?
<p>For normal Base Adapter, there is both <code>public abstract int getItemViewType (int position)</code> and <code>public abstract int getViewTypeCount ()</code>, but there is just public abstract int getViewTypeCount () in <code>RemoteViewsService.RemoteViewsFactory</code> when I develop HomeScreen Widget. How can I make use of <code>getItemViewType</code> ??</p>
android
[4]
4,622,730
4,622,731
How to unset Socks Proxy
<p>I am able to set a socks proxy server by code like this:</p> <pre><code> System.getProperties().setProperty("socksProxySet", "true"); System.getProperties().setProperty("socksProxyHost", address); System.getProperties().setProperty("socksProxyPort", port); </code></pre> <p>Accordind to <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html" rel="nofollow">http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html</a>, I can unset a HTTP, HTTPS and FTP proxy like this:</p> <pre><code> System.setProperty("http.proxyHost", null); </code></pre> <p>Question: Can I unset a socks proxy as well?</p> <p>By doing:</p> <pre><code> System.getProperties().setProperty("socksProxyHost", null); </code></pre> <p>I got nothing but a NullPointerException...</p> <p>Ty</p>
java
[1]
1,626,138
1,626,139
javascript code architecture question
<p>I'm about to make a web app which will have a pretty heavy client end. I'm not sure about the way to organize my javascript code, but here is a basic idea :</p> <pre><code>// the namespace for the application var app = {}; // ajax middle layer app.products = { add : function(){ // send ajax request // if response is successful // do some ui manipulation app.ui.products.add( json.data ); }, remove : function(){}, ... }; app.categories = { add : function(){}, .... }; // the ui interface which will be called based on ajax responses app.ui = {}; app.ui.products = { add : function( product_obj ){ $('#products').append( "&lt;div id='"+product_obj.id+"'&gt;"+product_obj.title+"&lt;/div&gt;" ); } }; app.ui.categories = {}; </code></pre> <p>Anybody got similar experiences to tell me the pros and cons of this approach? What's your way of designing client side javascript code architecture? Thanks. </p> <p>[update] : This web app, as you see from the above, deals with products CRUD, categories CRUD only in a ajax fashion. I'm only showing an snippet here, so you guys know what I'm trying to achieve and what my question is. Again, I'm asking for inputs for my approach to organize the code of this app. </p>
javascript
[3]
2,454,676
2,454,677
Clicking on List Item also clicks the checkboxes inside item
<p>I've a listview where each listitem has a checkbox. When I click list item, OnItemClick is called but checkbox is also clicked, that's annoying coz checbox onclick actions are triggered.</p> <p>Edit: how can I prevent checkbox from being clicked when row Item is clicked?</p>
android
[4]
701,060
701,061
Trying to make a thai translator in Python, but am unable to write using Thai characters
<p>I am trying to make a thai translator, but am unable to write using Thai characters. I saw somewhere to do this to check what the default encoding is:</p> <pre><code>import sys; print(sys.getdefaultencoding()) </code></pre> <p>I get utf-8 </p> <p>My problem is that I just get ?? when I use Thai characters. Is there a way that I can use them? A different question I am trying to translate a sentence and was wondering how to put a space in between words. As of right now I just get all the words combined in the .txt file. </p> <pre><code>s = shelve.open("THAI.dat") s[entry]=define text_file = open("THAI.txt", "w+") num = int(input("How many words are in sentence")) while num != 0: trys = input("Input english word") if trys in s: print(s[trys]) part = s[trys] text_file.write(part) num -= 1 </code></pre>
python
[7]
5,323,122
5,323,123
loop my function but not able to do it properly
<p>i have a code which i want to run in loop but its only running one time i tried intervel but its not working</p> <p>here is the code :</p> <pre><code>var getposition = 0; var intervalinfo ; function setpostion(){ document.getElementById("join").style.position = "absolute"; document.getElementById("join").style.left = "0px"; document.getElementById("join").style.top = "100px" intervalinfo = setInterval(getanimation ,50); } function getanimation() { getposition += 5; document.getElementById("join").style.left = getposition + "px"; if (getposition &gt; 500) { // clearInterval(intervalinfo); document.getElementById("join").style.left = "0px"; } } window.onload = function() { setTimeout(setpostion , 2000); } </code></pre> <p>Any help is really appreciable in advance :-)</p>
javascript
[3]
3,933,418
3,933,419
How to add checkboxes into dropdown in php?
<p>I am using core php. I want to add checkboxes inside dropdown list so can select multiple values. Please give me solution.</p>
php
[2]
1,547,614
1,547,615
Possible to activate camera led in torch mode while using the video recorder?
<p>I have an app that needs to record video while the led flashlight is on in torch mode. I know its possible in android while taking pictures but is it while using the Media recorder? Thanks for your help in advance. </p>
android
[4]
1,941,558
1,941,559
Prevent the loading of images
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2784418/lazy-load-images-when-they-come-into-the-viewport">Lazy load images when they come into the viewport</a> </p> </blockquote> <p>How can I prevent the loading of all image data in a long grid of images, but only loading the visible images. The others should be loaded on demand, when the potion of the grid they're in gets within the visible area of the screen. </p>
javascript
[3]
4,671,466
4,671,467
Failed Binder Transaction between activities but not between service and activity?
<p>Currently I have a background service that acts as a shared data holder for a couple apps. For some reason, it doesn't have any problem passing along some couple thousand parcelables in an array list along to the app, but when it comes to passing along that data within that app to a new activity that's being launched, I get a "FAILED BINDER TRANSACTION!" error.</p> <p>Any idea why there's an arbitrary different limit between the two?</p>
android
[4]
3,846,449
3,846,450
how to catch Error globally on android?
<p>When an exception occurs, i try to report it to a log server.</p> <p>i have caught an exception which inherited java.lang.RuntimeException when using <code>Thread.setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler handler)</code>. but i haven't caught any subclasses that have inherited java.lang.Error. (ex. OutOfMemoryError, IOError, ...)</p> <p>so i use <code>Runtime.addShutdownHook(Thread hookThread)</code>, but the <code>hookThread.run()</code> method is never called.</p> <p>how do i catch an Error globally on android? i do not want to use another process.. i just want to try to report a bug on the log server.</p> <p>sorry evertyone, i try to catch error throwable continuedly, and i know java.lang.Error also is caught. but not run implemented function in UncaughtExceptionHandler.uncaughtException().</p> <p>just.. printed log for checking.</p>
android
[4]
3,605,267
3,605,268
Make javascript mandatory in web application?
<p>I am building a web application that will have a fair bit of forms. The html forms are generated using php.</p> <p>One of the things I came across is this:</p> <p>I have a drop down box for the user to select his country. Once he selects the country, a call is made to the server to fetch a list of states within that country and populate it in a drop down box.</p> <p>Initially, I thought I could provide 2 options:</p> <ul> <li>An enhanced jquery version where ajax is used to fetch the states and the populate it in a drop down.</li> <li>Where javascript is not availiable, the whole page is submitted to the server and then rerendered with the new states in the drop down.</li> </ul> <p>However, onChange() requires javascript. So if someone where to visit the form without javascript enabled, there's no way we can deal with the second option, since javascript is required to submit a form using onChange(). </p> <p>What are some ways to deal with this? My only solution at the moment is to just make javascript mandatory. Users without javascript enabled will see a message saying that the page will not work properly.</p> <p>Some sites:</p> <ul> <li>Hotmail.com - Refuses to show anything except a "javascript is required message"</li> <li>Facebook.com - Tells us we should use the mobile version of the site.</li> <li>Google Maps - Does not work. No message to say javascript is required.</li> <li>Gmail - Falls back to basic html.</li> <li>Google account - Does not work. No message to say javascript is required.</li> </ul> <p>Is it acceptable to require users to have javascript enabled at the current state of the web (august 2011)?</p> <p>Just came across this possible solution: <a href="http://cita.disability.uiuc.edu/html-best-practices/auto/onchange.php" rel="nofollow">http://cita.disability.uiuc.edu/html-best-practices/auto/onchange.php</a></p> <p>I could perhaps add a button which the user can use to select their country. This should allow us to reload and render the form with the states drop down without any javascript.</p>
javascript
[3]
1,346,008
1,346,009
Android random string doesn't check
<p>Random string works fine.</p> <p>Doesn't work check now. I enter the text to what has been EditText drawn.</p> <p>But the check is not working. Why? Code: </p> <pre><code> public static StringBuffer random() { String str = new String( "G12HIJdefgPQRSTUVWXYZabc56hijklmnopqAB78CDEF0KLMNO3rstu4vwxyz9"); StringBuffer sb = new StringBuffer(); sb.toString(); String ar = null; Random r = new Random(); int te = 0; for (int i = 1; i &lt;= 10; i++) { te = r.nextInt(62); ar = ar + str.charAt(te); sb.append(str.charAt(te)); } return sb; } public void onCreate(Bundle icicle) { setContentView(R.layout.main); random = random().toString(); TextView display = (TextView) findViewById(R.id.textView1); display.setText("Random Number: " + random); // Show the random number et = (EditText) findViewById(R.id.etNumbers); ok = (Button) findViewById(R.id.button1); ok.setOnClickListener(this); } public void onClick(View arg0) { // TODO Auto-generated method stub try { charsEntered = et.getText().toString(); } catch (NumberFormatException nfe) { Toast.makeText(et.getContext(), "Bla bla bla", Toast.LENGTH_LONG) .show(); } if (random == charsEntered) { Toast.makeText(et.getContext(), "Good!", Toast.LENGTH_LONG).show(); } else { Toast.makeText(et.getContext(), "Bad!", Toast.LENGTH_LONG).show(); } } } </code></pre>
android
[4]
342,807
342,808
Breaking the string in certain number of characters
<p>I am looking for the shortest, elegant way to break the unicode string in to certain number of character.</p> <p>I am having the div enter code herewith different language strings. I am breaking the string after certain number of characters. But for capital and small letters in English there was UI distortion.</p> <p>I am looking for some workaround to break the string uniform way for any Unicode or capital character or numbers so UI remains intact.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test &lt;/title&gt; &lt;style&gt; .contri-title { float:left; width:625px; background-color:#fff0f0; } } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="contri-title bottom-part" id="art_title"&gt;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA&lt;/div&gt; &lt;br&gt; &lt;div class="contri-title bottom-part" id="art_title"&gt;aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php
[2]
5,602,530
5,602,531
Curious: Why is the "throws <SomeSpecific>Exception" syntax required in Java alone?
<p>We all know it is needed.</p> <p>But WHY is it needed in Java alone, when other similar languages that have exception handling capablities don't require us to write "throws Exception"? Is there anyone who knows what was happening when Java language was designed and why they made it that way? Just curious.</p> <p>P.S. This may not be a practical or really necessary question - it might not help me in anyway with my ongoing projects. But certain language features kindle my curiosity :D</p> <p><strong>Edit</strong> Looks like my question was very vague! I think I worded the question wrongly. We need to use the "throws Exception" kind of syntax at some points during programming when dealing with Java code. But something like that is never needed in C# or C++ or even VB.Net and PHP. So why Java alone insists on this?</p>
java
[1]
2,039,770
2,039,771
how i can Toggle this ul by jquery
<p>please any one can slideToggle this ul i use the jquery</p> <pre><code>&lt;ul id="flags_16"&gt; &lt;li&gt; &lt;a href="#" class="nb"&gt; &lt;img src="en.png" class="imgvatb"&gt;langs&lt;/a&gt; &lt;ul style="display: none;"&gt; &lt;li&gt; &lt;a href="en" class="nb"&gt; &lt;img src="en.png" class="imgvatb"&gt; english&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p> </p>
jquery
[5]
3,480,333
3,480,334
How to handle keys on certain area
<p>I wan to ask you, how to handle keys on certain area with this library <a href="http://www.openjs.com/scripts/events/keyboard_shortcuts/" rel="nofollow">http://www.openjs.com/scripts/events/keyboard_shortcuts/</a> It's shown only with document, and when i try '#dmine_div' it does not work.How it must be ? </p>
javascript
[3]
5,575,236
5,575,237
xml ws contain one string with no tags
<p>I have an xml WebService URL that contain only this line"hi this invalid number" I wanna read this line to my aandroid app at textView or alert msg I used the next code but it return nothing !!! is there any way to solve this issue?? </p> <p>int eventType = xpp.getEventType();</p> <pre><code> while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_DOCUMENT) { strData=xpp.nextText(); }else if(eventType==XmlPullParser.END_DOCUMENT){// &amp;&amp; xpp.getName().equalsIgnoreCase(tag) insideItem=false; } eventType = xpp.next(); //move to next element //tx.setText(String.valueOf(x)); } }catch (MalformedURLException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }catch (Exception e) { e.printStackTrace(); } tx.setText(strData); </code></pre>
android
[4]
2,349,148
2,349,149
Return position of an item in ArrayList
<p>I know that I can iterate the list and prove every element of the list. But I was wondering if there is better solution to get the position of an item in an ArrayList?</p>
java
[1]
2,157,045
2,157,046
Delete memory in inheritance
<p>I have code below, it always has memory leak please help me.</p> <p>Thanks, Ankata</p> <hr> <pre><code> class ABCD { public: ABCD(void); ~ABCD(void); CString tem1; CString tem2; }; class CDE : public ABCD { public: CDE(void); ~CDE(void); CString tem; }; void main() { CList&lt;ABCD*&gt; m; CDE *a = new CDE(); a-&gt;tem1 = "AAA"; a-&gt;tem2 ="BBB"; a-&gt;tem ="CCC"; m.AddTail(a); ABCD *b = m.GetTail(); delete b; } </code></pre>
c++
[6]
5,885,884
5,885,885
Remove divs around a div
<p><strong>My HTML</strong></p> <pre><code>&lt;div class="wrapper"&gt; &lt;div class="wrapper2"&gt; &lt;div class="real_content"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Question</strong></p> <p>Is there any way for me to remove the 2 divs around <code>&lt;div class="real_content"&gt;&lt;/div&gt;</code> so it won't appear on HTML and front end of my website? Thanks.</p>
jquery
[5]
2,145,363
2,145,364
Java Calendar problem: why are these two Dates not equal?
<pre><code>import java.io.*; public class testing { public static void main(String a[]) throws Exception{ Date d1=new Date(); Thread.sleep(2000); Date d2=new Date(); if(d1.equals(d2)){ System.out.println("Both equal"); }else{ System.out.println("Both not equal"); } Calendar c1=Calendar.getInstance(); Calendar c2=Calendar.getInstance(); c1.setTime(d1); c2.setTime(d2); c1.clear(Calendar.HOUR); c1.clear(Calendar.MINUTE); c1.clear(Calendar.SECOND); c2.clear(Calendar.HOUR); c2.clear(Calendar.MINUTE); c2.clear(Calendar.SECOND); if(c2.compareTo(c1) == 0){ System.out.println("Cal Equal"); }else { System.out.println("Cal Not Equal"); } } } </code></pre> <p>When I run the above code multiple times of which each time (for printing if conditions of date) 'Both not equal' is printed but (for if condition of Calendar) sometimes it prints 'Cal Equal' and sometimes 'Cal Not Equal'. Can anyone please explain me why this is so?</p> <p>The main reason I was trying this because I want to compare two dates. Both have same day, month and Year but different time of the day when the objects were created. I want them to be compared equal(same). How should I do this?</p>
java
[1]
2,192,424
2,192,425
How do you strip whitespace from an array using PHP?
<p>I was wondering how can I strip white space from an array using PHP?</p>
php
[2]
276,613
276,614
Attribute mapping with a Python property
<p>Is there a way to make a Python <code>@property</code> act as a setter and getter all at once?</p> <p>I feel like I've seen this somewhere before but can't remember and can't recreate the solution myself.</p> <p>For example, instead of:</p> <pre><code>class A(object): def __init__(self, b): self.b = b def get_c(self): return self.b.c def set_c(self, value): self.b.c = value c = property(get_c, set_c) </code></pre> <p>we could somehow signal that for <code>A</code> objects, the <code>c</code> attribute is really equivalent to <code>b.c</code> for getter, setter (and deleter if we like).</p> <h2>Motivation:</h2> <p>This would be particularly useful when we need <code>A</code> to be a proxy wrapper around <code>B</code> objects (of which <code>b</code> is an instance) but share only the data attributes and no methods. Properties such as these would allow the <code>A</code> and <code>B</code> objects' data to stay completely in sync while both are used by the same code.</p>
python
[7]
1,957,976
1,957,977
Bad magic number while trying to import .pyc module
<p>I have some problems while trying to import some module (compiled .pyc) in my program. I know that it compiled in Python 2.6.6 (r266:84297), I have installed the same version, but had an error "bad magic number" while trying to import it :(</p> <p>Does anybody know what I did wrong? Or maybe it's possible to change magic number in .pyc module?</p>
python
[7]
4,958,402
4,958,403
java how to know if a process is waiting for input
<p>I'm trying to create a process in java that starts a external file that asks for a number of arguments which the user gives at execution time.</p> <p>The question is how to determine if the precess is asking for a argument </p> <pre><code> ProcessBuilder pb = new ProcessBuilder(c.fileName); Process proc = null; try { proc = pb.start(); } catch (IOException ex) { Logger.getLogger(clas.class.getName()).log(Level.SEVERE, null, ex); } Scanner in = new Scanner(proc.getInputStream()); PrintWriter out = null; out = new PrintWriter(proc.getOutputStream()); while (in.hasNextLine()) { System.out.println(in.nextLine()); out.println(1); // i don't want to give 1 untill the process need it ! out.flush(); } out.close(); </code></pre>
java
[1]
983,187
983,188
NSNotification in iphone sdk
<p>what is the use of <strong>NSNotification</strong> in iphone sdk?</p> <p>Thanks</p>
iphone
[8]
1,842,280
1,842,281
PHP: Is it possible to set the domain when creating a session?
<p>On mydomain.com if I run this code:</p> <pre><code>session_start(); $_SESSION['close_label'] = '1'; </code></pre> <p>and then onspect the session cookie in my browser, it says:</p> <blockquote> <p>domain: .mydomain.com</p> </blockquote> <p>Is it possible to have it say:</p> <blockquote> <p>domain: .someotherdomain.com</p> </blockquote> <p>or not?</p>
php
[2]
2,653,394
2,653,395
getApplication use in onClick method
<p>I use Application to access my data. And while buttom be click, I want to use the data which in Application. I use below code:</p> <pre><code>b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { MyData md = (MyData)this.getApplication(); md.setName(""); md.setIP(""); } }); </code></pre> <p>But the error show:</p> <pre><code>The method getApplication() is undefined for the type new View.OnClickListener(){} </code></pre> <p>How to use getApplication in onClick method?</p>
android
[4]
4,136,809
4,136,810
get variable from included file?
<p>I have a php file. Name is never mind.<br/> I think you will understand. But i want to use function.</p> <p>Example.php file have a variable that reserve file name.</p> <pre><code>&lt;?php $name = "abcdfg"; ?&gt; </code></pre> <p>And my function is:</p> <pre><code>function getData($arg) { require_once($arg . '.php'); //return } </code></pre> <p>If i write</p> <pre><code>&lt;?php echo var_dump(getData("$name")); ?&gt; </code></pre> <p>I need to get</p> <pre><code>"abcdfg" </code></pre> <p>I'm waiting your reply..</p>
php
[2]
92,738
92,739
Concat performance
<p>I was reading a <a href="http://blogs.msdn.com/b/wesdyer/archive/2007/03/23/all-about-iterators.aspx?PageIndex=2#comments" rel="nofollow">blog post</a> on msdn about iterators which talks about about how <code>Concat</code> has <code>O(m^2)</code> performance where <code>m</code> is the length of the first <code>IEnumerable</code>. One of the comments, by richard_deeming on the second page, provides some sample code which he says is much faster. I don't really understand why it's faster and was hoping someone could explain it to me.</p> <p>Thanks.</p>
c#
[0]
927,061
927,062
storing image in Db using asp.net
<p>Im developing art gallery which needs 1000s of images to be uploaded so inserting images in DB won't be feasible. so i want to give link of folder inside db where ultimately images should get stored. plz help.</p>
asp.net
[9]
5,925,224
5,925,225
Open/Save as dialog box
<p>Jquery:</p> <p>Is there a way to catch the event that is fired when the browser opens the Open/ Save as dialog box? <img src="http://qpack.orcanos.com/helpcenter/Images/openSave.png" alt="Open/Save dialog example"></p> <p>I need to do something when the dialog is shown.</p>
jquery
[5]