Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
2,131,714
2,131,715
How to get the value of a javascript object?
<p>I have an object and inside that object are further objects. I want to get the value of those objects. Thanks!</p> <pre><code> foreach($query as $row){ $vehicles[$row-&gt;deviceID] = Array( 'description' =&gt; $row-&gt;description, 'deviceID' =&gt; $row-&gt;deviceID ); } </code></pre> <p>and then I pass it to the view and stored it to a global javascript variable.</p> <pre><code> var vehicleList = &lt;?php echo $vehicleList; ?&gt;; </code></pre> <p>here is the output of my console.log if I type vehicleList in my console log in chrome:</p> <pre><code>vehicleList &gt;Object &gt;11292: Object description: "Bus 1" &gt;11293: Object description: "Bus 2" &gt;11294: Object description: "Bus 1" </code></pre> <p>The value I want to get is the description. Is it also possible to store another value to the object 11292? If yes, how?</p> <p>Thanks!</p>
php javascript
[2, 3]
1,400,943
1,400,944
How can I make a function act like a callback
<p>How can I make <code>shwOpts.show("fast");</code> to act when <code>removeHighlight()</code> is done?</p> <p>I thought if I put an anonymous function as an argument in the other it will act as a callback. This didn't work.</p> <pre><code>removeHighlight : function(f) { // remove previous highlight. var highlight = $('#openid_highlight'); if (highlight) { highlight.replaceWith($('#openid_highlight a')[0]); } }, moreOptsLink = $("#more-options-link").click(function () { moreOptsLink.detach(); openid.removeHighlight(function(){$("#show-more-options").show("fast");}); //shwOpts.show("fast"); openid.setPref("showMoreOpenIdOptions", !0) }); </code></pre>
javascript jquery
[3, 5]
4,157,433
4,157,434
php or javascript for client performance?
<p>What's quicker?</p> <p>I'm using php simply to return json (restapi call) to a client and then using javascript to render the data.</p> <p>Or</p> <p>Would it be quicker to render the data using php instead and replace client-side javascript for this?</p> <p>I'm looking for the best performance for the client browser. By using using php to send data, I'm thinking it would be quick to handle multiple requests for data.</p> <p>Are there any good stress testing tools you would recommend to simulate this?</p> <p>Thanks</p>
php javascript
[2, 3]
5,666,487
5,666,488
Passing custom functional object in js via addJavascriptInterface
<p>Is it possible s.t arbitrary functional objects in js are passed to Java side, java can call that js object?</p> <p>for example, (access is function that already registered)</p> <pre><code>access(function(blabla){ ... }); </code></pre> <p>Are there any great techniques that can deal with callback function in java?</p>
javascript android
[3, 4]
3,141,478
3,141,479
Handling code which relies on jQuery before jQuery is loaded
<p>I'd like to follow the general guideline of putting all JavaScript at the very bottom of the page, to speed up loading time and also to take care of some pesky issues with conflicting jQuery versions in a web app (Django).</p> <p>However, every so often I have some code, code which depends on jQuery, but which must be further up on the page (basically the code can't be moved to the bottom).</p> <p>I'm wondering if there's an easy way to code this so that even though jQuery is not yet defined the code works when jQuery is defined.</p> <p>The following seems, I have to say, like overkill but I don't know of another way to do it:</p> <pre><code>function run_my_code($) { // jquery-dependent code here $("#foo").data('bar', true); } var t = null; function jquery_ready() { if (window.jQuery &amp;&amp; window.jQuery.ui) { run_my_code(window.jQuery); } else { t = window.setTimeout(jquery_ready, 100); } } t = window.setTimeout(jquery_ready, 100); </code></pre> <p>Actually, I might need to use code more than once in a page, code that doesn't know about other code, so even this probably won't work unless I rename each jquery_ready to something like jquery_ready_<em>guid</em>, jquery_ready_<em>otherguid</em> and so on.</p> <h1>Clarification</h1> <p>Just so this is clear, I am putting the include to JavaScript (<code>&lt;script type="text/javascript" src="jquery.min.js" /&gt;</code>) at the <strong>very bottom</strong> of the page, just before the <code>&lt;/body&gt;</code>. So I can't use the <code>$</code>.</p>
javascript jquery
[3, 5]
2,254,782
2,254,783
jQuery "load()" Can't Load PHP "curl_exec()" Result
<p>I want an HTML file to load the result of "curl_exec()" method of a PHP file.</p> <p>The PHP file is located in localhost, and the HTML file can be anywhere.</p> <p>Eg the PHP file name is "curl.php".</p> <p>I used jQuery "load()" to load the result, but it doesn't work, even after I upload the files to a web server.</p> <p>The HTML file code:</p> <p><a href="http://jsfiddle.net/aTkEZ/" rel="nofollow">http://jsfiddle.net/aTkEZ/</a></p> <p>The "curl.php" code:</p> <p><a href="http://jsfiddle.net/Quk8N/" rel="nofollow">http://jsfiddle.net/Quk8N/</a></p> <p>What is wrong with my code?</p>
php javascript jquery
[2, 3, 5]
3,510,179
3,510,180
convert c# datatype to equivalent java datatype
<p>I have few datatypes used in C# that I need to translate to Java.</p> <p><code>uint</code>, <code>Int16</code>, <code>UInt16</code>, <code>Nullable&lt;Int16&gt;</code></p> <p>What will be the appropriate datatype for these in Java?</p>
c# java
[0, 1]
4,504,591
4,504,592
js remove certain words that don't match
<p>I have a js string...</p> <pre><code>var string = "Hi how are you &lt;b&gt;today&lt;/b&gt;"; </code></pre> <p>I now have a new js string... </p> <pre><code>var newstring = "are today"; </code></pre> <p>I want to remove all the words from <code>var string</code> that don't match <code>var newstring</code>. I would also like to keep the tags that are associated with those words, if any.</p> <pre><code>Example Result: are &lt;b&gt;today&lt;/b&gt; </code></pre>
javascript jquery
[3, 5]
3,823,863
3,823,864
Upon jQuery onClick, incrementing a PHP variable?
<p>I have a link like this: <code>&lt;a href="javascript:window.print();"&gt;Print&lt;/a&gt;</code>. I'm trying to increment a PHP variable when that is clicked. I could technically do it by submitting a form, but I'm sure there is an easier way. Any ideas?</p>
php javascript jquery
[2, 3, 5]
2,172,193
2,172,194
Dynamically add "items" (ASCXs) to a repeater on a page
<p>I am looking to build an ASPX page where I have a this repeater to pull out these 5 questions items. Each item has a user control (with radio buttons) which need to be displayed. Now what I want to achieve is:</p> <ol> <li>At first just the first user control is displayed. The user selects a certain radio-button from this user-control. </li> <li>Only and only when a user selects a radio button, we have to decide whether the 2nd item is to be displayed or not - based on the user selection. </li> <li>This should continue for the list of 5 items.</li> </ol> <p>Is there a way to make the repeater wait for the remaining items to load until the user interacts with the user control of the current item? If so, how?</p> <p>Any pointers would be highly appreciated. I don't want any code for now but just a path/direction/pointer to follow. </p> <p>Thanks!</p>
c# asp.net
[0, 9]
5,612,486
5,612,487
Show javascript alert and do other actions?
<p>Here's my code and nothing is happening:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-git.js"&gt;&lt;/script&gt; &lt;script&gt; $(".clickMe").click(function() { alert('hi!'); // Do other stuff }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="clickMe"&gt;Click Me!&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>However, nothing happens when you click the "clickMe" div.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,140,206
3,140,207
How to do Year / Month Calculations in Javascript?
<p>We have a Year/Month HTML control. The underlying value is kept as a decimal. For Example: 15 year and 2 months is equal to "15.02".</p> <p>We want to do calculations based on 2 year/month controls (add/substract).</p> <p>Just doing basic math calculations doesn't work:</p> <pre><code> Value1 : 65.00 Value2 : 47.09 65.00 - 14.09 = 17.91 (is wrong, but should be 17.03 or (64.12 - 47.09)) </code></pre> <p>Are there any Javscript/Jquery functions for that or a library that I can use to do Year / Month calculations ?</p>
javascript jquery
[3, 5]
2,277,697
2,277,698
Change current element background in jQuery
<pre><code>&lt;label class="default" for="checkbox1"&gt;&lt;input id="checkbox1" name="checkbox1" type="checkbox" style="display:none" /&gt; some text&lt;/label&gt;&lt;br /&gt; &lt;label class="default" for="checkbox2"&gt;&lt;input id="checkbox2" name="checkbox2" type="checkbox" style="display:none" /&gt; some text&lt;/label&gt;&lt;br /&gt; &lt;label class="default" for="checkbox3"&gt;&lt;input id="checkbox3" name="checkbox3" type="checkbox" style="display:none" /&gt; some text&lt;/label&gt;&lt;br /&gt; </code></pre> <p>How should I change the currently clicked checkbox's label background color using jQuery? For example when the second checkbox is checked it's style should be changed with "checked":</p> <pre><code>&lt;label class="checked" for="checkbox2"&gt;&lt;input id="checkbox2" name="checkbox2" type="checkbox" style="display:none" /&gt; some text&lt;/label&gt;&lt;br /&gt; </code></pre>
javascript jquery
[3, 5]
719,032
719,033
Problems upgrading jquery 1.4.2 to 1.5.1
<p>I'm trying to upgrade from jquery 1.4.2 to 1.5.1 and I'm getting the following error:</p> <p>Uncaught Syntax error, unrecognized expression: [rel*=address:] </p> <p>I can't figure out what it's related to. Any ideas?</p>
javascript jquery
[3, 5]
5,285,859
5,285,860
jQuery pop-up menu on Internet Explorer
<p>Here - <a href="http://desandr.ci-team.ru" rel="nofollow">http://desandr.ci-team.ru</a> (mouse click on "КАТАЛОГ")</p> <p>On FF and Chromium works fine - on "mouse in" under element shows menu. On internet explorer 8 - nothing. </p> <p>What's this, and how i can fix that?</p>
javascript jquery
[3, 5]
720,836
720,837
gyroscope iphone
<p>Im rotating a cube with the below function and need to know how to stop listening to it because i want to apply touch movements also and right now the gyroscope overrides the touch and makes a weird behaviour. </p> <p>I thought putting an if and a variable isTouched and setting it to true when is touched should work but does not, any idea how to obtain that behaviour? </p> <pre><code>function sas_rotationUpdate(x, y, z) { angleX += (90 * parseInt((50 * x) / 90))*2; angleY += (90 * parseInt((50 * y) / 90))*2; angleZ += (90 * parseInt((50 * z) / 90))*2; document.getElementById('cube').style.webkitTransform = "rotateX(" + angleX + "deg) rotateY(" + angleY + "deg) rotateZ(" + angleZ + "deg)"; if(isTouched === true){return;} } window.addEventListener('touchstart', function (event) { isTouched = true; } </code></pre> <p>EDIT<br> Tried also backwards as </p> <pre><code>if (isTouched === false){ function sas_rotationUpdate(x, y, z) { angleX += (90 * parseInt((50 * x) / 90))*2; angleY += (90 * parseInt((50 * y) / 90))*2; angleZ += (90 * parseInt((50 * z) / 90))*2; document.getElementById('cube').style.webkitTransform = "rotateX(" + angleX + "deg) rotateY(" + angleY + "deg) rotateZ(" + angleZ + "deg)"; } } </code></pre> <p>But doesnt work either. I Im using this <a href="http://help.smartadserver.com/iOS/V3.1.2/html/docs/companion/htmlcreatives.html#orientation" rel="nofollow">documentation</a>, anyone with experience in it?</p> <p>2nd EDIT, putting the if at the top of the function and applying it only for the css change works for me now, hope Is helpfull and i dont get banned again due to the most than probable tumbleweed awarding this question.</p>
javascript iphone
[3, 8]
1,388,956
1,388,957
Generate Dynamic Pages With ASP.Net
<p>I am currently programming classic asp and have my own CMS and it's a good one but I'd like to move it to c#.net meanwhile. (customers don't like this old language anymore) on my current CMS I generate Pages physically with ASP FSO(filesystem object). so my question is should i use this method at asp.net too? I reviewed some .NET cms and realized that they don't build pages physically.</p> <p>For example after working with a CMS noticed that When I type <a href="http://localhost/PageName.aspx" rel="nofollow">http://localhost/PageName.aspx</a> in address bar actually it's still in default.aspx but it regenerated page with contents that belong to PageName.aspx's PageID at database.</p>
c# asp.net
[0, 9]
2,540,742
2,540,743
set value of input that do not allow it to be changed
<p>I have the following text box input code. I do not have access to it to add the default value to it so i used this Jquery code to add the value and then disable the input but it doesn't send the added value. How would I add the value but not allow them to change it. I was going to use "hidden" but I want them to see it just not able to change it. </p> <pre><code>$("input[type='text'][name='ShipCity']").val('Madison').attr('disabled', 'disabled'); &lt;input type="text" style="background-color: rgb(255, 255, 0);" value="" name="ShipCity" maxlength="45" size="25"&gt; </code></pre>
javascript jquery
[3, 5]
182,691
182,692
Error in callback rate with CountDownTimer?
<p>I have been building a small darkroom timer application, as I learn Android and java.<br> Ended up using CountDownTimer, as it does most of the work for me. :{)<br> However, I ran into what looks like an error in the class. </p> <p>My initial structure used the onTick() callback to decrement my time counter, and update the time-remaining display. If I set it up for example:</p> <pre><code> new CountDownTimer(60000, 100) { public void onTick(long millisUntilFinished) { mDisplayTime.setText(String.valueOf(millisUntilFinished)/1000); timeTenths -= 1; updateDisplay(); } public void onFinish() { // mDisplayTime.setText("Done!"); } }.start(); </code></pre> <p>The total timeout (60 seconds) is spot on, within half a second by my stopwatch.<br> However, the displayed count stops with 3.0 seconds on the clock.<br> Experimenting with it, I found a consistent 5% "shortage" in onTick() events.<br> I could change the second parameter to 950 milliseconds, but that's an ugly kludge...</p> <p>In the end, I changed the onTick() to display actual millisUntilFinished, which is fine, and eliminates my counter as well.</p> <p>Is this a known problem with CountDownTimer()?</p> <p>Dave</p>
java android
[1, 4]
1,302,054
1,302,055
Change div content on load
<p>I am trying to wrote a script that, when the page is loaded, change the content inside 2 divs. At the moment the script should only put the variable inside the div but my next step will be to write the same script using arrays. At the moment the script is not working and I can''t figure out why...have I to use AJAX instead of .html()? The page:</p> <pre><code>&lt;div class="think_infobox"&gt; &lt;h4 class="infbox" id="infbox_title"&gt; original title &lt;/h4&gt; &lt;p class="infbox" id="infbox_body"&gt; original body &lt;/p&gt; </code></pre> <h2> </h2> <p>The script</p> <pre><code>$(document).ready(function(){ var title = 'my new title'; var body = 'my new body'; $(#infbox_title).html(title); $(#infbox_body).html(body); }); </code></pre> <p>The same code on jsFiddle <a href="http://jsfiddle.net/G8F9a/" rel="nofollow">http://jsfiddle.net/G8F9a/</a></p>
javascript jquery
[3, 5]
2,497,860
2,497,861
Delete text and other elements before and after the element
<p>I need to delete everything (text and other elements) before and after the element <code>&lt;a&gt;</code> with value class <code>chatlink</code>. All this, within each element <code>&lt;div&gt;</code> with value class <code>main</code>.</p> <p><strong>But only if <code>&lt;div&gt;</code> element with the value <code>main</code> contains a link with the value of <code>chatlink</code>.</strong></p> <p>For example:</p> <pre><code>&lt;div class="main"&gt; Bla bla bla :) &lt;a href="#" class="chatlink"&gt;&lt;img src="#" /&gt;&lt;/a&gt; bla bla bla ... &lt;a href="#" class="chatlink"&gt;&lt;img src="#" /&gt;&lt;/a&gt; tra la la la laaa &lt;a href="#" class="postlink"&gt;some text&lt;/a&gt; tralalaaa &lt;/div&gt; </code></pre> <p>Final code:</p> <pre><code>&lt;div class="main"&gt; &lt;a href="#" class="chatlink"&gt;&lt;img src="#" /&gt;&lt;/a&gt; &lt;a href="#" class="chatlink"&gt;&lt;img src="#" /&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Is it possible?</p>
javascript jquery
[3, 5]
4,487,129
4,487,130
How can i kill a background task instantly?
<p>I'm starting an <code>Activity</code> with an <code>Intent</code>. This <code>Intent</code> contains a <code>Serializable</code> Object which is then sent to a server in the <code>onCreate</code> method in order to get the response to display.</p> <p>I'd like to be able to do the following: When i close the <code>Activity</code> the task doing the web request should be destroyed, in case it hasn't finished yet.</p> <p>I'm using a synchronous Web Request Library (Spring). So <code>AsyncTask</code>'s cancel wouldn't help since i cannot afford to loop. Is there a way to destroy an AsyncTask instantaneously?</p>
java android
[1, 4]
5,982,838
5,982,839
Concatenate DateTime string with Arabic String
<p>I'm trying to concatenate an Arabic string with a leading DateTime, I have tried in various way but the DateTime always ends up at the end of the string</p> <pre><code>var arabicText = "Jim قام بإعادة تعيين هذه المهمة إلى John"; var dateTime = DateTime.Now; System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("ar-AE"); string test1 = arabicText + " :" + dateTime.ToString(); string test2 = arabicText + " :" + dateTime.ToString(ci); </code></pre> <p>So when this is displayed it should show </p> <blockquote> <p>Jim قام بإعادة تعيين هذه المهمة إلى John :02/10/2012</p> </blockquote> <p>but I always seem to end up with </p> <blockquote> <p>02/10/2012: Jim قام بإعادة تعيين هذه المهمة إلى John </p> </blockquote> <p>Any ideas would be apprecicated</p>
c# asp.net
[0, 9]
4,089,153
4,089,154
how to access enums in jquery
<p>I am using ajax to post a request to a php script and a enum is returned from the script i.e.</p> <pre><code>success: function(data){ console.log(data) } </code></pre> <p>on the console I see:</p> <pre><code>enum('Engineering','Finance','Economics','Project Management') </code></pre> <p>Now how can I iterate over the value of the enums?</p>
php jquery
[2, 5]
3,047,772
3,047,773
Dialog by single method call
<p>I'm new to Java/Android developing, and I have the habit of creating a tool library when learning a new platform, where I put functions for very common tasks. In this case, an OK/Cancel-Dialog.</p> <p>What I want to achieve is something like this:</p> <pre><code>if (tools.ask("Are you sure")) { //do something } else { //don't do it } </code></pre> <p>tools.ask() should create and display an OK/Cancel-Dialog, if user clicks OK returns true, otherwise (cancel clicked, backbutton clicked, application terminated, whatever) returns false.</p> <p>I looked into AlertDialog, and I know how to implement this with X lines of code. But since this is event driven I have no idea about how to put this in a method with a return value.</p> <p>Is it even possible?</p> <p>Thanks in advance!</p>
java android
[1, 4]
5,325,396
5,325,397
How to change PreferenceActivity theme?
<p>I'm trying to change the theme for the PreferenceActivity in my app and I just can't get it to be working.</p> <p>So, this is the xml:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;SwitchPreference android:title="Auto Clear" android:key="autoclear" android:summary="Clear the command line when the code is being executed." android:defaultValue="false"/&gt; &lt;ListPreference android:title="Choose a theme" android:negativeButtonText="" android:dialogTitle="" android:key="theme" android:entries="@array/themesList" android:entryValues="@array/themesList" android:defaultValue="Default" /&gt; &lt;/PreferenceScreen&gt; </code></pre> <p>And this is the PreferenceActivity:</p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); this.setTheme(R.style.AppTheme); addPreferencesFromResource(R.xml.preferences); } </code></pre> <p>And the result is:</p> <p><img src="http://i.stack.imgur.com/NpdMo.png" alt="Result"></p>
java android
[1, 4]
2,995,272
2,995,273
How to make an application fixes oriented in android?
<p>I want to make my android application fixed oriented, where no one can change the app's orientation by any kind of force. So far I used these in my manifest's activity tag:</p> <pre><code>android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden" </code></pre> <p>it's working fine in my emulator, but in real device when I press the orientation change button it's orientation is changing and getting a force close. What should I do next? </p>
java android
[1, 4]
778,590
778,591
Javascript variable not defining in function
<p>I'm writing a small script to clear my search forms when they're clicked on for "only" the first time. So far I have the follow:</p> <pre><code>$(function() { if(typeof firstClick == 'undefined') { $("#search").live("focus", function() { $(this).val(""); var firstClick = true; }); } }); </code></pre> <p>However, even with defining the variable with var firstClick = true; in the function, the script seems to pass the if statement every time. I'm sure I'm missing something silly, but I can't seem to figure it out.</p> <p>I've tried defining the var firstClick outside of the function as a false boolean, and then checking to see if it's false or not but I still can't seem to get the variable to go true in the function.</p>
javascript jquery
[3, 5]
460,060
460,061
Basic action on click
<p>For some reason, I can't get jQuery to do what I want it to do.</p> <p>What I need is for the container div to disappear when one of its children is clicked.</p> <p>Here's example HTML</p> <pre><code>&lt;div id="container"&gt; &lt;a href="link"&gt; &lt;div id="child1"&gt; When this is clicked, #container disappears, including everything contained inside... &lt;/div&gt; &lt;/a&gt; &lt;a href="link"&gt; &lt;div id="child2"&gt; ...or when this one is clicked &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>Here's what I've tried.</p> <pre><code>$("#child1").click(function () { $(#container).hide(); }); </code></pre> <p>and</p> <pre><code>$("#child1").click(function () { $(#container).fadeOut("fast"); }); </code></pre> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
3,298,976
3,298,977
jQuery.trim does not work when i try to filter a table
<p>I have a textbox to put text in order to filter an html table. I want to trim the textbox contents before filter the table:</p> <p><strong>Demo</strong>: <a href="http://jsfiddle.net/QFQ5k/94/" rel="nofollow">http://jsfiddle.net/QFQ5k/94/</a></p> <p>The line that makes the filtering is:</p> <pre><code>return $(this).find("[zip^='"+ $.trim($("#txtbox").val())+"']").length&gt;0; </code></pre> <p>EDIT: It works succesfully, i tested it wrongly, but I <strong>want that alone blank space shows all table rows.</strong></p>
javascript jquery
[3, 5]
5,320,304
5,320,305
How to save the selected value of checkboxlist in array?
<p>I want to save the values of checkbox in an array using javascript or jquery. My checkboxlist is inside the datalist. Whenever the user select an item, I want to add the value of that selected item to a array.</p> <pre><code>ASPX : &lt;asp:DataList ID="dl_Groups_1" RepeatColumns="1" runat="server" OnItemDataBound="dl_Groups_1_ItemDataBound" RepeatDirection="vertical" ShowFooter="False" ShowHeader="False"&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox Font-Bold="true" runat="server" ID="chk_Group_1" Text='&lt;%# Eval("category_type") %&gt;' Value='&lt;%# Eval("service_type_category_id") %&gt;' onclick="OnGroupClick" /&gt; &lt;asp:CheckBoxList CssClass="line" runat="server" ID="chkServiceType_1" DataValueField="ServiceTypeID" DataTextField="Name" EnableViewState="true"&gt; &lt;/asp:CheckBoxList&gt; &lt;br /&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre> <p>I tried the below to, get the items that are slected, but i am struck up here...</p> <pre><code>function test() { $(":checkbox").each(function () { if (this.checked) { alert(this); } }); } </code></pre> <p>When i do this, i get alert message as "ON" and not the value. And where do i call the javascript to keep the array updated on selecting and un selecting the items in checkboxlist ? </p>
javascript jquery asp.net
[3, 5, 9]
2,085,569
2,085,570
Repeater - Save data in viewstate with the Dropdownlist selection change action?
<p>I need some help in the technical approach with the following scenario:-</p> <p>1) A dropdownlist with some options. It has a postback action on the selectedIndexChange server side event handler. For example, lets say it contains language options such as english, french etc.</p> <p>2) Repeater with a label and the textbox control. For example label is Emp Name and textbox is containing the Emp Designation. We have to save emp designation in the various languages. </p> <p>3) Every time i pick something from the dropdown, i have to flip the textbox control and fill the form. Now i want to save the given data of the texbox in the viewstate. So that every time, the user changes the dropdown selection, he can see the repeater data corresponding to the dropdown selection. </p> <p>4) I guess some kind of relationship between the dropdown option and the repeater data is needed. But how can we make this thing work.</p> <p>Now which is the best technique to save the data on the server side? I have to keep it in the viewstate. </p> <p>I hope my question makes sense and clear the problem scenario. Pls help me out.</p>
c# asp.net
[0, 9]
4,537,470
4,537,471
Array from database not working with json_encode
<p>If I change the array <code>$foo</code> to <code>$foo = array("one","two","three","four","five");</code> Then javascript will show me drop down lists when as i type the value, but when I am getting array $foo from database, the form is silent. </p> <p>PHP:</p> <pre><code>&lt;?php mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db("xxxx") or die(mysql_error()); $array = mysql_query("SELECT * FROM clients"); while($row = mysql_fetch_array($array)) { $foo = $row['company'] ; } ?&gt; </code></pre> <p>JS:</p> <pre><code>&lt;script&gt; $(function() { var availableTags = &lt;?php echo json_encode( $foo ); ?&gt;; $( "#tags" ).autocomplete({ source: availableTags }); }); &lt;/script&gt; </code></pre> <p>HTML:</p> <pre><code>&lt;label for="tags"&gt;Tags:&lt;/label&gt; &lt;input id="tags" name="field"/&gt; </code></pre>
php javascript
[2, 3]
5,966,430
5,966,431
jQuery / JS - Detecting / Matching an URL string to determine it's type
<p>I have two URLs types, (TYPE A)</p> <pre><code>/items </code></pre> <p>Or /items/XXXX with a trailing number (TYPE B)</p> <pre><code>/items/187 /items/12831 </code></pre> <p>I would like to know how to detect if the URL is type A or Type B</p> <pre><code>if (TYPE A) ... else if (TYPE B) .... </code></pre> <p>Any suggestions for making this happen? Do I need a regex?</p> <p>thanks</p>
javascript jquery
[3, 5]
3,908,173
3,908,174
Jquery bind & ready event?
<p>In my jquery code, I am trying to <strong>//Do things</strong> every time the page is reloaded/refreshed and when the select box is clicked. But when I add the ready function (as in document is ready,) yet what is supposed to go inside <strong>//Do things</strong>, only gets executed with a click event, but not ready.</p> <p>How can I fix this?</p> <pre><code>jQuery(document).ready(function(){ jQuery("select").bind("change ready", function(){ //Do things }); </code></pre>
javascript jquery
[3, 5]
3,580,434
3,580,435
Passing data from mobile app (iPhone, Android) to ASP.NET web application
<p>can we pass data from mobile phone application (iPhone app / Android app) to ASP.NET website application? Does it need to be on a secure channel like SSL? ASP.NET website, I was thinking of having a WCF service to get data from the mobile phone application, but what would be the better data format? REST? Json? Plain text?</p>
android iphone asp.net
[4, 8, 9]
802,226
802,227
Jquery cloud zoom issue in chrome
<p>I have a cloud zoom section in mycode and two section for thumbnails. in one section the thumbnail image is clicked it will load the main image area and cloud zoom will work in main image area(its fine ). other thumbnails , on mouse over the main image needs to change and cloud zoom needs to work but in Chrome its only working in click events same as first,But in firefox and IE its working fine.(Logic Used same click section for second thumbnails but on mouseover iam firing the click events using jQuery().trigger('click') function) any help ?</p> <p>Thanks in advance..</p>
javascript jquery
[3, 5]
1,616,779
1,616,780
Random interval upwards counter
<p>I'm currently using a jQuery plugin for counting upwards. However, I want this to be a bit more random, simulating number of downloads. For now, the counter counts upwards every 1 seconds, but I want it to be more random every time it ticks. (range from 1sec to 4sec)</p> <p>I'm currently using: <a href="http://code.google.com/p/jquery-countdown/" rel="nofollow">countdown</a> together with <a href="http://blog.sophilabs.com/2012/08/jquery-counter-plugin/" rel="nofollow">counter</a>.</p> <p>Any suggestions on how I can do this? My code looks like:</p> <pre><code>&lt;script&gt; $('#custom').addClass('counter-analog').counter({ initial: '5.351.487.124', direction: 'up', interval: '2000', format: '9.999.999.999', stop: '9999999999', }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,786,132
2,786,133
jQuery: How to disable hover on parent element when hovering over child element?
<p>So I have some HTML like this:</p> <pre><code>&lt;a class="tooltip" title="my tool tip"&gt; Hover over me for a tool tip! &lt;/a&gt; </code></pre> <p>the javascript changes the html into something like this:</p> <pre><code>&lt;a class="tooltip"&gt; Hover over me for a tool tip! &lt;span style="position:absolute; display:none;"&gt;my tool tip&lt;/span&gt; &lt;/a&gt; </code></pre> <p>When hovering over the parent element, the javascript triggers the child element to display. The child element is positioned so that it looks like it is not inside the parent element, so hovering over the child element still causes the child element to be displayed. I want to only show the child element when you are not hovering over it.</p> <p>How can I do this?</p>
javascript jquery
[3, 5]
1,474,836
1,474,837
Passing Variable from page to page using ASP.NET (C#) without using QueryString
<p>Looking for advice on passing variables from page to page without using QueryString. The web crawlers such as google get caught up on the querystrings found in a URL. I'm trying to get away from using it. Is there another suggested method for passing the variables? I've thought about using session variables, but this is just for simply passing the variable from page to page and they won't always be the same. Any ideas?</p> <p>On another note, I can't do it using forms. I'm using a master page with a form embedded in the master page and also the content pages. Unless microsoft updated it so you can multiple forms on one page.</p>
c# asp.net
[0, 9]
5,769,187
5,769,188
jQuery "array" is returned undefined
<p>Namaste!</p> <p>My simple issue is that $sortedData becomes undefined in the following code upon execution:</p> <pre><code>(function($) { $.fn.shuffle = function (){ var i = this.length, j, temp; if ( i == 0 ) { return; } while ( --i ) { j = Math.floor( Math.random() * ( i + 1 ) ); temp = this[i]; this[i] = this[j]; this[j] = temp; } }; })(jQuery); // DOMContentLoaded $(function() { // get the first collection var $cards = $('#cards'); // clone cards to get a second collection var $data = $cards.clone(); // call Quicksand when button clicked $('#shuffle').click(function(e) { // get all the list items var $filteredData = $data.find('li'); // random sort (shuffling) var $sortedData = $filteredData.shuffle(); // finally, call quicksand $cards.quicksand($sortedData, { duration: 600, easing: 'easeInOutQuad' }); }); }); </code></pre> <p>How this is called: I have a button that, when clicked, executes the above code.</p> <p>I've checked the values in the shuffle function, and prior to the call to the shuffle function, but, when the shuffle function returns, $sortedData is undefined.</p> <p>The error is probably a noobish one, but, I can't see it.</p> <p>Thank you for your input!</p>
javascript jquery
[3, 5]
4,165,364
4,165,365
How I can execute a javascript function by placing it inside head tag with runat="server" attribute in page having Master pagewith head tag
<p>How I can execute a javascript function by placing it inside head tag with runat="server" attribute. My page is using Master Page that already contains head tag with runat="server" attribute. As obvious I can use just head in my page but not with runat="server" attribute. Is it possible to execute the javascript functon with same effect without using head tag or to put my javascript function in master page and using it from there itself.</p> <p>Any help.</p> <p>Hi @Frater, actually I have a page having design </p> <pre><code>&lt;asp:Content ID="Content1" ContentPlaceHolderID="Head1" Runat="Server"&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="cphBody" Runat="Server"&gt; &lt;head&gt; &lt;script language="javascript" type="text/javascript"&gt; function func1() { document.getElementById("IMG_USER").src = "abc.jpg" } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input id="File1" tabindex="23" type="file" onchange="func1();" runat="server" style="width: 100px; height:23px" /&gt; &lt;img id="Img1" name="IMG_USER" runat="server" src="xyz.jpg" style="height:130px;width:150px" alt="" /&gt; &lt;/body&gt; </code></pre> <hr> <p>on uploading a image using input element I want the image to be changed to abc.jpg</p>
c# javascript asp.net
[0, 3, 9]
4,514,909
4,514,910
Unable to update the header summaries for PreferenceActivity on smartphones running 4.x
<p>From what I've noticed, on smartphones running 4.x when you have a PreferenceActivity with headers, the OS will first create an activity containing the headers. When the user clicks on one item from the headers list, another activity will be created representing the PreferenceFragment for that entry. On tablets, the headers list and this fragment belongs to the same activity and appear simultaneously on the screen.</p> <p>So, the problem is this. When the user is in the PreferenceFragment, and he changes some setting there, I want to update the corresponding header summary. I have a reference to the headers object from onBuildHeaders() call:</p> <pre><code>@Override public void onBuildHeaders(List&lt;Header&gt; aTarget) { ... headers = aTarget; } </code></pre> <p>Now in order to update the header I loop through this list and check the id:</p> <pre><code>private void setHeaderSummary(int id, String summary) { for (Header header : headers) { if (header.id == id) { header.summary = summary; invalidateHeaders(); return; } } } </code></pre> <p>This works perfect on tablets, however on smartphones it has no effect. When the user returns from the PreferenceFragment to the first PreferenceActivity (by hitting the Back button), the headers remain unchanged.</p>
java android
[1, 4]
3,077,403
3,077,404
Get Video Name and Id From url
<p>I have a video url (not youtube url), but my url redirect to the entire page which contains the video. my need is getting that video name and id from that url </p> <p>Thanks in advance</p>
php javascript jquery
[2, 3, 5]
3,305,070
3,305,071
Lost mouseover when mouse is over inner element
<p>I have example like below. How to avoid "lost of mouseover" on <code>&lt;div&gt;</code> when mouse is over inner <code>&lt;span&gt;</code> ?</p> <pre><code>&lt;div id="box"&gt; ABC &lt;span style="font-size: 10px; font-weight: normal;"&gt;abc&lt;/span&gt; &lt;/div&gt; </code></pre> <p>Live demo <a href="http://jsfiddle.net/PjhmC/" rel="nofollow">here</a>.</p>
javascript jquery
[3, 5]
3,787,341
3,787,342
Javascript replace expression
<p>I'm having trouble replacing some url variables in javascript. I'm trying to replace the value of <code>&amp;s=</code> and <code>&amp;so=</code>. Below is my code:</p> <pre><code>url = url.replace(/(s=).*?(&amp;)/, '$1' + $("#sort_by").val() + '$2'); url = url.replace(/(so=).*?(&amp;)/, '$1' + $("#sort_ord").val() + '$2'); </code></pre> <p>The first replace works no problem, the <code>s</code> value is always replaced, but the <code>so</code> variable never seems to get replaced.</p>
javascript jquery
[3, 5]
2,206,653
2,206,654
Problem in form auto submit
<p>How do i submit my form when the timer goes and also if refresh is clicked.?? The problem i faced is whenever refreshed it is asking for user confirmation, if clicked cancel, it remains on same page.</p>
php javascript
[2, 3]
699,090
699,091
Any tutorials or books that teach C# the way I learned java (commandline, without intelliSense or VS)?
<p>I'm a good java programmer and want to learn C# (seems fun, delegates, linq, lambda expressions, access to native dlls and unmanged code etc).</p> <p>Every tutorial, book seems to teach C# with Visual Studio. But at the learning state I want to write everything manually without intelliSense or project/solution etc and compile it at command prompt, the way anyone learns java.</p> <p>Is there a good resource or book that teaches C# and .net this way?</p>
c# java
[0, 1]
4,933,240
4,933,241
str_replace() works on WampServer but not on live server?
<p>I have a function which builds a multi-line string that needs to be echo'd out as a JavaScript variable, so after the string is built I run it through <code>str_replace()</code> before returning it like this:</p> <pre><code>return str_replace("\r\n", "\\\r\n", $output); </code></pre> <p>Here's the weird thing: this works fine on my development machine running WampServer, but it doesn't add the slashes at the ends of the lines on my live server (VPS running Apache and the latest version of PHP).</p> <p>Example:</p> <pre><code>return (str_replace("\r\n", "\\\r\n", 'this is a test')); </code></pre> <p>Dev. machine:</p> <pre><code>this\ is\ a\ test </code></pre> <p>Live server:</p> <pre><code>this is a test </code></pre> <p><br> I've been looking through the documentation, but have no idea why this is happening. Any ideas?</p> <p><strong>Solution:</strong></p> <pre><code>return (str_replace(PHP_EOL, '\\' . PHP_EOL, 'this is a test')); </code></pre>
php javascript
[2, 3]
4,176,802
4,176,803
jquery php embedding DOM element same problem
<p>When i embed or use php loops to create multiple div's with some id. I want each of them to use with jquery. Say anything like simple hide/show interface.</p> <p>But as the id is the same it wont work. I assign a variable lets say $i to php loop for the reference of uniqueness. I can assign id to a DOM element with like</p> <pre><code> &lt;div id="element-&lt;php echo $i ?&gt;"&gt;Bla Bla &lt;/div&gt; </code></pre> <p>Php echoes out here perfectly but how do i use it with jquery something like this:</p> <pre><code> $("#element"+&lt;?php echo $i ?&gt;).toggle(); </code></pre> <p>Here it doesnt works.</p> <p>How do i do it correctly and where am i going wrong ?</p> <p>Sorry for bad english.</p> <p>Thanks</p>
php jquery
[2, 5]
1,839,681
1,839,682
Eval in asp.net
<pre><code> public void item_bound(object sender,DataGridItemEventArgs e) { try { if((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))`enter code here` { string Status =(string)DataBinder.**Eval**(e.Item.DataItem,"customer_status"); Image Image = new Image(); Image = (Image)e.Item.Cells[1].FindControl("imgbtnstatus"); //Image.Command +=new CommandEventHandler(Image_Command); //Image.Attributes.Add("SEmpId ", SEmpId ); if (Status == "Active") Image.ImageUrl = "~/images/activeuser.png"; else Image.ImageUrl = "~/images/inactiveuser.png"; } } catch(Exception ex){Response.Write(ex.ToString()); } } </code></pre> <p>here is the code for runtime binding the active and inactive image for the users in datagrid...</p> <p>i want to know what is the use of Eval in above code...</p>
c# asp.net
[0, 9]
1,426,597
1,426,598
Is it possible for an Android app to modify the screen at all times?
<p>To give a ridiculous example, could you have a water app/service that stayed on the display AT ALL TIMES (or perhaps only when not actively using another application) and caused ripples to occur when you touched the screen? I would not want an app like this, but it's just an example.</p> <p>I know there is a live wallpaper for this, but it is in the background. What if you wanted the affect on top of your icons and widgets and UI as well?</p> <p>Is this possible?</p>
java android
[1, 4]
1,968,272
1,968,273
jquery dynamic dropdown menu - appending issue
<p>I am making a dynamic drop down using JSON info. Basically it works, but I can't append the sub menu with the parent. Can anyone give a good suggestion?</p> <p>json:</p> <pre><code> "navigation":[ { "title":"Home", "link":"index.html" }, { "title":"Products", "link":"product.html", "subnav":[ { "title":"Webapps", "link":"products/webapps.html" }, { "title":"Mobile Apps", "link":"products/mobile-apps.html" } ] } ] </code></pre> <p>my function :</p> <pre><code>var naviHandler = function (navi) { var localNaviData = navi, ul = '&lt;ul&gt;',naviLink=""; $.map(localNaviData, function (val,i) { naviLink +='&lt;li&gt;' if(val.subnav){ naviLink += naviHandler(val.subnav) }else{ naviLink +='&lt;a href='+val.link+'&gt;'+val.title+'&lt;/a&gt;' } }) naviLink +='&lt;/li&gt;&lt;/ul&gt;'; $('header').find('nav').append(naviLink); } naviHandler(localData[obj]); </code></pre>
javascript jquery
[3, 5]
3,487,068
3,487,069
back Button issue...and logout button
<p>I have searched lot on google for this. I got all the code but that code doesn't work. I created a logout button and on button's click redirecting user to logout page...but further things don't go well.</p> <p>here is code for logout page</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Session.Abandon(); Session.Clear(); Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); } protected void Timer1_Tick(object sender, EventArgs e) { string redirectUrl = FormsAuthentication.LoginUrl + "?ReturnUrl=loginAcc.aspx"; FormsAuthentication.SignOut(); Response.Redirect(redirectUrl); } </code></pre> <p><strong>Edit</strong>: The Following Exception occurs: The resource cannot be found. </p> <p>Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: <code>/MailFormat/login.aspx</code> </p>
c# asp.net
[0, 9]
1,266,416
1,266,417
On what factors should we opt Java or .Net technology for a windows application?
<p>I am quite aware of both java and C# .Net .when i try to create a new windows application which are the factors that decide which technology should be opted? I know of one thing ,for great and faster UI development Visual studio helps a lot.</p>
c# java
[0, 1]
1,006,359
1,006,360
Javascript find if english alphabets only
<p>Am trying to find some text only if it contains english letters and numbers using Javascript/jQuery.</p> <p>Am wondering what is the most efficient way to do this? Since there could be thousands of words, it should be as fast as possible and I don't want to use regex.</p> <pre><code> var names[0] = 'test'; var names[1] = 'हिन'; var names[2] = 'لعربية'; for (i=0;i&lt;names.length;i++) { if (names[i] == ENGLISHMATCHCODEHERE) { // do something here } } </code></pre> <p>Thank you for your time.</p>
javascript jquery
[3, 5]
948,193
948,194
regex function 4 letters and 4 numbers?
<p>i dont understand how regex works so this may be is a simple question for many people, but for me is very important that a person can explain me with simple words how can i use this.</p> <p>i need to validate in jquery adding a new function</p> <pre><code>$.validator.addMethod("loginRegex",function(a,b){return this.optional(b)||/^[a-zA-Z\d]+$/.test(a)},"Solo se aceptan letras o numeros"); </code></pre> <p>this function accept only letters and numbers, but if you put FH374HD3 the validate return me true, but i need to valid 4 letters and 4 numbers in that order, example: "ABCD4578", only letters and numbers but 4 letters first and 4 numbers at the end.</p> <p>is that posible??? tnx all!</p>
javascript jquery
[3, 5]
4,550,192
4,550,193
How Jquery/Javascript dynamically add td (table)
<p>I need help, any ideas?</p> <p>Firstly i want to hide some input element when page open, My approach creating dropdown <code>$counter (1-8)</code> and then depending on <code>$counter</code> Example:3.</p> <p>I create/show existing element dynamically <code>($counter)&lt;td&gt;&lt;/td&gt;</code> inside <code>tr</code> #ID.</p> <p>How jQuery solve this problem?</p> <p>Can u provide me example of switch case in jQuery to show/hide with defined <code>td</code> #ID?</p> <p>Thanks Before</p> <p>Rizq</p>
javascript jquery
[3, 5]
1,269,729
1,269,730
EXC_BAD_ACCESS and char pointer to float pointer cast
<p>I'm currently writing a file loader for an ipad program and I'm getting strange EXC_BAD_ACCESS exceptions. Here is a short snipped of code that I think is the reason for the error:</p> <pre><code>float testFloat() { char mem[32]; char *charPtr = &amp;mem[0]; float *floatPtr = (float*)(charPtr + 1); float f = *floatPtr; //EXC_BAD_ACCESS return f; } </code></pre> <p>The error happens only if the offset of charPtr is not divisible by 4, so I guess it could have something to do with pointer alignment on ARM CPUs.</p>
iphone c++
[8, 6]
2,933,848
2,933,849
How to use broadcast DATE_CHANGED? (android)
<pre><code> &lt;receiver android:name="com.BillManager.DateChanged"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.DATE_CHANGED"/&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre> <p>in class...</p> <pre><code> if (action.equals(Intent.ACTION_DATE_CHANGED)) { Log.d("DateChanged","DateChanged"); } </code></pre> <p>Hello, I am devloping an Android app and I use this broadcast to announce when the user changes the date manually. For some reason I get the broadcast at 12:00 without changing the date manually. Does anyone have an explanation why is it?</p>
java android
[1, 4]
3,304,594
3,304,595
whats wrong with this JS
<p>firebug is complaining its there is a syntax error</p> <pre><code>if (document.getElementById("fromAddress").value == "") || (document.getElementById("fromAddress").value == "Enter Address, City, Directions") { </code></pre>
javascript jquery
[3, 5]
2,152,099
2,152,100
jquery POST method callback function query
<pre><code>$("#submit_js").click(function() { var commentmsg = $('#comment').val(); $.post( "user_submit.php", {comment: $("#comment").val(), aid: imgnum, uid:$("#uid").val()}, function(data){ /*alert(data);*/ //$('#greetings').html('Your choice was submitted successfully. Thank You for voting.'); $('#confirm_msg').addClass("on"); $('#care_parent').addClass("off"); $('#fb_user_msg').html(commentmsg); //$('#fb_user_msg').html( commentmsg ); }); }); </code></pre> <p>the above is my jquery POST function. in the callback function i am doing some html stuff. this is the successful POST version. that means, when the POST procedure is complete or added to the DB. now in my user_Submit.php i am checking to validate whether I should add the data to the DB or not. </p> <p>Can the callback function be modified so that if I dont add to the DB in user_Submit.php, I should display some other message to the user...</p> <p>what I really want to ask is, how to make PHP pass a 0/1 value ot JS? can someone help?</p>
php javascript jquery
[2, 3, 5]
4,670,444
4,670,445
To building a jQuery web widget for other domains
<p>I spent two days to develop a web widget for other domains but I didn't get any success. I found a <a href="http://alexmarandon.com/articles/web_widget_jquery/" rel="nofollow">tutorial</a> to develop a widget that is quite useful but my problem is:</p> <p>If user clicks on my widget button then the widget will check the login status. If the user is not loggedin then a popup window will open and ask for username and password. If the user successfully logged in to widget origin then the parent window will automaticaly refresh and show the data on the place of widget button.</p> <p>I have created the widget in jQuery to open the popup window but not able to refresh the parent window of popup.</p>
php jquery
[2, 5]
2,175,166
2,175,167
BlockUI scrolls to top
<p>I am using the JQuery BlockUI plugin:</p> <pre><code>function block(msg) { $.blockUI({ message: msg, css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '10px', '-moz-border-radius': '10px', opacity: .8, color: '#fff' } }); } function unblock() { $.unblockUI(); } </code></pre> <p>The problem I am facing is, as soon as I call it, it scrolls my page to the top. This is not good.</p> <p>Here is the generated html:</p> <p><img src="http://i.stack.imgur.com/qRJrJ.png" alt="enter image description here"></p> <p>Is there anything I could modify so that it does not touch the pageoffset / scrolling? Is there anything I could do to preserve it or anything?</p> <p>Thanks</p> <p>called here:</p> <pre><code>function callBump(realid) { block('Bumping...'); $.ajax({ type: "POST", url: "CalendarServices.aspx/Bump", data: 'id=' + realid, success: function (data) { $('#calendar').fullCalendar('refetchEvents'); unblock(); } , error: function () { unblock(); } }); } </code></pre>
javascript jquery
[3, 5]
28,910
28,911
copy .aspx webform error
<p>I wanted to copy my .aspx file and paste it with all its content, but I run into an error.</p> <p>this is what I did : 1. Copy - Paste. 2. rename the new aspx file in the solution explorer. 3. rename the Inherits in the aspx file (the "code behind" there was already changed automatically for some reason..)</p> <p>I run into an error : "Type WebApplication21.Home" already defines a member called Page_Load with the same parameter types</p> <p>Thanks.</p>
c# asp.net
[0, 9]
2,585,346
2,585,347
Using a SAVE Button
<p>I have have completed an application and would like to add a save button to store all the string values throughout the activity. I have read about csv write, sqlite and others and trying to determine the best way to go. I would like to basically create a report with a header, column headings and then the data and not sure the best way to proceed. I would like to have a filename consisting of the date/time and name like report one ie: report one 2011091190400. Each time save is pressed I would like to append data to file as long as the date is the same, not the time.</p> <p>Is the best way sqlite or csv file? I usually implement something then get it working then find out there is a better way so this time I am asking for advice/recommendations before I start.</p> <p>There is not much data but the intent is open the file later on a pc using excel.</p> <p>thanks in advance.</p>
java android
[1, 4]
4,640,888
4,640,889
how to tell a string is all in english in php or javascript?
<p>how to tell a string is all in english of php. eg:$test="eeeeeeeeeeeee" how to tell that the <code>$test</code> string is writen all in english.</p>
php javascript
[2, 3]
6,018,729
6,018,730
Pattern checking .Check for incorrect operators in an expression
<p>In an expression , How to 1.Check if operators and operands are correct or not. 2.check if brackets match or not. Example 1: (a+b)- has a one extra operator How do i confirm that the number of operators are incorrect. Example 2 :((a+b)/(c-d) has one extra opening bracket. how to check such irregularities. Any regular expression pattern to check these or some way to do this ? Please help .</p>
c# javascript asp.net
[0, 3, 9]
97,167
97,168
what is the best practice to do the following using jquery/javascript?
<p>So I am just trying to add some functions to hover. the below does about the same thing except the one with the for loop i have the target stored in an array. I actually have a few questions.</p> <ol> <li>is this the correct use of stopPropagation?</li> <li>what's the best practice for doing something like this? </li> <li>which one of the below method is faster and uses less resources?</li> <li>I know I can use hover() but I used bind because I thought it is faster, is my thinking correct?</li> </ol> <p>thank you</p> <pre><code> for (var i in slides) { $(slides[i].el).bind( { mouseenter: function (event) { event.stopPropagation(); // do something }, mouseleave: function (event) { event.stopPropagation(); //do something } }); } $("#vehicleSlides .vehicleAreas").bind( { mouseenter: function (event) { event.stopPropagation(); // do something }, mouseleave: function (event) { event.stopPropagation(); //do something } }); </code></pre>
javascript jquery
[3, 5]
4,425,011
4,425,012
Jquery Remove Image
<p>My overall problem is to lazy load images. I've gotten to the point where I'm loading the images only when they are on screen. I need to remove the images that are not on screen. </p> <p>I thought </p> <pre><code>$(image).removeAttr("src") </code></pre> <p>would do it and it rightly removes src, but it does not clear the image from the screen, nor does it replace it with what is in alt. </p> <p>How do I make it remove the image? Note, I do not want to remove the img tag (I need it for later), just clear the image from the screen. </p> <p>Other code that may be relevant(although why I don't know)-</p> <pre><code>updateCarImages:=&gt; imagesOnScreen = $(@el).find(".carImageClass:onScreen") imagesOffScreen = _.without(cachedImagesOnScreen,imagesOnScreen) for image in imagesOnScreen imgSrc = $(image).attr("src") if (!imgSrc) id = $(image).data("tooltip-id") console.log(id) result = resultsStore.get(id+"") console.log(result) $(image).attr("src", result.get("carImageUrl")) console.log(imagesOffScreen) for image in imagesOffScreen $(image).removeAttr("src") </code></pre>
javascript jquery
[3, 5]
5,642,642
5,642,643
PHP Audio Streamer for Facebook like Chirbit
<p>I want to use a third party like chirbit through which we can upload the audio files and can use the url in the facebook post to play the audio in Facebook. Chirbit worked well, but it didn't provided <code>api</code>, since I want to this whole stuff through android code. Can anyone suggest to similar kind of thirdparty server or any PHP script which works like chirbit? Thanks in advance.</p>
php android
[2, 4]
2,443,920
2,443,921
for a newbie,what is the best web app to develop firstly?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/987057/small-projects-ideas-to-teach-beginners-web-developent-using-asp-net">Small projects ideas to teach beginners web developent using ASP.Net</a> </p> </blockquote> <p>I am learning about technical skills to become a web developer.But i don't know how i should start to develop a web application.</p>
c# asp.net
[0, 9]
3,876,024
3,876,025
("kg"=="kg") returns false. How Do I tell java, that this comparison returns true?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/995918/java-string-comparison">Java string comparison?</a> </p> </blockquote> <p>I was trying to do this:</p> <pre><code>boolean exit = false; while(exit==false &amp;&amp; convStoreIndex&lt;convStoreLength) { if(conversionStore[convStoreIndex].getInUnit()==inUnit) { indexCount++; exit=true; } convStoreIndex++; } </code></pre> <p>but the if-condition never went true, even if the two Strings were the same(checked this in the debugger). so I added some lines:</p> <pre><code>boolean exit = false; while(exit==false &amp;&amp; convStoreIndex&lt;convStoreLength) { Log.v("conversionStore["+String.valueOf(convStoreIndex)+"]", conversionStore[convStoreIndex].getInUnit()+"|"+inUnit); String cs = conversionStore[convStoreIndex].getInUnit(); String iu = inUnit; Log.v("cs", cs); Log.v("iu", iu); Log.v("Ergebnis(cs==iu)", String.valueOf(cs==iu)); if(conversionStore[convStoreIndex].getInUnit()==inUnit) { indexCount++; exit=true; } convStoreIndex++; } </code></pre> <p>and here is the extract from LogCat:</p> <pre><code>09-15 11:07:14.525: VERBOSE/cs(585): kg 09-15 11:07:16.148: VERBOSE/iu(585): kg 09-15 11:07:17.687: VERBOSE/Ergebnis(cs==iu)(585): false </code></pre> <p>the class of conversionStore:</p> <pre><code>class ConversionStore { private String inUnit; [...] public String getInUnit() { return inUnit; } } </code></pre> <p>Who is going crazy, java or me?</p>
java android
[1, 4]
3,283,752
3,283,753
Android SharedPreferences NullPointerException on getSharedPreferences
<p>I'm trying to create a single class which will deal with storing and retrieving two user settings 'radius' and 'cluster'.</p> <p>Upon loading the 'Settings' activity I get a null pointer exception.</p> <p><strong>Snippet from the user settings:</strong></p> <pre><code> storage = new Persistence(); radius = (EditText) findViewById(R.id.etRadius); radius.setText(String.valueOf(storage.getRadius())); &lt;-- Problem </code></pre> <p><strong>Class to deal with persistence:</strong> </p> <pre><code>public class Persistence extends Activity { private static final String PREFERENCES = "tourist_guide_preferences"; private SharedPreferences settings; private SharedPreferences.Editor editor; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); settings = getSharedPreferences(PREFERENCES, 0); editor = settings.edit(); } public int getRadius() { return settings.getInt("radius", 2000); } public int getClusterSize() { return settings.getInt("cluster", 50); } public void setRadius(int radius) { editor.putInt("radius", radius); editor.commit(); } public void setClusterSize(int size) { editor.putInt("cluster", size); editor.commit(); } } </code></pre>
java android
[1, 4]
6,018,621
6,018,622
Pass string variable from java to php function
<p>I am a beginner java and php I must pass a string variable from Java client to php server using WebView</p> <p>Is what I am doing right?</p> <p>In java side:</p> <pre><code>String Coords=CoordsString; String PHPPagePath="http://10.0.2.2/ReceiveLocation.php?Coords=" + CoordsString"; </code></pre> <p>and on the php side: ReceiveLocation.php</p> <pre><code> &lt;?php include('ConnectionFunctions.php'); Connection(); $x=$_GET['Coords']; GetCoords($x); function GetCoords($x) { echo $x; } ?&gt; </code></pre> <p>Is this the right way to pass the parameter Coords from Java Client to PHP Server Function?</p>
java php android
[1, 2, 4]
5,171,728
5,171,729
How do I get some JavaScript/jQuery to run in sequence
<p>I have an HTML file which contains two divisions. One has id 'welcome' and the other is named 'welcome_distort'.</p> <p>With jQuery imported, I have a seperate js file which contains some code that operates on these divs.</p> <pre><code>$("#welcome").fadeTo(50,0.1); $("#welcome").fadeTo(10,1.0); $("#welcome").fadeTo(10,0.1); $("#welcome").fadeTo(10,1.0); $("#welcome").fadeTo(1000,0.0); $("#welcome_distort").css({opacity:"1.0"}); </code></pre> <p>All the fadeTo() commands work in sequence. What I then want to happen is the css() command to come after these fadeTo()s. In reality, the operation on welcome_distort takes place at the same time as the first operation on welcome. My question is: how do I get the .css() operation to run after the last .fadeTo().</p> <p>Many Thanks, John</p>
javascript jquery
[3, 5]
1,490,630
1,490,631
Should I do my object oriented design class with Java or C++?
<p>I learned the C programming language and did my data structures class with C. What I am thinking is to learn Java. I know how the low level stuff works and people suggested that C++ is not a good language to do object oriented design. What do you think? Should I skip C++ and learn object oriented design using Java or should I first learn C++ and do object oriented design with C++ and then learn Java?</p> <p>Edit: of course I am doing C++ as I am a computer science major. Sorry for the confusion. But in which order? Java first or C++ first for my object oriented design class?</p>
java c++
[1, 6]
2,666,592
2,666,593
jQuery idle timeout for pages with iframes
<p>Idle timeout plugin, Google search brings couple of them, but not any which takes care of pages containing iframes. I have a lot of iframes in my pages. I use a jQuery idle timeout plugin. I click anywhere in page timer is rest, but if I click on iframe timer is not rest. Please advice, is there any plugin which works good when page has iframes?</p>
javascript jquery
[3, 5]
1,915,834
1,915,835
How to convert signs in url/text to hex characters? (converting = to %3D)
<p>With the script I'm making, jquery is getting vars from url parameter. The value that its getting is an url so if its something like </p> <p><code>http://localhost/index.html?url=http://www.example.com/index.php?something=some</code> </p> <p>it reads:</p> <pre><code>url = http://www.example.com/index.php?something </code></pre> <p>If its like</p> <p><code>http://localhost/index.html?url=http://www.example.com/index.php?something%3Dsome</code></p> <p>it reads:</p> <p><code>url = <a href="http://www.example.com/index.php?something%3Dsome" rel="nofollow">http://www.example.com/index.php?something%3Dsome</a></code></p> <p>which would register as a valid url. my question is how can I search for <code>=</code> sign in the <code>url</code> variable and replace it with hex <code>%3D</code> with jquery or javascript?</p>
javascript jquery
[3, 5]
2,609,840
2,609,841
How to validate incoming Urls?
<p>I need to validate incoming urls from my application following is the scenario</p> <p>on url <a href="http://abc.com/login.aspx" rel="nofollow">http://abc.com/login.aspx</a> - need to validate incoming urls from anyone of following</p> <p><a href="http://xyz.com/start.aspx" rel="nofollow">http://xyz.com/start.aspx</a><br> <a href="http://xyz.net/start.aspx" rel="nofollow">http://xyz.net/start.aspx</a><br> http:/yyy.com<br> <a href="http://mydomain.com/gotologin.aspx" rel="nofollow">http://mydomain.com/gotologin.aspx</a> </p> <p>Now from <a href="http://abc.com/login.aspx" rel="nofollow">http://abc.com/login.aspx</a> - I have to check whether the user came from above any three link or not?</p> <p>If use came from any of these link display the a custom message with the url.</p> <p>Any help on this will be most appreciated.</p> <p>I finished it with config file like<br> Here is a need of assign a particular value to a user came from specific url so, I took the key of url. All is working fine on local system. But when I published the sites on production it is not working. The code and rest logics are fine.</p>
c# asp.net
[0, 9]
3,847,048
3,847,049
jquery ui Autocomplete causing error with headers
<p>I'm getting an error when trying to redirect. It only started after I installed a search box with autocomplete. When I pull the bit of code out, the page redirects properly again. I know it isn't my php.ini settings.</p> <p>This is the error I'm getting:</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/content/67/6231767/html/nav.php:9) in /home/content/67/6231767/html/admin/includes/functions2.php on line 7</p> </blockquote> <p>Here is the code that is causing the problem. Thanks for your help!</p> <pre><code>$(function() { $.ajax({ url: "/admin/includes/links.xml", dataType: "xml", success: function( xmlResponse ) { var data = $( "link", xmlResponse ).map(function() { return { value: $( "title", this ).text(), id: $( "url", this ).text() }; }).get(); $( "#tags" ).autocomplete({source: function (request, response) { var term = $.ui.autocomplete.escapeRegex(request.term) , startsWithMatcher = new RegExp("^" + term, "i") , startsWith = $.grep(data, function(value) { return startsWithMatcher.test(value.label || value.value || value); }) , containsMatcher = new RegExp(term, "i") , contains = $.grep(data, function (value) { return $.inArray(value, startsWith) &lt; 0 &amp;&amp; containsMatcher.test(value.label || value.value || value); }); response(startsWith.concat(contains)); }, select: function( event, ui ) { window.location.href = ui.item.id; } }); } }); }); </code></pre>
php javascript jquery
[2, 3, 5]
5,381,337
5,381,338
JQuery - Pass value from an input box to a input box in another page
<p>quick question here.</p> <p>Normally, using JQuery, if I want to pass the value from an input box to another one on the same page, I`d just do something like this :</p> <pre><code> &lt;script type="text/javascript"&gt; $('#postalCodeBtn').live('click', function(){ var text = $('#from1').val(); $('#from').val(text); }); &lt;/script&gt; </code></pre> <p>But now assuming the input "from1" is on a page called detail, and "from" is on another page called maps.</p> <p>How can I pass the value between both pages ?</p> <p>Thanks ! </p>
javascript jquery
[3, 5]
2,538,737
2,538,738
Jquery using the click function to just reference buttons
<p>Hi I have this line in my script to reference any button click on my page </p> <pre><code> $("input").click(function() { alert ("clicked") ; but_id = (this.id); }); </code></pre> <p>It will then work on any input element but I cant seem to reference just a button . I thought this would work but is does not </p> <pre><code> $("input :button").click(function() { </code></pre> <p>can anyone offer any advice please ? </p>
javascript jquery
[3, 5]
3,811,711
3,811,712
Android key hold repeatedly generating event
<p>Is it normal that when you press and hold the Dpad key (or any other keys), it will first generate 1 key event, and after like 1 second or 2, it will then generate other key events repeatedly, as long as you are still pressing the key?? I am trying to write a game and want to use the Dpad as the game control, but the 1~2 second delay is a problem to me. Any workaround? </p>
java android
[1, 4]
182,104
182,105
how to add text to span jquery
<p>I have this jquery code that I am using to create a dynamic menu</p> <pre><code>function createList(test){ alert(test); $('#nav') .append('&lt;li class="top"&gt;&lt;a href="nogo2" id="products" class="top_link"&gt;&lt;span class="down"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;'); $('.down').text(test); } </code></pre> <p>the problem that i have is when i try to add the text to the span</p> <pre><code>$('.down').text(test); </code></pre> <p>the menu changes to whatever value is the last for example if my values are a b c d e then all my menus e e e e e can any body help me thanks</p>
javascript jquery
[3, 5]
3,956,401
3,956,402
How to focus in div tag in javascript
<p>I have created a tabs using div tag in javascript. I have asp.net button on each tab. whenever I clicked on button the focus is set to first tab.</p> <p>I am using following code in page load event.</p> <pre><code>HtmlGenericControl content_1 = new HtmlGenericControl("content_1"); HtmlGenericControl content_2 = new HtmlGenericControl("content_2"); HtmlGenericControl content_3 = new HtmlGenericControl("content_3"); HtmlGenericControl content_4 = new HtmlGenericControl("content_4"); HtmlGenericControl content_5 = new HtmlGenericControl("content_5"); HtmlGenericControl selectedPage = new HtmlGenericControl(pageName); content_1.Style["display"] = "none"; content_2.Style["display"] = "none"; content_3.Style["display"] = "none"; content_4.Style["display"] = "none"; content_5.Style["display"] = "none"; selectedPage.Style["display"] = "block"; selectedPage.Attributes.CssStyle.Add("class", "active"); </code></pre>
javascript asp.net
[3, 9]
1,522,333
1,522,334
asp.net int? when in debug being converted to Hex problem
<p>when I debug the values of variables set to an int?are being converted to hex values.<br> Does anyone know how to prevent the conversion from occuring?</p> <p>thanks, Niall</p>
c# asp.net
[0, 9]
3,286,708
3,286,709
jQuery click event problems when selecting by class and <div>
<p>When I access <code>&lt;div&gt;</code> or <code>&lt;p&gt;</code> elements by class with jQuery for a click function, it repeats the event by how many elements are in the array or stack. So, if I have 3 <code>&lt;div&gt;</code> elements on top of each other or next to each other, the one on the bottom, or the one to the right, will go through the event once and the one on the top or the left will go through the event 3 times.</p> <p>Am I doing something wrong? Or is this not meant to be done with jQuery? </p> <p>[revision] sorry if i worded this in a confusing way. here is a link... you will better understand my problem there. just add a couple new elements via the form and click on them.</p> <p><a href="http://jsfiddle.net/rNj6e/" rel="nofollow">http://jsfiddle.net/rNj6e/</a></p>
javascript jquery
[3, 5]
553,212
553,213
Tossing the coin over learning PHP or JavaScript first
<p>In your opinion which should I learn first: PHP or JavaScript?</p> <p>I am going to learn both but which order do you feel I should learn them in? </p>
php javascript
[2, 3]
1,449,743
1,449,744
How to Restart my Previous Activity from Next Activity
<p>I have critical stage can anyone help if you know,Actually i have 1 to 5 activities and 6th one is common activity,first i need to go 1st activity to 6th activity,Now my doubt is in 6th activity having one refresh button for activity 1st activity but its not working in my code,i have used _Try_Again.setOnClickListener(new OnClickListener() {</p> <pre><code> @Override public void onClick(View v) { // TODO Auto-generated method stub /*Intent loginIntent = new Intent(Inter_Conn_Error_activity.this, Splashscreen.class); startActivity(loginIntent);*/ onBackPressed(); finish(); } });... </code></pre> <p>How can i do this? please help me..</p>
java android
[1, 4]
744,710
744,711
JQuery click event not working correctly after class change
<p>I have JQuery script similar to this:</p> <pre><code>$('.follow_link').click(function(){ // Do some stuff $(this).removeClass(); $(this).addClass("unfollow_link"); }); $('.unfollow_link').click(function(){ // Do some stuff $(this).removeClass(); $(this).addClass("follow_link"); }); </code></pre> <p>My problem is that after I change the class the link is still refering to it's old class' click event. Is there a way of rebinding? Or am I doing this a bad way?</p>
javascript jquery
[3, 5]
3,927,931
3,927,932
Print PDF file to default printer on client side using Jquery or javascript
<p>I am creating an PDF file to print badges for Cloud Based application. Until now it's fine.</p> <p>Now I need to print this PDF file on client side default printer. As they are using DYMO printer. My code is not supporting the dymo printer.</p> <p>So is there any code, using javascript or jQuery to do this? .</p> <p>Can anyone please suggest me with examples?</p>
javascript jquery
[3, 5]
1,106,488
1,106,489
Formatting percentages in ASP.NET C# databinding using Eval
<p>There is a col in a database that is declare as decimal 4 precision 3. I need to multiply this number by 100 (I am doing that in the stored proceure query) and display it as a decimal with only significant zeros afte the decimal point. If the resulting value is less than 1%, I supose it should be displayed with a 0 <em>before</em> the decimal. The display should include a % mark. For example:</p> <pre><code> 100 % 99.1 % 0.1 % 56 % 0 % </code></pre> <p>The web page is using data binding:</p> <pre><code> &lt;asp:Label ID="lblTMLY_POL_HLDER_NOTC_PCT" runat="server" Text='&lt;%# Eval("DECIMAL_COL_PREC_4_SCALE_3") %&gt;'&gt;&lt;/asp:Label&gt; </code></pre> <p>I suppose I'd probably have an easier time handling this in the Data Bound Item even and using string formatting funtions there. Ideally, I'd like to know what format string in teh markup to use and how one would handle this in the code behind.</p> <pre><code> &lt;asp:Label ID="lblTMLY_POL_HLDER_NOTC_PCT" runat="server" Text='&lt;%# Eval("DECIMAL_COL_PREC_4_SCALE_3","{00:??????}") %&gt;'&gt;&lt;/asp:Label&gt; </code></pre>
c# asp.net
[0, 9]
431,205
431,206
javascript async woes
<p>This is a newbie JavaScript question, but something I'm not quite sure how to google for help because I'm not sure how to describe the problem in an easy way.</p> <p>I have a large, somewhat complex JSON that I need to manipulate so that I could reshape the JSON in a way that I get a list of only countries, cities, and sales.</p> <p>The JSON itself isn't the issue for me, it's what I would like to do with it once I've received it. Basically, I'd like to create 3 separate objects/arrays from a large received JSON and have those 3 separate objects/arrays accessible for usage OUTSIDE of the <code>$.ajax</code> call. Yes, I think I could do all of this inside of the <code>$.ajax</code> success callback, but I'd rather have all the JSON processing done elsewhere. My pseudo JavaScript looks something like this:</p> <pre><code>var model = { countries: [], cities: [], sales: [], set: function(data) { //manipulate data here so that model.countries, model.cities, model.sales are populated } }; $.ajax({ url: 'example.com/sample.json', success: function(data) { model.set(data); //is this the right way to do this? } }); $('#countries').html(model.countries); $('#cities').html(model.cities); $('#sales').html(model.sales);​ </code></pre> <p>But because JavaScript executes asynchronously, the last 3 lines are always blank because the JSON hasn't been received yet.</p> <p>So I guess my question is, how do I bind the results of my received JSON to a variable outside of the <code>$.ajax</code> scope so that I could use it wherever on the page?</p>
javascript jquery
[3, 5]
2,008,954
2,008,955
jQuery: Any way to "refresh" event handlers?
<p>I have two divs, one that holds some stuff and the other with all possible stuff. Clicking on one of the divs will transfer items to the other div. The code I came up with is:</p> <pre><code>$("#holder &gt; *").each(function() { $(this).click(function(e) { $(this).remove(); $("#bucket").append(this); }); }); $("#bucket &gt; *").each(function() { $(this).click(function(e) { $(this).remove(); $("#holder").append(this); }); }); </code></pre> <p>This one works perfectly, except that the event handlers need to be refreshed once I append or remove elements. What I mean is, if I first click on an element, it gets added to the other div, but if I click on this element again, nothing happens. I can do this manually but is there a better way to achieve this?</p>
javascript jquery
[3, 5]
2,589,641
2,589,642
Why do I need to set the Visibility of LinkButton in a ListView Layout in the LayoutCreated event instead of directly on the LinkButton?
<p>I have a ListView control and in the LayoutTemplate I have a LinkButton. I tried setting the Visible property to &lt;%# IsUserAdmin %>, where IsUserAdmin is a method which returns true or false depending on whether the user is an admin or not and sets the visibility of the control, but I found out that this does not work for the LayoutTemplate and instead of I have to go to the LayoutCreated event and get the control and then set its visibility. I am curious why I have to do it this way with a control in the LayoutTemplate? I can use the &lt;%# IsUserAdmin %> on the Visible property of a control in the ItemTemplate with no problem. I was thinking it would actually be easier for the LayoutTemplate because there is only 1 control generated instead of multiple controls for the ItemTemplates.</p>
c# asp.net
[0, 9]
2,301,005
2,301,006
Adding start delay
<pre><code> function moveto(coordinates) { step1 = coordinates[0]; step2 = coordinates[1]; var w = $(document).width(); var h = $(document).height(); $( "#full" ) .animate({left: -(step1 * w)}, 2000 ) .animate({top: -(step2 * h) }, 500 ); } var randomNum = randomNumbers(); moveto(randomNum); </code></pre> <p>I need to add start delay of this function and to replay after a certain time</p>
javascript jquery
[3, 5]
4,133,354
4,133,355
why document.write doesn't complete as expected
<p>Just trying to set up a little test page and even it doesn't behave as expected.</p> <p>Given the following working code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"&gt; &lt;title&gt;Terry's Test Page&lt;/title&gt; &lt;script src='jquery-1.7.1.min.js'&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;from the html in index.html&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I get what I expect, the one line from the html and Terry's Test Page in the tab label. However, if I add just before the <code>&lt;/head&gt;</code> line:</p> <pre><code>&lt;script&gt;$(document).ready(function() { document.write('&lt;p&gt;from the js&lt;/p&gt;'); }); &lt;/script&gt; </code></pre> <p>I properly get the 'from the js' line -- no from html since document.write replaces it -- but the tab label is not filled with Terry's Test Page. In IE the tab label shows the url, in Firefox it shows 'Connecting ...' but it never gets beyond that.</p> <p>What is it about document.write that I don't understand? Do I have to issue some sort of end of file or some such?</p>
javascript jquery
[3, 5]
5,978,632
5,978,633
Android: save file to SD-card
<p>.txt file need save in SD-card.</p> <pre><code>Save("n" + String.valueOf(key) + ".txt"); private void Save(String FileName){ File fileName = null; String sdState = android.os.Environment.getExternalStorageState(); if (sdState.equals(android.os.Environment.MEDIA_MOUNTED)) { File sdDir = android.os.Environment.getExternalStorageDirectory(); fileName = new File(sdDir, "FlyNote/"+FileName); } else { fileName = context.getCacheDir(); } if (!fileName.exists()) fileName.mkdirs(); try { FileWriter f = new FileWriter(fileName); f.write(editText2.getText().toString()); f.flush(); f.close(); } catch (Exception e) { } } </code></pre> <p>But in the SD-card file saves as a folder. Folder "n5.txt" and other...</p>
java android
[1, 4]
2,371,171
2,371,172
jQuery equivellent for dynamically create id
<p>I am looking for jQuery equivellent for the following. Please help. </p> <pre><code>var request = document.getElementById('request_' + id1) var response = document.getElementById('response_' + id1); modifyText(request.firstChild.nodeValue,response.firstChild.nodeValue); </code></pre>
javascript jquery
[3, 5]