Unnamed: 0
int64
65
6.03M
Id
int64
66
6.03M
Title
stringlengths
10
191
input
stringlengths
23
4.18k
output
stringclasses
10 values
Tag_Number
stringclasses
10 values
4,151,698
4,151,699
Getting trouble while uploading a file in PHP
<p>I'm using PHP as server side programming,I'm facing a different type of problem while uploading the images.If the uploading image is having below 8MB is uploading fine but if image size is increases then its not uploading.What might be the problem.I know I've to change in php.ini file,but where I don't know.please help me </p>
php
[2]
5,118,218
5,118,219
Can we overide the popup that come when we click the red underline word in textview with Custom keyboard
<p>I'm working on custom keyboard , What I want to do is select a word from the currentInput and display a popup .</p> <p>I'm not getting how to have to have click event on the word in CurrentInput view.</p> <p>I have tried using onViewClicked , I can find a way to overwrite the exciting popup that opens.</p> <p>This would be similar to how when we click the red underline word in Input view.</p> <p><img src="http://i.stack.imgur.com/higpD.jpg" alt="enter image description here"> Something like this , I need the click event on this underlined text.</p> <p>Thanks in advance!</p>
android
[4]
278,549
278,550
Remove unwanted words from string
<p>I have a csv file to read, but in one column there are some unwanted words. It's easier to write the needed words into an whitelist array, than to make a blacklist. This is what I tried, but i get an empty cell. The following script is only used when the cell index is 5 (the column that I need to modify).</p> <pre><code>$whitelist[0] = "BLACK"; $whitelist[1] = "RED"; $whitelist[2] = "ON"; $whitelist[3] = "BLUE"; $whitelist[4] = "COLOR"; $whitelist[5] = "YELLOW"; $whitelist[6] = "GREEN"; $whitelist[7] = "CYAN"; $whitelist[8] = "MAGENTA"; foreach( $csv_line as $row ){ $cell = explode(' ', $row[0]); foreach($cell as $b=&gt;$v) if( !in_array($cell, $whitelist) ) unset( $cell[$b] ); $row[0] = implode(' ', $cell); } echo "&lt;td&gt;".$row[0]."&lt;/td&gt;"; </code></pre> <p>Any tips will be appreciated.</p> <p>Thanks, Sebastian</p>
php
[2]
3,301,168
3,301,169
Use javascript to hide element based on ALT TAG only?
<p>I have a wordpress site, and a plugin uses cufon text replacement. (I'm not entirely sure the actual way it does this, but it's not important).</p> <p>I'd like to use a "display:none" on only a specific word or two. For example, on the mobile theme, I'd like to change "Contact Us" to only "Contact". The only way to hide this on the fly is by using the alt tag since there is no class or ID.</p> <p>So can I use JavaScript to detect the alt tag "Us" and do a display:none? Sample code below.</p> <pre><code>&lt;cufon class="cufon cufon-canvas" alt="Us" style="width: 20px; height: 14px; "&gt;&lt;canvas width="32" height="17" style="width: 32px; height: 17px; top: -2px; left: -2px; "&gt;&lt;/canvas&gt;&lt;cufontext&gt;Us&lt;/cufontext&gt;&lt;/cufon&gt; </code></pre>
javascript
[3]
409,544
409,545
wait a little before finish my activity
<p>What's the best way to wait before my activity is finished?</p> <p>In fact I launch a new activity named MasterNumber from MainActivity with "startActivityForResult". MasterNumber send a SMS and shows a Toast to say "SMS Sent", but MasterNumber activity is closed so quickly that the Toast is showed in MainActivity.</p> <p>Here is the content of MainActivity:</p> <pre><code>//Lorsqu'on clique sur le bouton "Send" Button button1 = (Button) findViewById(R.id.masterbutton1); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(automatikRN, null, "#00#", null, null); Toast.makeText(getApplicationContext(), "SMS Sent!", Toast.LENGTH_LONG).show(); } catch (Exception e) { Toast.makeText(getApplicationContext(), "SMS failed, please try again later!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } finish(); } }); </code></pre> <p>and here is the content of MasterNumber (activity)</p> <pre><code>//Lorsqu'on clique sur le bouton Add Master Number Button button2 = (Button) findViewById(R.id.mainbutton2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //On va appeler l'activité MasterNumber (#RECIPIENTNUMBERAUTOMATIK-1) Intent setMasterNumber = new Intent(MainActivity.this, MasterNumber.class); setMasterNumber.putExtra("MN", recipientNumber); //on lui fournit le n° du dest. afin qu'il soit saisit automatiquement startActivityForResult(setMasterNumber, 1); } }); </code></pre>
android
[4]
2,446,924
2,446,925
Request source code from internal page using jquery same domain
<p>I'm trying to get the source of an internal domain page can have it basically cloned into a js file.</p> <p>I'm not sure if it's possible, but I have attempted to start what the code might look like.</p> <p>I realize the var source is probably where I go wrong as that will not function correctly.</p> <p>Hopefully someone can try to debug my code.</p> <p>Thanks!</p> <pre><code> $(document).ready(function() { // make request to site var request = "http://mysite.com/page.html"; // get the dom from the html layer var source = $(request+'html').html(); // output to the dom the source of the request $('html').append(source); }); </code></pre> <p>Would something like this make more sense?</p> <pre><code>$(document).ready(function() { var create = $('html').load('http://mysite.com/page.html'); document.write(create); }); </code></pre>
jquery
[5]
4,337,809
4,337,810
Is there a way to recognize an item is a file or a directory?
<p>I hope to know if there is a way to detect an item is a file or directory?</p>
iphone
[8]
639,200
639,201
Casting from IEnumerable<Object> to IEnumerable<string>
<p>Recently I found a very surprising behavior in c#. I had a method which takes <code>IEnumerable&lt;Object&gt;</code> as a parameter and i was passing <code>IEnumerable&lt;string&gt;</code> but it's not possible. While in c# everything can be upcast to Object than why this is not possible? It's totally confusing for me. Please someone clear me on this issue.</p>
c#
[0]
2,278,384
2,278,385
String Handling Issue
<p>On my client-server system, a user can change a value of a <strong>Variable</strong>, say "System Power" in a drop-down box ("ON", "OFF", "STANDBY"). </p> <p>When clicking an index, a message gets passed to the server to change the variable that captures the state of "System Power" in this case.</p> <p>Currently, my server-side code is implemented to try to convert the value in the client's message as an Int64. </p> <p>Here are my thoughts as to a solution:</p> <p>1 - hard code logic in my client-side code to send the right Int64 value. Example: send message(System Power, 1) instead of message(System Power, OFF).</p> <p>2 - from the client-side, read an XML file that maps <strong>Variable</strong>'s state (ON, OFF) to an Int64 value</p> <p>3 - fix the server-side to behave correctly.</p> <p>I think #1 is a poor option due to inflexibility. #3 is the right option, but it will take me too long on my schedule.</p> <p>To implement #2, would it make sense to create an XML file like this:</p> <pre><code>&lt;root&gt; &lt;Variables&gt; &lt;System Power&gt; &lt;element name="ON"&gt;1&lt;/element&gt; &lt;element name="OFF"&gt;0&lt;/element&gt; ... </code></pre> <p>Then, in my client-side code, I could perform a look-up in the XML file to determine the correct message(System Power, 0).</p> <p>Please advise. Thank you.</p>
asp.net
[9]
2,968,012
2,968,013
Totalling up numbers within ArrayList out displaying
<p>I want to output the total of some numbers in a text file, with the use of an <code>ArrayList</code> to seek them out etc, I am unsure of how I would do this? here is my code:</p> <pre><code>import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.Scanner; public class ArrayListOfNumbers { public static void main(String[] args) throws FileNotFoundException { ArrayList&lt;String&gt; numbers = new ArrayList&lt;String&gt;(); Scanner Scan = new Scanner (new File("numbers.txt")); while (Scan.hasNext()){ numbers.add(Scan.nextLine()); } for(int i = 0; i &lt; numbers.size(); i++){ System.out.println(numbers.get(i)); } System.out.println("") Scan.close(); } } </code></pre>
java
[1]
4,607,011
4,607,012
using header() is good in this context
<p>I have a user who registered on my website with some email and password. As soon as he registers we will send a confirmation code to his email and ask him to enter the number to sign up.</p> <p>Unfortunately there is a possibility that the user may fill the data and may logoff today without entering the confirmation code and he may come back tomorow and login with his registered email. So I would check his email in the database and if he is registered and if his email is under the approval of code sent to his email then I want to redirect him to a page indicating that "a code has been sent to your email respond to your code to sign up" else if he is already registered and there is no pending approvals then redirect him to his profile.</p> <p>I am not sure the way to do it. I was thinking to use this: if user is under approval then <code>header('location confirmation.php')</code> and if he is approved then <code>header('location profile.php')</code> but I'm not sure if this is the right way to do it. Can headers be used for this purpose? or what is the alternate solution to do it. Please help me with this, thanks.</p>
php
[2]
113,575
113,576
c# Time formatting
<p>I have a time field as such: 06:30 PM. What formatting do I need so that it shows up as 6:30 PM. I tried:</p> <pre><code> String.Format("{0:t}", data.PgTime) </code></pre> <p>but still getting 06:30 PM</p>
c#
[0]
1,702,024
1,702,025
Avoid button multiple rapid clicks
<p>I have a problem with my app that if the user clicks the button multiple times quickly, then multiple events are generated before even my dialog holding the button disappears</p> <p>I know a solution by setting a boolean variable as a flag when a button is clicked so future clicks can be prevented until the dialog is closed. However I have many buttons and having to do this everytime for every buttons seems to be an overkill. Is there no other way in android (or maybe some smarter solution) to allow only only event action generated per button click?</p> <p>What's even worse is that multiple quick clicks seems to generate multiple event action before even the first action is handled so if I want to disable the button in the first click handling method, there are already existing events actions in the queue waiting to be handled!</p> <p>Please help Thanks</p>
android
[4]
2,100,641
2,100,642
php include from a subfolder
<p>I have been using to get my files</p> <pre><code>&lt;?php include 'example.html'; ?&gt; </code></pre> <p>however how do you get them if they are in a subfolder: For example</p> <pre><code>pictures/example.html </code></pre>
php
[2]
2,862,276
2,862,277
Get Selected HTML in browser via Javascript
<p>I have a requirement for my web app to allow the user to "Print Selected Only". In other words, a user selects text and potentially images and then clicks this option. I've seen examples of getting selected text with Javascript, but haven't found a solution for getting the selected html itself. </p> <p>As an example if I have a document like so:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;A bunch of text&lt;/p&gt; &lt;img src="someimage.jpg" /&gt; &lt;p&gt;Even more text&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>If user highlights the image and the second paragraph, I'd want the javascript to return:</p> <pre><code>&lt;img src="someimage.jpg" /&gt; &lt;p&gt;Even more text&lt;/p&gt; </code></pre> <p>Is this possible and how would one go about doing it?</p> <p>Edit: I ended up going with a js library called <a href="http://code.google.com/p/rangy/" rel="nofollow">Rangy</a> for this.</p>
javascript
[3]
2,972,748
2,972,749
How to specify path relative to site root?
<p>i want to specify a path to a file relative to the root of the web-site. e.g.</p> <pre><code>&lt;script type="text/javascript" src="/Scripts/jquery-1.7.2.min.js"&gt;&lt;/script&gt; </code></pre> <p>In ASP.net that causes problems because the <em>"root"</em> of the <strong>site</strong> can be different from the root of <strong>server</strong>.</p> <p>e.g. Specifying <code>src</code> results in a <code>GET</code> from path</p> <pre><code>src="/Scripts/jquery-1.7.2.min.js" http://localhost:64276/Scripts/jquery-1.7.2.min.js 404 src="~/Scripts/jquery-1.7.2.min.js" http://localhost:64276/WebSite/Adminstration/~/Scripts/jquery-1.7.2.min.js 404 src="~Scripts/jquery-1.7.2.min.js" http://localhost:64276/WebSite/Adminstration/~Scripts/jquery-1.7.2.min.js 404 src="~/Scripts/jquery-1.7.2.min.js" runat="server" 500 Unexpected character '$' </code></pre> <p>How can i specify a <strong>site relative</strong> path when using HTML in ASP.net?</p> <h2>See also</h2> <ul> <li><a href="http://stackoverflow.com/questions/9700260/how-to-set-the-site-root-relative-path-for-localhost-on-iis-on-my-web-applicat">How to set the Site-Root Relative Path (for localhost) on IIS on my web application</a></li> <li><a href="http://stackoverflow.com/questions/4571755/asp-net-relative-path">ASP.NET relative path</a></li> <li><a href="http://stackoverflow.com/questions/7960094/relative-path-from-site-root">Relative path from site root</a></li> <li><a href="http://stackoverflow.com/questions/200863/jquery-visual-studio-error-cs1056-unexpected-character">JQuery: Visual studio, error CS1056: Unexpected character &#39;$&#39;</a></li> </ul>
asp.net
[9]
1,826,555
1,826,556
why this happens in java?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/565634/integer-with-leading-zeroes">Integer with leading zeroes</a> </p> </blockquote> <p>I'm very new to Java. I did this :</p> <pre><code>System.out.println(01111); </code></pre> <p>which prints <code>4680</code>. Why it didnt print out <code>01111</code>?</p> <p>Thanks in advance.</p>
java
[1]
2,409,944
2,409,945
Change call type programatically
<p>How change a type of call programatically using Content Providers? From missed call to received call?</p> <p>Thanks!</p>
android
[4]
3,184,464
3,184,465
iPhone SDK location on hard drive
<p>I attempted to reinstall the iphone sdk on my mac. I figured the reinstallation would just override my previous installation but it seems that more hard drive space was eaten up after the second install. Does anyone know how I can refresh my installation and start from scratch to free up all the lost space?</p>
iphone
[8]
6,308
6,309
Getting FULL URL with #tag
<p>Tried to print the $_SERVER array in PHP, yet I can't find what I want:</p> <p><a href="http://www.domain.com/#sometaginpage" rel="nofollow">http://www.domain.com/#sometaginpage</a></p> <p>I want the "sometaginpage".</p> <p>Help. Thanks!</p>
php
[2]
1,959,097
1,959,098
Converting VB.NET Web Form to C# and wiring up events
<p>In My VB.NET web page, I have this standard event. Note the "Handles" clause on teh event declaration.</p> <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub </code></pre> <p>In my C# web app, I have this:</p> <pre><code>protected void Page_Load(object sender, System.EventArgs e) { </code></pre> <p>Since C# doesn't have a "Handles" equivalent and from what I've seen, event handlers are wired up using delegate += syntax, I was looking for this, but I could not foind it in the aspx page, aspx.cs file or the aspx.designer.cs file.</p> <p>In VB, I would have two drop down lists at the top of the Code Editor window and I could select any object on the web form or the web form itself and see the possible events for the object. Selecting the event would either take me to the event handler or if it didn't exists, it would create the stub for me.</p> <p>I know that the Properties window in C# (and I think in VB, too) has an Event tab that shows the list of events for the selected object GUI object, but "Page" doesn't appear as an object that can be selected.</p> <ol> <li><p>Where does C# define the hooking up of the event to the handler? </p></li> <li><p>How do I generate a stub for the Page event handler routine? I know that the handle appears by default, but what if it is deleted or I want to add a Page_initialize code? Is there an easy way to get the stub or do I need to go to the Object Browser for the syntax?</p></li> </ol>
c#
[0]
195,991
195,992
DoubleTap in android
<p>I need to create a small text area.Within that text area when i double click,it will move to next activity.How could i do this?</p>
android
[4]
4,273,998
4,273,999
How to get a mobile number for my application using an API?
<p>How do get the mobile number from an Android application? After installing the application on the mobile, I want to get the mobile number of the phone. Is there any API available in Android?</p>
android
[4]
1,700,636
1,700,637
Getting 'this' object in javascript without using the word 'this'
<p>What I am trying to do is getting the same result as clicking on this following submit button.</p> <pre><code>&lt;input id="submit_http:" class="add_submit" type="button" onclick="return dex.forms.form_ajax_submit(this,function(res) { alert('posting failed'); },function(res) { alert('posting success'); });" value="Next" name="submit_http:"&gt; </code></pre> <p>I was trying to do it like that:</p> <pre><code>$('.NextButton').click(function () { dex.forms.form_ajax_submit(document.getElementsByName('submit_http:'), function(res) { alert('posting failed'); }, function(res) { alert('posting success'); }); }); </code></pre> <p>But looks like document.getElementsByName is not returning the same result as the submit button 'this' How can I solve this issue?</p>
javascript
[3]
1,925,086
1,925,087
Saving listbox items to file
<p>I am trying to save the items from a listbox to a file. So I started writing this code:</p> <pre><code>private void mstri_SaveLog_Click(object sender, EventArgs e) { Stream s; this.sfd_Log.Filter = "Textfiles (*.txt)|*.txt"; DialogResult d = this.sfd_Log.ShowDialog(); if ((d == DialogResult.OK) &amp;&amp; (this.lb_Log.Items.Count != 0)) { for (int i = 0; i &lt; this.lb_Log.Items.Count; i++) { if ((s = this.sfd_Log.OpenFile()) != null) { StreamWriter wText = new StreamWriter(s); wText.Write(this.lb_Log.Items[i]); s.Close(); } } } } </code></pre> <p>There is a new textfile that is created, but it is <strong>always empty</strong>. But I have no idea where there is a mistake in my code.</p> <p>Thank you for your help.</p>
c#
[0]
718,085
718,086
Game engines for IPhone game development
<p>I am totally new to IPhone game development enviornment. Kindly suggest me with some common game engines used for developing games on IPhone. </p> <p>Jimmy</p>
iphone
[8]
2,309,141
2,309,142
Need to wait for'KeyDown' Enter to accept TextBox text
<p>I need to have a way to set an integer in a method by taking the users input from a textbox. The problem is that I need to pause the code to allow input to be typed then to resume when 'Enter' is keyed. Keydown method works but not for setting a variable local to an outside method. For instance:</p> <pre><code>....method() { int num = 0; //wait for keydown Enter num = Convert.ToInt32(TextBox1.Text); //or String s = TextBox1.Text; num = Int.TryParse(s); .... } </code></pre>
c#
[0]
5,761,377
5,761,378
What is good practice when u create a method whose parameter contains 2 objects but it only changes 1
<p>for example:</p> <pre><code> void FilterA(Hashset&lt;T&gt; blackList, List&lt;T&gt; myList) { blackList.UnionWith(myList); } </code></pre> <p>I don't know if there would be some good coding styles that separates <code>blackList</code> and <code>myList</code> apart. Or is it necessary at all?</p>
c#
[0]
4,976,627
4,976,628
Calling a changing function name on an object with PHP : how?
<p>How would I do something like this :</p> <pre><code>class Test { public function test($methodName) { $this-&gt;$methodName; } private function a() { echo("a"); } private function b() { echo("b"); } } $testObj = new Test(); $testObj-&gt;test("a()"); $testObj-&gt;test("b()"); </code></pre> <p>Maybe I should just pass a parameter "TYPE" and use a "IF statement" but I'm just curious! :)</p> <p>And what if the "dynamic function name" has one or more parameters? </p> <p>UPDATE : Thanks everyone! :)</p> <p><strong>UPDATE #2 - Answer :</strong> </p> <pre><code>class Test { public function testOut($methodName) { $this-&gt;$methodName(); } private function a() { echo("a"); } private function b() { echo("b"); } } $testObj = new Test(); $testObj-&gt;testOut("a"); $testObj-&gt;testOut("b"); </code></pre> <p>The problem with the class is that there was a method named "Test" (the same as the class name)... I changed it and it worked.</p>
php
[2]
3,805,120
3,805,121
I cannot use IF-THEN-ELSE and $_SERVER variables in PHP class definition
<pre><code>class MY_CONFIG { if ( $_SERVER["SERVER_ADDR"] == "127.0.0.1" ) { var $default = array( 'foo' =&gt; 1, 'bar' =&gt; 2 ); } else { var $default = array( 'foo' =&gt; 3, 'bar' =&gt; 4 ); } } </code></pre> <p>I am new to PHP. What's wrong with my code above?</p> <p>The system keeps saying:</p> <p>Parse error: syntax error, unexpected T_IF, expecting T_FUNCTION in C:\wamp\www\test\class.php on line 4</p> <p>Thanks.</p> <p>-- Hin</p>
php
[2]
4,570,537
4,570,538
Place a footer for each activity
<p>I'm trying to place a TextView at the bottom of every activity by using the include... My code is below... I don't know why, but it remains at top... Although it works fine for TextView.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#E0E0E0" android:orientation="vertical" /&gt; &lt;include android:layout_alignParentBottom="true" android:id="@+id/footer" layout="@layout/footer" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_alignParentBottom="true" android:text="Hello" android:textColor="#000000" android:textSize="15dp" /&gt; </code></pre>
android
[4]
4,171,578
4,171,579
Change textSize based on screen res/density?
<p>I have a grid of 18 buttons, apparently this is too big as my text is getting messed up between different res/densities.</p> <p>50sp looks right on 240 hdpi WVGA800, 30sp looks right on 120 ldpi QVGA and 160 mdpi HVGA. How can I adjust the sizes based on whatever screen is being used?</p>
android
[4]
112,847
112,848
Calling inflate() multiple times in an Android view
<p>I have a View that inherits from LinearLayout that inflates itself. After it has been created and inflated I wanted the ability to inflate a different layout. However, calling inflate() a second time seems to have no effect. Only if I close the activity and open it again is the state reflected in the UI.</p> <p>Is it possible to call inflate multiple times to dynamically change the layout?</p> <p>My inflate code is pretty simple:</p> <pre><code>layoutInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutInflater.inflate(R.layout.my_layout, this, true); </code></pre>
android
[4]
2,180,856
2,180,857
How to get the last four characters of a string whose length may change in Python
<p>My string coming in could be really any length i just need the last four characters:</p> <pre><code>string = asdfPALD string = asddasdfBLCA </code></pre>
python
[7]
612,709
612,710
Selecting paticular class in jquery
<p>I was wondering how i would go about selecting this class and changing it to a span12 once the screen size is below 1000px using jquery</p> <pre><code>&lt;div class="span4 minus65"&gt; </code></pre> <p>I am using </p> <pre><code>$(window).resize(function(){ if($(this).outerWidth() &lt; 1000){ $('.span4 minus65').attr('class',"span12"); } }); </code></pre> <p>but nothing changes when the screen width is below 1000px</p>
jquery
[5]
3,048,140
3,048,141
Session expiration issue in ASP.NET MVC
<p>Hi I have some issues with ASP.NET MVC session state which is not expiring after I implement the following piece of code and put the attributes over the methods.</p> <pre><code>public sealed class SessionActionFilterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpContext ctx = HttpContext.Current; //Check if session is supported if (ctx.Session != null) { //Check if the session is new if (ctx.Session.IsNewSession) { //If it says it is a new session but an existing cookie exists //then it must have timed out string sessionCookie = filterContext.HttpContext.Request.Headers["Cookie"]; if ((sessionCookie != null) &amp;&amp; (sessionCookie.IndexOf("ASP.NET_SessionId", StringComparison.OrdinalIgnoreCase) &gt;= 0)) { //Redirect to the login page ctx.Response.Redirect("~/Home/Index", true); ctx.Response.End(); } } } base.OnActionExecuting(filterContext); } } </code></pre> <p>The issue is that the Redirection request is not executing and the Action which has SessionActionFilter Attribute executes. This method uses session variables which are expired and results in error. </p> <p>Can anybody tell what I am missing?</p> <p>Thanks a lot in advance!!</p>
asp.net
[9]
2,954,859
2,954,860
Timezone issue - android
<p>I'm trying to get the timezone in android </p> <pre><code> Calendar cal = Calendar.getInstance(); TimeZone tz = cal.getTimeZone(); System.out.println("timezone = " + tz.toString()); </code></pre> <p>I should be getting</p> <pre><code>sun.util.calendar.ZoneInfo[id="Europe/London",offset=0,dstSavings=3600000 ..... </code></pre> <p>But when i print in ddms i get the below value</p> <pre><code>org.apache.harmony.luni.internal.util.ZoneInfo@9e54425b </code></pre>
android
[4]
1,616,017
1,616,018
Simulate low battery & low memory in Android
<p>In order to generate the notifications i need to know about how to generate the low battery and low memory interrupts programmatically. Can any one please provide your suggestions.I am aware of Intents.</p>
android
[4]
4,478,154
4,478,155
What are the performance implications of disabling the lock-screen?
<p>I am working on a timer application (it's my first app to try and learn the ropes). While the timer is running, I want to offer the user the ability to prevent the screen from locking.</p> <p>Since the screen is always displaying something (and refreshing the clock every second), what would the performance penalty be for doing this? The only things active on the screen are the timer (black background with just the running time) and "split" and "stop" buttons? I am mostly concerned with the battery life of the phone; e.g. if this were a long-running timer job (let's say long-distance running with split times).</p>
android
[4]
4,048,557
4,048,558
Unique setTimeout timer for each element?
<p>I'm trying to make a menu where there are elements shown in plain text, and when you hover over them there are fields revealed to edit the plain text.</p> <p>You can see an example here: <a href="http://jsfiddle.net/Bx7vX/9/" rel="nofollow">http://jsfiddle.net/Bx7vX/9/</a></p> <p>The timer variable is declared globally, so when you hover over a second list element really quickly, it clears the timer for the previous element. However, when I declare the timer inside of the function (seen here: <a href="http://jsfiddle.net/JYavJ/" rel="nofollow">http://jsfiddle.net/JYavJ/</a>), the multiple elements will fade out correctly, but when you hover off of an element and then back on, it won't clear the timer correctly. </p> <p>So basically, I'm having an issue with keeping the timer variable persistent between hovers on a single element. I've tried adding the timer variable to the DOM element with no success. If someone knows how to solve this issue, or maybe a better way to approach this menu style entirely, I'd much appreciate it. Thanks!</p> <p>For reference, here's the code with the timer declared outside of the hover function:</p> <pre><code>$('.diet_draggable').hover(function() { var timer; var current = $(this); if (current.is(':hover')){ clearTimeout(timer); $(this).children(".static_units").hide(); $(this).children(".mod_units").show(); } else if (current.children('.mod_units').children('.list_amount').is(":focus")) { current.children('.mod_units').children('.list_amount').blur(function() { timer = setTimeout(function() { current.children(".mod_units").fadeOut(300); current.children(".static_units").fadeIn(300); }, 500); if (current.is(':hover')) clearTimeout(timer); }); } else { timer = setTimeout(function() { current.children(".mod_units").fadeOut(300); current.children(".static_units").fadeIn(300); }, 500); } }); </code></pre>
jquery
[5]
201,367
201,368
draggable element color changed back when refreshing
<p>The draggable elememnt color will be changed to #DF2525 when stop dragging. But the color is changed back to original one when page is refresh. I want color won't be changed back when refreshing. Is there anyone know solution? Thanks in advance. </p> <p>$(function() {</p> <pre><code> $( "#draggable" ).draggable({ stop: function(){ var position = $(this).position(); $(this).css({"color":"#ff00ff","background":"#DF2525"}); } }); }); &lt;div class="demo"&gt; &lt;div id="draggable" class="ui-widget-content"&gt; &lt;p&gt;Drag&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
jquery
[5]
5,030,641
5,030,642
transparent panel with visibility criteria-Android
<p>I want to create a transparent panel with two buttons , previous and next.</p> <p>As i am using two edittext box. if i click on any edit text box that panel become visible and i can move in edittext through previous and next button.</p> <p>How Can i do this?</p>
android
[4]
709,726
709,727
Invoking Java EE web services from iPhone
<p>Is it possible to invoke Java EE web services from iPhone? and how?</p>
iphone
[8]
5,049,720
5,049,721
Coding a BBS Server in java
<p>After looking at the Google BBS project the other day I quite liked the idea of coding a new front end for our enterprise app that would be a bbs.</p> <p>This bbs server would then call various webservices etc.. all fine, all done before.</p> <p>The question I have is that I have made a telnet server before, connected from a client and talked and send data, but how do I get the BBS look, i.e being able to put the cursor where I want it, receive movement (via arrow keys) commands to move about and place a status (mock) bar at the bottom. Get the text scrolling up effect as a new screen is drawn (but not the status bar)</p> <p>So the question is using a telnet tech the best way to do this, or how can I achieve this look using another tech?</p>
java
[1]
777,133
777,134
Increasing the memory capacity of the android emulator?
<p>How can the Android emulator's memory capacity be increased? I have a 16MB binary file which I have to parse. But when I execute a second time it says:</p> <pre><code>Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE. </code></pre> <p>Can anybody help please?</p>
android
[4]
2,768,572
2,768,573
unexpected T_RETURN in C:\Program Files (x86)\xampp\htdocs\ss\admin.php on line 3
<p>code is</p> <pre><code>&lt;?php ini_set("display_errors","1"); ini_set("display_startup_errors","1"); set_magic_quotes_runtime(0); include("include/dbcommon.php"); ##if @BUILDER.m_bCreateLoginPage## if(!@$_SESSION["UserID"]) { header("Location: login.php"); return; } ##endif## ##if @BUILDER.arrLanguages.len&gt;1## include("include/languages.php"); ##endif## include('libs/Smarty.class.php'); $smarty = new Smarty(); $conn=db_connect(); $strPerm = GetUserPermissions("##@t.strDataSourceTable s##"); if(!$_SESSION["IsAdmin"]) { echo "&lt;p&gt;".##message NO_PERMISSIONS##." &lt;a href=\"login.php\"&gt;".##message BACK_TO_LOGIN##."&lt;/a&gt;&lt;/p&gt;"; return; } </code></pre>
php
[2]
2,688,670
2,688,671
get selected element containing specific word on text - jquery
<p>i want to check if selected item contains specific word. Ex:</p> <pre><code> &lt;select name='project_type' id='type'&gt; &lt;option value='1'&gt;Interpretation - S&lt;/option&gt; &lt;option value='2'&gt;Interpretation - K&lt;/option&gt; &lt;option value='5'&gt;Editing&lt;/option&gt; &lt;option value='7'&gt;Translation&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Jquery:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ //Hide div w/id extra $("#work1").show(); $("#work2").hide(); // Add onclick handler to checkbox w/id selected $("#type").live('click', function(){ // If checked if (!$("#type:selected").text(contains('interpretation'))) { //show the hidden div $("#work1").show(); $("#work2").hide(); } else if ($("#type:selected").text(contains('interpretation'))) { //otherwise, hide it $("#work2").show(); $("#work1").hide(); } }); }); &lt;/script&gt; </code></pre> <p>I need to get the selected element which contains 'interpretation' on text (i want all elements containing that word). I made this :<code>$("#type:selected").text(contains('interpretation'))</code> but doesn't function. Please, anybody can help? </p>
jquery
[5]
2,544,987
2,544,988
Delete everything between "quote" tags ([quote])
<p>I have nested quotes enabled in my private message system, but now I want to show the user a part of the message when they hover the title of the message.</p> <p>To get the relevant text out of the message I want to delete the quote parts.</p> <p>The quote structure is as follows:</p> <pre><code>[quote] [quote] dasdasa adsadsa ds a [/quote] ddasd asd ads adsasd [/quote] </code></pre> <p>How can I remove everything between de quote tags? </p> <p>I have tried it with the following code, but the last part of the nested quotes won't remove:</p> <pre><code>while(preg_match('#\[quote=(.*?)\](.*?)\[\/quote\]#si', $message)) { $message = preg_replace('#\[quote=(.*?)\](.*?)\[\/quote\]#si', '', $message, 1); } while(preg_match('#\[quote\](.*?)\[\/quote\]#si', $message)) { $message = preg_replace('#\[quote\](.*?)\[\/quote\]#si', '', $message, 1); } </code></pre> <p>Any suggestions how to delete these quotes out of the message? Thx!</p>
php
[2]
4,881,425
4,881,426
Where can I get comdef.h?
<p>I downloaded some example code from the internet, but when I compiled it I ran into some trouble. My compiler tells me: comdef.h: No such file or directory.</p> <p>I searched a bit on the internet, but I couldn't find anyone else with the same problem and I have no clue where I can obtain this header file.</p> <p>I use codeblocks with the GNU GCC compiler.</p>
c++
[6]
741,949
741,950
Android Scroller Issue
<p>i've done a custom view group to display my menu in a different way : </p> <p>it comes from the right of the screen.</p> <p>I use scrollTo right now and it works fine, but i would like to get the scroll action animated, so i decided to add a scroller. but when i call :</p> <pre><code>mScroller.startScroll(0, 0, 100, 0, 1000); </code></pre> <p>nothing happends. scrollTo(100,0) did its job</p> <p>Could you explain me why ? I basically have no more code to do what i want. is it a problem ?</p> <p>I've tried to do a simple animation : my xml : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="700" android:fromXDelta="0" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:toXDelta="100" &gt; </code></pre> <p>my Java : </p> <pre><code>Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.translate_menu_animation); animation.start(); </code></pre> <p>but still, it does nothing.</p> <p></p>
android
[4]
3,090,577
3,090,578
Set Contact Number in Contact Uri
<p>In my application i want to add the contact number . So here i called the Below code . It call the Add contact screen but i want to set the contact number using code . can any one help me to solve my problem ?</p> <pre><code>Intent intent = new Intent(Intent.ACTION_INSERT,People.CONTENT_URI); startActivityForResult(intent, 1); </code></pre> <p>It is called Add Contact Screen .</p> <p><img src="http://i.stack.imgur.com/bU1Tb.png" alt="In the Phone edit text i want to add the phone number using code "></p>
android
[4]
4,869,021
4,869,022
How to pass escaped string to shell script in Python
<p>I am attempting to create a Python script that in turn runs the shell script "js2coffee" to convert some javascript into coffeescript. </p> <p>From the command line I can run this, and get coffeescript back again...</p> <p><code>echo "var myNumber = 100;" | js2coffee</code></p> <p>What I need to do is use this same pattern from Python.</p> <p>In Python, I've come to something like this:</p> <pre><code>command = "echo '" + myJavscript + "' | js2coffee" result = os.popen(command).read() </code></pre> <p>This works sometimes, but there are issues related to special characters (mostly quotes, I think) not being properly escaped in the <code>myJavascript</code>. There has got to be a standard way of doing this. Any ideas? Thanks!</p>
python
[7]
5,753,083
5,753,084
MediaPlay won't play a sound, why?
<p>Here's my code </p> <pre><code>MediaPlayer mp = new MediaPlayer(); ... try { mp.setDataSource( getString(R.raw.click)); mp.prepare(); mp.start(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>yet strangely it give me </p> <pre><code>09-26 16:06:39.316: INFO/ActivityManager(110): Displayed Constructor.rob.com/.constr: +7s443ms 09-26 16:06:40.445: INFO/StagefrightPlayer(76): setDataSource('res/raw/click.mp3') 09-26 16:06:40.453: ERROR/MediaPlayer(21990): error (1, -2147483648) 09-26 16:06:40.457: WARN/System.err(21990): java.io.IOException: Prepare failed.: status=0x1 </code></pre> <p>any ideas what might be wrong?</p> <p>Thanks!</p>
android
[4]
5,424,395
5,424,396
How do I get rid of this weird gray drop shadow thing on my EditTexts?
<p>I'm not even sure what it's actually called.. but it looks really bad on some devices.</p> <p><img src="http://i.stack.imgur.com/YZGrJ.png" alt="weird gray thingy"></p>
android
[4]
1,474,498
1,474,499
Drag and drop functionality of android
<p>Am working on implementing the Drag and Drop functionality in android Here is my code.</p> <pre><code> public class DragnDropActivity extends Activity implements OnTouchListener,OnDragListener { } </code></pre> <p>am unable to reach onDraw call back function</p>
android
[4]
2,982,724
2,982,725
Cannot imitate a web request with request parameters : "X-Socket-Transport", "xhrPolling" / "X-Requested-With", "XMLHttpRequest" . java
<p>I am trying to create a parser and my request looks like : =1367664318243">https://www.example.com/method?sessionId=VFVSXxDBCjCDZ2QADWJ1bGxldEBwaG9ib3MAAAkBAAAd1wM.&amp;=1367664318243. I'm creating a HttpURLResourceConnectionConfig, setting all the parameters, but when i loaded in Eclipse it does not work. I've searched on the internet all the possible examples on replicate a XMLHttpRequest using only java, but there are not many. The interesting thing is that, if i take the url from eclipse while eclipse is running and waiting to connect and put it in a browser, in browser it loads and also in eclipse, but if i put it only in eclipse it gives me read timed out. So, if i loaded it in browser it works also in eclipse. I've increased the read timed out. I'm stuck on this think for weeks. Can anyone help?</p> <pre><code> `HttpURLResourceConnectionConfig config = new HttpURLResourceConnectionConfig(); config.clearRequestProperties(); config.setRequestProperty("Accept", "text/plain, */*; q=0.01"); config.setRequestProperty("Accept-Encoding", "gzip,deflate"); config.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); config.setRequestProperty("Cookie", _cookie); config.setRequestProperty("Host", "www.example.com"); config.setRequestProperty("Referer", "https://www.example.com/en/"); config.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0"); config.setRequestProperty("X-Socket-Transport", "xhrPolling"); config.setRequestProperty("X-Requested-With", "XMLHttpRequest"); config.setRequestMethod("GET"); config.setFirstByteReadTimeout(2 * 1000); config.setAllBytesReadTimeout(10 * 1000); return config;` </code></pre>
java
[1]
1,074,891
1,074,892
I need to define __setattr__ for assignment of fields without properties, but use the setter/getter functions for fields with a property defined
<p>Defining <code>__setattr__</code> overrides all setter methods / properties I define in a class. I want to use the defined setter methods in the property, if a property exists for a field and use <code>self.__dict__[name] = value</code> otherwise.</p> <p>Help! I found one solution that used <code>__setitem__</code>, but this does not work for me</p> <p>Where are properties stored in a python class? How do I access them?</p> <p>How do I define <code>__setattr__</code> so that it uses the properties for fields with setter methods defined?</p> <pre><code>class test(object): def _get_gx(self): print "get!" return self.__dict__['gx'] def _set_gx(self, gx): print "set!" self.__dict__['gx'] = gx gx = property(_get_gx, _set_gx) def __setattr__(self, name, value): self.__dict__[name] = value def __init__(self): pass </code></pre> <p>also,</p> <p>Why is "get!" printed twice when I do,</p> <pre><code>x = test() x.gx = 4 x.gx prints: "gets!" "gets!" 4 </code></pre>
python
[7]
1,282,496
1,282,497
Getting a value of object for user-defined classes for while, if and for statements
<p>I am trying to get a bool value out of user defined object. For example with float or int I can do something like</p> <pre><code>float a = 3.5 if (a) doSomething(); </code></pre> <p>I want my class to look like this:</p> <pre><code>class Socket { ... ... }; ... Socket T; if (!T) cout &lt;&lt; "Error occured"; else { doStuff(); } </code></pre> <p>Of course I can define a function that returns bool (like bool isValid();) and call it directly, but I would like to know if it is possible.</p>
c++
[6]
5,483,514
5,483,515
Android SMS_RECEIVED broadcastreceiver not getting called
<p>The onreceived function in my bradcastreceiver is not being triggered.</p> <p>I tested this by sending a sms message from different phones, but the log does not seem to show any Activity.</p> <p>here is the receiver class</p> <pre><code>package nz.co.smstopc; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class SmsListener extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { //---get the SMS message passed in--- Log.d("SmsListener", "new sms!!"); } } </code></pre> <p>And here is the minifest.xml</p> <pre><code> &lt;receiver android:name=".smstopc.SmsListener"&gt; &lt;intent-filter&gt; &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>This is the permission i have used. </p> <pre><code> &lt;uses-permission android:name="android.permission.RECEIVE_SMS"/&gt; </code></pre> <p>I have tried everything to solve this problem. Did i miss something to add in minifest? </p>
android
[4]
3,096,731
3,096,732
3d animation in android
<p>I am developing a android application which involves rotating the images in a horizontal way. Can anyone help me in this regard.</p> <p>Regards Tushar</p>
android
[4]
2,310,991
2,310,992
Why some class variables seem to act as static while others don't?
<p>Dictionaries and lists defined directly under the class definition act as static (e.g. <a href="http://stackoverflow.com/questions/3045246/python-and-object-class-attrs-whats-going-on">this question</a>)<br> How come other variables such as integer do not?</p> <pre><code>&gt;&gt;&gt; class Foo(): bar=1 &gt;&gt;&gt; a=Foo() &gt;&gt;&gt; b=Foo() &gt;&gt;&gt; a.bar=4 &gt;&gt;&gt; b.bar 1 &gt;&gt;&gt; class Foo(): bar={} &gt;&gt;&gt; a=Foo() &gt;&gt;&gt; b=Foo() &gt;&gt;&gt; a.bar[7]=8 &gt;&gt;&gt; b.bar {7: 8} </code></pre>
python
[7]
1,371,682
1,371,683
Best Practices for controlling access to form fields
<p>I have a classic 3-tier ASP.Net 3.5 web application with forms that display business objects and allow them to be edited. Controls on the form correspond to a property of the underlying business object. The user will have read/write, readonly, or no access to the various controls depending on his/her role. Very conventional stuff.</p> <p>My question is: what is the object-oriented best practice for coding this? Is there anything more elegant than wrapping each control in a test for the user's role and setting its Visible and Enabled properties?</p> <p>Thanks</p>
asp.net
[9]
5,222,410
5,222,411
Put external library to the JAR?
<p>I have added some external libraries to my java project (in netbeans).<br> Is it possible to put the external jar library to the java archive (and not to put them into a separate (for example) "lib" directory)?</p>
java
[1]
5,367,905
5,367,906
C# error "String was not recognized as a valid DateTime"
<p>I am trying to save the DateTime.Now in the format "yyyyMMdd"</p> <p><strong>I have this code</strong></p> <pre><code>string todaysDate = DateTime.Now.ToString(); </code></pre> <p>...</p> <pre><code>U_Date_of_PD_added = GetDateFromString(todaysDate) </code></pre> <p>// U_Date_of_PD_added is a datetime Database field</p> <p>...</p> <pre><code>//Method to get date from string private DateTime GetDateFromString(string dateString) { string format = "yyyyMMdd"; return DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture); } </code></pre> <p>I keep getting the error "String was not recognized as a valid DateTime." as it tries to parse. What could be wrong?</p> <p>I do not care if it saves the time, I would prefer 00:00:00.000</p>
c#
[0]
1,973,070
1,973,071
How to declare inline object with inline variables without a parent class
<p>I am trying to do something like:</p> <pre><code>Object [] x = new Object[2]; x[0]=new Object(){firstName="john";lastName="walter"}; x[1]=new Object(){brand="BMW"}; </code></pre> <p>I want to know if there is a way to achieve that in C#</p>
c#
[0]
167,512
167,513
Need to parse string to DateTime
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/13428149/parseexact-a-string-to-datetime-fails">ParseExact a string to DateTime fails</a> </p> </blockquote> <p>I need to parse </p> <blockquote> <p>Oct 19 13:55</p> </blockquote> <p>into a <code>DateTime</code> object.<br> Which culture would work for it ?</p>
c#
[0]
3,809,731
3,809,732
How to avoid scrolling to the top of the page when emptying window.location.hash
<p>Why does the following code make the scroll jump to the top of the page? </p> <pre><code>window.location.hash = '' </code></pre> <p>Is there a way to empty it without jumping to the top of the page?</p>
javascript
[3]
4,721,073
4,721,074
Variable name cannot be declared in this scope
<p>I think I have everything working so far. One error left if the local variable error for 'req' ... its already been declared above System.Net.WebRequest req = null; but i'm trying to clear it before using for WebRequest req = WebRequest.Create... do I not need to do that?</p> <pre><code>while (listId.Items.Count &gt; 0) { // making the first item as selected. listId.SelectedIndex = 0; foreach (object o in listProxy.Items) { string strProxy = o as string; WebProxy proxyObject = new WebProxy(strProxy, true); // insert listProxy proxy here WebRequest.DefaultWebProxy = proxyObject; string strURL = "http://www.zzzz.com"; // link from listId and insert here System.Net.WebRequest req = null; try { WebRequest req = WebRequest.Create(strURL + "/book.php?qid=" + listId.SelectedItem as string); req.Proxy = proxyObject; req.Method = "POST"; req.Timeout = 5000; } catch (Exception eq) { string sErr = "Cannot connect to " + strURL + " : " + eq.Message; MessageBox.Show(sErr, strURL, MessageBoxButtons.OK, MessageBoxIcon.Stop); } } // remove the selected item. listId.Items.RemoveAt(0); // refreshing the list. listId.Refresh(); } </code></pre>
c#
[0]
5,572,621
5,572,622
browse file in iphone
<p>I want user to select file from iphone and upload to a http server. Please help me how this can be done.</p> <p>Thanks......</p>
iphone
[8]
3,117,597
3,117,598
Iterate a list as pair (current, next) in Python
<p>I sometimes need to iterate a list in python looking at the "current" element and the "next" element. I have, till now, done so with code like:</p> <pre><code>for current, next in zip(the_list, the_list[1:]): # do something </code></pre> <p>This works and does what I expect -- just wondering if there's a more idiomatic or efficient way to do the same thing.</p>
python
[7]
4,143,938
4,143,939
How can I bind to multiple elements with the same name in jQuery?
<p>I have about 50 items on my screen. Each line is a form that contains one select box. Each select box has the same name, "permission_action"</p> <p>My code: </p> <pre><code>$("#permission_action").change(function() { $.ajax({ type: "PUT", url: this.form.action, data: "permission[action]=" + $("#permission_action").val() }); }); </code></pre> <p>only binds to the select box in the first form. I want to bind to <strong>all</strong> of the items.</p>
jquery
[5]
4,679,633
4,679,634
Using JQuery to get table values
<p>I have a html table with 4 tablecells: 1: Checkbox 2. label 3. textbox 4. label</p> <p>Once I click on the checkbox, a jquery function fires, but im trying to get the values next to the checkbox. I have tried below, but nothing works. I know I am close. Any help would be very much appreciated.</p> <pre><code>$(this).next() $(this).nextSibling $(this).nextSibling.childNodes[0] &lt;table id="MainContent_cockpitTable" style="width:80%;"&gt; &lt;tr&gt; &lt;td&gt; &lt;input id="MainContent_check_FLIGHT DECK1" type="checkbox" checked="checked"/&gt; &lt;/td&gt; &lt;td&gt;Pilot&lt;/td&gt; &lt;td&gt;&lt;input "type="text" value="86.2" maxlength="10" id="MainContent_input_FLIGHT DECK_weight1" /&gt; &lt;/td&gt; &lt;td&gt;&lt;span id="MainContent_input_FLIGHT DECK_arm1" style="display:inline-block;width:50px;"&gt;255.0&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
jquery
[5]
1,599,172
1,599,173
exiting from complete application
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4260409/how-i-can-close-exit-button-on-my-app">How i can close/exit button on my app?</a> </p> </blockquote> <p>Hi,sir I need code to exit from the android application directly</p>
android
[4]
623,250
623,251
Set a select option using variable in jQuery
<p>Im using jquery cookie plugin to set a cookie for my dropdown. This means when someone selects either Yes or No from the dropdown then the value writes to the cookie.</p> <p>This works, I can successfully console.log the cookie value too. But When I try to use the cookie to AUTO-SELECT the dropdown value it matches, it just sticks to 'no' all the time.</p> <p>am I missing something?</p> <p><strong>html</strong></p> <pre><code>&lt;select id="delete"&gt; &lt;option value="no"&gt;No&lt;/option&gt; &lt;option value="yes"&gt;Yes&lt;/option&gt; &lt;/select&gt; </code></pre> <p><strong>jquery</strong></p> <pre><code>$(document).ready(function(e) { var thiscookie = $.cookie('1C'); $('#delete').val(thiscookie); $('#delete').change(function(){ var choice = $(this).find("option:selected").val(); $.cookie('1C',choice); }); }); </code></pre> <p>Note: If I set the val of the selectbox in jquery to 'yes' it doesn't work either</p>
jquery
[5]
2,143,372
2,143,373
Regular Expression help or an alternative
<p>I have a file that looks like the following with lines of tags. I have:</p> <pre><code>Pattern.compile("&lt;(?:TIMEX TYPE|ENAMEX TYPE)=.+?&gt;(.+?)&lt;/(?:TIMEX|ENAMEX)&gt;"); </code></pre> <p>This gets the data I need if both tags are on one line. My problem is dealing with the following lines:</p> <pre><code>&lt;ENAMEX TYPE="CITED"&gt;1&lt;/ENAMEX&gt; </code></pre> <p>If there is a split in the middle of the tag it does not work correctly. So I am looking for help improving my regular expression, or an alternative that works with non standard xml tags.</p>
java
[1]
3,337,206
3,337,207
Using List<KeyValuePair> to store Keys and Values
<p>I'm still trying to understand <code>KeyValuePairs</code> but I believe this idea should work. In my code below it searchs through a large string and extracts 2 substrings. One substring (keep in mind the value between the quotes varies) is something like <code>Identity="EDN\username"</code> another substring is something like <code>FrameworkSiteID="Desoto"</code> So I was thinking about combining these strings together before I added them to the List but here is my problem.. The <strong>login</strong> string below is a Unique field of strings that I need to use in a SQL statement to select records in SQLServer and the <strong>framew</strong> strings are strings I need lined up with the login strings (and all the columns and rows of data coming from SQLServer) when I output this to a text file. Should I make the login strings KEYS and the framew strings VALUES? If so how do I do that?? Hope that makes sense. I can further explain if needs be</p> <pre><code>Regex reg = new Regex("Identity=\"[^\"]*\""); Regex reg1 = new Regex("FrameworkSiteID=\"[^\"]*\""); foreach (FileInfo file in Files) { string line = ""; using (StreamReader sr = new StreamReader(file.FullName)) { while (!String.IsNullOrEmpty(line = sr.ReadLine())) { if (line.ToUpper().Contains("IDENTITY=")) { string login = reg.Match(line).Groups[0].Value; string framew = reg1.Match(line).Groups[0].Value; //added IdentityLines.Add(new KeyValuePair&lt;string, string&gt;(file.Name, login + " " + framew)); //This is probably not what I need } else { IdentityLines.Add(new KeyValuePair&lt;string, string&gt;(file.Name, "NO LOGIN")); } } </code></pre>
c#
[0]
5,360,183
5,360,184
Scrolling Layouts with buttons!
<p>I am trying to make a scrollable layout that contains many relativelayouts and button. (See example below). But every time i make a scrollview it says a scroll view can on contain one child...</p> <p>EXAMPLE</p> <p>Scrollview </p> <pre><code>Relativelayouts1 Button1 Relativelayouts2 Button2 Relativelayouts3 Button3 Relativelayouts4 Button4 </code></pre> <p>Scrollview (END)</p>
android
[4]
5,895,865
5,895,866
What factors should be considered in picking an appropriate jQuery AJAX timeout length?
<p>I am developing a web application that will rely on a number of jQuery AJAX requests. In my developing environment, normally PHP will process and return the data in &lt;300ms.</p> <p>In the production environment on a typical and small web hosting setup, what factors should I consider in setting an appropriate timeout for async, jQuery GET requests so that the client can be kept informed?</p>
jquery
[5]
1,240,442
1,240,443
do some companies block client-side Javascript scripting on client-side browser?
<p>I'm aware users may turn support for Javascript on/off in their browsers. But, does anyone know if some corporations have the practice of locking down systems such that the user no longer has the ability to turn Javascript on/off?</p> <p>I'm considering building an enterprise web application that depends on Javascript scripting on the client side browser. Let's assume for the sake of discussion all users of this application are fine with enabling Javascript in their browsers as long as they are able to. Just wondering if I might possibly encounter situations where the user is not permitted to turn his/her browser's Javascript support on/off. </p> <p>If so, I wonder what other options are available to crunch numbers in the client's browser (and then the same question would apply). </p>
javascript
[3]
2,696,702
2,696,703
Class 'MCAPI' not found
<p>i am using Mialchimp module first time in drupal 7,i added the API key and MCPAI and Readme file under libraries/mailchimp but when i am going for add new list it shows Class 'MCAPI' not found in \sites\all\modules\mailchimp\includes\mailchimp.inc on line 3.</p> <p>Can anybody help me out from this problem.?</p>
android
[4]
4,608,232
4,608,233
Numeric operation using string
<p>I have following string.</p> <pre><code>$option = '+'; $value = '100'; </code></pre> <p>I want create new value using above parameters. </p> <p>ex:- <code>$newValue = 222 + 100;</code></p> <p>How can i do it using above parameters? as following</p> <pre><code>$newValue = 222 $option $value; </code></pre>
php
[2]
5,216,512
5,216,513
How to count children from different lists? [jQuery]
<p>I'm trying to count the number of child elements a certain category has.</p> <p>This is the situation:</p> <pre><code>&lt;ul id="select_cat"&gt; &lt;li id="_1"&gt;Category 1 (&lt;span&gt;#&lt;/span&gt;)&lt;/li&gt; &lt;li id="_2"&gt;Category 2 (&lt;span&gt;#&lt;/span&gt;)&lt;/li&gt; &lt;/ul&gt; &lt;ul id="cat_1&gt; &lt;li&gt;Link 1&lt;/li&gt; &lt;li&gt;Link 2&lt;/li&gt; &lt;li&gt;Link 3&lt;/li&gt; &lt;/ul&gt; &lt;ul id="cat_2"&gt; &lt;li&gt;Link 1&lt;/li&gt; &lt;li&gt;Link 2&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So I want to count the number of children a category has. In this example the first cardinal sign should be 3, and the second should be 2.</p> <p>How can I do this, using jQuery.</p> <p><a href="http://www.jopwijk.be/links" rel="nofollow">Check an example (not jQuery)</a> </p> <p>Thanks!</p>
jquery
[5]
942,810
942,811
Conditional configuration: How to detect if I'm local or online?
<p>I want to provide different configurations for local and offline. At the moment, every time I upload my stuff to the web server, I must make sure that I don't mess up with the different config files. One for local development, and one for online.</p> <p>I slightly remember a couple of years ago, a code snippet distinguished somehow automatically between online and local development.</p> <p>Is there a safe way to detect that?</p>
php
[2]
4,292,502
4,292,503
What do I need to fix to get this to print out a string of random characters?
<p>This is in Java as the tag implies. I can't figure out how to get it to print out the "key" string at the end of the code while keeping my variables the way they are. I've only really worked with static main, and I have no idea what that does for programs as I'm a total novice. Can someone point me in the right direction? I'd like to know what you all think!</p> <pre><code>import java.util.Random; class Key { private String key = new String(); private void main(String[] args) { Random r = new Random(); for (int i = 10; i &gt; 0; i--) { int randomNumber = r.nextInt(10) + 48; int randomLetter = r.nextInt(26) + 97; int branchSwitch = r.nextInt(2); if (branchSwitch == 1) { // System.out.print((char)randomNumber); key = key + (char) randomNumber; } else key = key + (char) randomLetter; // System.out.print((char)randomLetter); } System.out.print(key); } } </code></pre>
java
[1]
629,162
629,163
How to change two or more Div Styles in Javascript
<p>Is there a way to change two or more Div styles with a single javascript line?</p> <pre><code>document.getElementById("searchScroll").style.position="fixed"; document.getElementById("searchScroll").style.margin="-50px"; </code></pre> <p>Is it possible to merge the code in ONE line?</p>
javascript
[3]
2,877,249
2,877,250
Nothing happens using polyBezier function
<p>There is a code: </p> <pre><code>CPoint Pt[5] = { CPoint(20, 50), CPoint(20, 30), CPoint(40, 20), CPoint(80,40), CPoint(50,110) }; pDC-&gt;PolyBezier(Pt,5); </code></pre> <p>When i run my project, nothing from Bezier Curve, blank workspace.. </p> <p>Can you help me with that?</p>
c++
[6]
3,003,079
3,003,080
for loop does not execute twice
<pre><code> createModelView: function (obj,vitalslength,headerValue) { for(i = 0, vitalsLen = vitalslength; i &lt; vitalsLen; i++) { // Do some logic } } </code></pre> <p>Two Questions</p> <ol> <li><p>Where should i place my return statement for the function. If i place inside the for loop will it work. </p></li> <li><p>When i call this function <code>Obj.createModelView(arguments);</code> Why does it not execute twice or n number of times depending upon the vitalsLength. <code>It only executes once.</code></p></li> </ol>
javascript
[3]
2,748,790
2,748,791
Need help with this .get() script
<p>I am fetching value using jQuery .get() like this</p> <pre><code> $.get('clientarea.php', function(data) { var Val = $('#abc', data).val(); if (this.val() == 'YES') { // do this } else { // do that } }); </code></pre> <p>Using .get() I want to compare value of <code>#abc</code> [whether 'YES' or 'NO'] &amp; then use conditional command to define further action.</p> <p>But I am doing something wrong with above script. can anybody correct me.</p> <p><strong>Thanks</strong></p>
jquery
[5]
4,310,065
4,310,066
jQuery - Select empty input with class name
<p>How to select empty all 'input type="text"' elements with class name 'myTextbox"</p> <p>example below only selects empty fields</p> <p>var emptyfields = $("input[value=]");</p>
jquery
[5]
3,969,812
3,969,813
iPhone: Method overriding result
<p>I have method overriding like below. Please ignore the way i written it may not be perfectly written, just for sample. But i want to know what would the output if i method overridden like this for variable "a".</p> <p>-> base class</p> <pre><code>@interface A { int a=15; } -(int) myFunction; @end </code></pre> <p>-> derived class</p> <pre><code>@interface B : A { int a=10; } -(int) myFunction; @end </code></pre> <p>Lets image "myFunction" returns "a". Since, it does method overriding, when i call like, </p> <pre><code>B bObj; bObj.a = ? </code></pre> <p>What should be the output 10 or 15 ?</p>
iphone
[8]
562,826
562,827
JavaScript column sorting
<p>What is the best way of sorting if the column values are:</p> <p>Before SORTING:</p> <pre><code>CANCELLED, v06.*, INDEPENDENT, v06.00, v06.00.01, v06.01, v06.02, v06.00.xx, v06.03, v06.04, ON HOLD, v06.06, v06.05, v06.05.01, v06.04.01, v06.05.02, v06.07, v07.00, </code></pre> <p>After SORTING:</p> <pre><code> CANCELLED, INDEPENDENT, ON HOLD, v06.*, v06.00, v06.00.01, v06.00.xx, v06.01, v06.02, v06.03, v06.04, v06.04.01, v06.05, v06.05.01, v06.05.02, v06.06, v06.07, v07.00 </code></pre> <p>Thanks in advance, Joseph</p>
javascript
[3]
3,840,737
3,840,738
User Control hide other HTML under declaration
<p>I have user contol under my project with next valid HTML code inside</p> <pre><code>&lt;div class="myClass"&gt; &lt;div&gt;text bla bla&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I have CSS for myClass</p> <pre><code>.myClass { display:none; } </code></pre> <p>on aspx page I have next code</p> <pre><code>//my control &lt;uc:Spinner ID="Spinner1" runat="server" MinValue=0 MaxValue=10 /&gt; //other HTML page &lt;div&gt; .... &lt;/div&gt; </code></pre> <p>but when i load this page I expect to have visible all HTML code except html inside of "Spinner1" but all page data is hidden. If I wrap contol to div tag like </p> <pre><code>&lt;div&gt; &lt;uc:Spinner ID="Spinner1" runat="server" MinValue=0 MaxValue=10 /&gt; &lt;/div&gt; </code></pre> <p>everything work fine.</p> <p>Why does it happening ?</p>
asp.net
[9]
242,739
242,740
JavaScript - Find out how many times a number goes into another number evenly
<p>Is there a simple way to find how many times a number goes into another number evenly in JavaScript?</p> <p>Say 11 divided by 4 --- I know 4 goes into 11 2 times evenly</p> <p>I have this code but I thought there was a simpler way that I maybe forgetting?</p> <pre><code>&lt;script&gt; a = 11; b = 4; i = a % b; i2 = a - i; solution = i2 / b; document.write(solution); // 2 &lt;/script&gt; </code></pre>
javascript
[3]
3,367,191
3,367,192
c++ Input from text file help
<p>My test file has data like this:</p> <pre><code>1 2 3 0 1, 2 3, 4 0, 0 4, 3 2, 1 0, 0 </code></pre> <p>How would I separate the data by line but also separate each section of data by the zeros.</p> <pre><code> ifstream data("testData.txt"); string line, a, b; while(getline(data,line)) { stringstream str(line); istringstream ins; ins.str(line); ins &gt;&gt; a &gt;&gt; b; hold.push_back(a); hold.push_back(b); } </code></pre> <p>How do I separate them by the zeros?</p>
c++
[6]
4,305,855
4,305,856
Twitter integration in iphone
<p>Ha ii ,i know how to integrate a Twitter in ios sdk,i alredy done with the help of MGTwitter Engine.But my problem is it shows a login page as a webview,i want to be login screen as popup just like the facebook login popup,so i got a <a href="http://github.com/digdog/DDSocialDialog" rel="nofollow">link</a>,that contains costomized popup for twitter,but how can i authenticate our twitter username and password in this costomized from.is there any other way to costomize our twitter logijn form?.please help me. Thanks in advance.</p>
iphone
[8]
90,312
90,313
Why aren't Python dicts unified?
<p>After reading <a href="http://stackoverflow.com/questions/6602172/how-to-group-a-list-of-tuples-objects-by-similar-index-attribute-in-python">this question</a>, I noticed that S. Lott might have liked to use an “ordered defaultdict”, but it doesn't exist. Now, I wonder: Why do we have so many dict classes in Python?</p> <ul> <li>dict</li> <li>blist.sorteddict</li> <li>collections.OrderedDict</li> <li>collections.defaultdict</li> <li>weakref.WeakKeyDictionary</li> <li>weakref.WeakValueDictionary</li> <li>others?</li> </ul> <p>Why not have something like this,</p> <pre><code>dict(initializer=[], sorted=False, ordered=False, default=None, weak_keys=False, weak_values=False) </code></pre> <p>that unifies everything, and provides every useful combination?</p>
python
[7]
2,117,272
2,117,273
Java 2D array error
<p>So I need to take a 2D array do calculations to each elements and transfer that into another 2D array while using the values to the "left" "right" "up" and "down" of the current element. If the current element is on the edge (x = 0, y = 0, x = array.length , y = array.length) I will get an array out of bounds error. I want to create a for loop that deals with each of those cases but I don't know how to do it. A sample of my code is</p> <pre><code>private void buildE(int[][] array, int y, int x) { int up = array[y - 1][x]; int down = array[y + 1][x]; int left = array[y][x - 1]; int right = array[y][x + 1]; if(up == 0){ buildETopRow(array); } </code></pre> <p>E will be my new array. This method does not work because y does not equal 0, it just doesn't exist but I can't set ints to null either. In the case of an out of bounds error I need the element (up, down, left, or right) that is out of bounds to equal the current element. Is there a way I can still use a for loop for this or do I need to do something else?</p>
java
[1]
2,015,852
2,015,853
jQuery get image alt inside href multiple image in array .children() not working
<p>I do extend the code the jquery lightbox plugins to meet my requirements for to able to get the image alt inside the an anchor tags then show it inside paragrap tags</p> <p>here with my code that I can't get work </p> <p>online 76 jQuery Light box</p> <pre><code> if ( jQueryMatchedObj.length == 1 ) { settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title'),objClicked.children('img[alt]'))); } else { // Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references for ( var i = 0; i &lt; jQueryMatchedObj.length; i++ ) { settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title'),jQueryMatchedObj[i].children('img[alt]'))); } } while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) { settings.activeImage++; } </code></pre> <p>on line 244</p> <p>I add another line which has </p> <p>$('#lightbox-image-description').html(settings.imageArray[settings.activeImage][2]).show();</p> <p>so if code will be success it will show the image alt on p tag with id #lightbox-image-description</p> <p>But the problem is I cant get it work the code on the loop part on which getting the anchor tags image alt, when I click image it goes to image link </p>
jquery
[5]
5,583,192
5,583,193
dealing with javascript enclosed in a php string
<p>so in such situation you lose the javascript highlight syntax, to me it looks like there are some cases were youre obliged to put the Js in a php string (for example when working on some ajax stuff and php mysql request), how you do? i found very annoying to work js this way</p> <pre><code>echo '&lt;script&gt; $(function(){ $("select#discipline_").change(function(){ var selected = $("select#discipline_ option:selected"); $.ajax({ url: "valider.php?discipline_val="+selected.val()+"&amp;action=specialite", success: function(response){ $("span#specialite").html(response) if( selected.val()=="0" ){ $("select#specialite_").hide() $("span#add").hide() } else{ $("select#specialite_").css({width:"0px"}).animate({width:"204px"}, 300).fadeIn() $("#add").show() } } } ) } ) })&lt;/script&gt;'; </code></pre>
php
[2]
5,466,993
5,466,994
How can I detect shift + key down in javascript?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6178431/how-to-catch-enter-keypress-on-textarea-but-not-shiftenter">How to catch enter keypress on textarea but not shift+enter?</a> </p> </blockquote> <p>How can I detect shift + key down in JavaScript?</p>
javascript
[3]