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,639,994 | 3,639,995 | java: save and retrieve objects as objects rather than text information? | <p>I have a program that actually stores inputted data into an array. These data will then be displayed through a text file from the array. I was asked to modify these program so that it is saving and retrieving objects as objects rather than a text information and i don't really know how to do that.. Need some advice thanks.</p>
| java | [1] |
5,995,047 | 5,995,048 | Show winning success rate based on wins/loses count | <p>I want to show the winning success rate between wins and loses I had a go with this</p>
<pre><code>$percent = ($row['wins'] - $row['loses'] / (($row['wins'] + $row['loses']/2))* 100);
</code></pre>
<p>based on <a href="http://www.calculatorsoup.com/calculators/algebra/percentagedifference.php" rel="nofollow">calculatorsoup.com</a> % difference calculator formula </p>
<blockquote>
<p>Calculate percentage difference between V1 = 15 and V2 = 6</p>
<p>( | V1 - V2 | / ((V1 + V2)/2) ) * 100</p>
<p>= ( | 15 - 6 | / ((15 + 6)/2) ) * 100</p>
<p>= ( | 9 | / (21/2) ) * 100</p>
<p>= ( 9 / 10.5 ) * 100</p>
<p>= 0.857143 * 100</p>
<p>= 85.7143% difference</p>
</blockquote>
<p>but I think I'm going about it the completely wrong way, my goal is so output would be something like:</p>
<blockquote>
<p>user bob has a success rate of: 17% </p>
</blockquote>
| php | [2] |
4,587,173 | 4,587,174 | How to determine when the text of an html element is changed | <p>I have an error message like this:</p>
<pre><code><span class="errorMessage">Your input sucks!</span>
</code></pre>
<p>and I need to determine when it changes. the validation framework I'm using sets the text when there's an error and removes it when it's complete. I'm hoping to tap into that by watching for changes to the text property of the element using jquery. Any idea of how to go about doing this?</p>
<p>Thanks!</p>
| jquery | [5] |
1,876,853 | 1,876,854 | How to set the value for an HTML element from external javascript | <p>I'm using an external javascript file (eg:<code>myjs.js</code>) with function <code>setval()</code> to set the <code>innerText</code> property of a HTML lable.</p>
<p>I have PHP page with <code><lable id="abc"></lable></code> and I have included <code>myjs.js</code> in <code><head></code> section. <code>myjs.js</code> is included in <code><head></code> section of one more PHP file and I'm calling <code>setval()</code> from this file, so when it runs it must set the <code>innerText</code> of lable in the first PHP file.</p>
<p>Is it possible to achieve? Any suggestions are greatly appreciated.
I hope I made question clear.</p>
<p>Thanks</p>
| javascript | [3] |
830,834 | 830,835 | Android.mk read values from BoardConfig.mk | <p>I am tweaking ClockworkMod and I need to read a custom recovery_ui.c
In my device's BoardConfig.mk I have set:</p>
<pre><code>BOARD_USES_CUSTOM_RECOVERY_UI := true
BOARD_CUSTOM_RECOVERY_UI := device/hp/tenderloin/recovery_ui.c
</code></pre>
<p>In bootable/recovery/Android.mk I have added</p>
<pre><code>ifeq ($(BOARD_USES_CUSTOM_RECOVERY_UI),true)
LOCAL_SRC_FILES += $(BOARD_CUSTOM_RECOVERY_UI)
else
LOCAL_SRC_FILES += default_recovery_ui.c
endif
</code></pre>
<p>But when I make recovery I am still using default_recovery_ui.c. Can this file not read the values from BoardConfig?</p>
| android | [4] |
80,833 | 80,834 | Android - getSystemService error? | <p>I have followed this tutorial to get my ListView populating data -- <a href="http://android.amberfog.com/?p=296" rel="nofollow">http://android.amberfog.com/?p=296</a>. </p>
<p>But it only works if I subclass my custom list adapter (MyCustomAdapter) like the tutorial does. However I would like to put this in a separate class but when I try to I end up getting an error on this line below saying that "The method getSystemService(String) is undefined for the type
MyCustomAdapter</p>
<pre><code> public MyCustomAdapter() {
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
</code></pre>
<p>Any ideas how I can get this working in its own class? Any help appreciated.</p>
| android | [4] |
1,155,592 | 1,155,593 | How to program a double tap action in Android? | <p>View_B is implemented to listen double tap action. In View_A, I need to send a double tap action to View_B. </p>
<p>How to send a double tap action by code ??</p>
<p>Thanks.</p>
| android | [4] |
4,271,659 | 4,271,660 | Logging and Storing Values in XML or SQL CE? | <p>i have an C# application that is writing status information from a PLC device, the program accepts parameters stored in an XML file with a config editor to edit these parameters, the program checks the Memory address of the PLC using the config file to tell the program the address name and datatype etc. if the value changes from previous value then we write the status along with fields from the config to a Log.XML, after testing, this didn't seem like the best approach as the file was getting large and using lots of cpu to open the Log to check existing value then log new value if changed. the question is what is the best approach for storing config data and log data, the log data is getting written to very frequently, I'm wondering if SQL CE is better performance, if so shall i store config data in SQL as well?</p>
| c# | [0] |
4,420,621 | 4,420,622 | Why is MaybeChannelBound callable? | <p>The Queue class in the python kombu library inherits from MaybeChannelBound, which in turn implements the <strong>call</strong> method (making it callable). The <strong>call</strong>() method itself is a thin wrapper around the bind() method.</p>
<p>It is not clear why this was done, as calling the bind() method seems (to my simple mind, at least) to be clearer and more descriptive of the intent of the function.</p>
<p>Why would somebody use the <strong>call</strong>() method in a situation like this?</p>
| python | [7] |
667,187 | 667,188 | Call a third party app from another app | <p>Is it possible to launch any iPhone/iPad application from within another app?
For example in my application if I want the user to read a document say a pdf file from any of the installed apps on iphone or an ipad say PDFReaderLite.
How can i launch this app from my app.</p>
<p>How can we know which all installed apps support reading of documents and show a list to open with any of these apps from my app?</p>
<p>How do we get the URL Schemes for the installed apps?</p>
| iphone | [8] |
1,714,227 | 1,714,228 | Adding methods to native JavaScript objects | <p>Adding methods to native JavaScript objects like Object, Function, Array, String, etc considered as bad practice. </p>
<p>But I could not understand why? </p>
<p>Can some body shed light on this? </p>
<p>Thanks in advance.</p>
| javascript | [3] |
3,799,676 | 3,799,677 | what is message box in asp.net | <p>what in asp.net similar to message box </p>
<pre><code>if (s != "null")
MessageBox.Show("your in ");
else
MessageBox.Show("wrong user ");
</code></pre>
<p>i want to replace message box here in c# code </p>
| asp.net | [9] |
4,585,936 | 4,585,937 | Calling a function from a string with the function's name in Python | <p>What is the best way to go about calling a function given a string with the function's name in a Python program. For example, let's say that I have a module <code>foo</code>, and I have a string whose contents are <code>"bar"</code>. What is the best way to go about calling <code>foo.bar()</code>?</p>
<p>I need to get the return value of the function, which is why I don't just use <code>eval</code>. I figured out how to do it by using <code>eval</code> to define a temp function that returns the result of that function call, but I'm hoping that there is a more elegant way to do this.</p>
| python | [7] |
283,993 | 283,994 | jQuery add class for certain time | <p>How I can add a css class to an element for only 10 seconds ?</p>
| jquery | [5] |
2,336,472 | 2,336,473 | How to store one string and arrayvalue in sharedpreference? | <p>I have array values of up[]={0,0,0,0,0} and view="adult" thesetwo value i want to store and retrieve in from sharedpreference how to do that...</p>
| android | [4] |
4,169,091 | 4,169,092 | diference between return , echo and print keyword in PHP | <p>What is the difference between these three?</p>
<p>return , echo and print keyword in PHP</p>
<pre><code>function theBand($abc,$bac) {
return $abc;
echo $abc;
}
</code></pre>
<p>Both does the same, it does show or return me the value holding in the variable abc. Now return exists the function and echo continues. Apart from this is there anything specific on return keyword.</p>
| php | [2] |
3,542,470 | 3,542,471 | Python while loop/range | <p>I need to ask a number from the user and have then if it is in the range of the low/high number then it returns the number and if it isnt in the range, it loops until the number entered is in the range. I don't really know how exactly to do this but I think I have part of it right. My main concern is the line "while question != low <= question <= high:" I feel as if there is a problem with that line.</p>
<pre><code>def ask_number(question, low, high):
question = int(raw_input("Enter a number within the range: "))
question = ""
while question != low <= question <= high:
question = int(raw_input("Enter a number within the range: "))
</code></pre>
| python | [7] |
4,848,800 | 4,848,801 | How to work with initialize.php? | <p>I want to learn and work with <strong>initialize.php</strong> so I try to build simple php file like <strong>index.php</strong> and just to see if it call to <strong>hello.php</strong> I got some truble on my local host using windows xp.</p>
<p>the details are:</p>
<p><strong>http://127.0.0.1/www/oop/shape2/index.php</strong>
the file <strong>index.php</strong></p>
<pre><code><?php
defined('DS') ? null : define('DS', '/');
defined('SITE_ROOT') ? null :defined('SITE_ROOT', $_SERVER['DOCUMENT_ROOT']);
defined('LIB_PATH') ? null : define('LIB_PATH', SITE_ROOT.DS.'includes');
echo (LIB_PATH.DS.'hello.php');
require_once(LIB_PATH.DS.'hello.php');
?>
</code></pre>
<p><strong>the output is:</strong></p>
<pre><code>SITE_ROOT/includes/hello.php
</code></pre>
<p><strong>http://127.0.0.1/www/oop/shape2/includes/hello.php</strong>
the file <strong>hello.php</strong></p>
<pre><code><?php
echo ('hi');
?>
</code></pre>
<p>if i run it I got <code>hi</code></p>
<p>here is my local folder on windows:
<strong>C:\Program Files\Zend\Apache2\htdocs\www\oop\shape2</strong></p>
<p>what shell I do slove the problem.
Thx</p>
| php | [2] |
5,976,548 | 5,976,549 | Does BroadcastReceiver.onReceive always run in the UI thread? | <p>in my App, I create a custom <code>BroadcastReceiver</code> and register it to my Context manually via <code>Context.registerReceiver</code>. I also have an <code>AsyncTask</code> that dispatches notifier-Intents via <code>Context.sendBroadcast</code>. The intents are sent from a non-UI worker thread, but it seems that <code>BroadcastReceiver.onReceive</code> (which receives said Intents) always runs in the UI thread (which is good for me). Is this guaranteed or should I not rely on that?</p>
| android | [4] |
5,175,163 | 5,175,164 | Can bit-fields be used as a «poor man's» fast integer type? | <p>I've just noticed an interesting property of gcc with regard to bit-fields. If I create a <code>struct</code> like the following:</p>
<pre><code>template <int N>
struct C
{
unsigned long long data : N;
};
</code></pre>
<p>Then on amd64:</p>
<ol>
<li>with <em>-m64</em>, for N ∊ <1, 64>, <code>sizeof(C) == 8</code>;</li>
<li>with <em>-m32</em>, for N ∊ <1, 32>, <code>sizeof(C) == 4</code> and for N ∊ <33, 64>, <code>sizeof(C) == 8</code>.</li>
</ol>
<p>(with <code>sizeof(unsigned long long) == 8</code>).</p>
<p>That seems to <em>mostly</em> resemble the C99/C++11 <code>uint_fastXX_t</code> except for the fact that on my system <code>sizeof(uint_fast8_t) == 1</code>. But for example, I can't reproduce anything similar with <code>__int128</code> (which always results in <code>sizeof(C) == 16</code>).</p>
<p>Does it seem like a good idea to you to use the fore-mentioned <code>struct</code> as a «poor man's» replacement for <code>uint_fastXX_t</code> <em>in C++98</em>?</p>
| c++ | [6] |
5,947,831 | 5,947,832 | How do specify which EditText should get focus on Activity starts and auto bring up keyboard? | <p>I want to immediately highlight give focus to a particular edit box when the activity loads and bring up the softkeyboard. how can I do this? Also should there be anything in onStart()?</p>
| android | [4] |
3,651,983 | 3,651,984 | How to keep session alive for 1week without logout PHP, overwriting default server values? | <p>How to keep session alive for 1week without logout PHP, overwriting default server values?</p>
<p>I need to do this in the PHP code.</p>
| php | [2] |
5,586,941 | 5,586,942 | Choose multiple random integers with input | <p>I've been trying to solve this problem. I would like to input a number between 1 and 5. So for example if I choose to input number 3, I want to then randomly choose 3 numbers from a category of numbers between 1 and 10.</p>
| python | [7] |
2,322,286 | 2,322,287 | The type `T' must be convertible in order to use it as parameter `T' in the generic type or method | <p>I have these two main classes. First the FSMSystem class:</p>
<pre><code>public class FSMSystem<T> : MonoBehaviour where T : FSMSystem<T>
{
private T m_Owner = default(T);
protected FSMState<T> currentState;
private Dictionary<int, FSMState<T>> m_states;
public FSMSystem(T owner)
{
m_Owner = GameObject.FindObjectOfType(typeof(T)) as T; //owner;
m_states = new Dictionary<int, FSMState<T>>();
}
protected void AddState( FSMState<T> state )
{
m_states.Add( state.GetStateID(), state );
}
}
</code></pre>
<p>And the second class, FSMState:</p>
<pre><code>public abstract class FSMState<T>
{
public abstract int GetStateID();
public abstract void OnEnter (FSMSystem<T> fsm, FSMState<T> prevState);
public abstract void OnUpdate (FSMSystem<T> fsm);
public abstract void OnExit (FSMSystem<T> fsm, FSMState<T> nextState);
}
</code></pre>
<p>It leads to the following error:</p>
<blockquote>
<p>error CS0309: The type '<code>T</code>' must be convertible to '<code>FSMSystem<T></code>' in
order to use it as parameter '<code>T</code>' in the generic type or method
'<code>FSMSystem<T></code>'</p>
</blockquote>
<p>Can someone tell me how to resolve this? I see many other posts similar to this one but I'm not seeing the relationship.</p>
| c# | [0] |
1,886,244 | 1,886,245 | Network manager with NSURLConnection | <p>I am trying to create something like a Network Manager using NSUrlConnections.
For that, I want to be able to send multiple requests, but I also want to be able to identify the client(delegate) that made the request when the response arrives.
I have created a NSDictionary like this:</p>
<pre><code>NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:SERVER_TIMEOUT];
....
[clients setObject:client forKey:connection];
</code></pre>
<p>in "- (void)connectionDidFinishLoading:(NSURLConnection *)connection" I have something like this:</p>
<pre><code>client = (id<RTANetworkDelegate>)[clients objectForKey:connection];
[clients removeObjectForKey:connection];
</code></pre>
<p>The Network Manager is the delegate for all the connections, I do some preprocessing and then I send the (parsed) response to the right delegate, that sent the request in the first place.</p>
<p>Unfortunately, it appears that a NSMutableURLRequest cannot be set as a key in a dictionary since it does not have the copyWithZone method and I get the error:</p>
<blockquote>
<p>-[NSURLConnection copyWithZone:]:
unrecognized selector sent to
instance</p>
</blockquote>
<p>Any help would be much appreciated!
Thanks!</p>
<p>=======================================</p>
<p>[Edit] I already found this in the meantime:</p>
<p><a href="http://blog.emmerinc.be/index.php/2009/03/15/multiple-async-nsurlconnections-example/" rel="nofollow">http://blog.emmerinc.be/index.php/2009/03/15/multiple-async-nsurlconnections-example/</a></p>
<p>It seems to solve my problem.. I still don't know if it's the best solution though. I thought I would post it here since it might help others too.</p>
| iphone | [8] |
3,077,798 | 3,077,799 | When call by value is used, actual parameter values are pushed into the stack. What about call by reference? | <p>When call by value is used, actual parameter values are pushed into the stack. What about call by reference? What is pushed onto the call stack?</p>
<p>EDIT:</p>
<p>Nice to know that java does not use call by reference, ever. How about in C++. I changed the tag to c++ from java. Sorry for the confusion.</p>
| c++ | [6] |
600,265 | 600,266 | Get Text and post to an included file | <p>What I'm trying to do:</p>
<p>I have two files: One is the <strong>header.php</strong> which is included (<em>by php include</em>) into my second file <strong>content.php</strong></p>
<blockquote>
<p><em>I am going to be use my <strong>header.php</strong> with many different 'content' files, just so you know</em></p>
</blockquote>
<p>Now, I have a <em>div</em> that is going to display a title text provided by <strong>content.php</strong> and any other pages that includes the <strong>header.php</strong>: <code><div class="title"> </div></code> This <em>div</em> is <strong>only</strong> in the <strong>header.php</strong>.</p>
<p>My problem is that I do not know how to include a text into the <strong>header.php div area</strong> <code><div class="title"> </div></code> from my <strong>content.php</strong> which again includes the <strong>header.php</strong>. </p>
<ol>
<li><strong>Header.php</strong> (contains the <code><div class="title"></div></code>)</li>
<li><strong>Content.php</strong> (needs to have the title text and be included into the <strong>header.php</strong> <code><div class="title"> <div></code> area)</li>
</ol>
<p>My question is: <strong>How in heck can I do this with php?</strong></p>
<p>And I am not very knowledgeable about php or any type of coding for that matter. I have just been winging it, now I'm rather stuck. So If anyone could possibly explain how to do this in a simplified way, I would really appreciate it.</p>
| php | [2] |
3,223,990 | 3,223,991 | storing the value of dynamically created textbox in session | <p>I have done a project in ASP.Net that asks to input a number in textbox. After typing a number in it and click a button it generates the number of textbox according to the value given in the textbox. Like if I type 5 in the textbox it dynamically generates 5 textboxes below. </p>
<p>I want all the value of dynamically created textbox(more than one textbox) to be stored in session and pass to next page through session after clicking another button. But i could not do that. </p>
<p>How can i solve this problem.
Anyone can help me.</p>
<p>Thanks</p>
| asp.net | [9] |
4,360,378 | 4,360,379 | Canvas clears when resizing window | <p>I am trying to make a paint program and I have this problem with my canvas, it clears every time I resize or maximize the window containing it. I really have no ideea where is the problem, the paint() and repaint() methods are not overriden in the canvas class, and I don't use any addapter for resizing the window. Any help would be much appreciated.</p>
<p>Here's the code:</p>
<pre><code>public class Plansa extends Canvas{
Image image;
Pencil pencil;
public Plansa(){
this.setSize(800, 600);
this.setBackground(Color.white);
pencil = new Pencil(this);
addMouseListener(pencil);
addMouseMotionListener(pencil);
}
public Plansa(int width, int height){
this.setBounds(0, 0, width, height);
this.setBackground(Color.white);
pencil = new Pencil(this);
addMouseListener(pencil);
addMouseMotionListener(pencil);
}
public Plansa(Image imag) {
this.setBackground(Color.white);
this.setSize(imag.getWidth(this), imag.getHeight(this));
image = imag;
this.image = imag;
this.repaint();
pencil = new Pencil(this);
addMouseListener(pencil);
addMouseMotionListener(pencil);
}
public Dimension getPreferredSize() {
if(image==null)
return new Dimension( 800, 600 );
int w = image.getWidth( this );
int h = image.getHeight( this );
return new Dimension( w, h );
}
}
public class Fereastra extends JFrame{
private Plansa plansa;
public Fereastra () {
super( "***Painter***" ) ;
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
int x = (int) ((dimension.getWidth() - this.getWidth())/2);
int y = (int) ((dimension.getHeight() - this.getHeight())/2);
this.setLocation(0, 0);
this.setSize(dimension);
plansa = new Plansa(this.getWidth(), this.getHeight());
//...
setDefaultCloseOperation(EXIT_ON_CLOSE);
add (plansa, BorderLayout.CENTER ) ;
pack();
}
}
</code></pre>
| java | [1] |
3,001,742 | 3,001,743 | concat function in javascript? | <p>i want to pick highest value from an array so i use math.max function it is working well when i run this only with one array but as i have two different array to first of all i want to join them together so i use concat function but it is not working. </p>
<pre><code><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
var maX=[6,1]
var miN=[10,20]
alert(Math.max.apply(maX.concat(miN))
</script>
</head>
<body>
</body>
</html>
</code></pre>
| javascript | [3] |
4,674,996 | 4,674,997 | Map's equals() for keys that are arrays | <p>I'm using a TreeMap (SortedMap) whose keys are Object[] with elements of varying types.</p>
<p>TreeMap's equals() doesn't work on Object[] like Arrays's equals() would do -- which means it won't work when using its methods like containsKey() and get() unless I workaround it.</p>
<p>Is there somewhere a solution for this that doesn't involve creating a whole new Class?</p>
<p><strong>EDIT :</strong></p>
<p><strong>Just to make it clear, I made a mistaken assumption. Creating a <code>new Comparator(){}</code> also does affect every method that uses equality, such as <code>equals()</code>, not only the tree sorter.</strong></p>
| java | [1] |
3,969,091 | 3,969,092 | Javascript - get the form if of current control location | <p>I have a form and it has 4 input elements. if the user enters just two entries and clicks anywhere on the screen (out the form)...i would like to save the details..it is like auto-save.</p>
<p>I have id of my form..i want to compare with form id of the current control on the screen..so that i can ssave the data if both form ids are different..</p>
<p>could you please tell me how can i get the form id of current control location on screen (some times the control could be outside the forms..in that case form id of current cotrol location would null)... but how can i determine that in javascript.</p>
<p>please suggest...</p>
<p>Many Thanks in advance,
Jack.</p>
| javascript | [3] |
4,626,979 | 4,626,980 | how to solve this exception Illegal character in path? | <p>i am displaying images from url using xml parsing,some images are displaying very well,some time i got exception like </p>
<pre><code>Illegal character in path at index 113: http://www.theblacksheeponline.com/party_img/thumbspps/12390867930_15951_186997180114_709920114_4296270_6115611_n[1].jpg
</code></pre>
<p>How can i solve this problem,anybody know,please give some sample code for me...</p>
<p>Thanks All</p>
| android | [4] |
5,558,141 | 5,558,142 | Android Email(exchage server) takes more time on SSL while account configuration | <p>I observed that Android Email application takes more time while configuring the account <strong>on SSL</strong>. On SSL it takes 10 seconds to get the response back of OPTIONS command. Once the account is configured everything works fine. Anyone have any idea??? Thanks in advance...</p>
| android | [4] |
5,573,824 | 5,573,825 | Internal Error in .NET Runtime? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4367664/application-crashes-with-internal-error-in-the-net-runtime">Application Crashes With “Internal Error In The .NET Runtime”</a> </p>
</blockquote>
<p>I have a Windows service that runs 24x7. On a regular interval the service will communicate with a SQL Server to process some data. On occasion, the SQL communication will time out. All the code that handles this is in a try/catch block. Yet, my service is still brought down. When I check the Event Log on the box running my service, I see the following error:</p>
<p><strong>"The process was terminated due to an internal error in the .NET Runtime at IP 66587CB5 (664E0000) with exit code 80131506".</strong></p>
<p>Is this really an error in the .NET framework bringing my service down, or is this in response to my SQL timeout error?</p>
<p>I'm using .NET 4.</p>
<p>Thanks very much.</p>
| c# | [0] |
1,656,919 | 1,656,920 | nivo slider pause on last slide | <p>Client has 5 sliders that will switch over at random times, but pause for two or three seconds when the last one has changed over. There are only 2 images per "slider"</p>
<p>I figured I would use nivo slider as it looked promising.</p>
<p>I have set up the different divs and sizing for each slider and got positioning right, but I'm not sure what i'm doing with the Jquery.</p>
<p>I've tried other effects that people have posted up on here, but no help.
one example...</p>
<pre><code>$(window).load(function(){
$('#slider').nivoSlider({
animSpeed: 500,
pauseTime: 4000,
effect : 'fade',
directionNav : false,
controlNav: false,
});
jQuery('#slider').data('nivoslider').stop();
setTimeout("jQuery(#slider').data('nivoslider').start()",5000);
});
</code></pre>
<p>This is how I'm thinking it should work.</p>
<p>slider1 - switch after .5 seconds (pause)
slider 4 - switch after .75 seconds (pause)
slider 3 - switch after 1 second (pause)
slider 2 - switch after 1.25 seconds (pause)
slider 5 - switch after 1.5 seconds (pause)
They all start random switch again after 2 or 3 second pause.</p>
<p>Sorry if this is long, hope somebody can help</p>
<p>Thanks</p>
<p>Vic</p>
| jquery | [5] |
4,176,474 | 4,176,475 | How to customize the JavaScript prompt? | <p>I am trying to use the JavaScript prompt for entering text that will be enclosed between tags e.g</p>
<p>[url]http://www.yahoo.com[/url]</p>
<p>The problem is that the prompt always appear in the top left corner of the browser.</p>
<p>How do I position such that it only display the prompt around the text area where the text will be entered?</p>
<p>And also how do I customize the JavaScript prompt so that it look more user friendly?</p>
| javascript | [3] |
1,577,526 | 1,577,527 | A smart way to implement the same functions | <p>I have a lot of views and have same function <code>postInvalidate()</code>.</p>
<pre><code>regenerate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
img01.postInvalidate();
img02.postInvalidate();
img03.postInvalidate();
img04.postInvalidate();
}
});
</code></pre>
<p>Is there a better way to do this? This looks stupid.</p>
| android | [4] |
5,225,971 | 5,225,972 | immediate children of a list | <p>Hey,
A quick question.. what's the JAVASCRIPT statement to get the immediate children of a LIST? I tried:</p>
<pre><code>document.getElementById(id).getElementsByTagName('li');
</code></pre>
<p>which gives me all of the child nodes.</p>
| javascript | [3] |
3,776,888 | 3,776,889 | jQuery Checkbox Error | <p>I am working on a jQuery-based todo list interface, and have hit a bit of a wall. The jQuery I am working with is a bit hacked together from various tutorials I have read, as I'm a bit of a beginner.</p>
<pre><code>$('#todo input:checkbox').click(function(){
var id = this.attr("value");
if(!$(this).is(":checked")) {
alert("Starting.");
$.ajax({
type: "GET",
url: "/todos/check/"+id,
success: function(){
alert("It worked.")
}
});
}
})
</code></pre>
<p>This is the HTML I am using,</p>
<pre><code><div id="todo">
<input type="checkbox" checked="yes" value="1"> Hello, world. <br />
</div>
</code></pre>
<p>Any help on this would be greatly appreciated. For reference, thereason I have alerts in the jQuery is for debugging. The reason I can tell the code isn't working is because I am not getting these alerts. Thanks.</p>
| jquery | [5] |
1,935,714 | 1,935,715 | Not relying on a number being stored at index. method help | <p>I've been asked to change the 'getlot' method in this class so that it doesn't rely on a lot with a particular number being stores at index [number -1] in the collection. e.g, if lot # 3 was deleted, then lot # 4 would have been changed from index 3 to 2. I've tried recoding but to no avail. Any help is appreciated. This is the method I code I've been trying to change. (lot is part of an array list) Thanks</p>
<pre><code> public Lot getLot(int lotNumber)
{
if((lotNumber >= 1) && (lotNumber < nextLotNumber)) {
Lot selectedLot = lots.get(lotNumber - 1);
if(selectedLot.getNumber() != lotNumber) {
System.out.println("Internal error: Lot number " +
selectedLot.getNumber() +
" was returned instead of " +
lotNumber);
selectedLot = null;
}
return selectedLot;
}
else {
System.out.println("Lot number: " + lotNumber +
" does not exist.");
return null;
</code></pre>
| java | [1] |
813,181 | 813,182 | Store real time data of Acceleration sensor in android & input it in Kalman code | <p>I have Kalman filter code correctly executing in Android . Kalman filter had a parameter XDD which stands for acceleration.
I have written android acceleration sensor code. </p>
<p>1) I want the android acceleration sensor real time data to be passed to the parameter XDD of kalman filter. How to do it. Please explain with small code</p>
<p>2) can anyone suggest me how to plot graph with this real time acceleration sensor data in android?? </p>
| android | [4] |
1,854,537 | 1,854,538 | how can i initialize a dynamically allocated array of characters so i don't get those weird characters? | <p>I want to use that array of characters in my game of "hangman" to view to tha user his current progress. </p>
<pre><code>#include <iostream>
#include "randword.h"
#include <fstream>
#include <time.h>
#include <cstdlib>
using namespace std;
int main()
{
InitDictionary();
string tixaio=Randomword();
int m = tixaio.length();
int guesses=8;
char *charptr= new char[m];
for(int aa=0;aa<m;aa++){
charptr[aa]='-';
}
cout << "The word now looks like this: "<<charptr;
}
</code></pre>
<p>As soon as i try to cout<< charptr my array i got the usual "---------" plus some weird characters. How can i prevent those characters from showing up??</p>
| c++ | [6] |
3,713,520 | 3,713,521 | How to divert the iPhone on Voice Mail programmatically? | <p>In my iPhone application I want to divert my phone on voice mail if any callers call me, which I have to do programmatically for my app. </p>
<p>Is it possible in iPhone? If so please guide me.</p>
<p>Thanks,<br>
Panache</p>
| iphone | [8] |
2,850,131 | 2,850,132 | Python - Program not displaying as intended | <pre><code>#Hex Check
def Check(HexInput):
while HexInput!= Valid:
print('That is an invalid hex number.')
else:
print('That is an valid hex number.')
return HexInput
HexInput=input('Enter a hex number: ')
Valid='1234567890ABCDEFG'
</code></pre>
<p>When run, it outputs nothing when a hex number is entered.
The program is aiming to process the users inputted Hex number and output whether it is a valid hex number or not.</p>
| python | [7] |
1,117,682 | 1,117,683 | jQuery load doesn't work as I expected | <pre><code>$(".content")
.load("content/intro.html #bt")
.hide()
.fadeIn(2000)
.delay(2000)
.fadeOut(2000)
.load("content/intro.html #ofm")
.fadeIn(2000)
.fadeOut(2000)
.load("content/main.html")
.fadeIn(800);
</code></pre>
<p>I would expect that jQuery first load content (<code>intro.html #bt</code> etc.) but it will actually load <code>main.html</code> and than will do everything other on the list. In this case three times fade in an out. What is workaround? </p>
| jquery | [5] |
4,654,024 | 4,654,025 | How to know the one selected row in the tabs containing the datagridview | <p>I have a project with a form with 3 tabs, each contains 1 datagridview. I disabled multiselect and can only select a row.</p>
<p>I need to Add new data rows or Modify rows of datas from these three datagrids, so I have a MenuStrip on top of the window with a menu with a "Add", "Modify" and "Delete Selected Row" options.</p>
<p>How do I know which row is currently being selected in the current selected tab containing the datagrid which contains that row? Because there are 3 tabs containing 3 datagrids. I don't want to get the output saying there are 3 datagridviews selected with whatever row was selecting. I want the one row on my screen.</p>
<p>Please ask me if my question isn't clear enough.</p>
| c# | [0] |
1,685,862 | 1,685,863 | How can i delete image file in SD cardafter email sent? | <p>I want to delete image file in SD card after sending email...anybody knows,please give sample code for me...</p>
<p>Thanks All</p>
| android | [4] |
2,018,117 | 2,018,118 | How to use javascript templating rather than raw HTML in javascript string? | <p>I am creating a web app that requires me to render new elements on the page many, many times. It is getting out of hand for me to add HTML by putting it into a Javascript string. Mostly because it's hard to edit it especially when it spans multiple ways. What's the best solution for this? And what's the best way to organize this stuff because I feel like I am going to have a huge page full of JS "subelements".</p>
| javascript | [3] |
1,943,306 | 1,943,307 | extending jquery on the main element object | <p>I've seen some jquery code where people extend the main object like:</p>
<pre><code> $('someId').myCustomObject();
</code></pre>
<p>Is this possible or am I mistaken? (if yes, how?)</p>
| jquery | [5] |
3,016,326 | 3,016,327 | I used heredoc syntax to cover my string. But It displays error. Below is my code: | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2305869/heredoc-interfering-with-code-indentation">HEREDOC interfering with code indentation</a> </p>
</blockquote>
<pre><code><?php
$my_string = <<<TO
Everything in this rather unnecessarily wordy
ramble of prose will be incorporated into the
string that we are building up inevitably,
inexorably, character by character, line by line,
until we reach that blessed //final line which is this one.
TO;
echo $my_string;
?>
</code></pre>
<p>it's error is:</p>
<pre><code>Parse error: syntax error, unexpected $end in C:\wamp\www\ITP - Teaching\PHP\Chapter VIII - String\Heredoc Syntax\index.php on line 19
</code></pre>
| php | [2] |
4,620,921 | 4,620,922 | Form Validation with Functions | <p>I purchased a template that included many files and one of them was for jquery form validation. </p>
<p>I'm using their template to create a register form. I also had created a validation code as well but what I would like to do is have my register form use the original validation code which is the script.js file. I would just need to figure out how I can use that script.js file with 6 different various forms like register, login, forgot password, etc. With just a little added code on each that's different like the success handler.</p>
<p>How can I do this?</p>
<p>Also included was the plugins.js file which includes how it can remove alert boxes which is nice not sure how I can use that fuction to remove the alert boxes on every form submission. How would I also with the form validation make it to where if an error message comes up for a specific input box and the focus is taken off of it then I want it to remove that error message.</p>
<p><a href="http://www.kansasoutlawwrestling.com/kowmanager/register" rel="nofollow">Register Form</a></p>
| jquery | [5] |
1,919,539 | 1,919,540 | Getting appropriate hash index C++ | <p>I've tried everything. Even java's forumla: </p>
<p>java.lang.String.hashCode():</p>
<pre><code>s[0]*(31^(n-1)) + s[1]*(31^(n-2)) + ... + s[n-1]
</code></pre>
<p>I've interpretted this as a sum:
Although I am not quite sure what to do with the s[n-1];</p>
<pre><code>int hashmap::hashstr( const char*const str )
{
int result = 0;
int i = 0;
int j = 0;
int k = 0;
unsigned n = 0;
for ( ; str[n] != NULL; ++n ); // how many characters?
while ( j != n ) // no more characters
{
result += str[i] * ( 31 ^ ( n - k ) );
j++;
i++;
k++;
}
return result % maxSize;
}
</code></pre>
<p>where maxSize is the 10th element in my fixed array size of 11.</p>
<p>What am i doing wrong? SOME of my hash indicies are coming out wrong. Others, correctly. Why is this? So far everyones been like, "Who cares how it works!! Use a template!" Well, I want to understand this.. </p>
| c++ | [6] |
3,265,473 | 3,265,474 | how to clear a graphic object without using clear() method in c#? | <p>is it possible to clear the graphic object without a clear method?</p>
| c# | [0] |
5,028,429 | 5,028,430 | what is the most proffessional way to make an android app | <p>I am creating an app (not a game), and I want to make it look professional. I have two options right now of how to make it. The first one, goes straight into my app and then has a menu when you hit the menu button on the phone. The second is, that when you open the app, it goes into a “main menu” like the kind that you would find in a game, where there are options such as “start”, “help”, “settings”, and “exit”. The first option seems more professional, but I am worried that it will cause the app to look like it has less “substance” to it. Which one should I choose? If I choose the first one, will it effect the amount of customers that will buy or return my app? Is there a third/better option for the UI of an app?</p>
| android | [4] |
2,261,514 | 2,261,515 | jQuery : mousemove on 'body', and avoid 'menu' element | <p><br>
is there a possibility to use the mousemove on the 'body', and avoid at the same time an element of the DOM, like the div 'menu' ?
The idea is to show the 'prev' or 'next' arrow in the background, but hide it -> if we enter in the menu element. </p>
<p>I tried this :</p>
<blockquote>
<p>$('body').not('#menu').bind('mousemove', function(e){</p>
</blockquote>
<p>but it didn't work out...</p>
| jquery | [5] |
5,890,032 | 5,890,033 | how to get value of a div in jQuery | <p>I have this sample code but why is messageA always null?</p>
<pre><code>var test = "<div id='message2'>My Message 2</div>"
var $response1 = $('<div/>').html(test);
var messageA = $('#message1', $response1).html();
alert ('message: ' + messageA);
</code></pre>
<p>it should come back as 'My Message 2'</p>
| jquery | [5] |
1,570,737 | 1,570,738 | the function written in javascript works after refresh the page in firefox, I really can not figure not why | <p>I am now programming, using Jquery, to render the preview page before submitting a form. I fill in some of the fields and click the 'preview button' to preview. the result is not what i want, I think there are some bugs, but the strange thing is : when i refresh the page in firefox, which will keep the filled values, the result is exacty what i want now. can somebody tell what might be the problem or give me a clue to check that</p>
| javascript | [3] |
2,963,873 | 2,963,874 | append li in ul which contain multiple spaces | <p>I want to append <code><li></code> in <code><ul></code> using jQuery. I've done it successfully with the following line:</p>
<pre><code>var ChosedItem = $("#chosedItem");
ChosedItem.append('<li id=' + $(this).attr('id') + ' limit=' + $(this).attr('limit') + ' ><span>' + $(this).children(0) + '</span></li>');
</code></pre>
<p>in this, <code>#chosedItem</code> is the div id where the <code><ul></code> exists</p>
<p>But the problem in my case is if my <code><li></code> items contain spaces then it is not added after <code>[0]th</code> position of children because I am using <code>chlidren(0)</code>. What can I use in place of <code>children(0)</code> to add <code><li></code> items that contain multiple spaces?</p>
| jquery | [5] |
2,068,076 | 2,068,077 | Android Anatomy by Edward T Kim | <p>Any idea where can i find this book.
Analysis of Operating Principles of the Android Platform. #Part 2 : Android Anatomy</p>
<p>Link from where i found this:
<a href="http://www.kapg.org/E_Android_Anatomy" rel="nofollow">http://www.kapg.org/E_Android_Anatomy</a></p>
<p>Thanks.
Suren</p>
| android | [4] |
5,324,527 | 5,324,528 | How to detect errors from compileall.compile_dir? | <p>How do I detect an error when compiling a directory of python files using compile_dir?</p>
<p>Currently I get something on stderr, but no way to detect it in my app.
py_compile.compile() takes a 'doraise' argument, but nothing here.</p>
<p>Or is there a better way to do this from a python script?</p>
<p>Edit:</p>
<p>I fixed it with os.walk and calling py_compile.compile for each file. But the question remains.</p>
| python | [7] |
3,364,974 | 3,364,975 | How can i apply jquery on all elements with same id attribute? | <p>How can i apply jquery on all elements with same id attribute ?</p>
<p>i want to apply a <code>focus()</code> and <code>blur()</code> function on a <code>textarea</code> elements that have same id?</p>
| jquery | [5] |
563,344 | 563,345 | what is the best way define array cell if it's not defined? | <p>I have a 2nd level array, that at a cetain point in the code can be ether undefined or contain value. If it is undefined I need to define it, without giving it any value.
this is what i did:</p>
<pre><code>arr[arr2["stripID"]] = typeof(arr[arr2["stripID"]]) === 'undefined' ? [] : arr[arr2["stripID"]];
</code></pre>
<p>is there a better or shorter way?</p>
| javascript | [3] |
6,031,139 | 6,031,140 | Android Getting Current date+ specfied integer time? | <p>Currently, I have a time represented by a four character string (Example 2328). Is it possible to get android current date only + the time represented in string?</p>
<p>So that it will be represented in "yyyy-MM-dd HH:mm"</p>
| android | [4] |
5,113,180 | 5,113,181 | What's wrong in this small code? | <p>There is no any error in this code but when I run it, it doesn't give any result?</p>
<p>Please help me?</p>
<pre><code>#include <iostream.h>
int x;
int count;
char a[50];
char b[50];
int strlenn(char *str);
void strcpyy(char *str1,char *str2);
void main(){
int count1,count2;
cin>>a;
cin>>b;
while(true){
cin>>x;
if(x=1){
count1=strlenn(a);
count2=strlenn(b);
cout<<count1<<"\n"<<count2<<"\n";
}
if(x=2){
strcpyy(a,b);
cout<<a<<"\n";
}
}
}
int strlenn(char *str){
_asm{
push esi;
mov esi,0;
lp: cmp a[esi],0
je done
inc esi
jmp lp
done: pop esi
}
return(count);
}
void strcpyy(char *str1,char *str2){
_asm{
push esi
push edi
mov ax,0
next:cmp a[esi],0
je doo
cmp b[edi],0
je doo
movzx ax,edi
movzx esi,ax
inc edi
inc esi
jmp next
doo:pop edi
pop esi
}
return;
}
</code></pre>
| c++ | [6] |
4,419,817 | 4,419,818 | Dynamically Controls | <p>I have dynamically generated a button an its event too.Now want to access a textbox (Generated Dynamically) into the onClick event of the Button.How can i do this?</p>
| asp.net | [9] |
4,837,787 | 4,837,788 | What are the current best practices of Object ownership and transfers in C++? NOT C++0x | <p>Especially for large scale projects where maintainability is important.
Explanations, links/references are also welcome.</p>
| c++ | [6] |
2,135,980 | 2,135,981 | PHP Doesn't Display Errors or Warnings | <p>I don't know how php.ini was configured since I don't have access to it. But on top of my php code file I have </p>
<blockquote>
<p>error_reporting(E_ALL);
ini_set('display_errors', '1');</p>
</blockquote>
<p>But still, if there is an error, e.g. missing a ")", the page is blank. It is so painful to debug without error message. Why were the errors not shown?</p>
| php | [2] |
1,063,582 | 1,063,583 | Download the file from web using DefaultHttpClient | <p>Any one knows how to download a file from web using the DefaultHttpClient in android?<br>
I tried most of the possible options, is openurl connection but I need to use the DefaultHttpClient </p>
<p>Thanks in advance </p>
| android | [4] |
3,769,756 | 3,769,757 | What is the difference between include() and calling a function in PHP? | <p>What is the difference between include() and calling a function in PHP?
For example :</p>
<p>1-</p>
<pre><code><?php
$foo = '<p>bar</p>';
return $foo;
?>
<html><body><?php echo $foo; ?></body></html>
</code></pre>
<p>2-insert above php code in a php file and include()
thanks in advance </p>
| php | [2] |
1,938,510 | 1,938,511 | Abstracting threading and multiprocessing in Python? | <p>Is there a module that abstract threading and multiprocessing in Python? I want to have an option of switching between them in future. </p>
| python | [7] |
4,196,071 | 4,196,072 | RPC:S-5:AEC-0 keep on getting it,after doing everything thats advise to do | <p>Got a senua tablet and keep getting error message RPC:S-5:AEC-0. Have been doing what has been advised, it works for 1 download and then it gives me that message again. Can anybody help???? </p>
| android | [4] |
3,314,201 | 3,314,202 | How to recieve data from the server? | <p>I am trying to fetchg data from server like MP3 files, video files, etc. in my application. The application should show the list of video files received from the server. </p>
<p>How can I do this?</p>
| android | [4] |
5,306,316 | 5,306,317 | how can i change the password length in create user wizard of visual studo in asp.net | <pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center">
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</div>
</form>
</body>
</html>
</code></pre>
| asp.net | [9] |
2,124,374 | 2,124,375 | Override of Graphics.DrawLine | <p>I seek to <code>@override</code> the <code>DrawLine</code> method of the <code>Graphics</code> class, but I am unsure if this is possible?</p>
<p>I seek to put a validation in the method so that it stops drawing at a certain Y variable that I would provide, effectively adding a new parameter to the method.</p>
<p>Anyone got some experience or advice on overriding that specific method?</p>
<p>I am unsure about this rproblem so I dont know if I can simply do <code>@Override</code> and then give it a validation as it is plotting the separate pixel points.</p>
<p>Thanks.</p>
| c# | [0] |
4,107,278 | 4,107,279 | use of "this" and "class" as members | <p>I have seen Java code that says something like:</p>
<pre><code>SomeClass.this.someMethod(someArg);
Blah(AnotherClass.class);
Blah(YAClass.this);
</code></pre>
<p>What do "this" and "class" mean here? I am used to them as keywords to refer to the current object and to define a class, but this is different. My Java book and online searches have not yielded any explanation.</p>
| java | [1] |
165,713 | 165,714 | How do I determine if a request is the result of a postback? | <p><strong>Update</strong></p>
<p>I'm implementing a custom page caching solution and I don't want the request to be cached or retrieved from the cache if it's in response to a form submission or some sort of asp.net postback.</p>
<p>I'm trying to figure out if the current HttpRequest is a postback. Is there a way of doing this outside the context of a page or other usercontrol? In otherwords if I'm inside an HttpModule I don't have access to <code>this.IsPostBack</code> but I still need to determine if it is in fact a postback.</p>
<p>Also, are postbacks always "Post" requests or is that determined by containing form?</p>
<p>thanks!</p>
| asp.net | [9] |
414,528 | 414,529 | PHP crashing on occasion - APC error? | <p>Any thoughts on this? We've had this happen twice recently. Basically, every page throws a fatal error, fixed by an apache restart. Here's what's in the log, repeated over and over.</p>
<p>[Tue Apr 13 15:18:12 2010] [error] [client 10.0.0.2] PHP Fatal error: Internal Zend error - Missing class information for in /www/sites/ep/vogoo/items.php on line 31<br>
[Tue Apr 13 15:18:12 2010] [error] [client 10.0.0.2] PHP Fatal error: Internal Zend error - Missing class information for in /www/sites/ep/vogoo/items.php on line 31<br>
[Tue Apr 13 15:18:13 2010] [error] [client 10.0.0.2] PHP Fatal error: Internal Zend error - Missing class information for in /www/sites/ep/vogoo/items.php on line 31</p>
<p>Looking around, this may be an issue with APC?
<a href="http://pecl.php.net/bugs/bug.php?id=16120&edit=1" rel="nofollow">http://pecl.php.net/bugs/bug.php?id=16120&edit=1</a>
(We're running 3.0.19, which shows as latest stable on pecl.)</p>
<p>Thoughts? I increased the amount of memory apc uses, but the problem just happened again.</p>
| php | [2] |
967,846 | 967,847 | Is there a way for me to get detailed formatted information on a Python class? | <p>So, I know I can use dir() to get information about class members etc. What I'm looking for is a way to get a nicely formatted report on everything related to a class (the members, docstrings, inheritance hierarchy, etc.).</p>
<p>I want to be able to run this on the command-line so I can explore code and debug better.</p>
| python | [7] |
3,982,472 | 3,982,473 | Python - test whether object is a builtin function | <p>Is there a nice way to check whether object o is a builtin Python function?</p>
<p>I know I can use, for example</p>
<pre><code>type(o) == type(pow)
</code></pre>
<p>because type(pow) is 'builtin_function_or_method'.</p>
<p>But is there some nicer way?</p>
| python | [7] |
2,498,474 | 2,498,475 | display custom selection area on html page using javascript | <p>On an html page, can I calculate an invidual character's x,y coordinates and its render size on screen ? </p>
<p>I am asking this question because I was wondering how google docs does it ? If you look inspect selected region in google docs, it places an overlay on the selected region. I couldn't figure out how they do it. </p>
<p>Google search does not return anything relevant. May be I am not searching for the right thing!</p>
<p>Any clues ? </p>
<p>Thanks,
Parth</p>
| javascript | [3] |
5,495,049 | 5,495,050 | jquery :contains selector in child window | <p>I have a child window that I am trying to use jquery :contains selector, but it does not work.</p>
<pre><code>var child = window.open("index.html", null);
child.document.close();//I saw somewhere this was necessary...
$(child.document).ready(function() {
setTimeout( function() { // necessary to wait a few seconds
console.log($('.navigation .option:nth-child(4)', child.document).length);
console.log($('.navigation .option:contains("Item4")', child.document).length);
}, 5000);
});
</code></pre>
<p>The :nth-child correctly returns: "Item4". The second fails to find. The HTML is:</p>
<pre><code><div class="navigation">
<div class="option">Item1</div>
<div class="option">Item2</div>
<div class="option">Item3</div>
<div class="option">Item4</div>
</div>
</code></pre>
<p>In a normal window, the :contains selector works - no problem. It seems that jquery cannot handle :contains in a child window. Is this true?</p>
| jquery | [5] |
3,576,451 | 3,576,452 | help with show/hide jquery script | <p>I need a js script show / hide with only shown one div at time others closed. By default any (only one) must be shown.</p>
<p>I have got this script: <a href="http://jsfiddle.net/kolxoznik1/BFV9k/" rel="nofollow">http://jsfiddle.net/kolxoznik1/BFV9k/</a>.</p>
<p>I want to add some class like <code>show</code>: </p>
<pre><code> <div class="toggle show">Content</div>
</code></pre>
<p>If <code>show</code> will be added div will not be hided, he will heve status <code>show()</code> othervise all divs will be <code>hide()</code>.</p>
<p>Suppose someone will help me with my small problem.</p>
| jquery | [5] |
5,445,921 | 5,445,922 | Deploying Python via CGI | <p>How do I deploy a Python project to a webserver that supports Python via CGI? I'm well versed in PHP, but do not understand CGI's relation to Python in the deployment process.</p>
<p>Any resource links are appreciated.</p>
<p>The web host in question is GoDaddy.</p>
| python | [7] |
4,504,696 | 4,504,697 | Android POST JSON OBJECT - How to set $_POST Index | <p>i have a JSONObject which i want to POST to a server. </p>
<p>Here is the Code:</p>
<pre><code>JSONObject obj = new JSONObject();
for(int k = 0; k<len;k++){
obj.put("nachrichten_ids", params[k]);
}
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost("xxxxx");
HttpEntity entity;
StringEntity s = new StringEntity(obj.toString());
s.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
entity = s;
httpPost.setEntity(entity);
HttpResponse response;
response = httpClient.execute(httpPost);
</code></pre>
<p>By doing Log.i("TEST",obj) i get the JSON object:</p>
<p><strong>{"nachrichten_ids":"[2144,2138]"}</strong></p>
<p>That data is send to the server. But i cant access it:
<strong>There is no $_POST index.</strong> (PHP)</p>
<p>How to set a index, so that i can access the json object, <strong>like $_POST['nachrichten_ids']</strong>.
I had to work with that data then e.g with php json_decode()</p>
<p>Any idea ?</p>
<p>Thanks</p>
| android | [4] |
1,962,724 | 1,962,725 | Changing CSS margin in jquery as a negative percentage | <p>I have this in CSS:</p>
<pre><code>.inner{ margin-left: -100% };
</code></pre>
<p>How would I assign this in jquery?</p>
<pre><code>$('.inner').css("margin-left", -100%);
</code></pre>
<p>doesn't work.</p>
| jquery | [5] |
1,148,307 | 1,148,308 | How do I default to numeric keyboard on EditText without forcing numeric input? | <p>This has been asked elsewhere online to no avail. Is there any way in Android to display the numeric soft keyboard when focusing on and <code>EditText</code>, but still allow any text to be entered? </p>
<p>I'd like to let the user enter quantities (e.g. "1 kg", "2 L"), so just setting <code>inputType="number"</code> won't work.</p>
| android | [4] |
2,171,612 | 2,171,613 | Android Service classes | <p>why it is not showing me a messageboxdialog when the Service is being activated.</p>
<pre><code>@Override
public void onStart(Intent intent, int startid) {
Toast.makeText(this, "My Service Started", Toast.LENGTH_LONG).show();
Log.d(TAG, "onStart");
player.start();
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
AlarmService.this.onDestroy();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
}
</code></pre>
<p>The Toast is appearing the sound is being played only the showdialog is not comming, why ? </p>
| android | [4] |
1,470,687 | 1,470,688 | How does sensorlistener consume power? | <p>I run an android app using my google phone and then get the time it keeped the sensorlistener on. After one night, I noticed that the sensor usage is more than 5 hours, but it seems the sensor did not kill the battery at all. So I am very curious about what will sensorlistener do if I leave the phone idle? Does listener acquire wakelock on registration?<br>
Thanks,</p>
| android | [4] |
5,830,359 | 5,830,360 | ACL not getting inherited | <pre><code>var ac = directoryInfo.GetAccessControl();
var wid = WindowsIdentity.GetCurrent();
IdentityReference securityIdentifier = (wid == null) ? new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null) : wid.User;
bool result = false;
ac.ModifyAccessRule(AccessControlModification.RemoveAll, new FileSystemAccessRule(
securityIdentifier,
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Deny), out result);
//check result
result = false;
ac.ModifyAccessRule(AccessControlModification.Set, new FileSystemAccessRule(
securityIdentifier,
FileSystemRights.FullControl,
InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
PropagationFlags.None,
AccessControlType.Allow), out result);
//check result
directoryInfo.SetAccessControl(ac);
</code></pre>
<p>I have code above to set directory permission to full control and at the same time remove any "deny" permission set. This code works for the current directory but it's not propagated to child directories and files, anything wrong?</p>
<p>Note that I'm checking the "result" after each ModifyAccessRule call and I can see that they're set to true both times.</p>
| c# | [0] |
5,416,470 | 5,416,471 | Reading data from a various terminals using PHP | <p>I would like to know if there's by any chance a way to communicate with a POS device, a cash register and a magnetic card reader with PHP. By communications I mean reading the output of that device.</p>
<p>Thank you.</p>
| php | [2] |
5,273,834 | 5,273,835 | Android public void search(View view) | <p>I am using the code found here.</p>
<p>The summary is that there is an xml file with an EditText and a Button called search. When search is clicked it is meant to search an SQLite db. I have added Log tracking to the oncreate and search methods but only the oncreate is running. This leads me to think that the search method is not executing when the button is clicked.</p>
<p>I know that the easy work around is to set and onclick listener. I am just wondering if the way the code is written at the moment is missing something or old and depreciated? </p>
<pre><code>public void search(View view) {
Log.v("SEARCH", "Was run ");
// || is the concatenation operation in SQLite
cursor = db.rawQuery("SELECT * FROM employee" , null);
adapter = new SimpleCursorAdapter(
this,
R.layout.employee_list_item,
cursor,
new String[] {"firstName", "lastName", "title"},
new int[] {R.id.firstName, R.id.lastName, R.id.title});
employeeList.setAdapter(adapter);
}
</code></pre>
<p>Any help is appreciated.</p>
<p>Max</p>
| android | [4] |
5,516,615 | 5,516,616 | How to convert Integer to string | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c">Alternative to itoa() for converting integer to string C++?</a><br>
<a href="http://stackoverflow.com/questions/5290089/how-to-convert-a-number-to-string-and-vice-versa-in-c">How to convert a number to string and vice versa in C++</a><br>
<a href="http://stackoverflow.com/questions/10516196/append-an-int-to-a-stdstring">Append an int to a std::string</a> </p>
</blockquote>
<p>I want to convert integer to string, any one help me for these conversion?</p>
<pre><code>itoa(*data->userid,buff1,10);
itoa(*data->userphone,buff2,10);
</code></pre>
| c++ | [6] |
4,619,797 | 4,619,798 | Motion detection using iPhone | <p>I saw at least 6 apps in AppStore that take photos when detect motion (i.e. a kind of Spy stuff). Does anybody know what is a general way to do such thing using iPhone SDK? </p>
<p>I guess their apps take photos each X seconds and compare current image with previous to determine if there any difference (read "motion"). Any better ideas? </p>
<p>Thank you!</p>
| iphone | [8] |
5,198,434 | 5,198,435 | Any way to redirect to another page on my site with PHP, besides header()? | <p>I am programming my first PHP web app and I have a question:</p>
<p>If I want to redirect the user to another page on the same site, under x conditions, how can I do it?</p>
<p>Is there a way, besides using header ()? I want to use relative paths so I was wondering if there is another way.</p>
<p>Basically my page receives a POST variable, and I want to make it so that if the variable does not meet certain requirements the page redirects you to a different page.</p>
| php | [2] |
339,676 | 339,677 | Is it possible to access the NMEA information of the devices using PHP? | <p>Hi How can we get the NMEA data of the device using PHP so it can be use to identify its location using WEB that don't have javascript turned on.I know HTML 5 geolocation can be use to gather the location but it is limited to other mobile without with javascript turned off.
The skyhook provides also an API for gathering the location but it needs to use a javascript which can be turned off by a user.</p>
| php | [2] |
5,989,263 | 5,989,264 | Programming in java swings | <p>I need your help.In my project if iI click on the button it should open an open dialog box I am very confused in the code so please help to get exact code for it.I am doing my project based on swings so please send me the answer as fast as possible.</p>
| java | [1] |
4,047,671 | 4,047,672 | Can this javascript be written more efficiently? | <p>I'm using these two functions to control the height of separate drops on a navigation bar. It's working, but I'm sure it could be written as one function ... i just don't know how. Thanks in advance for any suggestions:</p>
<pre><code><script type="text/javascript">
function nav() {
$('.nav li').hover(function () {
$(this).find('ul.item1_sub').show();
$(this).find('ul.item1_sub').stop().animate({
height: '145px',
opacity: '100'
}, {
queue: false,
duration: 200,
easing: 'easeInSine'
})
}, function () {
$(this).find('ul.item1_sub').stop().animate({
height: '0px',
opacity: '0'
}, {
queue: false,
duration: 100,
easing: 'easeInCirc'
})
});
};
$(document).ready(function () {
nav();
});
function nav2() {
$('.nav li').hover(function () {
$(this).find('ul.item2_sub').show();
$(this).find('ul.item2_sub').stop().animate({
height: '170px',
opacity: '100'
}, {
queue: false,
duration: 200,
easing: 'easeInSine'
})
}, function () {
$(this).find('ul.item2_sub').stop().animate({
height: '0px',
opacity: '0'
}, {
queue: false,
duration: 100,
easing: 'easeInCirc'
})
});
};
$(document).ready(function () {
nav2();
});
</script>
</code></pre>
| javascript | [3] |
3,739,190 | 3,739,191 | list all files in the folder and also sub folders | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2534632/list-all-files-from-a-directory-recursively-with-java">List all files from a directory recursively with Java</a> </p>
</blockquote>
<p>How can i return a file array that include all files on the folder and also sub folders my method just work for folder and it doesn't include sub folders .</p>
<pre><code>public File[] listf(String directoryName) {
// .............list file
File directory = new File(directoryName);
// get all the files from a directory
File[] fList = directory.listFiles();
for (File file : fList) {
if (file.isFile()) {
System.out.println(file.getAbsolutePath());
} else if (file.isDirectory()) {
listf(file.getAbsolutePath());
}
}
System.out.println(fList);
return fList;
}
</code></pre>
| java | [1] |
4,354,670 | 4,354,671 | What's the difference between 'state' and 'status' in function name? | <p>readyState<br/>
statusText<br/>
onreadystatechange<br/>
window.status<br/></p>
<p>What's the difference between 'state' and 'status' in English ?</p>
| javascript | [3] |
Subsets and Splits