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
3,710,604
3,710,605
Downloading a file from server and save it in client
<p>I am currently developing an ASP.net application, where I generate a word document in server and I want to save it in client machine who access that feature with out user interactions. How can I download it and save it in client machine, using Javascript?</p>
c# javascript asp.net
[0, 3, 9]
1,119,134
1,119,135
jquery - target label with no adjacent "select" input
<p>I want to use the labelsFX plugin to turn label text into text in input fields which fade out on focus. This is fine apart from the fact that select dropdown boxes break if i try to apply the effect to the adjacent label. So I only want to apply this effect where the label is adjacent to a text or textarea input field.</p> <p>So what I want to do is something like this, but it's clearly not right - anyone know how to fix this?</p> <pre><code>$('label').next('not:(select)').labelsFX(); </code></pre>
javascript jquery
[3, 5]
5,830,133
5,830,134
Image Photo Gallery ---> Jquery. Next and Prev buttons
<p>As I am having only 4 solutions i.e. 4images/videos and I am clicking on next button then why the empty row is showing, again if am clicking on next then the normal 4 solutions are coming.</p> <p>Please check it out once. that empty row should not come. I need a help</p> <p><a href="http://jsfiddle.net/T657N/51/" rel="nofollow">http://jsfiddle.net/T657N/51/</a></p>
javascript jquery
[3, 5]
1,315,170
1,315,171
How do I attach jQuery .live() to this snippet of code?
<p>I'm using a plugin called cloud zoom. the problem is, it attaches itself to anything with <code>class="cloud-zoom"</code> when the DOM is ready. My problem is I don't attach that class to DOM elements at render time. It is appended dynamically. So I need somehow to mix .live() with it to make it work:</p> <pre><code>$(document).ready(function () { $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom(); }); </code></pre> <p>.live() expects an event. I'm not sure how to specify an event called invoke CloudZoom() on any element that gets injected into the DOM with the class cloud-zoom.</p>
javascript jquery
[3, 5]
3,557,613
3,557,614
How to load the application in Web-View in a specific browser like Chrome or Firefox in Android
<p>I am new to Android, i am doing an application where i need to load our existing application in Web-View on Tablet. In the Tablet when i load my application by using Web-View my application is getting loaded in default browser. </p> <p>How can i load my application in a specific browser[like Chrome or Firefox] in Web-View on Tablet?</p>
java android
[1, 4]
497,018
497,019
Jquery - Is it possible to rename a js function?
<p><br /> hope someone can help me.<br /><br /></p> <p>I have a function like</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; function my_test() { ... some code ... } &lt;/script&gt; </code></pre> <p>Is it possoble to rename (or clone) this function to <code>my_test_2()</code> ?</p> <p>Thanks in advance!<br />Peter</p>
javascript jquery
[3, 5]
4,660,564
4,660,565
Multiple custom validator using same function
<p>I implemented a generic logic client side and server side to use the same function in multiple custom validators. I'm currently testing it but it's only displaying the error message of the first control that fails and not the others. Can I pass the same function to multiple custom validators or do I need to create a separate function for each custom validator.</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,167,109
3,167,110
Best way to execute a javascript and php csv export script
<p>I have a PHP page which generates an HTML table. At the bottom of the page, you can click a 'submit' button and the data from the table is sent to a jquery script called Table2CSV (<a href="http://www.kunalbabre.com/projects/table2CSV.php" rel="nofollow">link here</a>) which takes the data, and submits to another php script for CSV export. </p> <p>Ultimately, all of the action takes place here:</p> <p></p> <pre><code>&lt;form action="getCSV.php" method ="post" &gt; &lt;input type="hidden" name="csv_text" id="csv_text"&gt; &lt;input type="submit" value="Get CSV File" onclick="getCSVData()" &lt;/form&gt; &lt;script type="text/javascript"&gt; function getCSVData(){ var csv_value=$('#example2').table2CSV({delivery:'value'}); $("#csv_text").val(csv_value); } &lt;/script&gt; </code></pre> <p>What I'd like to do is generate the csv script without ever having to output the html table to the screen (via a link click on another page). </p> <p>I think I ultimately need to simply change the javascript function above to call getCSVdata on page load then run getcsv.php but not sure how to do that exactly as I'm not very familiar with JS.</p> <p>Any suggestions?</p>
php javascript jquery
[2, 3, 5]
46,596
46,597
Library to read MANY document-file formats?
<p>I am developing an ASP.NET in which I have a "file upload" control. So, User may upload files of any format like .doc, .pdf, .docx, .txt, .rtf, .ppt, .odt etc.</p> <p>The program must be able read data from any file of these formats. I dont want to use different third party libraries for each of these file formats. I want one common solution to read all these files.</p>
c# asp.net
[0, 9]
628,812
628,813
Best practice for testing return value of indexOf
<p>What do you normally write when you're testing for the return value of indexOf?</p> <pre><code>if str.indexOf("a") &lt; 0 </code></pre> <p>vs</p> <pre><code>if str.indexOf("a") == -1 </code></pre> <p>Would one method be preferred over the other?</p> <p>I'm actually posing this question for any function in any language that returns -1 on error.</p> <p>I normally prefer the &lt; 0 approach, because if the function is extended to return -2 on some other case, the code would still work.</p> <p>However, I notice that the == -1 approach is more commonly used. Is there a reason why?</p>
java javascript
[1, 3]
2,186,020
2,186,021
How to force quit the Android app and restart it?
<p>My Android app has a <code>WebView</code> that requires the Flash plugin. The webview will provide a Market link to Adobe Flash if it's not installed. After installing Flash, the only way to instantiate it in my app is to force quit and restart the app. I would like to present a button to the user that does this for them because it's too complicated for casual users to open up their running processes and force quit the app manually. What is the Java code to implement such a restart button?</p>
java android
[1, 4]
2,307,269
2,307,270
How to read String in java that was written using python's struct.pack method
<p>I have written information to a file in python using struct.pack eg.</p> <pre><code>out.write( struct.pack("&gt;f", 1.1) ); out.write( struct.pack("&gt;i", 12) ); out.write( struct.pack("&gt;3s", "abc") ); </code></pre> <p>Then I read it in java using <code>DataInputStream</code> and <code>readInt</code>, <code>readFloat</code> and <code>readUTF</code>. Reading the numbers works but as soon as I call <code>readUTF()</code> I get <code>EOFException</code>.</p> <p>I assume this is because of the differences in the format of the string being written and the way java reads it, or am I doing something wrong?</p> <p>If they are incompatible, is there another way to read and write strings?</p>
java python
[1, 7]
5,352,869
5,352,870
How can I get the flv path from a youtube video?
<p>How can I get the flv path from a youtube video?</p>
c# asp.net
[0, 9]
2,930,058
2,930,059
getting an error for must implement the inherited abstract method
<p>I am new to android and am getting The type LinearLayoutActivity must implement the inherited abstract method RadioGroup.OnCheckedChangeListener.onCheckedChanged(RadioGroup, int) for an error. I don't understand how I made RadioGroup an abstract method. Here is my code, I left a // by where I am getting the error</p> <pre><code>package com.commonsware.android.linear; import com.commonsplace.android.skeleton.R; import com.commonsplace.android.skeleton.R.id; import com.commonsplace.android.skeleton.R.layout; import android.app.Activity; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.RadioGroup; import android.widget.EditText; import android.view.Gravity; import android.text.TextWatcher; public class LinearLayoutActivity extends Activity //I am getting the error for LinearLayoutActivity implements RadioGroup.OnCheckedChangeListener{ RadioGroup orientation; RadioGroup gravity; /** Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); orientation=(RadioGroup)findViewById(R.id.orientation); orientation.setOnCheckedChangeListener(this); gravity=(RadioGroup)findViewById(R.id.gravity); gravity.setOnCheckedChangeListener(this); } public void OnCheckedChanged(RadioGroup group, int checkedId){ switch(checkedId){ case R.id.horizontal: orientation.setOrientation(LinearLayout.HORIZONTAL); break; case R.id.vertical: orientation.setOrientation(LinearLayout.VERTICAL); break; case R.id.left: orientation.setGravity(Gravity.LEFT); break; case R.id.center: orientation.setGravity(Gravity.CENTER); break; case R.id.right: orientation.setGravity(Gravity.RIGHT); break; } } </code></pre> <p>}</p>
java android
[1, 4]
1,171,378
1,171,379
IE7 - Prevent unresponsive script error
<p>The following code is used as a visual filter on an application I'm building. Basically, when a user types something into the textbox with id 'filter', the code below runs to hide those that match. </p> <pre><code>$('#filter').keyup(function() { delay(function(){ $(".patient:not(:contains('" + $('#filter').val() + "'))").fadeOut(); $(".patient:contains('" + $('#filter').val() + "')").fadeIn(); }, 300 ); }); </code></pre> <p>The code works fine in Firefox and Chrome, but in IE7 two things happen that I don't like:-</p> <p>1) The selected divs dont fadeOut/In - they just appear.. 2) Occasionally, I get an error from IE that the script is taking too long and may become unresponsive.</p> <p>In terms of problem 2 I've read that returning control to the browser (again maybe using a timeout) might prevent the issue but I'm not sure if this is possible using my code or how to do it. </p> <p>Can you guys help?</p> <p>(PS - for the record, I HAVE to use IE7 in my organisation. Bad, I know, but I can do nothing about this, just in case your solutions involve changing browser :))</p>
javascript jquery
[3, 5]
6,016,928
6,016,929
jQuery: making a div inside ajaxcall
<p>Ok. If you didnt spell a full name right, and only entered the lastname, and the there exist more users with that lastname, in the recipient field, the ajax call will return an error with </p> <p>Who did you mean:<br> Mami Fox <br> Megan Fox <br> Blabla Fox</p> <p>Now, I would like to make so you can click on them, choose who you meant to send to.</p> <p>To do this I cannot use confirm, as confirm only have OK/CANCEL.</p> <p>So i got told to use jQuery BlockUI Plugin, or just making a div and show().</p> <p>But how can I prepend the error in a div(i know this), show it(i know this), and then make so you are able to click on them, and receive a alert on click ('you have chosen Mami Fox').</p> <p>As i cannot make an prepared div with the names in(as the name are suggested from the page ajax requested, sendPM.php), and so, I would like to know how to do this.</p> <p>--</p> <p>Firstly i guess i would need to make json variable for each name. e.g<br></p> <pre><code> name1 : 'Mami Fox', name2 : 'Megan Fox', name3: 'Blabla Fox' </code></pre> <p>So in the div you can then prepend the names in there(instead of one variable with all names including "Who did you mean"), and make them so when you click on them, it will say "You have chosen"+data.name1 (example, where data is callback function name from the ajax success)..</p> <p>--Just a thought.</p>
javascript jquery
[3, 5]
22,874
22,875
Getting the a text from EditText (but a Number)
<p>I know that you can get a normal text like this:</p> <pre><code>EditText input = (EditText) findViewById(R.id.input); String value = input.getText().toString(); </code></pre> <p>but now I need a to an input like this: 0xFFFFFF (a Hex-Color), an Integer... But value is only a String and I don't know how to convert it... I'm using view.setBackgroundColor(color);</p> <p>Thanks a lot! </p>
java android
[1, 4]
2,026,111
2,026,112
Using the GPS (LocationManager) how To get the current Time?
<p>I am developing one GPS Application. Which will send the location data to server for every one hour.</p> <p>In this I am using following code:</p> <pre><code>location.getLatitude(); location.getLongitude(); location.getTime(); </code></pre> <p>with this code I am getting Latitude and Longitude correctly and Time also, but I am getting some 13 digits number instead of the time. I done some research on that, I found that is an seconds for of the current time.</p> <p>so now I need to convert that 13 digit number in to the specific format.</p>
java android
[1, 4]
515,323
515,324
Convert UserControl To My Custom Control
<p>I have class that Inherit from UserControl Class.</p> <pre><code>public class Module : UserControl { // Custom Property And Method } </code></pre> <p>How can i load a UserControl (.ascx) and convert to my Module Class?</p> <p>UPDATE : </p> <p>I try all suggest but in best case I get null. the error is : Unable to cast object of type 'ASP.UC_acsx' to type'BICT.Module'</p> <p>my class is like this : </p> <pre><code>namespace BICT { public class Module : UserControl { public Module() { // Some Initial } // and some extra property exp. public int Index{ get; set;} } } </code></pre> <p>is somthing wron with my code?</p>
c# asp.net
[0, 9]
4,114,508
4,114,509
What is the simplest and best way to determine if the browser is IE or not?
<p>(Don't care about the version. IE or not IE.)</p>
javascript jquery
[3, 5]
4,718,632
4,718,633
ASP.NET - Sending a PDF to the user
<p>I have a process that creates a PDF. I want these PDF's to be temporary and short lived. I want to be able to perform the following when the user clicks a button:</p> <pre><code>string CreatePDF()//returns fileName.pdf PromptUserToDownloadPDF() DeletePDF(fileName.pdf) </code></pre> <p>I want to avoid having to create a cleanup procedure and deal with any race conditions that arise from users concurrently creating PDF's while running cleanup. </p> <p>In winforms, I would synchronously prompt a user to download a file. How can I do a similar task in web?</p> <p><strong>UPDATE</strong><br /> Please note that I am using a 3rd party app to create the PDF's (<a href="http://xmlgraphics.apache.org/fop/" rel="nofollow">Apache FOP</a>). Basically I (will) have a function that invokes the command line:</p> <blockquote> <p>C:>fop "inputfile" "output.pdf"</p> </blockquote> <p>So, in memory is not an option...that is unless I could somehow do like....</p> <pre><code>string CreatePDF()//returns fileName.pdf string RecreatePDFInMemory() DeletePDF(fileName.pdf) PromptUserToDownloadPDF() </code></pre>
c# asp.net
[0, 9]
2,139,780
2,139,781
XMLParsing error
<p>I am getting XML parsing error when trying to implement download function in web application in C#. The same code is working in another web form.</p> <pre><code>SqlConnection cn = new SqlConnection(); cn.ConnectionString =ConfigurationManager.ConnectionStrings["cn"].ConnectionString.ToString(); cn.Open(); String abc = null; SqlCommand cm = new SqlCommand("select User_ID from Mgmt where S_Name='" + DropDownList1.Text + "'", cn); SqlDataReader dr = cm.ExecuteReader(); if (dr.Read()) { abc = dr.GetString(0).ToString(); } dr.Close(); cm.Dispose(); String ab = null; SqlCommand cmd = new SqlCommand("select Result from Result where Clg_ID='" + abc + "'and Student_ID='" + TextBox1.Text + "'", cn); SqlDataAdapter drr = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); drr.Fill(ds); ab = ds.Tables[0].Rows[0][0].ToString(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename='"+ab+"'"); Response.TransmitFile(Server.MapPath("~/Result/"+ab)); Response.End(); cn.Close(); </code></pre>
c# asp.net
[0, 9]
1,375,269
1,375,270
How can detect that file uploading has been finished with jQuery?
<p>How can I detect that file uploading has been finished? I use php and jQuery.</p>
php jquery
[2, 5]
1,026,045
1,026,046
ASP .NET and C#
<p>I am fresh out of college (passed in 07) and have been working on a Windows Forms project since then. <br /> </p> <p>I have a decent understanding of C# (not all the features of the language only the ones that i got to use in the project) and am very interested in learning ASP .NET <br /><br /> Would it be better to start learning ASP .NET and pick up C# as i go along or do i first master the language and then start with ASP .NET</p> <p>EDIT: I am talking about the 3.5 version of the .NET framework</p>
c# asp.net
[0, 9]
4,215,542
4,215,543
How to detect when a session ends
<p>Is there a way to detect when someone leaves your site? So far I know about using <code>ignore_user_abort()</code> but thats about as far as I've gotten.</p> <p>The reason I need to know this is because I need a script to execute upon someone leaving the site.</p>
php javascript
[2, 3]
1,391,478
1,391,479
Most basic javascript templating solution...?
<p>I am looking to create a variable that is a template for repatative elements of my site. I however am only using it infrequently so I do not wish to use a javascript templating engine or library.</p> <p>I am using jquery... if that effects anyones approach.</p> <p>This is one of my templates.</p> <pre><code>$html_template = json_encode(" var html = '&lt;a href=\"javascript:ajax(\'#content\',\'{$conf['dir']['web_url']}profile.php?user_id='+data.id+'\');\"&gt; &lt;div id=\"'+data.id+'\" class=\"fb_user\"&gt; &lt;img alt=\"'+data.name+'\" height=\"50\" width=\"50\" /&gt; &lt;p&gt; '+data.first_name+' &lt;br/&gt; '+data.last_name+' &lt;/p&gt; &lt;/div&gt;';"); </code></pre> <p>I have gotten so lost in escaping I can't work out where I have gone wrong. The plan is to use eval within the templating function to replace the variables.</p> <p>Hope someone can help</p>
javascript jquery
[3, 5]
4,971,905
4,971,906
XML Serialization and null value - C#
<p>I have an object that I serialize to XML. If one of the properties in the object is null, then native serialization ignores to add this as the attribute. Is this normal behavior, if so, is there a way I can override it?</p> <p>ex:</p> <pre><code>public class Test { [XmlAttribute] public string value {set; get; } [XmlAttribute] public string key {set; get; } } </code></pre> <p>When value is null, i get</p> <pre><code>&lt;Root&gt; &lt;Test key="blah"&gt; &lt;/Root&gt; </code></pre>
c# asp.net
[0, 9]
4,069,789
4,069,790
Identifing if next/previous element exist
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7678499/jquery-checking-if-next-element-exists">jQuery: Checking if next element exists</a> </p> </blockquote> <p>I'm implementing a custom slider using jquery. There I want to give facility to load next/previous image when user press <code>right</code>/<code>left</code> keys respectively.</p> <p>It is working fine but when cursor reach <code>last</code>/<code>first</code> element, code breaks as it do not find further elements. My code is as follow:</p> <pre><code>function movePointer(dir){ var selected = $("#imgslider &gt; ul &gt; li &gt; img.siddslideselected"); console.log(selected); var selectedli = selected.parent(); if(dir=='left'){ var nabourele = selectedli.prev() }else if(dir=='right'){ var nabourele = selectedli.next(); } console.log(nabourele); if(nabourele){ selected.removeClass('siddslideselected'); nabourele.children().addClass('siddslideselected').trigger('click'); } } </code></pre> <p>If current position of cursor is in middle, everything work fine but if cursor is on first element, pressing <code>left</code> key breaks the code. I try to stop that by checking <code>if(nabourele){</code>, but it is not working. console log for <code>nabourele</code> show <code>[]</code> in that case.</p> <p>How can I test condition if next/prev element exist or not?</p>
javascript jquery
[3, 5]
2,758,716
2,758,717
Trim or replace all commas and spaces from the String
<p>Hi i am developing android application.Now i stuck in one problem. Let me give you a example to understand my problem.</p> <p><strong>What I have is : kushal,mayurv,narendra,dhrumil,mark, ,,,, ,</strong></p> <p><strong>What i want is : kushal,mayurv,narendra,dhrumil,mark</strong></p> <p>Any help is appreciated.</p>
java android
[1, 4]
2,663,038
2,663,039
Creating FTP client for asp with C#
<p>I have a little problem because on my website I can't really set permissions for the directories, it just doesn't work. I use filezilla and when I try to set them to some subdirectories of a default directory of the server that is publicly readable and writable it doesn't send me an error but when I want to save a file in one of that subdirectories from an asp page I get an error telling that I haven't got the permission to do so, I tried setting 777, so it should work. Using C# I created a FTP client that allows me to edit those subdirectories (those I couldn't edit from the asp page). My question is: can I create an asp page that uses a FTP client to access one of those subdirectories????? Thanks!!!</p>
c# asp.net
[0, 9]
4,707,778
4,707,779
JavaScript/jQuery HTML Encoding
<p>I'm using Javascript to pull a value out from a hidden field and display it on a textbox</p> <p>The value in the hidden field is encoded.</p> <p>e.g.</p> <pre><code>&lt;input id='hiddenId' type='hidden' value='chalk &amp;amp; cheese' /&gt; </code></pre> <p>gets pulled into</p> <pre><code>&lt;input type='text' value='chalk &amp;amp; cheese' /&gt; </code></pre> <p>via some JQuery to get the value from the hidden field (Its at this point that I lose the encoding)</p> <pre><code>$('#hiddenId').attr('value') </code></pre> <p>The problem is when I read chalk &amp; cheese from the hidden field, javascript seems to lose the encoding, but to escape " and ' I want the encoding to remain.</p> <p>Is there a Javascript library or a Jquery method that will Html Encode a string?</p>
javascript jquery
[3, 5]
4,330,444
4,330,445
How do I force a scrollbar in a <select> to go to the top of the list?
<p>I have this HTML:</p> <pre><code>&lt;select multiple='multiple' size='3'&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;option&gt;3&lt;/option&gt; &lt;option&gt;4&lt;/option&gt; &lt;option&gt;5&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Using jQuery how do I force the scrollbar in the select to go to the top?</p>
javascript jquery
[3, 5]
178,405
178,406
JQuery Hide list items more than 5 code issue
<p>I am using the following code:</p> <pre><code>&lt;script&gt; $(document).ready(function() { $(function() { $("ul.items").each(function() { $("li:gt(4)", this).hide(); }); }); }); &lt;/script&gt; </code></pre> <p>Basically it's not hidding anything...</p> <p>Here is the list part of the code:</p> <pre><code>&lt;ul class="items"&gt; &lt;li&gt;One&lt;/li&gt; &lt;li&gt;Two&lt;/li&gt; &lt;li&gt;Three&lt;/li&gt; &lt;li&gt;Four&lt;/li&gt; &lt;li&gt;Five&lt;/li&gt; &lt;li&gt;Six&lt;/li&gt; &lt;li&gt;Seven&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Can anyone spot the problem?</p>
javascript jquery
[3, 5]
442,779
442,780
Need help, writing my first useful Android application. A lyrics searching app
<p>I have been playing with the android SDK and I wanted to finally make something useful. </p> <p>I was thinking about developing a little android application. I have about 600 songs lyrics formatted in .text, total size about 5 Mb.</p> <p>Basically the user will search for the song lyric by number (1 to 600) or by title. Select it, and it will be displayed in a pleasant font, fit for a small screen. I doesn't have to look fancy, as long as it works.</p> <p>Other features might include: Favorites and playing the track alongside with the lyrics (but those are extra, maybe in a second release)</p> <ul> <li>I thought about putting all the files in a folder, then ID each titles, I figured it would be tedious, and I can only implement a basic string search algorithm.</li> </ul> <p>I am stuck and don't know where to begin in the design part</p> <p>My question is: what is my starting point? what's the best way to implement it? How do I put all the ideas together? If I were to divide the problem into smaller bits what would they be. Any tips, advices that you might have would be awesome.</p> <p>I did some research online, but they were a little too broad, I figured here might be the best place to find help.</p> <p>Thank you very much</p>
java android
[1, 4]
4,970,522
4,970,523
How to identify the chosen selector in jQuery?
<pre><code>$('#select_id1, #select_id2, #select_id3').change(function() { // If '#select_id1' has changed, 'str' should be equal to 'select_id1'. // If '#select_id2' has changed, 'str' should be equal to 'select_id2'. // If '#select_id3' has changed, 'str' should be equal to 'select_id3'. str = &lt;what should be here ?&gt; }); </code></pre>
javascript jquery
[3, 5]
437,596
437,597
How to get the serial number of the hard disk of the client user
<p>i want to find the serial number of hard disk of the client users using java Script or jquery Then save in Sql Server Data base ... Please Help me ... Thanks </p>
javascript jquery
[3, 5]
3,214,661
3,214,662
Remote system event Notification Library
<p>Hi I am looking for some sort of library that will allow: - multiple remote applications to register with the system on which events it is interested in - When this event occurs, the system will sent out notification to these remote applications regarding this event - Objects, or hash tables information should be able to be exchanged as well between the system and the remote application</p> <p>The system will be implemented in either Python, or Java, and it will serve as a middleware between a database and external applications. I am not sure if such a library exists, or if it will most suited to implement this as message exchanges. I have heard of twisted, pyro, but not sure of the extent of their capabilities. I had used RPyC previously, but it don't seem to fit the picture naturally. If someone can also point out what is available on the java side as well, I would really appreciated.</p> <p>Plz advise, thnx!</p>
java python
[1, 7]
3,933,570
3,933,571
Why is OnCreate() being called when the app is "quit", this causes my initiliazation code to run multiple times
<p>So this should be easy I am sure I am just missing something.</p> <p>in my OnCreate() method, I do most of my games initilization (oh by the way I am making a game!)... in OnCreate I create a Panel, which is a class that extends view, and is responsible for all displaying. In the constructor of this panel I update a few linkedlist with objects to display, these objects are moveable by me in the panel (I can click an object, click a new spot, and the object is moved there) That all works fine!</p> <p>Now if I hit the home button to leave my app, and come back, android remembers where I left my objects, and keeps them there! How kind of Android. However the problem occurs when I hit the back button to leave my application (Which I guess is more like killing it, which means OnCreate() is called the next time my app starts. (I know OnCreate() CAN be called if I just hit the home button, but only when the phone needs some space and kills my app) Anyways, when OnCreate is called again, Android so kindly remembers where the objects I moved are, but it does something else, it recalls all my initalization code, so there is duplicate objects, at the original location (aka now there is double the objects).. How do i fix this? I tried this,</p> <pre><code> if(savedInstanceState!=null) //see if android saved the state { super.onCreate(savedInstanceState); //reload the state } else{ super.onCreate(savedInstanceState); //I pass this savedinstancestate to OnCreate here even //though it is null, //because I do not know what else to pass //then i do the initilization crap all over again (because the savedinstancestate should have been //null and therefore it shouldnt display any saved data locations, // but.... YET IT DOES!!! } </code></pre> <p>Please help me with this! How do I either stop it from saving the state EVER and always let me load it how I want to or how do I make it so my init code is ONLY called when the game doesnt reload the state? Thank you!! </p>
java android
[1, 4]
5,726,043
5,726,044
C# for web development? or C# as general purpose programming?
<p>I'm not sure if I'de like to learn C# just for web development then what should I learn from C# exactly, will I compare myself to anyone who wants to learn C# and in this case I have to learn everything! or are there specific things that if I have learnt then I can write code for small-medium websites without any worries about the C# language? </p> <p>In short, for web development what should I learn from C# language? As I am not sure if I should go with C# first and then learn about the framework ASP.NET or pick up the two by reading a book such as "Beginning ASP.NET 4 in C# and VB".</p> <p>Cheers.</p>
c# asp.net
[0, 9]
5,740,914
5,740,915
ASPX site can't detect form fields filled in by JavaScript
<p>I'm working on a web application in ASP.NET/C#, which involves asking users to input data. My client has requested the addition of a JavaScript utility that allows the user to enter a postcode, and have all other address fields be automatically filled in for them. When we test the application, the JavaScript appears to fill in the address fields correctly but the C# validation code reports them to be empty. I've tried googling several different combinations of terms but haven't found anything useful. How do I get this to work?</p>
c# asp.net javascript
[0, 9, 3]
1,409,102
1,409,103
$.ajax JQuery progress bar
<p>I have a sql queries being executed via an ajax call, but I need to be able to check the progress of it and update a progress bar.</p> <p>Here's my simple ajax call (using JQuery):</p> <pre><code>var strResult = (($.ajax({url: URL,async: true}).responseText)); </code></pre> <p>Any ideas how I listen for changes to update the bar?</p> <p>PS. This question is nothing to do with SQL.</p>
php javascript jquery
[2, 3, 5]
1,184,261
1,184,262
Execute php code in Python
<p>For some reason, I have to run a php script to get an image from Pyhon. Because the php script is very big and it is not mine, it will takes me days to find out the right algorithm used and translate it into python.</p> <p>I am wonder if there is any way to run php script, with few parameters, which returns a image, in python.</p>
php python
[2, 7]
179,828
179,829
Code is not executed after the jquery ajax complete event
<p>i have tried to execute some code inside the ajax complete event but it doesn't work on the page load event , but it works perfectly in the onchange link event</p> <pre><code>$(document).ready(function() { $.ajax({ beforeSend: function() { // Handle the beforeSend event }, complete: function() { // Handle the complete event $("#customfields_1 :input").filter(function() { return $.trim(this.value).length === 0; }).closest("td").hide(); } // ...... }); }); </code></pre>
javascript jquery
[3, 5]
5,795,876
5,795,877
Converting from DateTime to SqlDateTime is inaccurate
<p>I have a method that gets a date property from a source (either a <code>DataRow</code> or a <code>SqlDataReader</code>):</p> <pre><code>protected SqlDateTime GetSqlDateTimePropertyValue(string propertyName, object source) { var objValue = GetPropertyValue(propertyName, source); var value = objValue == DBNull.Value ? null : (DateTime?)objValue; var sqlValue = new SqlDateTime(); if (value.HasValue) sqlValue = value.Value; return sqlValue; } </code></pre> <p>but the conversion appears to be changing the date slightly so that my test always fails.</p> <p>Does anyone know why this method would be converting wrongly? </p> <p>At the end of the method, it looks like the conversion to <code>SqlDateTime</code> does some rounding:</p> <pre><code>value.Value.Ticks: 634698391707468296 sqlValue.Value.Ticks: 634698391707470000 </code></pre>
c# asp.net
[0, 9]
846,266
846,267
Show / hide elements on mouse move
<p>I'm building a site where I want the certain sections to be hidden until the mouse is moved. They then remain visible whilst the mouse is moving, however, if it remains still for a couple of seconds they hide again.</p> <p>I'm using jQuery on the site, in my ready state I have:</p> <pre><code>var hide = setTimeout(function() { hideNav(); }, 2000); $('body').mousemove(function() { clearTimeout(hide); var hide = setTimeout(function() { hideNav(); }, 2000); showNav(); }); </code></pre> <p>And the functions that show/hide content</p> <pre><code>function hideNav() { $('#primary').fadeOut(1000); var lightbox = $('#lightbox'); if (lightbox.length) { lightbox.fadeOut(1000); } } function showNav() { $('#primary').fadeIn(1000); var lightbox = $('#lightbox'); if (lightbox.length) { lightbox.fadeIn(1000); } } </code></pre> <p>This sort of works, except the timeout for hiding the elements ends up fighting with the function to show it when the mouse moves resulting in a lot of flickering.</p> <p>EDIT: The mouse movement needs to be for anywhere on the page, not just when hovering over the element that is to be shown/hidden.</p> <p>Any help would be appreciated.</p> <p>Thanks</p>
javascript jquery
[3, 5]
968,454
968,455
recreate the slide technique of photojojo
<p>I'm looking for some guidance on how I can recreated a this feature. what it does is when you click DO NOT PULL, scroll to an anchor button with a inimation. You can see it action here. <a href="http://photojojo.com/store/awesomeness/iphone-dot-pano-lens/" rel="nofollow">http://photojojo.com/store/awesomeness/iphone-dot-pano-lens/</a></p> <p>can anyone help me understand how that happens? The source code tells me nothing..</p> <p>Regards</p>
javascript jquery
[3, 5]
3,733,738
3,733,739
grid view count
<p>i have a web page wit Repeater</p> <pre><code>&lt;asp:Repeater ID="Repeater1" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;th bgcolor="#666666" style="color: #FFFFFF" align="center"&gt; aaa &lt;/th&gt; &lt;th bgcolor="#666666" style="color: #FFFFFF" align="center"&gt; bbbs &lt;/th&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;td&gt; &lt;asp:HyperLink ID="hyp_dcisapp" runat="server" NavigateUrl="~/DCIS_Approv.aspx" Font-Bold="True" ForeColor="Black" Font-Size="Small" text-decoration="none"&gt;&lt;%#DataBinder.Eval(Container.DataItem, "Dcisdelt")%&gt;&lt;/asp:HyperLink&gt; &lt;/td&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>finally it `contains colums aaa bbb 20 30</p> <p>i have a link butoon in home page</p> <pre><code>asp:LinkButton ID="LinkButton1" Text="totalCount" </code></pre> <p>how i can display this linkbutton line totalcount(50)</p>
c# asp.net
[0, 9]
5,939,581
5,939,582
Random Number: converting JavaScript to PHP
<p>I have the following line of code in javascript:</p> <pre><code>(Math.random() + "") * 1000000000000000000 </code></pre> <p>which generates numbers like:</p> <pre><code>350303159372528000 </code></pre> <p>I tried the same thing in PHP with this:</p> <pre><code>rand()*1000000000000000000 </code></pre> <p>Which returns:</p> <pre><code>2.272e+21 </code></pre> <p>I need to use PHP as the number generated will be stored as a SESSION variable and will be used by JavaScript later on. </p> <p><strong>How do I get PHP to force the number to be an int rather than a float?</strong></p> <hr> <p>EDIT PHP seems to struggle with this.</p> <p>Would it work if I just generated the rand number in PHP saved it to the SESSION and then done the multiplying by 1000000000000000000 in JavaScript?</p> <p>How would I go about this?</p>
php javascript
[2, 3]
2,245,748
2,245,749
Handling multiple radio buttons and validations
<p>I have somewhat a complex web app. I need your advice on how should I approach this situation, I can't wrap my head around this problem. Instead of explaining this complexity I have images of different scenarios.</p> <p><img src="http://i.stack.imgur.com/vXw1g.png" alt="enter image description here"></p> <p>As you can see, when a radio button in Add column is clicked, input fields are populated, price and description are retrieved from database. When delete is clicked, radio button is unchecked. Toggling between Add or Option button creates multiple stations, to prevent this I collect checked station names in an array and if user toggles between Add or Option, I check this array if the station exists. If it doesn't, I return true and display the station fields. </p> <pre><code>if($.inArray($(obj).attr('data-name'), currentStations) == -1){ currentStations.push($(obj).attr('data-name')); return true; } </code></pre> <p>Do you think this is a right approach? How else can I handle this?</p> <p>My other and bigger problem is that there can be multiple systems as shown below. <img src="http://i.stack.imgur.com/JxYnL.png" alt="enter image description here"> What should I do in this case? How should I check if the station exists. Should I create multidimensional array for each systems columns? Thank you! </p>
javascript jquery
[3, 5]
1,107,368
1,107,369
When sortable is dropped fire an alert
<p>Is there a callback function which fires when a user moves a draggable into a new position ?</p> <p>So for fiddle : <a href="http://jsfiddle.net/adrianjsfiddlenetuser/zyUkd/" rel="nofollow">http://jsfiddle.net/adrianjsfiddlenetuser/zyUkd/</a> When "Hello 01" is dragged and dropped into a new area the alert is fired ?</p> <p>Do I need to use .droppable ?</p>
javascript jquery
[3, 5]
2,715,780
2,715,781
Javascript For loop doesn't always work in IE
<p>After two days of searching, I'm stuck and could really use some assistance.</p> <p>I have a javascript array that when iterated through will give me the key to each subsequent array. This works in all browsers except for some versions of IE. In some versions of IE, it appears that it first reorders the array in ascending order before returning the key. Jquery's each function does the same. Is there an equivalent to the javascript for loop that will not reorder the array and would still work for everyone?</p> <pre><code>var db = new Array(); db[259] = new Array(3); db[259][0] = "John Smith"; db[259][1] = "Los Angeles"; db[259][2] = "Chicago"; db[917] = new Array(3); db[917][0] = "Jane Smtih"; db[917][1] = "New York"; db[917][2] = "Tampa"; db[208] = new Array(3); db[208][0] = "Jack Johnson"; db[208][1] = "Baltimore"; db[208][2] = "Milwaukee"; for(var i in db){document.write(i + " ");} </code></pre> <p>In most browsers, the above will output 259 917 208. This is the outcome that I would like.</p> <p>In some versions of IE, the above will output 208 259 917. It looks like it orders the keys in ascending order first. The key is important here as it is the person's ID # and the rank is important (ie, 259 should come before 208). Other functions make reference to db[i] where i is the person's ID #.</p> <p>Can anyone help?</p>
javascript jquery
[3, 5]
4,167,511
4,167,512
Is it possible to avoid iframe generation in ASP .NET Masterpage
<p>I am using asp menu in masterpage.master to switch between pages in an intranet site. It is causing layout issues in IE8, since it generates iframe which is shrinked to a default size. The iframe does not stretch to remaining space of the container. </p> <p>Is there a way to avoid iframe generation when using asp menu in masterpage.master files? </p> <p>EDIT : It seems that using asp:Content and asp:ContentPlaceHolder is the one which is causing iframe to be generated. (I use asp:ContentPlaceHolder in matserpage.master and asp:Content in the actual asp .net page)</p>
c# asp.net
[0, 9]
4,080,264
4,080,265
How to create copy of class object without any reference?
<p>How do I create a copy of a class object without any reference? <code>ICloneable</code> makes a copy of a class object (via shallow copy) but doesn't support deep copying. I am looking for a function that is smart enough to read all members of a class object and make a deep copy to another object without specifying member names.</p>
c# asp.net
[0, 9]
811,830
811,831
Custom Text Box control
<p>I have a specific need to control how some text is entered in a multiline textbox (ASP:TextBox)</p> <p>At first I though I could control it with just JavaScript but it appears I can get close but not 100% of what I need.</p> <p>Now I'm wondering if I need to write a control from scratch (never done that) or if I can inherit from TextBox and be able to get what I need.</p> <p><strong>Requirements:</strong></p> <blockquote> <ol> <li>MultiLine TextBox</li> <li>Ability to control row's and columns</li> <li>Would prefer to be able to turn off the scroll bar that appears disabled on a MultiLine Textbox</li> <li>Still be able to use the validators</li> <li>Word Wrap</li> <li>Maxlength</li> <li>If I set the columns to 26 and the rows to 4 the user should not be able to enter more then 104 characters (Here comes the parts I've not figured out)</li> <li>The user can not enter more then 4 lines even if the max length is not reached.</li> </ol> </blockquote> <p>The 4 line limit has really been the biggest part of my trouble.</p> <p>If you enter:</p> <blockquote> <p>a<br> b<br> c<br> d </p> </blockquote> <p>I can check how many <code>\n</code> characters. However if you enter:</p> <blockquote> <p>12345678901234567890123456<br> 7890<br> c<br> d </p> </blockquote> <p>Here they have wrapped so there is one less <code>\n</code> character or you enter:</p> <blockquote> <p>This is a long piece of<br> text that has been entered<br> c<br> d </p> </blockquote> <p>Here the text has wored wrapped and again you can't just count the <code>\n</code> characters.</p>
c# javascript asp.net
[0, 3, 9]
5,410,518
5,410,519
Is beginner knowledge of Java enough to develop for Android?
<p>I just finished the book "Tech Yourself Java in 24 Hours, 6th Edition" I have a grasp on the language and I have been experimenting and building little things with my knowledge. I want to learn about Android and was wondering if I need to increase my knowledge in Java before moving on to Android or can I just go straight to Android?</p>
java android
[1, 4]
279,433
279,434
jQuery hide and show element and remember using cookie
<p>I have the following fiddle here: <a href="http://jsfiddle.net/9jN8L/" rel="nofollow">http://jsfiddle.net/9jN8L/</a></p> <p>The idea is that sidebar will be shown and if the user clicks the link then it will hide and a cookie will be created and remember that they have hidden it. Should they click it again it will show the sidebar again and delete the cookie (this is why the code is duplicated inside the toggle method functions)</p> <p>However the sidebar is hidden by default and it doesn't show when the link is clicked after it has been hidden... Can anyone help? Thanks</p>
javascript jquery
[3, 5]
4,424,821
4,424,822
How to use variable defined in one php tag in another php tag?
<p>I wrote a php page which has two php tags and one script tag inside it . </p> <pre><code>&lt;?php $value = $_GET['hash']; ?&gt; &lt;script&gt; function execute(){ &lt;?php $readfile = file($value); for ($k=0;$k&lt;=count($readfile)-1;$k++){ $cmd = $readfile[$k]; echo $cmd;} ?&gt; } &lt;/script&gt; </code></pre> <p>I want to use $value inside another php tag ( like above it has the file I want to open ), but I am not able to do it.Is the scope of variable limited to one php tag ? if yes how can I solve this problem Please help</p>
php javascript
[2, 3]
1,744,780
1,744,781
Using jQuery, hide a textbox if a radio button is selected
<p>I have 2 radio buttons, what I want is if a user selects the top radio button then hide a textbox.</p> <p>Not sure how to bind an event to a radio button.</p>
javascript jquery
[3, 5]
4,360,504
4,360,505
Using Jquery, call function on selection just once
<p>Say i have a selection of textboxes like this;</p> <pre><code>var arrayoftextboxes = $('.textbox1, .textbox2, .textbox3'); </code></pre> <p>Is there a way I can call a function on each one in a simpler way than this? It only needs to be called once.</p> <pre><code>arrayoftextboxes.each(function(i){foo(arrayoftextboxes[i]);}); </code></pre> <p>I tried </p> <pre><code>arrayoftextboxes.load(function(){foo(this)}); </code></pre> <p>and </p> <pre><code>arrayoftextboxes.bind(function(){foo(this)}); </code></pre> <p>but the functions dont seem to be called.</p>
javascript jquery
[3, 5]
3,938,898
3,938,899
trigger Android application from Web Application
<p>Hello all my problem is : We have to create a system in which we need to create both web(ASP.NET C#) and android application and we have to synchronize data on both interface. So <strong>is there any method/Way to trigger Android application from Web Application(ASP.NET C#).</strong></p>
android asp.net
[4, 9]
6,026,041
6,026,042
Handling form data from javascript function
<p>I have a form with an ID of 'manage_campaigns'.</p> <p>I'm trying to call a function and send the form data to a javascript function by using this for the submit button, onclick:</p> <pre><code>javascript:updateAffiliateCampaigns(this); </code></pre> <p>This is the javascript function I have so far:</p> <pre><code>function updateAffiliateCampaigns(oForm) {} </code></pre> <p>I really only have a checkbox list of campaign id's that are being used in the form. How would I pass which items are checked to the function, and then how would I handle the data in the javascript function?</p>
php javascript
[2, 3]
2,201,195
2,201,196
Clear field value and simulate enter?
<p>I'm using the quicksearch (<a href="https://github.com/riklomas/quicksearch" rel="nofollow">https://github.com/riklomas/quicksearch</a>) jQuery to hide elements in a <code>table</code> by entering text into a text box and then it only shows the ones that match. </p> <p>This works fine, but I want to be able to clear the text box. I am using the following code to do that...</p> <pre><code>&lt;script&gt; function clearsearch(){ document.getElementById('id_search').value = ""; } &lt;/script&gt; &lt;a onclick="clearsearch()" id="clearsearch"&gt;Clear&lt;/a&gt; </code></pre> <p>This also works fine at clearing the field, but the script doesn't respond. I think the reason why it's not responding is because when I clear it with the clear script above, <strong>I need to focus on the <code>input</code> and press the delete key.</strong></p> <p>Ex.) If I simply type text in the text box, and then delete it by hand, it works fine. If I run the clear script, and it deletes the text, the results don't show. If I run the script, it deletes the text, and I press delete within the <code>input</code> the script responds.</p> <p>Is there a way that I can first clear the text box, and then simulate the delete key within the text box?</p>
javascript jquery
[3, 5]
4,145,090
4,145,091
Fixing the animation properties
<p>I am doing some research at the moment into creating a new maths game for primary school children where divs from 0-9 appear at random inside a container.</p> <p>A question is given at the beginning. Something like, multiples of 20. The user will then have to click on the correct ones, and they will then be counted at the end and a score will be given.</p> <p>I have just changed the speed in which the divs appear so that they appear for longer and more than one at a time to make the game easier for younger children.</p> <p>I used "fadeIn" like so..</p> <pre><code> $('#' + id).animate({ top: newY, left: newX }, 'slow', function() {}).fadeIn(2000); } </code></pre> <p>My problem is that now when I shoot the correct or incorrect number the animation is very glitchy and I cannot figure out why. </p> <p>Fiddle: <a href="http://jsfiddle.net/cFKHq/6/" rel="nofollow">http://jsfiddle.net/cFKHq/6/</a> (See version 5 to see what it was like before)</p>
javascript jquery
[3, 5]
3,976,334
3,976,335
Div not showing on click
<p>I am having some trouble displaying a div on click using JQuery. All the code looks correct to me. On my website I have a searchbar that I am trying to add search suggestions to. But by default I would like it to be hidden. Only if the user selects "Show Suggestions", then it will appear. The form action being empty is irrelevent. It does not work even if I remove the form all together. I am not getting any errors. I have been trying to fix this problem for over an hour, I appreciate any help with this. </p> <p>HTML</p> <pre><code>&lt;form action=""&gt; &lt;input type="text" id="txt1" onkeyup="showHint(this.value)" /&gt; &lt;input type="submit" value="Search" /&gt;&lt;button id="hint"/&gt;Show Suggestions &lt;/button&gt; &lt;/form&gt; &lt;div id="searchhint" style="display:none; border:1px solid red; width:300px;" &gt; Suggestions:&lt;span id="txtHint"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt; </code></pre> <p>JQuery</p> <pre><code>$(document).ready(function(){ $("#hint").click(function(){ $("#searchhint").show(); }); }); </code></pre>
javascript jquery
[3, 5]
2,990,436
2,990,437
Create an Event Handler whenever a new Node is added in treeview
<p>I want to write a custom class in which whenevr I add a node to treeview it should call an event. so that I can run it recursively.</p>
c# asp.net
[0, 9]
516,227
516,228
Deserilization an object in web browser
<p>I have a serialized object in C# .net 4 which contains some images and strings. </p> <p>What I want is send that object to web browser and deserialize it in client's web browser. </p> <p>What are the technologies that I will need? Is is possible to do this? My requirement is to save a class with images and few strings to hard disk and use it back. </p>
c# asp.net
[0, 9]
3,715,135
3,715,136
Redefining variable
<p>Hello I have code which replaces <code>document.write</code>, makes a buffer and than pushes buffer into the document:</p> <pre><code>var lazyLoad = (function () { var CONFIG = { block: '', url: '' }; function work(){ buffer = '' d.write = d.writeln = function(s){ buffer += s } d.open = d.close = function(){} s = d.createElement('script'); s.setAttribute('type','text/javascript'); s.setAttribute('src',CONFIG.url); d.getElementById(CONFIG.block).appendChild(s) s.onload = function () { window.setTimeout(function() { console.warn(CONFIG.block + ' ' + buffer) d.getElementById(CONFIG.block).innerHTML += buffer; buffer = ''; }, 0); } } return { init: function (options) { $.extend(CONFIG, options); window.d = document window.onload = function(){ work() } } } })(); </code></pre> <p>If I init it once:</p> <pre><code>lazyLoad.init({ url: 'http://test1.com/test1.js', block: DIVID1 }) </code></pre> <p>But if I call it again with other parameters:</p> <pre><code>lazyLoad.init({ url: 'http://test2.com/test2.js', block: DIVID2 }) </code></pre> <p>First init wont work. <code>buffer</code> will be empty. Where is my mistake? </p>
javascript jquery
[3, 5]
5,490,341
5,490,342
Confused about global variable not updating
<p>I have the following code:</p> <pre><code>var clickCount = 1; var slideCount = $('div.slide').length; $('a#next-button').click(function() { if(clickCount &lt; slideCount) { $('div.slide').animate({"left":"-=" + slideWidth}, 'slow'); clickCount = clickCount + 1; } }); $('p').text(clickCount); </code></pre> <p>It has a global variable called <code>clickCount</code>.</p> <p>The <code>$('a#next-button').click(function() { …</code> updates the global variable with an increment of 1, each time the <code>&lt;a&gt;</code> element is clicked.</p> <p>So, my question is, why does: <code>$('p').text(clickCount);</code> not show me the updated clickCount on the page everytine the <code>&lt;a&gt;</code> tag is clicked. Instead it just shows 1 (the original assigned value).</p>
javascript jquery
[3, 5]
4,866,362
4,866,363
How can I reference a JavaScript file on every page? (ASP.NET 1.1)
<p>I have an old ASP.NET 1.1 site that I am maintaining. We are working with Google to place analytics code on all pages. Since I can't take advantage of master pages in 1.1, I have my pages include headers/footers/sidebars with User Controls.</p> <p>What came to mind first is to place the JavaScript in my footer ascx control so it appears on every page. But I don't think I can link to a JavaScript file from a user control. </p> <p>Any ideas on what I can do to get this js code placed on every page in my site?</p>
asp.net javascript
[9, 3]
2,375,503
2,375,504
JQuery - Wrap divs in groups of 50 after sorting
<p>I have the following html :</p> <pre><code>&lt;div class="backpack_all"&gt; //wrapper for all on screen content ... &lt;div class="backpack"&gt; //main content to display &lt;div class="item1"&gt; &lt;div class="item2"&gt; &lt;div class="item3"&gt; ...etc </code></pre> <p>I will have anywhere from 200-500 items in this format. I'm also actively sorting this data by various attributes on these items. When unsorted, they are partitioned in sets of 50 by a class="backpack_partition" which wraps around 50 items. To sort them I have to unwrap all items from their respective partitions. How can I use jquery/javascript to rewrap them? </p>
javascript jquery
[3, 5]
4,756,795
4,756,796
how can i add multiple images to image source in php?
<p>i have multiple Images in drop down List and I have to Show the Selected Images in a Particular box when i click on any image in Drop Down list.after Clicking the image,the previous image should replaced by clicked image in box. but after loading or refreshing the page the updated image disappear and showing the old image which i have given in the source(statically).My Question is how can i change image so that clicked image will show even after loading or refreshing the page. Here is my part of code.</p> <pre><code>&lt;Img Src="photoframes/photo-frame-0000000.Png" alt="" style="position: absolute; left: 0pt; top: 0pt; width: 416px; height: 382px; z-index: 10;" id="frame" height="382" width="416"&gt; </code></pre>
php javascript
[2, 3]
3,102,435
3,102,436
jQuery get previous month from php
<p>I have made this script that get's the month and the year from calendar.php and I would like when I click the link previous month to get the previous month but also when month number reach 1 make the year - 1. How can I do something like that? </p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script&gt; $(function() { get_data(); }); function get_data(a, b) { $.get('calendar.php', { month: a, year: b }, function(response) { $el = $('&lt;div&gt;&lt;/div&gt;').attr('class', 'data').html(response); $('#datas').prepend($el); height = $el.height()+'px'; $el.css({'opacity': 0, 'display': 'block', 'height': '0px'}).animate({height: height }, 500, function() { $(this).animate({opacity: 1}, 500); }) }); } &lt;/script&gt; &lt;style&gt; #datas { overflow: hidden; } .data { display: none; } &lt;/style&gt; &lt;body&gt; &lt;a href="#" OnClick="get_data(9, 2012);" &gt; Previous month&lt;/a&gt; &lt;div id="datas"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php jquery
[2, 5]
5,943,734
5,943,735
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,972,342
5,972,343
Can't call with javascript appended class using jquery
<p>I can't call the class which is appended with javascript in jquery. It just doesn't respond to it at all.</p> <p>I append the html with this:</p> <pre><code>$(function () { var $scntDiv = $('#parts'); var i = $('#parts input').size(); $('#addField').on('click', function () { var part = '&lt;div id="parts' + i + '"&gt;&lt;hr /&gt;&lt;input type="text" id="auto_part' + i + '" class="auto_part" name="auto_part' + i + '" placeholder="Dio" /&gt;&lt;br/&gt;' + '&lt;textarea type="text" id="auto_description' + i + '" class="auto_description" name="auto_description' + i + '" placeholder="Vise informacija"&gt;&lt;/textarea&gt; &lt;br /&gt;' + '&lt;a href="#" class="addPhoto' + i + '" style="display:block;"&gt;Add Photo&lt;/a&gt;&lt;input type="file" name="auto_image" class="auto_image' + i + '" style="display:none;" /&gt;&lt;a href="#" class="removefield"&gt;Izbrisi dio&lt;/a&gt;&lt;/div&gt;'; $scntDiv.after(part); $("#row_count").val(i); i++; return false; }); $(document).on("click", ".removefield", function () { if (i &gt; 2) { $("#row_count").val(i); $(this).parent('div').remove(); i--; } return false; }); </code></pre> <p>});</p> <p>So it creates addPhoto2, addPhoto3 and so on. But when I use this:</p> <pre><code>$(function () { $(".addPhoto2").click(function(){ console.log("Hello"); }); }); </code></pre> <p>It just doesnt do anything with addPhoto2. While I can call addPhoto itself which is loaded as default.</p>
javascript jquery
[3, 5]
5,011,340
5,011,341
How to find out where variable is being set?
<p>I have a page and there is a public variable that is being set somewhere, but I can't find where it is being set. I have tried using 'Find Usages' but it only finds where it used within the same page.</p> <p>Are there any other ways I can find out where it is being set?</p>
c# asp.net
[0, 9]
3,681,889
3,681,890
How to start an activity that is defined in other Android projects?
<p>I have defined some common Activities in a library project and want to reuse these activity in my working project.</p> <p>I declared my library project as Android library, use the fully-qualified name of the Activities and declare them in the AndroidManifest.xml of the new project. However, I get 'Unable to find explicit activity class' error when launching the application.</p> <p>Any other configurations shall I do in order to start the Activities?</p>
java android
[1, 4]
917,287
917,288
Help me understand whats wrong with my javascript
<p>If I do this-</p> <pre><code>alert(anchor); </code></pre> <p>I get this-</p> <blockquote> <p>"[object HTMLLIElement]"</p> </blockquote> <p>... ok, yep, it is the element I want. So I want to get that elements ID.</p> <p>So I test it like this:</p> <pre><code>alert(anchor.attr("id")); </code></pre> <p>... but I don't get any alert, nothing. I must not be selecting an element. What am I doing wrong, what don't I understand?</p>
javascript jquery
[3, 5]
3,208,245
3,208,246
How could i change the msgbox title "The page at http://.... says:"
<p>I am opening the msgbox in asp.net by following code..</p> <pre><code>if (ds.Tables[0].Rows[0][12].ToString() == "0" ) Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('This ID is not yet approved to create a case. ');", true); else if(ds.Tables[0].Rows[0][12].ToString() == "2") Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('Your ID is rejected to create a case. ');", true); else Page.ClientScript.RegisterStartupScript(this.GetType(), "Window", "alert('Please enter a valid ID.');", true); </code></pre> <p>When its running on mozilla browser Message Box title showing <code>The page at http://.... says:</code></p> <p>I want to change this title and show my custom title a part from <code>The page at http://.... says:</code></p> <p>Any open help me soon.</p>
c# asp.net
[0, 9]
4,040,758
4,040,759
Should I make a method static that will be used across many aspx.cs files
<p>I have a method with the following signature:</p> <pre><code>string GetTableCellValue(DataTable table, string columnName, int rowIndex){} </code></pre> <p>As you might guess, this method returns the value of the cell located at the specified column of the specified row of the specifies table in string format. It turns out that I need this methods almost in all the webpages. Here's my quetion(s):</p> <ol> <li>Should I put this method in all the code files or?</li> <li>Should I have it as a static method of some class, like Utilities_Class or?</li> <li>Should I have it as a public NON-STATIC method of some class , like Utilities_Class?</li> </ol> <p>The last 2 choices seem to be better idea. But I don't know which one to choose eventually.</p>
c# asp.net
[0, 9]
527,179
527,180
JQuery's Contains returns an Object?
<p>I am trying to see if a particular string appears in a div. I have tried but it doesn't return true or false which is what I thought contains did?</p> <pre><code>if($("#path"+i+"_status:contains('!=')")){ alert($("#path"+i+"_status:contains('!=')")); //alerts - [object object] return true; } </code></pre> <p>Here is my HTML:</p> <pre><code>&lt;div class="status" id="path3_status"&gt; &lt;img height="21" align="absmiddle" src="images/valid.jpg"&gt;Text File (3000) = Source Table (3000)&lt;img height="21" align="top" src="images/info.jpg" " id="img_path3"&gt; &lt;a onclick="clear_file('TI004OBAE', 'path3');" href="#"&gt;Clear&lt;/a&gt; &lt;/div&gt; </code></pre> <p>What am I doing wrong. How can I find out if a div contains the string "!="?</p> <p>Thanks all for any help</p>
javascript jquery
[3, 5]
1,809,757
1,809,758
Chrome showing undefined for keyCode
<p>So I have a dropdown list that when the user selects something from the list and presses enter instead of clicking, it is suppose to refresh the page with the selected data.</p> <p>It is working perfect in IE and Firefox, but Safari &amp; Chrome seem to be completely ignoring it.</p> <p>Here is where I add the attribute to the dropdown list:</p> <pre><code>cboContext.Attributes.Add("OnKeyDown", "if (typeAhead(event,'" + cboContext.ClientID + "') == 1) contextPostback();"); </code></pre> <p>It seems to be ignoring the OnKeyDown attribute in Chrome and Safari</p> <p><strong>Edit:</strong> </p> <p>Based on the work and comments from Sime and Nil, I have found out that Chrome is not recognizing the keyCode, it shows as undefined.</p> <p>I have put my typeAhead() code on <a href="http://jsfiddle.net/rcMGP/1/" rel="nofollow">jsFiddle</a></p> <p>Here is where I declare the variable for keyCode: </p> <pre><code>var charCode = evt.keyCode || evt.which; </code></pre> <p>Does anyone have any idea why it would be staying as undefined?</p>
c# javascript asp.net
[0, 3, 9]
695,194
695,195
Is there a sense to handle nullpointer exception by such way?
<p>Is there a sense to handle null pointer exception by such way like</p> <pre><code>private void doWork(Object object) { if (object == null) { try { throw new IllegalArgumentException(); } catch (Exception e) { e.printStackTrace(); } } else { ... } } </code></pre> <p>?</p> <p>Thanks in advance.</p>
java android
[1, 4]
3,878,495
3,878,496
Clear Text Selection with JavaScript
<p>Simple question which I can't find the answer to: how can I use JavaScript (or jQuery) to deselect any text which may be selected on a webpage? E.G. user clicks and drags to highlight a bit of text -- I want to have a function deselectAll() which clears this selection. How should I go about writing it?</p> <p>Thanks for the help.</p>
javascript jquery
[3, 5]
313,885
313,886
php gets stringified object as null
<p>I'm trying to pass a some information to a php page with jquery ajax. I really can't understand why the php page keeps echoing back that the strinified JSON i'm sending is null</p> <pre><code>//php if ($type == "new" || $type == "update"){ $new_address = json_decode($_REQUEST['address'], true); echo json_encode($new_address); //Null } //js var string_encoded_address = JSON.stringify(address_obj.address); string_encoded_address = encodeURIComponent(string_encoded_address); console.log(string_encoded_address); $.ajax({ type: "post", url: "order_queries_templates/queries/address.php", data: "type=new&amp;user_id=" + user_id + "&amp;address=" + string_encoded_address, dataType: "json", success: function (returnedData) { console.log(returnedData); } }); </code></pre> <p>this gives me a string for my <code>data</code> property:</p> <pre><code>type=new&amp;user_id=8244&amp;address=%7B%22companyName%22%3A%22test%20company%22%2C%22address1%22%3A%222420%20sample%20Road%22%2C%22city%22%3A%22SIOUX%20CITY%22%2C%22state%22%3A%22IA%22%2C%22zip%22%3A%2251106%22%2C%22cityStateZip%22%3A%22SIOUX%20CITY%2C%20IA%2051106%22%7D </code></pre> <p>What could be wrong with it? Thanks!</p>
php javascript jquery
[2, 3, 5]
5,456,953
5,456,954
jquery and page.isvalid in asp.net
<p>After struggling for a few days, i was able to implement a multi step wizard using jquery form wizard/validation plugin and asp.net. I noticed one gotcha while testing.(nothing do with the jquery plugins) When the user first clicks the final submit button, jquery validator kicks in and all the validation messages are spitted out right. However, submit button is still active and user can still click on it which obviously is not good. </p> <p>Should i just check for Page.IsValid method on code behind ? Is there a better solution, like disabling/enabling submit button in javascript? Whats the best way to handle this?</p> <p>Thanks.</p>
jquery asp.net
[5, 9]
917,842
917,843
Is it possible to bind two separate functions to the same event
<p>Basically I'd like to bind function A to all inputs. Something like this:</p> <pre><code>$('input').bind('change', function() { bla bla bla }); </code></pre> <p>And then later I would like to bind something different in addition like this:</p> <pre><code>$('#inputName').bind('change', function() { do additional processing..}); </code></pre> <p>Is that possible? Does it work? Am I missing the syntax? Is that fine actually fine (meaning I have a bug elsewhere that's causing one of these not to bind)?</p>
javascript jquery
[3, 5]
4,853,176
4,853,177
Get value from SQLite and Cursor comparison problem
<p>I access the SQLite database on device. And get some values from table</p> <pre><code>Cursor c = db.query(.....); </code></pre> <p>I try compare this values to other string values like that:</p> <pre><code>if(c.getString(0) == "value") </code></pre> <p>but this comparison returns false all time.</p> <p>In debug, i see the values and <code>c.getString(0)</code> is "value", but comparison returns false..</p> <p>How can I compare these values?</p> <p>I tried <code>c.getString(0).toString()</code> too.</p>
java android
[1, 4]
3,222,155
3,222,156
Run a .java program with javascript
<p>Is there a way to run 'n .java program through javascript?</p>
java javascript
[1, 3]
5,886,486
5,886,487
how to select all childs other than a element
<p>I have a element which contains 3 child. let says </p> <pre><code>&lt;div class="parent"&gt; &lt;div class="firstChild"&gt;firstChild&lt;/div&gt; SecondChild &lt;ul&gt;&lt;li&gt;thrid child&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt; </code></pre> <p>In the example I need to select first 2 childs and not the UL. how to do through jquery.</p>
javascript jquery
[3, 5]
5,693,186
5,693,187
getting the value of textbox of Grid
<p>Now , I am using ASP.net with C# . I have a Grid and there are two text box controls in it. How should I do to get the value of these two text box controls from JavaScript. </p> <p>Regards</p>
c# javascript asp.net
[0, 3, 9]
4,379,461
4,379,462
Animation with image preloading
<p>I have a list of objects MyObject and that looks like this:</p> <pre><code>var Obj1 = {'ImgTop':'500px','ImgLeft':'200px','ImgSrc':'/image1.jpg'} var Obj2 = {'ImgTop':'300px','ImgLeft':'100px','ImgSrc':'/image2.jpg'} </code></pre> <p>I load these objects into an array like this:</p> <pre><code>var AnimCycle = new Array(2); AnimCycle[0] = Obj1; AnimCycle[1] = Obj2; </code></pre> <p>In my code, there are actually 15 objects loaded in the array. I have function that gets called recursively and inside the function, I have this line:</p> <pre><code>$('#HomeImg').attr('src', AnimCycle[PanelID].ImgSrc); </code></pre> <p>The problem is that the loading of the image happens when the line is triggered. How can I make the images preload?</p> <p>Thanks for your suggestions.</p>
javascript jquery
[3, 5]
1,268,191
1,268,192
How to pass any HtmlControl to a function as a parameter
<p>Just wrote a function that checks if an HTML control is hidden or not. how can i change the type System.Web.UI.HtmlControls.HtmlTableRow of the parameter myControl to a type that will support any HTML control type. i prefer to not write specific function for any html control.</p> <pre><code> public static bool IsUIElementHidden(System.Web.UI.HtmlControls.HtmlTableRow myControl) { if ((myControl.Style["display"] ?? "").ToLower().Equals("none") || (myControl.Style["visibility"] ?? "").ToLower().Equals("none")) { return true; } else { return false; } } </code></pre> <p>I tried to use the type WebControl but when i am passing the control to the function i am getting an error.</p>
c# asp.net
[0, 9]
4,866,168
4,866,169
How to get text value in jquery?
<p>I have three elements, which are sliding on the screen, i want to get the text of element which is currently showing on the screen, I tried .text() function, but this returns the text of all the s elements, is there any way using javascript or jquery to do this.</p> <pre><code>&lt;div id="text"&gt; &lt;span style=" font-size:100px;text-align:center;"&gt;koko&lt;/span&gt; &lt;span style=" font-size:100px;text-align:center;"&gt;abc&lt;/span&gt; &lt;span style=" font-size:100px;text-align:center;"&gt;efh&lt;/span&gt; &lt;/div&gt; $(document).ready(function(){ $('#text').mouseover(function(){ var txt = $('#text span').text(); alert(txt); }); }); </code></pre>
javascript jquery
[3, 5]
1,666,753
1,666,754
Loading Content best practices
<p>I am sort of new to JavaScript and something has been bugging me. Say I have some code like this:</p> <pre><code>$('button').on('click', function() { var id = $(this).attr("id") // id being a file name sans extension $('.content').load(id + '.php'); }); </code></pre> <p>Everything works just fine, but something in the back of my head tells me that this is bad practice. Any thoughts?</p>
javascript jquery
[3, 5]
2,766,833
2,766,834
select the group of check box javascript
<p>in the website i am developing i am adding the list of menus and sub menus in the database. for creating a category to user the menus in website i have form to create a category in the their will the list of main menu and sub menus with a check box which comes dynamically from database. the thing is if i select the main menu check box the sub menu check box should be selected like a parent child format. bu getting the check box from the menu and check box dynamically i am feeling difficulty in this.</p> <pre><code>&lt;?php if ($arrAllMainMenuDetail) { $mmNo++; foreach ($arrAllMainMenuDetail as $mainmenuList) { $arrAllSubMenuDetail = $objMenu-&gt;getAllSubMenuDetails(false, 0, $mainmenuList['mainmenuId']); ?&gt; &lt;input type="checkbox" name="mainmenu[]" id="mainmenu&lt;? echo $mmNo; ?&gt;" value="&lt;? $mainmenuList['mainmenuid']?&gt;" onClick="Check(document.menuForm.mainmenu&lt;? echo $mmNo; ?&gt;.value)"/&gt; &lt;? echo $mainmenuList['mainmenuName']; ?&gt; &lt;br/&gt; &lt;?php if ($arrAllSubMenuDetail) { $smNo = 0; foreach ($arrAllSubMenuDetail as $submenuList) { ?&gt; &lt;input type="checkbox" name="submenu[]" id="submenu&lt;? echo $smNo; ?&gt;" value="&lt;? $submenuList['submenuId']?&gt;" style="margin-left:15px;"/&gt; &lt;? echo $submenuList['submenuName']; ?&gt; &lt;br/&gt; &lt;?php $smNo++; } } $mmNo++; } } ?&gt; </code></pre>
php javascript jquery
[2, 3, 5]
1,832,861
1,832,862
jquery $(selector).ready() code running even if no element was matched
<p>I am using this code to only run this js on certain pages.</p> <pre><code>$("body#action_new").ready(function() { console.log($("body#action_new")); console.log($("body#action_new").length); console.log("code is running"); } </code></pre> <p>Even though body#action_new does not exist, the code is running.</p> <p>the two console.logs print out:</p> <pre><code>[] 0 code is running </code></pre> <p>What gives?</p>
javascript jquery
[3, 5]
2,105,965
2,105,966
Java Android: Pre-processing the UI before it displays
<p>First off, I've been reading this site for years now and it's helped me out of a bind several times, so thank you to the community here who contribute, and hopefully you can help me with a problem of my own.</p> <p>I'm just starting out with Android development at my company and I'm attempting to port an existing application from Windows Mobile C# to Android Java. Most of it is going smoothly, but one area I'm having some difficulty is the UI.</p> <p>The Windows Mobile application reads in a survey specification from a file when the WinForm is created. In the case of a closed-ended question (such as multiple choice), I need to populate the screen with either a CheckBox or RadioButton control for each applicable answer in the spec. Creating the layout and controls required is no problem, but we also have a requirement that the screen does not scroll. Because of this our software needs to be able to calculate the best possible fit within the available screen space without overflow (ie. 1-4 columns used for display) before it's displayed</p> <p>I have written my UI (at least the layout) as both an XML resource or Java code, but because methods like GetWidth() and GetHeight() return 0 in onCreate(), I haven't yet been able to add this required pre-processing.</p> <p>All of this needs to happen prior to the screen showing. If anyone can point me in the right direction, I would be immensely grateful.</p>
java android
[1, 4]
502,898
502,899
file explorer in android
<p>I made a program for simple database with the database name "employee.db" but i'm not finding the file explorer where i can see that if database is created or not. while running the code i'm getting this :- [2011-09-09 14:52:19 - DatabaseExample] Failed to install DatabaseExample.apk on device 'emulator-5554': null [2011-09-09 14:52:19 - DatabaseExample] com.android.ddmlib.InstallException [2011-09-09 14:52:19 - DatabaseExample] Launch canceled!</p>
java android
[1, 4]
2,220,930
2,220,931
How can i fetch the values from Login control?
<p>How can i fetch the values entered for ID and password in the login control provided at the login page to be used further in my page? I want those values at my .cs page. Please give answer in c# language.</p>
c# asp.net
[0, 9]
1,863,876
1,863,877
jquery error function help
<p>I'm not much of a javascript guy but I would like to implement error dialogs in this project I'm working on. I want to send a http header that the error function will catch and display the correct message. I've already tested the error function with an alert box and when I send a header 400, the error function is triggered.</p> <p>Is it possible in JQuery or javascript to show different messages / dialogs based on the header code like 400 or 401? Based on that code then show the user the proper error message? I have about 4 or 5 messages that I need to show per error function</p> <pre><code>error:function(){ // call my dialog here } </code></pre>
javascript jquery
[3, 5]