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 |
---|---|---|---|---|---|
1,556,331 | 1,556,332 |
How to pass $this to non-object function
|
<p>When I pass <code>$this</code> to a function, I got error message like this, <code>The function does not exists.</code> </p>
<pre><code>// In class A
class A extents F
{
function m()
{
Do($this);
}
function t()
{
}
}
class B extents F
{
function m()
{
Do($this);
}
function t()
{
}
}
// Some where in .inc.php file
function Do(F $obj)
{
$obj->t();
}
</code></pre>
<p>Actually, I have many classes inherit from one base class. All those class have some functions in common. I need a function to deal them all.</p>
|
php
|
[2]
|
3,054,600 | 3,054,601 |
Asp.net LoginStatus - 'log out' shows but not logged in yet
|
<p>Why does my loginStatus show 'log out' even though I've not actually logged in yet?</p>
<pre><code><asp:LoginStatus ID="LoginStatus1" runat="server"
LoginText="Log In"
LogoutText="Log Out"
LogoutPageUrl="~/Default.aspx"
LogoutAction="Redirect" />
</code></pre>
|
asp.net
|
[9]
|
1,063,917 | 1,063,918 |
Covert list of Tuples to Dictionary
|
<p>Ho to convert in the shortest way a list of Tuples to Dictionary (C#) ?</p>
<pre><code>IList<Tuple<long, int>> applyOnTree = getTuples();
</code></pre>
|
c#
|
[0]
|
4,957,275 | 4,957,276 |
Resize layout after an image transformation android
|
<p>I have a layout in which I resize an image by doing a transformation with prescale. After the scale the image has the right size, but the layout container around it cuts its size of. I want the layout container arround it to show to complete image.</p>
<p>I just tried invalidate on the image, the container as well as requestLayout(). Any ideas?</p>
<p>Thanks</p>
|
android
|
[4]
|
54,734 | 54,735 |
Unreachable Code when using setContentView()
|
<p>I have the following code:</p>
<pre><code>public boolean onCreateOptionsMenu(Menu menu)
{
menu.add(0, AUSRECHNEN_ID, Menu.NONE,"Umrechnen");
return super.onCreateOptionsMenu(menu);
setContentView(R.layout.main);
}
</code></pre>
<p>I get an "unreachable code" warning right next to the <code>setContentView()</code> method.</p>
<p>What am I doing wrong?</p>
|
android
|
[4]
|
4,778,577 | 4,778,578 |
jquery cross browser solution
|
<p>What is the jQuery equivalent to the following:</p>
<pre><code>function stopEvent(evt) {
if (window.event) window.event.cancelBubble = true;
else evt.stopPropagation();
}
</code></pre>
|
jquery
|
[5]
|
4,293,748 | 4,293,749 |
How to display a score integer in python
|
<pre><code>score=0
score=+1
print"your score so far is " str+(score)
</code></pre>
<p>The syntax error is appearing in the "str" but i dont understand whats wrong</p>
|
python
|
[7]
|
2,413,950 | 2,413,951 |
Javascript and basic programming concepts
|
<p>I'm looking to deepen my knowledge in how Javascript works.<br>
I started learning JS without any programming background and it seems I lack some fundamental understanding of programming, things like <code>stack</code> <code>pointers</code> <code>memory usage</code> <code>prototyping</code> etc,
Where can I learn those things online\from a book?</p>
|
javascript
|
[3]
|
2,224,237 | 2,224,238 |
Match a select box value when another select box value is chosen/
|
<p>We're creating a select box of countries for billing and delivery.</p>
<p>When one select box is chosen for billing we want it to update the delivery select box..</p>
<p>Any ideas? </p>
|
jquery
|
[5]
|
448,875 | 448,876 |
How to add Preference in ICS
|
<p>I need to add Preference in ICS using <code>addPreferencesFromResource()</code>.<br>
It is shown as deprecated in ICS.<br>
I've added a preference layout in xml folder but this could not be added to the Preference activity.</p>
<p>How can I add it?</p>
|
android
|
[4]
|
5,989,971 | 5,989,972 |
Jquery [name=var] substitution
|
<p>Is there a way to use a variable in the name= parameter.</p>
<p>I would like to be able to do:</p>
<pre><code>var a = 1;
$("#gen_p").html($("input:radio[name='gen'+a]:checked").val()));
</code></pre>
<p>I am able to do <code>$("#gen_p"+a)</code> but not in the <code>[name=??]</code></p>
<p>Have I missed something?</p>
<p>Thanks</p>
|
jquery
|
[5]
|
661,713 | 661,714 |
how to fix jquery calendar on IE browser?
|
<p>anyone of you who is experiencing the same problem as mine, wherein, the JQuery calendar keep on popping out even after the user selected a date already via IE. what's the solution to fix this ?..because in other browsers such as FF,Chrome, Safari ,the jquery calendar work.
here's the simple code i use in all my date input field</p>
<pre><code>$(function(){
$('#datepicker').datepicker({changeYear: true,changeMonth: true,yearRange:'1940:2011',defaultDate:+7});
})
</code></pre>
|
jquery
|
[5]
|
4,273,978 | 4,273,979 |
Reuse an object
|
<p>I'm wondering if this is good, bad?</p>
<pre><code>SelectRecipientResponse user = SomeUtil.SelectRecipient(p.Email, p.ListID.ToString());
bool userIsInList = user.ExistsInList;
bool userIsOptedOut = user.IsOptedOut;
user = null;
user = SomeUtil.SelectRecipient(p.Email, _masterSuppressionListID);
bool userIsInSupressionList = user.ExistsInList;
</code></pre>
<p>so I'm using one instance of user to check to see if they are in 2 lists. Lists I am checking are over a 3rd party API. I want to do one check, null out that object and reuse it again.</p>
<p>Does this seem typical? I'm just trying to code this smartly so wanted to see what one thinks about this technique above.</p>
|
c#
|
[0]
|
4,445,071 | 4,445,072 |
Performance of "enhanced" for loop vs "traditional" for loop?
|
<p>Java 5 brought about the additions of "enhanced" for loops, providing better syntax that was more concise, and less prone to errors or syntactical bugs by programmers. In addition, it seems to be easier to use. </p>
<p>However, I've heard there are performance enhancements with the "enhanced" for loop as well. Is this true, and if so, what are the performance differences between the two styles of looping? </p>
|
java
|
[1]
|
3,724,338 | 3,724,339 |
Getting the centriod of a circle Turbo C++
|
<p>It's me again. Turbo C++ is real ancient. I got a problem in getting my centriod of a circle, I have written a program to show me the co-ordinates of the centroid but the display shows me -NAN, -NAN instead of numbers. Please advice, thnx.</p>
<pre><code>unsigned char *p = rgbImage; //rbgImage = new unsigned char [ 160 * 120 * 4 ]
unsigned char *q = image; //image = new unsigned char [ 160 * 120 * 1 ]
int n = 0;
float LaserX = 0, LaserY = 0;
char* LaserMID = new char[255];
for( int j = 0; j < 120; j++ ) {
for( int i = 0; i < 160; i++ ) {
*q++ = *p++;
if ( *q >= Thrshld ) {
LaserX += j;
LaserY += i;
n = n + 1;
}
}
}
LaserX = LaserX/n;
LaserY = LaserY/n;
sprintf(LaserMID, "%.1f, %.1f", LaserX, LaserY);
ShowCo->Text = LaserMID;
</code></pre>
|
c++
|
[6]
|
1,210,323 | 1,210,324 |
removing all the DOM Elements with a specific className
|
<p>How I can remove all DOM Elements with specific classname or element width ID's that start with a specific pattern. like (without any framework!)</p>
<pre><code>id="selectbox1"
id="selectbox2"
id="selectbox3"
id="selectbox4"
</code></pre>
<p>Thanks</p>
|
javascript
|
[3]
|
5,166,441 | 5,166,442 |
What will happen if I modify a Python script while it's running?
|
<p>Imagine a python script that will take long time to run, and what will happen if I modify it while it's running? Will the result be different?</p>
|
python
|
[7]
|
1,630,290 | 1,630,291 |
When button is pressed wait 3 seconds then submit javascript
|
<p>How do i make a Javascript that will make so when i press my submit button it will change the name of the button to something like this "Loading..." and after 3 sec the button should be pressed</p>
<pre><code><input type="Submit" name="submitNew" id="submitNew" value="Send">
</code></pre>
<p>It will act as an "spam filter" for humans..</p>
|
javascript
|
[3]
|
526,050 | 526,051 |
sanitizing a string before serializing and inserting to db
|
<p>I'm facing an odd problem....</p>
<p><code>$string</code> is user input</p>
<pre><code>$log = serialize(array('string' => $string);
</code></pre>
<p>example: "test" would be</p>
<blockquote>
<p>"string";s:4:"test";</p>
</blockquote>
<p>However problems arise when the user submits quotes and some other characters like ;
Of course I escape the string first, but the serialized data cannot be unserialized.</p>
<p><code>htmlentities</code> before submitting to db wouldn't work either since <code>;</code> messes up the data...</p>
<p>Any suggestions?</p>
<p>Please don't tell me to create db fields and not use <code>serialize()</code></p>
|
php
|
[2]
|
3,097,358 | 3,097,359 |
Java Enum not valid error
|
<p>Why is this enum not valid ? </p>
<pre><code>enum Type{
MPEG-2=2,PASSED_PIDS_ID=3,DVB=4,ATSC=5,NA=6,UNDETERMINED=7
}
</code></pre>
|
java
|
[1]
|
3,330,711 | 3,330,712 |
Is there a way to create custom UIDataDetectorTypes?
|
<p>What I am trying to do is create tooltip functionality so that certain words in my instructional app can be tapped and the definition pops up. For the popup part I plan on using code from “AFInformationView” which provides bubbles on the iPhone.</p>
<p>The part I'm struggling with is how to associate A particular word's location with the bubble. Currently I have the text on a UILabel that is on a custom UITableCell. Since I calculate the row height on the fly with:</p>
<pre><code>[textToUse sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:CGSizeMake(stop-start, 500)];
</code></pre>
<p>I'm not sure what the coordinates for a specific word will be. I was thinking that if I created a custom DataDetectorType that could be the fix.</p>
<p>If anyone knows how to do this or has any other ideas I would be happy to hear them.</p>
<p>Thanks,</p>
<p>Andrew</p>
|
iphone
|
[8]
|
4,320,516 | 4,320,517 |
Adb server not responding
|
<p>I am a Android newbie. I guess I might be doing something stupid here. I have started the Virtual Device and I see that adbd daemon is running from the Terminal Emulator. When I search for adb devices I get the following error:</p>
<pre><code>C:\Program Files\Android\android-sdk\tools>adb devices
* daemon not running. starting it now on port 5037 *
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
</code></pre>
<p>No other process is using port 5037. What am I doing wrong? Here are the packages I have installed - </p>
<pre><code>1) Android SDK Tools, revision 10
2) Android SDK Platform-Tools, revision 3
3) SDK Platform Android 2.3.3, API 10, revision 1
</code></pre>
|
android
|
[4]
|
5,823,107 | 5,823,108 |
Add new fieldset elements with button click
|
<p>Is there any way with JavaScript to generate all the elements in the fieldset with the click of a button? Code below shows two textboxes and one textarea in a fieldset.When I press 'Add item button',I would like to generate the same textboxes and textarea within that fieldset.</p>
<p>Many thanks for your help. </p>
<pre><code><fieldset id="fieldset">
<legend id="legend">Professional development</legend>
<p>Item <input type ="text" size="25" name="prof_item" /><br /></p>
<p>Duration <input type ="text" size="25" name="prof_duration" /><br /></p>
<p>Enlargement <label for="enlargement"></label><p></p>
<textarea name="textarea" cols="71" rows="5" id="prof_enlargement">
</textarea></p>
<p><input type="submit" name="Submit" value="Add new item" id="add_prof" /></p>
</fieldset>
</code></pre>
|
javascript
|
[3]
|
5,268,309 | 5,268,310 |
Why we need to serializable object for passing one activity to another activity in android
|
<p>can anybody please tell Why we need to serializable object for passing one activity to another activity in android?.Android is following java syntax .In java we can pass object to another class without serializable</p>
<p>Thanks</p>
|
android
|
[4]
|
1,385,870 | 1,385,871 |
My LINQ sort does not seem to be sorting the way I asked it to
|
<p>I have this code:</p>
<pre><code>var query = _cityRepository.GetAll(
u => u.PartitionKey == pk &
u.RowKey.CompareTo(lowerBound) >= 0 &
u.RowKey.CompareTo(upperBound) < 0)
.OrderBy(item => item.RowKey.Substring(0, 3))
.ThenBy(item => item.ShortTitle)
.Select((t, index) => new City.Grid()
{
PartitionKey = t.PartitionKey,
RowKey = t.RowKey,
Row = index + 1,
ShortTitle = t.ShortTitle,
Created = t.Created,
CreatedBy = t.CreatedBy,
Modified = t.Modified,
ModifiedBy = t.ModifiedBy
})
.ToList();
</code></pre>
<p>When I look at the data coming out I find this for the first two rows:</p>
<pre><code>RowKey = 0101004O , ShortTitle = "Access 1"
RowKey = 0103004M , ShortTitle = "Access 2"
RowKey = 0101004K , ShortTitle = "xxx"
</code></pre>
<p>When testing I simplified this to:</p>
<pre><code> var query1 = _cityRepository.GetAll()
.OrderBy(item => item.RowKey.Substring(0, 3))
.ThenBy(item => item.ShortTitle);
</code></pre>
<p>and the order is the same. Still the RowKey does not seem to be in the right order. </p>
<p>It is supposed to sort on the first four characters of the rowkey and then on the ShortTitle. </p>
<p>Can anyone see why this is not working. I have looked hard but I can't see why the OrderBy and ThenBy doesn't seem to work correctly.</p>
|
c#
|
[0]
|
5,537,165 | 5,537,166 |
how to add a hyphen in between a string
|
<p>I have the following sting xxxxx, I want to add a hyphen like x-xxxx, how can I do so using Java?</p>
|
java
|
[1]
|
141,033 | 141,034 |
Getting python to work, Internal Server Error
|
<p>I'm trying to get Python scripts, called from a web browser, to work. I keep getting the error: </p>
<pre><code>500 Internal Server Error
</code></pre>
<p>When I check my error logs I see the message </p>
<pre><code>Premature end of script headers
</code></pre>
<p>The only documentation of this error online says that it can be the result of having improper line return characters in your script, but I wrote my test script right from the shell with pico. Also, when I run the file from the command line it executes just fine.
"
So far the only change I have made to apache is to add the .py to the "AddHandler cgi-script" line.</p>
<p>Thanks!</p>
<hr>
<p>Thanks for the quick responses. Here is the latest version of the test code. I added a couple new lines before the output as suggested but still get the same error:</p>
<pre><code>#!/usr/local/bin/python
print "Content-type: text/html\n"
print "\n\n"
print "<HTML>"
print "<HEAD>"
print "<TITLE>Test</TITLE>"
print "</HEAD>"
print "<BODY>"
print "<H2>Hi there.</h2>"
print "</BODY>"
print "</HTML>"
</code></pre>
<p>Some other details: I am running Apache 1.3 and don't have mod_python. I set apache to recognize .py as mentioned above. I am running the script from the main public_html folder. </p>
<hr>
<p>An update. It doesn't seem to matter what I put in the shebang line. I tried all of the suggestions and even if I leave it blank the same error is showing up in the errors log and I'm getting a 500 error. </p>
<p>I'm running Apache/1.3.41 on linux (red hat 3.4) with WHM/Cpanel installed. </p>
|
python
|
[7]
|
1,783,722 | 1,783,723 |
sort a dictionary within another dictionary
|
<p>I want to Sort the dictionary by score. if the score is same then sort them by name </p>
<pre><code>{
'sudha' : {score : 75}
'Amruta' : {score : 95}
'Ramesh' : {score : 56}
'Shashi' : {score : 78}
'Manoj' : {score : 69}
'Resham' : {score : 95}
}
</code></pre>
<p>Help plz
Thanks.</p>
|
python
|
[7]
|
2,282,924 | 2,282,925 |
c++ vectors not like arrays
|
<p>I've been getting my head round c++ for a few months, and have
been directed by google to stack overflow most of the time
for c++ queries. I noted frequently exhortations of the type
"why don't you use a vector", and was inspired to do just that.</p>
<p>So, primarily to get the minor benefits of automatic memory deallocation,
and being able to write typed comparison functions for sorting.
I switched an array of pointers to objects to being a vector.
Now I thought (incorrectly it seems) that vectors could be used
more or less like arrays, and hence I initialized thusly:</p>
<pre><code>cluster clusters[LOTS];
vector<cluster *> pclust;
pclust.reserve(numClust);
for (int i=0; i<numClust; ++i)
pclust[i] = clusters + i;
</code></pre>
<p>No complaints from the compiler.
Then some time later I need to sort the vector on some
attribute of the cluster object. So:</p>
<pre><code>std::sort(pclust.begin(), pclust.end(), ClusterCompareNumSegs);
</code></pre>
<p>Again no problems compiling. Except the vector doesn't
get sorted. It turns out that vector.size() is zero,
and of course my initialization should have been </p>
<pre><code>pclust.push_back(clusters + i);
</code></pre>
<p>Now that's easy to fix, but I am confused, because the initial
incorrect assignment was working. I successfully iterated through
the vector - using the array syntax, like so:</p>
<pre><code>for (clustind=0; clustind < numClust; ++clustind) {<br>
cluster *cl = pclust[clustind];
...happily access *cl...
</code></pre>
<p>And it all worked fine. So I'm just wondering what's going on.
Presumably in my initial assignments, I was trying to access
elements not yet in the vector (I was trying to put them in),
and the vector was throwing exceptions that I was ignoring.
But nonetheless, when referencing the locations, the pointers
were there. Can anyone provide enlightenment?</p>
|
c++
|
[6]
|
5,114,404 | 5,114,405 |
How to create a map with 2 key value
|
<p>I am looking for something like a school time table. Based on two input - Day of the week and Time of the day, one decides the subject. To implement this in c++, I was thinking of something like "map < pair < int, int>, int>".
I was reading <a href="http://bytes.com/topic/c/answers/62216-stl-map-two-keys" rel="nofollow">here</a> to use a key class and operator overloading.
Is there any other elegant way of doing it?</p>
<p>Thanks in Advance</p>
|
c++
|
[6]
|
5,652,580 | 5,652,581 |
Javascript Countdown Show Link
|
<p>I'm trying to use this code to countdown from 10 seconds, then show a link.</p>
<pre><code>x116=30;
FUNCTION countdown()
{
IF ((0 <= 100) || (0 > 0))
{
x116--;
IF(x116 == 0)
{
document.getElementById("dl").innerHTML = '<a href="download.php">Download</a>';
}
IF(x116 > 0)
{
document.getElementById("dl").innerHTML = 'Please wait <b>'+x116+'</b> seconds..';
setTimeout('countdown()',1000);
}
}
}
countdown();
</code></pre>
<p>I just know some really basic javascript. So could anyone tell me whats wrong with this? Nothing happens basically.</p>
|
javascript
|
[3]
|
4,768,384 | 4,768,385 |
Using Geocoder to show user's location Address
|
<p>I have this method to show the user's latitude and longitude on a map activity:</p>
<pre><code>public void animateMap(Location location){
double lat = location.getLatitude();
double lng = location.getLongitude();
Toast.makeText(MyMapActivity.this,
"Sie sind an\n" + lat + "\n" + lng, Toast.LENGTH_SHORT)
.show();
GeoPoint point = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
mapController.animateTo(point, new Message());
mapOverlay.setPointToDraw(point);
}
</code></pre>
<p>How to implement the Geocoder on my method? So the Toast will display the location's address instead of the coordinates</p>
|
android
|
[4]
|
5,337,193 | 5,337,194 |
How to restrict editing of myapp's contacts?
|
<p>I implemented contacts synchronization for my application. (SyncAdapter and so on)
It's working fine, but maybe someone know how I can restrict this contacts from being changed by user?</p>
<p>Thanks in advance,
Dmitry.</p>
|
android
|
[4]
|
1,825,041 | 1,825,042 |
If the mouse over check
|
<p>I want to check mouseover and mouse leave status and execute some function if the mouse is over element or is out.
I tried something like this, but it didn't work.</p>
<pre><code>if($('#someid').is(':hover')){ DO STUFF OVER }else{ DO STUFF ELSE }
</code></pre>
|
jquery
|
[5]
|
3,678,408 | 3,678,409 |
How to replace/remove a character in a character buffer?
|
<p>I am trying to modify someone's code which uses this line:</p>
<pre><code>out.write(&vecBuffer[0], x.length());
</code></pre>
<p>However, I want to modify the buffer beforehand so it removes any bad characters I don't want to be output. For example if the buffer is "Test%string" and I want to get rid of %, I want to change the buffer to "Test string" or "Teststring" whichever is easier.</p>
|
c++
|
[6]
|
2,170,594 | 2,170,595 |
What is the difference of using std:: vs. not using it in C++?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1265039/using-std-namespace">Using std Namespace</a> </p>
</blockquote>
<p>I was just wondering if there was some reason to include std:: in some operations, like std::sort() for example. Is it because of possible overloading?</p>
|
c++
|
[6]
|
3,553,446 | 3,553,447 |
How can i delete image file in external storage after email sent?
|
<p>i am storing image in External storage using MediaStore,and send email with attach that image,image saved and sent email with attachment is working fine,i want to delete that image in external storage after mail sent.anybody knows,please give sample code for me..</p>
<p>Thanks All,</p>
|
android
|
[4]
|
4,454,874 | 4,454,875 |
Jquery click without function
|
<p>I have the following code:</p>
<pre><code>$(document).ready(function(){
$("button.continue").click(function(){
$(this).html("Hello!");
});
});
</code></pre>
<p>Which works perfect but I want to turn the whole thing into something like this:</p>
<pre><code>$(document).ready(function(){
$("button.continue").click().html("Hello!");
});
</code></pre>
<p>My questions are:</p>
<ol>
<li>Can I use click() and a following event, in this case html() in that way (Without turning to the function part)?</li>
<li>If not, why can I not do this since I would think of the workings behind this, something like:
When user clicks on the element selected, change the HTML text in it to something else.</li>
<li>If this is not the way to think or reason the logic behind this, how should I approach this </li>
</ol>
|
jquery
|
[5]
|
2,298,910 | 2,298,911 |
Application area of toString() and valueOf() method
|
<p>Can i know In what condition toString() and valueOf() methods gets invoked by js engine or when are these methods called?Also which method gets called fist?</p>
|
javascript
|
[3]
|
44,821 | 44,822 |
Organizing my JavaScript function library
|
<p>Over time, I created a bunch of various JavaScript functions. Most of them are static functions, and do things like modify the appears of a date, create the select menu HTML from an array, etc.</p>
<p>I currently have them all in a file called "general.js" which is in turn directly called by my HTML page, and each of them look something like:</p>
<pre><code>function modifyDate(data){....}
function makeArray(arr){....}
</code></pre>
<p>And then I use them as:</p>
<pre><code>alert(modifyDate("12/14/2013"));
</code></pre>
<p>I am thinking this is a bad idea as it might conflict with other libraries. Instead, I am thinking of something like the following:</p>
<pre><code>myLibrary={};
myLibrary.modifyDate= function(data){....}
myLibrary.makeArray= function(arr){....}
</code></pre>
<p>And them use them as:</p>
<pre><code>alert(myLibrary.modifyDate("12/14/2013"));
</code></pre>
<p>Note that I am kind of making this up as I go. Please provide advice how I should best organize my JavaScript library. Thank you</p>
|
javascript
|
[3]
|
743,893 | 743,894 |
How to notify controller that download finished?
|
<p>I have a class that downloads an image with NSURLConnection. I'm new to ios so i was wondering how I can "notify" my ViewController that download has finished ? What "tool's" should I use ? </p>
<p>Clarification:</p>
<p>I have implemented all the callbacks of NsUrlConnection, my problem is how to notify ViewController, from my connectionDidFinishLoading that download has finished ?</p>
|
iphone
|
[8]
|
2,865,796 | 2,865,797 |
Activity indicator not showing when there is loop code?
|
<p>I am showing an Activity indicator in welcome screen as well as main screen. It is working fine in welcome screen. In main view, there is a 'for' loop code which does some task for 16 times. At this time, device looks like a bit hang, to avoid that i want to show activity indicator. When i add the standard activity code in main screen during some loop(16 times) code going on, i'm not observing the set activity indicator show. It comes only after the loop finished. I tried giving some delay before doing loop code, but still doesn't show during expected time. Otherwise user may think that my app hangs the device, so i want to show activity indicator at that time.</p>
<p>Any suggestions to resolve this are welcome !</p>
<p>thanks.</p>
|
iphone
|
[8]
|
3,565,690 | 3,565,691 |
error when AppKit framework added in iphone application
|
<p>i want to import in my iphone application, but i know this framework is not available in iphone sdk,but i need to use NSfileWrapper class in this framework, is this class also available in UIKit or others framework available in iphone sdk, thanks</p>
|
iphone
|
[8]
|
2,643,421 | 2,643,422 |
Is it possible to simulate an increased rate of passage of time in Android?
|
<p>I searched for a while, but couldn't find the same question.</p>
<p>I am writing an application where I need to schedule a lot of alarms a day, and then do different things throughout the day, and I'd love to be able to test, say 24 hours in 24 minutes, or something along those lines. </p>
<p><strong>Is it possible to simulate a faster passage of time, either in emulator, or on-device?</strong> </p>
<p>If it is, this would be great for me to be able to test these things without losing development time. As it is, I'm writing them in a way that I think will work, doing spot tests, and then running the program myself to verify that the behavior is correct, but it greatly slows my development time to have to wait a day or two between seeing a poor behavior, and then trying to fix it and retesting it. Any help would be greatly appreciated!</p>
|
android
|
[4]
|
649,746 | 649,747 |
using storyboard create the Object of the second tab in the first tab
|
<p>I am new to iPhone Development.</p>
<p>I am working with tab bar application, it has two tab named
First and Second.</p>
<p>For your information i'm using storyboard, so i have no xib file.
But,</p>
<p>I want to create the Object of the second tab in the first tab.</p>
<p>What Should I do?</p>
|
iphone
|
[8]
|
5,974,815 | 5,974,816 |
NavigationControlller Push and Pop in iPhone?
|
<p>I am using the UINavigationControl based application, I am pushing view one by one. Some times i need to push the same view again.In this scenario whether i have to find the view and pop or can create new view and push. which is the best method? whether any standard method handle this situation. When pushed view release from memory? </p>
|
iphone
|
[8]
|
5,250,619 | 5,250,620 |
Joining elements of a list
|
<p>I have a list of tuples like:</p>
<pre><code>data = [('a1', 'a2'), ('b1', 'b2')]
</code></pre>
<p>And I want to generate a string like this: <code>"('a1', 'a2'), ('b1'. 'b2')"</code></p>
<p>If i do something like: <code>','.join(data)</code>, I get an error: </p>
<pre><code>TypeError: sequence item 0: expected string, tuple found
</code></pre>
<p>If I want to do something in a single line without doing something like:</p>
<pre><code>for elem in data:
str += ',%s' % str(elem)
</code></pre>
<p>then is there a way?</p>
|
python
|
[7]
|
5,836,679 | 5,836,680 |
Newbie: Checking to see if radio button is checked on form initialization. What does this code mean?
|
<p>I am a javascript novice. I'm trying to build a complex form whilst simultaneously learning JS and JQ... not an easy task. This code works, but I don't know what two lines do, so I thought I'd ask here.</p>
<p>What this code does is loop through an array to see if a radio button checkbox has been checked as yes or no. It runs at initialization when a user revisits the form he/she is filling out. The code is attached to a textfield element which unhides if myRadioButton is yes, stays hidden if no.</p>
<p>I do not know what lines 5 and 6 do (beginning with the second if statement). Would some knowledgable person please be so kind as to transcribe those lines into a couple of sentences, kind of like they do in tutorials? I would really appreciate it!</p>
<pre><code>var rbVal = "";
var rbBtn = JQuery("[name=\"myRadioButton[]\"]");
for (var i = 0; i < rbBtn.length; i++)
if (rbBtn[i].checked) {
if (rbVal != "") rbVal += ",";
rbVal += rbBtn[i].value;
}
if( rbVal != "yes" ){
doSomething;
}
else {
doSomethingElse;
}
</code></pre>
|
javascript
|
[3]
|
3,622,945 | 3,622,946 |
jQuery Star Rating using Select Option dropdown
|
<p>I need a little help here... last several hours been trying to figure this out, and getting nowhere.</p>
<p>I found this simple jQuery Star rating system that i'd like to use, the original coding was using an INPUT field but I changed it to being used with a Select Option Dropdown. When it's displayed on the left you have the dropdown and to the right you have the default STARS. Now when you click on the STARS, the dropdown options change... which is good, that part I want to keep, However when you use the actual Dropdown the stars wont change... here is the coding...</p>
<pre><code><select name="my_input" id="rating_simple">
<option value="0" selected="selected"></option>
<option value="1">Poor</option>
<option value="2">Below Average</option>
<option value="3">Average</option>
<option value="4">Good</option>
<option value="5">Excellent</option>
</select>
</code></pre>
<p>JavaScript</p>
<pre><code>$(function() {
$("#rating_simple").webwidget_rating_simple({
rating_star_length: '5',
rating_initial_value: '',
rating_function_name: '',
directory: 'rating-system/'
});
});
</code></pre>
<p>Thanks! Any help would be appreciated!</p>
|
jquery
|
[5]
|
1,439,802 | 1,439,803 |
Building New Product: ASP.NET/MVC vs SharePoint 2010
|
<p>Hi I met an investor who wants a new product to sells to other companies. We agreed to make it SaaS, but we're arguing over three options:</p>
<ul>
<li>SaaS product made by ASP.NET</li>
<li>Saas product Made up of huge SharePoint server</li>
<li>SharePoint add-on (as group of solutions/web parts)</li>
</ul>
<p>I can't disclose the product exactly, but, it is about collaboration and involves many interaction between users. That is the reason why we have SharePoint as an option, also because a user might optionally create web pages (single home page).</p>
<p>Some users dont want SaaS. There is possibility of hosting the product at a company server (some want their 'sensitive' data hosted locally).</p>
<p>So my question is: which one would you choose as SAAS with ability to make it a locally hosted solution (without losing your code of course).</p>
|
asp.net
|
[9]
|
1,884,782 | 1,884,783 |
how to convert String object to Boolean Object
|
<p>hi how to convert String object to Boolean Object</p>
|
java
|
[1]
|
6,027,126 | 6,027,127 |
PHP: Redirect ( header)
|
<pre><code>header("profil.php?id=" . $show["id"]);
</code></pre>
<p>What i tried to do, but headers are already sent at top, so how can I redirect the user? Should I use window.location.replace("URL"); (javascript) instead?</p>
|
php
|
[2]
|
1,209,465 | 1,209,466 |
WPF learning VS WinForms learning
|
<p>Alright, so I kinda finished learning all the Object Oriented Programming and now I want to start to learn Winforms and WPF. So my question is what I should learn first, Winforms or WPF, I know that WPF performance is much better than Winforms's.
What's easier to learn, what's recommended?</p>
|
c#
|
[0]
|
2,318,132 | 2,318,133 |
Java RegEx replace
|
<p>I need to use a replace function in Java:
<code>string.replace(myString,"");</code>
myString values are for example <code>javascript:r(0)</code>, <code>javascript:r(23)</code>, <code>javascript:l(5)</code> etc. Just number is always different and there is <code>r</code> or <code>l</code> letter. What's the regular expression to match it? Thanks</p>
|
java
|
[1]
|
2,724,000 | 2,724,001 |
Java thread dump from command line - output to file?
|
<p>I have heard of kill -3 , etc.</p>
<p>What is the definite way to get a java thread dump and have it output to a file?</p>
<p>tia.</p>
|
java
|
[1]
|
2,138,024 | 2,138,025 |
jQuery: run only once
|
<p>Yes i have an fancybox. It auto opens if ?mode=new</p>
<p>What happens on ?mode=new is:</p>
<pre><code><script>
$(document).ready(function(){
$('#newPM').click();
});
</script>
</code></pre>
<p>It opens fine. But when you then click on the element, it keeps closing/open, because this is activated. So how can i only run this once?</p>
|
jquery
|
[5]
|
4,058,725 | 4,058,726 |
hiding/removing selected from select option list for multiple select tags with same list
|
<p>let's say i have 4 select tags that uses the same option choices. i wanted to remove the selected options from the choices. currently i tried this code:</p>
<pre><code> function connect(val)
{
$(".option").show();
$(".selectbox").each(function(i) {
var obj = $("option[value='" + $(this).val() + "']");
alert(obj);
if($(this).val() != "") obj.remove();
});
}
</code></pre>
<p>i have this for the select tags:</p>
<pre><code>for()
{
<select id = "sc" name = "connect_array[]" class="input-select" onchange = "connect(this.value)">
for()
{
<option></option>
}
</select>
}
</code></pre>
<p>But what actually happens is the it only removes the options of the first select and the first select ends up with no choices when all choices where chosen by the other select tags, also you can still see the full choices in the other select tags.</p>
<p>thank you.</p>
|
jquery
|
[5]
|
3,090,349 | 3,090,350 |
dirname(php) similar function in c++
|
<p>is there is any function in c++ ,similar to <code>dirname</code> in php...it is used to normalize the url </p>
<pre><code>eg
<?php
$url = "../tets/index.html";
$currentURL = "http://example.com/somedir/anotherdir";
echo dirname($currentURL).substr($url, 2);
?>
</code></pre>
|
c++
|
[6]
|
517,545 | 517,546 |
Specialization of casting operator to template argument
|
<p>I can't find this question answered in any other place, so I finally decided to ask.
I have a C++ templated class that includes a casting operator to the type of one of the arguments:</p>
<pre><code>template <class E, class B>
class bar {
private:
B innerVal_;
[...]
public:
/* Casting to the type of the 2nd template argument */
operator B() const { return innerVal_; }; // default implementation provided
};
</code></pre>
<p>However, I need to provide a specialization of this casting operator for some specific template arguments, for instance:</p>
<pre><code>template<>
bar<concreteType,int>::operator int() // <-- whoops, error!
{ [...] }
</code></pre>
<p>The thing is that, no matter how I specify the syntax of the casting operator, gcc consistently returns me an error referred to the declaration of the function. The most common one is:</p>
<blockquote>
<p>error: template-id ‘operator int<>’ for ‘bar< concreteType, int>::operator int()’ does not match any template declaration.</p>
</blockquote>
<p>Which I got with these lines:</p>
<ul>
<li>Defining the casting operator as "operator int()"</li>
<li>Using "operator typeB()", after declaring in the original template a line "typedef B typeB;"</li>
</ul>
<p>I also played around with the "typename" keyword, with template brackets, and made some other desperate attempts. All of them result in bizarre errors --that I'm not going even to paste here.</p>
<p>Am I losing some obvious detail? Do you have any hint/pointer for me? Any help will be useful.</p>
|
c++
|
[6]
|
3,423,300 | 3,423,301 |
CSS locating sibling by text
|
<p>I am trying to select the sibling Edit menu based on the text "Edit" something like this</p>
<p>css=ul.jd_menu li:contains("Edit") but it still select the File link, so in essence trying to find the list items by their text</p>
<p>here is the a smipppet of the source</p>
<pre><code><ul class="jd_menu" style="background-color: rgb(236, 233, 216);">
<li class="" style="background-color: transparent;">
File
<ul class="jdm_events" style="left: 0px; top: 36px; display: none; background-color: rgb(236, 233, 216);">
</li>
<li class="">
Edit
</code></pre>
|
javascript
|
[3]
|
3,007,838 | 3,007,839 |
Fire Textbox.TextChange event without a button click
|
<p>I want to call Textbox.OnTextChange event without having to click a submit button or any button. How can I do this? As I enter text in the textbox, I want the ontextchange event to fire.</p>
<p>I would elaborate this further.I've a function for validating my entry in textbox which I'm calling ontextchange property.Now this function should be called without me changing focus from my textbox.</p>
|
asp.net
|
[9]
|
287,451 | 287,452 |
Android UI does not get refreshed with Data from DB
|
<p>I am creating an activity which paints the UI (TableLayout displayed with data from MYSQL database). The UI has a button so on clicking that, it takes to a different activity and then it comes back to the parent. My issue is that, when it comes back to the parent, the parent screen does not show the updated data.</p>
<p>to be more clear, the parent is a view screen with an add button. Clicking on Add button takes to a form where the user fills in data and submits. After submit of the Add screen, the parent screen(view screen) is invoked again. Here the table layout is not refreshed with the newly added record. </p>
<p>Kindly help me as am struggling with this for days now.</p>
<p>thanks in advance</p>
|
android
|
[4]
|
964,936 | 964,937 |
How to determine drive type with a cross platform approach
|
<p>I am writing a cross platform app that should create files on certain events, now I have a problem, if my target be on a removable disk or a network drive I want to first create the file in a temporary folder on local hard drive and then move it to the target to avoid data loss in case of removal of the target path.</p>
<p>Now my question is how should I indicate type of the path in a cross platform approach?</p>
|
c++
|
[6]
|
6,010,663 | 6,010,664 |
Submitting an unknown number of fields to a PHP Script
|
<p>My situation is this: I have an html page which contains a table of four rows and three columns. When creating the page (using a PHP script) some of the rows have their cells filled with text while the rest have their cells filled with text boxes. What I want to do is allow the user to fill any number of the rows with text boxes and then submit them to a PHP script.</p>
<p>When the user clicks submit, I want to get all the rows which the user has filled in (essentially the rows with filled textboxes) and submit just the data in those text boxes to the script, ideally in a 2D array where each row of the array represents a row of the table?</p>
|
php
|
[2]
|
419,236 | 419,237 |
how to input a BigInteger type in java
|
<p>when I tried to get an input of type Integer, what I only needed to do was the code below.</p>
<pre><code>Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
</code></pre>
<p>but when it comes to BigInteger,
I don't know what to do. What can I do to read a BigInteger Type input from the user? </p>
|
java
|
[1]
|
2,997,394 | 2,997,395 |
Is this too much data that should be used in a Struct?
|
<pre><code>public struct Cache {
public int babyGangters { get; set; }
public int punks { get; set; }
public int ogs { get; set; }
public int mercs { get; set; }
public int hsPushers { get; set; }
public int collegeDealers { get; set; }
public int drugLords { get; set; }
public int streetHoes { get; set; }
public int webcamGrls { get; set; }
public int escort { get; set; }
public int turns { get; set; }
public int cash { get; set; }
public int bank { get; set; }
public int drugs { get; set; }
public int totalValue { get; set; }
public int attackIns { get; set; }
public int attackOuts { get; set; }
public int status { get; set; }
public int location { get; set; }
}
</code></pre>
|
c#
|
[0]
|
5,145,592 | 5,145,593 |
hot to do LCM and GCF
|
<p>I have an homework ask to do LCM and GCF using C++ in the following format:</p>
<p>Input:</p>
<p>The first line of input contains a single integer <strong>N</strong>,(1<=N<=1000) which is the number of data sets that follow. Each data set consists of a single line of input containing two positive integers, <strong>a</strong> and <strong>b</strong>(1<=<strong>a</strong>, <strong>b</strong><=1000) separated by a space.</p>
<p>output:</p>
<p>for each data set, you should generate on line of output with the following value: The data set number as a decimal integer(start counting at one). the <strong>LCM</strong>, a space, and the*<em>GCF</em>*.</p>
<p>input:</p>
<ul>
<li>3</li>
<li>5 10</li>
<li>7 23</li>
<li>42 56</li>
</ul>
<p>output:</p>
<ul>
<li>1 10 5</li>
<li>2 161 1</li>
<li>3 168 14</li>
</ul>
<p>thank you!</p>
|
c++
|
[6]
|
2,166,007 | 2,166,008 |
please tell me whats wrong in this code
|
<pre><code>#include <iostream>
using namespace std;
int main()
{
char *fp = "Alex";
cout<<fp <<" "<<(void*)fp<<endl;
*(fp+1) = 'p';
cout<<fp <<" "<<(void*)fp<<endl;
}
</code></pre>
|
c++
|
[6]
|
2,027,155 | 2,027,156 |
How check memory location of variable in php?
|
<p>How check memory location of variable in php?</p>
<p>Thanks</p>
|
php
|
[2]
|
733,397 | 733,398 |
how to display the mark sheet on the next page using ASP.NET?
|
<p>i want to creat a web page that uses radiobuttons in a multiple choice quetions, but i want to do is to use a submit button to return the results to the next page with the mark sheet, so can you please help me with that. how to display the mark sheet on the next page using ASP.NET</p>
|
asp.net
|
[9]
|
1,693,877 | 1,693,878 |
Un-defined variable error
|
<p>Since, I am new to PHP and couldn't resolve undefined variable error in this code..<br>
The error is: <code>Notice: Undefined variable: row in C:\wamp\www\shopping\products.php</code> </p>
<p>Code:</p>
<pre><code> <?php
$result=mysql_query("select * from products");
while($row=mysql_fetch_array($result)){
?>
<tr>
**<td><img src="<?=$row['picture']?>" /></td>**
<td> **<b><?=$row['name']?></b><br />**
**<?=$row['description']?><br />**
Price:<big style="color:green">
**$<?=$row['price']?></big><br /><br />**
**<input type="button" value="Add to Cart" onclick="addtocart(<?=$row['serial']?>)" />**
</td>
</tr>
<tr><td colspan="2"><hr size="1" /></td>
<?php } ?>
</code></pre>
|
php
|
[2]
|
2,485,999 | 2,486,000 |
Only last execution of $.each seems to be executing
|
<p>Here's the code:</p>
<pre><code>// Each ul that holds the collection of our entities
var lists = ['ul.emails', 'ul.phoneNumbers'];
// Setup the "add" link
var $addLink = $('<a href="#" class="margin-left btn btn-mini add"><i class="icon-plus"></i>label</a>');
var $newLinkLi = $('<li></li>').append($addLink);
$(document).ready(function() {
// Add link to each list
$.each(lists, function(index, list) {
$(list).append($newLinkLi);
});
});
</code></pre>
<p>But, only the last <code>ul</code> gets the link. If, however, I do</p>
<pre><code> $.each(lists, function(index, list) {
$(list).append('test');
});
</code></pre>
<p>it works. What gives? Is something being passed by reference?</p>
|
jquery
|
[5]
|
5,816,650 | 5,816,651 |
create a user login to comment in a blog
|
<p>I am working on a functionality in my website which should allow users to comment on a video or an image only after the user had logged in (very similar to the comment on a video after a sign in on YouTube). I have created the login control and a new user registration control using ASP controls. How do i integrate this to my comments.aspx page in which the user can view all previous comments that other users have commented but cannot comment until he signs in???
This is my login control:
</p>
<pre><code> <asp:LoginName ID="LoginName1" runat="server" FormatString="welcome page {0}">
</asp:LoginName><br />
<asp:LoginStatus ID="LoginStatus1" runat="server" />
</LoggedInTemplate>
</asp:LoginView>
</code></pre>
<p>Please help.</p>
<p>Jake</p>
|
asp.net
|
[9]
|
3,064,820 | 3,064,821 |
C#.NET find actual url from page alias
|
<p>If I have a URL like
www.mydomain.co.uk/shopping</p>
<p>Is it possible to find the real URL of shopping?</p>
<p>HttpWebRequest req = (HttpWebRequest)WebRequest.Create("www.mydomain.co.uk/shopping");</p>
<p>I quickwatched 'req' but couldn't see it?</p>
<p>anyone got any ideas?</p>
|
c#
|
[0]
|
4,113,250 | 4,113,251 |
error with the new android tools and openRawResource
|
<p>Im trying to do the following:</p>
<pre><code> InputStream is = context.getResources().openRawResource(R.xml.stops);
</code></pre>
<p>but xml is underlined in red and the only quick fix is to "migrate android code" which just tells me "the resource fields (such as xml) are no longer constants when defined in library projects."</p>
|
android
|
[4]
|
5,400,506 | 5,400,507 |
Using Hex numbers in css setting w/Jquery
|
<p>I have this code that works as posted:</p>
<pre><code>$('#cs_tableVideoListings tbody tr td').each(
function() {
$(this).css('border-bottom','2px solid gray');
})
</code></pre>
<p>the issue is that "gray" is too dark. When I try #333 or any hex number, it doesn't work at all.</p>
<p>I only need to apply the bottom border, so using "border-bottom" : "2px solid #333" (note colon) doesn't work as that syntax seems to only work when applying multiple styles.</p>
<p>So, I'm wondering at to apply a hex color in the above code w/o getting ridiculous about assigning variables and such.</p>
<p>Thanks </p>
|
jquery
|
[5]
|
4,422,957 | 4,422,958 |
Force Page initialization
|
<p>The following code is not causing <code>Page_Load</code> of <code>PhotoList</code> to be called. I want the control to be initialized as if it is in normal Page live cycle, what I should do. </p>
<pre><code>Page pageHolder = new Page();
UserControl viewControl = (UserControl)pageHolder.LoadControl("Common/PhotoList.ascx");
pageHolder.Controls.Add(viewControl);
</code></pre>
|
asp.net
|
[9]
|
1,346,938 | 1,346,939 |
Find and replace URLS in a block of text, return text + list of URLS
|
<p>I'm trying to find a way to take a block of text, replace all URLs in that text with some other text, then return the new text chunk and a list of URLs it found. Something like:</p>
<pre><code>text = """This is some text www.google.com blah blah http://www.imgur.com/12345.jpg lol"""
text, urls = FindURLs(text, "{{URL}}")
</code></pre>
<p>Should give:</p>
<pre><code>text = "This is some text {{URL}} blah blah {{URL}} lol"
urls = ["www.google.com", "http://www.imgur.com/12345.jpg"]
</code></pre>
<p>I know this will involve some regex - I've found some seemingly good URL detection regex here:
<a href="http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/" rel="nofollow">http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/</a></p>
<p>I'm pretty rubbish with regex, though, so I'm finding that getting it to do what I want with python quite tricky. The order that the URLs are returned in doesn't really matter.</p>
<p>Thanks :)</p>
|
python
|
[7]
|
2,575,751 | 2,575,752 |
Android App Locker Help Required
|
<p>I am developing an app where I have to lock some android default Apps such as messaging, email, gtalk, etc . How to do it, i have no idea. Please help me with some relevant code or link.</p>
<p>Also, want to know how can i get the list of all application installed in android phone.</p>
|
android
|
[4]
|
2,999,945 | 2,999,946 |
ViewFlipper caching issue
|
<p>The views are not cached in a ViewFlipper. Is there a way wherein we can get an image of the view and show it to user so that he sees the Ui as we see on Home scrren(when we swipe the previous view also moves along and when we lift our finger, only then the next view is shown completely.)</p>
<p>What I want to do is that when the user starts moving his finegr on screen, the view should also move along(create an image of view).</p>
<p>I am not getting to do this, as when we swipe the present view goes and next view comes, we do not get both visible when we r moving our finger on screen.</p>
<p>Please if anyone gets what I am trying to do, do help me.</p>
<p>Thanks,
Farha</p>
|
android
|
[4]
|
4,616,085 | 4,616,086 |
C# - Form.Show locks up the application on the 3rd attempt - why?
|
<p>So I have a a button that simply shows and hides a window, pretty straightforward.</p>
<p>As such:</p>
<pre><code>public static void LaunchUI()
{
if (!Forms.AllForms.UI.Visible)
{
Forms.AllForms.UI.MdiParent = MyApp.Forms.AllForms.MainForm;
Forms.AllForms.UI.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Forms.AllForms.UI.Show();
}
}
public static void CloseUI()
{
if (Forms.AllForms.UI.Visible)
Forms.AllForms.UI.Hide();
}
</code></pre>
<p>I can open and close the window twice, then, on the 3rd time, it locks up on Forms.AllForms.UI.Show(). I have 0 idea why, it is being opened from the main thread.</p>
<p>Anyone know what I'm doing wrong?</p>
<p>Thanks!</p>
|
c#
|
[0]
|
2,788,491 | 2,788,492 |
My first python program: can you tell me what I'm doing wrong?
|
<p>I hope this question is considered appropriate for stackoverflow. If not, I'll remove the question right away.</p>
<p>I've just wrote my very first python program. The idea is that you can issue a command, and it's gets sent to several servers in parallel.</p>
<p>This is just for personal educational purposes. The program works! I really want to get better at python and therefore I'd like to ask the following questions:</p>
<ol>
<li>My style looks messy compared to PHP (what I'm used to). Do you have any suggestions around style improvements.</li>
<li>Am I using the correct libraries? Am I using them correctly?</li>
<li>Am I using the correct datatypes? Am I using them correctly?</li>
</ol>
<p>I have a good programming background, but it took me quite a while to develope a decent style for PHP (PEAR-coding standards, knowing what tools to use and when).</p>
<p>The source (one file, 92 lines of code)</p>
<p><a href="http://code.google.com/p/floep/source/browse/trunk/floep" rel="nofollow">http://code.google.com/p/floep/source/browse/trunk/floep</a></p>
|
python
|
[7]
|
2,729,165 | 2,729,166 |
What's the root of my android app?
|
<p>I'm trying to develop a simple android app. I want to know if an image exist in one of my apps' folder, but I don't know what's the root of my app. I tried...</p>
<pre><code>File nomeFile = new File("res/drawable-hdpi/imagename.jpg")
File nomeFile = new File("myappanem/res/drawable-hdpi/imagename.jpg")
</code></pre>
<p>...but it doesn't work. </p>
|
android
|
[4]
|
1,823,472 | 1,823,473 |
javascript get value of paragraph to appear in textarea
|
<p>I'm trying to add the value of a paragraph to a text area using javascript. This is my code at the moment. I can't quite seem to get it to work. Any help is appreciated</p>
<pre><code> <html>
<head>
</head>
<body>
<button value="this is a length definition" onclick="reveal(this.value)"> hi</button>
<script type="text/javascript">
function reveal(value)
{
var text = value;
document.outputtext.value += value;
}
</script>
<table>
<tr>
<td><textarea name="outputtext"></textarea></td>
</tr></table>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
3,449,160 | 3,449,161 |
pass class variable by reference in an arg
|
<p>So I'm trying to do the following;</p>
<pre><code>var myVar;
function testFunction(args){
args.cacheVar = new Date();
}
testFunction({cacheVar:myVar});
</code></pre>
<p>but instead of changing the value of myVar, its changing the value of args.cacheVar.
What I would like to happen is for myVar = new Date(). not args.cacheVar.</p>
<p>How can I accomplish this with my current setup? (using arguments)</p>
|
javascript
|
[3]
|
2,318,735 | 2,318,736 |
Pass list of ids between forms
|
<p>I have an ASP.NET c# project.</p>
<p>I have to pass a list of values (id numbers such as "23,4455,21,2,765,...) from one form to another. Since QueryString is not possible because the list could be long, which is the best way to do it?</p>
<p>Thanks in advance.</p>
<p>Thanks for all your answers, you are helping a lot !!!
I decided to do this:</p>
<p>On the first form:</p>
<p>List lRecipients = new List();
.....
Session["Recipients"] = lRecipients;</p>
<p>On the final form:
List lRecipients = (List)Session["Recipients"];
Session.Remove("Recipients"); </p>
|
asp.net
|
[9]
|
4,142,872 | 4,142,873 |
trigger rowcommand event from commandfrield Edit button
|
<p>I have a query regarding GridView Control : I added a commandfield inside my Gridview and set <code>ShowEditButton="True"</code> (By default it trigger RowEditing Event). Can i Trigger <code>RowCommand Event</code> Instead of <code>RowEditing Event</code>.</p>
<p>I know i can do it via other way but just got curious whether we can do this way</p>
|
asp.net
|
[9]
|
2,614,810 | 2,614,811 |
Sorting a table with foreach?
|
<p>Not sure if this is possible, but I'd like to sort a foreach table by a column, highest to lowest. The last column has a <code>count</code> formula to calculate <code>PilotData::getAllPilotsByHub</code> and I'd like the row with the highest number to be always first in the table.</p>
<pre><code><?php
$allhubs = OperationsData::GetAllHubs();
foreach($allhubs as $hub)
{
?>
<tr>
<td align="center"><?php echo $hub->icao; ?></td>
<td align="center"><?php echo $hub->name; ?></td>
<td align="center"><?php echo count(PilotData::getAllPilotsByHub(''.$hub->icao.'')); ?></td>
</tr>
<?php
}
?>
</code></pre>
|
php
|
[2]
|
4,647,163 | 4,647,164 |
How to check if correct email address is entered?
|
<p>I have this code</p>
<pre><code><?php
if(isset($_POST['submit'])) {
$to = "info@bodom.eu";
$subject = "Form";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
echo "<div id='messageok'> Ok. <br /><span> Thank you. </span></div>";
mail($to, $subject, $body);
} else {
echo "<div id='messageok'> Error. </div>";
}
?>
</code></pre>
<p>and I need to check if the fields in the form are filled and if e-mail address is correct. Yes, I found many tutorials, but I am not very good in PHP and this code works for me. Thank you.</p>
|
php
|
[2]
|
1,976,340 | 1,976,341 |
how to change the text of option in select in jquery
|
<p>I have a page contain the select code as follows: </p>
<pre><code><select id="select-choice">
<option value="0">Please Select</option>
<option value="1">red</option>
<option value="2">white</option>
</select>
</code></pre>
<p>How can I change the text of option 1 from red to green after the page finishes loading? So far I have the following:</p>
<pre><code>//following is the code
$('#newoutagePage').live('pageshow', function(event) {
$('#select-choice[value="1"]').text("green");
}
</code></pre>
<p>but it doesn't work. Any suggestions?</p>
|
jquery
|
[5]
|
2,919,119 | 2,919,120 |
how to write text on selection indicator of uipickerview
|
<p>how to write text on selection indicator of uipickerview</p>
|
iphone
|
[8]
|
5,057,878 | 5,057,879 |
How to get current screen's brightness in Android code dynamiclly?
|
<p>How to get current screen's brightness in Android code dynamiclly?</p>
|
android
|
[4]
|
3,464,718 | 3,464,719 |
Should a Python generator raise an exception when there are no more elements to yield?
|
<p>Should a Python generator raise an exception when there are no more elements to yield?</p>
<p>Which one?</p>
|
python
|
[7]
|
1,632,441 | 1,632,442 |
what is wrong with this c# code?
|
<p>Please tell me whats wrong with this c# code..</p>
<pre><code>public bool CloseCOMPort()
{
try
{
bool isClosed = false;
if (oSerialPortMisc != null && oSerialPortMisc.IsOpen)
{
oSerialPortMisc.Close();
isClosed=true;
}
else
{
isClosed = false;
}
return isClosed;
}
catch (Exception exp)
{
}
}
</code></pre>
<p>When I compile this code it gives error.. "not all code paths return a value".
I dont know whts wrong here. PLease help..
Thanxxx...:)</p>
|
c#
|
[0]
|
1,435,521 | 1,435,522 |
Indication when ap moves to background, when packages gets installed
|
<p>Am writing an android application which in background will monitor the device.I want to get an indication whenever an application moves to background/foreground.Also I want to get an indication when an application installed or gets uninstalled from the android device.
how can this be acheived in android ?please help .thank you </p>
|
android
|
[4]
|
2,387,029 | 2,387,030 |
Read in a txt file separating and storing variables (String , Double and int) for later use
|
<p>Beginner java programmer ,
I am Looking for a way to read in a txt file (output from a till) while manipulating certain data that relates to the shift type, transaction type and cost to give me my desired result.</p>
<p>Any help would be greatly appreciated.</p>
<p>Example line in txt document:</p>
<p>"<strong>CARD</strong>","<strong>05-07-2012</strong> 10:32:42","Laminate A4",10,<strong>10</strong>,"<strong>NIGHTSHIFT</strong>",1486510814,False,130</p>
<p>So the relevant information I need is in <strong>bold</strong> the rest of the information in the text line is irrelevant.</p>
<p>Where I need to find the total <strong>cost</strong> of all <strong>card</strong> transactions made <strong>yesterday</strong> (05-07-2012) on <strong>Nightshift</strong>.</p>
<p>Heres where I have gotten so far, I have tried to split at night shift. Also thought about using an array as well and storing each value to its own variable but found this too difficult.</p>
<pre><code>import java.io.File;
import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.*;
public class Finder{
public static void main (String args[]) throws FileNotFoundException
{
Calendar today = Calendar.getInstance();
SimpleDateFormat formatter=
new SimpleDateFormat("dd-MM-yyyy");
today.add(Calendar.DATE, -1);
String yesterday = formatter.format(today.getTime());
Scanner sc = new Scanner(new File("textdocument.log"));
while(sc.hasNextLine()) {
String[] numstrs = sc.nextLine().split(yesterday + "\"NIGHTSHIFT\""); // split by "
for(int i = 0; i < numstrs.length; i++)
{
System.out.println(numstrs[i]);
System.out.println();
}
}
}
}
</code></pre>
<p>DESIRED OUTPUT:</p>
<p>Nightshift Totals On 05-07-2012</p>
<p>Cash total $20</p>
<p>Card total $40</p>
<p>Eftpos total $20</p>
<p>I hope I have asked clearly.</p>
<p>Thanks</p>
|
java
|
[1]
|
4,836,309 | 4,836,310 |
How to convert time data in java?
|
<p>The following time formats are in outlook calendar file</p>
<pre><code>DTSTART;TZID="Eastern":20100728T140000
DTEND;TZID="Eastern":20100728T150000
</code></pre>
<p>how to convert this time to java time format.</p>
|
java
|
[1]
|
5,671,652 | 5,671,653 |
How to get first character of string?
|
<p>I have a string, and I need to get its first character.</p>
<pre><code>var x = 'somestring'
alert(x[0]); //in ie7 returns undefined
</code></pre>
<p>How can I fix my code?</p>
|
javascript
|
[3]
|
1,853,088 | 1,853,089 |
How do you select items in a listbox using jQuery?
|
<p>How do you programmatically select items in a multi-select listbox using jQuery?</p>
|
jquery
|
[5]
|
2,026,680 | 2,026,681 |
Why use static_cast rather than dynamic_cast in here?
|
<p>I copy the following text from the book More Effective C++.</p>
<p><strong>Item 31: Making functions virtual with respect to more than one object.</strong> </p>
<pre><code>class GameObject { ... };
class SpaceShip: public GameObject { ... };
class SpaceStation: public GameObject { ... };
class Asteroid: public GameObject { ... };
</code></pre>
<p>The most common approach to double-dispatching returns us to the unforgiving world of virtual function emulation via chains of if-then-elses. In this harsh world, we first discover the real type of otherObject, then we test it against all the possibilities: </p>
<pre><code>void SpaceShip::collide(GameObject& otherObject)
{
const type_info& objectType = typeid(otherObject);
if (objectType == typeid(SpaceShip)) {
SpaceShip& ss = static_cast<SpaceShip&>(otherObject);
process a SpaceShip-SpaceShip collision;
}
else if (objectType == typeid(SpaceStation)) {
SpaceStation& ss =
static_cast<SpaceStation&>(otherObject);
process a SpaceShip-SpaceStation collision;
}
...
}
</code></pre>
<p>Here is the question:</p>
<p>Q1> Why we use static_cast here rather than obvious dynamic_cast? </p>
<p>Q2> Are they same in this case?</p>
<p>thank you</p>
<p>// updated //</p>
<p>In fact, I am more interested in question 2. </p>
<p>For example,</p>
<pre><code>class base {};
class subclass : public base {};
base *pSubClass = new subclass;
subclass *pSubClass1 = static_cast<subClass*> (pSubClass);
</code></pre>
<p>// does the static_cast do the job correctly in this case although I know we should use dynamic_cast here?</p>
|
c++
|
[6]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.