Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
4,144,567
4,144,568
Jquery contains selects div too high up
<p>I'm sure this is a complete bonehead move on my side, but can't figure out what's happening here.</p> <p>I'm trying to select a div with a specific word in it, but Jquery seems to select the div on the wrong level. If you run this you'll see what I mean:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { $(".ms-my-profileDetails:contains('Birthday')").css("color", "red"); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="ms-my-profileDetails"&gt; &lt;div&gt; Department : &lt;a href='http://Someurl'&gt;IT&lt;/a&gt; &lt;/div&gt; &lt;br /&gt; &lt;div&gt; Birthday : &lt;a href='http://Someurl'&gt;1921-04-13&lt;/a&gt; &lt;/div&gt; &lt;br /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The result of the above contains matches the entire div of Birthday and Department <code>&lt;div class="ms-my-profileDetails"&gt;</code> when I only want the Birthday Div.</p> <p>Pls help. Tx</p>
javascript jquery
[3, 5]
2,319,089
2,319,090
Getting unknown child div from parent?
<pre><code>&lt;script type="text/javascript"&gt; $(".inventory-notes").bind("click", function() { if($(this).text().length &gt; 0) { alert($(this).text()); alert($(this).closest(".inventory-notes").children().text()); } }); &lt;/script&gt; </code></pre> <p>example table</p> <pre><code>&lt;table id="inventory" class="table"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Item&lt;/th&gt; &lt;th&gt;Value&lt;/th&gt; &lt;th&gt;Usage&lt;/th&gt; &lt;th&gt;Notes&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="items"&gt; &lt;td&gt;Hatchet&lt;/td&gt; &lt;td&gt;24,000 Gold&lt;/td&gt; &lt;td&gt;Woodcutting&lt;/td&gt; &lt;td&gt;&lt;div class="inventory-notes"&gt;&lt;div id="299"&gt;&lt;img src="addnotes.png"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>How can I get the value 299 from the child div of <code>inventory-notes</code>? The table really contains at least 1,000 rows of items each containing a random ID.</p> <p>I am using jQuery 1.6.2 so I cannot use the <code>.on() function.</code></p>
javascript jquery
[3, 5]
2,705,416
2,705,417
Broadcast Receiver issue
<p>Ok, so I have an app that needs to receive incoming SMS, and send out an SMS to the sender. This I can set up fine. The problem is, I only want the Broadcast Receiver to receive when the service is started. I declared the receiver class within the service. I destroy the reference (and unregister the receiver) in onDestroy. While the app compiles, and runs, the broadcast receiver never runs. If I delcare it in the manifest, it works fine, but never stops. The receiver just keeps waking up and processing.</p>
java android
[1, 4]
4,080,043
4,080,044
shorter way to write if(x==1 || x==5 || x==7 || x==22)
<p>Programming in JavaScript and PHP, is there a shorter way to include several options in an if() condition?</p> <p>I wonder if there is a way to write see a way to write for example</p> <pre><code>if( myvar==1 || myvar==5 || myvar==7 || myvar==22 ) </code></pre> <p>something like</p> <pre><code>if( myvar==(1||5||7||22) ) </code></pre> <p>Anyone knows a way to do this? Maybe regex?</p>
php javascript
[2, 3]
1,991,603
1,991,604
.slideToggle class individually based on .click
<p>Basically trying to write something like this. Click .button and it .slideToggle(s) it's associated .box Div. Nesting them inside a container div to try different methods.</p> <p>I feel stupid, this has been asked many times. I've tried at least a dozen none of which I can get to work.</p> <p>Code is here.</p> <p><a href="http://jsfiddle.net/BurRQ/25/" rel="nofollow">http://jsfiddle.net/BurRQ/25/</a></p> <pre><code>&lt;div class="container"&gt; &lt;div class="header"&gt; &lt;a href="#" class="toggle"&gt;TOGGLE&lt;/a&gt; &lt;/div&gt; &lt;div class="box"&gt; &lt;p&gt;Content&lt;/p&gt; &lt;/div&gt; &lt;/div&gt;​ </code></pre> <p>Cheers.</p>
javascript jquery
[3, 5]
4,413,753
4,413,754
error type or namespace name profilecommon could not be found
<p>When I compile this code, It show me this kind of error type or namespace name profilecommon could not be found. Could someone help me how to solve this?</p> <pre><code>case "Profile": ProfileCommon pc = Profile.GetProfile(user.UserName); DropDownList3.Items.Clear(); foreach (SettingsProperty p in ProfileCommon.Properties) { DropDownList3.Items.Add(p.Name); } MultiView1.ActiveViewIndex = 4; break; } </code></pre>
c# asp.net
[0, 9]
5,901,250
5,901,251
How to format date to match specific pattern?
<p>I need to format <strong>DateTime.Now</strong> to match this pattern <strong>Example:</strong> 10-March-2011.</p> <p>How can I accomplish it?</p>
c# asp.net
[0, 9]
5,107,522
5,107,523
call class file(.cs in c#) function from javascript and helps how to write Ajax+Webservices
<p>Here my simple sample code is:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; namespace PopUpFromCsFile { public class PopUpWindow { public void PopUpFromCsFile() { string str1 = "&lt;script&gt; $.ajax({" + "type: 'GET'," + "url: 'Service/Class1.cs/callfromjs'," + "data: '{}'," + "success: function () { getDetails(); } " + "});&lt;/script&gt;"; page.ClientScript.RegisterStartupScript(this.GetType(), "script1", str1); } [WebMetod] public string CallFromJs() { return "santosh"; } public void getDetails() { string str = "&lt;script&gt;alert('Hai');&lt;/script&gt;"; System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler; page.ClientScript.RegisterStartupScript(this.GetType(), "script2", str); } } } </code></pre> <h2>Explanation</h2> <p>In PopUpFromCsFile(), I wrote code for Ajax+WebMethod. Is Url path is correct,Here I am unable to call getDetails() from script.</p>
c# javascript
[0, 3]
5,108,990
5,108,991
change property on user control
<p>I changed a public property in my web user control but the client doesn't see that change until I delete the user control and re-add it and then it sees the change.</p> <p>I'm thinking to myself what if the user control is used in many places, will I have to do that to all of the pages? Certainly, I missing something?</p> <p>Here's the code-behind of my webusercontrol:</p> <pre><code>public partial class ReportExporter : System.Web.UI.UserControl { public IEnumerable&lt;object&gt; DataSource { get; set; } public String ExportFilename { get; set; } protected void Page_Load(object sender, EventArgs e) { } protected void BtnExportCsv_Click(object sender, EventArgs e) { //Client needs to subscribe to this event and set the //DataSource property with IEnumerable. //Todo: Find other ways to show this as a requirement. OnExportEvent(e); if (String.IsNullOrEmpty(ExportFilename)) ExportFilename = "NeedToOverrideThisName"; Response.Clear(); Response.ContentType = "text/csv"; Response.AddHeader("Content-Disposition", "attachment; filename=" + ExportFilename + ".csv"); byte[] csvData = Utility.ToCsv(",", DataSource.ToList()); Response.OutputStream.Write(csvData, 0, csvData.Length); HttpContext.Current.Response.End(); } protected void BtnExportPdf_Click(object sender, EventArgs e) { } public event EventHandler ExportEvent; protected void OnExportEvent(EventArgs e) { if (ExportEvent != null) { ExportEvent(this, e); } } } </code></pre> <p>All I did was change the property name for DataSource, it was AnyList.</p>
c# asp.net
[0, 9]
2,228,923
2,228,924
What do I need to know going from Java to JavaScript?
<p>This isn't as progressive as it sounds. Im not taking the whole "Oh I know Java, that must mean I can write in JavaScript too!" attitude. I have some education on Java under my belt, but now find myself having to do some PHP web development (which I have little experience in) using Java Script to handle some of the logic. But before going out and buying 2 or 3 books on JavaScript and diving right into it, I figure I might ask those that might have gone through the same experience. It appears that JavaScript lives and acts in its own environmnet which makes want to take the approach taking in JavaScript and PHP as a bundled package in my learning endeavors. JavaScript is similar just enough to Java that I will tend to make some dangerous assumptions. Should I treat JavaScript and PHP as one item, or should I still take this step by step and learn one at a time? What are some pitfalls that I might run Into? What are the main differences between the languages? Is there any litterature that has helped? Thanks Everybody. </p>
java php javascript
[1, 2, 3]
544,273
544,274
What is the best way to programmatically run javascript when an ASP.net page loads?
<p>In my <code>global.asax</code> file for my ASP.net project, I am checking for certain conditions. When those conditions are met, I want to automatically execute javascript code when the page runs.</p> <p>This is my code:</p> <blockquote> <p>if condition Then<br> Response.Write(" &lt; script type=""text/javascript"" > ")<br> Response.Write(" // Javascript code to do stuff ")<br> Response.Write(" &lt; /script > ")<br> End If</p> </blockquote> <p>While this appears to work to execute the Javascript code, I don't think it's a best practice because this code will preceed <em>all</em> of the HTML of the page that gets loaded.</p> <p>What is the best way of programmatically tacking on some extra Javascript code to be run when my page loads?</p> <p><b>Update</b> Thanks for the answer. Too bad this solution doesn't work from within <code>global.asax</code>. Is there no way to make this happen site-wide? It seems like <code>global.asax</code> would be the logical place to put code that runs with every page... <code>Response.Write</code> works fine in <code>global.asax</code>.</p>
asp.net javascript
[9, 3]
1,177,945
1,177,946
How to make the Setting works for Class Library project in C# 2.0?
<p>I am putting the setting under the property of one of my C# Class Library project for app setting:</p> <pre><code>EUCAccountService_ConnectionString EUCTelcoDB_ConnectionString </code></pre> <p>In the development, it works nicely. Until I deported to production, I realise that the component that use those thing .. it just hang. I found that under \BIN when it compiled dewaCorp.EUC.TelcoDB.Data.dll.config and open up that file and turn out nothing.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;configuration&gt; &lt;/configuration&gt; </code></pre> <p>How to make this works? I thought by compiling it, it turned to some sort config file or something. But it didn't.</p> <p>I am appreciated your comment.</p>
c# asp.net
[0, 9]
334,881
334,882
how to click url inside image control?
<p>I am converting pdf document to image using a itextsharp dll,in my requirement clickable url inside image control,how to click url inside image control.how to handle this...</p> <p>thanks, seelan</p>
c# asp.net
[0, 9]
2,428,580
2,428,581
Allow a web application to access a local file
<p>If I have a web application that needs to use a file, it presents the user with a standard open file dialog. But instead of uploading the file to server can it modify the file locally in a temporary location, while uploading in the background? That way the user does not have to wait for the upload before they can use my web app.</p>
php asp.net
[2, 9]
1,001,514
1,001,515
setOnCheckedChangeListener is getting invoked everytime the view is built
<p>I have a class <code>Devices</code> that stores the checked state of the Switch using <code>setChecked(boolean)</code> and gets it by the <code>isChecked()</code> method.</p> <p>Using this, I'm saving the state of the switch once once it is toggled.</p> <p>But, if I change the state of a switch to ON, every time I scroll down and up back to the switch, <code>setOnCheckedChangeListener</code> is invoked. How do I prevent this?</p> <pre><code> @Override public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; DeviceHolder holder = null; Devices devices = list.get(position); String id = devices.id; LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new DeviceHolder(); holder.devTxt = (TextView) row.findViewById(R.id.devdesc); holder.nameTxt = (TextView) row.findViewById(R.id.devname); holder.toggleSwitch = (Switch) row.findViewById(R.id.toggleswitch); holder.txt = (TextView) row.findViewById(R.id.debug); final int i=id; final Switch tswitch = holder.toggleSwitch; holder.toggleSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { //Comes here every time I scroll to a button that is ON Control._service.write(i); list.get(position).setChecked(tswitch.isChecked()); } }); holder.devTxt.setText(devices.dev); holder.nameTxt.setText(devices.name); holder.txt.setText(id); if (tswitch.isChecked() != devices.isChecked()) holder.toggleSwitch.setChecked(devices.isChecked()); return row; } </code></pre>
java android
[1, 4]
91,822
91,823
how to display checkbox values in popup with jquery
<p>I have a search page when I click on search button, I have a result with multiple rows with checkboxes, I wanted to know if it is possible when I check some results, it displays the values ​​in a popp, and when I change the search criteria and I check other boxes it adds other values ​​in popup without reset my popup</p>
javascript jquery
[3, 5]
1,384
1,385
jquery change function works on one page but not another
<p>I'm having a little bit of trouble with an on click function on one of the <a href="http://mb.tmlinc.ca/" rel="nofollow">projects</a> I'm working on. If you notice on the home page when you populate checkin and checkout dates and then switch the property, the values in both inputs are cleared.</p> <pre><code>// clear datepickers on property change $('#DropDownListProperty').change(function () { $('#TextBoxCheckIn').val(''); $('#TextBoxCheckOut').val(''); }); </code></pre> <p>(line 276 on the page's script if you're in firebug)</p> <p>I need this same functionality on the Pricings page but for some reason the change event never fires. As far as I can tell I've implemented the code in the exact same way with the addition of a couple more lines:</p> <pre><code>// clear datepickers and pricing on property change $('#DropDownListProperty').change(function () { $('#TextBoxCheckIn').val(''); $('#TextBoxCheckOut').val(''); $('#pricing').hide(); $('#personal-info').hide(); }); </code></pre> <p>but the code here never fires. (line 172 of the page's script in firebug). I swear I've checked the IDs a million times but it stumps me what is preventing the fields from being cleared.</p> <p>Any help is appreciated!</p>
javascript jquery asp.net
[3, 5, 9]
2,167,294
2,167,295
How to pass javascript variable value to java class
<p>I want to submit data from a html page to java class. I am using javascript to get data from html page, now I want to send this data to java class to save this data to db. I am using ftl template to generate html so I cant use jsp here. Please give an example using either javascript of ajax or jquery.</p> <p>thanks.</p>
java javascript
[1, 3]
4,417,601
4,417,602
Check whether link's text is "B" then remove its class?
<p>I want to check whether an <code>a</code> node contains the word "B". If so, the node's <code>someclass</code> class should be removed.</p> <p>For example:</p> <pre><code>&lt;a href="http://link.com" class="someclass"&gt;B&lt;/a&gt; </code></pre>
javascript jquery
[3, 5]
1,687,088
1,687,089
I get "function not defined" using setInterval with jQuery. Why?
<p>I am trying to update a users field by using jQuery.</p> <p>My code is...</p> <pre><code> jQuery(document).ready(function(){ setInterval("imStillAlive()", 6000); function imStillAlive() { jQuery.post('/users/update_useractive', function(data){ alert("updated"); });//post } }); </code></pre> <p>The above code when ran shows the error...</p> <blockquote> <p>"imStillAlive" not defined</p> </blockquote> <p>How to resolve this?</p>
javascript jquery
[3, 5]
4,962,813
4,962,814
What is Script Binding, and How is it done?
<p>I have heard such thing as Script Binding - binding Javascript or lua with API's from C++ or Objective-C. I want to know more about it- however Google has strangely proven unuseful for this. </p> <p>How is it done? - it OK if I get pointed to other sources, but, just how? I never knew a Scripts jitter could interact with compiled libraries.</p>
c++ javascript
[6, 3]
5,400,422
5,400,423
How to offset bitmap, drawn on a canvas?
<p>Here's my code that draws a BitmapMesh, as well as a circle on canvas.</p> <pre><code>canvas.drawBitmapMesh(GirlBitmap, WIDTH, HEIGHT, matrixVertsMoved, 0, null, 0, null); // need to offset this by "addOffset" canvas.drawCircle(pointX+addOffset, pointY, bubbleSize, p3); </code></pre> <p>Both of which have to be offset by x by <strong>addOffset</strong>. It wors fine with the circle, but I can't figure out how to make the bitmap offset?</p> <p>Any ideas? Maybe I should draw it on a separate canvas and then draw it on the old one, with an offset?</p> <p>Thanks!</p>
java android
[1, 4]
4,278,130
4,278,131
How to refer to currently selected element in jQuery?
<p>I'm trying to make a script that would insert <code>img</code> element after each link to a certain site with source equal to value of <code>href</code> attribute of given link. This is what I came up with:</p> <pre><code>$("a[href*=site.com/img/]").after("&lt;img src="+$(this).attr("href")+"&gt;"); </code></pre> <p>Problem is, <code>$(this)</code> doesn't work (attr() returns <code>undefined</code>). Why is it? How to refer to selected link and its argument <code>href</code>?</p>
javascript jquery
[3, 5]
192,636
192,637
asp.net, c# with mappath
<p>i have 10 rows like (E:\DocumentManager\Upload\rzgtlxvmuolmhej4ibvyif2o.pdf") already in the database. so I have dataset to pick it up, and now I want to know how to display/show on the browser (E:\DocumentManager\Upload\rzgtlxvmuolmhej4ibvyif2o.pdf") on the web using aspx/c# code behind.</p>
c# asp.net
[0, 9]
2,576,831
2,576,832
Is it possible to determinate if an element is currently overflowing its container?
<p>I want to check if a horizontal scrollbar is applied to a div like this:</p> <pre><code>if (box.width() &lt; box.get(0).scrollWidth) </code></pre> <p>This is always true, even when there isn't any scrollbar, because <code>box.get(0).scrollWidth</code> returns <code>203px</code>, while <code>.width()</code> returns <code>200</code>.</p> <p>Here I have an example, please look at the first box. <code>$('.box0')</code></p> <p>Example : <a href="http://www.nikolaydyankov.com/Dev/lionbars/" rel="nofollow">http://www.nikolaydyankov.com/Dev/lionbars/</a></p>
javascript jquery
[3, 5]
3,177,880
3,177,881
How to show Label1.Text for each item in a foreach statement?
<p>I want to show each item Id that is doing now dynamically in a foreach statement.</p> <p>But the following code only shows the last item Id in Label1.Text.</p> <p>How to show Label1.Text for each item in a foreach statement?</p> <pre><code>&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /&gt; </code></pre> <p>.</p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { List&lt;int&gt; list = new List&lt;int&gt;() { 1,2,3,4,5 }; foreach (var item in list) { Label1.Text = string.Format("I'm doing item {0} now.", item.ToString()); Thread.Sleep(1 * 1000); } } </code></pre>
c# asp.net
[0, 9]
1,026,451
1,026,452
jQuery Slider/Carousel update content after DOM
<p>guys.</p> <p>I have searched for an jquery slider/carousel plugin where i can update your content after DOM-ready, with AJAX call or something like that. Anyone knows an plugin where this is possible? Add new jquery slide after her ready?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,597,504
1,597,505
closer browser window.close not working
<p>I would like to close the browser window using javascript on button click this is what I tried</p> <pre><code>&lt;script type="text/javascript"&gt; function OpenMyWin() { window.open('', '_self'); window.close(); } &lt;/script&gt; &lt;asp:Button ID="btn" runat="server" Text="Close" OnClientClick="OpenMyWin();"/&gt; </code></pre> <p>and also I tried the alternate way</p> <p><code>btn.Attributes.Add("onclick", "javascript:window.close();");</code> and</p> <p><code>btn.Attributes.Add("onclick", "javascript:OpenMyWin();");</code></p> <p>I also tried this</p> <p><code>&lt;script type="text/javascript"&gt; function closeWindow() { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite"); alert("This will close the window"); window.open('', '_self'); window.close(); } &lt;/script&gt;</code></p> <p>Still I am unable to close my browser can some one help me I need the close event which should work on all browsers</p>
javascript asp.net
[3, 9]
5,451,749
5,451,750
Span element change event
<p>My question is:</p> <p>Does have a span element the inner html change event? I think about I have a span and when the span inner html is changing it will throw an event that I can reach?</p> <p>I would like to use Jquery to bind to this event of span.</p> <p>l.</p>
javascript jquery
[3, 5]
2,097,067
2,097,068
What is the dollar symbol used for in ASP.net?
<p>I know this might be a newbie question, but every-time i see code like this:</p> <pre><code>var table = $("table[title='Refresh']"); </code></pre> <p>And also code like this:</p> <pre><code> $(function () { $("#datepicker").datepicker(); }); </code></pre> <p>i always sort of glaze over the <code>$</code> symbol . It's a type of placeholder? or does it signify that its dynamic?</p>
c# asp.net
[0, 9]
895,923
895,924
android pick random images?
<p>How can i load a random image out of 2 ?</p> <p>I tried this code</p> <pre><code>final Random rgenerator = new Random(); Integer [] mImageIds = { R.drawable.mantrans, R.drawable.womentrans, }; Integer q = mImageIds[rgenerator.nextInt(mImageIds.length)]; gBall1 = BitmapFactory.decodeResource(getResources(), q); </code></pre> <p>but it did not work...</p> <p>Please help</p>
java android
[1, 4]
4,327,181
4,327,182
how can I cut a string that contain "map" in jquery/javascript
<p>Does anyone know how can I cut a string that contain "map" in jquery/javascript</p> <p>Example: If i have a string </p> <pre><code>var stringName = "abc mapTest bbc"; </code></pre> <p>How Can I cut the string by result only mapTest? </p> <p>NOTE: like assume the stringName is not the fixed value, it could change to "mapTest asdasd asdd", "asdasd asfffd mapTest" and so on. and the "mapTest" will keep changing (e.g mapTest1, mapTest, mapTest5 and so on)</p>
javascript jquery
[3, 5]
1,399,280
1,399,281
Including simple PHP code into Javascript
<p>How do I make this work? I've googled and even saw some examples here on Stackoverflow which show this kind of coding, but it doesn't work for me.</p> <pre><code>&lt;script type="text/javascript"&gt; var infoClass = ""; infoClass = &lt;?php echo('test'); ?&gt;; alert(infoClass); &lt;/script&gt; </code></pre> <p>The alert box displays empty box.</p>
php javascript
[2, 3]
4,110,294
4,110,295
How to set Row Filter for Dataview to filter rows according to valu of column?
<p>Hii, I am using DataView control to bind a gridview. In dataview data is coming from a table 'cloneUserEntry'. cloneUserEntry table contains a column 'Visibility' whose value is true or false (boolean type). I want to display rows whose visibility is true. So how to set row filter to filter rows whose column 'visiility' contains only true. I am using code as following..</p> <pre><code>Boolean var=true ; gvUserDataReadOnly.DataSource = new DataView(cloneUserEntry, string.Format("Visibility = #{0}#", var), "FirstName ASC", DataViewRowState.CurrentRows); </code></pre> <p>but this is not working. can anyone ell me how to do this task..?? Thanks in advance..</p>
c# asp.net
[0, 9]
1,515,432
1,515,433
add membership provider to my site
<p>I want to implement membership provider in my site that will include more that 100K users (optimistic...),but I am new with this issue. As I know I can use integrated ASP.NET provider (ASPNETDB.mdf) and I have some questions about it: Is it good enough for this amount of users considering users management , performance and good security? what is the advantages/disadvantages of custom provider? If you have some examples please add the link.</p>
c# asp.net
[0, 9]
1,639,893
1,639,894
PHP to PYTHON inter communication
<p>How can I run a Python script store in another server from PHP? I have googled for this and found many solutions to run Python files from PHP, but those were for Python files stored locally. Mine's on a another server.</p>
php python
[2, 7]
3,421,842
3,421,843
Jquery sliding DIV not working in browser compatibility issue
<p>I am trying to implement a sliding div over pdf (Information : Pdf is Shown using iFrame). Its working on Mozilla Firefox, Chrome but its not working on Internet Explorer, Safari :(. Here is the jsFiddler Link. <a href="http://jsfiddle.net/rickjackson/7VCeD/2/" rel="nofollow">Click Here</a></p> <p>Will any 1 let me know what should i do to work in all browsers.</p>
javascript jquery
[3, 5]
3,642,684
3,642,685
Sorting multiple html tables logically related to each other
<p>I wish to sort 3 separate tables that are logically related to each other but kept separate in design for some purpose. I am using sorttable.js for sorting. Can someone guide me on this. Thanks.</p>
javascript asp.net
[3, 9]
1,777,404
1,777,405
How to use element of a certain parent
<p>I have one element, when dragged to another place that element is cloned and i have two elements with same id and etc, but the parent is different, how can i set some style or whatever to the cloned element, but not affecting the older one, from witch i cloned. And again every class and id is the same, just different parent .</p>
javascript jquery
[3, 5]
1,680,599
1,680,600
What does jQuery(function) or $(function) do?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7642442/what-does-function-do">What does $(function() {} ); do?</a> </p> </blockquote> <p>what exactly does the following syntax mean?</p> <pre><code>$(function() {..} </code></pre> <p>as in </p> <pre><code>$(function () { $(".add_folder").click(function () { </code></pre> <p>Does it means only defining anonymos function? or also executing it?</p> <p>TIA</p>
javascript jquery
[3, 5]
5,469,526
5,469,527
Replace anchor tag onclick javascript function parameter
<p>I have a page which has a couple of anchor tags in this format:</p> <pre><code>&lt;a onclick="javascript:RefreshPageTo(event, &amp;quot;/web/Lists/exceptionlog/AllItems.aspx?Paged=TRUE&amp;amp;PagedPrev=TRUE&amp;amp;p_Created=20111026%2017%3a30%3a16&amp;amp;p_ID=175\u0026PageFirstRow=1\u0026\u0026View={8AB948D3-7F13-4331-9F06-29C8480B1E80}&amp;quot;);javascript:return false;" href="javascript:"&gt; </code></pre> <p>If you look at the RefreshPageTo javascript function it has a couple of arguments. The second argument is a server relative url. It has some querystrings, I need to append some more query strings to it. </p> <p>Lets say for example I want to append the following query string to it: "FilterColumn=title&amp;FilterValue=th". Any ideas how I would do this using jquery?</p>
javascript jquery
[3, 5]
2,696,166
2,696,167
Access to an object created in page from a class
<p>I have a page, Default.aspx, with its own code-behind file like this:</p> <pre><code> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { public int[] anArray; ... } </code></pre> <p>What I'd like to do is access to "anArray" from a C# class (not tied to a page) declared in \App_Code folder. What can I do?</p> <p>Thanks.</p> <p>Edit: As said in the first comment, I really apreciate your suggestions about refactoring my connection objects. However, what I'm really doing here is to rewrite an old PHP application in order to get comfortable with basic C# and ASP.NET, so this code will never go really live. So, I'm still intersted in a way (if any) to access an object declared in a code-behind code from a standard C# class. </p> <p>Edit2: I removed the OdbcConnection object in order to focus to the real problem: how to refer to an object istantiated in a code-behind file from a C# class situated in \App_Code?</p>
c# asp.net
[0, 9]
217,355
217,356
JQUERY to filter input in a textfield
<p>I am a newbie to jquery and javascript so this may be a silly question</p> <p>I have a textfield and i would like to filter the input</p> <p>so it will only let the usesr enter in [A-Z] chacters and also if the length of [A-Z] has reached 3 it then also disables the user from entereing any more characters</p>
javascript jquery
[3, 5]
4,487,533
4,487,534
How to find extension of a file?
<p>in my web application (asp.net,c#) i am uploading video file in a page but i want to upload only flv videos. how can i restrict when i upload other extension videos help me please.</p>
c# asp.net
[0, 9]
2,357,263
2,357,264
get table row data td and select
<p>Here is what I want to do.</p> <p>In the first row that has tds then <code>a = the text in the first cell</code> and <code>b = the selected value of the drop down that the user selected</code></p> <p>How do I do this as my code is not working?</p> <pre><code>$(document).ready(function () { var s = $('table td:first').parents('tr'); var a = s.eq(0).text(); var b = s.eq(1).find('option:selected').val(); alert(a + " " + b); }); &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; test &lt;/td&gt; &lt;td&gt; &lt;select&gt; &lt;option value="yes"&gt;yes&lt;/option&gt; &lt;option selected="selected" value="no"&gt;no&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>
javascript jquery
[3, 5]
4,694,668
4,694,669
how to get value from a datakey field inside datalist
<p>i have a datalist and i set DataKeyField</p> <pre><code> &lt;asp:DataList ID="lstItems" runat="server" RepeatDirection="Horizontal" DataKeyField="itemid" &gt; &lt;ItemTemplate&gt; //contents in the datalist here &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre> <p>i also have a imagebutton say imgADD in the page.My question is how can i get the value of datakey in imgADD click on server side</p>
c# asp.net
[0, 9]
4,549,719
4,549,720
jQuery on list item hover, show delete button for that individual item
<p>Below is a preview of what I have:</p> <hr> <p><img src="http://i.stack.imgur.com/RiF2B.jpg" alt="enter image description here"></p> <hr> <p>On the right is when I hover. What I want is for the delete icon to only show for that hover item.</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $(".removeService").hide(); // Deleting an Individual Service $("#dashboard ul li span").hover( function() { $(".removeService").show(); }); }); &lt;/script&gt; </code></pre> <p>This is probably a very simple fix, but if anyone could point me in the right direction I would really appreciate it.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,515,238
2,515,239
How do you programmatically fill in a form and 'POST' a web page?
<p>Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?</p> <p>Edit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their 'add' page. I want to be able to create a link/button on my site's page that will fill in those values and submit the info without having to copy/paste them across and click the submit button.</p> <p>Further clarification: How do automated spam bots fill out forms and click the submit button if they were written in C#?</p>
c# asp.net
[0, 9]
1,049,092
1,049,093
What would be jQuery equivalent of this sf hover suckerfish code?
<p>What would be jQuery equivalent of this sf hover suckerfish code?</p> <pre><code>&lt;script&gt; sfHover = function() { var sfEls = document.getElementById("navbar").getElementsByTagName("li"); for (var i=0; i&lt;sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" hover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" hover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,916,495
2,916,496
javascript jquery.getJSON weird behaviour
<p>I've been starting to experiment with javascript and jQuery. I was trying to create a class that would load a json file into a specified div, but I run into a behaviour I don't understand:</p> <p><em>NOTE: I know this code won't load anything into a div, it's just the shortest example I could find to show the behaviour I don't understand.</em></p> <pre><code>function test(div) { this.div = div; _this = this; jQuery.getJSON('/example.json', null, function(data) { console.log(_this.div); }); } </code></pre> <p>when I run</p> <pre><code>a = new test("a"); b = new test("b"); </code></pre> <p>I expected to see "ab" as the output, but the actual output is "bb". However, if I allow for the first line to finish before calling the second one, then the expected output is shown. I'm confused!</p>
javascript jquery
[3, 5]
987,122
987,123
How to store javascript code without it executing?
<p>I'm trying to have adsense javascript code added to a designated div location using jquery but it seems javascript code does not sit well inside a jquery variable. It executes. I've tried using php's htmlentities to encode it for storage, but I can't get it to decode naturally. What should I do? Do I need a javascript based replacement for htmlentities_decode? </p> <p>This is how far I've gotten, and .html() is not automatically decoding the htmlentities encoded html. </p> <pre><code>var html_1 = "&lt;?php echo htmlentities('&lt;script&gt;adsense ad code here&lt;/script&gt;'); ?&gt;"; if (html_1) { jQuery('#id_wpt_adblock_1').html(html_1); } </code></pre>
javascript jquery
[3, 5]
2,816,617
2,816,618
jQuery set flash wmode parameter
<p>Am wondering if there is any jQuery plugin available to change the wmode to transparent at runtime. (Something similar to wibiya)</p> <p>I tried googling, but could not find any exact plugin do to the job. The only resource I found was: </p> <p><a href="http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/" rel="nofollow">http://www.onlineaspect.com/2009/08/13/javascript_to_fix_wmode_parameters/</a> http://labs.kaliko.com/2009/11/change-wmode-with-jquery.html</p> <p>Are there any other options? </p>
javascript jquery
[3, 5]
4,161,918
4,161,919
call a function every X minute
<p>I have a background service running and inside this I wanted to call a function every X minute. What is the simplest solution to do this in Android?</p>
java android
[1, 4]
2,350,795
2,350,796
Need Removable comments in this textarea
<p>Hi I need to add some content which would be clear on click in the given below textarea.</p> <p>Not able to find the answer, please help me</p> <pre><code> &lt;tr&gt;&lt;td&gt;&lt;?php echo tep_draw_textarea_field('comments', 'soft', '60', '5'); ?&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>
php javascript
[2, 3]
4,364,752
4,364,753
lifetime of variable in java
<pre><code>private void func() { String str = "hi!"; } </code></pre> <p>this is my code.</p> <p>suppose I called func() in the onCreate event. I want to the near exact time, if thats possible to be determined, when GC will free the memory used by str.</p> <p>Actually str stores a password. and i want to free it as soon as I can. currently after using str I set its value to something irrelevant.</p> <p>I heard GC is the only thing that can free memories? is that correct? is there any other way of freeing the memory of a variable.</p>
java android
[1, 4]
2,940,748
2,940,749
How do i remove/destroy all child elements from a div entirely- .remove() does not seem to work properly
<p>Im dynamically loading content into gallery format-</p> <p>i have a table or list of image data, it needs to be able to discard the entire set of data, and reconstruct it again with new data.</p> <p>The problem i have, is when i call .remove() on the entire div structure, it stores all of the child elements if i got to put them back.</p> <p>This is a problem because if i have one page of information that has say 24 items, then calling the remove and adding the next set- which might have say only the last 3 items in the set- the other 21 items that were constructed before are showing up because the structure is the same- is there a more appropriate way to completely destory the information and all child elements of a div?</p>
javascript jquery
[3, 5]
3,682,205
3,682,206
jquery making local variable in function global
<p>I have this function that populates the currsong variable with data. The problem is that the variable currsong is only available inside the function and I need to access it globally.</p> <pre><code>// get a single audio url echonest.artist(artist).audio( function(audioCollection) { var currsong = audioCollection.data.audio[0].url; return currsong; }); </code></pre> <p>Thank you!</p>
javascript jquery
[3, 5]
2,459,441
2,459,442
Fade out before loading new content
<p>How do I fade out #special, then load the content, and when it´s loaded fade in again.</p> <pre><code>function test(x,y) { $('#special').fadeOut('fast').fadeIn('slow'); $('#special').load('index.php?close=1 #special'); } </code></pre> <p>I don´t want it to display/load the new content until #special has faded out.</p>
javascript jquery
[3, 5]
5,269,588
5,269,589
How to convert integer type to amount type in javascript?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/149055/how-can-i-format-numbers-as-money-in-javascript">How can I format numbers as money in JavaScript?</a> </p> </blockquote> <p>In JavaScript I accessed a variable like this:</p> <pre><code>amount= document.getElementById('&lt;%= DataItemValue1.ClientID%&gt;').firstChild.nodeValue; </code></pre> <p>Now if the amount is <code>10945</code> I want it as <code>$10,945</code>; if <code>1098</code> as <code>$1,098</code></p> <p>How can I do this in javascript and pass it to a label?</p> <p>Thanks a lot.</p>
javascript asp.net
[3, 9]
1,178,789
1,178,790
GridView Sort Problem after Browser's Back Button Clicked
<p>I have a web form with a gridView inside an UpdatePanel. </p> <p>After make a search and sort the gridview the user can click in a row to select the value to be edited, when it's clicked another page is opened.</p> <p>The problem is, when the user click on the Browser's Back Button on EditPage the Search page doesn't keep the Sort and the Search previously set.</p> <p>Any insight will be considered, please guys give me some way to get in!</p>
javascript asp.net
[3, 9]
1,882,748
1,882,749
PHP/Javascript project keeps calling your-meme-site.com
<p>I am developing a localhost project that keeps sending requests to your-mime-site.com. </p> <p>I have included these jquery plugins:</p> <ol> <li>jQuery</li> <li>jQuery.form</li> <li>jQuery.validate</li> <li>jQuery.ui</li> </ol> <p>Everything else I have coded myself.</p> <p>I have tried to use NetBeans to search the project for the string "your-meme-site" but it says that some lines are too long to be searched.</p> <p>Does anybody know why or how this is happening?</p>
javascript jquery
[3, 5]
2,877,318
2,877,319
The process cannot access the file because it is being used by another process
<p>I am getting binary data from a SQL Server database field and am creating a document locally in a directory my application has permissions. However I am still getting the error specified in the title. I have tried numerous suggestions posted on the web including those suggested in previous posts on Stackoverflow. I have also used ProcessExplorer > Find Handle to locate the lock and it returns nothing as if the file is not locked.</p> <p>I am using the code below to save the file to the file system and I then try to copy this file to a new location later in the application process within another method. It is this copy method that takes the path of the newly created file that throws the exception.</p> <p>The file itself is created with its content and i can open it through Windows Explorer without any problems.</p> <p>Am I missing something completely obvious? Am I creating the file correctly from the database? Any help on solving or better diagnosing the problem would be much appreciated.</p> <pre><code>// Get file from DB FileStream fs = new FileStream( "C:\myTempDirectory\myFile.doc", FileMode.OpenOrCreate, FileAccess.Write); BinaryWriter br = new BinaryWriter(fs); br.Write("BinaryDataFromDB"); fs.Flush(); fs.Close(); fs.Dispose(); // Copy file File.Copy(sourceFileName, destinationFilename, true); </code></pre>
c# asp.net
[0, 9]
4,941,375
4,941,376
Javascript Closure calling a Call back function?
<p>So I have tons of function that are very similar to each other. IE time to refactor via closures but I ran into a problem.</p> <p>My functions skeleton code is something like this (i have tons of this in my javascript):</p> <pre><code>function getBlahOutputInThisID(param1, ...., paramN, functionName) { var jasonArray = { param1: param1, param2: param2, ... } jQuery.ajax({ type: 'POST', url: '/blahController/ajax_functionName/', data: jasonArray, success: function(data) { //Some REALLY custom function stuff } }); } </code></pre> <p>So since I have tons of these:</p> <p>I was wondering if I can do a closure</p> <pre><code>function closure(paramArray, customFUNCTION) { return function() { //getBlahOutputInThisID code (the skeleton code, look above) } } </code></pre> <p>and have it call the callback function, customFunction in the closure (the <code>jQuery.ajax({</code> part), ie:</p> <pre><code> success: function(data) { customFunction() } </code></pre> <p>Or is this a very noob/bad way to refactor codes? </p> <p>Edit: Thank you for your time and effort.</p>
javascript jquery
[3, 5]
1,984,135
1,984,136
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,874,711
3,874,712
Handler to grab variable values from another function
<p>This is what I have so far </p> <pre><code>//file uploader /////////////////////////// function uploader(){ var file = $(this).val() var error = $(this).next('.req-error') var fileLimit = $(this).attr('maxlength')-1 var uploadedFiles = $(this).siblings('.uploaded-file').length //make uploaded file label if(error.length ==1){ $(this).next().after('&lt;div class="uploaded-file"&gt;&lt;span&gt;X&lt;/span&gt;'+file+'&lt;/div&gt;') }else { $(this).after('&lt;div class="uploaded-file"&gt;&lt;span&gt;X&lt;/span&gt;'+file+'&lt;/div&gt;') } //count uploaded files if(uploadedFiles &gt;= fileLimit ){ $(this).attr('disabled', true) }else{ $(this).removeAttr('disabled') } //clear input field $(this).val('') }; $(".input-file").change(uploader) function removeFile(uploader){ $(this).remove() } $('.uploaded-file').live('click',removeFile) </code></pre> <p>I made a limit for how many files can be uploaded. Once the limit is reached, the input gets disable but, when a file is removed I want it to enable again if its under the limit. Im just not sure how to get the removeFile function to read the if statement from the uploader function.</p>
javascript jquery
[3, 5]
4,699,404
4,699,405
How to create a multi line textbox with like button which can be sorted based on likes
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8566184/i-want-to-develep-comment-section-like-this-websites-stackoverflow-answer-modu">I want to develep comment section like this website&#39;s stackoverflow &ldquo;answer module&rdquo; using asp.net in c#</a> </p> </blockquote> <p>I am using a multiline textbox. Any user can post some article or content in that textbox. But other users should be able to like it (<strong>Like button</strong>). So later it can be displayed based on number of likes (<strong>Sorting</strong>). How to do this?</p>
c# asp.net
[0, 9]
5,155,100
5,155,101
Get last ID of dynamic div
<p>Couldn't find an answer, but Im trying to get the last ID of the last div that was created on the page. The code I'm using doesn't seem to work using .last(). My syntax is probably wrong but I can't get it to show the ID.</p> <pre><code> jQuery(document).ready(function() {jQuery("a.more_posts").live('click', function(event){ jQuery("div[id^='statuscontainer_']").last(); var id = parseInt(this.id.replace("statuscontainer_", "")); alert(id); }); }); </code></pre> <p>I figured out to do it this way and this worked.</p> <pre><code>jQuery(document).ready(function(){ jQuery("a.more_posts").live('click', function(event){ jQuery("div[id^='statuscontainer_']:last").each(function(){ var id = parseInt(this.id.replace("statuscontainer_", "")); alert(id); }); }); }); </code></pre>
javascript jquery
[3, 5]
4,733,095
4,733,096
Set Read status in SMS
<p>I'm writing a quick application for SMS Popup. What I want to do is, once the user closes the popup, the SMS should automatically be set as read. But I don't find a way to do so. I thought of using the date column. But its not working, I mean the no. of updated rows is always 0 This is my code:</p> <pre><code>public static int setMessageRead(Context context, long date, boolean isViewed){ try { ContentValues contentValues = new ContentValues(); if (isViewed){ contentValues.put("read", 1); contentValues.put("seen", 1); } else { contentValues.put("read", 0); } Log.d("SMS Popup", "Date: " + date); int rows = context.getContentResolver().update( Uri.parse("content://sms"), contentValues, "date=" + date, null); return rows; } catch (Exception ex) { Log.d("SMS Popup", "Message Read Exception", ex); return -1; } } </code></pre> <p>It always returns as 0. Date is in milliseconds as obtained by getTimestampMillis() method in my Broadcast receiver</p>
java android
[1, 4]
860,590
860,591
typecast problem with List class
<p>What is the bug here?</p> <pre><code>private void LoadUsers(List&lt;long&gt; uids, EventUser.EventUserStatus eventUserStatus, IList&lt;user&gt; chkfriends) { foreach (var f in chkfriends) { long l = f.uid; &lt;-- fails if (uids.Contains(l)) do it! } </code></pre> <p>Error 1 Cannot implicitly convert type 'long?' to 'long'. An explicit conversion exists (are you missing a cast?)</p>
c# asp.net
[0, 9]
899,868
899,869
javascript: alt attribute with special characters
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2775328/alt-attribute-encoding-with-javascript">Alt attribute encoding with JavaScript</a> </p> </blockquote> <p>I can't seem to assign special characters using javascript in alt tags and have them render in any browser.</p> <p>Without javascript, special characters in alt tags render fine (Pepsi&trade;):</p> <p><code>&lt;img id="pic" src="path/to/image.jpg" alt="Pepsi&amp;trade;" /&gt;</code></p> <p>However, when assigning this same value via javascript or jquery you get (Coke<code>&amp;trade;</code>).</p> <p><code>$("#pic").attr("alt","Coke&amp;trade;")</code> or <code>image = document.getElementById('pic'); image.alt="Pepsi&amp;trade;"</code></p> <p>This issue exists in chrome and IE6; I haven't tried other browsers. Any ideas?</p>
javascript jquery
[3, 5]
754,590
754,591
Why does delegate not work in "p" tag?
<p>When delegate with <code>p</code> tag, it does not work <a href="http://jsfiddle.net/peswe/wbVMV/4/" rel="nofollow">http://jsfiddle.net/peswe/wbVMV/4/</a></p> <p>HTML:</p> <pre><code>&lt;p id='test'&gt; &lt;div&gt;box 1 &lt;div&gt;box in box1&lt;/div&gt; &lt;/div&gt; &lt;/p&gt; </code></pre> <p>​ JavaScript:</p> <pre><code>$('p#test').delegate('div','click',function(){ alert('test'); }) </code></pre> <hr> <p>Changing <code>p#test</code> to <code>span#test</code> or <code>body</code>, it works <a href="http://jsfiddle.net/peswe/wbVMV/3/" rel="nofollow">http://jsfiddle.net/peswe/wbVMV/3/</a></p> <p>HTML:</p> <pre><code>&lt;span id='test'&gt; &lt;div&gt;box 1 &lt;div&gt;box in box1&lt;/div&gt; &lt;/div&gt; &lt;/span&gt; ​ </code></pre> <p>JavaScript:</p> <pre><code>$('span#test').delegate('div','click',function(){ alert('test'); }) </code></pre> <p>Please tell me something about it.Thank you very much!</p>
javascript jquery
[3, 5]
5,330,544
5,330,545
Remove element which matches multiple classes
<p>I'm trying to remove an element that holds two classes, one hard coded, and the other which is passed as a variable:</p> <pre><code>variable = 'class2'; $('.class1.'+variable).remove(); </code></pre> <p>This has no effect though!</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,152,052
3,152,053
Longpress simulation with onmousedown but also has onclick
<p>I have the following HTML</p> <pre><code>&lt;li onclick="setServerID(this);" class="server-item-item" data-server="1" onmousedown="serverHold(this);" onmouseup="serverRelease();"&gt;&lt;span&gt;MyServer&lt;/span&gt;&lt;/li&gt; </code></pre> <p>My JS looks like:</p> <pre><code>function setServerID(server) { sessionStorage.serverID = server.dataset.server; getServerInfo(); gotoMain(); } </code></pre> <p>And</p> <pre><code>function serverHold(server) { pressTimer = window.setTimeout(function() { var id = server.dataset.server; clearTimeout(pressTimer); $('#fav-the-server').css("visibility", "visible"); a.slide('fav-the-server', "left", 0, "200ms", "ease", "0ms", "1", "alternate", "running"); },1000); return false; } </code></pre> <p>This all works fantastically thanks to previous posts I looked up on SO but the issue is that its a touchscreen type app and it executes the <code>onclick</code> </p> <p>Anyway to do this that lets me get the following functionality:</p> <blockquote> <p>List Item -> Click and Hold for 1000ms -> Execute <code>serverHold</code> and do not execute the <code>setServerID</code></p> </blockquote> <p>AND</p> <blockquote> <p>List Item -> Click and do not hold or hold for less than 1000ms - > Execute <code>setServerID</code> only.</p> </blockquote> <p>Thanks!</p>
javascript jquery
[3, 5]
6,787
6,788
Run jQuery function on drop down change
<p>I have a jQuery function that current runs on Click. I need to change it so that it runs when a drop down box is changed. Here is my code:</p> <pre><code>&lt;form id="form1" name="form1" method="post" action=""&gt; &lt;label&gt; &lt;select name="otherCatches" id="otherCatches"&gt; &lt;option value="*"&gt;All&lt;/option&gt; &lt;/select&gt; &lt;/label&gt; &lt;/form&gt; </code></pre> <hr> <pre><code>$("#otherCatches").click(function() { $.ajax({ url: "otherCatchesMap.php&gt;", success: function(msg) { $("#results").html(msg); } }); }); </code></pre>
javascript jquery
[3, 5]
1,620,471
1,620,472
Generating form element with javascript and POSTing them to php works in EI not in Chrome and Firefox
<p>I cant get my head around this problem. I have a page on witch there is form genrated by php. Then Im using javascript to track number of selected checkboxes and in a real time generating a text with this information as well hidden input with this very same value I tried to use both jqueary and row javascript</p> <pre><code>var message=first+'&lt;input name="first_credit" type="hidden" value="'+first+'"/&gt;'; $('#render_second').html(message).show(); document.getElementById('render_second').innerHTML = message; </code></pre> <p>The value that is stored in variable first gets displayed correctly in all browsers, but when I post the form only in EI I get the value of first_credit. In FireFox and Chrome its as if that hidden element is not a part of form. </p> <p>Thank you for your time chaps.</p> <p>And here is the solution ... I opened the table tag, then the form opening tag and then trs and tds one of witch contained the div in to witch I was rendering the input field. All I did is, first open the form tag and then table tag and it all works fine :-) Sory to waste your time folks...</p>
php javascript
[2, 3]
2,968,562
2,968,563
is it possible to play system sound through phone app?
<p>Is there a way to play sound through the iPhone or android phone app. Can I play a sound so the other party can hear a song. Is there API access to the telephone stack.</p>
android iphone
[4, 8]
2,242,318
2,242,319
How can I turn content on or off based on the day of the week?
<p>I am using the jQuery cycle plugin to run a basic slider containing 3 slides (A, B, C) of a text header and an image.</p> <p>I want to be able to display slide A and B on Mon, Wed, Fri, Sun;</p> <p>then slide A and C on Tue, Thurs, Sat.</p> <p>So I am looking for some kind of script or PHP based solution to turn content on and off based on the day of the week. Does anyone have any suggestions for the best approach?</p> <p>Here is a link to an example of my code (can't get it to display fully in this post):</p> <p><a href="http://www.alexcreedy.com/slide/sample-code-for-forum.html" rel="nofollow">http://www.alexcreedy.com/slide/sample-code-for-forum.html</a></p> <p>regards, Alex</p>
php jquery
[2, 5]
2,663,494
2,663,495
Is there a jQuery image cropping plugin similar to Facebook's image crop?
<p>I know there are thousands of jQuery plugins for image crop, but the one I need is similar to Facebook's image crop: a draggable fixed size square over a image, or a draggable image under a fixed size square.</p> <p>I think there's a simple elegant code for it, instead of a 10k-50k framework for image manipulation that I'm finding everywhere.</p>
javascript jquery
[3, 5]
4,061,597
4,061,598
Change div value based on textbox value using jQuery
<p>I created this fiddle that the div value changes based on your dropdown list selection. <a href="http://jsfiddle.net/qSkZW/20/" rel="nofollow">http://jsfiddle.net/qSkZW/20/</a></p> <p>I want to take it one step further and this is to create a textbox field that if you add for example the number <code>2</code> it will change the div value to 240 (in real the 120 you find in the script it will be a php var). If it writes <code>3</code> then to 360.</p> <p>Additionally there must be two limitations.</p> <ol> <li>Prevent them from using non-numeric characters.</li> <li>The maximum number is pre-configured (from a php variable). Like if the max value is set to 10, if the user writes 30 it will return to 10.</li> </ol> <p>Thank you for your help.</p>
javascript jquery
[3, 5]
4,554,931
4,554,932
jquery and updatepanel?
<p>I have an updatepanel in ASP.NET that does a partial page refresh. </p> <p>I've had some success using jQuery's <code>on()</code> method, however <code>$(document).ready(function(){})</code> is only called during the initial load of a page, rather than after each updatepanel refresh.</p> <p>I think I could probably trigger it using '<code>ScriptManager.RegisterStartupScript()</code>' but would prefer a 'cleaner' method. Do any exist?</p>
javascript jquery asp.net
[3, 5, 9]
515,957
515,958
Membership.GetUser - table + field
<p>When I use:</p> <pre><code>Membership.GetUser(User.Identity.Name) </code></pre> <p>does anyone know which table and field User.Identity.Name corresponds to when I use the 'standard asp.net membership provider tables' like these:</p> <pre><code>aspnet_Membership aspnet_Users </code></pre> <p>Thanks.</p>
c# asp.net
[0, 9]
2,501,546
2,501,547
Dynamic images resizing
<p>I'm working on project where we are trying to adopt and resize template images to the various resolutions. For example if the website is viewed in 800px width (800x600) and 1024px width or larger the image size should be viewed in same quality. I've had in mind to use sprite with 3 types of images for each range of this template , but I'm looking for other ideas , php gd maybe ? Any python solution ? </p>
php javascript jquery python
[2, 3, 5, 7]
1,413,237
1,413,238
javascript detect browser close tab/close browser
<p>any cross browser javascript/jquery to detect if browser is closing tab or closed browser ? and should not activate event when go to other link? </p>
javascript jquery
[3, 5]
5,680,509
5,680,510
A Java and PHP application
<p>Is it possible to build a Java web application which has a PHP front end ?</p> <p>I want all my web pages to be coded in PHP. Most of them will be forms.</p> <p>I want all the data submitted by a form to go to a Java Code.</p> <p>I want to do all manipulation in back end and all rendering of web content on the front end.</p> <p>This is just a general question as I was probing for different options for my java web application.</p>
java php
[1, 2]
2,189,941
2,189,942
Validating Checkbox and Radio Button in C#
<p>I am using c# for coding!</p> <p>Below is my html for checkbox and radion button</p> <pre><code> &lt;input type="radio" style="float: left;" name="documents" id="Checkbox9" value="yes" runat="server" /&gt; &lt;label style="width: 35px!important;" class="checkbox"&gt; &lt;%=GetResourceString("c_HSGStudent")%&gt; &lt;/label&gt; &lt;input type="radio" style="float: left;" name="documents" id="Checkbox10" value="no" runat="server" /&gt; &lt;label style="width: 25px!important;" class="checkbox"&gt; &lt;%=GetResourceString("c_HSGParent")%&gt; &lt;/label&gt; &lt;input type="radio" style="float: left;" cheked name="documents" id="Radio1" value="yes" runat="server" /&gt; &lt;label style="width: 35px!important;" class="checkbox"&gt; &lt;%=GetResourceString("c_HSGStudent")%&gt; &lt;/label&gt; &lt;input type="radio" style="float: left;" name="documents" id="Radio2" value="no" runat="server" /&gt; &lt;label style="width: 25px!important;" class="checkbox"&gt; &lt;%=GetResourceString("c_HSGParent")%&gt; &lt;/label&gt; </code></pre> <p>You can see I have two checkboxes and two radio buttons, My problem is that on my submit button click I want to check whether user have checked at-least one checkbox or radio button. It will be good if we can have .NET solution like (customvalidator).</p> <p>Please suggest!</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,746,242
1,746,243
window.Open Open popup Instead of new window
<p>I have a ajax function in jQuery and i want in compelet function open a url in new window or tab.</p> <pre><code>&lt;a href="#" onclick="Add('1','http://www.google.com');return false;"&gt;Link&lt;/a&gt; </code></pre> <p>And :</p> <pre><code>function Add(ID, url) { var data = "{'ID' : '" + ID + "'}"; $.ajax({ type: "POST", url: "Function.ashx/Add", data: data, contentType: "application/json; charset=utf-8", dataType: "json", complete: function () { window.open(url); } }); } </code></pre> <p>windows.open fucntion work as popup but i want to open link in a new window. <a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_openwindow" rel="nofollow">w3School Example</a> work prefect. but my window detect as popup and blocked.<br> what's wrong with my code</p>
javascript jquery
[3, 5]
2,538,098
2,538,099
Save/output dynamically generated html source using jquery
<p>I have a search form that can be built dynamically by the user using code such as:</p> <p><code>$('tr.form_row:last').clone(true).insertAfter('tr.form_row:last');</code></p> <p>All of this is working fine, however, I would like to save the dynamically generated form html when the form is submitted. I have tried using <code>$(#my_form').html()</code> but this doesn't appear to have the dynamic content, instead, it's just the default html before customisation that is gathered.</p> <p>Is there a way of getting the generated source using javascript/jquery? It would need to include the value within the input fields that the user has typed etc.</p> <p><strong>EDIT</strong> - I've included my coding so far:</p> <p>This is the coding I have tried - it uses jquery form plugin and I populate a hidden form field called 'search_html':</p> <pre><code>var search_form = { beforeSubmit: function() { var search_html = '&lt;table&gt;'; $('.form_row').each(function() { search_html += $(this).html(); }); search_html += '&lt;/table&gt;'; $("#search_html").val(search_html); }, success: function(html) { $('#search_output').html(html); } }; $('#search_form').ajaxForm(search_form); </code></pre> <p>When I submit the form, HTML is passed within the hidden 'search_html' field, but it is only the first table row and doesn't have the values of the input fields populated.</p>
javascript jquery
[3, 5]
5,565,021
5,565,022
append fails when target a class auto-generated by cms system
<p>I need help on the following.</p> <p>The only way to solve this is be able to target the class. else what i am trying will not work. (I need to <strong>append</strong> some buttons behind the input field) The cms system generate the code for the input class itself. (apparently added on load screen) somehow there is now way i can target this with jquery…? or i just miss some skill be able to do so?</p> <p>my jquery code:</p> <pre><code>$(".theInput").append($addButtons); </code></pre> <p>when i change <code>.theInput</code> with a other <strong>class</strong>, all working, but .<em>theInput</em> is just not WORKING.</p> <p>NEED HELP</p> <p>auto-generated by the cms system where i have totally no control to adjust it.</p> <pre><code>&lt;td class="system"&gt; &lt;div class="cell"&gt; &lt;input onchange="some long code" class="theInput" type="text" value="1" /&gt;&lt;/div&gt; &lt;div class="cell"&gt; &lt;input onchange="some long code" class="theInput" type="text" value="1" /&gt;&lt;/div&gt; &lt;div class="cell"&gt; &lt;input onchange="some long code" class="theInput" type="text" value="1" /&gt;&lt;/div&gt; and so on. &lt;/td&gt; </code></pre>
javascript jquery
[3, 5]
5,798,627
5,798,628
FileUpload1.HasFile is always returning false
<p>I am uploading file using ASP.net File upload control. My FileUpload1.HasFile is always returning false.</p> <pre><code>if (FileUpload1.HasFile) { DBOperations db = new DBOperations(); try { FileUpload1.SaveAs(Server.MapPath("~/uploadedImages/" + db.uploadImage(System.IO.Path.GetExtension(FileUpload1.FileName)) + System.IO.Path.GetExtension(FileUpload1.FileName))); } catch (Exception Ex) { String he = Ex.Message; } } </code></pre> <p>I am using following ASP.net Code</p> <pre><code>&lt;asp:UpdatePanel ID="fileUpload" runat="server"&gt; &lt;ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="btnUploadFile" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; &lt;asp:Button ID="btnUploadFile" Text="Upload File" runat="server" onclick="btnUploadFile_Click" /&gt; &lt;br /&gt; &lt;asp:RegularExpressionValidator ID="revImage" ControlToValidate="FileUpload1" ValidationExpression="^.*\.((j|J)(p|P)(e|E)?(g|G)|(g|G)(i|I)(f|F)|(p|P)(n|N)(g|G))$" Text="Invalid image type" runat="server" /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>I have tried even by removing AsyncPostBackTrigger and even by removing Whole asp:updatePanel then also my FileUpload1.HasFile always returns false.</p>
c# asp.net
[0, 9]
211,051
211,052
Timing issue with jQuery and $(document).ready()
<p>I have the following code block code when the document is ready:</p> <pre><code>$(document).ready(function() { createDivs(); // creates some divs with class 'foo'; // iterate $(".foo").each(function(index) { alert(index + " - " + $(this).text()); }); } </code></pre> <p>I find that the "iterate" part misses the divs I created in the createDivs() method entirely! Is there some timing issue I'm not aware of? Why doesn't jquery see the divs that were just created?</p>
javascript jquery
[3, 5]
4,177,667
4,177,668
reload page to reflect changes
<p>I've my jquery code</p> <pre><code>.ajax({ type: "POST", url: "crop/crop.php", data: dataString, cache: false, success: function(data){ $('#popupMargin').hide(); $('#avatar img').remove(); $('#avatar').load('crop/dp.php'); //$('#avatar').hide(); } }); </code></pre> <p>Now</p> <pre><code>//Codes in the file loaded (`dp.php`) called by jQuery above &lt;?php session_start(); ?&gt; &lt;!-- To display display picture just after croppping --&gt; &lt;img src="users/&lt;?php echo $_SESSION['userId']; ?&gt;/img/dp.jpg" width="150"&gt; </code></pre> <p>The above ajax is called whenever I clicked a button <code>#btn</code>. The file <code>crop.php</code> crops an image and saves it at the same location and same name as seen above in the <code>dp.php</code>.</p> <p>So it means, everytime the user clicks on the button <code>#btn</code>, the image is changed. I want the change to be reflected as <code>$('#avatar').load('crop/dp.php');</code> is called in the jQuery code above; however, I'm not sure if it's some kind of caching that the old image still shows up.</p> <p>Does <code>.load()</code> reloads the page? How do I make sure that the change (updated image) is shown instead of the old one??</p>
javascript jquery
[3, 5]
4,786,349
4,786,350
jQuery: When getting the value of an element, do I need to declare the variable in document ready?
<p>I'm storing the value of a specific form element as a variable. This same value is used in multiple functions.</p> <pre><code>function one() { var selectedRole = $('#RegistrationRole_ID').val(); } function two() { var selectedRole = $('#RegistrationRole_ID').val(); } </code></pre> <p>I'd like to make this a global variable so I don't have to keep selecting it in each of my functions. So my question is, am I able to still get the value correctly if I declare the variable outside of my document ready block?</p> <pre><code>&lt;select id="RegistrationRole_ID"&gt; &lt;option value="1"&gt;one&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I think I might have answered my own question...it's possible that the value may change from when the document is loaded. Really, what I am trying to do is remove duplicate code, where I get the value of the element multiple times. Do you have a suggestion for this?</p>
javascript jquery
[3, 5]
5,318,653
5,318,654
Cannot get javascript innerHtml to work on WebView
<p>I am using a WebView with a javaScript interface. All I want to do is change the inner html of a span if some checkboxes are ticked.</p> <p>Below is a snippet of a String I have in strings.xml. The form will call this function onSubmit and should not continue if it does not pass. The problem is that I can't get the innerHtml working (is returns true everytime).</p> <p>This works</p> <pre><code>&lt;script type=\"text/javascript\" language=\"javascript\"&gt; function pass() { return javaInterface.checkboxPass(); /* if(passed) { //change the instructions document.getElementById(\"txtInstructions\").innerHTML = \'Loading Website...\'; } return passed; */ } &lt;/script&gt; </code></pre> <p>This returns true everytime</p> <pre><code>&lt;script type=\"text/javascript\" language=\"javascript\"&gt; function pass() { var passed= javaInterface.checkboxPass(); if(passed) { //change the instructions document.getElementById(\"txtInstructions\").innerHTML = \'Loading Website...\'; } return passed; } &lt;/script&gt; </code></pre> <p>This is the span in the body of the document</p> <pre><code>&lt;span id=\"txtInstructions\"&gt;%1$s&lt;/span&gt; </code></pre> <p>What am I doing wrong?</p>
javascript android
[3, 4]
5,197,115
5,197,116
hover to show content of a name anchor in a popup instead of click to go to the content
<p>I have a long html, the contents have references for other text.</p> <p>For example:</p> <pre><code>What is your &lt;a href="#A8"&gt;favorite&lt;/a&gt; day? &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;div id="A1"&gt;Monday&lt;/div&gt; &lt;div id="A2"&gt;Tuesday&lt;/div&gt; &lt;div id="A3"&gt;Wednesday&lt;/div&gt; &lt;div id="A4"&gt;Thursday&lt;/div&gt; &lt;div id="A5"&gt;Friday&lt;/div&gt; &lt;div id="A6"&gt;Saturday&lt;/div&gt; &lt;div id="A7"&gt;Subday&lt;/div&gt; &lt;div id="A8"&gt;It's a good day.&lt;/div&gt; </code></pre> <p>I hope to have a function to hover on an anchor tag to show the content in a popup or dialog of the anchor name instead of clicking to go to the content. No go back and forth.</p> <p>If hovering on <code>#A8</code>, it will show the content of <code>A8</code>, that's "It's a good day. "</p>
php javascript jquery
[2, 3, 5]
190,896
190,897
Putting datatable comma separated values in a string
<p>My datatable consists of a column named "ID". The no. of values in this column varies.Sometimes this Datatable fetches 3 IDs in that ID column, sometimes 2. Now if for example, my datatable has three values as 1,2,3. What I want is to put these three values in a string and separate them by commas as folows:-</p> <pre><code>string test= "1,2,3"; </code></pre> <p>If Datatable has 2 values, then string should be as follows:-</p> <pre><code>string test= "1,2"; </code></pre> <p>I did try but in vain. Please help. Thanks.</p> <p>edit:-</p> <pre><code>DataTable dt=new DataTable; dt = obj.GetIDs(); for (int i = 0; i &lt; dt.Rows.Count; i++) { string test= "What should be here????"; } </code></pre> <p><strong>edit 2</strong></p> <pre><code> foreach(DataRow dr in dt.Rows) { string str = str + "," + Convert.ToString(dr("ID")); } </code></pre> <p>@Rajeev ::Tried this..it says dr is a variable but used as a method. What's wrong?</p>
c# asp.net
[0, 9]
2,681,755
2,681,756
Using one javascript code on multiple sections
<p>I don't know much about jQuery but I've been using the following javascript code to make a table keep the scroll bar location upon pageback:</p> <pre><code>&lt;script type="text/javascript"&gt; window.onload = function () { var strCook = document.cookie; if (strCook.indexOf("!~") != 0) { var intS = strCook.indexOf("!~"); var intE = strCook.indexOf("~!"); var strPos = strCook.substring(intS + 2, intE); document.getElementById("grdWithScroll").scrollTop = strPos; } } function SetDivPosition() { var intY = document.getElementById("grdWithScroll").scrollTop; document.cookie = "yPos=!~" + intY + "~!"; } &lt;/script&gt; </code></pre> <p>and</p> <pre><code>&lt;div id="grdWithScroll" onscroll="SetDivPosition()"&gt; </code></pre> <p>It works great for a single div. But how could I extend this for use with a second div section?</p>
javascript jquery
[3, 5]
3,065,477
3,065,478
How do I position html intense widget without interfering with search optimization
<p>I have a widget that is comprised of quite a few divs. I then use javascript to bring the widget to life and do what it is supposed to do.</p> <p>It is positioned on the page above the main content. </p> <p>The client feels having all the widget html above the keyword rich content is bad for rankings, yet visually this is how we want the page set up.</p> <p>What are some options here to keep the widget positioned as we want, yet not clutter up the top of the page as it is crawled?</p> <p>current setup:</p> <p>-javascript file is called in head -widget html, which is several divs, text, images, etc. -other page content divs </p>
php javascript
[2, 3]
4,312,558
4,312,559
How to turn this static init into a dynamic one
<p>I have this fancybox plugin wich is great, but I don't think there is enough examples on the <a href="http://fancyapps.com/fancybox/" rel="nofollow">documentation</a></p> <pre><code>$(document).ready(function(){ $('nav.main a#gallery').live('click',function() { $.fancybox([ {href : 'img/galeria/fondo1.jpg', title : 'Title1','nextEffect' : 'fade', 'prevEffect' : 'fade'}, {href : 'img/galeria/fondo2.jpg', title : 'Title2','nextEffect' : 'fade', 'prevEffect' : 'fade'}, {href : 'img/galeria/fondo3.jpg', title : 'Title3','nextEffect' : 'fade', 'prevEffect' : 'fade'}, {href : 'img/galeria/fondo4.jpg', title : 'Title4','nextEffect' : 'fade', 'prevEffect' : 'fade'} ]); }); }); </code></pre> <p>Well as you can see this loads a few images in the fancybox.</p> <p>I would like to be able to do it by passing a javascript object to it so I don't need to know which, or how many images there are (in the init) and manage that updating the object, but I just don't see how to do this.</p> <p>Can anyone help.</p>
javascript jquery
[3, 5]
70,666
70,667
PHP / JQuery clone hidden table row, add to end of table
<p>I've got a table, with the first TR hidden (style="display:none;"). I have a button at the top of the table to allow users to add a new row to the table. When clicked, I would like the hidden row to be cloned and added to the bottom of of the table. I'm thinking this is the best way as I can pre-format the row to contain exactly what I need in the NEW row.</p> <p>Here is the JQuery I have so far:</p> <pre><code>$(document).ready(function($) { $(".dispadd").click(function() { $('#hiddenrow').clone().show().appendTo( $('#hiddenrow').parent() ); }); }); </code></pre> <p>It appears to add the row as expected, but within a second, the new row disappears. Anyone see what I'm doing wrong?</p> <p><em><strong></em>__<em>_</em>__<em></strong> LATEST CODE <strong></em>__<em>_</em>____</strong></p> <pre><code>$(document).ready(function($) { $(".dispadd").click(function(event) { event.preventDefault(); $('#hiddenrow') .clone() .removeAttr('id') .show() .appendTo( $('#disptable').after().show() ); }); }); </code></pre> <p>I had to modify it a bit after having to move the #hiddenrow outside the parent table. How do I set the value of one of the inputboxes in the cloned row?</p>
php jquery
[2, 5]
3,510,513
3,510,514
jQuery parent of a parent
<p>I am currently trying to find the parent of a parent of an element. I have a link being clicked that is in a <code>&lt;td&gt;</code>, and I'd like to get the <code>&lt;tr&gt;</code> object.</p> <p>Why wont "$(this).parent().parent()" work? What will?</p> <p>Thanks,<br /> Brendan</p> <p><strong>Edit:</strong> It appears an error in my syntax was throwing the whole thing off. "$(this).parent().parent()" does in fact work, but I wound up going with $(this).closest('tr')" because it seems like the most efficient solution.</p>
javascript jquery
[3, 5]