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
871,072
871,073
external javascript file from asp.net C# page
<p>i have some javascript functions written in an external javascript file. and i have included the file in my asp.net page head section. however i m not able to understand how do i call the functions from the code behind file. e.g, i want to call a certain function 'tacount' on onkeypress event of a textbox. how can i possible do that?</p>
c# javascript asp.net
[0, 3, 9]
5,277,523
5,277,524
ASP programmer thinking about learning PHP
<p>What's the best way to go about learning PHP when I've been doing ASP/ASP.NET? I'm not sure it's worth the time, but there seem to be so many projects doing it..</p> <p>What do you think? Anyone crossed the worlds? How did you do it?</p>
c# php asp.net
[0, 2, 9]
2,622,757
2,622,758
Unique div to delete - via live generated divs by jquery event
<p>I have a jQuery triggering a div with live updates every 5 seconds. That works fine. Sometimes those updates should be deleted immediately.</p> <p>jQuery generates html like this:</p> <pre><code>&lt;form&gt; &lt;div id="live1"&gt;Aha I love you too &lt;input id="live1" type="hidden" value="1"&gt;&lt;label id="livedel1"&gt;Delete 1&lt;/label&gt; &lt;/div&gt; &lt;div id="live2"&gt;Thx man &lt;input id="live2" type="hidden" value="2"&gt;&lt;label id="livedel2"&gt;Delete 2&lt;/label&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>... and so on.</p> <p>I need some help with HTML and jQuery how to send/separate specific id to jQuery so it can be deleted, since I'm kinda not into jQuery vals. Deletion is not a problem, just for jQuery to grab specific id.</p> <p>Recommendations in HTML and jQuery are welcome and upper HTML can be changed to xy code no problem.</p>
php jquery
[2, 5]
744,277
744,278
routing in javascript or php function
<p>I was wondering if there is a way of doing this:</p> <p>let's say I'm calling this method:</p> <p><code>object.segment1_segment2_segment3();</code></p> <pre><code>// or $object-&gt;segment1_segment2_segment3(); </code></pre> <p>What you have to know is that segment1_segment2_segment3() is not necessarily an existing method, and I want my program to guess which existing function to call, based on the segments in the object's method.</p> <p>I don't know if i'm clear enough but, I would like to know if you think it's possible, and what would be the cleanest way to do such a MAGIC thing ^^</p> <p>good day to you mister reader ^^</p>
php javascript
[2, 3]
3,741,641
3,741,642
Is it possible with javascript to find file's last modified time?
<p>Is it possible? Now, I have done live chat, where with jquery's help I connect to .php file and check last modified time and if it is not as before, I retrieve messages. If it were possible in javascript I probably would save a lot of resources.</p> <p>Thanks.</p>
php javascript jquery
[2, 3, 5]
4,522,599
4,522,600
Duplicating filename issue
<p>I have a web page in which different user account can be created and the files created for individual user will be diaplayed in the gridview. That is, The files created by abc will be displayed in gridview when abc logs in. Whenever a user creates a file, these files are stored in a folder so that whenever the user clicks on the filename in the gridview the control goes to this folder to open it. So now my question is how can I manage the duplication of the filename. that is, If the user abc creates a filename "Lion", this will be stored in the folder and also in the database and will be displayed to abc when he/she logs in. Now another user say xyz wants to create the the same filename "Lion" which is going to store in the same folder, then that file created by abc will be replaced by the one created by xyz. How can I avoid this?</p>
c# asp.net
[0, 9]
788,572
788,573
Looking for a Image Chooser in Jquery?
<p>I want to be able to browse the image from my web directory, select one of them or more and manipulate them. Like Store them... copy them.... resize them etc.</p> <p>Any plugins or Code to make this possible?</p>
php jquery
[2, 5]
3,308,806
3,308,807
Accessing to Java app from PHP
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3319161/php-java-integration">Php/Java Integration</a> </p> </blockquote> <p>I have a java app. It has some function. How can I call It's function in PHP? I need step by step tutorial about it. I need solution except Java/PHP Bridge and Thrift. </p>
java php
[1, 2]
3,206,928
3,206,929
Passing code to python from PHP
<p>I have a custom codechecker in python, Also there is a bigger project running in PHP, which stores users code in MySQL database.</p> <p>I am new to python, so I'm not sure how I can pass the code from PHP to Python.</p> <p>Do I have to store the file to the filesystem to pass it to Python? (In that case too many files might be created, and their cleanup after execution has to be taken care)</p>
php python
[2, 7]
4,586,122
4,586,123
jquery datatable editor plugin not working in asp.net(c#)
<p>I am using datatable editor plugins to insert rows into datatable but it is not working. Please see my code below.</p> <pre><code>// Create the form editor = new $.fn.dataTable.Editor({ "ajaxUrl": { "create": 'Default.aspx/InsertNewuser' }, "domTable": "#tbl", "fields": [{ "label": "FirstName:", "name": "FirstName" }, { "label": "LastName:", "name": "LastName" }] }); </code></pre> <p>new row code :</p> <pre><code>// New record $('a.editor_create').on('click', function (e) { e.preventDefault(); editor.create( 'Create new record', { "label": "Add", "fn": function () { editor.submit(); } }); }) </code></pre> <p>And the c# code from Default.aspx.cs:</p> <pre><code>[WebMethod] public static int InsertNewuser(string FirstName, string LastName) { DataClasses1DataContext db = new DataClasses1DataContext(); student1 table = new student1(); table.FirstName = FirstName; table.LastName = LastName; db.student1s.InsertOnSubmit(table); db.SubmitChanges(); return table.Std_ID; } </code></pre>
c# jquery asp.net
[0, 5, 9]
1,794,846
1,794,847
Can't make all elements of a class appear after delays
<p>I'm trying to make all the elements of a certain class show, but each after a delay.</p> <p>This code shows all the elements instantly, but I want to wait 1 second between each.</p> <pre><code>$('.notify').each(function(index) { $(this).fadeIn('slow'); }); </code></pre> <p>I've tried using setTimeout but it 'loses' the element variable (the one called 'this'). I've also tried using .delay() but that just makes all the elements show together after 1 second.</p>
javascript jquery
[3, 5]
3,351,823
3,351,824
Apply widget to current and future page elements
<p>Update : I had to change the text to explain my exact problem.</p> <p>I have a 3th party library for tooltips. It works like this</p> <p>jQuery("a").tooltip();</p> <p>How can I attach this to all future "a" elements added using ajax on this page ?</p>
javascript jquery
[3, 5]
2,443,453
2,443,454
Auto-spacing input field value
<p>I'm creating a payment form and one of that field is the card number for VISA, Master Card and so on. My question is how to auto space the value (card number) enter by a user. </p> <p>Let's say I input:</p> <pre><code>4242 4242 4242 4242 </code></pre>
javascript jquery
[3, 5]
783,660
783,661
Moving cursor position in contentEditable div
<p>I'm trying to move the cursor of a content editable div to the end of the line. By default, it goes to the beginning of the line.</p> <p>I'm using:</p> <pre><code>var r = $("#mydiv").createTextRange(); r.moveStart("character", l); r.moveEnd("character", l); r.select(); </code></pre> <p>The error I get:</p> <pre><code>Uncaught TypeError: Object [object Object] has no method 'createTextRange' </code></pre> <p>I've seen this question posted around, but I still can't seem to perform createTextRange(). Any suggestions?</p>
javascript jquery
[3, 5]
4,237,503
4,237,504
about broadcast receiver
<p>Hi all I want to create an application in which there is an activity say My activity. Now I want to start it with incoming call, if it is not answered within 20 seconds.Please Help me. </p>
java android
[1, 4]
5,848,010
5,848,011
Unable to convert input xml file content to a DataSet. Requested value 'ConnectionStrings' was not found
<p>Whenever i setup a typed dataset in visual studio 2008/2010 (ASP.NET) i encounter the error as </p> <blockquote> <p>Unable to convert input xml file content to a DataSet. Requested value 'ConnectionStrings' was not found.</p> </blockquote> <p>but i have the connnection string in my web.config </p> <p>Have anyone know the issue ... This is my dataset.xsd look like</p> <pre><code>&lt;Connections&gt; &lt;Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="AdminConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="AdminConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.AdminConnectionString.ConnectionString" Provider="System.Data.SqlClient" /&gt; &lt;/Connections&gt; </code></pre> <p>Line 1 : Throws Me the error</p>
c# asp.net
[0, 9]
3,362,716
3,362,717
IE and document.innerhtml()
<p>This works in firefox but not in IE7/8:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ $(document).ready(function() { $.get('page.php', function(data){ document.innerHTML = data; }); }); //]]&gt; &lt;/script&gt; </code></pre> <p>This also works in Firefox but not in IE7/8:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ $(document).ready(function() { $.get('page.php', function(data){ document.innerHTML.options[0]=new Option(data); }); }); //]]&gt; &lt;/script&gt; </code></pre> <p>Any suggestions?</p>
javascript jquery
[3, 5]
4,547,283
4,547,284
How to add textboxes to table when button is clicked
<p>I want to add a new cell and a TextBox into it when a button is clicked. But when I click the button in the current row, its cell and TextBox are removed and new ones are added. </p> <p><strong>Markup:</strong></p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Panel ID="pnlForTextBoxes" runat="server"&gt; &lt;/asp:Panel&gt; &lt;asp:DropDownList ID="ddlNumbers" runat="server" Height="16px" Width="143px"&gt; &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;5&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt;`enter code here` &lt;asp:Table ID="myActualTable" runat="server"&gt; &lt;/asp:Table&gt; &lt;br /&gt; &lt;asp:Button ID="cmdAddTextBox" runat="server" Text="Add" OnClick="cmdAddTextBox_Click" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p><strong>Code:</strong></p> <pre><code>protected void cmdAddTextBox_Click(object sender, EventArgs e) { TableRow myRow = new TableRow(); myRow.ID = "row" + ddlNumbers.SelectedValue.ToString(); TableCell myCell = new TableCell(); myCell.ID = "cell" + ddlNumbers.SelectedValue.ToString(); TextBox myTextBox = new TextBox(); myTextBox.ID = "txt" + ddlNumbers.SelectedValue.ToString(); myTextBox.Text = "TextBox number " + ddlNumbers.SelectedValue.ToString(); myCell.Controls.Add(myTextBox); myRow.Cells.Add(myCell); myActualTable.Rows.Add(myRow); myTextBox.Dispose(); myCell.Dispose(); myRow.Dispose(); } </code></pre>
c# asp.net
[0, 9]
6,005,593
6,005,594
Javascript reset function won't work after successful submission of a web form
<p>I am new to JavaScript. I am working in Visual Studio with ASP.NET and I have a simple form. I also have a JavaScript function to validate the form and a JavaScript function to reset the form. The validation and submission work fine. However, after submitting the form, I cannot get the JavaScript reset function to work. I have also tried using a regular HTML input button and it does not work. It works fine before a successful submision, but never after. Any help will be greatly appreciated. </p> <pre><code>function resetForm() { document.getElementById("accountForm").reset(); } &lt;asp:Button ID="subBtn" runat="server" Text="Submit" OnClientClick="return validateForm()" onclick="subBtn_Click" /&gt; &lt;asp:Button ID="rstBtn" runat="server" Text="Reset" OnClientClick="resetForm()" oncClick="rstBtn_Click"/&gt; </code></pre>
javascript asp.net
[3, 9]
467,774
467,775
Sort the listbox items in C#
<p>I develop a webpage in that I display a list box items which is fetched from a database. Dynamically I added some items into it. It adds to the end of the list box, so I want to sort the list box item after I add items. I tried <code>Arraylist</code> for sorting, but it is not working. </p>
c# asp.net
[0, 9]
5,769,832
5,769,833
Alternative to jQuery's .last
<p>I need to use the 1.3.2 library which unfortunately does not support the last functionality. This causes my function to fail: </p> <pre><code>$op.last().next().after($op); </code></pre> <blockquote> <p>"$op.last is not a function"</p> </blockquote> <p><strong>Demo:</strong></p> <p><a href="http://jsfiddle.net/uscyH/" rel="nofollow">http://jsfiddle.net/uscyH/</a></p> <p>I have been unsuccessful at rewriting this functionality in pure js, any suggestions? Note, I will also need the .first(), but I'm assuming I will be able to extrapolate that from the .last alternate code. Many thanks-</p>
javascript jquery
[3, 5]
1,083,276
1,083,277
How to get each file data in jQuery when I select multiple files?
<p>How to get each file data when I select multiple files?</p> <pre><code>&lt;input name="file" type="file" multiple="" &gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $(':file').change(function(){ var file = this.files[0]; name = file.name.toLowerCase(); size = file.size; type = file.type; }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
478,099
478,100
Search text box corrosponding letter name should be ap
<p>I have emp textbox. The textbox contain names.I want to enter some name in text box and corresponding entries should be visible. Please tell me anyone.</p>
c# asp.net
[0, 9]
177,572
177,573
How to restore Textbox Data
<p>I have a small requirement, </p> <p>We have restore the textbox data that was cleared previously.<br> Below is my HTMl code </p> <pre><code>&lt;table&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="textbox"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="checkbox"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Here is my JQuery Code </p> <pre><code> $('TABLE TR TD').find(':checkbox').change(function() { if($(this).prop('checked')) { $(this).parents('TR').siblings('TR').find('input').val("") } if(!$(this).prop('checked')) { $(this).parents('TR').siblings('TR').find('input').val(?) } }); </code></pre> <p>My Requirement is to clear the textbox content if checkbox is checked. And if i deselect it the textbox should be restored with previous data. </p> <p>Please someone help me.</p>
javascript jquery
[3, 5]
1,752,277
1,752,278
Count the length of a string excluding a list of keywords?
<p>I am validating a number of fields based on the length of the string entered. However, any of the values in the following array must NOT count against the string length:</p> <pre><code>var omittedSubStrings = ["%KEYWORD%","{Keyword:AltText}","%CITY_STATE%","%CITY%","%KEYWORD%","%KEY_WORD%","%QUERY_KEYWORD%","%QUERY_KEY_WORD%","$CLICK_ID$","$LOCATION$","%URLENC_CITY%","%NOSPACE_CITY%","%STATE%","$USER_PLACEMENT_INV_ID$"]; </code></pre> <p>so for example if my string is:</p> <pre><code>var str = "Hello %CITY%"; </code></pre> <p>I want to get the length of that string s.t it equals 6. Multiple variables can possibly be used in one string, and they must all not count against length.</p> <p>Suggestions?</p>
javascript jquery
[3, 5]
1,943,883
1,943,884
How can I tell when a character has been typed in an input field?
<p>Let's say I have an input field with an id of code ( #code ).</p> <p>How can I tell when a new character has been typed in it with javascript or jQuery ?</p> <p>This is when the text is manually being entered or is done by javascript / jQuery.</p>
javascript jquery
[3, 5]
1,790,751
1,790,752
jQuery Sparkline Boxplots - What does it expect for values array?
<p>I'm trying to wrap my head around the values that jQuery Sparklines expects in the values array for box plots. It doesn't seem to expect raw statistical values, but rather min value, 1st quartile value, median value, 3rd quartile value, and max value as the values array. Is that so? I went through the minified JavaScript and that seems to be the case, but I'm just not making full sense of it so wanted to double check with anyone that's worked with the Sparlines boxplots. </p> <p>I have the option of showing outliers disabled. I also let the boxplots determine the chart min and max values. The code to construct my boxplot is: </p> <pre><code>$('#ctl00_MainBodyContentPlaceHolder_rptrMultipleChoiceDimensionResult_ctl00_lblBoxPlot') .sparkline( [3.13, 3.2925, 3.375, 3.3975, 3.53], { type: 'box', targetColor: '#fff', boxLineColor: '#777', boxFillColor: '#ccc', whiskerColor: '#777', medianColor: '#000', lineColor: '#777', width: '500px', height: '30px', showOutliers: false, rangeColors: ['#eee', '#bbb', '#888', '#000'] } ); </code></pre> <p>From what I've gathered, when showOutliers is disabled the API expects the values array to be passed as min value, 1st quartile value, median value, 3rd quartile value, and max value. Just wanted to confirm that that is indeed the case, if anyone has used the component before.</p> <p>The documentation doesn't really describe what it expects for the values either: <a href="http://omnipotent.net/jquery.sparkline/" rel="nofollow">http://omnipotent.net/jquery.sparkline/</a>. </p> <p>Thanks</p>
javascript jquery
[3, 5]
295,978
295,979
How to know if a button is being pressed or released?
<p>I have a little problem when I try to run my Android application. The problem occurs when I push &amp; release a button on my main View. The application is to behave like a portophone (push the button to talk, release to stop).</p> <p>To notify that the button is pressed or released, I've tried 2 options: - Adding an onClickListener, - Adding an onTouchListener.</p> <p>The first only looks for the button being pressed, so it's not a viable solution. The second solution is able to differentiate between pushed &amp; released, so it's the one I'm using now. The code looks like this:</p> <pre><code>// Initialise handler for Push To Talk button Button button = (Button) findViewById(R.id.buttonPTT); button.setOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent me){ switch(me.getAction()){ case MotionEvent.ACTION_DOWN: Toast.makeText(getApplicationContext(), "PTT pressed", Toast.LENGTH_LONG).show(); // TODO: Activate Push To Talk break; case MotionEvent.ACTION_UP: Toast.makeText(getApplicationContext(), "PTT released", Toast.LENGTH_LONG).show(); // TODO: End Push To Talk break; } return false; } }); </code></pre> <p>The problem lies in the ACTION_UP case of the switch. While running, it will only work when you press the button, move the cursor/finger/etc, and then release the button. What I want it to do is press it, and being able to release it without having to move my cursor/finger/etc.</p> <p>Anybody have any ideas?</p>
java android
[1, 4]
3,712,800
3,712,801
Force browser to download PDF document instead of opening it
<p>I want to make the browser download a PDF document from server instead of opening the file in browser itself. I am using C#.</p> <p>Below is my sample code which I used. It not working..</p> <pre><code>string filename = "Sample server url"; response.redirect(filename); </code></pre>
c# asp.net
[0, 9]
3,789,887
3,789,888
Passing form values on a submit to an ajax call
<p>I have a common case of allowing a user to submit a form with some values and needed to pass those values to my ajax call. This approach works, but is there a more elegant/efficient way of accessing the form values other than using selectors?</p> <pre><code>$("#myForm").submit(function(){ myData = {name: $("#name").val(), age: $("#age").val()} $.ajax({ url: "foo.php", data: myData, type: get }); }); &lt;form id="myForm"&gt; Name: &lt;input type="text" id="name"&gt; Age: &lt;input type="text" id="age"&gt; &lt;/form&gt; </code></pre>
javascript jquery
[3, 5]
667,977
667,978
How can I block the keyup() event for a second in jQuery?
<p>I'm doing a form validation in jQuery that alerts something when a forbidden character like #$@% is input by user. The problem is, when a user enters those characters, he uses the SHIFT key, so there are two keyup's.</p> <p>How can I prevent the second one from happening?</p> <pre><code>if (!regex.test(lastCharacter) alert('forbidden character'); </code></pre> <p>Thanks a lot</p>
javascript jquery
[3, 5]
5,783,587
5,783,588
$(someelement).text().length and counting character encodings?
<p>Lets say I have this.</p> <pre><code>&lt;div id="somediv"&gt; hello, my friend&amp;#39;s &amp;amp; dog are good friends! &lt;/div&gt; </code></pre> <p>I think that <code>$(somediv).text().length</code> is counting the encodings and not the rendered view. I am doing some truncating on a string if it's too long, and because some of the strings (dynamic) could have <code>&amp;amp;</code> (instead of &amp; ), how do I properly count the total text in a <code>div</code> in its rendered view, not encoded view?</p>
javascript jquery
[3, 5]
3,589,944
3,589,945
ASP Query String From DropDown
<p>I have a webpage: <strong>Menu.aspx</strong>, where I have the following controls of relevance: </p> <ul> <li>a DropDownList with some values</li> <li>a hyperlink, which redirects me to a page called Edit.aspx.</li> </ul> <p>In my <strong>Edit.aspx</strong> page, I have a cancel button, which redirects the user back to the Menu page</p> <p>What I would like to do is when my user clicks on the hyperlink to go to the Edit page,index of the DropDownList is preserved in a query string In my <strong><em>Menu.aspx</em></strong> page I have the following aspx code, but I am not sure how to proceed</p> <pre><code>&lt;asp:HyperLink ID="lnkEdit" NavigateUrl='&lt;%# "Edit.aspx?" + Eval("UserID") + ...not sure... %&gt;' &lt;/asp:HyperLink&gt; &lt;asp:DropDownList ID="myDropDown" ...some &lt;asp:ListItems/&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>EDIT: Clarified why Im using NavigateURL. Because my query string already does an Eval to determine the user ID.</p>
c# asp.net
[0, 9]
4,245,821
4,245,822
How to Upload User Profile image and show it
<p>i am working on a project in which i have registration form in which i want to upload a user image . i have done upload work and store it in a folder. but i am confused how to show it when user open his account. please give idea in c# regards.</p>
c# asp.net
[0, 9]
4,671,513
4,671,514
Clearing UrlData
<p>In a partial asp.net page I have a menu that create links with a foreach statement, which sends the user to another page like this:</p> <pre><code>&lt;a href="Products/@category.CategoryName"&gt;@category.CategoryName&lt;/a&gt; </code></pre> <p>In the Products page I pick up the category chosen by the user in the variable UrlData[0].</p> <p>It works exactly like I want it to, but only the first time a link is clicked. The rest of the time UrlData is just being added to the current url, which mess up the UrlData used for retrieving the right products.</p> <p>Obviously I need some way of clearing the UrlData for this code to work properly.</p> <p>Any help is appreciated.</p>
c# asp.net
[0, 9]
4,699,213
4,699,214
Do event handlers for different buttons queue up?
<p>I have a question about handling of events triggered by clicks on different buttons:</p> <p>Assuming we have several buttons pointing to the same event handler (attached through JQuery's "one" function )</p> <p>If the first step in the event handler is to disable the event handlers of all the other buttons by calling JQuery's off -- Is it still possible for fast clicks on the other buttons to get queued up and execute once the event handler for the first button has finished executing? Even if the first button click removed the handlers for all buttons? I am thinking that the browser might keep an internal event queue that is managed separately from the JavaScript thread.</p>
javascript jquery
[3, 5]
4,056,004
4,056,005
How can I parse this Date in Java?
<p>I want to parse a date into my format like <code>02:09 AM 25/09/2012</code> but I can't. I used this code.</p> <pre><code>SimpleDateFormat sdf1 = new SimpleDateFormat("MMMM, DD yyyy HH:mm:ss Z"); //September, 25 2012 02:09:42 +0000 Date date = sdf1.parse(String.valueOf(PUNCH_TIME)); SimpleDateFormat sdf2 = new SimpleDateFormat("HH':'mm a 'on' DD'/'MMMM'/'yyyy"); SimpleDateFormat sdf2 = new SimpleDateFormat("MM"); String timeformat=sdf2.format(date); txtHomePunchStatus.setText("You have Punched In at "+timeformat); </code></pre> <p>and I got <code>You have punched IN at 7:52 AM on 25/01/2012</code>.</p>
java android
[1, 4]
4,130,171
4,130,172
Stream thread Null pointer error
<p>I am currently having a problem with retrieving an object from a stream in a thread. I am currently getting a null pointer error where it is trying to read from a stream. The input stream is instantiated in a service class so that only one connection for the app is needed. Can anyone see if there is any obvious reason as to why i am getting a null pointer error.</p> <pre><code>@Override public void run() { try { while(true){ while ((mess = (com.DrawTastic.Message) messRec.readObject()) != null) { runOnUiThread(new Runnable() { public void run() { mAdapter.add(mess); } }); } } } catch (IOException ex) { ex.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } </code></pre> <p>error trace:</p> <pre><code>03-27 23:08:10.800: ERROR/AndroidRuntime(2218): FATAL EXCEPTION: Thread-13 03-27 23:08:10.800: ERROR/AndroidRuntime(2218): java.lang.NullPointerException 03-27 23:08:10.800: ERROR/AndroidRuntime(2218): at com.DrawTastic.ChatActivity.run(ChatActivity.java:149) 03-27 23:08:10.800: ERROR/AndroidRuntime(2218): at java.lang.Thread.run(Thread.java:1019) </code></pre>
java android
[1, 4]
1,899,750
1,899,751
How use keyboard arrow keys to move a div 100px left/right respectively
<p>I have a div with an id of <code>bottom_arrow</code> and I want to use my keyboard arrows left/right to move the div left and right 100px. How can I do this?</p>
javascript jquery
[3, 5]
5,915,908
5,915,909
how to keep track of accordion(in masterpage) open status after page navigation?
<p>i am using jquery accordion as a menu in asp.net Masterpage.</p> <p>This is jquery</p> <pre><code>$(document).ready(function() { $(".header").click(function() { $(this).toggleClass("display"); $(this).next("div .menu_body").slideToggle(500); }); }); </code></pre> <p>This is html.</p> <pre><code> &lt;div id="MasterPage_Menu" class="menu_list"&gt; &lt;p class="header"&gt;Header-1&lt;/p&gt; &lt;div class="menu_body"&gt; &lt;a href="page1.aspx"&gt;Link-1&lt;/a&gt; &lt;/div&gt; &lt;p class="header"&gt;Header-2&lt;/p&gt; &lt;div class="menu_body"&gt; &lt;a href="page2.aspx"&gt;Link-2&lt;/a&gt; &lt;/div&gt; &lt;p class="header"&gt;Header-3&lt;/p&gt; &lt;div class="menu_body"&gt; &lt;a href="page3.aspx"&gt;Link-3&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>According the code above, when the header is clicked, the content (menu_body) will be slided toggle. The menu_body is hide at default, when the user click on the header, the menu_body is visible. </p> <p><strong>Example Problem:</strong> eg: 2 menu_body is visible, when i click on href = "page1.aspx", the page will be navigated to page2.aspx but the accordion will return to be default which all the menu_body is hidden.</p> <p>Since I am using this accordion in master page, i fail to store the value to keep track of the accordion menu_body status into the hiddenfield when the page is navigated away. The value in hiddenfield will be reset. </p> <p>I am thinking to store this in session, but in client page, it doesn't allow us to store value into the session.</p> <p>Any solution for this?</p>
javascript jquery asp.net
[3, 5, 9]
4,734,389
4,734,390
Tilde in jQuery selector
<p>My understanding of the tilde's function in Javascript is that it performs a bitwise not operation (i.e. 1 becomes 0 and vice versa; 1000 becomes 0111). However, I've recently begun work on an existing project where my predecessor has included a lot of code like this: </p> <pre><code>var iValuation = $('div[class~="iValuation"]'); </code></pre> <p>Can anyone tell me what the purpose of the tilde in this instance is? I've not come across it before and haven't been able to find any reference to it online.</p>
javascript jquery
[3, 5]
5,302,586
5,302,587
Javascript; check if a variable is 1 or 0
<p>I'm using a variable in Javascript which will be set via Php e.g. <code>var usesInterview = &lt;?php echo 1;?&gt;</code></p> <p>If not, then <code>var usesInterview = &lt;?php echo 0;?&gt;</code></p> <p>How best should I handle this in my code? There will be a If statement to check for the variable and determine the route to take.</p> <p>I've tried using <code>typeof() == 1</code> and when I set it to 0, it still carries out the routine as if it where 1.</p>
php javascript
[2, 3]
741,826
741,827
jquery "hasClass()" not working?
<p>I need to hide a div if another div has a class.</p> <p>I've created a very basic example <a href="http://jsfiddle.net/sC3Yq/1/" rel="nofollow">HERE</a></p> <p>I need the div on the bottom to hide when the word "click" is.. well.. clicked. It adds a class to the middle div just fine, but it seems <code>hasClass()</code> doesn't want to work?</p> <p><strong>NOTE:</strong> The structure needs to be like this. If "click" is clicked, modify the middle div (add class?), and manipulate the bottom div based on the middle div. With this setup - I can't just do "if CLICK is clicked, slideUp() the bottom div".</p> <p>Also, once "ok" or "cancel" is clicked, it will revert, because the middle div will no longer have the class. Provided that's the method I can get working here, haha.</p>
javascript jquery
[3, 5]
5,456,002
5,456,003
Best way to submit UL via POST?
<p>Quick question...</p> <p>I have an input box that upon key enter, adds the value to an unordered list. How would I pass this unordered list to jquery post? I'm using the form.serialize, so I don't have to define each variable for posting. </p> <p>Example, let's say I entered 3 fruits and they get dynamically added to an unordered list inside the form.</p> <blockquote> <p>Fruit: [input text here]</p> <ul> <li>Apple</li> <li>Banana</li> <li>Pear</li> </ul> </blockquote> <p>I was thinking of creating a hidden text field that would populate with the new value everytime the user pressed enter.</p> <p>Any other thoughts?</p>
php jquery
[2, 5]
5,140,895
5,140,896
Addition of contextmenu for gridview in asp.net
<p>I want to bind each and every row in my gridview with context menu. That menu should contain options like Edit , Delete . can anybody please give me a sample code for that and also I want to know where can I get this contextmenu.dll file. Please help me out, I have tried every kown way. Thank you.</p>
c# asp.net
[0, 9]
2,934,760
2,934,761
php variables won't save properly
<p>I'm posting to a php script, and I want to update some already existing variables in the script. My javascript is this :</p> <pre><code>$('.submit_html').click( function(e) { e.preventDefault(); var requested = $('.page_select').val(); var text = new Array($('.edit_html').val(), $('.header_val').val()); $.post('data_handlers/get_content.php', {page: requested, action: 'update', text: text}, function(data) { alert(data); }); }) </code></pre> <p>There really isn't anything complicated about the post, just a couple variables to tell the script what to do, and then a text variable, with the data in the first two spots of the array.</p> <p>On the php side, I know it is getting the data correctly, but when I try to overwrite the current variable in the script, it doesnt stay saved after the php script completes.</p> <p>php code:</p> <pre><code>if ($page == 'home') { $home = $text[0]; $home_head = $text[1]; return; } </code></pre> <p>So obviously, it is changing the variables during the execution, but reverting to the values that were manually saved in the script before. Is there anyway to actually have the values stay changed after the script ends?</p>
php javascript
[2, 3]
2,461,441
2,461,442
Change url when manually scrolled to an anchor?
<p>By Default, if I have anchors in my website, then the URL on the address bar is changed, when I click on a link (ie. www.mysite.com/#anchor)</p> <p>Is it possible to change the URL in the address bar instantly when I scroll to an anchor? Or have a long document with multiple anchors and the url changes on address bar, when I hit a new anchor?</p>
javascript jquery
[3, 5]
3,211,424
3,211,425
@Override gives error in eclipse?
<p>When I import project from workspace in eclipse, it gives error at <code>@Override</code> annotation. If the project has any method that has an annotation it displays as an error and when I remove it works fine, but when I have a major project that has a lot of annotations, what should I do fix it?</p>
java android
[1, 4]
633,873
633,874
Can I have send two AlarmManager in a application
<p>I have two class, A, B in these classes. Both of them I have a alarmmanager like next;</p> <pre><code>class A{ PendingIntent sender; AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); .......... am.set(AlarmManager.RTC_WAKEUP, atTimeInMillis, sender); </code></pre> <p>}</p> <pre><code>class B{ // some code like Class A} </code></pre> <p>Then, both A and B send the PendingIntent to a BroadcastReceiver B. I think it's wrong to have two AlarmManger in a Application. can you tell me the truth. I want to do like that, because I want to trigger a notifiction in c instead of a service. because I think service is a waste to do that.in class A I want to trigger something else. Besides what I want to do can't be do in class A .so I want to do it in class B individually.</p>
java android
[1, 4]
2,563,541
2,563,542
Need to show id in href tag but not navigate into other page
<p>I need to show item id in a href tag ,but it must not navigate into other page... one way to prevent navigation is using jvascriptvoid(0) but can i append it to id... If so how??</p> <pre><code> &lt;a href="id='.$portfolio_id.' "&gt;&lt;img height="57" width="57" src="images/portfolio_uploads/orig_'.$portfolio_item['image'].'"&gt;&lt;/a&gt; </code></pre>
php javascript
[2, 3]
1,156,442
1,156,443
Is rewriting a PHP app into Python a productive step?
<p>I have some old apps written in PHP that I'm thinking of converting to Python - both are websites that started as simple static html, then progressed to PHP and now include blogs with admin areas, rss etc. I'm thinking of rewriting them in Python to improve maintainability as well as to take advantage of my increase in experience to write things more robustly.</p> <p>Is this worth the effort?</p>
php python
[2, 7]
5,548,247
5,548,248
ASP.NET: How to assign ID to a field in DetailsView?
<p>I have a master-detail page, in which I use GridView to display multiple rows of data, and DetailsView + jQuery dialog to display the details of a single records. only one DetailsView is open at a time.</p> <p>I need to be able to pull out a single field of the open DetailsView, for manipulation using JavaScript. Is there a way to give a unique ID to a given field in DetailsView, so I can use getElementByID? Or is there another way to accomplish what I'm trying to do?</p> <p>Thank you in advance.</p>
asp.net javascript jquery
[9, 3, 5]
1,469,957
1,469,958
Passing a jQuery event as a variable
<p>You can do this with JavaScript:</p> <pre><code>function bar(test) { alert(test); } var foo = bar; foo('hi'); </code></pre> <p>I'd like to be able to do something similar with a jQuery event:</p> <pre><code>var foo = $('#bork').click; foo(function() { alert('I was just clicked.'); }); </code></pre> <p>However, I get an error when the page loads: <code>this.bind is not a function</code>. Am I doing something wrong with the events here? Is there a better way to get the same effect?</p>
javascript jquery
[3, 5]
4,214,310
4,214,311
Custom validation rule for tild and tilt character in PHP and Jquery
<p>I need a good validation for tild(~) and tilt(`) character in PHP and Jquery. Here is the Jquery validation what i have made.</p> <blockquote> <p>$.validator.addMethod("validSMS", function(value, element) { if (value.indexOf('~') === -1 || value.indexOf('`') === -1) { return true; } else { return false; } }, "Tild and tilt Character is not allowed");</p> </blockquote> <p>But I need another good method for this validation in Jquery and in PHP also.</p>
php jquery
[2, 5]
3,987,909
3,987,910
c# page_unload firing together with after page_load
<p>So i want to delete some files when a user closes the browser.</p> <p>I'm using the <code>page_unload</code> method shown below: </p> <pre><code> protected override void OnUnload(EventArgs e) { base.OnUnload(e); string[] uploadedFiles = Directory.GetFiles(Server.MapPath("~/testPdfIn")); foreach (string uploaded in uploadedFiles) { File.Delete(uploaded); } } </code></pre> <p>but the <code>page_unload</code> method will just fire right after the page load, deleting the files in folder without the user even closing the browser.</p> <p>Is there a way to stop the <code>page_unload</code> from firing right after loading and only firing when user closes the browser?</p>
c# asp.net
[0, 9]
2,882,908
2,882,909
Passing a JavaScript element ID into PHP or Form Variable
<p>I'm using the google maps API to get a city based on the latitude and longitude of the persons geo-location. I want to take the city name and be able to: display the name, use it as a variable or hidden form field. I found some great code online that runs a lot of this and I've got the code below working to display the city name on the page, however I don't know how to get this into a PHP variable. I'm not very fluid with Javascript so any help would be awesome. Here is the code I have, how do I get the "geo" ID into a PHP variable or even into a hidden form field I can post to another page:</p> <pre><code>&lt;script language="JavaScript"&gt;function updatePage() {if (xmlHttp.readyState == 4){var response = xmlHttp.responseText; document.getElementById("geo").innerHTML = response;}} &lt;/script&gt; &lt;? echo "&lt;span id=\"geo\"&gt;&lt;/span&gt;"; ?&gt; </code></pre>
php javascript
[2, 3]
1,238,623
1,238,624
Can I subscribe my Python script, running on Android, to get Broadcast Events?
<p>Short intro: I have an Android phone and a campus WiFi network, and to be logged in I need to enter the same login and password each time I get connected to it. So I've decidet to write small script, which would do thatt automaticaly.</p> <p>But, as I understood, I have to subscribe to NETWORK_STATE_CHANGED_ACTION event, so the question is - is there any way to do it in Python?</p>
android python
[4, 7]
4,385,239
4,385,240
Which is faster, int to String or String to int?
<p>This may seem like a fairly basic question, for which I apologise in advance.</p> <p>I'm writing an Android app that uses a set of predefined numbers. At the moment I'm working with <code>int</code> values, but at some point I will probably need to use <code>float</code> and <code>double</code> values, too.</p> <p>The numbers are used for two things. First, I need to display them to the user, for which I need a <code>String</code> (I'm creating a custom <code>View</code> and drawing the <code>String</code> on a <code>Canvas</code>). Second, I need will be using them in a sort of calculator, for which they obviously need to be <code>int</code> (or <code>float</code>/<code>double</code>).</p> <p>Since the numbers are the same whether they are used as <code>String</code> or <code>int</code>, I only want to store them once (this will also reduce errors if I need to change any of them; I'll only need to change them in the one place).</p> <p>My question is: should I store them as <code>String</code> or as <code>int</code>? Is it faster to write an <code>int</code> as a <code>String</code>, or to parse an <code>int</code> from a <code>String</code>? My gut tells me that parsing would take more time/resources, so I should store them as <code>int</code>s. Am I right?</p>
java android
[1, 4]
2,811,696
2,811,697
jQuery delegate selector problem
<p>I'm trying to delegate click event to all first anchor tags of all now and future divs with "panels" class. I did something like that:</p> <pre><code>$('#panel').delegate('.panels a:first', 'click', function(event) [...] </code></pre> <p>but that doesn't work. It binds event only to one, first ".panels". Any hints?</p>
javascript jquery
[3, 5]
4,963,775
4,963,776
Jquery click function with button and text
<p>Hello eveyone I'm trying to using click function. When the user clicks the button, a second text will appear and the first one will be display none and then user clicks again using the same button this time third text will appear and the second text will be display and finally click the same button again fourth text will appear third one display none. </p> <p>I have another button that user clicks this button the fourth text will be display none and the third text will appear and click again this button the third text will display none second text will appear and finally click this button second will diplay none the first text will appear. Here is my function:</p> <pre><code> $("#slider1next").click(function () { var $next = $(".text:visible").hide().next(); $next.length ? $next.show() : $(".text:first").show(); }); $("#slider2next").click(function () { var $next = $(".text:visible").hide().next(); $next.length ? $next.show() : $(".text:first").show(); }); </code></pre> <p>​ Here is my html:</p> <pre><code>&lt;button id="slider1next" &gt;Clickme&lt;/button&gt; &lt;p class="text" id="first_one"&gt;This is the first text&lt;/p&gt; &lt;p class="text" id="second_one" style="display:none"&gt;This is the second text&lt;/p&gt; &lt;p class="text" id="third_one" style="display:none"&gt;This is the third text&lt;/p&gt; &lt;p class="text" id="fourth_one" style="display:none"&gt;This is the four text&lt;/p&gt; &lt;br/&gt; &lt;button id="slider2next" &gt;Clickme&lt;/button&gt; </code></pre> <p>And also you can see there </p> <p><a href="http://jsfiddle.net/ganymedes/7kxAE/2/" rel="nofollow">http://jsfiddle.net/ganymedes/7kxAE/2/</a></p> <p>Please help me</p>
javascript jquery
[3, 5]
2,119,001
2,119,002
change src image onload
<p>script:</p> <pre><code> function SetProductImageLeft (img,idProduct){ var address="Image/ProductImage/"+id+".png"; $(img).attr('src', address); } </code></pre> <p>html:</p> <pre><code>&lt;img onclick="alert();SetProductImageLeft(this,1);" onload="alert();SetProductImageLeft(this,1);" &gt; &lt;img onclick="alert();SetProductImageLeft(this,2);" onload="alert();SetProductImageLeft(this,2);" &gt; &lt;img onclick="alert();SetProductImageLeft(this,3);" onload="alert();SetProductImageLeft(this,3);" &gt; </code></pre> <p>onclick show alert(); and run function success but onLoad does not show alert(); and function;</p> <p>i like show image when page load.set images in onload</p>
php javascript jquery asp.net
[2, 3, 5, 9]
3,182,804
3,182,805
Trigger click function on load
<p>I have the following function which is activated on click:</p> <pre><code>$('.results .view-rooms').click(function(){ } </code></pre> <p>Is there anyway I can trigger this function on document load?</p>
javascript jquery
[3, 5]
600,755
600,756
JS: adding text to text area issue
<p>Hi I'm trying to implement a solution that was posed on this question: <a href="http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery">http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery</a></p> <p>But coming unstuck.</p> <p>This flat function works fine when adding some dummy text into a textarea element:</p> <pre><code>function add_to() { $('#ad_textarea').val($('#ad_textarea').val()+'test'); } </code></pre> <p>However, when I try to wire up this function to a variable, it breaks:</p> <pre><code>function add_to(word) { $('#ad_textarea').val($('#ad_textarea').val()+word); } </code></pre> <p>when being called from this line of code:</p> <pre><code>&lt;?php foreach ($words as $word) { echo "&lt;li class='$word[0]'&gt;&lt;a href='#' onclick='add_to('$word');'&gt;$word&lt;/a&gt;&lt;/li&gt;"; } ?&gt; </code></pre> <p>I have looked at the outputted code, and it looks clean:</p> <pre><code>&lt;li class='a'&gt;&lt;a href='#' onclick='add_to('aardvark');'&gt;aardvark&lt;/a&gt;&lt;/li&gt; </code></pre> <p>I'm ultimately trying to get aardvark to print out in the textarea. Can anyone spot my slip up?</p> <p>TIA</p>
javascript jquery
[3, 5]
2,172,422
2,172,423
jquery POST method callback function query
<pre><code>$("#submit_js").click(function() { var commentmsg = $('#comment').val(); $.post( "user_submit.php", {comment: $("#comment").val(), aid: imgnum, uid:$("#uid").val()}, function(data){ /*alert(data);*/ //$('#greetings').html('Your choice was submitted successfully. Thank You for voting.'); $('#confirm_msg').addClass("on"); $('#care_parent').addClass("off"); $('#fb_user_msg').html(commentmsg); //$('#fb_user_msg').html( commentmsg ); }); }); </code></pre> <p>the above is my jquery POST function. in the callback function i am doing some html stuff. this is the successful POST version. that means, when the POST procedure is complete or added to the DB. now in my user_Submit.php i am checking to validate whether I should add the data to the DB or not. </p> <p>Can the callback function be modified so that if I dont add to the DB in user_Submit.php, I should display some other message to the user...</p> <p>what I really want to ask is, how to make PHP pass a 0/1 value ot JS? can someone help?</p>
php javascript jquery
[2, 3, 5]
3,716,719
3,716,720
how to tell a string is all in english in php or javascript?
<p>how to tell a string is all in english of php. eg:$test="eeeeeeeeeeeee" how to tell that the <code>$test</code> string is writen all in english.</p>
php javascript
[2, 3]
4,999,344
4,999,345
Get image size using JQuery/ javascript
<p>please tell me how to get image size of all images in the page using jquery or javascript</p>
javascript jquery
[3, 5]
415,488
415,489
Dynamically created divs get hidden after postback
<p>I have several divs in a nested gridview which are bound to att runtime with the command div id="div&lt;%# Eval("id") %>". I then set the visibilty of the div via javascript. The problem is that the visibilty setting isnt retained between postbacks. (Im using a filter feature that filters the rows in the nested gridview). </p> <p>How can I retain the visibilty settings for all the divs created dynamically? (Could be up to fifty divs.)</p>
c# asp.net
[0, 9]
4,525,747
4,525,748
jQuery - On escape, close window if overlay not open
<p>When the escape key is pressed, I would like to close a child window, but first check for open overlays. If an overlay is open and the escape key is pressed, I only want the overlay to close. If the user presses escape again, I want it to close the child window.</p> <p>So, I first need to check whether an overlay is open. All my overlays have a class of <code>.simpleOverlay</code> and a close button with the class <code>.closeOverlayBtn</code>, so I thought of having a function that checks if that class has focus, before closing the window, like so:</p> <pre><code>if (e.keyCode == 27) { // "Esc" Key if ( $('.simpleOverlay').is(':focus') ) { $('.closeOverlayBtn').trigger('click'); } else { window.close(); } return(false); } </code></pre> <p>But this is not happening!! If I replace the <code>.trigger</code> line with an <code>alert()</code>, I get alerted when the overlay is closed and open, not good!</p> <p>Is this the right way to go about this or am I completely missing something?</p>
javascript jquery
[3, 5]
1,177,312
1,177,313
on checking one item in custom list view another get automatically selected?
<p>Checking on one item in custom list view and another get selected in Android. I'm using custom adapter list view with check box.</p> <p>I'm using check boxes in list view. and I'm using following code for check box count. i.e how many check box are selected. </p> <pre><code>final int listItemCount = screenList.getChildCount(); for (int i = 0; i &lt; listItemCount; i++) { CheckBox cbox = (CheckBox) ((View) screenList.getChildAt(i)) .findViewById(R.id.checkBox); if (cbox.isChecked()) { count++; } } </code></pre> <p>But while I'm getting <code>count=listItemCount</code> there are some numbers are not shown checked in the list view.</p>
java android
[1, 4]
4,110,113
4,110,114
ASP.NET with Javascript disabled
<p>As you probably know, ASP.NET injects some javascript code to the form, like so:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; &lt;/script&gt; </code></pre> <p>Now, the problem with this is that if I turn Javascript off (using WebDev toolbar in FF), I get </p> <p>"Browser does not support script" at the top of the page.</p> <p>Does anyone know how I can set this tag, for this bit of auto-injected js?</p> <p>Thanks Duncan</p>
asp.net javascript
[9, 3]
602,658
602,659
When to fetch more content on infinite scroll?
<p>I'm building out an infinite scrolling feature for my site and am debating at what scroll point to inject more content into the page. I've seen some that perform the request at a fixed pixel distance from the bottom of the document, and others that feel more percentage based. What do large sites like Tumblr, Facebook, Pinterest, etc. do? Are there different use cases between fixed pixel distance and percentage? Here's my code:</p> <pre><code>// 20% var scrollPoint = ($(document).height()/5); if($(window).scrollTop() &gt;= $(document).height() - $(window).height() - scrollPoint) { console.log('Load more goodness'); } </code></pre> <p>Edit: On re-examining Facebook, it almost looks like they have a 'hot zone' where they pull in more content. If you use the mouse to scroll to the bottom you don't get an auto fetch of content.</p>
javascript jquery
[3, 5]
1,509,974
1,509,975
c# browse for a image on web applications and display it
<p>What would be the best way to create a C# Web Application that allows the user to browse for an image and then display it? An equivalent of Picturebox in windows applications, sort of</p> <p>Ideally the user should be able to click on Browse, choose the picture and see it in the browser itself</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,253,698
3,253,699
Does an asp.net common page to CRUD all the tables in DB exist?
<p>I want a page for super admin to CRUD all the tables in DB. Admin can use one asp.net page to select specific Table on a dropdownlist and can perform CRUD operation on that page.</p> <p>I think that's a common topic for db access, searched but not found such module. Can anyone give me advice?</p>
c# asp.net
[0, 9]
3,213,656
3,213,657
Finding already playing ringtone
<p>How can I find whether ringtone is already playing? If it is already playing then do not play it again.</p>
java android
[1, 4]
817,491
817,492
Change the summary of a ListPreference with the new value (Android)
<p>How can I modify the summary of a ListPreference to the new "Entry" string selected by the user (not the entry value)</p> <p>I suppouse its with setOnPreferenceChangeListener() but in</p> <pre><code>new OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { return true; } } </code></pre> <p>using ((ListPreference)preference).getEntry() I get the old value (because it isn't changed yet) and newValue.toString() returns the entry value (not the entry text displayed to the user)</p> <p>How can I do it? Thanks in advance</p>
java android
[1, 4]
4,954,825
4,954,826
jquery click on link?
<p>After an event is triggered, how do I make jQuery click on a link with an <code>id</code> of <code>mylink</code>?</p>
javascript jquery
[3, 5]
2,639,587
2,639,588
PHP class to validate javascript syntax
<p>Do you have any ideas where to find a PHP class (library) which can validate JavaScript syntax?</p> <p><strong>Result</strong>: it seems that there is no such library which is available to download, so the only solution is to write own. Thank you all.</p>
php javascript
[2, 3]
4,990,666
4,990,667
how can change the text string to date object?
<p>i am getting string from server and i need to covert that fetching string in to new date object.. for doing this, i tried this function, but no use, any one can help me to convert strings to date object?</p> <p>my code is :</p> <pre><code>var nationZone = { getNewYorkLocalTime : 'getTime.php?lat=40.71417&amp;lan=74.00639', getLondonLocalTime : 'getTime.php?lat=51.5&amp;lan=0.1166667', getChennaiLocalTime : 'getTime.php?lat=13.0833333&amp;lan=80.2833333', getBangaloreLocalTime:'getTime.php?lat=12.9833333&amp;lan=77.5833333' } $.each(nationZone , function(key, value){ $.get(value, function(response){ var newdate = $(response).find('localtime').text(); if(key == "getNewYorkLocalTime"){ var newyourktime = new Date(newdate); newyourktime.getTime() } }); }); </code></pre> <p>but, the newyourktime is showing local time only.. any help please? as well i am getting the response from server is : 17 Nov 2011 18:09:47 - like this.</p>
javascript jquery
[3, 5]
1,891,104
1,891,105
How to highlight the first 10 characters of text using Javascript or jQuery?
<p>I want to highlight the first 10 characters of text and also color occurrences of the word "paragraph".</p> <pre><code>&lt;html&gt; &lt;body&gt; This is a heading This is a paragraph.This is another paragraph. &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
126,879
126,880
Creating a prompt with a one touch button inorder to create shortcut to android homescreen
<p>I am new to android development and do not know the specific prompt and create codes to accomplish the following. </p> <p>I have a website ( <a href="http://www.hibbertmcgee.com" rel="nofollow">http://www.hibbertmcgee.com</a> ) that, when someone logs into from a mobile device, I would like them to be prompted to add the site shortcut to their homescreen. I have accomplished this before on apple ios using the following code.</p> <pre><code>&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;link rel="apple-touch-icon-precomposed" href="img/shortcut-icon.png" /&gt; &lt;link rel="stylesheet" href="css/add2home.css"&gt; &lt;script type="text/javascript"&gt; var addToHomeConfig = { animationIn: 'bubble', animationOut: 'drop', lifespan:30000, expire:2, touchIcon:true, message:'Thank your for visiting our site on your &lt;strong&gt;%device&lt;/strong&gt;. To add our web app, click this icon `%icon` and select "Add to Homescreen" .' }; &lt;/script&gt; &lt;script type="application/javascript" src="js/add2home.js"&gt;&lt;/script&gt; </code></pre> <p>I am able, for the most part, to detect an android device, however I do not know the scripting to bring up a prompt to allow people to bookmark the site to their home screen. I don't need you to write the code for me(unless you really want to), just point me in a general direction or toward a specific resource.</p> <p>Thanks So Much,</p> <p>~Andrew Glover</p>
php javascript android
[2, 3, 4]
3,079,620
3,079,621
JQuery: using .LIVE problems
<p>I have the following JQuery code:</p> <pre><code>$("#myDIV li:eq(0)").live('click',function(){ funcA(); }); $("#myDIV li:eq(1)").live('click',function(){ funcB(); }); $("#myDIV li:eq(2)").live('click',function(){ funcC(); }); $("#myDIV li:eq(3)").live('click',function(){ funcD(); }); </code></pre> <p>And realized it's really inefficient.</p> <p>So I tried the following, which I believe is much more effect; however, the code does not work:</p> <pre><code>var tab_node = $("#myDIV li"); tab_node.eq(0).live('click',function(){ funcA(); }); tab_node.eq(1).live('click',function(){ funcB(); }); tab_node.eq(2).live('click',function(){ funcC(); }); tab_node.eq(3).live('click',function(){ funcD(); }); </code></pre> <p>Any idea how I can make my code more efficient while also work?</p> <p><strong>UPDATE:</strong></p> <p>From the answers below, it sounds like these two statements are not equalavent.</p> <p><em>New Question:</em> Is there any way to run my original code more efficient?</p>
javascript jquery
[3, 5]
5,929,623
5,929,624
Are JavaScript functions asynchronous?
<p>Consider the following function being executed,</p> <pre><code>function loadPage() { takeInput(); processInput(); outputInput(); } </code></pre> <p>In what order would they be executed(I have <a href="http://www.slideshare.net/clutchski/writing-asynchronous-javascript-101" rel="nofollow">read</a> that it follows stack so option 2 will be the answer)?</p> <p><strong>Option #1</strong></p> <ol> <li>takeInput(); </li> <li>processInput();</li> <li>outputInput();</li> </ol> <p><strong>Option #2</strong></p> <ol> <li>outputInput();</li> <li>processInput();</li> <li>takeInput();</li> </ol>
javascript jquery
[3, 5]
4,816,702
4,816,703
How do I retrieve the textnode of a element without getting descending elements textnodes using Jquery?
<p><code> &lt;a href="#"&gt;Domain name&lt;span class="value"&gt;2&lt;/span&gt;&lt;/a&gt; </code></p> <p>I would like to retrieve only the text "Domain name".</p> <p>I have tried using $('a').text() but that will also get the text inside the descending SPAN tag. Is there a way to select only the first text node inside the A tag somehow?</p> <p>I can't figure out how.</p> <p>.contents('not:(span)') do not work either.</p>
javascript jquery
[3, 5]
4,413,167
4,413,168
Insert/Update values in a gridview
<p>What would be the best way to Insert/Update the values in a Grid view on clicking a save button placed somewhere. in the page . I dont want that to be done like Using Insert Item template and EditItemTemplate.</p> <p><b>My thought:</b> "Loop through each row of Gridview and connecting to database and execute the command and close the connection."</p> <p>Or is there any way so that we can connect to database only once and perform Insert/Update operations.</p> <p>any suggestions would be appreciated..</p> <p>Thanks in advance. </p>
c# asp.net
[0, 9]
396,078
396,079
simple jquery event handler
<p>having some real problems with jquery at the moment. Basically what I have so far is. The form is submitted once the form is submitted a grey box pop's up with the relevant infomation.</p> <p>What I need to do though is refresh the whole page then allow the grey box to appear.</p> <p>I have the following code</p> <pre><code> $("#ex1Act").submit(function() { //$('#example1').load('index.php', function() $("#example1").gbxShow(); return true; }); </code></pre> <p>the line which is commented out load's the page again after the form is submitted the other code makes the grey box pop-up.</p> <p>Is their a way to say once the:</p> <pre><code>$('#example1').load('index.php', function() </code></pre> <p>has been exucted do this:</p> <pre><code> $("#example1").gbxShow(); </code></pre> <p>hope this makes sense.</p>
javascript jquery
[3, 5]
567,728
567,729
ASP.NET jQuery Ajax posting forms
<p>I can't seem to get the jQuery.ajax() function posting back any of my asp.net generated form controls.</p> <p>I've put a break point on the server side and there aren't any values.</p> <p>Is there a way around this or do I have to build up a list of what I want sent back?</p> <p>Another question slightly off topic, but it seems that although jQuery is a great JS library, it doesn't seem to integrate too well with .net.</p> <p>Has anyone given up with jQuery to perform server side interaction and just gone with ms ajax implementation?</p>
asp.net jquery
[9, 5]
4,763,856
4,763,857
definitive removing urls in a textbox
<p>I have a comment box and do not want people to post urls.</p> <p>the site is written in c# asp.net</p>
c# asp.net
[0, 9]
127,590
127,591
jquery Ellipse: How To Create Ellipse shape Gallery With jQuery
<p>This code is somewhat near to ellipse shape. I want my gallery shape to be arrange is ellipse shape like cloud carousel example. Right now i am using roundabout plugin shape tearDrop and below function used for tearDrop. I require similar function for ellipse shape.</p> <pre><code>tearDrop: function (a, b, c) { return { x: Math.sin(a + b), y: -Math.sin(a / 2 + c) + .35, z: (Math.cos(a + b) + 1) / 2, scale: Math.sin(a + Math.PI / 2 + b) / 2 + .5 } }; </code></pre>
javascript jquery
[3, 5]
4,296,063
4,296,064
Use jQuery to fade image out
<p>I am using the following script to fade an image out after 5 seconds: </p> <pre><code>var $j = jQuery.noConflict(); $j(document).ready(function() { var fade_out = function() { $j("#fadeout").fadeOut().empty(); } setTimeout(fade_out, 5000); }); </code></pre> <p>When the image goes away it just disappears. I want the image to slowly fade out over a second or so. How can I do this? </p>
javascript jquery
[3, 5]
684,000
684,001
javascript: Swap image & onClick
<pre><code>&lt;img src="logo.jpg" class="myImage" alt="Logotyp" /&gt; </code></pre> <p>This is my javascript code:</p> <pre class="lang-js prettyprint-override"><code>$(function() { var windowWidth = $(window).width(); if (windowWidth &lt;= 480) { $(".myImage").attr("src", "load.jpg"); } }); </code></pre> <p>The image logo.jpg becomes load.jpg when window width = 480. Works fine. But I want an onClick-function that says when you click load.jpg it becomes logo.jpg again. Can't seem to make it work. Suggestions?</p>
javascript jquery
[3, 5]
4,364,989
4,364,990
how to call javascript/jQuery when javascript is disabled in mozilla/ie?
<p>how to call javascript/jQuery when javascript is disabled in mozilla/ie ?</p>
javascript jquery
[3, 5]
1,510,514
1,510,515
btnAdd_Click fires when i press F5
<p>Hi I've a simple code to insert data into db in button click event. It is executing fine and insert data into db. After inserting data if i press f5 button it is again inserting a new row into db with the same values.</p> <p>Button click event fires on each f5 button (refresh)</p> <p>Wat is the problem?</p> <p>Thank you, Nagu</p>
c# asp.net
[0, 9]
3,718,335
3,718,336
How can i get Equivalent method of HttpwebRequest in javascript
<p>As we all know HttpwebRequest loads another page behind the scenes without redirecting the client to the other page. </p> <p>How can I get this functionality using Javascript/Jquery?</p> <pre><code>$(document).ready(function () { debugger; var ip = '&lt;%= Request.UserHostAddress%&gt;'; var location = window.location.href; var Browser = BrowserDetect.browser; var Version = BrowserDetect.version; var Os = BrowserDetect.OS; var SendItems = 'Ip=' + ip + '&amp;location=' + location + '&amp;Browser=' + Browser + '&amp;Version=' + Version + '&amp;Os=' + Os; var HttpWebReq = ? </code></pre> <p>I want to pass these values as a query string to the other page :S </p>
c# javascript jquery asp.net
[0, 3, 5, 9]
3,754,663
3,754,664
Variable jquery parameter name
<p>I have a set of PHP language files which I use to output text to the user based on the their language choice. I have passed the PHP variables to javascript successfully and they are available as <code>LANG</code> You can see it in use in the code.</p> <p>Here is my question... Since the code as shown below works perfectly, why can I not change this line...</p> <pre><code>'No': { 'class' : ''}} </code></pre> <p>to</p> <pre><code>LANG.no: { 'class' : ''}} </code></pre> <p>Basically I want to know why I can use <code>LANG</code> elsewhere in the code but not in the line shown above or in the equivalent "Yes" line.</p> <p>Here is the working code:</p> <pre><code>$.confirm({ 'title': LANG.return_to_exhibit_lobby, 'message': "&lt;strong&gt;"+LANG.return_to_exhibit_lobby_confirmation+"&lt;/strong&gt;", 'buttons': { 'Yes': { 'class': 'special', 'action': function(){ window.location.href='logout.php'; }}, 'No': { 'class' : ''}} }); </code></pre>
javascript jquery
[3, 5]
4,876,016
4,876,017
How to randomly settext in texviews in android?
<p>I have 4 string arrays,each of these array's length is 4. I also have four textviews . Now I want to randomly settext of that array's indexes in the textviews. I have done this:</p> <pre><code>ansone.setText(Answera[0]); anstwo.setText(Answerb[0]); ansthree.setText(Answerc[0]); ansfour.setText(Answerd[0]); </code></pre> <p>but its keeps the same sequence everytime I run the application, I want to randomly select the arrays in different textviews like some time 'ansone' textview will set the text of Answerb[0], or 'anstwo' textview will set the text of Answerd[0] and so on. Thus everytime I run the application the textviews will randomly select the arrays from where it will be set text. How can I make it random? </p>
java android
[1, 4]
2,727,707
2,727,708
Android Calender.getTimeInMillis() units?
<p>I am using Android's Calendar object and I am using the getTimeInMillis() method, but when I look at the Value it gives me it is a really long number. I am trying to replicate this format but I don't know how as when I take the current time in 24 hour mode and convert it to milliseconds I am completely off.</p> <p>Example:</p> <p>Calendar.getTimeInMillis() : at 11:46 pm = 1,349,585,220,205</p> <p>Time at 11:46 pm using formula[(23 * 60 * 60 * 1000) + (46 * 60 * 1000)] = 85,560,000</p> <p>I'm wondering if there is some kind of formula the calendar is using to convert the current time to Milliseconds and how I can replicate this. </p> <p>Thank you!</p>
java android
[1, 4]
443,208
443,209
how to auto redirect a page based on given time? should i use javascript ? how?
<p>let's say i have this code</p> <pre><code>$itemtoDisplayTime = $model-&gt;getItemTime() // e.g 03:00pm $currentTime = date('H:i'); //this is the system clock/time </code></pre> <p>is it appropriate to use javascript to automate the process of redirection without having to refresh the page ? if so, how ?</p> <p>let's say the $itemDisplayTime is now equal to $currentTime , how to use these variables in javascript or jquery if possible </p>
php javascript jquery
[2, 3, 5]
842,519
842,520
PHP with Javascript: Email confirmation script not working
<pre><code> echo "&lt;script type=\"text/javascript\"&gt; function finishForm() { var answer = confirm('Are you sure these are the teams you want to enter with?'); if (answer) { if(document.getElementByID(emailconfirm).value == ".$_SESSION[Email].") { form.action=\"esubmit.php\"; form.submit(); } else { alert('E-mail address do not match'); return false; } } } function restartForm() { var answer = confirm('Are you sure you want to start over?'); if (answer) { form.action=\"e1.php\"; form.submit(); } } &lt;/script&gt;"; </code></pre> <p>I have a regular button calling this function. emailconfirm is a text input.<br> I want to confirm that they have chosen the right teams, then check if the email in the session and the email confirmation text match. If they do match Then i want to submit the form.<br> If they dont match, I want to alert the user they dont match, and just return to page so user can check emails and then resubmit.<br> This script is in my header.</p> <p>EDIT: Haha sorry i submitted one before and it didnt go through, forgot to add my problem!!</p> <p>When you click the button it comes up with the confirmation, clicking either yes or no doesnt do anything. The alert doesnt pop up if they dont match and if they do match it doesnt submit. Also it might be good to note I had it without the email confirmation if statement and it worked fine (going to the submit page)</p>
php javascript
[2, 3]
900,635
900,636
on() jquery not work with dynamic page?
<p>I want to use the jQuery <code>.on()</code> function with click. Below is my code, currently it doesn't work, does this contain an error? </p> <pre><code>$('#header-left-container').prepend( results.rows.item(i).LibelleTypeTravail + "" + "&lt;br&gt;" + "&lt;img src='../js/images/add.png' id='img_go' class='upvote' name="+results.rows.item(i).IdTypeTravail+" &gt;" + "&lt;textarea rows='6' cols='60' id='" + results.rows.item(i).IdTypeTravail + "'name='"+ results.rows.item(i).LibelleTypeTravail + "'&gt; &lt;/textarea&gt;&lt;br&gt;&lt;br&gt;" ).trigger("create"); $(".upvote").on("click", function() { window.localStorage.setItem("id_grp", id_grp_tr); window.localStorage.setItem("id_travail", e.target.name); $.mobile.changePage('../prestation_html/list_rubrique.html'); }); </code></pre>
javascript jquery
[3, 5]
2,234,702
2,234,703
JQuery - Extend and Access Superclass
<p>Is there a way to access the super object when extending objects using $.extend?</p> <p>I would like to extend an object, override a method, but call the overridden superclass method in the subclass method. </p>
javascript jquery
[3, 5]