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
1,288,205
1,288,206
jQuery reset buttons
<p>I have a player I am working with that has the ability to add JS event listeners so that you can control the player using jQuery or any other method of JS.</p> <p>I have a bunch of play buttons in a list next to a list of audio files. When one clicks the play button, the play button hides and a pause button appears. The problem I am running into is that if one is listening to a track and the pause button is showing and then they click on another play button, the list of buttons doesn't reset and then they see two pause buttons instead of just the one next to the audio file they are listening too.</p> <p>Here is my Javascript code:</p> <pre><code>$('.btn-control').live("click", function() { var $action, jw_content, playerData, self; self = $(this); console.log(self.parent()); self.parent().find('.pause').hide(); $action = self.attr('data-player-action'); self.hide(); self.parent().find('.btn-control').not(self).css('display', 'block'); switch ($action) { case "play": $('#player_area').slideDown('200'); $('#player_wrapper').show(); jw_content = jQuery.parseJSON(self.attr('data-player-feed')); playerData = { 'streamer': jw_content.Location, 'file': jw_content.Resource }; return jwplayer().load(playerData).setMute(true).play(true); case "pause": return jwplayer().pause(); } }); </code></pre>
javascript jquery
[3, 5]
566,608
566,609
How do I listen for specific button presses, and home view user interactions?
<p>My application listens for user input from the touchscreen and the buttons, but I would like to listen for interaction with specific items in the homescreen view. So, for example, I need to listen for the user to tap the menu button, and then to produce output. Is there a paramater I can pass through the onClick() class? Or do I need to take another route? </p>
java android
[1, 4]
4,500,455
4,500,456
Combat system in JQuery
<p>i would like to create a pretty simple combat system in JQuery, for a browser game. The idea is that i have combat statistics ( i already have that ), and i want to represent them back to the user in a nice graphical manner.</p> <p>If you have played the game shakes and fidget, you can already see what i'm asking. If not, think that two parties are fighting, visualize two images. The first party attacks, then the second, then the first again and so on..</p> <p>Ideally, each time a party attacks, i should show the damage done (probably like flashing the damage right on top of the image associated with that party). Then the health meter goes down (i actually have that bar, so it's not a problem).</p> <p>My main problem, is how to do that in like a manner that seems like the story of the battle unravels. Should it be sort of like a timer ? And then, how do i actually present flashing values in a nice manner ?</p> <p>Any related tutorials or resources on that topic would be greatly appreciated :)</p> <p>NOTE that i'm looking for code help, samples even better, that would help me in actually coding that.</p>
javascript jquery
[3, 5]
4,499,520
4,499,521
jQuery select by input name
<p>I have this input:</p> <pre><code>&lt;tr&gt;&lt;td class="forms"&gt;Price:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="price" size="30"/&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>How can I call this input?</p> <p>Example: With this code I call to the id:</p> <pre><code>$("#numberclasses").change(function() { </code></pre> <p>And I call to the class with this:</p> <pre><code>$(".numberclasses").change(function() { </code></pre> <p>But How can I call to the name?</p>
javascript jquery
[3, 5]
1,523,506
1,523,507
How to create public and private members?
<p>I'm a bit confused, how can I create public and private members.</p> <p>My code template so far is like:</p> <pre><code>(function()){ var _blah = 1; someFunction = function() { alert(_blah); }; someOtherFunction = function() { someFunction(); } }(); </code></pre>
javascript jquery
[3, 5]
4,777,864
4,777,865
Making Properties of a object as Nullable type?
<p>Is that a good practice when i need to pass DBnull by properties.To make them as a nullable type. Cause when we need to Pass Null value to Backend by our Variables.We made them as Nullable.But is This okay With Properties also.</p>
c# asp.net
[0, 9]
2,393,428
2,393,429
ASP.Net - Call Method from markup that includes data-binding
<p>I have a user control in C# in ASP.NET. This user control has a method in the code-behind that is defined as follows:</p> <pre><code>protected string GetGreeting(string name) { if (String.IsNullOrEmpty(name)) { return "Hello"; } else { return "Hello " + name; } } </code></pre> <p>My markup looks like the following:</p> <pre><code>&lt;asp:Repeater ID="listRepeater" ClientIDMode="Static" runat="server" OnLoad="listRepeater_Load"&gt; &lt;HeaderTemplate&gt; &lt;table id="listTable" style="width:100%;"&gt; &lt;thead&gt;&lt;tr&gt; &lt;th&gt;Greeting&lt;/th&gt; &lt;th&gt;Actions&lt;/th&gt; &lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;tr&gt; &lt;td&gt;&lt;%# GetGreeting("FullName")%&gt;&lt;/td&gt; &lt;td&gt;&lt;a href='#'&gt;view info&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>How do I bind the FullName property of the record in my data source? Right now, I keep seeing "Hello FullName". I want to see something like "Hello John Smith". What am I doing wrong?</p> <p>Thank you!</p>
c# asp.net
[0, 9]
823,322
823,323
How do i only allow a text box to only have numbers and the following percent symbol?
<p>I am currently building an application and I want a javascript or jquery condition that only allows numbers to be entered into the text box and/or the following percent but i am not sure how to obtain this... I found <a href="http://stackoverflow.com/questions/469357/html-text-input-allow-only-numeric-input">this</a> but how do i allow the following percent</p>
javascript jquery
[3, 5]
4,661,601
4,661,602
Issue, echoing HTML with script in it, in need of third ' "
<pre><code>&lt;?php echo ' &lt;input type="file" name="image_path" style="visibility:hidden;" id="image_file"&gt; &lt;div class="input-append"&gt; &lt;input id="photoCover" class="input-large" type="text"&gt; &lt;a class="btn" onclick="$('input[id=image_file]').click();"&gt;Browse&lt;/a&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; $('input[id=image_file]').change(function() { $('#photoCover').val($(this).val()); }); &lt;/script&gt; '; ?&gt; </code></pre> <p>As you see, this presents a conflict at </p> <pre><code>&lt;a class="btn" onclick="$('input[id=image_file]').click();"&gt;Browse&lt;/a&gt; </code></pre> <p>and at </p> <pre><code>&lt;script type="text/javascript"&gt; $('input[id=image_file]').change(function() { $('#photoCover').val($(this).val()); }); &lt;/script&gt; </code></pre> <p>due to the script start ' ending the echo ' how would you fix this? Sorry if it is a stupid question </p>
php javascript
[2, 3]
2,923,732
2,923,733
Unordered List item <Li>'s not able to retain class when given programatically
<p>Asalamualikum(May Peace be on you) , My Problem is that I am trying to change the class of li item when its item is clicked . I succeed in that but problem is that class is given to li item but its not able to retain class.</p> <p>My html and jquery is like this </p> <pre><code>$(document).ready(function () { //On Click Event $("ul.tabs li").click(function () { $("ul.tabs li").removeclass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab }); }); &lt;/script&gt; &lt;div class="menu_nav"&gt; &lt;ul class="tabs"&gt; &lt;li&gt;&lt;a href="default.aspx"&gt;&lt;span&gt;Home Page&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="support.aspx"&gt;&lt;span&gt;Support&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="aboutus.aspx"&gt;&lt;span&gt;About Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="services.aspx"&gt;&lt;span&gt;Services&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="contactus.aspx"&gt;&lt;span&gt;Contact Us&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
jquery asp.net
[5, 9]
5,023,792
5,023,793
jQuery - text field value change after jquery auto complete select event
<p>Simple text field change after jquery auto complete select event. I want to split the data and display it in other text fields. I am trying this. This doesn't change any values at all. What do I need to change here? </p> <pre><code>$(function() { $("#term").autocomplete({ source: function (request, response) { $.post("/users/search", request, response); }, minLength: 2, select: function(event, ui){ $('#div2').html(ui.item.value); #doesn't populate with new text. document.getElementById('#found').value="test"; #for test } #doesn't populate with new text. #I want selected data to go here in the 'found' element id }); }); </code></pre> <p>Ruby/html - </p> <pre><code>&lt;%= text_field_tag :found, nil, :maxlength =&gt; 11, :size =&gt; 20%&gt; &lt;input id="found" maxlength="11" name="found" size="20" type="text" /&gt; </code></pre>
javascript jquery
[3, 5]
3,069,980
3,069,981
select loses focus when mouse is over options
<p>I am trying to do a hover effect as follows:</p> <pre><code>&lt;div&gt;Some Text&lt;/div&gt; </code></pre> <p>should be substituted by a <code>&lt;select&gt;</code> upon mouseover. as soon as the mouse leaves that select it should display either the value previously displayed or the new selected value.</p> <p>Unfortunately the mouseleave is called when you open the dropdown to select some options and I cannot get it to work. Has anyone had this problem before and knows the solution?</p> <pre><code>&lt;div id="text"&gt;Some Text&lt;/div&gt; &lt;select id="selector" style="display: none"&gt; &lt;option value="1" selected="selected"&gt;Some Text&lt;/option&gt; &lt;option value="2"&gt;Some More&lt;/option&gt; &lt;option value="3"&gt;Some Other&lt;/option&gt; &lt;/select&gt; </code></pre> <p>the jQuery:</p> <pre><code>$("#text").mouseover(function() { $(this).hide(); $("#selector").show(); }); $("#selector").mouseleave(function() { $(this).hide(); $("#text").show(); }); </code></pre> <p>Can anyone let me know how I can make sure that the mouseleave isn't called when somebody is opening the select and hovers over the options?</p> <p>BTW: It does work when the mousebutton is being pressed during the selection</p>
javascript jquery
[3, 5]
847,242
847,243
Web Application Architecture (ASP.NET 3.5,JavaScript)
<p><strong>hey all ,</strong></p> <p>background -</p> <p>I'm using an activx that allow me to access some information on the client side,</p> <p>By using the activex events and callback i'm updating server side from client.</p> <p>i wrote a user control that register all activex's events so when one of the events occuer there is a callback to the server that handle this event.</p> <p>I need to write some other user controls based on this control so on every callback this user controls will be render on the client side.</p> <p><strong>My question is -</strong></p> <p>what is the best way to make a shared infrastructure that handle this events and render the right content base on user controls? is there any other ways i can use ?</p> <p>thanks!</p>
asp.net javascript
[9, 3]
181,093
181,094
accessing an id within another id jquery
<p>Here's what I'm trying to do. I'm trying to get a block of code written in div then modify some of the div/id to different names and so I can send them to the form with unique names. Any ideas on how to do this? My idea right now is to first set the variable to to the div that I'm copying then access the other div's within it, but that doesn't seem to work. Any ideas?</p> <pre><code>var i = 0; $("#custom_rates").click(function() { var sublet_dates_seen = $("#sublet_dates_seen").clone(); // all id's below are within #sublet_dates_seen sublet_dates_seen.getElementById('#CustomPricePerNightPrice').attr('name','data[CustomPricePerNight][price][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateMonth').attr('name','data[CustomPricePerNight][start_date][month][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateDay').attr('name','data[CustomPricePerNight][start_date][day][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateYear').attr('name','data[CustomPricePerNight][start_date][year][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateMonth').attr('name','data[CustomPricePerNight][end_date][month][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateDay').attr('name','data[CustomPricePerNight][end_date][day][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateYear').attr('name','data[CustomPricePerNight][end_date][year][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightMinimumNights').attr('name','data[CustomPricePerNight][minimum_nights][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightMaximumNights').attr('name','data[CustomPricePerNight][maximum_nights][' + i ']'); sublet_dates_seen.appendTo(".avi_specialrates"); i = i + 1; return false; }); </code></pre>
javascript jquery
[3, 5]
2,539,325
2,539,326
Android 1.5/1.6 issue with style and autogenerated R.java file
<p>I'm having strange issue with R.java file and styles defined in my resources.</p> <p>Here's some code:</p> <p>In res/values/strings.xml:</p> <pre><code>&lt;style parent="android:Theme.Dialog" name="PopupWindowStyle"&gt; &lt;item name="android:windowBackground"&gt;@drawable/bg1&lt;/item&gt; &lt;item name="android:textColor"&gt;@android:color/black&lt;/item&gt; &lt;/style&gt; </code></pre> <p>In AndroidManifest.xml:</p> <pre><code>&lt;activity android:name=".RegisterScreen" android:icon="@drawable/ico" android:label="@string/applicationName" android:theme="@style/PopupWindowStyle" android:configChanges="locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|fontScale"&gt; &lt;/activity&gt; </code></pre> <p>In autogenerated gen/.../R.java:</p> <pre><code>public static final class style { public static final int PopupWindowStyle=0x7f090000; } </code></pre> <p>After some changes in the project, eclipse changed autogenerated value for <code>PopupWindowStyle</code> from 0x7f080000 to 0x7f090000. After that, on Android 1.5, <code>RegisterScreen</code> activity is displayed without <code>PopupWindowStyle</code> style - there is an error displayed in logcat:</p> <p><code>Skipping entry 0x7f090000 in package table 0 because it is not complex!</code></p> <p>On Android 1.6 however everything works fine - <code>PopupWindowStyle</code> works like it was before it's integer value has changed.</p> <p>I was testing this issue, by reverting the source code to older revisions. I can confirm, that this problem started occurring after src code commit, which changed two files completely unrelated to this part of code - and an autogenerated R.java file.</p> <p>Any idea what could cause that? </p>
java android
[1, 4]
4,381,676
4,381,677
How do I access public properties when sharing webforms codebehind for user control
<p>I am trying to make an ascx control that can be templated by our front-end developers by just making a new .ascx and pointing to that specific .ascx in that instance. However, I am having issues with accessing properties in shared code-behind scenarios.</p> <p>I have the following code behind that's shared</p> <pre><code>public partial class TemplateCodeBehind : TemplateControlBase { protected void Page_Load(object sender, EventArgs e) { } // Ascx Available properties public string GetOption1Value { get { return Option1; } } public string GetOption2Value { get { return Option2; } } public string GetOption3Value { get { return Option3; } } public string GetOption4Value { get { return Option4; } } } </code></pre> <p>Note that those options that are returned are public properties of the <code>TemplateControlBase</code> class. In my Templates subfolder I have the following ascx</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="false" CodeBehind="../TemplateCodeBehind.ascx.cs" Inherits="MyNamespace.JqueryTemplates.TemplateCodeBehind" %&gt; &lt;%@ Import Namespace="MyNamespace.JqueryTemplates" %&gt; &lt;div&gt; Option1: &lt;%= GetOption1 %&gt; &lt;/div&gt; </code></pre> <p>This compiles fine, but when I try to load my test ascx I get the following error</p> <blockquote> <p>An error has occurred. DotNetNuke.Services.Exceptions.PageLoadException: c:\Projects\DNN-Dev\Website\DesktopModules\Module.JqueryTemplates\Templates\Test.ascx(5): error CS0103: The name 'GetOption1' does not exist in the current context </p> </blockquote> <p>I have tried changing <code>&lt;%=</code> to <code>&lt;%#</code> and calling <code>Page.Databind()</code> but nothing seems to work.</p> <p>Any ideas on how I can accomplish this?</p>
c# asp.net
[0, 9]
5,084,206
5,084,207
Checkbox onChange submit problem if checked
<p>The purpose is to have a checkbox, that if clicked, will send via post where I will update the db. The user can check back and forth to set or unset active status.</p> <p>This works perfectly:</p> <pre><code>&lt;form name='form".$value['id']."' action='./filter_edit.php' method='post'&gt;&lt;input type='checkbox' name='checkbox[".$value['id']."]' value='".$newActive."' onclick='document.form".$value['id'].".submit();' /&gt;&lt;/form&gt; </code></pre> <p>However, using the code above, the box never appears checked.</p> <p>With the below code, once the field is set to active where the box will be checked, clicking to uncheck the box does submit but sends no post variables.</p> <pre><code>&lt;form name='form".$value['id']."' action='./filter_edit.php' method='post'&gt;&lt;input type='checkbox' name='checkbox[".$value['id']."]' value='".$newActive."'"; if($value['active'] == 1) echo " checked='checked'"; echo" onclick='document.form".$value['id'].".submit();' /&gt;&lt;/form&gt; </code></pre>
php javascript
[2, 3]
1,890,149
1,890,150
Multiple document.write from external scripts
<p>I have a URL that generates a document.write method that inserts another JS.</p> <p>Example:</p> <pre><code>http://domain.com/scriptONE.js </code></pre> <p>Generates</p> <pre><code>document.write('http://domain.com/scriptTWO.js'); </code></pre> <p>How can I use jQuery to insert the second document.write to a div not an iFrame - so that my div contains only the output from this file</p> <pre><code>http://domain.com/scriptTWO.js </code></pre>
javascript jquery
[3, 5]
457,546
457,547
jQuery PHP Refresh Content
<p>I'm looking for a way of refreshing a PHP include using jQuery.</p> <p>I had a go but needed to re-include the database config file which isn't what I wanted.</p> <p>Is there a nice easy way of including and auto refreshing a file every 10 seconds?</p> <p>Any help would be great,</p> <p>Thanks!</p>
php jquery
[2, 5]
4,696,877
4,696,878
I am unable to use crystal report?
<p>I am unable to use crystal report? i have a file crystalreport1.rpt and a crystalreportviewer.</p> <p>I am unable to create the object of crystalreport1.rpt.</p> <p>crystalreport1 cr=new crystalreport1(); //not able to create object of crystalreport1.rpt</p> <pre><code> //CrystalReportViewr1.ReportSource = ds; //CrystalReportViewr1.DataBind(); </code></pre> <p>how do i solve this > </p>
c# asp.net
[0, 9]
516,452
516,453
Using Javascript/JQuery and getting undefined var when the page loads
<p>I have this Javascript/JQuery code:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; name = $("#name").val(); alert("Name: " + name); &lt;/script&gt; </code></pre> <p>And this HTML:</p> <pre><code>&lt;form name="report" action="send.php" method="post"&gt; &lt;input type="text" name="name" id="name" value="Senna" /&gt; &lt;input type="submit" value="Send" /&gt; &lt;/form&gt; </code></pre> <p>When the page loads i get "Name: undefined" instead of "Name: Senna".</p> <p>Can someone help me to get the expected result?</p>
javascript jquery
[3, 5]
3,568,514
3,568,515
How prevent click event?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4589964/jquery-disable-click">jquery - disable click</a> </p> </blockquote> <p>How can I prevent a click event of a button's selector when is pushed? If there are some buttons. I want to lock the event of the button pushed. I have tried with: </p> <pre><code>event.stopImmediatePropagation(); event.stopPropagation(); event.preventDefault(); </code></pre> <p>But it does not work.</p> <p>Edit: I haven't provided the code because is backbone code and this isn't a theme of that theme. If I have a list of buttons in a menu, and I press one multiple times, the code associated a that button is run multiple times. I want to lock this click event and unlock it if other button is pushed.</p> <p>Solution:</p> <pre><code>//disable $("#button").bind('click', function() { return false; }); //enable $("#button").unbind('click'); </code></pre>
javascript jquery
[3, 5]
4,841,919
4,841,920
Prevent users to click RadioButton
<p>In my form I have some TextBoxes. Once the value of TextBox is changed then corresponding RadioButton will be selected. But I want to prevent users from changing the value of RadioButton. I tried disabling like this.</p> <pre><code> optA.Attributes.Add("disabled", "disabled"); </code></pre> <p>But this script greys out the radiobutton which is not looking good. Is there any script to prevent users from clicking/changing the selected value of radiobutton?</p> <p>Small example is</p> <pre><code>totalval=document.getElementById('txt1').value+document.getElementById('txt2').value if (totalval&gt;101) document.getElementById('optA1').checked=true; else if(totalval&lt;100) document.getElementById('optA2').checked=true; </code></pre> <p>This is what I want. So the users should not change the value of radiobuttons (optA1,optA2) if am using </p> <pre><code>optA1.Attributes.Add("disabled", "disabled"); </code></pre> <p>I couldnt get the value of optA1 at server side. My aspx code is</p> <pre><code>&lt;asp:RadioButton ID="optA1" GroupName="optAchieve" runat="server" Text="30" value="30" onclick="indicateColor()" /&gt; &lt;asp:RadioButton ID="optA2" GroupName="optAchieve" runat="server" Text="20" value="20" onclick="indicateColor()" /&gt; </code></pre>
javascript asp.net
[3, 9]
5,306,965
5,306,966
Why does jQuery.fn display [] in the console?
<p>I am trying to understand how jQuery is coded. </p> <p>They have an object:</p> <pre><code>jQuery.fn = { //key value pairs } </code></pre> <p>But if I type <code>jQuery.fn</code> in the browser console, it just returns <code>[]</code> and not the object itself. Does anyone know why?</p>
javascript jquery
[3, 5]
5,790,413
5,790,414
Writing on SDCard Problem - Android
<p>I'm trying to write a file to my SDcard in my HTC Hero phone. I create the File in my SDCard using:</p> <p>File = new File(path.getAbsolutePath(), "Filename.txt");</p> <p>where path is the path to my externalStorageDirectory (i.e. \sdcard)</p> <p>When I log the path of this file, it does say \sdcard\filename.txt</p> <p>However, when I create a fileoutputstream to write to the file, suddenly the filepath is changed to \data\data and I cannot access it.</p> <p>Can someone please help clarify how I can create a File in the SDCard and then write to it?</p> <p>Thanks!</p> <p>Edit:</p> <pre><code>path = Environment.getExternalStorageDirectory(); Log.d("SDCARDPLSWORK", path.toString()); try { myFile = new File(path.getAbsolutePath(), "SensorValues.txt"); boolean i = myFile.createNewFile(); Log.d("SDCARDPLSWORK", myFile.toString() + " " + i); fos = new FileOutputStream(myFile); Log.d("FILEANDROID", getFileStreamPath("SensorValues.txt").toString()); } catch(FileNotFoundException e) { e.printStackTrace(); } </code></pre> <p>This is what I'm doing. The part until SDCARDPLSWORK is correct, but when it comes to the FILEANDROID log it goes to the private data storage. </p>
java android
[1, 4]
1,607,666
1,607,667
jQuery/Javascript - how to detect that image was re-loaded
<p>I have a several actions that can be taken on the screen that would cause image to be re-loaded via Ajax call (non-jQuery). I need a way to detect that image has been reloaded so that I can attach event handler to the image again. How can I do this?</p>
asp.net javascript jquery
[9, 3, 5]
6,000,627
6,000,628
Dynamic creation of divs
<p>I want to create dynamic divs in a ASP.NET application.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { List&lt;produkt&gt; produkte = Repository.GetProductsRanged(0, 9).ToList(); } </code></pre> <p>As you can see, there is a of products (10 elements) and I want to put some of there attributes in divs. Every product should have it owns div. How can I do this dynamicaly?</p> <p>Thanks in advance!</p>
c# asp.net
[0, 9]
2,747,368
2,747,369
ASP.net form getting JS error
<p>I have an ASP.NET form (C#) but which I click this button that should execute a JS method I get the error "Microsoft JScript runtime error: 'document.getElementById(...)' is null or not an object"</p> <p>This is odd because it should work:</p> <pre><code> &lt;asp:LinkButton ID="btnDriverPopulate" runat="server" Text="" Height="55px" Width="172px" CssClass="btnMTO" OnClientClick="readLicense()" ToolTip="Check Driver" /&gt; </code></pre> <p>textbox code here</p> <pre><code> &lt;asp:TextBox ID="DriverLast" runat="server" Width="180px" Text='&lt;%# Eval("Last") %&gt;' ToolTip="Enter driver last name"&gt;&lt;/asp:TextBox&gt; &lt;cc:TextBoxValidator ID="valDriverLast" runat="server" AllowBlank="false" Display="dynamic" ControlToValidate="DriverLast" ValidationGroup="ValGrpDriver" CorrectFormat="Please enter in alphanumeric characters only." FieldName="Last Name" RegString="^[a-zA-Z0-9\s.,\-']+$" /&gt; </code></pre> <p>JS function readLicense that SHOULD set the textbox's value to "hi"</p> <pre><code>document.getElementById("DriverLast").value = "hi"; </code></pre>
javascript asp.net
[3, 9]
252,461
252,462
JQuery Progress bar implementation
<p>I found this Jquery progress bar function and I want to simply use it to show the progress bar while my web page is loading. Since my page is loading a bit slow, it serves as a reminder to the user that the page hasn't stopped loading. Below is the javascript and css part. Now how to implement it in the html part? What do I inlcude in the html body?</p> <pre><code>&lt;script type="text/javascript" src="js/jquery.progressbar.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var progress_key = '&lt;?= $uuid ?&gt;'; $(document).ready(function() { $("#pb1").progressBar(); $("#pb2").progressBar({ barImage: 'images/progressbg_yellow.gif'} ); $("#pb3").progressBar({ barImage: 'images/progressbg_orange.gif', showText: false} ); $("#pb4").progressBar(65, { showText: false, barImage: 'images/progressbg_red.gif'} ); $(".pb5").progressBar({ max: '2000', textFormat: 'fraction', callback: function(data) { if (data.running_value == data.value) { alert("Callback example: Target reached!"); } }} ); $("#uploadprogressbar").progressBar(); }); &lt;/script&gt; &lt;style type="text/css"&gt; table tr { vertical-align: top; } table td { padding: 3px; } div.contentblock { padding-bottom: 25px; } #uploadprogressbar { display: none; } &lt;/style&gt; </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
1,984,521
1,984,522
Android - Remove data from SDCard
<p>My application use the SDCard to store data (about 100 Mb of stuff). I would like to delete these file when the application is deleted through the application manager and offer a way to clear the data from there (like the Google Apps does). Any ideas ? </p>
java android
[1, 4]
5,476,092
5,476,093
jQuery function not working on one page only
<p>Hi I have a smooth scrolling jQuery function that works on all pages but one. The link to the page that does not work is below. The blue 'Free Tests' link in the subnav is the one not working. Has anyone had this odd problem before, and what could be causing it?</p> <p><a href="http://tinyurl.com/c364wwx" rel="nofollow">http://tinyurl.com/c364wwx</a></p>
javascript jquery
[3, 5]
141,970
141,971
Invoking a method when the back button is pushed on Android
<p>I am programming an Android application. I would like to invoke a certain method once the user pushes the "back" button. I want the program to work on all versions of Android, so I cannot use onBackPressed(). I tried the following piece of code (in the class MyView extends View):</p> <pre><code>@Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK &amp;&amp; event.getRepeatCount() == 0) { // do something on back. return true; } return super.onKeyDown(keyCode, event); } </code></pre> <p>But when I run it and press the back button, the program exits. Is there a different way to treat the back button?</p> <p>Thank you in advance.</p>
java android
[1, 4]
3,718,392
3,718,393
$(window).bind('hashchange', function () -- advice needed
<p>does this look like the best way to get the #value out of the url on change, it does work but just wondering if there was a better way.</p> <pre><code>$(function () { $(window).bind('hashchange', function () { var hash = window.location.hash; var map = { one: 1, two: 2, three: 3, four: 4 }; var hashValue = map[hash.substring(1)]; alert(hashValue); }); }); </code></pre>
javascript jquery
[3, 5]
1,203,441
1,203,442
Is there a way to find a matching element in two arrays?
<p>I have two arrays of strings :</p> <pre><code>"bob marley", "bob dylan", "bob harris" </code></pre> <p>and</p> <pre><code>"alfred hitchcock", "matt damon", "bob marley" </code></pre> <p>How would I compare these two arrays and find that Bob Marley exists in both?</p>
javascript jquery
[3, 5]
3,650,627
3,650,628
Adding values of multiple text box values
<p>I have multiple text boxes with a class name <code>.paymentamount</code>.i want to add all values of text boxes of the same class but i am getting error nan.Code is this</p> <pre><code>function paymentData() { $('.paymentamount').keyup(function(){ var amountSum=0; $('.paymentamount').each(function(){ amountSum+=parseInt(this.value); //console.log(this.value); }); console.log(amountSum); }); } </code></pre>
javascript jquery
[3, 5]
6,033,435
6,033,436
jQuery not working in Chrome and IE
<p>I'm working on a Wordpress theme. On the header I check if this is the first visit (the user just entered the website).</p> <p>If this is the first visit, an animation appears. Animation = a sidebar appears in the middle of the page, in some miliseconds it opens and the page appears. In the code, ub_sb_closed_on_hp is an option that sets only the sidebar to appear for the home page.</p> <p>It works under Mozilla, but it doesn't work under Internet Explorer and Chrome. On IE and Chrome the animation appears on all the pages.</p> <p>See the code here: <a href="http://paste.laravel.com/lFt" rel="nofollow">http://paste.laravel.com/lFt</a></p>
php javascript jquery
[2, 3, 5]
3,234,732
3,234,733
How do you access the DOM node in jquery inside of a javascript variable?
<p>I have the following html</p> <pre><code>&lt;div id="list_item_template"&gt;&lt;li&gt;&lt;a href="#"&gt;Text&lt;/a&gt;&lt;/li&gt;&lt;/div&gt; </code></pre> <p>and javascript:</p> <pre><code>var item = $("#list_item_template").clone(); </code></pre> <p>What I want to do is access the inner <code>&lt;a&gt;</code> tag of the cloned copy and add an attribute. Without cloning I would just do:</p> <pre><code>$("#list_item_template a").attr("onclick", "SomeFunction()"); </code></pre> <p>However, I need to perform that operation on the cloned copy, not on the html currently on the page. How would I do this?</p>
javascript jquery
[3, 5]
4,649,429
4,649,430
jquery how to combine two selectors to second function of single toggle event
<p>If I have a regular toggle function bound to a click event</p> <pre><code>$('#work-content a').toggle( function() { // first click stuff }, function() { // second click stuff } ); </code></pre> <p>But, I also need to bind <code>$(document).click</code> event to the second function somehow. My logic is probably off so I'm sure a new solution is necessary.</p> <p>Functionality is 1) do something when link is clicked then 2) do the opposite when the link is clicked again or if the outside of the <code>#work-content</code> div is clicked.</p>
javascript jquery
[3, 5]
4,780,337
4,780,338
How do i make a allocation table?
<p>I have build a grid of div's as playground for some visual experiments. In order to use that grid, i need to know the x and y coordinates of each div. That's why i want to create a table with the X and Y position of each div.</p> <p>X:0 &amp; Y:0 = div:eq(0), X:0 Y:1 = div:eq(1), X:0 Y:2 = div:eq(2), X:0 Y:3 = div:eq(3), X:1 Y:0 = div:eq(4) etc..</p> <p>What is the best way to do a table like that? Creating a OBJECT like this:</p> <p>{ 00: 0, 01: 1, 02: 2, etc.. }</p> <p>or is it better to create a array?</p> <p>position[0][0] = 0</p> <p>the thing is i need to use the table in multiple way's.. for example the user clicked the div nb: 13 what are the coordinates of this div or what is the eq of the div x: 12 y: 5.</p> <p>Thats how i do it right now:</p> <pre><code> var row = 0 var col = 0 var eq = 0 c.find('div').each(function(i){ // c = $('div#stage') if (i !=0 &amp;&amp; $(this).offset().top != $(this).prev().offset().top){ row++ col = 0 } $(this).attr({'row': row, 'col': col }) col++ }) </code></pre> <p>I think it would be faster to build a table with the coordinates, instead of adding them as attr or data to the DOM. but i cant figure out how to do this technically. </p> <p>How would you solve this problem width JS / jQuery?</p>
javascript jquery
[3, 5]
427,420
427,421
Jquery: Is there some way to make val() return an empty string instead of 'undefined' for an empty list?
<p>With Jquery, is there some way to make val() return an empty string instead of 'undefined' when called against an empty list of elements?</p> <p>E.g., I have this code:</p> <pre><code>var x = $('#my-textbox-id').not('.watermark').val(); </code></pre> <p>The idea is that I want to get the value of my textbox, but I want an empty string if it is currently showing the watermark (i don't want the watermark value!).</p> <p>The selector works, but i don't want 'undefined' - I want an empty string ''.</p>
javascript jquery
[3, 5]
783,094
783,095
Loop through form checkboxes for dynamic list of checkboxes
<pre><code>elm = ('cbProducts' + suffix); _ctl = document.forms[0].elements[elm]; </code></pre> <p>This works when there are more than 1 checkbox in my list. But when there are only 1, _ctl is undefined.</p> <p>Would rather use jQuery if possible and have something like:</p> <pre><code>elm = ('cbProducts' + suffix).trim(); _ctl = $("form :input #cbProducts*"); </code></pre> <p>Next step is assigning length of _ctl (_ctl.length) but it is null for only 1 checkbox in the elements collection.</p>
javascript jquery
[3, 5]
1,259,263
1,259,264
How can I skip key in object loop
<p>I was wondering if there is any way to skip key in object loop. If I have:</p> <pre><code>obj = { key1 : [ 1, 2, 3 ], key2 : [ 4, 5 ], key3 : [] } </code></pre> <p>how can I skip, for example, the empty one. Because I want to <code>join()</code> the not empty arrays in that object, and filter them. If I join that empty array the filter looks for empty string and of course it doesn't find it, and everything brakes.</p> <pre><code>var match = $('.widget'); for ( var i in obj ){ var joined = obj[i].join(); match = match.filter(joined); } </code></pre> <p>I have tried to delete it:</p> <pre><code>if ( obj[i].length == 0 ) { delete obj[i] }; </code></pre> <p>but error occurs that obj[i] is undefined and can't join it. How can I just skip it.</p>
javascript jquery
[3, 5]
5,149,133
5,149,134
How to hide/show multiple objects in Jquery?
<p>I want to hide/show items and show them again if requested. </p> <p>I am using the following code to do it. But it slows down the page if i do it few times.</p> <pre><code>for(i=0;i &lt; 9; i++) $('.myBetSingleBox').eq(i).css({'display':''}); </code></pre> <p>Is there a way to do it without slowing down the page? the for loop is slowing down the page, but i dont have another solution.</p> <p>maybe is there a Garbage Collection possible in JQuery?</p> <p><strong>info:</strong> <strong>hide</strong>(), <strong>toggle</strong>() methods are worst then css({'display':''});</p> <p>Thanks!</p>
php javascript jquery
[2, 3, 5]
2,414,903
2,414,904
How do i get selected radiobuttonlist in asp.net?
<p>I am using following code for a radiobuttonlist with default value of yes.</p> <pre><code> &lt;asp:RadioButtonList ID="RadioButtonList1" runat="server" onselectedindexchanged="radiobtnlist_SelectedIndexChanged"&gt; &lt;asp:ListItem Selected="True"&gt;YES&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;NO&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>Every time when the value of the radiobtnlist is changed an event is fired.I am using following c# code for selected index changed</p> <pre><code>protected void radiobtnlist_SelectedIndexChanged(object sender, EventArgs e) { //do work } </code></pre> <p>Problem is that when radiobtnlist value is set as No and the selection is not changed but the selectedindex change event is fired and when radiobtnlist is set as Yes, the selectedindex change event is not fired.</p> <p>I have to find the selection of radiobtnlist everytime before postback and if its value is changed then saved data in db but how to find the selected value of radiobtnlist with a default value on a ListItem.</p>
c# asp.net
[0, 9]
3,696,395
3,696,396
Header navigation to history php
<p>I generally use <code>header("location:xyz.php")</code> but this time I want to navigate to history. I have more than 10 pages from where user navigate to single file and I want to navigate him back to history that is out of 10 pages. If it is button I use <code>history.go(-1);return false;</code> So using this at place of file name in header is correct?</p> <p>or any other way I navigate him back to history?</p>
php javascript
[2, 3]
2,613,208
2,613,209
What's the equivalent of Java's Thread.sleep() in Javascript?
<p>What's the equivalent of Java's <code>Thread.sleep()</code> in Javascript?</p>
java javascript
[1, 3]
3,686,393
3,686,394
Member turns to undefined
<p>I've developed a jQuery plugin which has default options:</p> <pre><code>$.fn.incromentor.defaults = { max : 65355, min : 0 }; </code></pre> <p>In the initialization of the plugin, I merge the user options with plugin default options using <code>$.extend</code></p> <pre><code>function init( $elm, options ) { this.$element = $elm; this.options = $.extend( {}, $.fn.incromentor.defaults, options ); } </code></pre> <p>So the problem is, if user sets <code>min</code>or <code>max</code> to <code>0</code>, that property turns to undefined!<br> Why is this and how can I store a simple 0?</p> <p>Here a jsFiddle: <a href="http://jsfiddle.net/KDXa6/2/" rel="nofollow">http://jsfiddle.net/KDXa6/2/</a></p>
javascript jquery
[3, 5]
1,171,164
1,171,165
what is the best practice to do the following using jquery/javascript?
<p>So I am just trying to add some functions to hover. the below does about the same thing except the one with the for loop i have the target stored in an array. I actually have a few questions.</p> <ol> <li>is this the correct use of stopPropagation?</li> <li>what's the best practice for doing something like this? </li> <li>which one of the below method is faster and uses less resources?</li> <li>I know I can use hover() but I used bind because I thought it is faster, is my thinking correct?</li> </ol> <p>thank you</p> <pre><code> for (var i in slides) { $(slides[i].el).bind( { mouseenter: function (event) { event.stopPropagation(); // do something }, mouseleave: function (event) { event.stopPropagation(); //do something } }); } $("#vehicleSlides .vehicleAreas").bind( { mouseenter: function (event) { event.stopPropagation(); // do something }, mouseleave: function (event) { event.stopPropagation(); //do something } }); </code></pre>
javascript jquery
[3, 5]
129,930
129,931
Rechange ID with Javascript
<p>Hello:) Im a javascript newbie and I'm trying to change a div ID with a script. I have a div with the id "change", and onClick I would like to change the ID "changed", and that I could do, but I would like to click again, and it will return to receive the ID "change". Can you help me?</p> <p>This is how I did:</p> <pre><code>&lt;script&gt; $document.ready( function() { $("#change").attr('id','changed'); }); }); </code></pre> <p>Thanx. </p>
javascript jquery
[3, 5]
3,895,125
3,895,126
javascript how to dynamically update a variable
<p>I have an html form that triggers a function to change a value, reference: <a href="http://jsfiddle.net/ZvuMh/3/" rel="nofollow">http://jsfiddle.net/ZvuMh/3/</a> How can I use <code>avalue</code> dynamically in another function?</p> <p>HTML:</p> <pre><code>&lt;select id="sort_post_date"&gt; &lt;option value="a"&gt;a&lt;/option&gt; &lt;option value="b"&gt;b&lt;/option&gt; &lt;option value="c"&gt;c&lt;/option&gt; &lt;option value="d"&gt;d&lt;/option&gt; &lt;option value="e"&gt;e&lt;/option&gt; &lt;option value="f"&gt;f&lt;/option&gt; &lt;/select&gt;​ </code></pre> <p>Change value function:</p> <pre><code> var avalue=''; function getSelectData(id) { // set value to be the current selected value avalue = jQuery(id+" option:selected").val(); // change value whenever the box changes jQuery(id).change(function () { avalue = jQuery(id+" option:selected").val(); console.log("I see a change! -&gt; "+avalue); }); console.log(avalue); return avalue; } var d = getSelectData("#sort_post_date"); console.log(d);​ </code></pre> <p>Another function that wants to inherit <code>avalue</code> when function getSelectData changes it to another letter:</p> <pre><code>function somefunction(){ var test = "foo"+avalue; } </code></pre>
javascript jquery
[3, 5]
5,498,360
5,498,361
jQuery: html() returning empty string
<p>If I use firebug and type <code>$("&lt;p&gt;").html()</code> into the watch window, I get an empty string back. My guess is because the <code>$("&lt;p&gt;")</code> hasn't been rendered to the document. How can I get the markup for <code>$("&lt;p&gt;")</code> before it's added to the DOM?</p>
javascript jquery
[3, 5]
1,932,680
1,932,681
Open a file using javascript, client-side
<p>In my application I want to open a file that exists on a client machine. I created two applications: desktop and web application. When the user installs the desktop application there are some files which is copied to its installation path, and I want to open those files from my web application via javascript.</p>
javascript asp.net
[3, 9]
4,674,377
4,674,378
From PHP to ASP.net/C#?
<p>I know this may seem like a common question on SO but I could not really find anything in particular to my exact question. </p> <p>Just throwing some of my thoughts so far out there, PHP is super super easy and FAST to code in, I do not know C# or how to use ASP.net, I would like to learn it and studying some of it briefly it seems to me that it takes a lot more coding and time to code the same result in ASP.net </p> <p>So I am just curious is there any noticable benefits of having for example a social network in ASP.net vs having it in PHP? Not looking for a debate but I need some guidance</p> <p>Hopefully this is not to broad of a question, I couldn't really put it into words exactly how I wanted at the moment</p>
c# php asp.net
[0, 2, 9]
1,817,947
1,817,948
autoTab and allowed only numbers
<p>is there any easy way of implementing two feature 1) auto tab and 2) allowed only numbers</p> <p>i have a SSN box below as soon as the user enter three digits will skip to the next .. so on and so forth.....</p> <pre><code> &lt;TR&gt; &lt;TD nowrap&gt;&lt;b&gt;Social Security Number&lt;/b&gt;&lt;/TD&gt; &lt;TD align="left" nowrap colspan="4"&gt; &lt;INPUT NAME= "SSN1" TYPE= "TEXT" SIZE= "3" MAXLENGTH= "3" VALUE= ""&gt; &lt;INPUT NAME= "SSN2" TYPE= "TEXT" SIZE= "2" MAXLENGTH= "2" VALUE= ""&gt; &lt;INPUT NAME= "SSN3" TYPE= "TEXT" SIZE= "4" MAXLENGTH= "4" VALUE= ""&gt; &lt;/TD&gt; &lt;/tr&gt; </code></pre> <p>also i wanted to restrict to have only numbers.</p>
javascript jquery
[3, 5]
5,292,079
5,292,080
Change Input to Upper Case
<p>JS: </p> <pre><code>&lt;script type="text/css"&gt; $(function() { $('#upper').keyup(function() { this.value = this.value.toUpperCase(); }); }); &lt;/script&gt; </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="search"&gt; &lt;input type="radio" name="table" class="table" value="professor" tabindex="1" /&gt; Professor &lt;input type="radio" name="table" class="table" value="department" tabindex="2" /&gt; Department &lt;input type="radio" name="table" id="upper" class="table" value="course" tabindex="3" /&gt; Course &lt;input type="text" name="search" class="keywords" value="Select an option..." onclick="this.value='';" onfocus="this.select()" onblur="this.value=!this.value?':this.value;" tabindex="4" /&gt; &lt;div id="content"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Why is this still not working?? Just trying to call div ".keywords" from JS.</p>
javascript jquery
[3, 5]
2,259,966
2,259,967
I Need to initialise PHP variable inside the javascript function?
<p>The above code is an javascript function . I need to initialise PHP variable in the else part</p> <pre><code>function validate() { if(document.loginForm.vuser_login.value==""){ alert("Login Name name cannot be empty"); document.loginForm.vuser_login.focus(); return false; } else if (document.loginForm.vuser_password.value=="") { alert("Password cannot be empty"); document.loginForm.vuser_password.focus(); return false; } else { //Here i need to initialise PHP variable ...... return true; } } </code></pre>
php javascript
[2, 3]
5,747,336
5,747,337
Receiving data from Android in a ASP.NET web site
<p>I wrote an Android app that sends data to an ASP.NET web site. When I test the app, I get the error:</p> <blockquote> <p>Connection to <code>https://localhost:1863</code> refused.</p> </blockquote> <p>How do I solve this problem? Also, how do I go about storing this data into <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" rel="nofollow">SQL&nbsp;Server</a>?</p> <pre><code>HttpClient client1 = new DefaultHttpClient(); HttpPost request = new HttpPost("http://localhost:1863"); String lat = "lat",lng = "lng"; List&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;(3); postParameters.add(new BasicNameValuePair("lat", lat)); postParameters.add(new BasicNameValuePair("lng", lng)); try { request.setEntity(new UrlEncodedFormEntity(postParameters)); UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters); request.setEntity(formEntity); // request.addHeader("Content-type", "application/x-www-form-urlencoded"); HttpResponse response; response = client1.execute(request); BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); String line; String page = ""; line = in.readLine(); while (line != null) { page = page + line; line = in.readLine(); } } catch (ClientProtocolException e) { e.printStackTrace();} catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre>
android asp.net
[4, 9]
5,528,485
5,528,486
How to build Query dynamically using asp.net3.5 and c#.net
<p>i need create query dynamically in my .cs page. Actually what happens in my application is user can pass the column name and Table names from the page. by using those parameters(columns and tables) we need build Select query . we need retrieve those values from database and show in text format to user.there may multiple table and single table have multiple columns also.</p> <p>please try yo help how to do this ny using asp.net3.5 and c3.net</p>
c# asp.net
[0, 9]
4,496,744
4,496,745
passing multivariables to new page via gridview select
<p>I have a gridview where i want to pass two different ID when i select a row to a new page. I need them to be two different variables so i dont want to bind them together.</p> <p>Currently, the way i am doing it with link select the values of SUBMITTEDJOBAPPLICATION &amp; the JOBAPPLICATIONID variables are the same(which is incorrect). What i mean is the SUBMITTEDJOBAPPLICATION is correct but the JOBAPPLICATIONID is the same as SUBMITTEDJOBAPPLICATION and that is incorrect.</p> <pre><code>&lt;asp:HyperLink ID="lnkSelect" runat='server' NavigateUrl='&lt;%# String.Format("~/UnscreenedApplicantPage.aspx?SubmittedID={0}&amp;jobID={0}", Eval("SUBMITTEDJOBAPPLICATION"), Eval("JOBAPPLICATIONID")) %&gt;'&gt;Select&lt;/asp:HyperLink&gt; </code></pre> <p>How can i remedy this?</p>
c# asp.net
[0, 9]
206,001
206,002
Managing ajax calls with jQuery Deferred object
<p>I have to check the availability of internet access in a device at a given point of time. So, I am making an ajax call to the server to load a tiny image. I came across jQuery Deferred and tried to use it.</p> <pre><code>var spacer = "some url"; var getImage; var connectionAlive; function checkOnline(spacer) { getImage = $.ajax({url:spacer}) .done(function() {console.log('Connection alive');connectionAlive = true;}) .fail(function() {console.log('Connection dead');connectionAlive = false;}); if(connectionAlive === true) { return true; } return false; } </code></pre> <p>Now i have to call this checkOnline function when certain events occur. So, i am calling the function and waiting till the promise is resolved.</p> <pre><code>$(document).on('click','#explore',function() { checkOnline(spacer); getImage.done(function() { // Do something }) }); </code></pre> <p>This only works the first time and I think it is because the deferred object state stays the same once it is resolved. How should I write my code so that i can actually check the connection every-time the click event fires?</p> <p>New Code: </p> <p>Hi, I followed the above code but still the click event is only working correctly the first time.</p> <pre><code> var connectionAlive; var url = "http://plaza.foxqa.com.au/app/images/spacer.gif"; function checkOnline(url, callback1,callback2) { $.ajax({url:url}) .done(function() {console.log('Connection alive');connectionAlive = true;}) .done(callback1) .fail(function() {console.log('Connection dead');connectionAlive = false;}) .fail(callback2); } $(document).on('click','#explore',function() { checkOnline(url, function(){ console.log('Connection Alive from event'); },function() { console.log('Connection Dead from event'); }); }); </code></pre>
javascript jquery
[3, 5]
4,587,788
4,587,789
check if URL contains some text (javascript)
<p>how can i use javascript/jQuery to check if a URL contains a specific link/text.</p> <p>for example :<br> A user browse to my site and his URL is : "http//www.mywebsite.com/userprofile/abc&amp;from=home"<br><br> I have set a variable and its value is "http//www.mywebsite.com/userprofile/abc" , i want to know how to detect <strong>if</strong> "http//www.mywebsite.com/userprofile/abc" <strong>exist in the URL</strong>("http//www.mywebsite.com/userprofile/abc&amp;from=home") then execute a function.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,343,733
4,343,734
Unknown inflate error with android
<p>Hi i'm having a problem with my android app. The problem is when i try to set up new view.</p> <pre><code> public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { try{ LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.list, null); } catch(Exception e){ String a=e.toString(); } } </code></pre> <p>in line v = vi.inflate(R.layout.list, null); i get this error:</p> <pre><code> android.view.InflateException: Binary XML file line #5: Error inflating class &lt;unknown&gt; </code></pre> <p>Here is also my list.xml file:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;TableRow android:layout_width="fill_parent" android:layout_height="15dp" android:background="@drawable/bg_seznam" &gt; &lt;TextView android:id="@+id/item_title" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="17dp" android:textColor="#ffffff" android:textSize="20dp" android:textStyle="bold" android:typeface="serif" &gt; &lt;/TextView&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; </code></pre> <p>So any ideas?</p>
java android
[1, 4]
5,397,333
5,397,334
Removing a child div from a parent div in jquery
<p>I am trying to delete the child element in the dom from its parent using jquery.</p> <p>Here is the code snippet.</p> <pre><code>$('#delete').live('click' , function() { var strchild = m.split("/",2)[1]; var c = group.children(strchild); c.remove(); }); </code></pre> <p>strchild contains the id of the child element. group is the parent object. I am getting the right child element in the variable c. But the remove function fails.</p> <p>Can some help me out here.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
953,996
953,997
How do i trigger a lightbox when certain text is selected using jQuery?
<p>Ok so i have this </p> <pre><code>&lt;select class="something"&gt; &lt;option value=''&gt; Select a Project &lt;/option&gt; --- &lt;/option&gt; &lt;option value="/projects/2"&gt;test&lt;/option&gt; &lt;option value="/projects/3"&gt;test2&lt;/option&gt; &lt;option value="/projects/4"&gt;test7&lt;/option&gt; &lt;option value="/projects/5"&gt;test5&lt;/option&gt; </code></pre> <p>When someone clicks the Select a Project how would popup a lightbox just for that and not if they select the others....Popping up the lightbox is not too hard its distinquishing from the other options that i dont understand</p> <pre><code>$(".something").change </code></pre> <p>this will get all but i only want "Select a Project"</p>
javascript jquery
[3, 5]
3,774,248
3,774,249
Displaying Parent/Children name with indent
<p>i have an object that have parent/children relationship.</p> <p>below is shorter version of what i have but the below is the core props</p> <pre><code>public class Company { Name {get;set;} List&lt;Company&gt; ChildCompany {get;set;} } </code></pre> <p>displaying something like this:</p> <pre><code>-----ABC Corporation (in this chas ABC has child company so it will display right indent) ----------ABC Child ----------ABC One ----------ABC Two -----BBC Corporation (in this case no child company) -----CBS -----CNN Corporation ----------ABC ----------BBC ----------NBC </code></pre> <p>my code:</p> <pre><code>Company company = new Company(); company = GetDataForCompany(); //DAL if(!string.IsNullEmpty(company.Name)) { //dispaly Name PlaceHolder ph; l = new Literal(); l.Text = "&lt;ul&gt;" + Environment.NewLine; ph.Controls.Add(l); l = new Literal(); l.Text = "&lt;li"&gt;"; ph.Controls.Add(l); hl = new HyperLink(); hl.Text = company.Name; ph.Controls.Add(hl); foreach (Company item in company) { l = new Literal(); l.Text = "&lt;li"&gt;"; ph.Controls.Add(l); hl = new HyperLink(); hl.Text = item.Name; ph.Controls.Add(hl); } } </code></pre> <p>the above code does not seems to rendering exactly what i wanted as shown above.</p>
c# asp.net
[0, 9]
3,996,708
3,996,709
How to use a javascript strings object
<p>I'm having a problem utilizing my language files. </p> <p>Currently, I have a language file where I have an object like</p> <pre><code>var strings { title: "Title", subtitle: "Subtitle" }; </code></pre> <p>In my html currently, I'll have something like</p> <pre><code>&lt;div id="title"&gt;Title&lt;/div&gt; &lt;div id="subtitle"&gt;Subtitle&lt;/div&gt; </code></pre> <p>Now I want to include inside the div the value from a javascript object instead, so that I can use various language files. The relevant language file is chosen in the backend by a php script, and isn't the issue here.</p> <p>Eg</p> <pre><code>&lt;div id="title"&gt;strings.title&lt;/div&gt; &lt;div id="subtitle"&gt;strings.subtitle&lt;/div&gt; </code></pre> <p>Is there an easy way to do this? I don't want to have to use php to create the necessary js file every single time, or use a jquery loop that populates every single div value on create, though right now it looks like that's what I'll have to do.'</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,438,687
5,438,688
Can i create an array that has multiple objects and then manipulate that array throughout my script?
<p>I have created an array of jquery objects that I want to hide when a particular click event is triggered. Instead of looping through the contents of the same array for each click event can I transform the array into a single object or something that I can just attach a method on to?</p> <p>I have a current fiddle here: <a href="http://jsfiddle.net/hd5qa/13/" rel="nofollow">http://jsfiddle.net/hd5qa/13/</a></p> <p>Sorry if this sounds vague, I'm not sure how to best explain this.</p> <p>Kyle</p>
javascript jquery
[3, 5]
2,083,858
2,083,859
ArrayList Limit to hold 10 Values
<p>I am using an <code>ArrayList</code> within my code which gets populated by a <code>EditText</code> field but I am wanting to limit the <code>ArrayList</code> so it can only hold 10 values. After 10 values have been added if another tries to get added I just need it to not add into the <code>Array</code>. Anyone got any ideas how to do that?</p> <pre><code>private static ArrayList&lt;String&gt; playerList = new ArrayList&lt;String&gt;(); </code></pre>
java android
[1, 4]
3,499,167
3,499,168
jQuery: copying element attributes to another attribute of the same element
<p>I've got a list of links, all in the same class, each with a custom argument ("switch-text"). My script should copy the text of the custom argument to the text of each link and replace it ("Pick A" should become "Pick A Please").</p> <p>It works fine with only 1 link, but when I add several, they all get switched to the first argument. ("Pick B" should be replaced by "Pick B Please", but it doesn't).</p> <p>I could probably solve this using each(), but I'm preferably looking for a simple, single jQuery line that does it, and I'm baffled I haven't yet found out how to achieve this.</p> <p>Can somebody help? Thanks!</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() { $(".switcher").text( $(".switcher").attr("switch-text") ); }); &lt;/script&gt; &lt;a href="a" class="switcher" switch-text="Pick A Please"&gt;Pick A&lt;/a&gt;&lt;br&gt; &lt;a href="b" class="switcher" switch-text="Pick B Please"&gt;Pick B&lt;/a&gt;&lt;br&gt; </code></pre>
javascript jquery
[3, 5]
4,118,076
4,118,077
How to populate infinite scroll with images from 1 directory?
<p>I have a <code>&lt;div id="content" class="clearfix"&gt;&lt;/div&gt;</code> which self populates with a list of image urls from a separate directory on my server. </p> <p>Here is the live URL for the site : <a href="http://ilovesmallies.com/forum/showcase.php" rel="nofollow">http://ilovesmallies.com/forum/showcase.php</a></p> <p>I want to use infinite scroll and masonry plugins in this div. </p> <p>However, I'm unsure of how to point towards a list of image urls with this script...</p> <p>Here is how it is coded now and does not work. </p> <pre><code>&lt;script&gt; $(function(){ var $container = $('#content'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.box', columnWidth: 250 }); }); $container.infinitescroll({ navSelector : '#content', // selector for the paged navigation nextSelector : '#content a', // selector for the NEXT link (to page 2) itemSelector : '.box', // selector for all items you'll retrieve loading: { finishedMsg: 'No more pages to load.', img: 'http://i.imgur.com/6RMhx.gif' } }, // trigger Masonry as a callback function( newElements ) { // hide new items while they are loading var $newElems = $( newElements ).css({ opacity: 0 }); // ensure that images load before adding to masonry layout $newElems.imagesLoaded(function(){ // show elems now they're ready $newElems.animate({ opacity: 1 }); $container.masonry( 'appended', $newElems, true ); }); } ); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,331,621
1,331,622
having a lookup form in asp?
<p>OK. Normal winform thing that I do all the time but now in asp.net. You have a browse button on Form A and you open a new form B. For example you have user click on a browse button to select list of friends. User clicks on the button, picks one or more friends and then presses select. you then add them to the original forms grid.</p> <p>Same idea using asp.net ( 2010 version using windows 7 IE browser). How do I do it? I have a button. User clicks on the button a new web page opens. User selects what she wants and then presses select. There is where i am stuck. I would like to call a delegate in the original form which displayed the popup so that it knows which session variable to use to get the data. How do I do this?</p>
c# asp.net
[0, 9]
5,935,400
5,935,401
which language is better for my application?
<p>I want to design a professional software. Features :</p> <ol> <li>Direct Connection with SQL</li> <li>HTML code editing and build</li> <li>Search among thousands of content files (Advance search)</li> <li>Artificial intelligence (Simple)</li> <li>Compress/Extract files</li> <li>Create a Private file Extension</li> <li>Encrypt/Decryption</li> </ol> <p>And users most can make a modules and plugins for software</p> <p>Now which language is best for my application? C#.NET or C++/CLI</p> <p>thanks before your answer</p>
c# c++
[0, 6]
659,245
659,246
C# ASP.Net WebForm Membership Extra User Details (Profile)
<p>I'm learning how to use the ASP.net membership, when a user registers they just create a username and password, however i want to create a page on my website called "profile" where they can fill in extra details such as firstname, lastname, date of birth ect. However i don't see where i can place this in the asp.net membership database. Theres an asp.net_profile table however i'm not sure how this works.</p> <p>Could someone please explain how i can do this?</p>
c# asp.net
[0, 9]
1,201,880
1,201,881
jquery: Exiting function
<p>I am doing animation in jquery. I have a looping picture moving from left to right of the webpage. I used following code:</p> <pre><code> function run() { $("#run").animate({ left: "980px" }, 250).animate({ left: "-600px" }, 0); setTimeout("run()", 250); } </code></pre> <p>I want to stop the loop(OR break the function) once I press a button.</p>
javascript jquery
[3, 5]
1,490,127
1,490,128
Block HTML tags in posts
<p>Forums on the internet can block people from posting HTML tags in their posts. how is that done in php? I mean HTML tags show up as is in the tweets on twitter and in the comment space on Facebook? How is that done?</p>
php javascript
[2, 3]
1,350,439
1,350,440
Row Databound issue when changing Container.DataItem value in a gridview
<p>I am using a gridview to display on a buttonClick in asp.net using c#.</p> <pre><code> DataSet dsnew = new businessLogic.Biz().getData(); if (dsnew != null &amp;&amp; dsnew.Tables[0].Rows.Count &gt; 0) { DataView myDataView = new DataView(); myDataView = dsnew.Tables[0].DefaultView; grdDetail.DataSource = myDataView; grdDetail.DataBind(); } </code></pre> <p>and on a rowDataBound, depending on the condition, i want to change the dataitem container value. I am doing it in the following way but the issue is that all the rows have the paymentmethod of the last row in the dataset. </p> <pre><code>&lt;asp:TemplateField ItemStyle-Width="70" ItemStyle-HorizontalAlign="Center"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblPaymentMethod" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem,"SellingPaymentMethod") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; protected void grdDetail_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { return; } foreach (DataRow dtrCurrentRow in (((System.Data.DataView)grdDetail.DataSource)).Table.Rows) { //DataRow row = (DataRow)e.Row.DataItem; Label lblPaymentMethod = e.Row.FindControl("lblPaymentMethod") as Label; if (Condition1)) { lblPaymentMethod.Text = dtrCurrentRow["SellingPaymentMethod"].ToString(); } else if (Condition 2) { lblPaymentMethod.Text = dtrCurrentRow["DeliveryPaymentmethod"].ToString(); } } </code></pre>
c# asp.net
[0, 9]
5,155,905
5,155,906
How to convert C++ code into java
<p>I am trying to convert C++ code to Java but am stuck at the following line</p> <pre><code>memcpy(cmd-&gt;CommandData+2, &amp;m_UnitData[i].Value, 2); </code></pre> <p>I also use cpp to java converter but it does not change anything here. <code>CommandData</code> and <code>UnitData</code> are byte arrays in my Java class.</p> <p>This is original cpp code:</p> <pre><code>unsigned char CommandData[255]; private SUnitData[] m_UnitData; cmd-&gt;CommandData[0] = SSP_CMD_SET_COIN_MECH_INHIBITS; cmd-&gt;CommandData[1] = 0x01; memcpy(cmd-&gt;CommandData+2, &amp;m_UnitData[i].Value, 2); </code></pre> <p>Are there any alternatives to <code>memcpy()</code> in java?</p>
java c++
[1, 6]
1,209,438
1,209,439
Where is the path "file:///android_asset/" documented?
<p>There's a number of pages on the Internet talking about the "file:///android_asset/" path (sometimes with an <em>s</em> appended to the end...) for accessing the assets folder. I am unable to find any kind of official or trustworthy documentation on this path/feature.</p> <p>Is there any proper documentation for this path? Did the Android team document it?</p>
java android
[1, 4]
1,048,459
1,048,460
How to Convert event object to string in JavaScript?
<p>I am trying to get which event is occured :: </p> <pre><code>function getEvent(){ alert(window.event); } </code></pre> <p>I am getting below event object. I want it in string to compare. if event onclick event then I want to do the action. how can I get it in string? or how can I convert event object to string?</p> <pre><code>[object MouseEvent] </code></pre>
javascript jquery
[3, 5]
527,335
527,336
Android is there any way to only rotate one component were other component in same layout will not rotate
<p>I want the content of <code>webview</code> vertical to horizontal as device rotate, but not the other components. I mean button below the webview should not rotate, </p> <p>So i am trying to rotate the content of <code>webview</code> vertical to horizontal or vice versa but cant do it .</p> <p>Is there any way to only rotate one component were other component in same layout will not rotate</p>
java android
[1, 4]
2,042,958
2,042,959
Inside OnClickListener I cannot access a lot of things - how to approach?
<p>Inside an OnClickListener I cannot access most variables "outside" of the scope, like this:</p> <pre><code>findViewById(R.id.Button01).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent mainApps = new Intent(Intent.ACTION_MAIN); mainApps.addCategory(Intent.CATEGORY_LAUNCHER); List&lt;ActivityInfo&gt; activities = this.getPackageManager().queryIntentActivities(mainApps, 0); /* Intent intent = new Intent("com.sygic.drive/com.sygic/drive/.SygicDriveActivity"); startActivity(intent);*/ } }); </code></pre> <p>in this example I need to get the PacketManager, and I cannot get it since I do not have the Context available inside the OnClickListener. </p> <p>I could make a static reference outside, and use it inside, but is that correct? Seems odd to have to do that all the time?</p>
java android
[1, 4]
5,593,786
5,593,787
Development tools
<p>What programming language are windows applications begin built with these days? from what I can see when looking at job descriptions, Java and C# are mostly used for web applications. I found a couple of companies looking for a c# winforms developer but the job also includes some web development as well. I think that is right since.net is web orientated.</p> <p>Any comments please </p>
c# java
[0, 1]
868,047
868,048
Android TableLayout group dynamic radioButtons
<p>How can I group all dynamic created radioButtons into one group?</p> <pre><code>while (cursor.moveToNext()) { TableRow row = new TableRow(this); // CheckBox chk = new CheckBox(this); RadioButton radioBtn = new RadioButton(this); // chk.setText(cursor.getString(cursor.getColumnIndex("from_text"))); radioBtn.setText(cursor.getString(cursor.getColumnIndex("from_text"))); radioBtn. row.addView(radioBtn); table.addView(row); } </code></pre> <p><strong>Xml</strong></p> <p></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /&gt; &lt;TableLayout android:layout_width="wrap_content" android:layout_height="fill_parent" android:id="@+id/myTable"/&gt; &lt;/LinearLayout&gt; </code></pre>
java android
[1, 4]
4,990,007
4,990,008
UIpagecontrol in android
<p>can anyone tell me that how can i use UIpagecontrol control of iphone by using it we can scroll horizontally any page.like this</p> <p><a href="http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html" rel="nofollow">http://cocoawithlove.com/2009/01/multiple-virtual-pages-in-uiscrollview.html</a></p>
android iphone
[4, 8]
4,760,514
4,760,515
click mouse position with scroll in javascript
<p>I have code to get x-y coordinates when the browser scrolls:</p> <pre><code>left1 = window.event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; top1 = window.event.clientY + document.body.scrollTop + document.documentElement.scrollTop; </code></pre> <p>This is working in IE7, but not in Mozilla Firefox 3.5.19. How can I get it working in Firefox?</p>
javascript asp.net
[3, 9]
1,798,493
1,798,494
remove class from current group
<p>The easiest way to see the problem is checking the code here: <a href="http://www.studioimbrue.com/beta" rel="nofollow">http://www.studioimbrue.com/beta</a></p> <p>What I need to do is once a thumbnail is clicked, to removed the "selected" class from all other thumbnails that are in this same or without removing them from the other galleries on the page. Right now, I have everything working except the class removal. Someone helped me in another question but wasn't quite specific enough (my javascript skills aren't all that great!) I'm using jQuery. Thanks for the help.</p> <p>Well in that case, I'm not sure why this doesn't work properly:</p> <pre><code>$(document).ready(function(){ var activeOpacity = 1.0, inactiveOpacity = 0.6, fadeTime = 100, clickedClass = "selected", thumbs = ".thumbscontainer ul li img"; $(thumbs).fadeTo(1, inactiveOpacity); $(thumbs).hover( function(){ $(this).fadeTo(fadeTime, activeOpacity); }, function(){ // Only fade out if the user hasn't clicked the thumb if(!$(this).hasClass(clickedClass)) { $(this).fadeTo(fadeTime, inactiveOpacity); } }); $(thumbs).click(function() { // Remove selected class from any elements other than this var previous = $(thumbs+'.'+clickedClass).eq(); var clicked = $(this); if(clicked !== previous) { previous.removeClass(clickedClass); } clicked.addClass(clickedClass).fadeTo(fadeTime, activeOpacity); }); }); </code></pre>
javascript jquery
[3, 5]
3,898,815
3,898,816
How to indent particular row in datagridview
<p>I have a gridview and and I am creating it dynamically, I get parent and child tables records and binding the data to a single data grid view. I need to indent the row which is from child table a bit to the right so that i can differentiate the record from parent record.</p> <pre><code>private void CreateDynamicGridView(DataTable tables, GridView gv) { try { DataTable _dtSearchList = tables; strColumnCount = _dtSearchList.Columns.Count.ToString(); foreach (DataColumn col in _dtSearchList.Columns) { BoundField bfield = new BoundField(); bfield.DataField = col.ColumnName; bfield.HeaderText = col.ColumnName; gv.Columns.Add(bfield); } gv.DataSource = _dtSearchList; gv.DataBind(); } catch (Exception ex) { } } </code></pre>
c# asp.net
[0, 9]
2,749,797
2,749,798
Save string from jQuery's `$.get`
<p>I'd like to load some content from an URL, to use it in my code. I tried closures and this:</p> <pre><code>function getStringFromURL(url) { var getter = function() { this.result = "undef"; this.func = function(response) { this.result = response; }; }; var x = new getter(); $.get(url, x.func); return x.result; // the it returns "undef" and not the wanted response } </code></pre> <p>Nothing worked at all. I'll never got the content, but if I call it with <code>alert</code> like <code>$.get("http://localhost:9000/x", function(response) { alert(response) });</code> it works -- but I'd like to save the response. I think theres a problem with the scope of the <code>$.get</code>-method.</p> <p>Whats wrong with this?</p>
javascript jquery
[3, 5]
1,946,866
1,946,867
How can I insert a prefix for all jQuery selectors?
<p>I need extended main jQuery function to insert a prefix before any selector passed to it.</p> <p>For example</p> <pre><code>jQuery.prefix = '#newBody '; jQuery('.content') </code></pre> <p>would be the same as </p> <pre><code>jQuery('#newBody .content') </code></pre> <p>I tried running this code</p> <pre><code>window.oldJquery = jQuery; window.jQuery = window.$ = function( selector, context) { console.log('+',selector); return oldJquery(selector, context ); } </code></pre> <p>But I last jQuery object.</p> <p>**</p> <h2>Without changes in the current code</h2> <p>**</p>
javascript jquery
[3, 5]
4,234,510
4,234,511
Faster/better: Fetch a few JSON-objects with PHP or JavaScript
<p>Personally I would do this with PHP but maybe someone has an pro/contra for doing this with JavaScript:</p> <ul> <li>I (will) fetch a few song details (about ten per page load) from Soundcloud</li> <li>afterwards the statistic (played this week/total, liked this week/total etc.) will be displayed in a table</li> </ul> <p>That's it - nothing special.</p> <hr> <p>I can solve it like this:</p> <ul> <li>let PHP do the stuff and render the whole page at once</li> </ul> <p>This will of course take some time before the page is rendered.</p> <p>Is there any advantage of doing this with JavaScript? I can only think of:</p> <ul> <li>the page renders faster (with the disadvantage that the results may not be displayed instantly)</li> </ul>
php javascript
[2, 3]
251,272
251,273
Using CodeBehind to change the LoginView
<p>I am wondering if there is a way to do this? I'm using windows authentication, and I have a list of groups the user belongs to. I then want to determine which loginview to use based on which group(s) they are part of. Because everyone accessing the site will be required to be logged in anyway the LoggedInTemplate and the AnonymousTemplate are not enough. Any help is appreciated. </p>
c# asp.net
[0, 9]
3,474,374
3,474,375
What is the fastest way to deal with large arrays of data in Android?
<p>could you please suggest me (novice in Android/JAVA) what`s the most efficient way to deal with a relatively large amounts of data? </p> <p>I need to compute some stuff for each of the 1000...5000 of elements in say a big datatype (x1,y1,z1 - double, flag1...flagn - boolean, desc1...descn - string) quite often (once a sec), that is why I want to do is as fast as possible.</p> <p>What way would be the best? To declare a multidimensional array, or produce an array for each element (x1[i], y1[i]...), special class, some sort of JavaBean? Which one is the most efficient in terms of speed etc? Which is the most common way to deal with that sort of thing in Java?</p> <p>Many thanks in advance!</p>
java android
[1, 4]
5,568,366
5,568,367
how to use FFT to filter a 50Hz noise from a data array?
<p>Suppose I have a data array from an ECG like this one</p> <p><a href="http://joachim.behar.perso.neuf.fr/Joachim/ECG_tuto_1/ECG_filters_basics/ecg_sample.txt" rel="nofollow">http://joachim.behar.perso.neuf.fr/Joachim/ECG_tuto_1/ECG_filters_basics/ecg_sample.txt</a></p> <p>and I need to filter a 50Hz noise out of it, using an algorithm like that</p> <p><a href="http://joachim.behar.perso.neuf.fr/Joachim/ECG_tuto_1/ECG_filters_basics/notch_filter.m" rel="nofollow">http://joachim.behar.perso.neuf.fr/Joachim/ECG_tuto_1/ECG_filters_basics/notch_filter.m</a></p> <p>and the result should be like that ( red - filtered, blue - unfiltered ) seen in <a href="http://joachim.behar.perso.neuf.fr/Joachim/ECG_tuto_1.php" rel="nofollow">Figure 2</a>:</p> <p><img src="http://i.stack.imgur.com/06ici.png" alt="enter image description here"></p> <p>What would be the best way of doing it in Java/android? Would this library help <a href="https://sites.google.com/site/piotrwendykier/software/jtransforms" rel="nofollow">https://sites.google.com/site/piotrwendykier/software/jtransforms</a> ?</p> <p>Thanks! )</p>
java android
[1, 4]
5,966,834
5,966,835
how to prevent web page refreshing
<p>I have a "CaptchaControl" in a webusercontrol, when i click refresh link for the captcha code, the page refresh too. how can i prevent it?</p> <pre><code>&lt;cc:CaptchaControl ID="captcha" CssClass="toppading" runat="server" CharCount="5" ImageUrl="~/images/CapchaImage.jpg" /&gt; &lt;asp:LinkButton CssClass="leftpading" id="btnReset" runat="server" Text="Refresh" resourcekey="lblrefresh" OnClick="btnReset_Click" &gt;&lt;/asp:LinkButton&gt; protected void btnReset_Click(object sender, System.EventArgs e) { captcha.Refresh(); } </code></pre> <p>i've heard something about ajax, but i'm green in ajax.</p>
c# javascript asp.net
[0, 3, 9]
5,939,510
5,939,511
Both side Sync database from sqlite to website
<p>I hv apps that sync db from sqlite to sqlserver in website. bt the prbm is that i need to sync both side(server side and phn side). Means when user insert/update/delete any data from web it reflect in phn and also when any changes made phn's db it reflect on website.</p> <p>Curretly im using simple method. which master tables are controled by website and transation are in adnroid phn. so whn syncing process done. it remove all the master data from adnroid db and recreate all stuff. so it take a process. i only need that chnages made on master tables on website and changes reflects on phn, that's the method which i looking for. same way android phn hv transation record when syncing, it remove all data form website and recreate. </p> <p>So, how can i get only those records which is newly inserted or updated or deleted from adnroid phn as well as website....help me plzzzz...</p>
android asp.net
[4, 9]
732,256
732,257
Cannot read parameters from Msxml2.XMLHTTP ajax call
<p>I cannot read parameter in PageHandler when using Msxml2.XMLHTTP ajax call.</p> <pre><code>function InvokeHandler() { InitXmlHttp(); xmlhttp.onreadystatechange = XMLHttpRequestCompleted; xmlhttp.open("GET", "BookmarkletHandler.ashx?target=ww1", true); xmlhttp.send(); } </code></pre> <p>I even tried:</p> <pre><code>function InvokeHandler() { InitXmlHttp(); xmlhttp.onreadystatechange = XMLHttpRequestCompleted; xmlhttp.open("GET", "BookmarkletHandler.ashx", true); xmlhttp.send("target=ww1"); } function InvokeHandler() { InitXmlHttp(); xmlhttp.onreadystatechange = XMLHttpRequestCompleted; xmlhttp.open("POST", "BookmarkletHandler.ashx", true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded") xmlhttp.send("target=ww1"); } </code></pre> <p>Here how i am trying to read in HTTPHandler:</p> <pre><code>public void ProcessRequest(HttpContext context) { String param = context.Request.QueryString["target"]; --&gt; this gives null } </code></pre> <p>Can anyone help?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
969,360
969,361
Passing dynamic value via param
<p>I am using this plugin <a href="http://valums.com/ajax-upload/" rel="nofollow">http://valums.com/ajax-upload/</a>. I am using this code :</p> <pre><code>var uploader = new qq.FileUploader({ // pass the dom node (ex. $(selector)[0] for jQuery users) element: document.getElementById('file-uploader'), // path to server-side upload script action: '/server/upload', params: {item1:$('#txtName').val() } }); </code></pre> <p>Now when the request is made to server always the blank value goes to server instead of what the actual value is (I changed the value of textbox after the page has been loaded). I think the first default value of textbox is passed in this case. My question how can I pass the dynamic value of textbox to server ?</p>
javascript jquery
[3, 5]
1,288,526
1,288,527
Allocating and deallocating event on a button
<p>I am busy having a problem with allocating a new event to an existing button that was created in the designer.</p> <p>Now here is the button that was created prior to runtime which is inside the modalpopupexteder5 -</p> <pre><code>&lt;asp:Button runat="server" ID="btnClose" Text="Close" OnClick="btnClose_Click" /&gt; </code></pre> <p>Here is the codebehind - </p> <pre><code> protected void btnAddAccount_Click(object sender, EventArgs e) { btnClose.Click -= new EventHandler(btnClose_Click); btnClose.Click += new EventHandler(btnCancel_Click); ModalPopupExtender5.Show(); } protected void btnCancel_Click(object sender, EventArgs e) { ModalPopupExtender11.Hide(); } protected void btnClose_Click(object sender, EventArgs e) { ModalPopupExtender5.Hide(); } </code></pre> <p>So the button in the beginning has the event btnClose_Click hooked up to it. But I want to change it to the btnCancel_Click</p> <p>But it wont execute the btnCancel_Click. It executes the original btnClose_Click</p> <p>Any Ideas what could of caused this?</p> <p>Does this relate to the page life cycle?</p> <p><strong>--EDIT--</strong> I should let you know that the btnAddAccount_Click does get executed.</p> <p>Basically I don't to create the same modalpopupextender, I want to use the existing one but depending on user selection will determine which eventhandler should be called and in this case the btnAccount_Click has selected the btnCancel_Click to be assigned to the button.</p>
c# asp.net
[0, 9]
3,847,368
3,847,369
Eventhandling in ascx usercontrols
<p>What is best practises for communicating events from a usercontrol to parent control/page i want to do something similar to this:</p> <pre><code>MyPage.aspx: &lt;asp:Content ID="Content1" ContentPlaceHolderID="MainContentPlaceholder" runat="server"&gt; &lt;uc1:MyUserControl ID="MyUserControl1" runat="server" OnSomeEvent="MyUserControl_OnSomeEvent" /&gt; MyUserControl.ascx.cs: public partial class MyUserControl: UserControl { public event EventHandler SomeEvent; .... private void OnSomething() { if (SomeEvent!= null) SomeEvent(this, EventArgs.Empty); } </code></pre> <p>Question is what is best practise?</p>
c# asp.net
[0, 9]
5,489,051
5,489,052
my hover function in jquery it's not working
<p>i am trying to append p tag with some text and i trying to show alert message when hover that p tag content but here it's not working here is my code:<a href="http://jsfiddle.net/sureshpattu/37TUN/" rel="nofollow">code</a></p>
javascript jquery
[3, 5]