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,120,767 | 1,120,768 |
C#: Should I bother checking for null in this situation?
|
<p>Lets say I have this extention method:</p>
<pre><code>public static bool HasFive<T>(this IEnumerable<T> subjects)
{
if(subjects == null)
throw new ArgumentNullException("subjects");
return subjects.Count() == 5;
}
</code></pre>
<p>Do you think this null check and exception throwing is really necessary? I mean, when I use the <code>Count</code> method, an <code>ArgumentNullException</code> will be thrown anyways, right?</p>
<p>I can maybe think of one reason why I should, but would just like to hear others view on this. And yes, my reason for asking is partly laziness (want to write as little as possible), but also because I kind of think a bunch of null checking and exception throwing kind of clutters up the methods which often end up being twice as long as they really needed to be. Someone should know better than to send null into a method :p</p>
<p>Anyways, what do you guys think?</p>
<p><hr /></p>
<p><strong>Note:</strong> <code>Count()</code> is an extension method and <em>will</em> throw an <code>ArgumentNullException</code>, not a <code>NullReferenceException</code>. See <a href="http://msdn.microsoft.com/en-us/library/bb338038.aspx" rel="nofollow"><code>Enumerable.Count<TSource> Method (IEnumerable<TSource>)</code></a>. Try it yourself if you don't believe me =)</p>
<p><hr /></p>
<p><strong>Note2:</strong> After the answers given here I have been persuaded to start checking more for null values. I am still lazy though, so I have started to use the <code>Enforce</code> class in <a href="http://abdullin.com/shared-libraries/" rel="nofollow">Lokad Shared Libraries</a>. Can recommend taking a look at it. Instead of my example I can do this instead:</p>
<pre><code>public static bool HasFive<T>(this IEnumerable<T> subjects)
{
Enforce.Argument(() => subjects);
return subjects.Count() == 5;
}
</code></pre>
|
c#
|
[0]
|
2,985,959 | 2,985,960 |
My loop and File I/O
|
<p>How do I get my loop to write to the file until I stop the loop?</p>
<p>For example</p>
<pre><code>outFile = "ExampleFile.txt", "w"
example = raw_input(" enter number. Negative to stop ")
while example >= 0:
example = raw_input("enter number. Negative to stop")
outFile.write("The number is", example,+ "\n")
</code></pre>
<p>I feel like im hitting it close but I'm not sure. I wasn't sure how to search for this question in paticular. Sorry, I keep getting a error stating that the function takes 1 argument, when I enter more than 2.</p>
<pre><code>import os.path
outFile = open("purchases.txt","w")
quantity = float(raw_input("What is the quantity of the item :"))
cost = float(raw_input("How much is each item :"))
while quantity and cost >= 0:
quantity = float(raw_input("What is the quantity of the item :"))
cost = float(raw_input("How much is each item :"))
total = quantity * cost
outFile.write("The quantity is %s\n"%(quantity))
outFile.write("the cost of the previous quality is $s\n" %(cost))
outFile.close()
outFile = open("purchases.txt","a")
outFile.write("The total is ",total)
outFile.close()
</code></pre>
|
python
|
[7]
|
2,812,195 | 2,812,196 |
How to use a blittable type representing a string
|
<p>I am trying to use the ReadUsingPointer Method described <a href="http://www.codeproject.com/Articles/25896/Reading-Unmanaged-Data-Into-Structures" rel="nofollow">here</a> to have a light spead binary reader for huge binary files. <br>However, the struct I am trying to pass to it contains strings. I was wondering how I could circumvent this and avoid the "cannot take the address of, get the size of, or declare a pointer to a managed type" message</p>
<p>I tried the following with no success so far (maybe having accessors to these fields is the problem?):</p>
<pre><code> [MarshalAs(UnmanagedType.LPStr)]
string s;
</code></pre>
<p>I have to specify that these string fields are used after reading and are not assigned while reading the bytes, so I do not need them while reading (I could use an intermediary struct without these fields but for legacy issues I can't do this).</p>
|
c#
|
[0]
|
1,734,938 | 1,734,939 |
To get notification after download?
|
<p>imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:srcAddres]];</p>
<p>Downloading jpeg to my imagedata will spend some time,for example:2 second,so I want to show an activity indicator until the downloading finished . How can I know when the downloading has finished?</p>
|
iphone
|
[8]
|
302,943 | 302,944 |
Android Spinner
|
<p>I am having three spinner. I wanna to display today date in 1st spinner and current month in 2nd spinner and year in 3rd spinner when new Activity started.. Like this 30 12 2010</p>
|
android
|
[4]
|
5,730,555 | 5,730,556 |
Push integer from Input to array
|
<p>Hi im trying to get the number pushed into the array but cant seem to link the input to the array any help please </p>
<pre><code><html>
<body>
<form id="myform">
<input type="text" name="input">
<button onclick="myFunction()">Add number</button>
</form>
<br>
<div id="box"; style="border:1px solid black;width:150px;height:150px;overflow:auto">
</div>
<script>
var number= [];
function myFunction()
{
number.push=("myform")
var x=document.getElementById("box");
x.innerHTML=number.join('<br/>');
}
</script>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
216,843 | 216,844 |
JSoup is not working
|
<p>I'm trying to delete html tags from a string using JSoup, but at run time the emulator gives an exception that is: NoClassDefFoundError: org.jsoup.JSoup</p>
<p>here is my code:</p>
<pre><code>String result="<html> hello </html>";
Jsoup.parse(result).text();
</code></pre>
<p>can anyone help me?</p>
|
android
|
[4]
|
868,744 | 868,745 |
Type conversion error
|
<pre><code>int age = txtAge.Text;
</code></pre>
<p>I'm getting the error:</p>
<pre><code>Error 2 Cannot implicitly convert type 'string' to 'int'
</code></pre>
|
c#
|
[0]
|
711,615 | 711,616 |
Inline functions in c++ - conditions
|
<p>Under What condition an inline function ceases to be an inline function and acts as any other function?</p>
|
c++
|
[6]
|
3,446,398 | 3,446,399 |
Make a php file to be accessed only by a certain php file on the same domain
|
<p>I have two php files on a webdomain.</p>
<ul>
<li>The first one contains an iframe with the src="phpfile2.php";</li>
<li>In the second php I have the url of the iframe and other things.</li>
</ul>
<p>I want to secure the second php file so users can't see it because they can get the url of the iframe. </p>
<p>The idea is that I want the secondphp to be accessed only from the first php file.</p>
|
php
|
[2]
|
3,979,356 | 3,979,357 |
How to put array values in different columns of same row of csv
|
<p>I am having an array having multiple elements and i want each element to be inserted in a column of the same row of a csv file using php.
I am trying hard but can't find the solution can anyone help me please as soon as possible</p>
|
php
|
[2]
|
622,449 | 622,450 |
android developer console exception report platform not mentioned?
|
<p>I am new to android development. Recently I published a free app. after 70 to 80 downloads I have received a stack trace for a null pointer exception, </p>
<p>But the platform is not mentioned it only says 'Other'.</p>
<p>I am unable to reproduce the issue at my end and the stack trace is giving me no clue I have mentioned it here <a href="http://stackoverflow.com/questions/9929696/android-texttospeech-app-null-pointer-exception">Android TextToSpeech app null pointer exception</a>
. I would try to test it on the platform where the problem has occurred. </p>
<p>Can you please tell me what can I do to get the platform information if I get such errors ??</p>
<p>Like do I need to incorporate any code in the app for scenarios where app crashes do get more detailed information about the environement ??</p>
<p>Thanks, </p>
|
android
|
[4]
|
585,158 | 585,159 |
Selecting all children and decendants with jQuery
|
<p>I have some HTML that is being produced by a WordPress plugin that is designed to allow for expandable/collapsible text, with up to three levels of depth. I would like it so that if you were to collapse the first or second levels and the children below it were also expanded those too would get collapsed but nothing I use seems to allow the selection of <em>all</em> children. This is what I'm using so far:</p>
<pre><code>$(".hidden-text-toggle").click(function () {
if ($(".hidden-text:animated").length) return false;
$(this).next().slideToggle();
if ($(this).hasClass('expanded') ){
$(this).removeClass('expanded');
$(this).animate({ backgroundColor: "black" , color: "red"});
}
else
{
$(this).addClass('expanded');
$(this).animate({backgroundColor: "red" , color: "black"});
}
return false;
});
<div class="wrapper">
<h2 class="title">Level One</h2>
<div class="text" href="#">
This is level one text.
<div class="wrapper">
<h2 class="title" href="#">Level Two</h2>
<div class="text">
This is level two text.
<div class="wrapper">
<h2 class="title" href="#">Level Three</h2>
<div class="text">
This is level three text.
</div>
</div>
</div>
</div>
</div>
</div>
</code></pre>
<p>I would have thought that putting something like <code>$(this).find(".text").slideUp();</code> after line 4 would allow this but apparently I am wrong. </p>
<p>Any help would be much appreciated!</p>
|
jquery
|
[5]
|
5,145,106 | 5,145,107 |
Language selection using images in PHP
|
<p>I have found an open source PHP script that uses a select menu to choose the language.</p>
<p>In the code session makes use of a loop to fill in the select menu, as above...</p>
<pre><code>$la = 0;
foreach($trans['languages'] as $short=>$langname) {
$params['LANGSEL'][$la]['LANG_SHORT'] = $short;
$params['LANGSEL'][$la]['LANG_LONG'] = $langname;
$la++;
}
</code></pre>
<p>In the php template creates the select menu like that...</p>
<pre><code><td><select class="select" name="lang"><#FOR LANGSEL#>
<option value="<#LANG_SHORT#>"><#LANG_LONG#></option>
<#/FOR LANGSEL#></select></td>
</code></pre>
<p>So this code works fine but i find it kinda ugly so i am trying to make an image input instead
So i thought something like that would work..</p>
<pre><code><input type="image" name="lang" value="http://localhost/index.php?lang=en" src=" <#IMAGES_DIRECTORY#>/english.png"></td>
<input type="image" name="lang" value="http://localhost/index.php?lang=it" src=" <#IMAGES_DIRECTORY#>/italian.png"></td>
</code></pre>
<p>But nothing changes, the page always shows up in italian that is the default language..
Thanks in advance from a newbie that is struggling to learn some html and php.</p>
|
php
|
[2]
|
4,023,785 | 4,023,786 |
Jquery buttons background color alternate
|
<p>I have a list of <code>for</code> and <code>against</code> buttons. What i'm trying to do is if <code>for</code> is clicked , the <code>against</code> button for that row has alternate colors. I've tried to do this with jquery but it isn't working. How do i fix this? Here is the jsfiddle <a href="http://jsfiddle.net/mdanz/9H9qE/1/" rel="nofollow">http://jsfiddle.net/mdanz/9H9qE/1/</a></p>
<pre><code> <style type="text/css">
.rate3 {
padding:5px;
font-family:Arial;
color:#FFFFFF;
cursor:pointer;
background-color:red;
border:1px solid #000000;
}
.rate4 {
padding:5px;
font-family:Arial;
color:#FFFFFF;
cursor:pointer;
background-color:red;
border:1px solid #000000;
}
.vote {
height:30px;
width:auto;
margin-bottom:10px;
}
</style>
<script type="text/javascript">
$('.rate3').live('click',function() {
$(this).css('background-color','#FFFFFF');
$(this).css('color','red');
$(this).parent('div').next('.rate4').css('background-color','red');
$(this).parent('div').next('.rate4').css('color','#FFFFFF');
}
$('.rate4').live('click',function() {
$(this).css('background-color','#FFFFFF');
$(this).css('color','red');
$(this).parent('div').next('.rate3').css('background-color','red');
$(this).parent('div').next('.rate3').css('color','#FFFFFF');
}
</script>
<?php for($i=0;$i<11;$i++) { ?>
<div class="vote"><a class="rate3">For</a> <a class="rate4">Against</a></div>
<?php } ?>
</code></pre>
|
jquery
|
[5]
|
4,784,923 | 4,784,924 |
how to display image view background color with hash value
|
<p>how to display image view background color with hash values.</p>
<p>i need to place image view background color with #028002.</p>
<p>can any one please help me,</p>
<p>Thank u in advance. </p>
|
iphone
|
[8]
|
2,625,447 | 2,625,448 |
track the mouse moving speed and highlighting the paragraph
|
<p>i need to <strong>track the mouse moving speed</strong> through a line(line in a paragraph) and track that speed.then according to that speed, the <strong>paragraph should start to highlight</strong>.</p>
|
javascript
|
[3]
|
1,877,239 | 1,877,240 |
Sending Data From Serial To Socket
|
<p><br>I want to write the program, that pass data from serial link to socket and socket to serial link, vice visa.
<br> Do I need to use thread. If I need, can anybody guide me if there is any program like that before.
<br>Thanks </p>
|
python
|
[7]
|
5,767,850 | 5,767,851 |
how to block incoming calls in android
|
<p>I am not able to block incoming call in android programmatically.
when incoming calls comes,it just beep once and then end the call.
please help me to block incoming call very perfectly means without ringing even single ring.</p>
|
android
|
[4]
|
179,712 | 179,713 |
new to c++: error C2059: syntax error : 'constant'
|
<p>I am pretty new to C++ and I am getting following errors in header file. Thank you for any help.</p>
<p>3>c:\hedge\hedge\hedge\AisTarget.h(22) : error C2059: syntax error : 'constant'
3>c:\hedge\hedge\hedge\AisTarget.h(22) : error C2238: unexpected token(s) preceding ';'</p>
<pre><code>#if !defined(AisTarget_h)
#define AisTarget_h
#include "GeneralAviationItems.h"
#include <string>
namespace HEDGE
{
using namespace GeneralAviation;
class AisTarget : public WaypointLatLon
{
public:
static const int NO_DATA = -1000; //here it crashes
AisTarget();
virtual ~AisTarget();
int aisRptInd; //repeat indicator type
int aisMMSI; //target MMSI (i.e. id)
int aisNavStatus; //nav status
int aisSOG; //speed over ground knots
int aisCOG; //course over ground degrees
int aisROT; //rate of turn;
int aisHeading; //true heading degrees
bool lost;
double lastXPos;
double lastYPos;
bool hasBeenDrawn;
protected:
};
} // end namespace HEDGE
#endif
</code></pre>
|
c++
|
[6]
|
1,236,700 | 1,236,701 |
how to create widget in android
|
<p>how to create widgets in android i dnt know nothing please any boby help me to create this widget and tell me each and every s</p>
|
android
|
[4]
|
4,639,127 | 4,639,128 |
Attempting all possible pairs on a grid and keep a record for improvements to sides matches
|
<p>Please go easy if I fail to explain anything.</p>
<p>Basically I wish to find out how I can keep a record of swapping all points in a tetravex grid. [ref: http://gamegix.com/tetravex/game].</p>
<p>I've created the grid and added the tiles from a random solution. I can currently swap ONE pair of USER-generated tiles but cannot do this as an automatic process.</p>
<p>How would one generally automate the process of swapping items automatically? AND keep a record of the "good" swaps</p>
<p>The swap method accepts the following parameters:</p>
<pre><code>ems.swap(i1, j1, i2, j2);
</code></pre>
<p>Where <code>i1,j1</code> is the first tile which you want to swap and <code>i2,j2</code> is the second tile you want to swap.</p>
<p>Once this is done, the tiles are assessed,</p>
<pre><code> public static int AssessSwapTiles(EdgeMatchSolution ems, EdgeMatch em)
{
int a = em.getRows();
int b = em.getColumns();
int swaptotal = 0;
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
{
int numSides = ems.sidesMatched(i,j);
System.out.print(numSides + " ");
swaptotal += numSides;
}
System.out.println();
}
System.out.println(swaptotal);
return swaptotal;
}
</code></pre>
<p>This method is called once before the swap and again AFTER the swap.</p>
<p>Apologies for a long explanation, it was only for those who would stumble upon on this in the future.</p>
|
java
|
[1]
|
3,710,922 | 3,710,923 |
jQuery: How to get return value of function as value of id attribute?
|
<p>I'm trying to create a new tr element and set it's id attribute to the last id in the table of my MySQL db.</p>
<p>Here's what I have, but this does not set the id properly:</p>
<pre><code>$('<tr>').html(response)
.attr('id',function(){
var daId;
$.get(
'/getlastid.php',
null,
function(response){
daId = response;
alert(daId); //this shows correct id from db
});
return daId;
})
.prependTo('#table-id tbody'); //the tr does not have the id attribute set
</code></pre>
<p>How can I get this working right? The alert proves that my server side code is correct, it's just that the id attribute is not being created for the new row.</p>
|
jquery
|
[5]
|
2,673,896 | 2,673,897 |
Permutations of a list of lists
|
<p>I have a list like this:</p>
<pre><code>l = [['a', 'b', 'c'], ['a', 'b'], ['g', 'h', 'r', 'w']]
</code></pre>
<p>I want to pick an element from each list and combine them to be a string.</p>
<p>For example: 'aag', 'aah', 'aar', 'aaw', 'abg', 'abh' ....</p>
<p>However, the length of the list l and the length of each inner list are all unknown before the program is running. So how can I do want I want?</p>
|
python
|
[7]
|
3,044,655 | 3,044,656 |
Telerik Report With WPF
|
<p>I used Telerik Report control with WPF(C#). I assinged data to Telerik Report but i don't want to open report but i need to print directly when it filled.</p>
|
asp.net
|
[9]
|
4,198,653 | 4,198,654 |
Files type to upload aiff
|
<p>In a form used to upload music I check the files type, I want to allow people to upload mp3, wav and aiff. I found $_FILES['music']['type'] == 'audio/wav' and $_FILES['music']['type'] == 'audio/mp3' but I can't manage to find the appropriate type for the aiff files. Can anybody help me please?</p>
<p>Thanks</p>
|
php
|
[2]
|
5,440,687 | 5,440,688 |
mouse click limit problem, like a alert()
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1787625/disable-ie-menu-while-displaying-a-custom-dialog">Disable IE menu while displaying a custom dialog</a> </p>
</blockquote>
<p>alert Function is executed, you can not click on the menu of Internet Explorer.</p>
<p>I would like to implement these features.</p>
<p>please , give me hint.</p>
<p>and sorry, i can't speak english well..</p>
|
javascript
|
[3]
|
1,746,043 | 1,746,044 |
ajax extension tabs do not show the GUI after publishing on the server 2008
|
<p>On the localhost, ajax extension tabs display correctly. however, after publishing on the server, the tabs only show the text but not the GUI.</p>
<p>Is there any idea?</p>
<p>Thanks in advance.</p>
|
asp.net
|
[9]
|
2,875,766 | 2,875,767 |
How do I perform a calculation which depends on a dropdown and N number of selected textboxes?
|
<p>I hope that somebody can help me or point me in the right direction. </p>
<p>Here's what I have,</p>
<p>One select dropdown with two values
Eight checkboxes</p>
<p>The dropdown has a value of 6 or 12, the checkboxes value needs to be calculated on how many have been selected.</p>
<p>ie</p>
<p>If I select one checkbox and 6 from the dropdown I need to populate a textbox with 60<br>
If I select two checkboxs and 6 from the dropdown I need to populate a textbox with 80<br>
If I select three checkboxs and 6 from the dropdown I need to populate a textbox with 100<br>
etc etc</p>
<p>Any help greatly appreciated</p>
|
javascript
|
[3]
|
2,626,205 | 2,626,206 |
Listen for ringer muted on incoming call
|
<p>i need to know in a background task if the user mutes an ongoing ringing with the volume button. so the call comes in and the phone starts ringing. the user then mutes this ringing by clicking one of the volume buttons. neither RINGER_MODE_CHANGED nor ContentObserver on system settings work here since the volume does actually not change nor does the phone change its ringer mode.</p>
<p>any ideas?</p>
<p>Thx
Simon</p>
|
android
|
[4]
|
4,693,308 | 4,693,309 |
Unexpected initCause behaviour I cannot overcome
|
<p>I have a source like this:</p>
<pre><code> Exception e = new Exception("Exception");
IOException ioE = new IOException("An exception cause");
e.initCause(ioE);
</code></pre>
<p>I'm trying to set the cause of the exception "e" and what I get is the exception being set to itself!</p>
<p>I just don't get it. Does my code make any sense or am I going nuts?</p>
|
java
|
[1]
|
1,621,798 | 1,621,799 |
Is it possible to change values in windows service - in ini file or xml?
|
<p>I have Windows service, that have Timer.</p>
<p>I want the option to change the Timer speed value.</p>
<p>how I can do it ? with ini file ? or xml file ?</p>
<p>Is it possible ? if yes, can I get sample code ?</p>
<p>thank's in advance</p>
|
c#
|
[0]
|
2,709,940 | 2,709,941 |
insert "Assignment Operator Expression" to complete Expression
|
<p>I am using Java and I have the error
insert "Assignment Operator Expression" to complete Expression" </p>
<p>what is the meaning of this error?.
Is there a List of all java error Messages and what they mean?</p>
<p>thanks</p>
|
java
|
[1]
|
156,258 | 156,259 |
loading the same page with and without session variables
|
<p>I have an aspx page. This page is used for both create and edit.
While editing, I set a session variable and load the same page.
While creating , user has to click on menu option and it get redirected to "CreatePage.aspx".
While editing, it will be redirected on click of a column in a grid . this time the response.redirect happens to the same page with Session["Id"] set to some value. Now my question is how and when do I set the session to null?
This should work for Create and Edit using the same page. Any help will be greatly appreciated.</p>
|
asp.net
|
[9]
|
1,750,824 | 1,750,825 |
in_array ignores 000 after decimal
|
<pre><code>$arr = array(2.1,3.1);
if(in_array(2.1000,$arr))
echo "yes";
else
echo "no";
</code></pre>
<p>I want it should show "No" but it ignores 0's after decimal point.</p>
|
php
|
[2]
|
3,885,136 | 3,885,137 |
Android onPause issue
|
<p>I have a search function in my app, and I have the searching activity called SearchPage2.java, and also another activity (SearchTaDa.java) that shows more info when a list Item is clicked. I've discovered that I can't call <code>finish()</code> in <code>onPause()</code> in SearchPage2.java because I want the ListView to still be visible when you press my software back button (or the hardware Back Button) from SearchTaDa.java. But because I'm not calling <code>finish()</code> in SearchPage2.java, when you press the hardware home button to exit the app, then restart the app, it goes right back to the SearchPage2 activity rather than restarting the app from the splash screen, the beginning of the app. So the SearchPage2 onPause looks like:</p>
<pre><code> @Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
}
</code></pre>
<p>and the More Info Activity, SearchTaDa.java onPause looks like:</p>
<pre><code> @Override
protected void onPause() {
super.onPause();
overridePendingTransition(R.anim.fadein, R.anim.fadeout);
finish();
}
</code></pre>
<p>My question is what can I call in the SearchPage2 activity so that when you restart the app it starts fresh, and doesn't resume at the search page?</p>
|
android
|
[4]
|
3,461,199 | 3,461,200 |
Why Java is still used in web development?
|
<p>Why Java is still used in web development? I'm just curious..</p>
|
java
|
[1]
|
5,676,027 | 5,676,028 |
RETS - How can I Replicate data from RETS server to my local server?
|
<p>Right now I am working on one Real Estate Website, In that website I am using RETS Service to get property data.I want to replicate that data to my local server so, I am stuck with database design for replicate that RETS data.I want sample DB for RETS data handle or help me how to make database for RETS data replication?</p>
<p>Help me please.</p>
|
php
|
[2]
|
5,398,488 | 5,398,489 |
write function inside another function in javascript
|
<p>I am wondering that javascript support to write the function inside another function, by one of blog. Is this really possible. In fact i have done code but doubt about this concept. please clear this concept. I a really confuse.</p>
|
javascript
|
[3]
|
2,550,051 | 2,550,052 |
Javascript Settimeout problem
|
<p>In my application i am using asp.net3.5,ajax.dll.</p>
<p>I am calling all functionalities using ajax from javascript.</p>
<p>Sometimes i need to get the condition results from server side, only then i will be able to pass to next condition.</p>
<p>for the above case, javascript passes to next condition before executing the first condition.</p>
<p>So i added the following code to make it work,</p>
<p><code>setTimeOut("finddefaultvideo()",1000);</code>.</p>
<p>Can anyone please help me to get rid of this issue?</p>
<p>One thing i understood that,it won't wait for the time until server returns the value.</p>
<p>any idea to overcome the above one?</p>
|
javascript
|
[3]
|
3,497,398 | 3,497,399 |
Remove content and append class with jQuery
|
<p>I have to use a proprietary cms blog that renders it's "summary marker" that contains</p>
<ol>
<li>an elipsis</li>
<li>a dynamic changing link (so the link is always different)</li>
<li>static text that says: Click here to read more.</li>
</ol>
<p>This is how the summary marker currently renders on a page:</p>
<pre><code><p>Content goes here....<a href="example.htm">Click here to read more.</a></p>
<p>More content goes here....<a href="anothertest.htm">Click here to read more.</a></p>
<p>Content goes here....<a href="helloworld.htm">Click here to read more.</a></p>
</code></pre>
<p>Meanwhile, I would like to control the summary marker with some jquery so I'm not restricted to its rigid display by:</p>
<ol>
<li>removing each <code>ellipsis</code> </li>
<li>appending a <code>class</code> ONLY after the <code>href</code> that contained the ellipsis, so it doesn't update other links on the page.</li>
</ol>
<p>This would be the much desired expected result.</p>
<pre><code><p>Content goes here.<a href="example.htm" class="readmore">Click here to read more.</a></p>
<p>More content goes here.<a href="anothertest.htm" class="readmore">Click here to read more.</a>
<p>Content goes here.<a href="helloworld.htm" class="readmore">Click here to read more.</a>
</code></pre>
<p>Thanks so much for your help in advance!</p>
<p>This is what I got, which is bad I know</p>
<pre><code>$("p").html("...").remove:after.attr(".readmore").attr("href"));
</code></pre>
|
jquery
|
[5]
|
2,149,886 | 2,149,887 |
String is palindrome or not
|
<p>I was in process to develop an application in which I want to prove that the given string is palindrome or not but I don't want to use string builder of string buffer class I want to proceed with string class , Please advise how to achieve this..! </p>
|
java
|
[1]
|
257,544 | 257,545 |
Way of loading dynamic content onload with Javascript
|
<p>On my page I load some tracks in a music player ( <a href="http://dev.upcoming-djs.com" rel="nofollow">http://dev.upcoming-djs.com</a> ) on page load.</p>
<p>Which is working fine.</p>
<p>However when people go to the following URL: <a href="http://dev.upcoming-djs.com/track/1/artist/title" rel="nofollow">http://dev.upcoming-djs.com/track/1/artist/title</a> I would like to load another track in the player on page load.</p>
<p>Currently the JS code for the player is:</p>
<pre><code>var tracks = [];
tracks.push({'url':trackurl, 'title':trackurl});
$('.upcoming-player-container').theplayer({
links: tracks // contains an array with url's
});
</code></pre>
<p>Which is static.</p>
<p>What would be the best way (not meant to be subjective, just don't know how to rephrase it) of making it dynamic.</p>
<p>I was thinking of adding some hyperlinks in a (hidden) container on the page which I retrieve with JS.</p>
<p>Is this a good way to do it? (Since I think Google might add the text to the search results).</p>
<p>Or perhaps there is a better way of doing it?</p>
|
javascript
|
[3]
|
1,603,239 | 1,603,240 |
ASP.NET 4.0 Website, want to put left menu in a file to edit from 1 file only
|
<p>I developed a website (I'm not a hard core programmer, but I can get by) using MS Visual Web Developer 2010. I love it! Stack people who responded to my 1st question recommended a new host, and that was a perfect recommendation.</p>
<p>Anyway, I have a navigational menu that I got from dynamicdrive on the left of every page. Currently, if I want to change the menu, I have to edit 24 different pages (a lot of copying and pasting!). I'd like to know if there's a way I can take the left menu, put it into a file (css? htm? Whatever the case ...), and then just put some type of or (??) type of tag there. This way, when I want to change the menu for the entire site, I just have to change 1 file.</p>
<p>Here's a picture I put on photobucket:
<a href="http://s1209.photobucket.com/albums/cc387/jdluski/?action=view&current=leftmenu.png" rel="nofollow">Picture of my left menu on my website (photobucket .png picture because I'm not allowed to upload pictures yet)</a></p>
<p>Also, whatever recommendation you have, I'll do the same to the footer, with our legal copyright and social bookmarking links.</p>
<p>Thanks a bunch Stack people!</p>
|
asp.net
|
[9]
|
3,859,508 | 3,859,509 |
Javascript firefox issue
|
<p>I developed a .htm document with an in-built script for javascript to run a program. In google chrome, the program works fine, but I got a beta test complaint that it didn't work on firefox 14.01 or opera. On testing with firefox 14.01, I can confirm it doesn't work (I assumed opera to be the same). I cannot insist the audience upgrade their browsers, as this is supposed to be widely compatible.</p>
<p>Doing a little tracing of the issue, I installed Firebug, which, on clicking the Javascript button to generate a coordinate the first time, it worked (clearly showing the <em>function is defined and exists</em>), but the second time, Firebug complained that:</p>
<pre><code>"ReferenceError: GenerateCoord is not defined".
</code></pre>
<p>This wouldn't be so ironic if it only did this after generating an (encrypted) coordinate (thus calling GenerateCoord that is supposedly 'undefined').</p>
<p>If one looks in the code, one can clearly see that the function GenerateCoord is clearly defined before it is called. I would say firefox has an 'onclick' issue, but then it begs the question why did it work the first time I clicked it (calling GenerateCoord via 'onclick') but not the second?</p>
<p>Reloading the file allows the button to work the first time, and the first time only. I am baffled as to how firefox can call a function one time that it then says is undefined the next. Am I missing something here?</p>
<p>Javascript and HTML code can be viewed here:</p>
<p><a href="http://pastebin.com/4qykTfEW" rel="nofollow">http://pastebin.com/4qykTfEW</a></p>
<p>-</p>
<p>How do I solve the problem, and is there an easier solution than re-writing the code to avoid onclick (that seems to work in certain circumstances but not others)?</p>
|
javascript
|
[3]
|
4,658,283 | 4,658,284 |
TypeError when applying a textarea's value to a variable
|
<p><strong>JavaScript</strong></p>
<pre><code>var textarea = document.getElementById("textarea").value;
</code></pre>
<p><strong>HTML</strong></p>
<pre><code><textarea id="textarea" cols="100" rows="10">du hello!</textarea>
</code></pre>
|
javascript
|
[3]
|
3,237,777 | 3,237,778 |
Configure one app to be built using two Android name spaces?
|
<p>I have an app that, for release, needs building as two apps. The app will self-reconfigure based on the app's namespace, so I just need to build two versions, each with its own slightly different namespace.</p>
<p>I obviously want to avoid changing source code package names, and would like to change the name space in one place so building either version is quick and easy.</p>
<p>Can I simply change the package name in the <manifest> tag in the Android manifest, making sure my references are fully qualified? Are there any gotchas with doing this?</p>
|
android
|
[4]
|
2,569,012 | 2,569,013 |
Replace String Literals If/elseIf block with Enum
|
<p>I'm new to using Java Enums and I've read that replace IF logic that compares String literals should be replaced with an Enum. I don't quite understand how to replace my below code with an Enum, any ideas? Based on the col value being passed into applyEQ, I need to do a base the next method call on it's value. I do know the possible values of col ahead of time and I'm using a constants file for now. Should I create an Enum and place it in my Interface of Constants file?</p>
<pre><code>public class FilterHelper implements IFilterHelper {
private final EQuery eQuery;
public FilterHelper(EQuery query) {
eQuery = query;
}
@Override
public void applyEQ(String col, String val) throws Exception {
int return = 0;
if (col.equalsIgnoreCase(EConstants.NAME)) {
ret = Sample.addName(eQuery, val);
} else if (col.equalsIgnoreCase(EConstants.KEYWORDS)) {
ret = Sample.addKey(eQuery, val);
} else if (col.equalsIgnoreCase(EConstants.ROLE)) {
ret = Sample.addRole(eQuery, val);
}
if (return != 0) {
throw new Exception("failed");
}
}
}
</code></pre>
<p><strong>EConstants.java</strong></p>
<pre><code>public final class EConstants {
public static final String NAME = "cewName";
public static final String KEYWORDS = "cewKeywords";
public static final String ROLE = "cewRole";
}
</code></pre>
|
java
|
[1]
|
3,321,961 | 3,321,962 |
Which child does jquery pick if there are multiple children?
|
<p>I have a unordered list <code><ul id="images" ></code>. There are 3 list items in the list and in each item there is an image. Each image has a different width. How does jquery deal with the following.</p>
<pre><code>var width = $('#images li img').width();
</code></pre>
<p>which of the 3 image widths will the var 'width' contain?</p>
|
jquery
|
[5]
|
1,133,305 | 1,133,306 |
Search 0KB files in a folder C#
|
<p>hi
How can I find the files in a folder which are of size 0 KB using c#.</p>
<p>Regards,
Creator </p>
|
c#
|
[0]
|
1,139,726 | 1,139,727 |
issue in javascript in checkboxlist
|
<p>this is my Javascript which behaves like an Radiobutton. where user can select only 1 option at a time (ex: <strong>if he select item1 and selects item2 then item1 gets deselected,</strong> as he as selected item2 if he clicks again on item2 it gets deselected.) which make user either select any one item or deselect the selected item to</p>
<p><strong>this condition works fine</strong><br>
<strong>issue</strong>
i have an button in page once user clicks that button again if user selects any item[eg item1 is selected before clicking on the button. then after clicking the button. and now if we selected any item in checkboxlist the initially selected item1 is not getting deselected when i am selecting another item in check boxlist </p>
<p>below is my code</p>
<pre><code>var objChkd;
function HandleOnCheck()
{
var chkLst = document.getElementById('CheckBoxList1');
if(objChkd && objChkd.checked)
objChkd.checked=false;objChkd = event.srcElement;
}
</code></pre>
<p>and register the client event to the 'CheckBoxList1' at the Page_load as </p>
<pre><code>CheckBoxList1.Attributes.Add("onclick","return HandleOnCheck()");
</code></pre>
<p>in .cs file i don't want to do this CheckBoxList1.clearSelection();</p>
<p>any help would be great </p>
<p>thank you</p>
|
javascript
|
[3]
|
4,551,780 | 4,551,781 |
Missing Data for Image
|
<p>I am loading an image from the internet using the following code:</p>
<p>NSURL *URL = [NSURL URLWithString:urlToImage];
NSData *data = [NSData dataWithContentsOfURL:URL options:0 error:&err]];
self.img = [[UIImage alloc] initWithData:data];</p>
<p>After the above:</p>
<p>self.img == nil, err == nil</p>
<p>No error, or no img.</p>
<p>I am suspecting that the data coming from the server is being truncated. THe data variable ends up being 850b but the image is 20K. </p>
<p>So, is there any reason data would be truncated?</p>
<p>Thanks in advance</p>
|
iphone
|
[8]
|
1,048,618 | 1,048,619 |
How to properly update a datatable while inside a loop
|
<p>In my below code I'm comparing values (email addresses) in my Arrarylist (called emails) with values in my Datatable (called dtResult). I was hoping to be able to remove rows from the datatable if it has an email address that is found in the arraylist but I'm starting to think I'm better off creating a new datatable that does not have those rows instead (I just don't know how to do that). Obviously my code below bombs after a row is deleted because it loses its place in the foreach loop. How can I fix this?</p>
<p>Thanks.</p>
<pre><code>foreach (DataRow row in dtResult.Rows)
{
var tmpl = row[3];
for (int x = 0; x < emails.Count; x++) //emails is an ArrayList of email addresses
{
string one = emails[x].ToString().ToUpper();
string two = tmpl.ToString().ToUpper();
//compare datatable value to arraylist value..
if (one == two)
{
//if they are equal then I want to remove them (or maybe create a new datatable??)
dtResult.Rows.Remove(row);
dtResult.AcceptChanges();
}
}
}
</code></pre>
|
c#
|
[0]
|
2,423,839 | 2,423,840 |
how to get values sent by location.replace(URL)
|
<p>In my JavaScript function I do like this in order to redirect parameters to servlet:</p>
<pre><code>var ids1=document.getElementById("projet").value;
document.location.href("http://localhost:8080/Opc_Web_App/ServletAffectation?ids1="+ids1);
</code></pre>
<p>and in the servlet I do the following to get Value:</p>
<pre><code>String idprojet= request.getParameter("ids1");
System.out.println("le projet selectionné est :" +idprojet);
</code></pre>
<p>the problem that i didn't have the result of System.out.print in my screen; so in other terms the servlet didn't get the parameter.</p>
<p>I can not see the problem until now.
Please help.
Thank you.</p>
|
javascript
|
[3]
|
4,149,315 | 4,149,316 |
Does not display the PDF files in listview thumbnail format c# 2008
|
<p>im trying to display the PDF files in the listview thumnail like windows explorer. I have not any idea about this.</p>
<p>How to display the pdf files. plz suggest some idea.</p>
<p>thanks in advance.</p>
|
c#
|
[0]
|
1,530,304 | 1,530,305 |
How to set a print the contents of the div tag
|
<p>I have a div tag on my web page which scrolls a long way to the right. I want to create a print button which the user can use to only print the contents in the div tag.
Thanks for any help with this. </p>
|
javascript
|
[3]
|
3,840,554 | 3,840,555 |
Php self-delete file...is it possible?
|
<p>say I have a install folder containing a php file, say <code>install.php</code> handling the installation of other scripts... I want to delete this file and it's containing directory when it completes it's work... is this possible? are there any walkarounds you would suggest?</p>
|
php
|
[2]
|
2,468,718 | 2,468,719 |
rebuild my Android for multiple languages
|
<p>I want to rebuild my Android application so it supports multiple languages.
What is the best way to do this?</p>
|
android
|
[4]
|
1,034,172 | 1,034,173 |
Specific JavaScript Not working in Mozilla Firefox
|
<p>After selecting the check box I'm submitting the form and i want to close the window if the checkbox is checked. Below is the code; it is working in IE but not working in Mozilla Firefox.</p>
<pre><code>try {
window.close();
$('#submitFrm').submit();
} catch (err) { }
</code></pre>
|
javascript
|
[3]
|
201,695 | 201,696 |
Apply event on children element in jquery
|
<p>I want to write my custom jquery tooltip code for selected dropdown list.below is my html code structure.I want to display tooltip on hover of ? (question mark) in span tag. I have write jquery code but it does not work.My question is that how apply event of children element (like span children of div).I have already tried below jquery code but it does not work.</p>
<p>Dropdown fill up on page load using ajax. </p>
<p><strong>Javascript code</strong> </p>
<pre><code>$(document).ready(function(){
// first code not working
$('#sub_cat_tooltip').hover(function(){
alert("Title :"+$("#subcat option:selected").attr( "title"));
});
// second code not working
$('#subcatdrp p #sub_cat_tooltip').hover(function(){
alert("Title :"+$("#subcat option:selected").attr( "title"));
});
// third code not working
$('#subcatdrp > p > #sub_cat_tooltip').hover(function(){
alert("Title :"+$("#subcat option:selected").attr( "title"));
});
// fourth
// try all above try using onmouseover event
$('#sub_cat_tooltip').onmouseover(function(){
alert("Title :"+$("#subcat option:selected").attr( "title"));
});
});
</code></pre>
<p><strong>HTML Code</strong></p>
<pre><code><div id="subcatdrp">
<p>
<label for="subcategory">Sub Category:</label>
<select id="subcat" name="subcat">
</select>
</p>
<span id="sub_cat_tooltip" class="tooltip_img">?</span>
</div>
</code></pre>
|
jquery
|
[5]
|
3,929,188 | 3,929,189 |
Is there any good alternative for python's webkit module that works on windows?
|
<p>Is there any official good alternative for webkit that works on windows?</p>
|
python
|
[7]
|
3,937,761 | 3,937,762 |
How to save values when i click previous button in asp.net
|
<p>I have created online exam application (web based) in asp.net c#. In my application first form includes dropdownlist for tests & start button. When i select particular test from dropdownlist & after clicking to start button it goes to the next page. It includes one label for question, radiobuttonlist for answers, next & previous button.In first form in the click event of start button i have created non repeated random values ( for question ids) i.e stored in array.when it redirects to another page then 1st question from that array will display with answers & after clicking next button next question will appear, here i have inserted selected values(answers selected in radiobuttonlist) by user in database to calculate score. Problem is with previous button, when i click to previous button then it goes to previous button but i want earlier selected values by user to be bind with that radiobuttonlist. how i can do this? </p>
|
asp.net
|
[9]
|
5,215,841 | 5,215,842 |
TypeError: list objects are unhashable
|
<pre><code>totalCost = problem.getCostOfActions(self.actions)
</code></pre>
|
python
|
[7]
|
594,316 | 594,317 |
Can the same app be used for both Iphone and Ipod Touch?
|
<p>can a single application be used in both iphone and ipod touch > or we have to build them seperately ? Are there IPod only applications ?</p>
|
iphone
|
[8]
|
5,376,092 | 5,376,093 |
asp.net data binding in literal
|
<p>Lets say we have the following in the default.aspx file</p>
<pre><code><asp:Literal runat="server" Text="<%= TestMethod() %>" />
</code></pre>
<p>What needs to be defined in the default.aspx.cs file to make this work?</p>
<p>I tried to add a method called <code>TestMethod</code> to the <code>_Default</code> class which simply returned the string <code>Test</code>, but it didn't seem to work.</p>
<p>Can anyone help?</p>
<p>Thanks,</p>
<p>AJ</p>
|
asp.net
|
[9]
|
1,950,133 | 1,950,134 |
iPhone Camera API and Zoom
|
<p>I am just curious as to how current ZOOM-Camera Apps on the AppStore are implemented (Are they using undocumented APIs?)</p>
|
iphone
|
[8]
|
4,384,382 | 4,384,383 |
Android arrow keys on a Mac
|
<p>My teacher wants us to work on the Snake Android demo, and I'm having trouble using the arrow keys of my Mac. I need to press the arrow about 20 times before the snake actually moves. In my 2.3.3 AVD config I have enabled <code>hw.dPad</code> and <code>hw.keyboard</code>. One thing I was suggested was to use an Android 4 rom, but I actually get worse problems. What else can I do?</p>
|
android
|
[4]
|
3,638,544 | 3,638,545 |
Size of components in a JavaScript library?
|
<p>I have my JavaScript organized into modules.</p>
<p>In some places there is a lot of different ways I could organize the code to get a certain size.</p>
<p>This question is not intended to create opinions or speculation.</p>
<p>I just want to organize my code well. If there is not an optimal size, is there an average size of well written code?</p>
<p>Here is link to a study about this by <a href="http://dl.acm.org/citation.cfm?id=567176.567181" rel="nofollow">Columbia University</a> posted on this similar question <a href="http://stackoverflow.com/questions/840092/whats-the-optimum-size-for-a-class-file/840102#840102">here</a></p>
<blockquote>
<p>enough code to do the job</p>
</blockquote>
<p>is the top answer in the similar question, but if you believe the egg came first then what is the average size of a well written component ( the egg ) in JavaScript?</p>
|
javascript
|
[3]
|
5,264,374 | 5,264,375 |
comparing dates in Javascript - Results not consistent
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3789913/how-to-check-2-date-fields-and-compare-to-see-which-date-is-ahead-behind-or-the">How to check 2 date fields and compare to see which date is ahead, behind or the same</a> </p>
</blockquote>
<p>I am trying to implement a validation which should compare two dates and give an alert message.</p>
<p><code>entrydate</code> is a text feild in our ASP page and so is <code>vdata</code>. I should check and make sure that <code>vdata</code> is always greater than or equal to <code>entrydate</code>. The code below is not working.</p>
<p>Please help to identify what the problem is with the this code:</p>
<pre><code>if(document.Step2.entrydate.value <= document.all(vData).value)
</code></pre>
|
javascript
|
[3]
|
5,121,107 | 5,121,108 |
portable code between windows and linux
|
<p>I have an aplication written for linux,and i want to make it to execute under windows too. So how can i make a specific line in code to execute only if the programs runs under windows ? I know its somehting with #ifdef... Thanks</p>
|
c++
|
[6]
|
4,126,847 | 4,126,848 |
How to make a database connection
|
<p>Using MySQL & Java Script</p>
<p>I want to make a mysql connection in Java Script, then how can i get a table value by using this connection.</p>
<p>ASP.Net code</p>
<p>con.ConnectionString =
"Dsn=server1;" +
"Uid=root;" +
"Pwd=root;";
con.Open();</p>
<pre><code>cmd = new OdbcCommand("Select * from tb_values", con);
cmd.ExecuteNonQuery();
</code></pre>
<p>Above Code is working in asp.net, but i want to make a connection & select a values by using JavaScript.</p>
<p>Need JavaScript Code Help.</p>
|
javascript
|
[3]
|
4,808,667 | 4,808,668 |
Building a dict using zip
|
<p>I have a list of names:</p>
<pre><code>['john smith', 'sally jones', 'bob jones']
</code></pre>
<p>I want to build a dict in the following format:</p>
<pre><code>{'john smith': [], 'sally jones': [], 'bob jones': []}
</code></pre>
<p>This is what happens when I try using zip </p>
<pre><code>zip((all_crew_names, [[] for item in all_crew_names]))
[(['john smith', 'sally jones', 'bob jones'],), ([[], [], []],)]
</code></pre>
<p>What am I doing incorrectly here, and how would I properly zip this up?</p>
|
python
|
[7]
|
3,018,133 | 3,018,134 |
What is the difference between "service" and "component"?
|
<p>I am little bit confused about the difference between a service and component. Can someone explain with example that what is the difference between a service and component?</p>
|
c#
|
[0]
|
4,603,155 | 4,603,156 |
Best way to show message in Controller
|
<p>Which way is the best to show message in Controller? Is must showing count articles.</p>
<pre><code>$c = count($articles);
if($c == 0) {
return "On site are 0 articles";
} elseif ($c == 1){
return "On site is 1 article";
} else {
return "On site are" . $c . "articles";
}
</code></pre>
<p>or:</p>
<pre><code>if($c == 1) {
$text1 = 'is';
$text2 = 'article'
} else {
$text1 = 'are';
$text2 = 'articles'
}
return "On site" . $text1 . $c . $text2;
</code></pre>
<p>Maybe others ways?</p>
|
php
|
[2]
|
2,376,661 | 2,376,662 |
How to create an array with size more than C++ limits
|
<p>I have a little problem here, i write c++ code to create an array but when i want to set array size to 100,000,000 or more i got an error.</p>
<p>this is my code:</p>
<pre><code>int i=0;
double *a = new double[n*n];
</code></pre>
<p>this part is so important for my project.</p>
|
c++
|
[6]
|
3,614,276 | 3,614,277 |
Which is the best way to get continues location updates from running background service with battery optimization?
|
<p>I have to create an app which runs a service in background and continually update the current location on the server or we can say i have to send my current location at some points. The solutions i have think are following. please look at that and give me some idea.</p>
<ol>
<li>Running an service in background with boot-starter.</li>
<li>Implementation of alarm manager so service can be started automatically if android kills it. </li>
<li>If my current location is in the radius of the 500 from my points than start to update on server.</li>
<li>and other logic which i have think to prevent continues server update.</li>
</ol>
<p>I have research on it and found it consumes much battery of phone. So please suggest me how can i optimized it.</p>
|
android
|
[4]
|
494,779 | 494,780 |
C++: how to add int to current string in C++?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/191757/c-concatenate-string-and-int">C++ concatenate string and int</a> </p>
</blockquote>
<p>Hi,</p>
<p>In C# I can write like this:</p>
<pre><code>int i = 0;
string text = "out.jpg";
while(true)
{
i++;
Object.write(i+text, stream);
}
</code></pre>
<p>But this is not true for C++. the problem is at: i + default.</p>
<p>How could I fix this in C++?</p>
<p>Thanks in advance. Your help is much appreciated!</p>
|
c++
|
[6]
|
2,773,233 | 2,773,234 |
jQuery function queueing confusion
|
<p>I'm trying to understand exactly what it means when I put multiple calls in a row on jQuery, because I'm not getting the results I expect in similar situations.</p>
<p>Example 1:</p>
<pre><code>$(this).animate({opacity: 0.25}, 250).animate({opacity: 1.0}, 250);
</code></pre>
<p>As expected, this gives a quick flash of translucency before returning to full opacity.</p>
<p>Example 2:</p>
<pre><code>$(this).animate({opacity: 0.25}, 250).removeAttr("style");
</code></pre>
<p>In this case, instead of a gradual return to opacity, I would expect the removeAttr("style") to cause it to jump back to opacity after the animation is complete. This is because the animate opacity function merely changes values for <code>opacity</code> and sets <code>display:block</code>, and I would expect that by removing these styles, everything returns to normal.</p>
<p>Instead, it seems like the removeAttr is firing before the animation is complete, clears out the style, and then animation sets the opacity some more, leaving the item translucent. </p>
<p>The fact that this is the sequence of events would seem to be confirmed by the fact that altering the removeAttr to use a completion callback works properly:</p>
<pre><code>$(this).animate({opacity: 0.25}, 250, function(){$(this).removeAttr("style");});
</code></pre>
<p><b>Why is it that animations appear to be processed serially, while at least some functions are processed in parallel with the animations?</b></p>
|
jquery
|
[5]
|
3,607,840 | 3,607,841 |
Memory Leak Problems with UIImagePickerController in iPhone
|
<p>I am using the following code for UIImagePicker,</p>
<pre><code>UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
[self presentModalViewController:imagePicker animated:YES];
[imagePicker release];
</code></pre>
<p>When I run instrument, I see a memory leak on the first line of the code. Though I am releasing it, still its showing memory leak, does anyone have any idea where am I going wrong.</p>
<p>I installed the iPhoneCoreDataRecipes Application from iPhone Developers Sample Code help and it is having the same problem.</p>
|
iphone
|
[8]
|
3,844,575 | 3,844,576 |
Calling a variable from another class, issues with scope
|
<p>Ok I've narrowed down my problem but can't come up with a fix.</p>
<p>I want the first class to be able to reference variables from the second class.</p>
<pre><code>class TheFirstClass{
public function __construct(){
include 'SecondClass.php';
$SecondClass = new SecondClass;
echo($SecondClass->hour);
}
}
//in it's own file
class TheSecondClass{
public $second;
public $minute = 60;
public $hour;
public $day;
function __construct(){
$second = 1;
$minute = ($second * 60);
$hour = ($minute * 60);
$day = ($hour * 24);
}
}
</code></pre>
<p>But in this situation, only the "minute" is able to be accessed from the other class. If I were to remove the "= 60", then the minute would return nothing along with the rest of the variables.</p>
<p>The variables within the constructor are calculated correctly, but they do not affect the variables of the same name higher in the scope. Why, and what would be the correct way to structure the code instead?</p>
|
php
|
[2]
|
4,557,672 | 4,557,673 |
Android How can app run as System App?
|
<p>What is required for app to run as System app. what needs to be requested from the vender. Is this needed if device is rooted and say you want to call a method like on PowerManager or other System manager that will effect device? Thanks? I am able to call call set brightness but not do operations like put device in sleep mode etc. Thanks</p>
|
android
|
[4]
|
3,025,131 | 3,025,132 |
What does the C++ compiler error "looks like a function definition, but there is no parameter list;" mean?
|
<pre><code>#include <iostream>
#include <fstream>
using namespace std;
int main
{
int num1, num2;
ifstream infile;
ostream outfile;
infile.open("input.dat");
outfile.open("output.dat");
infile >> num 1 >> num 2;
outfile << "Sum = " << num1 + num2 << endl;
infile.close()
outfile.close()
return 0;
}
</code></pre>
<p>This is what I did and when I compile it, I got this error that said</p>
<pre><code>error C2470: 'main' : looks like a function definition, but there is no
parameter list; skipping apparent body
</code></pre>
<p>Please don't hate me :( I am new at this computer science....</p>
|
c++
|
[6]
|
4,354,081 | 4,354,082 |
Else statement for Login Function not Always Working Correctly
|
<p>The code below is part of a PHP / MySQL login system that I am using. It determines whether or not the login fields are displayed, and it is supposed to only display them when the user is not logged in. Sometimes it displays them when is user is logged in, logging the user out. </p>
<p>Any ideas on what I should look for to trouble shoot this?</p>
<p>Thanks in advance,</p>
<p>John</p>
<pre><code><?php
if (!isLoggedIn())
{
if (isset($_POST['cmdlogin']))
{
if (checkLogin($_POST['username'], $_POST['password']))
{
show_userbox();
} else
{
echo "Incorrect Login information !";
show_loginform();
}
} else
{
show_loginform();
}
} else
{
show_userbox();
}
?>
</code></pre>
|
php
|
[2]
|
3,556,064 | 3,556,065 |
c# what is the process of building/installing a service?
|
<p>i am creating a simple service in VS2008 c#</p>
<p>how do i install it on my computer so that it runs when i start my machine?</p>
|
c#
|
[0]
|
3,060,306 | 3,060,307 |
Use of unassigned local variable 'bar'
|
<p>Why if do this:</p>
<pre><code>Object bar;
Foo(bar);
</code></pre>
<p>in C# I get a</p>
<pre><code>Use of unassigned local variable 'bar'
</code></pre>
<p>error?</p>
<p>How can I fix it?</p>
|
c#
|
[0]
|
5,719,794 | 5,719,795 |
php header to download multiple files in loop
|
<p>I am creating pdf files on the fly and I want to download multiple files using php. Can I write header like this</p>
<pre><code><?php
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="downloaded.pdf"');
readfile('original.pdf');
?>
</code></pre>
<p>in while loop?</p>
|
php
|
[2]
|
3,459,033 | 3,459,034 |
duplicate checking of date and time using php
|
<p>I have a php web site, and here I need to create a page to enter exam details of a student. There are 5 Subject in one exam. Each subject has exam date, starting time and end time </p>
<p>I.e. </p>
<pre><code>Date: 02-nov-2012
Start time: 2.30 pm
End time: 4.30 pm
</code></pre>
<p>I have to check the duplication of the exam date time....i.e. any other subjects which don't have the similar date time also if one subject has </p>
<pre><code>Exam Date: 02-nov-2012
Start time: 3.00.pm
End date: 5.00 pm
</code></pre>
<p>Must be avoided. It’s invalid
Another subject has</p>
<pre><code>Exam Date: 02-nov-2012
Start time: 9.00.am
End date: 2.00 pm
</code></pre>
<p>It’s a valid </p>
<p>I think it's clear... I don't know to explain further in details....
I don't know to validate this in php </p>
|
php
|
[2]
|
3,017,086 | 3,017,087 |
Check two drawable images
|
<p>All</p>
<p>I have created frame animation using Animation drawable. I have 25 images in that animation. Now I have to compare Image which is the current frame in animation with the one that is stored in the res/drawable folder.</p>
<p>How to compare this two drawables?? == and .equals methods wont work with the drawables.</p>
<p>Please give me reply as soon as possible.</p>
|
android
|
[4]
|
4,429,095 | 4,429,096 |
How to use Weather API in python
|
<p>I'm a newbie to python and this would be my first web app...I'm planning to develop a web app which will send an email if your local temperature exceeds a pre-defined temp say 85F. Can someone tell me which API to use and how can I call the api using python and send email.</p>
|
python
|
[7]
|
4,805,646 | 4,805,647 |
Why does "self" outside a function's parameters give a "not defined" error?
|
<p>Look at this code:</p>
<pre><code>class MyClass():
# Why does this give me "NameError: name 'self' is not defined":
mySelf = self
# But this does not?
def myFunction(self):
mySelf2 = self
</code></pre>
<p>Basically I want a way for a class to refer to itself without needing to name itself specifically, hence I want self to work for the class, not just methods/functions. How can I achieve this?</p>
<p><strong>EDIT:</strong> The point of this is that I'm trying to refer to the class name from inside the class itself with something like self.<strong>class</strong>._<em>name</em>_ so that the class name isn't hardcoded anywhere in the class's code, and thus it's easier to re-use the code.</p>
<p><strong>EDIT 2:</strong> From what I've learned from the answers below, what I'm trying to do is impossible. I'll have to find a different way. Mission abandoned.</p>
<p><strong>EDIT 3:</strong> Here is specifically what I'm trying to do:</p>
<pre><code>class simpleObject(object):
def __init__(self, request):
self.request = request
@view_defaults(renderer='string')
class Test(simpleObject):
# this line throws an error because of self
myClassName = self.__class__.__name__
@view_config(route_name=myClassName)
def activateTheView(self):
db = self.request.db
foo = 'bar'
return foo
</code></pre>
|
python
|
[7]
|
5,684,136 | 5,684,137 |
Create folder in drawable
|
<p>Is it possible to create our own folder in drawable and put all my images in that folder as:</p>
<p>"drawable\Myimages\p.png.."</p>
<p>If it possible than how can i use this images in my activity..gnerally we use "R.drawablw.p" but now how that can be written because now my images is in drawable\Myimages directory </p>
<p>please suggest me..</p>
<p>with regards
Anshuman</p>
|
android
|
[4]
|
3,451,772 | 3,451,773 |
How to bind List<class> object to gridview
|
<p>below is my code</p>
<pre><code> List<test> Students = new List<test>(){
new test() { name = "Jack", imgpath = "15", Des = "100" },
new test() { name = "Smith", imgpath = "15", Des = "101" },
new test() { name = "Smit", imgpath = "1", Des = "102" }
};
GridView1.DataSource = Students;
GridView1.DataBind();
</code></pre>
<p>and my class is:</p>
<pre><code>public class test
{
public string name;
public string imgpath;
public string Des;
}
</code></pre>
<p>but it gives me error "A field or property with the name 'name' was not found on the selected data source."</p>
<p>So how to solve it. I do not know what is wrong in my code.</p>
<p>Thanks</p>
|
asp.net
|
[9]
|
5,439,919 | 5,439,920 |
What is the best way of including a JS file from JS code?
|
<p>What is the recommended way of including a Javascript file from another Javascript file?</p>
|
javascript
|
[3]
|
890,228 | 890,229 |
How to create an action for a UITabBarItem?
|
<p>I have created a UITabBar and UITabBarItems without UITabBarController on it, now i want to know how to place an action on click of the UITabBarItem.What is the method i should use for action on UITabBarItem?</p>
|
iphone
|
[8]
|
3,992,042 | 3,992,043 |
html 5 video not working on mobile devices
|
<p>I have been having trouble getting this video playing on android, iphone, etc.
It is on an iis 6 server which has had the mime types added.</p>
<pre><code><video id="video" width="100%" height="auto" autoplay="autoplay" loop="loop" style="position:relative; top:-60%">
<source src="images/river.mp4">
<source src="images/river.webm" type="video/webm">
<source src="images/river.ogv" type="video/ogg">
<img src="images/river.jpg">
</video>
</code></pre>
<p>and just inside the ...</p>
<pre><code><script type="text/javascript">
var video = document.getElementById('video');
video.addEventListener('click',function(){
video.play();
},false);
</script>
</code></pre>
<p>I want it to play on page load if possible.</p>
|
javascript
|
[3]
|
2,309,207 | 2,309,208 |
read and write file with newline php
|
<p>I have a php file with the following info</p>
<pre><code>One
Two
Three
</code></pre>
<p>Now i want to split them into an array, so i used:</p>
<pre><code> $filehandle = fopen($filename, 'rb');
$line_of_text = fgets($filehandle);
$array = explode("\n", $line_of_text);
</code></pre>
<p>But it is not working.</p>
<p>They are written in the file like this:</p>
<pre><code> $filehandle = fopen($textfile, 'a');
fputs($filehandle, $line . "\r\n");
fclose($filehandle);
</code></pre>
<p>So how do i read them into an array?. </p>
<p>Thanks.</p>
|
php
|
[2]
|
605,882 | 605,883 |
Problem with getElementsByClassName
|
<p>Following code is causing the problem:</p>
<pre><code>var CheckBoxes = document.getElementsByClassName('DeleteCheckBox')
for (var i = 0; i < CheckBoxes.length; i++) {
CheckBoxes[i].checked = false;
}
</code></pre>
<p>Well, the checkboxes are still selected after this runs. And it runs, because I checked the i variable and it is counting.</p>
<p>What is wrong here? By the way, only checkboxes have the "DeleteCheckBox" class, so only checkboxes get returned by getElementsByClassName.</p>
<p>SOLVED:</p>
<p>I've found the problem. I am using asp.net and the framework seems to assign the class to the "label" (it creates a span tag) of the checkbox, not to the input.</p>
<p>Fixed with InputAttributes.Add("class", "DeleteCheckBox"); (asp.net codebehind)</p>
|
javascript
|
[3]
|
3,597,284 | 3,597,285 |
simple question about define a path
|
<p>im very sorry to ask a very simple question, its seems im not understanding define path properly</p>
<p>as you can see</p>
<pre><code>i put this at D:\Project Storage\wnmp\www\folder\scriptfolder
example D:\Project Storage\wnmp\www\folder
define('SAMPLE1', realpath(dirname(__FILE__).'/..'));
example D:\Project Storage\wnmp\www\somefolder
define('SAMPLE2', realpath(dirname(__FILE__).'/../somefolder/'));
how do we put like D:\Project Storage\wnmp\www\folder\scriptfolder/ ? ( add '/') ?
define('SAMPE3', realpath(dirname(__FILE__).'/')); it seems its not working.
</code></pre>
<p>thanks for looking in</p>
<p>Adam Ramadhan</p>
|
php
|
[2]
|
3,029,837 | 3,029,838 |
how to connect a python code to database using mysql
|
<p>I am using below code for connectivity:</p>
<pre><code> import MySQLdb
db = MySQLdb.connect("localhost","root","root","test" )
cursor = db.cursor()
cursor.execute("SELECT * from student")
data = cursor.fetchone()
print "Database result : %s " % data
db.close()
</code></pre>
<p>i am getting below error during running the file:</p>
<pre><code>Traceback (most recent call last):
File "C:/Python27/xsxs.py", line 5, in <module>
db = MySQLdb.connect("localhost","root","root","test" )
File "C:\Python27\lib\site-packages\MySQLdb\__init__.py", line 81, in Connect
return Connection(*args, **kwargs)
File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 187, in __init__
super(Connection, self).__init__(*args, **kwargs2)
OperationalError: (2003, "Can't connect to MySQL server on 'localhost' (10061)")
</code></pre>
<p>How can i solve it.</p>
|
python
|
[7]
|
409,404 | 409,405 |
JQuery Div Closing on click
|
<p>I am using JQuery to insert html in a div using <code>$('#myDiv').show();</code> on a click of a checkbox.
But whenever I click somewhere in the Div that is not an object (Dropdownlist or a Textbox etc.) . The Div seems to be closing. Is there a property in Jquery to prevent this?.</p>
<pre><code> $(".mycheckboxDiv input[@type=checkbox]").click(
function () {
// Insert code here
if ($(this).attr('checked')) {
var y = $(this).attr('value');
var divname = "reactiondiv" + y;
$('#' + divname).show("1000");
getData('ajaxService.asmx/GetControlHtml1', 'MyService/x/UserControls/SeverityandReactionWidget.ascx', divname, y, hiddendivname);
}
});
</code></pre>
<p>getData is a function that puts the HTML. Which has the <code>$('#divName').html(eval(msg))</code> (I am using <code>$.ajax();</code>)</p>
|
jquery
|
[5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.