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
628,549
628,550
How to assign the value of a javascript variable to a php variable
<p>I've a form. </p> <pre><code>&lt;form action="inc/genxml.php" method="post"&gt; &lt;input id="nameTxt" name="name" type="text" value="test"/&gt; &lt;button id="nameSave" class="left"&gt;Save&lt;/button&gt; &lt;/form&gt; </code></pre> <p>And a div element #name</p> <p>When I click the save button, I want to pass the position of the div #name to the form action file. To get the position, I'm using jQuery .position().</p> <p>Something like below. (which just prints out the coordinates)</p> <pre><code>$('#nameSave').click( function() { var pos = $('#name').position(); alert("left: " + pos.left + ", top: " + pos.top ); } ); </code></pre> <p>I want to pass the coordinate values (pos.left &amp; post.top) to the form action file (in this case to the file genxml.php).</p> <p>How should I do that?</p>
php javascript jquery
[2, 3, 5]
4,364,844
4,364,845
Does Integer.parseInt(String) creates object?
<p>I am using <code>int duration = Integer.parseInt(durationInString)</code> to convert String object to primitive integer value. I am using this in a while loop and the integer conversion happens every second until the end of video duration. For example - if Video is 2 min I will call <code>Integer.parseInt</code> 120 times. I wanted to know if every call to <code>Integer.parseInt</code> creates a object? If so is it a bad idea to have it called continuously?</p> <p>Any help is very much appreciated.</p> <p>Note: I am working on Android application</p> <p>Thanks, SKU </p>
java android
[1, 4]
3,112,146
3,112,147
Prevent tab text highlight / disable tab text selection
<p>Here's a sample form:</p> <pre><code>&lt;form action="#" method="post"&gt; Name:&lt;br /&gt; &lt;input type="text" name="name" value="your name" /&gt;&lt;br /&gt; E-mail:&lt;br /&gt; &lt;input type="text" name="mail" value="your email" /&gt;&lt;br /&gt; &lt;input type="submit" value="Send"&gt; &lt;/form&gt; </code></pre> <p>When you tab to a text input, the value gets highlighted. How can it be disabled?</p> <p>Any help is appreciated!</p> <p>Mike</p>
javascript jquery
[3, 5]
1,224,539
1,224,540
Clear text inside DIV
<p>I'm using the following HTML structure:</p> <pre><code>&lt;div id="clock"&gt;5:30 AM &lt;div id="day"&gt;Wednesday &lt;/div&gt; &lt;div id="date"&gt;14 December &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I update the contents of these elements using Javascript. For "day" and "date" I use <code>$("#day").text(day)</code> and <code>$("#date").text(date)</code>. Because "clock" is a parent element I had to use <code>$("#clock").prepend(clock)</code> to succesfully add the text.</p> <p>The problem with the latter function, is that new text is prepended every time the clock is refreshed, i.e. it builds up a list of clock times. For the first two functions the text is just replaced, like it should. Is there a way to make this happen for the "clock" function as well?</p> <p>EDIT: Sorry, should have been a bit more clear about the clock. Have edited the code, so you understand. BTW, the reason the clock is parent element is that could make the other two elements depend on the clock's position and styling.</p> <p>I also created a jsFiddle: <a href="http://jsfiddle.net/KeyMs92/NZtFA/" rel="nofollow">http://jsfiddle.net/KeyMs92/NZtFA/</a> I left the list building thing (annoyingly) in!</p> <p>BTW, I'm not too sure if <code>function(); setInterval('function()', 1000)</code> is the best way to refresh, so if you something better I'd be happy to know :)</p>
javascript jquery
[3, 5]
6,008,362
6,008,363
window.setInterval - more than expected
<p>Could you guys explain more deeply window.setInterval functionality? I've been asked myself several questions while running that snippet:</p> <pre><code>var i = 0; window.setInterval(function(){ $('#show').html($('.questions :eq('+i+')')); }, 1000); </code></pre> <p>So, i think that window.setInterval is awesome because it automatically increment <code>i</code> var, displays all divs that nested in <code>.questions</code> before goes new iteration, and stops when last div in <code>.questions</code> is reached.</p> <p>But the main question if it is possible to change function from outside, for example remove <code>$('.questions :eq('2')')</code>, before new iteration?</p> <p>thanks!</p>
javascript jquery
[3, 5]
3,329,541
3,329,542
jquery slider - animating timeline
<p>I'm using the jquery slider function for a timeline</p> <pre><code>$("#content-slider").slider({ min: 0, max: 300, step: 1, change: handleSliderChange, //start: getImageWidth, slide: handleSliderSlide }); function handleSliderSlide(event, ui) { $("#content-scroll").prop({scrollLeft: ui.value * (maxScroll / 300) }); if (ui.value &gt;= 7 &amp;&amp; ui.value &lt;= 13) { $('#marker_10').animate({opacity: 'hide'}, 100, function () { $(this).parent('div').animate({marginTop: '100px'}, {duration:1000, queue:false }).addClass('up').find('p').animate({opacity: 'show'} ) }) } if (ui.value &gt; 13 || ui.value &lt; 7 &amp;&amp; ($('div#container_10').hasClass('up'))) { $('div.up').stop(true) $('#container_10').removeClass('up').find('p').fadeOut('fast').end().animate({marginTop:'165px'}, {duration:500, complete:function() {$(this).find('img.marker').fadeIn() }, queue:false}) } } </code></pre> <p><a href="http://asla.dev.1over0.com/html/slider/bacardi_last.html" rel="nofollow">http://asla.dev.1over0.com/html/slider/bacardi_last.html</a> </p> <p>It animates ok when I scroll left to right but when I scroll right to left then I get some issues where elements are fading out and displaying correctly any information would be appreciated; this is all done on the front end currently Thank you</p>
javascript jquery
[3, 5]
1,899,142
1,899,143
window.location.href.match Not Working
<p>Here is the code:</p> <pre><code>$(function() { var pathname = (window.location.href.match(/[^\/]+$/)[0]); $('#menu dl dd a#toparrow').each(function() { if ($(this).attr('href') == pathname) { $(this).addClass('currenttop'); } }); }); </code></pre> <p>Here is a link to my website: <a href="http://bluraymoviestore.com" rel="nofollow">http://bluraymoviestore.com</a></p> <p>The purpose of the script is to make the arrow image stay on the current page, like it does when you first click to the categories.</p> <p>The script works when I'm clicked on the parent page, but when I click to the next page under the same category, the script no longer works (example: works with <code>/bluraynewreleases</code> but not <code>/bluraynewreleases-2625374011-rc-2-new_releases.html</code>). What do I need to add to the code to make it work? </p>
javascript jquery
[3, 5]
3,141,691
3,141,692
jquery: help center variable size div on image hover
<p>I have a little problem I don't understand. I made a jsfiddle to illustrate it.</p> <p><a href="http://jsfiddle.net/sandrodz/czfGy/9/" rel="nofollow">http://jsfiddle.net/sandrodz/czfGy/9/</a> (updated to include images)</p> <p>So when user hovers on image it should div is revealed which contains text "sunny cloudy" this massage varies so it can be smaller or larger.</p> <p>I want it centered over the image. But unfortunately my jquery logic doesn't work correctly and hover appears shifted to the left.</p> <p>Any ideas?</p> <pre><code>$("#tempicon img").hover(function() { divW = ($(this).next("div").width() / 2) - ($(this).outerWidth() / 2); $(this).next("div").css({marginLeft: -divW }).animate({ opacity: "show" }, "fast"); }, function() { $(this).next("div").animate({opacity: "hide"}, "fast"); }); </code></pre> <p>To add to the confusion, I use same exact code on the other div and it works perfectly :S</p>
javascript jquery
[3, 5]
1,525,825
1,525,826
Dynamic javascript from web resource
<p>I have written a custom web control that validates some input to a textbox client-side. The associated JavaScript is an embedded resource. As part of the validation process the JavaScript displays a confirm alert box.</p> <p>I want to be able to set the message of the alert from a property of web control, in a similar way to the standard asp.net validation controls have the ErrorMessage property.</p> <p>Can anyone advise me on the best way to splice this property into my embedded JavaScript?</p> <p>Embedded js function</p> <pre><code>function checkDeduction(sender, eventArgs) { var dNewVal = eventArgs.get_newValue(); if (dNewVal &gt; 0) { var bRetVal = confirm("custom msg here"); if (!bRetVal) { dNewVal = dNewVal * -1; sender.set_value(dNewVal); } } } </code></pre>
javascript asp.net
[3, 9]
5,708,267
5,708,268
Get access to user control from a nested master page
<p>Is there a way to get access to a puplic property on a user control from a nested master page?</p> <p>Let me explain further</p> <p>I have 3 deep master pages</p> <ol> <li>global.master<br/></li> <li>LargeTopNav.master (inherits global.master)<br /></li> <li>LargeTopNav25-50-25.master (inherits LargeTopNav.master)<br /></li> <li>feature.aspx - This page is where I would like to access a custom user control I have on LargeTopNav.master to be able to set a property.</li> </ol> <p>I'm fairly new to .net so any help is appreciated.</p>
c# asp.net
[0, 9]
1,012,205
1,012,206
Javascript Function dont works on dynamically created ImageButton (ASP.NET)
<p>Got something like this:</p> <pre><code> protected void Page_Init(object sender, EventArgs e) { LoadImageButtons(); } private void LoadImageButtons() { for (int i = 1; i &lt; 10; i++) { ImageButton myImageButton = new ImageButton(); myImageButton .ID = i.ToString(); myImageButton .CssClass = "buttonFieldClass"; myImageButton .Click += new ImageClickEventHandler(einButton_Click); myImageButton .OnClientClick = "toRight(this.id);return false"; div.Controls.Add(myImageButton); } } </code></pre> <p>Javascript (Jquery):</p> <pre><code>function toRight(id) { $("#id").animate({ "left": "+=250px" }, "slow");}; </code></pre> <p>and nothing happens (with static controls it works).. So I think something with the ID goes wrong.. Hope u guys can help me ..</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
4,989,037
4,989,038
onItemSelected property of spinner in android
<pre><code>Spinner spin1 = (Spinner) findViewById(R.id.spinner1); spin1.setOnItemSelectedListener(this); spin2 = (Spinner) findViewById(R.id.spinner2); spin2.setOnItemSelectedListener(this); ArrayAdapter&lt;String&gt; choice1 = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, data1); choice1 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); choice2 = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, data2); choice2 .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); </code></pre> <p>In this code i am creating two drop downs and now my requirement is when i select the item from first combo the data in the second combo must be changed according to the selected item of first combo.</p> <p>now in onItemSelected property how to code specially for first dropdown?</p>
java android
[1, 4]
2,088,077
2,088,078
Restrict Keyboard Input jQuery
<p>How would you go about Restricting Keyboard Input on a textbox using Jquery?</p>
asp.net javascript jquery
[9, 3, 5]
2,896,002
2,896,003
How to export sqlite database as csv file in android?
<p>i am trying to print the content's in the table from the database .so i am trying to generate a csv file from database.. any inputs on how to do this always appreciated</p>
java android
[1, 4]
5,263,541
5,263,542
Dynamically change a image URL based on a variable
<p>I'm currently displaying a circle graph in a project I'm working on. I'm wanting to update the circle chart by changing the image URL that is displayed, there are 100 unique images each representing one percentage point on the chart. The URLs are set up in such a fashion img/circleGraph/circleG-12.png the number (in this case 12) being the percentage complete that the graph is showing. In JavaScript /jQuery how could I alter the URL that is displayed dynamically, based on a percentage I'm returned from the database?</p> <p>This is a .Net MVC application that I'm working on, so the percentage complete is returning back to me in a Razor variable as a decimal. I know I would have to multiply this variable by 100 in order to convert to a whole number and then set that as part of the URL, but am unsure on how to approach it. </p>
javascript jquery
[3, 5]
3,227,045
3,227,046
Javascript for running code-behind code when a button is clicked
<p>i have a popup that is getting displayed when Save button is clicked. The popup has 2 buttons. Yes and No. No should cancel the popup and yes should take you to function in the code-behind say, btnSave_Click(object sender, Eventargs e). How is it possible. Could someone help me, i am new to Javascript.</p> <p>Below is the code where i am showin the popup.</p> <pre><code>var mdlPopup = $find('&lt;%= ModalPopupExtendersavechanges.ClientID %&gt;'); if(mdlPopup) { mdlPopup.show(); } </code></pre>
c# javascript asp.net
[0, 3, 9]
5,526,623
5,526,624
How to go back to previous page in asp.net while retaining the previous page data
<p>I am having problem while using onclick="javascript:history.back();" with Aspnet. In the first page i filled some data and click search button it show some results, i click on particular result for its details which navigate to the 2nd page but when i click on custom back button it refresh the page and all data set to initial values,when i use onclick="javascript:history.back();" I get nothing but the page displays "webpage has expired." </p> <p>Thanks in advance!</p>
javascript asp.net
[3, 9]
2,898,015
2,898,016
Javascript: Insert link into Mouse right click?
<p>I'm wondering how would I include my function on my website inside a users right click? for example function <code>hello()</code> with Title <code>Hello</code> is an option when a user right clicks on my website.</p> <p><strong>edit:</strong> I simply wish to append to the current right click menu. Not make my own.</p>
javascript jquery
[3, 5]
4,581,526
4,581,527
Javascript - Select drop down element with target value
<p>I have a drop down box with values dynamically populated from a database. So, its HTML is somewhat like this:</p> <pre><code>&lt;select id="productclass"&gt; &lt;option value="1"&gt;Name1&lt;/option&gt; &lt;option value="7"&gt;Name2&lt;/option&gt; &lt;option value="11"&gt;Name11&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Where the id's and the names are pulled from the database.</p> <p>I need to be able to write JavaScript to select the option with a specific value. So, how can I make option #7 selected using JavaScript? I can use JQuery too if it's easier.</p>
javascript jquery
[3, 5]
467,622
467,623
In jQuery, is there a way to manually propagate an event onto a DOM object?
<p>I know the mouseenter is coded such that it propagates mouseover to all the elements within the DOM that it is bound to.</p> <p>So, like the question states, is there a way to manually apply this propagation to other elements that are separate from the DOM, which I bound the mouseenter event to.</p> <p>The function, $.stopPropagation(), stops the propagation but is there an applyPropagationTo like function?</p> <p><strong>Here is the scenario:</strong></p> <p>Say I have a div, class=divCON. I have a absolute positioned div appended to the body, called divHOV, which is hid. When I mouseenter divCON, divHOV becomes visible and follows my mouse when I am within divCON.</p> <p>I want it so that when my mouse is moving within divCON, the mouse tends to enter divHOV if the browser is slow to reposition the divHOV while moving the mouse. I want it so that I can propagate divHOV's mouseenter onto divCON so that a mouseleave event is not trigger when I go on divHOV.</p> <p>jsFiddle: <a href="http://jsfiddle.net/vuxcR/" rel="nofollow">http://jsfiddle.net/vuxcR/</a></p> <p>Note how when the mouse enters divHOV, it mouseleaves the divCON. I want it so that when it does not mouseleave divCON when I enter divHOV. </p>
javascript jquery
[3, 5]
5,991,520
5,991,521
Displaying of larger initial Image
<p>I am showing the first larger Image as the page loads, But I want to show the larger Images as I click on thumbnail image, initially I dont want to show any larger image as I load the page. only thumbnails should be shown initially.</p> <p>This is the tried link:</p> <p><a href="http://jsfiddle.net/L7yKp/37/" rel="nofollow">http://jsfiddle.net/L7yKp/37/</a></p>
javascript jquery
[3, 5]
3,533,642
3,533,643
List of RadioButtons on Android, Java
<p>I need create a list of RadioButtons, but if I try to do it with ListView than I can select all radiobuttons simultaneously, but I need 1 selected radiobutton simultaneously. Therefore, I can try this code:</p> <pre><code>RadioGroup group=new RadioGroup(this); LinearLayout layout=(LinearLayout)findViewById(R.id.linearLayout2); for (String item:mMusicData.keySet()) { RadioButton button=new RadioButton(this); button.setText(item); group.addView(button); } layout.addView(group); </code></pre> <p>But layout doesn't show all items, because layout is small. I need scrollbar or another mean for my task. Help me please. </p>
java android
[1, 4]
1,139,392
1,139,393
.hide/.show jumps to top of page or shows div name in url
<p>The <code>.hide</code>/<code>.show</code> functions jump to top of page with <code>return false</code>, but shows div name in url with <code>preventDefault</code>.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { //Default Action $(".ar-tab-content").hide(); //Hide all content $("ul.ar-tabs li:first").addClass("active").show(); //Activate first tab $(".ar-tab-content:first").show(); //Show first tab content //On Click Event $("ul.ar-tabs li").click(function() { $("ul.ar-tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".ar-tab-content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); }); &lt;/script&gt; &lt;ul class="ar-tabs"&gt; &lt;li&gt;&lt;a href="#ar-tab1" name="ar-tab1"&gt;Why you should join&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#ar-tab2" name="ar-tab2"&gt;What members are saying&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,012,160
4,012,161
jQuery form action change
<p>Normally to change the action attribute of a form in jQuery I would do the following:</p> <pre><code>&lt;form id="removeLightboxForm" action=""&gt; ... &lt;/form&gt; $('#removeLightboxForm').attr("action", "view/#close"); </code></pre> <p>But I usually use this for when the action attribute is empty on the HTML form tag itself. I'm now trying to use this on a form where the action attribute already contains a default URL and is causing problems.</p> <p>In this example, the form action is present:</p> <pre><code>&lt;form id="removeLightboxForm" action="view/"&gt; ... &lt;/form&gt; </code></pre> <p>But when I do this:</p> <pre><code>$('#removeLightboxForm').attr("action", "view/#close"); </code></pre> <p>I end up with the new URL/action being added to the original URL/action, for example:</p> <pre><code>&lt;form action="view/view/#close" ... </code></pre> <p>Is this how it's supposed to work or am I doing something wrong?</p>
javascript jquery
[3, 5]
3,809,472
3,809,473
`attr('checked', false)` not working on IE6
<p>As the title says, I can't get <code>.attr('checked', false)</code> to work on IE6. I am cloning some HTML and then before I assign the newly cloned HTML to a element, I run through it and un-check all of the checkboxes that are in the newly cloned section, which works fine in all browsers except IE 6. </p> <p>Here is the code:</p> <pre><code> //give each input and select a custom id clone.find('input, select').each( function( i ) { //get the id attribute var id = $(this).attr('id'); //uncheck all of the tick boxes $(this).attr('checked', ''); //get the name attribute var name = $(this).attr('name'); $(this).attr('name', name+"_"+count) $(this).attr('id', id+"_"+count+"_"+i) }); //append the newly created area to the area wrapper clone.appendTo('[data-custom="area_wrapper"]'); </code></pre> <p>Is there any way that I can work around this problem?</p>
javascript jquery
[3, 5]
4,113,649
4,113,650
How could I do the same thing using asp.net and jquery instead of php?
<p>The author in this screencast is using jquery to submit data to a database using php. The link is here:</p> <p><a href="http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-13/" rel="nofollow">http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-13/</a></p> <p>How could I do the same thing using asp.net and sql server 2005?</p>
php asp.net jquery
[2, 9, 5]
4,463,134
4,463,135
highlighting text according to output of a text to speech. in Asp.net c#
<p>i am trying to highlight words read by the text to speech but its not working. until now i made:</p> <pre><code> string startSpan = "&lt;span style=" + "background-color:Yellow" + "&gt;"; string endSpan = "&lt;/span&gt;"; //button onclick protected void speak_Hope(object sender, EventArgs e) { speaker.Rate = -4; speaker.SpeakAsync(announce.InnerText); speaker.SpeakProgress += new EventHandler&lt;SpeakProgressEventArgs&gt; (speaker_SpeakProgress); System.Diagnostics.Debug.WriteLine("processing"); } void speaker_SpeakProgress(object sender, SpeakProgressEventArgs e) { counter2 = e.CharacterPosition - 10; counter3 = e.Text.Length; counter4 = counter2 + counter3; System.Diagnostics.Debug.WriteLine(e.CharacterPosition - 10 + " next one" + e.Text); announce.InnerHtml = announce.InnerText.Substring(0, counter2) + startSpan + announce.InnerText.Substring(counter2, counter3) + endSpan + announce.InnerText.Substring( announce.InnerText.Length - 1); } </code></pre> <p>am i doing it right or is there any other way, can it be done in a javascript manner? thanks alot </p>
c# asp.net
[0, 9]
3,981,973
3,981,974
why can't we declare object of a class inside the same class in C++ but it is allowed in Java?
<pre><code>class A { A a;//why can't we do this in C++ but it is allowed in Java? }; </code></pre> <p>Using this <a href="http://stackoverflow.com/questions/4941629/why-cant-we-declare-object-of-a-class-inside-the-same-class">question</a>, i came to know why it is not allowed in C++ but why is it allowed in java? According to same argument of not knowing the memory size while compilation, it should not be allowed in Java as well.</p>
java c++
[1, 6]
5,955,320
5,955,321
Don't load the image until user scroll to there , possible?
<p>If I don't want the image to be downloaded from server , until user scroll to there , which event should I capture ? </p> <p>And how ?</p>
javascript jquery
[3, 5]
4,007,205
4,007,206
Can I send a string to a php file from my mobile Java app?
<p>I want to be able to send a parameter to a php page that contains a devices IMEI/MEID.</p> <p>I then want the php page to take that IMEI parameter and check a list of IMEI's to see if the IMEI sent as a parameter from my Java mobile app is contained in a database, if it is then return true.</p> <p>I only know the very basics of php but I believe this should be possible?</p> <p>If so can anyone point me in the right direction of what php functions I should be looking into?</p> <p>And also the best way to pass the parameter from java?</p>
java php
[1, 2]
1,540,066
1,540,067
JQuery - Collapsable DIV: Easy way to remember state of opened div?
<p>This is what I have for a simple collapsable div (opens/closes on click of a toggle button)</p> <pre> $(document).ready(function(){ $(".slidingDiv").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ $(".slidingDiv").slideToggle(); }); }); </pre> <pre><code>&lt;a href="#" class="show_hide"&gt;Show/hide&lt;/a&gt; &lt;div class="slidingDiv"&gt; Fill this space with really interesting content. &lt;a href="#" class="show_hide"&gt;hide&lt;/a&gt;&lt;/div&gt; </code></pre> <pre> .slidingDiv { height:300px; background-color: #99CCFF; padding:20px; margin-top:10px; border-bottom:5px solid #3399FF; } .show_hide { display:none; } </pre> <p>Now, the function works perfectly, but if I open the div and then navigate the page, the div obviously goes back to being closed on reload/clicking a link etc.. </p> <p>Is there an easy way to add a remembered state so that during the entire user experience the div remains open when he clicks to open it?</p>
php jquery
[2, 5]
5,976,469
5,976,470
Session gets time out frequently although i set timeout time in web.config
<p>Session gets time out frequently although i set timout time in web.config</p>
c# asp.net
[0, 9]
3,701,953
3,701,954
Jquery: run code when text is selected
<p>I have a HTML document which llokes like this:</p> <pre><code>&lt;div class="this_can_be_selected"&gt;Some text here&lt;/div&gt; &lt;div&gt;No text in the div above is selected&lt;/div&gt; &lt;div class="this_can_be_selected"&gt;Some text here&lt;/div&gt; &lt;div&gt;No text in the div above is selected&lt;/div&gt; &lt;div class="this_can_be_selected"&gt;Some text here&lt;/div&gt; &lt;div&gt;No text in the div above is selected&lt;/div&gt; </code></pre> <p>I want text <code>No text in the div above is selected</code> to be changed to <code>Some text in the div above is selected</code> when, guess what, some of the text in the div above is selected :)</p> <p>jQuery has a <a href="http://api.jquery.com/select/" rel="nofollow">.select() event</a>, that would make this rather easy to do, but seems, that it works when selected text is inside input or textarea.</p> <p>Here is a code that I've tried:</p> <pre><code>$(document).ready(function() { //Some text inside div is selected $('DIV.this_can_be_selected').select ( function() { alert('Something is selected!'); $(this).next().html('Some text in the div above is selected'); } ); } ); </code></pre> <p>Nothing is happening.</p> <p>Is there a way to solve this problem?</p>
javascript jquery
[3, 5]
4,164,486
4,164,487
What is the easiest way for a c# programmer to develop for i-Phone?
<p>Should I use Mono + c#? Or I'm better off learning and using objective c? Thanks</p>
c# iphone
[0, 8]
4,659,178
4,659,179
Android - 1 divided by 2 = 0
<p>I have been trying to use my new IOIO for android, and needed to find a frequency of a signal.<br> So I converted the signal to binary and then did 1 divided by the time between 1's. Although when I did this I found that I got 0 as my output. I then decided to see what 1 / 2 gave me, and to my surprise it also gave 0! Anyone have any idea why this is the case?</p> <p>Code: <code>private float frequency = 1/2;</code> </p> <p>Could this be todo with using <code>Float.toString(frequency)</code>?</p>
java android
[1, 4]
3,809,169
3,809,170
How to limit the visible items of dropdownlist, which is populated by DataSet
<p>I have a <code>DropdownList ASP control</code>, which is populating by <code>DataSet</code>.</p> <p>I am using <code>.net 3.5, c#.</code></p> <p>To control the height of DropDownList, i am using the following code and it is working.</p> <pre><code>&lt;asp:DropDownList size="1" onMouseOver="this.size=10;" onMouseOut="this.size=1;" style="display:none; position:absolute; width:150px;" runat="server"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p><strong>But it is flickering</strong> when clicking on it, means first it shows all values and again resized for 10, provided length of the control.</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,542,226
5,542,227
How to implement draft save using ckeditor/or any editor?
<p>I am integrating the ckeditor for the user to edit the content but i am wondering whether i can add the draft save function for it</p> <p>Actually, draft save is just saving a cookies for a period of time but not anything tricky?</p> <blockquote> <p>So is it no matter to use ckeditor or textarea or anything?</p> </blockquote> <p>The work i need to do is to :</p> <pre><code> $i = 0; while ($curfiletime &lt;15) { $COOKIES=$_POST['editor']; echo "draft saved"; } </code></pre> <p>But in this case i can not post it as the user hasn't submit the form, how can i implemnt it in php or js , jq?</p> <p>Thank you.</p>
php javascript jquery
[2, 3, 5]
4,175,295
4,175,296
Possible race condition when checking img.complete in Internet Explorer
<p>I've written a jQuery plugin that will execute a function before and after an image loads. Essentially this is so we can show a loading animation when displaying large images.</p> <pre><code>if (typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { return; // 1 } // 2 if (!this.complete) { options.preload(this); //3 $(this).load(function () { options.loaded(this); //4 }); } </code></pre> <ol> <li>Check for images that have failed to load (e.g.404). </li> <li>Check if the image has loaded <code>this.complete</code></li> <li>If not, call the preload function (starts the loading animation)</li> <li>Add the callback for the image <code>load</code> event (stops the loading animation)</li> </ol> <p>This works fine in Chrome and Firefox. However, in IE (9) I'm finding that sometimes the <code>preload</code> function fires, but not the <code>loaded</code> function.</p> <p>I suspect that this could be a possible race condition.</p> <p>What's the best way of handling this? Should I just check <code>this.complete</code> again after calling the preload function?</p> <p>Thanks</p> <p>Ben</p>
javascript jquery
[3, 5]
97,386
97,387
Best PHP validation with jQuery
<p>There are a lot of tutorials out there on how to make validation with php/jquery but they are all different... Which one is the best approach? Which one should I use? Which one is up to date? Works in every common browser, etc...</p> <p>I would like tips... links/tutorials etc on a jQuery validation (plugin) or whatever, that you use and WHY you use it.</p>
php jquery
[2, 5]
1,002,605
1,002,606
Bitmap getWidth returns wrong value
<p>I have a jpg image in my android application drawable folder which resolution is 1000x600. I load that image to bitmap like this</p> <pre><code> Bitmap bitMap = BitmapFactory.decodeResource(getResources(), R.drawable.image); </code></pre> <p>After this I call <code>bitMap .getWidth()</code> which returns 1500. How it can be? And how to get the right width and height of image?</p>
java android
[1, 4]
5,429,825
5,429,826
JavaScript, / jQuery determining if the URL contains a Min String
<p>Here's what I want to happen</p> <p>Anything the variable hash contains: #/projects/X</p> <p>X being anything other than blank, I want to fire an alert</p> <p>Fires Alerts</p> <pre> #/projects/X #/projects/X/boo/123/123/ads/asd/ads/ads </pre> <p>Does not fire an alert</p> <pre> #/projects/ </pre> <p>Suggestions?</p>
javascript jquery
[3, 5]
1,393,832
1,393,833
remember password after jquery post
<p>Here is code</p> <pre><code>&lt;script type='text/javascript'&gt; $("#focusform").submit(function(event) { event.preventDefault(); var $form = $( this ), usname = $form.find( 'input[name="name"]' ).val(), uspass = $form.find( 'input[name="pass"]' ).val(); if($('#chk').is(':checked')) var checked='yes'; else var checked='no'; $.post("/login/submit/", { name: usname, pass: uspass, checkbox: checked, template_framed:"yes",submit: "yes" }, function(data) { if(data=='error'){ alert("You have made an error"); return false; } else{ if(checked=='yes')window.location='/usercookie/'; else window.location='/login/success/'; return true; } }); }); &lt;/script&gt; </code></pre> <p>But browser doesn't want to promt whether save password or not. Cant't you help me?</p>
javascript jquery
[3, 5]
1,266,314
1,266,315
window.scrollTo weirdness inside Android webview
<p>I'm having a weird issue when I use window.scrollTo(0, document.body.scrollHeight) to scroll to the bottom of a page (loaded inside an Android webview). There's a huge gap of whitespace at the bottom of the page (it disappears when the page is tapped). Does anyone have any advice? Thanks.</p> <p><img src="http://i.stack.imgur.com/nG5W3.png" alt="enter image description here"></p>
javascript android
[3, 4]
2,420,882
2,420,883
does not contain using jquery
<p>Below is the function that I am using in jquery</p> <pre><code>function addlnkfieldmkAndyr() { var mymke = $('h3:contains("Make")'); var mymkeVal= $('h3:contains("Make")').closest("td").next(); var myyr= $('h3:contains("Year")'); var myyrVal= $('h3:contains("Year")').closest("td").next(); } </code></pre> <p>The problem that is there is another field with the name as <code>MakeandYear</code> , so <code>mymkeVal</code> and <code>myyrVal</code> are getting the values from <code>MakeandYear</code> instead of just <code>Make</code>.</p> <p>I would like to say </p> <pre><code>string.Contains("Make") &amp;&amp; !string.Contains("MakeandYear). </code></pre> <p>How do I do that in jquery , please help!</p>
javascript jquery asp.net
[3, 5, 9]
4,441,364
4,441,365
How can we do overloading in php?
<p>In java we call it overloading when we define two methods with different numbers of arguments.How do we do it in php or javascript where number of parameters passed need not be equal to arguments defined.</p>
php javascript
[2, 3]
68,765
68,766
Unable to receive the data (recv in cpp) put into socket(write() in java)
<p>I'm new to socket programming so as to test some cases I'm using a java side client to send integer data through socket and I want ot receive that data on the server side in cpp.</p> <p>My code on client side (java) looks like</p> <pre><code>out=new DataOutputStream(s.getOutputStream()); ar=1; le=1; out.writeInt(ar); out.flush(); out.writeInt(le); out.flush(); </code></pre> <p>and im using recv function in cpp to receive this data. the code on cpp side looks like</p> <pre><code> if (int(recv(acceptFD, &amp;number, sizeof(int), 0)) != sizeof(int)) { ALOGE ("error reading on socket: number of Args: %d,reutrned value =%d\n",number); return; } for (int i = 0; i &lt; number; i++) { int len; if (recv(acceptFD, &amp;len, sizeof(int), 0) != sizeof(int)) { ALOGE ("error reading on socket: Len of Args: expected length :%d\n",len); freeDebugCallbackArgs(i, args); return; } </code></pre> <p>and its showing the log as</p> <blockquote> <p>E/RILC ( 235): error reading on socket: number of Args: 16777216, returned value =-1073741824 E/RILC ( 235): error reading on socket: Len of Args: expected length :1075093557</p> </blockquote> <p>It would be a great help if someone posts an answer to this. Thank you</p>
c# java android
[0, 1, 4]
2,206,696
2,206,697
.show() not working on document ready
<p>I'm triggering a onchange event that i have on a textbox when the page loads</p> <pre><code>$(document).ready(function () { $("input[id$=dpDeliveryDate]").each(function () { $(this).get(0).onchange(); }); }); </code></pre> <p>This gets fired correctly and is calling a function I have created.</p> <p>If I put in alerts into this function it will alert on the page loading correctly. So I know its calling the function just fine! but does not do the rest of the commands in the function</p> <p>Also if after the page loads I change the textbox value it also fires correctly this time doing all the commands correctly in the function..</p> <p>THe function basically needs to do</p> <pre><code> $(this).parent().next().next().show(); </code></pre> <p>So I cannot work out why it works onchange but not when onchange is triggered from the document.load?</p>
javascript jquery
[3, 5]
1,325,444
1,325,445
error type or namespace name profilecommon could not be found
<p>When I compile this code, It show me this kind of error type or namespace name profilecommon could not be found. Could someone help me how to solve this?</p> <pre><code>case "Profile": ProfileCommon pc = Profile.GetProfile(user.UserName); DropDownList3.Items.Clear(); foreach (SettingsProperty p in ProfileCommon.Properties) { DropDownList3.Items.Add(p.Name); } MultiView1.ActiveViewIndex = 4; break; } </code></pre>
c# asp.net
[0, 9]
4,963,156
4,963,157
Post value pairs from jQuery to php file and save data in database
<p>I have two html text input fields and two buttons.</p> <p>The first button saves the value pairs from the two input fields in an array. The second button sends this array with all the input value pairs to a php file and the php file saves all these values in a database. The user can input values so much as he can, there is no limit.</p> <pre><code>&lt;input type="text" id="field1" name="field1" /&gt; &lt;input type="text" id="field2" name="field2" /&gt; &lt;button id="notizeValues"&gt;Notize&lt;/button&gt; &lt;button id="sendToServer"&gt;Save&lt;/button&gt; </code></pre> <p>My question is, how can the server access this data? I am trying this:</p> <pre><code>var values = []; $('#notizeValues').click(function (){ var value1 = $('#field1').val(); var value2 = $('#field2').val(); values.push({'value1': value1 , 'value2': value2 }); }); $('#sendToServer').click(function (){ var sendValues = values; $.post("achieveAdminAktion.php",{values: sendValues }, function(data){ $("#serverResponse").html(data); }); }); </code></pre> <p>Now comes the code of the php file, but I get the whole time errors. For this solution I get an Warning: <code>json_decode() expects parameter 1 to be string, array given</code> and errors in echo function:</p> <pre><code>isset($_POST['values']){ $values = json_decode($_POST['values'], true); foreach ($values as $json) { ....save value in database.... } echo $values; // nothing } </code></pre> <p>That is only one example of lot of examples I tried but nothing works. How can I solve this problem? How can I access these data in php file and how can I walk through the json-array and save al these value pairs in database.</p>
php jquery
[2, 5]
1,106,719
1,106,720
Best way from PHP to ASP.net?
<p>What all is involved if I wanted to switch from PHP to asp.net? I have basicly no knowledge of asp or other languages besides php and some javascript. </p> <p>What would be the best place to start learning more?</p> <p>What is needed to host an asp site?</p> <p>What is it developed with?</p> <p>Is there an equivalent to php.net for a resource?</p>
php asp.net
[2, 9]
772,854
772,855
How to write url rewriting for [mywebsitename].com/pages/224?task=5 in asp.net
<p>I have written code required for url rewriting of </p> <pre><code>[mywebsitename].com?type=pages&amp;id=22 </code></pre> <p>as </p> <pre><code>[mywebsitename].com/pages/224. </code></pre> <p>Now my question is, can i use </p> <pre><code>[mywebsitename].com/pages/224?task=5 </code></pre> <p>so that i can use </p> <pre><code>Request.Querystring["task"] </code></pre> <p>in my code?</p>
c# asp.net
[0, 9]
839,925
839,926
jQuery delay does not seem to give the correct delay for this kind of event
<p>I had some help today with a need and this is what I have come up with:</p> <pre><code> $(window).keypress(function (e) { if (e.keyCode == 13) { $('#doCheck') .css('color', '#666') .delay(100) .queue(function (next) { $(this).css('color', '#00ff00'); next(); }); doCheck('mark1'); } &lt;input id='doCheck' type="button" onclick="doCheck('mark1'); return false;" value="Mark" /&gt; </code></pre> <p>The idea here is that when a user presses the ENTER key then the color of the button will change color for 100 milliseconds and at the same time I call a function called doCheck that will call AJAX.</p> <p>My problem is that there seems to be some minimal delay of almost a second before the color of the button changes back to #666. I expect a much shorter time but even if I set the delay to 10 then it still seems to delay for 1/2 to one second. I should add that if I set a long delay like five seconds then it really does do the five seconds.</p> <p>I can't see what's wrong here. </p> <p>Does anyone have any ideas? </p> <p>thanks,</p> <p>Here is the doCheck function. The function works correctly. Just the button thing is giving me problems. Note that I just changed it to async: true </p> <pre><code>function doCheck(task) { var parms = { task: task, pk: $('#Q_PartitionKey').val(), rk: $('#Q_RowKey').val(), }; $.ajax({ type: "POST", traditional: true, url: '/power/check', async: true, data: parms, dataType: "json", success: function (data) { // $('#doCheckMark').attr("disabled", false); // $('#doCheckMark').css("color", "#000"); }, error: function () { var cdefg = data; } }); } </code></pre>
javascript jquery
[3, 5]
4,678,080
4,678,081
How to changed a part of URL in embeded code from youtube by Query String
<p>I'm programming on ASP.NET with C#. I want to know how to change a part of URL in embed code from youtube by Query String. for example </p> <pre><code>&lt;iframe width="560" height="315" src="http://www.youtube.com/embed/**5CZobYTEwaY**" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt; </code></pre> <p>I want to receive the variable of video by query string and insert instead of <strong>5CZobYTEwaY</strong>.</p> <p>I will be very thankful if anybody help me.</p>
c# asp.net
[0, 9]
525,595
525,596
merge 2 classes into one class at runtime
<p>suppose i have Class A with some properties and Attributes, and Class B with the same, how can i merge these 2 class Properties and properties Attributes into 1 class at runtime, or better is how can i add these 2 classes into a a third class as properties of this new class with their Fields, Properties, Methods, etc... at Runtime ? </p> <p>using reflection or the News .NET 4.0 Dynamic or expando Object</p> <p><strong>Edit</strong>: Damn i am sorry to all for not being clear, what i want is to create a dynamic ViewModel for MVC, where other classes are in some other assemblies, and i want them to be part of the model with their Datavalidation attributes. and i don't know how many or what exactly these classes are goanna be, so i want to iterate through assemblies and choose them then add them to the main View Model</p> <p>thanks in advanced</p>
c# asp.net
[0, 9]
5,966,868
5,966,869
How Close is the Javascript Math.Round to the C# Math.Round?
<p>I know from reading <a href="http://stackoverflow.com/questions/977796/in-c-math-round2-5-result-is-2-instead-of-3-are-you-kidding-me">this Stackoverflow question</a> that the complier will look at your number, decide if the midpoint is an even or odd number and then return the even number. The example number was 2.5 which rounded to a 3. I've tried my own little experiments to see what happens, but I have yet to find any specifications about this, or even if it would be consistant between browsers.</p> <p>Here's an example javascript snippet using JQuery for the display:</p> <pre><code> $(document).ready(function() { $("#answer").html(showRounding()); }); function showRounding() { var answer = Math.round(2.5); return answer; } </code></pre> <p>This returns a '3'.</p> <p>What I would like to know is this: How close is the rounding in javascript to the the C# equivalent? The reason I'm doing this is because I would like to take a Javascript method that uses Math.Round and rewrite the same method into C# and would like to know that I would be able to get the same results after rounding a number.</p>
c# javascript
[0, 3]
316,661
316,662
How to get screen resolution of a client system by using JavaScript
<p>I am developing a website,my webpage consist of many products. on clicking over a product i must show the details of that product in popup window.For setting the popup window to full window, i want to get client system resolution, so that it may easy to show the popup window in full screen according to resolution. Can any one please help me to sort a way to solve this problem by using JavaScript or any other method.</p> <p>Thanks in advance... </p>
c# javascript asp.net
[0, 3, 9]
1,318,758
1,318,759
jQuery code critque
<p>Thought I'd post here. My first hour on jQuery, actually first programing ever done. Would love to learn whats not right and how it could be better.</p> <pre><code>$(function() { function hide_me() //A place to specify which elements you want hidden, on page load. { $("li.credentials").hide(); } function first_bow() //The div right_column takes a bow on initial load. { $("div#right-column").show("drop"); } function bigpeek() //The third column toggles in/out. All elements under div right_column. { $("div#right-column").toggle("drop", "fast"); } function smallpeek() //Smaller snippets like credentials or user assignment flying in/out. { $("li.credentials").toggle("drop", "fast"); } $(document).ready(function() { $("*").ready(hide_me); $("*").ready(first_bow); $(".btn-new-email").click(bigpeek); $(".button").click(smallpeek); $(".icon-delete").mouseover(function() { $(this).effect("bounce", "fast"); }); }); }); </code></pre>
javascript jquery
[3, 5]
2,547,891
2,547,892
c++ from javascript
<p>I need to call a c++ function from the javascript. Please somebody hlp..</p>
javascript c++
[3, 6]
2,099,391
2,099,392
Get ID of a Clicked Link
<p>In the code below and demo here <a href="http://jsfiddle.net/jasondavis/vp2YN/3/" rel="nofollow">http://jsfiddle.net/jasondavis/vp2YN/3/</a> you can see I need to get the ID attribute of a clicked item and assign it to a variable in Javascript.</p> <p>Right now the code returns the ID name of the first item, regardless of which item is clicked on.</p> <p>In the Javascript you can see I have this line commented out...</p> <p><code>var clickedID = this.attr("id");</code> when I use that line, I get an error saying: <code>Object has no method 'attr'</code></p> <p>Please help me get the ID name of the clicked link and assign it to a variable </p> <p>HTML</p> <pre><code>&lt;a href="#" style="display:block" class="button insertcolumn" id="one_half"&gt;2 Columns&lt;/a&gt; &lt;a href="#" style="display:block" class="button insertcolumn" id="one_third"&gt;3 Columns&lt;/a&gt; &lt;a href="#" style="display:block" class="button insertcolumn" id="one_fourth"&gt;4 Columns&lt;/a&gt;​ </code></pre> <p>Javascript/jQuery</p> <pre><code>jQuery('.insertcolumn').click(function(){ var clickedID = jQuery('.insertcolumn').attr("id"); //var clickedID = this.attr("id"); alert(clickedID); });​ </code></pre> <p>Demo <a href="http://jsfiddle.net/jasondavis/vp2YN/3/" rel="nofollow">http://jsfiddle.net/jasondavis/vp2YN/3/</a></p>
javascript jquery
[3, 5]
1,391,463
1,391,464
How can I call code behind fuction from Javascript
<p>I want to set permissions after Group is added, So my logic is once user add Group, I want to prompt them Confirm box asking (" Do you like to assign permissions to Group?") if yes, I want to call ModalPopupExtender with Permission otherwise nothing. How can I perform this?</p> <pre><code>protected void ListView1_ItemInserted(object sender, ListViewInsertedEventArgs e) { if (e.Exception == null) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "Confirm('Do you like to Give permission to this User?')", true); } } </code></pre> <p>Is there anyway to do same task?</p>
javascript asp.net
[3, 9]
5,149,728
5,149,729
How to use javascript variables in jquery selectors
<p>How do I use the javascript variables as a parameter in a jquery selector?</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $("input").click(function(){ var x = $(this).attr("name"); $("input[id=x]").hide(); }); }); &lt;/script&gt; &lt;input type="text" id="bx"/&gt;&lt;input type="button" name="bx"/&gt; &lt;input type="text" id="by"/&gt;&lt;input type="button" name="by"/&gt; </code></pre> <p>Basically what I want to do is to be able to hide the element which has id that is equal to the name of the element that is being clicked.</p>
javascript jquery
[3, 5]
911,976
911,977
About binding record to gridview from 2 tables in asp.net c#
<p>I have one gridview. I have one table(source) that contains fields like sourceid, name and another table(target) that contains fields like targetid, from, to,date. In that target table from &amp; to fields are ids refer to source table's sourceid's. So i have to bind record of target table i.e to bind fields : from - here name should come respect to that source id from source table to - here name should come respect to that source id from source table date should come from target table.</p> <p>How i can do this? Asp.net c#</p> <p>Thank you.</p>
c# asp.net
[0, 9]
4,155,814
4,155,815
inline to handle url redirect
<p>I am migrating a site from siteA.domain.com to siteB.domain.com. All the page paths remain the same. The problem is it's a gradual migration, and not every path is being migrated at the same time. So what I need to do is check the path the user is going to, and if it's a member of a list of migrated sites, then redirect the user from siteA.domain.com/path to siteB.domain.com/path</p> <p>I was hoping to add in-line c# code to the master page. Any thoughts/examples of this? </p>
c# asp.net
[0, 9]
1,007,390
1,007,391
JQuery find not working for tr element?
<p>Just wondering if anyone knows why the following code doesn't work (each() is not executed at all)...it works if i try td elements but not tr elements for some reason?</p> <p>The html is returned by a php script and looks like</p> <pre><code>&lt;tr class="my_files_row"&gt;&lt;td&gt;bla&lt;/td&gt;&lt;td&gt;bla&lt;/td&gt;&lt;/tr&gt; function update(html) { $(html).find('tr').each(function() { alert('success'); }) } </code></pre> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
3,009,102
3,009,103
JQuery, how to access click object after ajax call?
<p>this seems like it should be straightforward, but I'm having trouble getting it to work.</p> <p>I have a .click bind to many buttons of a certain class. When that button is clicked, it passes its id to a $.post call for processing.</p> <p>When the $.post call returns successfully, I'd like to remove the button and add a message to the container, but I can't seem to even access the button at that point.</p> <p>Here is the .click bind:</p> <pre><code>$('.button').click(function() { $.post('process.php', { action: 'checkit' }, function(result) { if (result == 'win') { // Access the button that was pressed with jQuery } else { alert("fail"); } }); }); </code></pre> <p>I've tried, $(this), this, and also setting a variable like var trigger=this as I enter the initial click function, but none of these are working. I get undefined, or it points to the actual JQuery object, not the button.</p> <p>Does anyone have any insight into how I can access the button that was clicked at that point, using a jQuery wrapper, essentially something like $( <em>triggered button</em> ).html() so that I can manipulate the correct button?</p> <p>Thanks for your time.</p>
javascript jquery
[3, 5]
3,041,607
3,041,608
"super of super" in extented classes (alter variable in super class of super class)
<p>The question is more Java, but I want to implement it in Android:</p> <p>Suppose there are 3 or more classes extending each other:</p> <pre><code>class A { ... int color; ... } class B extends A { ... } class C extends B { ... // I want to alter color of class A inside here } </code></pre> <p>Is this possible without setting a <code>super.color = 4</code> in <code>C</code> and setting another <code>color=4</code> and <code>super.color = 4</code> in <code>B</code>??</p> <p>e.g. is it possible to write something like <code>super(super(color=3))</code> within class C ?</p>
java android
[1, 4]
5,271,637
5,271,638
Using "this" from event handler in jquery
<p>I have the following javascript code found also in this fiddle: <a href="http://jsfiddle.net/periklis/k4u4c/" rel="nofollow">http://jsfiddle.net/periklis/k4u4c/</a></p> <pre><code>&lt;button id = "element_id" class = "myclass"&gt;Click me&lt;/button&gt; &lt;script&gt; $(document).ready(function() { this.myfunc = function() { console.log('Hello world'); } this.myfunc(); $('#element_id').select('.myclass').bind('click', function() { this.myfunc(); //Obviously this doesn't work }); }); &lt;/script&gt;​ </code></pre> <p>How can I call this.myfunc() when the element is clicked? I don't want to define the myfunc() in the global space.</p> <p>Thanks as always</p>
javascript jquery
[3, 5]
2,675,405
2,675,406
Javascript: check if window.fullScreen is false then open url in new window in full screen
<p>I have written a javascript on page load that</p> <pre><code>if(!window.fullScreen) window.open(document.URL,'','fullScreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');} </code></pre> <p>but window.fullScreen always come false so it keep opening window.</p> <p>any other way to check if window is in full screen mode or not?</p> <p>Thanks</p>
javascript asp.net
[3, 9]
1,838,590
1,838,591
jQuery ajax post dynamic url insertion
<pre><code>$.ajax({ type: "POST", url: "OMFG.php", data: info, success: function(){ }}); </code></pre> <p>is what I'm using atm as a test and it works fine. </p> <p>I need to get the url from the link I'm clicking, so I do:</p> <pre><code>var url = $(this).attr("href"); </code></pre> <p>which works fine if I alert it out(the link includes <a href="http://samedomain.com/etc.php" rel="nofollow">http://samedomain.com/etc.php</a>), but the ajax function doesn't post if I insert it into the ajax code:</p> <pre><code>$.ajax({ type: "POST", url: url, data: info, success: function(){ }}); </code></pre> <p>Please help, as I'm screwed without this working.</p>
php jquery
[2, 5]
4,665,791
4,665,792
android-php ,response is triggered twice sometimes
<p>I am using json response which connects to <a href="http://example.com/test.php" rel="nofollow">http://example.com/test.php</a> I receive response in the listview and its all good,but sometimes the php is triggered twice , eg: if has mail() function inside it sends once but rarely sends it twice ,I cannot predict when that is happening ,Is it because it does not contain session_start() or is it some other reason? The php has just mail() function.</p> <p>Thanks in advance.</p>
php android
[2, 4]
4,744,496
4,744,497
No DataTypeConverter Method option in android
<p>I want to use <strong>DataTypeConverter.printBase64Binary(.........)</strong> in my project. But there is no option coming through intellisense. Am i missing some jar ? </p>
java android
[1, 4]
3,951,679
3,951,680
Toggle span elements in div on hover
<p>I am still relatively new to jQuery and am trying to hide the text I have contained in a few spans within a div on a hover, then show them again on a hover out. I feel like it it something relatively easy to do, I just havent had much success. Thank you!</p> <pre><code>$(".resultBox").hover(function() { // Perform actions only if targeted result box it is not enlarged if($(this).height() === RESULTBOX_DEF_HEIGHT &amp;&amp; $(this).width() === RESULTBOX_DEF_WIDTH) { // Toggle the highlight class matching the target box var targetBoxId = $(this)[0].id; $(this).toggleClass(targetBoxId + "BoxHighlight"); // Hide all text in the spans within this box } }); </code></pre>
javascript jquery
[3, 5]
5,957,102
5,957,103
Make lingering hover repeat action in jQuery
<pre><code>$('#test').hover( function () { $(this).append('Blah'); } ); </code></pre> <p>How can I make the jQuery repeatedly append <code>Blah</code> in <code>#test</code> based on how long you are hovering over <code>#test</code>?</p> <p>For instance, how can I append <code>Blah</code> once every second you are hovering over <code>#test</code>?</p>
javascript jquery
[3, 5]
5,049,610
5,049,611
Populate dropdown select with array-with multiple options- using jQuery
<p>So I'm trying to populate a dropdown with the states, the value for the option should be the two characters value, and the text for the option should be the full state's name, using the code below is returning a value of 0,1,2,3... and returning all the options in the var as the text.</p> <pre><code>var states = ["Select State","","Alabama","AL","Alaska","AK","Arizona","AZ","Arkansas","AR",...]; $.each(states, function(val, text) { $('#selector').append( $('&lt;option&gt; &lt;/option&gt;').val(val).html(text) ) }); </code></pre>
javascript jquery
[3, 5]
3,812,378
3,812,379
Android WeekView Calendar with google sync
<p>Hi i'm new to Android development. I'm facing a problem in getting the <code>WeekView</code> and <code>DayView</code> in <code>Calendar</code> with functionality and also sync with the <code>Google Calendar</code>. I want those in this format.</p> <p>How should it be done?</p>
java android
[1, 4]
2,018,779
2,018,780
Need advises how to make authentication in asp.net
<p>Im developing asp.net c# web site where i want to make user authentication. without any roles or something. </p> <p>i have database with user table where i store all user data, this table have relationship with many other tables.</p> <p>I like asp.net from authentication controls, but problem is that it have her custom database lots of tables, views and stored procedures, i need more simpler solution for my problems. All i want is to make secure remember me and any time check if user is logged in and get user name or id. Of course i tried custom relationship provider but i could not changed asp users table to my user table .</p> <p>So I just need secure remember me function and to get user id any time.</p>
c# asp.net
[0, 9]
3,163,887
3,163,888
browser history for Selectable (jQuery UI)
<p>How can I keep open seletable item when I go to the other pages? When I come back I want it is already open last one, whether when I reload page or come throught "previous page" (browser history). <strong>ui-state-active</strong> is set to item which is currently open. </p>
javascript jquery asp.net
[3, 5, 9]
1,967,596
1,967,597
How to replace document.getElementById('file-uploader') with jQuery?
<p>How to replace <code>document.getElementById('file-uploader')</code> with jQuery?</p> <p>just </p> <pre><code>var myElement = document.getElementById('file-uploader'); </code></pre> <p>into jQuery expression?</p> <p>Thanks!!!</p>
javascript jquery
[3, 5]
3,078,925
3,078,926
how to get wrap text using div tag?
<p>I need to get the "wrap text" in div tag, here is what I'm using: </p> <pre class="lang-html prettyprint-override"><code>&lt;div style="width:650px;height:200px;overflow-y:scroll;display: inline-block; writing-mode:lr-tb; word-wrap:break-word;white-space:normal;"&gt; &lt;asp:Label ID="bodyLabel" runat="server" Text=""&gt;&lt;/asp:Label&gt; &lt;/div&gt; </code></pre> <p>Can any one please suggest me how to implement this.</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
2,996,247
2,996,248
Determine if aspx page was opened by a window.open() command
<p>Is there a way to determine in the child page's code behind that is was opened by the window.open() javascript command from the parent page?</p> <p>The pop-up page contains a user control that is used by other pages that are not spawned from a window.open() command and I want to dynamically add functionality to close the page after the user has completed their task in the child page.</p> <p>It is an ASP.NET C# 3.5 application. </p>
c# asp.net javascript
[0, 9, 3]
3,202,109
3,202,110
Clone Table Output and Display In Popup With Jquery
<p>This might be fairly simple. I have a table that I generate dynamically with php/mysql lets just say for example;</p> <pre><code>&lt;table id="mytable"&gt; &lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;6&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;7&lt;/td&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;9&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I want to copy the entire html of this table, so that I can display it on another page in php. How would I go about doing this? Could I store the html in a php session somehow?</p> <p>Any help is appreciated, thanks!</p>
php jquery
[2, 5]
237,718
237,719
Android app that already exists on iphone
<p>Can I develop an android app that already exists on iphone market(not by me of course). This is basically stealing the idea, but is this legal?</p> <p>What do i need to check and where. Thanks in advance.</p>
android iphone
[4, 8]
2,267,071
2,267,072
How To Override Datalist To Be Rendered Into Divs Instead Of Table?
<p>i want to render datalist to divs instead of table, and the repeat columns will fixed by float style on div.</p> <p>so any one know a an override render method do that.</p> <p>Thanks</p>
c# asp.net
[0, 9]
426,635
426,636
Android - crash during phone orientation in asynctask
<p>When orientation of phone changes during loading of images from sdcard the application crashes due to</p> <pre><code>java.lang.RuntimeException: An error occured while executing doInBackground() </code></pre> <p>I am using the code from <a href="http://mihaifonoage.blogspot.com/2009/11/displaying-images-from-sd-card-in.html" rel="nofollow">http://mihaifonoage.blogspot.com/2009/11/displaying-images-from-sd-card-in.html</a></p> <p>can any one Please help me</p>
java android
[1, 4]
4,168,999
4,169,000
Determine distance from the top of a div to top of window with javascript
<p>How do I determine the distance between the very top of a div to the top of the current screen? I just want the pixel distance to the top of the current screen, not the top of the document. I've tried a few things like <code>.offset()</code> and <code>.offsetHeight</code>, but I just can't wrap my brain around it. Thanks!</p>
javascript jquery
[3, 5]
1,312,445
1,312,446
Use for loop with if and else
<p>I have a situation where I have to do some thing like this</p> <pre><code>for (int i = 0; i &lt; list.size; i++) //Master for loop { //I need a control statement here to control list1 i.e. only if statement if (time == list1.get(someInteger)) { //do something } else { //do something else } } </code></pre> <p>But every "if" should be followed by an "else", and I don't seem to understand how to go about it. Ive tried do and while but to no avail. For me it is important to execute both if and else, yet have a control statement for only "if". </p> <p>Is that possible?</p>
c# java android
[0, 1, 4]
4,682,946
4,682,947
changing value in javascript object iterated using jquery
<p>OK So I have this piece of code :</p> <pre><code>var el = {a:"b","isSel":true}; $.each(el,function(k,v){ if(k=="isSel"){ v=false } }) console.log(el); </code></pre> <p>but that doesn't change isSel to false... any clues?</p>
javascript jquery
[3, 5]
2,751,981
2,751,982
Signal device with high frequency sound
<p>We are working on a mobile application for shopping.<br/> Is it possible to find a signal device that can pop up a notification when the user who's using the application enters a store?<br/> The mobiles are mainly <strong>Android</strong> and <strong>iPhone</strong>.<br/> Thank you.</p>
android iphone
[4, 8]
1,127,556
1,127,557
.NET Get logged in user
<p>My problem is that I have a asp.net solution that uses a seperate project for logging and now I want the log to save the logged in user. Windows authentication is used for the webapp and the app pool is run under a service account. So when I call the logger through a method(static) I want the logger to pick up who is the logged in user. The only thing I currently get is the service account that the app pool run under.</p> <p>Any ideas of how to get the user from the webapp?</p>
c# asp.net
[0, 9]
1,887,579
1,887,580
How to handle a silent SEND intent with a headless activity
<p>Just as the user who asked this: <a href="http://stackoverflow.com/questions/3320930/how-does-the-default-browser-on-android-send-send-intents">How does the default browser on Android send &quot;SEND&quot; intents?</a>, I want my Android app to process a silent send. I implemented the proposed solution, a headless activity that never calls setContentView():</p> <pre><code>public class IntentMgrAct extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // setContentView explicitally ommited Toast.makeText(getApplicationContext(), "Message sent", Toast.LENGTH_LONG).show(); } } </code></pre> <p>When other apps send the intent to my "dumb" activity, it shows up behind the toast, but all I want is the toast. I tried to hide the headless activity with finish() after Toast.makeText and does the trick, but there is a noticeable flicker. How can I prevent the the activity from showing up?</p>
java android
[1, 4]
4,957,114
4,957,115
Cannot use document javascript object when running from Java
<p>I have the following javascript code that runs from java:</p> <pre><code>var doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html', null); doc.documentElement.innerHTML = xmlResponse; </code></pre> <p>And I get the following error:</p> <pre><code>Caused by: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "document" is not defined. (&lt;Unknown source&gt;#13) at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3773) at sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3751) at sun.org.mozilla.javascript.internal.ScriptRuntime.notFoundError(ScriptRuntime.java:3836) at sun.org.mozilla.javascript.internal.ScriptRuntime.name(ScriptRuntime.java:1762) at sun.org.mozilla.javascript.internal.Interpreter.interpretLoop(Interpreter.java:1790) at sun.org.mozilla.javascript.internal.Interpreter.interpret(Interpreter.java:854) at sun.org.mozilla.javascript.internal.InterpretedFunction.call(InterpretedFunction.java:164) at sun.org.mozilla.javascript.internal.ContextFactory.doTopCall(ContextFactory.java:429) at com.sun.script.javascript.RhinoScriptEngine$1.superDoTopCall(RhinoScriptEngine.java:116) at com.sun.script.javascript.RhinoScriptEngine$1.doTopCall(RhinoScriptEngine.java:109) at sun.org.mozilla.javascript.internal.ScriptRuntime.doTopCall(ScriptRuntime.java:3163) at sun.org.mozilla.javascript.internal.InterpretedFunction.exec(InterpretedFunction.java:175) at sun.org.mozilla.javascript.internal.Context.evaluateReader(Context.java:1159) at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:210) ... 16 more </code></pre> <p>Do you have any clue of how to solve it?</p>
java javascript
[1, 3]
4,056,564
4,056,565
Acessing php variable using jquery
<pre><code>&lt;script&gt; $(document).ready(function(){ &lt;?php echo 'var timeLeft = 12796;'; ?&gt;; console.log(timeLeft); }); &lt;/script&gt; </code></pre> <p>How is jquery acessing the php variable because to create a php variable we use $ and here it is using var?</p> <p>Now how can i correct the below code because its showing me error in the console? <pre></p> <code>&lt;script&gt; var currentDate= &lt;?php echo 'strtotime("now")' ; ?&gt;; console.log(currentDate); &lt;/script&gt; </code></pre> <p>Here i am using strtotime function instead of simple echoing a numbe</p>
php jquery
[2, 5]
1,038,122
1,038,123
c# public string pass into function
<p>I have the code below and am trying to access the 'text' string in the lnkSave_Click function, but text doesn't seem accesible from lnkSave_Click function, it always seems empty.</p> <pre><code>private string _text = ""; public string text { get { return _text; } set { _text = value; } } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { text = "Hello World!"; } } protected void lnkSave_Click(object sender, EventArgs e) { if (text == "Hello World!") { ... do things.. } } </code></pre>
c# asp.net
[0, 9]
3,779,449
3,779,450
Give PHP value into Javascript in same page
<p>How can I give the ID value to Javascript in same page.</p> <p>Example data :</p> <pre><code>&lt;a href="" id="ctextarea&lt;?php echo $uid; ?&gt;"/&gt; </code></pre> <p>JS :</p> <pre><code>function recountss() { var maxlen=280; var current = maxlen-$('#ctextarea').val().length; $('.counters').html(current); if(current&lt;0 || current==maxlen) { $('.counters').css('color','#D40D12'); $('input.comment_button').attr('disabled','disabled').addClass('inact'); } else if (!$.trim($("#ctextarea").val())) { $('input.comment_button').attr('disabled','disabled').addClass('inact'); } else $('input.comment_button').removeAttr('disabled').removeClass('inact'); if(current&lt;10) $('.counters').css('color','#D40D12'); else if(current&lt;20) $('.counters').css('color','#5C0002'); else $('.counters').css('color','#C0C0C0'); } </code></pre> <p>I tried using get class, but it's effect for 1 data not for many data. Have idea ?</p> <p>Thanks.</p>
php javascript jquery
[2, 3, 5]
3,844,158
3,844,159
How to display text in a textbox using jQuery and another textbox?
<p>I have a form, where there are three fields: Title, Slug, and URL.</p> <p>I have a plugin that converts the text entered in the Title field as a slug. (For example, if I type "Joe Bloggs Goes On Holiday" would then display as "joe-bloggs-goes-on-holiday" in the slug field).</p> <p>What I need to do now, is get the information in the slug field and add it to my URL field. In the URL field, there already is text (usually "/mainpage/" but this will depend on what type of page is being created). So in the URL field I would then have "/mainpage/joe-bloggs-goes-on-holiday".</p> <p>How can I achieve this?</p> <p>Cheers</p>
javascript jquery
[3, 5]
4,795,761
4,795,762
User control that returns formated text
<p>I am looking for a way to return some formatted text via a user control in ASP.NET C#. This is basically what I am looking for:</p> <p>Call a user control such as</p> <pre><code>&lt;mycontrol:formatedtitle id="blah" runat="server"&gt;Text to format&lt;/mycontrol:formatedtitle&gt; </code></pre> <p>And then have it return some formatted HTML such as</p> <pre><code>&lt;div class="blah"&gt;Text to format&lt;/div&gt; </code></pre> <p>I have been reading up online on creating user controls but nothing comes close to what I am looking for. I was able to do this in PHP easily by calling a command and having it return the fomatted text such as:</p> <pre><code>&lt;? print_section_start("Text to format"); ?&gt; </code></pre>
c# asp.net
[0, 9]
4,706,183
4,706,184
How to create new radiobuttonlist with question on submit? c# asp.net
<p>i have:</p> <pre><code>&lt;div id="question"&gt; &lt;div style="float: left; width: 250px;"&gt; &lt;asp:Label ID="question" runat="server"&gt;&lt;/asp:Label&gt;&lt;/div&gt; &lt;div&gt; &lt;asp:RadioButtonList ID="selectdYesNo" runat="server" RepeatDirection="Horizontal"&gt; &lt;asp:ListItem Text="Yes" Value="1"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="No" Value="0"&gt;&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="btCreate" style="margin-left: 200px; margin-top: 10px;"&gt; &lt;asp:Button runat="server" Text="Categorize" ID="btCategorize" /&gt; &lt;/div&gt; </code></pre> <p>how can i create new entry of radiobuttonlist with new question after submit?? im princip create new 2, 3, 4 etc. </p>
c# asp.net
[0, 9]
5,042,194
5,042,195
Multi edit/save grid (hiddenfield + javascript)
<p>I got a gridview which contains 10 rows where 1 of the columns is a combobox that can be edited. When I click on an "edit" button, all of the 10 rows becomes editable and I want to keep track of which rows I have changed so that I dont save all 10 rows to the DB if there has only been made changes to 2 of them. My toughts so far:</p> <p>Make an extra hidden column in the grid (like a checkbox that tells that the row is edited) On SelectedIndexChanged on the combobox im going to find a script that tells me the grid-row im currently editing and sets the checkmark in the hidden column for that row</p> <p>Then when i press "Save" I can run through the lines of the grid and see which ones has the checkmark and then save those rows to the DB</p> <p>Javascript is not my strong side so any help/tips would be appreciated, or a completely different solution would work too :)</p>
javascript asp.net
[3, 9]
4,177,158
4,177,159
Dictionary Lookup Efficiency & Request Scoped Global Variable in ASP.NET? Accessible by global.asax and pages/etc
<p><em>I know there is a couple answered questions on here regarding "request scoped" globals, but I want to nit-pick on something specifically and maybe squeeze some extra enlightenment out of one or two of you.</em></p> <p>I have an ASP.NET C# Website and a static Dictionary of objects (loaded from DB once on Application start). Each page request will need to do a lookup in the Dictionary (based on a key derived from the request url/etc) and get the appropriate object.</p> <p>The issue is I'm trying to maximize efficiency by reducing the lookups to the Dictionary per Request. Doing just a single lookup within a Page itself is easy enough and I can pass the object to sub controls, etc too.. but global.asax is separate from the Page and it also needs to use the object (in Application_BeginRequest and Session_Start).</p> <p><strong>So is doing a Dictionary lookup once in Application_BeginRequest, once (when necessary) in Session_Start and once in the Page negligible speed wise, even if there are many requests coming in every second?</strong></p> <p>I would like it if I could just have a Request scoped global variable that I can easily call upon.. the only one I see available though is HttpContext.Current.Items and that is a Dictionary itself.</p> <p><strong>Am I being ridiculously nit-picky with my concern over efficiency? or will these milliseconds (nanoseconds?) get me in the long run when more and more requests are being made?</strong></p> <p>Thanks.</p> <p>PS. I currently only have around 100 objects in the Dictionary although this may increase in the future.</p>
c# asp.net
[0, 9]
5,937,382
5,937,383
Adjusting jQuery script to add height to parent element
<p>I'm using Soh Tanaka's script to toggle open and closed div content in the accordion style.</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; $(document).ready(function(){ //Hide (Collapse) the toggle containers on load $(".toggle_container").hide(); //Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state) $("h3.trigger").click(function(){ $(this).toggleClass("active").next().slideToggle("slow"); return false; //Prevent the browser jump to the link anchor }); }); &lt;/script&gt; </code></pre> <p>I'm trying to adapt this script so that the toggle also adds an increase of 50px to the height of a container div with the id of #join_find_talk. Help, please... </p> <p>You can see it in action here: <a href="http://www.snakeandherring.com.au/join/" rel="nofollow">http://www.snakeandherring.com.au/join/</a></p>
javascript jquery
[3, 5]