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,313,152
2,313,153
Application with payment functionality
<p>Could you please refer me to an example of an Asp.Net application that would allow the owner to collect a fee for viewing certain pages content? I have no idea what to start with. Besides the technical aspect of this question, I don't know where one would get a server to install such an application. Can any computer work as such? Thanks, and sorry if my question is too naive.</p>
c# asp.net
[0, 9]
5,385,366
5,385,367
JQuery SetTimeout before running code
<p>I'm trying to run a function in JQuery that basically shuts down or starts up a server. The code I have so far is this -</p> <pre><code>$(".stopServer").click(function(){ $.post("controller.php",{stop: 'true', server: this.name}); $('#test'+this.name).load('controller.php?status=true&amp;server='+this.name); }); </code></pre> <p>The problem is obviously it stops the server fine but it updates the status div ('#test'+this.name) straight away. This is no good because the server takes a period of time to shut down. I've been trying to get SetTimeout to work but can't figure it out... Any help would be appreciated.</p> <p>Thanks guys, you're the best :)</p> <p>UPDATE:</p> <p>Full functions are here:</p> <pre><code>$(document).ready(function() { $(".startServer").click(function(){ $.post("controller.php",{server: this.name}); setTimeout("showStatus('"+this.name+"')", 3000); }); $(".stopServer").click(function(){ $.post("controller.php",{stop: 'true', server: this.name}); setTimeout("showStatus('"+this.name+"')", 3000); }); function showStatus(name) { alert(name); $('#test'+name).load('controller.php?status=true&amp;server='+name); } }); </code></pre> <p>UPDATE</p> <p>Given up on the idea of it, instead the status is polled for every second instead.</p> <pre><code>var refreshId = setInterval(function() { $('.status').each(function() { var $name = $(this).attr('name'); $(this).load("controller.php?status=true&amp;server=" + $name); }); }, 1000); </code></pre>
php jquery
[2, 5]
3,713,158
3,713,159
jquery not working in IE6
<p>I have developed a dropdown category and sub category menu in jquery. The script is working n Firefox, chrome but not in IE6. could you please guide me to fix this problem</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('#loader').hide(); $('#show_heading').hide(); $('#search_category_id').change(function() { $('#show_sub_categories').fadeOut(); $('#loader').show(); $.post("get_chid_categories.php", { parent_id: $('#search_category_id').val(), }, function(response) { setTimeout("finishAjax('show_sub_categories', '"+escape(response)+"')", 400); } ); return false; }); }); function finishAjax(id, response){ $('#loader').hide(); $('#show_heading').show(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } function alert_id() { if($('#sub_category_id').val() == '') alert('Please select a sub category.'); else alert($('#sub_category_id').val()); return false; } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
683,706
683,707
Android app loading white screen on device
<p>I've debugged my app on my PC and it works fine. When I go into my phone and tablet instead of it loading the <code>WebView</code> like it should it simply loads a white screen, I guess failing to load the web site. I'm not sure where to begin debugging since my debug mode and virtual device works fine. Any suggestions?</p>
java android
[1, 4]
2,219,914
2,219,915
Hide/show DIVs - change current effect to fade
<p>I'm currently using the code below found on web tutorial to show/hide DIVs. It works great but don't like the effect. Would like the DIVs to fade in / fade out instead (or something smoother, for the moment the DIVs are growing from the top-right corner). How could I adapt the code to do this? Youc ans ee it here <a href="http://jsfiddle.net/Grek/w4HWn/1/" rel="nofollow">http://jsfiddle.net/Grek/w4HWn/1/</a> Many thanks</p> <pre><code>function showonlyone(thechosenone) { $('.textzone').each(function(index) { if ($(this).attr("id") == thechosenone) { $(this).show(2000); } else { $(this).hide(2000); } }); } </code></pre>
javascript jquery
[3, 5]
1,288,162
1,288,163
Printing out a javascript variable (not showing up?)
<p>I want to make sure a javascript variable is getting the correct values passed into it when setting it to a ruby variable.</p> <pre><code>&lt;script type="text/javascript" charset="utf-8"&gt; var test = &lt;%= @test || 'null' %&gt;; document.write(test); &lt;/script&gt; </code></pre> <p>However, there doesn't seem to be any output whatsoever. I've tried just <code>document.write("somethinganything")</code> and I still don't see any output. Is it supposed to appear on webpage or terminal? I couldn't find any in both. </p>
javascript jquery
[3, 5]
3,673,949
3,673,950
passing rowindex to javascript
<p>I am trying to pass row index from inside my gridview to javascript function and I am getting an error that databind does not contain a property name container.</p> <pre><code>&lt;label style="text-decoration: underline" onclick="javascript:GetSelectedRow('&lt;%# Eval("ID") %&gt;','&lt;%# Eval("root__level") %&gt;','&lt;%# Eval("ParentMclid") %&gt;','&lt;%# Eval("systempath") %&gt;','&lt;%# Eval("Container.DataItemIndex + 1") %&gt;);"&gt;&lt;%#Eval("ID") %&gt;&lt;/label&gt; </code></pre> <p>I just want to pass the rowindex of the gridview to the javascript function. .</p>
javascript asp.net
[3, 9]
957,562
957,563
Bind "Ctrl+Alt+L" to insert some predefined string into focused textarea?
<p>Is is possible to bind Ctrl+Alt+L to insert predefined string into <strong>focused</strong> textarea to cursor position? For example, I'm typing some text in textarea, then I'm pressing Ctrl+Alt+L and <code>&lt;a href="" title=""&gt;&lt;/a&gt;</code> is inserted into current cursor position.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
1,439,600
1,439,601
php java bridge error in Java.inc: Cannot redeclare java_last_exception_get()
<p>5.2, Tomcat 5.5, jdk 1.5. php was working fine, I installed JavaBridge.war. And now, when I use "require_once(JavaBridge/java/Java.inc)" I am getting error like </p> <p>Fatal error: Cannot redeclare java_last_exception_get() in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\JavaBridge\java\Java.inc on line 1584.</p> <p>Can anyone tell me how to resolve this? my php project folder is in "webapps/phptest/", Javabridge is on "Webapps/JavaBridge"</p>
java php
[1, 2]
1,301,981
1,301,982
String was not recognized as a valid DateTime
<p>Im stuck here why i run my project in local properly but when i upload to server got this error.</p> <p>i passing like this.</p> <pre><code>///////////////////in js/////////////////// '&amp;dFrom='+Ext.getCmp('txtDateFrom').getValue().dateFormat('m/d/Y') 'dTo=' + Ext.getCmp('txtDateTo').getValue().dateFormat('m/d/Y') ///////////////////in c///////////////////// DateTime dFrom; DateTime dTo; dFrom = Convert.ToDateTime(Request.Params["dFrom"]); dTo = Convert.ToDateTime(Request.Params["dTo"]); </code></pre>
c# javascript
[0, 3]
3,171,132
3,171,133
Append a jQuery element to a string that contains html
<p>I have a jQuery wrapped element which I would like to append to a html row. I can't wrap my head around this, since append() seemingly accepts strings but not existing jQuery elements (I might be mistaken here). I have a following setup:</p> <pre><code>var row='&lt;tr&gt;&lt;td&gt;data1&lt;/td&gt;&lt;td&gt;data2&lt;/td&gt;&lt;td&gt;'; var img=$('&lt;img src="path/to/img.png"'); img.click(myClickHandler); </code></pre> <p>Now what I'm trying to do is to append this img element to my row and 'close' the row with a closing tag. I'm doing it as follows:</p> <pre><code>var jRow=$(row); jRow.append(img); jRow.append('&lt;/td&gt;&lt;/tr&gt;'); </code></pre> <p>After my row is ready I append it to my table:</p> <pre><code>$('#tableId').append(jRow); </code></pre> <p>Well, all above doesn't work, because I get [Object Object] instead of image tag in my added row.</p> <p>My goal is to have a row with an image in last cell and a working click handler.</p> <p>Pleease, help.</p>
javascript jquery
[3, 5]
437,072
437,073
How to change size of title's text on Action Bar?
<p>There is Action Bar on each Android 4.0 application, and it has got a title. I need to make this size less. But I don't understand how I can do it, because Action Bar doesn't provide public methods for it. Thank you in advance. Remark: I don't want to use custom views. </p>
java android
[1, 4]
1,767,987
1,767,988
C++ or Python for C# programmer?
<p>I am a corporate C# programmer. I found some time to invest into myself and stumbed upon a dilemma. Where to go from now? C#/.NET is easy to learn, develop for, etc. In future I would want to apply to Microsoft or Google, and want to invest spare time wisely, so what I will learn will flourish in future.</p> <p>So: Python or C++ for a C# programmer? I am a little scared of C++ because developing anything in it takes ages. Python is easy, but I take it as a child-play language, which still need lots of patching to be some mature development tool/language.</p> <p>Any C# developers having same dilemma?</p>
c# c++ python
[0, 6, 7]
4,619,418
4,619,419
Changing css dynamically
<p>I have css like so:</p> <pre><code>.myTabs .JustForFun .ajax__tab_inner:hover { width: 109px; background: url ("/images/csc_tr.png") no-repeat 100% 0%; margin-right: 2px; background-color: #BBC614; } </code></pre> <p>Using javascript, jquery or asp.net code behind c# I would like to manipulate <code>background-color</code> attribute.</p> <p>How can I do this, what are the pros and cons of the solution you've recommended me is what I would like to know.</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
5,653,431
5,653,432
Ajax based File Uploads
<p>I'm looking for a javascript/ajax based file upload. The way it would work is this:</p> <p>1) User clicks browse</p> <p>2) User selects CTRL and selects the files he wants to upload</p> <p>3) Via Javascript the user is shown a few loading graphics (1 per each file being uploaded)</p> <p>4) After each upload finishes, a loading graphic is replaced with a success graphic and the filename of the uploaded file.</p> <p>So what I'm really asking for is:</p> <p>1) A way to do javascript/ajax based file uploads.</p> <p>2) A way to detect when a file starts/finishes uploading, or to call a function when it happens.</p>
javascript jquery
[3, 5]
3,845,610
3,845,611
Get check box value in jQuery?
<p>I need to get a check box value in jQuery. Here is my code:</p> <pre><code>$(document).ready(function() { $('input[type="checkbox"]').bind('click',function() { var tObj = $('#checkpermission'); var tVal = tObj.val(); alert(tVal); }); }); $query="select * from tbl_user where username!='admin' and password!='admin' order by username limit $eu, $limit"; $result=mysql_query($query); while($data=mysql_fetch_array($result)) { &lt;td&gt;&lt;INPUT TYPE="checkbox" name="checkuser" id="checkpermission" onclick="changePage()" value='&lt;?=$data[0]?&gt;'&gt;&lt;/td&gt; &lt;?php } </code></pre> <p>Every time I only get the first value. What am doing wrong?</p>
php javascript jquery
[2, 3, 5]
2,102,819
2,102,820
Retrieve year out of text best solution?
<p>I want to retrieve de year out of this date (european format date) i know this as a solution but is there a better way to write this code(less code,less declarations etc..)?</p> <p>You don't need to use those variables. Only variable needed is date = "22/3/2011"</p> <p>Code in javascript:</p> <pre><code>var myDate = "22/3/2011", pos = myDate.lastIndexOf("/"), myYear="1970"; myYear = myDate.substr(pos+1); </code></pre> <p>I used jsperf to see which solution was the fastest <a href="http://jsperf.com/retrivetextoutofdate/2" rel="nofollow">http://jsperf.com/retrivetextoutofdate/2</a></p>
javascript jquery
[3, 5]
2,123,864
2,123,865
'condition is expected' in query
<pre><code>SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\Projects\\csharp\\Login1\\App_Data\\Login.mdf;Integrated Security=True;User Instance=True"); SqlCommand cmd; SqlDataReader dr; protected void LinkButton1_Click(object sender, EventArgs e) { conn.Open(); cmd=new SqlCommand("Select * from LoginTable where User Name='"+TextBox1.Text+"'",conn); dr=cmd.ExecuteReader(); // &lt;---error here if(dr.Read()) { Label1.Text="User name already exist"; this.Label1.ForeColor=Color.Red; } else { Label1.Text="Name available"; } } </code></pre> <p>It shows the following error near <code>dr=cmd.ExecuteReader();</code>:</p> <blockquote> <p>An expression of non-boolean type specified in a context where a condition is expected, near 'Name'.</p> </blockquote> <p>Whats happening here</p>
c# asp.net
[0, 9]
1,265,476
1,265,477
Change TextBox TextMode with jQuery
<p>I was wondering if someone knew the best way to switch from using the </p> <pre><code> myTextBox.TextMode = TextBoxMode.Password; </code></pre> <p>to</p> <pre><code> myTextBox.TextMode = TextBoxMode.SingleLine; </code></pre> <p>using client code and jQuery. I will have to do it on focus, along with deleting the whole text content of the textbox onFocus event.</p>
jquery asp.net
[5, 9]
67,135
67,136
How can I access to an HTML control runat server from javascript
<p>I have the following code:</p> <pre><code>&lt;telerik:GridTemplateColumn DataField="JOB_CODE" &lt;EditItemTemplate&gt; &lt;input type="text" ID="JOB_CODETextBox" runat="server" value='&lt;%# Eval("JOB_CODE") %&gt;' readonly="readonly" onclick="$('#basic-modal-content').modal({ appendTo:'form', persist: true, onClose: function (dialog) { /* I want to assign here a value to the textbox control like this: JOB_CODETextBox = 'something...' I tried this: $find('&lt;%= JOB_CODETextBox.ClientID %&gt;').value = 'something..' but it didn't work!! the find function returns [null] */ $.modal.close(); } } );" /&gt; </code></pre> <p>Any help!!</p>
javascript asp.net jquery
[3, 9, 5]
4,362,087
4,362,088
Change textbox text (parent page) by another textbox (child page) upon text changing
<p>i have two .aspx pages named default1.aspx and default2.aspx. default1.aspx has one textbox named as textbox1 and default2.aspx has one textbox named as textbox2. default1.aspx opens the default2.aspx by using window.showmodaldialog(). Issue is that While i am changing the text of textbox2, the textbox1 text also gets changed.</p> <p>can any one tell me how to do this?</p> <p>Thank you in advacne</p>
javascript asp.net
[3, 9]
5,868,910
5,868,911
How to get clientID if textbox name is in string variable
<p>I have written below code to check for blank value in my textbox but its generating compilation Error, please provide me solution.</p> <p>my code in javascript:</p> <pre><code> function checkTextboxNotFilled(txtbox) { var txtb = document.getElementById("&lt;%= " + txtbox + ".ClientID %&gt;"); if (GetFormattedString(txtb.value) == "") { return true ; } else { return false ; } } </code></pre> <p>error:</p> <pre><code>'string' does not contain a definition for 'ClientID' and no extension method 'ClientID' accepting a first argument of type 'string' could be found (are you missing a using directive or an assembly reference?) </code></pre> <p>I am calling it like this : checkTextboxNotFilled("MytextboxName")</p>
asp.net javascript
[9, 3]
2,391,371
2,391,372
Download text as a file from a webpage
<p>I'm downloading text from a website and I want to have the user be able to save it as a file. So, I have the following code that does just that.</p> <pre><code>protected void DownloadFile(string fileName, string content) { Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName); Response.ContentType = "text/plain"; Response.Write(content); Response.End(); } </code></pre> <p>The problem I am having is that I get an exception after this code runs. I believe it's due to the fact that I call Response.End(). So, every time a user downloads a file it redirects them to the generic error page because all generic exceptions redirect to that page.</p> <p>Any ideas on how I can write text out to a file and not get this error? If I remove Response.End() I get my text and then the rest of the HttpResponse text, but I don't get the error. </p> <p>Thanks.</p>
c# asp.net
[0, 9]
4,440,565
4,440,566
Android Text validation
<p>Hi I am creating a task reminder app. It works but I would like to create some sort of Toast validation. For example a user doesn't fill in the title and I'd like an toast saying "title needs to be filled in!" e.t.c But I'm not sure how to do this.</p> <p>I am using an EditText widget by the way.</p> <p>This is one method:</p> <pre><code> protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mDbHelper = new RemindersDbAdapter(this); setContentView(R.layout.reminder_edit); mCalendar = Calendar.getInstance(); mTitleText = (EditText) findViewById(R.id.title); mBodyText = (EditText) findViewById(R.id.body); mDateButton = (Button) findViewById(R.id.reminder_date); mTimeButton = (Button) findViewById(R.id.reminder_time); mConfirmButton = (Button) findViewById(R.id.confirm); mRowId = savedInstanceState != null ? savedInstanceState.getLong(RemindersDbAdapter.KEY_ROWID) : null; registerButtonListenersAndSetDefaultText(); } </code></pre> <p>and another: </p> <pre><code>private void saveState() { String title = mTitleText.getText().toString(); String body = mBodyText.getText().toString(); SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT); String reminderDateTime = dateTimeFormat.format(mCalendar.getTime()); if (mRowId == null) { long id = mDbHelper.createReminder(title, body, reminderDateTime); if (id &gt; 0) { mRowId = id; } } else { mDbHelper.updateReminder(mRowId, title, body, reminderDateTime); } new ReminderManager(this).setReminder(mRowId, mCalendar); } </code></pre> <p>Thanks.</p>
java android
[1, 4]
989,158
989,159
JQuery hover menu that works like a regular menu if the brower has javascript disable
<p>Is there a way to make this code not have the hover point links' pictures not come up if the browser has Javascript disable? And then have the links work like a regular hover point when Javascript is disable?</p> <pre><code>&lt;script type="text/javascript" src="/Scripts/jquery-1.2.2.pack.js"&gt; &lt;script type="text/javascript"&gt; $(function () { // set opacity to nill on page load $("ul#bnavmenu span").css("opacity", "0"); // on mouse over $("ul#bnavmenu span").hover(function () { // animate opacity to full $(this).stop().animate({ opacity: 1 }, 'slow'); }, // on mouse out function () { // animate opacity to nill $(this).stop().animate({ opacity: 0 }, 'slow'); }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,004,117
5,004,118
Custom JavaScript functions from Java: doesn't work with explicit context?
<h3>PreWork</h3> <p>I am able to invoke or evaluate javascript expressions from java as follows:</p> <pre><code>jsEngine.eval("ComputerName == 'mymachine'", myScriptContext); </code></pre> <p>The attribute value ComputerName is read from myScriptContext object.</p> <h3>Scenario</h3> <p>Now the problem is that I want to have some custom functions which can be part of the evaluated expression like:</p> <pre><code>jsEngine.eval("startswith(ComputerName, 'my')", myScriptContext); </code></pre> <p>Since startswith is not an available function (I must support startswith with that signature), I tried to write a .js file, where I defined my custom functions &amp; also appended my expression to be evaluated to that script and executed as follows:</p> <pre><code>jsEngine.eval("_js_having_myfunction_and_expression_"); // note - no myScriptContext </code></pre> <h3>Problem</h3> <p><code>startswith</code> gets recognized by JS engine ONLY IF I DO NOT present myScriptContext. The moment I present myScriptContet, I get this exception:</p> <p>Exception in thread "main":</p> <blockquote> <p>javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: startswith is not a function</p> </blockquote>
java javascript
[1, 3]
2,279,029
2,279,030
In javascript Jquery, how do I determine the position from the top to the current state...everytime someone scrolls?
<p>How do you bind it so that when a user scrolls, I can know the "offset" from the top, in pixels?</p>
javascript jquery
[3, 5]
4,005,483
4,005,484
JQuery parameter serialization without the bracket mess
<p>I'm using JQuery to make a JSON request back to the server and it seems that it's parameter serialization is hard-coded to what PHP expects instead of being generic in nature. Basically I have an object that looks like this:</p> <pre><code>{ foo: 1, bar : [1, 3, 5] } </code></pre> <p>And it serializes it to:</p> <pre><code>foo=1&amp;bar[]=1&amp;bar[]=3&amp;bar[]=5 </code></pre> <p>Is there anyway to make it just do?</p> <pre><code>foo=1&amp;bar=1&amp;bar=3&amp;bar=5 </code></pre> <p>It seems to me that jQuery shouldn't be so tied to what a handful of server side frameworks expect as a naming convention. If I wanted my param to be called <code>bar[]</code> I could easily name it that myself if it's what my server-side code expects.</p>
javascript jquery
[3, 5]
4,415,427
4,415,428
I have this countdown timer that I want running even after my activity closes
<p>Here is my code,</p> <pre><code> new CountDownTimer(30000, 1000) { public void onTick(long millisUntilFinished) { forgotpass.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { forgotpass.setText("done!"); } }.start(); </code></pre> <p>I want it to continue to run even after my activity or application closes.</p> <p>So far when i press the back button or the home button on the application it is running on it stops automatically and when i reopen the activity it starts back on 30. Is there any possible way I can have it continue to countdown even when the application or the activity is not running?</p>
java android
[1, 4]
5,679,118
5,679,119
How to pass value of C# variable to javascript?
<p>In button click event I am writing this code.(code behind).I know button click event</p> <pre><code>protected void button_click() { string s1 = "Computer"; StringBuilder sb = new StringBuilder(); sb.Append(@"&lt;script language='javascript'&gt;"); sb.Append("document.write('&lt;table&gt;&lt;tbody&gt;')";); sb.Append("document.write('&lt;tr&gt;&lt;td&gt;Information&lt;/td&gt;&lt;/tr&gt;')";); if(s1 == "Computer" ) { sb.Append("&lt;tr&gt;&lt;td&gt;s1&lt;/td&gt;&lt;/tr&gt;"); } sb.Append("document.write('&lt;/tbody&gt;&lt;/table&gt;')";); sb.Append(@"&lt;/script&gt;"); } </code></pre> <p>It is working but I want value of s1 not s1.I know javascript is a client side programing.I wrote this function in button click event.How can pass value of s1 that is computer to table's cell</p>
c# javascript asp.net
[0, 3, 9]
4,508,886
4,508,887
JQuery - Unfamiliar notation
<p>I am modifying a javascript file in which they have used the following code. Does anyone know what this does / where it is documented / etc. It appears it is creating an anchor node and giving it the inner html of "Back", but I'm not sure how it works or what it's capabilities are, as I need to add various attributes to the link:</p> <pre><code>$("&lt;a id=&gt;").html("Back"); </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
1,879,128
1,879,129
Calculation issue With JQuery
<p>I know it is very simple.But Still it is not working.I am multiplying a input number with a fixed number,but is not showing the expected result.it always shows the Error message "Please enter some value" even i enter some integer e.g. 6. This is Html Code.</p> <pre><code> &lt;input type="text" class="cc" id="getdata" /&gt; &lt;div id="result"&gt; &lt;input type="text" id="show" /&gt;&lt;/div&gt; &lt;input type="button" value="calculate" id="calculate" /&gt; </code></pre> <p>This is JQuery Code.</p> <pre><code> $(document).ready(function () { $("#calculate").click(function () { if ($("#input").val() != '' &amp;&amp; $("#input").val() != undefined) { $("#result").html("total value is::" + parseInt($("#input").val()) * 5); } else { $("#result").html("Please enter some value"); } }); }); </code></pre> <p>Any help will be highly appreciated.</p> <p>Can anyone tell me please how to concatenate all clicked values of different buttons in a textbox?I want to show previous and current clicked value of button in a textbox. Thank you.</p>
javascript jquery
[3, 5]
1,991,687
1,991,688
clone values of select fields into span or any other html elements
<p><img src="http://i.stack.imgur.com/aH5Pp.png" alt="enter image description here"></p> <p>this is the fields I have in the app, I need to clone this values into some span elements or any other html elements, so it will be a clone of the date that I select from selectors:</p> <pre><code>&lt;select id="massmedium_register_date_1i" name="massmedium[register_date(1i)]"&gt;&lt;/select&gt; &lt;select id="massmedium_register_date_2i" name="massmedium[register_date(2i)]"&gt;&lt;/select&gt; &lt;select id="massmedium_register_date_3i" name="massmedium[register_date(3i)]"&gt;&lt;/select&gt; </code></pre> <p>ex:</p> <p>I select: <code>15 - 06 - 1982</code> </p> <p>clone to: </p> <pre><code>&lt;span class="date"&gt;15&lt;/span&gt;&lt;span class="date"&gt;06&lt;/span&gt;&lt;span class="date"&gt;1982&lt;/span&gt; </code></pre> <p>any help is welcome. Thank you.</p>
javascript jquery
[3, 5]
1,915,177
1,915,178
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]
3,109,892
3,109,893
Need help with jQuery conditional that removes container element based on matched text
<p>here is my markup:</p> <pre><code> &lt;div&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;ul class="eventslist"&gt; &lt;li&gt;This event would be discarded&lt;/li&gt; &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;ul class="eventslist"&gt; &lt;li&gt;Earnings - This event would be included&lt;/li&gt; &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I need help writing a conditional that would go through each UL class="eventslist" on the page, and check that the first LI under UL class="eventslist" contains the word "Earnings" (it can be anywhere in the text, and capitilization should be ignored). If it doesn't, the entire DIV wrapped around the UL should be removed along with everything inside it. </p> <p>Any help is greatly appreciated!</p>
javascript jquery
[3, 5]
2,992,336
2,992,337
$(document.width).bind(onchange,...)?
<p>Will this work? </p> <p>The reason I ask is because I want to animate two elements that calculate their end location based on the width of the document. If the window or document size is changed I want to reset the animation. </p> <p>Any suggestions or other methods that might work?</p>
javascript jquery
[3, 5]
1,336,988
1,336,989
Jquery submit and post to post a form unable to return data
<p>i have problem with jquery submit and post. I would like to submit a form and post it to my php for a check, and return the php result back to the form. However, I have problem with the returning of data, it basically ignores the result.</p> <p>This is my html form:</p> <pre><code>&lt;form id="form" method="post"&gt; &lt;p id="status"&gt;Status:&lt;/p&gt; &lt;p class="text"&gt; &lt;label for="name" class="label"&gt;Name:&lt;/label&gt; &lt;input type="text" id="name" name="name" value="" size="30" /&gt; &lt;/p&gt; &lt;p class="text"&gt; &lt;label for="email" class="label"&gt;Email:&lt;/label&gt; &lt;input type="text" id="email" name="email" value="" size="30" /&gt; &lt;/p&gt; &lt;p class="submit"&gt; &lt;input type="submit" name="send_btn" id="send_btn" value="Send" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>This is my javascript to do the submit and post:</p> <pre><code>$('#form').submit(function(e) { e.preventDefault(); var name = $('#name').val(); var email = $('#email').val(); $.post('notify.php', {name: name, email: email}, function(data) { $('#status').html(data); }); }); </code></pre> <p>This is the php that does the check and return the data:</p> <pre><code>&lt;?php if (isset($_POST['name'], $_POST['email'])) { $name = htmlentities($_POST['name']); $email = htmlentities($_POST['email']); if ($name == "myname") { $output = 'It matches!'; } else { $output = 'No matches!"; } } ?&gt; </code></pre> <p>Can please highlight what has gone wrong? Thank you.</p>
php javascript jquery
[2, 3, 5]
4,085,710
4,085,711
Common property with all jQuery objects
<p>I want create a property inside my object with all jQuery objects wich it will use. I novice at JavaScript and that's why I want an advice. Can I do this in such manner?</p> <pre><code>var myVar = { init: function() { //... this.obj = { id1: $('#id1'), id2: $('#id2'), id3: $('#id3') } this.method2(); }, method1: function() { alert(this.obj.id1.html()) // some work with id1 }, method2: function() { alert(this.obj.id1.html()) // some work with id1 } }; $(function() { myVar.init(); myVar.method1(); }); </code></pre>
javascript jquery
[3, 5]
1,780,365
1,780,366
How to use Server.MapPath in jQuery JavaScript when deploying on Hosting Server
<p>I am using <code>WebMethod</code> on my ASPXpage and I call it from jQuery on the same page like this:</p> <pre><code> $.ajax({ type: "POST", url: "Mypage.aspx/GetSomeData", contentType: "application/json; charset=utf-8", data: parameters, dataType: "json", success: AjaxSucceeded, error: AjaxFailed }); </code></pre> <p>This works fine in my debug environment, but when I deploy on the hosting site it does not. The problem seems to be in the URL because on the server the path would be different. So I used <code>Server.MapPath</code> in various ways but none of them worked.</p> <p>E.g </p> <pre><code>url: '&lt;%= Server.MapPath("MyPage.aspx/GetSomeData")%&gt;', </code></pre> <p>When I use the above code snippet it does not work on my machine. <code>MyPage</code> is in the root directory.</p>
c# jquery asp.net
[0, 5, 9]
2,883,306
2,883,307
How do I bind a dynamically created asp textbox to a dataset?
<p>I have a textbox generated by parsing an xml file.</p> <pre><code> TextBox tb = new TextBox; tb.ID = "MYDATA" Parent.Controls.Add(tb); </code></pre> <p>I then read another Xml file for the data to populate the created TextBox. I have been trying all sorts of databinging and setting the text property to a dataset, but cannot figure it out. If I set the text property at creation to say:</p> <pre><code>MyDataSet.Tables[0].rows[0].["MYDATA"].ToString(); </code></pre> <p>I get an error because the dataset hasn't been created and wont be until the form has been created. Am I going about this wrong? Can't I someway specify that the data to fill the textbox is coming from the dataset without already creating it?</p>
c# asp.net
[0, 9]
4,709,133
4,709,134
How to parse URL safe query parameters into readable strings
<p>I found one library, <a href="http://github.com/allmarkedup/jQuery-URL-Parser" rel="nofollow">jQuery URL Parser</a>, which seems to be full-featured as far as parsing out the various segments of a URL. I'm trying to go one step further though, and parse the <em>values</em> of the query parameters.</p> <p>For example, given the URL <code>"http://www.google.com/search?sourceid=chrome&amp;ie=UTF-8&amp;q=rm+-rf+%2F"</code> I'd like to get <code>"rm -rf /"</code> for the <code>q</code> parameter. Any suggestions would be greatly appreciated.</p> <p>As a side note, I'm not operating on the URL of the current page so any <code>location</code> magic doesn't apply.</p>
javascript jquery
[3, 5]
4,601,992
4,601,993
Dynamic code to addClass to an element specified in the link
<p>I'm trying to add a class to an element specified within my HTML from clicking on a button.</p> <p>HTML:</p> <pre><code>&lt;div id="servicenext"&gt;&lt;a href="#nav2"&gt;&lt;p class="four"&gt;next&lt;/p&gt;&lt;/a&gt; </code></pre> <p>Script:</p> <pre><code>$('#servicenext a').click(function(){ $('ul.navigation a').removeClass('active'); $(*the div in the href*).addClass('active'); }); </code></pre> <p>I'm hoping to have code that's dynamic. Basically it'll work by adding the class to any element specified in the <code>a</code> href. This is because i have quite a handful of these and do not wish to code them individually.</p> <p>EDIT:</p> <p>Thanks James! that's great! But I do have to apologize, i was confused myself at what I was asking for! What I'm actually looking to <code>addClass</code> to was actually the <code>li</code> in <code>ul.navigation a</code></p> <p>So if I'm thinking right, im trying to do this:</p> <ul> <li>by clicking onto the servicenext button, </li> <li>the code gets the <code>id</code> of the <code>div</code> in the <code>href</code></li> <li>the <code>addClass</code> is applied to the <code>li</code> with the same <code>href</code></li> </ul> <p>I'm guessing there should be if else statements somewhere, forgive me, i'm not really a programmer.</p> <p>the gibberish i came up with is:</p> <pre><code>$('#servicenext a').click(function(){ $('ul.navigation a').removeClass('active'); $($(this).attr("href").find($('ul.navigation li a').attr("href"))).addClass('active'); }); }); </code></pre>
javascript jquery
[3, 5]
210,418
210,419
Posting/submitting multiple forms in jQuery
<p>I have two forms on a page (one is being grabbed by AJAX). I need them both to be posted, so I serialize the second one and send it in a post using jQuery before submitting the first one. However, only the first form appears to be getting posted. The odd thing is though, if I put an alert after the serialized post it works as expected. What exactly is my problem here? </p> <pre><code>$("#submit").livequery('click', function() { var form = $("#second_form"); var action = form.attr("action"); var serialized_form = form.serialize(); $.post(action, serialized_form); //alert('test'); $("#first_form").submit(); return false; }); </code></pre> <p>Is there any better way to post two forms and then redirect to a new page on a button press? I tried posting both of them using the method above and then using window.location to change pages but I had a similar problem.</p> <p>Much thanks!</p>
javascript jquery
[3, 5]
5,504,368
5,504,369
Web.Config <appSettings file=""> question
<p>I have defined in my web.config the following:</p> <pre><code>&lt;appSettings file="settings.config" &gt; &lt;/appSettings&gt; </code></pre> <p>It works just fine, but my question is, how to i modify it at runtime?</p> <p>If i use:</p> <pre><code>WebConfigurationManager.OpenWebConfiguration("~/"); </code></pre> <p>This actually modifies my web.config.</p> <p>I have a few entries in my custom configuration file i would like to edit.</p> <p>Any thoughts or pointers would be greatly appreciated :)</p>
c# asp.net
[0, 9]
4,815,278
4,815,279
Are there any general listeners defined in Android or Java
<p>Sometimes I want a simple generic Listener without defining my own class. Is there a predefined "something happened and here is a string or object or whatever" in Java or Android?</p>
java android
[1, 4]
2,488,022
2,488,023
Checkbox in listview
<p>I would like to set a checkbox in a listview's click-event. How can I set the right checkbox?</p> <p>This is my code:</p> <pre><code> listView.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView&lt;?&gt; adapter, View view, int position, long id) { Checkbox checkbox = ?? checkbox.setChecked(true); return true; } }); </code></pre>
java android
[1, 4]
853,870
853,871
Android - JAVA Denial of Service: Parse Double
<p>There is a vulnerability in implementations of <code>java.lang.Double.parseDouble()</code> and related methods that can cause the thread to hang when parsing any number in the range </p> <pre><code>[2^(-1022) - 2^(-1075) : 2^(-1022) - 2^(-1076)] </code></pre> <p>This is not an issue when using java version 6 Update 24 or later. </p> <p>So in order to develop a secure android application, is it enough to make sure that APK is built on using a JDK whose version is 1.6u24 and above? OR, this issue is also related to the Android Dalvik VM? </p> <p>Please help in clarifying as I might have misconceptions. </p>
java android
[1, 4]
5,929,840
5,929,841
jQuery getter/setter conditional?
<p>I have a script that needs to set one of two json data call URLs depending on which element was clicked to invoke the query. </p> <p>How can I code the url: property so that its determined by which element was clicked?</p> <p>Off the top of my head, I was thinking to create a hidden input field and set a flag that I can read/write to depending on the link that's clicked. Then i can wrap the url: parameter in an if/then</p> <p>However, then I remembered that jQuery has an each() method that I might be able to use.</p> <p>Any suggestions?</p> <p>Code:</p> <pre><code>&lt;div id='items'&gt; Label: &lt;a href='#' id='item1'&gt;Item 1&lt;/a&gt; &lt;a href='#' id='item2'&gt;Item 2&lt;/a&gt; &lt;/div&gt; jQuery("#items").find("a").each.click(function(){ jQuery.ajax({contentType: "application/json; charset=utf-8",dataType: "json", if(jQuery(this).id = '#item1') { url: "first url" } else { url: "second url" } }); </code></pre>
php jquery
[2, 5]
3,755,750
3,755,751
how to get the querystring from a parent page?
<p>i am using an iframe ipage in my parentpage. I would like to get the querystring in javascript of the parentpage?</p>
javascript asp.net
[3, 9]
342,454
342,455
update dropdown menu values depending on user selection
<p>I have the following html:</p> <pre><code>&lt;label&gt;Sizes &lt;select name="item_options[product_size]"&gt; &lt;option value="s"&gt;small &lt;span class="avail-inventory"&gt;10&lt;/span&gt;&lt;/option&gt; &lt;option value="m"&gt;medium &lt;span class="avail-inventory"&gt;1&lt;/span&gt;&lt;/option&gt; &lt;option value="l"&gt;large &lt;span class="avail-inventory"&gt;5&lt;/span&gt;&lt;/option&gt; &lt;option value="xl"&gt;extra large &lt;span class="avail-inventory"&gt;10&lt;/span&gt;&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; &lt;label&gt;Quantity &lt;select name="quantity"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;option value="3"&gt;3&lt;/option&gt; &lt;option value="4"&gt;4&lt;/option&gt; &lt;option value="5"&gt;5&lt;/option&gt; &lt;option value="6"&gt;6&lt;/option&gt; &lt;option value="7"&gt;7&lt;/option&gt; &lt;option value="8"&gt;8&lt;/option&gt; &lt;option value="9"&gt;9&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; </code></pre> <p>This is part of a shopping cart where the user can pick product option(size) and quantity. Since the quantity always varies, I would like the max quantity change on the fly depending on what product option the user chooses. </p> <p>For instance if the user chooses size large the max number in quantity dropdown should also be only 5.</p> <p>thanks a lot</p>
javascript jquery
[3, 5]
5,847,823
5,847,824
Create links in single image
<p>I want to create some links in single image.I know we can do it with area map.i have used <a href="http://davidlynch.org/js/maphilight/docs/demo_usa.html#" rel="nofollow">this</a> link for help</p> <p>Please have a look at link.</p> <p>But now my requirement is to show the selected state as active.Along with this we also want to select multiple state at a time which should we active.</p> <p><strong>select state with control key combination is below</strong></p> <pre><code>click = function(e) { e.preventDefault(); // Get clicked area element. var i = e.srcElement || e.target; /** * Turn on/off alwaysOn option (boolean, false by default). * Indicates whether to always show the hilighted areas. */ i.alwaysOn = !i.alwaysOn; if (window.event) { key = window.event.keyCode; //IE if (window.event.ctrlKey) isCtrl = true; else isCtrl = false; } else { key = e.which; //firefox if (e.ctrlKey) isCtrl = true; else isCtrl = false; } // Apply changes. if (isCtrl == true) { i.alwaysOn = true; $(i).data('maphilight', i).trigger('alwaysOn.maphilight'); } else { i.alwaysOn = false; $(img).hasClass('maphilighted').each(function() { $(this).data('maphilight', i).trigger('alwaysOn.maphilight'); /* here i want remove all selected (highlighted) state */ }); } }; </code></pre>
javascript jquery
[3, 5]
248,500
248,501
onload for div tag
<p>I have div tag, after some event, I insert (change old content) into this tag, several images and also texts, for example:</p> <pre><code> $("#some_button").on("click", function () { $("#mydiv").html("&lt;div&gt;aaaa&lt;/div&gt;&lt;img src='1.jpg'&gt;&lt;div&gt;bbb&lt;/div&gt;&lt;img src='2.jpg'&gt;"); }); </code></pre> <p>I want, that after load "mydiv" tag full content, alert("mydiv contonet is loaded"). That is, some like this:</p> <pre><code>$("#mydiv").onload( function () { alert("mydiv contonet is loaded"); }); </code></pre> <p>Tell please, how can this make?</p>
javascript jquery
[3, 5]
3,691,102
3,691,103
Round Up Double to Whole Number?
<p>I have a double that contains the result of a calculation.</p> <p>i.e 2.123 etc</p> <p>Is there a simple way where i can round up this number to the next number up i.e 3</p> <p>I have searched the forum, but only come up with how to round off to decimal places.</p> <p>cheers</p>
java android
[1, 4]
4,984,654
4,984,655
Object function Function() { [native code] } has no method '_registerScript'
<p>I have site which has updatePanel and it is hosted on a web farm. Ive noticed that sometimes when I hit ctrl + r there is an js error:</p> <pre><code>Object function Function() { [native code] } has no method '_registerScript' </code></pre> <p>Requests before <code>ctrl+r</code> and on <code>ctrl+r</code> are made to the same server.</p> <p>What can be the sause of this problem ?</p>
c# asp.net
[0, 9]
3,958,482
3,958,483
validating ajax success response
<pre><code>function run() { $.ajax({ type: "POST", url: "script.php", success: function(msg){ if(msg == "OK"){ // call a js function }else if(msg == "NOT"){ // call a js function }} }); } </code></pre> <p>I need to run a function base on server response, however when the response is OK it return NOT rather than OK. any idea of why this is happening?</p>
php jquery
[2, 5]
4,370,121
4,370,122
How to differentiate between sliding and clicking in android?
<p>In pure Java there is <code>MouseInputListener</code> which I can use to work with those 2 events.</p> <p>How do I do it with Android?</p> <p>If I implement both events then only one is fired (<code>onClickListener</code>) and not the other.</p> <p><strong>Updated:</strong></p> <p>The question is not about detecting the finger movement. </p> <p>I have a View (<code>ImageView</code> for example). I need to detect the click on this view which is <code>onClickListener()</code> and finger movement on this view (i.e. press, move then release the finger). </p> <p>The problem here is that only <code>onClickListener()</code> is called and <code>MotionEvent</code> handler is not caught. </p> <p>I need to be able to differentiate those 2 events as the main event should be finger movement and <code>onClickListener()</code> should just say "Don't click this view. Spin this view." </p> <p>Hopefully this is more clear. </p>
java android
[1, 4]
2,545,342
2,545,343
Get Dates betwen Ranges, c#
<p>I've two dates</p> <blockquote> <ol> <li>21/01/2011 [From Date]</li> <li>25/01/2011 [To Date]</li> </ol> </blockquote> <p>How can I get all the dates between these ranges using c#</p> <p>The answer should be </p> <blockquote> <p>21/01/2011<br> 22/01/2011<br> 23/01/2011<br> 24/01/2011<br> 25/01/2011</p> </blockquote>
c# asp.net
[0, 9]
1,224,552
1,224,553
Register Listener in constructor of subclass
<p>I need to register a <code>Listener</code> in my subclass on an inherited <code>final</code> field (<code>mCursorLoader</code>). I need to do this in the <code>constructor</code> of my subclass. <strong>Preferably without changing the fields to <code>non-final</code> or doing any <code>unRegistering</code> in the subclass.</strong></p> <p>The problem is that my parent class is registering the <code>Listener</code> from its implementation in its constructor. And i need a way to either prevent it from registering that <code>Listener</code> and then register the subclasses <code>Listener</code> or unRegister the parent classes <code>Listener</code> and then register the subclasses <code>Listener</code>.</p> <p>Having a hard time explaining, so if it needs more clarification, please let me know.</p> <pre><code>public abstract class A&lt;T&gt; extends AsyncTaskLoader&lt;List&lt;T&gt;&gt; { protected final Listener mListener = new Listener(); protected final CursorLoader mCursorLoader; protected final String mId; public A(Context context, String mId) { super(context); this.mCursorLoader = new CursorLoader(context); this.mCursorLoader.registerListener(0, mListener); this.mId = mId; } public class Listener implements OnLoadCompleteListener&lt;Cursor&gt; { public void onLoadComplete(final Loader&lt;Cursor&gt; loader, final Cursor cursor) { } } } public abstract class B&lt;T&gt; extends A&lt;T&gt; { protected B(Context context, String mId) { super(context, mId); } public class Listener implements OnLoadCompleteListener&lt;Cursor&gt; { public void onLoadComplete(final Loader&lt;Cursor&gt; loader, final Cursor cursor) { } } } </code></pre>
java android
[1, 4]
367,780
367,781
frame by frame caching
<p>How to cache multiple videos frame by frame</p>
java javascript c++
[1, 3, 6]
1,939,275
1,939,276
Unable to catch all mouse co-ordinates when moving mouse faster
<p>I have written the below code to calculate mouse moved co-ordinates </p> <pre><code>$(document).mousemove(function(e){ console.log(e.pageX + ", " + e.pageY); }); </code></pre> <p>and <a href="http://jsfiddle.net/Z5L7T/1/" rel="nofollow">here</a> is the fiddle​.</p> <p>My Question is, when I move mouse slowly I am able to see all the mouse moved co-ordinates in console. But when I move faster I could not see all. Only few are counted.Is there any problem with my code?</p>
javascript jquery
[3, 5]
227,619
227,620
How to bind large amount of data into gridview?
<p>Recently i went for an interview for c#.net programmer.The interviewer asked me a scenario which i could not answer,and couldnt find it by googling it</p> <p>Scenario is like this..</p> <p>Suppose we've about 100k customers in our database,I want to show them in a gridview,how will we do that ??</p> <p>My answer was that we would fill customers in the datatable and bind it to the gridview.</p> <p>He replied to me that there could be possible timeout scenario,when i bind it in the above mentioned way...</p> <p>How could i solve this issue ???</p>
c# asp.net
[0, 9]
2,283,315
2,283,316
How to handle enter key in Javascript overlay?
<p>I have a JavaScript overlay that consists of several input text search criteria. When the user presses the <kbd>enter</kbd> key in any of those inputs, I want to mimic the behaviour of the search button.</p> <p>I know how to handle the enter key if there is only one input. I define the input as: </p> <pre><code>&lt;input type=\"text\" class=\"txtOrgNmFilter inputBox\" onkeyup=\"ClientsListControl.onFilterKeyup(event);\" /&gt; </code></pre> <p>and in the onFilterKey up </p> <pre><code>onFilterKeyup: function(event) { if (event.keyCode == 13) { $(".txtOrgNmFilter").click(); } } </code></pre> <p>My question is as follows: if I have several input texts, do I need to add the <code>onKeyUp</code> attribute in all of them or is there a simpler way (similar to a form submit action)?</p> <p>My overlay is a table</p>
javascript jquery
[3, 5]
3,552,788
3,552,789
JQuery: How to select table rows but not the rows of the table inside the cell
<p>So I have a table, and there are tables within the cell too, like this:</p> <pre><code>&lt;table id='table1'&gt; &lt;tr&gt; &lt;td&gt;xyz&lt;/td&gt; &lt;td&gt; &lt;table&gt;&lt;tr&gt;&lt;/tr&gt;&lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;tr&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>How do I use jquery to select those only directly under "table1", but not those under the inside table?</p>
javascript jquery
[3, 5]
2,312,633
2,312,634
jquery this selector after clicked element removed
<p>I want to empty content of div with class dialogBody and then append returned ajax response. See the code below please. The problem I have is .html(response) doesn't do anything because clicked element is removed. How can I carry over the target element which is $this.closest('.dialogBody') after clicked element was removed?</p> <pre><code>&lt;div class="dialogBody"&gt; &lt;p&gt;Some content&lt;a href="/question/33" class="ajaxReplace"&gt;Click to show question&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;script&gt; $(".ajaxReplace").live("click", function(e){ e.preventDefault(); var $this = $(this); $this.closest('.dialogBody').empty(); ajaxUrl = $(this).attr("href")+"?ajax=1"; $.ajax({ type: "POST", url: ajaxUrl, success: function(response){ $this.closest('.dialogBody').html(response); console.log(response); } }) }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,092,851
3,092,852
Keydown pressed for left does not update for Keyup
<p>I have an object on <code>canvas</code> that I would like to move with keyboard events,</p> <p>My event function is as follows</p> <pre><code>function onKeyDown(evt) { if (evt.keyCode == 40) { downDown = true;} if (evt.keyCode == 39) { rightDown = true;} if (evt.keyCode == 38) { upDown = true;} if (evt.keyCode == 37) { leftDown = true;} } </code></pre> <p>and my <code>onKeyUp</code> function is the same except with <code>false</code> as the value</p> <p>then I attach it as</p> <pre><code>$(document).keydown(onKeyDown); $(document).keyup(onKeyUp); </code></pre> <p>I have a draw function that is called within my init as <code>intv = setInterval(draw, 10);</code> with the following statements</p> <pre><code> if (rightDown) { x += dx;} if (upDown) { y -= dy;} if (downDown) { y += dy;} if (leftDown) {x -= dx;} </code></pre> <p>Everything except the -x direction (left Down) works well. Such that I can move the object up,right and down. When left is pressed the object continues moving left. Are my conditional statements setup improperly ? </p> <p>The full demo is at <a href="http://jsfiddle.net/avSvu/" rel="nofollow">http://jsfiddle.net/avSvu/</a></p>
javascript jquery
[3, 5]
5,892,175
5,892,176
Java/Android: Reading/writing a byte array over a socket
<p>I have an Android application where I'm trying to send a picture to a server. I did this using Base64 encoding and it worked quite well, but it took too much memory (and time) to encode the picture before sending it.</p> <p>I'm trying to strip the Android application down to where it just simply sends the byte array and doesn't fiddle around with any kind of encoding scheme so it'll save as much memory and CPU cycles as possible.</p> <p>This is what I would like the Android code to look like:</p> <pre><code>public String sendPicture(byte[] picture, String address) { try { Socket clientSocket = new Socket(address, 8000); OutputStream out = clientSocket.getOutputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); out.write(picture); return in.readLine(); } catch(IOException ioe) { Log.v("test", ioe.getMessage()); } return " "; } </code></pre> <p>The server is written in Java. How do I write the server code so I can properly retrieve the exact same byte array? My goal is to save as many CPU cycles on the Android as possible.</p> <p>So far, all the methods I've tried resulted in corrupt data or a thrown exception.</p> <p>Any help will be appreciated.</p>
java android
[1, 4]
991,233
991,234
milliseconds to time in javascript
<p>I have this function which formats seconds to time </p> <pre><code> function secondsToTime(secs){ var hours = Math.floor(secs / (60 * 60)); var divisor_for_minutes = secs % (60 * 60); var minutes = Math.floor(divisor_for_minutes / 60); var divisor_for_seconds = divisor_for_minutes % 60; var seconds = Math.ceil(divisor_for_seconds); return minutes + ":" + seconds; } </code></pre> <p>it works great but i need a function to turn milliseconds to time and I cant seem to understand what i need to do to this function to return time in this format</p> <pre><code>mm:ss.mill 01:28:5568 </code></pre>
javascript jquery
[3, 5]
2,960,800
2,960,801
c# class in a session state?
<p>My senior project is building a reservation system in ASP.NET/C#. Part of my senior project is to have c# classes (and basically use everything ive learned in the past few years). One thing Im trying to do is after I instantiate a new "user" class I need it to travel between the pages. I know session states holds variables, so I figured a session state would work where I can simply type "Session["blah"]." and have access to its members. But I dont see that happening. I realize session states are HTTP context, so i doubted it would work anyway. But is there any other way in which I can accomplish what I need without instantiating a new user class every time? I know its a webpage...but im also trying to make it as much as a functional online program as I can. </p> <p>Just for coder's sake, heres the code snippet im working with:</p> <pre><code> cDatabaseManager cDM = new cDatabaseManager(); string forDBPass = Encryptdata(pass_txt.Text.ToString()); string fullName = fname_txt.Text.ToString() + " " + lname_txt.Text.ToString(); cDM.regStudent(email_txt.Text.ToString(), forDBPass, fullName, num_txt.Text.ToString(), carrier_ddl.SelectedValue.ToString(), this); //ADD - getting a cStudent cUser studentUser = new cStudent(fullName, forDBPass, email_txt.Text.ToString()); //ADD - session states Session["cStudent"] = studentUser; //Session["cStudent"]. //session state will not work with what I am doing //ADD - transfer to campus diagram </code></pre> <p>Thanks in advance!!</p> <p>EDIT:</p> <p>I want to thank all of you who posted and commented! Ive learned alot from this short discussion. All your answers helped me understand!</p>
c# asp.net
[0, 9]
4,796,018
4,796,019
Still stuck on my php calling javascript problem. Please help in this
<p>Still stuck on my PHP calling a JS script problem </p> <p>On the click of a button this Javascript is called:</p> <pre><code>var xmlhttp; function register() { xmlhttp=GetXmlHttpObject(); alert("pass"); if(xmlhttp==null) { alert("Your browser does not support AJAX!"); return; } var url="register.php"; url=url+"?id="+uniqueid+"&amp;name="+name+"&amp;passwrd="+passwrd1+"&amp;email="+email; xmlhttp.onreadystatechange=statechanged; xmlhttp.open("GET", url, true); xmlhttp.send(null); } function statechanged() { //alert("statechanged function"); if(xmlhttp.readyState==4) { //alert(xmlhttp.responseText); document.getElementById("response").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { if(window.XMLHttpRequest) { return new XMLHttpRequest(); } if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } function testing() { document.getElementById("mainbody").innerHTML="This is my first JavaScript!"; } </code></pre> <p>And then this PHP script is called:</p> <pre><code>&lt;?php echo "&lt;script type=\"text/javascript\"&gt;testing();&lt;/script&gt;"; ?&gt; </code></pre> <p>The HTML has two <code>DIV</code> tags with IDs of <code>mainbody</code> and <code>response</code>:</p> <pre><code>&lt;HTML&gt; &lt;HEAD&gt; &lt;SCRIPT SRC=javascriptname.js&gt;&lt;/SCRIPT&gt; &lt;/HEAD&gt; &lt;BODY&gt; &lt;DIV ID=mainbody&gt; &lt;DIV ID=response&gt; &lt;/DIV&gt; &lt;/DIV&gt; &lt;/BODY&gt; &lt;/HTML&gt; </code></pre> <p>I am unable to call the javascript from my php. If anyone know what am i doing wrong, or has a idea what should i do, it will be very helpful. </p> <p>Thank you Zeeshan</p>
php javascript
[2, 3]
520,836
520,837
How do I call a function on confirmation of leaving page?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1299452/how-do-i-stop-a-page-from-unloading-navigating-away-in-js">How do I stop a page from unloading (navigating away) in JS?</a> </p> </blockquote> <p>I've created an online whiteboard. I wish to confirm from user whether he wants to leave the page or not (since he needs to save whiteboards before leaving)<br/></p> <pre><code>$(window).bind('beforeunload', function(){ return 'Are you sure you want to leave?'; }); </code></pre> <p>Now I need to call a function if the user confirms to leave the page. That function will post to the DB from jQuery (which I know how to do) &amp; convert the user from active to inactive. <br/> Only trouble I'm having is <b>how do i get that function to be executed when the user CONFIRMS to leave.</b> <br/> Thanks!<br/></p> <hr> <p>FURTHER...<br/></p> <pre><code>$(window).bind('beforeunload', function(){ return 'Are you sure you want to leave?'; }); window.onunload=pageleave(); function pageleave() { var grp=$("#grpid").val(); var login=$("#loginid").val(); $.ajax({ type: 'POST', url:'collwb_pageleave.php', data: { GrpID:grp, LogID:login }, cache:false, }); } </code></pre> <p><br/> Here what happens is, on page load, pageleave gets executes and make Activity=0 in the Database. This should happen on page unload... Why? Why would this happen?</p>
javascript jquery
[3, 5]
3,588,716
3,588,717
jQUery .slideToggle() & .text replace
<p>I've got the following problem (test version available <a href="http://jsfiddle.net/qmP8R/2/" rel="nofollow">http://jsfiddle.net/qmP8R/2/</a>):</p> <p>I have two <code>&lt;div&gt;</code> containing two versions of text and a third <code>&lt;div&gt;</code> used as a "container".</p> <p>On load the container is populated with the shorten text. On the click of a button I want to change the short version for the long version with some animation (sliding up/down animation) and vice versa (swap short for long and long for short - basically toggle). </p> <p>In the test version it works quite as expected, but I am not able to solve the following problems:</p> <ul> <li>animation on 1st click does not work (but the text is changed to the long version)</li> <li>on second click the whole container is slided up - not reverting to initial state</li> </ul> <p>Basically what I waht to achieve is a kind of toggle behaviour, but connected with .text replacement rather than display: show/hide.</p> <p>P.S.: AJAX content replacement is not available as a solution in my case.</p>
javascript jquery
[3, 5]
1,952,654
1,952,655
Using jQuery to change dynamic content?
<p>I'm pretty new to using jQuery but am working on a Safari Extension at the moment and have run into a bit of a puzzle with appending some text to a page.</p> <p>Basically, I am creating an extension that will append a specific string of text with another on the page within an element</p> <pre><code>&lt;td id="name"&gt;foo&lt;/td&gt; </code></pre> <p>Using the following jQuery code</p> <pre><code> jQuery("#name").filter(function() {return jQuery(this).text() == 'foo'; }).append('bar'); </code></pre> <p>This would result in</p> <pre><code>&lt;td id="name"&gt;foobar&lt;/td&gt; </code></pre> <p>This works great in a standard html page, however - the site I wish it to run on uses a different bit of JS to dynamically load the content within the element, so when testing it on the site, the element is listed as</p> <pre><code>&lt;td id="name"&gt;&lt;/td&gt; </code></pre> <p>and then the JS library adds the name to it, meaning I cannot append the text (the name appears in the browser window but not within the page's source). Is there a way I can get around this? </p> <p>I've tried using</p> <pre><code>$(window).load() </code></pre> <p>Though this had no effect. </p>
javascript jquery
[3, 5]
216,963
216,964
Android Demo's aren't appearing in simulator
<p>I'm trying to get my feet wet with Android development. I downloaded Eclipse, and setup the ADT. When I create a project from existing source, I choose the demo projects (API Demo) and compile + run. The simulator pops up but I can't seem to find the API Demo application. How can I get this up and running?</p>
java android
[1, 4]
3,152,951
3,152,952
system.web.mail vs system.net.mail
<p>Any body pls share the difference between <code>system.web.mail</code> and <code>system.net.mail</code></p>
c# asp.net
[0, 9]
5,955,917
5,955,918
Can someone explain to me the role of the Application class in android?
<p>I'm studying Java and Android development by myself from PDFs. I'm trying to figure out what the <code>Application</code> class is for, and when should it be used? </p> <p>I couldn't understand it from reading through either the PDFs or the android developers website.</p> <p>Anyone care to explain it to me?</p>
java android
[1, 4]
928,378
928,379
Images not coming on android browser
<pre><code>function ShowProcessingImage() { try { var divProcessingImageY = $(document).height(); var processingImageY = $(window).scrollTop() + ($(window).height()/2) - 45; var processingImageX = (($(window).width()/2) - 45); $('body').append('&lt;div id="divProcessingImage" style="position:absolute;width:100%; height:'+divProcessingImageY+'px; top:0; left:0; background-color:#7f7f7f; text-align:center; vertical-align:middle; z-index:98;opacity:.7"&gt;&lt;/div&gt;'); $('#imgProcessing').css({'z-index' : 99, 'top' : processingImageY + 'px', 'left' : processingImageX + 'px'}); $('#imgProcessing').show(); } catch (err) { } } </code></pre> <p>This in my js file. I am calling this method on click events. It works fine on Iphone browser but on Android browser I am not getting the loading image on all button clicks. I have seen putting alert and the function seems to be getting called and executed but no image is displayed?</p> <p>I have this the image div blcok in my master page.</p>
jquery android
[5, 4]
2,929,810
2,929,811
getting fakepath in jquery
<p>am trying get size of a file by passing the file bath from javascript to an php file then return the result , problem is javascript passing file bath as the following ex, c:\fakepath\NAME OF THE FILE , so the php file getting an wrong path so always returning an false !!! </p> <pre><code> $(document).ready(function (){ $("#file").click(function (){ fileBath=$("#name").val(); $.get('newfile2.php','fileBath='+fileBath,function(data){ alert(data); }); }); }); </code></pre> <p>php file </p> <pre><code>getmax($_GET['fileBath']); function getmax($fileBath){ $value=filesize($fileBath); echo $value; } </code></pre> <p>as i said the return value FALSE in php file because file bath is wrong !! </p>
php javascript jquery
[2, 3, 5]
5,380,664
5,380,665
how can I $_POST this below
<p>Below is my javascript and form code where it appends a question number (qnum) for each table row appended in the application one by one. So if user adds a table row then it contains question number 1, when second row is added, question number 2 is added, then 3 for third row and etc.</p> <pre><code>&lt;script&gt; function insertQuestion(form) { var $tbody = $('#qandatbl &gt; tbody'); var $tr = $("&lt;tr class='optionAndAnswer' align='center'&gt;&lt;/tr&gt;"); var $qid = $("&lt;td class='qid'&gt;" + qnum + "&lt;/td&gt;"); $tr.append($qid); $tbody.append($tr); ++qnum; $("#questionNum").text(qnum); &lt;/script&gt; &lt;form id="QandA" action="insertQuestion.php" method="post" &gt; &lt;div id="detailsBlock"&gt; &lt;table id="question"&gt; &lt;tr&gt; &lt;th colspan="2"&gt; Question Number &lt;span id="questionNum"&gt;1&lt;/span&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>The problem I have is that I want to do a <code>$_POST</code> in the next page for all the question numbers added. The only problem is that because I am not using an input field, I do not have a name attribute to <code>$_POST</code>. so what I want to know is that if I can use 'name' attribute to <code>$_POST</code>, then how else can I post the question numbers?</p>
php javascript
[2, 3]
5,730,630
5,730,631
Unable to execute dex: Multiple dex files define
<p>I know this question has been asked here a few times before. But i haven't seen any possible solution yet. Before i make the project 'Run as Android Application' , if i do not clean it, i receive the following error and have to restart Eclipse ... and clean again.</p> <pre><code>Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/jstun/core/attribute/MessageAttributeInterface; </code></pre> <p>com.jstun.core... is a part of my src folder, of course i can't remove it. And even if i remove that package, another package will show up as an error like:</p> <pre><code>Unable to execute dex: Multiple dex files define Landroid/support/v4/app/ActivityCompatHoneycomb; </code></pre> <p>I've seen this error since updating to ADT 15, i'm using Eclipse Galileo on Ubuntu Do you have any idea? Thanks for any reply!</p>
java android
[1, 4]
5,745,982
5,745,983
Ignore escape sequences in strings java?
<p>In C#, I can write the string <code>"\\myDir\\myFile"</code> as <code>@"\myDir\myFile"</code>. What is the equivalent for this "@" character in Java, if any?</p>
c# java
[0, 1]
3,880,610
3,880,611
How to call JavaScript in Android 4.2
<p>I have already found many examples about how to call JavaScript from android. But it's not working for me. My target SDK is 17(android 4.2). This is how I am loading my html page from my activity:</p> <pre><code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); myWebView = (WebView)findViewById(R.id.mapwebview1); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); JavaScriptHandler jScriptHandler = new JavaScriptHandler(this); WebChromeClient myWebChromeClient = new WebChromeClient(); myWebView.setWebChromeClient(myWebChromeClient); myWebView.addJavascriptInterface(jScriptHandler, "MyHandler"); myWebView.loadUrl("file:///android_asset/mywebpage.html"); myWebView.loadUrl("javascript:myFunc()"); } </code></pre> <p>Here is the code for my JavaScriptHandler:</p> <pre><code>public class JavaScriptHandler { //TabFragmentMap mapFragment; Context context; //Fragment fragment; public JavaScriptHandler (Context c){ this.context = c; } </code></pre> <p>}</p> <p>Here is the code for my html:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;PhoneGap&lt;/title&gt; &lt;/head&gt; &lt;body onload="myFunc()"&gt; &lt;h1 id="test1"&gt;Hello World&lt;/h1&gt; &lt;input type="button" value="Say hello" onClick="moveMyself()" /&gt; &lt;div id="myDiv"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; function myFunc() { document.getElementById('test1').innerHTML = 'Good Morning'; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript android
[3, 4]
2,049,463
2,049,464
combine multiple DataViews into a single one?
<p>I have 4 different select statements which i sequently assign to an sqlDataSource like this:</p> <pre><code>sqlNoutatiProduse.SelectCommand = select; </code></pre> <p>and i keep the results in different DataViews like</p> <pre><code>MySession.Current.dataViewNoutatiProduse1 = (System.Data.DataView)sqlNoutatiProduse.Select(DataSourceSelectArguments.Empty); </code></pre> <p>and so on.</p> <p>Is it possible to combine into a single DataView the results of these queries?</p>
c# asp.net
[0, 9]
4,210,884
4,210,885
Script tag in ASPX page is written partially (output stopped at random)
<p>I have an aspx page where I put a script tag with .net "if" and "else".<br> The problem is that the output gets cut at random points each time. Sometimes it's ok, sometimes I get cropped output.</p> <p>The code itself (Simplified example):</p> <pre><code>&lt;body id="body" runat="server"&gt; &lt;form id="form1" runat="server"&gt;some HTML &lt;script type="text/javascript"&gt; window.addEvent('domready', function() { var x = "nothing"; &lt;% if(someCondition){%&gt; x = "2"; &lt;%} else {%&gt; x = "3"; &lt;%}%&gt; }); &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>The cropped output:</p> <pre><code>&lt;body id="body" runat="server"&gt; &lt;form id="form1" runat="server"&gt;some HTML &lt;script type="text/javascript"&gt; window.addEvent('domready', function() { var x = "nothi &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>Does anybody have a clue?</p>
c# asp.net javascript
[0, 9, 3]
2,161,901
2,161,902
Android spinner give a NullPointException
<p>Any ideas why this code throws a NullPointException?</p> <pre><code> Spinner spinnerLoadLayouts = (Spinner)this.findViewById(R.id.spnLoadLay); ArrayAdapter&lt;CharSequence&gt; adapter = new ArrayAdapter&lt;CharSequence&gt;(this, android.R.layout.simple_spinner_item, new ArrayList&lt;CharSequence&gt;()); adapter.add("aaa"); adapter.add("bbb"); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinnerLoadLayouts.setAdapter(adapter); </code></pre> <p>Thanks! :)</p>
java android
[1, 4]
910,933
910,934
Get the caller id
<p>I'm trying to make app which will log my incoming and outgoing calls and the problem is i can't seem to get working this code to return caller id(Like name and surname) but it allways returns "Unknown"</p> <pre><code>public String getname(String num,String nbc ){ String namer=""; ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); try { if (cur.getCount() &gt; 0) { while (cur.moveToNext()) { String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID)); String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); Log.i("",name); if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) &gt; 0) { System.out.println("name : " + name + ", ID : " + id); // get the phone number Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?", new String[]{id}, null); while (pCur.moveToNext()) { String phone = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); System.out.println("phone" + phone); if(phone==nbc||phone==num) { namer = name; return namer; } } pCur.close(); } } } } catch (Exception e) { // TODO: handle exception } return namer; </code></pre> <p>}</p> <p>It doesn't execute this(<code>if(phone==nbc||phone==num)</code>) part. </p> <p>Can you please tell me what's wrong or another way to do this or at least point me in the right direction.</p>
java android
[1, 4]
5,940,596
5,940,597
jQuery - don't fire 'click' on 'mousemove'
<p>I created a <a href="http://jsfiddle.net/syTKq/" rel="nofollow">Fiddle</a> to demonstrate my situation.</p> <p>I want to not fire the click event when the user is panning--only if it's just a simple click. I've experimented with different placements of .off() and .on() to no avail.</p> <p>Thanks in advance for your help.</p>
javascript jquery
[3, 5]
3,987,509
3,987,510
Use view as base container Android
<p>Here is the scope. I am trying to create a base class you will be subclassing and running into some snags. I want to create a method that returns a view so it can be overridden by any of its subclasses such as listview, gridview, textview, etc. Not sure if that is even possible or if I am going about it the wrong way, but here is the code below. Thank you for your time.</p> <p>This is the base view method in my class. </p> <pre><code> View backViewController() { return null; } </code></pre> <p>Here is the subclass.</p> <pre><code>@Override View backViewController() { MenuList = (ListView) findViewById(R.id.backView); return MenuList; } </code></pre> <p>With MenuList being a ListView I created in the subclass and trying to use in place of the base View. The error I am receiving is "The return type is incompatible"</p>
java android
[1, 4]
5,307,831
5,307,832
Jquery client validation asp.net
<p>i am new to jquery ; i am using jquery validation as shown below:</p> <pre><code> function validate() { return $('#aspnetForm').valid(); } &lt;asp:Button UseSubmitBehavior="false" ID="Button1" runat="server" Text="Button" OnClientClick="return validate();" OnClick="btnSubmit_Click"&gt;&lt;/asp:Button&gt; </code></pre> <p><strong>is this possible in asp.net ?;</strong> currently this button is not post backing if function returns true</p>
jquery asp.net
[5, 9]
2,875,693
2,875,694
drop down list not updating selected item on subsequent calls
<p>i have the following code </p> <pre><code>Page_Load () { if (!IsPostBack) { //data binding to ddl year } else { if (ViewState["ddlyear"] != null) { ddlyear.SelectedValue = ViewState["ddlyear"].ToString(); } } } ddlyear_SelectedIndexChanged { ViewState["ddlyear"] = ddlyear.SelectedItem.Value.ToString(); } </code></pre> <p>heres the error.</p> <ul> <li><p>load page select item in ddlyear, which reloads page, and correctly displays the item in the ddl.</p></li> <li><p>if I change the displays the selected item will not change. </p></li> </ul> <p>if I put a breakpoint on <code>ddlyear.SelectedItem.Value.ToString();</code> the value actually never changes form the first call. it will change once, to the selected items value, but will not change even if another item is selected on subsequent page calls. </p> <p>i.e.</p> <ol> <li>first page load - ddlyear = 1000 </li> <li>change to another option, lets say 1001</li> <li>page reload, ddlyear = 1001 </li> <li>change to another option, lets say 1002</li> <li>page reloads, ddlyear = <strong>1001</strong> not 1002</li> </ol>
c# asp.net
[0, 9]
2,251,982
2,251,983
How make a popup work
<p>I am trying to develop a popup feature when you click on an Image the image opens up as a popup. Here is the example <a href="http://soumghosh.com/otherProjects/natalierosscms/175-2/" rel="nofollow">http://soumghosh.com/otherProjects/natalierosscms/175-2/</a></p> <p>Click on the first image and close it. Then click on the second image. The images are repeating. Any ideas what I am doing wrong? For some reason I am not able to post code here.</p> <p><strong>JavaScript:</strong></p> <pre><code>$('.alignnone').click(function(){ $('.overlay').appendTo('body'); $('.overlay').show(); var popImage = $('.projectContainer').show(); var thumbHolder = $(this).parent(); thumbHolder.css('position', 'relative'); $(this).clone().appendTo('.projectContainer'); var cssAtrOne = { padding:'10px', width:'110%' }; popImage.appendTo(thumbHolder).css(cssAtrOne); }); $('.closeButton').click(function(){ $('.overlay').hide(); $('.projectContainer').hide(); }); </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;!-- clickable image --&gt; &lt;img src="http://soumghosh.com/otherProjects/natalierosscms/wp-content/uploads/2013/03/T1Main.jpg" alt="T1Main" width="559" height="745" class="alignnone size-full wp-image-181"&gt; &lt;!-- popup --&gt; &lt;div class="projectContainer" style="padding: 10px; width: 110%; display: block;"&gt; &lt;img class="closeButton" src="/otherProjects/natalierosscms/wp-content/themes/twentyeleven/images/closeButton.png"&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
3,627,843
3,627,844
Dynamically adding attributes to <head> tag ASP.NET
<p>How would I go about finding on my ASPX page (from codebehind) and then adding the attribute "runat=server" to it? I have tried using <code>Page.header.attributes.add(...)</code> and<code>(HtmlHead) Page.FindControl("head");</code> The second one obviously won't work as the Head tag doesnt have an ID.</p> <p>I can't work out how to change this property and I can't change or add any additional code to the ASPX page - like ID's etc.</p>
c# asp.net
[0, 9]
1,606,285
1,606,286
How to show an image proportional to the screen
<p>I want to display .png image on TextView. Someone will use tablet, someone will use smartphone, how can I show an image proportional to the screen? Do I have to create different images and use in the code something like <code>if(screen == smartphone) setView(Png1.png)</code>?</p>
java android
[1, 4]
5,298,154
5,298,155
how to valid only digit in textbox in firefox?
<p>i have problem to valid digit in textbox in IE 9 and firefox 4 &amp; 5, is any one know ? i try all previous question's answer but still face problem, i just want use to enter only digit in textbox, i am use asp.net too for code language.</p>
javascript jquery asp.net
[3, 5, 9]
5,306,136
5,306,137
calculate values on basis of text box entry
<p>i have one row of text boxes which is generated with php loop and mysql id.</p> <pre><code> &lt;input class="text_field1" id="&lt;?php echo $i ?&gt;" name="q_&lt;?php echo $row['pid']; ?&gt;" type="text" style="width:150px" /&gt; &lt;input disabled="disabled" class="text_fieldD" id="p_&lt;?php echo $row['pid']; ?&gt;" name="p_&lt;?php echo $row['pid']; ?&gt;" type="text" value="&lt;?php echo $row['pprice'] ?&gt;" /&gt; &lt;input disabled="disabled" class="text_fieldD" id="t_&lt;?php echo $row['pid']; ?&gt;" name="t_&lt;?php echo $row['pid']; ?&gt;" type="text" /&gt; </code></pre> <p>what i want is</p> <p>when i enter any value in text box with class text_field1, i want to calculate total in text box name t_.... (qty * price ,p_....)</p> <p>i try this code its works little bit but not all i want , my JQUERY code is</p> <pre><code> $('.text_field1').bind("focus blur change keyup", function(){ var $el = $(this); var numPallets =IsNumeric1($el.val()); }); </code></pre> <p>Thanks</p>
php jquery
[2, 5]
195,653
195,654
How to load more items when we scroll down like in google places
<p>How to load more items when we scroll down like in google places</p> <p><a href="http://www.google.com/city/portland/" rel="nofollow">http://www.google.com/city/portland/</a></p> <p>When we scroll it has load items</p>
c# asp.net
[0, 9]
3,645,069
3,645,070
Find in URL string from Array of values?
<p>I am trying to find array values in URL string? check the condition If requested URL contains array values then pass condition otherwise redirect to google.com </p> <p>example</p> <pre><code> $(document).ready(function () { var urls = ["/dept/ce/", "/dept/cs", "/dept/career", "/dept/it", "/dept/mkt/", "/dept/Membership/" , "/dept/pr" , "/dept/PS" , "/dept/ta" , "/dept/wc" , "/dept/PubsProducts" , "_layouts/settings.aspx" ,"/_catalogs/masterpage/"]; //If document.location.href = "http://localhost/dept/ce/default.aspx" //And Array has "/dept/ce" values //Now check document.location.href against array values, if //document.location.href contains array values then pass condition otherwise //else condition }); </code></pre> <p>How to do this?</p>
javascript jquery
[3, 5]
2,308,877
2,308,878
asp checkbox not firing jquery function
<p>Ok I have checked several solution and have no luck. What the heck am I doing wrong. I can retrieve the ID from check_controls doing an alert onload but not on change</p> <pre><code>&lt;asp:CheckBox ID="chkAutoReverse" runat="server" CssClass="" Width="200px" Text="Auto Reverse:" TextAlign="Right" AutoPostBack="false" /&gt; $(document).ready(function() { var check_controls = $('input[id*=chkAutoReverse]'); var AutoReverseOptions = document.getElementById('AutoReverseOptions'); $(check_controls).change(function() { if ($(this).is(':checked')) { alert($(check_controls).attr("id")); } else { alert($(AutoReverseOptions).attr("id")); } }); }); </code></pre> <p>additional html markup</p> <pre><code> &lt;div style="height: 60px"&gt; &lt;div class="singlepanelcontentleft"&gt; &lt;asp:CheckBox ID="chkAutoReverse" runat="server" CssClass="" Width="200px" Text="Auto Reverse:" TextAlign="Right" AutoPostBack="false" /&gt;&lt;/div&gt; &lt;div id="AutoReverseOptions" class="singlepanelcontentleft" style="display: none;"&gt; &lt;asp:RadioButtonList ID="optTabs" runat="server" RepeatDirection="Horizontal" RepeatLayout="Table" Width="91%" Height="22px"&gt; &lt;asp:ListItem Text="Next Period" Value="1" Selected="true"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="2 Periods from Now" Value="2"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="3 Periods from Now" Value="3"&gt;&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>this is nested in other divs and a fieldset. Pasting the other code did not render well</p>
jquery asp.net
[5, 9]
195,486
195,487
Are there in jQuery some methods for handling period of time data type?
<p>I'm new in jQuery and all of my search requests bring me to methods for handling Date/Time data types. But I need to handle some period of time, given in number of minutes. I want to convert, for example, <code>1708</code> minutes to <code>"1 day and 4 hours"</code> expression, ignoring minutes. There is <code>TimeSpan</code> data type in C#, for example, and I can do following:</p> <pre><code>public string ConvertMinutes() { //Number of minutes I have and want to convert int n = 1708; TimeSpan t = new TimeSpan(0, n, 0); string dayshelper = t.Days == 1 ? "day" : "days"; string hoursHelper = t.Hours == 1 ? "hour" : "hours"; //The result I want to get //For example "4 days and 2 hours" string result = string.Empty; result += t.Days == 0 ? string.Empty : string.Format("{0} {1}", t.Days, dayshelper); result += t.Hours == 0 ? "." : string.Format(" and {0} {1}.", t.Hours, hoursHelper); return result; } </code></pre> <p>Is there something similar in jQuery? Or do I have to get number of days and hours from number of minutes by myself?</p>
c# javascript jquery
[0, 3, 5]
974,363
974,364
Handling double quotes in mailto:
<p>I am working on Visual Studio 2008 and ASP.net.. I want to preview email that is created in the web page. I have problems in handling double quotes in the email body. </p> <pre><code>string emailbody = "\"some text\""; btPreviewEmail.OnClientClick = "javascript:location.href='mailto:?subject=Chalk Pushcast Software Order Agreement&amp;body=" + emailbody + "';"; </code></pre> <p>I have left the recipient's field blank because I just have to preview the email. </p> <p>At runtime, I get a Microsoft Outlook error like, "The command line argument is not valid. Verify the switch you are using"</p>
javascript asp.net
[3, 9]
5,542,654
5,542,655
How to read a word document in asp.net
<p>I want to read a word document in asp.net and i need to convert the document words into bytes .So how to do that ?</p>
c# asp.net
[0, 9]