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,611,991
3,611,992
Disable keypad or whole keyboard support on android activity?
<p>I have a layout with lots of different imagebuttons on it.<br> Application is developed in full-touch, so there should be no response to keyboard or keypad on all activities except one, where user can input his name.<br> Is there a way to achieve that? </p> <p>I've checked on debug, keypress and keypad press result in onKeyDown event.<br> I've set it to return 'false' for all keys.<br> But, for some reason, android keeps selecting my imagebuttons when keypad is pressed.<br> And pressing Enter key result in View.onClick event.</p> <p>How to totally disable all keyboard input for activity?<br> I use Motorola Milestone for tests - a slider with a keyboard<br> Thanks</p>
android
[4]
3,548,184
3,548,185
Loop through list from specific point?
<p>I was wondering if there was a way to keep extremely large lists in the memory and then process those lists from specific points. Since these lists will have as many as almost 400 billion numbers before processing we need to split them up but I haven't the slightest idea (since I can't find an example) of where to start when trying to process a list from a specific point in Python. Edit: Right now we are <em>not trying to create multiple-dimensions</em> but if it's easier then I'll for sure do it.</p>
python
[7]
3,699,097
3,699,098
Display multiple anchor links within a single div container
<p>I'm trying to display multiple anchor links within the same div container...specifically pdf files. I'm fairly new to jQuery and was hoping there'd be a way to do it. </p>
jquery
[5]
4,030,350
4,030,351
How can i get timezone by IP address in US?
<p>In example,<br> I have an IP address from US.<br> I'm using this function : </p> <pre><code>$timeZone = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, "US"); </code></pre> <p>to get the location.<br> I'm getting an array : </p> <pre><code>0 =&gt; string 'America/Adak' 1 =&gt; string 'America/Anchorage' 2 =&gt; string 'America/Boise' </code></pre> <p>how can I know from the IP address what is the location that I need? </p> <p>thanks,</p>
php
[2]
2,500,235
2,500,236
Unable to find dtw_std in mlpy 3.5.0
<p>I was trying to use the mlpy-3.5.0 on Ubuntu 10.04.4 LTS ( Python 2.6.5 ), but after the packages import, at the point I will perform the DTW instruction, an error happens and the following log is shown:</p> <p><strong>Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'dtw_std'</strong></p> <p>An interesting thing also occurs when I was googling about it and found this <a href="https://groups.google.com/forum/?fromgroups=#!topic/mlpy-general/7902Ae6soCI" rel="nofollow">relevant topic</a>: if I replace by mlpy.Dtw(), it works! So I would like some help.</p> <p>Here is the source code, also provided by the package:</p> <blockquote> <blockquote> <blockquote> <p>import mlpy</p> <p>x = [0,0,0,0,1,1,2,2,3,2,1,1,0,0,0,0]</p> <p>y = [0,0,1,1,2,2,3,3,3,3,2,2,1,1,0,0]</p> <p>dist, cost, path = mlpy.dtw_std(x, y, dist_only=False)</p> </blockquote> </blockquote> </blockquote> <p><em>Thanks in advance,</em></p>
python
[7]
2,855,114
2,855,115
string to encode in CodePage 857
<p>I need a function that can print Turkish characters.</p> <pre><code>public String convert(String input) { String output = new String(s.getBytes(input), "CodePage-857"); return output; } </code></pre> <p>Is there anyone out there can show me how to achieve this?</p> <p>Thank you</p>
java
[1]
1,993,223
1,993,224
the chk_all dosnt work to enable all other child boxes for the first attempt
<pre><code>&lt;input type="checkbox" id="checkMain" /&gt; &lt;p&gt;&lt;input type="checkbox" id="checkMain1" /&gt; &lt;p&gt;&lt;input type="checkbox" id="checkMain2" /&gt; &lt;P&gt;&lt;input class="child" type="checkbox" id="chk1" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk2" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk3" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk4" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk5" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk6" disabled="true" /&gt; &lt;input class="child" type="checkbox" id="chk_all" disabled="true" /&gt;ALL&lt;/p&gt; &lt;/html&gt; $ ( function() { $("input[id^=checkMain]").click ( function() { var otherCks = $("input[id^=checkMain]").not(this); if( !$(this).is( ":checked" )) { $(".child").attr("disabled" , true ); $(function() { $("#chk_all").click(function() { var checked_status=this.checked $("input[id^=chk]").each (function() { this.checked=checked_status; }); }); } ); otherCks.removeAttr ( "disabled" ); } else { $(".child").removeAttr ( "disabled" ); otherCks.attr("disabled" , true) } } ); } ); </code></pre>
jquery
[5]
1,076,770
1,076,771
Beginner Issue (Python) - How do I remove words from a list under a certain length
<p>This is what I do:</p> <pre><code>for word in doc: if len(word) &lt; 3: doc.remove(word) </code></pre> <p>But, if I do this:</p> <pre><code>for word in doc: if len(word) &lt; 3: print word </code></pre> <p>The results returned are: 'O,' 'Of' '30' '4.' 'I.' 'IF' and more.</p> <p>Most two character items are removed, but a few still remain, am I doing something wrong?</p>
python
[7]
5,957,163
5,957,164
Server for streaming from android to web
<p>I am trying to develop an android application that will stream the video from android mobile to the web (similar to Qik). I had gone through RED5, MAMMOTH and RTMPD servers. </p> <p>My question is which web server I should use? Which is the best supported on android? Is there any other alternative to do this?</p> <p>If there is some tutorial or code is available, please point it to me.</p> <p>Thanks</p>
android
[4]
2,598,525
2,598,526
How rotate image with different angle?
<p>I have implemented speedometer i have one arrow image.i want to rotate 0 to 180 very smoothly.how it possible?</p>
iphone
[8]
651,936
651,937
How to create periodic table in android?
<p>I am trying to create periodic table in android for my app , creating all buttons for each element is not so efficient. please suggest !</p>
android
[4]
2,770,095
2,770,096
find out if url is compressed
<p>I just have a question thats been pozzling my head all morning.</p> <p>I want to get all http headers thru CURL ... and find out, if pinged url is compressed, or not. (either one of: gzip / x-gzip / deflate / compress) </p> <p>But all I can get from CURL is this:</p> <pre><code>[url] =&gt; http://www.url [content_type] =&gt; text/html; charset=UTF-8 [http_code] =&gt; 302 [header_size] =&gt; 764 [request_size] =&gt; 54 [filetime] =&gt; -1 [ssl_verify_result] =&gt; 0 [redirect_count] =&gt; 0 [total_time] =&gt; 0.042535 [namelookup_time] =&gt; 0.002779 [connect_time] =&gt; 0.014986 [pretransfer_time] =&gt; 0.015039 [size_upload] =&gt; 0 [size_download] =&gt; 0 [speed_download] =&gt; 0 [speed_upload] =&gt; 0 [download_content_length] =&gt; 218 [upload_content_length] =&gt; 0 [starttransfer_time] =&gt; 0.042204 [redirect_time] =&gt; 0` </code></pre> <p>Nothnig like "Content-encoding" ... any chance to get that thru PHP?</p>
php
[2]
2,810,423
2,810,424
ContentLength field 0 on client web service
<p>I am using this to get started on returning a stream:</p> <pre><code>[WebGet(UriTemplate = "GetTestData/{file}")] public Stream GetTestData(string file) { string fileName = "\\testdirectory" + file; if (File.Exists(fileName)) { FileStream stream = File.OpenRead(fileName); if (WebOperationContext.Current != null) { long fileSize = new System.IO.FileInfo(filePath).Length; WebOperationContext.Current.OutgoingResponse.ContentType = "text/.txt"; WebOperationContext.Current.ContentLength = fileSize; } return stream; } return null; } </code></pre> <p>When I look through Safari's web inspector or Firebug, I do not see anything for the size of the information. Is there a reason for that? I step through my code and I do see the size at the beginning as expected. Thanks.</p>
c#
[0]
4,556,950
4,556,951
My code works in Firefox but not Internet Explorer
<p>This code works fine in Firefox but IE9 returns an error of '_area' is undefined</p> <pre><code>function dbasetype(){ var dbasedata = document.forms[0]._dbase_name.value; dbasedata = dbasedata.toUpperCase(); dbasedata = dbasedata.replace(/\s/g, ""); if (dbasedata.indexOf("UK_CONTACTS")==-1) { _area.value = _dbase_name.value; } else { setarea(); } </code></pre> <p>After your responses I have now changed to code to this and it works. I can't figure out why it worked in Firefox without the definitions. I guess it carried them from the fucntion that was calling this function?</p> <pre><code>function dbasetype(){ var dbasedata = document.forms[0]._dbase_name.value; dbasedata = dbasedata.toUpperCase(); dbasedata = dbasedata.replace(/\s/g, ""); var area = document.forms[0]._area; var _dbase_name = document.forms[0]._dbase_name; if (dbasedata.indexOf("UK_CONTACTS")==-1) { area.value = _dbase_name.value; } else { setarea(); } } } </code></pre>
javascript
[3]
5,367,866
5,367,867
to send a text file to server using javascript
<p>I need to send a text file to server and get it saved. how can i do it using javascript???</p>
javascript
[3]
2,284,674
2,284,675
Unselecting values in multiselect using val() and prop
<p>Look at this fiddle: <a href="http://jsfiddle.net/imparator/XPGa8/1/" rel="nofollow">http://jsfiddle.net/imparator/XPGa8/1/</a></p> <p>First, I am selecting the value "Volvo" of the select list: </p> <pre><code>$("select").val('volvo'); </code></pre> <p>Later, when I try to unselect it like this: </p> <pre><code>$("select").val('volvo').prop("selected", false); </code></pre> <p>The value volvo still stays selected as you can see from the fiddle. </p> <p>How can I unselect a value in multiselect using jquery? </p>
jquery
[5]
5,425,711
5,425,712
out parameter - why does it not work
<p>The following is a failing unittest explaining a bug I found today:</p> <pre><code> [TestMethod] public void WFT() { string configDebug = "false"; bool configDebugEnabled = bool.TryParse(configDebug, out configDebugEnabled); Assert.AreEqual(false, configDebugEnabled); } </code></pre> <p>This is how to make the test go from red to green:</p> <pre><code> [TestMethod] public void WFT() { string configDebug = "false"; bool configDebugEnabled; bool.TryParse(configDebug, out configDebugEnabled); Assert.AreEqual(true, configDebugEnabled); } </code></pre> <p>I haven't been able to find the paragraph explaining this in the C# specification but there's most likely a decent explanation to this behaviour. Can anybody explain to me why the first test is failing?</p>
c#
[0]
5,987,652
5,987,653
generators that defer to sub-generators
<p>I yould like to have generators that defer to other generators, e.g.</p> <pre><code>def gx(): for i in [1, 2, 3]: yield i def gy(): for i in [11, 12, 13]: yield i def gz(): """this should defer to gx and gy to generate [1, 2, 3, 11, 12, 13]""" for i in gx(): yield i for i in gy(): yield i </code></pre> <p>Is the explicit loop in gz() the only way to do this, or are there better alternatives?</p>
python
[7]
3,709,198
3,709,199
Regarding scanner class
<p>I am currently using StringTokennizer class to split a String into different token as by defined delimiter..</p> <pre><code>public class App { public static void main(String[] args) { String str = "This is String , split by StringTokenizer, created by Neera"; StringTokenizer st = new StringTokenizer(str); System.out.println("---- Split by comma ',' ------"); StringTokenizer st2 = new StringTokenizer(str, ","); while (st2.hasMoreElements()) { System.out.println(st2.nextElement()); } } } </code></pre> <p>My query is that can same thing can also be achieved through scanner class also ...!! Is it the right approach to use the scanner class since I was reading The Scanner class allows you to tokenize data from within a loop, which allows you to stop whenever you want to... I have tried the following thing, but it doesn't work ...please advise me ..!!!</p> <pre><code>public class App1 { public static void main(String[] args) { Scanner scanner = new Scanner("This is String , split by StringTokenizer, created by Neera").useDelimiter(", "); while (scanner.hasNextLine()) { System.out.println(scanner.nextLine()); } } } </code></pre>
java
[1]
3,838,874
3,838,875
PHP coding competition
<p>I would like to know if there are any competitions like Sharp Coder for C and Java which are organized for PHP. Does anyone know where I can find some tasks in which to compete?</p>
php
[2]
332,551
332,552
Calling the base class's implementation from the derived?
<p>I want to do what the base does, but then I want to add some derived stuff.</p> <p>I tried the following but it did not work: (this function is virtual in AguiWidget)</p> <pre><code>void AguiLabel::onSizeChanged( const AguiSize &amp;size ) { AguiWidget.onSizeChanged(size); updateLabel(); } </code></pre> <p>Thanks</p>
c++
[6]
1,527,247
1,527,248
jQuery check image file exists
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3327655/jquery-check-if-image-exists">jQuery: Check if image exists</a><br> <a href="http://stackoverflow.com/questions/92720/jquery-javascript-to-replace-broken-images">jQuery/Javascript to replace broken images</a> </p> </blockquote> <p>I need to check if an image file exists and replace it with a default image in case the image does not exist on the server. Please let me know how can this be done using jQuery.</p>
jquery
[5]
4,336,471
4,336,472
jquery calculation question
<p>I have this code: </p> <pre><code>&lt;div&gt; &lt;input id="number" type="text" /&gt; &lt;select id="Selection" name="D1"&gt; &lt;option&gt;Plus 1&lt;/option&gt; &lt;option&gt;Minus 1&lt;/option&gt; &lt;/select&gt; &lt;input id="result" type="text" /&gt; &lt;/div&gt; </code></pre> <p>How could I calculate any number entered into the input "number" based on the value chosen from the select control using jQuery? For example I would like to enter 5 in the input "number" and if I choose "Plus 1" then add 1 to the number and show the result in the "result" input. If I choose "Minus 1" then I will do a substraction and show the new result. thank you.</p>
jquery
[5]
1,203,389
1,203,390
Would you prefer coding PHP using a framework or on its own?
<p>Would you prefer coding PHP using a framework or just PHP? I started using CodeIgniter and now I am back to just PHP for my clients' projects.</p>
php
[2]
5,813,845
5,813,846
Converting an array with 50,000+ entries into a mysql database
<p>Ok, so I am helping someone with their site. Their original coder thought it would be a great idea to put their entire database in an array.</p> <p>I am looping through each piece of data in the array and inserting it into a new mysql table I created, the rows are getting inserted just fine but the problem is that php wont let my script execute for more than 60 seconds.</p> <p>How can I override this setting?</p>
php
[2]
2,238,226
2,238,227
PHP: What if one variable return from server with different value?
<p>I have a problem with variable (for example $foo), because when first part of the PHP script execute, variable $foo has value "123" ($foo = 123) but second part of the same script execute another action and also return $foo with a new value.</p> <p>I need to enter the following data to my database:</p> <p>The first $foo which has a value of 123 Second $foo with a new value</p> <p>If I try to do it, script enters the same value as first $foo, where $foo have value '123' but I need also to have this another new $foo value.</p> <p>What should I do to have something like this: first </p> <pre><code>$foo = 123; </code></pre> <p>and second </p> <pre><code>$foo = 'new value' </code></pre> <p>?? </p> <hr> <p>UPDATE: </p> <p>THIS IS EXACTLY WHAT I GOT FROM THE SERVER (after second part of the script is executed):</p> <pre><code>Array ( [first_value] =&gt; 5555 [second_value] =&gt; 22222 [third_value] =&gt; 3333333 [some_name] =&gt; 123456 [fourth_value] =&gt; 44444 ) </code></pre> <p>Well to clarify: How I can get value '123456' without echo $some_name; or without asking for $some_name for example: $foo = $_REQUEST["some_name"]; </p> <p>I need just this value "123456" (near this: "[some_name]").</p>
php
[2]
2,806,985
2,806,986
Get DNS request from service
<p>Is it possible to capture the current dns request via a service in android? I would like to drive some logic in my backend process depending on what URL the user is currently trying to access.</p>
android
[4]
5,470,642
5,470,643
Java upcast scope resolution issue
<p>I have a base class "Shapes" and an extended class "Circle". Both have a getName method. My test class is the "Driver" class. </p> <p>I upcast a Circle object to Shapes and pass it to a function called polyTest. In that function I want to call getName but I do not want the circle objects implementation of get name to be triggered but instead want the base classes implementation to be triggered.</p> <p>super.getName() does not work.</p> <p>My code is bellow.</p> <pre><code>public class Driver{ public static String polyTest (Shapes s){ return s.getName(); /*Instead of s.getName()... (gives me the Circle class implementation of getName() ) I want to call s.Shapes::GetName, the base class implementation of getName. */ } public static void main(String[] args){ Circle c = new Circle(); //Test Basic inheritance &amp; basic polymorphism. //System.out.print(c.getName()); //Upcast test. Shapes s = (Shapes) c; System.out.print( polyTest(s) ); } } public class Circle extends Shapes{ Circle(){ super(); } public String getName(){ return "I am a Circle"; } } public abstract class Shapes{ Shapes (){ } public String getName(){ return "I am a Shape"; } } </code></pre>
java
[1]
643,468
643,469
SMB Directory Listing with C#
<p>I am trying to do a remote directory listing of an SMB web server.</p> <p>My method however doesn't work. The call to <code>DirectoryInfo()</code> complains that I can't give it a string in a URi format.</p> <p>This is what I have come up with:</p> <pre><code>string smbDirectory = @"\\SERVER\MYSHARE"; Uri requestURI = new Uri(smbDirectory); List&lt;FileInfo&gt; files = this.listAllFilesInWebDirectory(requestURI); List&lt;FileInfo&gt; listAllFilesInWebDirectory(Uri smbDirectory) { string filePattern = "*"; List&lt;FileInfo&gt; returnable = null; DirectoryInfo directory = new DirectoryInfo(smbDirectory.AbsoluteUri); if (directory.Exists == true) { FileInfo[] files = directory.GetFiles(filePattern); returnable = new List&lt;FileInfo&gt;(files); } return returnable; } </code></pre> <p>I keep getting an exception when I call <code>directory.GetFiles(filePattern)</code>.</p>
c#
[0]
4,258,929
4,258,930
About the global keyword in python
<pre><code># coding: utf-8 def func(): print 'x is', x #x = 2 #if I add this line, there will be an error, why? print 'Changed local x to', x x = 50 func() print 'Value of x is', x </code></pre> <ol> <li>I dont't add the <code>global x</code> in func funtion, but it can still find <code>x</code> is 50, why?</li> <li>When I add the <code>x=2</code> line in the func function, there will be an error (<code>UnboundLocalError: local variable 'x' referenced before assignment</code>), why?</li> </ol>
python
[7]
1,975,351
1,975,352
Error when installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'
<p>I'm trying to install settuptools on a linux machine that I don't have root access. I already create the virtual python.</p> <pre><code>dgomez:~/download&gt; which python /home/dgomez/bin/python </code></pre> <p>when I do the following, I get an error:</p> <pre><code>/home/dgomez/bin/python ez_setup.py Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8816.pth' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/local/lib/python2.7/site-packages/ This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir </code></pre> <p>option).</p> <p>I would like to know how to fix this. I see in other forum where the user fixed it by creating the directory, but in my case I don't have root access for I can't create a directory. Thanks</p> <h2>UPDATE</h2> <p>I ran the python </p> <pre><code>ez_setup.py --install-dir=/home/dgomez/lib/python2.7/site-packages/ </code></pre> <p>Bu still getting an error:</p> <pre><code>You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /home/dgomez/lib/python2.7/site-packages/ and your PYTHONPATH environment variable currently contains: '' </code></pre>
python
[7]
577,849
577,850
Error in parameter that i use in update command in sqlDataSource
<p>I use below code : </p> <p><strong>.aspx</strong></p> <pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" ConnectionString="&lt;%$ConnectionStrings:Con %&gt;" runat="server" SelectCommand="select * from DorePayvar" OnSelecting="selecting" UpdateCommand="update DorePayvar set Name=@name" OnUpdating="SqlDataSource1_Updating"&gt; &lt;UpdateParameters&gt; &lt;asp:Parameter Type="String" Name="name" DefaultValue="Sajjad" /&gt; &lt;/UpdateParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre> <p><strong>.cs</strong></p> <pre><code>protected void SqlDataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e) { e.Command.Parameters["name"].Value = "bvhjbjh"; } </code></pre> <p>but when i press update button occur below error</p> <blockquote> <p>An SqlParameter with ParameterName 'name' is not contained by this SqlParameterCollection.</p> </blockquote>
asp.net
[9]
5,554,248
5,554,249
Android: application settings lost when updating to new version?
<p>I recently released a new version of my app. When users update to the new version (through google market), the settings for their application are cleared -- I am fairly confident this did not happen in previous versions. </p> <p>Can anyone suggest a reason why this might occur? I added an additional permission in the recent version, could this be the cause?</p>
android
[4]
1,461,335
1,461,336
Using different cipher than default
<p>i need to connect to a server using only one cipher - "ADH-RC4-MD5". i'm looking for a generic solution which will enable me to check what cipher the server is using (i'm a provisioning server that acts as a client to many other application servers and need to connect and get data - each time it can be a different server) .</p> <p>the flow i had so far was :</p> <pre><code>TcpClient tcpClient = new TcpClient(serverName, port); SslStream sslStream = new SslStream(tcpClient.GetStream(), false, null, null, EncryptionPolicy.RequireEncryption); sslStream.AuthenticateAsClient(HostName); </code></pre> <p>i keep on crash in the "AuthenticateAsClient". the reason is that one AS is working only with the mentioned cipher.</p> <p>i have verified this is the case with the <a href="http://code.google.com/p/sslscan-win/" rel="nofollow">SslScan tool</a>.</p> <p>i have tried to enter this cipher through the policy editor (gpedit.msc in the command line) but again with no luck.</p> <p>basically i'm looking for a way to use this cipher from code dynamically.</p> <p>i have a working Java code `</p> <pre><code>sslsocket.setNeedClientAuth(true); String[] list = new String[1]; list[0] = "ADH-RC4-MD5"; sslsocket.setEnabledCipherSuites(list); </code></pre> <p>` Any idea of c# equivalent ?</p>
c#
[0]
1,120,601
1,120,602
Do I have to check whether a String object is null?
<p>If the compiler is going to complain that a String object is not initialized then is it appropriate to check in my method whether the String object is null or not?</p> <p>Is there a place that the compiler will not check that for me?</p>
java
[1]
229,299
229,300
Plot Experimental Data Distribution
<p>I'm working on a clustering task and I've built the dataset similarity matrix M, repeating N times the clustering algorithm and chosing as element m_{ij} the the number of times the elements i and j have been on the same cluster, divided by N.</p> <p>Now I'd like to have a graphical way to check my results, so i was wondering if there is any library that, given an array of doubles ( aka the values in the upper triangular part of my matrix ), plots the data distribution and the histogram ? All the doubles are in the [0,1] interval, and most of the will be around 0 and 1 .</p>
java
[1]
5,855,336
5,855,337
Accessing HttpApplicationState
<p>Can it be done outside of Global.asax? I stored some app state info on app_start that I want to grab in a controller action. </p>
asp.net
[9]
425,557
425,558
PHP - limiting <li> tags in a <ul>
<p>I have the following HTML output;</p> <pre><code>&lt;ul&gt; &lt;li&gt;Test 1&lt;/li&gt; &lt;li&gt;Test 2.&lt;/li&gt; &lt;li&gt;Test 3&lt;/li&gt; &lt;li&gt;Test 4&lt;/li&gt; &lt;li&gt;Test 5&lt;/li&gt; &lt;li&gt;Test 6&lt;/li&gt; &lt;li&gt;Test 7&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>What I need to do, is display the same HTML, but with only the first 4 <code>&lt;li&gt;</code> tags, i.e.</p> <pre><code>&lt;ul&gt; &lt;li&gt;Test 1&lt;/li&gt; &lt;li&gt;Test 2.&lt;/li&gt; &lt;li&gt;Test 3&lt;/li&gt; &lt;li&gt;Test 4&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Is there an easy way I can do this in PHP?</p> <p>Thanks</p> <p>EDIT:</p> <p>The data is coming from:</p> <pre><code>$data = $product-&gt;getDescription(); </code></pre> <p>It is stored in the DB as the HTML content, I am currently displaying it using the above code;</p> <p>Thanks</p>
php
[2]
3,264,812
3,264,813
"download" of client-side data from JS (without a new server round-trip)
<p>I've got a bunch of data on the client side, in JS. I want to allow the user to save that data to the local hard drive in text (CSV actually) format.</p> <p>I can easily accomplish this by posting all of this data up to the server using ajax, then initiate a GET from the client to download the data. But that seems wasteful. Especially if the data is large.</p> <p>The client already has the data -- I could certainly show it to them, and allow them to copy/paste it into their favorite text editor -- but that's not a very nice UI.</p> <p>I want to allow them to save the data to a local file. I understand the security implications here.</p> <p>I believe this is possible using dataurl, but (thank you MS), this has to work in IE7 and 8.. so that's out.</p> <p>Any out-of-the-box ideas?</p>
javascript
[3]
5,622,020
5,622,021
Launch "Recent apps" NOT from holding on home button
<p>I want to launch from my application the activity recent apps, without holding on home button. How can i launch that dialog activity? Is that possible ? Thank you very much.</p>
android
[4]
355,473
355,474
Problem displaying ShapeDrawable in an ImageView
<p>I am writing an app which will create drawable shapes and add them to other drawables. (Think Tetris pieces onto a Tetris board.) As a test, I want to have a particular shape appear when my activity is loaded, but I cannot get a Drawable to appear in the ImageView I created. Could anyone explain why the following code isn't working?</p> <p>Activity code:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView mImg = (ImageView) findViewById(R.id.img); ShapeDrawable sD = new ShapeDrawable(new RectShape()); sD.setBounds(1,1,10,10); sD.getPaint().setColor(Color.BLUE); mImg.setImageDrawable(sD); } </code></pre> <p>main.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:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/img" android:layout_width="320px" android:layout_height="206px" /&gt; &lt;TextView android:id="@+id/debug" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Note: I have been able to make static resources from the 'drawable' folder appear in this ImageView, just not Drawables I have created in the code.</p>
android
[4]
3,556,308
3,556,309
What can I do with urllib?
<p>I grasp that it can fetch internet resources, but I'm not really fully appreciating what that means. I was doing the challenges at pythonchallenge.com, and I got past the one that requires urllib to fetch the page and read the source, but I don't see how this is useful quite yet. And examples are kind of lacking in diversity.</p> <p>What else can it do, or how can I use this to my advantage?</p> <p>(Besides building a web browser...)</p>
python
[7]
931,783
931,784
Retreiving data from SQLite database in another Activity
<p>I have created 3 activities including DBAdapter for database. One is for saving the data and another is for retreiving the data from the SQLitedatabase created in DBAdapter class. The creation of database has completed successfully.</p> <p>mainActivity code for saving:</p> <pre><code>DBAdapter db=new DBAdapter(this); save=(Button)findViewById(R.id.save); save.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { try { db.open(); } catch (SQLException e) { e.printStackTrace(); } String s=nme.getText().toString(); String em=email.getText().toString(); long id=db.insertContact(s,em); Toast.makeText(DataActivity.this, "Saved", 20).show(); db.close(); } }); </code></pre> <p>For retreiving the data I created the object in another Activity called RetrieveActivity </p> <p>RetreiveActivity code for retreiving:</p> <pre><code>DBAdapter db=new DBAdapter(this); try { db.open(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } srch.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Cursor c=db.getAllContacts(); no1.setText(c.getString(0)); nm1.setText(c.getString(1)); em1.setText(c.getString(2)); } }); db.close(); </code></pre> <p>But while clicking the button for retreiving "Force to close command" occured. My doubt is with creating the object for DBAdapter.Can I access the Created database with an object from other Activity..? Thanks in advance....</p>
android
[4]
5,803,183
5,803,184
Javascript: td value == td value
<pre><code>&lt;tr&gt; &lt;td class = "nowrap cr" id="cr1"&gt;123123&lt;/td&gt; &lt;td class = "nowrap ch" id="ch1"&gt;123123&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class = "nowrap cr" id="cr2"&gt;123123&lt;/td&gt; &lt;td class = "nowrap ch" id="ch2"&gt;123123&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class = "nowrap cr" id="cr3"&gt;467574&lt;/td&gt; &lt;td class = "nowrap ch" id="ch3"&gt;123123&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>How do I set the font-weight: bold in tr where chID == crID</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { for(var i =0;i &lt; 20;i++) { if($('#cr'+i).val() == $('#ch'+i).val()) { $('#cr'+i).parent().css('font-weight', 'bold'); } } }); &lt;/script&gt; </code></pre> <p>Dont' working. Any ideas? Sorry for bad english</p>
javascript
[3]
3,017,456
3,017,457
Jquery + Toggle with double callback
<p>Hi I'm trying to use a toggle() with a callback for on/off:</p> <pre><code>instantMsgTabOptions.click(function() { instantMsgOptions.toggle(function() { $('table.instantMsgTabs td.instantMsgTabOptions').css('color','#849C00').css('text-decoration', 'underline'); },function() { $('table.instantMsgTabs td.instantMsgTabOptions').css('color','#000').css('text-decoration', 'none'); }); }); </code></pre> <p>this doesn't work - any advice on what needs to be changed?</p> <p>thx</p>
jquery
[5]
4,488,203
4,488,204
Basic Java Syntax Questions
<p>I am doing a homework assignment (I am not one to lie) and I am honestly stumped at the questions. I have 3 years of programming experience but am stumped on some of the simplest problems in the class, lol. New to Java, not new to programming rather. I would like to discuss why the questions result in an answer and why it is one way or another.</p> <p>1) Write 3.4, is this a double or a float?</p> <p>I want to say its a float by default, as it takes up less space (32 bits) versus a double (64) bits. Since 3.4 is a small number, I would assume it is a float?</p> <p>2) Declare x as a double and assign it the value of 3.4 (as a double).</p> <p>I think it is <code>double x = 3.4d;</code> not 100% sure on this</p> <p>3) Declare y as a float and assign it the value 3.4 (as a float).</p> <p>Similar to above, i think it is <code>float y = 3.4f;</code></p> <p>Not usually one to come on here and ask for HW help in this manner...but I have no textbook for another week as I just ordered it. I would rather like to discuss why it is one way or another so I can get a better understanding of how Java works. Thanks.</p>
java
[1]
5,193,212
5,193,213
onHover effect with textarea
<p>I am trying to create an hover effect, so when a user moves his mouse over a button, a textarea will be displayed below the button where the user can insert text before submitting a form. If the user leaves the textarea after it was was opened, I would like it to be closed again.... The problem with the code I've used below is that once the user leaves the button area (in order to insert text in the textarea) the textarea disappears. Help would be appreciated!</p> <p>I have used the following code (You can find the following example also at <a href="http://jsbin.com/ifiso3" rel="nofollow">jsbin</a> ):</p> <p><strong>CSS</strong></p> <pre><code>#send-container { position:relative; } #text-container { display:none; background-color:#FEF9F4; position: absolute; z-index: 1000; top:28px; left:0; padding:2px; } textarea { width: 150px; height: 50px; resize: none; border: 3px solid #cccccc; padding: 5px; font-family: Tahoma, sans-serif; } </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="send-container"&gt; &lt;input type="button" value="Button"&gt; &lt;div id="text-container"&gt; &lt;textarea&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>JS (jQuery)</strong></p> <pre><code>$("#send-container").live("mouseenter", function() { $("#text-container" , $(this)).show(); }); $("#send-container").live("mouseleave", function() { $("#text-container" , $(this)).hide(); } ); </code></pre> <p>Thanks!</p> <p>Joel</p>
jquery
[5]
1,721,270
1,721,271
Java IO - Folder Creation Error
<p>I am not able to create a folder using following code. </p> <pre><code>import java.io.File; public class Fileupload { public static void main(String[] args) { File f = new File("C:\\BOS\\BOS-5.8-Tomcat-6.0.35\\webapps\\bonita\\ECR-DZ-00013\\Ranjeet\\"); if (f.exists()) { System.out.println("Already Present"); } else { f.mkdir(); System.out.println("Created"); } } } </code></pre> <p>If I remove my name "Ranjeet" from the path then it gets created, otherwise folder is not created by the same code.</p>
java
[1]
2,815,118
2,815,119
How to check if a String[] index exists?
<p>I have a <code>String[]</code> and I would like to check if an index exists in it (such as String[3]).</p> <p>How can I go about doing this?</p>
java
[1]
4,611,163
4,611,164
Regarding Multiple Language Application for Android?
<p>I am trying to make small app for android. My idea for app is that user can change the language whichever they want ...etc french , german,chinese , english etc... how to force the locale language in my app or how to get access to the language used by user on their device and with respect to that I can change my application language.</p> <p>THank you,</p>
android
[4]
379,620
379,621
Resume Activity with back button
<p>I have an application I am creating with a DashboardActivity &amp; a SettingsActivity. On the dashboard, I have one object displayed, but when I go into settings, I want to be able to select/deselect X options. Once the user clicks the back button, I save that data locally and to the server. Once the phone receives a success message from the server that it was stored properly, I want to reload the dashboard. </p> <p>I thought I would do this with the onPause and onResume, but they are called when the DashboardActivity is first created. What would be the best way to reload the dashboard by calling my web service after the settings were saved to the server? Here is what I am doing when the back button is hit</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { //Save data to the server once the user hits the back button if ((keyCode == KeyEvent.KEYCODE_BACK)) { SchoolSearchActivity.this.divisionProxy = new DivisionProxy(SchoolSearchActivity.this.saveUserDivisionHandler); SchoolSearchActivity.this.divisionProxy.submitUserDivisions(SchoolSearchActivity.this.userDivisions, SchoolSearchActivity.this.user_id); //SchoolSearchActivity.this.finish(); //Toast.makeText(SchoolSearchActivity.this, "Divisions Saved",Toast.LENGTH_LONG).show(); } return true; } </code></pre> <p>The above opens an HTTP connection, and when the response is received, the handler processes the response. I want to: 1) submit the data to the server 2) return to the previous activity 3) show a progress dialog until the response from #1 returns (response handler is in the settings activity; and we are now in the dashboard activity) 4) "refresh" the dashboard</p> <p>What is the best way to accomplish this so I can just resume the dashboard as it was. Like I said, when I overwrite the onResume method, it is called when the activity is first created. I was considering putting my webservice call in onResume, so it's called once everytime you make it to the Activity, but it doesn't seem like the cleanest way.</p> <p>What would you suggest for 1-4?</p>
android
[4]
3,625,937
3,625,938
Open Page in ReadOnly mode
<p>I have to open page in read only mode where all the controls are disabled and no body can perform any action on page.</p> <p>I tried to use Panel / div overlap.</p> <p>is there any other smart solution for this?</p> <p>Thanks</p>
asp.net
[9]
980,580
980,581
What is wrong with this JavaScript function?
<p>I do not usually use JavaScript, and cannot see why this is not working. Thanks.</p> <pre><code>function testYear() { var dObject = new Date(); var dRegEx = /^[0-9][0-9]00$/; var d = dObject.getFullYear(); if (d.match(dRegEx) &amp;&amp; d % 400 == 0) { alert("The year "+d+" is in fact a leap year!"); //return true; } else if(!(d.match(dRegEx) &amp;&amp; d % 400) &amp;&amp; d % 4 == 0) { alert("The year "+d+" is in fact a leap year!"); //return true; } else { alert("The year "+d+" is not a leap year."); //return false; } } </code></pre>
javascript
[3]
4,045,805
4,045,806
Confused with the output related to character and wchar_t
<p>Not able to understand whats happening in the below code </p> <pre><code>wchar_t wc; wc =L'ab'; char ch = 'ab'; </code></pre> <p>When i am debugging the above code , i found that a is stored in <code>wc</code> where as <code>b</code> is stored in <code>ch</code> . I dont understand why <code>a</code> is not being stored inside the <code>ch</code>.</p>
c++
[6]
98,373
98,374
What is the simplest method to write a file with Chrome file interface?
<p>Chrome implements the file interface as described here <a href="http://www.html5rocks.com/en/tutorials/file/filesystem/" rel="nofollow">http://www.html5rocks.com/en/tutorials/file/filesystem/</a>, just adding the <code>webkit</code> prefix. The documentation covers several aspects of the interface, but what are the simplest steps, for example, to prompt the user with a file saving dialog, or to tell him that the file has been saved somewhere? For example, let's say we want to save some text data for the user.</p> <p>I'm mainly referring to lines of code as a metric of simplicity, but within the 80 characters per line (and common sense). I'm also referring to Chrome 26.</p>
javascript
[3]
219,853
219,854
Get the control id of usercontrol in aspx page
<p>I'm working on asp.net website. In my project I'm using the usercontrols. I have placed the radgrid inside the user controls. I need to get the id of radgrid of usercontrol and need to enable the scrolling for the grid. How can I achieve this. please help me</p>
asp.net
[9]
5,609,709
5,609,710
Losing click information after page refresh
<p>I came up with the following for my NavBar. Well, after refreshing the current page using F5 I am losing my click information, everything according to my NavBar falls back to default, like u've never clicked on a link :/</p> <pre><code> &lt;script&gt; "use-strict"; $(document).ready(function() { /* $(".default").show(); */ $("#navSalon&gt;ul&gt;li a").click(function() { $("#navSalon&gt;ul&gt;li a").next().hide(); $(this).next().show(); }); $("#navSalon&gt;ul&gt;li a").click(function() { $("#navSalon&gt;ul&gt;li a").children().attr("src", "dot1.png"); $(this).children().attr("src", "dot0.png"); }); }); &lt;/script&gt; </code></pre>
jquery
[5]
4,780,723
4,780,724
Echo multiple variables to one div class
<p>I'm trying to echo a user name and a greeting from IF statement i made.</p> <pre><code>&lt;?php global $current_user; get_currentuserinfo(); echo get_avatar( $current_user-&gt;ID, 64 ); $hour = date('G'); if ($hour &lt; 12) { $greeting = 'Good Morning'; } else if ($hour &lt; 18) { $greeting = 'Good Evening'; } else { $greeting = 'Good Night'; } echo '&lt;div class="greeting"&gt;'.($greeting). , .$current_user-&gt;user_login. '&lt;/div&gt;'; ?&gt; </code></pre> <p>but i'm getting syntax error:</p> <blockquote> <p>syntax error, unexpected ','</p> </blockquote> <p>How can i echo 2 variables into one div?</p>
php
[2]
4,387,252
4,387,253
Creating an instance of collection in JAVA
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/147468/why-should-the-interface-for-a-java-class-be-prefered">Why should the interface for a Java class be prefered?</a><br> <a href="http://stackoverflow.com/questions/3356113/what-is-the-benefit-of-polymorphism-using-collection-interface-to-create-arrayli">What is the benefit of polymorphism using Collection interface to create ArrayList object?</a> </p> </blockquote> <p>I see in many examples that when one creates an instance of some collection like TreMap, he uses it's base as type:</p> <pre><code>Map&lt;String,String&gt; theMap = new TreeMap&lt;String,String&gt;(); </code></pre> <p>Why not to use </p> <pre><code>TreeMap&lt;String,String&gt; theMap = new TreeMap&lt;String,String&gt;(); </code></pre>
java
[1]
1,662,196
1,662,197
Android: Whats the maximum size of app that i can upload to the market?
<p>I have 3 video files each of 70 MB in my raw folder besides other audio files of few KBs. I am getting an installation error of insufficient space on the DROID while testing my app. I tried uninstalling apps and am now left with apps that are essential to the device.</p> <p>What needs to be done to resolve this issue? I also wonder what will be the app size that i am allowed to upload to the android market?</p> <p>Thank you.</p>
android
[4]
3,693,564
3,693,565
How to integrate a modal dialog
<p>I want to show AJAX error messages for form validation and want these messages centered on the screen. I was advised to use a modal window for this. I have the following code but I'm not sure how to do this. I know that I need to call the modal in the success function but unfortunately that's about the extent of my JQ knowledge.</p> <p>This is my JQ script where the modal should be integrated</p> <pre><code> success: function(data){ ... if(data.success == 0){ $(div).addClass('ajax-error'); } </code></pre> <p>This is the modal code. This code is currently set up to work with a hyperlink that activates the window but I don't need that. The window should be invoked automatically upon error in the code above.</p> <pre><code> $('a[name=modal]').click(function(e) { e.preventDefault(); var id = $(this).attr('href'); var maskHeight = $(document).height(); var maskWidth = $(window).width(); $('#mask').css({'width':maskWidth,'height':maskHeight}); $('#mask').fadeIn(1000); $('#mask').fadeTo("slow",0.8); var winH = $(window).height(); var winW = $(window).width(); $(id).css('top', winH/2-$(id).height()/2); $(id).css('left', winW/2-$(id).width()/2); $(id).fadeIn(2000); }); $('.window .close').click(function (e) { e.preventDefault(); $('#mask').hide(); $('.window').hide(); }); $('#mask').click(function () { $(this).hide(); $('.window').hide(); }); </code></pre>
jquery
[5]
428,698
428,699
How do I order an array of objects based on one of their attributes?
<p>I have an object called a Contact that has a bunch of attributes. I also have an array of Contacts called Contact_List, and I have to write a method for the Contact_List that will add a Contact object to it. That part is easy, but it has to ensure that all of the Contacts within it are in order based on their last names. I already have an accessor called getLastName that returns the String of their last name, but how do I make the method add the contact and order them? Please Help, this is due in an hour and a half!</p> <pre><code> public void add(Contact frnd) { if(numContacts == MAX_CONTACTS) // If the List is already full { System.out.println("The Contact List is already at Maximum Capicity"); } else { numContacts += 1; // There is one more Contact Contact_List[numContacts - 1] = frnd; // Assigns the Last Open Spot the new Contact } } </code></pre>
java
[1]
5,900,995
5,900,996
What is the difference between a += b and a =+ b , also a++ and ++a?
<p>As I mentioned in the title,</p> <p>What is the difference between a += b and a =+ b , also a++ and ++a ? I'm little confused</p>
java
[1]
5,248,156
5,248,157
How i can use Funcunit or Qunit to test my jQuery code in ASP.NET MVC?
<p>How i can use FuncUnit or qunit to test my jQuery code.Can anyone exaplain how i can use one of them to test the jQuery code i write ?</p>
jquery
[5]
2,561,484
2,561,485
empty() does not work when passing data from an object. Why?
<p>I just discovered that <code>empty()</code> does not work when passing data from an object. Why is that?</p> <p>This is my code:</p> <pre><code>// This works $description = $store-&gt;description; if (!empty($description) ) echo $description; //This is not working if (!empty($store-&gt;description) ) echo $store-&gt;description; </code></pre> <p><strong>UPDATE</strong><br> Added extra code for context.</p> <pre><code>// At the top of my PHP file I have this code $store = Factory::new_store_obj($id); // To controll that I got content, I can test by printing object echo '&lt;pre&gt;'; print_r($store); echo '&lt;/pre&gt;'; //output Store Object ( [data:Store:private] =&gt; Array ( [name] =&gt; Lacrosse [street1] =&gt; Bygdøy Allé 54 [street2] =&gt; [zipcode] =&gt; 0265 [city] =&gt; Oslo [country] =&gt; Norway [phone] =&gt; 22441100 [fax] =&gt; [email] =&gt; [opening_hours] =&gt; [keywords] =&gt; [description] =&gt; Lacrosse er en bla bla bla... ) ) </code></pre>
php
[2]
36,150
36,151
any one can help me how to handle global event in android?
<p>i am firing golbal event from one apps and another apps recieve it which is running in background when user open or view it display message. i want to add notification like Blinking LED or play alert etc...</p>
android
[4]
1,976,998
1,976,999
Why is it good practice to use if (myBoolean === true) in JavaScript?
<p>As a follow-up to this question: <a href="http://stackoverflow.com/questions/13250176/is-there-ever-a-reason-to-write-if-myboolean-true-in-a-javascript-conditi">Is there ever a reason to write &quot;if (myBoolean == true)&quot; in a JavaScript conditional?</a> -</p> <p>Why is it good practice to use if (myBoolean === true) in JavaScript? As a relatively inexperienced JavaScript user, I'm trying to work out in what specific, real-world scenarios you'd end up with a value that might be a Boolean true or might be a "truthy" value, so that you would need to check if (myBoolean === true) rather than if (myBoolean)</p>
javascript
[3]
744,290
744,291
jquery ajax call with xml query not working. Need advice
<p>I've written some code that is supposed to load an xml file via AJAX, parse a couple variables, and alert them to the screen. It isn't working... Can any guru's out there tell me what I've done wrong?? </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $.get("http://www.greenshipping.com/api/requestAccountSummary.php?UID=7ef364b35ca79b0497f391da7f6776ab", {}, function(xml) { $('result', xml).each(function(i) { num_shipments = $(this).find('num_shipments_offset').text(); lbs_carbon = $(this).find('total_lbs_carbon_offset').text(); alert("num_shipments:"+num_shipments+" lbs_carbon:"+lbs_carbon); }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
2,730,034
2,730,035
jQuery Flickr feed Plugin: How to open an image in new window?
<p>Using a jQuery Flickr Feed Plugin from <a href="http://www.gethifi.com/blog/a-jquery-flickr-feed-plugin" rel="nofollow">http://www.gethifi.com/blog/a-jquery-flickr-feed-plugin</a>. </p> <p>They are using "opening image in parent window" where we can see only image and in lightbox. </p> <p>But how can we open a flickr photo in new window while the link should be its original flickr page....</p>
jquery
[5]
4,654,058
4,654,059
Exporting flash content to PDF?
<p>I am using fpdf.php to export the PDF document from PHP. I'm still facing the problem that I couldn't export flash content in to the PDF</p>
php
[2]
3,726,743
3,726,744
Check real internet connection
<p>In my application I need to check whether device is connected to Internet. I tried using ConnectivityManager but it doesn't give a 100% precise result. For instance, I might have a wi-fi connection but still don't have access to internet resources. In my case I've got to open a VPN connection, after I've connected to via wi-fi, in order to get real access to Internet. So the approach with ConnectivityManager doesn't work.</p> <p>So, regarding the above - should I write a manual http request in order to ensure or there's another way ?</p> <p>Here's some code I'm using</p> <pre><code>ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo() != null &amp;&amp; cm.getActiveNetworkInfo().isConnected() &amp;&amp; cm.getActiveNetworkInfo().isAvailable(); </code></pre>
android
[4]
5,483,902
5,483,903
show js array in html table
<p>I have a javascript array and I want to show parts of it in HTML.</p> <p>For example what html code would I use in the body to show a table of just the info from QR4 - the number and the country? There are other parts to the array so to show the whole QR4 array would be fine, but Id also like to know how to select specific parts</p> <pre><code>QR4[25] = "China"; QR4[24] = "39241000"; QR8[25] = "China"; QR8[24] = "39241000"; QR8L[25] = "China"; QR8L[24] = "39241000"; QR4L[25] = "China"; QR4L[24] = "39241000"; </code></pre> <p>I have this code making a table in php using csv which works fine but I want it client side, not server side. A table like this would be fine...</p> <pre><code>&lt;?php echo "&lt;table&gt;\n\n"; $f = fopen("csv.csv", "r"); while (!feof($f) ) { echo "&lt;tr&gt;"; $line_of_text = fgetcsv($f); echo "&lt;td&gt;" . $line_of_text[10] . "&lt;/td&gt;"; echo "&lt;tr&gt;\n"; } fclose($f); echo "\n&lt;/table&gt;"; ?&gt; </code></pre>
javascript
[3]
1,054,601
1,054,602
Adding ScrollSpy to multiple Divs
<p>I have a div that un-hides according to the scroll spy parameters, but what if I want to add another div that appears under different conditions? I dont want both divs to appear at the same time, only after they are scrolled upon.</p> <p>below is my JQ:</p> <pre><code>&lt;script type='text/javascript'&gt; $(document).ready(function() { $('.nav').hide(); $('#sticky-navigation').scrollspy({ min: $('.nav').offset().top, onEnter: function(element, position) { $(".nav").show('hide'); }, }); }); &lt;/script&gt; </code></pre> <p>Thanks! JOE</p>
jquery
[5]
5,246,670
5,246,671
get web page text via javascript
<p>Is there a JavaScript statement that will retrieve the contents/text from a web page?</p>
javascript
[3]
868,699
868,700
Instructions Page
<p>I have just finished my first app in Android and now I want to build a small instructions page that will open when the application opens. Id like the user to be able to read a small set instructions and then just click a close button on the same screen to close the screen and begin using the application.</p> <p>Should I do the with an alert box or is there a better way?</p> <p>Thanks for the help.</p>
android
[4]
27,123
27,124
Need to post JSONObject to PHP server through parameter
<p>From past couple of hour I was trying to send JSONObject to a PHP server. I need to send this object through a parameter.</p> <p>Some what like this:</p> <pre><code>message={"name":"Firstname","email":"[email protected]"} </code></pre> <p>here message is my parameter name.</p> <p>Yes I am using HttpClient for posting my request. As I have mentioned that I need to send a post request to the server attaching a JSONObject to a parameter, I am using the following methods:</p> <p>Supose my exact URL is like <a href="http://www.example.com/" rel="nofollow">http://www.example.com/</a> then I need to append deviceID, date and message type with the URl so as to make it look like <a href="http://www.example.com/deviceID/date/140" rel="nofollow">http://www.example.com/deviceID/date/140</a> then to this URL I need to send a post request which is a JSONObject attaching it to a parameter named message.</p> <p>For this I am doing:</p> <pre><code>String url = "http ://www.example.com/deviceID/date/140"; JSONObject j = new JSONObject(); j.put("name", "Firstname"); j.put("email", "[email protected]"); HttpClient httpclient = new DefaultHttpClient(); HttpPost request = new HttpPost(url); BasicHttpParams params = new BasicHttpParams(); params.setParameter("message",j.toString()); request.setParams(params); HttpResponse response = httpclient.execute(request); </code></pre> <p>If I pass this way, the server returns a JSONObject error message saying <code>"error":"name not found"</code> -- what am I doing wrong?</p>
android
[4]
364,968
364,969
Get value from input
<p>I'm very new to jQuery so this might be a stupid question. I'm using a jQuery datepicker and I'm trying to fetch the date from an input to a simple <code>&lt;div&gt;</code>.</p> <p>The page works like this:</p> <ol> <li>You select a date with jQuery datepicker.</li> <li>You select a time with jQuery timepicker.</li> <li>You select a place with a normal select box.</li> <li>A text will come up and you have to verify the date,time and place.</li> </ol> <p>I'm having a problem getting the values from the inputs.</p> <p>When I use this script nothing happens:</p> <pre><code>$("input").keyup(function () { var value = $(this).val(); $("#datum").text(value); }).keyup(); </code></pre> <p>I have a <code>div</code> with <code>id="datum"</code> where I want to display the results.</p> <p>My datepicker code looks like this:</p> <pre><code>$('#datepicker').datepicker( { onSelect: function(date) { $("#pick_time").show(); // Go to step 2 }, showWeek: true, firstDay: 1 }); </code></pre>
jquery
[5]
397,682
397,683
how to retrieve .keydown() function
<p>How is it possible to retrieve all functionality from a .keydown() function?</p> <p>I need to retrieve the function, clear it and add a new function and in the end roll back to the origin function</p> <p>I don't have the origin function as a handler function so I can't use bind() and unbind() I think..</p>
jquery
[5]
4,124,620
4,124,621
ipod not loading proper date and time
<p>hey in my application i use date time picker to pick up the date and time, it runs perfectly on the simulator but when run on device the date and time changes and is not the one entered by the user. Can some one help as to what might be wrong!</p>
iphone
[8]
6,026,654
6,026,655
splitting by white space or multiple white spaces
<p>Right now I split words by one whitespace and store in an array: <code>var keywds = $("#searchquery").text().split(" ");</code></p> <p>The problem is there can/might be multiple white spaces. For example : </p> <pre><code>"hello world" </code></pre> <p>How would I still have the array = <code>[hello, world]</code></p>
jquery
[5]
2,122,048
2,122,049
why destructor called twice when exception is thrown?
<p>I am very confused why the destrctor is called twice when excpetion is thrown and which point they are called??</p> <pre><code>#include &lt;iostream&gt; using namespace std; class base { public: base(){cout&lt;&lt;"constructor called"&lt;&lt;endl;} ~base(){cout&lt;&lt;"destructor called"&lt;&lt;endl;} }; void fun() { throw base(); //&lt;=- Create temp obj of base, and throw exception } int main() { try { fun(); } catch(...) { cout&lt;&lt;"handle all exception"&lt;&lt;endl; } } </code></pre> <p>following is the output</p> <pre><code>constructor called destrctor called handle all exception destuctor is called </code></pre> <p>But when i added the copy constructor, it never called but destructor called only once so what's happening????</p> <pre><code>#include &lt;iostream&gt; using namespace std; class base { public: base(){cout&lt;&lt;"constructor called"&lt;&lt;endl;} ~base(){cout&lt;&lt;"destructor called"&lt;&lt;endl;} base (base &amp;obj){cout&lt;&lt;"copy constructor called"&lt;&lt;endl;} }; void fun() { throw base(); //&lt;=- Create temp obj of base, and throw exception } int main() { try { fun(); } catch(...) { cout&lt;&lt;"handle all exception"&lt;&lt;endl; } } </code></pre> <p>output:</p> <pre><code>constructor called handle all exception destrctor called </code></pre>
c++
[6]
4,637,125
4,637,126
Removing labels in Google Apps Account
<p>I wanted to ask that how do I remove the labels which are present in google apps account at one stroke.Now I can remove the labels but i need to do it one by one.How can i remove all the labels at one stroke.Thanx in advance.</p>
c#
[0]
4,482,363
4,482,364
how to disable outlook blank subject prompt in C#
<p>I want to disable default outlook subject pop up because its making subject optional.I want to have my own pop up which makes the subject mandatory. I am outlook developer and using C#.Net. Can anyone tell me how can i disable outlook blank subject pop up in C#?</p> <p>Thanks, Nidhi</p>
c#
[0]
3,201,658
3,201,659
Loading content in jquery scrolldown in firefox not working
<p>Here is my code it is working in chrome but not in firefox.</p> <pre><code>$(window).scroll(function(){ if($(window).scrollTop() == $(document).height() - $(window).height()){ alert(3); } }); </code></pre>
jquery
[5]
4,463,291
4,463,292
iPhone Developer account: Multiple Admins?
<p>I am doing some dev work for a client. She has a Dev License should would like to put the app under but since she is non-technical it has been frustrating since she has to be the one to submit the final app. </p> <p>Is there a way for a Dev License to have multiple Admins? I have it configured so I am a developer but as such I cannot do the Distribution License. Only she can do that. Is there a fix?</p>
iphone
[8]
4,643,763
4,643,764
How does milliondollarhomepage work?
<p>I noticed the pixel array is only one image, I wonder if it is dynamically created on a page request and then cached? Is that possible to do with .NET?</p>
asp.net
[9]
1,251,862
1,251,863
How do I commit changes to a text file on button press?
<p>I've written a small <a href="http://www.reddit.com/r/ubuntuappshowdown/comments/vbo7y/my_app_idea_ushare_gui/" rel="nofollow">app that creates a GUI</a> for setting up uShare. Currently it depends heavily on the 'w' (write) and 'a' (append) functions to generate/edit ushare.conf file. But I've been trying to find a way for the app to store all the changes until a save button is pressed, and only then committing them to the actual file. I think that would be the best way of getting around having the user press enter every time they change any field (and indeed allow for GtkCheckButton).</p> <p>The code giving me errors, (and any code where I use StringIO has the same result:</p> <pre><code> def on_userinput_activate(self, widget): usrinpt = widget.get_text() global output output = StringIO.StringIO() output.write(usrinpt) def on_savetofile_clicked(self, widget): global output output = StringIO.StringIO() global inserttofile inserttofile = output.getvalue() logfile = open('/home/boywithaxe/Desktop/test.txt', 'w') logfile.write(inserttofile) </code></pre>
python
[7]
275,549
275,550
Receiving memory leak
<p>I am new to iPhone Development. I am displaying lots of images on view.also i put button named LOAD MORE for more images.I am also downloading images on LOAD MORE event. Here is my code:`</p> <pre><code>-(void)btnLoadMorePressed { [appdelegate showLoader:MBProgressHUDModeIndeterminate]; RequestResponseManager *requestManager=[RequestResponseManager sharedInstance]; [requestManager setRequestPropery:self ExtraInfo:nil]; Album *album=[appdelegate.CurrentUser.albumListarray objectAtIndex:indexNum-1]; NSArray *obj_keys = [NSArray arrayWithObjects:@"UserId",@"AlbumId",@"SessionId",@"PageNo",@"ModMethod", nil]; NSArray *objects = [NSArray arrayWithObjects:appdelegate.CurrentUser.userId,album.AlbumId,appdelegate.sessionId,[NSString stringWithFormat:@"%d",currentPage],@"getPhotoListByAlbumId",nil]; NSDictionary *jsonDictionary = [NSDictionary dictionaryWithObjects:objects forKeys:obj_keys]; NSString *jsonString = [jsonDictionary JSONRepresentation]; NSString *requestString=[NSString stringWithFormat:@"data=%@",jsonString]; currentRequest=JGetAlbumPhotoList; [requestManager sendPostHttpRequest:GET_USER_ALBUM_PHOTO_URL RequestType:JGetAlbumPhotoList PostContent:requestString]; } </code></pre> <p>but when i am trying to fetch more images,it gives me memory warning and then suddenly crashing.please help me.thanking you...</p>
iphone
[8]
1,238,004
1,238,005
How to create a Soundex function in PHP?
<p>I have the task of creating a PHP function that does the same exact thing as the built in PHP <code>soundex()</code> function, but I am unable to use the built in function. What would be a custom PHP function that would do the exact same thing as the <code>soundex()</code> function</p>
php
[2]
2,612,135
2,612,136
Android: Possible to have multiple distinct Shared Preferences per app?
<p>Is it possible to have multiple Shared Preferences per app? If you create a PreferenceActivity, the values by default are persisted to /data/data/[PACKAGE_NAME]/shared_prefs/[PACKAGE_NAME]_ preferences.xml</p> <p>Is there a way to have multiple such files and which one to use for a given PreferenceActivity?</p>
android
[4]
4,934,015
4,934,016
jQuery on() method does not bind events like live() did
<p>As described on <a href="http://api.jquery.com/live/"><code>http://api.jquery.com/live/</code></a>:</p> <blockquote> <p>As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. </p> </blockquote> <p>Right. <strong>So instead of</strong> </p> <pre><code>$('.dynamicallyCreatedElement').live('click', function(){ console.log('click'); }); </code></pre> <p><strong>I should use:</strong></p> <pre><code>$('.dynamicallyCreatedElement').on('click', function(){ console.log('click'); }); </code></pre> <p>However it does not bind event to elements created after <code>on()</code> calling. So is it really better <code>live()</code> method ?</p> <p>Am I missing something ?</p>
jquery
[5]
1,782,320
1,782,321
jQuery percentage width has up tick when animating down.
<p>Does anyone know why jQuery has an uptick in the width percentage when using animate to scale down the width of an image. This only seems to happen when you are scaling down a div with a percentage based width that is within a div that is also using a percentage based width. See <a href="http://jsfiddle.net/buz9L/" rel="nofollow">this</a> example in it you can see that the square to the right drops down for a split second in the up tick. If you try ordering the animate changes on completion handlers there are similar results due to the uptick. The example is based on <a href="http://stackoverflow.com/questions/8299608/jquery-animate-with-percenteges">this</a> other SO issue but is unanswered for my use case. I'm guessing it has something to do with 3rds and floats in ranging limits with percentages in jQuery, but maybe there is a simple solution out there. Thanks in advance for any help. </p> <pre><code>Check JSFiddle Link </code></pre>
jquery
[5]
2,310,505
2,310,506
android market is not showing my published application
<p>i have published android app but not appearing in android market.i m using android 2.2 and i have tried in samsung galaxy that is not showing my application so just give me some idea to fix this problem.</p> <p>this is my manifest.xml file:</p> <p> </p> <pre><code> &lt;activity android:name=".Full" android:screenOrientation="landscape" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.SAMPLE_CODE" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".Short" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.SAMPLE_CODE" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre> <p> </p> <p>Please help me..</p>
android
[4]
731,405
731,406
sending and recieving files with php jquery
<p>how can i send and recieve files live like in yahoo chat..i.e if i send the file than the user on the other end will only get that file if he click on the accept button and if he click deny than the file should not upload and should be deleted from the server...i want to that via php jquery $.ajax()</p>
php
[2]
4,406,338
4,406,339
What is the Difference Between file:\D:\Interactives\Pallete\dist and Normal D:\Interactives\Pallete\dist
<p>This might be very basic Question for you. I am getting</p> <p><code>1).file:\D:\Interactives\Pallete\dist</code> as Output from the </p> <p><code>String jardata_path_parent=jarFile1.getParentFile().getParentFile().getPath(). toString();</code></p> <p>Can any one tell me Is there any Difference between Both of the statements. As one works fine in NetBeans but when trying to run at command prompt gives Error <code>CreateProcess error=2, The system cannot find the file specified.</code></p> <p>How can get output as <code>D:\Interactives\Pallete\dist</code></p> <p>Thanks in Advance..</p>
java
[1]
1,158,846
1,158,847
Simple hello world for Android app won't display text
<p>I recently bought an Android phone and am trying to learn to code my own apps. Unfortunately after the first ten seconds I ran into the problem where I can't even get the <a href="http://developer.android.com/resources/tutorials/hello-world.html" rel="nofollow">"hello world" tutorial</a> to display "hello world."</p> <p>I've read similar posts and I can't seem to find a fix. Since the Android loading logo is displaying I've waited for about ten minutes thinking it was just taking a while for the emulator to boot, but no luck.</p> <pre><code>package multivax.random; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class RandomNumbersActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello World"); this.setContentView(tv); } } </code></pre>
android
[4]
4,470,381
4,470,382
Java JPane Option Window Problems
<p>This last program we did, stupid simple, was to just use a jpane and graphics to draw 3 non primative shapes but I need a way so that a message (JOptionPane) shows up AFTER the JPane is closed> if you have it after in the code, they both go at the same time</p>
java
[1]
3,567,210
3,567,211
JQuery - Fadein an ajaxForm() page call
<p>I have this script that opens a new page inside a span:</p> <pre><code>$(document).ready( function() { $('#botao').click( function() { $('#pesquisar').ajaxForm({ type: 'POST', target: '#resultado' }); }); }); </code></pre> <p>I want the new page to fadein, i have tried putting fadein() around with no luck. How do i do that?</p>
jquery
[5]
4,127,114
4,127,115
Intent_filter splash screen manifest Android
<p>I have a main class and a splash screen. the splash doesn't want to show and I'm fairly certain its the manifest.</p> <p>Any thoughts?</p> <pre><code> &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:debuggable="true"&gt; &lt;uses-library android:name="com.google.android.maps"&gt;&lt;/uses-library&gt; &lt;activity android:name="splash"&gt;&lt;/activity&gt;&lt;activity android:label="@string/app_name" android:name=".Main" android:theme="@android:style/Theme.NoTitleBar"&gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;/application&gt; </code></pre>
android
[4]
3,659,597
3,659,598
custom implementation of interface methods
<p>I have a doubt in this scenario, I have posted some example code here....</p> <pre><code>public interface a{ public void m1(); public void m2(); public void m3(); . . . public void m100(); } public class A implements a{ public void m3(){ // implementation code } // Here i need to implement only m3() method but not all 100 methods //basically i have to implement all the other 99 methods // but here i don't want to either implement or provide skeleton declarations for all //remaining.... what should i do for compiling this ???? } </code></pre> <p>Could anyone help this?</p>
java
[1]