Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
4,503,043
4,503,044
Taking action for all controls with an 'ImageUrl' property
<p>I've got the below piece of code, which iterates through the controls on a webpage and where it is an imagebutton, it modifies the imageUrl property. What I'd <em>like</em> it to do, is go through each control and, if that control happens to <em>have</em> an imageUrl property, then do the change. Eg normal images etc would be included in the process. I get the feeling that generics or something might be the key here, but I am not versed in that area to say the least. Any thoughts? Thanks!</p> <pre><code> public static void AddThemePathToImages(Control Parent) { foreach (Control c in Parent.Controls) { ImageButton i = c as ImageButton; if (i != null) { // See if theme specific version of this file exists. If not, point it to normal images dir. if (File.Exists(System.Web.HttpContext.Current.Server.MapPath("~/App_Variants/" + GetUserTheme().ToString() + "/images/" + i.ImageUrl))) { i.ImageUrl = "~/App_Variants/" + GetUserTheme().ToString() + "/images/" + i.ImageUrl; } else { i.ImageUrl = "~/images/" + i.ImageUrl; } } if (c.HasControls()) { AddThemePathToImages(c); } } } </code></pre>
c# asp.net
[0, 9]
4,921,473
4,921,474
Pass test score results to mysql query
<p>I have been putting a quiz together with jQuiz: <a href="http://www.fatihacet.com/lab/jQuiz/" rel="nofollow">http://www.fatihacet.com/lab/jQuiz/</a></p> <p>If you take the test you will see it shows your score at the end in the format of 90/100 (it only has four questions).</p> <p>How would you pass the score the user got to a variable to then perform a sql and IF statement?</p> <p>in the jQuiz.js file it has the following code at the bottom:</p> <pre><code> $('.btnShowResult').click(function(){ $('#progress').width(300); $('#progressKeeper').hide(); var results = jQuiz.checkAnswers(); var resultSet = ''; var trueCount = 0; for (var i = 0, ii = results.length; i &lt; ii; i++){ if (results[i] == true) trueCount++; resultSet += '&lt;div&gt; Question ' + (i + 1) + ' is ' + results[i] + '&lt;/div&gt;' } resultSet += '&lt;div class="totalScore"&gt;Your total score is ' + trueCount * 20 + ' / 100&lt;/div&gt;' $('#resultKeeper').html(resultSet).show(); }) </code></pre> <p>I tried </p> <pre><code>$Count = var results; if($Count &gt;= "90") { $award = $db-&gt;exec("UPDATE users SET test='passed' WHERE username='$username'"); } </code></pre> <p>I feel I have the right idea but am just missing something crucial as it is not working or doing anything. Thanks for any direction or help you can give me. </p>
php javascript jquery
[2, 3, 5]
4,081,525
4,081,526
Send data from my C# application to browser
<p>My question is.. how am I able to send 2 data parameters to the browser within my C# application? I have a command line application which is a server for my game and on a certain message from the client I have to activate JavaScript on the webpage the client is playing on. What do I use to achieve this?</p>
c# javascript
[0, 3]
916,503
916,504
Pass Code To Function Be Executed
<p>I am wondering is this possible with Javascript or Jquery?</p> <p>I would like to pass in the parameters to a function some code which it will then execute once other conditions are met.</p>
javascript jquery
[3, 5]
4,417,690
4,417,691
jsDatePick - Using a Selected Date
<p>Using the jsDatePick Full JQuery example i am unable to get the calender to load with a specified date selected, i recieve either undifined message or syntax errors</p> <p>The full code can be downloaded from <a href="http://javascriptcalendar.org/" rel="nofollow">JsDatePick</a></p> <p>The Code they supply</p> <pre><code>g_globalObject2 = new JsDatePick({ useMode:1, isStripped:false, target:"div4_example", cellColorScheme:"beige" /* selectedDate:{ day:16, month:3, year:2013 }, yearsRange:[1978,2020], limitToToday:false, dateFormat:"%m-%d-%Y", imgPath:"img/", weekStartDay:1*/ }); </code></pre> <p>If i then un comment the slected date part i get either undifined on the calendar once it loads or it fails to load with a syntax issue</p> <p>Can anyone help?</p> <p>Thanks</p>
javascript jquery
[3, 5]
947,883
947,884
jquery how to make sure that the user has selected a value for all select menus on a form
<p>i have a form with multiple select menus i want to make sure on submit that a user selected a value for each select menu how can i do that with jquery ? i tried something like </p> <pre><code>var form = $('myform'); if($(form ).find('select').length != $(form).find('select:option[selected="selected"]').length ) { alert('wrong please make sure to select all select menu'); } </code></pre> <p>but no luck </p> <p>please help </p> <p>Thank you</p>
javascript jquery
[3, 5]
2,972,532
2,972,533
jQuery datetime formatter
<p>Is there a working jQuery plugin (or a javascript 'library') for formatting datetimes? I found some, but they were:</p> <ul> <li>not working with hours and minutes (the one from datapicker)</li> <li>not fully functional - can't give you names of months, leading zeroes, etc.</li> <li>are just a piece of code written in some blog.</li> </ul> <p>Of course I can implement it, but it'd be better to reuse one. I seek functionality similar to Java's <a href="http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html" rel="nofollow"><code>SimpleDateFormat</code></a></p>
javascript jquery
[3, 5]
4,237,340
4,237,341
Why won't my span do a JQuery event click when I click it?
<pre><code>.tablePlayButton { display: block; width: 16px; background: transparent; margin-top:2px; margin-right: -10px; margin-left: 2px; height:17px; } tr:hover .tablePlayButton { background: url(ton.png) top left no-repeat; } tr:hover .tablePlayButton:active { background-position: bottom left; } tr:hover .tablePlayButton.playing, .tablePlayButton.playing { background: url(ton2.png) top right no-repeat; } tr:hover .tablePlayButton.playing:active, .tablePlayButton.playing:active { background-position: bottom right; } </code></pre> <p>I draw the span like this: <code>&lt;span class="tablePlayButton"&gt;&lt;/span&gt;</code></p> <p>It's got a little button. WHen I click it, nothing happens:</p> <pre><code>$(".tablePlayButton").click(function(){ alert('hi'); }); </code></pre>
javascript jquery
[3, 5]
384,017
384,018
How can I bind events to the appended element?
<p>I tried to show an error message using the jquery effect <code>fadeTo</code> and tried to hide the message by appending a button and using fadeout but doesn't seem to work.</p> <p>What I did was:</p> <pre><code>$("#sub_error") .fadeTo(200, 0.1, function() { $("#sub_error") .html(error.join("&lt;br/&gt;&lt;br/&gt;")) .append('&lt;br/&gt;&lt;input type="button" name="err_ok" id="err_ok" value="ok"&gt;') .addClass('subboxerror') .fadeTo(900,1); }); $("#err_ok").click(function() { $("#sub_error").fadeOut("slow"); }); </code></pre> <p>What am I doing wrong, could someone help me?</p>
javascript jquery
[3, 5]
3,151,566
3,151,567
how to change the value in the html tag using jquery
<p>I want to change the param value of the applet tag based on the value from the dropdown. I am new to jquery .can someone tell me how can i do it using jquery . </p> <p>My applet code :</p> <pre><code>&lt;applet id="decisiontree" code="com.vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" &gt; &lt;param name="dieasenmae" value="Malaria"/&gt; &lt;/applet&gt; </code></pre> <p>My dropdownc code :</p> <pre><code>&lt;html:select name="AuthoringForm" property="disease_name" size="1" onchange="javascript:showSelected(this.value)"&gt; &lt;option&gt;Malaria&lt;/option&gt; &lt;option&gt;High Fever&lt;/option&gt; &lt;option&gt;Cholera&lt;/option&gt; &lt;/html:select&gt;&lt;/p&gt; </code></pre> <p>javascript:</p> <pre><code>function showSelected(value){ alert("the value given from dropdown is "+value); $("#decisiontree param[name='dieasenmae']").val(value); } </code></pre>
javascript jquery
[3, 5]
5,016,502
5,016,503
What context is the jQuery.post callback function invoked in?
<p>Lets say for example:</p> <pre><code>$(".button").click(function() { $.post("commandrunner.php", { param1: 'value', param2: 'value2', param3: 'value3' }, function(data, textStatus) { $(this).parent().after('&lt;p&gt;button clicked&lt;/p&gt;'); }, "json" ); }); </code></pre> <p>I ran this and it didn't work. I tried a couple of things before I theorized the callback wasn't being invoked in the context of this particular ".button" and so $(this) was useless. This worked instead:</p> <pre><code>$(".button").click(function() { var thisButton = $(this); $.post("commandrunner.php", { param1: 'value', param2: 'value2', param3: 'value3' }, function(data, textStatus) { thisButton.parent().after('&lt;p&gt;button clicked&lt;/p&gt;') }, "json" ); }); </code></pre> <p>This feels like a bit of a hack. Is this the right way to get a reference to the clicked on button? And what context is that (or any other callback) invoked in?</p> <p>Thanks!</p> <p>Ali</p>
javascript jquery
[3, 5]
3,613,835
3,613,836
Jquery Focus on input field
<p>I have this code working on a page that literally just has 20 input fields each named and id'ed 1 through 20.</p> <p>If I set the variable id to the next id. E.g current fields id +1 then it will focus on that field. But at the moment when you click out of the current input it will not focus back onto the one you were last typing in if the number entered is over 10, but the alert will fire.</p> <p>Any help is appreciated.</p> <pre><code>$(":input").focusout(function(){ var input = $(this).val(); var id = $(this).attr('id'); if(input &gt; 10){ alert('You must enter a number between 0 and 10 '+id); $("#"+id).select(); } }); </code></pre>
javascript jquery
[3, 5]
2,612,508
2,612,509
Add dynamic charts using ASP.NET CHART CONTROL, c#
<p>I wanted to add dynamic charts in the webpage. It goes like this...</p> <p>I get the start and end date from user and draw separate charts for each date bewteen the start and end date.</p> <p>I get the data from sql database and bind it with the chart like this:</p> <pre><code> SqlConnection UsageLogConn = new SqlConnection(ConfigurationManager.ConnectionStrings["UsageConn"].ConnectionString); UsageLogConn.Open();//open connection string sql = "SELECT v.interval,dateadd(mi,(v.interval-1)*2,'" + startdate + " 00:00:00') as 'intervaltime',COUNT(Datediff(minute,'" + startdate + " 00:00:00',d.DateTime)/2) AS Total FROM usage_internet_intervals v left outer join (select * from Usage_Internet where " + name + " LIKE ('%" + value + "%') and DateTime BETWEEN '" + startdate + " 00:00:00' AND '" + enddate + " 23:59:59') d on v.interval = Datediff(minute,'" + startdate + " 00:00:00',d.DateTime)/2 GROUP BY v.interval,Datediff(minute,'" + startdate + " 00:00:00',d.DateTime)/2 ORDER BY Interval"; SqlCommand cmd = new SqlCommand(sql, UsageLogConn); SqlDataAdapter mySQLadapter = new SqlDataAdapter(cmd); Chart1.DataSource = cmd; // set series members names for the X and Y values Chart1.Series["Series 1"].XValueMember = "intervaltime"; Chart1.Series["Series 1"].YValueMembers = "Total"; UsageLogConn.Close(); // data bind to the selected data source Chart1.DataBind(); cmd.Dispose(); </code></pre> <p>The above code adds only one chart for one date and I have added 'chart1' to design view and its not created dynamic. But I wanted to add more charts dynamic at runtime to the webpage.</p> <p>Can anyone help me with this?</p> <p>I am using VS 2008, ASP.NET 3.5 and the charting lib is: using System.Web.UI.DataVisualization.Charting;</p>
c# asp.net
[0, 9]
2,221,276
2,221,277
Assorted jQuery questions
<p>1.) What's the difference between these two queries, exactly?</p> <pre><code>$( "#orderedlist li" ) $( "#orderedlist&gt;li" ) </code></pre> <p>2.) In the jQuery file itself there is a function that returns the following:</p> <pre><code>function now(){ return +new Date; } </code></pre> <p>What does that mean? I've never seen +new before.</p> <p><strike>3.) In a brief skimming of a tutorial, I observed the following samples:</p> <pre><code>// use this to reset a single form $( "#reset" ).click( function() { $( "form" )[0].reset(); }); // use this to reset several forms at once $( "#reset" ).click( function() { $( "form" ).each( function() { this.reset(); }); }); </code></pre> <p>When I try to reference my own queries by array indexes, they don't seem to work. Yet this example clearly did when I tested it. What could I be doing wrong?</strike></p> <p><strong>Edit:</strong> I'll put this one into its own question soon. <strong>Edit 2:</strong> Actually I may be able to debug it myself. Hang on...</p> <p>I have guesses to each of these, but short of dissecting the jQuery file itself in full, I'm not completely certain what's at work here. Help appreciated.</p>
javascript jquery
[3, 5]
106,552
106,553
jquery populating wrong input on back button
<p>I am seeing a bit of a strange issue on webkit browsers where when I click the back button, my search input gets populated with the values which are meant for another input below generate by jQuery slider.</p> <p>script in the doc ready</p> <pre><code> $(function() { $( "#slider-amount" ).slider({ range: true, min: 0, max: 50000, values: [ 4000, 30000 ], slide: function( event, ui ) { $( "#amount" ).val( "€" + ui.values[ 0 ] + " - €" + ui.values[ 1 ] ); } }); $( "#amount" ).val( "€" + $( "#slider-amount" ).slider( "values", 0 ) + " - €" + $( "#slider-amount" ).slider( "values", 1 ) ); }); </code></pre> <p>Search input:</p> <pre><code> &lt;input id="topminiSearch" type="text" value=""/&gt; </code></pre> <p>Input slider</p> <pre><code> &lt;input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" /&gt; &lt;div id="slider-amount"&gt;&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
621,757
621,758
which solution will be faster on Android?
<p>Which solution will be faster on Android 2.1?</p> <p>1.</p> <pre><code>public void foo(String a, String b) { String msg = a + ": " + b; print(msg); } </code></pre> <p>2.</p> <pre><code>public void foo(String a, String b) { StringBuilder sb = new StringBuilder(a.length() + b.length() + 2); sb.append(a); sb.append(": "); sb.append(b); print(sb.toString()); } </code></pre> <p>Is android use internally StringBuilder for first solution?</p>
java android
[1, 4]
3,743,996
3,743,997
asynchronous triggers
<p>I have gridview and detailsview controls. The detailsview will be displayed only for the edits of the gridview. My detailsview is in an update panel and it will be displayed on the same page.</p> <p>I have a button inside the detailsview. When the button is clicked the itemcommand doesn't trigger and moreover, it causes a full post back. My page gets refreshed and I lose the data from the detailsview and only gridview is displayed. Any ideas for overcoming it?</p> <p>Thanks </p>
c# asp.net
[0, 9]
261,401
261,402
How to call a php function from Javascript
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/3761448/how-to-call-php-function-in-js">how to call php function in JS?</a><br> <a href="http://stackoverflow.com/questions/221396/javascript-and-php-functions">Javascript and PHP functions</a> </p> </blockquote> <p>Hi,</p> <p>I would like to invoke different php function with client window resolution.Consider if the users browser is large enough, then I would like to show a message from php function as vertical and if the browser is less than 960px wide then and only I would like to show the message as horizontal component.Any suggestions please... Thanks</p>
php javascript
[2, 3]
812,789
812,790
jquery scroll to an element that has been created on the fly via ajax
<p>I'm current using the solution provided in this answer <a href="http://stackoverflow.com/questions/6677035/jquery-scroll-to-element">jQuery scroll To Element</a> however, the problem I have is that the element I want to scroll to has been inserted into the dom via ajax so the function does not actually work. I'm assuming that jquery does not know the element exists yet as the page has not actually been reloaded.</p> <p>I've used things like jquery .delegate in the past for click/onchange events but, I'm not sure if/how I can use something similar so that jquery can find the newly created element.</p> <p>Any ideas on how I can do this? The code I'm currently using at the moment to do the scrolling is:</p> <p>$('html, body').animate({ scrollTop: $("#comment_row_"+comment_id).offset().top }, 2000);</p>
javascript jquery
[3, 5]
246,026
246,027
problem in Labels with asterisk!
<p>I have the following ASP.NET markup:</p> <pre><code>&lt;td align="right" valign="top" style="width: 130px"&gt; Answer: &lt;asp:Label ID="lblanswer" runat="server" CssClass="errorMessage" ForeColor="Red" Text="*"&gt; &lt;/asp:Label&gt; &lt;/td&gt; </code></pre> <p>I want it to say "Answer:*" with only the asterisk in red. </p> <p>How to do that if I want Answer to be inside the <code>&lt;asp:label/&gt;</code>. </p>
c# asp.net
[0, 9]
2,525,229
2,525,230
Echo PHP variable in Javascript in PHP
<p>This may seem like an odd question, and it may have been answered elsewhere...but frankly I'm not quite sure how to phrase a search any better.</p> <p>Essentially, I am trying to write an entire HTML and Javascript page in PHP (this way I can easily call and manipulate SQL queries...I know it doesn't make a lot of sense, but it's my last resort for an upcoming deadline). </p> <p>Anyways, I want to call/append to a PHP variable (the SQL query) in my Javascript...Something like this:</p> <pre><code>mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myquery = "SELECT `xxx`, `yyy` FROM `$tbl_name`"; $query = mysql_query($myquery); $data = array(); for ($i = 0; $i &lt; mysql_num_rows($query); $i++) { $data[] = mysql_fetch_assoc($query); } $data1 = json_encode($data); echo '&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;script&gt; data_arr = {$data1} ... ... </code></pre> <p>This doesn't seem to be working though. I've tried:</p> <pre><code> data_arr = {$data1} </code></pre> <p>and</p> <pre><code> data_arr = {'.$data1.'} </code></pre> <p>No luck so far. Is there anything I can do?</p>
php javascript
[2, 3]
151,960
151,961
How to add a pop up using jquery?
<p>My html code:</p> <pre><code>&lt;form id="room-from" method="post"&gt; &lt;input id="room" type="text" name="room" /&gt; &lt;input type="submit" id="save" name="save" /&gt; &lt;/form&gt; </code></pre> <p>when i press the save button if the room text field is empty a pop up should appear at the center of the screen and must say enter a room number.</p> <p>jquery:</p> <pre><code> $("#save").submit(function(){ if ( $("#room").val() == "") { } }); </code></pre> <p>I'm not sure how to do this.</p> <p>Can anyone please help me out on this.</p>
javascript jquery
[3, 5]
3,662,603
3,662,604
Get css properties from string
<p>I am creating a plugin that allows the user to define the notification by typing something like this.</p> <pre><code>growl-top-left-300px; </code></pre> <p>I was using a split to get rid the width, but this still required me to have quite a few if statements because I user had the following choices</p> <p>for example I had</p> <pre><code>if (position == "growl-top-left" || position == "growl-left-top") { container.css ({ top: '0px', left: '0px' }); }else if (position == "growl-top-right" || position == "growl-right-top") { container.css ({ top: '0px', right: '0px' }); }else if (position == "growl-top-center" || position == "growl-center-top") { // apply css // Not done yet }else if (position == "growl-bottom-left" || position == "growl-left-bottom") { container.css ({ bottom: '0px', left: '0px' }); }else if (position == "growl-bottom-right" || position == "growl-right-bottom") { container.css ({ bottom: '0px', right: '0px' }); }else if (position == "growl-bottom-center" || position == "growl-center-bottom") { // apply css // not done yet } </code></pre> <p>but as you can imagine that seems like a lot of redundant code, and I just want to know if anyone has a nicer way to clean it up?</p> <p>I thought it would be nice if I could get the top and left css values so I can write the following code:</p> <pre><code>container.css ({ retrivedCSS[0]: '0px', retrivedCSS[1]: '0px' }) </code></pre> <p>where retrivedCSS[0] would be the first position and the [1] would be the second position</p>
javascript jquery
[3, 5]
3,001,322
3,001,323
Hovering over <a> and displaying images based on value
<p>I am currently displaying pictures when an tag is hover over. I have been able to workout the main problem of displaying the picture. The problem is that it has a glitch when hovering occurs quickly. Is there away to avoid that? Also how can i set a default image to display when page is loaded? <a href="http://jsfiddle.net/BramVanroy/7Wp9z/" rel="nofollow">JSFIDDLE</a></p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="links"&gt; &lt;a href="example.htm" class="large magenta awesome" data-content="cheeseburger"&gt;Cheeseburger »&lt;/a&gt; &lt;a href="example.htm" class="large blue awesome" data-content="tacos"&gt;Tacos »&lt;/a&gt; &lt;a href="example.htm" class="large red awesome" data-content="salads"&gt;Salads »&lt;/a&gt; &lt;a href="example.htm" class="large orange awesome" data-content="bread-sticks"&gt;Bread Sticks »&lt;/a&gt; &lt;a href="example.htm" class="large yellow awesome" data-content="dessert"&gt;Dessert »&lt;/a&gt; &lt;/div&gt; </code></pre> <p><strong>Jquery</strong></p> <pre><code>$("div#links &gt; a").hover( function(){ var ID = $(this).data("content"); $("div#images").children("img#" + ID).fadeIn("slow"); }, function() { var ID = $(this).data("content"); $("div#images").children("img#" + ID).hide(); } );​ </code></pre> <p>Glitch</p> <p><img src="http://i.stack.imgur.com/nZj9p.png" alt="enter image description here"></p>
javascript jquery
[3, 5]
2,554,748
2,554,749
How to check value in a string?
<p>I have a value here:</p> <pre><code>itemList[i].ul.li.div[1].div[2].p </code></pre> <p>Which is</p> <p>Updated <code>n</code> minutes ago, where <code>n</code> can be any number.</p> <p>How do I check what <code>n</code> is in that string?</p> <p>So I can add it to an if statement, i.e.</p> <pre><code>if( n &lt; 10 ) { alert("less than 10"); } else { alert("more than 10") } </code></pre>
javascript jquery
[3, 5]
2,482,081
2,482,082
Cannot make unique javascript object. What's wrong with this code?
<p>I'm trying to make a simple in in-page popup called like this:</p> <pre><code>var test = new popObject({}); //JSON options </code></pre> <p>and I'm having trouble because when I create two in a row, and call show() on the first one, the second one always shows. Both are created, but they aren't separate somehow, despite being called with new. What am I doing wrong here? I've included my code, but I have removed out the irrelevant functions for compactness.</p> <pre><code>function popObject(options) { //functions show = function() { console.log(boxselector); jQuery(boxselector).css("display", "block"); return jQuery(boxselector); } var hide = function() {...} var update = function(updateOptions) {...} var calcTop = function(passedHeight) {...} var calcLeft = function(passedWidth) {...} var calcHeight = function(passedHeight) {...} var stripUnits = function(measure, auto) {...} var destroy = function() {...} //public functions this.show = show; this.hide = hide; this.update = update; this.destroy = destroy; //constants name = options.name; //name should never be changed. boxselector = ".boxcontainer[name=" + options.name + "]"; boxbodyselector = ".boxbody[name=" + options.name + "]"; boxtitleselector = ".boxcontainer[name=" + options.name + "]" boxboxselector = ".boxbox[name=" + options.name + "]" title = options.title; content = options.content; width = options.width; height = options.height; this.name = name; this.selectors = [boxselector, boxbodyselector, boxtitleselector, boxboxselector] this.title = title; this.content = content; this.width = width; this.height = height; //variables popupHtml = ... //init code jQuery("#dropzone").append(popupHtml); this.init = null; jQuery(".boxbox[name=" + name + "]").css("top", calcTop(width)); jQuery(".boxbox[name=" + name + "]").css("left", calcLeft(height)); jQuery(".boxbody[name=" + name + "]").css("height", calcHeight(height)); } </code></pre>
javascript jquery
[3, 5]
5,553,012
5,553,013
passing values to nest activity from diff lists
<p>i have a problem of passing two values in different <code>ArrayList</code>s.</p> <p>I made a listView and fetched to it list2 elements. when click on the listView item want to pass the selected item and the element in the list1 at the same position. The problem in next code that its pass only the selected item from listView?? how can i make it work to pass both values to next activity?</p> <pre><code>lv = getListView(); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, names); setListAdapter(adapter); lv.setOnItemClickListener(new OnItemClickListener(){ public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { //int c=parent.getSelectedItemPosition(); String bb=parent.getItemAtPosition(position).toString(); Intent i = new Intent(LastActivity.this, Details.class); String ur=links.get(position).toString(); // String x=edt.getText().toString(); i.putExtra("name",bb); i.putExtra("link",ur); // starting new activity startActivity(i); } }); </code></pre>
java android
[1, 4]
4,491,620
4,491,621
jQuery addClass after / Before
<pre><code>&lt;div id="box"&gt;&lt;/div&gt; &lt;div class="text"&gt;&lt;/div&gt;? $(document).ready(function () { $('#box').click(function () { $('.text').slideToggle('slow'); }); }); #box{ height:40px; width:100px; background:red; } #box:hover{background:blue;} #box:after{ content: ""; height: 10px; position: absolute; width: 0; margin-top:40px; margin-left:40px; border: 10px solid transparent; border-top-color: red; } #box:hover:after{ border-top-color: blue; } .text{ display:none; height:40px; width:100px; background:#fd0; margin-top:20px; } </code></pre> <p><a href="http://jsfiddle.net/zfQvD/16/" rel="nofollow">http://jsfiddle.net/zfQvD/16/</a></p> <p>Is that possible to use jQuery to add the styled <code>after</code> arrow? when <code>text class</code> is closed, remove <code>after</code> arrow class if <code>text class</code> is shown, then add the arrow? I tried, but seems doesn't work</p>
javascript jquery
[3, 5]
5,621,728
5,621,729
Adding Jquery to an new Window "window.open"
<p>what about adding jquery to a page. Like this:</p> <ol> <li>Clicking on a bookmark (which loads the same url into a new window)</li> <li>Adding Jquery.js</li> <li>Run some jquery..</li> </ol>
javascript jquery
[3, 5]
5,478,835
5,478,836
How to use jQuery to download zip file which directly ouput from server?
<p>I have a php script that will generate zip file.</p> <pre><code>header("Content-type: application/octet-stream"); header("Content-disposition: attachment; filename=random_name.zip"); echo $zipfile-&gt;file(); </code></pre> <p>The filename is random and the server script doesn't even come with a return-file-uri function.</p> <p>So my question is that how jQuery can handle this output (echo $zipfile->file()) so that I can download the zip file in the usual way? </p> <p>Any help would be appreciated.</p> <p>Regards,</p> <p>Jesse</p>
php javascript jquery
[2, 3, 5]
3,206,624
3,206,625
what is the operator be overloading here : String8::operator const char*() const
<p>I know it is used to get the containing c string ,similar to <code>std::string.c_str().</code> But how should I use the operator? </p> <pre><code>//android/frameworks/base/include/utils/String8.h 458 inline String8::operator const char*() const 459 { 460 return mString; 461 } </code></pre>
c++ android
[6, 4]
3,107,180
3,107,181
How to implement unobtrusive javascript with dynamic content generation?
<p>I write a lot of dynamically generated content ( developing under PHP ) and I use jQuery to add extra flexibility and functionality to my projects.</p> <p>Thing is that it's rather hard to add JavaScript in an unobtrusive manner. Here's an example:</p> <p>You have to generate a random number of DIV elements each with different functionality triggered onClick. I can use the "onclick" attribute on my DIV elements to call a JS function with a parameter but that is just a bad solution. Also I could generate some jQuery code along with each div in my PHP "for" loop, but then again this won't be entirely unobtrusive.</p> <p>So what's the solution in situations like this?</p>
javascript jquery
[3, 5]
205,436
205,437
Basic Crud Application Using Php , Prototype.js and Scriptaculous.js
<p>I want to develop a web application using php and javascript.</p> <p>There should be functionality of validations, data searching (from tables), sorting and pagination.</p> <p>But my application should be built upon php, prototype.js and scriptaculos.js . I don't want to use jquery and similar tools due to virus issues.</p> <p>Is there any tutorial on prototype.js and scriptaculos.js? Please guide me</p> <p>Thanks</p>
php javascript
[2, 3]
1,293,907
1,293,908
Problem with $.getJSON in jquery
<p>My Jquery code</p> <pre><code>function nalozi() { var id_skupine = $('#skupina option:selected').val(); $('#artikel option').remove(); //$('#artikel').append('&lt;option value="'+id_skupine+'"&gt;'+id_skupine+'&lt;/option&gt;'); $.getJSON('artikli.php', {id_skupine:$('#skupina').val()}, function(data) { $.each(data, function(index,item) { $("#artikel").append("&lt;option value=" + item.id + "&gt;" + item.ime_artikla + "&lt;/option&gt;"); }); }); } $(document).ready(function() { nalozi(); $('#skupina').change(function() { nalozi(); }); }); </code></pre> <p>AND PHP CODE</p> <pre><code>&lt;?php if(isset($_GET['id_skupine'])) { $id_skupine = $_GET['id_skupine']; $poizvedba = mysql_query("SELECT id,ime_artikla FROM artikli WHERE id_skupine = '$id_skupine'"); $velikost = mysql_num_rows($poizvedba); for ($i=0;$i&lt;$velikost;$i++) { $elements[]=mysql_fetch_assoc($poizvedba); } } echo json_encode($elements); ?&gt; </code></pre> <p>I don't get the values back.</p>
php jquery
[2, 5]
2,433,153
2,433,154
javascript one letter function names in jQuery
<p>I noticed that the production version of jquery has one-letter function and variable name and was wondering how they achieve that. are there tools to create a production level javascript file from the one use during development? I am having a hard time figuring out how they make sure there are no mistakes, especially for an open source project that big. </p>
javascript jquery
[3, 5]
5,524,362
5,524,363
How can i get the Reaction time and Maximum Continuous Frame Drop for an android application usign java or android?
<p>I want to Caulate the reaction ttime and frames per second of a device using an application or java code in the homescreen launcher.</p>
java android
[1, 4]
81,474
81,475
Best method to repeat JS function
<p>Sometimes this function can be called too quickly and multiple elements are created but since it uses an ID that's not unique to each instance it the part to fade out and remove the div only applies to the top level element, not all of them. So I end up with a static div tag that isn't fading/removing.</p> <p>The best thing I can think to do is to simply repeat the process again. How do I do that, or is there a better method?</p> <pre><code>document.triggerNotification = function (type, message) { jQuery(document.body).append("&lt;div class='push-notification push-"+type+"' id='notification'&gt;"+message+"&lt;/div&gt;"); jQuery('#notification').delay(1500).fadeOut(1200, function () { jQuery('#notification').remove(); }); } </code></pre>
javascript jquery
[3, 5]
3,330,087
3,330,088
Connecting to a PHP web server with android
<p>Hi! I'm developing an internet based app in android. What i want to do is send a user id and password to a php web server and return a response from the server. The response could be a text, like "valid" or "invalid", and if the response is "valid" then a new activity should be launched. I don't know how to send data to a PHP server from android and read a response from the server. The following PHP code will generate a proper response. Please help me regarding this as it is important in my final year project of my BS in computer science. Thanks!</p> <pre><code>&lt;?php $user= $_POST["uid"]; $pwd=$_POST["pass"]; $con= mysql_connect("localhost","root"); if(!$con) { die("Not able to connect"); } mysql_select_db("try",$con); $result=mysql_query("Select * from info where uid='$user'and pass='$pwd'"); if( mysql_num_rows($result)&lt;=0) { echo "unsuccessful"; } else { echo "successful"; } mysql_close($con); ?&gt; </code></pre>
php android
[2, 4]
196,610
196,611
Retaining select box based values on page refresh
<p>I have one form where in select box in which I have two options "oui" and "non":</p> <ul> <li>When "oui" is selected "hello" is displayed</li> <li>When "non" is selected "not valid" is displayed</li> </ul> <p>My problem is when I refresh page after submitting form, "oui" or "non" is properly selected but not the value based on it like "hello" or "not valid"</p> <p>here is some code</p> <pre><code>&lt;p&gt;choose option: &lt;select name="opt" class="slct"&gt; &lt;option value="0" selected="selected"&gt;--&lt;/option&gt; &lt;option value="oui"&gt;Oui&lt;/option&gt; &lt;option value="non"&gt;Non&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;div id="oui" class="brandDiv"&gt; hello &lt;/div&gt; &lt;div id="non" class="brandDiv"&gt; not valid &lt;/div&gt; </code></pre> <p>and the jquery</p> <pre><code>function showhide() { $("div.brandDiv").hide(); $("select.slct").bind('change', function() { $('div.brandDiv').hide(); var targetId = $(this).val(); $('div#' + targetId).show(); }); } </code></pre> <p>Thank you all in advance.</p>
php jquery
[2, 5]
1,121,605
1,121,606
class magic methods in asp.net c# like php
<p>im know a lot in php, but im newbie in asp.net.</p> <p>In asp.net exists magic methods in classes like php?(__construct(), __isset() __get() __set() __destruct(), etc) for example, how i can do this in asp.net c#:</p> <pre><code>class foo { public $name; public function __contruct($name){ $this-&gt;name = $name; } public function getName(){ return $name; } } $test = new Foo("test"); echo $test-&gt;getName(); //prints test </code></pre> <p>Thanks for help!</p>
c# asp.net
[0, 9]
3,401,320
3,401,321
Google places query limit
<p>I have developed an android app using Google Map API. When I am using my home Internet from a local provider, the app is running.</p> <p>But, when I changed my internet to AT&amp;T , I am getting following error:</p> <blockquote> <p>Places error-Sorry query limit to google places is reached.</p> </blockquote> <p>I don't understand why is this happening. Is there a difference between the 2 internet connections?</p> <p>Thanks </p>
java android
[1, 4]
1,449,818
1,449,819
datepicker issue with jquery on textbox
<p>I am using "jquery-ui-1.8.12.custom.min.js" file in my project. I have the following code in aspx page</p> <p><strong>script</strong></p> <pre><code>&lt;script type="text/javascript" &gt; $(function() { $('#&lt;%=txtDate.ClientID%&gt;').datepicker(); }); &lt;/script&gt; </code></pre> <p><strong>add file reference</strong></p> <pre><code>&lt;script type="text/javascript" src="&lt;%= ResolveUrl("~/script/jquery-ui-1.8.12.custom.min.js") %&gt;" &gt;&lt;/script&gt; </code></pre> <p>but I dont know where I am wrong. Plz help me out to resolve this issue.</p> <p>I found this kind of error </p> <p><img src="http://i.stack.imgur.com/L9dmd.jpg" alt="jquery error in error console"></p>
c# jquery asp.net
[0, 5, 9]
1,080,863
1,080,864
Python and C++ code comparison
<p>I have the following <code>python</code> code</p> <pre><code>for m,n in [(-1,1),(-1,0),(-1,-1)] if 0&lt;=i+m&lt;b and 0&lt;=j+n&lt;l and image[i+m][j+n] == '0'] </code></pre> <p><code>image</code> is array defined and <code>i</code> and <code>j</code> is also defined.</p> <p>Following is how I have converted this into <code>C++</code></p> <pre><code>std::vector&lt;std::pair&lt;int,int&gt; &gt; direction; direction.push_back(std::make_pair(-1,1)); direction.push_back(std::make_pair(-1,0)); direction.push_back(std::make_pair(-1,-1)); for ( std::vector&lt;std::pair&lt;int,int&gt; &gt;::iterator itr = direction.begin(); itr != direction.end(); ++itr) { int m = (*itr).first; int n = (*itr).second; if ( (0 &lt;= i + m &amp;&amp; i + m &lt; width ) &amp;&amp; (0 &lt;= j + n &amp;&amp; j + n &lt; width ) &amp;&amp; image[i + m][j + n ] == 0) { } </code></pre> <p>Is this conversion correct?</p>
c++ python
[6, 7]
2,442,863
2,442,864
Audio trigger in Javascript
<p>I've coded up a quiz using javascript, I want to add sound effects when a user answers a question either correctly or incorrectly. Sounds will be different for correct and incorrect answers. Im just starting javascript and need this for a class project so any help would be greatly appreciated. I can upload the html and js code if anyone can help. I presume I have to use an onclick event with if or else statements but im not too sure how to do this. Thanks</p>
javascript jquery
[3, 5]
4,868,575
4,868,576
Create popup box success message with jquery and PHP
<p>How to create a popup box success message with jquery and PHP after submitted without ajax? I usually using only javascript,</p> <pre><code>&lt;?php $query = //my query insert query if($query){ echo "&lt;script&gt;alert('success submitted');&lt;/script&gt;"; // my popup box success message } ?&gt; </code></pre> <p>any suggestion for this? I hope to make it jquery so it looks nicer. Thanks</p>
php jquery
[2, 5]
3,798,309
3,798,310
Auto click when user scrolls to the end of the page
<p>I'm trying to create an infinite scroll feature on my site but it isn't working. My code:</p> <pre><code>var post = {} post.load_moreBtn = $('#home_load_more'); if($(window).scrollTop() + $(window).height() == $(document).height()) { post.load_moreBtn.trigger('click'); } post.load_moreBtn.on('click', function () { $(this).html('&lt;img src="' + base_url + 'images/core/loader2.gif"/&gt;'); post.load_more_messages($(this).attr('data-last_id')); }); </code></pre> <p>If I put an alert in place of the trigger it works,also if I remove the scroll detection bit, the load more works fine. Just can't get it to autoload, please help.</p>
javascript jquery
[3, 5]
1,664,668
1,664,669
Jquery / Javascript form help?
<p>I have implemented this solution..</p> <p><a href="http://tutorialzine.com/2010/10/ajaxed-coming-soon-page/" rel="nofollow">http://tutorialzine.com/2010/10/ajaxed-coming-soon-page/</a></p> <p>However, on submit, I would like the form to disappear and the "thank you" text displayed. Currently, the form remains and the "thank you" text is displayed in the textbox.</p> <p>What would I have to change?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
479,327
479,328
jQuery: Foreach element href?
<p>The title sounds confusing.. but im sure this is possible!</p> <p>I have one button, <code>(id='downloadAll')</code> and many <code>&lt;a href="..." class="link"&gt;&lt;/a&gt;</code> on my page. What i want to do, for the purpose of finding out how to do this.. is to do something logic like this.</p> <pre><code>var hrefs = ALL OF THE ELEMENTS WITH CLASS 'link'; foreach(hrefs){ alert(this.attr('href')); } </code></pre> <p>Basically for each of the elements with a class, i want to get the value of each one... in tern. Yes, i do have jquery on the page - am hoping to make use of this!</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,352,497
2,352,498
How can I parse this home-made string-based data format?
<p>I need to iterate through a dataset of IDs and labels. I got some part of the code right, but I need some assistance. </p> <pre><code>// 1. String var string = '1:answer1,2:answer2,3:answer3,4:answer4,5:answer5,' // 2. Split to array var string = string.split(","); // 3. EACH $.each(string, function(key, val) { var answer = answer.split(":"); $.each(answer, function(key1, val1) { // output textfield with id of key1 and value of val1 }); }); </code></pre> <p>I can go through the first set of data, that is comma separated, but not the next (:). How do I do that?</p>
javascript jquery
[3, 5]
4,121,226
4,121,227
How to detect javascript file download complete in the client machine by simple javascript
<p>i hard that it is always better to move all script at the bottom of the page and as a result page load very fast. so today i did that and found a problem that when javascript files and my javascript function was loading then i click on a button which was attached with jquery function. the result i got page reload. which i don't want. to avoid this situation we have 2 choice. one is let all script tag should be download first before other page content download and second one is just detect javascript file or script tag download in client side and functions are ready to call. if javascript files are downloading and function can be called then button click should call the righ js function other wise it will return false.</p> <h2>here is my code</h2> <p>if btnFeedback1 is clicked then a routine will be executed.</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; jQuery.noConflict(); jQuery(document).ready(function () { jQuery("#btnFeedback1").click(function () { //here my logic goes return false; }); }); </code></pre> <p></p> <p>if associated js file are downloading then button click will return false not reload the page. so please guide me with code how to achieve it.</p>
javascript jquery
[3, 5]
30,766
30,767
Run function on specific key press
<p>I have tried to program a jquery script that does a fadeIn() on an element identified as myDiv when I press the x key. </p> <pre><code>function showKeyCode(e) { //alert( "keyCode for the key pressed: " + e.keyCode + "\n" ); $if(e.keycode == 88){$("#myDiv").fadeIn(); } </code></pre> <p>Points to take note of. When I allow the alert x displays a key code of 88</p> <p>This code does not work.</p>
javascript jquery
[3, 5]
1,062,970
1,062,971
ASP.NET & JQuery | Show jQuery LightBox on Submit
<p>Currently I have a small form that uses a <code>asp:linkbutton</code> to submit and send out an email.</p> <p>I want to instead display a lightbox saying "Thank you for your submission" when the user clicks the form rather than a full post back.</p> <p>What is the best solution?</p>
asp.net jquery
[9, 5]
2,749,968
2,749,969
HtmlEncode List<string> values
<p>I have cell values saved in List like this</p> <pre><code>public List&lt;string&gt; Cell { get; set; } </code></pre> <p>I want do htmlEncode to each value of this list. can anyone help me with this??</p>
c# asp.net
[0, 9]
39,240
39,241
toggle the title of a button
<p>I have an HTML button and it shows another div instead of another div.</p> <p>All I need is to toggle the text for the button: </p> <pre><code>&lt;input id="blueButton" type="button" value="+ Add a new Team" onclick=" $('#blueButton').prop('value', 'Hide'); $('#teams').toggle('slow'); $('#add_block').toggle('slow');"&gt; </code></pre> <p>I need to change the button text again from hide to the orgianl title which is <code>+ Add a new Team</code> </p> <p>so the button title is <code>+ Add a new Team</code> if clicked the button title change to <code>hide</code> if I click the button again it will change to <code>+ Add a new Team</code> again.</p> <p>Thank you in advance.</p>
javascript jquery
[3, 5]
5,048,517
5,048,518
Randomize setInterval ( How to rewrite same random after random interval)
<p>I'd like to know how to achieve: generate a random number after a random number of time. And reuse it.</p> <pre><code>function doSomething(){ // ... do something..... } var rand = 300; // initial rand time i = setinterval(function(){ doSomething(); rand = Math.round(Math.random()*(3000-500))+500; // generate new time (between 3sec and 500"s) }, rand); </code></pre> <p>And do it repeatedly.</p> <p>So far I was able to generate a random interval, but it last the same until the page was refreshed (generating than a different time- interval).</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,125,774
4,125,775
Required textbox in javascript
<p>I have this code </p> <pre><code>$(document).ready(function () { $("#&lt;%= chkSpecialIntegration.ClientID %&gt;").click(function () { if (this.checked) { document.getElementById('&lt;%=ddlTypeSpecialIntegration.ClientID %&gt;').style.visibility = 'visible'; } }); }); </code></pre> <p>When this is checked then a textbox is no longer required. How can I do this?</p>
c# javascript jquery
[0, 3, 5]
1,764,637
1,764,638
What is jQuery(document) vs. $(document)
<p>I don't get what jQuery(document) is here. I thought you always used $(document)</p> <p>see here in his examples: <a href="http://sorgalla.com/projects/jcarousel/" rel="nofollow">http://sorgalla.com/projects/jcarousel/</a></p>
javascript jquery
[3, 5]
2,828,889
2,828,890
PHP extension library accessing PHP superglobals
<p>I have written a PHP extension library in C++. I am writing the extension for PHP 5.x ad above.</p> <p>I need to access PHP superglobals in my C++ code. Does anyone know how to do this?. A code snippet or pointer (no pun inteded) to a similar resource (no pun ...) would be greatly appreciated.</p>
php c++
[2, 6]
507,717
507,718
How can I detect when a file download has completed in ASP.NET?
<p>I have a popup window that displays "Please wait while your file is being downloaded". This popup also executes the code below to start the file download. How can I close the popup window once the file download has completed? I need some way to detect that the file download has completed so I can call self.close() to close this popup.</p> <pre><code>System.Web.HttpContext.Current.Response.ClearContent(); System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.ClearHeaders(); System.Web.HttpContext.Current.Response.ContentType = fileObject.ContentType; System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", string.Concat("attachment; filename=", fileObject.FileName)); System.Web.HttpContext.Current.Response.WriteFile(fileObject.FilePath); Response.Flush(); Response.End(); </code></pre>
c# javascript asp.net
[0, 3, 9]
2,900,605
2,900,606
How to remember that the item is purchased or not in android app billing service?
<p>In my app I have done the below code in the dungeons sample project to check whether the item is purchased or not and changing my text of a list item :</p> <pre><code>@Override public void onPurchaseStateChange(PurchaseState purchaseState, String itemId, int quantity, long purchaseTime, String developerPayload) { if (Consts.DEBUG) { Log.i("Tag", "onPurchaseStateChange() itemId: " + itemId + " " + purchaseState); } if (purchaseState == PurchaseState.PURCHASED) { ownedItems.add(itemId); list.get(purchaseposition).setPurchase("Play"); adapter.notifyDataSetChanged(); } // YOU can also add other checks here } </code></pre> <p>but when I re run the application it can not remember that I have already bought the item and it prompt me to buy it again. How can i do this? Its looking a little bit of complicated for me.</p>
java android
[1, 4]
5,973,259
5,973,260
I have a C#/ASP solution that uses datatables to output to gridviews. Links are not working
<p>I have a C#/ASP solution that uses datatables to output to gridviews. I am using VS2010. All works well when I run it on my local machine. I can sort, and choose rows. But I have pushed it out to the server and it does nothing when it gets to the page with the gridview on it. The sorts and rows are blue and clickable but nothing happens when you click on them. The only thing that I notice is that the JavaScript_doPostBack() is mentioned when i hover on the links. The server is IIS 7, Win Serv 2008 R2, MS Win 7 enterprise. Can any of you C#/ASP guru's out there get me over this hurtle?</p>
c# asp.net
[0, 9]
3,967,331
3,967,332
how to include javascript into web app projet in visual studio?
<p>Anyone knows how to include javascript file as project's resource for aspx.cs files under different folders to use?thanks very much</p>
asp.net javascript
[9, 3]
3,452,467
3,452,468
How do I handle screen orientation changes when a dialog is open?
<p>I have an android app which is already handling changes for orientation, i.e. there is a <code>android:configChanges="orientation"</code> in the manifest and an <code>onConfigurationChange()</code> handler in the activity that switches to the appropriate layout and preps it. I have a landscape / portrait version of the layout.</p> <p>The problem I face is that the activity has a dialog which could be open when the user rotates the device orientation. I also have a landscape / portrait version of the dialog.</p> <p>Should I go about changing the layout of the dialog on the fly or perhaps locking the activity's rotation until the user dismisses the dialog. </p> <p>The latter option of locking the app appeals to me since it saves having to do anything special in the dialog. I am supposing that I might disable the orientation when a dialog opens, such as </p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); </code></pre> <p>and then when it dismisses</p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); </code></pre> <p>Would that be a sensible thing to do? If the screen orientation did change while it was locked, would it immediately sense the orientation change when it was unlocked?</p> <p>Are there alternatives?</p>
java android
[1, 4]
2,414,200
2,414,201
How to access resource strings from enum's ToString in Android?
<p>In my app, I have a Spinner being filled from an enum:</p> <pre><code>ArrayAdapter&lt;myEnum&gt; enumAdapter = new ArrayAdapter&lt;Stroke&gt; (parentActivity.getApplicationContext(), R.layout.simple_spinner_item, myEnum.values()); enumAdapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); enumSpinner.setAdapter(strokeAdapter); </code></pre> <p>This uses an override of the enum's <code>toString()</code> method to get a friendly name for the enum values to display in the <code>Spinner</code>. Currently my enum has strings hardcoded for the friendly names but I'd like to move these to <code>strings.xml</code> to support localization.</p> <p>However, toString doesn't have access to a <code>Context</code> so I'm not sure how to resolve the resource ids. </p> <p>Is there any way of getting localised strings in the toString() method of an enum?</p>
java android
[1, 4]
2,214,003
2,214,004
Popup window issue
<p>I have a question regarding the popup window.</p> <p>I have</p> <pre><code> ajax callback funtion.... var popup = window.open("popup.html", "popup","width=1000, height=600, scrollbars=yes"); if (window.focus) {popup.focus()} popup.document.write("&lt;table id='popupData'&gt;&lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"); button1 click -&gt;call ajax button2 click -&gt;call ajax </code></pre> <p>My codes will creata a popup window when I click button 1 or button 2 the first time.</p> <p>However, if I didn't close the first popup window and click button1 or button2 again, My browser lose focus (I want the focus on the new popup window. Also, The new popup window will open a different webpage (index page in my case).</p> <p>I am not sure what's going on here. Can someone helps me out plz? </p>
javascript jquery
[3, 5]
5,838,997
5,838,998
Get Specific Time in Specific TIme Zone
<p>I am trying to get a calendar object with the a specific time tomorrow in a specific time zone (not the time zone the device is in). In the example below I want to get 12:15am in Central time zone tomorrow not matter where in the world the device is located.</p> <p>First question, is this the best way to do this?</p> <p>Second question, how should I deal with daylight savings. I am only dealing with the 4 continental US time zones and I can assume that I want to adjust for daylight savings time.</p> <pre><code>Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"), Locale.getDefault()); calendar.add(Calendar.DATE, 1); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.add(Calendar.HOUR_OF_DAY, 6); //Central time zone calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.MINUTE, 15); </code></pre>
java android
[1, 4]
5,786,236
5,786,237
jquery event is not working properly
<p>i have a Invoice form and a jquery function. In Invoice if i enter the quantity greater then the available quantity then i have to alert the user.</p> <p>My problem is: Let the max quantity is 5, if i input data as 7 (single digit>max avail quantity) then my code is working fine. But if i enter two digigist number eg. 17(two digists>max avail quantity) then my alert box is not coming. I mean onkeyup my function is working only with single digit.</p> <p>How can i make it happening? Please help.</p> <pre><code> $('input[name="quantity"]').keyup(function() { //problem is here var $tr = $(this).closest("tr"); var unitprice = $tr.find('input[name^="unitprice"]').val(); var q = $tr.find('input[name^="quantity"]').val(); var cq = $tr.find('input[name^="checkquantity"]').val(); if(q&gt;cq) { alert("Error: Quantity value exceeds then available quantity..Max Quantity is "+cq); //this works fine only if single digit is entered in textbox quantity } //----below are some other stuffs -these are working fine $tr.find('input[name^="sprice"]').val($(this).val() * unitprice); var totalPrice = 0; $('input[name="sprice"]').each(function() { totalPrice += parseFloat(this.value); $('[name=subtotal]').val(totalPrice); }); }); -------------- ------------ // Form containing the above textboxes &lt;input type="submit" id="submitbtnId" value="Save"/&gt;` </code></pre>
javascript jquery
[3, 5]
3,487,546
3,487,547
How to set :hover on a li(A) when hover an other li(B)
<p>I am daily an iOS developer, but i'm trying to give a help for a friend in php and jquery, since I didn't do Jquery for a lonnng time, im asking you guys a little help :)</p> <p>So let's say I got this, for a unique ID</p> <blockquote> <p>&lt; li class="listname" value="'.$id.'"></p> </blockquote> <p>When I go hover this, I want to li:hover this for the same unique ID</p> <blockquote> <p>&lt; li class="listpicture" value="'.$id.'></p> </blockquote> <p>My CSS job is done, when I go hover one, it does the job.</p> <p>I began my script with something like that</p> <pre><code>$("li.listname").mouseover( function() { var id = $("li.listpicture").attr('value'); // and miss some job here } </code></pre> <p>I feel a little bit noob on this, but I will feel free to help you with iOS Developement :)</p> <p>Thx</p>
php javascript jquery
[2, 3, 5]
933,501
933,502
Accessing a JSON var wthout using item.item = string
<p>Here is the array</p> <pre><code>var weekdayColor = { sunday : 'red', // sunday monday : 'blue', // monday tuesday: 'white', // tuesday wednesday: 'black', thursday: 'green', friday: 'yellow', saturday: 'orange' } </code></pre> <p>I want to be able to do something along the lines of <code>weekcayColor[0]</code> to get <code>sunday</code>:</p> <p>Here is the JavaScript I wrote for an interview which was already turned in.. I know there is an easier way to do this. The first var <code>weekdayColor</code> CANNOT BE CHANGED; also <code>weekdayColor.sunday</code> returns <code>red</code>.</p> <p>Perhaps I am using the wrong date method or accessing the var incorrectly?</p> <pre><code>var weekdayColor = { sunday : 'red', // sunday monday : 'blue', // monday tuesday: 'white', // tuesday wednesday: 'black', // wednessday thursday: 'green', // thursday friday: 'yellow', // friday saturday: 'orange' // saturday } var weekday=new Array(); weekday[0]="sunday"; weekday[1]="monday"; weekday[2]="tuesday"; weekday[3]="wednesday"; weekday[4]="thursday"; weekday[5]="friday"; weekday[6]="saturday"; d = new Date; day = d.getDay(); console.log(weekday[day]); a = weekday[day]; function change(){ var x = document.getElementById("weekday"); x.innerHTML = a; x.style.color = weekdayColor[a]; } </code></pre>
javascript jquery
[3, 5]
5,611,617
5,611,618
Re-create activity when service is started again
<p>In my MainActivity i have boolean method which checks if Airplane mode is ON. Example below:</p> <pre><code>public static boolean isAirplaneModeOn(Context context) { return android.provider.Settings.System.getInt (context.getContentResolver(), android.provider.Settings.System.AIRPLANE_MODE_ON, 0) != 0; } </code></pre> <p>In my broadcast receiver class i have code which calls that method from MainActivity. Example down below:</p> <pre><code>if(MainActivity.isAirplaneModeOn(act)) { act.stopApplication(); } </code></pre> <p>I need that code in onReceive, because onReceive code is triggered every 2sec and i don't allow airplane mode to be ON(application uses 3g network and obviously you can't use 3g when you have airplane mode ON ). Code works just fine. But now it comes the real problem.</p> <p>I noticed that when system resources are low ( ram ), android OS tries to kill my application and it does. Because my application uses <em>service</em>, android OS wants to run service again (when RAM is available). Then my app force closes and i get NULLPOINTEREXCEPTION on <strong>act</strong> variable. I think its because system starts only service and in my service <strong>act</strong> variable doesnt exists ( it come to existance only if i run application again - onCreate() method)</p> <p>My question: </p> <p>How to fix my problem so i can call my isAirplaneModeOn(Context context) method, from Broadcast receiver and <strong>act</strong> variable won't be null, even if my service is started again by android OS. ( in this case act variable is null, because is initialized onCreate() ).</p> <p>Or, how to save objects that are initialized in activity, and load them in my service when its started again. Is this possible?</p> <p>I already tried to change isAirplaneModeOn method to be non-static, and i created new MainActivity object onReceive(), and called that method. But i get NULLPOINTEREXCEPTION again.</p>
java android
[1, 4]
4,373,027
4,373,028
In a javascript case statement should I be putting multiple breaks or just one break when there's an if else?
<p>I have two questions related to the code:</p> <p>For my code should I have a break statement after each part of the if - else or just one at the end? Also when I define my object. Is it standard practice to be using uppercase for the fields such as Pk, Param, Table, Success?</p> <pre><code> case "Exam": if (accountID) { obj = { pk: pk = accountID + "04000", param: '?pk=' + accountID + "04000", table: "Content", success: true }; // break here ? } else { paramOnFailure("Please reselect Account"); obj = { success: false }; // break here ? } // break here ? </code></pre>
javascript jquery
[3, 5]
4,065,625
4,065,626
How to know when a user has left the page and refreshed the page
<p>I want to make an AJAX call before the user leaves the page (so basically before leaving the page and before refreshing the page)?</p> <p>How can this be done. I was trying to search something with jQuery but didnt get anything. </p> <p>I tried to use the following code -</p> <pre><code>window.onbeforeunload(function(){alert('before unload');}); </code></pre> <p>But the alert box never appears when leaving the page(closing the browser tab) or refreshing the page. </p> <p>How can this be accomplished?</p>
javascript jquery
[3, 5]
694,818
694,819
Principle of getting new letters from my Google Account on device
<p>I need information about getting new letters from my gmail mailbox: i turn on synchronization on my device, and when my mailbox get a new letter gmail client on my device will respond to it and show me notification. How does it work? Gmail client sends requests every second/minute or there is mean to respond to this event? I need it, because i have been making application which must respond to a new event in Google Calendar. Thank you.</p>
java android
[1, 4]
3,442,841
3,442,842
jquery - write a function to allow for a callback?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3888488/javascript-callback-programming">Javascript callback programming?</a> </p> </blockquote> <p>A lot of jquery functions allow for a callback. Most are in a syntax like:</p> <pre><code>$('.selector').slideUp('fast', function(){ alert('slideUp has completed'); }); </code></pre> <p>If I'm writing my own function, how can I make sure it is finished before the one after it is called (i.e. provide a callback parameter)</p>
javascript jquery
[3, 5]
5,450,565
5,450,566
How can I select an element's parent row in a table?
<p>I have the following function:</p> <pre><code>$("#example tbody").click(function(event) { $(oTable.fnSettings().aoData).each(function (){ $(this.nTr).removeClass('row_selected'); }); $(event.target.parentNode).addClass('row_selected'); }); </code></pre> <p>When a user clicks on a td element in a table it adds the row_selected class to the row. However when a user clicks on an input element inside of a td then it adds the row_selected class to the td. </p> <p>Is there a way that I can change event.target.parentNode so that instead of the parent it adds the class to the parent tr? </p>
javascript jquery
[3, 5]
4,338,012
4,338,013
how to integrate javascript in iPhone application?
<p>i am new in iphone application and i want to integrate the javascript so would you please give some information about how to implement javascript? </p>
javascript iphone
[3, 8]
1,683,772
1,683,773
Call Web control's JavaScript Function From Button Click
<p>I've got a Web control called Fou.ascx and it has a java script function called DoFou(message). In my web Page I want to click a button, which is on the page and not part of the web control, and have it execute DoFou and pass in the message parameter. The web page has an instance of the web control Fou.</p> <p>How can I do this?</p> <p>thanks</p>
javascript asp.net
[3, 9]
3,039,671
3,039,672
The left-hand side of an assignment must be a variable error in eclipse
<pre><code>public class CustomBlockFactory { private static final Logger logger = Logger.getLogger(TableListControllerFactory.class.getName()); public static AndroidTourController getController(TourControllerParameters paramTourControllerParameters, TourSequencer paramTourSequencer) { ((CustomBlock)paramTourControllerParameters); return new EnableTableController(paramTourControllerParameters, paramTourSequencer); } } </code></pre> <p>I'm getting error at ((CustomBlock)paramTourControllerParameters); as "The left-hand side of an assignment must be a variable".</p> <p>Could anyone please rectify this error?</p> <p>Thanks in advance</p>
java android
[1, 4]
701,403
701,404
assign columns value on rowdatabound in gridview
<p>I am facing a problem in grid view, basically what i am trying to achieve is below: I have a grid view in which my first column is a link button, i have to put a condition where value from my 2nd column is taken and is input to a c# method for poulating a value which i need to assign into my first column.</p> <p>I am trying below code however when i view my grid its showing 1st columns value as blank. Aspx page:</p> <pre><code>&lt;asp:TemplateField HeaderText="FileName" ItemStyle-HorizontalAlign="Center"&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID="btn" runat="server" CommandName="Click"/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>aspx.cs</p> <pre><code>if (e.Row.RowType == DataControlRowType.DataRow) { int EmpiD = Int32.Parse(e.Row.Cells[2].Text); DataSet EmpIDDs = GetEMP.getValue(EmpiD); DataRow EmpRow = EmpIDDs.Tables[0].Rows[0]; e.Row.Cells[0].Text = EmpRow[3].ToString(); } </code></pre> <p>Please help me if you have any solution</p>
c# asp.net
[0, 9]
3,489,276
3,489,277
Javascript: Arrays
<p>For some reason my values are not being stored in the array:</p> <pre><code>var req = new Array(); $.get('./ajax/get_cat_info.php?cid=' +cid, function(data, textStatus) { var count = 0; $.each(data, function(key, val) { $('#' + key).show(); if(val == 1) { req[count] = key; count = count + 1; //var arLen=req.length; //alert('l: ' + arLen); // this works though } }); }, 'json'); var arLen=req.length; alert('l: ' + arLen); </code></pre> <p>I get alerted "l: 0" at the end. If I uncomment the line alert in the IF statement, it alerts on each one, then still alerts 0.</p>
javascript jquery
[3, 5]
1,955,270
1,955,271
Streamlining code
<p>I have a question about streamlining my jquery code. I have a list of images and each has a unique id and the click event displays the larger image and its info. Is there a way to do this with a loop similar to php's foreach loop?</p> <pre><code>$(function() { $('img#cl_1').click(function() { $('div#left').html('display image').slideDown('fast'); $('div#right').html('display image info').slideDown('fast'); }); $('img#cl_2').click(function() { $('div#left').html('display image').slideDown('fast'); $('div#right').html('display image info').slideDown('fast'); }); $('img#cl_3').click(function() { $('div#left').html('display image').slideDown('fast'); $('div#right').html('display image info').slideDown('fast'); }); $('img#cl_4').click(function() { $('div#left').html('display image').slideDown('fast'); $('div#right').html('display image info').slideDown('fast'); }); /*so on and so forth*/ }); </code></pre>
javascript jquery
[3, 5]
455,345
455,346
Javascript disable container, but enable inputs in it
<p>I have the following HTML:</p> <pre><code>&lt;div class="section_rows"&gt; &lt;div class="body-row crew"&gt; &lt;input type="text" class="col1" name="cast_person" value="{{cast.person }}"/&gt; &lt;input type="text" class="col2" name="cast_character" value="{{ cast.character }}"/&gt; &lt;input class="ordering" type="hidden" name="cast_ordering" value="{{ cast.ordering }}" /&gt; &lt;a href="#;" class="delete"&gt;X&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And the following jQuery:</p> <pre><code>// drag and drop of cast and crew $('.section_rows').sortable(); $( ".section_rows" ).disableSelection(); </code></pre> <p>Currently, this disables the entire <code>section_rows</code> div container. How would I enabled the <code>input</code>s inside it?</p>
javascript jquery
[3, 5]
347,268
347,269
Understanding "this" keyword
<p><a href="https://github.com/jquery/jquery/commit/6e066a4db72ff6b0d12dd8a43faec0a80e4a1fed#L0L31">In this commit</a> there is a change I cannot explain</p> <pre><code>deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); </code></pre> <p>becomes</p> <pre><code>deferred.done( arguments ).fail( arguments ); </code></pre> <p><a href="https://developer.mozilla.org/en/JavaScript/Reference/Operators/this#section_5">AFAIK</a>, when you invoke a function as a member of some object like <code>obj.func()</code>, inside the function <code>this</code> is bound to <code>obj</code>, so there would be no use invoking a function through <code>apply()</code> just to bound <code>this</code> to <code>obj</code>. Instead, according to the comments, this was required because of some preceding <code>$.Callbacks.add</code> implementation.</p> <p>My doubt is not about jQuery, but about the Javascript language itself: when you invoke a function like <code>obj.func()</code>, how can it be that inside <code>func()</code> the <code>this</code> keyword <strong>is not bound</strong> to <code>obj</code>?</p>
javascript jquery
[3, 5]
809,472
809,473
How to assign the javascript variable value to php variable
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1917576/how-to-pass-javascript-variables-to-php">How to pass JavaScript variables to PHP?</a> </p> </blockquote> <p>I want to assign the javascript variable to php variable </p> <pre><code>$msg = "&lt;script&gt;document.write(message)&lt;/script&gt;"; $f = new FacebookPost; $f-&gt;message = $msg; </code></pre> <p>But it is not working......</p>
php javascript
[2, 3]
5,497,194
5,497,195
global variables in a loaded page
<p>I have my index page which uses a script to load another page into a div </p> <pre><code> $('#TransportPlanning').click(function() { mainpage = $('#FloatMain') mainpage.load('create_diary.php') }); </code></pre> <p>The page loads ok into my div, but I want to share php variables from one page to another, I thought the newly loaded page would be able to reference the main index variables but this is not the case , I have tried global but still not working </p> <p>Any help please ?</p>
php jquery
[2, 5]
2,970,152
2,970,153
Get all multiple listbox values
<p>I have a multiple selection listbox in which I insert items using javascript. At a certain point I need to get the values of all entries (both selected and unselected). I'm currently using this code:</p> <pre><code>&lt;form method="post" action="?page=test" name="something"&gt; &lt;select name="thelist[]" id="selOriginalWindow" size="5" multiple="multiple"&gt; &lt;/select&gt; &lt;input type="button" value="Добави" onclick="openInNewWindow();" /&gt; &lt;input type="submit" value="Get" /&gt; &lt;/form&gt; &lt;? if ($_GET['page']=="test") { $thelist=$_POST['thelist']; var_dump($thelist); } ?&gt; </code></pre> <p>Javascript inserts the values, but PHP only gets the selected items' value. How do I get the value of all of the items in that listbox?</p>
php javascript
[2, 3]
3,025,252
3,025,253
Registration in app right way
<p>I am want to do registration in my app. So i have made all requests to my web service. I now when user is registered. </p> <p>Now i need to save somewhere that he is registered that don't give him registration form again. </p> <p>How to do this ? </p> <p>Do i need to save somewhere in my sqlite database and every time when app lunches check if he is registered user. Or maybe in app settings i could save this information.</p> <p>I am new to developing android app and i am searching for the right way. </p> <p>Thanks all for help.</p>
java android
[1, 4]
101,387
101,388
How do I store a jquery object on a HTML element property?
<p>I have a <code>&lt;select&gt;</code> form element where I create multiple <code>&lt;option&gt;</code> children based on looping through a jQuery array of objects.</p> <p>I want to store each jQuery associated with an <code>&lt;option&gt;</code> on the <code>&lt;option&gt;</code> itself, I guess as a property. So that when I get the change event fired I can pull out the jQuery object which the <code>&lt;option&gt;</code> was based on.</p> <p>I thought I could just set it using attr, serializing the object into JSON, but its not working. Any ideas?</p> <p>Here is some code:</p> <pre><code>// creating the select: (data is a jquery array of objects) $(data).each(function() { var opt = $('&lt;option&gt;&lt;/option&gt;').val(this[id_property]).html(this[label_property]); // preserve the original jquery object on this &lt;option&gt; element: opt.attr('json', JSON.stringify(this)); $(select).append(opt); }); // bind the onchange event, and try to recreate that original jquery object $(select).bind('change', function(event) { // this gives me a ref to the &lt;option&gt; element: var val = $(select).find(":selected"); // now how to get the original jquery object? var item = $(val).attr('json'); }); </code></pre> <p>I want that last line setting var item to the original jquery object - or somehow recreate it. I even tried doing an <code>eval()</code> passing in item since it is JSON formatted but it throws an error.</p>
javascript jquery
[3, 5]
1,465,689
1,465,690
Chnage asp.net button text permanently using Javascript
<p>Hi hope this is an easy one. So help me. i have asp.net button. based upon the input values given to javascript function I want to change the asp.net button value permanently. Even if the page post backs, it should not affect.</p>
javascript asp.net
[3, 9]
2,010,838
2,010,839
Hyperlink inside aspx.cs page
<p>Instead of the following code coming up with messages -</p> <p><code>public partial class mylogin1 : System.Web.UI.Page</code> { <code>protected void Page_Load(object sender, EventArgs e)</code> { <code>if (User.Identity.IsAuthenticated)</code> { <code>if (User.IsInRole("Principal") || User.IsInRole("Teacher")</code>|| <code>User.IsInRole("Student") || User.IsInRole("Solicitor"))</code> { <code>Label wlcm_lbl = (Label)LoginView1.FindControl("Label1");</code> <code>wlcm_lbl.ForeColor = System.Drawing.Color.Black;</code> <code>wlcm_lbl.Text = "Welcome " + User.Identity.Name + ". You are approved to use this website. Please select an Option from the left menu to continue.";</code></p> <p>Instead of this message coming up is there anyway that I can say if Role = teacher go to this page or if role = principle go to this page</p>
c# asp.net
[0, 9]
5,059,404
5,059,405
Show more/less without stripping Html tags in JavaScript/jQuery
<p>I want to implement readmore/less feature. i.e I will be having html content and I am going to show first few characters from that content and there will be a read more link in front of it. I am currently using this code :</p> <pre><code> var txtToHide= input.substring(length); var textToShow= input.substring(0, length); var html = textToShow+ '&lt;span class="readmore"&gt;&amp;nbsp;&amp;hellip;&amp;nbsp;&lt;/span&gt;' + ('&lt;span class="readmore"&gt;' + txtToHide+ '&lt;/span&gt;'); html = html + '&lt;a id="read-more" title="More" href="#"&gt;More&lt;/a&gt;'; </code></pre> <p>Above input is the input string and length is the length of string to be displayed initially. There is an issue with this code, suppose if I want to strip 20 characters from this string: <code>"Hello &lt;a href='#'&gt;test&lt;/a&gt; output"</code>, the html tags are coming between and it will mess up the page if strip it partially. What I want here is that if html tags are falling between the range it should cover the full tag i.e I need the output here to be <code>"Hello &lt;a href='#'&gt;test&lt;/a&gt;"</code> . How can I do this</p>
c# php javascript asp.net jquery
[0, 2, 3, 9, 5]
1,044,664
1,044,665
ArrayList<String> Object assignment
<p>I have two separate objects <code>ArrayList&lt;String&gt;</code> in two separate packages Top and top10. I assign the value of top10 to Top in my activity. And now if I remove an element from Top it also gets removed from top10. I don't know why is this happening? I feel totally dumbfounded. Is there something I don't know about java? Or is it android? </p> <p>This is my activity code:</p> <pre><code>ArrayList&lt;String&gt; Top = new ArrayList&lt;String&gt;(); // ServiceCall is the name of the class where top10 is initialized. Top = ServiceCall.top10; System.out.println("top WR: "+ServiceCall.top10); if(Top.get(0).equals("Please Select")) Top.remove(0); System.out.println("top WR: "+ServiceCall.top10); </code></pre> <p>The second printed out statement has one element less than the one before.</p>
java android
[1, 4]
4,738,715
4,738,716
How to get content from a drop down menu to text field?
<p>I am a new person in this PHP and Javascript. I have a drop down menu as follows. Want to get the content or value to a text field and retain the value after the page refreshs? How will do this?</p> <pre><code>&lt;select name="animal" style="width: 350px;"&gt; &lt;option value=""&gt;Please Select&lt;/option&gt; &lt;option value="Dog"&gt;Dog&lt;/option&gt; &lt;option value="Cat"&gt;Cat&lt;/option&gt; &lt;option value="Cow"&gt;Cow&lt;/option&gt; &lt;option value="Rat"&gt;Rat&lt;/option&gt; &lt;/select&gt; </code></pre>
php javascript
[2, 3]
3,267,149
3,267,150
Select a value from dropdown depending on the value from the Sql table
<p>In the add page i have a dropdown which has got two listitems M and F.I have also got a table which store the value of the dropdown . In the edit page i have got the same dropdown with the same listitems,and i would like to have that value of the dropdown (listitem)selected depending on the value stored in the sql table. Using the code below i get this error:System.NullReferenceException: Object reference not set to an instance of an object.</p> <p>.aspx code</p> <pre><code>&lt;asp:DropDownList ID="DriverGender" runat="server"&gt; &lt;asp:ListItem &gt;M&lt;/asp:ListItem&gt; &lt;asp:ListItem &gt;F&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>.aspx.cs code</p> <pre><code>String SqlSelectDriverDetails = "SELECT * FROM driver WHERE driverID = @IdFromUrl"; //Create SqlCommand object SqlCommand SqlComm = new SqlCommand(SqlSelectDriverDetails, DBConn); //Passing parameters to the sql query SqlComm.Parameters.Add("@IdFromUrl", SqlDbType.Int).Value = ID; //Creating DataReader object SqlDataReader DataReaderObj; DataReaderObj = SqlComm.ExecuteReader(); //if the resultant is not empty while (DataReaderObj.Read()) { string gender = (String)DataReaderObj["gender"]; DriverGender.Items.FindByValue((String)DataReaderObj["gender"]).Selected = true; } </code></pre>
c# asp.net
[0, 9]
65,353
65,354
J-query J-player is not auto playing
<p>I have used jPlayer in my music site .The actual songs data in dynamic.It is been adding on user checks from 10 listed songs on every page.jPlayer is getting added with the playlist but not autoplaying.when i'm clicking manually only it is getting palyed. I tried with playItem= 0,playItem= 1,playItem= 2...etc.,</p> <p>Can any body suggest be about this issue .How to add dynamic playlist and set it play automatically.</p>
php javascript jquery
[2, 3, 5]
252,824
252,825
Put current time date in hidden field
<p>I would like to put the current time/date into a hidden text field with the format 19:19:09 Sep 27, 2011</p> <pre><code> &lt;input type="hidden" name="current_date" value="" readonly="readonly"&gt; </code></pre> <p>Thank you</p>
php javascript
[2, 3]
2,366,918
2,366,919
Android display an image based on a calculation
<p>I have an EditText box where the user inputs a number and 3 TextViews that display the result of some calculations. Instead of showing "2" as the result, I would like to show a specific picture based on the result. i.e. "1"=pic1 "2"=pic2.... </p>
java android
[1, 4]
2,128,336
2,128,337
jquery insertion method
<p>Have a look on this code:</p> <pre><code> $('li').add('&lt;p id="new"&gt;new paragraph&lt;/p&gt;') .css('background-color', 'red'); </code></pre> <p>Although the new paragraph has been created and its background color changed, it still does not appear on the page. To place it on the page, we could add one of the insertion methods to the chain.But what is that method and how to insert it on the chain</p>
javascript jquery
[3, 5]
4,631,559
4,631,560
Is learning C# a better solution for me than learning extensive python frameworks?
<p>I've learned (atleast the basics) of python but it seems frustrating to have to learn every framework in the world to be able to do anything reasonable. Looking at C#, now it could be my ignorance but it seems alot of the tools are included in the whole package (GUI, Networking).</p> <p>This makes me want to switch my primary language to learn to C#. Am I wrong in this analysis or is it pretty much the same process in C# as it is in python learning all these frameworks.</p> <p>Sorry if this question is confusing but I didn't know how to really ask. </p>
c# python
[0, 7]
5,910,390
5,910,391
jQuery - get the index of a element with a certain class
<p>I have a list like this one:</p> <pre><code>&lt;li&gt; .... &lt;/li&gt; &lt;li&gt; .... &lt;/li&gt; &lt;li&gt; .... &lt;/li&gt; &lt;li class="active"&gt; .... &lt;/li&gt; &lt;li&gt; .... &lt;/li&gt; </code></pre> <p>I want to find out the index (number in the list) of the item with the "active" class element. in this case the index would be 4 (or 3 if we're starting from 0) How can I do that?</p>
javascript jquery
[3, 5]