Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
3,513,198
3,513,199
Redirect via datagridView
<p>I am currently working in ASP.Net / C#. I am trying to make the server redirect to another page using via the rows in a datagrid, however, my code doesn't seem to work. Any help would be appreciated. </p> <p> </p> <pre><code> protected void GridView1_RowCreated() { foreach (GridViewRow row in GridView1.Rows) { Color color = row.BackColor; string color2 = System.Drawing.ColorTranslator.ToHtml(color); Session["" + row.Cells[0].Text + ""] = row.Cells[0].Text; //row.Attributes.Add("onclick", "zz(); return false;"); /*if (row.RowState == DataControlRowState.Alternate) { row.Attributes.Add("onclick", "redirectFunction(); return false;"); //row.Attributes.Add("onmouseover", "this.style.backgroundColor=' #FFFFFF';"); //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';"); //row.Attributes.Add("onclick", cookie.Value = row. GridView1.SelectedRow.Cells[0].Text); //row.Attributes.Add("onclick", "zz(); return false;"); } else { //row.Attributes.Add("onmouseover", "this.style.backgroundColor=' #FFFFFF';"); //row.Attributes.Add("onmouseout", "this.style.backgroundColor='" + color2 + "';"); //row.Attributes.Add("onclick", "zz(); return false;"); }*/ } } public void redirectFunction() { Response.RedirectPermanent("View.aspx"); } Other page if(Session["session"].ToString() != null) { // do something } </code></pre>
c# asp.net
[0, 9]
5,308,572
5,308,573
A Way Of Saying "For All Subclasses In My Project That Extend This Superclass"?
<p>Here's something that's got me a bit stumped but intrigued all the same. In my Android game I have various Levels that extend the superclass Level. What I am trying to do is build a levelDirectory (based on the Singleton DP) that essentially is an object that has a HashMap object within it that stores all the Level subclasses. Here is my question:</p> <p>We're all familiar with the enhanced for loop, but how can I write something that would be the equivalent of</p> <pre><code>for(Level l : An Array Of Every Level Subclass In My Project that is an Extension of the Level Superclass){ HashMap.put(l.name, l); } </code></pre> <p>I am trying to build a system that can dynamically update itself when I add more and more level subclasses. I know having a method in Level that submitted itself to the static Directory and was called in the Level's constructor is an option, But I'm just wondering whether there is a way of doing what I said above in that enhanced for loop?</p> <p>Many thanks</p>
java android
[1, 4]
483,687
483,688
Scroll down to Form DIV area?
<p>Every time I add an item - I want to scroll down to <strong>Add Item Form</strong> form (<code>#form_additem</code>) - how can that be done?</p> <p>Example of HTML Code:</p> <pre><code>&lt;div class="item"&gt; 1 &lt;/div&gt; &lt;div class="item"&gt; 2 &lt;/div&gt; &lt;div class="item"&gt; 3 &lt;/div&gt; &lt;div class="item"&gt; 4 &lt;/div&gt; &lt;div id="form_additem"&gt; Add Item: &lt;input type="text" value="" /&gt; &lt;/div&gt; </code></pre> <p>I have tried:</p> <pre><code> $('html,body').animate({scrollTop: $("#form_additem").offset().top + "px"}); </code></pre> <p>but it scrolling at the bottom of the page.</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,747,801
3,747,802
Why my page is refresed every time I click a empty link?
<p>I have a link like this:</p> <pre><code>&lt;a hreflang="15" class="comment-show-link" href=""&gt;View/hide comments&lt;/a&gt; </code></pre> <p>And then have this code to show/hide the content:</p> <pre><code>$('.comment-show-link').click(function(e) { $('#comment-show-'+$(this).attr("hreflang")).slideToggle('slow'); e.stopPropagation(); }); </code></pre> <p>But when I click the link the page is sended and the div "#comment-show-" isn't showed, why? What I'm doing wrong?</p>
javascript jquery
[3, 5]
5,662,673
5,662,674
How to Iterate data from array inside another array in jquery
<p>i have an array inside another array like this in php </p> <pre><code>Array ( [common_search] =&gt; Array ( [BusinessName] =&gt; Sun Shine Vision [Address] =&gt; Amulia St Madhava Pharmacy Jn [Phone] =&gt; ) [cache_table] =&gt; Array ( [Details] =&gt; Speedtrax,Ample's Bldg Off Banerji Rd., Amulia St, ) ) </code></pre> <p>And i have to iterate these as seperate arrays in my result page using Jquery ,as i want to get these arrays separately to display in different divs to set as html ,How can i get the data from two arrays (common_search , cache_table) separately . And in my html i want to set data like <code>$("#common_searchdiv").html(common_search)</code> and <code>$("#cache_tablediv").html(cache_table)</code> . Thanks in advance</p>
php javascript jquery
[2, 3, 5]
5,567,258
5,567,259
How to get nested control's ClientID using JavaScript?
<p>Today I got an interview question as titled.</p> <p>For example, a Update Panel contains a Panel, the Panel contains a TextBox. </p> <p>How can I get the TextBox ClientID?</p> <p>The only I could think of that is:</p> <ol> <li><p>We can predict the TextBox ClientID depends on the ClientID mode and use getElementByID. </p> <p>i.e. <code>getElementByID('ct100$MasterPageBody$ct100$UpdatePanelID$ct100$PanelID$ct100$TextBoxID')</code></p></li> <li><p>We can use JavaScript to parse the HTML, parse the input controls into arrays.</p> <p>i.e Assume we know we want to find the first UpdatePanel's first Panel's first TextBox. We can find it from myUpdatePanel[0] then get its children using JavaScript? (I am only guessing here)</p></li> <li><p><code>getElementByID('&lt;%=MyTextBox.ClientID%&gt;')</code></p></li> </ol> <p>But assuming the TextBox is added dynamic, but what's the proper way of doing it?</p>
javascript asp.net
[3, 9]
1,068,280
1,068,281
Efficient paging in Web Application
<p>I'm new to paging in web applications. I searched the web and found lots of tutorial on paging for web site(Create new website in VS). I cant use the current method of enable paging in vs which can be done easily because its not efficient &amp; retrieve the whole table of data from database.</p> <p>Default paging—Can be implemented by just checking the Enable Paging option in the data Web control's smart tag. However, whenever viewing a page of data, the ObjectDataSource retrieves all of the records, even though only a subset of them is displayed in the page.</p> <p>Custom paging—Improves the performance of default paging by retrieving only those records from the database that must be displayed for the particular page of data requested by the user. However, custom paging involves a bit more effort to implement than default paging.</p> <p>I'm looking for a custom paging for web application, hope you guys can help me with it. I found 2 links which i think might be custom paging but i'm not sure which part of the code say so, so it would be nice if you can tell me which part of the code actually make it efficient Thanks!</p> <p>The 2 links are <a href="http://www.codeproject.com/Articles/170921/MvcContrib-Grid-Paging-and-Searching-in-ASP-NET-MV" rel="nofollow">http://www.codeproject.com/Articles/170921/MvcContrib-Grid-Paging-and-Searching-in-ASP-NET-MV</a> and <a href="http://blogs.msdn.com/b/codefx/archive/2009/09/07/how-to-implement-insert-edit-delete-paging-and-sorting-functions-in-an-asp-net-gridview-control.aspx?CommentPosted=true#commentmessage" rel="nofollow">http://blogs.msdn.com/b/codefx/archive/2009/09/07/how-to-implement-insert-edit-delete-paging-and-sorting-functions-in-an-asp-net-gridview-control.aspx?CommentPosted=true#commentmessage</a></p> <p>Thanks again!</p>
c# asp.net
[0, 9]
358,270
358,271
A function to convert null to string
<p>I want to create a function to convert any null value e.g. from a database to an empty string. I know there are methods such as if value != null ?? value : String Empty but is there a way to pass null to a method e.g.</p> <pre><code>public string nullToString(string? value) { if(value == null) return empty; return value } </code></pre> <p>But I am not sure on the paremter syntax to do this..</p> <p>I tried the above but it says not a nullable type.</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
5,780,131
5,780,132
javascript unterminated string constant
<p>I have the following function which I pass in a value, but this value is coming from the database. However I get the following javascript when doing the following: </p> <pre><code>showrootcausedetails('showrootcause',true,'&lt;%# eval("Root Cause Analysis").ToString() %&gt;') </code></pre> <p>I know I have to escape the characters, but How can I do that without knowing what is in the actual string?</p> <p>Thanks,</p> <p>Jacob</p>
c# javascript asp.net
[0, 3, 9]
4,074,831
4,074,832
Exception Unable to set property 'href' of undefined or null reference when
<p>The problem is this: I try to dynamically change the innerHTML and href of an LINk in a function <code>CheckCookie</code> which is executed in body - onload. Here is the function: </p> <pre><code>function checkCookie() { var username = getCookie("username"); if (username != null &amp;&amp; username != "") { document.getElementById("firstlink").href = "http://localhost:8080/newLogIN/probalassfinalwithoutstyle.html"; document.getElementById("firstlink").innerHTML = "Go to my lesson"; } } </code></pre> <p>also I have another jquery function which is executed on document ready </p> <pre><code>function DropDown(el) { this.dd = el; this.initEvents(); } DropDown.prototype = { initEvents: function() { var obj = this; obj.dd.on('click', function(event) { $(this).toggleClass('active'); event.stopPropagation(); }); } } $(function() { var dd = new DropDown($('#dd')); $(document).click(function() { // all dropdowns $('.wrapper-dropdown-3').removeClass('active'); }); }); </code></pre> <p>In my body I've got this</p> <pre><code>&lt;body onload="CheckCookie()"&gt; &lt;div id="dd" class="wrapper-dropdown-3"&gt;LoGG &lt;ul class="dropdown"&gt; &lt;li&gt;&lt;a href="#" id="firstlink"&gt;Gismo Account&lt;/a&gt; &lt;/li&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>Everything works as I want but when I add </p> <pre><code>document.getElementById("dd").innerHTML = "Hi," + getCookie("username"); </code></pre> <p>to change the InnerHtML of dd div it gives me an exception </p> <p>SCRIPT5007: Unable to set property 'href' of undefined or null reference </p>
javascript jquery
[3, 5]
1,981,823
1,981,824
How to do this in jQuery
<p>I have the following code:</p> <pre><code>var tempIdx = document.getElementById('cityBuild').selectedIndex; var tempBuilding = document.getElementById('cityBuild').options[tempIdx].value; // Do stuff with tempBuilding </code></pre> <p>I spent some time trying to do it in jQuery under the assumption it'd be easier, it wasn't. I tried what was given at <a href="http://marcgrabanski.com/article/jquery-select-list-values" rel="nofollow">this site</a> but is never returned any of the values. Am I doing something wrong or is this something that jQuery simply doesn't do?</p> <p>The item is a select box (single selection only) and I want to get the value from it.</p>
javascript jquery
[3, 5]
3,741,032
3,741,033
Single queue for jQuery animate() elements
<p>By default the jQuery queue that is created for animate() is done per element, I'm wondering if there is a way to create a single queue for all animations done with animate()? I.e. only one animation should be occuring at a time</p>
javascript jquery
[3, 5]
1,146,944
1,146,945
Using jQuery and "if/else" to animate
<p>I'm back with another jQuery problem, woo! Here's what I'm trying to do, I have text field, and I want it's background to turn red if the user doesn't input anything, or turn green if something is entered. Both checks occur on "blur," and I'm using ".animate()." to change the background color. (I have jQuery-Color to let me animate colors). Here is my script:</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript" src="assets/javascript/jQuery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="assets/javascript/jQuery-color.js"&gt;&lt;/script&gt; &lt;script&gt; var jQ=jQuery.noConflict(); var fullNameValue=jQ(".fullName").attr("value"); jQ(document).ready(function(){ jQ(".fullName").blur(function(){ if(fullNameValue==null || fullNameValue==""){ jQ(".fullName").animate({ backgroundColor: "#AF383C", color: "#FFFFFF" }); } else{ jQ(".fullName").animate({ backgroundColor: "#78BB6C", color: "#000000" }); } }); }); &lt;/script&gt; &lt;/head&gt; </code></pre> <p>Currently, on blur, the text field turns red, even if something is entered in the text field, which probably means something is wrong with my if statement, correct?</p>
javascript jquery
[3, 5]
5,328,647
5,328,648
Null Pointer Exception in my Listener
<p>I am making a call to my AsyncTask from my Fragment class, when i try to send the data back to my Fragment, i get a null pointer exception. </p> <pre><code>public interface AsyncListner { public void onLoadComplete(List&lt;DocumentResponse&gt; documents); } </code></pre> <p>My Fragment class implements the interface. </p> <pre><code>public class FragmentClass extends SherlockFragment implements AsyncListner {@ Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); new AsyncTask(Obj, getSherlockActivity()).setListener(this); new AsyncTask(Obj, getSherlockActivity()).execute(); } @Override public void onLoadComplete(List &lt; Response&gt; data) { Log.d("Result", data.toString()); } } </code></pre> <p>I followed this answer. <a href="http://stackoverflow.com/a/13476196/98514">http://stackoverflow.com/a/13476196/98514</a></p>
java android
[1, 4]
8,261
8,262
I want a similar effect with the one from this website. Can it be done with jQuery?
<p>I need a jQuery effect something similar with the one from this website:</p> <p>[site removed]</p> <p>If you go hover the right menu (right of the slider), top is Visit SMWF you will see that the slider is changing. I want something similar.</p> <p>Anyone knows a JQ plugin or at least can anyone share how to do it? Can this be done in jQuery?</p> <p>Thanks a lot!</p>
javascript jquery
[3, 5]
3,674,432
3,674,433
JQuery script conflict
<p>I am using a jQuery Lightbox for a gallery on a page with a jQuery Slideshow and menu bar, whilst the menu bar and Slideshow work ok, the Lightbox does not.</p> <p>CONFLICT WITH LIGHTBOX see <a href="http://concertorestaurant.creativeconnect.com.au/functions_gallery.html" rel="nofollow">http://concertorestaurant.creativeconnect.com.au/functions_gallery.html</a></p> <p>WORKING EXAMPLE - Menu with Slideshow <a href="http://concertorestaurant.creativeconnect.com.au/home.html" rel="nofollow">http://concertorestaurant.creativeconnect.com.au/home.html</a></p> <p>Appreciate your help!</p>
javascript jquery
[3, 5]
4,021,080
4,021,081
jQuery hide image without $somestuff in title
<p>I am trying to code a piece where thousands of image thumbnails are on a page and the users want to search for them rapidly and repetatively. </p> <p>So turned to trusty jQuery. I have come up with the following code: </p> <pre><code>$(document).ready(function () { $('input[name="search"]').keyup(function(e){ console.log('checking...'); var $this = $(this); if($this.val().length &gt; 3 || e.which == 8 || e.which == 46) { var check = 'img[title*="' + $this.val() + '"]'; $.each($('.asset'), function() { $(this).show(); $(this).not(check).hide(); }) console.log(check); } else { console.log('False'); }; }); }); </code></pre> <p>Which only partially works. The bit it fails on is that <code>$(this).not(check).hide();</code> simply hides everything without selecting only the images with the search query in their title. </p> <p>Is there a way to get jQuery to complete this task? </p>
javascript jquery
[3, 5]
5,204,911
5,204,912
merge 2 classes into one class at runtime
<p>suppose i have Class A with some properties and Attributes, and Class B with the same, how can i merge these 2 class Properties and properties Attributes into 1 class at runtime, or better is how can i add these 2 classes into a a third class as properties of this new class with their Fields, Properties, Methods, etc... at Runtime ? </p> <p>using reflection or the News .NET 4.0 Dynamic or expando Object</p> <p><strong>Edit</strong>: Damn i am sorry to all for not being clear, what i want is to create a dynamic ViewModel for MVC, where other classes are in some other assemblies, and i want them to be part of the model with their Datavalidation attributes. and i don't know how many or what exactly these classes are goanna be, so i want to iterate through assemblies and choose them then add them to the main View Model</p> <p>thanks in advanced</p>
c# asp.net
[0, 9]
125,812
125,813
ClickListener and ListView Item Layout
<p>I have the following ClickListener on my ListView. My item layout is a RelativeLayout with 3 TextViews. I'm trying to return the value of the list item but I'm getting "android.widget.TextView@44ed....". What am I doing wrong?</p> <pre><code> itemList=(ListView)findViewById(android.R.id.list); itemList.setTextFilterEnabled(true); itemList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) { Intent intent = new Intent(); Bundle b = new Bundle(); b.putString("TEXT", ((RelativeLayout) v).getChildAt(position).toString()); intent.putExtras(b); setResult(SUCCESS_RETURN_CODE, intent); finish(); } }); </code></pre>
java android
[1, 4]
5,996,256
5,996,257
Loop through 2 arrays in jquery and combine
<p>I have 2 arrays, one with cities, and another array with ID's... I would like to loop both, and then output some HTML</p> <p>Right now im only looping cities, and then appending some HTML to a as following:</p> <pre><code>if ($jq(".area").length &gt; 0) { var region = $jq(".hiddenFieldRegion").val(); var cityIDs = $jq(".hiddenFieldChosenAreas").val(); var strcities = $jq(".hiddenFieldChosenCities").val(); //var cities = strcities.split('|'); //Set region to be marked if (region) { $jq(".mapdk").attr("class", region); } //Appending to searchform if (strcities) { $jq.each(strcities.toString().split("|"), function (k, v) { var v = v.split("|"); $jq("&lt;option selected /&gt;").text(v[0]).appendTo("select.chosen-cities"); }); } } </code></pre> <p>I would like the place where im appending to the searchform, add an attribute value, with an ID from the cityIDs array...</p> <p>So i get some HTML like:</p> <pre><code>&lt;option value="XXX"&gt;CityName&lt;/option&gt; </code></pre> <p>Is that possible?</p>
javascript jquery
[3, 5]
5,040,868
5,040,869
How to replicate the "popup" messages seen in SE sites?
<p>StackOverflow and other sites in the SE Network have nifty things that pop up with messages, for example, when you click on an upvote link while not logged in. I'm not sure what this sort of thing is called, though.</p> <p>I'm assuming that this is done with CSS somewhere, but looking at the source of the pages with a view to reverse engineering it, it doesn't seem like the buttons are actually links.</p> <p>Using C# and ASP.NET, how could I emulate this sort of functionality?</p>
c# asp.net
[0, 9]
3,797,565
3,797,566
Inline statement keypairvalues
<p>I have the following HtmlLink:</p> <pre><code>HtmlLink htmlLink = new HtmlLink(); htmlLink.Attributes.Add("href", "/style/" + category + ".css"); htmlLink.Attributes.Add("type", "text/css"); htmlLink.Attributes.Add("rel", "stylesheet"); </code></pre> <p>Im trying to write it in a one line statement, but I dont know the right syntax to write a statement like: </p> <pre><code>List&lt;string&gt; list = new List&lt;string&gt; { "one", "two", "three" }; </code></pre> <p>Doing:</p> <pre><code>HtmlLink htmlLink = new HtmlLink() { ???? }; </code></pre> <p>Can someone satisfy my curiosity?</p>
c# asp.net
[0, 9]
3,368,217
3,368,218
Select All Elements that do not have a binding to a given function?
<p>If I assign a function to a variable <em>foo</em>, is there a way to select all elements that do not have a binding to <em>foo</em> given that they are assigned via a structure like <code>$('.elementsWithClass').click(foo)</code>?</p> <p>My motivation here is we have ajax requests replacing parts of the DOM, and I need an easy way to rebind event handlers that is not based on .live/.on as we are controlling event bubbling in some parts of the application.</p>
javascript jquery
[3, 5]
1,412,493
1,412,494
parallax with 1 image
<p>I want to use parallax effect with only 1 image. Can it be done?</p> <p>Actually, it's not really parallax, I have one big image in the center of screen, so when I move my mouse to the left, I want the image slightly moves to the right, move mouse to the right, the image slightly moves to the left, move mouse up image moves down, move mouse down image moves up.</p> <p>I think I've seen this effect before, but I kinda forget where I see it. Really appreciate help. Thanks</p>
javascript jquery
[3, 5]
256,441
256,442
In jQuery How to Call a Function When Images Loaded In a "Each & Load" Loop
<p>I am writing a little plugin like this:</p> <pre><code>(function($){ $.fn.extend({ myplugin: function (callback) { return this.each(function(){ $(this).one('load',function(){ // Manipulate Images }) ; }) ; } }) ; })(jQuery) ; </code></pre> <p>I want to fire a callback after plugin finishes its job:</p> <pre><code>jQuery('img').myplugin({function(){ // Do something }) ; </code></pre> <p>How can I do this?</p> <p><strong>Edit:</strong> It is still not solved, even I got a minus point because of my question found not clearly specified. But it must be obviously a little bit tricky solution. Are there any js ninja who can solve this?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
1,252,234
1,252,235
How to determine whether the user has switched to another tab of the current browser
<p>I wish to determine using jquery or javascript that is the user has switched tab standing on the same browser?</p> <p>I.e. if the user is currently standing on browser say mozilla-firefox tab no.1 , now he has opened another tab say tab no.2 , at that point a popup should appear , with the message "tab changed"</p>
javascript jquery
[3, 5]
2,340,526
2,340,527
Convert this JavaScript code to jQuery
<p>I am new to jQuery, so I'm having trouble solving this. I want this converted to jQuery.</p> <p><strong>JavaScript:</strong></p> <pre><code>var el = document.getElementById("box"); el.style.backgroundColor = "#0000000"; var new_el = document.createElement("div"); new_el.innerHTML = "&lt;p&gt;some content&lt;/p&gt;"; el.appendChild(new_el); </code></pre>
javascript jquery
[3, 5]
2,477,803
2,477,804
Emulate drag-and-drop using JavaScript
<p>I know that jQuery can programmatically trigger events on DOM elements that are listening to those events. For example <code>$el.click()</code> will trigger a click event on <code>$el</code> without having to physically click <code>$el</code> with the mouse.</p> <p>Given two DOM elements <code>dom1</code> and <code>dom2</code>, is it possible to programmatically emulate a drag-and-drop from <code>dom1</code> to <code>dom2</code> using jQuery (or vanilla JavaScript), where <code>dom1</code> is draggable and <code>dom2</code> is droppable using jQuery UI.</p> <p>Note: The reason I want to do this is to build automated UI tests.</p>
javascript jquery
[3, 5]
1,182,324
1,182,325
is it possible creating a floor plan with clickable region and will be used as a web app?by floor plan i mean what architects use
<p>What tools could i use to create a web app with an interactive floor plan?by interactive i mean there are clickable regions in a floor plan.if you have any experience developing such web app could you point me to the right direction.thanks in advance</p>
java php javascript jquery
[1, 2, 3, 5]
57,517
57,518
Populate an array to consist of all of the values in an html select list using jQuery
<p>I have an HTML select list (let's call it List A) that is dynamically populated with a list of values. I need to change another select list (List B) depending on the value of List A. That part, I can do. Ordinarily, the user selects <em>one</em> element of List A, and gets a List B contingent on List A. </p> <p>However, the first element of List A is "All Values." Therefore, in this instance, I want a List B that consists of the aggregate of all of the values possible for List B. Because the available values of List A are dynamically generated, I can't simply pull all List B values. I need to pull all List B values contingent on all List A values <em>shown</em>.</p> <p>To do this, I want to iterate through all of the values in List A, and append to List B for each item in List A. This is where I'm stuck. <strong>How can I populate an array to consist of all of the values in a select list?</strong> Again, because List A is populated dynamically, the only way to get a list of these values is to pull them from the select list element.</p> <p>I tried this: </p> <pre><code>iterate_models = $.map($('#listA'), function(e) { return $(e).val(); }); </code></pre> <p>This did not give me an array of the values of each element in #listA. I can't figure out why not.</p>
javascript jquery
[3, 5]
207,284
207,285
Javascript window.open Calling Twice
<p>I'm using this code in a php conditional if/else statement to open a new window.</p> <pre><code>echo("&lt;script type=\"text/javascript\"&gt; &lt;!-- window.open(\"http://www.example.com/index.php?$var\"); //--&gt; &lt;/script&gt; "); </code></pre> <p>It's opening 2 windows instead of one, but only on my live site (on a dedicated server) and not on the test site (shared server).</p> <p>EDIT: From zebediah49's suggestion, I appended a random int variable after the new window url. It changes the variable with each new window instance, so I assume that means that it runs the conditional twice. I probably should mention that it's using Joomla and a 3rd-party community app, JomSocial.</p> <p>Alright, as I was editing this and after ~5min of the same window being open, it opened a brand new instance of the window.open window. So obviously it automatically refreshes once as soon as it lands. I'll have to pry into that. Still any suggestions are welcome.</p> <p>Thank you for your tips regarding language and best practices.</p>
php javascript
[2, 3]
3,190,280
3,190,281
Cannot make a static reference to the non-static method
<p>I'm trying to insert string value from R.string resource xml file and i'm getting error message.</p> <p>here is the Java code:</p> <pre><code> public static final String TTT = (String) getText(R.string.TTT); </code></pre> <p>This is the error message:</p> <pre><code>Cannot make a static reference to the non-static method getText(int) from the type Context </code></pre> <p>How can i fix it ? i need it in order to make multi language application.</p> <p>Thanks in advanced</p>
java android
[1, 4]
5,187,669
5,187,670
jquery detecting when we are at the end of text in textarea
<p>I am just trying to learn jquery, and I was wondering how can you figure out when, given a bunch of text in a textarea, is the user at the end of textarea and tries to click down. For example, the last line of the text is asdf, and when the user is at that line, and presses down on the arrow key, i would like to get an event of some sort, or at least be able to figure out whether we are at the last line, and do an action (for example, wrap around and go to the first line)</p> <p>If anyone has some idea of how to do this, it would be greatly appreciated!</p> <p>Jason</p>
javascript jquery
[3, 5]
3,161,947
3,161,948
get the first tr that contains tds
<p>In jquery how do I get the first table row that contains <code>&lt;td&gt;s</code></p> <p>So far my code looks like this but its not working?</p> <pre><code>$('#mytable tr').has('td:first').html(); </code></pre> <p>thanks</p>
javascript jquery
[3, 5]
2,253,442
2,253,443
How to programmatically detect if an object is a jQuery object?
<p>How can I programmatically detect if an object is a jQuery object? For example:</p> <pre><code>// 1. declare some variables var vars = [1, 'hello', ['bye', 3], $(body), { say: 'hi' }]; // 2. ??? : implement function that tests whether its parameter is a jQuery object function isjQuery(arg) { /* ??? */ } // 3. profit var test = $.map(vars, isjQuery); /* expected [ false, false, false, true, false ] */ </code></pre>
javascript jquery
[3, 5]
4,944,773
4,944,774
jquery - Add exception onclick
<p>I have the following input fields:</p> <pre><code>&lt;input type="text" value="5" maxlength="12" id="qty" class="input-text qty" name="qty2050" tabindex="1"&gt; </code></pre> <p>and </p> <pre><code>&lt;input type="text" value="0" maxlength="12" id="qty" class="input-text qty" name="qty2042" tabindex="1"&gt; </code></pre> <p>I use this code to prevent the user from losing inserted data (upon quitting the page):</p> <pre><code>&lt;script&gt; window.onbeforeunload = function() { var showAlert = false; jQuery('.input-text.qty').each(function (){ //console.log("fonction 1"); var val = parseInt(jQuery(this).val(),10); if(val &gt; 0) { showAlert = true; } //alert(val); }); //console.log("fonction 2"); //console.log(showAlert); if (showAlert == true) { console.log("fonction 3"); return 'You have unsaved changes!'; } } &lt;/script&gt; </code></pre> <p>I want to add an exception to my submit button, and to not show the alert message when there is a quantity > 0 in one of my input fields.</p> <p>My problem is in adding this exception!</p> <p>Thanks for help.</p>
javascript jquery
[3, 5]
3,361,932
3,361,933
jQuery .live('click') seems to only bind to the first element
<p>So I have a bunch of buttons on a page, interspersed with other HTML, that look like this:</p> <pre><code>&lt;input class="add_new_task" type="submit" value="Add New Task"&gt; &lt;input class="add_new_task" type="submit" value="Add New Task"&gt; &lt;input class="add_new_task" type="submit" value="Add New Task"&gt; </code></pre> <p>And then I have my selector as follows: </p> <pre><code>$JQ('.add_new_task').live('click', function(){ //do some stuff }); </code></pre> <p>However, the live('click') only seems to bind to the first element, and so nothing will happen with the 2nd, 3rd etc. elements. Any suggestions as to what I'm doing</p> <p>EDIT:</p> <p>Turns out I was being stupid - I added some error checking to not allow submission if a text box was empty - but I was targetting the text box (stupidly) by id, and that in turn was selecting the first textbox with that ID - which indeed was empty. Changed to a class based selection system for these now - thanks for all the answers though! </p>
javascript jquery
[3, 5]
1,787,050
1,787,051
PHP not support double
<p>Hi I have written one function which is giving diff out put in PHP and JAVA. Please help me to get same output in PHP too. below are that functions written in both languages.</p> <p>function in JAVA </p> <pre><code>public String getLat(String v_str, String strNS){ try { double lat = Integer.parseInt(v_str.substring(0, 2)); //System.out.println("lat="+lat); double lat2 = Float.parseFloat(v_str.substring(2)); lat2 = lat2*10000; lat2 = lat2/60*10000; lat2 = lat2/100000000; //System.out.println("lat2="+lat2); lat += lat2; if(strNS.equals("S")) return ("-"+lat); else return (""+lat); } catch(Exception e){} return (""); } </code></pre> <p>CALL : getLat("5224.09960","N");</p> <p>OUTPUT: 52.40165999730428</p> <p><strong>function in PHP</strong></p> <pre><code>$deg_coord = '5224.09960'; $lat = (int)(substr($deg_coord,0,2)); $lat2 = (substr($deg_coord,2)); $lat2 = $lat2*10000; $lat2 = $lat2/60*10000; $lat2 = $lat2/100000000; echo $lat += $lat2; exit; </code></pre> <p>OUTPUT:52.40166</p>
java php
[1, 2]
4,411,781
4,411,782
JavaScript Split & jQuery .val() can I chain them?
<p>Here's a very simple question... can I add/chain the JS method <code>.split()</code> to jQuery's <code>.val()</code> method? For example...</p> <pre><code>var myNewArray = $("#myString").val().split(","); </code></pre> <p>I seem to get <code>$("#myString").val().split</code> is not a function in Firebug? I thought I could chain my JS and jQuery methods, perhaps I was wrong?</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,955,732
4,955,733
jQuery Make a Link in Active Status
<p>I am working on a HTML template, but I cannot touch the HTML code, I can only work on CSS and JS files. So I cannot in any way edit the HTML code.</p> <p>What I am trying to achieve is to put some links in active status when jQuery or Javascript recognizes that the current page URL is the same one of the link I want to put in active status, without editing the HTML code.</p> <p>Is there a way to do it? I tried in many ways but with no luck.</p> <p>Here is the HTML code ( Remember I cannot edit it ).</p> <pre><code>&lt;span class="Tag_Nav_Aux"&gt; &lt;a href="/my-account/create-account.aspx"&gt;Create&amp;nbsp;Account&lt;/a&gt; &amp;nbsp;|&amp;nbsp; &lt;a href="/my-account/login.aspx"&gt;Login&lt;/a&gt; &amp;nbsp;|&amp;nbsp; &lt;a href="/my-cart/default.aspx"&gt;My Cart&lt;/a&gt; &lt;/span&gt; </code></pre> <p>The jQuery or Javascript code should work on different links, other than the ones I reported above, since the HTML changes when the user is logged in or logged out. So the jQuery should point the class <code>Tag_Nav_Aux</code> and add the Active class to any <code>a</code> tag it will find that has the link the same of the current URL.</p>
javascript jquery
[3, 5]
715,001
715,002
jQuery change() fires on Page Load
<p>This code fires on the page load, but not when the change event actually occurs. </p> <pre><code>jQuery('select#order_note_type').change(function() { random code here }); </code></pre> <p>I have to add that it is not inside the <code>ready</code> method. Do I need to bind it?</p> <p>EDIT: I changed my code to be inside the <code>$(document).ready()</code> and used bind, but I still get my method to fire only at page load:</p> <pre><code>jQuery(document).ready(onReady); function onReady() { jQuery('select#order_note_type').bind('change',showTrackingInfo); } </code></pre>
javascript jquery
[3, 5]
5,973,066
5,973,067
jQuery JSON nested loops
<p>I have the following script:</p> <pre><code>function drawDimensions(divid) { $.getJSON('dimensions.json', function(data) { $.each(data, function(index) { var ppp = $('#' + divid).append("&lt;div class='dTitle'&gt;&lt;img src='images/cleardot.gif' /&gt;" + index + "&lt;/div&gt;&lt;br&gt;"); $.each(this, function(k, v) { $('&lt;div&gt;').append(v).appendTo(ppp); }); }); }); } drawDimensions('dim'); </code></pre> <p>I'm trying to nest the divs so the values from the first loop will be the parents of the divs on the second loop.</p> <p>What am I doing wrong? the second loop divs are not nested within the first one but simply appended after the first ones..</p>
javascript jquery
[3, 5]
3,103,741
3,103,742
Android listing contacts sync sources
<p>Does anyone knows how to get the contacts sync sources in android? like google source, facebook source or from the phone contacts.</p>
java android
[1, 4]
5,327,073
5,327,074
Get link value in html document with jQuery?
<p>Let's say I have a link in a table like:</p> <pre><code> &lt;td class="ms-vb" width="100%"&gt; &lt;a onfocus="OnLink(this)" href="/Lists/Business%20Divisions/DispForm.aspx?ID=2" onclick="GoToLink(this);return false;" target="_self"&gt;Train&lt;img src="/_layouts/images/blank.gif" class="ms-hidden" alt="" width="1" border="0" height="1"&gt; &lt;/a&gt;&lt;/td&gt; </code></pre> <p>How can I get the value Train with jQuery?</p> <p>Thanks in advance.</p> <p>edit: I currently get the querystring value from every link and push them into an array with the following code:</p> <pre><code>$("table").each(function(index, value) { $(this).addClass("table" + index); }); var hrefs = new Array(); $('.table449').children().children().each(function(){ var link = ($(this).find('a').attr('href')); var startIndex = link.indexOf(",'"); var endIndex = link.indexOf("');"); if ( startIndex &gt;= 0 &amp;&amp; endIndex &gt;= 0 ) { var linkID = link.substring( startIndex+2, endIndex ); hrefs.push(linkID); } alert(hrefs); }); </code></pre> <p>What I want to do is to store the values like Train in another array.</p>
javascript jquery
[3, 5]
4,212,422
4,212,423
Accessing siblings in jquery
<p>I want to access the sibling of a column :</p> <pre><code> &lt;tr&gt; &lt;td&gt;1&lt;/td&gt; &lt;td&gt;2&lt;/td&gt; &lt;td&gt;3&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>When i click over 3, how can i access 1?</p>
javascript jquery
[3, 5]
2,330,793
2,330,794
Related to executing Java programs through Python
<p>I am using os.system to execute a java program through a python script. I need to pass a file name to the java program as an argument. I am not able to figure out how to pass the relative file location. What should be my reference for determining the relative location. I tried to use the location of the python script as the reference but doesn't work.</p>
java python
[1, 7]
745,403
745,404
Use python to execute javascript on a given list of websites and output result to a csv
<p>I have an input file which contains a list of URLs. I am trying to execute a script on each of those URLs and output the result of that script to a CSV. </p> <p>An example is trying to find if a given list of sites are using Google Analytics. The script below when run in the context of the page will return a JSON like "{'GA': true}". </p> <pre><code>var scripts = document.getElementsByTagName("script"); var source = []; for (var i = 0; i &lt; scripts.length; i ++) { var s = scripts[i]; if (!s.src) continue; source.push(s.src); } checkforGA(); function checkforGA() { var tools = {}; for (var j = 0 ; j &lt; source.length; j ++) { if (/google-analytics.com\/(ga|urchin).js/i.test(source)) { tools.GA = true; return JSON.stringify(tools); } else { tools.GA = false; return JSON.stringify(tools); } } } </code></pre> <p>My input is a csv file which has a list of sites</p> <pre><code>Google, http://google.com Wikipedia, http://wikipedia.com Techcrunch, http://techcrunch.com Stackoverflow, http://stackoverflow.com Yahoo, http://yahoo.com </code></pre> <p>My desired output is </p> <pre><code>Google, http://google.com, {'GA': false} Wikipedia, http://wikipedia.com, {'GA': false} Techcrunch, http://techcrunch.com, {'GA': true} Stackoverflow, http://stackoverflow.com, {'GA': true} Yahoo, http://yahoo.com, {'GA': false} </code></pre> <p>I am not sure if it is possible to run js from within a python script but i am looking for some idea on how to get started. </p>
javascript python
[3, 7]
2,166,878
2,166,879
Abstract question about Dom Object as Value Object in Javascript
<p>I've got an image gallery where each item in the gallery has a unique ID I'm using to tie it to my backend so that I can run DB actions etc. I'm using the data attribute to hold the 'imageid' on the parent div of each image for example: data-imageid="168"</p> <p>The image gallery items have alot of nested divs so on rollover/click I find myself doing alot of the below in order to run actions:</p> <pre><code>$(this).parent().parent().attr('data-imageid'); </code></pre> <p>It doesn't feel like a clean solution or the best performance wise. How are other people handling this? What's the best solution? Whatever the solution, this must be a problem solved everyday.</p> <p>Edit: I realize my subject line is vague but it further explains where my heads at with this problem.</p>
javascript jquery
[3, 5]
4,912,192
4,912,193
Building an HTML table on the fly using jQuery
<p>Below is the code I use to build an HTML table on the fly (using JSON data received from the server).</p> <p>I display an animated pleasewait (.gif) graphic while the data is loading. However, the graphic freezes while the JavaScript function is building the table. At first, I was just happy to make this happen (display the table), I guess now I need to work on efficiency. At the very least I need to stop the animated graphic from freezing. I can go to a static "Loading" display, but I would rather make this method work.</p> <p>Suggestions for my pleasewait display? And efficiency? Possibly a better way to build the table? Or maybe not a table, but some other "table" like display</p> <pre><code>var t = eval( "(" + request + ")" ) ; var myTable = '' ; myTable += '&lt;table id="myTable" cellspacing=0 cellpadding=2 border=1&gt;' ; myTable += "&lt;thead&gt;" ; myTable += "&lt;tr&gt;"; for (var i = 0; i &lt; t.hdrs.length; i++) { myTable += "&lt;th&gt;" + header + "&lt;/th&gt;"; } myTable += "&lt;/tr&gt;" ; myTable += "&lt;/thead&gt;" ; myTable += "&lt;tbody&gt;" ; for (var i = 0; i &lt; t.data.length; i++) { myTable += '&lt;tr&gt;'; for (var j = 0; j &lt; t.hdrs.length; j++) { myTable += '&lt;td&gt;'; if (t.data[i][t.hdrs[j]] == "") { myTable += "&amp;nbsp;" ; } else { myTable += t.data[i][t.hdrs[j]] ; } myTable += "&lt;/td&gt;"; } myTable += "&lt;/tr&gt;"; } myTable += "&lt;/tbody&gt;" ; myTable += "&lt;/table&gt;" ; $("#result").append(myTable) ; $("#PleaseWaitGraphic").addClass("hide"); $(".rslt").removeClass("hide") ; </code></pre>
javascript jquery
[3, 5]
300,308
300,309
Two docready() events are firing with jQuery.tabs();
<p><strong>Problem:</strong> When the document is ready, jQuery will fire off the tabs function below. Then after tabs finishes, it fires the document ready function again. What would be a good approach to only trigger the document ready function once? Thanks!</p> <pre><code>$(document).ready(function() { $("#index-tabs").tabs({ cache: true }, { idPrefix: 'ui-tabs-index' }); }); </code></pre> <p>My tabs:</p> <pre><code>&lt;ul id="index-tablist"&gt; &lt;li id="index-config-tab" class="frstTab"&gt;&lt;a href="ajax/config.html" &gt;Config&lt;/a&gt;&lt;/li&gt; &lt;li id="index-system-tab"&gt;&lt;a href="ajax/system.html" &gt;System&lt;/a&gt;&lt;/li&gt; &lt;li id="index-wizard-tab"&gt;&lt;a href="ajax/wizard.html" &gt;Wizard&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><strong>Update:</strong> I tried using the load parameter to specify a function to load. But for some reason when tabs() is executed its reloading the index and executing the tabs function twice.</p> <pre><code>$("#index-tabs").tabs({ load:initScripts, cache: true }, { idPrefix: 'ui-tabs-index' }); function initScripts(){ alert('run this code once'); // This alerts twice for some reason. } </code></pre>
javascript jquery
[3, 5]
107,690
107,691
How To Update JQuery Progress Bar Value from a Variable
<p>I have a Problem Regarding the JQuery Progress Bar.</p> <p>I Need to set the Value of the Progress bar with the Value stored in a Javascript Variable.</p> <pre><code> $(document).ready(function () { var text = $('.Gadget').find('input[name="Percentage"]').val(); $(function() { $( ".ProgressBar" ).progressbar({ value: 59 }); }); </code></pre> <p>});</p> <p>The Above code works fine, but as there is Value 59 the value is always Constant. </p> <p>What I Really need is that instead of the 59, there will be the value of the text Variable.</p> <p>Note: if I Put Value:text, the Progress bar disappears</p> <p>Thank You, Andrew Borg</p>
javascript jquery
[3, 5]
1,687,589
1,687,590
jQuery Tree View and wp_list_pages
<p>I'm looking to use the <a href="http://www.dynamicdrive.com/dynamicindex1/treeview/index.htm" rel="nofollow">jQuery TreeView</a> script on wp_list_pages to get a nice collapsable-tree effect going. </p> <p>The script requires that I add some classes to the list elements such as:</p> <pre><code>&lt;ul id="red" class="treeview-red"&gt; </code></pre> <p>So I tried putting this in my template:</p> <p>First, load scripts on my template page via wp_enqueue_script() </p> <pre><code>wp_enqueue_script("av_jquery_tree"); get_header(); </code></pre> <p>Where "av_jquery_tree" is defined in a plugin:</p> <pre><code>function av_jquery_tree() { wp_register_script('jquery.treeview', get_template_directory_uri() . '/js/jquery.treeview/jquery.treeview.js', array('jquery'), '1.0' ); wp_register_script('jquery.cookie', get_template_directory_uri() . '/js/jquery.treeview/jquery.cookie.js', array('jquery'), '1.0' ); wp_enqueue_script('jquery.treeview'); wp_enqueue_script('jquery.cookie'); } add_action('wp_enqueue_scripts', 'av_jquery_tree'); </code></pre> <p>Second, In order to add the class and id to the first ul element on the page, I just insert this script above the call to wp_list_pages:</p> <pre><code>&lt;script&gt; jQuery(document).ready(function(){ jQuery("ul").first().attr("id", "red").addClass("treeview-red"); }); &lt;/script&gt; </code></pre> <p>Unfortunately, my output is just a bunch of red lines across wp_list_pages. Also keep in mind that I'm using the Suffusion Theme, which <a href="http://aquoid.com/forum/viewtopic.php?f=4&amp;t=7466&amp;p=32243#p32243" rel="nofollow">preloads jquery</a>.</p>
jquery javascript
[5, 3]
3,251,525
3,251,526
How to blank the hidden field value from Jquery
<p>Assume that a hidden field </p> <pre><code>&lt;input type="hidden" id="hdn" name="hdn" value="100" /&gt; </code></pre> <p>So i want to blank the value of hidden field using Jquery. In javascript we can blank using this syntax</p> <pre><code>document.getElementById("hdn").value = ''; </code></pre> <p>but i want it using jquery.</p>
javascript jquery
[3, 5]
894,389
894,390
How to rewrite this javascript code using only jQuery instead
<p>I am a beginner at jQuery, so I had a friend help me write some script for an effect I was having trouble with. Problem, is he is pretty much only familiar with Javascript and doesn't know how to translate this same script into jQuery. Is there a way to write this same code into jQuery?</p> <pre><code>$(document).ready(function() { //milliseconds - change this value to modify the delay between //one text animation and the other var delay = 1000; //milliseconds - change this value to modify the single text //animation speed var timing = 2000; animateText('creative_div', timing); //setTimeout allow to call the function animateText after a //certain delay (declared above) setTimeout("animateText('motivated_div'," + timing + ");", delay); setTimeout("animateText('skilled_div'," + timing + ");", delay * 2); }); function animateText(divElement, timing) { //$(divElement).style="visibility: visible"; document.getElementById(divElement).style.visibility = "visible"; $('#'+divElement).effect('drop', { direction:"up", mode:"show", distance:"400" }, timing); } </code></pre>
javascript jquery
[3, 5]
2,343,529
2,343,530
My single-page scrolling website's links remain active after press and my navigation is broken until I scroll
<p>I created a single-page website that uses twitter's bootstrap for a fixed position nav bar at the top. I use some jquery plugins to slowly scroll the page. The site works fine on my desktop; however, a problem arises when opening the site on a mobile device. I have currently only tested it on my iPhone 4 at the moment. The page scrolls fine when I click; however when I go to click another link immediately after, I can't. I've discovered that after I scroll the page a little, functionality returns to the nav bar. I've tried narrowing the problem down to no avail. To see the problem for yourself, here's a barebones version of my site: <a href="http://boundincode.com/demo/iPhoneIssue/" rel="nofollow">here</a>.</p> <p>Here's the javascript: </p> <pre><code>$(function() { $('ul.nav a').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 1500,'easeInOutExpo'); event.preventDefault(); }); </code></pre> <p>}); Thanks for any help!</p>
javascript jquery iphone
[3, 5, 8]
16,193
16,194
initialize then output in single line
<p><strong>PHP</strong></p> <pre><code>&lt;?php $x = 10; echo $x = 20; ?&gt; </code></pre> <p><br/> <strong>c++</strong></p> <pre><code>#include&lt;iostream&gt; using namespace std; int main(){ int x = 10; cout &lt;&lt; x = 20; return 0; } </code></pre> <p>Why in php initialize then ouput in a single line works, in c++ it didnt work?</p>
php c++
[2, 6]
911,542
911,543
Android Include File Equivalent
<p>I have a menu that I want to implement on multiple activities. If I change the menu I don't want to have to update these everytime in every place</p> <pre><code>onCreateOptionsMenu() </code></pre> <p>or</p> <pre><code>onOptionsItemSelected() </code></pre> <p>Is there a way to include these sections in an activity and link it to a single file to edit the menu?</p>
java android
[1, 4]
5,695,389
5,695,390
How to perform javascript inside C# event
<p>I am inside an event and inside this event I want to have a javascript alert display a message to a user. But I cannot seem to get this to work.</p> <pre><code>protected void dgvStaff_Deleting(object sender, Infragistics.Web.UI.GridControls.RowDeletingEventArgs e) { // Code stub object test = e.Row.Items[0].Text; //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertbox", "ShowPopup('Select a row to rate');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertbox", "ShowPopup('Select a row to rate');", true); if (objGatewayFunctions.CheckStaffAssignment(e.Row.Items[0].Text.ToString(), ConfigurationManager.AppSettings.Get("Connection").ToString()) == true) { } } </code></pre> <p>Any idea what I am doing wrong here?</p>
c# asp.net
[0, 9]
2,188,401
2,188,402
jQuery Analog Gauge
<p>I'm trying to get something like the <a href="http://dojotoolkit.org/reference-guide/dojox/widget/AnalogGauge.html#a-partial-circle-gauge-with-two-indicators-programmatic" rel="nofollow">Dojo Toolkit Analog Gauge widget</a>. I'm searching for a highly customizable jQuery plugin for analog gauge.</p> <p>I found a lot of those but many of them do not have features such as changeable with user input with animation.</p>
javascript jquery
[3, 5]
2,159,562
2,159,563
Best way of getting a a series of custom fields into an array?
<p>I've a series of custom fields attached to certain pages. These fields are named slide1, slide2, side3, slide4, slide5, slide6. </p> <p>These are images which are going to be used as a slideshow (I'm using jflow slider for this - <a href="http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screencast/" rel="nofollow">http://net.tutsplus.com/articles/news/using-the-wonderful-jflow-plugin-screencast/</a> )</p> <p>(I don't want to call them all 'slide' and put them in an custom field array because there may be captions for each slide, and when both slides and captions are custom field arrays, the order may not match up)</p> <p>Now, sometimes there will be only 3 slides entered (slide1 to slide3), and sometimes all 6 slides (slide1 to slide6).</p> <p>Not being very PHP savvy, I wonder what the best way best way to stick these custom fields into a PHP array, and then iterate thru them to print out the code, which looks a bit like the below?</p> <pre><code>&lt;div id="slides"&gt; &lt;div&gt;&lt;img src="qwerty.jpg"&gt; &lt;/div&gt; &lt;div&gt;&lt;img src="foo.jpg"&gt; &lt;/div&gt; &lt;div&gt;&lt;img src="test.jpg"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The code to print, for instance slide1's image, would be something like:</p> <pre><code>&lt;img src="&lt;?php echo wp_get_attachment_url($slide1); ?&gt;"&gt; </code></pre>
jquery php
[5, 2]
5,410,217
5,410,218
Handle/Grip bar convention
<p>Greetings,</p> <p>Because textarea elements do not resize with jquery.touch ( <a href="http://plugins.jquery.com/project/touch" rel="nofollow">http://plugins.jquery.com/project/touch</a> ), I've put an textarea in a table where the first row allows the user to drag the table around and resize it with the textarea growing/shrinking/moving along.</p> <p>It works well, except that users dont seem to 'get' that they can use the bar to resize/move. I was trying to find some 'grip bar' graphics but google isnt helping me.</p> <p>What is the best way to show users that an element can be moved/resized ? Pointer to graphics ( generators ) would be great. Or, does any one know how to make textarea's movable/resizable ?</p> <p>T.</p>
jquery iphone javascript
[5, 8, 3]
4,602,425
4,602,426
what is the best practice of binding jQuery click event to each anchor tag on every row of a table
<p>There is a grid (just html table) that lists users and you can delete a specific user by clicking on delete link. The usual way I do is </p> <pre><code>&lt;% foreach (var user in Model.Users) {%&gt; &lt;tr &gt; &lt;td align="right"&gt;&lt;%= user.Name %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= user.Level %&gt;&lt;/td&gt; &lt;td align="center"&gt; &lt;a href="#" onclick="return deleteUser('&lt;%= user.Name %&gt;');"&gt; &lt;%= Html.Image("trash.gif") %&gt; &lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;% )%&gt; </code></pre> <p>but I want to attach click event to the link in a non-obtrusive way. I mean, I do not want to specify javascript method inside the tag. I am not sure what is the best way to achieve it with jQuery, binding multiple multiple anchor tags with parameter passing.</p>
javascript jquery
[3, 5]
1,748,150
1,748,151
Jquery not functioning correctly (not waiting?)
<p>Here is my javascript:</p> <pre><code> $('#Service').val("2"); $("#Service").change(); // Sets new options in subservice. $('#Subservice').val("5"); //EDIT: alert($('#Subservice').length); // Returns 1, when there are far more in it. </code></pre> <p>Service and Subservice are drop down boxes.</p> <p>On Service change, the new list of subservices is populated.</p> <p>This is setting the fields of the record to be editted. It executes when I click an Edit Button. It sets the service dropdownbox, then is populating the subservice dropdown box, then attempting to set the correct dropdown selection for it.</p> <p>However it is not correctly setting the subservice box. The options are correct, so <code>.change()</code> is working and service sets correctly. However Subservice is not being set. And there is an entry with value 5 in it. </p> <p>My only reasoning is that .change is firing, but carrying on to setting .val before it finishes. And so no options exist at the time of setting. However I dont see why it would be threading either. So Im not sure what is going on or how to fix it.</p>
javascript jquery
[3, 5]
4,585,641
4,585,642
Problem with simple onClick action
<p>Simple code which is copied from web doesnt seem to be working. There is no action when i click button but text of it is correctly changed. What's wrong?</p> <pre><code>package android.test; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button closeButton = (Button)this.findViewById(R.id.button1); closeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getApplicationContext(), "Klik!", Toast.LENGTH_LONG); } }); closeButton.setText("dupa"); } } </code></pre> <p>main.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &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;Button android:layout_width="wrap_content" android:id="@+id/button1" android:layout_height="wrap_content" android:text="@string/button"&gt;&lt;/Button&gt; &lt;/LinearLayout&gt; </code></pre> <p>Thanks for any help, Chris</p>
java android
[1, 4]
4,843,563
4,843,564
Clean up dynamically created 'html elements' on page?
<p>I have javascript showing results from a search, and when the users click 'more' - more results are added, so on average there can be up to 1,000 results displayed on a session, with each result having 20kb images, so after about 100 results you can start to see the page get slower.</p> <p>The images are currently the background of a div, and when I clear the background the page is still slow. So is it the 1000+divs that are making it slow, or the large array in javascript memory? or has the image just not been cleared correctly?</p> <p>Is there a proper way to destroy something efficently with javascript? (other than $(this).html()?)</p>
javascript jquery
[3, 5]
4,886,389
4,886,390
Error in Javascript code?
<p>What is wrong in this code? it shows an Syntax error in <code>eval(e.text); //run the script</code></p> <pre><code> runScripts1: function(e) { if (e.nodeType != 1) return false; //if it's not an element node, return if (e.tagName.toLowerCase() == 'script') { eval(e.text); //run the script } else { var n = e.firstChild; while ( n ) { if ( n.nodeType == 1 ) forrester.runScripts1(n); //if it's an element node, recurse n = n.nextSibling; } } return true; }, </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
3,543,047
3,543,048
Button in an AlertDialog
<p>How would I set up the onClickListener for a button inside an alertDialog? Do I just use the onClick of the whole activity or do I make a new one inside the alertDialog builder? </p> <p>EDIT: Sorry I didn't make it clear first time but this isn't for the positive/negative buttons. This is for a button within a custom xml.</p> <p>Thanks in advance</p>
java android
[1, 4]
876,175
876,176
downloadable link in website
<p>How to create a downloadable link in a website.</p>
asp.net javascript
[9, 3]
5,350,279
5,350,280
HTML elements loaded after page load not recognized by Javascript
<p>I've had this issue with two different projects and finally realized what it could have been on this most recent one. In both, I'm pulling in some dynamic text and a dynamically-valued button from SQL (in one project through a Python MVC, in the other through PHP), and I have an onclick function on the button that hides some of the text.</p> <p>The issue that it works the second time I try it, perfectly fine. With this second project, I finally put a few alerts in the right places and realized that on the first click, the visibility/display CSS attribute has no value (not undefined, when I alert(object.style.display) it's just blank). I think that <a href="http://stackoverflow.com/questions/8877145/jquery-script-doesnt-recognize-newly-appended-elements" title="this">this</a> issue may be my answer, but with .live() depreciated in jQuery, I'm not exactly sure what to do with .on() - is the event I'm looking for load, or is there something else I should use?</p> <p>Any help is greatly appreciated. Thanks!</p>
javascript jquery
[3, 5]
5,618,282
5,618,283
Override default Android themes
<p>I've been able to override any themes that have names with "android:" prepended to them, but the Android themes.xml also defines properties that don't seem to be able to be overridden. For example:</p> <pre><code>&lt;!-- Variation on the Light theme that turns off the title --&gt; &lt;style name="Theme.Codebase" parent="android:style/Theme.Light"&gt; &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt; &lt;item name="android:windowContentOverlay"&gt;@null&lt;/item&gt; &lt;item name="colorBackground"&gt;@color/off_white&lt;/item&gt; &lt;/style&gt; </code></pre> <p>colorBackground is defined in the Theme.Light xml, but adding this here gives me a </p> <pre><code>/res/values/styles.xml:10: error: Error: No resource found that matches the given name: attr 'colorBackground'. </code></pre> <p>error. How do I override that style for the Application as a whole?</p>
java android
[1, 4]
29,547
29,548
Is this function getting assigned as a method or already executed?
<p>Coming from C++ and Java, I am a beginner with Javascript. This code pattern confuses me (found in a jQuery Application):</p> <pre><code>var opts = { drop : empty}; function drop(arg){ opts.drop(arg); //do something } </code></pre> <p>How I would read this: The object <code>opts</code> is created and the attribute <code>drop</code> is declared, but initialized as empty. Then, the function(-object) <code>drop</code> is defined. In the second line, the drop-attribute of the opts object is called as a method. But, in my understanding, <code>opts.drop</code> is empty. So it should not be callable.</p> <p>What happens here? Am I missing some important code, or is this a pattern that makes sense?</p> <p>EDIT: Source: <a href="https://github.com/weixiyen/jquery-filedrop/blob/master/jquery.filedrop.js" rel="nofollow">https://github.com/weixiyen/jquery-filedrop/blob/master/jquery.filedrop.js</a></p>
javascript jquery
[3, 5]
2,729,794
2,729,795
jQuery tools tabs fade effect
<p>I used <a href="http://flowplayer.org/tools/demos/tabs/ajax-history.html" rel="nofollow">jQuery tools</a> to create a tabs setup, and I would like to incorporate the fade effect, but when I try to do so, it bombs out, here is my code:</p> <pre><code>$(function() { $("#flowtabs").tabs("#flowpanes &gt; div", { history: true, effect: 'fade' }); }); </code></pre> <p>I am assuming that it's because I am also enabling the tabs history?</p> <p>I am kinda new to all of this, so please be patient! :-)</p> <p>Thanx in advance!</p>
javascript jquery
[3, 5]
2,888,618
2,888,619
Assign 100% height to a div with jQuery
<p>I have a similar problem like <a href="http://stackoverflow.com/questions/1128226/problem-using-jquery-to-animate-div-to-100-height">This</a></p> <p>I want to animate a div, to a css property of 100% height. This doesnt seem to work:</p> <pre><code>$("#somediv").css('height', '100%'); </code></pre> <p>Is there a way to solve this other than slidedown/up?</p>
javascript jquery
[3, 5]
1,274,198
1,274,199
How to extend an object while ignoring null values?
<p>Say for example I have an object of</p> <pre><code>var user = { "Name": "Dan", "Age": 27, "Hobbies": null }; </code></pre> <p>which I would like to merge onto the following base object so that my user object will have all the required properties</p> <pre><code>var base = { "Name": null, "Height": null, "Age": null, "Hobbies": [ { "Name": "Tennis", "Location": null }, { "Name": "Football", "Location": null }, { "Name": "Rugby", "Location": null } ] }; </code></pre> <p>The easiest way to merge to the two objects would be to extend the base object with the user object as follows</p> <pre><code>$.extend(true, base, user); </code></pre> <p>which would modify the base object to be</p> <pre><code>{ "Name": "Dan", "Height": null, "Age": 27, "Hobbies": null }; </code></pre> <p>My question would be how can I get the extend method to not override null values? For example, in this instance, how can I still obtain a list of hobbies if the users hobby list is null so I end up with the following</p> <pre><code>{ "Name": "Dan", "Height": null, "Age": 27, "Hobbies": [ { "Name": "Tennis", "Location": null }, { "Name": "Football", "Location": null }, { "Name": "Rugby", "Location": null } ] }; </code></pre>
javascript jquery
[3, 5]
3,002,146
3,002,147
unterminated string constant javascript error when opening tiny box
<p>I am opening a url using tiny box by following code</p> <pre><code> function openAddBranchPopup(siteurl) { TINY.box.show(siteurl+'/pages/dept.php',1,780,'',1); } </code></pre> <p>but in internet explorer 8 and 9, i am getting "unterminated string constant" error. Please help.</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,911,898
2,911,899
Can I add my caching lines to global.asax?
<p>Take the following lines of code that would work fine in a c# asp.net file:</p> <pre><code>Response.Cache.SetExpires(DateTime.Now.AddSeconds(300)); Response.Cache.SetCacheability(HttpCacheability.Public); </code></pre> <p>Can I set these in some way in global.asax so that by default my entire application will support 300 second public caching?</p>
c# asp.net
[0, 9]
1,166,944
1,166,945
How can I load an aspx page in another aspx page in a specific <div> tag
<p>I would like to update a certain part of the page with content from another *.aspx page, thus avoiding having to have just one (very) long page of code.</p> <p>So: How can I load an aspx page in another aspx page in a specific tag, without having to reload the entire page.</p>
c# asp.net
[0, 9]
3,638,506
3,638,507
.aspx code errors "Element 'xxxx' is not supported."
<p>I'm getting a bunch of these errors for my image buttons, link buttons, text boxes, and labels. These errors are in my .aspx code. Why am I getting so many?</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmSearchPersonnel.aspx.cs" Inherits="frmSearchPersonnel" %&gt; &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 id="Head1" runat="server"&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;div align="center"&gt; &lt;/div&gt; &lt;/div&gt; &lt;asp:Label ID="Label1" runat="server" Text="Search for employee by last name"&gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID="txtSearchName" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;p&gt; &lt;asp:Button ID="btnSearch" runat="server" PostBackUrl="~/frmViewPersonnel.aspx" Text="Search" onclick="btnSearch_Click" /&gt; &lt;/p&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;. </code></pre> <p>The errors are under Label, TextBox &amp; Button above in blue. The errors state:</p> <blockquote> <p>Validation (): Element 'xxxx' is not supported.</p> </blockquote>
c# asp.net
[0, 9]
3,994,941
3,994,942
Multiple PHP vars in a JavaScript onclick() problem
<p>I have the following php code </p> <pre><code>$bigImageSrc = 'images/'.$prodXML-&gt;bottles-&gt;bottle[$i]-&gt;bigImage; $text = $prodXML-&gt;bottles-&gt;bottle[$i]-&gt;title; $title = $prodXML-&gt;bottles-&gt;bottle[$i]-&gt;text; echo "&lt;a href=javascript:void(0); onClick=showProduct('$bigImageSrc', '$text', '$title');&gt; </code></pre> <p>but I'm getting this error:</p> <blockquote> <p>syntax error<br> showProduct('images/image1.jpg',</p> </blockquote> <p>It works for just one var in the showProduct function.</p> <p>Any ideas where I'm going wrong?</p>
php javascript
[2, 3]
5,180,220
5,180,221
How to get the keys from ContentValues?
<p>My ContentValues object has string keys, and I would like to get a String[] result having all the keys in it?</p> <p>How do I iterate a ContentValues object?</p> <p><strong>EDIT 1</strong></p> <p>After getting two responses I came up with this, do you see problems with it?</p> <pre><code> ArrayList&lt;String&gt; ar = new ArrayList&lt;String&gt;(); ContentValues cv=data; Set&lt;Entry&lt;String, Object&gt;&gt; s=cv.valueSet(); for (Entry&lt;String, Object&gt; entry : s) { ar.add(entry.getKey()); } String[] projection=new String[ar.size()]; ar.toArray(projection); </code></pre>
java android
[1, 4]
2,748,689
2,748,690
StringBuilder.Append with float
<p>StringBuilder.Append using float is truncating the value. What is it converting to and how can I stop it from truncating?</p> <p>AttributeOrder is type float and I am losing precision when building the string.</p> <pre><code>if ( AttributeOrder != 0 ) { if ( Result.Length &gt; 0 ) { Result.Append( " AND " ); } Result.Append( COLUMN_ATTRIBUTE_ORDER ); Result.Append( "=" ); Result.Append( AttributeOrder ); } </code></pre> <p>EDIT: This is legacy code, I cannot change the underlying datatypes. The column in SQL Server is a real and the datatype is float. I need to present the float as it is filled, as a string for other purposes and not loose precision as is.</p>
c# asp.net
[0, 9]
1,869,832
1,869,833
How to pass DataTable to Javascript
<p>How can I pass a DataTable element with a lot of rows, to Javascript ? </p> <p>The idea is to allow me do a loop in my variable that receive this DataTable and recover the values.</p>
c# javascript
[0, 3]
3,061,028
3,061,029
Changing IFrame src attribute
<p>I'm working with a few test pages and I'm having trouble loading the pages in to the IFrame with the src attribute using jQuery. All the pages are local.</p> <p>Here are the scripts I've tried:</p> <pre><code>$(document).ready(function () { $("#button1").click(function () { $("#iframeBox").attr("src", "Default.aspx"); }); }); </code></pre> <hr> <pre><code>$(document).ready(function () { $("#button1").click(function () { $("#iframeBox").attr("src") = "Defualt.aspx"; }); }); </code></pre> <p>This is the markup for the IFrame:</p> <pre><code>&lt;iframe id="iframeBox" src="Copy of Default.aspx"&gt;&lt;/iframe&gt; </code></pre> <p>I tried to use this code with online pages and it still didn't work.</p> <p>If using IFrames is a bad idea, could you please recommend me a different method I can use. The idea of the site is to show a lot of galleries with subjects that the user can browse and every page should hold a gallery.</p> <p>I'm using the: <code>galleriffic</code> jQuery plugin.</p>
javascript jquery
[3, 5]
1,674,234
1,674,235
how to get array of array in javascript
<p><strong>I'm creating graph and for this I need data in this form in javascript:</strong></p> <pre><code>var currYear = [["2011-08-01",796.01], ["2011-08-02",510.5], ["2011-08-03",527.8], ["2011-08-04",308.48]] </code></pre> <p><strong>Data is coming from JSON</strong></p> <pre><code>var total_click = JSON.parse(&lt;%=raw @report.to_json %&gt;); var i=0; var graph_type = ""; var graph_typ = new Array(); while(i &lt; total_click.length){ graph_typ.push("['"+total_click[i].report_date+"',"+total_click[i].clicks+"]"); i++; } </code></pre> <p><strong>Data which I get from this is below</strong></p> <pre><code>['2012-03-19',48],['2012-03-20',14],['2012-03-21',934] </code></pre> <p><strong>How do I get this format</strong></p> <pre><code>[['2012-03-19',48],['2012-03-20',14],['2012-03-21',934]] </code></pre>
javascript jquery
[3, 5]
1,347,741
1,347,742
ASP.NET dynamically insert code into head
<p>I'm working inside of a Web User Control (.ascx) that is going to be included in a regular web form (.aspx), but I need to be able to dynamically insert code into the head of the document from the User Control. In my Coldfusion days &lt;cfhtmlhead&gt; would do the trick. Is there an equivalent of this in ASP.NET or a similar hack?</p>
c# asp.net
[0, 9]
3,165,252
3,165,253
Is it possible to use javascript popup to accept input in php
<p>Is it possible to use javascript popup to accept input in PHP</p> <pre><code>&lt;script type="text/javascript"&gt; &lt;!-- function popup(){ var answer = prompt ("What is your name ?","") return answer } // --&gt; &lt;/script&gt; &lt;?php $value = echo "popup()"; // error ?&gt; </code></pre>
php javascript
[2, 3]
3,480,957
3,480,958
How to create the view in android?
<p>Can someone tell me how should i create the above view <a href="http://www.google.com.sg/imglanding?q=dialog%20box%20android%20example&amp;hl=en&amp;sa=X&amp;tbm=isch&amp;tbnid=6GDKENa7dfWAPM%3a&amp;imgrefurl=http://thedevelopersinfo.com/2009/10/22/email-sending-in-android/&amp;imgurl=http://thedevelopersinfo.com/wp-content/uploads/2009/10/email.png&amp;w=324&amp;h=481&amp;ei=jjvLTcTdDImYvAONybzeBQ&amp;zoom=1&amp;iact=hc&amp;page=2&amp;tbnh=162&amp;tbnw=109&amp;start=21&amp;ndsp=26&amp;ved=1t:429,r:9,s:21&amp;biw=1366&amp;bih=653" rel="nofollow">here</a> via xml or java coding in android? </p> <p>This is what i have tried so far... But the view just seems to look too plain without any pictures by the side of each string as shown in the above link? What should i do to get the sort of more professional view?</p> <pre><code>final String [] items = new String []{"Details", "Delete File"}; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("File Options"); builder.setItems(items, new OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub if(arg1 == 0) { startActivity(new Intent(getApplicationContext(), DialogBox.class)); } else { deleteFile(); } } }); builder.create().show(); </code></pre>
java android
[1, 4]
2,472,407
2,472,408
Get a File information that is open or not in physically path in asp.net C#
<p>I am facing a problem regarding when a file open at physically end then i will get information that file open or not (File like as .xml , .txt).</p> <p>So how to get information regarding this file .</p> <p>I am awaiting for a positive response.</p> <p>Thanks,</p> <p>Sanwar. </p>
c# asp.net
[0, 9]
4,803,722
4,803,723
Apply mask a string in C# asp.net?
<p>Hi all in my project i want a currency in three formats,.</p> <pre><code>1) ...999,999,999 2) ...999,999,999.00 3) ...999,999,99 </code></pre> <p>The format is specified in mysql data table field. My project is in ASP.NET so I can't use MaskedTextBox . Code I tried:</p> <pre><code>String.Format("{999,999,999}",rate); </code></pre> <p>and </p> <pre><code>rate.ToString("999,999,999). </code></pre> <p>How to get the mask string?</p>
c# asp.net
[0, 9]
1,387,955
1,387,956
Importing C++ enumerations into C#
<p>I'm currently working on creating a new C# project that needs to interact with an older C++ application. There is an error enumeration that already exists in the C++ app that I need to use in the C# app.</p> <p>I don't want to just redeclare the enumeration in C# because that could cause sync issues down the line if the files aren't updated together. </p> <p>All that being said my question is this: Is there a way for me to taken an enumeration declared like so:</p> <pre><code>typedef enum { eDEVICEINT_ERR_FATAL = 0x10001 ... } eDeviceIntErrCodes; </code></pre> <p>and use it in a C# program like so:</p> <pre><code>eDeviceIntErrCodes.eDEVICEINT_ERR_FATAL </code></pre>
c# c++
[0, 6]
2,131,314
2,131,315
Trying to get a jquery script to hide an element when a user clicks outside the scope
<p>I am trying to implement a bit of code that Twitter use to toggle off the drop-down login box when a user clicks outside the scope of the drop-down box itself.</p> <p>I am having a bit of trouble, currently if I click outside the scope of the element it works as expected but the same thing also happens when I click inside the element scope I.e. within the #form element.</p> <p>HTML Markup:</p> <pre><code>&lt;body&gt; &lt;div id="form"&gt; &lt;div id="form-tab"&gt;&lt;/div&gt; &lt;div id="form-header"&gt;FooBar&lt;/div&gt; &lt;form&gt; &lt;label&gt;Test&lt;/label&gt; &lt;input type="text"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>jQuery Code:</p> <pre><code>$(document).mouseup(function(e) { if ($(e.target).parent("div#form").length==0) { hide(); } }); function hide() { $element.animate({ right: $rightPos }, 1000); } </code></pre> <p>If anyone can help me figure out where I am going wrong it would be greatly appreciated.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
483,017
483,018
jQuery not replacing some text
<p>I've been working on a project that involves ajax; it's a planner for school assignments. When a button is pressed, it's supposed to change the text inside of 31 <code>&lt;textarea&gt;</code>'s (and one <code>&lt;span&gt;</code>) based on data it gets from the server. The thing is, textareas that have been changed after the last time the window was refreshed don't change. I've looked over the JSON sent between the server and the webpage and vice-versa, and concluded that the bug is in the success function of the ajax call. Here's the code:</p> <pre><code> success: function(data) { $("span#date").text(data['date']); $("#assignments").find("textarea").each(function() { $(this).text(""); $(this).html(data[$(this).attr("id")]); }); console.log(data); // I was using this to see if the data received from the server was correct } </code></pre> <p>Thanks very much in advance for any help.</p>
javascript jquery
[3, 5]
1,078,483
1,078,484
Is it possible to limit the user to upload an image with fixed dimension?
<p>Is there any Jquery Plugin to perform the image dimension operation on an image before being uploaded using uplodify. i want the plugin to check the image dimension with the fixed define size and then only process for uploading. </p> <p>right now i am doing it with PHP function, instead of server side validation i want to adopt the client side validation.</p>
javascript jquery
[3, 5]
1,784,575
1,784,576
How to stop all worker threads in android application
<p>how to stop all running worker threads in an android application without stoping the main thread?</p> <p>Any example for this?</p>
java android
[1, 4]
3,034,395
3,034,396
converting date format using javascript
<p>I have a simple textfield with the type defied to be as date which attached with a jquery <code>datepicker()</code>. Now i have set the <code>dateFormat()</code> to be <code>dd-mm-yy</code>. All this works fine. But as i know MySql requires date in <code>yyyy-mm-dd</code>. So i was just wondering if i can convert that date format either using php or javascript to enter into the database. </p> <p>E.g <code>var date = $('#order_date').val();</code> gives value 26-2-2012. I need to convert this into 2012-02-26.</p> <p><strong>Note:</strong> There is also a <code>0</code> being added to the month.</p>
php javascript jquery
[2, 3, 5]
2,647,980
2,647,981
How to renamed Page_load to PageName_load in asp.net
<pre><code> Instead of page_load i want to write PageName_Load, how can i do </code></pre> <p>Recently this question was asked my the one of the company in interview</p> <p>REgards Praveen</p>
c# asp.net
[0, 9]
4,687,772
4,687,773
How to kill session in jQuery function when I redirect to the logout page through jQuery?
<p>Hi all, I have gone through this example to end session when user was inactive for some amount of time which works fine</p> <p><a href="http://www.philpalmieri.com/js_sandbox/timedLogout/" rel="nofollow">http://www.philpalmieri.com/js_sandbox/timedLogout/</a></p> <p>But when it redirects back to <code>logout</code> page and if I access the page with sessions I am able to see the page access with the data. I don't want this to be done. When user logged out on inactive session through the <code>jQuery</code> function I would like to kill the session which I am having too? How can I achieve this?</p>
jquery asp.net
[5, 9]
1,348,774
1,348,775
jQuery - Updating clicked image in jQuery.ajax().done()
<p>I have a few images, like</p> <pre><code>&lt;img src="unstarred.png" class="unstarred-button" id="unstarred-1" /&gt; &lt;img src="unstarred.png" class="unstarred-button" id="unstarred-2" /&gt; &lt;img src="unstarred.png" class="unstarred-button" id="unstarred-3" /&gt; &lt;img src="unstarred.png" class="unstarred-button" id="unstarred-4" /&gt; </code></pre> <p>Then I bind this function:</p> <pre><code>$('.unstarred-button').click(function() { id = $(this).attr('id').replace(/^unstarred-/, ''); url = '/star.php?id=' + id; $.ajax({ type: 'GET', url: url }).done(function() { // What should be put here? }); }); </code></pre> <p>Now I don't know how to go forward. I want to change the <code>src</code> attribute of the clicked image in the <code>done()</code> call, but $(this) doesn't return the image clicked for sure, as <code>$(this).attr('id')</code> is <code>undefined</code> according to <code>alert()</code>.</p> <p>Could someone help me out?</p>
javascript jquery
[3, 5]
5,885,241
5,885,242
Passing location data to another activity in Android
<p>I'm working on an Android application development and i'm stuck in this point:</p> <p>I have 2 activities: First one called CurrentLoc and it gets me the current position and after getting the position i click on a button that take me to activity number 2 which called Sms.</p> <p>What i need to do is that i want to pass the position data that i have received in the first activity to the second activity when i click the button...</p> <p>Thanks in advance to all of you...</p> <p>Here is my code for the first activity :</p> <pre><code>public class Tester2Activity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); startService(new Intent(Tester2Activity.this,SS.class)); LocationManager mlocManager = (LocationManager)getSystemService (Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0, mlocListener); Button button1 = (Button) findViewById(R.id.widget30); button1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent hg = new Intent(Tester2Activity.this, Sms.class); startActivity(hg); } }); public class MyLocationListener implements LocationListener { @Override public void onLocationChanged(Location loc) { loc.getLatitude(); loc.getLongitude(); //This is what i want to pass to the other activity when i click on the button } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } } </code></pre> <p>}</p>
java android
[1, 4]
2,534,105
2,534,106
Compared effort when developing Android and iOS app
<p>Given:</p> <ul> <li>A desired application called APP wich will present 2 "forms" and will comunicate with a web server to call 3 Web Methods.</li> <li>One developer with nearly equivalent expertise on iOS and Android platforms.</li> <li>X: required effort to build APP for Android only.</li> <li>Y: required effort to build APP for iOS only.</li> <li>X = K1 * Y where K1 is a real number.</li> <li>Z = K2 * (X + Y) where K2 is a real number and Z is defined as the required effort to build APP for both Android an iOS.</li> </ul> <p>Please answer:</p> <ul> <li>What is the approximate value of K1?</li> <li>Assuming that the formula for Z is acceptable, what is the approximate value of K2?</li> </ul>
iphone android
[8, 4]