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,707,733
2,707,734
Hide button after last class has been shown
<p>I have the following, </p> <pre><code>$("#slider1next").click(function () { $(".text:visible").next().show(); }); </code></pre> <p>When the last class (.text) has been shown i want to hide #slider1next how would i go about this? </p> <p><a href="http://jsfiddle.net/ma9ic/U2UZ4/3/" rel="nofollow">http://jsfiddle.net/ma9ic/U2UZ4/3/</a></p>
javascript jquery
[3, 5]
2,936,251
2,936,252
Scroll Positioning for Overflow Container
<p>How to set (horizontal) scroll position of overflow container?</p> <p><strong>JsFiddle:</strong></p> <p><a href="http://jsfiddle.net/JeaffreyGilbert/FVrtx/" rel="nofollow">http://jsfiddle.net/JeaffreyGilbert/FVrtx/</a></p> <p><strong>Preview:</strong></p> <p><img src="http://i.stack.imgur.com/wf24h.png" alt="alt text"></p>
javascript jquery
[3, 5]
3,214,146
3,214,147
why the javascript variable doesn't change among function?
<p>my problem with the following javascript function:</p> <pre><code>function ValidateDates() { var valid = false; birthD = $("#cp1_txtBirthDate").val(); initialD = $("#cp1_txtInitialDate").val(); var regexp = new RegExp("^([1-9]|(0|1|2)[0-9]|30)(/)([1-9]|1[0-2]|0[1-9])(/)((20|19|18)[0-9]{2})$"); if (birthD != "__/__/____" &amp;&amp; initialD != "__/__/____") { if (regexp.test(initialD) &amp;&amp; regexp.test(birthD)) { $.get("ValidateDates.aspx?BirthD=" + birthD + "&amp;InitialD=" + initialD, function (data) { if (data == 0) { valid = true; $("#Dates_span").html(""); } else { $("#Dates_span").html("*" + data); valid = false; } }); } } return valid; } </code></pre> <p>here when i check the variable valid i found it "false" even if its true, because the initial for it is false from the beginning of function so how to solve it and what is wrong?</p>
javascript jquery
[3, 5]
5,587,338
5,587,339
iFrame Validation
<p>I currently have an iframe within my main page that has a number of checkboxes that need to be actioned prior to leaving the iframe, i.e, if the user commences checking the checkboxes and half way through they then click back on the main page, i.e leaving the iframe, I would like to be able to trap/validate that they have left the iframe and prompt them with a message indicating this, say with a "Note: You will lose all data entered here - Leave: Yes/No?" type message.</p> <p>Any help/websites would be appreciated.</p> <p>Thanks. Tony.</p>
javascript jquery
[3, 5]
1,933,601
1,933,602
anticipating a click event within a while loop - jquery/javascrip
<p>I'm working on a little dice game app with javascript/jquery and the part where I run into trouble is in the following while loop. I want the user to click the button and then the body of the while loop should execute. However, with the following code, the contents of the while loop execute without waiting for the user to click each time. Is this the right way to approach what I'm trying to do?</p> <pre><code> while (dice.value != rollFirst &amp;&amp; dice.value != 7) { $("#roll").click(function() { $("#roll").unbind('click'); dice.roll(); }); </code></pre> <p>update: Based on the responses, maybe I wasn't totally clear in what I'm trying to do. For every iteration of the while loop, I want to user to click the roll button and only then do I want to continue execution of the contents of the while loop. In other words, I want the while loop to wait until the users clicks "roll" for each iteration.</p> <p>As it is right now, the logic of the program works but it doesn't wait for the user to click the roll button.</p>
javascript jquery
[3, 5]
5,699,758
5,699,759
Strip all images with data.replace?
<p>I'm using a script to retrieve content from an external website, and the date is returned with certain elements stripped out so that they don't interfere with the page I'm pulling the data to. However, when I view my page with the error console open, I am receiving 404s on all images. Is there anyway I can strip out all the images from the script so that I'm just getting the text (which is still in its formatted tags)?</p> <pre><code>$(document).ready(function () { var container = $('#target'); function doAjax(url) { if (url.match('^http')) { $.getJSON("http://query.yahooapis.com/v1/public/yql?" + "q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent(url) + "%22&amp;format=xml'&amp;callback=?", function (data) { if (data.results[0]) { var fullResponse = $(filterData(data.results[0])), justTable = fullResponse.find("table"); container.append(justTable); } else { var errormsg = '&lt;p&gt;Error: could not load the page.&lt;/p&gt;'; container.html(errormsg); } }); } else { $('#target').load(url); } } function filterData(data) { data = data.replace(/&lt;?\/body[^&gt;]*&gt;/g, ''); data = data.replace(/[\r|\n]+/g, ''); data = data.replace(/&lt;--[\S\s]*?--&gt;/g, ''); data = data.replace(/&lt;noscript[^&gt;]*&gt;[\S\s]*?&lt;\/noscript&gt;/g, ''); data = data.replace(/&lt;script[^&gt;]*&gt;[\S\s]*?&lt;\/script&gt;/g, ''); data = data.replace(/&lt;script.*\/&gt;/, ''); return data; } doAjax('mywebsite'); }); </code></pre>
javascript jquery
[3, 5]
5,428,166
5,428,167
Could this be done any easier? Java beginner question
<p>I need to create a series of objects, and it just looks plain ugly right now:</p> <pre><code>CheckBox checkOne = (CheckBox) findViewById(R.id.checkOne); CheckBox checkTwo = (CheckBox) findViewById(R.id.checkTwo; CheckBox checkThree = (CheckBox) findViewById(R.id.checkThree); CheckBox checkFour = (CheckBox) findViewById(R.id.checkFour); CheckBox checkFive = (CheckBox) findViewById(R.id.checkFive); </code></pre> <p>I'm on an intermediate level when it comes to Java, so what I wanted to do was to do a for loop and then use variable variables. Alas, Java does not support this. Is there any, less recursive, way to do this?</p>
java android
[1, 4]
2,770,438
2,770,439
How to avoid the grid view in asp.net not to post the page to the server on paging
<p>I've a grid view, with IList as a datasource. I've thousands of records and so I've used pagination. The grid view will display only 10 records per page. My question is, how to avoid the grid view making DB calls again to the server when I click the 2nd page. Since I load all the data in a collection(IList), I need to iterate within the IList to bind data to the grid view when the next page is clicked. How can I accomplish this ? Help appreciated.</p>
c# asp.net
[0, 9]
42,790
42,791
How to highlight different type of codes in JS or PHP?
<p>I'm doing my first project for my university grade and I would like to code a "paste" service for different type of languages: php, javascript, c, etc. You know, something similar to pastebin, pastie...</p> <p>I would like to know how I can highlight the code depending of the language. I mean, if there is a plugin that does and how to handle the different languages.</p> <p>Thank you in advance</p>
php javascript
[2, 3]
1,863,056
1,863,057
the main cause of application force close on android
<p>What is the main cause of force close on android? Is there any way to help avoid unwanted force close problem when coding an android application?</p>
java android
[1, 4]
2,543,874
2,543,875
Jquery form validation plugin - how to submit with an extra step?
<p>I'm currently using the <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">Jquery form validation plugin</a>, and it works well when I followed it's form submission instruction on the webpage:</p> <pre><code>$("#form").validate({ submitHandler: function(form) { form.submit(); } }); </code></pre> <p>However, now I need to add a popup alert box after the users click the submit button, then they need to click a button on the popup box before the form being submitted.</p> <p>So it needs to be:</p> <ol> <li>fill in form, click submit button</li> <li>pop up box shows up with a button, click that button</li> <li>form submits</li> </ol> <p>I have tried this but it triggers no response:</p> <pre><code>$("#form").validate({ submitHandler: function(form) { $('.popup').show(); $('.popup').find('.button').click(function(){ form.submit(); }); } }); </code></pre>
javascript jquery
[3, 5]
2,433,144
2,433,145
Java/Android: Method with Full Project Scope
<p>I have a method that I've created that I would like to be able to use anywhere, but I don't know what the best practice is for giving access to that method throughout the project. Do I just create a .java file with a public method and that will give access throughout? Will I need to declare it anywhere (somewhere in the manifest?)?</p> <p>I'm sure this has been asked, but I am not returning anything useful on my google searches. I am not good enough at googling for Android, yet! Sorry for adding to the duplicates, if I am.</p>
java android
[1, 4]
5,226,224
5,226,225
C# books or web sites for C++ developers
<p>I am looking for web sites or books that would help a C++ developer to pick up C#. So far, <a href="http://andymcm.com/csharpfaq.htm" rel="nofollow">this</a> is the best one I've found.</p>
c# c++
[0, 6]
4,451,698
4,451,699
Android touchpaint.java API
<p>I have come across the Android touchpaint.java API, i run it on my android emulator.</p> <p>To learn i would like to edit this, how would I be able to add some extra features to it.</p> <p>What changes would you suggest i make to it, someone has probably done this years ago, but i dont care, i just want to learn.</p> <p>So what changes could i make to this API that is not so hard and any other help that you can offer.</p> <p>And how would i send a drawing to an email address, lets says i just drew something, how would i send that to my email address.</p> <p>i know this is not a specific question but i would really appreciate any help.</p>
java android
[1, 4]
5,014,471
5,014,472
how to change endtime based on starttime (If starttime =3pm default endtime should be 6pm)
<p>I am developing an application where i musing facebook like Date and Time(facebook create event) .Now in my application suppose i set start time 3:00pm I want the default end time to be 6:00pm (this is if end time not set) how to do it? reply</p>
php javascript jquery
[2, 3, 5]
5,139,318
5,139,319
JavaScript If statement not working in IE
<p>I have the following code, which is working great in firefox and chrome, but not working in Internet Explorer...</p> <pre><code>$("#nav-tabs").on("click", "a", function(e) { e.preventDefault(); $(this).tab('show'); $('li#test').each(function() { if($(this).attr('class') == "active") { //Active class is applied $(this).children().children().attr("src", "assets/img/button_home_selected3.png"); } else { $(this).children().children().attr("src", "assets/img/button_home_plain.png"); } }); }); </code></pre> <p>Is there any problems with conditional statements with IE???</p> <p>Here is the HTML</p> <pre><code>&lt;ul id="nav-tabs" data-tabs="tabs"&gt; &lt;li id="test" style="list-style: none;" class="active"&gt; &lt;a href="#home" data-toggle="tabs" &gt;&lt;img src="assets/img/button_home_selected3.png" id="test2" width="83" /&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>More over, the li tags are Addded dynamically...</p>
javascript jquery
[3, 5]
1,456,104
1,456,105
android null pointer exception in Application
<p>i have an activity which initialize a variable of my Application class (AppVariables):</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (AppVariables) getApplicationContext(); } </code></pre> <p>when using this if condition which check if a drawable is null or not i get a null pointer exception from some reason:</p> <pre><code> if (app.getFacebookCurrentUser().getProfilePicture() != null) </code></pre> <p>can't really under stand why.. i am checking if it null.. </p>
java android
[1, 4]
3,612,300
3,612,301
how can I allow the user to click only 3 times on a button in jquery?
<p>I'm trying to make a little rock paper scissors game. for that I've written a small javascript in jquery. the whole thing should work like this: user presses button, an ajax event is fired, the selected option is added to a div and a counter increments. but only 3 times! I can't figure it out to work like this... here's my code</p> <pre><code>if (counter &lt;= 3){ $('.buStein1').click(function(event){ $.post("game.php", { uid: "&lt;?php echo $user['id']?&gt;", choice: "stein", runde: counter }); $('#choiceContainer').append(stein); counter++; }); $('.buSchere1').click(function(event){ $.post("game.php", { uid: "&lt;?php echo $user['id']?&gt;", choice: "schere", runde: counter }); $('#choiceContainer').append(schere); counter++; }); $('.buPapier1').click(function(event){ $.post("game.php", { uid: "&lt;?php echo $user['id']?&gt;", choice: "papier", runde: counter }); $('#choiceContainer').append(papier); counter++; }); } else { $('#choiceContainer').text('no clicking possible'); } </code></pre>
javascript jquery
[3, 5]
2,743,217
2,743,218
how to refrence Linq2SQL class from a static class
<p>i am having a strange problem, i have a static class like this </p> <pre><code> public static class BlogDataAccess { private static Blog _Blg; public static Blog Blg { get { _Blg = new Blog (); return _Blog ; } } } </code></pre> <p>then in my page i do the following</p> <pre><code> var DataContext= new DataClasses(); BlogDataAccess.Blg.ArticleTitle ="Title"; DataContext.Blog.InsertOnSubmit(BlogDataAccess.Blg); DataContext.SubmitChanges(); </code></pre> <p>the record get inserted but with null value of the ArticleTitle field thanks in advanced.</p>
c# asp.net
[0, 9]
2,016,300
2,016,301
how to use jquery selectors in a for loop?
<p>i want to acheive this :</p> <pre><code>for (i = &lt;?php echo $current_i ?&gt; /*then I get augmented in javascript */;i&lt;max;i++){ $('#anyid****')./* my actions goes here */ } </code></pre> <p>here i want to put the counter I of the javascript in the selector how could i do that ???</p>
javascript jquery
[3, 5]
987,128
987,129
How do I replace HTML escapes in an input stream before parsing it to XML?
<p>I have an input stream which is being converted to XML, and read. When I get down to some text elements in the XML, they are truncated. I believe the parser is dropping everything after escaped HTML such as &amp; Here is the code getting the input stream and then getting the text element.</p> <pre><code>String hvurl = "https://www.mysite.com/api/a/" + answerId; in = OpenHttpConnection(hvurl); Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { db = dbf.newDocumentBuilder(); doc = db.parse(in); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } ... //Now when I get the text element, it's truncated //---get the &lt;varietalTitle&gt; elements under the &lt;varietal&gt; // element--- NodeList varietalTitleNodes = (varietalElement).getElementsByTagName("varietaltitle"); //---convert a Node into an Element--- Element varietalTitleElement = (Element) varietalTitleNodes.item(0); //---get all the child nodes under the &lt;varietaltitle&gt; element--- NodeList varietalTitleTextNodes = ((Node) varietalTitleElement).getChildNodes(); //---retrieve the text of the &lt;varietalid&gt; element--- strVarietalTitle = ((Node) varietalTitleTextNodes.item(0)).getNodeValue(); </code></pre>
java android
[1, 4]
2,043,609
2,043,610
Removed php session in Jquery or Javascript
<p>Does anyone know whether I can removed a php session by using jquery or javascript?</p>
javascript jquery
[3, 5]
3,162,150
3,162,151
what is the best strategy to handle messages between UI code (Activities) and business logic code
<p>I'm looking the best way to Implement the messages and notifications between activities and the business logic code, I used listeners but I had to register and unregister to avoid that activity do any thing while it is not active.have any body use better strategy </p>
java android
[1, 4]
3,700,638
3,700,639
Rewrite jQuery on() to click()
<p>I need to rewrite this on function to a click function. with the exact same functionality. I cant use on since I have to use jQuery 1.3</p> <pre><code>$('#citybreak_availability_calendar_widget').on('click', '#CB_SearchButton', function() { var iframe = $('#citybreakContent').find('iframe'); iframe.attr('src', $(this).attr('href')); $('#menu ul li a[title="Boka rum"]').click(); return false; }); </code></pre> <p>And this is what I got:</p> <pre><code>$('#citybreak_availability_calendar_widget #CB_SearchButton').click(function() { var iframe = $('#citybreakContent').find('iframe'); iframe.attr('src', $('#CB_SearchButton').attr('href')); $('#menu ul li a[title="Boka rum"]').click(); return false; }); </code></pre>
javascript jquery
[3, 5]
1,878,095
1,878,096
confusion over simple variable declaration jQuery "$variable" vs javascript "var"
<p>I have this simple ghost text implementation:</p> <p>HTML code:</p> <pre><code>&lt;div id="searchPanel"&gt; &lt;form method="get" id="searchBox" action="somePage.php"&gt; &lt;input class="ghText" type="text" name="query" value="search here"/&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>jQuery code:</p> <pre><code>$(document).ready(function(){ $txtField = "#searchPanel form input.ghText"; var value = $($txtField).val(); $($txtField).focus(function(){ if($(this).val() == value) $(this).val("").removeClass("ghText"); }); $($txtField).blur(function(){ if($(this).val()==""){ $(this).val(value).addClass("ghText"); } }); }); </code></pre> <p>The example above is not going to work. When the user focuses the cursor on the search bar, the class "ghText" wont be removed for some reason.</p> <p>However now if I change the "var value" (variable initialization) and "value" with "$value" as in:</p> <pre><code>$value = $($txtField).val(); $(this).val($value).removeClass("ghText"); $(this).val($value).addClass("ghText"); </code></pre> <p>everything works perfectly. </p> <p>I can just go to sleep and not worried too much about it..but I am very curious why something like that can happen? </p> <p>is it because of the "this" not referreing to the right object, or is it because i tried storing jQuery object in non-jQuery variable or is it about something else..can somebody point out to me what was wrong? I have always thought that "var x" is the same as "$x"..?</p>
javascript jquery
[3, 5]
5,533,163
5,533,164
How to change attribute of surrounding div/parent effectively?
<p>I have a table with some radiobuttons in it. When i click on a radiobutton, i want to update two of the sorrounding containers ID attribute (a div and a table). The problem is, i need to go 4 and 6 levels up, and the only way i know how to do this is parent().parent().parent().parent() etc. I am looking for a better solution, and was hoping someone could point me in the right direction. You can see an image of how the "parent-child" tree is here:</p> <p><a href="http://imageshack.us/photo/my-images/834/imgkz.png/" rel="nofollow">http://imageshack.us/photo/my-images/834/imgkz.png/</a></p> <p>I already have a clickhandler etc set up.</p> <p>Basicly i need to check if the table's id attribute is "answeredTable", if not i need to change it. Also i need to check if the div two levels up from the table is "answered", if not, i need to change that too.</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,030,978
5,030,979
-bash: javah: command not found on windows7
<p>I am new to Android environment.I use this link(<a href="http://stevethai.wordpress.com/2010/08/04/android-helloworld-with-native-code-tutorial/" rel="nofollow">http://stevethai.wordpress.com/2010/08/04/android-helloworld-with-native-code-tutorial/</a>) to run the NDK Project using NDK and cygwin Terminal.I follow all the steps given in the link.However during compiling in Cygwin Terminal it shows Error Like(-bash: javah: command not found).I specify all the path correctly. Thanks in Advance.</p>
java android
[1, 4]
1,616,507
1,616,508
WinApp in C# calling java program
<p>I have a c# winapp that calls a java app by tcp and sends everything back by tcp to the c#.</p> <p>The reason why I'm using java is because I received a java api. So I wrote a small java app that calls that api and get all the data I need.</p> <p>So I was wondering if there is another solution for this. Because it's going slow, especially with a lot of data.</p> <p>Thanks</p>
c# java
[0, 1]
4,113,903
4,113,904
jQuery Store Values of checkboxes in div
<p>How can I get this list of checkboxes to be added to a div prior to their selected state, so if they are selected, they should be added to the div, if not they are removed from the list if not selected.</p> <pre><code>&lt;div id="selected-people"&gt;&lt;/div&gt; &lt;input type="checkbox" value="45" id="Jamie" /&gt; &lt;input type="checkbox" value="46" id="Ethan" /&gt; &lt;input type="checkbox" value="47" id="James" /&gt; &lt;input type="checkbox" value="48" id="Jamie" /&gt; &lt;input type="checkbox" value="49" id="Darren" /&gt; &lt;input type="checkbox" value="50" id="Danny" /&gt; &lt;input type="checkbox" value="51" id="Charles" /&gt; &lt;input type="checkbox" value="52" id="Charlotte" /&gt; &lt;input type="checkbox" value="53" id="Natasha" /&gt; </code></pre> <p>Is it possible to extract the id name as the stored value, so the id value will be added to the div instead of the value - the value needs to have the number so that it gets added to a database for later use.</p> <p>I looked on here, there is one with checkboxes and a textarea, I changed some parts around, doesn't even work.</p> <pre><code>function storeuser() { var users = []; $('input[type=checkbox]:checked').each(function() { users.push($(this).val()); }); $('#selected-people').html(users) } $(function() { $('input[type=checkbox]').click(storeuser); storeuser(); }); </code></pre>
javascript jquery
[3, 5]
2,182,392
2,182,393
JQuery map vs Javascript map vs For-loop
<p>I'm implementing some code that is a natural fit for map. However, I have a significant amount of objects in a list that I'm going to iterate through, so my question is which is the best way to go abou this:</p> <pre><code>var stuff = $.map(listOfMyObjects, someFunction()) var stuff = listOfMyObjects.map(someFunction()) </code></pre> <p>or just</p> <pre><code>var stuff = new Array(); for(var i = 0; i &lt; listOfmyObjects.length; i++){ stuff.push(someFunction(listOfMyObjects[i])); } </code></pre>
javascript jquery
[3, 5]
1,137,580
1,137,581
Two submit event handlers on a form. One must stop the other
<p>I have to event handlers attached to a form. The first one that fires should stop the other event if a condition is not met.</p> <p>The code below does not work, as both events will be triggered. Can you help me?</p> <p>Thanks!</p> <pre><code>//fires first $("#myform").submit(function(){ if (some validation) { alert("You need to make the form valid"); return false; } }); //fires second $("#myform").submit(function(){ //ajax stuff return false; }); </code></pre> <p>p.s. I have to this as the ajax stuff is in a plugin that is not changeable. I cannot avoid two event handlers</p>
javascript jquery
[3, 5]
5,768,984
5,768,985
background on emulator being stretched
<p>I have a background on my android app with is a png image. It is 800 x 480 px in size. It is being stretched width wise and hence does not look as I intend it to. As the image is actually the background of the app and not just an imageView I was unable to use the android:scaleType="centerCrop" to get the image to scale equally. </p> <p>I need the image to fill the background equally.</p> <p>I have also tried using NinePatch drawable but the results were not good at all on this - The image became blurred or was OK when being stretched vertically but not width wise.</p> <p><img src="http://i.stack.imgur.com/x5BLx.png" alt="before image"> <img src="http://i.stack.imgur.com/y3UEF.png" alt="after image as seen on emulator"></p> <p>Here is my XML code:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:background="@drawable/menu" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" </code></pre> <p>Is there any other command I can use to get the background to display correctly?</p>
java android
[1, 4]
534,714
534,715
Skip some code if the computer is slow
<p>Is there any way to detect if a computer is slow and not run some code (by either turning jQuery animations off or just running a function if it <em>is</em> fast)?</p> <p>I know this question is probably really trivial, but I noticed that on some slower computers even the simplest margin animation to move something is done in flashes that doesn't look very nice.</p> <p>Update:<br /> The code I'm trying to run is simply a bunch of animations; they all take the same amount of time but on slower browsers the animation is segmented like what you see when you watch a video that is buffering.</p>
javascript jquery
[3, 5]
1,156,781
1,156,782
Creating div on the fly fires twice
<p>I've seen similar posts but nothing that helped me 100%</p> <p>I need to insert these divs before the first element of the body, on the fly when a specific js file is loaded into the page. I'd like this to fire when the script is loaded, and then add the two divs in front of the existing first child element.</p> <pre><code>$('&lt;div id="DIV1"&gt;&lt;div id="DIV2"&gt;&lt;/div&gt;&lt;/div&gt;').prependTo('body:first').index(); </code></pre> <p>I can use the above code in a .js file without an attached function and it works but it fires twice. I've tried multiple methods of doing this, but pretty much everything I try fires twice so I get two divs instead of 1. </p> <p>Can anyone guide me on a better way to do this?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,075,182
3,075,183
Problem with two JavaScript codes
<p>I have these two codes - </p> <pre><code>new function($) { $.fn.getCursorPosition = function() { var pos = 0; var el = $(this).get(0); // IE Support if (document.selection) { el.focus(); var Sel = document.selection.createRange(); var SelLength = document.selection.createRange().text.length; Sel.moveStart('character', -el.value.length); pos = Sel.text.length - SelLength; } // Firefox support else if (el.selectionStart || el.selectionStart == '0') pos = el.selectionStart; return pos; } } (jQuery); </code></pre> <p>And</p> <pre><code>var element = document.getElementById('txtarr'); if( document.selection ){ // The current selection var range = document.selection.createRange(); // We'll use this as a 'dummy' var stored_range = range.duplicate(); // Select all text stored_range.moveToElementText( element ); // Now move 'dummy' end point to end point of original range stored_range.setEndPoint( 'EndToEnd', range ); // Now we can calculate start and end points element.selectionStart = stored_range.text.length - range.text.length; element.selectionEnd = element.selectionStart + range.text.length; } </code></pre> <p>The first one is for getting the cursor position in a textarea and the second one is for determining the end of a textarea ,but they give the same result? Where's the mistake?</p>
javascript jquery
[3, 5]
311,991
311,992
Stopping and resuming timer in jQuery
<p>I've got two solutions. The first of them using the method <code>animate</code>:</p> <p><a href="http://jsfiddle.net/g9aK8/3/" rel="nofollow">http://jsfiddle.net/g9aK8/3/</a></p> <p>The problem is with a delay, when we pause timer for example on 400px and resume then we have to wait again all delay (the speed of bar is absolutely lower). </p> <p>In the second solution I used <code>interval</code>:</p> <p><a href="http://jsfiddle.net/6wNcd/1/" rel="nofollow">http://jsfiddle.net/6wNcd/1/</a></p> <p>It looks better, but when I tried stop this after a few minutes I had to wait something about 30 seconds then stopped. I not sure that using here <code>interval</code> with that small value is correct.</p> <p>Have you any ideas how do this smartly?</p>
javascript jquery
[3, 5]
5,785,368
5,785,369
i am not getting the expected output with sensors in android
<p>I am new to android. I am developing an application that can measure height and width of any object using camera. For this application i am using the angle for calculating the distance. But my problem is that i am not getting the angle in range of 0 to 180. Rather i am getting angle in just range of 0 to 90. After 90 degree it starts giving angle from 90 to 0. so plz help me out. </p> <pre><code> mSM = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSM.getDefaultSensor(Sensor.TYPE_ORIENTATION); public void onSensorChanged(SensorEvent event) { //int sensor = event.type; float[] values = event.values; int i,flag = 0; StringBuffer str=new StringBuffer(); // do something with the sensor data TextView text = (TextView) findViewById(R.id.my_text); float[] R = new float[9]; // rotation matrix float[] magnetic = new float[3]; float[] orientation = new float[3]; float[] I = new float[3]; magnetic[0]=0; magnetic[1]=1; magnetic[2]=0; str.append("From Sensor :\n"); for(i=0;i&lt;values.length; i++) { str.append(values[i]); str.append(", "); } SensorManager.getRotationMatrix(R, I, values, magnetic); SensorManager.getOrientation(R, orientation); str.append("\n\nGives :\n"); if(orientation[1]==0.0) flag = 1; for(i=0;i&lt;orientation.length; i++) { str.append(Math.toDegrees(orientation[i])); str.append(", "); } str.append(" flag = "+flag); text.setText(str); } </code></pre>
java android
[1, 4]
90,460
90,461
Android reading file from assets and storing in array list
<p>My app needs to read from several files in the assets folder. But my file has delimiters $$$ and ||. The structure of the file is like this.</p> <blockquote> <p>Construction$$$<br> All the work involved in assembling resources and putting together the materials required to form a new or changed facility.|| </p> <p>Construction Contractor$$$<br> A corporation or individual who has entered into a contract with the organization to perform construction work.||</p> </blockquote> <p>The sentences ending with $$$ are to be stored in seperate array list and the sentences ending with || are to be stored on seperate array list. How can i do this? Any sample or example code will be appreciated. Note that these files are very long.</p> <pre><code>BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(getAssets().open("c.txt"))); //throwing a FileNotFoundException? String word; while((word=br.readLine()) != null) A_Words_array.add(word); //break txt file into different words, add to wordList } catch(IOException e) { e.printStackTrace(); } finally { try { br.close(); //stop reading } catch(IOException ex) { ex.printStackTrace(); } } String[]words = new String[A_Words_array.size()]; A_Words_array.toArray(words); //make array of wordList for(int i=0;i&lt;words.length; i++) Log.i("Read this: ", words[i]); </code></pre> <p>Above is the code i found now how to split my sentences based upon ending delimiters?</p>
java android
[1, 4]
5,213,141
5,213,142
Using .hasClass() in if condition is not works
<p>I am having a div when user hover on it will insert a div <code>child</code> div. But the problem is on every hover it added the same div repeatably. so i tried the below script for check if <code>child</code> div availabe in <code>MotherDiv</code> do nothing. else add the <code>Child</code> div. These all are happen on hover. So, What is the wrong with the below code?</p> <p>Am i missing something? </p> <pre><code>if ($('.MotherDiv').hasClass('Child')) { alert('alerady a div there!');//DO NOTHING } else { var Details= "&lt;div class='MotherDiv'&gt;&lt;table class='Special'&gt;&lt;tr&gt;&lt;td&gt;Offers&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CheckOut Now&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;"; $(Child).insertAfter($(this));//This is insert the child div on hover } </code></pre>
javascript jquery
[3, 5]
977,475
977,476
asp.net and javascript
<p>I am assigning a value to asp textbox in javascript as follows:</p> <pre><code>var tempStorytxt = document.getElementById("&lt;%=txtStory.ClientID%&gt;"); tempStorytxt.Value = TempValue; alert(tempStorytxt.Value); </code></pre> <p>but when I access in codebehind as follows there is nothing in txtStory</p> <pre><code> int StoryId = int.Parse(txtStory.Text); </code></pre> <p>Please help me out guys, its very urgent.</p>
javascript asp.net
[3, 9]
2,041,635
2,041,636
Create a simple, simple, Game Engine
<p>I'm on my way with my first game, all design and that stuff are done, just coding left. I have successfully watched tutorials around the world wide web with information about Graphics and how to create a successfully thread-synchronization within it. </p> <p>Like now I have a SurfaceView-class and a Thread-class. The thread-class have this constructor to receive the Game Engine from my SurfaceView-class. Simple code from Thread-class constructor:</p> <pre><code> public Thread(SurfaceHolder localsurfaceHolder, Context context, Handler handler, SurfacefView localEngine) { surfaceHolder = localsurfaceHolder; this.handler = handler; this.context = context; engine = localEngine; } </code></pre> <p>From my SurfaceView-class in the surfaceCreated-method:</p> <pre><code>thread = new GameThread(getHolder(), context, new Handler(), this); </code></pre> <p>And there is my code that will start trigging the thread when the surface is created.</p> <p>Now to the <strong>real deal</strong>. Shortly I want a game engine that is totally separated from the view. The problem is; how to achieve this? How should the GameEngine-class constructor look like and where shall I put the drawing/calculations-methods? What does the GameEngine?</p> <p>Now my GameEngine-class look like:</p> <pre><code>package com.myname.mygame; public class GameEngine { //If im right, a constructor for the engine should be placed here //How and which parameters shall I change and send with from the view } </code></pre> <p>Thanks in advance!</p>
java android
[1, 4]
5,257,761
5,257,762
asp.net unique link generator
<p>In an email, I want my users to be able to click a link to confirm an interview schedule. How do I dynamically create these urls? </p> <p>I am thinking of using a query string and I don't want them to have to login every time. So ideally, I'd like this query string to contain credentials, and a date and time. Of course, I'd like this to be encrypted in some simple way. </p> <p>example: invitation.aspx?qs=24lkl254524j2re2wtl5y6.</p> <p>Any suggestions? </p>
c# asp.net
[0, 9]
929,598
929,599
if () not working
<p>This is my code: </p> <pre><code>Log.d("inf", loader); if (loader == "Klasse"){ Log.d("inf", "Klasse yes"); OPTS = new String[] { //Something }; } else { Log.d("inf", "Klasse no"); OPTS = new String[] { //Something }; } </code></pre> <p>In the first Line, the Output is exactly "Klasse" but the next output is everytime "Klasse no". The loader String is set as follows:</p> <pre><code>String loader = ""; Bundle exta = getIntent().getExtras(); if(exta !=null) { try { json = new JSONObject(exta.getString("json")); loader = exta.getString("order"); } catch (JSONException e) { e.printStackTrace(); } } </code></pre> <p>Do you guys have any Idea whats wrong?</p>
java android
[1, 4]
303,273
303,274
How to create JQuery Modal Login Box in C#
<p>Please guide me to develop Login Modal Popup using JQuery and C#.</p> <p>When User will click on "Login" link on the page, it will show the modal popup which will be having username and password fields and "login", "Cancel" button, it should also validate the fields for validations and if required entry is done it should send ajax https web request to validate the valid user and if it returns false then it should show the message in the modal popup only., if user login is valid then it should close the modal popup form.</p> <p>Please suggest as it is very new to me.</p> <p>Thanks.</p>
c# jquery
[0, 5]
3,220,015
3,220,016
JS if inside for loop
<p>I'm trying to rewrite this as a for loop; my attempt below failed. Any ideas?</p> <pre><code>jQuery.event.add(window, "load", resizeFrame); jQuery.event.add(window, "resize", resizeFrame); function resizeFrame() if ($(window).width() &lt; 232){ $("#grid-content").css( 'width', '232px' ); }else if ($(window).width() &lt; 458){ $("#grid-content").css( 'width', '232px' ); }else if ($(window).width() &lt; 684){ $("#grid-content").css( 'width', '458px' ); }else if ($(window).width() &lt; 910){ $("#grid-content").css( 'width', '684px' ); }else if ($(window).width() &lt; 1136){ $("#grid-content").css( 'width', '910px' ); }; }; </code></pre> <p>The result is the div (#grid-content) is really wide around 3000px, regardless of window size.</p> <pre><code>jQuery.event.add(window, "load", resizeFrame); jQuery.event.add(window, "resize", resizeFrame); function resizeFrame() for (var x=232;x&lt;=3000;x=x+226){ if ($(window).width() &lt; x ){ $("#grid-content").css( 'width', x +'px' ); }; }; }; </code></pre>
javascript jquery
[3, 5]
5,557,965
5,557,966
image slide gallery with jquery
<p>I'm try to create a sliding banner with jquery here. </p> <p>I tried to code in this manner </p> <pre><code> .post(this,{ajax : 1}, function(data){ var oldImage = $('div.banner &gt; img'); var newImage = $(data).insertAfter(oldImage).css('position','absolute').css('left',800); newImage.load(function(){ oldImage.animate({left:-800},'medium',function(){}); newImage.animate({left:0},'medium',function(){ oldImage.remove(); }); }); }); return false; </code></pre> <p>However, the transition between the 2 images is not smooth, and there seem to have a little gap between the 2 image when the old image slide away, and the new image slide in. I assume is because there is a lag between the execution of image. Do you guys have any tips on how I can better do this?</p>
javascript jquery
[3, 5]
1,908,365
1,908,366
Image resize without saving on disk
<p>in asp.net i want to resize the image and display on some control but without saving on disk. is there any free utility just like for clasic asp.</p> <p><a href="http://www.aspjpeg.com/livedemo.html" rel="nofollow">http://www.aspjpeg.com/livedemo.html</a></p>
c# asp.net
[0, 9]
3,631,977
3,631,978
Communicate from one page to another? JavaScript, PHP?
<p>I'm building a prototype where on one page A I have a controller. Imagine a TV remote. On another page B, independent of form A -- it can be a different screen/computer -- with some elements X, Y, and Z that are going to be animated by the remote on page A.</p> <p>My first idea would be:</p> <ul> <li>Remote on page A saves an action wanted and sends JSON.</li> <li>I create a listener on page B that reads the JSON to listen to what action to trigger.</li> </ul> <p>I wonder if this the right direction.</p> <p>It is just for a prototype so it doesn't have to be a production-perfect idea.</p>
php javascript
[2, 3]
1,000,341
1,000,342
How can I say this in jQuery?
<p>I want to append some text after 2 closing divs to a sector element.</p> <pre><code>&lt;a href="" class="thingIClicked"&gt;Click me&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; // this is where I want to append the text </code></pre> <p>My code appends the text after the link. How can I say "append it after the 2nd closing div"?</p> <pre><code>$('a.thingIClicked').click(function() { $(this).append('hello'); }); </code></pre>
javascript jquery
[3, 5]
3,263,024
3,263,025
PHP's unpack method functionality in Java
<p>I am wondering what the algorithm behind <code>unpack()</code> method in PHP is? Is there maybe an equivalent in Java which I could use?</p> <p><em>What would be the best way to implement PHP <code>unpack()</code> method in Java?</em></p>
java php
[1, 2]
2,936,548
2,936,549
2nd Activity doesn't call after calling from 1st Activity
<pre><code>if(dialog.getProgress()==dialog.getMax()) { Intent i = new Intent(this, ShowMyDialog.class); startActivity(i); } </code></pre> <p>I have written this code in my 1st activity.but 2nd activity not get called after progress bar value reached to max. so,please help me......how can i solve this. </p>
java android
[1, 4]
4,730,258
4,730,259
How to update the alarm ringing time While updating calendar events?
<p>I'm trying to set alarm for calendar events that are inserted through my application. I have also set alarm for events(i.e) when calendar event notification shows, Alarm also sounded. Now, if I update the event time, I must get the alarm time also be updated from old time to new time. How to make out this? Any help is highly appreciated and Thanks in advance...</p>
java android
[1, 4]
3,294,256
3,294,257
How to access class member variables inside an event handler defined in a class prototype - Javascript
<p>I've seen this solution that works when the event is defined in the constructor:</p> <p><a href="http://stackoverflow.com/questions/3076010/accessing-class-member-variables-inside-an-event-handler-in-javascript">Accessing class member variables inside an event handler in Javascript</a></p> <p>But when the handler is defined in the prototype it doesn't have scope to see "var _self" from the previous solution. Is there a variation that will work for code similar to below?</p> <p>The problem is with the "this" in the "slide" handler... referring to the HTML element instead of the member variables in MyView.</p> <pre><code>function MyView(wrapperDiv) { this.contentW = 1200; this.vboxW = 600; this.vboxH = 400; this.vboxX = 0; this.vboxY = 0; } MyView.prototype = { initHorizontalScrollBar : function ($bar) { //create the wrappers for the slider if($bar.find('.slider-wrap').length==0) $bar.append('&lt;\div class="slider-wrap"&gt;&lt;\div class="slider-horizontal"&gt;&lt;\/div&gt;&lt;\/div&gt;');//append the necessary divs so they're only there if needed $bar.find('.slider-wrap').width(this.svgWidth); //initialize the JQueryUI slider $bar.find('.slider-horizontal').slider({ orientation: 'horizontal', min: 0, max: 100, range:'min', value: 0, slide: function(event, ui) { var difference = this.contentW-this.vboxW; if(difference&lt;=0) return; this.vboxX = (ui.value) / 100 * ( this.contentW-this.vboxW); // 0 &gt;= ui.value &lt;= 100 this.svg.setAttribute("viewBox", toViewBoxString(this.vboxX, this.vboxY, this.vboxW, this.vboxH)); $('ui-slider-range').width(ui.value+'%');//set the height of the range element } }); this.sizeHScrollbar(); } }; </code></pre>
javascript jquery
[3, 5]
3,648,256
3,648,257
Issue related to ItemCommand event in DataGrid asp.net
<p>I have asp.net application having DataGrid on the aspx page having some autogenerated columns :</p> <p>i have bound ItemCommand Event on the grid as Following :</p> <pre><code> protected void DataGrid2_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e) { if (e.CommandName == "CheckInventoryAndPrice") { string itemMainPageLink = E2WConstants.Pages.ITEM_MAIN; string itemId = (DataRowView)e.Item.DataItem).Row["ItemId"].ToString(); //Response.Redirect(); } } </code></pre> <p>but i am getting DataItem Null always : so how can i get the value of cell of selected row ??</p> <p>Thanks..</p>
c# asp.net
[0, 9]
4,545,296
4,545,297
Android Hashmap Failed in showing up inside the listView
<p>I am stuck in this hashmap problem when copying the key. (Android)</p> <p>Initially I had a xml file similar to this</p> <pre><code>&lt;many_people&gt; &lt;people&gt; &lt;id&gt;1&lt;/id&gt; &lt;name&gt;Johnson&lt;/name&gt; &lt;tel_num&gt;12345678&lt;/tel_num&gt; &lt;/people&gt; . . . &lt;/many_people&gt; </code></pre> <p>so i created arraylist with hashmap to store the whole xml</p> <pre><code>for (int i = 0; i &lt; nl.getLength(); i++) { map = new HashMap&lt;String, String&gt;(); Element e = (Element) nl.item(i); map.put(KEY_ID, parser.getValue(e, KEY_ID)); map.put(KEY_NAME, parser.getValue(e, KEY_NAME)); map.put(KEY_TELNUM, parser.getValue(e, KEY_TELNUM)); // adding HashList to ArrayList peopleList.add(map); } </code></pre> <p>I used onItemClickListener to capture the input from AutoCompleteTextView so that I can compare the input with the xml. The peopleList will later be used in listView.</p> <p>For example: input - Johnson Compare with , if found then my list view will show Johnson's name with contact together. The problem is here, if I have 2 Johnson, the listView only read my first johnson in the xml. I do not know how to compare the input to the xml. Below is my code:</p> <pre><code>for (HashMap&lt;String, String&gt; map : peopleList) { if (input.equals(map.get(KEY_NAME))) { // At here I created another hashmap with copying the value map2.put(KEY_ID, map.get(KEY_ID)); map2.put(KEY_NAME, map.get(KEY_NAME)); map2.put(KEY_NAME, map.get(KEY_TELNUM)); peopleList2.add(map2); } } </code></pre> <p>I successfully to show the first data in my listView but second and third data (same name as Johnson) failed. I not sure this is the way to do or not.</p>
java android
[1, 4]
5,563,403
5,563,404
Java split string from array
<p>I have a string array that contains some information.</p> <p>Example: </p> <pre><code> String [] testStringArray; testStringArray[0]= Jim,35 Alex,45 Mark,21 testStringArray[1]= Ana,18 Megan,44 </code></pre> <p>This is exactly how the information is. Now my problem is I want to make each element a seperate element in an array and I want to split it based on the \n character.</p> <p>So I want </p> <pre><code> newArray[0]=Jim,35 newArray[1]=Alex,45 newArray[2]=Mark,21 newArray[3]=Ana,18 </code></pre> <p>etc etc. I am aware of the split method but won't this just split each array element into a completely new array instead of combining them?</p> <p>If anyone could help, it would be appreciated. Thanks</p>
java android
[1, 4]
5,599,080
5,599,081
how to write the condition in jquery?
<p>I have two text input fields like so:</p> <pre><code>&lt;input type="text" id="test1".../&gt; &lt;input type="text" id="test2".../&gt; </code></pre> <p>Now I want the visitor to only be able to fill in only one of those text inputs. For example, if <code>#test1</code> has a value, when the visitor tries to enter a value into <code>#test2</code>, an alert a box should say "Fill in either test1 or test2 but not both".</p>
javascript jquery
[3, 5]
644,532
644,533
Can I access a variable in the child window
<p>I'm trying to access a variable in a window that I have opened.</p> <p>Here is the parent window, it opens up a new window, sets a reference to the child window and then in another onclick event it attempts to retrieve a variable defined in the child window.</p> <pre><code> var window1; //open a window $('#btnOpen').click(function () { window1 = window.open('openedwindow', 'window2'); }); //get child variable $('#btnGetChildVariable').click(function () { alert(window1.childVariable); }); </code></pre> <p>here is the code in the child window</p> <pre><code> var childVariable = 'My child'; </code></pre> <p>Is this possible? is window1.childVariable correct syntax, currently it just returns undefined (there is no unsafe javascript error and I've tried it to get at a control in the child window and I can access it). Page 358 of Javascript the Definitive guide seems to suggest this is possible.</p>
javascript jquery
[3, 5]
3,368,933
3,368,934
getting value from the database
<p>I want to check the validation of username and password, for wrong value i should get alert saying that "invalid username and password", I am a newbie to javascript and php can anyone guide me with this</p> <pre><code>function loginValidation() { var username = $('#username').val(); var password = $('#password').val(); if ( username == "" || password == "" ) { alert("Invalid entry...!!!"); return false; } } </code></pre>
php javascript jquery
[2, 3, 5]
4,716,939
4,716,940
Checking Number of Selected Checkboxes
<p>I saw the <a href="http://docs.jquery.com/Is" rel="nofollow">is</a> function in jQuery, and it returns me, for example, if any of the checkboxes are selected.</p> <p>I need to do a check for how many checkboxes had been selected by the user, because my app requires something like "select two of these". Is there a quick way to do it?</p> <p>Also, how can I catch when the user clicks the "submit" and then be able to decide whether to let the form send or not, according to checks?</p>
javascript jquery
[3, 5]
3,019,324
3,019,325
Keying a collection by type
<p>I'm looking to have a collection of objects that implement a certain interface, but I'd like to only have one per concrete type within the collection.</p> <pre><code>collection of implementers of dog: - instance of dachshund - instance of beagle - instance of corgi </code></pre> <p>In .NET, there's a "KeyedByTypeCollection". Does something similar exist in Java in such a way that I could use it on Android?</p> <p>Thanks!</p>
java android
[1, 4]
5,318,585
5,318,586
How to bind a repeater to an array of a custom class?
<p>I have a class like this </p> <pre><code> public class Link { public string LinkID { get; set; } public string Title { get; set; } public string URL { get; set; } } </code></pre> <p>and a method that returns an array of <code>Link[]</code> </p> <p>Could I bind that to a repeater, which will reference the Title and URL from Link?<br> How do I reference it? <code>&lt;%# DataBinder.Eval(Container.DataItem, "Title") %&gt;</code> doesn't make anything show up </p> <p>edit:This is embarrassing..I forgot that I emptied the database a couple days ago</p>
c# asp.net
[0, 9]
1,216,921
1,216,922
How to detect and manage incoming call (Android)?
<p>I want to create an application that can detect incoming calls and start my custom activity after a certain number of beeps (rings), I mean after 2 or 3 or 5 beeps (rings) my <code>activity</code> is triggered. How can I do it? </p> <p>Thanks</p>
java android
[1, 4]
4,260,074
4,260,075
findviewbyid returns null in a dialog
<p>I have a custom dialog and when I try to get the value of an EditText it returns null.</p> <p>This line returns null</p> <pre><code>EditText et = (EditText)findViewById(R.id.username_edit); </code></pre> <p>Here is the code in its entirety.</p> <pre><code>protected Dialog onCreateDialog(int id) { switch (id) { case DIALOG_TEXT_ENTRY: LayoutInflater factory = LayoutInflater.from(this); final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null); return new AlertDialog.Builder(TicTacToe.this) //.setIconAttribute(android.R.attr.alertDialogIcon) .setTitle(getTitleText()) .setView(textEntryView) .setPositiveButton("JOIN GAME", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { try { EditText et = (EditText)findViewById(R.id.username_edit); playerName = et.getText().toString(); } catch (Exception e) { } } }) .create(); } return null; } </code></pre>
java android
[1, 4]
840,312
840,313
Apostrophe in DataView RowFilter
<p>I have a DataView that I'm trying to filter based on a dynamic string:</p> <pre><code>dv.RowFilter = "ContentTitle = '" + titleFilter + "'"; </code></pre> <p>In some cases, <code>titleFilter</code> contains an apostrophe, which is closing out the filter query and causing an error.</p> <p>Is there a way I can escape that character? I can't replace it.</p>
c# asp.net
[0, 9]
5,521,209
5,521,210
dynamically add <asp:linkbutton>
<p>i have a question about asp : i have a list of ids that are returned from the server to my webpage . Can i return it in a div under a asp.net control ? : </p> <blockquote> <p>div_containing_link += " &lt; asp:linkbutton id="bleah" runat='server' onclientclick='java_function()' onclick='dosomething' />"</p> </blockquote> <p>if not , how can i do so ? the particular example is that i want to return a list of people ( friends of my friends -- i'm developing as a project a facebook-like app ) and when i click on them i want to send to the server that we should become friends and make the changes needed in the database .</p>
javascript asp.net
[3, 9]
222,926
222,927
Identify caller
<p>I have a link in some html which calls a javascript function I'm writing. The call must be inline so the code is as follows:</p> <pre><code> &lt;a href='#' onclick='quipManager.getQuip(1, $(this))'&gt;Test&lt;/a&gt; </code></pre> <p>In the getQuip function I use the this reference to modify the div which wraps the link by means of .parents() e.g.</p> <pre><code> getQuip: function (id, currentQuip) { alert(currentQuip.parents('.qtip').html()); } </code></pre> <p>I need to keep the call inline, but what I'd like to know is if I can use it like this:</p> <pre><code> &lt;a href='#' onclick='quipManager.getQuip(1)'&gt;Test&lt;/a&gt; </code></pre> <p>and still have getQuip know which link called it so the following still works.</p> <pre><code> getQuip: function (id) { var currentQuip = id.caller ??? alert(currentQuip.parents('.qtip').html()); } </code></pre>
javascript jquery
[3, 5]
133,120
133,121
by using parcelable,trying to add an arraylist into another arraylist,getting error "the method add is not applicable for the arguments"
<p>I have in one activity (firstactivity):</p> <pre><code>ArrayList &lt;MyDouble&gt; myfinals=new ArrayList &lt;MyDouble&gt;(); ... i.putParcelableArrayListExtra("myfinals",myfinals); ... public static class MyDouble implements Parcelable { Double al; public MyDouble(Parcel source){ al = source.readDouble(); } public MyDouble(Double val){ al = val; } @Override public int describeContents() { // TODO Auto-generated method stub return this.hashCode(); } @Override public void writeToParcel(Parcel dest, int flags) { // TODO Auto-generated method stub dest.writeDouble(al); } public Double getValueDouble(){ return this.al; } public static final Parcelable.Creator&lt;MyDouble&gt; CREATOR = new Parcelable.Creator&lt;MyDouble&gt;() { @Override public MyDouble createFromParcel(Parcel source) { // TODO Auto-generated method stub return new MyDouble(source); } @Override public MyDouble[] newArray(int size) { // TODO Auto-generated method stub return new MyDouble[size]; } }; } </code></pre> <p>and in the other activity:</p> <pre><code>ArrayList &lt;MyDouble&gt; myfinals=new ArrayList &lt;MyDouble&gt;(); ArrayList&lt;Double&gt; y =new ArrayList&lt;Double&gt;(); ... for (int i=0;i&lt;=100;i++){ y.add(myfinals.get(i)); } </code></pre> <p>I am trying to add 'myfinals' to y but it gives me error "the method add is not applicable for the arguments 'firstactivity.MyDouble".</p>
java android
[1, 4]
3,999,982
3,999,983
Javascript/jQuery function yields undefined in <IE8
<p>A short while back I asked a question here about how I could calculate when a heading was longer than one line within a given container, and subsequently wrap each of these lines in a <code>&lt;span&gt;</code>:</p> <p><a href="http://stackoverflow.com/questions/3960336/use-javascript-jquery-to-determine-where-a-heading-breaks-to-the-next-line">Use Javascript/jQuery to determine where a heading breaks to the next line?</a></p> <p>I chose an answer which worked great for me, at least until I checked in IE7 and IE6, in which all the headings handled by this script rendered as </p> <p>"<strong>undefinedundefinedundefinedundefinedundefinedundefined</strong>[...]"</p> <p>on the page. As I'm not really a JavaScript person (that's why I asked such a question in the first place), it's really tough for me to figure out where the problem is. I assumed an undefined variable or something, but I just can't seem to grasp it.</p> <p>Can anyone help?</p> <p>I'll repeat the code here, but please refer to the link above for context:</p> <pre><code>$(function(){ $h = $('.fixed').find('h3'); $h.each(function(i,e){ var txt = $(e).text(); $th = $('&lt;h3 /&gt;').prependTo($(e).parent()); var lh = $(e).text('X').height(); $(e).text(''); while (txt.length &gt; 0) { $th.text($th.text() + txt[0]); txt = txt.slice(1); if (($th.height() &gt; lh) || (txt.length &lt;= 0)) { var shc = $th.text().split(' '); var ph = shc.slice(0,-1).join(' ')+' '; if (txt.length &lt;= 0) { ph += shc.pop(); } $('&lt;span /&gt;').text(ph).appendTo($(e)); $th.text(shc.pop()); } } $th.remove(); }) }); </code></pre>
javascript jquery
[3, 5]
350,863
350,864
data export gird view to excel
<p>export data gird view to excel in asp dot net full data export in excel sheet this is write. 10 column in gird view but i want to show only 5 column in excel sheet how to solve this problem </p> <pre><code> protected void btnexcel_Click1(object sender, EventArgs e) { Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=ActualsAndBudgets.xls"); Response.Charset = ""; Response.ContentType = "application/ms-excel"; Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gvdetails.AllowPaging = false; fillgrid(); gvdetails.RenderControl(htw); Response.Write(sw.ToString()); Response.End(); gvdetails.AllowPaging = true; fillgrid(); } public override void VerifyRenderingInServerForm(Control control) { } </code></pre>
c# asp.net
[0, 9]
1,712,550
1,712,551
JAVA DES in PHP
<p>I can't get the same result of encrypted text in JAVA from my php script. This is my php code (client side - my side):</p> <pre><code>$input = 'my text to be encrypted'; $key = 'my key'; $size = mcrypt_get_block_size(MCRYPT_DES, 'ecb'); $input = pkcs5_pad($input, $size); $td = mcrypt_module_open(MCRYPT_DES, '', 'ecb', ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $data = mcrypt_generic($td, $input); print base64_encode($data); function pkcs5_pad ($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } </code></pre> <p>This is The base JAVA code (Server side):</p> <pre><code>SecretKey key = new SecretKeySpec(keyBytes, "DES"); Cipher ecipher = Cipher.getInstance("DES/ECB/PKCS5Padding"); byte[] utf8 = str.getBytes("UTF8"); byte[] enc = ecipher.doFinal(utf8); // Encode bytes to base64 to get a string return new String(Base64Utils.encode(enc)); </code></pre> <p>I know there's a padding problem in php that makes the difference in my result. Can't find why.</p>
java php
[1, 2]
5,592,260
5,592,261
Using JQuery Deferred and Promise
<p>I have a function that I want to use deferred and promise to chain an animation.</p> <p>The first animation is a type writer plugin, using <a href="https://github.com/stephband/jticker/blob/master/js/jquery.jticker.js" rel="nofollow">https://github.com/stephband/jticker/blob/master/js/jquery.jticker.js</a>. The second is a function that contains other animations.</p> <p>What I want to do is run the first animation and when the animation is completed, run the second.</p> <pre><code> $(function () { var ticker =setTimeout(runTicker(), 8000); $.when(ticker).done(function(){ setTimeout(Other(),16000)}); }); function runTicker() { $("#ticker").ticker({ cursorList: " ", rate: 50, delay: 18000 }).trigger("play").trigger("stop"); } </code></pre> <p>I have tried numerous examples of deferred, but still can't get it.</p> <p>I finally cleared all the examples in order to get the ticker working again.</p> <p>How would I use deferred and promise to run the Other() function?</p> <p>Thank you</p>
javascript jquery
[3, 5]
1,098,976
1,098,977
How to post a particular button from jQuery
<p>How can I submit a particular button by jQuery without submiting other buttons in the same form</p> <p>I want to post the delete button only when i clck yes in jquery confirmation box</p> <pre><code>$(document).ready(function(){ $( "#dialog:ui-dialog" ).dialog( "destroy" ); $( "#dialog-confirm" ).dialog({ resizable: false, height:140, modal: true, buttons: { "Ok": function() { $('#form1').submit(); //***************************************************************** }, Cancel: function() { $( this ).dialog( "close" ); } } }); }); </code></pre> <p>Here I want to post only delete button in php without submiting whole form</p> <pre><code>$('#form1').submit(); </code></pre> <p>What is the modification needs to be done in this code?</p> <p>my php code </p> <pre><code> if(isset($_POST['delete_btn']) &amp;&amp; $_POST['delete_btn']=='Delete' ){ $rid=$_POST['roleid']; $sql_u="SELECT * FROM `user_mst` WHERE `role_id`=".$rid; mysql_query($sql_u,$conn) or die("Unable to execute queary :". mysql_error()); } </code></pre>
php jquery
[2, 5]
4,433,733
4,433,734
Asp:Textbox vs input text (a PHP Developer learning ASP)
<p>I’ve been a PHP developer for 10 years, trying to broaden my horizon I am doing a project in ASP.NET. What is the advantage to using an <code>&lt;asp:TextBox&gt;</code> over using a standard <code>&lt;input type=’text’&gt;</code>?</p> <p>It seems advantageous to use a regular <code>&lt;input type=”text”&gt;</code> over <code>&lt;asp:TextBox&gt;</code>. First, when the page is rendered, the <code>&lt;asp:TextBox&gt;</code> becomes a standard <code>&lt;input type=text&gt;</code>. When I use a standard <code>&lt;input type=”text”&gt;</code> I can easily retrieve their value with in serverside code, via Request.Form["Name"]. Next when I dynamiclly add inputs (via javascript) I can’t use TextBox’s I need to use <code>&lt;inputs type=”text”&gt;</code>. Finally wouldn’t it be faster to render the normal input? If I code with <code>&lt;asp:TextBox&gt;</code>, that has to be rendered where if I use <code>&lt;input type=”text”&gt;</code> it simply needs to be displayed. </p> <p>In otherwords why bother with all the asp controls when standard inputs work just as well and if not better…</p>
php asp.net
[2, 9]
3,888,242
3,888,243
Generate Screenshots from URL using ASP.NET and C#
<p>I want to generate screenshots of a website using its URL.</p> <p>This I want to create using ASP.NET and C#, and I <strong>dont</strong> want to use any of the available tools and API(Url2Png, Wesnappr, Awesomium etc..).</p> <p>Which classes of ASP.NET and C# should I explore for this ? How should I start about on this ?</p> <p>Please can someone guide me on this.</p>
c# asp.net
[0, 9]
3,934,459
3,934,460
Jquery plugin for sticking a few table rows at the top of the page when scrolling?
<p>Can anyone recommend a jquery plugin that would allow you to stick a few rows at the top of the page</p> <p>i.e. page loads, the content is in the right place, then once the content reaches the top of the page it gets fixed in place while the user scrolls...then if they scroll back up the content will go back to it's original place?</p> <p>The content in question, would be a few TR elements. </p> <p>I tried a few, but all the ones I tried had major issues, so I'm wondering if you could recommend a few more options for me? thanks</p>
javascript jquery
[3, 5]
469,697
469,698
SQl server hierarchy
<p>I have a website application, In that website i created four text boxes(txtSchoolName,txtBranchName,txtClass,txtSection)....</p> <p>I want to know about SQL server Hierarcy... and How to create hierarchy sqlserver? how to insert values in that? and also how to connect that hierarchy to ASP.net website(C#)?</p> <p>Anyone pls Tell me about it...</p> <p>Thanks in Advance</p>
c# asp.net
[0, 9]
3,781,854
3,781,855
How to redirect after File upload?
<p>I have a File.aspx form where I display all the files.</p> <p>When I upload a file I am using a upload.aspx file to run c# code to upload the file.</p> <p>The thing is that at the end , I want to refresh the page automatically to display the new file upload but apparently it's not redirecting even if all the parameters are good.</p> <p>This is the code I use </p> <pre><code> HttpContext postedContext = HttpContext.Current; string param = Request.UrlReferrer.Query; string param2 = Request.UrlReferrer.Query; var url = HttpUtility.ParseQueryString(param).Get("projectName"); var url2 = HttpUtility.ParseQueryString(param2).Get("projectId"); HttpPostedFile file = postedContext.Request.Files[0]; string name = file.FileName; byte[] binaryWriteArray = new byte[file.InputStream.Length]; file.InputStream.Read(binaryWriteArray, 0, (int)file.InputStream.Length); //FileStream objfilestream = new FileStream(Server.MapPath("~\\" + "\\Files\\" + url + "\\" + name), FileMode.Create, FileAccess.ReadWrite); FileStream objfilestream = new FileStream(("C:\\inetpub\\wwwroot\\Clientportal\\Files\\" + url + "\\" + name), FileMode.Create, FileAccess.ReadWrite); objfilestream.Write(binaryWriteArray, 0, binaryWriteArray.Length); objfilestream.Close(); string[][] JaggedArray = new string[1][]; JaggedArray[0] = new string[] { "File was uploaded successfully" }; JavaScriptSerializer js = new JavaScriptSerializer(); string strJSON = js.Serialize(JaggedArray); Response.Write(strJSON); Response.Redirect(string.Format("Files.aspx?projectId={0}&amp;projectName={1}", url2, url)); </code></pre> <p>Any ideas ? I'm a bit stuck because I use this response.redirect everywhere and it works only when the code is in the same code file...</p> <p>Maybe it's because of the fact that I try to redirect from another code file ?</p>
c# asp.net
[0, 9]
5,422,298
5,422,299
Why does *[checked] act like :checked when using jQuery's filter method?
<p>Following on from a <a href="http://stackoverflow.com/questions/8673201/why-does-checked-not-match-a-single-checked-input-box">previous question</a>.<br> Lets say I have two checkboxes on a page loaded with jQuery 1.5.2</p> <pre><code>&lt;input id="test1" type="checkbox"/&gt; &lt;input id="test2" type="checkbox"/&gt; </code></pre> <p>Then lets click both of them to give each the <code>checked</code> property. Now lets grab all checkboxes and filter out the ones that aren't checked</p> <pre><code>var numOfCheckedBoxes = $("input:checkbox").filter("*[checked]").size(); </code></pre> <p>Now based on the answer to the <a href="http://stackoverflow.com/questions/8673201/why-does-checked-not-match-a-single-checked-input-box">previous question</a>, I would expect <code>numOfCheckedBoxes</code> to equal <code>0</code> but it equals <code>2</code>. I now I should just use <code>$("input:checkbox:checked")</code> or <code>$("input:checkbox").filter(":checked")</code>.</p> <p>This differs from if I do</p> <pre><code>var numOfCheckedBoxes = $("#test1").filter("*[checked]").size(); </code></pre> <p>which sets <code>numOfCheckedBoxes</code> equal to <code>0</code>.<br> Here is a jsFiddle of the <a href="http://jsfiddle.net/2QZvU/9/" rel="nofollow">first scenario in question</a>. Here is a jsFiddle of the <a href="http://jsfiddle.net/2QZvU/13/" rel="nofollow">second scenario in question</a>.</p>
javascript jquery
[3, 5]
5,822,520
5,822,521
How to get a PHP iteration variable in an external jquery.js file?
<p>I'm writing a PHP program that displays a user's to do list. What I have is basically an unordered list that has a checkbox that, when checked, will allow the user to mark a list item as done (i.e give the text a strikethrough). Here's the code I have for the list</p> <pre><code>echo '&lt;ul&gt;'; for ($i=0; $i&lt;6; $i++){ $text = "This is item number " . $i; $complete = 'No'; $order = 'This item is to be done #' . $i; echo '&lt;li id = '. $i . '&gt;'; echo 'Item complete? &lt;input type="checkbox" id="checkbox" /&gt;'; echo '&lt;span id = ' . $i . ' onLoad="crossOut()"&gt;Item: ' . $text . ' Complete? ' .$complete . '&amp;nbsp&amp;nbspWhen to do Item: ' . $order . '&lt;/span&gt;'; echo '&lt;/li&gt;'; } echo '&lt;/ul&gt;'; } </code></pre> <p>And here's the jquery function I'm using</p> <pre><code>$(document).ready(function crossOut(){ $("#checkbox").change(function crossOutText(){ if($(this).is(":checked")){ $("#liID").css("text-decoration", "line-through"); } }) }) </code></pre> <p>What I'm trying to figure out is how to pass the list ID from the PHP to the jquery function, in an external JS file, so that whenever a user checks an item it marks that list item done and puts a strikethrough on the text of that list item. I'm new to using jquery and any help that anyone is willing to give would be greatly appreciated. </p>
php javascript jquery
[2, 3, 5]
3,323,907
3,323,908
Trying to add class to dynamic selector
<p>In a page I am working on, each of the list-items's have an attribute data-number with the value of the number that the <code>&lt;li&gt;</code> is in the list.</p> <p>The list-item's correspond to slides and I am trying to apply the class <code>.current</code> to the list-items that corresponds to the slide that is currently being viewed.</p> <p>The slide that is currently being viewed can be get by the function <code>.getIndex()</code> and then I have to style the li with that data-attribute of that number with the class current.</p> <p>I tried to do that with the following, but it is not working:</p> <pre><code>$('li[data-number="'+k.getIndex();+'"]').addClass('current'); </code></pre> <p>Any idea what I am doing wrong or how I can achieve what I am trying to?</p>
javascript jquery
[3, 5]
1,851,011
1,851,012
Execute jQuery function from asp:DataGrid ItemCommand
<p>I have an <code>asp:DataGrid</code>, in this grid view an <code>asp:ButtonColumn</code>. When I click on delete action, I enter in the <code>"delete"</code> case switch. If the result is false, I'd like execute an jQuery fuction define in the .aspx page.</p> <p>Is it possible to do this ?</p> <p>Thanks,</p> <pre><code>&lt;asp:DataGrid runat="server" ID="dgList" InItemCommand="dgList_ItemCommand"&gt; &lt;asp:ButtonColumn Text="Delete" CommandName="delete" /&gt; &lt;/asp:DataGrid&gt; </code></pre> <p>In the code behind :</p> <pre><code>protected void dgList_ItemCommand(object source, DataGridCommandEventArgs e) { switch (e.CommandName) { case "other_command": break; case "delete": bool myResult = new MyClass().GetTest(); //if myResult = false, I'd like execute a jquery function break; } } </code></pre>
jquery asp.net
[5, 9]
2,313,959
2,313,960
How to close the shadowbox
<p>I have a shadow box, and it contains a form , the problem is when the form is submitted shadow box doesn't get closed.I've used these functions , self.close(); window.parent.Shadowbox.close();</p> <p>but still no luck, can any one help me, thanks</p> <p>This is how I created the shadow box</p> <pre><code>&lt;a href="#" id="mylink"&gt;Example shaodow box&lt;/a&gt; &lt;script language="javascript"&gt; $('#mylink').click(function(){ Shadowbox.open({ content: 'mybox.php', player: 'iframe', height: 550, width: 800, options: { onClose: function() { top.location = "index.php?mydata=asas1234"; } } }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,403,166
3,403,167
Move focus from one control to another control just pressing enter key by Jquery
<p>suppose i have many html control in the page and all the control has a sequentially tab stop set.so if i press tab then focus move properly but i want to move focus just by pressing enter key instead of tab. so please tell me how could i programatically press tab when user will press enter key in my web page just by javascript or jquery. expecting small smaple code to achieve the effect i need.</p> <p>thanks.</p>
javascript jquery
[3, 5]
3,434,582
3,434,583
taking text from textbox and putting into span in javascript
<p>I am doing a self print function by gathering all the HTML from the users screen and putting it into a variable which then displays a pop-up screen so the user can print that information.</p> <pre><code> var disp_setting = "toolbar=no,location=no,directories=no,menubar=no,"; disp_setting += "scrollbars=yes, height=500, left=100, top=25"; var content_vlue = document.getElementById("print_content").innerHTML; var docprint = window.open("", "", disp_setting); docprint.document.open(); docprint.document.write('&lt;html&gt;&lt;head&gt;'); docprint.document.write('&lt;/head&gt;&lt;body text="#000000" onLoad="self.print()"&gt;'); docprint.document.write('&lt;table&gt;'); docprint.document.write(content_vlue); docprint.document.write('&lt;/table&gt;'); docprint.document.write('&lt;/body&gt;&lt;/html&gt;'); docprint.document.close(); </code></pre> <p><strong>UPDATE:</strong> OK thanks to many of the suggestions so far I'm starting to make some headway...</p> <p>What I would like to do is instead of manipulating print_content, I would like to put print_content into a variable (i.e. content_vlue) and then manipulate content_vlue.</p> <pre><code>var content_vlue = document.getElementById("print_content").innerHTML; $("content_vlue").find("INPUT[type='text']").each(function(i){ var input = $(this); input.replaceWith("&lt;span class='textinput'&gt;" + input.val() + "&lt;/span&gt;"; }); </code></pre> <p><strong>Is there a way to do this?</strong></p>
javascript jquery
[3, 5]
2,748,451
2,748,452
clearInterval() Undefined Error After Using setInterval()
<p>I know this isn't supposed to be inline, but YUI library's dialogs force me to. My issue is that whenever I hover over this div, the margin-left scroll activated but it does not stop when I move the mouse out of the div. The JS console reports that:</p> <blockquote> <p>Uncaught ReferenceError: timerID is not defined</p> </blockquote> <p>And here's the code:</p> <pre><code>&lt;div class="span1" onmouseover=" var timerID; $(document).ready(function(){ timerID = setInterval(scrollLeft, 10); function scrollLeft(){ $('.inner_wrapper').animate({ marginLeft: '-=30px' }); } }); " onmouseout="clearInterval(timerID)"&gt; &lt;/div&gt; </code></pre> <p>EDIT: The thing is that I can NOT run SCRIPT tags inside dialogs (they are already created via scripts, which filter any javascript besides inline one like onmouseover and onmouseout). So your suggestions of encapsulating the onmouseover and onmouseout handles in a single function will not work in this case.</p>
javascript jquery
[3, 5]
4,416,823
4,416,824
SQL user authentication web service
<p>Is it possible to authenticate user using a SQL database, containing users and passwords?</p> <p>What I want to achive is: I have as SQL database containig data for my app. This database also contains usernames, passwords and rights which are specific for my app. Also I have a middle tier WebService, which contains the business logic of my app, and is responsible for connecting to SQL database. The connection between SQL server and the WebService as made with hardcoded user. I don't need to authenticate the Users with SQL server. As a frontend I have a Windows Froms and ASP .NET applications. The users should fill username/password boxes, then this information is to be passed to the WebService, which checks the username and password in the SQL database. I want the WebService methods to be available only to users, which have authenticated to the user database in SQL server.</p> <p>For example: The following operations are supported URL: <a href="https://www.example.com/AuthenticationService.asmx" rel="nofollow">https://www.example.com/AuthenticationService.asmx</a></p> <p>inside this service description will contains 2 methods such as</p> <p>CheckUserAuthentication UserEndSession</p> <p>Any ideas, sample code and documents of how to implement this would be greatly appreciated.</p> <p>I use C# ASP.NET</p> <p>Thank you in advance!</p>
c# asp.net
[0, 9]
812,967
812,968
How do I relay dynamic parameters passed into a functionA() to functionB() called within functionA()
<p>I'm trying to relay dynamic parameters from a web page into a function, which then passes them to a call inside the function. For example, take the simplified snippet below, as it is now, passing in the parameters directly is not problem. But how do I pass in a parameter which colorbox accepts without making a parameter for showColorbox() for every possible colorbox parameter? </p> <pre><code>function showColorbox(title, url, width, height, modal, params) { $.colorbox({title:title, href:url, width:width, height:height, opacity:0.7}); } </code></pre> <p>For instance, colorbox accepts passing in an event function, such as below if I called colorbox directly:</p> <pre><code> $.colorbox({title:title, href:url, width:width, height:height, opacity:0.7, onComplete: function() { $.colorbox.resize(); } }); </code></pre> <p>So, without adding some code or making another parameter and parsing it out somehow inside showColorbox(), is there a way for me to pass the onComplete param/code [via showColorbox(....{onComplete:yada yada}) or something] and have them relayed to the $.colorbox() function?</p> <p>UPDATE: Ended up using the following successfully, added an extra objParams parameter to the showColorbox() function.</p> <pre><code>//m_title, m_url, m_width, m_height are from fixed parameters for showColorbox() var objBase = {title:m_title,href:m_url,width:m_width,height:m_height} ; var objFinal = {}; //add base parameters passed in directly, fixed params for(var item in objBase) { objFinal[item] = objBase[item]; } //add the parameters from objParams passed in (variable params/values) for(var item in objParams) { objFinal[item] = objParams[item] } //call function with combined parameters in object $.colorbox(objFinal) </code></pre> <p>None of the callers needed to be updated, but now passing in a new object using parameters which $.colorbox understands works fine! Thanks again!</p>
javascript jquery
[3, 5]
2,657,571
2,657,572
I'm new to coding, and I have a idea but don't know how to code it
<p>I have a idea for my first application. It should be able to write a new note, email the note, post it to Facebook or Twitter, etc. But I don't know how to code it. How can I do it?</p>
java android
[1, 4]
3,930,663
3,930,664
IE7 opacity problem by Dropdown menu
<p>in the following website we have a dropdown menu with rollover effact. this function perfactly but in IE7 the opacity is not working correctly.</p> <p>Any tip?</p> <p><a href="http://webentwicklungsserver.ch/2011-08-25/index.php" rel="nofollow">http://webentwicklungsserver.ch/2011-08-25/index.php</a></p> <p>As both white and Gray text will be displayed and is difficult to read.</p>
javascript jquery
[3, 5]
4,170,863
4,170,864
Cancel form.submit()
<p>In javascript function I am submitin a form:<br /> <code>form.submit();</code>, </p> <p>with huge amount of data. </p> <p>Is it possible to cancel this operation beside clicking on browser's stop button?</p> <p><strong>UPDATE:</strong></p> <p>Maybe i didn't made my self clear i am submiting large files.<br /> form with uploadcontrol that runs in iframe.</p>
asp.net javascript
[9, 3]
3,382,145
3,382,146
call javascript window.onload after SelectedIndexChanged event fire
<p>//my problem is when i fire SelectedIndexChanged event of ddlmodalitylist asynchronously(ajax call) then javascript load event is not fired..thats y i have to fire onload event from server side.</p> <pre><code>window.onload = body_Onload; function body_Onload() { //javascript code } protected void ddlModalityList_SelectedIndexChanged(object sender, EventArgs e) { ddlStudy.Items.Clear(); ListItem selectedPair = ddlModalityList.SelectedItem; string str= selectedPair.Value; int ID= Convert.ToInt32(str); if (ID == -1) { // ddlStudy.Items.Clear(); return; } DataTable dataTableStudy = null; dataTableStudy = objSqlDbComm.ExecuteDatasetQuery(strSQL).Tables[0]; var dictioneryStudy = new Dictionary&lt;int, string&gt;(); foreach (DataRow dr in dataTableStudy.Rows) { dictioneryStudy.Add(Convert.ToInt32(dr["Study_ID"]), dr["Study_Desc"].ToString()); } ddlStudy.DataTextField = "Value"; ddlStudy.DataValueField = "Key"; ddlStudy.DataSource = dictioneryStudy; ddlStudy.DataBind(); ddlStudy.Items.Insert(0, new ListItem("[Select]", "-1")); ddlStudy.Items[0].Selected = true; } </code></pre>
c# javascript asp.net
[0, 3, 9]
3,251,182
3,251,183
get an array of data-val values from a list of elements of a certain css class
<p>I would like to get an array of the values from the data-val attributes of <code>.my-li</code> elements</p> <pre><code>&lt;ul id="stuff"&gt; &lt;li class='my-li' data-val='1'&gt; &lt;li class='my-li' data-val='2'&gt; &lt;li class='my-li' data-val='3'&gt; &lt;li class='my-li' data-val='4'&gt; &lt;li class='my-li' data-val='5'&gt; &lt;ul&gt; </code></pre> <p>here the result should be [1,2,3,4,5];</p> <p>anybody knows a good way of doing this ?</p>
javascript jquery
[3, 5]
5,937,268
5,937,269
Simple Login Application in WebForms C#.NET
<p>Can anyone please help me ..I have created a simple login web application in C#.NET and SQL Server with backend db. I Just want to know how to restrict the user if he enters incorrect password more than 3 times . I want to restrict that user for 10 mins and he can try again. So can anyone please post me detail code how to do this. Thanks</p>
c# asp.net
[0, 9]
5,450,571
5,450,572
jquery getting all dropdown values
<p>I have dropdown <code>&lt;select&gt;</code> with id <code>my_dropdown</code>. I allow multi-select. I know how to pull the selected value(s) using jquery:</p> <pre><code>var values = $('#my_dropdown').val(); </code></pre> <p>This will return an array of values if I select multiple. I also need to get all the values in the dropdown regardless of what is selected. How can I use jquery similarly to get all the values in the dropdown given that id?</p>
javascript jquery
[3, 5]
3,272,685
3,272,686
how to substring from a string using c#
<p>The following is a line of huge .txt file and i am reading it line by line. I need the value of second column. In this line, I need to extract 'C9006'. </p> <blockquote> <p>Mr ABC|C9006|The white field, ON|493-493-4939|493-493-4939|YR|Inactive</p> </blockquote> <p>Note : The delimiter char is pipe sign '|'. The length of second column is not consistent.</p> <p>Help please. </p>
c# asp.net
[0, 9]
1,360,157
1,360,158
jQuery $('.someClass').click(function(){}) only applies to elements that are currently present?
<p>So I am constantly adding new points to a graph and I want all of them to have the same click function. But it seems like when I run</p> <pre><code>$('.someClass').click(function(){}) </code></pre> <p>it only applies to elements that currently have someClass. If I add a new someClass element, it does not have the click listener.</p> <p>How do I get around this? Must I run click function every time I add an element?</p>
javascript jquery
[3, 5]
4,238,430
4,238,431
Prevent back button after logout
<p>I don't want the user to go back to secured pages by clicking back button after logging out. In my logout code, I am unsetting the sessions and redirecting to login page.But, I think the browser is caching the page so it becomes visible despite the session being destroyed from logout.</p> <p>I am able to avoid this by not allowing the browser to cache</p> <p><code>header("Cache-Control", "no-cache, no-store, must-revalidate")</code></p> <p>But this way I am loosing the advantage of Browser Caching.</p> <p>Please suggest a better way of achieving this. I feel, there must be a way of handling this by javascript client side</p>
php javascript jquery
[2, 3, 5]
3,609,303
3,609,304
Jquery user control
<p>I have a problem with jquery not loaded in an asp user control.</p> <p>I want simply to add the click event when a checkbox is clicked.</p> <p>Here is my javascript file </p> <pre><code>$(document).ready(function() { var arr = jQuery(":checkbox[id*='drpAccountType']"); for (i = 0; i &lt; arr.length; i += 1) { $("#" + arr[i].id).click(function() { alert(this.id) }); } }); if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded(); </code></pre> <p>The user control pre render events:</p> <pre><code>Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender ScriptManager.RegisterClientScriptInclude(Me, Me.GetType, "CheckboxdropdownScript", ResolveUrl("~/Scripts/CheckBoxDropDown.js")) End Sub </code></pre> <p>the script is loaded fine but any usage of jQuery return undefined. Then only when the page is loaded I can excute the same code for the commande line in firebug. The jquery library is loaded in the master page.</p> <p>Whenever I'm using jquery within an asp user control I always find problems, and I always have to hack around to get it to work. I try all the entries in stackoverflow but I never found a one as general solution.</p> <p>did any one found a simple solution to use jquery with master pages, user control in asp.net I would appreciate if someone can share such valuable information.</p> <p>My manager is about to drop jquery from the application as we always waist lot of time just to find a workaround to have it to work with user controls.</p> <p>Please help, I like jquery and I really want to use it for client script.</p> <p>best regards</p>
asp.net jquery
[9, 5]
5,629,931
5,629,932
$.post not firing
<p>I have some script like this:</p> <pre><code>$("#button").click(function () { alert("before"); $.post("doAction.aspx?id=hotel", {}, function (response) { }); alert("after"); return false; }); </code></pre> <p>the <code>$.post</code> is not firing. I really don't know what the error is. I used the same script elsewhere and it worked fine. pls help out.</p>
jquery asp.net
[5, 9]