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
912,004
912,005
Uncaught ReferenceError, my function is not defned
<p>I'm creating a dyanamic scrolling div and it works fine on Jsfiddle as seen here --> <a href="http://jsfiddle.net/9zXL5/19/embedded/result/" rel="nofollow">http://jsfiddle.net/9zXL5/19/embedded/result/</a> yet on the browser I get: </p> <blockquote> <p>Uncaught TypeError: Cannot set property 'onscroll' of null</p> </blockquote> <p>So then I added <code>$(document).ready(function (){</code> to my code and got </p> <blockquote> <p>Uncaught ReferenceError: yHandler is not defined</p> </blockquote> <p>I'm not understanding why I'm getting these errors yet its flowing smoothly on jsfiddle. I'd really appreciate it if someone could tell me what I'm not understanding or missing. Code in question is below</p> <pre><code>var movelist = document.getElementById('movelist'); $(document).ready(function (){ function yHandler (){ var contentHeight = movelist.scrollHeight; var yOffset = movelist.clientHeight; var y = yOffset + movelist.scrollTop; if(y &gt;= contentHeight){ movelist.innerHTML += '&lt;div class ="newData"&gt;hey look at me&lt;/div&gt;'; } } }); movelist.onscroll = yHandler; </code></pre>
javascript jquery
[3, 5]
2,501,579
2,501,580
Run a Script to Disable a Script
<p>I need to run a script that will disable a another script on the page. How do I do this?</p> <p>(Internet Explorer Issues is why I am having to do this.) I am using jQuery 1.8.</p> <p>Please provide examples. </p>
javascript jquery
[3, 5]
5,762,410
5,762,411
Android draw chart
<p>I want to know API for draw a chart/graph in android. Already I have tried following API</p> <ul> <li><p>achartengine</p></li> <li><p>achartfree</p></li> <li><p>achart4j</p></li> </ul> <p>but I didn't get currect solution can any one help?</p>
java android
[1, 4]
763,012
763,013
Return statement does not work!
<p>I have this simple method here:</p> <pre><code>private Node addItem(Node current, Node target) { if (current.data.getId() &lt; target.data.getId()) { if (current.larger == null) { current.larger = target; Log.i("BinaryTree", "Added item: " + target.data.getId()); return target; } return addItem(current.larger, target); } else { if (current.smaller == null) { current.smaller = target; Log.i("BinaryTree", "Added item: " + target.data.getId()); return target; } return addItem(current.smaller, target); } } </code></pre> <p>when i debug it, the code gets to the line 'return target;', and just skips it and goes to the last return statement - 'return addItem(current.smaller, target);'! I have never in my life seen anything like this WTF?!?!</p>
java android
[1, 4]
5,822,105
5,822,106
IE not implemented javascript error
<p>I'm using some basic jQuery at <a href="http://s329880999.onlinehome.us/" rel="nofollow">http://s329880999.onlinehome.us/</a> and I'm getting a "not implemented" error in Internet Explorer. I'm guessing that this is to do with my using top (var s2). How can I make it work in IE?</p>
javascript jquery
[3, 5]
1,473,009
1,473,010
Android List of values with key
<p>I am trying to work out if I can use a resource file, while developing my android app, to hold a list of numbers using a string value as a key. For example</p> <p>numbers("UK")= 999 numbers("US") = 911</p> <p>As I said, this would ideally be in resource file rather than a Java class as it is more maintainable</p>
java android
[1, 4]
37,069
37,070
ASP.NET - Page.Form.Action error
<p>On my local development server, I am running version 2.0.50727.4955 on the live server I am running 2.0.50727.42.</p> <p>On my live server I get:</p> <p>Compiler Error Message: CS0117: 'System.Web.UI.HtmlControls.HtmlForm' does not contain a definition for 'Action'</p> <p>On my development server everything works fine. Is this a .NET version issue or something else? Is there a way to make this work on my liver server with its current .Net version? Is there a way to upgrade from 2.0.50727.42 to 2.0.50727.4955?</p> <p>Thanks</p> <p>EDIT (Code):</p> <pre><code> if (Request.PathInfo.Length != 0) { string reqPath = Request.PathInfo; string raw = Request.RawUrl; string url = Request.Url.ToString(); if (reqPath.Length &gt; 0) url = url.Replace(reqPath, ""); if (raw.Length &gt; 0) url = url.Replace(raw, ""); litBasePath.Text = "&lt;base href=\"" + url + "\"&gt;"; Page.Form.Attributes["Action"] = raw; } </code></pre> <p>EDIT (Local Setup)</p> <p>This is my local setup. I am not getting any compile errors when i run this locally.</p> <p><img src="http://i.stack.imgur.com/oexCK.png" alt="alt text"></p> <p><img src="http://i.stack.imgur.com/u9hSi.png" alt="alt text"></p> <p><img src="http://i.stack.imgur.com/HLhrq.png" alt="alt text"></p>
c# asp.net
[0, 9]
3,674,127
3,674,128
include button into .cs file
<p>I'm trying to read a text file containing the name of the image, and display it opon pageload.</p> <p>Let's say that the content in the text file is </p> <pre><code>Australia Picture101 Singapore Picture201 </code></pre> <p>Following is the code i tried and it does not display the image.</p> <pre><code>tableString += "&lt;table class='content_background' cellpadding='0' cellspacing='0'&gt;"; foreach (string line in lines) { string[] country = line.Split(token2); string[] image = country[1].Split(token); string row = "&lt;tr&gt;&lt;td class='left_content'&gt;" + country[0] + "&lt;/td&gt;" +"&lt;td&gt;&lt;table&gt;&lt;tr&gt;"; tableString += row; for (int i = 0; i &lt; image.Length; i++) { ---&gt; string row2 = "&lt;td class='right_content'&gt; &lt;asp:ImageButton ImageUrl='~/img/missing children pictures/" + "image[i]" + ".jpg'/&gt;" + "&lt;/td&gt;"; tableString += row2; } tableString += "&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;"; } tableString += "&lt;/tr&gt;&lt;/table&gt;"; container.InnerHtml = tableString; </code></pre> <p>Is there any other way to do this ? Thanks in advance. </p> <p>the screen shot is as follow <img src="http://i.stack.imgur.com/L0Y4V.png" alt="screen shot"></p>
c# asp.net
[0, 9]
4,689,177
4,689,178
Extending Python 3 with C++
<p>I'm trying to extend Python 3 using instructions given <a href="http://docs.python.org/release/3.1.3/extending/extending.html" rel="nofollow">here</a> and I'm fairly confident I've followed the instructions correctly so far, but it asks me to include this code:</p> <pre><code>PyMODINIT_FUNC PyInit_spam(void) { PyObject *m; m = PyModule_Create(&amp;spammodule); if (m == NULL) return NULL; SpamError = PyErr_NewException("spam.error", NULL, NULL); Py_INCREF(SpamError); PyModule_AddObject(m, "error", SpamError); return m; } </code></pre> <p>I'm writing this in MSVC++ 2010 and it's warning me that &amp;spammodule is undefined (the name of the module is spammodule.cpp), but it doesn't define it anywhere in the instructions so I assume that it should recognise it automatically as the name of the module.</p> <p>The full code is:</p> <pre><code>#include &lt;Python.h&gt; #include &lt;iostream&gt; using namespace std; static PyObject *SpamError; int main() { cout &lt;&lt; "Test" &lt;&lt; endl; system("PAUSE"); return(0); } static PyObject *spam_system(PyObject *self, PyObject *args) { const char *command; int sts; if (!PyArg_ParseTuple(args, "s", &amp;command)) return NULL; sts = system(command); return PyLong_FromLong(sts); } PyMODINIT_FUNC PyInit_spam(void) { PyObject *m; m = PyModule_Create(&amp;spammodule); if (m == NULL) return NULL; SpamError = PyErr_NewException("spam.error", NULL, NULL); Py_INCREF(SpamError); PyModule_AddObject(m, "error", SpamError); return m; } </code></pre>
c++ python
[6, 7]
1,658,620
1,658,621
disable browser button
<p>I want to remove previously visited url from history in asp.net so that if user click on back button of browser user will not go in previous url.</p> <p>Is there any other method than Window.history.forward()? Thanks.</p>
javascript asp.net
[3, 9]
52,490
52,491
How does Android accelerometer (Java in general) handles call back listeners?
<p>This question is basic for Java, not android. If the code that is inside listener interface does some complex calculations, what happens for callbacks given by the system. In Android accelerometer readings are collected in onSensorChanged(SensorEvent event). If I want to process "event" data and that its called around 30-40 times a second. What happens ? </p> <p>Does this reduces the calls to function? Or Does this lags the output but all call will finally get executed ?</p> <p>I know this should be handled in separate thread, but if large number of threads keep generating , this may be a problem. Also I cannot rely on Java System.currentTimeMillis(); for pinging every say 500 milliseconds as this is never reliable (in a way it guarantees the function will not called before 500 ms but not maximum time like it may be even after 1000 second, which in my case would be a problem as I need data atleast in 500ms).</p> <p>Or should I consider TimerTask instead for collecting data every 500 ms?</p>
java android
[1, 4]
1,509,868
1,509,869
jquery that just waits
<p>I normally set up my javascript code to have a function. But due to the fact that the application generates most of the HTML and javascript calls from a VB6 application I would like to create a jQuery function that is more like a listener. So for example if I have a td tag that has the class 'gridheader1' I would like the jQuery to wait for it to be clicked.</p> <p>I'm assuming that I would use the bind... But I'm getting javascript errors with it... If you can offer suggestions on where my code is wrong that would be great.</p> <pre><code>$('.gridheader1').bind('click', function() { alert('hi I got clicked'); }); </code></pre> <p>Again this just has to sit out there on the main .js file. It isn't attached to any functions. Please let me know.</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,529,855
3,529,856
Reduce power conssumption while wireless should be used
<p>I am working on my MSc dissertation right now. This dissertation has one related app which should be developed by android. One of the objectives of the research is about using wireless to sync data among the phones. In the meanwhile, I must consider power consumption which means reduce power consumption while using wireless. I am thinking about 3 possible wireless technologies for this app:</p> <ul> <li>wifi direct (p2p wifi) - fast, reliable, but not supported on many phones (even ones with Android >=4.0) (you would also probably need to two devices to test/develop this)</li> <li>regular wifi - fast, reliable, but requires at least an access point (i.e. some infrastructure, or another mobile device acting in part as an access point but does NOT Need internet access), code partially compatible with wifi direct</li> <li>Bluetooth - slow, unreliable, supported on most devices, requires no infrastructure (also probably need two devices to develop), code least </li> </ul> <p>Regarding these mentioned wireless technologies, I have few questions listed below (please consider that I need acceptable evidences or documentations to support my ideas):</p> <ol> <li>Which of these technologies consume less power?</li> <li>How can I reduce power consumption in android phone?</li> <li>Are there any practical strategies available in this case regardless of coding? For example consider sth in setting of the app or sth else?</li> </ol>
java android
[1, 4]
3,627,931
3,627,932
Run a Script to Disable a Script
<p>I need to run a script that will disable a another script on the page. How do I do this?</p> <p>(Internet Explorer Issues is why I am having to do this.) I am using jQuery 1.8.</p> <p>Please provide examples. </p>
javascript jquery
[3, 5]
4,783,861
4,783,862
How to detect when a text input changes with ie8
<p>I want to detect when a text input changes. I tried these, which worked in firefox but not in ie 8.</p> <pre><code>$('#taskSearch').bind('input', function() { alert($(this).val()); }); $('#taskSearch').live('input', function() { alert($(this).val()); }); $('#taskSearch').change(function() { alert($(this).val()); }); </code></pre>
javascript jquery
[3, 5]
5,741,822
5,741,823
common gridview for whole project asp.net
<p>How to create a grid view for whole project. (asp.net, c#)</p> <p>in project contains 10 forms and each forms contains a grid.</p> <p>i want to make it a (single grid)user-control .</p> <p>how can i make it. please give some sample source or a reference link</p>
c# asp.net
[0, 9]
3,680,034
3,680,035
How can i use regular expression check in jsvalidate?
<p>I am using jsvalidate.js for my form validation. i need to eliminate addition of quotes inside my textbox by using jsvalidate.js. If anyone knows help me in advance...</p>
javascript jquery
[3, 5]
2,730,136
2,730,137
How can I control the usage of a custom jar library?
<p>I need a way to essentially secure my jar library to allow registered apps to use it in their projects and deny usage to apps that weren't approved by me.</p> <p>It is fine if I hard code things in the lib for each distribution. I currently have this jar obfuscated.</p> <p>What are good approaches to restrict the usage of a jar?</p> <p>One idea was to lock the lib to a specific package so if the developer tries to use it in another project they can't. But I'm not sure if they can easily provide a custom fake Context to make it work...</p>
java android
[1, 4]
421,841
421,842
PHP and Java interoperablity
<p>I am working on windows using tomcat 6 and PHP/Java Bridge. I know how to access a Java file from PHP but how do we do it the other way i.e accessing PHP from Java</p> <pre><code>&lt;?php require_once("java\Java.inc"); $systemInfo = new Java("java.lang.System"); print "Total seconds since January 1, 1970: ".$systemInfo-&gt;currentTimeMillis(); ?&gt; </code></pre> <p>Also how do I access Java classes that are created by me. Do I write a CLASSPATH env variable or change the php.ini config file?</p>
java php
[1, 2]
5,779,886
5,779,887
Showing a formatted elapsed time
<p>On my upload file page I want to show an elapsed time (how long the user has been uploading the file for) in this format: <code>00:26</code>, which would be 26 seconds. <code>17:34</code> would be 17 minutes 34 seconds, etc.</p> <p>How could I do this? I have an event that gets called when the upload starts so I can set a Date variable from there, and I also have a function that gets called periodically for me to update the elapsed time.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,506,973
3,506,974
Auto incrementing of id and showing it in the textbox in 3 tier architecture
<p>I am using Visual Studio 2008, ASP.NET 3.5 and C# for my project. I am use 3-tier architecture for database connectivity. I have designed a form with the ID, name, age, etc. In the database table, id is the primary key. On the page load I want to display the next value of the id in the text box automatically. Then the user would have to enter the other details such as name, age and so on. After which, I want to submit the data to the table. Can any one suggest a good idea for this. I am new to 3 tiered architecture.</p>
c# asp.net
[0, 9]
2,550,901
2,550,902
How to add a specific class to appended LI which is loaded via ajax?
<p>This is my code. What I am trying to do is add a class "featured" to the first li item which gets added to this UL however, when I try this code, it does not work, it always add the class to every li inserted, while I want the class to be added only if there are no li in the ul and to the first li element added to this UL.</p> <p>My code:</p> <pre><code>$(".img_add").click(function(event){ event.preventDefault(); $('input:submit, p.upload-result').hide(); // hide submit button + results while working $(this).parent().after('&lt;p class="loading"&gt;&lt;img src="&lt;?php bloginfo('template_directory'); ?&gt;/img/loading_2.gif" alt="" /&gt;&lt;/p&gt;'); var path_img = $("#img_url").val(); var count_images_lib = $(".upload-images-lib").length; $.ajax({ url: '&lt;?php bloginfo('template_directory'); ?&gt;/ajax/add_image_url.php', type: 'POST', data: { path : path_img }, dataType: 'json', success: function(data){ $('.loading').remove(); $('input:submit').show(); if (data.status) { $('.upload-images-lib').prepend(data.message); if (count_images_lib == 1) { $('.upload-images-lib li:first-child').addClass('featured'); } alert(count_images_lib); $('p.upload-result').fadeIn(500).html('&lt;span class="success"&gt;&lt;?php _e('Your image has been added successfully.','sofa'); ?&gt;&lt;/span&gt;'); } else { $('p.upload-result').fadeIn(500).html('&lt;span class="error"&gt;' + data.message + '&lt;/span&gt;'); } } }); }); </code></pre> <p>What I want is to add the class to the first loaded li only. <strong>Please note: data.message is actually a list item in html format.</strong></p> <p>The problem is with count_images_lib always returning 1 and thus my class is added everytime. It is not with first/last selector.</p>
javascript jquery
[3, 5]
5,620,843
5,620,844
javascript/jQuery anonymous functions to populate an array
<p>Hi I was just wondering if building an array in javascript was possible using a function like so. I have a variable that is getting the margins of a series of elements using <code>$(ele).css('margin');</code>. This returns a string of <code>0px 0px 0px 0px</code> where I only want the left property to check whether it's been animated <code>-=</code> left.</p> <p>I can do a similar function but I know there must be a better way. Here's my example:</p> <pre><code>var marginsLeft = new array(); $(ele).each(function(i){ var r = $(i).css('margin').split(" "); marginsLeft[i]=r[3]; }); </code></pre> <p>I'm not entirely sure how to simplify this, but I'm sure it's possible :) thanks in advance.</p>
javascript jquery
[3, 5]
4,858,882
4,858,883
Update label C#
<p>When the page first load i have a label who has 0 or 1. Look at the code and you will se what i trying to do. But it don't work because the page allready loaded.</p> <pre><code>protected void rptBugStatus_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Label lblName = e.Item.FindControl("lblBugStatus") as Label; if (lblName.Text == "1") { lblName.Text = lblName.Text + "Under arbete"; } else if (lblName.Text == "0") { lblName.Text = "Fixad"; } else { } } } </code></pre>
c# asp.net
[0, 9]
526,519
526,520
How do i create a method/function in Jquery
<p>How do i create a method in Jquery</p> <p>For example</p> <pre><code>function dosomething() { // do something } dosomething();// i can call the function this way </code></pre> <p>How can i define function like dosomething() and call them in jquery?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,738,508
3,738,509
How can I display a dialog box for making a choice before a CALL is processed in android?
<p>I would like to intercept outgoing calls and pass them to a VOIP application. I see that the Google Voice application has a feature for displaying a question before each call is actually initiated. It provides the user with the choice:</p> <ul> <li>Initiate call via Google Voice</li> <li>Initiate call via standard call</li> </ul> <p>I would like a way to do something similar with my application (so that not all calls have to be routed through it). At the moment, I can intercept CALL events via a BroadcastReceiver, however, these are not allowed to open dialogs (thus making it possible to display the choice).</p> <p>What is the best way of achieving this goal?</p>
java android
[1, 4]
1,819,340
1,819,341
Skip line in ListBox C#
<p>I've want to populate a ListBox with a roulette game but I need to skip lines which doesn't work</p> <p>If the winning numbers doesn't match the list box must print as follow</p> <p>Sorry there was no winning number!</p> <p>You Loose!!!</p> <p>And if the winning number DOES match the betting number it should look like this:</p> <p>Winning Number #</p> <p>Bet: R#</p> <p>Bet-Type: #</p> <p>Total Winnings: R#</p> <p>note: # represents the numbers choosen</p> <p>I've tried two ways the "/n" and "system.Enviroment.NewLine" and nothing seems to work</p> <pre><code>protected void btnSpin_Click(object sender, EventArgs e) { Random random = new Random(); intNumbRolled = random.Next(36); if (intNumb == intNumbRolled) { winning = intBet * type; } else { winning = 0; } if (winning == 0) { ListBox1.Items.Add ("Sorry there was no winning number \nYou loose!!"); } else { ListBox1.Items.Add ("Winning number is " + intNumbRolled + System.Environment.NewLine + System.Environment.NewLine + "BET: R " + intBet + System.Environment.NewLine + "Bet-Type: " + type + System.Environment.NewLine + "Total Winnings: R " + winning); } } </code></pre> <p>Can someone please help?</p>
c# asp.net
[0, 9]
5,277,922
5,277,923
How to open the new window in C#
<p>I like to open a new window in my project. I am using two panels in my project When I click the "Viewdocument" link in gridview(panel1) it should display the window to open that file. But in my code its not working can any one help me to solve this issue. Here is the code.</p> <pre><code>if (myReader.Read()) { myReader.Close(); openWIndow("fr_OpenFile.aspx", "", fileName); Linkbutton_ModalPopupExtender.Show(); //OpenMyFile(); } else { myReader.Close(); Message("Cannot open selected file"); Linkbutton_ModalPopupExtender.Show(); return; } con.Close(); //OpenMyFile(); } else { Message("File not found"); Linkbutton_ModalPopupExtender.Show(); } } catch (Exception ex) { lblmsg.Text = ex.Message; } } private void openWIndow(String FileName, String WindowName, String qString) { String fileNQuery = FileName + "?value=" + qString; String script = @"&lt;script language=""javascript""&gt;" + "window.open(" + fileNQuery + WindowName + "," + "menubar=Yes,toolbar=No,resizable=Yes,scrollbars=Yes,status=yes" + " );" + "&lt;/script&gt;"; ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", script); } </code></pre> <p>Thanks in Advance</p>
c# asp.net
[0, 9]
1,665,018
1,665,019
.click function not working
<p>I have JavaScript for a commenting system, however when I click on the submit button with the class name "com_submit" nothing happens except the page reloads. Even if I leave the form empty and submit the alert should pop up but it isn't. What am I doing wrong?</p> <p>Here is my code: </p> <pre><code>$(function() { $('.com_submit').live("click", function() { var comment = $("#comment").val(); var user_id = $("#user_id").val(); var perma_id = $("#perma_id").val(); var dataString = 'comment='+ comment + '&amp;user_id='+ user_id + '&amp;perma_id=' + $perma_id; if(comment=='') { alert('Please Give Valid Details'); } else { $("#flash").show(); $("#flash").fadeIn(400).html('&lt;img src="ajax-loader.gif" /&gt;Loading Comment...'); $.ajax({ type: "POST", url: "commentajax.php", data: dataString, cache: false, success: function(html){ $("ol#update").append(html); $("ol#update li:first").fadeIn("slow"); $("#flash").hide(); } }); } return false; }); }); </code></pre> <p>I have tried using .click, .live and .bind none of these work</p>
javascript jquery
[3, 5]
4,971,514
4,971,515
Detect if Javascript disabled, if yes then redirect
<p>I'm having problems with detecting Javascript. I've created a jQuery Popup window which is working only for users who has javascript enabled. However if their browser has JS disabled, I'd like to redirect them to index.php WHEN they click on the button.</p> <p>So basically if someone has JS enabled he/she would get the popup window, and if they don't have, they would have been redirected.</p> <p>Is it possible? Also if would this work on mobile devices aswell?</p>
javascript jquery
[3, 5]
5,171,129
5,171,130
JS /JQuery Form Submit Delay?
<p>I've implemented this 'locksubmit' plugin <a href="http://blog.leenix.co.uk/2009/09/jquery-plugin-locksubmit-stop-submit.html" rel="nofollow">http://blog.leenix.co.uk/2009/09/jquery-plugin-locksubmit-stop-submit.html</a> where it changes the display state of the button to disabled. I then want the form to be delayed by a few seconds before posting to the form URL.</p> <p>What would I have to add in or modify to delay the form "post" once the user has clicked the submit button?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,283,605
3,283,606
Function doesn't work at second call
<p>i have this function</p> <pre><code>function notify() { alert('oo'); $("#SuccessNotification").dialog({ bgiframe: true, modal: true, title: 'success', buttons: { Ok: function() { $(this).dialog('close'); } } }); } </code></pre> <p>the alert works each time this function is called but the dialog is getting poped out only first time</p>
javascript jquery
[3, 5]
2,785,609
2,785,610
need to handle double and single quote in C# code behind
<p>I am trying to handle both double and single quote in my code behind , but none of them are working. Below is my code</p> <pre><code>private String _systemPath; public String SystemPath { get { // return _systemPath = _systemPath.Replace("'", "\'").Replace("\"", @"\\\""); return _systemPath = _systemPath.Replace("'", @"\'").Replace(@"\""", "\""); } set { _systemPath = value; } } </code></pre> <p>any help will be appreciated.</p>
c# asp.net
[0, 9]
4,390,720
4,390,721
saving webpages in android
<p>Now I am doing an application to save webpages for offline reading. If our application is switched on then the pages we visited will be saved and we can open those pages in offline mode. Please provide the idea that how we can work on the application. Help me friends. </p>
java android
[1, 4]
104,662
104,663
Draw custom lines on chart
<p>I've a requirement,</p> <p>Generate a line chart, then user must be able to draw custom lines on the chart and save the chart with newly added lines. I prefer to use High chart or Google chart for generating the chart, but I couldn't find a solution for drawing custom line on the chart. Is there any way to accomplish my requirement?</p>
c# jquery
[0, 5]
2,267,257
2,267,258
What is better solution to passing an uknown parameter problem?
<p>My problem is like this:</p> <p>In <code>ASP</code> <code>DetailsView</code> component we have three different EventArgs for different DB operations: <code>DetailsViewInsertedEventArgs</code>, <code>DetailsViewDeletedEventArgs</code>, <code>DetailsViewUpdatedEventArgs</code>.</p> <p>All above EventArgs have common properites, I am interested in two of them: <code>Exception</code> and <code>ExceptionHandled</code>. Unfortunately those two properties are not existant in the common ancestor for those event args.</p> <p>I would like to create a method like this:</p> <pre><code>public void DoSomething(ref CommonAncestorForDVArgs args) { if (args.Exception != null) { //do something with an exception args.ExceptionHandled = true; } } </code></pre> <p>Of course this is not possible due to the fact that I've described earlier. Solution which I came up with is this:</p> <pre><code>public void DoSomething(Exception e, bool ExceptionHandled) { if (e.Exception != null) { //do something with an exception ExceptionHandled = true; } } </code></pre> <p>But I am wonder if there is something better?</p>
c# asp.net
[0, 9]
2,570,931
2,570,932
Android, GridView, Click an Image to show full size
<p>I want to have a gridview where an image click displays the image full screen without creating a new activity. I have the grid set up. </p> <pre><code> GridView gridview = (GridView) findViewById(R.id.gridview); gridview.setAdapter(new ImageAdapter(this)); gridview.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { } }); } </code></pre> <p>i think i need to use setImageResource(R.drawable.?); </p> <p>but im just kind of confused. any help would be great</p>
java android
[1, 4]
3,889,744
3,889,745
jQuery attribute selector - am I doing something wrong?
<pre><code>var selector = "ul.lower-menu li a[innerText=\"" + PanelSettings[tab_name_key] + "\"]"; </code></pre> <p>I'm trying to get horizontal menu tab that has innerText property set to the previously stored value. </p> <p>The config value is stored like this:</p> <pre><code>PanelSettings[tab_name_key] = $("ul.lower-menu li:first &gt; a").prop("innerText"); </code></pre> <p>It is actually there and it always has the proper value.</p> <p>I get nothing from jQuery - am I doing something obviously wrong here?</p> <p>Edit: I'm using jQuery 1.6.4</p>
javascript jquery
[3, 5]
1,221,029
1,221,030
How to add months by quarter using java script
<p>Hereby i am the following inputs:</p> <p><strong>Months to be separated by</strong> : 4 months</p> <p><strong>Will have the date with month and year</strong>: 07-05-2011.</p> <p>Now i need to add months by 4 using java script or jquery. How can this be done?</p> <p><strong>For example:</strong></p> <p><strong>I am having the date as : 01-01-2011 and the duration is 4</strong></p> <p><strong>My output should be:</strong></p> <p>01-12-2010</p> <p>01-04-2011</p> <p>01-08-2011</p> <p>01-12-2011</p> <p><strong>For example if it is:</strong></p> <p><strong>I am having the date as : 01-06-2011 and the duration is 4</strong></p> <p><strong>My output should be:</strong></p> <p>01-06-2011</p> <p>01-10-2011</p> <p>01-02-2012</p> <p>01-06-2012</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
19,517
19,518
ASP.Net C# JavaScript Popup Window Help
<p>I've looked all over the place and had very little luck.</p> <pre><code>try{ FooError(); } catch (Exception Exc){ ClientScript.RegisterClientScriptBlock(this.GetType(), "errorPop", @"&lt;script language='javascript'&gt; alert(" + Exc.Message + "); &lt;/script&gt;"); return; } </code></pre> <p>I keep getting a javascript error saying "Expected a ')'.". I've tried the script with a @ at the start (like it is), without a @ at the start, with and without a semicolon at the end. I've tried </p> <pre><code>ClientScript.RegisterClientScriptBlock(this.GetType(), "errorPop", @"&lt;script type=\"text/javascript\"&gt; alert(" + Exc.Message + "); &lt;/script&gt;"); </code></pre> <p>I've been able to get this to work with a static value in the alert function</p> <pre><code>ClientScript.RegisterClientScriptBlock(this.GetType(), "errorPop", @"&lt;script language='javascript'&gt; alert('Foo'); &lt;/script&gt;"); </code></pre> <p>But that's not what I need. What am I doing wrong here? Is there a better way? I guess what I mean to ask is how do you use a C# string variable in a JavaScript alert box, if it's even possible.</p> <p>Thanks.</p> <p>This is my first question I hope I did it right -.-;</p>
c# javascript asp.net
[0, 3, 9]
4,287,746
4,287,747
asp.net json displaying weird results
<p>I am having trouble displaying results recieved from asp.net WebMethod. I have a HTML template and fill in the results from JSON response. The problem is that the first response is being displayed once, the second is displayed 2 times, the third 4 times, the fourth 8 times and so on . Here is the jQuery (I need to reference "d" first because the response is comming from asp.net and they put it there automatically)</p> <pre><code> function fnGetContent(keyword) { var NewKeyword = keyword.tag; var type = keyword.type var oldresults = $("#fillresultsdiv").html() $('#hidQueryType').val('tagsearch'); $.ajax({ type: "POST", //GetEvents(iType As Integer, sSearch As String) url: "Default.aspx/GetEvents", data: "{'iType':'" + type + "','sSearch' : '" + NewKeyword + "' }", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { var events = []; var obj = $.parseJSON(msg.d); $.each(obj.res, function() { var newRow = $('.Template').clone(); // Now loop through the object for (var prop in this) { if (this.hasOwnProperty(prop)) { // Lucky for you, the keys match the classes :) $('.' + prop, newRow).text(this[prop]); } } $('#fillresultsdiv').append(newRow); }); </code></pre> <p>There is only one entry in the JSON for each event, it is the jQuery code that is making this happen, sample response:</p> <pre><code> {"d":"{\"res\":[{\"day\":\"26\",\"dayofweek\":\"Tue\",\"month\":\"Jun\",\"title\":\"Glen Hansard\" ,\"venue\":\"Vic Theatre\",\"time\":\"7:00 PM\",\"ticketurl\": \"http://seatgeek.com/glen-hansard-tickets/chicago-illinois.... </code></pre>
javascript jquery asp.net
[3, 5, 9]
4,089,096
4,089,097
onchange event - IE error
<p>In my code behind, I have - </p> <pre><code>tbWhatIfBeginDate.Attributes.Add("onchange", "checkDates(" + tbWhatIfBeginDate.ClientID + ", " + tbWhatIfEndDate.ClientID + ")"); tbWhatIfEndDate.Attributes.Add("onchange", "checkDates(" + tbWhatIfBeginDate.ClientID + ", " + tbWhatIfEndDate.ClientID + ")"); </code></pre> <p>and here is my javascript function - </p> <pre><code>function checkDates(BeginDateId, EndDateId) { if (BeginDateId.value &gt; EndDateId.value) { var beginDt = new Date(BeginDateId.value); var endDt = new Date(EndDateId.value); var newDt = new Date(endDt.getTime() - (24 * 60 * 60 * 1000)); var y = newDt.getFullYear(), m = newDt.getMonth() + 1, // january is month 0 in javascript d = newDt.getDate(); BeginDateId.value = [pad(m), pad(d), y].join("/"); } } </code></pre> <p>when I run through Visual Studio 2010, it works.</p> <p>When I deploy to my test server, I get an error message. "Object expected - Line:176,Char:1"</p> <p>line 176 is - input name="ctl00$cpMain$tbWhatIfBeginDate" type="text" value="8/1/2012" id="ctl00_cpMain_tbWhatIfBeginDate" onchange="checkDates (ctl00_cpMain_tbWhatIfBeginDate, ctl00_cpMain_tbWhatIfEndDate)" style="width:70px;"</p> <p>I don't see an error.</p> <p>Ideas?</p>
c# javascript
[0, 3]
5,615,815
5,615,816
Given a start and end date, create an array of the dates between the two
<p>Right now, I have this on my page:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { var days = [ { Date: new Date($('#hfEventStartDate').val()) }, { Date: new Date($('#hfEventEndDate').val()) } ]; }); &lt;/script&gt; &lt;asp:HiddenField ID="hfEventStartDate" runat="server" /&gt; &lt;asp:HiddenField ID="hfEventEndDate" runat="server" /&gt; </code></pre> <p>I'm setting hfEventStartDate and hfEventEndDate when the page loads. With my code right now, it creates an array with two values: the start date and the end date. But I'd like to also have the array contain all the dates in between. How can I do that?</p>
javascript jquery
[3, 5]
1,519,006
1,519,007
Deserilization an object in web browser
<p>I have a serialized object in C# .net 4 which contains some images and strings. </p> <p>What I want is send that object to web browser and deserialize it in client's web browser. </p> <p>What are the technologies that I will need? Is is possible to do this? My requirement is to save a class with images and few strings to hard disk and use it back. </p>
c# asp.net
[0, 9]
639,523
639,524
Call a Javascript function within an inline statement
<p>Quick question: It's kind of tough to describe so let me just show an example.</p> <p>Is there anyway to do this: (I'm using jQuery but this is a general javascript question)</p> <p>$('div.element').offset().x;</p> <p>$('div.element').offset() by itself will return {'x' : 30, 'y' : 180}, so I'm just wondering if there is any compact way of doing this without creating an extra variable.</p> <p>Thanks! Matt</p>
javascript jquery
[3, 5]
3,849,382
3,849,383
setInterval works online on same sytem (with 2 browsers open) but not online on separate systems
<p>I have a setinterval code updating a div. This works fine when tested in two separate browsers on the same system but when I test online on say a separate mac and PC and it stops. </p> <p>The code is as follows:-</p> <p>Javascript:</p> <pre><code> function setupAjaxIntervalDiscuss(){ setInterval(function() { var datastring = 'refreshchat=true&amp;projid=' + proj_id + '&amp;uid=' + uid; ajaxUpdateDiscussion(datastring); }, 2000); } function ajaxUpdateDiscussion(ajaxdata){ $.ajax({ type: "POST", url: "uploaddata.php", data: ajaxdata, success: function(data){ $("#discussresult").html(data); refreshNav();//Updating a scrollbar styled with JS } }); } </code></pre> <p>PHP(this update correctly just here for ref) :</p> <pre><code> if(isset($_POST["refreshchat"])){ $user_id= $_POST['uid']; $proj_id=$_POST['projid']; echo '&lt;img class="closeddiscuss" src="images/closey.png" title="close" alt="close"/&gt;'; $get_discuss_query = "SELECT * FROM discuss INNER JOIN user ON discuss.user_id=user.user_id WHERE discuss.project_id=$proj_id ORDER BY discuss_id DESC"; $get_discuss_result=mysql_query($get_discuss_query); while($row=mysql_fetch_assoc($get_discuss_result)){ $text = nl2br($row['discuss_text']); $name = $row['user_name']; $user_profileimageurl = $row['user_profileimageurl']; echo '&lt;div class="discussbubble"&gt;&lt;p&gt;'.$text.'&lt;/p&gt;&lt;img class="smallprofileimage" src="'.$user_profileimageurl.'" alt="user profile image"/&gt; by '.$name.'&lt;/div&gt;'; } } </code></pre>
php javascript jquery
[2, 3, 5]
1,877,995
1,877,996
quoting a string
<p>I found a bit of code on the web that I would like to use.</p> <pre><code>$(document).ready(function() { $(".fbreplace").html.replace(/&lt;!-- FBML /g, ""); $(".fbreplace").html.replace(/ --&gt;/g, ""); $(".fbreplace").style.display = "block"; }); </code></pre> <p>The problem is the browser thinks</p> <pre><code>&lt;!-- </code></pre> <p>is a real comment. How would I quote it in a way to tell the browser look for that string and it is not a real comment?</p>
javascript jquery
[3, 5]
637,206
637,207
disable certain navigation links in popup window (external website)
<p>Hi I am opening an external website in my pop window. I would like to disable certain links in that popup. </p> <p>i.e. I am opening <a href="http://www.yahoo.com" rel="nofollow">http://www.yahoo.com</a> in pop and I want to disable some links in that pop-up so that who ever visit yahoo.com using my website, will not able to click on some links...</p> <p>Is it possible? any idea?</p>
javascript jquery
[3, 5]
3,552,473
3,552,474
In a time when starting to turn off the display of the activity, and then start it
<p>I now have a activity receiver display information from service to send, receive after there will be no closed the activity, led him to stay on after completion of reception interface. The beginning want to once again start time time, to close out the activity, then open it again, service came from the information receiving display. Timing start broadcasting there through the log to see is received by the start time information, but because the activity received after the page has no exit, or not to move ... ...</p> <p>The problem is this:</p> <p>For example, every eight points from time to time to start at eight tomorrow, start, and then after a few hours, finished the work, the display of the activity will stop at the last page does not turn off, always stop until the day after tomorrow, when the day after tomorrow eight broadcast from time to time, the activity life has no reaction.</p> <p>This problem I began with a solution is to turn it off and then restart, and now is in the service off him, after switching off, acquired the regular broadcast can start his ... Eight.</p> <p>The activity with dynamic registration broadcasting, receiving and displaying service information ( service's sendBroadcast ( intent ) continued to broadcast, until the thread to run over ); and the activity is made by another assignment activity boot, this arrangement the task of activity is true by regular broadcasting started.</p> <p>Again, now want to once again start time time, do not shut off the activity, let him continue to receive display service pass information ... How to write ah.</p> <p>CSDN for help with link: <a href="http://topic.csdn.net/u/20120626/10/7d163b1d-d689-4dda-a7f5-b117e4c1f7e4.html" rel="nofollow">http://topic.csdn.net/u/20120626/10/7d163b1d-d689-4dda-a7f5-b117e4c1f7e4.html</a></p> <p>差不多解决了,原因是这个activity的mainfest里面有个属性是这样的:android:launchMode="singleTask" 改成android:launchMode="singleTop" 就可以了,不过出现了新问题,我要继续苦逼下去了……</p>
java android
[1, 4]
31,652
31,653
How can I force a web user to read and check an NDA before proceeding?
<p>Every time a user registers to our site we need to show a NDA (non-disclosure agreement). In order to continue the user has to accept it. My issue is that I have the NDA in all one page and the user does not really read it and accept (like we all do). </p> <p>What I want is to make sure the user reads the NDA and accepts it one he "read" it?</p> <p>What I have now is a simple jQuery validation if the user checks a box and click on accept. then it goes to the next page.</p> <p>Here's what i have</p> <pre><code>&lt;script&gt; $(document).ready(function() { $('#go').click(function() { // check if checkbox is check and go to next page // i have this code }); }); &lt;/script&gt; &lt;div&gt; full nda &lt;hr&gt; &lt;input type=checkbox&gt; &lt;input type=button value=go id=go&gt; &lt;/div&gt; </code></pre> <p>I already have the code for the checkbox and button</p> <p>i simply dont want the user to blindly accept the nda</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,440,190
2,440,191
Browser is not smooth while using jQuery "replaceWith"
<p>I'm using jQuery replaceWith to update information of my website. Div elements which are returned are small. The function is called after 5 minutes. When I focus on browser, replaceWith function will run but my browser is not smooth and sometime can crash. Which plugin or solution can I use to resolve the problem ? I used: </p> <pre><code>$('#hotpost').hide().html(newHtml).fadeIn("slow"); $('#hotpost div.content').hide().replaceWith(newHtml).fadeIn("slow"); </code></pre>
javascript jquery
[3, 5]
5,890,679
5,890,680
Jquery add more buttons
<p>dynamically add more buttons not working in jquery and validations for the form works when I remove the jquery-1.9.1 script. in my php file , and when i keep the jquery 1.9.1 library file add more buttons works fine but validations for the form won't work</p>
php jquery
[2, 5]
5,733,434
5,733,435
Check if a given DOM element is ready
<p>Is there a way of checking if the HTML DOM element/s for a given selector/element are ready yet using jQuery or JavaScript? </p> <p>Looking at the jQuery <a href="http://api.jquery.com/ready">api</a> for the ready function it looks like it can only be used with the document object. If ready cannot be used for this purpose is there another way of doing this?</p> <p>e.g.</p> <pre><code> $('h1').ready(function() { //do something when all h1 elements are ready }); </code></pre> <p>Obviously I could use </p> <pre><code>$(document).ready(function() { //do something when all h1 elements are ready }); </code></pre> <p>But if all the h1's load first then the code specific to h1 elements will only execute after the whole document is ready even though it could actually execute earlier.</p> <p>Thanks in advanced for the help.</p>
javascript jquery
[3, 5]
2,302,651
2,302,652
Passing jQuery variable to PHP - 500 Internal Server Error
<p>I am trying to pass a jQuery value to PHP as follows:</p> <pre><code>var your_var_value=1200; $.ajax({ type: "POST", url: "scripts/php/controllers/tariff.fare.controller.php", data: { var_value: your_var_value}, error:function(request){alert(request.statusText)}, success:function(result){ alert(your_var_value); } }); </code></pre> <p>To the following:</p> <pre><code>&lt;?php require_once('models/sql.php'); require_once('models/server.php'); require_once('models/journey.php'); class TariffFareController { // If there is no fixed fare, use route calc if ($fixed_fare_result == null) { $distance=$_POST['var_value']; if ($distance &gt; 1100) { $fare = 222.00; } else { $fare = 111.00; } //MORE CODE } </code></pre> <p>But when I do this I get a <code>500 Internal Server Error</code></p> <p>I know the URL I am passing this to is correct, any ideas ?</p>
php jquery
[2, 5]
3,199,942
3,199,943
Android drawBitmap draws a kind of checkerboard pattern
<p>Okay maybe I'm missing something here but when I do </p> <pre><code> canvas.drawRGB(0x80, 0x80, 0x80); </code></pre> <p>I get a clean and expected grey screen: <img src="http://i.stack.imgur.com/BIqrD.png" alt=""></p> <p>But when I use this code</p> <pre><code>pixels = new int[800*480]; ... for(int x = 0; x &lt; 800; x++) { for(int y = 0; y &lt; 480; y++) { pixels[x+y*800] = 0xff808080; } } canvas.drawBitmap(pixels, 0, 800, 0, 0, 800, 480, false, null); </code></pre> <p>My phone draws something like this: (note the 'checkerboard' pattern; which shouldn't be there) <img src="http://i.stack.imgur.com/5T64b.png" alt="enter image description here"></p> <p>The same happens in the emulator, so I guess I'm doing something wrong?</p>
java android
[1, 4]
4,263,417
4,263,418
How can I add elements to this object
<p>If I had this structure </p> <pre><code>var data = { "people": [ { "name" : "John", "id" : 1 }, { "name" : "Marc", "id" : 2 } ] } </code></pre> <p>I want to add more elements to this, in JavaScript, specifically in jQuery to then send it like this</p> <pre><code>var dataString = JSON.stringify(data); $.post('some.php', { data: dataString}, showResult, "text"); </code></pre>
javascript jquery
[3, 5]
4,478,949
4,478,950
Android Development: Class That Creates an Object, Calls Some Methods Then Returns That Object (How?)
<p>I'm wondering how I'd go about making a class, let's call it Class Master, where: - You call Class Master and it calls Class A, and calls some of that Class A's methods, then returns Class A so you can call methods from the returned Class A where ever you called Class Master.</p> <p>Basically, I want to turn this code:</p> <pre><code>//Create FTPClient object and connect FTPClient ftpClient = new FTPClient(); ftpClient.connect(server); ftpClient.enterLocalPassiveMode(); ftpClient.login(username); ftpClient.listFiles("/"); </code></pre> <p>Into this code:</p> <pre><code>FTPClient ftpClient = new ftpConnection(); //Connects, enters passive mode and logs in then returns the FTPClient object we created so we can do other stuff with it, like below: ftpClient.listFiles("/"); </code></pre> <p>So that I can have one single call that I can use in different activites to connect to an FTP, if you understand what I mean.</p> <p>I tried myself but I didn't get the desired effect for some reason (don't have the code I tried anymore)</p> <p>Thanks, Alex.</p>
java android
[1, 4]
3,350,970
3,350,971
How to put jQuery Dialog popup div into the jQuery code?
<p>I have a very simple message to display in one jQuery popup and I just want to generate it without adding extra divs into my HTML.</p> <p>What I'd like to do is just open a dialog box with a message and thats it.</p> <p>Here is something like that I want:</p> <pre><code>$("&lt;div&gt;Hello sir&lt;/div&gt;").dialog("open"); </code></pre> <p>But that doesn't work. Should it? It seems like that should just open a simple dialog box, shouldn't it?</p> <p>Thanks!!</p>
javascript jquery
[3, 5]
4,150,428
4,150,429
Slow collision detection using bounding box
<p>I have small library i want to use for creating games. First, i tried to implement pixel perfect collision detection, but that did not went well, so i decided to use simple bounding box collision detection. It works fine, but after amount of objects exceeds around 20, it starts slowing down. Here is my code: (Runs in loop, 25 times per second)</p> <pre><code>for (int i=0;i&lt;sc.collGr.size();i++){ CollisionGroup gr=sc.collGr.get(i); Collidable[] cc=gr.getCollidables(); for (int l=0;l&lt;cc.length;l++){ for (int w=l+1;w&lt;cc.length;w++){ if (BorderBox.areColliding(cc[l].getBorderBox(), cc[w].getBorderBox()){ addEventToHandler(sc.collGr.get(i),cc[l],cc[w]); } } } } </code></pre> <p>part of BorderBox class:</p> <pre><code>public class BorderBox { int top; int down; int left; int right; /** * Creates new BorderBox object * Arguments: (top, down, left, right); * */ public BorderBox(int topy,int downy, int leftx,int rightx){ top=topy; down=downy; left=leftx; right=rightx; } /** * Checks if two provided BorderBoxes are colliding. * */ public static boolean areColliding(BorderBox a,BorderBox b){ if (b.left&lt;=a.right &amp;&amp; b.right&gt;=a.left &amp;&amp; b.down&gt;=a.top &amp;&amp; b.top&lt;=a.down){ return true; } return false; } </code></pre>
java android
[1, 4]
1,974,674
1,974,675
Changing href attribute
<p>In need to change a part of this href:</p> <pre><code>&lt;a href="media/xxxxx-yyy.jpg"&gt;large pic&lt;/a&gt; </code></pre> <p>I have some designs, and some colors, xxxxx stands for designnumber and yyy for colornumber, when one of the designs is clicked or one of the colors the href should change according to the value:</p> <pre><code>&lt;a href="#"&gt;design1&lt;/a&gt; &lt;a href="#"&gt;design2&lt;/a&gt; &lt;a href="#"&gt;design3&lt;/a&gt; &lt;a href="#"&gt;color1&lt;/a&gt; &lt;a href="#"&gt;color2&lt;/a&gt; &lt;a href="#"&gt;color3&lt;/a&gt; </code></pre> <p>Is there any way to do this with JQuery?</p>
javascript jquery
[3, 5]
474,640
474,641
Choosing between PHP or Java to use
<p>I'm having trouble choosing between PHP or Java to develop a fairly small web application for a school project.</p> <p>Our project is to create a very crude/working/barebones ticket and events management system. Think of the basic functionality of Ticketmaster.</p> <p>I have people in my team who are confident with Java but not ALL. Would it be better to choose PHP due to its small learning curve?</p> <p>Obviously the standard things like speed and security wont matter since this is a project. We want the coding/debugging to be easier.</p> <p><strong>EDIT:</strong> At the end of the project we'll have to demonstrate our web app using our laptop, so no distribution etc is required. Our goal is: as long as it works and ensures it. It doesn't have to work well, it doesn't have to use super efficient code (we are not marked by our code).</p>
java php
[1, 2]
2,395,422
2,395,423
.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]
3,550,179
3,550,180
jQuery "please wait" while php executes
<p>I have a script that connects to the PayPal api to check for a valid credit card input. The script can take about 5 seconds to execute and in an effort to keep users from clicking "submit" multiple times if they don't see an immediate response, I'd like to place a "Please wait" indicator.</p> <p>I have a div, "pleaseWait" which is hidden. In jQuery I have:</p> <pre><code>$('#submit').click(function(){ $('#pleaseWait').show(); }); </code></pre> <p>The only problem is if there is an issue, it will send the php error back and the "Please wait" will continue on screen. I decided to try another approach and echo the jQuery in php after the script starts to run, and hide it if there is an error.</p> <pre><code> /* Echo the jQuery so the "Please wait" indicator will show on screen */ echo "&lt;script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js\"&gt;&lt;/script&gt;"; echo "&lt;script type='text/javascript' charset='utf-8'&gt;"; echo "\$(document).ready(function(){"; echo "\$('#pleaseWait').show();"; echo "});"; echo "&lt;/script&gt;"; if($error == ""){ /* There is not an error, run php. */ }else{ /* There was an error, stop the jQuery from displaying the "please wait" and display the error */ echo "&lt;script type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js\"&gt;&lt;/script&gt;"; echo "&lt;script type='text/javascript' charset='utf-8'&gt;"; echo "\$(document).ready(function(){"; echo "\$('#pleaseWait').hide();"; echo "});"; echo "&lt;/script&gt;"; } </code></pre> <p>This can work, but seems really messy. Is there a better way to do this other than multiple echos in php?</p>
php javascript jquery
[2, 3, 5]
5,262,496
5,262,497
Adding characters to string (input field)
<p>I have a text box where the value is the result of a calculation carried out in jQuery. What I would like to do, using jQuery, is to display brackets around the number in the text box if the number is negative. </p> <p>The number may be used again later so I would then have to remove the brackets so further calculations could be carried out.</p> <p>Any ideas as to how I could implement this? </p> <p>Thanks</p> <p>Zaps</p>
javascript jquery
[3, 5]
4,471,632
4,471,633
Page_Load not loaded after inheriting my own Page
<p>I am trying to create BasePage Web.UI.Page that is inherited by my main page. But when i create public class mypage : BasePage method Page_Load of this class is not loaded in page live cycle. BasePage does not contain any Page_Load. has anybody got a clue where can be the problem? thanx</p>
c# asp.net
[0, 9]
2,693,874
2,693,875
jQuery select all elements with a common class
<p>I want to handle a click event across a set of links so tried to approach this by adding a secondary class like following:</p> <pre><code>&lt;a href="..." class="foo external"&gt;Test 1&lt;/a&gt; &lt;a href="..." class="bar external"&gt;Test 2&lt;/a&gt; &lt;a href="..." class="car external"&gt;Test 3&lt;/a&gt; &lt;a href="..." class="dar"&gt;Don't handle this one&lt;/a&gt; </code></pre> <p>Then tried this jquery selector to select the "external" class on links:</p> <pre><code>$('a.external').click(function(e) { do something here... }); </code></pre> <p>However this isn't working like I expected. What's the right way to handle this? Should I just use a wildcard selector like the following or is there a better way?</p> <pre><code>$('[class^="someclass"]').click(function(e) { .... }); </code></pre>
javascript jquery
[3, 5]
159,399
159,400
Asp.Net ViewState lost with RegisterClientScriptBlock
<p>I am validating a zip code using Javascript that is generated server-side, and injected when a LinkButton is clicked. Then, I retrieve the return value by calling a server-side function when the page loads. </p> <p>This works nicely, but the problem is that the ViewState is completely lost after PostBack. Below is the code, starting with the page_load event, the button click event, and then the callback called from the page_load event. </p> <p>Is there a way I can somehow save the ViewState, maybe easily in a session variable? Or is there a workaround I can use?</p> <pre><code>// In Page_Load if (Request.Form["__EVENTTARGET"] == "CallFunction") { GetValidateZipCodeScriptReturnValue(Boolean.Parse(Request.Form["__EVENTARGUMENT"].ToString())); } // OnClick for LinkButton private bool ValidateZipCode(string zip) { StringBuilder script = new StringBuilder(); script.Append("&lt;script language='javascript' type='text/javascript'&gt;"); script.Append(@"var regex = /^\d{5}$|^\d{5}-\d{4}$/;"); script.Append("__doPostBack('CallFunction', regex.test(" + zip + "));"); script.Append("&lt;/script&gt;"); Type t = GetType(); if (!ClientScript.IsClientScriptBlockRegistered(t, "ValidateZipCodeScript")) { ClientScript.RegisterClientScriptBlock(t, "ValidateZipCodeScript", script.ToString()); } return false; } // Method called on PostBack to get the return value of the javascript private void GetValidateZipCodeScriptReturnValue(bool valid) { m_ZipCode = uxZip.Text; if (valid) { Response.Redirect(string.Format("~/checkout/overview.aspx?pc={0}&amp;zc={1}", ProductCode, ZipCode)); } else { Alert.Show("The entered zip code is invalid. Please ensure the zip code is a valid zip code."); SetupPostBackViewState(); ScrollToZipCode(); } } </code></pre>
c# asp.net javascript
[0, 9, 3]
4,225,357
4,225,358
how do I disable the cache on for a single image (a single page)?
<p><strong>ASP.NET Image Caching Problem (How to Disable it?)</strong>.IE browser load old image from directory C:\Documents and Settings...\Local Settings\Temporary Internet Files </p> <pre><code> protected void Page_Load(object sender, EventArgs e) { MembershipUser user = Membership.GetUser(); imCropped.ImageUrl = (File.Exists(Server.MapPath("..") + @"\Users\" + user.ProviderUserKey.ToString() + @"\" + user.ProviderUserKey.ToString() + ".gif"))? "~/Users/" + user.ProviderUserKey.ToString() + "/" + user.ProviderUserKey.ToString() + ".gif" : "~/Images/thumb.gif"; } protected void ButtonJcrop_Click(object sender, EventArgs e) { ... String mapPath = @"\Users\" + user.ProviderUserKey.ToString() + @"\" + user.ProviderUserKey.ToString() + ".gif"; bmpCropped.Save(Server.MapPath("..") + mapPath); imCropped.ImageUrl = Request.ApplicationPath + mapPath; ... } </code></pre>
c# asp.net
[0, 9]
5,506,705
5,506,706
How to execute a python script from Java?
<p>I have a python script and need to run the python script from Java. How to do this?</p>
java python
[1, 7]
3,879,714
3,879,715
Adding Records to Table from Template Field Checkbox selection and Gridview Boundfield
<p>I am currently building a Attendance Register System in ASP.Net using C#. The system has a database including these Sql tables;</p> <pre><code>Attendance Table AttendanceID Present (boolean type) StudentID Student Table StudentID StudentName CourseID Course Table CourseID CourseName </code></pre> <p>I have populated a dropdownlist with the Course Table and based on the selected <code>CourseID</code> in the dropdownlist a gridview is populated from the student table where the <code>studentID</code> and <code>StudentName</code> is displayed with the same <code>CourseID</code> that is selected in the dropdownlist. This works fine. </p> <p>The Attendance Table does not contain any records untill the register has been taken and records are added.</p> <p>Now for the tricky bit, the gridivew displays all the <code>StudentID</code> which have the same <code>CourseID</code> based on the <code>CourseID</code> selected in the dropdownlist. The gridview also has a template field with a checkbox, this allows the user to check the checkbox if the student is present.</p> <p>There is a <code>SaveAttendance</code> Button on the page. Once the user clicks the <code>SaveAttendance</code> button, I want to add all the <code>StudentID</code>'s displayed in the gridview along with adding the status of the checkboxes (weather they are checked or not) into the Attendance table fields <code>StudentID</code> and Present respectively. Need help as soon as possible, any help is much appreciated. Thanks!</p>
c# asp.net
[0, 9]
634,621
634,622
What's mean the "this" context?
<p>I look at a lot of android tutorial on the internet. In these tutorials they use the <code>this</code> context for the context everywhere. I know what's mean in Java the <code>this</code> keyword, but I can't make equal this, with the <code>this</code> keyword in Android programming. For example, at <code>AlertDialog.Builder</code>, on the developer.android.com site, there is only one reference at the parameters to the Context, but I can't learn what this <code>this</code> mean here. </p>
java android
[1, 4]
2,297,647
2,297,648
Matching division widths with jquery
<p>This is a question regarding matching division widths with jquery. Here is the html code I am working with.</p> <pre><code>&lt;ul class="thumbs_container"&gt; &lt;li class="thumbs"&gt; &lt;a class="fancybox" href="" &gt; &lt;div class="thumbs_image_container"&gt; &lt;img src="" /&gt; &lt;/div&gt; &lt;div class="caption"&gt; caption &lt;/div&gt; &lt;/a&gt; &lt;/li&gt; &lt;li class="thumbs"&gt; &lt;a class="fancybox" href="" &gt; &lt;div class="thumbs_image_container"&gt; &lt;img src="" /&gt; &lt;/div&gt; &lt;div class="caption"&gt; caption &lt;/div&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I will have multiple list items with the class 'thumbs'. What I want to do is match the widths of the divs with the class 'caption' to the widths of the divs with the class 'thumbs_image_container', but treating each list item separately. </p> <p>Could someone please give me some pointers on how to do this? I know how to match the widths, but I am having problems figuring out how to treat each list item separately.</p>
javascript jquery
[3, 5]
935,518
935,519
Android : Searching items using there barcodes in ebay
<p>I have a project idea for my college project to develop an android application which can take images of the bar codes of various electronic equipments like cameras laptops and then to read models and brands of them using that bar codes and then to search for that model and brand in Ebay to point the user to relevant web pages. I want to know that is it possible to do this project ?</p> <p>Thanks! </p>
java android
[1, 4]
746,798
746,799
Enable/Disable button click handlers in Javascript
<p>Ok, let's say that I have a button and I would like to enable/disable its click handlers.</p> <p>I would like to create functions like these:</p> <pre><code>var bar = []; function storeHandlers(buttonID) { //I would like to store the click handlers in bar[buttonID] } function preventHandlers(buttonID) { storeHandlers(buttonID); //I would like to disable all the click handlers for button } function loadHandlers(buttonID) { //I would like to enable all the handlers loaded from bar[buttonID] } </code></pre> <p>Is this possible? How can I achieve this?</p> <p>Thank you in advance</p>
javascript jquery
[3, 5]
2,385,002
2,385,003
javascript function call timing. The best way of implementing this
<p>I have The following in my main javascript file:</p> <pre><code>window.onbeforeunload = function () { firstFunction(); } $("a").live("click", function() { secondFunction(); } </code></pre> <p>When user clicks on any link that unloads the page (i.e. navigate to another page), both of those functions get called; FirstFunction() gets called first, then secondFunction() gets called. I want the secondFunction() to get called before the firstFunction();</p> <p>I was able to achieve this by doing this: setTimeout('firstFunction(),100), but I am wondering if there is a better way of doing this?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
548,845
548,846
Using DateTime.AddHours from a static method does not product the desired result
<p>I have a helper class which among other things gets the current datetime. Because our server is 6 hours behind where ALL our customers are from I want to add 6 hours to the datetime. My public method is static and is as follows:</p> <pre><code>public static DateTime GetCurrentDate() { DateTime dt = DateTime.Now; dt = dt.AddHours(6); return dt; } </code></pre> <p>For some reason if I <code>Response.Write</code> the datetime returned it has not added the 6 hours. If I do the above in an aspx.cs file and write out the result then it works. Am I doing something wrong here?</p> <p>Thanks</p>
c# asp.net
[0, 9]
514,179
514,180
Android RandomAccessFile usage from resource
<p>How can I access an Android resource using <code>RandomAccessFile</code> in Java?</p> <p>Here is how I would like this to work (but it doesn't):</p> <pre><code>String fileIn = resources.getResourceName(resourceID); Log.e("fileIn", fileIn); //BufferedReader buffer = new BufferedReader(new InputStreamReader(fileIn)); RandomAccessFile buffer = null; try { buffer = new RandomAccessFile(fileIn, "r"); } catch (FileNotFoundException e) { Log.e("err", ""+e); } </code></pre> <p>Log output:</p> <pre><code>fileIn(6062): ls3d.gold.paper:raw/wwe_obj </code></pre> <p>The following exception appears in my console:</p> <pre><code>11-26 15:06:35.027: ERROR/err(6062): java.io.FileNotFoundException: /ls3d.gold.paper:raw/wwe_obj (No such file or directory) </code></pre>
java android
[1, 4]
3,558,706
3,558,707
Is creating page contents dynamically using javascript faster than loading different pages?
<p>I'm designing a website with different pages and every page has it's contents as like as <code>textbox, label, button, gridview</code> and etc. after that I want to load every pages using <code>$("#xx").load(page url Address)</code> in jquery to prevent postback when the page is necessary.</p> <p>is this method faster or following method:</p> <p>I have just one page for example: <code>default.aspx</code> and a <code>javascript</code> file. The page contents will be created using javascript dynamically just in one page with <code>createElement</code> instead of loading different pages.</p> <p>In the first method all <code>aspx</code> elements should be converted to <code>html</code> and then html elements must be transferred to the client but in the second method we won't have any <code>html</code> element transferring except for the <code>default.aspx</code> page and the elements will create in run-time using javascript.</p>
javascript jquery asp.net
[3, 5, 9]
1,932,641
1,932,642
What is a good program to have done as part of your work history?
<p>I am wondering what is a valuable program (or programs) that a prospective employer hiring in Java, Python, C# or any high level programming language would like to see in the candidates work history? This or these programs would be seen as valuable indicators for the persons knowledge of the language.</p> <p>A list of useful apps would be helpful. Just let me know what you think is a good app to have on your resume or CV.</p> <p>Thanks everyone for your comments and suggestions.</p>
c# java python
[0, 1, 7]
5,180,729
5,180,730
how to restart scripts automatic
<p>What's the best way if you have a big script with a large process and you get an Error, then how to tell the script, wait 1min and begin again from top.</p> <p>It's written in asp.net, c#.</p> <p>Example</p> <pre><code>protected void doAll() { FirstFunction(); // If I get in this function an error it should stop wait 1min. and start doAll() again. NextFunction(); // END } </code></pre>
c# asp.net
[0, 9]
589,436
589,437
Pass parameters to javascript function of user control
<p>I'm adding user control dynamically on my page.</p> <p><strong><code>MyPage.aspx</code>:</strong></p> <pre><code>MyControl cntl = (MyControl)Page.LoadControl("MyControl.ascx"); </code></pre> <p><strong>The <code>MyControl.ascx</code> has a javascript function:</strong></p> <pre><code>function myfun(a, b) { .... } </code></pre> <p>I can pass parameters to <code>myfun</code> from code behind of <code>MyControl.ascx</code> like:</p> <pre><code>string script2 = String.Format("myfun({0},{1})", param1, param2); this.Page.ClientScript.RegisterStartupScript(this.GetType(), "initialize control", script2, true); </code></pre> <p>Is it possible to call this javascript function from <code>MyPage.aspx</code>?</p>
c# javascript asp.net
[0, 3, 9]
5,593,408
5,593,409
Detect which button is clicked in Page_Load?
<p>In my asp.net web page, there are a few of buttons and checkboxs. They all can cause postback. Can I detect which control is clicked? Because I will add code for if clicked a button then do something. I saw that some examples are done with Jquery. Can we just do it in C#?</p> <p>Thanks.</p>
c# jquery asp.net
[0, 5, 9]
2,026,343
2,026,344
What is the fastest way to work with ajax request?
<p>I am a little bit confused about what is the fastest and the friendly way with the server to request POST or GET from server by AJAX, is it jQuery (<code>$.load()</code>, <code>$.get()</code>, <code>$.post()</code>, <code>$.ajax()</code>) or Javascript like XMLHttpRequest? </p> <p>I need to make a function or class to use in my project to call request from server via AJAX, but I don't know what is the faster and more friendly with the server jQuery or Javascript.</p>
javascript jquery
[3, 5]
1,860,312
1,860,313
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,373,721
5,373,722
C# ASP.Net BlackJack/CardGames Reference
<p>I want to build a card game in C# ASP.Net.</p> <p>Something like blackjack or solitaire.</p> <p>Has anyone any ideas on how to go about doing this or any references I could refer to? Books on card game designs would be a good help.</p>
c# asp.net
[0, 9]
3,945,568
3,945,569
Python faster than C++? How does this happen?
<p>I'm using Windows7 using CPython for python3.22 and MinGW's g++.exe for C++ (which means I use the libstdc++ as the runtime library). I wrote two simple programs to compare their speed.</p> <p>Python:</p> <pre><code>x=0 while x!=1000000: x+=1 print(x) </code></pre> <p>C++:</p> <pre><code>#include &lt;iostream&gt; int main() { int x=0; while(x!=1000000) { x++; std::cout&lt;&lt;x&lt;&lt;std::endl; } return 0; } </code></pre> <p>Both not optimized.</p> <p>I ran c++ first, then i ran python through the interactive command line, which is much slower than directly starting a .py file.</p> <p>However, python outran c++ and turned out to be more than twice as fast. Python took 53 seconds, c++ took 1 minute and 54 seconds. </p> <p>Is it because python has some special optimization done to the interpreter or is it because C++ has to refer to and std which slows it down and makes it take up ram?<br> Or is it some other reason?</p> <p><strong>Edit:</strong> I tried again, with <code>\n</code> instead of <code>std::endl</code>, and compiling with the <code>-O3</code> flag, this time it took 1 min to reach 500,000.</p>
c++ python
[6, 7]
2,301,814
2,301,815
Customer Validation ASP.Net C#
<p>I am having the same problem as someone else in this forum. My validation control is not firing...and not sure where I have gone wrong. Could someone please take a look and let me know what obvious error I have here...thanks</p> <p>I have set up a customer validator in my aspx page using the following:</p> <pre><code> &lt;asp:TextBox ID="EmployeeNumber2TextBox" runat="server" Text='&lt;%# Bind("EmployeeNumber") %&gt;'Visible='&lt;%# AllowEmployeeNumberEdit() %&gt;' /&gt; &lt;asp:CustomValidator ID="ValidateEmpNumber" runat="server" onservervalidate="ValidateEmpNumber_ServerValidate" controltovalidate="EmployeeNumber2TextBox" ErrorMessage="You Must Enter an Employee Number" Text="*" /&gt; </code></pre> <p>and the code behind:</p> <pre><code> protected void ValidateEmpNumber_ServerValidate(object sender, System.Web.UI.WebControls.ServerValidateEventArgs e) { int SiteCompanyID = System.Convert.ToInt32(Session["SiteCompanyID"]); SiteCompanyBLL SiteCompany = new SiteCompanyBLL(); SiteCompanyDAL.SiteCompanyRow ScRow = SiteCompany.GetCompanyByID(SiteCompanyID); bool AutoGenerate = ScRow.AutoGenNumber; // result returning true or false if (AutoGenerate == false) { if (e.Value.Length == 0) e.IsValid = false; else e.IsValid = false; } } </code></pre>
c# asp.net
[0, 9]
5,693,141
5,693,142
If div is empty, remove it and change class of next div
<p>Some generated output can be as follows:</p> <pre><code>&lt;div class="fivecol"&gt;&lt;/div&gt; &lt;div class="sevencol"&gt;content&lt;/div&gt; </code></pre> <p>if the div.fivecol is empty, I want to remove it and change the div.sevencol to a div.twelvecol</p> <pre><code>$('.fivecol').each(function() { if ($(this).html() ==''){ $(this).remove().next('sevencol').removeClass('sevencol').addClass('twelvecol'); } }); </code></pre> <p>doesn't do the trick. Any ideas?</p>
javascript jquery
[3, 5]
331,693
331,694
javascript profanity filter on a contenteditable div
<p>I am currently working on a site which filters bad words on an array. Whenever a user types a word on the textbox, an alert box appears if a word from the array was found. I'd like to do the same but instead of using a textbox, I'd like to use a contenteditable div. I'll be needing jquery on this but there seems to be some conflict on my code since the initial code was done in pure js. </p> <p>Fiddle link: <a href="http://jsfiddle.net/br7TD/" rel="nofollow">http://jsfiddle.net/br7TD/</a></p> <p>Here's the javascript:</p> <pre><code>var swear_words_arr=new Array("bad","evil","freak"); var swear_alert_arr=new Array; var swear_alert_count=0; function reset_alert_count() { swear_alert_count=0; } function validate_user_text() { reset_alert_count(); var compare_text=document.form1.user_text.value; for(var i=0; i&lt;swear_words_arr.length; i++) { for(var j=0; j&lt;(compare_text.length); j++) { if(swear_words_arr[i]==compare_text.substring(j,(j+swear_words_arr[i].length)).toLowerCase()) { swear_alert_arr[swear_alert_count]=compare_text.substring(j,(j+swear_words_arr[i].length)); swear_alert_count++; } } } var alert_text=""; for(var k=1; k&lt;=swear_alert_count; k++) { alert_text+="\n" + "(" + k + ") " + swear_alert_arr[k-1]; } if(swear_alert_count&gt;0) { alert("Please refrain from using offensive words"); /* + alert_text */ document.form1.user_text.select(); } else { document.form1.submit(); } } function select_area() { document.form1.user_text.select(); } window.onload=reset_alert_count; </code></pre> <p>Sorry for the noobish question, I'm pretty much new to this. Any help will be appreciated.</p>
javascript jquery
[3, 5]
1,434,330
1,434,331
How to calculate total size of a page with additional files and scripts
<p>I would like to ask if it's possible to get programmatically in C#, a specific site content size. By size I mean: the full size of the site including all images and scripts referenced in the head section or body and so on. For example if we have a site <a href="http://www.google.com" rel="nofollow">http://www.google.com</a> I want o get it's total size including the logo, scripts refered to, and so on as it will be presented to the user not just the main page.</p> <p>Here is a picture what I mean: (click for full size)</p> <p><a href="http://i.stack.imgur.com/5LPe9.png" rel="nofollow"><img src="http://i.stack.imgur.com/5LPe9.png" alt=""></a></p> <p>If we use IE Developer tool in IE 9, and start capturing traffic on the network session, than we hit google.com and it shows the total files loaded (.js, .png, and so on) and the time of loading in milliseconds.</p> <p>I tried to do something similar using a webrequest but i get only 43kb instead of 101 as IE developer tool gets.</p> <p>Here is the code:</p> <pre><code>WebRequest request = WebRequest.Create(textBox2.Text.ToString()); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string responseFromServer = reader.ReadToEnd(); byte[] bytes = Encoding.ASCII.GetBytes(responseFromServer); MessageBox.Show(ConvertSize(responseFromServer.Length) + " - " + responseFromServer.Length.ToString()); reader.Close(); dataStream.Close(); response.Close(); </code></pre> <p>How can I get the total size of a site including all images, js and additional files used/referenced in that specific page? Thanks a lot!</p>
c# asp.net
[0, 9]
5,683,368
5,683,369
PHP pagination for unordered list
<p>item1 item2 item3</p> <p>I've three items arranged in this order,i've used unordered list to arrange the items in this order. I did n't find a pagination plug in for items arranged in unordered list ,How do i implement pagination for this.</p> <p>Any help would be appreciated!</p>
php jquery
[2, 5]
2,364,116
2,364,117
How to command if ( ..) don't executive setTimeout()
<p>This <a href="http://jsfiddle.net/58PKb/1/" rel="nofollow">Demo</a>, After landing page it will show <code>btn2</code>(green area), then user have 2 option:<p> 1. user do nothing - <code>setTimeout()</code><br> 2. user hover to <code>btn2</code>- show <code>btn3</code>(blue). <br> I stuck in 2. after hover to <code>btn2</code> and <code>btn3</code> be show. <code>btn1</code>(red) still fadeIn how to cancel it?</p> <p>Any suggestion will be appreciated. <br><br></p> <pre><code>&lt;div class="btn btn1"&gt;&lt;/div&gt; &lt;div class="btn btn2"&gt;&lt;/div&gt; &lt;div class="btn btn3"&gt;&lt;/div&gt; .btn{ width: 200px; position: absolute; } .btn1{ background-color: red; height: 100px; width: 100px; } .btn2{ background-color: green; height: 200px; opacity: 0.3; display: none; } .btn3{ background-color: blue; height: 200px; opacity: 0.3; display: none; } </code></pre> <p>jQuery</p> <pre><code>$(function(){ function navctr(){ //landing $('.btn1').hide(); $('.btn2').show(); setTimeout(function(){ $('.btn2').fadeOut(50); $('.btn1').fadeIn(50); }, 2250); //after click $('.btn1').click(function(){ $('.btn1').fadeOut(100); $('.btn2').delay(100).fadeIn(50); }); //both $('.btn2').hover(function(){ $('.btn2').hide(); $('.btn3').fadeIn(100); }); $('.btn3').mouseleave(function(){ $('.btn3').fadeOut(50); $('.btn1').fadeIn(100); }); }; navctr(); }); </code></pre>
javascript jquery
[3, 5]
853,053
853,054
Using $(this) with jQuery not always working
<p>On line 6 below, I have <code>$("ul.tabrow li").removeClass("active"); //Remove any "active" class</code> If I change it to use <code>$(this).removeClass("active")</code> instead then it does not work as I thought it was.</p> <p>The code works how I want it to right now, I am just wanting to know why what I mentioned above does not work, on line 7 below I use <code>$(this)</code> on what appears to be the same selector and that works on line 7's code but differently on line 6.</p> <p>Can anyone explain this?</p> <pre><code>$("ul.tabrow li").bind({ click: function() { return false; }, mouseenter: function() { $("ul.tabrow li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab-box").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 $(activeTab).show(); //Fade in the active content return false; } }); </code></pre>
javascript jquery
[3, 5]
3,052,808
3,052,809
How to write custom event which gets fired when user click three times
<p>i am trying to write a custom event which should get fire when user click three times on any html node.</p> <p>i know that i can create even using </p> <pre><code>var evt = document.createEvent("Event"); evt.initEvent("myEvent",true,true); </code></pre> <p>but i am not getting how i will capture that three times click event.</p> <p>I will be appreciated if some one can suggest me the write approach for this.</p> <p>Thanks!!!</p>
javascript jquery
[3, 5]
3,324,227
3,324,228
mimicking iPhone main screen slide in JavaScript
<p>I'd like to mimick iPhone main screen in JavaScript on Safari / Chrome / Firefox.</p> <p>By mimicking I mean: - Having a couple of pages - Switching between the pages by clicking &amp; dragging / swiping with my mouse - Having those dots from the bottom iPhone main screen displaying which page it is</p> <p>The closest to what I want is: <a href="http://jquery.hinablue.me/jqiphoneslide/" rel="nofollow">http://jquery.hinablue.me/jqiphoneslide/</a> But the sliding doesn't work nearly as good as in iPhone (i have to slide first, and the animation appears after i release the mouse button), and there are no dots at the bottom.</p>
javascript iphone
[3, 8]
1,088,767
1,088,768
Verify External Script Is Loaded
<p>I'm creating a jquery plugin and I want to verify an external script is loaded. This is for an internal web app and I can keep the script name/location consistent(mysscript.js). This is also an ajaxy plugin that can be called on many times on the page. </p> <p>If I can verify the script is not loaded I'll load it using:</p> <pre><code>jQuery.getScript() </code></pre> <p><b>How can I verify the script is loaded because I don't want the same script loaded on the page more than once? Is this something that I shouldn't need to worry about due to caching of the script?</b></p> <p><b>Update: </b> I may not have control over who uses this plugin in our organization and may not be able to enforce that the script is not already on the page with or without a specific ID, but the script name will always be in the same place with the same name. I'm hoping I can use the name of the script to verify it's actually loaded.</p>
javascript jquery asp.net
[3, 5, 9]
4,473,812
4,473,813
My $.extend does not seem to work when inside a function in javascript
<p>I have the following code:</p> <pre><code>File 1: $(document).ready(function () { addDataTableExts(); } File 2: function addDataTableExts() { $.extend($.fn.dataTableExt.oStdClasses, { sWrapper: 'no-margin last-child' } } </code></pre> <p>This seems to work okay. I now tried to replace this with the following:</p> <pre><code>File 2: (function () { $.extend($.fn.dataTableExt.oStdClasses, { sWrapper: 'no-margin last-child' } } </code></pre> <p>This doesn't work. </p> <p>Is there some reason why it only seems to work if I do this the first way? I thought that by changing the first line of File 2 then it would cause the code to get executed without me calling it.</p>
javascript jquery
[3, 5]
5,050,531
5,050,532
How do I properly fade in and out using jQuery?
<p>Can anyone help me with this simple bit of jQuery? I am building a carousel that features many sliding <code>&lt;li&gt;</code>s. Each one has a short description accompanying it, which I want to fade out when the carousel slides, and fade in when the carousel stops at another <code>&lt;li&gt;</code>. The problem is that when the carousel controls are clicked rapidly, the fades take a while to catch up. Also the current simple fadeIn/Out option doesn't work well when clicking to an <code>&lt;li&gt;</code> much further through the carousel (from the small grey discs underneath infographic). I've tried a few options but I'm not really getting anywhere.</p> <p>The page is here: <a href="http://weaver-wp.weavertest.com/radiation-infographic/" rel="nofollow">http://weaver-wp.weavertest.com/radiation-infographic/</a></p> <p>Thanks for any help :)</p> <p>David</p>
javascript jquery
[3, 5]
1,135,119
1,135,120
Any Hints on getting Android Java code tutorials?
<p>I cant seem to find anywhere the Java codes are mentioned on developer.android.com's training,Please where can I get tutorials with appropriate explanation for the Java source codes because without the codes Im just a designer</p>
java android
[1, 4]
807,936
807,937
Checking password match while typing
<p>I have a registration form with "password" and "confirm password" input fields. I want to check if the "confirm password" matches the "password" while the user is typing it and give the appropriate message. So I tried to do this:</p> <p>This is the HTML:</p> <pre><code>&lt;div class="td"&gt; &lt;input type="password" id="txtNewPassword" /&gt; &lt;/div&gt; &lt;div class="td"&gt; &lt;input type="password" id="txtConfirmPassword" onChange="checkPasswordMatch();" /&gt; &lt;/div&gt; &lt;div class="registrationFormAlert" id="divCheckPasswordMatch"&gt; &lt;/div&gt; </code></pre> <p>And this is the checkPasswordMatch() function:</p> <pre><code>function checkPasswordMatch() { var password = $("#txtNewPassword").val(); var confirmPassword = $("#txtConfirmPassword").val(); if (password != confirmPassword) $("#divCheckPasswordMatch").html("Passwords do not match!"); else $("#divCheckPasswordMatch").html("Passwords match."); } </code></pre> <p>That didn't validate while typing, only when user leaves the field.</p> <p>I tried to use onKeyUp instead of onChange - also didn't work.</p> <p>So how can it be done?</p> <p>Thank you!</p>
javascript jquery
[3, 5]