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
4,093,353
4,093,354
JQuery - Fade Out Elements After Being Created
<p>I'm currently working on a JQuery game (Just to get around with using JQuery) and on certain collisions, an "explosion" class is created. </p> <p>Right now I'm using <code>$("#game").append("the div html code goes here")</code> to add it in the game div. Now, how do I make it so after the element is created, it fades out after being created? I tried doing something along the lines of <code>$(".explosion").load(function goes here)</code> but that doesn't seem to work :\</p>
javascript jquery
[3, 5]
5,284,909
5,284,910
class cannot be serializied
<pre><code>[Serializable] public class KeyValue { public List&lt;Dictionary&lt;string, string&gt;&gt; pair { get; set; } } </code></pre> <p>Exception comes Keyvalue pair cannot be serialized when i am insert data into profile. Whats the problem?</p>
c# asp.net
[0, 9]
1,523,007
1,523,008
Getting the size of a image after it is cloned and resized using jQuery
<p>I'm trying to write some jQuery code that gets the combined width of images that have been cloned and resized before they are shown, the problem is that before they are added to the DOM the width is always 0. </p> <pre><code>(function($){ var $images = createDiv(), totalWidth = 0; //loop through a list of images $("#images &gt; li &gt; img").each(function(){ var $this = $(this), $img = $this.clone(); //createa duplicate of the images $img.height(100); //resize each duplicate to a set height totalWidth += $img.width(); //always equals zero //this always results in 0 too //totalWidth += $img.get(0).clientWidth; //add the cloned image to the div $images.append($img); //remove full sized image to reattach later $this.remove(); }); $images.hide(); $("body").append($images); $("#show").on('click',function(){ $images.show(); }); function createDiv(){ return $('&lt;div id="imgs"&gt;&lt;/div&gt;'); } }(jQuery)); </code></pre> <p>Here is a fiddle of a complete example: <a href="http://jsfiddle.net/bittersweetryan/9c3SH/2/" rel="nofollow">http://jsfiddle.net/bittersweetryan/9c3SH/2/</a></p> <p>How can I get the total combined width of the resized images before they are added to the DOM?</p>
javascript jquery
[3, 5]
5,419,098
5,419,099
ASP.NET and jQuery - call from codebehind
<p>This is a problem i've tried so solve before but gived up. Basicly i'm using ModalPopupExtenders (from AJAX.NET) to display Panels with a few content (text, controls, etc). And i'm calling it from codebehind. And it works well.</p> <p>But now i want to replace the ModalPopup with some jQuery dialog box. The problem is calling it from codebehind. As far as i know, i have to register the jQuery libraries on RegisterStartup event, but i've tried it and call the jQuery from codebehind but with no sucess.</p> <p>Can someone help me? I really want to replace the ModalPopup, they gives me to much trouble.</p> <p>Thanks in advance.</p> <hr> <pre><code>protected void Page_Load(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "registerDialog", "$(function() { $('#dialog').dialog({autoOpen:false, show:'blind'}); });", true); } protected void Button1_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "openDialog", "$('#dialog').dialog('open');", true); } </code></pre> <p>Is this the correct way? I've to register it first to stay hidden. Thanksю</p>
asp.net jquery
[9, 5]
4,745,767
4,745,768
onclick submit one of two same form
<p>I included one file (containing a form) two times in php file.I want to submit one form with onclick function. both forms are same. i wrote onclick function document.formname.submit();</p> <p>I want to do somthing like this document.this.form.submit(); please give some solution.</p>
php javascript jquery
[2, 3, 5]
272,618
272,619
Android App development for a newbie
<p>I have done a bit of programming in Java and the whole point of this project is to learn something new.</p> <p>I want to create an Android App which would record a users voice, and then it would change the recording, and give you an output.</p> <p>The change in the recording would be the frequency or pitch of the voice.</p> <p>so lets say you say " hello my name is james" the app would repeat this, with the frequency of your voice changed, which would sound really stupid, and maybe fun, but that is the point of the app.</p> <p>I have tried asking people on Twitter for any help and resource suggestions, however so far i have got nowhere.</p> <p>How would i go about doing this, if you could suggest any resources, books, online material anything to get me started i would really appreciate it.</p> <p>Thanks</p>
java android
[1, 4]
4,047,007
4,047,008
How do i find the difference between two dates using jquery
<p>I want to get reaming days to go particular date so i am trying to detection of particular date with today date. but this not working here is my <a href="http://jsfiddle.net/sureshpattu/sJueG/" rel="nofollow">code</a> If the date is next month 27 how can i get remaining days to go</p> <pre><code> var date2=new Date(); var date1=27/5/2012; var diff = date1.getDate()-date2.getDate(); var date_reaming = diff.getDate(); document.write(date_reaming + 'days to go'); </code></pre>
javascript jquery
[3, 5]
4,435,343
4,435,344
How can I select an element based on its position?
<p>How is it possible to select an element based on its position?</p> <pre><code>&lt;div id="parent"&gt; &lt;p id="text"&gt;This is a text&lt;/p&gt; &lt;/div&gt; </code></pre> <p>//CSS</p> <pre><code>#parent{width:100px;height:100px;position:absolute;left:100px;top:100px;} </code></pre> <p>Now using the left=100px,top=100px how can I select the div element using JQuery?</p>
javascript jquery
[3, 5]
2,764,932
2,764,933
How to export javascript generated report to pdf?
<p>I made a reporting engine with javascript for my project... The problem is with printing.. Although with page-break and css i can produce a good looking report, i want to export that report to a pdf in order to be printed better without ,the url,page title and other stuff that browsers add. Note in Chrome there isnt page setup!!!</p> <p>I am using java for server side.</p> <p>i think sending via ajax the Html of the report somehow and return a url for the pdf report maybe... i am looking for a good tool for this thank you</p>
java javascript
[1, 3]
2,657,694
2,657,695
dynamically add a name anchor tag within dynamic content page
<p>I have a page that lists over 100 items and I need to dynamically add a name="" tags to the beginning of each new section of items that starts with the next alphabet.</p> <p>For example:</p> <pre><code>&lt;a name="a"&gt;&lt;/a&gt; &lt;h1&gt;Amazon River&lt;/h1&gt; &lt;h1&gt;Arrow Heads&lt;/h1&gt; &lt;a name="b"&gt;&lt;/a&gt; &lt;h1&gt;Bear Claws&lt;/h1&gt; &lt;h1&gt;Bee Traps&lt;/h1&gt; &lt;h1&gt;Dodge Ball&lt;/h1&gt; &lt;a name="f"&gt;&lt;/a&gt; &lt;h1&gt;Football Players&lt;/h1&gt; &lt;h1&gt;Fig Newtons&lt;/h1&gt; .... &lt;a name="y"&gt;&lt;/a&gt; &lt;h1&gt;Yorktown&lt;/h1&gt; &lt;h1&gt;Yikes&lt;/h1&gt; &lt;a name="z"&gt;&lt;/a&gt; &lt;h1&gt;Zebra&lt;/h1&gt; &lt;h1&gt;Zoo Mobile&lt;/h1&gt; </code></pre> <p>I am only familiar w/ php, somewhat familiar w/ javascript, not sure what one it would take to accomplish this.</p> <p>I will type out the "code" in theory, so you have an idea of what I want to accomplish</p> <pre><code>$letter = range(a-z); if($title == first_letter_character($letter)) { print '&lt;a name="'.$letter.'"&gt;&lt;/a&gt;'; $letter++; // goes to next letter in range } </code></pre> <p>Also, there may be some letters that may not have an item.</p> <p>Any help is appreciated.</p>
php javascript
[2, 3]
1,844,989
1,844,990
Canvas not visible on particular device (One X)
<p>I think I am facing a small issue. My problem is that I am drawing a speedometer based on <a href="http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/" rel="nofollow">http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/</a>. And the needle is visible on all devices that I have but not on HTC One X. On checking, I found that the canvas density (canvas.getDensity()) is returned as 0. Could that be the reason it is not visible? Also tested on S3 which has the same OS (4.0.4). Works fine there.</p> <pre><code> handPath = new Path(); handPath.moveTo(0.5f, 0.5f + 0.0f); handPath.lineTo(0.5f - 0.010f, 0.5f + 0.0f - 0.00f); handPath.lineTo(0.5f - 0.002f, 0.5f - 0.22f); handPath.lineTo(0.5f + 0.002f, 0.5f - 0.22f); handPath.lineTo(0.5f + 0.010f, 0.5f + 0.0f - 0.00f); handPath.lineTo(0.5f, 0.5f + 0.0f); handPath.addCircle(0.5f, 0.5f, 0.05f, Path.Direction.CW); private void drawHand(Canvas canvas) { // if (handInitialized) { float handAngle = degreeToAngle(handPosition); // float handAngle = 0; canvas.save(Canvas.MATRIX_SAVE_FLAG); canvas.rotate(handAngle, 0.5f, 0.5f); canvas.drawPath(handPath, handPaint); canvas.restore(); float scale = getScaled(canvas,canvas.getWidth()); canvas.scale(scale, scale); canvas.drawCircle(0.5f, 0.5f, 0.01f, handScrewPaint); // } } </code></pre>
java android
[1, 4]
4,807,393
4,807,394
PHP with javascript code, live clock
<p>Hey I would to create a live clock to put it on my website. So I wrote a simple php with JavaScript code for that, here is it: </p> <pre><code>&lt;?php Function d1() { $time1 = Time(); $date1 = date("h:i:s A",$time1); echo $date1; } ?&gt; &lt;script type="text/javascript"&gt; window.onload = startInterval; function startInterval() { setInterval("startTime();",1000); } function startTime() { document.getElementById('qwe').innerHTML = '&lt;?php d1();?&gt;'; } &lt;/script&gt; &lt;div id="qwe"&gt;test&lt;/div&gt; </code></pre> <p>When run this code the output like <code>"2:40:17 PM"</code>, the <code>div</code> refreshed every second but the problem is the time never changed.</p>
php javascript
[2, 3]
5,063,943
5,063,944
Download XML client-side, fetch data from Session first
<p>My goal is to have the user be able to download some information currently stored in Session. There are multiple key/value pairs in Session I would like to have the user download as one XML file.</p> <p>The control I am working with has a client-side 'onClick' event exposed. I was planning on calling a PageMethod to extract the data I wanted from Session, and return that data to the client.</p> <p>I've seen a very clean implementation of this in MVC and I am wondering if this clean implementation is possible in ASP.NET AJAX, as well. If not, I am wondering what the best route would be to go for this.</p> <p>In MVC/JavaScript I see something like this:</p> <pre><code>location.href = "../WorkOrders/Export/" + workOrderID; public ActionResult Export(int id) { WorkOrderPdfExporter exporter = new WorkOrderPdfExporter(); byte[] buffer = exporter.Export(id); return File(buffer, "application/pdf", String.Format("workorder#{0}.pdf", id)); } </code></pre> <p>This Export method returns a FileContentResult which is an MVC thing. I am wondering if something like this exists in ASP.NET AJAX, and if the datatype is suitable to return for a Page Method.</p> <p>If not, what should I be doing here? I was thinking about creating a dictionary, sticking the relevant session objects into this dictionary, serializing it to XML (I have a Serializable Dictionary class implemented), ...and then attempting to return that XML for download?</p> <p>Thanks for your time.</p>
c# javascript asp.net
[0, 3, 9]
2,333,416
2,333,417
how do i stop a form submit with jQuery
<p>I have this form <a href="http://posnation.com/shop_pos/" rel="nofollow">here</a> and i dont want them to go to the next page without certain selections</p> <pre><code>&lt;form method="post" action="step2/" id="form1"&gt; .... .... .... &lt;input type="submit" class="submit notext" value="Next" /&gt; </code></pre> <p>and here is my jquery</p> <pre><code>$('.submit').click(function(e) { var business = $(".business_type_select").find('.container strong').text(); alert(business); if(business == "Select Business Type"){ alert("BusinessBusinessBusiness"); e.preventDefault; return false; } }); </code></pre> <p>any ideas what i am missing to get this to stop submitting</p>
javascript jquery
[3, 5]
5,747,233
5,747,234
Get every nth item in array
<p>I have an array of HTML elements. I'm checking whether a previous object in the array exists like this:</p> <pre><code>var boxes = $('.box'); // creating the array boxes.each(function(i){ // going through the array var prevBox = i&gt;0?$(boxes[i-1]):false; // check whether a previous box exists if (prevBox) { } // do something else { } // do something else }); </code></pre> <p>This works well. But I would also need to check the existence of every fourth object (box) in the array, or more precisely whether an object three objects before the current one exists.</p> <p>This doesn't work:</p> <pre><code>var prevBox = i&gt;0?$(boxes[i-4]):false; </code></pre> <p>I believe using <code>jQuery.grep()</code> and checking if <code>(i % 4) == 0</code> might be the answer, but with my limited knowledge of Javascript, I don't know how to apply it to what I have now.</p> <p>Anyone can help? Thanks!</p>
javascript jquery
[3, 5]
3,893,130
3,893,131
ASP.Net Repeater Eval in an If statement
<p>So I've been looking around for a good answer to this question, but haven't really found anything useful. Hopefully someone can shed some light on this for me.</p> <p>Basically, I have a repeater that is backed by a database table. Inside the ItemTemplate for this repeater, I have some HTML elements that are populated with properties from each item in the list. Pretty standard stuff. However, there is a possibility that one of the items could be null. In that case, it would make sense for me to put some sort of <code>if (blah != null)</code> logic around the offending code. The only problem is, when I've tried to do so, ASP throws up on me, telling me that I can't use an if statement inside of <code>&lt;%# %&gt;</code>. </p> <p>My question to the masses is this: if you can't use an if statement inside of <code>&lt;%# %&gt;</code>, then how are you supposed to do conditional logic based on the values of each item?</p> <p>I know that you can call your own methods inside the repeater, but that won't work for what I'm trying to do. </p> <p>Below is what I'm trying to accomplish, to better illustrate my point.</p> <pre><code>&lt;asp:Repeater runat="server" ID="repeater"&gt; &lt;ItemTemplate&gt; &lt;div class="item-wrap"&gt; &lt;% if(Eval("imageUrl") != null) { %&gt; &lt;div class="plan-img"&gt; &lt;asp:Image runat="server" ImageUrl='&lt;%# Eval("imageUrl") %&gt;'/&gt; &lt;/div&gt; &lt;% } %&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
c# asp.net
[0, 9]
312,529
312,530
Remove common string from a string using jquery or Javascript
<p>How can remove the 'tp.','ta.' and 'tta.' from below string from each place where it is coming</p> <pre><code>str = " tp.FirstName, tp.FamilyName, ta.DOB, tta.TypeOfLocation WHERE tp.DateStamp BETWEEN '2012-02-12 15:13:00' AND '2013-02-12 15:13:00' AND tta.db_name_id =21 AND tp.FirstName = 'Darlene'"; </code></pre> <p>I need result as below:</p> <pre><code>FirstName, FamilyName, DOB, TypeOfLocation WHERE DateStamp BETWEEN '2012-02-12 15:13:00' AND '2013-02-12 15:13:00' AND db_name_id =21 AND FirstName = 'Darlene'"; </code></pre> <p>Note: I have asked same question but this time I am using multiple removing string. Please assist me</p>
javascript jquery
[3, 5]
583,689
583,690
VideoView in Fullscreen
<p>How do I get the VideoView to go Fullscreen in lanscape?</p> <p>I've set the following in the manifest file for the activity.</p> <p>android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></p> <p>Is there anything else I need to do?</p>
java android
[1, 4]
3,647,502
3,647,503
Monitor the progress of an input stream / httpclient.exectute
<p>I'm trying to get the progress of an Apache HTTP Client Execute method. Is it possible to either</p> <ol> <li>Get the mount of input stream that has been read by the execute method or </li> <li>Monitor the execute process using some internal method either by percent or amount of data sent?</li> </ol> <p>The code below sends an input stream to the server (in this case an image) which is then stored appropriately. Problem is with high resolution cameras and slow mobile operators its hard to tell if an upload is actually taking place. The code does work, but feedback is desired.</p> <pre><code>public List writeBinary(String script, InputStream lInputStream) { Log.d(Global.TAG,"--&gt;writing to server..."); HttpParams httpParameters = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParameters, 5*1000); HttpConnectionParams.setSoTimeout(httpParameters, 60*1000); HttpClient httpclient = new DefaultHttpClient(httpParameters); HttpPost httppost = new HttpPost("http://xxx.xxx.xxx.xxx" + script); String responseText = null; List responseArray = new ArrayList(); try { httppost.setEntity(new InputStreamEntity(lInputStream, -1)); HttpResponse response = httpclient.execute(httppost); if (response.getStatusLine().getStatusCode() == 200){ InputStream lInputStreamResponse = response.getEntity().getContent(); DataInputStream lDataInputStream = new DataInputStream(lInputStreamResponse); BufferedReader lBufferReader = new BufferedReader(new InputStreamReader(lDataInputStream)); while ((responseText = lBufferReader.readLine()) != null){ responseArray.add(responseText); } lInputStream.close(); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return responseArray; } </code></pre>
java android
[1, 4]
4,157,630
4,157,631
How much data can be stored using .data method?
<p>How much data can be stored using $.data method in Jquery? Are there any pitfalls of using it?</p> <p>I tried to get an answer for this very concrete question, however, I couldn't find any.</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,310,865
4,310,866
jQuery add event for a selector that hasn't been "added" to page yet
<p>I have a <code>&lt;div&gt;</code> tag that gets added to the page depending on user variables (I'm using jquery append() to add it to the page)</p> <pre><code>&lt;div id="message"&gt;&lt;/div&gt; </code></pre> <p>I would like to have a click event for this div, but I think I am having problems because I am listening for the event before the div is added to the page.</p> <pre><code>$(document).ready(function(){ $('#message').click(function() { console.log('clicked'); // no console message? }; }); </code></pre>
javascript jquery
[3, 5]
5,385,858
5,385,859
Reading selected value of dropdown list in HTML by jQuery
<p>I am trying to read the value of the selectedID in a drop down list in html through jQuery but it keeps producing an error. Did I miss something?</p> <pre><code>&lt;select style="width: 80px;" class="text ui-widget-content ui-corner-all" id="metaList"&gt; &lt;option value="4d5e3a8c418416ea16000000"&gt;Wikipedia&lt;/option&gt; &lt;option value="4d5e3a8c418416ea16010000"&gt;Twitter&lt;/option&gt; &lt;option value="4d5e3a8c418416ea16020000"&gt;DBPedia&lt;/option&gt; &lt;option value="4d64cd534184162629000000"&gt;test&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I tried which used to work before</p> <pre><code>var temp = $("#metaList").val(); </code></pre> <p>but it produces NULL!</p>
javascript jquery
[3, 5]
1,396,778
1,396,779
How to delete string from string with regex and jQuery/JS?
<p>I wonder, how to delete: </p> <pre><code>&lt;span&gt;blablabla&lt;/span&gt; </code></pre> <p>from:</p> <pre><code>&lt;p&gt;Text wanted &lt;span&gt;blablabla&lt;/span&gt;&lt;/p&gt; </code></pre> <p>I'm getting the text from <strong>p</strong> using:</p> <pre><code>var text = $('p').text(); </code></pre> <p>And for some reason I'd like to remove from <strong>var text</strong> the span and its content.</p> <p>How can I do it? </p>
javascript jquery
[3, 5]
1,591,979
1,591,980
How to call function defined using jquery in js?
<p>Here is sample jquery code</p> <pre><code>$(document).ready(function(){ $('#myId').change(function(){ regularJSfunc('data1','data2'); }); } </code></pre> <p>now i want to trigger function call of $('#myId').change , can i do it through java script ?</p>
javascript jquery
[3, 5]
4,800,906
4,800,907
Rely on javascript to execute PHP script or manipulate hidden form elements and rely on PHP?
<p>I wrote a JavaScript script that swaps two selected <code>img</code> tag <code>src</code> values.</p> <p>The point is to let the user rearrange a list of images.</p> <p>For sending the new order to a PHP script, I have two ideas:</p> <ol> <li><p>Have a button execute a JavaScript function that gathers the new order of images into an array of URLs. Then, rely on JavaScript to send the data to a PHP script?</p></li> <li><p>Have the initial JavaScript rearrange <code>hidden</code> input tag <code>value</code> attributes which would contain data such as a URL and order number. Then, rely on a <code>submit</code> input button to execute a <code>POST</code> request without JavaScript?</p></li> </ol> <p>Thanks!</p>
php javascript
[2, 3]
1,448,825
1,448,826
browser history for Selectable (jQuery UI)
<p>How can I keep open seletable item when I go to the other pages? When I come back I want it is already open last one, whether when I reload page or come throught "previous page" (browser history). <strong>ui-state-active</strong> is set to item which is currently open. </p>
javascript jquery asp.net
[3, 5, 9]
5,746,228
5,746,229
How to execute a python script in .NET application..?
<p>When user click Build button Python script needs to run.I execute this by using process but so many processes created when so many clicked the Build button, server hang.</p>
c# asp.net
[0, 9]
3,541,994
3,541,995
getting css attributes before the containing div is toggled
<p>I've made a user control containing a panel, which is being loaded in a page, being toggled. in the js of that userControl i have a function in my document.ready that needs those attributes such as height, width, position, z-index. but those are all set to 0 cause the whole containing div is'nt yet toggled. what should i do to have those attributes before the toggling? thanx in advance.</p>
javascript asp.net jquery
[3, 9, 5]
3,337,733
3,337,734
How to deal with the callback being called multiple times when animating more than one thing in jQuery
<p>Consider this code...</p> <pre><code>$(function() { for (var i = 0; i &lt; 10; i++) { $('body').append('&lt;div style="width: 30px; height: 30px; background: red; margin: 10px;" /&gt;') } $('div').slideUp(1000, function() { $('body').append('done sliding'); }); }); </code></pre> <p>(see it on <a href="http://jsbin.com/etoqu/edit" rel="nofollow">JSbin</a>)</p> <p>It creates 10 <code>div</code>s and then slides them up. The callback is called 10 times, when I would prefer it to be called once (after all have finished sliding).</p> <p>I know <a href="http://jsbin.com/etoqu/2/edit" rel="nofollow">I could do a Boolean</a> or something, like <code>hasCalledCallback</code>, but is there any other more elegant way to make multiple elements animating call a completion callback only once?</p>
javascript jquery
[3, 5]
4,269,683
4,269,684
jQuery returns full page to Ajax
<p>Here's a link i saw but still confused over the answers provided for them : <a href="http://stackoverflow.com/questions/2586217/jquery-ajax-returns-the-whole-page">jQuery Ajax returns the whole page</a></p> <p>My situation is something similar. </p> <p>I have a index.php that calls for a popup login form, that tries to submit this login information to a ajax call to another php called login_check.php.</p> <p>This is my index.php :</p> <pre><code>var dataString = 'email='+ email.val() + '&amp;password=' + password.val(); $.ajax({ type: "POST", url: "login_check.php", data: dataString, cache: false, error: function (request, status, error) { alert("An error occured while trying to complete your request: " + error); }, success: function(data) { alert(data); } }); </code></pre> <p>This is what is in my login_check.php :</p> <pre><code>session_start(); //input from login form $myemail = htmlspecialchars(trim($_POST['email'])); $mypassword = htmlspecialchars(trim($_POST['password'])); //selecting from database to check user account $sql="SELECT * FROM user WHERE email='$myemail' and password='$mypassword'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); $count=mysql_num_rows($result); //If result matched $myemail and $mypassword, table row must be 1 row if($count==1) { echo 'true'; session_register("myemail"); $_SESSION['login_user']=$myemail; } else if($count==0) { echo 'false'; } </code></pre> <p>And the output of the alert box is the full html of the page i am currently in, i.e. index.php.</p> <p>And i have no idea whyy. ):</p>
javascript jquery
[3, 5]
4,605,142
4,605,143
Why jQuery do this: jQuery.fn.init.prototype = jQuery.fn?
<p>Little extended question is why jQuery do</p> <pre><code>jQuery.fn = jQuery.prototype = { init: function() {...}, f1: function() {...}, ... }; jQuery.fn.init.prototype = jQuery.fn; </code></pre> <p>Why not simply add <code>f1()</code> etc into <code>init.prototype</code>? Is it only aesthetic or there are some deep ideas?</p>
javascript jquery
[3, 5]
361,625
361,626
Using native c++ code in c# - problem with std::vector
<p>I want to use my native c++ functions from dll in managed c# code. But my functions take arguments like std::vector&amp; - a vector reference... How I can implement this argument in dllimport statement? I know for example that there are IntPtr and so on but what will be for std::vector&lt;>?</p>
c# c++
[0, 6]
2,835,376
2,835,377
jQuery selectors: targeting inputs in a form
<p>I have the following:</p> <pre><code>$('#registration_form input[type=text], #registration_form input[type=password]') </code></pre> <p>And I feel it can be much better: faster and shorter</p> <p>Something like</p> <pre><code>$('#registration_form input[type=text,password]') </code></pre> <hr> <p><strong>EDIT: <a href="http://stackoverflow.com/questions/2896938/jquery-combine-two-jq-selectors">THIS</a></strong> is what I really wanted! Please take a look <a href="http://api.jquery.com/find/" rel="nofollow">here</a> </p>
javascript jquery
[3, 5]
5,752,150
5,752,151
Javascript AJAX call to Jquery Call
<p>In order to have my code written almost fully written in Jquery, I want to rewrite an AJAX call in Jquery.</p> <p>It's a call from a webpage to a Tomcat servlet.</p> <p>Similar code of my present situation:</p> <pre><code>var http = new XMLhttpRequest(); var url = "http://example.com/MessageController?action=send"; http.onreadystatechange = function () if (http.readyState == 4) { if (http.status == 200){ var response = http.responseText;} else {/*code2*/} }; http.async = false; http.open("POST", url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); http.send(string); </code></pre> <p>Which would be the best way to do this? <code>.ajax</code> or <code>.post</code>? Could you help me with some pseudo code to start this?</p>
javascript jquery
[3, 5]
1,496,961
1,496,962
Why does my JQuery Image swap not work in firefox or chrome, but fine in IE?
<p>Relatively new to JQuery. I've got some code that does a banner swap with a fade in fade out transition. The images swap as expected in IE8, chrome, and firefox. However, the actual fade, the smooth transition between images only works in IE.</p> <p>Can anyone point me in the right direction for a fix?</p> <p>Javascript:</p> <pre><code>function swapImages() { var $active = $('#transitionImagePlaceHolder .active'); var $next = ($('#transitionImagePlaceHolder .active').next().length &gt; 0) ? $('#transitionImagePlaceHolder .active').next() : $('#transitionImagePlaceHolder img:first'); $active.fadeOut( 'slow', function () { $next.fadeIn('slow').addClass('active'); $active.removeClass('active'); }); } $(document).ready(function () { setInterval('swapImages()', 5000); }); </code></pre> <p>CSS:</p> <pre><code>#transitionImagePlaceHolder { } #transitionImagePlaceHolder { position:relative; left: 26px; } #transitionImagePlaceHolder img { display:none; position:absolute; top:4; left:10; } </code></pre> <p>HTML:</p> <pre><code>&lt;div id="transitionImagePlaceHolder"&gt; &lt;img class="active" src="Images/TransitionImages/Trans_Img_1.jpg" /&gt; &lt;img src="Images/TransitionImages/Trans_Img_2.jpg" /&gt; &lt;img src="Images/TransitionImages/Trans_Img_3.jpg" /&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,730,577
5,730,578
Getting a weird exception Unparseable date: "6 Aug 2012"
<p>I got a date time format - <code>"dd MMM yyyy"</code>, when trying to parse "6 Aug 2012", I get an java.text.ParseException Unparseable date.</p> <p>Every thing looks fine, do you see the problem?</p>
java android
[1, 4]
4,069,956
4,069,957
How to display the latest called object on top?
<p>I'm creating a custom select plugin. Everything is going great, but the dropdowns (<code>&lt;ul&gt;</code>-objects) are overlapping on each other :(</p> <p>I understand, that the overlapping order is set after the elements order on page or when they are created. So my question is: <strong>What is the method to make the latest opened/shown object (<code>&lt;ul&gt;</code>) on top of the hierarchy?</strong></p> <p>I just need the correct method. I'm not going to copy the full code, but a little example:</p> <pre><code>$('#trigger').click(function () { new_dropdown.slideDown(); }); </code></pre> <p><em>(A picture is worth of 1000 words)</em></p> <p><img src="http://i.stack.imgur.com/QTWlz.png" alt="enter image description here"></p> <p>So lets say, that I open the green select the last.. How can I make it on top of the yellow one?</p> <p><strong>EDIT</strong></p> <p>For easier testing I created jsfiddle. For future references I'll post the link: <strong><a href="http://jsfiddle.net/hobobne/uZV5p/1/" rel="nofollow">http://jsfiddle.net/hobobne/uZV5p/1/</a></strong> This is the live demo of the problem at hand.</p>
javascript jquery
[3, 5]
5,831,841
5,831,842
How to "run method" from different android class
<p>First and foremost, like so many, I have just recently began to try and learn Java and Android Development. I am following some tutorials and so on. Anyhow, I am attempting to do something that is probably very simple but I am unsure of syntax to complete, and because of such, not sure how to search it on the internet with any success.</p> <p>My question: I have a "Main.java" file and a second "Tabs.java". The main has everything you would expect from a default stub:</p> <pre><code>package com.example.main; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class Main extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } </code></pre> <p>My Tabs.java looks like:</p> <pre><code>package com.example.main; import android.app.Activity; import android.os.Bundle; import android.widget.TabHost; import android.widget.TabHost.TabSpec; public class Tabs extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tabs); //Initiate tabs TabHost th = (TabHost)findViewById(R.id.tabhost); th.setup(); //Create tab1 TabSpec specs = th.newTabSpec("tag1"); specs.setContent(R.id.tab1); specs.setIndicator("Reservation List"); th.addTab(specs); } } </code></pre> <p>My hope is to initiate this tabs class on program start, to setup a tabbed view. I could throw it into the main class but I thought I would attempt to keep the code neater by separating them out. How can I go about completing this?</p>
java android
[1, 4]
4,403,118
4,403,119
Convert client time to utc time to save into sql
<p>How could I go about having a client in various time zones select a date and time in their web browser and save it as utc time in my sql database? This date is a date in the future, so whether or not the date is in daylight savings time could change so I'll need to account for that.</p> <p>The site is a asp.net c# site. </p>
c# asp.net javascript
[0, 9, 3]
1,671,495
1,671,496
JQuery search and copy DIV
<p>I have a div </p> <pre><code>&lt;div id="s1"&gt;s1&lt;/div&gt; </code></pre> <p>Can JQuery check the ID and create a copy of the div BUT with the 1 being changed to the next number?</p>
javascript jquery
[3, 5]
3,485,333
3,485,334
Which HttpUtility decode method to use?
<p>this may be a silly question, but it trips me up every time.</p> <p><code>HttpUtility</code> has the methods <code>HtmlDecode</code> and <code>UrlDecode</code>. Do these two methods decode anything (Html/Http related) I might find? When do I have to use them, and which one am I supposed to use?</p> <p>Just now I hit an error. This is my error log:</p> <pre><code>Payment receiver was not [email protected]. (it was payment%40mysite.com). </code></pre> <p>But, I wrapped the email address here in <code>HttpUtility.HtmlDecode</code> before using it. It turns out I have to use <code>.UrlDecode</code> instead, but this email address didn't come from a URL so this wasn't obvious to me.</p> <p>Can someone clarify this?</p>
c# asp.net
[0, 9]
2,526,455
2,526,456
Get number of pictures using URL and Directory.GetFiles
<p>I want to get the number of pictures that is in a folder on a website. But I can't find a way to do it.</p> <p>I have tried to use </p> <pre><code>string a = Request.QueryString["nr"]; string[] filePaths = Directory.GetFiles(@"URL" + a, a + "_profil*"); </code></pre> <p>But it doesn't work. I get the error:</p> <p>Exception Details: System.ArgumentException: URI formats are not supported.</p>
c# asp.net
[0, 9]
4,735,372
4,735,373
Replacing &ndash; character using Javascript or JQuery
<p>I need to replace the dash in a title on by site with a span tag and line break to break to title over two lines. Unfortunately I don't have access to do this in the PHP :(</p> <p>The below statement seems to do this. Although with bugs as it's making this change to the character throughout the page.</p> <pre><code>document.body.innerHTML = document.body.innerHTML.replace(/\u2013/g, "&lt;/span&gt;&lt;br /&gt;&lt;span&gt;"); </code></pre> <p>The jQuery solution I tried below, works but sometimes the element would have a visibility hidden on the element!</p> <pre><code>$("#events h3 a").each(function() { $(this).html($(this).html().replace(/\u2013/g,"&lt;/span&gt;&lt;br /&gt;&lt;span&gt;")); }); </code></pre> <p>Ideally I would like to use the pure JavaScript version above but need help navigating to the Events Link.</p> <pre><code>#events h3 a </code></pre> <p>Thanks anybody who can help, I have hunted for a solution everywhere.</p> <p>This is an example of the page structure. And explains why the span close and start are back to front in the code excerpt. This is so each half can be styled when on separate lines.</p> <pre><code>&lt;ul id="events"&gt; &lt;li&gt; &lt;h3&gt; &lt;a href="http://example.com"&gt; &lt;span&gt;First Events Title - On Every Sunday&lt;/span&gt; &lt;/a&gt; &lt;/h3&gt; &lt;/li&gt; &lt;li&gt; &lt;h3&gt; &lt;a href="http://example.com"&gt; &lt;span&gt;Second Events Title - On Every Monday&lt;/span&gt; &lt;/a&gt; &lt;/h3&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
670,534
670,535
append data is not showing? HELP!
<p>im trying to append data using jquery, but its only showing the status messages but not the button! although the button deos show on firebug?</p> <pre><code>$("form.follow-form").live('submit', function(e) { /* stop event */ e.preventDefault(); /* "on request" */ $(this).find('i').addClass('active'); /* send ajax request */ $.ajax({ type: "POST", url: "ajax_more.php", data: $(this).serialize(), cache: false, success: function(html) { $("ul.statuses").append(html); $("form.follow-form").remove(); // this is not full code ;) </code></pre> <p>this is ajax_more.php file:</p> <pre><code>$query= mysql_query($result) or die(mysql_error().$result); while($row=mysql_fetch_array($query)) { $dateTime = $row['dt']; //the append shows this echo formatUpdate($row['user_note'],$row['dt']); } ?&gt; // but not this form, it deos show on firebug only &lt;form class="follow-form" method="post" action="ajax_more.php"&gt; &lt;input name="date" value="&lt;?php echo $dateTime ?&gt;" type="hidden"&gt; &lt;button type="submit" value="Actions" class="btn follow" title="123456"&gt; &lt;i&gt;&lt;/i&gt;&lt;span&gt;More&lt;/span&gt; &lt;/button&gt; &lt;/form&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,012,571
3,012,572
How to send array to Javascript function from another page?
<p>I have a static site (let's call it settings page), and my Javascript function takes with AJAX data from mysql table and draws table on a HTML document. It works like a charm - it takes all the data I need and doing it in a proper way. Here's my function:</p> <pre><code>function get_people() { $.post("/controller/get_people", function(data,status,xhr) { if(status=="success") { people_data = data; draw_table(); } }) } </code></pre> <p>The thing is, on ANOTHER PAGE I have table with all people and checkboxes next to them. I'm checking this checkboxes, clicking a button and I want to get into settings page - and my get_people function will select data from mysql only about people checked on previous page.</p> <p>technically the problem is - how can I pass an array to javascript function from another page? Can I save it on a DOM or something and read it from JS?</p> <p>Please provide me some ideas : ]</p>
php javascript jquery
[2, 3, 5]
327,362
327,363
Stopping twitter api from refreshing
<p>On my webpage, I have the following link:</p> <pre><code>&lt;asp:LinkButton ID="lnkChangePic" runat="server" onclick="lnkChangePic_Click" Text="Upload new profile picture"&gt;&lt;/asp:LinkButton&gt; </code></pre> <p>When you click it, it calls this function:</p> <pre><code> protected void lnkChangePic_Click(object sender, EventArgs e) { pnlUpload.Visible = true; pnlChangePic.Visible = false; } </code></pre> <p>The link is present in pnlChangePic. pnlUpload is initially not visible. I want the page to be as responsive as possible when the user clicks this link, and at the moment, when the user clicks, only two bits of the page change: the panels, and a twitter stream that is also on the page:</p> <pre><code> &lt;div class="fr"&gt; &lt;h4 id="twitter"&gt;Twitter Stream&lt;/h4&gt; &lt;script src="http://widgets.twimg.com/j/2/widget.js"&gt;&lt;/script&gt; &lt;script&gt; new TWTR.Widget({ version: 2, type: 'profile', rpp: 4, interval: 6000, width: 430, height: 300, theme: { shell: { background: '#000', color: '#666' }, tweets: { background: '#000', color: '#666', links: '#ffa20f' } }, features: { scrollbar: false, loop: false, live: false, hashtags: true, timestamp: true, avatars: false, behavior: 'all' } }).render().setUser(asdf').start(); &lt;/script&gt; &lt;/div&gt; </code></pre> <p>What should I do to make it so the twitter steam does not refresh when the user clicks the link? I can can get it to stop doing that, the page will be much more responsive.</p>
javascript asp.net
[3, 9]
786,023
786,024
Insert } to Complete ClassBody error even with matched braces
<p>Yes. I know this is trivial. But this is getting silly. </p> <p>Image proving the error:</p> <p><img src="http://i.stack.imgur.com/BXMUG.png" alt="enter image description here"></p> <p>The code:</p> <pre><code>package apack.age; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; public class DisplayContactActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.display_contact_layout); } public void openSubreddit(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.reddit.com"))); } public void openTwitter(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://twitter.com"))); } public void openGmail(View view) { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("www.gmail.com"))); } } </code></pre> <p>Seriously. There's 5 open and 5 close braces. This is my first attempt at an android app but I have 3 years of Java experience so this is pretty frustrating.</p> <p>Run errors out. Refresh does nothing. Project clean does nothing. Auto code format in eclipse (CTRL + SHIFT + F) does nothing.</p> <p>EDIT 1: Copying the code to a new class gets it to compile. I'm running the new version of Eclipse: Juno. I've done source -> cleanup and it just says "nothing to change" every time!</p>
java android
[1, 4]
5,266,553
5,266,554
How to find a directory in ASP.NET
<p>I'm working on an Intranet web application on a server somewhere, and I wish that application to generate files so I can download them to my local PC.</p> <p>I connect to this application using a URL in the browser like this...</p> <p><a href="http://myapp.ourplace.com" rel="nofollow">http://myapp.ourplace.com</a></p> <p>and I can get to the software using an ftp connection...</p> <p><a href="ftp://myapp.ourplace.com" rel="nofollow">ftp://myapp.ourplace.com</a></p> <p>where I can see a directory structure like this...</p> <pre><code>myapp.ourplace.com aspnet_client bin files images UserControls default.aspx myapp.bin . . . </code></pre> <p>I need to know how the C# application can locate the directory <code>files</code> in the above structure in order to write files into it. I've tried <code>Environment.CurrentDirectory() + "\\files"</code> but that doesn't appear to be the same place; no files appear in it at any rate.</p> <p>Does anyone know how to do this?</p>
c# asp.net
[0, 9]
2,440,506
2,440,507
jQuery or JavaScript is it possible to call in another JavaScript file that was not initially loaded in the dom?
<p>I am working with an MVC framework with PHP and in my views I only try to load whats needed for the view. However sometimes I need something from a script that may not have been called into play with the loading of the DOM. This is mostly out of the sake of curiosity to know if there is a way I can load another javascript file into my DOM dynamically after the DOM has rendered or can it only be pulled in while the DOM is rendering?</p>
javascript jquery
[3, 5]
6,456
6,457
jQuery: Can't cache onclick handler?
<p>I've got a step-by-step wizard kind of flow where after each step the information that the user entered for that step collapses down into a brief summary view, and a "Go back" link appears next to it, allowing the user to jump back to that step in the flow if they decide they want to change something.</p> <p>The problem is, I don't want the "Go Back" links to be clickable while the wizard is animating. To accomplish this I am using a trick that I have used many times before; caching the <code>onclick</code> handler to a different property when I want it to be disabled, and then restoring it when I want it to become clickable again. This is the first time I have tried doing this with jQuery, and for some reason it is not working. My disabling code is:</p> <pre><code> jQuery.each($("a.goBackLink"), function() { this._oldOnclick = this.onclick; this.onclick = function() {alert("disabled!!!");}; $(this).css("color", "lightGray ! important"); }); </code></pre> <p>...and my enabling code is:</p> <pre><code> jQuery.each($("a.goBackLink"), function() { this.onclick = this._oldOnclick; $(this).css("color", "#0000CC ! important"); }); </code></pre> <p>I'm not sure why it's not working (these are good, old-fashioned onclick handlers defined using the <code>onclick</code> attribute on the corresponding link tags). After disabling the links I always get the "disabled!!!" message when clicking them, even after I run the code that should re-enable them. Any ideas?</p> <p>One other minor issue with this code is that the <code>css()</code> call to change the link color also doesn't appear to be working.</p>
javascript jquery
[3, 5]
4,795,991
4,795,992
Can't add programmatic controls in ASP.NET
<p>I've got a page in ASP.NET, and I'm dynamically adding a subclass of WebControls.Button to the <code>Controls</code> data member of a pre-existing static TableCell. The button displays fine in the browser as expected. But when I click the button, the event handler I added for <code>button.Click</code> is not being called. Any suggestions as to why this is?</p> <pre><code>var controls = this.displaytable.Rows[i].Cells[j].Controls; var button = new TableButton(j, i); button.Click += new EventHandler(this.button_Click); button.UseSubmitBehavior = false; button.Text = "Available"; controls.Add(button); </code></pre>
c# asp.net
[0, 9]
2,870,215
2,870,216
Get all text nodes using jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/298750/how-do-i-select-text-nodes-with-jquery">How do I select text nodes with jQuery?</a> </p> </blockquote> <p>In jquery we can select an element using:</p> <pre><code>$(#elem).get(); </code></pre> <p>is their a way to select all text nodes of an element using jquery ?</p>
javascript jquery
[3, 5]
5,454,091
5,454,092
javascript code executes when grid refreshes
<p>I have a gridview, the gridview refreshes when I type something in the search box that is on top of the gridview, the problem is when the gridview refreshes it excutes a javascript code that is present on the linkbutton click event, this linkbutton is inside the gridview.</p> <p>I don't want the javascript to be excutes when the gridview refreshes.</p> <p>How can I stop that.</p> <pre><code>&lt;asp:LinkButton ID="ID_Link" runat="server" OnClientClick='&lt;%# "warningMessage(" + Container.ItemIndex + "); return false" %&gt;' Text='&lt;%#Bind("ID") %&gt;'&gt;&lt;/asp:LinkButton&gt; </code></pre> <p>Thanks </p>
javascript asp.net
[3, 9]
445,957
445,958
Android adding Listener with resources to many buttons
<p>I have a very weird problem with my Android project. I have a 2d array of buttons and i am trying to add action listener to those. So this is what i have:</p> <pre><code>for ( i = 0; i&lt;buttons.length;i++) { for ( k = 0; k&lt;buttons[i].length;k++) { String but = "mtp" + i + k; buttons[i][k] = (Button)v.findViewWithTag(but); if (k%2 == 0) { buttons[i][k].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { text.setText(words[w]); w++; } }); } else { buttons[i][k].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int res = getResources().getIdentifier(icons[p],"drawable", getPackageName()); buttons[i][k].setBackgroundResource(res); p++; } }); } } } </code></pre> <p>The weird thing is that my first action Listener works fine. It changes the TextView correctly. But the second one crashes my app. Moreover when i set an action listener not in a loop but outside of it like:</p> <pre><code>buttons[0][1].setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int res = getResources().getIdentifier(icons[p],"drawable", getPackageName()); buttons[0][1].setBackgroundResource(res); p++; } }); </code></pre> <p>It works just fine. What do i do? How can i fix this?</p>
java android
[1, 4]
4,624,042
4,624,043
Android - Can't create simple rectangle shape... UnsupportedOperationException?
<p>I'm having trouble creating a simple rounded rectangle using XML. Every time I try to add the "corners" element to the custom shape I get:</p> <blockquote> <p>java.lang.UnsupportedOperationException at android.graphics.Path.addRoundRect(Path.java:514) at android.graphics.drawable.GradientDrawable.draw(GradientDrawable.java:314) at android.view.View.draw(View.java:6520) ...</p> </blockquote> <p>res/dawable/rounded_rectangle.xml:</p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"&gt; &lt;solid android:color="#ffffff"/&gt; &lt;stroke android:width="3dp" android:color="#ff000000"/&gt; &lt;padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp"/&gt; &lt;corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp"/&gt; &lt;/shape&gt; </code></pre> <p>simple layout.xml using the above shape:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" android:layout_width="fill_parent"&gt; &lt;View android:id="@+id/View01" android:background="@drawable/rounded_rectangle" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/View&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Fyi, I'm trying to compile for Android 2.1 and I have all the latest updates installed to Eclipse and the Android SDK. This shape is a direct copy of something I saw on another website, but for some reason It doesn't want to work for me.</p> <p>Thanks.</p>
java android
[1, 4]
2,544,572
2,544,573
Apply a function to a variable? JavaScript/jQuery
<p>For example</p> <pre><code>var contents = 'some text'; function fileSave(path){ // I'll handle saving the file, but I need the file contents } contents.fileSave('index.html'); </code></pre> <p>So when the function is fun on the contents variable, the function has access to the variable. Like how replace() works in JavaScript.</p> <p>EX.</p> <pre><code>str.replace(); </code></pre> <p>but in this case</p> <pre><code>contents.fileSave(); </code></pre> <p>the variable is interchangeable, the function applies to any variable is attached too.</p> <p>Sorry, newbie..</p>
javascript jquery
[3, 5]
682,664
682,665
Algorithm for 'Shift + Clicking' items in a collection to select them
<p>I am trying to mimic the file selecting from Windows Explorer in Javascript. I notice Windows Explorer has two types of "selecting". One is the normal selection which highlights the file and the other one is a dotted line which means that file is currently focussed on. So I am using "selected" and "focus" as css classes.</p> <p><a href="http://www.enome.be/projects/rowselection.htm" rel="nofollow"><b>Here</b></a> you can find an example of my code working in a webpage. </p> <p>In my code it just finds the rows between the focussed item and the current item and select those. </p> <pre><code>select: function (e) { if (e.ctrlKey) { rs.removeFocus(); $(this).toggleClass("selected"); $(this).addClass("focus"); } else if (e.shiftKey) { var focusItem = $("#Items p.focus"); var currentItem = $(this); var betweenItems = rs.betweenItems(currentItem, focusItem); rs.unSelectAll(); rs.removefocus(); $(betweenItems).each(function () { this.addClass("selected"); }); focusItem.addClass("selected"); $(this).addClass("focus"); $(this).addClass("selected"); } else { rs.unSelectAll(); rs.removeFocus(); $(this).addClass("selected"); $(this).addClass("focus"); } } </code></pre> <p>This works "okay" but it's not exactly as advanced as the Windows Explorer selecting. In Windows Explorer they don't always select the rows between last focussed item and the current one. If there are no "gaps" in the selection they will add those items to the selection. But if there is a gap it will start from the focussed item. </p> <p>I am not sure how I should do this. It seems the algorithm they use in Windows is a little to complex for me. So if anybody can help me or push me into the right direction I would appreciate it.</p>
javascript jquery
[3, 5]
5,179,336
5,179,337
Print Asp.Net page with 3 print copy,2 copy carry copy word.?
<p>i have one asp.net page. i want to print that page on single click of button with[window.print()] this is working fine. but i want to print page on single click with three copy one original and 2 copy with carry copy word in asp.net</p>
c# javascript asp.net jquery
[0, 3, 9, 5]
3,072,051
3,072,052
Fade effect with timer?
<p>How to set a timer for a fade effect? Say text1 will fade out in 5 seconds, then text2 will appear, then it will fade out after 5 seconds, then text3 will appear. I'm not knowledgeable in jQuery. </p> <p>Say I have 3 texts:</p> <pre><code>&lt;div class= "text1&gt;Text 1&lt;/div&gt; &lt;div class= "text1&gt;Text 2&lt;/div&gt; &lt;div class= "text1&gt;Text 3&lt;/div&gt; </code></pre> <p>I have only this:</p> <pre><code>$(".text1").fadeOut(5000); //now that a timers. </code></pre>
javascript jquery
[3, 5]
5,657,565
5,657,566
How to wrap script in setTimeout
<p>I have some jquery code which resets image sliders to slide 1 when the tabs are clicked. The problem is, it happens instantly, so you see a little flicker of the reset slider before the tab fades out. </p> <p>I want to "hold" the reset back about half a second until it fades out. </p> <p>I have been told I need to wrap the code in a "setTimeout" function, so I am hoping for some assistance on how to do this. </p> <p>It is the "Work" section of this page that I'm talking about: www.oncreative.com.au</p> <p>This is the code I have to reset the sliders: </p> <pre><code>&lt;script&gt; $('.reset').click(function() { $('.workslider').each(function() { var s = $(this).data('royalSlider'); s.st.transitionSpeed = 0; s.goTo(0); setTimeout(function() { s.st.transitionSpeed = 600; }, 10); }); }); &lt;/script&gt; </code></pre> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
5,523,172
5,523,173
Send JSON with FormData-Object through XHR
<p>I've been trying to send images through AJAX to my PHP script and I got it to work out fine. Now I want to send some serialized info along with the images. I've tried a few things to no avail. Can anyone help?</p> <pre><code>var formdata = New FormData(); var info = $('#upload').serializeArray(); $.ajax({ url: "accept.php", type: "POST", data: formdata, processData: false, contentType: false, success: function (res) { console.log(res); } }); </code></pre>
javascript jquery
[3, 5]
2,200,247
2,200,248
Best filename to include JQuery in an embedded application
<p>I'm using JQuery for an embedded system that is isolated from the outside word. Therefore jquery exists on the local server (the embedded system). The question is: what would be the best file name to include JQuery in my html?</p> <ol> <li><code>&lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;</code></li> <li><code>&lt;script type="text/javascript" src="js/jquery-1.6.4.js"&gt;&lt;/script&gt;</code></li> </ol> <p>I searched Stackoverflow and found the following threads despite of being useful they don't answer my specific question in this scenario:</p> <ul> <li><a href="http://stackoverflow.com/questions/3312830/what-is-the-best-way-to-include-latest-version-of-jquery">What is the best way to include latest version of jQuery?</a></li> <li><a href="http://stackoverflow.com/questions/3534111/what-is-the-best-way-to-include-jquery-in-dotnetnuke-4-8-x">What is the best way to include jQuery in DotNetNuke 4.8.x?</a></li> </ul> <p>Because if later we switch to a newer version, I don't have to go through the html files and update them. This is an embedded system and once it's running we hardly update any file. Besides the customer doesn't need to know the version of the libraries and developers know the version already.</p>
javascript jquery
[3, 5]
1,539,871
1,539,872
Issue with JavaScript binding?
<p>I have a drag oriented UI I'm putting the finishing touches on. I was having trouble with losing the mousemove event outside of the parent container, and found some code to bind the mousemove and mouseup functions to the document instead of the element. I tried to apply this to my code but have been unsuccessful so far.</p> <p>Original working code:</p> <p>...</p> <p>Reference Code: <a href="http://www.foreachbit.com/2010/08/draggable-html-element.html" rel="nofollow">http://www.foreachbit.com/2010/08/draggable-html-element.html</a></p> <p>EDIT: I got the code working, but now I have two mousemove functions. I feel like one of them muse be redundant. How would you clean up the following code?</p> <pre><code>$(document).ready(function () { metroUI.init(); $('#panorama').mousedown(function (event) { $(document).mousemove(function (event) { $('#panorama').bind("mousemove", metroUI.moveInfo); }); }); $(document).mouseup(function (event) { $(document).unbind('mousemove'); $('#panorama').unbind('mousemove'); metroUI.panelAnimate('#panorama'); metroUI.resetVars(); $('body').removeClass('unselectable'); }); }); </code></pre>
javascript jquery
[3, 5]
3,248,411
3,248,412
creating dynamic table header
<p>i am developing monthly report of attendance sheet of a class. so for that i am thinking to create header dynamically (limit of loop will be the no of days in a month, which i am getting from javascript code) so can ne one pls suggest me with the function to print this kind of table . this is my function to get number of days in a month </p> <pre><code>function daysInMonth(month, year) { return new Date(year, month, 0).getDate(); } { var month='5'; var year='2009'; var loop=daysInMonth(month, year) } </code></pre>
javascript jquery
[3, 5]
3,881,653
3,881,654
What is a real-world practical application for using return false instead of e.preventDefault() and vice-versa?
<p>I understand that if I return false it's essentially calling <code>e.preventDefault()</code> and <code>e.stopPropagation</code>.</p> <p>My question lies in the decision of when I would want to continue event flow vs stopping it altogether. Could we list some real-world situations where I would want to use <code>e.preventDefault()</code> instead of <code>return false</code> and vice-versa to paint a clearer picture for me? </p> <p><strike><strong>EDIT:</strong></p> <p>I'm a visual learner and <strong><em>seeing</em></strong> <em>how</em> something works, as opposed to <strong><em>reading</em></strong> about it, is how I understand <em>why</em> it works. I would be most appreciative to anyone who could post code examples for me.</strike></p> <p><strong>EDIT:</strong></p> <p>Based on @Pointy's answer and comments, I created a working <a href="http://jsfiddle.net/3DwwA/" rel="nofollow">jsFiddle demo</a> for those visual learners out there. I think it sums it up quite nicely.</p>
javascript jquery
[3, 5]
4,502,317
4,502,318
PHP JS Transform date to user timezone
<p>I have a page that shows future events along with the date (server time). I need some method to display the date in user time.</p> <p>Example:<br> Oct, 26 13:48:23 (server)<br> Oct, 26 14:48:23 (user time (UTC +1)) -> event info</p> <p>What I have so far:</p> <pre><code>&lt;?php $sql=mysql_query("SELECT * FROM table") or die("Come back later"); while($row=mysql_fetch_array($sql)) { echo date('M, d H:i:s', strtotime ($row['date'])).' -&gt; '.$row['info']; } ?&gt; </code></pre> <p>With the diffence I want to detect user timezone.</p> <p>Thank you.</p> <p><strong>EDIT</strong> I know I should not be using mysql_*</p>
php javascript
[2, 3]
4,869,783
4,869,784
Extracting time from string
<p>I have a string in the format of something like this: "7:18 am"</p> <p>What I'd like to be able to do is extract the "718" (not the colon in between) and the "am" into two separate variables.</p> <p>I tried doing something like this, but it only returned the first integer - in this case, the 7.</p> <pre><code>var time = parseInt("7:18") </code></pre> <p>What would be the best way to accomplish this?</p>
javascript jquery
[3, 5]
3,996,789
3,996,790
How to load .ascx control in .aspx page with out postback or reloading the page
<p>I have some code that is running fine , what i want is when i create a cookie i want the .ascx control to load to perform some function on the cookie but i don't want the page to post back, how can i achieve that.</p>
javascript asp.net
[3, 9]
1,587,397
1,587,398
$find returning null
<p>I have radGrid in <code>.ascx</code> page in which I want to find the control using <code>$find</code> but it returns a null to me. Below is my code which I am using to get the object (written in .ascx).</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { var Rates_gridID = $find('&lt;%= gridRates.ClientID %&gt;'); alert(Rates_gridID); }); &lt;/script&gt; </code></pre> <p>Here, I am getting <code>Rates_gridID</code> as null in alert. Interesting thing which I noted is when I change the jQuery version to <code>1.2.6</code> from <code>1.6.4</code> I am getting <code>Rates_gridID</code> object. I have googled this a lot but not getting any solution. I think the problem is with <code>$(function()</code>.</p>
jquery asp.net
[5, 9]
5,963,562
5,963,563
Checking and unchecking checkboxes after postback in Page_PreRender
<p>I have a dynamic table that's in a update panel. The data of the table gets filled form the code behind. In every row there is a checkbox. After a postback the checkboxes get rechecked if they need to be checked. I have all the items that needs to be chacked in a list. This list gets checked in the PreRenderer. This works fine if the page opens for the first time.</p> <pre><code>void Page_PreRender(object sender, EventArgs e) { foreach (string CheckedeID in cboCheckedList) { CheckBox checkedBox = (CheckBox)tbl_main.FindControl(CheckedeID); checkedBox.Checked = true; } } </code></pre> <p>After a postback, if a button gets click to change the checked status. The new ID gets added to the cboCheckedList. I can see when I'm debugging the item is in the list and the new item also gets checked. But when I return to the page the checkbox isn't checked.</p> <p>Am I setting the checkbox in the wrong location? Where should I set the checkbox so it will stay checked?</p> <p>The code of the table in the updatepanel:</p> <pre><code>&lt;asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Table runat="server" ID="Table1" BorderStyle="Solid" BorderWidth="2" GridLines="Both" BackColor="White" class="tablesorter"&gt; &lt;asp:TableHeaderRow ID="TableHeaderRow2" runat="server"&gt; &lt;asp:TableHeaderCell BackColor="#CEE3F6" ForeColor="White" Wrap="false" Width="50px" HorizontalAlign="Center" CssClass="NoImage"&gt; &lt;/asp:TableHeaderCell&gt; .... &lt;/asp:TableHeaderRow&gt; &lt;/asp:Table&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
c# asp.net
[0, 9]
2,458,373
2,458,374
Jquery chat how track user session
<p>We have implemented a Jquery chat in our company for internal communications.it is working fine. We are saving user status on data base, when a user logged in save his status on DB, when he logged out change status as log out.</p> <p>Issue is that if any user does not click the logged out button and close the window or shut down his PC, he still logged in our chat system.How we can track a each user is logged in, tracking user session is possible?</p> <p>Help is highly appreciated, Thanks, VKS</p>
php jquery
[2, 5]
1,075,883
1,075,884
How to get a collection of divs with jquery?
<p>I want to get the second img:</p> <pre><code>&lt;form id="formElem" name="formElem" action="" method="post"&gt; &lt;fieldset class="step"&gt; &lt;img src="1.jpg" &gt; &lt;/fieldset&gt; &lt;fieldset class="step"&gt; &lt;img src="2.jpg" &gt; &lt;/fieldset&gt; &lt;fieldset class="step"&gt; &lt;img src="3.jpg" &gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>I tried doing something like:</p> <pre><code>var imgSRC = $("div[id ='step']").get(1).find('img').attr('src'); alert(imgSRC); </code></pre> <p>Got nothing....</p>
javascript jquery
[3, 5]
1,032,923
1,032,924
Restricting characters entered in textbox using Javascript
<p>I need to validate a textbox that it should allow only certain characters and after the limit is reached the textbox should not allow entering characters in it.It can be done by Javascript but dont know how to do.. Anyone please help.. </p>
javascript asp.net
[3, 9]
1,894,975
1,894,976
How can I format a number to the fixed locale?
<p>How can I insert to a string comma (,) after every 3 position starting from last? </p> <pre><code>input desired output 9876567846678 9,876,567,846,678 567 567 1234 1,234 </code></pre> <p>I used one method like first divide the whole string by three position and then while merging appending coma by three three position.</p> <p>Is there any better solution? Is there function available to do this trick in java? </p> <p><strong>Edit :</strong><br> LAS_VEGAS answer will format the number based on the locale. But i want to format it to a fixed locale ...<br> how can i do tht?</p>
java android
[1, 4]
562,576
562,577
Writing a quiz application
<p>im making a quiz application in asp.net using c#. The following code is my start page where on clicking on start i'm redirected to my questions page. The only reason I've added a start.aspx page ... so I could initialize the values in the Session. Here in the page_load event the- request.QueryString["testid"] always resulting to null? i.e my if condition is never true and everytime i'm redirected to my "default.aspx" page. what is the reason?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; namespace TESTPROJ2 { public partial class START : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ArrayList a1 = new ArrayList(); Session.Add("answerlist", a1); Session.Add("quizid", 1); if (Request.QueryString["testid"] != null) { int testID = int.Parse(Request.QueryString["testid"]); Session.Add("quizid", testID); } else { Response.Redirect("DEFAULT.aspx"); } } protected void startB_Click(object sender, EventArgs e) { Response.Redirect("QUEST.aspx"); } } } </code></pre>
c# asp.net
[0, 9]
3,439,528
3,439,529
Clear cookie with javasript or php script
<p>i have a problem need all you guys help me.i set the cookie with javascript when the user make change to the select tag in html code and clear i want to clear it.</p> <p><em>*</em> if in php script i just need to clear or delete it , but if in jquery script i need to delete the old one immediately and set a new one of cookie value when the user make change to select tag. let's see the script below.</p> <p>jquery script</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $('#category').live('change',function(){ var opt = $('category :seleted').val(); document.cookie='category_name='+opt; //set the cookie when user make change $.ajax({ type:'POST', url : 'getcatetgory.php', data : {option : opt}, success: function(){alert('you have successfully get on category')} }); }); }); &lt;/script&gt; </code></pre> <p>html</p> <pre><code>&lt;select id='category'&gt; &lt;option value='car'&gt;Car&lt;/option&gt; &lt;option value='house'&gt;House&lt;/option&gt; &lt;option value='sport'&gt;Sport&lt;/option&gt; &lt;option value='song'&gt;Song&lt;/option&gt; &lt;option value='phone'&gt;Phone&lt;/option&gt; &lt;/selete&gt; </code></pre> <p>this is i have done with php script.</p> <pre><code>unset($_COOKIE['category_name']); </code></pre> <p>but it still doesn't work for me. please guide me </p>
php javascript
[2, 3]
2,643,022
2,643,023
Reloading data using javascript
<p>I'm trying to create an image with text on it that people can edit on the same page. But a lot of the information that will be placed on the image is being taken from another source using <code>file_get_contents</code> via PHP. I want user's to be able to click a refresh button to reload the image and data on the image without having to refresh the page. How can I do this using javascript or other language? </p> <p>Any ideas are welcome, thanks.</p>
php javascript
[2, 3]
5,652,848
5,652,849
Changing the UI of a webform when the browser language changes
<p>I need to change the location of some controls of a webform when the page is opened in a different language. That is I simply need to Localize the GUI of the Webform too along with the text of the webform.</p>
c# asp.net
[0, 9]
3,826,137
3,826,138
Return value from child thread
<p>I'm writing an Android app that communicates with a website. Any time I hit the website, I'm displaying a ProcessDialog so that the user knows something's happening. Most of my website communication is one-way, so I don't usually expect any return data.</p> <p>There is one point however where I need to get information back, but the results are not being stored when I exit the child thread. In a nutshell, I need to call a thread, let it process the results, and store the results in a couple of fields.</p> <p>Here's what I've got so far - I have two variables, <code>String[] Account</code> and <code>boolean AccountRetrievalSuccess</code>:</p> <pre><code>public void GetAccount() { MyDialog = ProgressDialog.show( MyContext, "Retrieving Account" , "We're retrieving your account information. Please wait...", true); Thread T = new GetAccountThread(); T.start(); } public class GetAccountThread extends Thread { @Override public void run() { try { String resp = GetPage(BaseURL+MainPage+"?P="+PhoneID+"&amp;K="+WebAccessKey+"&amp;A=ACCOUNT"); if (resp.contains("FAILURE|")){ failhandler.sendEmptyMessage(0); } else { resp = resp.replace("SUCCESS|", ""); Account = resp.split("\\|"); handler.sendEmptyMessage(0); } } catch (Exception e) { failhandler.sendEmptyMessage(0); } }; private Handler handler = new Handler() { @Override public void handleMessage(Message msg) { AccountRetrievalSuccess = true; MyDialog.dismiss(); } }; private Handler failhandler = new Handler() { @Override public void handleMessage(Message msg) { AccountRetrievalSuccess = false; MyDialog.dismiss(); ShowWtf(); } }; } </code></pre> <p>Any idea what I'd need to do to be able to store the Account and AccountRetrievalSuccess values so that I can access them from elsewhere in the code?</p>
java android
[1, 4]
5,889,140
5,889,141
"Guard" operator like JavaScript in PHP
<p>I like to do this in JavaScript:</p> <pre><code>function (a, b, c) { var foo = a || b || c; return foo.bar; } </code></pre> <p>Is there a quick way to do assignment with fallback or does it require a custom <code>function</code>?</p>
php javascript
[2, 3]
1,579,901
1,579,902
Validate form before submit with jQuery post to javaScript then to confirmation page
<p>I need to validate a form using jQuery then submit it to a JavaScript file that redirects it to the confirmation/send mail page. The reason I am doing this is to prevent spam emails with out putting some type of Captcha in. I am basically putting in a wrong url for the post to page of the form and then changing that to the correct page in an external JavaScript file. Everything works great except the form submits before it validates. I can see it mark the errors for a slight second before it submits.</p> <p>Validation JS:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('#contactform').submit(function() { return $('#contactform').valid(); }); $("#contactform").validate(); $("#Name").rules("add", { required: true, minlength: 5, messages: { required: "Required", minlength: jQuery.format("Minimum {0} Characters Required") } }); $("#Question").rules("add", { required: true, minlength: 20, messages: { required: "Required", minlength: jQuery.format("Question Must Be {0} Character Long") } }); $("#math").rules("add", { required: true, equalTo: "#math2", messages: { required: "Solve Security Question.", } }); }); &lt;/script&gt; </code></pre> <p>External JS Redirect:</p> <pre><code>function submitCommentForm() { // Change the form action to the real submission page document.getElementById('contactform').action = "confirmation.php"; // Submit the form document.getElementById('contactform').submit(); } </code></pre>
php javascript jquery
[2, 3, 5]
2,063,290
2,063,291
How to convert this javascript code in to jquery
<pre><code>if (window.parent.frames['scripts1']) { if (window.parent.frames['scripts1'].document.documentElement) { var strSCRIPT = window.parent.frames['scripts1'].document.documentElement.textContent; if ((strSCRIPT.lastIndexOf('bbbbEND') - strSCRIPT.length) != -7) { window.parent.frames['scripts1'].document.location.href = 'test1.txt?refresh=' + Date(); } } else { window.parent.frames['scripts1'].document.location.href = 'test1.txt?refresh=' + Date(); } } </code></pre> <p>I have tried lot of things but not success in writing something for cross browser.</p>
javascript jquery
[3, 5]
5,734,629
5,734,630
PHP/Javascript, Real Filename from Rewritten URL
<p>I have a Javascript bookmarklet that POSTs to a PHP script, and I need PHP to know the filename of the page that the bookmarklet is POSTing from. I'll be using that filename with <code>file_put_contents()</code>, so I need it to be a real file.</p> <p>The PHP will also be running on the same server as the page being POSTed from.</p> <h2><strong>For example:</strong></h2> <ul> <li><code>script.php</code> is placed in the root of an arbitrary server (<code>http://site.com/</code>)</li> <li>The operator browses to an arbitrary page on the server (<code>http://site.com/foo/bar/baz</code>) before executing the bookmarklet.</li> <li>The bookmarklet sends some data to <code>http://site.com/script.php</code>.</li> <li><code>script.php</code> now needs to make some modifications to the file corresponding to <code>http://site.com/foo/bar/baz</code>, but can't resolve the URL to a filename.</li> </ul> <hr> <p>There's <code>location.href</code> in Javascript and <code>$_SERVER[ 'HTTP_REFERER' ]</code> in PHP, but in the case of a rewritten URL (via <code>mod_rewrite</code> or whatever) these won't contain the real filename.</p> <p><strong>Is there any way to find the real filename of a URL in PHP or Javascript?</strong></p>
php javascript
[2, 3]
5,945,854
5,945,855
Invoking clearInterval for a Property Instance of an Initialized Custom jQuery Plugin
<p>I've written many js scripts &amp; jQuery plugins, so here's a condensed pseudo coded scenario of my dilemma.</p> <p>Assume we have a well written jQuery plugin defining an a method object to pass into our plugin.</p> <pre><code>// OUR HYPOTHETICAL jQUERY PLUGIN (function($){ var methods = { init : function(options){ var setup = $.extend({ 'speed' : 300, 'msg' : 'blah' }, options) return this.each(function(){ var animation = setInterval(function(){ ... },1000) ... }) }, stop : function(){ window.clearInterval(animation); // DOES NOT WORK } }; $.fn.somePlugin = function(method){ // Method calling logic if ( methods[method] ) { return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Bad Method...' ); } }; })(jQuery) </code></pre> <p>Let imagine instantiate this plugin to a div <code>$('#someDiv').somePlugin();</code></p> <p>Everything up to this point works fine and I'm able to call... <code>$('#someDiv').somePlugin('stop');</code></p> <p>However, the inside of the <strong>stop</strong> method is not able to figure out how to access the instance of the animation property that was created during the plugin initialization.</p> <p>Any ideas on how to get that specific instance of the <strong>animation</strong> variable that's associated to the plugin binded to <strong>#someDiv</strong>.</p>
javascript jquery
[3, 5]
4,467,882
4,467,883
form won't submit correctly via jQuery and reverts to default behaviour
<p>I've got a form withthe id offerForm which I submit via Jquery, but despite the 'return false' statement, the form doesn't submit via ajax. Any help will be much appreciated. </p> <pre><code>$(document).ready(function() { $('#offerForm').live('submit',function(){ loadData(1); }); function loadData(page){ $.post('get-offers.php', $("#offerForm").serialize() + '&amp;page=' + page, function(data) { //Do stuff $('#demo').html(data.htmlOutput); },'json' ); return false; } }); </code></pre>
javascript jquery
[3, 5]
2,452,213
2,452,214
How to call WebUserControls based on users request?
<p>I'm building a website where i need to call WebUserControls (.ascx) based on the user request, how can I accomplish this? Is this even possible?</p> <p>Example:</p> <pre><code>protected void userclick_click(object sender, EventArgs e) { if(textbox1.Text == "2") { call WebUserControl1.ascx } else { /*do nothing*/ } } </code></pre> <p>I'm using C# for this.</p> <p>Thank you in advance.</p>
c# asp.net
[0, 9]
17,751
17,752
How to get current content view in Android programming?
<p>I know that I can set the content of the view in an Android app by saying setContentView(int). Is there a function I can use to know what the current content view is? I don't know if that makes any sense, but what I'm looking for is a function called, say, getContentView that returns an int.</p> <p>Ideally, it would look like this:</p> <pre><code>setContentView(R.layout.main); // sets the content view to main.xml int contentView = getContentView(); // does this function exist? </code></pre> <p>How would I do that?</p>
java android
[1, 4]
2,980,071
2,980,072
Database add item to list view?
<p>I download this database script and i was wondering how can i convert it to instead add a item to a list view.. its a really easy understandable database code..</p> <p><a href="http://www.anotherandroidblog.com/wp-content/uploads/2010/08/AABDatabase.zip" rel="nofollow">http://www.anotherandroidblog.com/wp-content/uploads/2010/08/AABDatabase.zip</a></p> <p>Thats the source for it..</p> <p>also im guessing it could be in here??</p> <pre><code>/** * retrieves a row from the database with the id number in the corresponding * user entry field */ private void retrieveRow() { try { // The ArrayList that holds the row data ArrayList&lt;Object&gt; row; // ask the database manager to retrieve the row with the given rowID row = db.getRowAsArray(Long.parseLong(updateIDField.getText().toString())); // update the form fields to hold the retrieved data updateTextFieldOne.setText((String)row.get(1)); updateTextFieldTwo.setText((String)row.get(2)); } catch (Exception e) { Log.e("Retrieve Error", e.toString()); e.printStackTrace(); } } </code></pre>
java android
[1, 4]
91,963
91,964
Moving from Java to Python
<p>I've got a junior starting who's coming from a Java background. As a company we're now focused on Python development(albeit with some legacy systems in Java hanging around).</p> <p>I'm looking around for tips and resources to help the transition and wondered if you guys here had any useful tips for a newbie. </p> <p>Cheers.</p>
java python
[1, 7]
2,513,751
2,513,752
javascript or jquery get high lighted text
<p>How do I get javascript or jquery to grab me text that I've selected/high lighted with my mouse or keyboard?</p>
javascript jquery
[3, 5]
3,179,940
3,179,941
get selected text's html in div
<p>i have a div with contentEditable set to true. I have to find selected text html.I am able to get selected text in FireFox by</p> <pre><code> window.getSelection(); </code></pre> <p>I case of IE i am able to get selected text html by using</p> <pre><code>document.selection.createRange(). </code></pre> <p>But, how can i find selected text html in FireFox. How can in do this.Please help.</p>
javascript jquery
[3, 5]
4,898,373
4,898,374
ASP.NET (C#) - vs PHP
<p>Is it possible to create a login/registration system on my site without using any of the bulit-in stuff from ASP.NET - just like you can do in PHP? I've almost completely forgotten everything I learned about ASP.NET - but I don't mind starting over again.</p> <p>I'd rather roll my own login-registration system in ASP.NET than use an existing one. I seem to learn better this way.</p>
c# php asp.net
[0, 2, 9]
4,260,802
4,260,803
use variable part of ID with js
<p>I have a list of 8 divs: #video1, #video2, ... with each the same javascript actions to run when clicked, but with other id's (for #video1: show #image1, #preview1, ...). </p> <p>Instead of writing 8 times the same code but with other id's, can I do this more efficient? Is it possible to take the sixth caracter (the number) from each #videoX as a variable when clicked, and use this in the code?</p>
javascript jquery
[3, 5]
3,893,608
3,893,609
PHP - How can I load the same form with some differences concerning the type of fields?
<p>I have a form with some fields of type text and 2 fields (<code>name</code> and <code>second name</code>) that have a value by default, and these 2 fields are of type="hidden".</p> <p>Now, I would like to add a link on the form "Fill an order for another person". If the user click on this link the same form must be reloaded but with a little difference: the fields name and second name must be of type text to allow the user enter a name/second name.</p> <p>I can reload the form, but the fields <code>name</code> and <code>second name</code> remain hidden, because I don't know how define a condition that say to change the types if the user clicks on the link. Could you explain how can I do this? </p> <p>The fields that are filled by default:</p> <pre><code>if ($field_label=="Name") { return sprintf("&lt;div class='ginput_container'&gt;$name&lt;input name='input_%d' id='$field_id' type='hidden' value='$name' class='ginput_container' $max_length $tabindex $html5_attributes %s/&gt;&lt;/div&gt;", $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text); } else if ($field_label=="Second name") { return sprintf("&lt;div class='ginput_container'&gt;$secondname&lt;input name='input_%d' id='$field_id' type='hidden' value='$secondname' class='ginput_container' $max_length $tabindex $html5_attributes %s/&gt;&lt;/div&gt;", $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text); } </code></pre>
php javascript jquery
[2, 3, 5]
4,275,311
4,275,312
ASP.NET Role Management
<p>I am new at ASP.NET and developing my first web based application at ASP.NET.I should do role management.There are three kinds of folder in project; 1.ADMIN 2.MEMBER 3.ANOYNOMUS I wanna set the roles at web.config side.How can I do it at web.config? I couldn't find useful info at web, about the database side of this subject? Should I have a table which is about only roles?Or should I add 'Role' property to the Admin and Member tables.. Thanks in advance for your replies..</p>
c# asp.net
[0, 9]
4,892,285
4,892,286
jquery fadein broken
<p>I dont knwo why the Jquery fade in is not working for my content div</p> <p>HTML:</p> <pre><code>&lt;div id="content"&gt; &lt;div id="logo"&gt; &lt;img src="images/blue.jpg" alt="logo" /&gt; &lt;/div&gt; &lt;div id="form"&gt; &lt;form action="controler.php" method="post" id="target"&gt; &lt;input id="pass" type="text" value="Password" name="pass" /&gt;&lt;/form&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Javascript:</p> <pre><code>$(document).ready(function(){ $("#content").fadeIn(2000); $('#pass').click(function() { this.value=""; return false; }); }); </code></pre> <p>It might be something small but I cant find it</p>
javascript jquery
[3, 5]
3,995,862
3,995,863
Getting URL of the top frame
<p>Inside a facebook application I need to check what is the top frame (the main window) URL, and show content accordingly.</p> <p>I tried using the following:</p> <pre><code>if (top.location.toString().toLowerCase().indexOf("facebook.com") &lt;0) { ... } </code></pre> <p>Which works well if the page is not inside an iframe, but when the page is loaded within an iframe (as it does when used as facebook application) the code generates </p> <blockquote> <p>"Uncaught TypeError: Property 'toString' of object # is not a function".</p> </blockquote> <p>Is there any way I can fix this code (with cross-browser compatibility - maybe with jQuery)?</p> <p>Thanks!</p> <p>Joel</p>
javascript jquery
[3, 5]
1,395,652
1,395,653
what is the difference between jquery selectors and js selectors?
<p>Simple question for a noob. Is there a difference between these to variables?</p> <pre><code>var object1 = document.getElementById('myElement'); var object2 = $('#myElement'); </code></pre> <p>Also, am I able to run normal js stuff on object2? For example, if #myElement is a <code>&lt;textarea&gt;</code> can I do:</p> <pre><code>object2.value = "fill in with this text"; </code></pre> <p>or, must I do: </p> <pre><code>$(object2).val('fill in with this text'); </code></pre> <p>or, is there yet a better way?</p>
javascript jquery
[3, 5]
1,150,984
1,150,985
Best way to put delay after calling javascript functions
<p>I'm using jquery to call some javascript functions with a delay between them.<br /> Also I'm using <a href="http://docs.jquery.com/Cookbook/wait" rel="nofollow">Jquery Wait</a></p> <p>When I call below function,all functions are called recpectively,there are no delays between each other.</p> <pre><code>$(this) .call(f1) .wait(5000) .call(f2) .wait(5000) .call(f3); </code></pre> <p>Here <strong>call</strong> function calls some function as I did</p> <pre><code>$.fn.call = function (f) { if (f) f(); return this; }; </code></pre> <p>What am i doing wrong ? How can i achieve something like this ? <br /> Thank you</p>
javascript jquery
[3, 5]
584,724
584,725
Form submit event problem
<pre><code>&lt;form id="form1" runat="server" onsubmit="return CheckForm(this)"&gt; &lt;script type="text/javascript" language="javascript"&gt; function CheckForm(frm) { if(CheckEntireForm(frm) == false) return false; } &lt;/script&gt; </code></pre> <p>Hello EveryBody Please help me to get solution</p> <p>I've used a javascript function on form's onSubmit event like</p> <p></p> <p>which validates my page's textboxes etc. NOTE: i am not using asp.net's validation. i have got my own validation classes</p> <p>I've also used a dropdownlist with auto post back set to true</p> <p>in asp.net 2.0 when dropdownlist's selected index is changed it</p> <p>calls form's onsubmit while this did not use to happen in asp.net 1.1</p> <p>I've used this on 140 pages in my website the worst case will be to call</p> <p>CheckForm(this.form) on my save buttons client click on all the pages.</p> <p>I am looking for a backword compatibility solution which can be applied at a single place</p> <p>like web.config or some class etc. i am using asp.net and javascript</p>
asp.net javascript
[9, 3]