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,341,585 | 4,341,586 |
Using a pre-defined method to change a property of an object Javascript
|
<p>I have a function which is defined before the object was created. This pre-defined function uses the 'this' keyword to change the value of a property in the object. Inside the object I have a method that calls the predefined method with one argument. However after calling this method and I try to print the value of the property that was supposed to be changed, it still remains the same. How do I fix this?</p>
<pre><code>var setName = function(yourName){
this.name = "Your name is " + yourName;
};
// create an object called `human`
var human = {
name: "Nothing here yet",
setHumanName: function(name) {
setName(name);//Name should be changed now
}
};
human.setHumanName("Emeka");
console.log(human.name); //this does not print the new value of name
</code></pre>
|
javascript
|
[3]
|
1,991,550 | 1,991,551 |
When is the function executed when using jQuery .each()?
|
<p>Given the following jQuery expression</p>
<pre><code> $("form").each(function () {
var info = validationInfo(this);
if (info) {
info.attachValidation();
}
});
</code></pre>
<p>The selector chooses all forms on the page, and then for each 'form' found, it attaches a function.</p>
<p>My question is when does the JS in this function actually run? Does the JS in the function execute when it is attached?</p>
|
jquery
|
[5]
|
1,621,314 | 1,621,315 |
Cluster member variables declaration by their type useful or not?
|
<p>Please have a look a the following code sample, executed on a Windows-32 system using Visual Studio 2010:</p>
<pre><code>#include <iostream>
using namespace std;
class LogicallyClustered
{
bool _fA;
int _nA;
char _cA;
bool _fB;
int _nB;
char _cB;
};
class TypeClustered
{
bool _fA;
bool _fB;
char _cA;
char _cB;
int _nA;
int _nB;
};
int main(int argc, char* argv[])
{
cout << sizeof(LogicallyClustered) << endl; // 20
cout << sizeof(TypeClustered) << endl; // 12
return 0;
}
</code></pre>
<hr>
<h1>Question 1</h1>
<p>The <code>sizeof</code> the two classes varies because the compiler is inserting padding bytes to achieve an optimized memory allignment of the variables. Is this correct?</p>
<h1>Question 2</h1>
<p>Why is the memory footprint smaller if I cluster the variables by type as in <code>class TypeClustered</code>?</p>
<h1>Question 3</h1>
<p>Is it a good rule of thumb to always cluster member variables according to their type?
Should I also sort them according to their size ascending (bool, char, int, double...)?</p>
<p><strong>EDIT</strong></p>
<h1>Additional Question 4</h1>
<p>A smaller memory footprint will improve data cache efficiency, since more objects can be cached and you avoid full memory accesses into "slow" RAM. So could the ordering and grouping of the member declaration can be considered as a (small) but easy to achieve performance optimization?</p>
|
c++
|
[6]
|
4,260,094 | 4,260,095 |
Reduce volume of received call's ringtone?
|
<p>I want to lower the volume in in-call mode
So I tried this code:</p>
<pre><code>AudioManager audio = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
audio.setStreamVolume(audio.STREAM_VOICE_CALL, -1, 0);
</code></pre>
<p>But In-call volume is set to 0 and still loud.
Have any idea? I don't want to set the mode of ringtone to silent, just turned down.</p>
|
android
|
[4]
|
2,198,204 | 2,198,205 |
for each JavaScript Support in IE?
|
<p>I have this code:</p>
<pre><code><script>
function toggle(source) {
checkboxes = document.getElementsByName('DG1');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
checkboxes = document.getElementsByName('DG2');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
checkboxes = document.getElementsByName('DG3');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
checkboxes = document.getElementsByName('DG4');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
checkboxes = document.getElementsByName('DG5');
for each(var checkbox in checkboxes)
checkbox.checked = source.checked;
}
</script>
<input type="checkbox" onClick="toggle(this)" />Select All<br/>
<form method=POST action="DGUsageServlet">
<input type="checkbox" name="DG1">DG1</input>
<input type="checkbox" name="DG2">DG2</input>
<input type="checkbox" name="DG3">DG3</input>
<input type="checkbox" name="DG4">DG4</input>
<input type="checkbox" name="DG5">DG5</input>
</form>
</code></pre>
<p>How can I make the above script to work in IE?</p>
|
javascript
|
[3]
|
4,740,887 | 4,740,888 |
java exception handling and continuation
|
<p>I have a Java Program where I get data from a different source. some times while reading I see Exception and the program is exiting.
Mine is in a program that runs every 10minutes.</p>
<pre><code>Public static void main(Strings[] args)
{
...readsource();
}
Private static void readsource() throws IOException
{
...
}
</code></pre>
<p>Issue:
I am able to get/See the Exception. But I want the program to continue
To that what is the best logic? I dont see try-catch-finally also is not addressing ..I want the program to continue even after seing the exception (I mean the next iteration should continue). This looks to be a Basic issue not sure how to address this...</p>
|
java
|
[1]
|
5,396,914 | 5,396,915 |
zlib inflate error : Z_DATA_ERROR randomly
|
<p>I have an application that compresses and sends data via socket and data received is written in remote machine. During recovery, this data is decompressed and retrieved. Compression/Decompression is done using "zlib".But during decompression I face the following problem randomly:</p>
<p><strong>zlib inflate() fails with error "Z_DATA_ERROR" for binary files like .xls,.qbw etc.</strong></p>
<p>The application compresses data in blocks say "1024" bytes in a loop with data read from the file and decompresses in the same way.From the forum posts, I found that one reason for Z_DATA_ERROR is due to data corruption. As of now, to avoid this problem, we have introduced CRC check of data compressed during send and what is received.
Any possible reasons on why this happens is really appreciated! (as this occurs randomly and for the same file, it works the other time around).Is it bcoz of incorrect handling of zlib inflate() and deflate() ?
<strong>Note: If needed,will post the exact code snippet for further analysis!</strong></p>
<p>Thanks...Udhai</p>
|
c++
|
[6]
|
4,351,838 | 4,351,839 |
Issue with spaces in JavaScript function
|
<p>I have created JavaScript code for validation of a simple text field. The issue is when I want to skip spaces in field,</p>
<pre><code>var strFilter = /^[A-Za-z]*$/;
var chkVal2 = document.getElementById("fname").value.replace(/^\s+|\s+$/g, "");
if ((!strFilter.test(chkVal2)) || (chkVal2 == "")) {
alert("Please enter a valid first name\r\n (only characters)");
document.getElementById("fname").style.background = "#DFE32D";
document.getElementById("fname").focus();
document.getElementById("fname").value = null;
return false;
}
</code></pre>
<p>Here I want, when the value is checked, it removes all spaces in ID. The script is going well, but it's not removing spaces.</p>
|
javascript
|
[3]
|
329,629 | 329,630 |
Why doesn't this if statement ever get hit?
|
<pre><code>foreach (Dictionary<string, object> dictionary in listOfDictionaries)
{
if( object.Equals(dictionary, listOfDictionaries.Last() )
{
//Do something on last iteration of foreach loop.
}
}
</code></pre>
<p>I realized fairly soon on that I wanted a reference equals, but it still brought up the question of how this code could not be hit. Does object.Equals not implicitly know how to compare two Dictionaries, and thus returns not equal?</p>
|
c#
|
[0]
|
1,460,734 | 1,460,735 |
contact exists in contacts
|
<p>I have phone number. Is there any way to check whether the phone number exists in contacts database in the device or not? Depending on that I need have move further in my app. Please suggest or if any one can have sample code snippet please provide.</p>
<p>The below is the code I wrote:</p>
<pre><code>public boolean contactExists(Activity _activity, String number) {
String[] mPhoneNumberProjection = { PhoneLookup._ID, PhoneLookup.NUMBER, PhoneLookup.DISPLAY_NAME };
Cursor cur = _activity.getContentResolver().query(number, mPhoneNumberProjection, null, null, null);
try {
if (cur.moveToFirst()) {
return true;
}
} finally {
if (cur != null)
cur.close();
}
return false;
}// contactExists
</code></pre>
<p>Thanks in Advance...</p>
|
android
|
[4]
|
5,214,503 | 5,214,504 |
Storing "binary" data type in C program
|
<p>I need to create a program that converts one number system to other number systems. I used itoa in Windows (Dev C++) and my only problem is that I do not know how to convert binary numbers to other number systems. All the other number systems conversion work accordingly. Does this involve something like storing the input to be converted using %?</p>
<p>Here is a snippet of my work:</p>
<pre><code>case 2:
{
printf("\nEnter a binary number: ");
scanf("%d", &num);
itoa(num,buffer,8);
printf("\nOctal %s",buffer);
itoa(num,buffer,10);
printf("\nDecimal %s",buffer);
itoa(num,buffer,16);
printf("\nHexadecimal %s \n",buffer);
break;
}
</code></pre>
<p>For decimal I used %d, for octal I used %o and for hexadecimal I used %x. What could be the correct one for binary? Thanks for future answers!</p>
|
c++
|
[6]
|
4,717,106 | 4,717,107 |
store the values in a list from database
|
<p>in my database there is a table called account .in this table 2 fields user and account number . the single user has multiple account number. i want to display all the account number of a particular user in my jsp page </p>
|
java
|
[1]
|
2,050,672 | 2,050,673 |
Page selector PHP
|
<p>i need to be able to get the file name and the "page" variable in one string or something. Because i need to check if you come from index.php or another page. The problem with my code is that the statement will always be "true" because "$file" only contains the file name and not the file name and the $_GET variables e.g (index.php?page=news). Any ideas guys?</p>
<pre><code>$file = mysql_real_escape_string(basename(__FILE__));
if ($file != "index.php")
$page = mysql_real_escape_string($_GET['page']);
else
$page = "index";
</code></pre>
|
php
|
[2]
|
5,989,591 | 5,989,592 |
properties file is returning null
|
<p>i am trying to read values from properties file and
when i tried to run this program
its giving the output as<br>
<code>null</code></p>
<pre><code>import java.io.FileInputStream;
import java.util.Properties;
public class JavaApplication1 {
final private static String osName = System.getProperty("os.name");
static final Properties configFile = new Properties() {
{
try {
configFile.load(new FileInputStream("config.properties"));
} catch (Exception e) {
}
}
};
private static String DIR = osName.equals("Linux") ? configFile.getProperty("tempDirForLinux") : configFile.getProperty("tempDirForWindows");
public static void main(String[] args) {
System.out.println(DIR);
}
}
</code></pre>
|
java
|
[1]
|
362,767 | 362,768 |
Uninstantiated class attribute
|
<p>Hello I need an uninstantiated class attribute and I am doing this:</p>
<pre><code>>>> class X:
... def __init__(self, y=None):
... self.y = list()
</code></pre>
<p>Is this ok? If no, is there another way of doing it. I can't instantiate this attribute in <code>__init__</code> cause I would be appending to this later.</p>
|
python
|
[7]
|
5,180,347 | 5,180,348 |
move jQuery code to a function
|
<p>I have the following jQuery code:</p>
<pre><code>$('.show-additional-link').click(function(){
$(this).parent().next().slideDown();
$(this).hide();
return false;
});
</code></pre>
<p>HTML:</p>
<pre><code><div class="row">
<label for="native_language">Select</label>
<select name="native_language" id="native_language">
<option value="">Any</option>
<option value="1">English</option>
</select>
<a class="show-additional-link" href="#">Select Additional Languages</a>
</div>
<div id="additional-languages" style="display: none;">
<div class="row">
<!-- additional language checkboxes -->
</div>
</div>
</code></pre>
<p>I would like to move the contents of my jQuery code (within the 'click' function) in to a separate function, as I will need to call it again on page load (after the form is submitted, so that the DIV is shown again automatically).</p>
<p>I'm having trouble with this - can anyone help?</p>
|
jquery
|
[5]
|
2,911,186 | 2,911,187 |
C#: How would I get the current time into a string?
|
<p>How could I get the current h/m/s AM time into a string? And maybe also the date in numeric form (01/02/09) into another one?</p>
|
c#
|
[0]
|
2,136,721 | 2,136,722 |
python try multiple statements with same possible error
|
<p>I'm trying to set some booleans based on whether or not an object has attributes:</p>
<pre><code>try:
att1 = myobj.att1
att2 = myobj.att2
att3 = myobj.att3
except AttributeError:
pass
</code></pre>
<p>However, if <code>att1</code> is not present and throws an <code>AttributeError</code>, it won't try the other two. Must I loop (is there no way to do it in one <code>try</code> statement?)</p>
<p>Thanks!</p>
|
python
|
[7]
|
4,714,987 | 4,714,988 |
How to read from a csv file and write into text file in php?
|
<p>I need to read the below data from csv file</p>
<p>"here goes the question,option-1,option-2,option-3,option-4,B"</p>
<p>and write it into a text file exactly as follows</p>
<p>here goes the question</p>
<p>A) option-1</p>
<p>B) option-2</p>
<p>C) option-3</p>
<p>D) option-4</p>
<p>Correct Answer: B</p>
<p>can this be done using php?</p>
|
php
|
[2]
|
5,775,201 | 5,775,202 |
How to write this array as a php loop
|
<p>I have the follow array, how do I write a loop to list the name and id?</p>
<pre><code>Array
(
[data] => Array
(
[0] => Array
(
[name] => Test name
[id] => 110
)
[1] => Array
(
[name] => Test name 2
[id] => 111
)
[2] => Array
(
[name] => Test name 3
[id] => 124
)
[3] => Array
(
[name] => Test name 4
[id] => 105
)
[4] => Array
(
[name] => Test name 5
[id] => 56
)
)
</code></pre>
<p>)</p>
<p>Thanks for any help :)</p>
|
php
|
[2]
|
221,524 | 221,525 |
German characters not display using print_r( )
|
<p>German characters are not displaying when using <code>print_r( $data->sheets[0]['cells'] );</code> and I used UTF-8 but it does not work. <strong>eg.:</strong> "Stra�e, Wedemarkstra�e".</p>
|
php
|
[2]
|
4,945,817 | 4,945,818 |
Generating and Displaying labels and corresponding textboxes at runtime?
|
<p>I want to generate labels and corresponding textboxes at runtime after fetching data from tables.How do i do that?</p>
|
asp.net
|
[9]
|
4,345,863 | 4,345,864 |
How to know if radio is checked
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2272507/find-out-if-radio-button-is-checked-with-jquery">Find out if radio button is checked with JQuery?</a> </p>
</blockquote>
<p>Hi, i want to make a div appear with jquery when one of 3 radio buttons is pressed.. </p>
<p>I have 3 radio buttons, image video and sound, when the user clicks image, a div will appear.</p>
<p>how can i use jquery for this. I know how to do the div appearing part, just not the checking if the specific radio button is checked.</p>
<p>Bascially, how do i check if a specific radio is checked.</p>
<p>Thanks</p>
|
jquery
|
[5]
|
617,874 | 617,875 |
My programs won't work on 32-bit computers
|
<p>I'm using Visual Studio 2012, but it seems that any program I compile won't work on 32-bit type computers, it only works on 64-bit type... I was wondering, is there any fix to this? I'd really appreciate it...</p>
<p>-Thanks in advance.</p>
<p><strong>//Edit:</strong> <a href="http://i.stack.imgur.com/sH9sm.png" rel="nofollow">http://i.stack.imgur.com/sH9sm.png</a></p>
<p>I have the 32-bit type enabled as well, and still doesn't work...</p>
|
c#
|
[0]
|
633,469 | 633,470 |
How to obtain lang attribute in html using JavaScript?
|
<p>How to obtain lang attribute in html using JavaScript?</p>
<pre><code><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
</code></pre>
|
javascript
|
[3]
|
3,210,470 | 3,210,471 |
How to communicate back to a service from a broadcast receiver?
|
<p>Hope someone can help me out here. I will try to be concise!</p>
<p>I have a widget which starts a service. The service registers two broadcast receivers. I would like to send back intents from the receivers to the service, so that the service can react.</p>
<p>I believe I read somewhere that 'starting' the service multiple times works, e.g. do the following in the receivers:</p>
<pre><code>serviceIntent.setAction("me.SERVICE");
intent.putExtra("me.SERVICE", somedata);
context.startService(serviceIntent);
</code></pre>
<p>I remember reading (on some blog) that this won't start a new service, but will simply pass the intent to the already running service. Is this correct? Is it a bad way of doing it? Is there a better way?</p>
<p>Thanks very much!</p>
<p>Jack</p>
|
android
|
[4]
|
2,990,635 | 2,990,636 |
What can of selector do I need to select for the presence of an ID and a class?
|
<p>I would like to check for </p>
<pre><code>#dialogOrder
</code></pre>
<p>and </p>
<pre><code>.menu-mask
</code></pre>
<p>Is the following valid and is there an even easier shortcut ?</p>
<pre><code>$("#dialogOrder").$(".menu-mask")
</code></pre>
<p><strong>Update</strong></p>
<p>I just realized I also need to select the element only if it is on a form with the class of menu. Sorry that this was not part of the original question. I hope someone can help me.</p>
|
jquery
|
[5]
|
572,945 | 572,946 |
direct file download protection
|
<p>I have a folder for downloads on my server, i want to prevent direct access to that folder so i am makin it pass-protected with htaccess and i will push download with a php script. But i have some questions regarding <code>mkdir</code> and <code>file_exists</code></p>
<p>Do mkdir and file_exists works good for pass-protected folders ?</p>
<p>and</p>
<p>would i get any error while uploading file to that folder ?</p>
<p>AND</p>
<p>is this a good way of preventing direct access ?</p>
<p>thanks</p>
|
php
|
[2]
|
5,257,005 | 5,257,006 |
PHP if statement - can I use it like this?
|
<pre><code>if(!isset($_GET['set']) && (($_GET['set'] != 'on') || ($_GET['set'] != 'off'))){
header('Location: http://google.com');
exit;
}
</code></pre>
<p>What I want to check is if set has not set and value is not on or off. Is this right or is there any other way?</p>
|
php
|
[2]
|
4,072,509 | 4,072,510 |
Need to show progress bar while page loads
|
<p>I am new to Javascript.</p>
<p>I am having a html which shows a report graph.</p>
<p>It takes 5-10 secs for the report to generate in html.</p>
<p>I want to show progress bar before the report generates.</p>
|
javascript
|
[3]
|
5,753,446 | 5,753,447 |
How to get Command Functionality from a Panel
|
<p>Is there a <code>Panel</code> or any container with <code>CommandName</code>, <code>CommandArguments</code> instead of using Buttons (LinkButton, ImageButton, ...)?</p>
<p>I want to add a column in a GridView to make selection for the row, the whole cell's rectangle instead of a Select link.</p>
|
asp.net
|
[9]
|
1,043,782 | 1,043,783 |
Accessing an Object's attribute value using an expression
|
<p>Consider the following code:</p>
<pre><code>Class Demo
{
Person person = new Person("foo"); // assume Person class has a 'name' field.
//Now, how do I get the value of a field, using some expression.
String expression = "person.name";
}
</code></pre>
<p>Now, I want to evaluate the 'expression' to get the value of the 'name' attribute. Can anyone tell how it can be done?</p>
<p>--
Updated: the 'expression' string I'll be getting it from an XML file. So, will it be possible to use 'Reflection' in that scenario also? the 'expression' string may go into deeper levels also, like 'person.birthday.date'.</p>
|
java
|
[1]
|
1,316,678 | 1,316,679 |
writing to a message router through a socket
|
<p>i was trying to write a program by which i can write some messages to a MessageRouter through a socket.How can that be accomplished ? i have written the socket program to connect a client to the server through a socket.But will that actually do what i need..? By making the MessageRouter run on the server side ,can i accomplish my goal....?</p>
<p>Hope you have understood what my requirement is..?
Please do share any information you have regarding this.?
Thanks.</p>
|
java
|
[1]
|
3,060,799 | 3,060,800 |
What is the best package for game developing in Java?
|
<p>What is the best package for game developing in Java; I work with JITTers but it's too weak for example how can I make a game such as <a href="http://splintercell.us.ubi.com" rel="nofollow">Splinter Cell Conviction</a>? :)</p>
<p>What is the best in Java?</p>
|
java
|
[1]
|
3,034,890 | 3,034,891 |
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]
|
5,090,258 | 5,090,259 |
jQuery - Outputting jquery results to a hidden form field
|
<p>I was wondering how i could output the results from my jQuery to a hidden form field so i can then shove it into the database.</p>
<p>Im using the Calendar function found here - <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html" rel="nofollow">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html</a></p>
<p>Apparently the following code gets the array, but im not sure how to forward it to the hidden field.</p>
<pre><code>$('.date-picker').dpGetSelected()
</code></pre>
<p>From what i can tell i want the dpGetSelected to run with when the following is triggered dpClosed</p>
<p>Its all a bit confusing to me.</p>
<p>Any help would be great.</p>
<p>Cheers,</p>
|
jquery
|
[5]
|
3,368,241 | 3,368,242 |
How to find number of characters in a div line by line?
|
<p>here is the image to explain it</p>
<p><img src="http://i.stack.imgur.com/BVmtd.png" alt="div line"></p>
<pre><code><div id="tshirt">
<div id="text-wrapper">
<p id="tshirtover">Nothing is impossible unless we try it</p>
</div>
</div>
</code></pre>
<p>Is there any way to find the length of the first line?</p>
<p>I tried below jQuery function. It's giving the entire length of the string. </p>
<pre><code>$("#tshirtover").text().length;
</code></pre>
<p>But i need to find only the first line. Is it possible to get it?</p>
|
jquery
|
[5]
|
1,624,452 | 1,624,453 |
Provide implementation to pure virtual function through multiple inheriting another class
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3291568/import-a-definition-of-a-function-from-a-base-class-to-implement-abstract-inte">“import” a definition of a function from a base class to implement abstract interface (multiple inheritance in C++)</a> </p>
</blockquote>
<p>Suppose I have a base class</p>
<pre><code>struct Base1 { virtual void f() = 0; };
</code></pre>
<p>and another class that provides implementation for function <code>f</code>:</p>
<pre><code>struct Base2 { virtual void f() {} };
</code></pre>
<p>I wanted to use <code>Base2::f</code> to implement <code>Base1::f</code> through multiple inheritance:</p>
<pre><code>struct C : Base1, Base2 {};
</code></pre>
<p>But look like compiler doesn't do what I expected, and <code>C</code> is still abstract.</p>
<p>So what is the best way to provide implementation to a pure virtual through another class?</p>
<p>Thanks.</p>
|
c++
|
[6]
|
705,250 | 705,251 |
remove img tag using .remove() attribute jquery
|
<p>I am attempting to remove a <code><img></code> tag from a function using its <code>id</code> with <code>.remove()</code> attribute but it doesn't work. You can find a simple code of what I am doing below:</p>
<pre><code><script>
function verify(img)
{
if(/*somecondition*/)
removetag_setother();
else
//do something
}
function removetag_setother()
{
$("#1").remove();
text="<p>hello</p>";
$("body").append(text);
}
</script>
<body>
<img id="1" onclick="verify(this)" src="image1.png">
</body>
</code></pre>
<p>Reviewing the console logging I got this message:
<strong>ReferenceError: $ is not defined</strong></p>
|
jquery
|
[5]
|
1,628,992 | 1,628,993 |
android mediaplayer bacgroung loading
|
<p>how can i load a file into mediaplayer while showing a splash screen in the foregroung ,i mean after splash sceen i want to display video on the screen directly without wait </p>
|
android
|
[4]
|
4,507,443 | 4,507,444 |
converting javascript code into html output?
|
<p>I can use javascript to get html tags and divs to appear but I want to put some text in a div.</p>
<pre><code> this.buildDomModel(this.elements["pans"],
{ tag: "div", className: "panel",
id: "tabs",
childs: [
{ tag: "div", id: "page_button",
className: "box",
childs: [
{ tag: "div", className: "tab_left" },
{ tag: "div", className: "tab_middle",
{ tag: "div", className: "tab_right" }
]},
]
</code></pre>
<p>So how do I add text to this? I want: </p>
<pre><code><div class="tab_title">Sample text</div>
</code></pre>
<p>to appear in my html within the div tag with classname tab_middle. </p>
<p>How do I achieve this?</p>
<p>Also, if I create several of these "tab-titles" with sample text how do I allign them to the centre of the screen.</p>
<p>Thank so much. As you can tell I am a noice at javascript. I do have some basic html knowledge though. Thanks hope someone can help been struggling through books all day</p>
|
javascript
|
[3]
|
1,789,053 | 1,789,054 |
Garbage appears in vector after inserting result of operator
|
<p>I have an object with an operator defined like this:</p>
<pre><code>P& operator +(const P &rhs) {
return P(x + rhs.x, y + rhs.y, z + rhs.z);
}
</code></pre>
<p>It does not have custom copy or assignment operators.</p>
<p>After I assign directly the result of an addition inside the vector, garbage appears inside it.</p>
<pre><code>P p1(1.0, 0.0, 0.0);
P p2(0.0, 0.0, 0.0);
vector<P> v(1);
v[0] = p1 + p2; // v[0] now contains garbage.
</code></pre>
<p>If I do it through a variable, everything is as expected.</p>
<pre><code>vector<P> u(1);
P q = p1 + p2;
u[0] = q; // u[0] contains correct value.
</code></pre>
<p>What can be the reason for such behavior? What is the difference between the two cases?</p>
|
c++
|
[6]
|
1,590,960 | 1,590,961 |
Why does java have an int and int Integer datatype and can I move data from one to another?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7121581/why-can-integer-and-int-be-used-interchangably">Why can Integer and int be used interchangably?</a> </p>
</blockquote>
<p>I am trying to understand the difference between these. Can I declare something to be an int for example and then compare this with a number that I put in an Integer? Also why does Java have the two. Why not just combine these?</p>
<p>Can someone help me by showing me a 3-4 line code example of how each is used?</p>
|
java
|
[1]
|
332,416 | 332,417 |
How do I check/grant logon as service rights in a 64bit environment
|
<p>I am running into a wall with the whole p/invoke issue. I need to do this programmatically in C#.</p>
|
c#
|
[0]
|
3,324,377 | 3,324,378 |
split twice in the same expression?
|
<p>Imagine I have the following:</p>
<pre><code>inFile = "/adda/adas/sdas/hello.txt"
# that instruction give me hello.txt
Name = inFile.name.split("/") [-1]
# that one give me the name I want - just hello
Name1 = Name.split(".") [0]
</code></pre>
<p>Is there any chance to simplify that doing the same job in just one expression?</p>
|
python
|
[7]
|
2,206,078 | 2,206,079 |
how to convert seconds into date and time format in java
|
<p>i have seconds since 1970 january 1,then i need to convert that seconds into date and time format in java.Suppose the seconds are </p>
<pre>
1320105600
</pre>
<p>Then it should display that seconds in the below format</p>
<pre>
Friday,November 4,2011 5:00,AM
</pre>
<p>Any idea is Appreciated.</p>
|
java
|
[1]
|
613,661 | 613,662 |
get data from generated hashcode()
|
<p>i have a string(name str) and i generate hashcode(name H) from that ,
i want recieve orginal string(name str) from recieved hashcode(name H)</p>
|
c#
|
[0]
|
2,567,950 | 2,567,951 |
How to get a part of id element using jQuery?
|
<p>How I can get a "Some text" from span with id="old-[id]" and put it in id="new-[id]" ?</p>
<pre><code><span id="old-1">Some text</span>
<span id="new-1"></span>
<span id="old-5">Some text</span>
<span id="new-5"></span>
</code></pre>
<p>I don't know how to get a digital part of <code>id</code> without <code>substring()</code> function.
I think exists is more correct solution.
Thanks.</p>
|
jquery
|
[5]
|
5,363,935 | 5,363,936 |
Why swap don't use Xor operation in C++
|
<p>I've learned that Xor operation can be used to implement effective swap function. like this:</p>
<pre><code>template<class T>
void swap(T& a, T& b)
{
a = a^b;
b = a^b;
a = a^b;
}
</code></pre>
<p>But the implementation of swap all i can found on the internet is essentially like this:</p>
<pre><code>template<class T>
void swap(T& a, T& b)
{
T temp(a);
a = b;
b = temp;
}
</code></pre>
<p>It seems that the compiler didn't generate the same code for the two form above because I tested it on VC++ 2010 and the first one is done the job more quickly(and is more quickly than std::swap). Is there portable or any other problem with first one? Feel free to correct any of my mistake cause i'm not an English native and not good at C++.</p>
|
c++
|
[6]
|
1,986,818 | 1,986,819 |
How to install application remotely on my client android devices?
|
<p>Is there any way to remotely deploy/install on the client Android devices? </p>
<p>In case of BlackBerry this could potentially be done using the BES server to remotely deploy the applications.</p>
|
android
|
[4]
|
1,026,421 | 1,026,422 |
ASP.NET: Bind HyperLinkColumn to more than one field
|
<p>Using ASP.NET and the DataGrid, how do I bind a HyperLinkColumn to more than one field?</p>
<pre><code> Dim detail As New HyperLinkColumn
With detail
.Text = "View Details"
.HeaderText = ""
.NavigateUrl = "\TeamDetail.aspx?Account={0}&Broker={1}"
.DataNavigateUrlField = "AccountKey, BrokerNumberKey"
End With
</code></pre>
<p>I was hoping for an data-binding event on HyperLinkColumn but no such luck.</p>
|
asp.net
|
[9]
|
3,360,408 | 3,360,409 |
how to convert .java file to a .class file
|
<p>can anyone tell me how I can convert a .java file into .class file with an executable bytecode.</p>
<p>Thanks</p>
|
java
|
[1]
|
4,558,830 | 4,558,831 |
How to automate Image buttons using Pywinauto in python
|
<p>I have window, In window contains to image buttons a and b, So how to automate using pywinauto</p>
|
python
|
[7]
|
2,621,374 | 2,621,375 |
Get range of dates by month between range of dates
|
<p>I have these dates:</p>
<pre>
start date: 5/08/2011
end date: 16/11/2011
</pre>
<p>I need get the follow ranges according to the month dynamically:</p>
<pre>
5/08/2011-31/08/2011
1/09/2011-30/09/2011
1/10/2011-31/10/2011
1/11/2011-16/11/2011
</pre>
<p>I need get ranges of dates dynamically by month from a start date and end date.</p>
<p>Can you help me? Thanks.</p>
|
php
|
[2]
|
2,325,783 | 2,325,784 |
Can Java Array objects be created dynamically at Runtime?
|
<p>Can I do this in Java?</p>
<p><strong>At Runtime:</strong></p>
<p><code>int length</code> = some arithmetic that loads length</p>
<p>then I use length to do this:</p>
<pre><code>byte [] b = new byte[length];
</code></pre>
<p>Will this throw an Exception at Runtime? If so which one?</p>
|
java
|
[1]
|
6,022,488 | 6,022,489 |
WebBrowser control manipulation
|
<p>I use a webbrowser control in C# to input text into forms, click on forms, etc to automate some tasks. But with a webbrowser control it takes forever for pages to load. How can I speed things up. Is it possible to login to a website using webrequest? I know it can post data but will it consider it to be logged in. If I used a webclient control and downloaded the source code to a web page. Will it download the normal page or the logged in page?</p>
<p>Also whenever I download a page using webclient, certain elements dont load (some images/forms) unless the page was accessed in a browser. Is there a way around that?</p>
<p>@John Saunders
Its not the wpf version.
I navigate to websites with the Navigate function, from there I can access elements in the page such as:</p>
<pre><code>HtmlElementCollection links = webBrowser.Document.GetElementsByTagName("a");
if(links[index].InnerText == "some link value")
links[index].InvokeMember("click");
</code></pre>
<p>That is some pseudo code for following a specific link on a page.
Its just too slow. Takes easily 10-20 seconds for a page to load.</p>
|
c#
|
[0]
|
1,299,743 | 1,299,744 |
Looking for javascript techniques
|
<p>I'm trying to learn some fresh and hacky javascript techniques and on my quest to do so, here is a function I mocked up:</p>
<pre><code>function doAction(index) {
for(var a = Array.prototype.slice.call(arguments, 1),
i = 0, r = [], l = a.length; i < l; i++)
r.push(a[i][index]);
return r;
}
doAction(2, ['a','b','c'],['a','b','c'],['a','b','c']) //==> ["c", "c", "c"]
</code></pre>
<p>This is basically what it does: get every nth element from a number of arrays and return them in a new one.</p>
<p>I would like to improve this function with freaky ninja-style ideas, not necessarily shorten the code, but rather optimize it. (You most probably already noticed the infamous <code>Array.prototype.slice</code> thingy);</p>
<p>As English is not my native tongue, I would also like a decent name for the action performed by this function. Thanks in advance guys (and women!)</p>
<p>Oh, here's a Fiddle: <a href="http://jsfiddle.net/Exv7Z/" rel="nofollow">http://jsfiddle.net/Exv7Z/</a></p>
<p>EDIT: Talking about optimizing things... (Idea from the genius in the comments)</p>
<pre><code>function doAction(index) {
return Array.prototype.slice.call(arguments, 1).map(function(b) {
return b[index];
});
}
</code></pre>
|
javascript
|
[3]
|
5,448,781 | 5,448,782 |
Ksoap2 socket not connected exception in android with .Net soap webservice
|
<p>i have done the following code in android for connecting to .net soap web service but it gives an errorr java.net.sockettimeoutexception : Socket not connected. </p>
<p>my code</p>
<pre><code>package com.hello;
import android.app.Activity;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.os.Bundle;
import android.widget.TextView;
public class HelloWorldActivity extends Activity {
/** Called when the activity is first created. */
private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private static final String METHOD_NAME = "HelloWorld";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://x.x.x.x/HelloWebService/HelloWebService.asmx";
public TextView mResult;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mResult=(TextView)findViewById(R.id.textView2);
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
String result=(String)envelope.getResponse();
mResult.setText("Content:" +result);
}
catch (Exception e)
{
mResult.setText(e.toString());
}
}
}
</code></pre>
<p>Help me please...!</p>
|
android
|
[4]
|
5,163,659 | 5,163,660 |
What is a good javascript editor for editing custom DSL code?
|
<p>I'm looking for a nice / customisable editor to put on a web page for editing scripts for a custom DSL. Ideally with syntax highlighting (and intellisense would be great! ) </p>
<p>Anyone know of anything suitable?</p>
|
javascript
|
[3]
|
3,572,154 | 3,572,155 |
iphone application to build
|
<p>am working with a friend of mine, to make an iphone application, we have the idea but we lack technical experience and we were wondering where we could find such help? is there a company we can contact or search for that provide atleast concultancy services as a start </p>
|
iphone
|
[8]
|
236,192 | 236,193 |
trying to make a C++ program to convert a 4 digit octal number to decimal
|
<p>This here is my code, I have tried googling it but i can find why my code doesnt convert the number properly. however it complies fine. could you please tell me why it is not working and what i should do to fix it. </p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
char a = 0;
char b = 0;
char c = 0;
char d = 0;
cout << "Enter 4 digit octal number ";
cin >> a >> b >> c >> d;
cout << "Decimal form of that number: " << (a * 512) + (b * 64) + (c * 8) + d << endl;
return 0;
}
</code></pre>
|
c++
|
[6]
|
2,042,704 | 2,042,705 |
Project some fields from an array
|
<pre><code>slecteditem{ id:10, name:"sji" }
</code></pre>
<p>i have an array of slecteditem(each element with different values)</p>
<p>from this i have to create an Array of ids</p>
<p>how can i achive this uisng jqerry </p>
|
jquery
|
[5]
|
1,512,460 | 1,512,461 |
javascript function scope and overwriting
|
<p>I have some javascript like this:</p>
<pre><code><script>
var num = 0;
if(num==0){
function lol(){
alert("lol");
}
} else {
function lol(){
alert("haha");
}
}
</script>
</code></pre>
<p>Then, later in the page I have:</p>
<pre><code><script>lol();</script>
</code></pre>
<p>How do I ensure that the first function isn't always overwritten by the second in the else statement?</p>
<p>Thanks</p>
|
javascript
|
[3]
|
3,498,739 | 3,498,740 |
Javascript: Convert a number into a well formatted string
|
<p>In javascript, I have some numbers.</p>
<p>23, 100000, 5000, 45.543 </p>
<p>I want to convert each number into a well-formatted string
e.g.</p>
<p>'23.00', '1,000,000.00', '5,000.00' , '45.54'</p>
<p>How do I do that in javascript ? </p>
<p>I can do it easily in java (where there is a textformatter class for this)</p>
<p>thanks,</p>
|
javascript
|
[3]
|
4,178,201 | 4,178,202 |
Using PDO for Data Management
|
<p>This question is more a design oriented question than a code specific question. I am new to PHP and I am planning to use PDO as a data access layer. Say for instance I have a class called CITY. Now if I need to create an instance of this class, what is the best technique. </p>
<ul>
<li>Should have a singleton DB access class which is used to write and read data from the db layer. </li>
<li>OR should I delegate it to the individual class object. For example if I invoke city.save() (city is a class), then the city class will handle the saving of that city object's data into the database. </li>
</ul>
<p>Excuse my ignorance but i have a java background and therefore trying to understand what is the best design principle for data management when using php. </p>
|
php
|
[2]
|
1,101,325 | 1,101,326 |
Multithreading - StringBuffer and StringBuilder
|
<blockquote>
<p>If your text can change and will only
be accessed from a single thread, use
a StringBuilder because StringBuilder
is unsynchronized.</p>
<p>If your text can changes, and will be
accessed from multiple threads, use a
StringBuffer because StringBuffer is
synchronous.</p>
</blockquote>
<p>What does it mean by multiple threads? Can anyone explain me over this? I mean is it something two methods or two programs trying to access another method at same time.</p>
|
java
|
[1]
|
1,894,416 | 1,894,417 |
Clustering in Google Maps
|
<p>I have developed an application using google maps v3. Here, I need to show some markers at the initial zoom level. The problem is on mouseover of the marker, I need to show a div content. The div is not properly aligned, that is for the marker on the extreme left or right, the div is getting partly hidden. How do I show the div with proper alignment viz., inside the map itself? could someone help me with this please? Thanks in advance.</p>
|
javascript
|
[3]
|
4,831,039 | 4,831,040 |
How can I make Android application data persistent?
|
<p>I am new to Android development and am creating a "ToDoList" app in Android.</p>
<p>I used a SQLlite database to save the list in a database table, and
it saved data perfectly. </p>
<p>I don't have an Android phone, so I can check my application
only using an emulator. </p>
<p>After saving tasks in the database, if a user restarts the phone then will my task list in database be deleted or not? If it will be deleted then how can I make the data in the table persistent?</p>
|
android
|
[4]
|
2,408,027 | 2,408,028 |
Object arrays in JavaScript
|
<p>If I do this, </p>
<pre><code>var element = {};
alert(element);
element[name] = "stephen";
alert(element.name);
</code></pre>
<p>Why doesn't <code>element.name</code> work?</p>
|
javascript
|
[3]
|
1,780,169 | 1,780,170 |
touch event for whole android application
|
<p>I am developing a new app in which i had a great doubt whether is it possible or not?
My doubt is </p>
<p>We have to set one time listener for whole application. And we have to run a set of code for any touch event occurs in our application. <strong>For eg.</strong> there may be n activities in our app. But we have to set one time listener for all activities and run a set code when any touch occurs in any of n activities. I have tried a lot for it. Any ideas are welcome. Thanks in advance.</p>
|
android
|
[4]
|
2,407,412 | 2,407,413 |
C# classes - Why so many static methods?
|
<p>I'm pretty new to C# so bear with me.</p>
<p>One of the first things I noticed about C# is that many of the classes are static method heavy. For example...</p>
<p>Why is it:</p>
<pre><code>Array.ForEach(arr, proc)
</code></pre>
<p>instead of:</p>
<pre><code>arr.ForEach(proc)
</code></pre>
<p>And why is it:</p>
<pre><code>Array.Sort(arr)
</code></pre>
<p>instead of:</p>
<pre><code>arr.Sort()
</code></pre>
<p>Feel free to point me to some FAQ on the net. If a detailed answer is in some book somewhere, I'd welcome a pointer to that as well. I'm looking for the definitive answer on this, but your speculation is welcome.</p>
|
c#
|
[0]
|
4,193,901 | 4,193,902 |
How to test a method (White box testing)
|
<p>Here's the method I want to test</p>
<pre><code> private static void selectTop20Tags(Dictionary<string, int> list)
{
//Outputs the top 20 most common hashtags in descending order
foreach (KeyValuePair<string, int> pair in list.OrderByDescending(key => key.Value).Take(20))
{
Console.WriteLine("{0}, {1}", pair.Key, pair.Value);
}
}
</code></pre>
<p>I don't know how I would test this, I've been researching it all day and try various things but cannot get it to work.</p>
<p>I was thinking of including some code such as </p>
<pre><code>#if TEST
if ((length of list don't know how you would do it) <= 20)
{
StreamWriter log2;
// appends file
log2 = File.AppendText("logOfTests.txt");
// Writes to the file
log2.WriteLine("PASS");
log2.WriteLine();
// Closes the stream
log2.Close();
}
#endif
</code></pre>
<p>I think I just need to see an example and I would know.</p>
|
c#
|
[0]
|
2,840,167 | 2,840,168 |
Android apk won't install from the market nor web server
|
<p>This is my own application developed with the intention of distributing it via the Android market. It's been tested on several handsets, installed each time with from the SDK (so, adb).
However that appears to be the only way I can install it:</p>
<ul>
<li>I signed the application and uploaded it to my own server.</li>
<li>Any previous version is uninstalled from the device:</li>
<li>Downloading via the browser results in a silent fail. Server logs show that there was only one access (a successful OTA install requires, I believe, two request/responses). There is nothing at all in Logcat.</li>
<li>I tried instead releasing it to the Android Market. This time Logcat indicates a server-side error:
DEBUG/vending(530): [42] BaseAction.run(): ApiException: com.android.vending.api.ApiException: Error from backend. Request=com.android.vending.model.PurchaseOrderRequest, Response=INTERNAL_SERVICE_ERROR
DEBUG/vending(530): [1] LocalAssetDatabase.notifyListener(): -7763566390739351724 / UNINSTALLED
DEBUG/vending(530): [1] LocalAssetCache.updateOneAsset(): No local info for -7763566390739351724
INFO/vending(530): [1] BaseAction.displayErrorUi(): Server error in com.android.vending.billing.PurchaseOrderAction: com.android.vending.api.ApiException: Error from backend. Request=com.android.vending.model.PurchaseOrderRequest, Response=INTERNAL_SERVICE_ERROR</li>
</ul>
<p>The most likely problem, then, is how I signed the application. However the signed version can be installed via adb on the command line and even from gmail. Furthermore I signed a small, unrelated application with exactly the same results. I've also tried building from another machine and under Windows and Linux. Same results every time, on three different devices, factory reset, over the internet or WIFI. The only constant is me.</p>
<p>I've read literally every thread on stackoverflow regarding the above error in Logcat, all of which appear to be unrelated because I have no difficulty installing other applications from the Android market.</p>
<p>I've exhausted my meagre wits trying to debug this and would be very grateful for any ideas.</p>
|
android
|
[4]
|
5,688,677 | 5,688,678 |
Process and Task in Android
|
<p>Can someone let me know what is the difference between process and task in android.
As far as I understand whenever you lanuch an application, it will run in a seperate process. Am I Right? <br />
An application can contain multiple activities which can be run in same or different process. <br />
A Task is a set of activities (orederly). <br />
A process can contain multiple tasks. <br />
Please differentiate the two.</p>
|
android
|
[4]
|
3,817,005 | 3,817,006 |
jQuery Dropdown - Follow URL onchange
|
<p>I have a select element that functions as a dropdown menu. Each option has a value that is a URL.</p>
<p>I want it so that every time any option is selected, the page will go to that option's value as a URL.</p>
<p>This is what I have so far, but I am not sure if I am on the right track:</p>
<pre><code>$('userNav').change(function() {
window.location.replace("http://" something with concatenation);
});
</code></pre>
<p>Any help?</p>
|
jquery
|
[5]
|
495,273 | 495,274 |
Find connected device to Galaxy Tab - Android
|
<p>I'm developing an app in which I must start a slideshow with some picture info. So far, so good. There's only one issue: I need to show one type of view when the device (galaxy tab) is connected to a TV (TV-Out) and another view if it's showing on the tab.</p>
<p>Example:</p>
<p>If is connected to TV: Show only the images on TV, no info.
If is not connected to TV: Show images plus info.</p>
<p>How can I find out if the device is plugged to a TV?</p>
|
android
|
[4]
|
3,126,854 | 3,126,855 |
Difference between Server.MapPath and Page.MapPath
|
<p>What is the difference between those two?
If I only want to retrieve the absoluate path to an image on web server, is Server.MapPath safer in any case?
I'm using Page.MapPath right now, but it won't work if control was created in WebService since control.Page property become null?
Whether Server.MapPath always work?</p>
|
asp.net
|
[9]
|
3,641,362 | 3,641,363 |
How do I get the path of a binary in c#?
|
<p>For some reporting purposes I'm trying to get the location of a certain binary.</p>
<p>I was doing this, and it was working, but I'm now getting a NullReferenceException when I try to get testProc.MainModule.FileName; and I think it may be that the program is closing before I'm able to grab it. Is there any better way to do this?</p>
<pre><code>ProcessStartInfo testPSI = new ProcessStartInfo(RunOptions.TestBinary);
testPSI.RedirectStandardError = true;
testPSI.RedirectStandardOutput = true;
testPSI.UseShellExecute = false;
Process testProc = new Process();
testProc.StartInfo = testPSI;
testProc.Start();
ret = testProc.MainModule.FileName;
testProc.Kill();
if (ret != null)
return ret;
</code></pre>
|
c#
|
[0]
|
2,175,075 | 2,175,076 |
Python Timezone conversion
|
<p>I am looking for a quick way to type in a time and then python convert it into other timezones ( maybe up to 10 different timezones )</p>
<p>Sorry. I am not fimilar with time in python at all, if someone could put me in the right direction I would really appreciate it.</p>
|
python
|
[7]
|
4,727,527 | 4,727,528 |
code for discerning palindromes
|
<pre><code>def is_palindrome(s):
if s == ' ':
return True
if s[0] != s[-1]:
return False
return is_palindrome(s[1:-1])
</code></pre>
<p>This is my code and it doesn't work.
It works for cases such as abab, but not abba.
Can anyone tell me why?</p>
|
python
|
[7]
|
957,142 | 957,143 |
Is there a way to perform animations between activities?
|
<p>I was wandering whether there is a way to perform
animations between activities like you see when you press the search in google maps (it slides down from the top).
From my research I have gathered it us only possible been views. Am I missing something? </p>
|
android
|
[4]
|
3,076,885 | 3,076,886 |
how to catch a standard output from my command line?
|
<p>I try to run a process.start() for command in command line, and try to get the output into string or some usefull locaiton. The output will consist of several rows ( like DIR command ). I read how to do it but it doesn' t work for me. It runs but then got into loop and does not stop.See below. any ideas?</p>
<pre><code> ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("cmd.exe",
@" /k dir");
Process myProcess = new Process();
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.FileName = "cmd.exe";
myProcess.StartInfo.Arguments = @" /k dir";
myProcess.Start();
string ppp = myProcess.StandardOutput.ReadToEnd();
myProcess.WaitForExit();
</code></pre>
|
c#
|
[0]
|
2,056,109 | 2,056,110 |
C++/ build project got errors
|
<p>I have the next files in c++ in Visual Studio 2010:</p>
<pre><code>stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
void printHello();
// TODO: reference additional headers your program requires here
</code></pre>
<p>inter.cpp</p>
<pre><code>// Inter.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
printHello();
}
</code></pre>
<p>stdafx.cpp</p>
<pre><code>// stdafx.cpp : source file that includes just the standard includes
// Inter.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#include <iostream>
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
void printHello() {
std::cout << "Hello World!" << std::endl;
}
</code></pre>
<p>and I got it:</p>
<pre><code>'Inter.exe': Loaded 'C:\Users\Adamsh\Documents\Visual Studio 2010\Projects\Inter\Debug\Inter.exe', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[3636] Inter.exe: Native' has exited with code 0 (0x0).
</code></pre>
<p>How can I fix it?</p>
|
c++
|
[6]
|
1,548,925 | 1,548,926 |
What does a leading zero do for a php int?
|
<pre><code>echo(073032097109032116104101032118101114121032109111100101108032111102032097032109111100101114110032109097106111114032103101110101114097108046);
</code></pre>
<p>Essentially, a very large number. Now, why does it output <code>241872</code>? I know PHP has float handlers. When I remove the leading zero, it functions as expected. What is that leading zero signifying?</p>
|
php
|
[2]
|
3,801,356 | 3,801,357 |
My android local host not working
|
<p>I am trying to send data to my php file and get response but couldn't able to do it I don't know why but i am not receiving any value on my php server. Please help me out</p>
<p>Android Code:</p>
<pre><code>HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.0.2.2/first.php");
try {
List<NameValuePair> nvp= new ArrayList<NameValuePair>(2);
nvp.add(new BasicNameValuePair("uid", "mirza"));
nvp.add(new BasicNameValuePair("pass", "mirza"));
httppost.setEntity(new UrlEncodedFormEntity(nvp));
HttpResponse response = httpclient.execute(httppost);
}
catch(IOException e){
}
}
</code></pre>
<p>PHP CODE:</p>
<pre><code>$ user = $_POST ["uid"];
$ pwd = $_POST ["pass"];
$con= mysql_connect("localhost","root");
if(! $con)
{
die("Not able to connect");
}
mysql_select_db("try", $con);
$result=mysql_query("Select * from info where uid=' $user 'and pass=' $pwd '");
if( mysql_num_rows( $result)<=0)
{
echo "unsuccessful";
}
else{
echo "successful";
}
mysql_close( $con);
?>
</code></pre>
|
android
|
[4]
|
2,419,720 | 2,419,721 |
Looking for File Copy function in C#
|
<p>I'm writing a tool that performs copying from USB devices to the local HD - I wonder if there is a function in C# to copy a file from one path to another?</p>
|
c#
|
[0]
|
610,317 | 610,318 |
get data by id in grid view
|
<p>I have a table with threads for a forum, the thread name is a link and once clicked it passes the thread_id to the comments page, I need to know how to then display all the comments with the thread_id that is passed?</p>
<p>Have tried:</p>
<pre><code><asp:SqlDataSource ID="CommentsDataSource" runat="server"
SelectCommand="select * from comments where thread_id=@thread_id" >
<SelectParameters>
<asp:QueryStringParameter Name="@thread_id" QueryStringField="thread_id" Runat="Server" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:BoundField DataField="comment" HeaderText="Comment" />
</Columns>
</asp:GridView>
</code></pre>
<p>but it doesn't work</p>
<p>Thanks</p>
|
asp.net
|
[9]
|
5,828,337 | 5,828,338 |
Android : List View or SPinner
|
<p>Team, </p>
<p>I would like to know how to display a List View or SPinner using key and value pairs in Android platform. For example take Contacts Contact has id, First Name, LastName, i would like to display First Name and Last Name in the list view or in the spinner, </p>
<p>id1, lastname1, firstname1
id2, lastname2, firstname2
id3, lastname3, firstname3</p>
<p>Once the user selected any value in the List view or spin list, I need to get the key value from the List view or spinner. </p>
<p>How to do it? </p>
<p>Any help or examples is greatly appreciated.</p>
<p>Thanks,
Ramesh</p>
|
android
|
[4]
|
3,018,149 | 3,018,150 |
Get last week date in php
|
<p>Hello, I'm having a problem in my PHP code.</p>
<p>When I run this on my localhost the results is okay but when I upload it on the server it is not the same as on localhost.</p>
<p>I want to get the previous monday (last week) and end of last week (sunday).</p>
<p>This is my code:</p>
<pre><code>$start_past = strtotime("last week");
$end_past = strtotime("+6 day",$start_past);
echo $start_past_qry = date("m/d/Y",$start_past);
echo $end_past_qry = date("m/d/Y",$end_past);
</code></pre>
<p><strong>RESULTS ON LOCALHOST</strong>:
05/06/2013
05/12/2013</p>
<p><strong>RESULTS ON SERVER</strong>:
05/13/2013
05/19/2013</p>
<p>But the results on the server seems to be fall under the current week.
I want to get the last week range.</p>
<p>Please HELP. Thank you!</p>
|
php
|
[2]
|
2,628,065 | 2,628,066 |
Adding user input to an array list
|
<p>How do I add user input to an arraylist? </p>
|
c#
|
[0]
|
2,584,184 | 2,584,185 |
how to get and read traces.txt file in android
|
<p>I want to read and understand what is being written to traces.txt file whenever application forcecloses. I am iplementing app, in that I am fetching data from web and set it to imageview and textview . When I run that app , it takes more time to fetch image and set it to imageview inbetween forceclose is happening and saying activity not responding.</p>
<p>Thanks,
Vishakha.</p>
|
android
|
[4]
|
4,866,787 | 4,866,788 |
Javascript: How do I code a script where the user inputs a number and it returns three other numbers?
|
<p>I'm not even quite sure how I can make myself clear and I do apologize... but I have been searching all over the internet for a similar JavaScript code and I'm not even quite sure how to phrase the question ...</p>
<p>Basically, I want the user to input one thing, and I want something else to pop up.</p>
<p>As an example, the user would type in a number, let's say "10" into a text field or drop-down menu and then three other numbers would pop up, such as 15.25, 16.50, and 17.75 (either in pop window form, or just in a plain sentence, or in other text fields ... it doesn't really matter).</p>
<p>What I'm doing is I want to post an estimate calculator for loan payments on a website (with options for 30 day, 60 day, and 90 day payoff options).</p>
<p>There's no math involved in this code whatsoever (I understand if I have to input a lot of numbers - I already have those!). I don't want to create a calculator, because I think a calculator would be more complicated (I'm aiming for simple!) ... The loan fees and interest vary from one group of numbers to another, so if it were to be a calculator the script might get really complicated (because we're not looking at a easy 1 + 1 = 2 equation ... it's more like 1 + 1.50 + 1.00 = 3.50, or 10.00 + 4.00 + 1.25 = 15.25, or even 30.00 + 6.00 + 1.75 etc., there's no consistency).</p>
<p>So I'm figuring a simpler way around this beast would be to have the numbers readily available, with no calculations. So if they enter in a 1, the result they would get be 3.50, 4.50, and 5.50.</p>
<p>I don't know, that might be asking a bit much too....</p>
<p>Thank you in advance for your time and help.</p>
|
javascript
|
[3]
|
1,758,572 | 1,758,573 |
ListPreference Dropdown
|
<p>I am using preference screen in Tabhost,so it was displaying the preference background white in order to fix it I used a theme which changed background color to black
but the same is appled to the listprefernce dropdown list as well and I can't see any option </p>
<p>as idiotic question as it sounds it has been killing me for hours
thanks in advance </p>
|
android
|
[4]
|
983,463 | 983,464 |
My android app is pending approval for two week now! What's wrong?
|
<p>I've uploaded an app to the android market place two weeks ago.
The app is "pending approval" since I published it.
What's wrong?
Is there any phone number I can call to solve this issue?</p>
|
android
|
[4]
|
2,245,925 | 2,245,926 |
Help with jQuery 'zoom' script
|
<p>I'm using this script on my site - <a href="http://www.suuronen.org/esa-matti/projects/panfullsize/" rel="nofollow">http://www.suuronen.org/esa-matti/projects/panfullsize/</a></p>
<p>Got it all working fine, only problem is that it always defaults to the zoomed image when you load a page. I'd rather it showed the scaled down image first, and then zoomed when requested.</p>
<p>Anyone know how I can fix it?</p>
<p>Cheers</p>
<p>Sam</p>
|
jquery
|
[5]
|
2,080,539 | 2,080,540 |
Generating objects and putting into arraylist with no duplicates
|
<p>Hi I am figuring out why this code is not working the way how i wanted it to work..</p>
<p>What i basically want is a random object that has a char and an int generating and putting it into an arraylist. However if the generated matches the same in the arraylist it must regenerate the number again and check to see if it exists. If it does not exist it will then be added into the arraylist.</p>
<pre><code> private final char letter;
private final int num;
private static Collection<RegistrationNumber> REGISTRATION_NUMBER = new ArrayList<RegistrationNumber>();
private RegistrationNumber(){
Random rand = new Random();
this.num = (1+(rand.nextInt(3)));
this.letter = Character.toUpperCase((char)(rand.nextInt(1)+'a'));
}
public static RegistrationNumber getInstance(){
boolean foo = false;
RegistrationNumber rn = null;
while(!foo){
rn = new RegistrationNumber();
if(!REGISTRATION_NUMBER.contains(rn)){
REGISTRATION_NUMBER.add(rn);
foo=true;
}
}return rn;
}
</code></pre>
<p>Once I look through the arraylist, there are still some repeating for example [A1,A1,A2] or [A2,A2,A3] </p>
<p>Many thanks!</p>
|
java
|
[1]
|
1,899,337 | 1,899,338 |
Finding objects in JS array and storing names to new array?
|
<p>So, I have an array that contains X objects, all named by dates and containing useless data beyond their name.
I want to store these dates in an array for later use and objects are, apparently, not found in an array by array[i], so how do I iterate through the array and just save the names to a string in another array?</p>
<p>Edit: Ok this question was due to a major brainfart... The obvious answer would be</p>
<pre><code> var dP = $('#calendar').GetDate();
var dPTmp = [];
var i = 0;
for (var id in dP) {
dPTmp[i] = dP[id].toString();
i++;
}
console.log(dPTmp);
</code></pre>
|
javascript
|
[3]
|
901,499 | 901,500 |
Java code To convert byte to Hexadecimal
|
<p>I have an array of bytes.
I want each byte String of that array to be converted to its corresponding hexadecimal values.</p>
<p>Is there any function in Java to convert a byte String to Hexadecimal ?</p>
<p>Regards
Vivek</p>
|
java
|
[1]
|
389,039 | 389,040 |
Escape sequences from an integer
|
<p>I am writing an application to communicate with a serial device and I need to send the length of a string field in the string that is written to the serial port.
For example <code>"\x00\x27"</code> would be 27 bytes, and if I send this in the string it works as everything is hard coded so I know the length.</p>
<p>Another example is <code>"\x01\x27"</code> would be 127 bytes.</p>
<p>The problem is I need to be able to send variable length string fields. I know I can get the length using </p>
<pre><code> int lninbyte = System.Text.ASCIIEncoding.ASCII.GetByteCount(data);
</code></pre>
<p>but how do I convert <code>lninbyte</code> into <code>"\x00\x27"</code>?</p>
<pre><code>private void GetBCDDataLength(string data)
{
int lninbyte = System.Text.ASCIIEncoding.ASCII.GetByteCount(data);
if (lninbyte > 99)
{
}
else
{
BCDlenData = "\x00" + lninbyte.ToString("X");
}
}
</code></pre>
|
c#
|
[0]
|
2,164,425 | 2,164,426 |
How can I reserve an iPhone app name in apple's developer portal?
|
<p>I want to reserve an app name that I intend to build out over the next 90 days, how do I do this in apple's web developer portal?</p>
|
iphone
|
[8]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.