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 |
|---|---|---|---|---|---|
5,061,126
| 5,061,127
|
javascript error "invalid XML attribute value <script language=JavaScript>\n"
|
<p>i have some <code>javascript</code> files included in my html file for months. It used to work just fine until couple of days ago, now my scripts don't run anymore and i get <code>javascript error "invalid XML attribute value <script language=JavaScript>\n"</code> with firebug.</p>
<p>Does anyone know what this error means and how to get rid of it? i guess is something about that <code>newline</code> "\n" but i can't see that in my file if i open it.</p>
|
javascript
|
[3]
|
3,083,459
| 3,083,460
|
On click get button Value
|
<p>I have a button like following</p>
<pre><code><input type='button' value='Generate' onclick='f1()' />
</code></pre>
<p>now the f1 function should show a alert box contain button value. in this case 'Generate'</p>
<p>How to do this?</p>
<p>I tried</p>
<pre><code>alert(this);
alert(this.val());
</code></pre>
<p>it does not work</p>
|
javascript
|
[3]
|
1,917,551
| 1,917,552
|
Can the object you create with a constructor function ever itself be a function?
|
<p>I hope this question makes sense. Can I ever do something like the following:</p>
<pre><code>function constructor_function() {...code...};
var a = new constructor_function();
a();
</code></pre>
|
javascript
|
[3]
|
1,711,227
| 1,711,228
|
Calling webservice from windows service
|
<p>I have a windows service project that references an asp.net webservice. When I run this service locally on my machine via VS it works fine and when I call the web method I get the results I want.</p>
<p>Today I deployed this to a test server and when I call the web method it fails because the it is trying to connect to the local host webservice and not the one on the server. The error I get is "Unable to Connect to remote server --> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it: 127.0.0.1"</p>
<p>My service has a app.config file and the web service settings are correctly pointing at the webservice url. I know the url is correct as when I put it into IE it resolves to the webservice. Also the properties of the webservices are correct.</p>
<p>Any suggestions on how the service is getting hold of localhost would be greatly appreciated.</p>
|
asp.net
|
[9]
|
1,428,493
| 1,428,494
|
show multiple select box value with jquery?
|
<p>hi
i am a php developer and using an multiple select box , i want when we select a multiple
option from the select box then value of every select box should be display in text box how
can i do this with the help of jquery please help if anybody have solution of this
thank's</p>
|
jquery
|
[5]
|
5,890,429
| 5,890,430
|
What is the difference between clearAnimation() and stop() in android?
|
<p>Can anyone please tell me when i am finishing my activity, Whether i will use clearAnimation() or stop() for AnimationDrawable !</p>
|
android
|
[4]
|
3,363,404
| 3,363,405
|
Sum function not working in Java.
|
<p>I'm new to Java programming. I have a project that is supposed to sum a series of inputs and also calculate the average of those numbers. Right now the Total is coming up as zero no matter what I put in for values. I'm stuck. Please help. Thank you.</p>
<pre><code> private class InputButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
for(int i=0; i<7; i++)
{
numInput = 0.0;
strInput = JOptionPane.showInputDialog(null, "How many hours did you sleep on day " + (i+1));
numInput = Double.parseDouble(strInput);
numInput +=total;
}
}
}
private class CalcButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JOptionPane.showMessageDialog(null,"The total amount of sleep for the week is " + total + " hours");
JOptionPane.showMessageDialog(null,"The average amount of sleep for 7 days is " + avg + " hours");
}
}
public static void main(String[] args)
{
HoursSlept HS = new HoursSlept();
}
</code></pre>
<p>}</p>
|
java
|
[1]
|
3,459,951
| 3,459,952
|
How do you programmatically fill rectangle defined in xml
|
<p>I have a simple Android project with a rectangle defined in xml, but I can't find a way to pro grammatically fill it with a solid colour.</p>
<p>The main.xml file has the following</p>
<pre><code><ImageView
android:id="@+id/Smoke20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/editText2"
android:layout_marginLeft="26dp"
android:src="@drawable/zonebox" />
</code></pre>
<p>Where zonebox is defined in res/drawable/zonebox.xml as follows</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:width="80sp"
android:height="20sp" />
<stroke
android:width="1dp"
android:color="#88888888" />
<!-- solid
android:color="#0A0" />
-->
</shape>
</code></pre>
<p>In my code, I can for example change the colour of boundary of the rectangle with
something like</p>
<pre><code>int colourBox = getResources().getColor(R.color.fire2_fire_color);
View rectTest = findViewById(R.id.Smoke20);
rectTest.setBackgroundColor(colourBox);
</code></pre>
<p>but I can't replicate in code the "solid" attribute that is so easily done in the xml as shown commented out. I'm obviously going about this the wrong way, but after considerable research, I'm still in the dark.</p>
<p>I have looked at getting the xml resource as follows, but this doesn't offer a suitable method for filling the rectangle either.</p>
<pre><code>ShapeDrawable viewTest = (ShapeDrawable)getResources().getDrawable(R.id.Smoke20);
</code></pre>
<p>Thanks</p>
|
android
|
[4]
|
3,644,725
| 3,644,726
|
Java noob question - how to store a string to a new text file
|
<p>Here is my scenario:</p>
<p>Selenium grabbed some text on the html page and convert it to a string (String store_txt = selenium.getText("text");) - the text is dynamically generated.</p>
<p>Now I want to store this string into a new text file locally every time I run this test, should I use FileWriter? Or is it as simple as writing a System.out.println("string");?</p>
<p>Do I have to write this as a class or can I write a method instead?</p>
<p>Thanks in advance!!</p>
|
java
|
[1]
|
3,745,040
| 3,745,041
|
Opening a file for append
|
<p>I just had a passing thought and figured what better place to ask then right here. Out of curiosity, does anyone know if opening a file for append, like this:</p>
<pre><code>file_name = "abc"
file_handle = open(file_name,"a")
</code></pre>
<p>Is essentially the same as opening a file for writing and seeking to the end:</p>
<pre><code>file_name = "abc"
file_handle = open(file_name,"w")
file_handle.seek(0,2) # 0 for offset, 2 for end-of-file
</code></pre>
<p>I'm just wondering if opening a file for append is essentially doing the second block, open for write followed by a seek to the end of the file, behind the scenes.</p>
|
python
|
[7]
|
2,142,877
| 2,142,878
|
UIView or UIImage in a UITableView, what's better for performance
|
<p>I have a UITableView where we want to just put a colored square. Depending on the data in the UITableViewCell, the UIView changes its background color. That's the way it currently is. To me, it seems better to just have a UIImageView and have a .png image for the different color squares, and load the correct one per cell depending on the data in the UITableViewCell. I'm not sure which method is better, or if there is an even better method I do not know of. Any thoughts? Thanks.</p>
|
iphone
|
[8]
|
4,607,572
| 4,607,573
|
How to upload and download a file
|
<p>I like to upload an file in my project. when I click the upload button the file should be stored in client system and the file name and path should be stored in the database. When I clicking the download button it should be downloaded based on the file name and path that I have stored in the database. After making the changes it should be uploaded as different file name and it will not affect the previous file content. If there is any code for this process please send it to me.</p>
<p>Thanks in advance</p>
|
asp.net
|
[9]
|
4,952,451
| 4,952,452
|
Singly linked-list class with constructors
|
<p>What I want to do is have a singly linked-list class with a default constructor, copy constructor, copy assignment constructer, and destructor. I barely started it because I am confused if a <code>Node</code> with int data and next pointer should be a separate class or the way I did it.</p>
<pre><code>class list {
public:
list(): next(NULL) {} // default constructor
list(const list &t){} // copy constructor
list& operator= (const list &t) // assignment operator
~list(){} //destructor
void print()
private:
struct Node {
data x;
Node *next;
}_list;
}
</code></pre>
|
c++
|
[6]
|
5,927,948
| 5,927,949
|
Alternative plugin to Javascript for Java to provide a way for user to specify a mask
|
<p>I'm looking for a scripting language that can be run on a Java VM that would work as a simple scripting language that a user can use for specifying how there filenames are constructed from music metadata. Please see earlier related post of mine <a href="http://stackoverflow.com/questions/6285045/putting-a-simple-expression-language-into-java">Putting a simple expression language into java</a> where Javascript was recommended, I use this and it works:</p>
<p>i.e I if I have a file containing the following metadata:</p>
<pre><code>albumartist=U2
album=Boy
trackno=02
title=Twilight
</code></pre>
<p>and apply this javascript mask:</p>
<pre><code>(albumartist.length>0 ? albumartist +'-' :(artist.length>0 ? artist + '-' : ' ')) + (album.length>0 ? album + '-' :'') + (trackno.length>0 ? trackno + '-' :'') + title
</code></pre>
<p>it will output</p>
<p>U2-Boy-02-Twilight</p>
<p>which is great.</p>
<p>But the trouble is the Javascript syntax is <strong>too hard</strong> for the average user.</p>
<p>Can anyone recommend an alternative scripting language I can plugin that gives me simailar functionality but a simpler syntax. For example it would be nice if I could use this kind of syntax instead</p>
<pre><code>if(albumartist,albumartist-)else if(artist,artist-)(album,album-)(trackno,trackno)title
</code></pre>
<p>and get the same result</p>
|
java
|
[1]
|
766,791
| 766,792
|
isFinishing method
|
<p><code>isFinishing()</code> method allows to check if <code>finish()</code> method was called or if the <code>Activity</code> is killed by the system.</p>
<p>What's the purpose of distinguishing these two scenarios? </p>
<p>What's the difference between calling <code>finish()</code> and killing the <code>Activity</code> by system?</p>
|
android
|
[4]
|
355,154
| 355,155
|
Writing to Subprocess's Standard Input
|
<p>I'm spawning a process in Java using the following code:</p>
<pre><code>Process newExec = null;
BufferedReader outStream = null;
BufferedReader inStream = null;
BufferedReader errStream = null;
StringBuffer outputBuffer = new StringBuffer();
String PATH_TO_EXEC = config.getExecPath();
try {
newExec = Runtime.getRuntime().exec(PATH_TO_EXEC + " " + args);
}
catch(IOException e){
outputBuffer.append("Error in running executable.");
e.printStackTrace();
return outputBuffer.toString();
}
</code></pre>
<p>After the process is spawned it expects some input through stdin. How would I stream strings to this newly-spawned program?</p>
|
java
|
[1]
|
4,584,510
| 4,584,511
|
android screen resolution
|
<p>How to know the resolution of phone programatically in android .help me please</p>
|
android
|
[4]
|
191,917
| 191,918
|
how to add events to default android calendar?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3721963/how-to-add-calendar-events-in-android">How to add calendar events in Android?</a> </p>
</blockquote>
<p><li>I have to add events to the default calendar control on android phones from my application.</li>
<li>I am making the app for android 2.1 to 2.3.</li>
<li>I have tried out <a href="http://www.developer.com/article.php/3850276" rel="nofollow">this</a> tutorial but it does not work. </li></p>
<p>it is mentioned in the tutorial that the code may not work for android 2.x and above.</p>
<p>I am getting the data from a database for adding events to the calendar.</p>
<p>How do i add events to the default phone calendar in android 2.x?</p>
<p>thank you in advance.</p>
|
android
|
[4]
|
1,989,939
| 1,989,940
|
Google Goggles Intent
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2080731/google-goggles-api">Google goggles API</a> </p>
</blockquote>
<p>According to Google, Goggles now supports barcode scanning via intents.
So how would I launch this intent?
Apart from it being mentioned on the app store site there's no info whatsoever :(</p>
<p>Am I missing something trivial here?</p>
|
android
|
[4]
|
3,898,700
| 3,898,701
|
ASP.NET Removing Items from a list array by checking for certain value
|
<p>So I am reading a text file which may or may not end with some lines ending 9999999999999999999999999</p>
<p>which are just extra lines to make up a batch...im reading in the file like this</p>
<pre><code>var lines =
File.ReadAllLines("C:\\Users\\Downloads\\EmployeeExpenseReimbACH_20111214.txt");
</code></pre>
<p>How can I loop through this and remove the lines with 9999999's? and then end up with an array without them basically.</p>
|
asp.net
|
[9]
|
5,010,233
| 5,010,234
|
jQuery autocomplete-style search box to pull list of links from page
|
<p>I have a newsroom page, with a short list of articles. I'm not using a database or a CMS for this, so for the time being, I'd like to implement a quick search functionality to parse through the list of titles using a search box.</p>
<p>I'd like to be able to start typing into the input box, and perhaps use .find() to parse through the list of articles, then have a list or result below the search box in a div (similar to autocomplete) and have the links to the article be clickable to the articles themselves. I'm already using jQuery, so I'd rather not have to use jQueryUI as well, so any tips on how to go about accomplishing this?</p>
|
jquery
|
[5]
|
2,845,170
| 2,845,171
|
Download file through Intent.ACTION_VIEW ignoring SSL certificate errors
|
<p>I'm trying to download a PDF file.</p>
<p>This is the code I'm using:</p>
<pre><code>Uri uri = Uri.parse(urlReferingPDF);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
</code></pre>
<p>I have a problem with SSL error. (Or that is what I beleive)</p>
<p>A external browser is then opening to download the file and download goes to notification bar as expected but never starts properly.</p>
<p>I have found a member that had almost the same problem but I couldn't manage to message him besides he told to ask him about it.</p>
<p>Thanks in advance!!</p>
|
android
|
[4]
|
2,082,192
| 2,082,193
|
Remove short words and characters from a string in PHP
|
<p>I have a string which could be like this:</p>
<pre><code>$searchterm = "The quick brown fox, jumps over the lazy dog! 48372. John's?"
</code></pre>
<p>Is there a way to remove all words that are 3 characters and under as well as characters that aren't alphanumeric (except for apostrophes)?</p>
<p>I want my result to be:</p>
<pre><code>quick brown jumps over lazy 48372 John's
</code></pre>
|
php
|
[2]
|
4,323,879
| 4,323,880
|
manipulating lists
|
<p>I have written a code to manipulate the contents of a time series data and output into a newly created matrix. This is to enable me construct the phase space for the time series data.</p>
<p>The list is one-dimensional of length=N called "noise".</p>
<p>I want to create a MxN matrix where <code>m = N -5*tdelay1</code> and <code>n = 6</code>. When the code complies it displays an error:</p>
<blockquote>
<p>Index was outside the bounds of the array.</p>
</blockquote>
<p>The code is below:</p>
<pre><code>float[,] phaseSpace6 = new float[(length-5*tdelay1-1), m];
for (int i = 0; i < (length-5* tdelay1-1); i++)
{
int col1 = i + tdelay1;
int col2 = i + 2 * tdelay1;
int col3 = i + 3 * tdelay1;
int col4 = i + 4 * tdelay1;
int col5 = i + 5 * tdelay1;
phaseSpace6[i, 1] = noise[i];
phaseSpace6[i, 2] = noise[col1];
phaseSpace6[i, 3] = noise[col2];
phaseSpace6[i, 4] = noise[col3];
phaseSpace6[i, 5] = noise[col4];
phaseSpace6[i, 6] = noise[col5];
}
</code></pre>
<p>I am not sure why this is happening, as someone new to programming. I will be grateful if some experienced person could help me out.</p>
|
c#
|
[0]
|
3,687,320
| 3,687,321
|
Remove/Disable javascript when using browser's back button
|
<p>I have a page that consists of two frames: one being a flash app, and one being an aspx page with a user control that contains a grid with several "add to cart" buttons. When the user clicks a button I would like to reload the whole window with a shopping cart page. </p>
<p>I found out how to do so <a href="http://weblogs.asp.net/ksamaschke/archive/2003/02/23/2831.aspx" rel="nofollow">here</a> quite nicely by avoiding response.redirect, and using response.write to insert some javascript that redirects. The problem is that when the user hits the back button from the shopping cart page, the script executes again, effectively canceling out the back button. (bad usability)</p>
<p>So my question is, is there a way to detect if the user arrived at the page via the back button and avoid executing the script?</p>
|
javascript
|
[3]
|
4,875,323
| 4,875,324
|
StringIndexOutOfBoundsException in android
|
<p>I am getting the following error:</p>
<pre><code> java.lang.StringIndexOutOfBoundsException: length=13243; regionStart=32; regionLength=-39
at java.lang.String.startEndAndLength(String.java:593)
at java.lang.String.substring(String.java:1474)
at com.dict.XMLParser.getResultFromXML(XMLParser.java:63)
at com.dict.InternetDictProvider.searchWord(InternetDictProvider.java:29)
at com.dict.SearchDict$SearchOnline.doInBackground(SearchDict.java:130)
at com.dict.SearchDict$SearchOnline.doInBackground(SearchDict.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
</code></pre>
<p>in the following code which typically gets results after parsing the XML page given as HttpResponse to a HttpGet :</p>
<pre><code> retry:
{
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet("http://oxforddictionaries.com/definition/"+query+"?q="+query);
HttpResponse httpResponse = httpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
String meanings=parser.getResultFromXML(StringUtils.inputStreamToString(httpEntity.getContent()));
if(meanings==null && firstRetry)
{
firstRetry=false;
query = query.substring(0, 1).toUpperCase() + query.substring(1);
break retry;
}
else if(meanings==null && !firstRetry)
return query;
result = query + ":" + meanings;
}
</code></pre>
|
android
|
[4]
|
5,858,166
| 5,858,167
|
Disable black screen when lock button pressed
|
<p>I want to disable the black screen appearing when i press the lock button in android. You might have observed how they do it in android video players just place a lock icon on the top instead of bringing up the black screen. Please tell to which classes or methods to refer?</p>
|
android
|
[4]
|
4,161,509
| 4,161,510
|
Pointer-to-data-member-of-data-member
|
<p>I had the following piece of code (simplified for this question):</p>
<pre><code>struct StyleInfo
{
int width;
int height;
};
typedef int (StyleInfo::*StyleInfoMember);
void AddStyleInfoMembers(std::vector<StyleInfoMember>& members)
{
members.push_back(&StyleInfo::width);
members.push_back(&StyleInfo::height);
}
</code></pre>
<p>Now, we had to restructure this a bit, and we did something like this:</p>
<pre><code>struct Rectangle
{
int width;
int height;
};
struct StyleInfo
{
Rectangle size;
};
typedef int (StyleInfo::*StyleInfoMember);
void AddStyleInfoMembers(std::vector<StyleInfoMember>& members)
{
members.push_back(&StyleInfo::size::width);
members.push_back(&StyleInfo::size::height);
}
</code></pre>
<p>If this all looks like a stupid thing to do, or if you feel there's a good opportunity to apply BOOST here for some reason, I must warn you that I really simplified it all down to the problem at hand:</p>
<blockquote>
<p>error C3083: 'size': the symbol to the left of a '::' must be a type</p>
</blockquote>
<p>The point I'm trying to make is that I don't know what the correct syntax is to use here. It might be that "StyleInfo" is not the correct type of take the address from to begin with, but in my project I can fix that sort of thing (there's a whole framework there). I simply don't know how to point to this member-within-a-member.</p>
|
c++
|
[6]
|
789,287
| 789,288
|
cross domain issue
|
<p>There is a iframe in my page. This page is in domain A, the stuff in that iframe is belong to domain B. Is there any way I could get the source code of that page in that iframe?
This is a cross domain problem, the domain A and B are totally different. Also the domain B is third part domain, we can not do any changes on that.
For example, the stuff in iframe is google's homepage.</p>
|
javascript
|
[3]
|
3,154,887
| 3,154,888
|
How does JVM deal with duplicate JARs of different versions
|
<p>When there were duplicate JARs with different versions, the behavior was very inconsistent. Does anyone know how the JVM deals with duplicates?</p>
|
java
|
[1]
|
2,302,821
| 2,302,822
|
Strategy for a global network connection listener
|
<p>What would be the best strategy to have a network connection listener for my application that it is started when the application starts and closes when the activity exists. Could I use a service in which to register a PhoneStateListener like this:</p>
<pre><code>((TelephonyManager)app.getSystemService(Context.TELEPHONY_SERVICE)).listen(PhoneStateListener,
PhoneStateListener.LISTEN_DATA_CONNECTION_STATE);
</code></pre>
|
android
|
[4]
|
3,680,272
| 3,680,273
|
What does the compiler do to perform a cast operation in C++?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/340413/how-do-c-c-compilers-handle-type-casting">How do C/C++ compilers handle type casting between types with different value ranges?</a> </p>
</blockquote>
<p>What does the compiler do to perform a cast operation in C++?</p>
<p>Explain with some sample C++ code.</p>
|
c++
|
[6]
|
500,185
| 500,186
|
framework for setting the sms body programmatically in iphone
|
<p>i want to set the sms body by my application so there is any way or a framework available to do this task.. and if any framework than how to implement that..
plz help. i searched a lot on google but all in vain...</p>
|
iphone
|
[8]
|
5,217,667
| 5,217,668
|
Not able to get value of textarea in .val
|
<p>HTML:<br></p>
<pre><code><textarea cols="50" rows="5" id="txtHtmlContent">
</textarea>
</code></pre>
<p>jQuery:</p>
<pre><code>if ( $("#rdbHtmlContent").attr("checked") ) {
alert( $('#txtHtmlContent').val() );
}
</code></pre>
<p>But alert show empty. What is my mistake?</p>
|
jquery
|
[5]
|
3,021,113
| 3,021,114
|
Unknown function
|
<p>I have a script called ranking.php. I call this script at the top of another script (headtohead.php) as follows:</p>
<pre><code>include("ranking.php");
</code></pre>
<p>Within the ranking script, there is a function called 'win'. In the headtohead.php script, I have a function with the following:</p>
<pre><code>global $form, $database, $foottour, $ranking;
</code></pre>
<p>And then within the function itself:</p>
<pre><code>$newHomePoints = $ranking->win($homePoints, $homescore, $awayscore, ($homeStar - $awayStar));
</code></pre>
<p>I am getting the error saying that the function 'win' on the line where it's called is unknown?</p>
|
php
|
[2]
|
67,494
| 67,495
|
c++ count down script
|
<pre><code>#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int num, num2;
num = 33;
do
{
cout <<"\n" <<num-3;
}
while (num >=3);
system("PAUSE");
return EXIT_SUCCESS;
}
</code></pre>
<p>I have coded the above but when I run it, it outputs 30 and does not deplete the value to 3.
How can I have the loop do this? I know that num-- would work but that would only deplete the value by one. I'm new to c++ and I am trying to figure these things out.</p>
<p>Thanks! :)</p>
<p>//edit thanks I have it working now with num = num - 3, num-=3 works too</p>
|
c++
|
[6]
|
852,024
| 852,025
|
Generating a Deck of Cards
|
<p>I'm trying to make a simple blackjack program. Sadly, I'm having problems right off the bat with generating a deck of cards.</p>
<pre><code>#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<char> deck;
char suit[] = {'h','d','c','s'};
char card[] = {'2','3','4','5','6','7','8','9','10','J','Q','K','A'};
for (int j=0; j<13; j++) {
for (int i=0; i<4; i++) {
deck.push_back(card[j] suit[i]);
}
}
return 0;
}
</code></pre>
<p>I know my problem begins with me trying to assign the value '10' to a char. Obviously I couldn't get this to compile but I'm sure when I try to assign the card values to the vector deck I'll also get an error since I used variable type 'char'. Knowing what kind of variable type to use seems to be killing me. Also, would 'deck.push_back(card[j] suit[i]);' be the correct code to combine the card and suit, or do you have to put something between card[j] and suit[i]? I'd appreciate it if any of you could lead me in the right direction. Also as a little side note, this is part of a homework assignment so please don't just give me entire blocks of code. Thanks for your help.</p>
|
c++
|
[6]
|
3,139,878
| 3,139,879
|
Custom XML error with Android Build Tools (0.4.2) -- No resource identifier found for attribute 'gapWidth' in package 'xxx.xxxx.'
|
<p>Updated to the latest Android Build tools (0.4.2) and ran into the following when attempting to assemble:</p>
<p>/AndroidApp/App/build/res/all/flavor/debug/layout/fragment.xml:84:
error: No resource identifier found for attribute 'gapWidth' in package 'com.viewpagerindicator'</p>
<p><code>RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/build/res/com.viewpagerindicator"
android:layout_width="match_parent"
android:layout_height="match_parent" ></code></p>
|
android
|
[4]
|
2,919,051
| 2,919,052
|
Android How to restirct a zoom level on webview
|
<p>I wants to capture a webview as a bitmap. If captured a zoomed webview it getting out of memory exception. We need to restrict a zoom level according to the maximum bitmap size.</p>
|
android
|
[4]
|
582,313
| 582,314
|
Double conversion would solve it but there is not such a thing in C++, right?
|
<p>I have something like this...</p>
<pre><code>void f(dclass b);
class dclass
{
dclass(string s);
};
f("s");
</code></pre>
<p>This does not seem to work. In principle, it could with double conversion: <code>char* -> string -> dclass</code></p>
<p>So there is no such a thing in C++. Or maybe some compilers support it... Do you know a language where it may be possible?</p>
|
c++
|
[6]
|
3,505,430
| 3,505,431
|
TAG id for each TAG in a TAGHOST
|
<p><strong>I have a tabhost with two tabs in it. I want to access each TAB separately to perform some logic on each tab. need some guide.</strong> </p>
|
android
|
[4]
|
642,361
| 642,362
|
To avoid insertion on Refresh
|
<p>I have a button.In its click i hve written code for insertion.If i click on refresh in browser again insertion takes place and so the duplicate data enters to database.Is there any javascript to avoid insertion on refresh.Can anybody help?</p>
|
javascript
|
[3]
|
935,176
| 935,177
|
How to get user gmail contacts and send Email from android phone
|
<p>How to get the Gmail contacts data includes like first Name,Last-name B Day Email address Phone Number and the User Photo.How to send Email to a gmail contact from the android Phone.Using the Face Book SDK we can able to get the user contacts details but the Gmail is not come up with a SDK how to get these details.</p>
|
android
|
[4]
|
5,336,007
| 5,336,008
|
Use of Unassigned local variable
|
<p>I encountered an error. Despite declaring the variables (failturetext and userName) errors still appear. Can anyone please help me? </p>
<pre><code>- Use of Unassigned local variable "FailureText"
- Use of Unassigned local variable "UserName"
protected void Login1_LoginError(object sender, System.EventArgs e)
{
TextBox FailureText;
TextBox UserName;
//There was a problem logging in the user
//See if this user exists in the database
MembershipUser userInfo = Membership.GetUser(UserName.Text); // errors appear here
if (userInfo == null)
{
//The user entered an invalid username...
//error appear here ( failuretext.text)
FailureText.Text = "There is no user in the database with the username " + UserName.Text;
}
</code></pre>
<p>Thanks (: </p>
|
c#
|
[0]
|
470,192
| 470,193
|
New to Java and have the error "int cannot be dereferenced"
|
<p>I'm new to java and I've been working on this exercise for a while, but keep receiving the error: int cannot be dereferenced. I saw couple of similar questions but still cannot figure out my own case.
Here is the complete codes:</p>
<pre><code>package inclass;
class OneInt {
int n;
OneInt(int n) {
this.n = n;
}
@Override public boolean equals(Object that) {
if (that instanceof OneInt) {
OneInt thatInt = (OneInt) that;
return n.equals(thatInt.n); // error happens here
} else {
return false;
}
}
public static void main(String[] args) {
Object c = new OneInt(9);
Object c2 = new OneInt(9);
System.out.println(c.equals(c2));
System.out.println(c.equals("doesn't work"));
}
}
</code></pre>
<p>Thank you very much for helping me with this little trouble.</p>
|
java
|
[1]
|
2,905,450
| 2,905,451
|
Handling Android application pause on incoming call and resume after call end
|
<p>I want to pause my android application when the phone receives an incoming call. After the call ends, I want my applications to resume automatically.</p>
<p>How would this be implemented in an Android application?</p>
|
android
|
[4]
|
868,671
| 868,672
|
Where do you add iphone frameworks from
|
<p>I want to add the MessageUI Framework to my project.</p>
<p>The first time I did it, I selected</p>
<pre><code> /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1sdk/System/Library/Frameworks/MessageUI.framework
</code></pre>
<p>After I did that my project would no longer build - lots of syntax errors, and wouldn't build even after I told Xcode to delete the framework - still had syntax errors, just not quite as many.</p>
<p>So I went back to a back up of the project I'd made just before doing the add - thank goodness I had one - and tried again. This time I selected the MessageUI framework from</p>
<pre><code> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneOS3.1sdk/System/Library/Frameworks
</code></pre>
<p>Now the project builds fine.</p>
<p>I also noticed there was a MessageUI framework in the folder</p>
<pre><code> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneOS3.0sdk/System/Library/Frameworks
</code></pre>
<p>Why would I choose one over the other?</p>
|
iphone
|
[8]
|
4,081,184
| 4,081,185
|
Index being set to 3040 unexpectedly
|
<p>I am making a game in which there will be many enemies on the screen. Here is part of the code so far:</p>
<pre><code>private boolean update() {
pIndex += cSpd;
if (pIndex > path.length) return true;
cX = path[pIndex].x;
cY = path[pIndex].y;
return false;
}
</code></pre>
<p>The problem is that if there are too many enemies/objects on screen, it will throw an exception. (I don't know the precise amount of "too many," but I will definitely need to have more than this amount.) Here is the exception:</p>
<pre><code>Exception in thread "AWT-EventQueue-1" java.lang.ArrayIndexOutOfBoundsException: 3040
at Game$GamePanel$Circle.update(Game.java:152)
at Game$GamePanel$Circle.access$1(Game.java:149)
at Game$GamePanel.paintComponent(Game.java:110)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
...
</code></pre>
<p>I understand what it means. Line 152 is:</p>
<pre><code>cX = path[pIndex].x;
</code></pre>
<p>However, this is confusing because the line right before it is:</p>
<pre><code>if (pIndex > path.length) return true;
</code></pre>
<p>I don't understand why this is happening. <code>pIndex</code> and the other variable aren't static, so I don't know how other <code>Circle</code>s could affect it. Strangely, the index is <strong>always</strong> 3040 when it throws this exception. How can I fix this problem?</p>
|
java
|
[1]
|
3,842,345
| 3,842,346
|
Why do I have to initialize pointers as variables?
|
<p>This piece of code below works fine.
// example on constructors and destructors</p>
<pre><code>#include <iostream>
using namespace std;
class CRectangle {
int *width, *height;
public:
CRectangle (int,int);
~CRectangle ();
int area () {return (*width * *height);}
};
CRectangle::CRectangle (int a, int b) {
width = new int;
height = new int;
*width = a;
*height = b;
}
CRectangle::~CRectangle () {
delete width;
delete height;
}
int main () {
CRectangle rect (3,4), rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
</code></pre>
<p>But why couldn't I use another piece of code below instead? It didn't compile by using the code below but if I force to run it will still generate correct result.</p>
<pre><code>#include <iostream>
using namespace std;
class CRectangle {
//here I didn't initialize these two variables' pointers.
int width, height;
public:
CRectangle (int a,int b);
~CRectangle ();
int area () {
return (width * height);
}
};
CRectangle::CRectangle (int a, int b) {
width = a;
height = b;
}
CRectangle::~CRectangle () {
}
int main () {
CRectangle rect (3,4), rectb (5,6);
cout << "rect area: " << rect.area() << endl;
cout << "rectb area: " << rectb.area() << endl;
return 0;
}
</code></pre>
|
c++
|
[6]
|
640,569
| 640,570
|
Android handler skip/jump a second
|
<p>I am trying to implement a simple digital clock with second and two colons changing every second. I have thought about using DigitalClock but I want the colons to flash as well as the second and don't want to show am/pm. So I read the "Updating the UI from a Timer" and it suggests us to use Handler. So i use Handler and can change second and colons every second but the weird thing is that sometimes, it jumps a second (1,2,4,5,6). It seems the clock is a bit lagging. Is there any way to solve this problem? Thanks!</p>
<pre><code>tick_handler = new Handler();
Runnable updateSecond = new Runnable(){
@Override
public void run() {
second.setText(DataModel.getSeconds());
if(colon1.getVisibility()== View.VISIBLE){
colon1.setVisibility(View.INVISIBLE);
colon2.setVisibility(View.INVISIBLE);
} else {
colon1.setVisibility(View.VISIBLE);
colon2.setVisibility(View.VISIBLE);
}
tick_handler.postDelayed(this, 1000);
}
};
tick_handler.postDelayed(updateSecond, 0);
</code></pre>
|
android
|
[4]
|
5,597,796
| 5,597,797
|
Changing Beats per Minute of selected song
|
<p>I am working on an iPhone application where I want to change the Beats Per Minute (BPM) of the selected song. I am using AVAsset classes for that. </p>
<p>How it can be implemented? Any code help would be appreciated.</p>
|
iphone
|
[8]
|
27,205
| 27,206
|
Python function that works the same as s.upper
|
<p>So I am trying to create a function that capitalizes all of the letters of a string the same way s.upper would do, but in the format of a function. And I want to try to utilize ord() and chr() but stating that if the character of a string is >90 replace it with the character that is 32 less than the original ore. I feel like I have some of the pieces, but Im not sure how to actually put it together. I know I need a string accumulator, but how to fit them all together is not coming to me. So far I have this:</p>
<pre><code> def Uppercase(s):
x = ''
for ch in s:
x = -----> confused about what the accumulation would be
if ch ord() > 91:
s.replace(ch, chr(ord())-----> not sure that this is possible to implement
</code></pre>
|
python
|
[7]
|
5,988,754
| 5,988,755
|
Java: Syntax problem
|
<p>I want to use the above code for one more argument, say<code>args[2]</code>. Where should I make changes? Will <code>nextline</code> remain the same or does it become <code>nextline[1]</code>?</p>
|
java
|
[1]
|
5,817,996
| 5,817,997
|
How to assign values to JSON object
|
<p>I have the following code that does not work. I am trying to push the text "John" onto the end of the object. I am more familiar with PHP, and this works in PHP. </p>
<pre><code>var data = {};
var field_name = "first_name";
data[field_name]['answers'][] = "John";
alert(data['first_name']['answers'][0]);
</code></pre>
<p><strong>Edit:</strong></p>
<p>I also tried the following and it did not work.</p>
<pre><code>var data = {};
var field_name = "first_name";
var i=0;
data[field_name]['answers'][i] = "John";
alert(data['first_name']['answers'][0]);
</code></pre>
|
javascript
|
[3]
|
951,951
| 951,952
|
how to check if an ImageView is attcahed with image in android
|
<p>I am setting an image to ImageView in android code not in xml, but could not make out how to check whether that image has been set in or not in java.</p>
<p>Tried with <code>imageViewOne.getVisibility() == 0</code>
but it is not working</p>
<p>If image has been set to ImageView then I am attaching that image for sending mail.</p>
|
android
|
[4]
|
5,520,534
| 5,520,535
|
What is the best way to create a HashMap of String to Vector of Strings in C++?
|
<p>Criteria, don't want creating copies of objects all over the place.
Should be fast, memory efficient and should not create leaks.
Should be threadsafe.</p>
<p>Ideally I would want to store pointers to vectors in the HashMap, but I am worried about memory leaks that way.</p>
<p>Is this the best way?</p>
<pre><code>std::map<std::string, std::auto_ptr<std::vector<std::string> > > adjacencyMap;
</code></pre>
|
c++
|
[6]
|
3,472,262
| 3,472,263
|
read file with ip range and see if supplied IP matches any range in file
|
<p>I am trying to read a file with ip/mask ranges and if the supplied IP matches any range in the file it will return with TRUE or similar function. Here is the code I have below</p>
<pre><code>function myip2long($ip) {
if (is_numeric($ip)) {
return sprintf("%u", floatval($ip));
} else {
return sprintf("%u", floatval(ip2long($ip)));
}
}
function ipfilter($ip) {
$match = 0;
$ip_addr = decbin(myip2long($ip));
if (file_get_contents('./countryip/all-zones/us.zone')) {
$source = file('./countryip/all-zones/us.zone');
foreach ($source as $line) {
$network = explode("/", $line);
$net_addr = decbin(myip2long($network[0]));
$cidr = $network[1];
if (substr($net_addr, 0, $cidr) == substr($ip_addr, 0, $cidr)) {
$match = 1;
break;
}
}
}
return $match;
}
$user_ip = $_SERVER['REMOTE_ADDR'];
if (ipfilter($user_ip) == 1) echo "<br />allowed! Your IP is a United States IP!";
else echo "deny!";
</code></pre>
<p>An example file (like the one in the example above) is available here
<a href="http://www.ipdeny.com/ipblocks/data/countries/us.zone" rel="nofollow">http://www.ipdeny.com/ipblocks/data/countries/us.zone</a></p>
<p>Not sure if the code above is correct, I got it from here'
<a href="http://www.php.net/manual/en/function.ip2long.php#86793" rel="nofollow">http://www.php.net/manual/en/function.ip2long.php#86793</a></p>
|
php
|
[2]
|
1,179,296
| 1,179,297
|
increase and decrease date
|
<p>I want to increase and decrease date on image button click.e.g. < 10/11/09 >.
how can i do that???</p>
|
asp.net
|
[9]
|
5,752,260
| 5,752,261
|
Programing exercise
|
<p>Hi I have been doing the Javabat exercises and I have found myself in a bit of a snag with this problem:</p>
<p>We'll say that a String is xy-balanced if for all the 'x' chars in the string, there exists a 'y' char somewhere later in the string. So "xxy" is balanced, but "xyx" is not. One 'y' can balance multiple 'x's. Return true if the given string is xy-balanced. </p>
<pre><code>xyBalance("aaxbby") → true
xyBalance("aaxbb") → false
xyBalance("yaaxbb") → false
</code></pre>
<hr>
<pre><code>public boolean xyBalance(String str) {
if(str.length() < 2){
if(str == "x"){
return false;
}
return true;
}
for (int i = 0 ; i < str.length()- 1;i++){
if (str.charAt(i)=='x' && str.charAt(i + 1) == 'y'){
return true;
}
}
return false;
}
</code></pre>
|
java
|
[1]
|
439,031
| 439,032
|
"Function expected" error when updating frames with javascript in IE9
|
<p>We're using some javascript to update a child frame. This has been working fine in IE7 and IE8 but only works in IE9 when compatibility mode is switched on. I've added the code fragment below. I've tried various solutions including using window instead document but nothing seems to work. The error "Function expected" is always given.</p>
<p>Any help be would much appreciated!
Thanks, Andrew</p>
<pre><code> <script language="jscript">
function UpdateContent(strAddress) {
document.frames("content").document.location.replace(strAddress);
}
</script>
</code></pre>
|
javascript
|
[3]
|
2,255,780
| 2,255,781
|
Modification to the timezone of my function to add 9 hours on the output result
|
<p>I am trying to get correctly the difference of the current time and a blog's post. When I echo the post's time I get this <code>Sun, 05 Jun 2011 07:24:00 +0000</code> while the correct time should be <code>Sun, 05 Jun 2011 10:24:00 +0000</code> it's also shown on the XML feed.</p>
<p>With <code>time();</code> I get the current time. My current time is 19:44. and this is the output of the function below <code>'day': 5,'month': 0,'year': 0,'hour': 2,'min': 14,'sec': 37</code> 5 days, 2 hours, 20 mins and 37 sec.</p>
<p>How can I correctly show the passed time, by adding 9 hours to the output result ? ( It should be 12 hours but the 3 are "lost" as I said above).</p>
|
php
|
[2]
|
4,333,159
| 4,333,160
|
Syncing like GMail
|
<p>I have an application in which the user can edit/add records offline and they should be sent to the server as soon as the Internet connection is established. It seems to be the exact behavior of the GMail application:</p>
<p>You can write an email offline, click "Send", close the application/process, and when the Internet connection is back, a sync is performed which sends the email to the server.</p>
<p>The problem is that I already have a SyncAccount with a SyncAdapter running a daily sync. If I were to add a second sync using <strong><em>ContentResolver.addPeriodicSync</em></strong>, I would have to create another authority and thus would have to use different database tables? </p>
<p>Can I schedule two sync operations independent from each other, accessing the same database?</p>
|
android
|
[4]
|
3,453,189
| 3,453,190
|
designing class hierarchy for typical characters in role playing game
|
<p>I'm trying to design a simple role playing game which has your typical character types like fighter, wizard, cleric, theif, etc. I need advice on a good way to setup the class hierarchy. </p>
<p>My initial attempt was to create a class of type "Character" and make the fighter, wizard, cleric, derived types from "Character".</p>
<p>But then I thought it might be better to create a "Character" class and then use the decorator pattern. So say a fighter decorator, wizard decorator, etc.</p>
<p>Or is there a different way that would be better?</p>
|
c#
|
[0]
|
3,825,958
| 3,825,959
|
Jquery problem collapsing div
|
<p>Please see this <a href="http://jsfiddle.net/yv8uw/1/" rel="nofollow">http://jsfiddle.net/yv8uw/1/</a></p>
<p>When you click "View all Comments" the box opens up all right.... but when you click again, it doesn't collapse back like it was supposed to... please help.</p>
|
jquery
|
[5]
|
4,542,623
| 4,542,624
|
Calling a function within a variable declaration
|
<p>In my lifelong quest to write my entire code on a single line, and give all the psychopathic maintainers nightmares, I ask the following question:</p>
<p>Is there any way I can instantiate an object, assign it to a variable, and call a function on the instantiation on the same line?</p>
<p>Eg I have:</p>
<pre><code>var abc=new window();
window.show()
</code></pre>
<p>But i want something along the lines of...</p>
<pre><code>(var abc= new window).show()
</code></pre>
|
javascript
|
[3]
|
4,173,310
| 4,173,311
|
How do i fix an edittext and a send button at bottom of my List View?
|
<p>I have a list view in which i m getting my data from server. but at the bottom i need an edit text and a send button so that its like a chat app. where i can type my message and send it back to server and it adds to my list view at the same tym.</p>
<p>Plz give me some suggestions. Thanks in advance.</p>
|
android
|
[4]
|
3,625,798
| 3,625,799
|
Change layout for Preference screen
|
<p>I have a Preference screen and also two <code>EditTextPreference</code>. </p>
<p>I want to change its background color and font and also to add an image in its background.</p>
<p>How can I do that?</p>
<p>Here it the code as shown below for the layout in XML:</p>
<pre><code><PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="Login Information"
android:key="first_category">
<EditTextPreference
android:key="@string/txtusername"
android:title="@string/username"
android:summary="@string/userNameSummary" />
</PreferenceCategory>
<PreferenceCategory
android:title="Device Information"
android:key="Device">
<EditTextPreference
android:key="welcome_message"
android:title="DeviceId"
android:summary="This is your mobile device ID"
android:shouldDisableView="true" />
</PreferenceCategory>
</PreferenceScreen>
</code></pre>
|
android
|
[4]
|
4,265,498
| 4,265,499
|
Jquery Styling for Autocomplete
|
<p>This is driving me nuts!!! I'm using the JQuery Autocomplete UI 8.1 and everything works fine except for my styling on the autocomplete dropdown list hovering. I've narrowed it down to the following line in jquery-ui-1.8.11.custom.css. It seems that I can not add font-weight:bold to the line and get results. Can someone verify this? The CSS line is as follows:</p>
<pre><code>.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus
{
background: #394b6f url(images/ui-bg_highlight-soft_0_394b6f_1x100.png) 50% 50% repeat-x;
color: #d9d9d9;
font-size:1.1em;
}
</code></pre>
|
jquery
|
[5]
|
3,958,423
| 3,958,424
|
Is there any good way of SELF-updating running web application?
|
<p>as stated - it needs to be a "self-update" similar like Wordpress... I haven't thought through because of my knowledge limits... (I haven't found any good answer from the web yet /asp.net c#)</p>
<p>anyone can give some help/ perhaps some code example would be better?</p>
<p>Thanks in advance!</p>
|
asp.net
|
[9]
|
1,389,055
| 1,389,056
|
Android: Trying to create a dialog within a AsyncTask<String object
|
<p>I'm using a AsyncTask
<p>I use parent to create the intent no errors.</p>
<p>The line to creat a dialog gives a
parent cannot be resolved to a ye.
new parent.AlertDialog.Builder(this)</p>
<p>The error I get is that parent does not exist, but I use parent in the same methed to call the intent</p>
<p>code block
private class SendTextOperation extends AsyncTask {</p>
<pre><code> @Override
protected void onPreExecute() {
//Update UI here
}
@Override
protected String doInBackground(String... params) {
// Talk to server here to avoid Ui hanging
rt=TalkToServer("http://besttechsolutions.biz/projects/bookclub/login.php");
return(rt);
}
@Override
protected void onPostExecute(String result) {
if (rt.contains("ok"))
{
Intent i = new Intent(parent, cChat.class);
startActivity(i);
}
else
{
new parent.AlertDialog.Builder(this)
.setTitle("Game Over")
.setMessage("Your time is up, You saved "
+" Million more people!!")
.setNeutralButton("Try Again",new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dlg, int i)
{
}} ).show();
}
}
}
</code></pre>
|
android
|
[4]
|
6,014,876
| 6,014,877
|
Program has error lines which are remarked by ???? .I could not understand where the problem is
|
<pre><code>public static void main (String args[]) {
Scanner myinput=new Scanner(System.in) ; //Arrary length comes from user!
System.out.println("Enter a number: ") ;
int sayi=myinput.nextInt() ;
int [] Array = new int [sayi] ;
for(int i=0; i<SayiDizisi.length ; i++){ //Fill the array!(Comes from user)
System.out.println("Enter the numbers: ") ;
SayiDizisi[i]=myinput.nextInt() ;}
}
Max(int [] SayiDizisi) ; // ???????????????????????????????????
}
public static int Max(int [] Array1) {
int max=SayiDizisi1[0] ;
for(int i=0; i<SayiDizisi1.length ; i++) {
if(SayiDizisi1[i]>max)
max=SayiDizisi1[i] ;
}
return SayiDizisi ; //?????????????????????
}
}
</code></pre>
|
java
|
[1]
|
1,502,351
| 1,502,352
|
python .rstrip removes one additional character
|
<p>I try to remove seconds from date:</p>
<pre><code>>>> import datetime
>>> test1 = datetime.datetime(2011, 6, 10, 0, 0)
>>> test1
datetime.datetime(2011, 6, 10, 0, 0)
>>> str(test1)
'2011-06-10 00:00:00'
>>> str(test1).rstrip('00:00:00')
'2011-06-10 '
>>> str(test1).rstrip(' 00:00:00')
'2011-06-1'
</code></pre>
<p>Why 0 at end of '10' is removed?</p>
|
python
|
[7]
|
1,084,684
| 1,084,685
|
Asp.net LoadViewState and ItemCommand Never Firing
|
<p>I converted one of my apps a little while ago from .NET 2 to .NET 4 and I've just noticed a problem on a couple of pages. For some reason the <code>LoadViewState</code> and Itemcommand (repeater) are never fired so the page is not working. This was working before and now it's not! I've tried all sorts but can never get any of of the events to trigger/debug.
<code>Viewstate</code> is enabled at the page level and this is running in a usercontrol.</p>
<p>Just wondering if anyone had some ideas I could try as I'm really stuck with this now.</p>
<p>Thanks,</p>
<p>Dan</p>
|
asp.net
|
[9]
|
5,327,496
| 5,327,497
|
How do I play videos sequentially; one after the other?
|
<p>I am developing an Android application in which I am reading video links from web services and displaying them in a ListView. I want it so that when I click on any video link it starts playing and at end of that video the next video starts playing automatically (just like a playlist).</p>
|
android
|
[4]
|
4,151,117
| 4,151,118
|
Modifying a class name through reference to the parent with jQuery
|
<p>I had some help and some suggestions on how to remove a class name. </p>
<p><a href="http://stackoverflow.com/questions/9257348/how-can-i-remove-a-class-from-an-element-with-jquery-based-on-some-characters-of/9257394#9257394">Previous answer</a></p>
<p>These worked in fiddle but my application is just a bit different. I have the following:</p>
<pre><code><span id="refType_1" class="refType indent_02">Link Header</span>
</code></pre>
<p>My javascript looks like this:</p>
<pre><code>if (action == "Edit") {
var parent = linkObj.closest("tr");
parent.find(".refType").html($("#Type :selected").text()); // 1
parent.find(".refType").className.replace(/indent_\d+($|\s)/, "xxx");
parent.find(".refType").trim(this.className.replace(/(^|\s)indent_\d+($|\s)/, " "));
</code></pre>
<p>I tried the last two ways of replacing the class name with "" but both give me an error. For example the last method gives the following:</p>
<pre><code>SCRIPT438: Object doesn't support property or method 'trim'
</code></pre>
<p>I think I'm 99% towards getting it working but would appreciate advice. I tried a few different ways so far and it still does not work. </p>
<p>Please note the line with comment // 1 does work. I can change the contents of the span as needed. What does not work is:</p>
<pre><code>parent.find(".refType").className.replace(/indent_\d+($|\s)/, "xxx"); or
parent.find(".refType").trim(this.className.replace(/(^|\s)indent_\d+($|\s)/, " "));
</code></pre>
<p>These are my two different attempts to get the text indent_xx to be removed from the span.</p>
|
jquery
|
[5]
|
1,095,596
| 1,095,597
|
Share Intent not give me an option
|
<p>I am developing an app in which i would like to share my data through facebook,twitter,gmail,message or many more option which are provide by <code>share intent</code> do simply i have goto this code ..</p>
<pre><code> Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE );
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
</code></pre>
<p>but here problem is when i am run an app it show only message screen (where <code>to</code> blah blah, type to compose and send button) ii cant give me those all option. so please help me out this...</p>
|
android
|
[4]
|
626,948
| 626,949
|
NSurl connection delegates are not called
|
<p>This is my code for getting image from url but the delegate methods are not getting invoked.why?</p>
<pre><code>NSString *urlLink = [NSString stringWithString:appRecord.imageURLString];
self.urlString=urlLink;
NSURL *url=[NSURL URLWithString:urlLink];
NSMutableURLRequest *request=[[NSMutableURLRequest alloc] initWithURL:url];
NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
self.imageConnection=conn;
[conn release];
</code></pre>
|
iphone
|
[8]
|
2,052,200
| 2,052,201
|
Why is there a difference in the way functions are created in javascript?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname">Javascript: var functionName = function() {} vs function functionName() {}</a> </p>
</blockquote>
<p>I have code with functions defined in two ways:</p>
<pre><code>var retrieveData = function (statusValue, statusText)
{
...
}
function retrieveData(statusValue, statusText) {
..
}
retrieveData(1,2);
</code></pre>
<p>Can someone explain what the difference is. Seems that the second way of setting up the function is much simpler.</p>
|
javascript
|
[3]
|
904,769
| 904,770
|
Managing user progression through a form with JQuery
|
<p>I have a very long horizontal form that is separated into multiple sub-forms, acting as <em>slides</em>. </p>
<p>Only one <em>slide</em> is visible at any given time, however they each have a button that allows going on to the next section, without actually submitting the form. I also would like the user to be able to navigate back so I added buttons that let the user go back and forward. I use the JQuery validate plugin to validate user input.</p>
<p>How do I prevent the user from navigating through the form if the information is in an incorrect state?</p>
|
jquery
|
[5]
|
49,549
| 49,550
|
AutoCompleteTextView and input type in Android
|
<p>When I give inputtype as "TextUri" for AutoCompleteTextView, the keyboard shows up and after entering the url when I click on Done, instead of going away it's still getting displayed in the screen..</p>
<p>To hide the keyboard,I need to press backbutton..</p>
<pre><code> <AutoCompleteTextView android:id="@+id/autocomplete_country"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textUri"/>
</code></pre>
|
android
|
[4]
|
3,322,303
| 3,322,304
|
Why is it said that the java language was developed on top of C, C++?
|
<p>Why is it said that the java language was developed on top of C, C++ ? </p>
<p>Is that because java virtual machine was developed in C, C++ ?
because of the use of native functions in some classes?</p>
|
java
|
[1]
|
1,752,116
| 1,752,117
|
How to know where the input/element goes to after the blur event?
|
<p>I tried this, but it is undefined:</p>
<pre><code>alert($(ev.relatedTarget).attr('name'));
</code></pre>
<p>I have a combobox (textbox and a button), I don't want the code to continue processing if the input goes to its partner control(button). I want to detect from textbox blur that it is leaving the whole combobox not just the textbox. Textbox's blur will naturally trigger when I click its partner button. The only ideal logic I can think of is to detect from textbox's blur that the focus destination is not its partner button, if the relatedTarget is its partner button don't continue processing.</p>
|
jquery
|
[5]
|
1,674,899
| 1,674,900
|
How to check if object has any properties in JavaScript?
|
<p>Assuming I declare </p>
<pre><code>var ad = {};
</code></pre>
<p>How can I check whether this object will contain any user-defined properties?</p>
|
javascript
|
[3]
|
4,923,746
| 4,923,747
|
Rewriting problem while loggin in iPhone
|
<p>i am using following code to log into a file...</p>
<pre><code>NSData *dataToWrite = [[NSString stringWithString:@"log data"] dataUsingEncoding:NSUTF8StringEncoding];
NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *path = [docsDirectory stringByAppendingPathComponent:@"fileName.txt"];
[dataToWrite writeToFile:path atomically:YES];
</code></pre>
<p>But when this method gets called again...it doest show the last entry...??</p>
<p>Could anyone suggest?</p>
<p>thanks</p>
|
iphone
|
[8]
|
3,943,492
| 3,943,493
|
How to target specific paragraphs within an HTML string in PHP
|
<p>A simple one for all your PHP guys out there.
I have a string which represents a portion of HTML. It looks something like this:</p>
<pre><code><p>blablabla.....</p>
<p>blablabla.....</p>
<p>blablabla.....</p>
<p>blablabla.....</p>
<h3>hello</h3>
<p>blablabla.....</p>
<p>blablabla.....</p> etc etc
</code></pre>
<p>What I would like to do is loop over the nodes applying a class to each, until I hit the h3.</p>
<p>Thanks,</p>
<p>EDIT
I have so far tried:</p>
<pre><code>$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
foreach ($dochtml->childNodes as $node)
{
if($node->tagName == "p") {
$node->setAttribute('class', 'someclass');
} else {
break;
}
}
</code></pre>
<p>Which simply doesn't work.</p>
<p>The HTML fragment is from a database and represents the editable portion of a page within a CMS. </p>
|
php
|
[2]
|
4,021,305
| 4,021,306
|
In App Purchase Receipt verification within app
|
<p>I want to verify the transaction receipt within my app,</p>
<p>Here is my code,</p>
<pre><code>- (void)recordTransaction:(SKPaymentTransaction *)transaction {
NSData *receiptData = [NSData dataWithData:transaction.transactionReceipt];
NSString *encodedString = [Base64 encode:receiptData];
NSURL *url = [NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setPostValue:encodedString forKey:@"receipt-data"];
[request setRequestMethod:@"POST"];
[request setDelegate:self];
[request startAsynchronous];
}
</code></pre>
<p>I am getting output: </p>
<p>{"status":21002, "exception":"java.lang.NullPointerException"}</p>
<p>Can someone help me to get proper receipt verification?</p>
|
iphone
|
[8]
|
82,744
| 82,745
|
Cannot Bind my Listview
|
<p>I want to bind my Listview but I can't. I dont know what I am doing wrong here. When I press ctrl+f5, the page is empty.</p>
<p>My Code is:</p>
<pre><code><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Student_ID">
<LayoutTemplate>
<table id="itemplaceholderContainer" runat="server">
<tr id="itemplaceholder">
<td>
Student ID :
</td>
<td>
Registration Number :
</td>
<td>
Student Name :
</td>
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
StudentID:
<asp:Label ID="LabelID" runat="server" Text='<%Eval("Student_ID") %>'></asp:Label>
StudentRegistrationNumber:<asp:Label ID="LabelNumber" runat="server" Text='<%Eval("StudentRegistrationNumber") %>'></asp:Label>
StudentName:<asp:Label ID="LabelName" runat="server" Text='<%Eval("Name") %>'></asp:Label>
</ItemTemplate>
</asp:ListView>
</asp:Content>
</code></pre>
<p>Codebehind is :</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(@"Data Source=LOCALHOST;Initial Catalog=ITCF;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Select * from Student", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.fill(dt);
ListView1.DataSource = dt;
ListView1.DataBind();
}
</code></pre>
|
asp.net
|
[9]
|
3,970,188
| 3,970,189
|
Javascript. Compare UNIX timestamps
|
<p>I got two timestamps in unix format and I need to find a way to compare them and to find out which one is the newest (closest to present date).</p>
<p>The two timestamps are:</p>
<ul>
<li>1299925246</li>
<li>1300526796</li>
</ul>
<p>Is there a simple way of doing this in Javascript?</p>
|
javascript
|
[3]
|
2,726,350
| 2,726,351
|
What is Change the source attachment in android
|
<p>I am trying to debug a android application. I got error-</p>
<p>"The JAR file C:\Android\android-sdk-windows\platforms\android-8\android.jar has no source attachment" </p>
<p>What is this error exactly?</p>
<p>Thanks.</p>
|
android
|
[4]
|
1,558,505
| 1,558,506
|
Timer doesn't stop
|
<p>Basically when a user wins a game I want to animate (counting up) from the original score to the new score. </p>
<p>I'm trying to do this using a timer as shown below</p>
<pre><code> public final void updatePlayerScore(final int newScore){
final Timer t = new Timer();
TimerTask tt = new TimerTask() {
@Override
public void run() {
mHandler.post(new Runnable() {
public void run() {
initialScore++;
// update TextView
scoresTextView.setText("" + initialScore);
if(initialScore >= newScore){
t.cancel();
mHandler2.postDelayed(mLaunchNextQuestion,1000);
}
}
});
}
};
t.scheduleAtFixedRate(tt, 0, 2);
</code></pre>
<p>The initial score gets incremented upwards every time the TimerTask is called (every 2 milliseconds) when the initialScore equals or is greater than the newScore - it should cancel the timer and then load a new activity mLaunchNextQuestion.</p>
<p>What is happening in reality is that mLaunchNextQuestion is getting called more than once. I'm guessing this is because either timer.cancel is not working or the timer is running to fast to be cancelled?</p>
<p><strong>UPDATE---</strong></p>
<p>Thanks for the advice on the refresh rate being too quick. I ended up ditching the timer and instead used a runnable that calls itself after a delay.</p>
<pre><code>private Runnable updatePlayerScoreNew(final int newScore){
Runnable aRunnable = new Runnable(){
public void run(){
if (initialScore >= newScore) {
mHandler.postDelayed(mLaunchNextQuestion,1000);
} else {
initialScore+=40;
if(initialScore > newScore){
scoresTextView.setText("" + newScore);
}else{
scoresTextView.setText("" + initialScore);
}
mHandler.postDelayed(updatePlayerScoreNew(newScore), 40);
}
}
};
return aRunnable;
}
</code></pre>
|
android
|
[4]
|
4,834,447
| 4,834,448
|
Android display gradient image
|
<p>I use the below code to test gradient image.</p>
<pre><code>myView=(ImageView)findViewById(R.id.imgView);
bitmap = BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
if(bitmap!=null){
myView.setImageBitmap(bitmap);
}
</code></pre>
<p>The gradient image can display normal when I compile it in sdk 10-13 of android2.3-android3.1. If I compile this in the sdk 15 of android4.0, the gradient image can not display and have the clear outline.</p>
<p>I check on line it said that the default format is rgb565 in android 4.0. And I need to set the format <code>getWindow().setFormat(PixelFormat.RGBA_8888);</code> to show 24 bits image. But it still can not display.</p>
<p>How to do this? Thanks!</p>
|
android
|
[4]
|
1,152,752
| 1,152,753
|
Is it possible to get the the createTextNode method to render html tags?
|
<p>The following code prints</p>
<p><strong>This should print</strong>(b)This should print(/b)<strong>This should print</strong></p>
<pre><code><script>
function produceMessage(){
var msg= '<b>This should print</b>';
return msg;
}
</script>
<span id="mySpan"></span>
<script>
document.body.appendChild(document.createTextNode(produceMessage()));
document.write(produceMessage());
document.getElementById('mySpan').innerHTML=produceMessage();
</script>
</code></pre>
|
javascript
|
[3]
|
4,836,941
| 4,836,942
|
Get a single columns
|
<pre><code><?php
include('config.php');
$result=mysql_query('select * from userinfo');
$row = mysql_fetch_row($result);
$count=mysql_num_rows($result);
echo $row[1];
echo $count;
?>
</code></pre>
<p>This displays only the column 1 data. I want to get the whole first column in an array </p>
|
php
|
[2]
|
4,964,674
| 4,964,675
|
Payment APIs in android
|
<p>Is there any google payment APIs for android like we are having "paypal" ?
And
I want to implement credit card payment process in my android application. There is a form in my application. User will enter his card information and on submission the service will verify and accept or reject the card. I have no idea if there is any API or a tutorial available in android. Please help me if someone knows how to do that.</p>
|
android
|
[4]
|
192,554
| 192,555
|
working with pseudo-elements jquery
|
<p>I have an HTML table with some <code><tr></code> and <code><td></code>, and I need to set some attributes to certain <code><td></code> elements. So, the problem is:</p>
<p>If I write the selector <a href="http://jsfiddle.net/JTyju/3/" rel="nofollow"><strong>this way</strong></a>:</p>
<pre><code>$("table tr:not(table tr:first)").css("background","#ccc");
</code></pre>
<p>it works fine, but if I try to use a specific table, nothing happens:</p>
<pre><code>$("#tableTit tr:not(#tableTit tr:first)").css("background","#ccc");
</code></pre>
<p>What am I missing?</p>
|
jquery
|
[5]
|
2,562,750
| 2,562,751
|
Using JQuery inside a boxy modal
|
<p>I'm working on a site which has a modal window (using boxy) with a form. Inside document ready I have the following to load up the modal window:</p>
<pre><code>$("#confirm").boxy({title: "Title", modal: true});
</code></pre>
<p>Where the link is:</p>
<pre><code><a id="confirm" href="/confirm/">Confirm order</a>
</code></pre>
<p>And this runs fine where /confirm/ loads up a new html in the modal window.</p>
<p>But in the modal window I want to do some JQuery manipulations. But even simple things don't work. For example:</p>
<pre><code>$("#link").click(function () {
console.log('logging...');
});
</code></pre>
<p>Where "link" is the id on a link in the modal window, but when I click the link nothing happens. If I comment out the top and bottom lines (only have the console.log line it DOES log to the console...)</p>
<p>Everything works fine if I run this in a separate window. Am I missing something obvious?</p>
<p>Regards,
AndriJan</p>
|
jquery
|
[5]
|
3,540,885
| 3,540,886
|
look inside application pool to see what is wrong
|
<p>Hello I have a problem with Silverlight software Who is working with WCF Service
it is a very big Solution with 12 projects
i now get the the Solution to My responsibility
The problem WCF service randomly stops responding.
When recycling Application Pool
it fix the problam WCF service start reply again
and the application work</p>
<p>So what I did DOS software
Which checks If
WCF returns a reply
If not return reply. Makes recycling
Application Pool.
but this is not the solution i want
i need to some how look inside application pool to see what is wrong</p>
<p>the software is install on win2003 iis6
silverlight 4 .net 3.5</p>
|
asp.net
|
[9]
|
1,889,427
| 1,889,428
|
why base64EncodeData does't work?
|
<pre><code>NSString *result = [encData base64EncodeData:encData];
</code></pre>
<p>why base64EncodeData does't work??
it had the message like:</p>
<blockquote>
<p>-[NSConcreteData base64EncodeData:]: unrecognized selector sent to instance 0x4e1f020</p>
</blockquote>
<p>Any suggestion??</p>
|
iphone
|
[8]
|
1,720,174
| 1,720,175
|
How to change the graphic of the SDK Sample "Compass"?
|
<p>I m using this sample for android sdk <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.html" rel="nofollow">http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.html</a></p>
<p>In that sample,the compass is like that</p>
<p><img src="http://i.stack.imgur.com/9Bumg.jpg" alt="enter image description here"></p>
<p>I would like to use a graphic for the compass as this one for example <img src="http://i.stack.imgur.com/niNl3.jpg" alt="enter image description here"></p>
<p>Is that possible?Maybe my question is stupid but i have never used graphics like that before!Thanks</p>
|
android
|
[4]
|
5,177,432
| 5,177,433
|
Why the size of a class is getting increased by 1 if I inherit more than 2 classes in C++
|
<p>In the following code snippet, If I inherit the first 2 classes the size of derived class is 1, from omwards if inherit more number of classes to derived the size of derived class is getting incresed by those many number of classes. Why?</p>
<pre><code>// Remove the comment one by one at derived class (//Base1, //Base2//, Base3//, Base5, //Base6) and check.
struct Base {
Base(){}
};
struct Base1 {
Base1(){}
};
struct Base2 {
Base2(){}
};
struct Base3 {
Base3(){}
};
struct Base5 {
Base5(){}
};
struct Base6 {
Base6(){}
};
struct Derived : Base, Base1, Base2//, Base3//, Base5, //Base6
{
public:
Derived(){}
};
int main() {
Derived der;
cout << "Sizeof der: " << sizeof(der) << endl;
}
</code></pre>
|
c++
|
[6]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.