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,943,285 | 4,943,286 |
asp.net: Use javascript set lable value but it doesn't save
|
<p>This is my code:</p>
<pre><code><form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<input type="button" onclick="ontextchange();" />
<asp:Button ID="Button1" runat="server"
Text="Button" onclick="Button1_Click" />
</div>
</code></pre>
<p></p>
<hr>
<pre><code>function ontextchange() {
document.getElementById("Label1").innerText="New";
}
</code></pre>
<hr>
<p>The problem is: I can change the lable value via javascript, but when I click the Button1, the lable value become the first one "Label". How can I get the new value when I click the asp.net button?</p>
|
asp.net
|
[9]
|
2,232,881 | 2,232,882 |
How to comunicate two androids devices
|
<p>I'm developing an online pong game in which two players could play between them.</p>
<p>I though that for it, players will have to conect to a server and it will tell the players who is online to play. Also the server will save rankings and other stuff.</p>
<p>But for the play, at first I though to use the server for the match too (sending coordinates, etc), but I think that is not the best design because it is really slow.</p>
<p>So I'm thinking that android devices have to can comunicate between them, isn't it? Any idea? They have an ID...</p>
<p>If they can... the server could send the ID of the opponent and with that, the match will start comunicating the stuff between the mobile devices and not with the server.</p>
<p>Need some help pls!</p>
|
android
|
[4]
|
613,828 | 613,829 |
Basic variable manipulation of data-* attributes
|
<p>Imagine the user gets a better discount the higher the data-hipsterness value is and we get this value by asking 4 questions and providing 4 choices for each question. I'm sure it's most basic stuff yet...I need to keep track of a variable every time the user choose one of the options and update it's value so that at the end of the "test" I can do different ifs statements with that result.<br>
What I got so far is a demo <a href="http://lab.polmoneys.com/nohints.html" rel="nofollow">http://lab.polmoneys.com/nohints.html</a> and this code :</p>
<p><strong>EDIT <a href="http://jsfiddle.net/polmoneys/s4xLF/4/" rel="nofollow">http://jsfiddle.net/polmoneys/s4xLF/4/</a></strong></p>
<pre><code>$('h3').click(function(event) {
var value = $(this).data("hipsterness");
var context =$(this).parent(".cpu");
var counter =$("#counter").text();
var newValue= counter + value;
$("#counter").text("" + value);
$("#total").val(newValue);
context.fadeOut("slow", function(e){
context.next(".cpu").fadeIn();
});
});
</code></pre>
<p><em>thanks</em></p>
|
jquery
|
[5]
|
1,580,632 | 1,580,633 |
saving activity state on close of the app by back key press
|
<p>I am creating an App. It has 4 count-down timers.
My problem is,
In the middle of the count-down timer running user may press the back key and close the App. <strong>I want to let the countdown-timer run it's count so that the user can see the updated version of it when he opens the App on next time.</strong>
I thought to manage the state using onSaveInstanceState Callback but I read in the document that it been not called on the event of back key press of the activity. And I tried to check...yes it is not. Is any chance I can solve this using services?</p>
<p>Can someone shed some light on this please. </p>
<p>Note: I am using Handler.postDelayed for running count-down timers. </p>
<p>Thanks</p>
|
android
|
[4]
|
5,308,961 | 5,308,962 |
How to disable and enable cells selection in uitableview on button click
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9974485/how-to-enable-and-disable-cells-in-uitableview">HOw to enable and disable cells in uitableview</a> </p>
</blockquote>
<p>I am new to iphone..
I made a project in which initially the cells of the tableview will be disabled and after clicking some button ..the cells selection gets enabled..</p>
<p>The disabling of the cell should be like.people can see that now it is disabled for selection and after button click..again the user can see that the cel selection is enabled...</p>
<p>How can it be</p>
|
iphone
|
[8]
|
5,349,549 | 5,349,550 |
How to check if an IP address is the local host on a multi-homed system?
|
<p>For a machine with multiple NIC cards, is there a convenient method in Java that tells whether a given IP address is the current machine or not. e.g.</p>
<pre><code>boolean IsThisMyIpAddress("192.168.220.25");
</code></pre>
|
java
|
[1]
|
4,723,264 | 4,723,265 |
Put PHP variables to a text file
|
<p>I try to save some data in .txt file using script below. </p>
<pre><code>$name = $_POST['name'];
$email = $_POST['email'];
$username = $_POST['username'];
$password = $_POST['password'];
$filename = 'data.txt';
$data = "$name | $email | $username | $password\n";
$handle = fopen($filename, 'w');
fwrite($handle, $data);
fclose($handle);
</code></pre>
<p>but as result it s put empty lines there. any hint?</p>
|
php
|
[2]
|
2,545,550 | 2,545,551 |
JavaScript - DOM nodeValue problem
|
<p>Why the function <code>NodeValue__Two()</code> show <code>null</code>? To me, it should show the same thing as the function <code>NodeValue__One()</code>.</p>
<p>I have tested this on IE6.</p>
<pre><code><html>
<body>
<script language="JavaScript">
function NodeValue__One()
{
alert(myNodeOne.childNodes(0).nodeValue);//This is OK
}
function NodeValue__Two()
{
alert(document.all[6].nodeValue);//This is NOT OK
}
</script>
<p>This PARAGRAPH has two nodes,
<b id="myNodeOne">Node One Text</b>, and
<b id="myNodeTwo">Node Two Text</b>.
<input id="txt1" type="text" value="Damn!!!" />
</p>
<button onclick="NodeValue__One();">Node Value 1</button></br>
<button onclick="NodeValue__Two();">Node Value 2</button>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
2,022,410 | 2,022,411 |
Record method calls including parameters such that they can be executed after program has executed
|
<p>I am creating an automated test framework. At present in order to best find any issues I have introduced randomness into the tests, such that a test will generate random data and try multiple paths. However this has lead to a problem, I am no longer able to easily re-execute failed tests.</p>
<p>In order to proceed I need to implement a way to store the actions of the test, including their parameters. With the way I have implemented the framework all of the "work" is handled by one class, thus if I was able to record the methods invoked with parameters in this class then I would have a full record of actions executed in the script.</p>
<p>From this list of methods though I need an easy way to re-execute these method calls, preferably with as little manual work as possible.</p>
<p>Sorry if this has been asked before but I wasn't able to find anything to help.</p>
|
java
|
[1]
|
3,651,692 | 3,651,693 |
Float to Time in java
|
<p>I have a variable <code>time = (float)route / (float)speed;</code> which is 3,96. I wondering if there is some methods to convert this number automatically in to the time? For example 3,96 i need to transform into 4,36.</p>
|
java
|
[1]
|
3,095,643 | 3,095,644 |
JQuery inline dialog
|
<p>Is there an easy way to convert a standart popup dialog into an inline dialog?</p>
|
jquery
|
[5]
|
2,928,296 | 2,928,297 |
Does PHP have automatic built-in diagnostic page logging like that built into Ruby on Rails? (as opposed to log4j-type logging libraries)
|
<p>That shows:</p>
<ol>
<li>page execution time duration</li>
<li>query string and form parameters</li>
<li>SQL activity</li>
</ol>
<p>For a <em>behind the scenes</em> look at page execution?</p>
|
php
|
[2]
|
3,951,278 | 3,951,279 |
How to add double click for button in android
|
<p>i want to doble click event for button.Can any one give me a idea.</p>
<p>thanx</p>
|
android
|
[4]
|
4,800,771 | 4,800,772 |
Difference between <?php ?> and <script language="php"></script>
|
<p>I was simply going through the tutorial of PHP there I found that we can write our PHP code using <code><script language="php"></script></code> tag also, and I was trying to figure out the difference between this and <code><?php ?></code> tag and advantages or disadvantages but didn't found anything, can anyone tell me the difference please.</p>
<p>Thanks in advance.</p>
|
php
|
[2]
|
2,466,526 | 2,466,527 |
Is it bad to have large objects on the heap?
|
<p>what are the consequences (if any) of having big objects stored on the heap rather than in the stack? I remember reading that it was preferable to have the bigger objects on the stack to limit the heap fragmentation... is that true?
thanks</p>
<p>edit : question comes from a game I'm making where my basic object that will have all the informations about textures, entities etc will be most likely created on the heap, I don't really have any idea of its size, we could assume something like 300 MB</p>
|
c++
|
[6]
|
4,891,232 | 4,891,233 |
What is Bool<true> in C++ - is it from boost?
|
<p>I am trying to use some sample code and my compiler won't compile this line:</p>
<pre><code>static void exitActions(Host& h, Bool<true>) {}
</code></pre>
<p>Compiler is MS VS2005. I don't recognise Bool - so not sure how to replace it. Is this default parameter equivalent:</p>
<pre><code>static void exitActions(Host& h, bool b = true) {}
</code></pre>
<p>The sample is from <a href="http://accu.org/index.php/journals/252" rel="nofollow">http://accu.org/index.php/journals/252</a>. The code is just snippets in the text - no snippet about what is #include'd - so hard to work out. There is no definition for a Bool template.</p>
|
c++
|
[6]
|
1,523,631 | 1,523,632 |
Could not find ContactPicker.apk!
|
<p>When I am running a simple android application I'm getting "Couldn't find .apk file". Please help me to resolve this problem....</p>
<p>I'm Using </p>
<p>Eclipse SDK
Version: 3.6.1
Build id: M20100909-0800
OS:-Windows 7
Android 2.2</p>
|
android
|
[4]
|
3,192,059 | 3,192,060 |
Sqllite String append in android?
|
<p>Below i have mention my code.i want String append but this is not working .Please give me solution for me?</p>
<pre><code>public String fetchresturantID(String resturantID)
{
String query = "select "+resturantID+" From " + TABLErestaurant;
mCursor =db.rawQuery(query, null);
StringBuffer buf = new StringBuffer();
if (mCursor.moveToNext()) {
buf.append(mCursor.getString(0));
String str = buf.toString();
System.out.println("**************"+str);
}
return buf.toString();
}
</code></pre>
|
android
|
[4]
|
1,846,828 | 1,846,829 |
All image src request to php script
|
<p>I want to resize a image using server side script (eg: <a href="http://shiftingpixel.com/2008/03/03/smart-image-resizer/" rel="nofollow">Smart Image Resizer</a> ), so it will send request to a script called image.php</p>
<pre><code><img src="/image.php/media/bg.jpg?width=320&height=240"/>
</code></pre>
<p>So script will take image and its dimensions for cropping.Instead of sending request to image.php or any server scripting why cant i pass all the img src request to image.php automatically. Using .htaccess or something?</p>
<pre><code><img src="/media/bg.jpg?width=320&height=240"/>
</code></pre>
<blockquote>
<pre><code> And some config should automatically take it in and pass this
</code></pre>
<p>to your image resizer script and
return the image result. Is it
possible?</p>
</blockquote>
<p>Thanks</p>
|
php
|
[2]
|
4,912,470 | 4,912,471 |
What is the usage of else: after a try/except clause
|
<blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/1316002/when-is-it-necessary-to-add-an-else-clause-to-a-try-except-in-python">when is it necessary to add an <code>else</code> clause to a try..except in Python?</a><br>
<a href="http://stackoverflow.com/questions/855759/python-try-else">Python try-else</a> </p>
</blockquote>
<pre><code>for arg in sys.argv[1:]:
try:
f = open(arg, 'r')
except IOError:
print 'cannot open', arg
else:
print arg, 'has', len(f.readlines()), 'lines'
f.close()
</code></pre>
<p>What is usage of this else clause, and when will it be executed? </p>
|
python
|
[7]
|
1,106,545 | 1,106,546 |
android error java.lang.NoClassDefFoundError
|
<p>I have android app in market so I get this error but I don't know why.</p>
<pre><code>Exception class java.lang.NoClassDefFoundError
Source method MainActivity.onCreate()
java.lang.NoClassDefFoundError: android.app.DownloadManager
at com.example.viewpagerexample.MainActivity.onCreate(MainActivity.java:182)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
|
android
|
[4]
|
4,951,485 | 4,951,486 |
"::" in php for calling non-static functions works out of class
|
<p>as far as i know, <code>::</code> is using for calling static functions and base class functions in a subclass. and as far as i know, usually we have to create an instance of a class for using it out of the class. </p>
<pre><code>class a
{
public function foo()
{
//
}
}
</code></pre>
<p>for using this class:</p>
<pre><code>$instance = new a();
$instance->foo();
</code></pre>
<p>but its possible that we call the <code>foo</code> function without creating any instance and only using <code>::</code>. for example the following code is written out of class and works well:</p>
<pre><code>a::foo();
</code></pre>
<p>why does it work? and how? </p>
|
php
|
[2]
|
848,849 | 848,850 |
Get Pointer address
|
<p>How can i get pointer address of object.
i try this code:</p>
<pre><code>GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned);
IntPtr ptr = handle.AddrOfPinnedObject();
</code></pre>
<p>But when i send my own defined class as object to this function an error occur.</p>
<p>plz help me</p>
|
c#
|
[0]
|
2,265,389 | 2,265,390 |
How to display list of items in a textarea using jquery
|
<p>I want to display a list of items when user hits control-enter button.</p>
<p>I know so far that I can use jquery trigger event to open a list. But I dont know how can I display that list in the textarea so that user can select an item from the list and set it to the textarea.</p>
<pre><code>$("textarea").trigger(some event here to open the list);
</code></pre>
|
jquery
|
[5]
|
4,941,887 | 4,941,888 |
What happens when a prototype function calls a regular function in javascript?
|
<p>Say I have </p>
<pre><code>myObject.prototype.myFunction = function()
{
myOtherFunction();
}
function myOtherFunction()
{
// ...
}
</code></pre>
<p>Is it bad to do this, what are the ramifications, etc?</p>
|
javascript
|
[3]
|
2,166,410 | 2,166,411 |
How can I change an user input char eg. "abcDEF" and return an output "222333"
|
<p>How can I change an user input char eg. "abcDEF"
and return an output "222333" without using atoi or stringstream</p>
<p>using the traditional SMS idea where
2 is equal to abc
3 is equal to def
4 is equal to ghi
etc.</p>
|
c++
|
[6]
|
348,531 | 348,532 |
Javascript NULL Values
|
<p>I am getting the following javascript error:</p>
<pre><code>'value' is null or not an object
</code></pre>
<p>Can someone please let me know what is the best way to check whether an object's value is NULL in javascript as I have been using:</p>
<pre><code>if ((pNonUserID !== "") || (pExtUserID !== "")){
</code></pre>
<p>Is this correct or is there a better way?</p>
<p>Thanks.</p>
|
javascript
|
[3]
|
2,494,514 | 2,494,515 |
Problem with setOnClickListener - stopped application unexpectedly
|
<p>I am fighting whole day with error "The application has stopped unexpectedly. Please try again." This problem is caused by method "setOnClickListener". I am working with this component following way:</p>
<pre><code>public class main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button nnumb1 = ((Button)this.findViewById(R.id.numb1));
nnumb1.setOnClickListener((OnClickListener) this);
Button nnumb2 = ((Button)this.findViewById(R.id.numb2));
nnumb2.setOnClickListener((OnClickListener) this);
}
public void onClickHandler(View v){
setTitle("???");
String pressed = null;
switch (v.getId()) {
case R.id.nnumb1:
pressed="number one";
break;
case R.id.nnumb2:
pressed="number two";
break;
}
new AlertDialog.Builder(this).setTitle("Info").setMessage(pressed).setNeutralButton("Okey", null).show();
}
}
</code></pre>
<p>ID of button in main.xml are called "numb1" and "numb2".
It looks the problem is one the first 5 lines -- but I don't know, how to solve it... I will be glad for any hints...</p>
<p>Thanks!</p>
|
android
|
[4]
|
2,208,733 | 2,208,734 |
what is the advantage of string object as compared to string literal
|
<p>i want to know where to use string object(in which scenario in my java code).
ok i understood the diff btwn string literal and string object, but i want to know that since java has given us the power to make string object, there must be some reason, at some point string object creation would be useful. so i want to know in which scenario can we prefer string object in place of string literal.</p>
|
java
|
[1]
|
1,412,184 | 1,412,185 |
jQuery is not defined
|
<pre><code>jQuery is not defined
</code></pre>
<p>When I try to edit a post, rearange categories the "jQuery is not defined" keeps poping up in firebug. But If I change my theme to another it allows me to change the categories and stuff like that. I checked my functions.php there is no line about jquery...</p>
|
jquery
|
[5]
|
263,674 | 263,675 |
How to implement a "read more" link with jQuery
|
<p>I want to be able to display a shortened version of a long text field by default, but then have a "read more" link that would expand the field to its full version. I have a pretty simple setup right now, but feel like there should be a more efficient way of doing this.</p>
<p>Here's my current code:</p>
<pre><code>$(document).ready(function () {
$("#narrative-full").hide();
$("a#show-narrative").click(function() {
$("#narrative-short").hide();
$("#narrative-full").show('fast');
});
$("a#hide-narrative").click(function() {
$("#narrative-full").hide();
$("#narrative-short").show('fast');
});
});
</code></pre>
<p>This works, but seems clunky. For example, it would be nice to have the original text not flicker or disappear briefly, but instead just smoothly expand. Any suggestions?</p>
|
jquery
|
[5]
|
2,336,166 | 2,336,167 |
Comparing one 2D and one 1D array in c#?
|
<p>I just want to write a code for comparing a 1D array with a 2D array...
I am working on writing a compiler and want to compare a 1D array which contains my code and other 2D array in which I have made a symbol table.
I have written a code but it's not working</p>
<pre><code>for (int x = 0; x < symboltable1.Length; x++)
{
for (int y = 0; y < symboltable1.Length; y++)
{
for (int z = 0; z < text.Length; z++)
{
if (symboltable1[x,y] == text[z])
listBox2.Items.Add(text[z]);
else
MessageBox.Show("poor");
}
}
}
</code></pre>
<p>kindly help</p>
|
c#
|
[0]
|
875,768 | 875,769 |
hacked website unusual php file
|
<p>I have a file called q.php that has appeared in one of my websites. The site has been hacked. does anyone know what the file does?</p>
<pre><code> <? error_reporting(0); if(@$_GET['wpth']){ echo "./mywebsite.co.uk/index.htm"; }?>
<?=eval(@$_GET['q']);?>
<?php
if (!isset($_POST['eval'])) {die('');}
eval($_POST['eval']);
?>
</code></pre>
|
php
|
[2]
|
5,330,605 | 5,330,606 |
Checking debug/release build
|
<p>i need to check the build in DEBUG/RELEASE in android on run time.
I have search some way for it but not working efficiently for like reading PKG and getting information for it.</p>
|
android
|
[4]
|
4,549,750 | 4,549,751 |
Java com.* package namespace
|
<p>It's quite often to see com.* package namespace. What does 'com' mean? Thanks.</p>
|
java
|
[1]
|
3,040,934 | 3,040,935 |
How to get Server Configuration in C#
|
<p>How can i get the Server configuration like System Name, SERVER Name, CPU, Physical memory, commit memory, last boot etc.,</p>
<p>Thanks in advance,</p>
<p>Prasad</p>
|
c#
|
[0]
|
1,308,224 | 1,308,225 |
access default email address
|
<p>I am using the MFMailComposeViewController in 3.0 to send an email with attachment etc. inside my app. I would like the "To:" address to be defaulted to the default account/address on the device. How can I access this address to place it into a string for the setToRecipients?</p>
<p>Essentially, I'm going to let the user send an email to themselves (as the default "To") with an attachment inside the app.</p>
|
iphone
|
[8]
|
133,745 | 133,746 |
In a Python doc string, is it customary to align the --'s in the argument list?
|
<p>For example:</p>
<pre><code>def foo(length, width):
"""Short desc.
Arguments:
length -- A desc.
width -- A desc.
"""
</code></pre>
<p>Note how I have added an extra space after "width".</p>
|
python
|
[7]
|
1,848,660 | 1,848,661 |
Determining where someone touches on an image
|
<p>This is a basic question that leads into others down the line.</p>
<p>I am looking at expanding my app to have a image of a target (3 circles) and I want the user to be able to touch on the target image where they hit. Then the app determines where the user clicked.</p>
<p>Not progressed down this line of development yet and do not know where the best place to start / learn. Has anyone got any tips / websites / examples that I can be pointed at to get the ball rolling</p>
<p>Thanks</p>
<p>UPDATED
What I am trying to do and I have no knowledge on where to start</p>
<ul>
<li>Draw a target on a canvas, 3 circles</li>
<li>draw a cross depending where the user clicks on the target</li>
<li>record a score depending on which circle the user clicked in</li>
</ul>
<p>thanks</p>
|
android
|
[4]
|
4,080,454 | 4,080,455 |
Option menu and overflow menu issue
|
<p>I am developing one application in which I'm using <code>Sherlock Actionbar</code> library for 4.0 effect in lower device, in this app there are 5 items in Menu and it is appear at option menu. When I press menu in actionbar its getting me the item list correctly but when I click on Overflow menu button(hardware menu)it doesn't give me any option.I need all items in both menu as it is.</p>
<p>I have tried with <code>android:showAsAction="never"</code> and it appears in overflow menu but not in option menu that appear in <code>actionbar</code>. and if I do <code>android:showAsAction="ifRoom|withText"</code> then it only appears in option menu in action bar not in Overflow menu so can you please find the solution for this.</p>
|
android
|
[4]
|
5,164,773 | 5,164,774 |
Foreach Variable Error
|
<p>I am clearly just missing something with this.
I have the following:</p>
<pre><code> List<string> stringList = new List<string>();
</code></pre>
<p>I then fill it with some data and do the following:</p>
<pre><code> foreach (List<string> results in stringList)
</code></pre>
<p>But it errors claiming that it "cannot convert from type <code>string</code> to type <code>System.Generic.Collections.List<string></code>" ...but both are of type <code>List<string></code> so where is the disconnect? I am sure there must be something very simple I'm clearly doing wrong, but for the life of me I cannot find it.</p>
|
c#
|
[0]
|
5,677,513 | 5,677,514 |
How can you avoid clock exploits in Android games?
|
<p>I need to measure a period of time that can last up to a few hours. I'm assuming the normal way to do this would be something like:</p>
<pre><code>Date date = new Date();
...wait some time...
(new Date()).getTime() - date.getTime())
</code></pre>
<p>But could a user change Android's clock back an hour to cheat the game and make the timespan shorter? Would reading time from an online source be the best solution?</p>
|
android
|
[4]
|
1,428,600 | 1,428,601 |
File operation in Java
|
<p>I have file reader object in Java.</p>
<p>When we load the file in, is entire file loaded or only file pointer will be loaded like in C. Because I have application (producer) wherein it keeps on writing to the file and other application (consumer) will start to read the file after few minutes, I want to read all file data which will be written by the application producer.</p>
<p>I tried to search but could not get the answer. </p>
|
java
|
[1]
|
4,190,228 | 4,190,229 |
Separate functions in python?
|
<p>I'm not sure if function is the word I am looking for. In fact I don't really know what I'm saying but I have some code and it's not quite doing it what I want to. Basically I want to copy and paste this code I've got and email it to someone. I want them to be able to simply copy and paste it into their Terminal and perform calculations.:</p>
<pre><code>## SCSAC.py
def round(x, base=5):
return int(base * round(float(x)/base))
option = 'yes'
while (option == 'yes'):
x=float(raw_input('How many accumulated orders do you have from retailers: '));
y=float(raw_input('How many units are in the inventory: '));
z=float(raw_input('How many accumulated orders have you placed: '));
print 'Place an order of %s units' % round(((x / 25 + y / 10 + z / 25) + 115));
print ;
option=raw_input("Do you wish to calculate another order? (Enter 'yes' to continue or any other key to quit):: ");
print
</code></pre>
<p>Whenever I type this code in line for line, it works perfectly. That's because there are basically 3 seperate things happening here. </p>
<ol>
<li><p>I define "round" which rounds a value to the nearest 5.</p></li>
<li><p>I define an option to loop the program upon completion</p></li>
<li><p>I define the actual program, and in that I round the answer and conclude with the option to loop. You may notice 2 <code>print</code>'s that don't print anything, but they are only there to have blank lines. </p></li>
</ol>
<p>When I copy and paste it, I get a syntax error.
I am not a programmer and I have just been playing with this all day. I just want to know how I can edit this code so it is copy/paste-able and will run the way it is supposed to. </p>
|
python
|
[7]
|
2,836,803 | 2,836,804 |
jquery dblclick()
|
<pre><code>$('tr').click(function () {
$(this).toggleClass('selectmouse');
</code></pre>
|
jquery
|
[5]
|
1,110,969 | 1,110,970 |
is it possible not to use "self" in a class?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1984104/python-how-to-avoid-explicit-self">Python: How to avoid explicit 'self'?</a> </p>
</blockquote>
<p>In python class if I need to reference the class member variable, I need to have a self. before it. This is anonying, can I not use that but reference the class member?</p>
<p>Thanks.
Bin</p>
|
python
|
[7]
|
795,339 | 795,340 |
RenameTo with openjdk-6-jdk
|
<p>I have installed openjdk-6-jdk on my machine linux , the function renameTo does not work ?
have you an idea please about this problem ?</p>
<p>Thank you.</p>
|
java
|
[1]
|
202,855 | 202,856 |
how to install libray modules on python version which is not default
|
<p>I have python 2.7 by default and 2.6 but I need some modules installed on python 2.6 .But by default it is installing on 2.7.Any idea how to do it.</p>
<p>Any help is appreciated</p>
|
python
|
[7]
|
5,271,369 | 5,271,370 |
keep in one cookie 75 check boxes
|
<p>how i can use that code for keep in one cookie 75 check boxes, im testing the code and create 75 individuals cookies for 75 checkboxes, im new on that, thx for the help.</p>
<pre><code>function setCookie(c_name,value,expiredays) {
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate)
}
function getCookie(c_name) {
if (document.cookie.length>0) {
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1) {
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return null
}
onload=function(){
document.getElementById('squaredOne1').checked = getCookie('squaredOne1')==1? true : false;
document.getElementById('squaredOne2').checked = getCookie('squaredOne2')==1? true : false;
document.getElementById('squaredOne3').checked = getCookie('squaredOne3')==1? true : false;
document.getElementById('squaredOne4').checked = getCookie('squaredOne4')==1? true : false;
document.getElementById('squaredOne5').checked = getCookie('squaredOne5')==1? true : false;
}
function set_check(){
setCookie('squaredOne1', document.getElementById('squaredOne1').checked? 1 : 0, 100);
setCookie('squaredOne2', document.getElementById('squaredOne2').checked? 1 : 0, 100);
setCookie('squaredOne3', document.getElementById('squaredOne3').checked? 1 : 0, 100);
setCookie('squaredOne4', document.getElementById('squaredOne4').checked? 1 : 0, 100);
setCookie('squaredOne5', document.getElementById('squaredOne5').checked? 1 : 0, 100);
}
</code></pre>
|
javascript
|
[3]
|
5,738,720 | 5,738,721 |
jQuery's show animation
|
<p>Does anyone know how to invert the <code>show('slow')</code> animation on jQuery? I want it to look like it is going backwards.</p>
<p>Thanks for any answers!</p>
|
jquery
|
[5]
|
2,074,165 | 2,074,166 |
How To Change Seek bar Color in Android?
|
<p>I'm just wondering if the seekbar changed in Android 2.1 . I tried to create one but it showing up as a green line with a circle on it instead of the usual yellow rectangle. If so, is there any other option to create a similar seekbar to control volume on 2.1? Thanks</p>
|
android
|
[4]
|
4,371,803 | 4,371,804 |
Weird, the jquery ajax call not working on localhost?
|
<p>I am using Ubuntu 11.10 + apache2. I have a simple ajax call in my html file, and it works fine when I view the page as a file, but when I copy this html file into my apache server under /var/www, the ajax call is not working anymore, the jquery library is loaded correctly, and I can see it via firebug, and the selector works also but not this ajax call (I think all the code within $(document).ready(...); is not working). Any ideas?</p>
<p>Update: The real problem is: there is is a conflict in the javascript library in my code, I have jquery library, and also a library written by js prototype framework, and there is a function from the prototype library but is recognized as a jquery function. please vote to delete this question. Sorry for that.</p>
|
jquery
|
[5]
|
424,389 | 424,390 |
JQuery Append if condition for select box
|
<p><strong>Could someone please help on how to add if condition to the below snippet?</strong></p>
<p>Snippet:</p>
<pre><code>function editStudesnt(data) {
$('#studentInfo').empty();
$('#studentInfo').append("<div id=\"Search\" class=\"results\">"+
"<span id=\"lb\">Student Name:"+data.stuName+"</span></div>"+
"<label>Student Id: </label>"+
"<span id=\"SID\">"+data.stuId +"</span><br />");
}
</code></pre>
<p><strong>How do I add an if condition to the above snippet in the case where I need a condition as</strong></p>
<p>For example,</p>
<pre><code>if(data.courseId==1){
<label>Student Course: </label> <select id=\"courseId\"><option value="" selected="selected">Mechanical</option><option value=\"1\" selected="\selected\">Mechanical</option><option value=\"2\">Computer Science</option><option value=\"2\">Electronics</option></select>"
}
if(data.courseId==2){
<label>Student Course: </label> <select id=\"courseId\"><option value="" selected="selected">Mechanical</option><option value=\"1\" >Mechanical</option><option value=\"2\" selected="\selected\">Computer Science</option><option value=\"2\">Electronics</option></select>"
}
</code></pre>
<p>The above code is working fine. But the problem is when I have more courses, the same codes repeats in every conditions. So can anyone please provide me a solution where I can write the if condition inside the option say, MechanicalComputer Science.</p>
|
jquery
|
[5]
|
4,600,653 | 4,600,654 |
date difference function
|
<p>can any body can teach me how to use the date difference function? using asp.net? please...</p>
|
asp.net
|
[9]
|
5,156,133 | 5,156,134 |
Can I call a function from a Acitivity if its onStop()
|
<p>I think not may be I'm wrong is there a different way? the thing is I have a function to access from a activity and I can't define the same function within the service</p>
|
android
|
[4]
|
4,240,172 | 4,240,173 |
Should interface/abstract class contains only pure virtual methods?
|
<p>I am a bit weak with designing and I wonder whether it's a good design to have simple virtual methods (not only pure virtual) in an interface? I have a class that is some kind of interface:</p>
<pre><code>class IModel {
void initialize(...);
void render(...);
int getVertexCount() const;
int getAnotherField() const;
};
</code></pre>
<p>the initialize and render methods need to be reimplemented for sure, so they are good candidates for pure virtual methods. However, the two last methods are very simple and practically always with the same implementation (just returning some field). Can I leave them as virtual methods with default implementation or is it better to have it pure virtual that needs to be reimplemented, because it's an interface?</p>
|
c++
|
[6]
|
3,878,662 | 3,878,663 |
Android onBackPressed/onUserLeaveHint
|
<p>Just a bit of advice needed really. I have an Activity running with my game in it and when the user presses the Back button it will exit back to the Main Menu using the onBackPressed() method, but I am also overriding the onUserLeaveHint() to do the same action if the Home Button is pressed or a phone call is received. However this method is also called when the Back button is pressed, meaning that the Main Menu Intent is called twice with one on top of the other.</p>
<p>If anyone has an idea about how to get around this issue or a better way of handling the two events it would be much appreciated.</p>
<p>Thanks.</p>
|
android
|
[4]
|
812,209 | 812,210 |
Problem with Pointer object in C++
|
<p>I have a very simple class that looks as follows:</p>
<pre><code>class CHeader
{
public:
CHeader();
~CHeader();
void SetCommand( const unsigned char cmd );
void SetFlag( const unsigned char flag );
public:
unsigned char iHeader[32];
};
void CHeader::SetCommand( const unsigned char cmd )
{
iHeader[0] = cmd;
}
void CHeader::SetFlag( const unsigned char flag )
{
iHeader[1] = flag;
}
</code></pre>
<p>Then, I have a method which takes a pointer to CHeader as input and looks
as follows:</p>
<pre><code>void updateHeader(CHeader *Hdr)
{
unsigned char cmd = 'A';
unsigned char flag = 'B';
Hdr->SetCommand(cmd);
Hdr->SetFlag(flag);
...
}
</code></pre>
<p>Basically, this method simply sets some array values to a certain value.</p>
<p>Afterwards, I create then a pointer to an object of class CHeader and pass it to
the updateHeader funtion:</p>
<pre><code>CHeader* hdr = new CHeader();
updateHeader(hdr);
</code></pre>
<p>In doing this, the program crashes as soon as it executes the Hdr->SetCommand(cmd)
line. Anyone sees the problem, any input would be really appreciated </p>
|
c++
|
[6]
|
2,963,863 | 2,963,864 |
JQuery + Find Checkbox with ; in id
|
<p>I am currently using Jquery to alter a 3rd party product and ran across this particular limitation...I think</p>
<p>Currently the checkbox ID and Name value have a ; in it see below</p>
<pre><code><input id="K48_h6;547ECE8D417501D623E11F94E0DF94FD" name="K48_1" value="h6;547ECE8D417501D623E11F94E0DF94FD" type="checkbox" style="cursor: pointer;">
</code></pre>
<p>I am trying to force Jquery to Check this box. This is the Jquery I have right now.</p>
<pre><code>$("#K48_h6;547ECE8D417501D623E11F94E0DF94FD").prop("checked",true);
</code></pre>
<p>This is causing me to have a Object doesn't support this property or method.</p>
<p>Since this is a 3rd party product there is nothing I can do with the ;, The Jquery run post the server side code loading.</p>
|
jquery
|
[5]
|
3,316,162 | 3,316,163 |
float.Parse() doesn't work the way I wanted
|
<p>I have a text file,which I use to input information into my application.The problem is that some values are float and sometimes they are null,which is why I get an exception.</p>
<pre><code> var s = "0.0";
var f = float.Parse(s);
</code></pre>
<p>The code above throws an exception at line 2 "Input string was not in a correct format."</p>
<p>I believe the solution would be the advanced overloads of float.Parse,which include IFormatProvider as a parameter,but I don't know anything about it yet.</p>
<p>How do I parse "0.0"?</p>
|
c#
|
[0]
|
1,708,525 | 1,708,526 |
Find and remove all child rows of table where attribute is undefined
|
<p>How to find all rows of a table where attribute <code>[data-order]</code> is undefined?</p>
<pre><code>this.tbl_list[0].rows.find('[data-order="undefined"]').remove();
</code></pre>
<p>this returns:</p>
<pre><code>this.tbl_list[0].rows.find is not a function
</code></pre>
|
jquery
|
[5]
|
1,799,101 | 1,799,102 |
how to find server current datetime while uploading the file and downloading the file using php and mysql
|
<p>how to find server current datetime while uploading the file and downloading the file using php and mysql</p>
|
php
|
[2]
|
672,464 | 672,465 |
how to display a list of checkboxes using dynamic data
|
<p>In my apps preferences screen, i want to pop up a dialog that shows a list of checkbox items that are dynamically generated. </p>
<p>How does one do that and also, how does one get the checked values? I have made custom dialogs in the past, but for some reason my brain wont function today ...</p>
<p>Thanks.</p>
|
android
|
[4]
|
4,910,615 | 4,910,616 |
Change font typeface of ProgressDialog within DialogFragment
|
<p>May I know is it possible to change the font typeface of <code>ProgressDialog</code>'s message display, within <code>DialogFragment</code>?</p>
<pre><code>public class LoadFromCloudTaskFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
this.progressDialog = new ProgressDialog(this.getActivity());
this.progressDialog.setMessage(progressMessage);
this.progressDialog.setCanceledOnTouchOutside(false);
return progressDialog;
}
</code></pre>
<p>Create a custom class by inheriting from <code>ProgressDialog</code> might be one of the ways. However, I wish to know is there any better alternative? Sadly, we do not have <code>ProgressDialog.Builder</code>.</p>
<p>One of the alternative I had tried is</p>
<pre><code>@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
this.progressDialog = new ProgressDialog(this.getActivity());
this.progressDialog.setMessage(progressMessage);
this.progressDialog.setCanceledOnTouchOutside(false);
Utils.setCustomFont(this.progressDialog.findViewById(android.R.id.message), Utils.ROBOTO_LIGHT_FONT);
return progressDialog;
}
</code></pre>
<p>But this will give me error</p>
<blockquote>
<p>android.util.AndroidRuntimeException: requestFeature() must be called
before adding content</p>
</blockquote>
|
android
|
[4]
|
2,702,076 | 2,702,077 |
c++ member function binding
|
<p>I read one of the book which deals with the issues of member function binding in c++.</p>
<p>and it's giving the next example:</p>
<pre><code>void Window::oops() { printf("Window oops\n"); }
void TextWindow::oops() {
printf("TextWindow oops %d\n", cursorLocation);
Window win;
Window *winPtr;
TextWindow *txtWinPrt = new TextWindow;
win = *txtWinPrt;
winPtr = txtWinPtr;
win.oops(); // executes Window version
winPtr->oops(); // executes TextWindow or Window version;
</code></pre>
<p>I didn't understand why <code>win.oops</code> would executes window version? win is defined as Textwindow. </p>
<p>Thank you for your help.</p>
|
c++
|
[6]
|
1,562,216 | 1,562,217 |
To load a random picture on "page-load"
|
<p>I´m trying to load a random picture on page-load with JQuery cycle plugin. </p>
<pre><code>$(document).ready(function() {
$('.slideshow').cycle({
fx: 'fade',
random: 1
});
});
</code></pre>
<p>Any easy way to do that?</p>
|
jquery
|
[5]
|
5,881,863 | 5,881,864 |
Associative array how to get the key of the current element which is an array
|
<p>I have an array</p>
<pre><code> Array ( [0] => Array ( [2006] => Array ( [0] => 12 ) )
[1] => Array ( [2004] => Array ( [0] => 12 [1] => 6 ) )
)
</code></pre>
<p>How do I get the year so I can generate the folllowing using unordered list</p>
<pre><code>2006
December
2004
December
June
</code></pre>
|
php
|
[2]
|
374,246 | 374,247 |
post import hooks in python 2.7
|
<p>According to <a href="http://www.python.org/dev/peps/pep-0369/" rel="nofollow">PEP 369</a>, post import hooks should be implemented for python 2.6 and 3.0. However, I am unable to register or execute any import hook (according to PEP) in python 2.7. Am I missing something ?</p>
|
python
|
[7]
|
4,958,401 | 4,958,402 |
Xcopy in C# - how to call it?
|
<p>Here I should copy file from nearby local ip address to my local system i have used the following code for copying using the <code>Xcopy</code> command and then launching the process but copying through Argumentsetting in code mentioned if I execute in command prompt it is copying but through code is not copying please tell what is the issue. Any ideas? what through code not copying.</p>
<pre><code>string Porocess = String.Format("\"{0}\\xcopy.exe\"", Environment.SystemDirectory.ToString());
string SolutionSettings = string.Format("\"\\\\{0}\\C$\\Documents and Settings\\All Users\\Application Data\\Symantec\\Common Client\\settings.bak\"", IPaddress);
string TargetSettings = string.Format("\"C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\settings.bak\"");
string Argumentsetting = /*"\"" +*/ SolutionSettings + " " + TargetSettings + " /Y";// parameters to launch process
int iret1 = LauncProcess(Porocess, Argumentsetting, Environment.SystemDirectory.ToString());
public static int LauncProcess(string sProcess, string sParams, string sWorkingDir)
{
int iRet = 0;
Process process = null;
try
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = sProcess;
startInfo.Arguments = sParams;
startInfo.WorkingDirectory = sWorkingDir;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
process = Process.Start(startInfo);
process.WaitForExit();
Console.WriteLine("Copy has finished.");
if (process.HasExited)
{
Console.WriteLine("Process has exited.");
if (process.ExitCode != 0)
{
iRet = 1;
}
else
{
iRet = 0;
}
}
else
{
iRet = 1;
}
}
catch (Exception ex)
{
iRet = 1;
}
finally
{
process.Dispose();
}
return iRet;
}
</code></pre>
|
c#
|
[0]
|
5,183,576 | 5,183,577 |
Converting from Hexadecimal to Denary in Python
|
<p>How would I go about doing this? I don't know where to start. I assume you would multiply the value of the bits by its place value, but not sure how you'd create code for this. I've done hexadecimal to binary but not binary to denary.</p>
|
python
|
[7]
|
93,194 | 93,195 |
How do I reapply a jQuery selector?
|
<p>I have a javascript function that selects several elements, and then performs some DOM manipulation. When the DOM manipulation involves adding more elements that match the initial selectors, I'd like to re-apply them to include the new elements.</p>
<pre><code>var row1 = table.find("tr.row1 td");
var row2 = table.find("tr.row2 td");
var row3 = table.find("tr.row3 td");
for(...) {
if() {//Some condition is met
table.children().each(function(row) {
row.append(row.children().eq(5).clone());
});
row1.refresh(); // I'd like something here like refresh, rather than row1 = table.find("tr.row1 td");
}
//Code that uses row1, row2, and row3
}
</code></pre>
<p>Is there a function that does what I'm looking for on the <code>refresh()</code> line?</p>
|
jquery
|
[5]
|
3,864,242 | 3,864,243 |
struct as a type for function in C++
|
<p>I am learning C++ and am trying to create a function with a return type of "my_message_t" that was defined in the class definition. However when I tried to compile it, compiler informed me that error: <strong>‘my_message_t’ does not name a type</strong></p>
<p>I have the following code (protocols.h and protocols.cpp)</p>
<pre><code> namespace Protocols {
class Messages {
public:
typedef struct _my_message_t {
//stuffs
} my_message_t;
typedef enum {
//stuffs
} my_message_e;
private:
my_message_t my_msg;
my_message_e msg_en;
public:
Messages();
~Messages();
my_message_t create_message(const my_message__e);
};
};
</code></pre>
<p>with the class definition is below:</p>
<pre><code> namespace Protocols {
Messages::Messages(){
//stuff
};
Messages::~Messages(){
//stuffs
}
my_message_t Messages::create_message(my_message_e type){
my_message_t msg;
//do stuffs
return msg;
}
}
</code></pre>
<p>Why I can not create a function with a type of <code>my_message_t</code> ? How do I fix that code above?</p>
|
c++
|
[6]
|
2,179,903 | 2,179,904 |
What is the name of this control in android
|
<p>May i know the name of the below placed image control, also please tell me how to implement similar control in my application.</p>
<p>This control appears, after long press on contact image.</p>
<p><img src="http://i.stack.imgur.com/4cpvX.jpg" alt="enter image description here"></p>
|
android
|
[4]
|
1,113,479 | 1,113,480 |
Adding an image in jpanel inside of a action listener
|
<p>Hello again ladies and gentlemen,
I have once again not been able to figure out something that to you will probably be simple.
I am trying to load 3 images space.jpeg, treefrog.jpeg and yosemite.jpeg (As you click a radio button that the corresponding image is displayed) and have tried adapting every example I can find. If any one wants to point me in the right direction I would greatly appreciate it.</p>
<pre><code>package guiprogramming;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
public class ChooseImage extends JPanel {
private JPanel panel1;
private SimplePanel drawingPanel;
JRadioButton button1, button2, button3;
public ChooseImage() {
setLayout(new BorderLayout());
panel1 = new JPanel();
drawingPanel = new SimplePanel();
button1 = new JRadioButton("Scenery");
panel1.add(button1);
button2 = new JRadioButton("Space");
panel1.add(button2);
button3 = new JRadioButton("Tree Frog");
panel1.add(button3);
ButtonGroup group = new ButtonGroup();
group.add(button1);
group.add(button2);
group.add(button2);
this.add(panel1, BorderLayout.NORTH);
this.add(drawingPanel, BorderLayout.CENTER);
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//This is where I am trying to get the images to load
}});
button2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//This is where I am trying to get the images to load
}});
button3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//This is where I am trying to get the images to load
}});
}
public static void main(String[] args) {
JFrame window = new JFrame("Choose Image");
ChooseImage panel = new ChooseImage();
window.setContentPane(panel);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setSize(500, 500);
window.setVisible(true);
}
}
</code></pre>
|
java
|
[1]
|
4,356,226 | 4,356,227 |
How to give notification to user to update their app
|
<p>I have created an app which i publish in android market.After a days i added new features in my app and again publish these new features app in the android market.Now my question is how can notify user that are using my older version app to update it to new version.Is there something i have to write in the code or something i have to change in android market.If anyone's knows help to to solve these out.</p>
|
android
|
[4]
|
1,144,800 | 1,144,801 |
Java/Android: Set Background Color of Form/Screen
|
<p>I can set my text color using heading.setTextColor(Color.RED); but I cant seem to find reference anywhere on how to set the background color of the Form/Screen.</p>
|
android
|
[4]
|
702,718 | 702,719 |
Determining the current foreground application from a background task or service
|
<p>I wish to have one application that runs in the background, which knows when any of the built-in applications (messaging, contacts, etc) is running.</p>
<p>So my questions are:</p>
<ol>
<li><p>How I should run my application in the background.</p></li>
<li><p>How my background application can know what the application currently running in the foreground is.</p></li>
</ol>
<p>Responses from folks with experience would be greatly appreciated.</p>
|
android
|
[4]
|
1,049,777 | 1,049,778 |
Unidentified problem with jQuery's .click() function
|
<p>I'm trying to add an 'onclick' function to an image with jQuery and for some reason it's not sticking. My code looks like:</p>
<pre><code>//create arrow icon/button for li
var img = $('<img></ >').attr('id',i+5)
.attr("src","images/16-arrow-right.png")
.addClass("expImg")
.click(function(){expand(this, 'tdb', 'years', 'danwoods')})
.appendTo(li);
</code></pre>
<p>and the resulting element looks like;</p>
<pre><code><img id="6" src="images/16-arrow-right.png" class="expImg"/>
</code></pre>
<p>It completely leaves out the onclick function, but everything else works fine. Does anyone see a problem with my code, or does the error lie elsewhere? Thanks in advance...</p>
|
jquery
|
[5]
|
2,004,080 | 2,004,081 |
Change the width by title
|
<p>I want make the width of fixed sized element 300 pixel. What is wrong with the code?</p>
<pre><code><script type="text/javascript">
$().ready(function () {
$('@title="Title Name"').css("width", "300px");
});
</code></pre>
|
javascript
|
[3]
|
5,698,795 | 5,698,796 |
I want to call webservice first then generates table view in iphone
|
<p>I wanted to call webservice first then generates table view, How I can achieve this please help me.</p>
|
iphone
|
[8]
|
3,276,366 | 3,276,367 |
PHP Globals and Reference Difference Confusion
|
<p>Could some one please explain to me what the difference in the following is:</p>
<pre><code>$var = 'something';
function myFunc(){
global $var;
// do something
}
</code></pre>
<p>and (note: the reference sign &)</p>
<pre><code>$var = 'something';
function myFunc(&$var){
// do something
}
</code></pre>
<p>I can't understand the difference between these two methods.</p>
<p><strong>Update</strong> </p>
<p>Hmmm... I think i'm getting alittle confused here :)</p>
<pre><code>$var = 1;
$var2 = 2;
function myFunction(){
global $var, $var2;
$var = $var + $var2;
}
</code></pre>
<p><em>// echo $var would return 3 here.</em></p>
<hr>
<pre><code>$var = 1;
$var2 = 2;
function myFunction(&$a, &$b){
$a = $a + $b;
}
</code></pre>
<p><em>// echo $var would return 3 here aswell.</em></p>
<hr>
<p>I understand those part already, But what i don't understand is the difference between these two approaches, am i wrong to assume that these two approaches are technically the same thing, with different concept of how they are wrote by the coder and also how they are handled by PHP?</p>
<p>If i'm wrong to assume this, then it would really help if you could provide better examples, maybe something that can be accomplished using only one of the above approaches?</p>
<p>ok, i noticed one difference while writing <em>This Update</em>, which is that when doing references i can chose new variable names while keeping the pointer to the variable in the functions scope.</p>
|
php
|
[2]
|
2,458,342 | 2,458,343 |
Re-positioning div/ moving div to left and right with JavaScript
|
<p>I am new to javascript and I am trying to start a very simple project which is to display a controllable div that can be moved around using a,w,s,d keys on keyboard. I am currently having problem on how to move around the div because I do not know what attribute to change.</p>
<pre><code>divBar = null;
function detectKey() {
//97 = a
//115 = s
//100 = d
//119 = w
if (event.charCode == 97) {
//a
alert(divBar.position);
}
if (event.charCode == 115) {
//s
}
if (event.charCode == 100) {
//d
}
if (event.charCode == 119) {
//w
}
}
function createDiv() {
divBar = document.createElement("div");
divBar.id = "divBar";
divBar.style.border = "solid 1px #AAAAAA";
divBar.style.backgroundColor = "black";
divBar.style.top = 400;
divBar.style.height = "10px";
divBar.style.width = "100px";
divBar.style.position = "absolute";
document.body.appendChild(divBar);
document.addEventListener("keypress", detectKey, false);
}
</code></pre>
<p>I am not sure to put in that condition statement. so that the div will move to the left, right, up and down.</p>
|
javascript
|
[3]
|
3,256,010 | 3,256,011 |
Getting the name/id of the select that was changed
|
<p>All,
I have the following select:</p>
<pre><code><select name="options_1" id="options_1" class="select_me">
<option>1</option>
<option>2</option>
</select>
</code></pre>
<p>I have multiple selects with the same class on my page. When I change one of these selects I'd like to get the name or ID of the select and then the value that is after the underscore.</p>
<p>Can anyone let me know how to do this? Thanks!</p>
|
jquery
|
[5]
|
5,391,735 | 5,391,736 |
how to make functions with setTimeout() work in sequence?
|
<p>Let's say I have 4 functions, every each of them has loops inside working with <code>setTimeout()</code>. How do I make those functions to run in sequence and not overlap? That is, how do I make each of them execute just after previous one is finished?</p>
<pre><code>function1();
function2();
function3();
function4();
</code></pre>
|
javascript
|
[3]
|
1,455,460 | 1,455,461 |
How does Apple know you are developing iPhone apps on MacOS?
|
<p>I know there is a requirement in their EULA, but I heard about people getting their apps developed on Windows into the app store.</p>
<p>How can Apple find out, or do they even know?</p>
|
iphone
|
[8]
|
935,916 | 935,917 |
How to get the ID of images which are stored in smart phone's library
|
<p>from the beginning I use</p>
<pre><code>Drawable pic = getResources().getDrawable(R.drawable.android);
</code></pre>
<p>to get the drawable object while R.drawable.android means the ID of the picture I put in drawable folder.
However, I would like to get also the drawable object of the images which are stored in library.</p>
<p>do you have any suggestion</p>
|
android
|
[4]
|
4,503,055 | 4,503,056 |
jQuery is not submitting form values with .submit()
|
<p>I have a form with <code>action = post</code> and i am validating it with after validating it I am submitting that form with:</p>
<pre><code>$("#form").submit();
</code></pre>
<p>But it is submitting all fields nulled while I have data in those fields. How can I post those fields filled?</p>
|
jquery
|
[5]
|
3,973,845 | 3,973,846 |
What is the easiest way to get a crash stack trace from Android?
|
<p>Many of my beta testers are non-developers and don't know how to use Eclipse. Is there an EASY way for non-techies to send me stack traces after a crash?</p>
<p>Is Eclipse the only way to see a stack trace for an Android app?</p>
<p>Thanks,</p>
<p>Barry</p>
|
android
|
[4]
|
5,366,735 | 5,366,736 |
VAT validity check
|
<p>I have to build in some VAT formulas in a webpage.
When a user fills in a VAT number, i have to check if it's in the right validity format.</p>
<p>The control for Belgium is already done, but I can't find validity formulas for the Netherlands, France and Luxembourg...</p>
<p>Anyone suggestions?</p>
<p>I use Visual Studio .NET 2008, c#. Visual Basic is fine too :)</p>
|
c#
|
[0]
|
2,038,386 | 2,038,387 |
Change constant, var value in php file
|
<p>I'm writing my own tiny deployment script and I need to change db login and password in db.php file when copying it to remote host. Is it possible to change variable/constant value without hand-made analyzing (preg_replace etc.) text of php file?</p>
<p>I know that PHP have <code>tokenizer</code>, but I have no clue how to use it.</p>
<p>Please help me with some samples.</p>
<p>Any help and suggestions are appreciated.</p>
<p>Thank you.</p>
|
php
|
[2]
|
4,049,592 | 4,049,593 |
Unique element ID to reference later
|
<p>I'm trying to figure out a method of storing a unique reference to each tag on a particular page. I won't have any ability to edit the page content and I'll the generated UID to stay the same on every page refresh.</p>
<p>Since browsers don't generate any kind of UID for elements, I was thinking that the only method to do this would be to execute a script which walks the DOM and creates a UID for each it comes across. I don't know how accurate this will be, especially considering I'll need to ensure it creates the same UID for the tag each time the script crawls the page.</p>
<p>Can anyone think of any other, more accurate ways of mapping a page? </p>
<p>Many thanks.</p>
|
javascript
|
[3]
|
1,858,567 | 1,858,568 |
jQuery div opacity management
|
<p>I am having trouble getting this jQuery to work. I am trying to toggle overlaid divs' visibility. There are five divs and one has the class of 'on' with page load while the rest have the class 'off'. However, when the code executes, the "on" div fades out but the div that should receive the class "on" does not appear. What is the problem?</p>
<pre><code>.on{opacity:1;}
.off{opacity:0;)
$('li.tunes').click(
function() {
$('div.on').animate({"opacity":"0"},800).removeClass('on').addClass('off', function() {
$('div.tunesdiv').removeClass('off').addClass('on')
})
});
</code></pre>
|
jquery
|
[5]
|
2,826,189 | 2,826,190 |
from where to start - iPhone?
|
<blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/1294214/want-to-start-iphone-development">Want to start iPhone development</a><br>
<a href="http://stackoverflow.com/questions/1939/how-to-articles-for-iphone-development-and-objective-c">How-to articles for iPhone development and Objective-C</a> </p>
</blockquote>
<p>hi</p>
<p>i develop for Windows-mobile and Windows-CE for 10 years,</p>
<p>i want to start working with Iphone.</p>
<p>from where to start ? what develop tools i need ? sdk ? books ?</p>
<p>i need some help.</p>
<p>thanks in advance</p>
|
iphone
|
[8]
|
2,598,330 | 2,598,331 |
Referring to the public root in PHP - best practices
|
<p>I've been using the $_SERVER["DOCUMENT_ROOT"] environment variable to refer to the public root in my apps. Now I'm realizing that that's not very reliable. I'm thinking about an approach where I define a constant in my index.php based on a magic constant. Something like that:</p>
<pre><code>define("PUBILC", __DIR__."/");
</code></pre>
<p>I'm not sure about it though.</p>
<p>What approach would you recommend?</p>
|
php
|
[2]
|
2,193,557 | 2,193,558 |
how to call the sharepoint web service GetListItems using objective C
|
<p>Can any one tell me how to call the SharePoint web service <code>GetListItems</code>. I am getting an error message "403 Forbidden" on calling this method</p>
<p>The code for my HTTP header request is:</p>
<pre><code>[theRequest setValue: cookie forHTTPHeaderField:@"Cookie"];
[theRequest setHTTPShouldHandleCookies:YES];
[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[theRequest addValue: saction forHTTPHeaderField:@"SOAPAction"];
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
urlconnection = [NSURLConnection connectionWithRequest:theRequest delegate:self];
</code></pre>
<p>My XML structure for calling the <code>GetListItems</code> methods is:</p>
<pre><code>< listName >listName< /listName >< viewName >< /viewName >< Query />< ViewFields />< rowLimit>< /rowLimit>< QueryOptions>< IncludeAttachmentUrls>TRUE< /IncludeAttachmentUrls>< /QueryOptions>< webID>< /webID>< /GetListItems>< /soap:Body>< /soap:Envelope>
</code></pre>
<p>Can anybody tell me where I am wrong or what else I need to do?</p>
<p>Thanks in advance.</p>
|
iphone
|
[8]
|
3,653,342 | 3,653,343 |
get current position in list of inputs
|
<p>I want to get the value of the input and the position after they 'blur' the input.</p>
<pre><code><span id="blah">
<input type="text">a</input>
<input type="text">b</input>
<input type="text">c</input>
<input type="text">d</input>
...
</span>
$('span input:text').live('blur', function(){
var value = $(this).val();
}
</code></pre>
<p>so if they blur out of c i need it to return the value 'c' and the placement '3' in the list.</p>
<p>i cant change the HTML and the number of inputs may increase.</p>
|
jquery
|
[5]
|
1,255,798 | 1,255,799 |
Cannot login in to my google account on nexus one or acer iconia because of google 2-step verification
|
<p>I am trying to setup my nexus one and acer iconia google email account and I keep getting "Your username and password do not match". I'm pretty sure it's correct and I strongly suspect it's because of the google 2-step verification:</p>
<p><a href="http://www.google.com/support/accounts/bin/static.py?page=guide.cs&guide=1056283&topic=1056284" rel="nofollow">google 2-step verification</a></p>
<p>How can I fix this?</p>
|
android
|
[4]
|
4,250,638 | 4,250,639 |
Submit a form post event using jquery when user types in textbox
|
<p>How do I postback whenever a user types in a textbox to filter results in a div tag. </p>
|
jquery
|
[5]
|
602,648 | 602,649 |
How to get real screen height and width?
|
<pre><code>DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
screenWidth = metrics.widthPixels;
screenHeight = metrics.heightPixels;
</code></pre>
<p>I use these codes to get the height and width of screen</p>
<p>the screen height on my Nexus7 should be 1280 </p>
<p>but it return 1205...</p>
<p>and my minSdkVersion is level 8</p>
<p>so i can't use these method:</p>
<pre><code>Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int screen_width = size.x;
int screen_height = size.y;
</code></pre>
<p>now, how should i get the correct screen size ?</p>
<p>Edit:</p>
<pre><code>if (Build.VERSION.SDK_INT >= 11) {
Point size = new Point();
try {
this.getWindowManager().getDefaultDisplay().getRealSize(size);
screenWidth = size.x;
screenHeight = size.y;
} catch (NoSuchMethodError e) {
Log.i("error", "it can't work");
}
} else {
DisplayMetrics metrics = new DisplayMetrics();
this.getWindowManager().getDefaultDisplay().getMetrics(metrics);
screenWidth = metrics.widthPixels;
screenHeight = metrics.heightPixels;
}
</code></pre>
<p>use it works!</p>
|
android
|
[4]
|
3,723,200 | 3,723,201 |
Too many " or '
|
<p>I seriously suck at getting the quotes and quotation marks correctly. is there a rule that would help me easily remember?</p>
<pre><code>echo "<option value='".$data['recordc']."' . "selected=selected>" '". data['recordc'] ."' . "</option>";
</code></pre>
|
php
|
[2]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.