Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
2,042,455
2,042,456
run jquery code on loaded page via jquery ajax request (load)
<p>I am loading an entire middle div via JQuery Ajax call and I simply want to run $(document).ready on the loaded page </p> <p>header.php loads part of the page </p> <pre><code>var $next = $("&lt;div class='nextab center'&gt;").insertAfter('#content .current'); $next.load($this.attr('href')+ ' #content .center section' , function(resp) { ... </code></pre> <p>}</p> <p>so for example when header.php loads career.php it does not run all the code that is inside the $(document).ready(function(){ that is on career.php</p> <p>I was thinking of creating a function init on each page loaded but not sure how to call this function from the load callback</p> <p>Thanks </p>
javascript jquery
[3, 5]
612,670
612,671
how do I show n json items every x seconds using jquery?
<p>I have a json object 'items' which has few items that I want to show 2 of them every 2 seconds. How would I do that? so, it displays items in division1 every few seconds instead of showing all at once. Eg. get all items every 5 seconds and show 4 items every second for 20 items.</p> <pre><code>&lt;table id="division1" &gt; &lt;thead&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Score&lt;/th&gt; &lt;/thead&gt; &lt;tbody&gt;&lt;/tbody&gt; &lt;/table&gt; function render_items(division){ var tablebody =""; $.each(division.items, function (i,item){ var tablerow ="&lt;tr&gt;" +"&lt;td&gt;"+item.name+"&lt;/td&gt;" +"&lt;td&gt;"+item.score+"&lt;/td&gt;" +"&lt;/tr&gt;"; tablebody = tablebody+tablerow; //$('#test').append(division.name+' '+i+' '+robot.name+'&lt;br&gt;'); } ); $('#'+division.name+" tbody").html(tablebody); } function poll(){ $.post("data.php", {getvalues: 0}, function (data, status){ $.each (data.divisions, function(i,division){ render_items(division); }); }, 'json' ); setTimeout('poll()',5000); } $(document).ready(function() { poll(); } </code></pre>
javascript jquery
[3, 5]
332,931
332,932
jQuery plugin will use default options instead of user defined options
<p>So I have a plugin with a update method, which is used if a user ads new content to a div(placeholder), at start things go fine, the plugin will use the user defined options of the plugin, but once the user runs the update method it will use the default options instead of the defined options.</p> <p>Plugin wrapper...</p> <pre><code>;(function($, window, document, undefined){ //"use strict"; // jshint ;_; var pluginName = 'myPlugin'; function Plugin(element, options){ this.elm = $(element); this.options = $.extend({}, $.fn[pluginName].defaults, options); this.init(); }; Plugin.prototype = { init: function(){ // we run this at start... }, update: function(){ // code that we need when we need to update... }, }; $.fn[pluginName] = function(option) { var options = typeof option == "object" &amp;&amp; option; return this.each(function() { var $this = $(this); var data = new Plugin($this, options); if(!$.data($this, pluginName)){ $.data($this, pluginName, data); } if(typeof option == 'string'){ data[option](); } }); }; $.fn[pluginName].defaults = { name: 'Hank', ... ... }; })(jQuery, window, document); </code></pre> <p>// inline js</p> <pre><code> $('#container').myPlugin({name: 'NOT Hank...'}); $('#updatelink').click(function(e){ $('#container').myPlugin('update'); }): </code></pre>
javascript jquery
[3, 5]
3,420,349
3,420,350
JQuery change class by given id's
<p>I have a number of tables, for example:</p> <pre><code>&lt;table class="onion" id="12"&gt; </code></pre> <p>When a div named "Mark_Pre_Val" gets clicked i want tables with the id's 4, 6, 12 &amp; 21 to change their class to "onionClick", and if one of them is already "onionClick" then don't change the class.</p> <p>Here is the click event:</p> <pre><code> $(".Mark_Pre_Val").click(function(){ }); </code></pre> <p>Can someone point me to the right direction how to approach this?</p>
javascript jquery
[3, 5]
2,707,317
2,707,318
using jquery for validation
<p>I'm pretty much new to jquery. I've been trying to do validations where i check if a textbox length is greater than 4.</p> <p>So, this is what i did: </p> <pre><code> $(document).ready(function () { $('#tbstreet1').blur(isValid); }); function isValid() { Boolean isvalid; var street1Length = $("#tbstreet1").val().length; alert(street1Length); if(myLength &gt;4) { isvalid= true; ActivateSave() } } function ActivateSave() { $("#btn_save").attr("Enabled",true); } </code></pre> <p>This is my aspx page:</p> <pre><code> &lt;asp:Label runat="server" ID="street1" Text="Street1" O&gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID="tbstreet1" runat="server" CausesValidation="true" &gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btn_save" runat="server" Text="Save" Enabled="false" /&gt; </code></pre> <p>I even have script source in my .net page</p> <pre><code> &lt;script src="http://code.jquery.com/jquery-1.6.4.js" type="text/javascript" &gt; &lt;/script&gt; </code></pre> <p>But the thing has been that how do i call the javascript function from here? as i 'm pretty sure that my javascript is not getting called. Can u help me?</p>
jquery asp.net
[5, 9]
4,101,805
4,101,806
Get Value selected dropdownlist option
<p>I have Drop Down List control and add dynamic add option into Dropdownlist but But when I get value option return string empty </p> <p>please help me thanks</p>
c# jquery asp.net
[0, 5, 9]
1,271,536
1,271,537
how to get value from a loop while using different button
<p>I need the value from a loop witch is $row->value, then when I click on button_click(href) a DIV popup will show and ask for another value that is idnumber. At the popup a submit button will direct to next_page.php</p> <p>I want both value from loop $row->value and at popup value=idnumber send to next_page.php</p> <pre><code>&lt;div id="show_popup"(hide/show popup)&gt; &lt;form action="next_page.php" method="GET or POST"&gt; &lt;input name="idnumber" type="text" value=""&gt; &lt;input type="submit" value="button"&gt; &lt;/form&gt; &lt;/div&gt; &lt;?php foreach($foo as $row){ echo " &lt;tr&gt; &lt;td&gt;".$row-&gt;value."&lt;/td&gt; &lt;td&gt;&lt;a class='button' href='#' onlick='(popup DIV)'&gt;button_click&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt;"; } ?&gt; </code></pre> <p>Is this possible?</p> <pre><code>$(function() { function launch() { $('#show_popup').lightbox_me({centered: true, onLoad: function() { $('#add-new-popup').find('input:first').focus()}});} $('.button').click(function(e) { $("#show_popup").lightbox_me({centered: true, onLoad: function() { $("#show_popup").find("input:first").focus();}});e.preventDefault(); }); }); </code></pre>
php javascript jquery
[2, 3, 5]
1,972,891
1,972,892
jquery each function on string variable
<p>I have wrote a function in javascript which takes title attributes of <code>&lt;tr&gt;</code> calls ajax then after some operation it retreive some title attributes from them. depending on that title attribute i want to remove those <code>&lt;tr&gt;</code> rows</p> <pre><code>function currentTicketStatus() { var ids = ''; $('tbody tr[title]').each(function() { ids += ((ids == '') ? '' : ',') + $(this).attr('title'); }); $.ajax({ url: 'ajaxExecute.aspx?Fn=CTS', type: 'POST', context: document.body, cache: false, data: 'Tickets=' + ids, success: function(response) { if (response != '') { if (response.substr(0, 5) != 'ERROR') { var sTickets = response.split('|'); sTickets.each(function() { $(this).parent().parent().remove(); }); } } } }); } </code></pre> <p>Example : at the time of ajax call <code>ids="100,101,102,103,104"</code> after ajax call <code>sTickets="101|102"</code> . Now remove those rows with attributes of sTickets</p> <p>HTML (Not Exactly )</p> <pre><code>&lt;tbody&gt; &lt;tr title="100"&gt; some data part &lt;/tr&gt; &lt;tr title="101"&gt; some data part &lt;/tr&gt; &lt;tr title="102"&gt; some data part &lt;/tr&gt; &lt;tr title="103"&gt; some data part &lt;/tr&gt; &lt;/tbody&gt; </code></pre>
javascript jquery
[3, 5]
421,557
421,558
Inserting PHP variable value in Javascript file
<p>I have a JavaScript file which has a hard coded BASEURL variable, this value is then used by other functions in the file. I would like for this url value to be set dynamically so that I don't need to manually change it for different installs. Is it possible to insert a PHP variable value into a JavaScript file?</p>
php javascript
[2, 3]
802,934
802,935
javascript convert string to safe class name for css
<p>I am sure this must of been asked before but can't find any in the search. What is the fastest way to ensure all non safe characters are removed from a string allowing it to be used in a CSS class name?</p>
javascript jquery
[3, 5]
2,964,760
2,964,761
Why is decodeByteArray giving me a null pointer error
<p>I'm trying to pass a byte array from an image to an activity through a bundle</p> <p>creating the byte array with </p> <pre><code> Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); ByteArrayOutputStream picArray = new ByteArrayOutputStream(); thumbnail.compress(CompressFormat.PNG, 0, picArray); byte[] picData = picArray.toByteArray(); </code></pre> <p>when i try to decode the byte array into a bitmap i get a null pointer exception which FC's (running on physical phone) </p> <p>I've been going through line by line and this is the only thing creating an error</p> <pre><code> //grab byte array taken Intent sent = this.getIntent(); Bundle arrayForPic = sent.getExtras(); byte[] picArray = arrayForPic.getByteArray("pictureArray"); //convert array into bitmap //null error happens HERE Bitmap thumbnail = BitmapFactory. decodeByteArray(picArray, 0, picArray.length); </code></pre> <p>the errors are</p> <pre><code>FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.HandlePic}: java.lang.NullPointerException Caused by: java.lang.NullPointerException at com.test.HandlePic.onCreate(HandlePic.java:43) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1703) </code></pre> <p>line 43 is where the decodeByteArray is</p>
java android
[1, 4]
4,317,915
4,317,916
ASP:Imagebutton fail to post back in gridview
<pre><code> &lt;asp:GridView ID="gv1" runat="server" Width="100%" DataSourceID="ods1" AutoGenerateColumns="false" DataKeyNames="FileID" HeaderStyle-Height="20px"&gt; &lt;Columns&gt; &lt;asp:TemplateField ItemStyle-Width="25px" ItemStyle-HorizontalAlign="Center"&gt; &lt;ItemTemplate&gt; &lt;asp:ImageButton ID="imgMimeType" runat="server" CommandName="download" /&gt; &lt;/ItemTemplate&gt; ... </code></pre> <p>I have defined my image button as above, but for some reason row command fails to fire off when I click the button. </p> <p>Strangely, linkbutton in another column works just fine. </p> <p>How do I make it so that image button will fire off post back?</p> <p><strong>Row bind</strong></p> <pre><code>Image Button imb = e.Row.FindControl("imgMimeType") as ImageButton; if (imb != null) { imb.CommandArgument = file.FileID.ToString(); imb.AlternateText = imb.ToolTip = file.MimeType; if (file.MimeType.Contains("zip")) { imb.ImageUrl = "~/Images/mimetypes/zip-icon.png"; } ... </code></pre> <p><strong>Row command code</strong></p> <pre><code>public void gv1_RowCommand(object sender, GridViewCommandEventArgs e) { switch (e.CommandName.ToLower()) { case "download": ... </code></pre>
c# asp.net
[0, 9]
843,705
843,706
How to remove rows from huge data table without iterating it?
<p>I have a DataTable available with me which contains thousands of rows. There is a column called EmpID which is containing '0' for some of the rows. I want to remove them from my current DataTable and want to create a new correct DataTable. I cannot go row by row checking it since it contains huge amount of data. Give me a suggestion to overcome this problem. </p>
c# asp.net
[0, 9]
5,030,340
5,030,341
Is it possible to select class & class & class, not just class OR class OR class?
<p>I am trying to select specific values. but I am running into an issue.</p> <p>I have two elements one has X Y and the other has X Y Z.</p> <p>When selecting for X Y Z, I'm also receiving the value of X Y... is there a way to make it so its looking for X AND Y AND Z instead of X OR Y OR Z?</p>
javascript jquery
[3, 5]
2,316,667
2,316,668
jQuery Animate not working on Chrome
<p>I'm having a little issue here with Google Chrome. My code works pretty well with Safari, which makes me think it should work fine with Google Chrome. But Chrome doesn't animate as expected. What could be wrong?</p> <pre><code>$(function() { var sourceFoto = $(".empreendimento .main-photo img").attr("src"); var alturaFoto; var larguraFoto; var limiteX; var limiteY; $(document).load(sourceFoto, function() { alturaFoto = $(".empreendimento .main-photo img").height(); larguraFoto = $(".empreendimento .main-photo img").width(); limiteY = Math.round(alturaFoto - 420); limiteX = Math.round(larguraFoto - 580); $(".empreendimento .main-photo img").animate({ marginLeft: "-" + limiteX }, 5000, 'jswing').animate({ marginTop: "-" + limiteY }, 5000, 'jswing').animate({ marginLeft: "0px" }, 5000, 'jswing').animate({ marginTop: "0px" }, 5000, 'jswing'); }); });​ </code></pre> <p><strong>Edit</strong></p> <p>I've found the answer. Just loaded the image with <code>onLoad</code> method and worked pretty well.</p> <pre><code>image = new Image(); image.onload = function() { alturaFoto = $(".empreendimento .main-photo img").height(); larguraFoto = $(".empreendimento .main-photo img").width(); limiteY = Math.round(alturaFoto - 420); limiteX = Math.round(larguraFoto - 580); $(".empreendimento .main-photo img").animate({ marginLeft: "-" + limiteX }, 5000).animate({ marginTop: "-" + limiteY }, 5000).animate({ marginLeft: "0px" }, 5000).animate({ marginTop: "0px" }, 5000); } image.src = sourceFoto;​ </code></pre>
javascript jquery
[3, 5]
2,014,209
2,014,210
Substring not working on childNodes[0].nodeValue
<p>I'm trying to extract a text from td as discussed here <a href="http://stackoverflow.com/questions/13760664/replacing-a-part-of-text-inside-a-td#13760705">Replacing a part of text inside a td</a></p> <pre><code>$('.my-table tr').each(function() { var contact = $(this).find('td').eq(1)[0].childNodes[0].nodeValue; $(this).find('td').eq(1).contents()[0].data = contact.substring(0,10); }); </code></pre> <p>But contact.substring(0,10); doesn't seem to work and it just shows empty.</p> <p>How can i fix this?</p>
javascript jquery
[3, 5]
5,768,010
5,768,011
files.length is undefined in Internet Explorer
<p>I'm using </p> <pre><code>$(upload_button).bind('change', function(event) { var files = this.files; alert(typeof(files)); if(typeof(files)!='undefined') { } }); </code></pre> <p>in my code with jQuery which is working fine in Firefox and Chrome but not in IE8(i.e., IE returns undefined for <b>files.length</b>, whereas others returns the value). So do anybody know how to resolve this?</p>
javascript jquery
[3, 5]
3,615,105
3,615,106
How to set the Background color while printing?
<p>I am using ASP.NET and C#. I am printing the entire aspx page into new window on button click.</p> <p>This is my code..</p> <pre><code> Page pg = new Page(); pg.EnableEventValidation = false; HtmlForm frm = new HtmlForm(); pg.Controls.Add(frm); frm.Controls.Add(ctrl); pg.DesignerInitialize(); pg.RenderControl(htmlWrite); string strHTML = stringWrite.ToString(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(strHTML); </code></pre> <p>This is working fine. Now i need that the printed page should have the same background color of the aspx page. Then the aspx page has some textbox. So i need that after printed the values in the textbox should not be able to change. Now by this code its changable.</p> <p>Is it possible?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
1,005,699
1,005,700
Android - HTTP Get request on LAN
<p>I am using the following code to get a page's source which is a plain text (no html tags) from a webserver on LAN. But I am always getting empty string in return and If I open the same URI in browser I can see the text. Following is my code:</p> <pre><code> String url = "http://192.168.1.40/touchscreens/get.qsp?display=1"; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); request.setHeader("Content-Type", "text/plain; charset=utf-8"); request.setURI(new URI(url)); HttpResponse response = client.execute(request); in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer sb = new StringBuffer(""); String line = ""; String NL = System.getProperty("line.separator"); while ((line = in.readLine()) != null) { sb.append(line + NL); } String page = sb.toString(); Toast.makeText(getApplicationContext(), page, Toast.LENGTH_LONG).show(); </code></pre> <p>and one more thing when I enter the same URL in android emulator browser I don't see anything. Am i missing something?</p>
java android
[1, 4]
11,807
11,808
How can I add a dynamic numer of UserControls in an asp.net page?
<p>Here's the problem:</p> <p>I have an (almost) empty aspx page and I want to insert a certain number of the same user control in this page.</p> <p>The fact is that I don't know how many of them I will need.</p> <p>I tried to add them from the CodeBehind but it seems that the UserControls are completely empty.</p> <p>In the main page (MainDiv is a div with runat="server"):</p> <pre><code>protected void Page_Init(object sender, EventArgs e) { WebUserControl1 uc = new WebUserControl1(); WebUserControl1 uc1 = new WebUserControl1(); MainDiv.Controls.Add(uc); MainDiv.Controls.Add(uc1); } </code></pre> <p>(it doesn't work if i put this code on Page_Init, Page_Load or Page_PreRender)</p> <p>UserControl (gw is a Gridview contained in the UserControl):</p> <pre><code>protected void Page_PreRender(object sender, EventArgs e) { if (_data != null) { gw.DataSource = _data; gw.DataBind(); } } </code></pre> <p>when I arrive there, gw is null (this.Controls.Count is 0).</p> <p>How can I solve this?</p>
c# asp.net
[0, 9]
5,837,505
5,837,506
Explicit or implicit looping?
<p>Why or when is "explicit" preferred when implicit solutions often are more readable and less code? It says "explicit is better than implicit" when for example an implicit loop is better than an explicit loop isn't it? </p> <pre><code>for every in all: every.updated = True </code></pre> <p>The above looks implicit to me and better than an explicit counter since a counter is another thing that can go wrong and why not leave to the compiler or other environment instead of requirement an explicit counter variable:</p> <pre><code> for(int i=0, i&lt;a.length, i++) ... </code></pre> <p>And there are languages where all looping is "implicit" - what does it mean and when is it preferred? And not explicitly setting a value to <code>null</code>or <code>None</code> or likewise seems better to me and I want to rewrite code when I "solve" a requirement by explicitly setting <code>return null</code> or <code>String name = null</code> since I think being explicit about what should be null and None should have a more clear solution such as only use a variable if it's needed and if I write return null somewhere I'm probably doing it wrong. When I was writing Java I found myself writing <code>return null</code> and declaring values as null at some places and I didn't like it and could rewrite it even though the case where I put <code>return null</code> was reached only in case of error. </p> <p>I asked the guru at work whether we ever should declare a variable to null, isn't defaults much better?</p> <p>I'd be glad to know your thoughts about this. An example where it <em>is</em> better to be explicit I can think of is declaring a list and explicitly declaring what type is in the list is better than just a list of objects e.g. it's preferred to declare <code>ArrayList&lt;ArrayList&gt;</code> instead of just an ArrayList if we know that it's a list of lists. </p>
java python
[1, 7]
4,792,719
4,792,720
Javascript/JQuery. Cache xml file locally
<p>Using <code>$.ajax({..})</code> I receive the contents of an XML file from the server. So I don't have to request this file every time the page loads, I would like, if possible, to cache this content locally, save it in a file on the disk. But cache it in such a way that it will be available even the next day, after a restart. The XML file content updates daily so no need to resend the file so often.</p> <p>Is it possible? If so, how can i achieve this? Could you offer a link or some sample code please? I've searched for something good which I can understand, but i was not successful.</p>
javascript jquery
[3, 5]
2,347,500
2,347,501
How to make android phone silent in java
<p>Hi I am new to android development. I am trying to make my android phone silent using java. After searching google I found some examples but they didnt workd for me. Here is my code.</p> <pre><code>package com.zafar.silent; import android.app.Activity; import android.content.Context; import android.media.AudioManager; import android.os.Bundle; public class Silent extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); AudioManager audiomanage = (AudioManager)getSystemService(Context.AUDIO_SERVICE); audiomanage.setRingerMode(AudioManager.RINGER_MODE_SILENT); } } </code></pre> <p>Can someone help me how can I make this run?</p> <p>Thanks in advance</p> <p><strong>Update</strong></p> <p>Here is my menifest file</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.zafar.silent" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="10" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".Silent" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;uses-permission android:name="android.permission.WRITE_SETTINGS"/&gt; &lt;uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p><strong>I updated menifest file</strong></p>
java android
[1, 4]
2,999,524
2,999,525
jQuery: How do I remove surrounding div tags?
<p>In this line...</p> <pre><code>&lt;div class="textwidget"&gt;lorem ipsum dolor sit amet&lt;/div&gt; </code></pre> <p>I'd like to get rid of the surrounding div tags with jQuery so the output looks like this:</p> <p><code>lorem ipsum dolor sit amet</code></p> <p>Is this possible?</p>
javascript jquery
[3, 5]
3,911,188
3,911,189
event attach with on is not unbinding
<p>I am loading <code>.html</code> file using jquery <code>load()</code> function. The html file which i am loading </p> <p>contains some script, in that script there is <code>keydown event</code> binded with the document, </p> <p>like : <code>$(document).on("keydown", handler);</code>. Now in the callback of <code>load()</code> i am </p> <p>trying to unbind <code>keydown event</code>, <code>$(document).off("keydown");</code> but the event was not unbind. </p> <p>Can anybody tell me what i am doing wrong?</p>
javascript jquery
[3, 5]
77,897
77,898
Alert message with textarea content
<p>Im trying to alert whatever text is in a textarea (id="status_update") when the user hits enter:</p> <pre><code>&lt;script type='text/javascript'&gt; $(document).ready(function(){ $('textarea').keypress(function(e) { if(e.which == 13) { var entry = $('#status_update').val; alert(entry); } }); }); &lt;/script&gt; </code></pre> <p>Alert bubble pops up when the user hits enter but the text says 'undefined'. I think there is some issue with the way I am trying to define the var entry but Im not sure what the issue is. </p>
javascript jquery
[3, 5]
3,422,827
3,422,828
how to get the value to td inside list in javascript
<p>I have a listview in asp.net it appears in html like this </p> <pre><code>&lt;li id="l3" class="add" onclick="hilite()" style=""&gt; &lt;table id="tbl" style="width: 100%;"&gt; &lt;tbody&gt; &lt;tr style="width: 100%;"&gt; &lt;td class="border2" style="width: 50%;"&gt; 1011 &lt;/td&gt; &lt;td class="border2" style="width: 50%;"&gt; Name 3 &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/li&gt; </code></pre> <p>now i want to get all the table value via javascript on button click li contains table inside table tr and td presented i want td value of each list for sorting. and also i tried like this</p> <pre><code>function sortUnorderedList(ul, sortDescending) { if (typeof ul == "string") ul = document.getElementById(ul); var lis = ul.getElementsByTagName("li"); var vals = []; for (var i = 0, l = lis.length; i &lt; l; i++) vals.push(lis[i].innerHTML); vals.sort(); if (sortDescending) vals.reverse(); var contentArray = new Array(); for (var i = 0, l = lis.length; i &lt; l; i++) { lis[i].innerHTML = vals[i]; alert(lis[i].innerHTML); var x = lis[i].innerHTML.getElementById('lsttable1').rows[0].cells; alert(x[0].innerHTML); } } </code></pre> <p>in <code>alert(x[0].innerHTML);</code> i got table then how should i take the td value of each li</p>
javascript jquery asp.net
[3, 5, 9]
2,556,974
2,556,975
jquery datepicker onselect not working
<p>jquery function:</p> <pre><code>$(function() { $("#iDate").datepicker({ dateFormat: 'dd MM yy', beforeShowDay: unavailable onSelect: function (dateText, inst) { $('#frmDate').submit(); } }); }); </code></pre> <p>html:</p> <pre><code> &lt;form id="frmDate" method="post" action="&lt;?php echo $base_url;?&gt;index.php"&gt; &lt;input id="iDate" name="iDate" class='input' type="text" /&gt; </code></pre> <p></p> <p>it doesn't seem to be firing, don't understand why it is not working.</p> <p>cheers.</p>
javascript jquery
[3, 5]
3,545,389
3,545,390
Using jQuery.get() to measure client bandwidth
<p>I am using the following script do determine the downlink bandwidth of a user to serve content accordingly:</p> <pre><code> var bandwidthCheckStart = new Date().getTime(); var bandwidthCheckEnd; $.ajax({ url: xBandwidthCheckFile, async: false, cache: false, success: function(clipXmlRequest){ bandwidthCheckEnd = new Date().getTime(); }, error: function() { xSendDebugMessage("Could not get \""+xBandwidthCheckFile+"\" from server.", "warning"); } }); var bandwidthCheckDuration = bandwidthCheckEnd - bandwidthCheckStart; </code></pre> <p>However, I feel like this method is not reliable, since it doesnt consider the time needed to initiate the file transfer. (We could probably minimize the effects by using a larger file to check the bandwidth but I want it to be 10kb max.)</p> <p>Is there any way to determine the time the request starts to be answered or do you have another more reliable way in mind?</p>
javascript jquery
[3, 5]
3,256,500
3,256,501
String, Pattern match
<p>I can build the string like this:</p> <pre><code>String str = "Phone number %s just texted about property %s"; String.format(str, "(714) 321-2620", "690 Warwick Avenue (679871)"); //Output: Phone number (714) 321-2620 just texted about property 690 Warwick Avenue (679871) </code></pre> <p>What I want to achieve is reverse of this. Input will be following string</p> <p><em>Phone number (714) 321-2620 just texted about property 690 Warwick Avenue (679871)</em></p> <p>And I want to retrieve, "<em>(714) 321-2620</em>" &amp; "<em>690 Warwick Avenue (679871)</em>" from input</p> <p>Can any one please give pointer, how to achieve this in Java or Android?</p> <p>Thank you in advance.</p>
java android
[1, 4]
789,106
789,107
regular expression text merge
<p>Is this possible in reg-ex?<br><br></p> <blockquote> <p>subject='fox';<br> adjective='quick brown';<br> verb='jumps';<br> text='The &lt;&lt;adjective&gt;&gt; &lt;&lt;subject&gt;&gt; &lt;&lt;verb&gt;&gt; over the lazy dog.'<br></p> </blockquote> <p><i>reg-ex would return:</i><br></p> <blockquote> <p>'The quick brown fox jumps over the lazy dog.'</p> </blockquote>
php javascript
[2, 3]
3,121,832
3,121,833
Using Self Calling Anonymous Functions and $(document).ready
<p>I just recently learned about self calling anonymous functions. Some snippets of code that I came across used the self calling function along with the $(document).ready. It seems redundant, or pointless, to use both.</p> <p>Is there a case where you'd use</p> <pre><code>(function(){ $(document).ready(); })(); </code></pre> <p>vs.</p> <pre><code>$(document).ready(function(){ (function(){})(); }); </code></pre> <p>I figure that you'd either want the script to be executed right away or after the DOM loaded. I can't see why you'd use both together.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,185,027
3,185,028
Best way to disable all submit buttons after postback
<p>I'm trying to write code that will disable submit button (or all submit buttons) on the page to avoid double postback.</p> <p>I thought of generating my own postback javascript function (and inject postback javascript using <code>GetPostbackEventReference</code>) but maybe there are some better ways to do this? Or maybe there is some other way to avoid double postbacks?</p> <p><strong>Update</strong>:</p> <p>I also want to figure out the best place to call javascript, e.g. if I call following script in the onclick button handler then button's server click event won't be wired up.</p> <pre><code>$('input[type=submit]').attr('disabled', 'disabled') </code></pre>
javascript asp.net jquery
[3, 9, 5]
5,788,490
5,788,491
Override single attribute in machine.config
<p>I was wondering if it's possible to override just an attribute of a tag in machine.config ?</p> <p>More exactly I want to set the domain attribute of in machine.config, as it differs from my production server and my development server.</p> <p>I tried just adding the tag to machine.config, but alas it doesn't seem to have an effect.</p> <p>in machine.config I added:</p> <pre><code>&lt;authentication&gt; &lt;forms domain=".foo.com" /&gt; &lt;/authenticaion&gt; </code></pre> <p>EDIT:</p> <p>Since web.config overrides machine.config, the question is rather how I avoid losing my domain attribute on the tag, when forms is also defined in web.config ?</p>
c# asp.net
[0, 9]
3,645,113
3,645,114
How to make a manage a collection of javascript vars, add/remove etc
<p>I'm creating items which are displayed on a page, I do this with:</p> <pre><code>var popup = "something..." </code></pre> <p>How can I keep a record of all created popup vars and then manage them via:</p> <ol> <li>add a new popup var</li> <li>remove a popup var</li> </ol> <p>Any clean ways of doing this?</p>
javascript jquery
[3, 5]
1,099,748
1,099,749
What does this JS Syntax do?
<p>Why would I put brackets around the <code>true</code> here.... doesn't that make an array? Does it do something else?</p> <pre><code>$e.trigger("onlyShowIfChange", [true]); </code></pre>
javascript jquery
[3, 5]
3,014,337
3,014,338
How to get JQuery and ASP.Net work together?
<p>Is there any reason why JQuery would not work when used in an ASPX page? We have been trying to get working a simple call like this:</p> <pre><code>$(document).ready(function() { alert("This is SPARTA!!!!!!!!!"); }); </code></pre> <p>An the alert box is never shown. I've had some experience with JS and ASP.Net before with buttons and I know that I have to return false after the JS like:</p> <pre><code>&lt;input type=button value="Button 1" onclick='button_1_onclick();return false;'&gt; </code></pre> <p>Is there a similar thing to be done?</p> <p>Edited: I have ran Firebug in the debugger mode and the JS is never ran, all the libs are present in the page. The only thing I can think of is that the ready event is not triggered or something similar.</p>
asp.net javascript jquery
[9, 3, 5]
6,024,506
6,024,507
Convert TableCell text into hyperlink
<p>I am fetching data from a sql query into an asp table in cs code behind page</p> <pre><code>TableCell tCell1 = new TableCell(); tCell1.Text = myDataRow["tid"].ToString(); </code></pre> <p>I want to convert that id into a hyperlink. How can I do that?</p>
c# asp.net
[0, 9]
3,338,122
3,338,123
What's the method to access whatever child item is displayed in an Android spinner, instead of just waiting for an onItemSelected() event?
<p>As the title says, what is the method to access which item is displayed in an Android spinner, so I can have multiple spinners, then wait on a button click?</p> <p>Thanks!</p>
java android
[1, 4]
4,359,130
4,359,131
Adding and removing classes in jQuery
<p>I have a jQuery snippet written where if any of my inputs in a specific table are entered it changes the class of the rest of the inputs on that table, but if the user fills in an input field, and then deletes their input it still changes the class, though it shouldnt. here is my attempt at doing this.</p> <pre><code> $('#lostTable :input').change(function(){ var $lostTableInput = $('#lostTable :input:not(input[type=hidden])'); var hasData = false; $lostTableInput.each(function(){ if($(this).val().length &gt; 0){ hasDataLf = true; return false; } }); $lostTableInput.toggleClass('R', hasDataLf); // this above part works for changing the class, and below is my attempt at changing // it back if the user deletes the data that was entered in. $lostTableInput.each(function(){ if($(this).val().length == 0) { $lostTableInput.removeClass('R'); } } ) } ); </code></pre>
javascript jquery
[3, 5]
4,626,584
4,626,585
Deleting items more than 1 day old from sql database
<p>I am trying to remove items that are created more than 1 day old, however all my items still remain. I am certain that the changes are committed to my database since I am using the <code>RemoveItem</code> method in other locations as well. </p> <pre><code> using (var db = new CommerceEntities()) { DateTime checkexpiryDate = DateTime.UtcNow.AddDays(-1); var itemstoDelete = from c in db.ShoppingCarts where c.DateCreated &lt; checkexpiryDate select new { c.CartID, c.ProductID, c.Color, c.Size, }; foreach (var item in itemstoDelete) { try { //remove item code.... //RemoveItem(string cartID, int productID, string color, string size) } public void RemoveItem(string cartID, int productID, string color, string size) { using (var db = new CommerceEntities()) { .... .. //db.DeleteObject(myItem); .... .. //db.SaveChanges(); ... .... .. } } </code></pre>
c# asp.net
[0, 9]
1,625,278
1,625,279
Jquery hide and show
<p>I a building a simple FAQ page on my site. I'd like the question only to be visible, and once the user clicks on the question it should then show the answer. for some reason my code isn't working. Please review my code and tell me what I am doing wrong.</p> <p><strong>html</strong></p> <pre><code>&lt;div class="copy" id="about1"&gt; &lt;h1&gt;The Mission&lt;/h1&gt; &lt;p&gt; content content content content content content content content content &lt;/p&gt; &lt;h1&gt;The Game&lt;/h1&gt; &lt;p&gt; content content content content content content content content content &lt;/p&gt; &lt;/div&gt; </code></pre> <p><strong>JS</strong></p> <pre><code>$(document).ready(function() { $('.copy h1').onclick(function(){ $('.copy p').hide(); $('this').next('p').show(); }); }); </code></pre> <p><strong>CSS</strong></p> <pre><code>.copy p{ display=none; } </code></pre>
javascript jquery
[3, 5]
687,435
687,436
Event handling of select change in jQuery doesn't return the current selectedIndex
<p>I'm trying to do the following: Show a drop down with jquery, which has a structure like:</p> <ul> <li>Add element</li> <li>Element 1</li> <li>Element 2</li> </ul> <p>Now, I would like to have the following behavior: The user looks at "Add element" and clicks it. He then selects one of the elements, some function gets called and then the drop down selection goes back to the title "Add element".</p> <p>This is what I hoped would work:</p> <pre><code>$('#elementselect').change(function(e) { selectedIndex = $("#gadgetselect").attr('selectedIndex'); if (selectedIndex != 0) { var selectmenu = document.getElementById("elementselect"); chosenoption = selectmenu.options[selectedIndex]; load_element(chosenoption.value); $("#elementselect").attr('selectedIndex', 0); } }); </code></pre> <p>If Element 1 is selected, .change is called and the load_element function is called. After setting the selectedIndex back to 0, the .change function is called again, however selectedIndex is still 1 there. So the load_element function gets called twice... Any ideas?</p>
javascript jquery
[3, 5]
1,394,670
1,394,671
Count divs and add jquery to expand and collapse Text
<p>I hope someone can help. There are 3 divs with employee-block class in the html code included. I would like to add javascript/jquery code to expand/collapse anything after the 2nd div (or employee-block div). This is my html:</p> <pre><code>&lt;div class="employee-block"&gt; &lt;img alt="test" title="test" src="/images/42.png" /&gt;&lt;div class="employee-details"&gt;&lt;span class="red strong"&gt;TEST&lt;/span&gt;&lt;br /&gt;&lt;p&gt;test description&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="bottom"&gt;&lt;/div&gt; &lt;div class="employee-block"&gt; &lt;div class="employee-details"&gt;&lt;span class="red strong"&gt;[email protected]&lt;/span&gt;&lt;br /&gt;&lt;p&gt;testing description&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="bottom"&gt;&lt;/div&gt; &lt;div class="employee-block"&gt; &lt;img alt="test" title="test" src="/images/42.png" /&gt;&lt;div class="employee-details"&gt;&lt;span class="red strong"&gt;TEST&lt;/span&gt;&lt;br /&gt;&lt;p&gt;test description&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="bottom"&gt;&lt;/div&gt; </code></pre> <p>I have this jquery code, but not sure how to plug it in. In my example html code I only want to hide/show the 3rd employee-block div, so really anything more than 2 because there could be more than 2:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('div.view').hide(); $('div.slide').click(function () { $('div.view').slideToggle(400); return false; }); }); </code></pre> <p></p>
javascript jquery
[3, 5]
3,749,038
3,749,039
To lock sql when multiple users trying to update details of different users
<p>In my web application , we have list of students and we have staff login. When multiple staff logs in and try to edit two different student details , when a first user opens the page and second user opens page second both trying to update two different student details , on update , the first user data wont get update while the second user data updates.When checked with the break point, at that time on first user update , it was taking student id of details opened by second user. Tried with Lock but before it could go to the stored procedure , value is changing. Any help appreciated.</p>
c# asp.net
[0, 9]
5,826,269
5,826,270
Can the dollar sign be someone referred to c++ pointers?
<p>Today I saw a post on php.net that I'm quoting here:</p> <pre><code>$Bar = "a"; $Foo = "Bar"; $World = "Foo"; $Hello = "World"; $a = "Hello"; $a; //Returns Hello $$a; //Returns World $$$a; //Returns Foo $$$$a; //Returns Bar $$$$$a; //Returns a $$$$$$a; //Returns Hello $$$$$$$a; //Returns World </code></pre> <p>Since PHP derives from C++, doesn't this remember anything similar to pointers? Something like:</p> <pre><code>string bar = "a"; string *foo = &amp;bar; string **world = &amp;foo; string ***hello = &amp;world; string ****a = &amp;hello; </code></pre> <p>Just like pointers, when you define <code>$a = 'var'</code> and <code>$var = 'test'</code> and then you do <code>$$a</code> you are using the R-value of <code>$a</code> to point to <code>$var</code> which is kinda what happens with C++ pointers. </p> <p>So just like the <code>new X</code> and <code>X-&gt;</code> syntax that is clearly taken from the C++ dynamic memory syntax, does this somehow derives from pointers?</p>
php c++
[2, 6]
3,294,803
3,294,804
Jquery count selection-boxes that have an item selected
<p>i wonder if there is a more efficient way of counting the selections of a user:</p> <p>This is the selection dropdown that is multiple times on the page:</p> <pre><code>&lt;select class="span2 jquery-countable" name="category[7]"&gt; &lt;option&gt;&lt;/option&gt; &lt;option value="1"&gt;1. vote&lt;/option&gt; &lt;option value="2"&gt;2. vote&lt;/option&gt; &lt;option value="3"&gt;3. vote&lt;/option&gt; &lt;option value="4"&gt;4. vote&lt;/option&gt; &lt;/select&gt; </code></pre> <p>This is my js that counts the selections:</p> <pre><code>$(document).ready(function () { $('#selected-count').html('You choose ' + getCount() + ' entries'); function getCount() { prio1 = $('.jquery-countable option:selected[value="1"]').length; prio2 = $('.jquery-countable option:selected[value="2"]').length; prio3 = $('.jquery-countable option:selected[value="3"]').length; prio4 = $('.jquery-countable option:selected[value="4"]').length; return prio1 + prio2 + prio3 + prio4; } $('.jquery-countable').change(function () { $('.jquery-countable option:selected').each(function () { $('#selected-count').html('You choose ' + getCount() + ' entries'); }) }) }); </code></pre> <p>My goal is it to count all selections that where made by the user that are not empty?!</p> <p>Is there a more efficient way?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,137,929
1,137,930
jquery click handler and Oriented object programming
<p>I have a method in a class and into this method i have a handler for a click event in a div element:</p> <pre><code>function MyClass(container) { this.Container=container; this.PrepareHandlers = function() { $('#Div1').click(function() { alert(this.Container); }); }; } </code></pre> <p>But since im into the handler, "this" is the clicked element. Is possible to access to a property of an object from a handler declared inside a method?</p>
javascript jquery
[3, 5]
4,402,450
4,402,451
jQuery $.post basics
<p>I'm just learning how to use jquery, and I'm beyond confused. Here's what I'm trying to do (for practice/learning purposes):</p> <ol> <li>Take an input</li> <li>Post the input into a div tag using jquery</li> </ol> <p>Here's my code.. but it's not working</p> <pre><code>&lt;script type="text/javascript"&gt; function test(data) { $.post("&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;", function(data) { $("#lol").innerHTML = data; }); } &lt;/script&gt; &lt;form action="" onsubmit="test($(this.children()))" method="POST"&gt; &lt;input type="hidden" value="derp" /&gt; &lt;input type="text" name="herp" /&gt; &lt;a href="javascript:void(0)" onclick="test($(this).parent())"&gt; Submit &lt;/a&gt; &lt;/form&gt; &lt;div id="lol"&gt;...&lt;/div&gt; </code></pre> <p>Some help/tutorial explanation would be absolutely wonderful. Thanks!</p>
javascript jquery
[3, 5]
562,249
562,250
Splitting an string into a string
<p>I have a string with two different delimiters (| and ~). I want to first split based on one delimiter (|) then loop through the results and split those results by the second delimiter (~). From there I want to take the three values form the second split and assign them to labels on my page.</p> <p>The problem I am having is with the code below I can only get item[0], for item[1] and item[2] I get an index out of bounds error. </p> <p>I am not sure where I have gone wrong here and any assistance would be greatly appreciated!</p> <pre><code> int rowNumber = 1; foreach (string itemArray in ItemList.Text.Split('|')) { Label tbCM = (Label)FindControl("CM" + rowNumber); Label tbCode = (Label)FindControl("Code" + rowNumber); Label tbAmt = (Label)FindControl("Amt" + rowNumber); HtmlTableRow trItem = (HtmlTableRow)FindControl("trRow" + rowNumber); string[] item = itemArray.Split('~'); tbCM.Text = item[0].TrimStart(','); tbCode.Text = item[1]; tbAmt.Text = item[2]; trItem.Style.Add("display", "block"); rowNumber = rowNumber + 1; } </code></pre>
c# asp.net
[0, 9]
4,054,944
4,054,945
How to create custom view from xml-layout?
<p>I have the xml layout, and I want to create View from it - I need do it programatically. Is it possible? </p>
java android
[1, 4]
23,759
23,760
Triggering mouseenter several times on changing height for block
<p>There is problem with absolute positioned blocks - when I use $('.my-block').mouseenter() and change height in its handler - mouseenter triggers as many as it crosses other such blocks.</p> <p>for example some thing like this:</p> <pre><code>.items{position:relative;} .item{position:absolute;} </code></pre> <pre><code>&lt;div class="items"&gt; &lt;div class="item item1" style="top:0; z-index:1"&gt;&lt;/div&gt; &lt;div class="item item2" style="top:50; z-index:2"&gt;&lt;/div&gt; &lt;div class="item item3" style="top:100; z-index:3"&gt;&lt;/div&gt; &lt;div class="item item4" style="top:150; z-index:4"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <pre><code>$('item').hover(function(event){ console.log("mouseenter triggered"); $(this).stop().animate({ height:400px; // it should to grow up direction },{ step=function(now, fx){ //changing previous items position by some magic with fx.pos and some logic } }); event.stopPropagation(); },function(){/*...*/}) or $('item').mouseenter(function(){ console.log("mouseenter triggered"); event.stopPropagation(); }); </code></pre> <p>so when i make mouse enter on item3 in browser in log i see the string "mouseenter triggered" twice and if item4 thrice! What can I do here for preventing this?</p>
javascript jquery
[3, 5]
1,728,715
1,728,716
ASP.NET 3.5 C#: Best way to create and display dynamic menu with submenus
<p>I usually just create a datatable with one repeater and have all this html in my codebehind. I have not found an easy method for adding a submenu dynamically. Does anyone have a way to do this better?</p>
c# asp.net
[0, 9]
3,475,431
3,475,432
how do I? simple scramble/encrypt string in server (ASP.NET) and unscramble/decrypt in javascript
<p>Platform: Server - ASP.NET 3.5 / C#; client side - javascript/jQuery</p> <p>This is what I want to do</p> <ol> <li>Scramble a string in ASP.NET WebMethod (called through a jQuery Ajax call) before sending to the client</li> <li>Unscramble it in javascript and display</li> </ol> <p>I'm not looking at any sort of heavy duty encryption AES SHA whatever. I'm only interested in simple obfuscation - so if a user wants to persevere and decrypt the strings (which I will display anyway in a sequence, it's just that I don't want them to see all of them in the mark-up) then they can, it doesn't matter.</p> <p>Are there any simple schemes to do this?</p> <p>for clarity:</p> <p>say I want to send a pre-filled array to the client browser with ["a'"b","c"]</p> <p>when someone opens the source on the browser, he/she should see, say. ["m","n","o"]</p> <p>but when I display, I would recompute it to "a" and show it. That's all.</p>
c# javascript asp.net jquery
[0, 3, 9, 5]
5,388,480
5,388,481
calling java script function then C# function after clicking ASP.NET button
<p>I have this serious:</p> <p>I have ASP.NET page, This page contents Update panel with ASP.NET control.</p> <p>I have Java script function to do validation so when I click the button I will use onclientclick to call the java function to do the validation and after this one done should call then event click button function from code behind.</p> <p>I tried vew methods but they did not work for me.</p> <p>here is sample of my code that after I click the button onclientclick will call the java script function for validation and if the validation is OK should call onclick event.</p> <p>.................... java script function ........................</p> <pre><code> &lt;script type="text/javascript" &gt; function add(){ if (tag == trye) { document.getElementById('&lt;%=btnInfor.ClientID%&gt;').click(); alert("DataAdded") } else { alert("Requiered Field Missing.") return false; } } &lt;/script&gt; ..................... ASP.NET button ................... &lt;asp:Button ID="btnInfor" runat="server" Text="Add Information" Style="position: absolute; top: 1659px; left: 433px;" onclientclick="JavaScript: return myAdd()" /&gt; .................... code behind in C# ...................... protected void btnInfor_Click(object sender, EventArgs e) { \\mycode } </code></pre>
c# asp.net javascript
[0, 9, 3]
2,327,085
2,327,086
Determine all child elements width
<p>Is there a method i can do to determine all child elements width in a single line of code. Adding up all child widths </p>
javascript jquery
[3, 5]
4,833,111
4,833,112
How to chage the properties for controls inside a template field?
<p>I have a templatefield having a textbox and filteredtextboxextender inside the templatefield. I need to change the ValidChars property for filteredtextboxextender from "123" to "abc" in c# codebehind. The templatefield is there inside the GridView. I used the following code in aspx page.</p> <pre><code>&lt;asp:GridView ID="grdEducation" runat="server" AllowSorting="True" AutoGenerateColumns="False" AllowPaging="false" CellPadding="4" GridLines="Vertical" OnRowDeleting="grdEducation_RowDeleting" OnRowDataBound="grdEducation_RowDataBound" OnRowUpdating="grdEducation_RowUpdating" ShowFooter="false" ShowHeader="true"&gt; &lt;HeaderStyle CssClass="grid-header-style" /&gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderStyle-CssClass="grid-label-small" &gt;` &lt;ItemTemplate&gt; &lt;table&gt; &lt;tr&gt; &lt;td width='90%'&gt; &lt;table&gt; &lt;td width='60%'&gt; &lt;asp:TextBox ID="textbox1" Width="100px" runat="server" ToolTip="Provide text" MaxLength="11"&gt;&lt;/asp:TextBox&gt; &lt;ajaxtoolkit:FilteredTextBoxExtender ID="filter" runat="server" TargetControlID="textbox1" ValidChars="123" /&gt; &lt;/td&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; </code></pre> <p>Is there any possibility is there for change filteredtextboxextender property like that like that? </p> <p>Thank you..</p>
c# asp.net
[0, 9]
2,188,374
2,188,375
How do I refresh dynamic content loaded into a web part inside my existing jvacscript/jquery code?
<p>I have the code that I've pasted below, helpfully supplied by another stackoverflow member. I've added this code into a Kentico web part, and set the cache minutes=0, thinking that would solve my caching issue. It does, but not in IE. Is there any way I can tweak this code to refresh the content when the user comes to the page, or when we have to update the html file?</p> <pre><code> &lt;SCRIPT type=text/javascript&gt; // article footer Date.prototype.getWeek = function() { var onejan = new Date(this.getFullYear(),0,1); var today = new Date(this.getFullYear(),this.getMonth(),this.getDate()); var dayOfYear = ((today - onejan +1)/86400000); return Math.ceil(dayOfYear/7) }; jQuery(function(){ //Quotes/Testimonials var today = new Date(); var weekno = today.getWeek(); jQuery('#quotes-wrapper').load('/quotesroller.html div.quote-'+weekno); }); &lt;/SCRIPT&gt; </code></pre>
javascript jquery
[3, 5]
436,883
436,884
problem with checked all checkbox?
<p>When someone clicks on first <code>input:checkbox</code>, I want my code to check all checkboxes, but my code doesn't work correctly: <p></p> <p><strong>EXAMPLE:</strong> <a href="http://jsfiddle.net/cQYVE/" rel="nofollow">http://jsfiddle.net/cQYVE/</a></p> <pre><code>$('.table_show tr input:first').live('click',function(){ var isChecked = $(this).prop('checked'); $(".table_show tr input[name=checked[]]").each(function(){ if (!$(this).prop('checked') == isChecked) { $(this).parent().click(); } }); }); </code></pre> <p>What is the cause of the problem?</p>
javascript jquery
[3, 5]
418,183
418,184
Accessing $_SESSION from android
<p>I built a website with PHP, and now and am working on an application to go with it, (however I am not new to php nor Android, just to them together) and I am able to login, and get Status Code: 200 response (successful login), however in the headers list when I print out</p> <pre><code>Header[] heads = response.getAllHeaders(); </code></pre> <p>Does not show the fact that (in php) I called</p> <p><code>header("Location: success.php")</code> or <code>"Location: failure.php"</code> for failure, so I'm not sure why it is returning the 200 at all, it just is.</p> <p>but what I really need to know how to access my <code>$_SESSION</code> variables I set in the php code so I can go about my navigation signed in just like I would on my website. If you need more information, just ask.</p>
php android
[2, 4]
3,442,695
3,442,696
How to append a value from php inside my JS file?
<p>Basically I want to read and write to a file then save all the compiled content another file.</p> <p>Steps:</p> <ol> <li><p>Say I have a file <em>mycode.js</em> with this code:</p> <pre><code> var url = ''; //this will be field throug form in php </code></pre></li> <li><p>Now in php, I will input a value of that url e.g <code>www.google.com</code></p></li> <li><p>How will I be able to append the url I just entered to my js file?<br> Expected output:</p> <pre><code>var url = 'www.google.com'; </code></pre></li> <li><p>Also follow question, upon successful append of the value to my JS file I will now create a new file (<em>newlyappend.js</em>), like a save as thing. Where the content of the file is the newly append code:</p> <pre><code>var url = 'www.google.com'; </code></pre></li> </ol> <p>Would like to achieve this using php.</p>
php javascript
[2, 3]
5,888,545
5,888,546
Is it worth coding for users who may not have JavaScript enabled?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3485890/how-safe-is-it-to-assume-that-most-users-will-have-js-enabled">How safe is it to assume that most users will have JS enabled?</a><br> <a href="http://stackoverflow.com/questions/155615/is-it-reasonable-to-assume-my-visitors-have-javascript-enabled">Is it reasonable to assume my visitors have javascript enabled?</a> </p> </blockquote> <p>I'm worrying about this and don't know if I should be.</p>
javascript jquery
[3, 5]
3,949,332
3,949,333
Change table border color using JQuery
<p>I have a user control that conatins HTML, like this:</p> <pre><code>&lt;table id="tblProgramInfo" runat="server" cellpadding="0" cellspacing="0" class="ProgramInfo"&gt; &lt;tr&gt; &lt;td&gt; &lt;table cellpadding="0" cellspacing="0" width="100%" class="tblProgram" abc="def"&gt; &lt;tr&gt; &lt;td&gt; Some data &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p></p> <p>Since its a user control, their could be multiple table with same class "ProgramInfo" and "tblProgram". Now I have attached mouseover and mouseout event for "ProgramInfo" class using Jquery. What I want is, <strong>to change the border color of inside table containing class "tblProgram" on mousemove and mouseout</strong>. <br/> My mousemove and mouseevent are:</p> <pre><code>$(document).ready(function() { $(".ProgramInfo").mouseover(function() { // Code here? }); $(".ProgramInfo").mouseout(function() { // Code here? }); }); </code></pre> <p>Also, <strong>I want to change the width and height of upper table through JQuery</strong>. When I tried this, I get width:auto.</p>
asp.net jquery
[9, 5]
5,275,141
5,275,142
jquery combining each and setInterval on elements with shared class
<p>I have a series of links with a class "bloglink".</p> <p>They have a click event associated with them - but that is irrelevant at this point. I am trying to cycle through them and trigger the click event every X seconds. This is where I'm at:</p> <pre><code>$('a.bloglink').each(function(){ var $bl = $(this); setInterval(function(){ $bl.trigger('click') },2000); }) </code></pre> <p>But it just triggers the click event for all of them at once.</p> <p>Any tips?</p>
javascript jquery
[3, 5]
597,760
597,761
Can I catch uninstall action in my Android app
<pre><code>public class Unistallreceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String action = intent.getAction(); if (action == null) Log.e("uninstall ", "Action==null!"); else if ("android.intent.action.BOOT_COMPLETED".equals(action)) { Log.e("uninstall ", "action :"+action); } } </code></pre> <p>} </p> <p>Doing something like this, but can't get notification.Reference said :</p> <blockquote> <p>public static final String ACTION_PACKAGE_REMOVED</p> </blockquote> <p>Since: API Level 1 Broadcast Action: An existing application package has been removed from the device. The data contains the name of the package. <strong>The package that is being installed does not receive this Intent</strong></p> <p>A need this intent to set uninstall password.</p> <p>Any suggestions??</p>
java android
[1, 4]
525,345
525,346
JQuery Allow Multiple Field Check Function
<p>I have a simple option for users to check the "title" or "username" for availability. The function runs the ttck.php and displays the appropriate alert. Problem is the function() will not reset to allow multiple checks without reloading the entire page.</p> <pre><code>function checkTitle() { $.post('ttck.php', $(".pubttl").serialize(), function(data) { $('.tresult').html(data).delay(5000).fadeOut('slow'); }); } &lt;span class="udo" onclick="checkTitle()"&gt; check title availability&lt;/span&gt; </code></pre> <p>What am I not seeing here to reload/reset this event so users can check as many times as necessary?</p> <p>EDIT: This is the PHP</p> <pre><code>if(empty($TITLE)) { echo 'Please enter a Title';} else { $que=mysql_query("SELECT * FROM `pubs` WHERE TITLE='$TITLE'"); $result=mysql_num_rows($que); if($result&gt;0) { echo 'Sorry, Title is already published. Try an alternate'; } else { echo 'Huzzah, your Title is Available!'; }} </code></pre> <p>There are a few extended parameters in this statement, but none that would effect the function.</p>
php jquery
[2, 5]
2,499,885
2,499,886
User Error Alert
<p>I am using VS2010 (with C#). I have an online application. I have 2 error forms setup that the user is redirected to if they encounter an error. I have a global.asax.cs file that i have code setup in the <code>Application_Error</code> event to send me an email to let me know a user has received an error. My issue is that I am receving an email every time the form loads. It should be only when an error occurs. Here is my code behind in the <code>global.asax.cs</code> file:</p> <pre><code>protected void Application_Error(object sender, EventArgs e) { if (HttpContext.Current.Server.GetLastError() != null) { Exception myException = HttpContext.Current.Server.GetLastError().GetBaseException(); // Create the Outlook application by using inline initialization. Outlook.Application oApp = new Outlook.Application(); Outlook.MailItem email = (Outlook.MailItem)(oApp.CreateItem(Outlook.OlItemType.olMailItem)); email.Recipients.Add([email protected]); email.Subject ="Error in COF page " + Request.Url.ToString(); string message = string.Empty; message +="&lt;b&gt;Message&lt;/b&gt;&lt;br /&gt;" + myException.Message + "&lt;br /&gt;"; message +="&lt;b&gt;StackTrace&lt;/b&gt;&lt;br /&gt;" + myException.StackTrace + "&lt;br /&gt;"; message +="&lt;b&gt;Query String&lt;/b&gt;&lt;br /&gt;" + Request.QueryString.ToString() + "&lt;br /&gt;"; email.Body = message; email.Send(); //Clear out any lingering errors after they have been reported. Server.ClearError(); } } </code></pre>
c# asp.net
[0, 9]
1,180,987
1,180,988
cant return value out of closure
<p>I cant seem to get this value to pass the isValid value back out of the ajax call in the snippet below:</p> <pre><code> function isShortUrlAvailable(sender, args) { var isValid = false; $.ajax({ type: "POST", url: "/App_Services/ShortUrlService.asmx/IsUrlAvailable", data: "{url: '" + args.Value + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { isValid = response.d; }, error: function (msg) { isValid = false; } }); args.IsValid = isValid; } </code></pre> <p>I'm sure its just something simple to do with closures that i'm overlooking. Can anyone help please?</p> <p>Its for an asp.net custom validator. </p> <p>This is what's happening:</p> <ol> <li>isValid is set to false in the first line</li> <li>.ajax() request fires correctly and if its valid returns true</li> <li>isValid is set to true (response.d) correctly</li> <li>when it comes back out to the last line it thinks isValid is false again</li> </ol>
javascript jquery
[3, 5]
1,549,407
1,549,408
"Refreshing" JQuery datepicker widget
<p>I want to refresh a datepicker widget. If a user presses for instance "button 1", the datepicker should have a certain set of properties, whereas if he presses "button 2" the datepicker should have a different set of properties. </p> <p>How can i achieve this?</p> <p>Some proof of concept code an be found here: <a href="http://jsfiddle.net/5zyLg/1/" rel="nofollow">http://jsfiddle.net/5zyLg/1/</a></p> <pre><code>$("#booking_calendar").datepicker({ autoSize: false, dateFormat: 'dd/mm/yy', firstDay: 1, altField: "#date", altFormat: "yy-mm-dd", minDate: 0, maxDate: "2W" ); // VIRTUAL CLICK EVENT GOES HERE $("#booking_calendar").datepicker({ autoSize: false, dateFormat: 'dd/mm/yy', firstDay: 1, altField: "#date", altFormat: "yy-mm-dd", minDate: 0, maxDate: "3W" ); $("#booking_calendar").datepicker("refresh"); </code></pre> <p>^this is the general idea, although it does not work</p>
javascript jquery
[3, 5]
81,231
81,232
Integer used as View Tag not working
<p>I had not used the tag element of views until just recently, and have since found a handful of cool uses. I have ran into an unusual problem that I hope someone can answer. This may be more general Java specific than Android, but I'm not sure. It has to do with how Java handles the Integer Class.</p> <p>See these method bits. As it is, this works correctly. You can assume here POSITIVE and NEGATIVE are constants.</p> <pre><code>public void onClick(View v) { switch(v.getId()){ case R.id.dialog_addrecord_button_sign: Sign mSign = (Sign) v.getTag(); if(mSign.sign == NEGATIVE){ ((Button) v).setText("+"); mSign.sign = POSITIVE; } else { ((Button) v).setText("-"); mSign.sign = NEGATIVE; } break; } }; private void initButtons(){ signButton = (Button) findViewById(R.id.dialog_addrecord_button_sign); signButton.setOnClickListener(this); signButton.setTag(new Sign()); } private class Sign { int sign; private Sign(){ sign = NEGATIVE; } } </code></pre> <p>I realized, though, that I could just use the Integer class instead, rather than mull about with a custom class that only has a single field. I changed to this, however the button toggles only once, telling me that there is something I'm unaware of about how Java deals with the Integer class... can someone tell me why this does not work?</p> <pre><code>public void onClick(View v) { switch(v.getId()){ case R.id.dialog_addrecord_button_sign: Integer sign = (Integer) v.getTag(); if(sign == NEGATIVE){ ((Button) v).setText("+"); sign = POSITIVE; } else { ((Button) v).setText("-"); sign = NEGATIVE; } break; } }; private void initButtons(){ signButton = (Button) findViewById(R.id.dialog_addrecord_button_sign); signButton.setOnClickListener(this); signButton.setTag(new Integer(NEGATIVE)); } </code></pre>
java android
[1, 4]
1,492,438
1,492,439
call 2 bound field on gridview in same column
<p>i am trying to call 2 Data field in same column, it that possible to do so? my date is replace my user name</p> <pre><code>BoundField userNameBF = new BoundField(); userNameBF.HeaderText = "User Name"; userNameBF.DataField = "userName"; userNameBF.DataField = "PostDate"; userNameBF.ItemStyle.Width = 180; GridView2.Columns.Add(userNameBF); </code></pre> <p><strong>Output</strong></p> <pre><code>+---------------+ | user Name | +---------------+ | | | 22/02/2012 | +---------------+ | | | 22/02/2012 | +---------------+ </code></pre> <p><strong>Expected Output</strong></p> <pre><code>+---------------+ | user Name | +---------------+ | Ken | | 22/02/2012 | +---------------+ | Ryu | | 22/02/2012 | +---------------+ </code></pre>
c# asp.net
[0, 9]
2,185,750
2,185,751
How to handle / remove broken image icon of imagebutton in asp.net
<p>I am trying to add alternate image if the image is broken, also can we remove the broken image icon. Here is my code for ref.</p> <pre><code>&lt;asp:ImageButton AlternateText = " " onerror = "imgError(this)" ID = "ImageButton111" runat="server" Width = "140" Height = "140" CommandName = "image1" CssClass = "imagetest" CommandArgument = "image" CausesValidation = "false" ImageUrl='&lt;%# "loadImage.ashx?RollNo=" + Eval("RollNO")%&gt;' /&gt; function imgError(image) { image.onerror = ""; image.src = "~/images/no-hit.gif"; return true; } </code></pre> <p>Thanks in advance for all suggestion and help.</p>
c# asp.net
[0, 9]
1,457,512
1,457,513
how to get the rating value on click on stars
<p>i am using jquery rating plugin. in all examples they have a submit button near to rating stars. so that submit button do this.form.serialize. but i want to save the rating to db without clicking on the submit button. i am not giving submit button to users. if anybody has done this already can you help me please. these are the jquery examples.</p> <p><a href="http://www.fyneworks.com/jquery/star-rating/#tab-Testing" rel="nofollow">http://www.fyneworks.com/jquery/star-rating/#tab-Testing</a></p>
javascript jquery
[3, 5]
4,604,272
4,604,273
Toggle TWO Drop Down Panels
<p>I am using two panels at the top of my web page that drop down: "Fast Quote" and "Client Login". Can someone show me how to alter my code so that ONLY ONE panel is open at one time? Example: If "Client Login" is open and the user clicks on "Fast Quote", the "Client Login" should close and the "Fast Quote" drops down.</p> <p>Here is my website: <a href="http://www.ubspack.com" rel="nofollow">http://www.ubspack.com</a></p> <p>CODE:</p> <pre><code>$(document).ready(function(){ $(".btn-slide").click(function(){ $("#panel_quote").slideToggle("slow"); $(this).toggleClass("closeQ"); return false; }); }); $(document).ready(function(){ $(".btn-slide2").click(function(){ $("#panel_login").slideToggle("slow"); $(this).toggleClass("closeL"); return false; }); }); </code></pre>
javascript jquery
[3, 5]
265,138
265,139
list picker asp.net
<p>I have list picker asp.net one is assigned techs and unassigned techs my problem I need to remove the duplicate's name form unassigned I need a way to delete mike from list box b</p> <pre><code>list box A Mike list box B Mike Adam TOm </code></pre>
c# asp.net
[0, 9]
873,080
873,081
Calling a function before Page_Load
<p>I have a button that calls function A()</p> <p>When I click on it I want the calls to be made in that order:</p> <pre><code>A() Page_Load() </code></pre> <p>Right now it's doing:</p> <pre><code>Page_Load() A() </code></pre> <p>Is there a way around that or is it just by design and there's nothing I can do about it?</p>
c# asp.net
[0, 9]
5,274,547
5,274,548
"Length cannot be less than zero." on a blank line
<p>I keep getting the above error message, even if I comment out the line that the error is occurring on. Any idea what could be causing this? I've tried re-writing the lines with test values, but I still get the same error.</p> <p>This works perfectly in debug mode, it's only in the deployment that this came up.</p> <p>Original code:</p> <pre><code>Line 21: string domain, username; Line 22: string text = Page.User.Identity.Name; Line 23: Line 24: domain = text.Substring(0, text.IndexOf("\\")); Line 25: username = text.Substring(text.IndexOf("\\") + 1, text.Length - text.IndexOf("\\") - 1); Source File: F:\&lt;file path&gt;\Default.aspx.cs Line: 23 </code></pre> <p>Test code (same error):</p> <pre><code>Line 21: string domain, username; Line 22: //string text = "TEST"; // Page.User.Identity.Name; Line 23: // this line is blank Line 24: domain = "TEST"; //text.Substring(0, text.IndexOf("\\")); Line 25: username = "TEST"; // text.Substring(text.IndexOf("\\") + 1, Source File: F:\&lt;file path&gt;\Default.aspx.cs Line: 23 </code></pre> <p>Here's the stack trace if it helps at all:</p> <pre><code>[ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length] System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +12681546 Insufficiencies._Default.Page_Load(Object sender, EventArgs e) in F:\&lt;file path&gt;\Default.aspx.cs:23 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3048 </code></pre>
c# asp.net
[0, 9]
3,585,843
3,585,844
Path problem with javascript/php
<p>I've been developing my site with the site directory structure as</p> <pre><code>www img javascript include index.php </code></pre> <p>Now I want to change it to</p> <pre><code>www index.php dir1 dir2 ... themes theme1 img javascript include index.php </code></pre> <p>At the theme level index.php, earlier I've my paths to javscript files as <code>javascript/file1.js</code> or so.</p> <p>Now I've changed the paths to <code>&lt;?php echo THEME_PATH . "javascript/file1.js"?&gt;</code></p> <p>This includes the js files, however my problem is when I reached inside the js file.</p> <p>For example, in one script.js file, I've a jquery method called as</p> <p><code>$('#pop-con').html('&lt;p&gt;&lt;img src="img/ajax-loader.gif" width="220" height="19" /&gt;&lt;/p&gt;');</code></p> <p>I can't use php inside the js file. So how do I change the paths similar to the php implementation above??</p>
php javascript
[2, 3]
6,020,977
6,020,978
how to create forms dynamically in javascript
<p>I have this div, where <code>divBrdr</code> should contain a form <code>summaryConfig</code></p> <pre><code> &lt;div id="popup"&gt; &lt;div id="popupClose"&gt; &lt;input type="image" alt="close window" src="images/close_btn.gif" width="20" height="20" onclick="" align="right"&gt; &lt;/div&gt; &lt;div id="divBrdr" &gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="backgroundPopup"&gt; &lt;/div&gt; </code></pre> <p>Right now i have this form inside <code>divBrdr</code> but then this <code>popup</code> appears differently for <code>create</code> and <code>update</code> so I wanted to make this form made dynamically. Can somebody help me do that? </p> <pre><code>&lt;form style="padding-bottom:11px;" name="summaryConfig" method="post" action=""&gt; &lt;img alt="title" src="images/update_conform_title.gif" width="189" hspace="4" height="17" vspace="4"&gt;&lt;br&gt; &amp;nbsp;&lt;br&gt; &lt;table align="center" width="90%" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td width="800"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id="postUploadInfo"&gt; &lt;/div&gt; &lt;table align="center" border="0" cellpadding="10" cellspacing="0" width="84%"&gt; &lt;tr&gt; &lt;td colspan="3" align="center"&gt; &lt;label&gt; &lt;input type="button" tabindex="4" id="btnOk" value="Done" class="btn" onClick=""&gt; &lt;/label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre>
javascript jquery
[3, 5]
4,785,328
4,785,329
add pages to masterpage gives me javascript error
<p>i have a page which uses some javascript code to run,it was working fine until i added it to master page, on adding it to master page it gives me an error from javascript</p> <pre><code>var fu1 = document.getElementById("FileUpload1"); var ex1 = extension(fu1.value) ; object expected in fu1.value </code></pre> <p>i need to know where to add the javascript in master page</p>
asp.net javascript
[9, 3]
5,728,233
5,728,234
NullPointerException using append method on a view in android?
<p>I am trying to populate data from database into a TextView using this code:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView view = (TextView) findViewById(R.id.textView); db = (new DatabaseHelper(this)).getWritableDatabase(); cursor = getCursor(); cursor.moveToFirst(); while (cursor.isAfterLast() == false) { String text = cursor.getString(2); view.append(text); cursor.moveToNext(); } </code></pre> <p>However I am getting a NullPointerException on this line:</p> <pre><code> view.append(text); </code></pre> <p>and I am not sure about the reason as the view exists.</p>
java android
[1, 4]
5,094,499
5,094,500
Python to C# Code Explanation
<p>My ultimate aim is to convert the below code in python to C#, but I'd like to do it my self by learning the python syntax. I understand that the code is recursive.</p> <p>The code produces polynomials of degree n with k variables. More specifically the list of exponents for each variable.</p> <pre><code>def multichoose(n,k): if k &lt; 0 or n &lt; 0: return "Error" if not k: return [[0]*n] if not n: return [] if n == 1: return [[k]] return [[0]+val for val in multichoose(n-1,k)] + \ [[val[0]+1]+val[1:] for val in multichoose(n,k-1)] </code></pre> <p>Here is the conversion I have so far:</p> <pre><code>public double[] MultiChoose(int n, int k) { if (k &lt; 0 || n &lt; 0) { throw new Exception(); } if (k == 0) { return [[0]*n]; // I have no idea what the [[0]*n] syntax means } if (n == 0) { return new double[0]; // I think this is just an empty array } if (n == 1) { return new double[1] {k}; // I think this is just an empty array } //Part I don't understand return [[0]+val for val in MultiChoose(n-1,k)] + \ [[val[0]+1]+val[1:] for val in MultiChoose(n,k-1)] } </code></pre> <p>My question is: How do I convert the python code?</p>
c# python
[0, 7]
1,979,212
1,979,213
drag & drop w/ reordering - reordering 2 side-by-side elements at once
<p>I have had no luck figuring out how to do this. I was originally using jQuery UI sortable, but I am not sure it will work with this workflow:</p> <p>I have a table with multiple columns. I want to be able to drag an element in column A AND the element next to it in column B at once and drop them into a different position. After the drop, the element from column A &amp; B will still be side-by-side but not at their original Y coordinate. The key is dragging them at once &amp; allowing other elements that cross their paths to "move out of the way". </p> <p>I was able to achieve this with 1 element using jquery UI sortable, but am not sure how to make this work with two side-by-side elements. Any suggestions any help is more than welcome. Thanks in advance.</p>
javascript jquery
[3, 5]
166,981
166,982
Is there a better way to organise javascript in a single file with specific code for multiple pages?
<p>I have a couple of websites where I use a relatively small amount of jQuery to do various things on the pages. Generally we're talking about a couple of dozen lines of code per page. </p> <p>I keep all of my JS in one file so far as it's not huge and fairly clearly defined. That said, what I have trended towards is organizing it like so:</p> <pre><code>$(document).ready(function(){ var onPage1 = $("#id_thing_on_1").length === 1; if( onPage1 ){ var usefulPage1Function = function(){}; //blah $("a").click(function(){}); //etc } }); $(document).ready(function(){ var onPage2 = $("#id_of_page_2").length === 1; if( onPage2 ){ $(".someClass").fadeIn().click(function(){}); //etc } }); </code></pre> <p>Anything that <em>is</em> used on multiple pages gets taken out into a library, but for page specific stuff, this is the pattern I've been following. Is there a better approach, or is this an acceptable practice for keeping your JS in one file and loading it on multiple pages?</p>
javascript jquery
[3, 5]
2,821,609
2,821,610
Remove all the activites before restarting app.
<p>Does someknow how I get set flags at the main (startup) activity? I want that all activties will be removed of the stack. </p> <p>This is my code know, but it doenst work:</p> <pre><code>/** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Intent mainIntent = new Intent(this, Main.class); mainIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mainIntent); setContentView(R.layout.splashscreen); LoadData(); </code></pre> <p>}</p> <p>I have also tried to use <code>android:clearTaskOnLaunch</code> but that seems not to work...</p>
java android
[1, 4]
277,496
277,497
jquery wont send with post method
<p>nothing is being sent with $.post</p> <pre><code> function clicked() { var $contact_title=$("#contact_title"); var $contact_summary=$("#bbcode"); alert($contact_title.val());// How do I get the contents of the title alert($contact_summary.val());// How do I get the contents of the textarea $.post('jquery_send_admin.php',{ title:$contact_title, content:$contact_summary }, function(data){ alert("Message was sent") }, 'html'); } </code></pre> <p>I get exceptions in my console error..like the following:</p> <p>UPDATE: no data is inserted on the next page..why?!?</p> <pre><code> if( isset($_POST["title"]) &amp;&amp; isset($_POST["content"]) ) { $title=mysql_escape_string($_POST["title"]); $content=mysql_escape_string($_POST["content"]); $result=mysql_query("INSERT INTO users (query_title,query_message) VALUES(''$title', '$content')") or die(mysql_error()); } </code></pre> <p>The following error happens:</p> <pre><code>Error: uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js :: &lt;TOP_LEVEL&gt; :: line 16" data: no] </code></pre> <p>UPDATE: Thats what I request from the page, which is triggered by jquery:</p> <pre><code> &lt;?php echo 'outside'; if( isset($_POST["title"]) &amp;&amp; isset($_POST["content"]) ) { echo 'inside'; $title=mysql_escape_string($_POST["title"]); $content=mysql_escape_string($_POST["content"]); $result=mysql_query("INSERT INTO users (query_title,query_message) VALUES(''$title', '$content')") or die(mysql_error()); } ?&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,969,784
3,969,785
What is the equivalent of Java's SimpleDateFormat class in C#?
<p>Anyone knows an equivalent class of Java's SimpleDateFormat in C#? I wonder if i can convert the following java code using Custom Date and Time Format Strings in C#</p> <pre><code> SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); TimeZone tz = TimeZone.getDefault(); format.setTimeZone(TimeZone.getTimeZone("GMT")); str = format.format(new Date()); </code></pre>
c# java
[0, 1]
4,231,852
4,231,853
Image Enlarger Script
<p>I am looking for one of those scripts that when you click a Thumbnail, it makes the picture englarge. I tried searching Google using a lot of terms, but cant find any.</p> <p>Where do I get these?</p>
javascript jquery
[3, 5]
797,791
797,792
Access to external literal class inside a function
<p>What I have is something like that:</p> <pre><code>jQuery(function($) { 'use strict'; var App = { init: function() { App.startTool(); } [...] </code></pre> <p>and when I try to call <code>App.init();</code> from another file it say that <code>App is not defined</code>.</p> <p>I'm trying to create some test with jasmine and I've the same error.</p> <p>How can I go inside this "literal class", nested inside a simple function, from external files?</p>
javascript jquery
[3, 5]
3,369,124
3,369,125
I want to do a simple drag-drop using jQuery
<p>I have 4 Buttons in browser,I want to drag those Buttons and select those Buttons in mouse right click. is it possible. its like windows. i want to drag and select those Buttons in jquery in localhost.</p>
javascript jquery
[3, 5]
3,910,785
3,910,786
fade a gallery of 9 thumbnails in randomly 1 at a time using jquery
<p>I have 9 thumbnail images (3 x 3), on page load I want to fade these images in randomly so maybe maybe image #4 fades in then 8 then 3...</p> <p>At the moment Im trying to work out how this can be done, does a random number have to be generated for each image and then loop through each element adding the number to the .data attribute?</p> <p>So far Ive managed to create a variable that generates a random number but not sure how I integrate the loop, <a href="http://jsfiddle.net/kyllle/MGW8k/" rel="nofollow">http://jsfiddle.net/kyllle/MGW8k/</a></p> <p>Kyle</p>
javascript jquery
[3, 5]
2,454,658
2,454,659
Jquery IE 8 Unexpected call to method or property access
<p>I am helping design a school website. Most of the school computers use IE 8. When publishing the site, I get the following error</p> <p>Line: 2 Error: Unexpected call to method or property access.</p> <p>After using the debugging tool, the bad line seems to be:</p> <pre><code>(this.nodeType===1||this.nodeType===11)&amp;&amp;this.insertBefore(a,this.firstChild) </code></pre> <p>I am trying to get the navigation bar looking...well... like a traditional navigation bar .Any help would be great</p> <p>the website is <a href="http://bakersfield.kernhigh.org/" rel="nofollow">http://bakersfield.kernhigh.org/</a> </p> <p>you will notice that the navigation bar is one giant block instead of a traditional bar</p>
javascript jquery
[3, 5]
2,817,963
2,817,964
How to integrate the google + with ios and android native apps?
<p>Please give some suggestion ? Is it possible to do this?</p>
android iphone
[4, 8]
1,565,055
1,565,056
Calendar's getTime() method gives back wrong hours
<p>Well i would like to simply get the current date in my app.</p> <p>I use this snippet:</p> <pre><code>Calendar cal = Calendar.getInstance(); cal.getTime().toGMTString(); </code></pre> <p>for some reason it gives me like: "22 Feb 2013 18:00:48 GMT"</p> <p>Well it is <strong>19:00 right now in Hungary</strong>, <strong>not 18:00</strong>, There is <strong>1 hour difference.</strong></p> <p>What the heck ? :) How can i implement a reliable way to always get the current date?</p>
java android
[1, 4]
4,921,507
4,921,508
get root node value null
<p>I have a problem with a <code>TreeView</code>. My <code>TreeView</code> structure is something like this:</p> <pre><code> Root !-&gt;child !-&gt;subchild </code></pre> <p>Now my requirement is that when I click on subchild node I get the information I want but when I click on root node the page and the children should refresh.</p> <p>I hope you understand my question. If anybody knows how to do this please help me. Thanks.</p>
c# asp.net
[0, 9]
1,732,453
1,732,454
Good resource for creating a portal in aspx from design perspective
<p>I want to learn how to create a portal using asp and C#. I have learned language features of C# and asp. I want to learn how one should design a portal (like banking).</p> <p>Regards,</p> <p>Sachin</p>
c# asp.net
[0, 9]
1,904,706
1,904,707
click once for each letter
<p>In my game you have to click the letters to spell the words. When a letter is clicked it animates to an area in the grid where the words are.</p> <p>When I click a letter and it animates to the cell, I can click more than one. How would I limit it is only one letter per cell.</p> <p>I was thinking maybe disabling the click function for as long as the animation takes but I don't know how I would implement this.</p> <p>Can someone point me in the right direction?</p> <p>Here is the click event...</p> <pre><code>$('.drag').on('click', function(e) { e.preventDefault(); var target = $('.drop-box.spellword:not(.occupied):first'); var targetPos = target.position(); var currentPos = $(this).offset(); var b = $(this); if (target.length) { $(".minibutton").prop("disabled", true); b.clone().addClass( b.data("letter") == target.data("letter") ? "wordglow3" : "wordglow").appendTo("table").css({ background: "transparent", position: "absolute", top: currentPos.top, left: currentPos.left }).animate({ top: targetPos.top, left: targetPos.left }, "slow", function() { $(this).css({ top: 0, left: 0 }).appendTo(target); target.addClass("occupied"); }); </code></pre>
javascript jquery
[3, 5]
2,745,268
2,745,269
How to capture paste event from right-click context menu?
<p>I have a textbox in ASP.NET web form, and I need to catch the paste event from right-click context menu. But I can't see where I can catch the associated event. </p> <p>The onchange event is no use, as this is only triggered when the input field loses focus. Neither does OnKeyDown event since it is not a mouse event.</p> <p>Any solution?</p>
asp.net javascript
[9, 3]
1,381,423
1,381,424
how to set refresh Interval In Application
<p>hi I am new in android. I have created one application and I use preferences for setting. I have used list preferences set to 1,10 ,60 minute. Now i want to apply a function so that another activity should be refreshed in each time interval. </p> <pre><code>beerPref2 .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { // TODO Auto-generated method stub final ListPreference listrefresh = (ListPreference) preference; final int idx = listrefresh .findIndexOfValue((String) newValue); if (idx == 0) { } else if (idx == 1) { // System.out.println("2"); } else if (idx == 2) { System.out.println("3"); } else { System.out.println("4"); } return true; } </code></pre> <p>This is code for preferences screen. Now i have another class named DetailPage. This class we have to reload. Can You please complete this code. I have tried much but not able to do. I am new in android and want to implement this. Please help me and complete this code. How i will load another class in certain time interval? I mean to say that if we select 1 minute then the activity should reload each 1 minute. If we select 10 minutes then application should reload each 10 minute and ... Help me to implement this</p>
java android
[1, 4]
2,120,792
2,120,793
Javascript/Jquery beginner question
<p>I am learning some jQuery basics with this great book: <a href="http://jqfundamentals.com/book/" rel="nofollow">http://jqfundamentals.com/book/</a></p> <p>There is an example that doesn't return the right result.</p> <p>Here is the code:</p> <pre><code> var myName = 'the global object', sayHello = function () { console.log('Hi! My name is ' + this.myName); }, myObject = { myName : 'Rebecca' }; var myObjectHello = sayHello.bind(myObject); sayHello(); // logs 'Hi! My name is the global object' myObjectHello(); // logs 'Hi! My name is Rebecca' </code></pre> <p>The log returns <code>undefined</code> instead of <code>the global object</code> for <code>sayHello();</code> and I'd like to know why...</p>
javascript jquery
[3, 5]