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
122,540
122,541
How do I add response from TextBox? c#
<p>Hi I have created my own control which contains TextBox control as a child control. this textbox has autopostback set on. when the postback is called I dont get any text in request.querrystring. where should I specify text entered into texbox will be send to response ? or is there any easier way of sending this information? I want to have the entered text once again in textbox after postback.</p> <p>thank you</p>
c# asp.net
[0, 9]
463,670
463,671
Show(), Hide() for class works for IE?
<p>I am using one drop down list to determine what is displaed in another. My jquery .show() and .hide() works for firefox and not IE. I am using the class attribute to toggle. How would I do this for IE? Should I use javascript?</p> <pre><code> if (dept == "All") { $('.Sales').show(); $('.Acct').show(); } else if (dept == "Sales") { $('.Sales').show(); $('.Acct').hide(); } </code></pre> <p><strong>EDIT</strong> dept is set to the value of the first drop down list</p>
javascript jquery
[3, 5]
5,714,865
5,714,866
need a solution for this problem
<p>I have parts produced and parts rejected options in my app. My client gave me a condition to put:</p> <p>At any time parts rejected should not be less than the parts produced<br> and<br> You should be able to save even if the parts produced is 0*</p> <p>What do I need to put the condition there to make it successful?</p> <p>Parts produced/rected those are textbox names.</p> <p>The data in the textboxes we can select it from database.</p> <p>Now I have the condition like</p> <pre><code>if (partProduced &lt;= _runtime.PartsRejected) { errorMessage.Append("Parts rejected should not be greater than or equal to parts produced." + Environment.NewLine); } </code></pre> <p>this is the condition I have now I need to change it as my client requirement</p>
c# asp.net
[0, 9]
183,608
183,609
Problems using SQLiteOpenHelper, returns null on create, possible Thread issue
<p>I have a ContentProvider named <em>GeneralDataProvider</em>. Which calls </p> <pre><code>@Override public boolean onCreate() { mDatabaseOpenHelper = new DatabaseOpenHelper(getContext()); return true; } </code></pre> <p>Which looks like:</p> <pre><code>private static class DatabaseOpenHelper extends SQLiteOpenHelper { DatabaseOpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { Log.e("DataBaseOpenHelper", "onCreate()"); //The columns we'll include in the dictionary table //db.execSQL("CREATE TABLE general " + // .. and more } } </code></pre> <p><strong>The problem</strong></p> <p>This works fine as long as I run managedQuery(...) inside an Activity, but when i try to execute the following code in a thread, I get a NullPointerException.</p> <pre><code> public class SyncManager extends Thread { @Override public void run() { mIntent = new Intent(); mIntent.setData(GeneralDataColumns.CONTENT_URI); GeneralDataProvider generalProvider = new GeneralDataProvider(); mCursor = generalProvider.query(mIntent.getData(), GENERAL_PROJECTION, selection, null, GeneralDataColumns.DEFAULT_SORT_ORDER); } } </code></pre> <p>Which is executed from my main activity as such</p> <pre><code> mSyncManager = new SyncManager(); mSyncManager.start(); </code></pre> <p>After digging deeper, it turns out that what causes the NullPointerException is the following line, inside GeneralDataProvider.query().</p> <pre><code> SQLiteDatabase db = mDatabaseOpenHelper.getReadableDatabase(); </code></pre> <p>Since mDatabaseOpenHelper is null.</p> <p>Am I using my ContentProvider in an incorrect manner?</p> <p>What I have tried: Added 'synchronized' to the query()-method inside my GeneralDataProvider</p>
java android
[1, 4]
4,792,786
4,792,787
how to get a variable over to a function?
<p>i want to get a variable (which is set when a link is clicked) over to a function and show it as a pop out.</p> <p>the code as shown below:</p> <pre><code>$('a#link1').click(function(e){ e.preventDefault(); var value = 'true'; }); function exe(){ alert(value); } </code></pre> <p>when the function is executed , all i get is value is undentified.</p> <p>So anyone knows a way around it? </p>
javascript jquery
[3, 5]
4,130,722
4,130,723
js array.length called from variable doesn't work, why?
<p>Here is code that I have copied from w3schools, I have different code, but the problem that I am having still happens in this simplified coding.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;p id="demo"&gt;Click the button to create an array, then display it's length&lt;/p&gt; &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt; &lt;script&gt; function myFunction() { var fruits = ["Banana", "Orange", "Apple", "Mango"]; var foods = ["steak","pizza","bread","fruits"]; var x=document.getElementById("demo"); var y=foods[3]; x.innerHTML= y.length; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When I do <code>x.innerHTML= fruits.length;</code>, I get <code>4</code> back which is what I want to get.</p> <p>But when I call </p> <pre><code>var y=foods[3]; x.innerHTML= y.length; </code></pre> <p>I get <code>6</code> which is the length of the word <code>"fruits"</code> but I want the length of the array <code>fruits</code>.</p> <p>How do I do this?</p> <p>I'm using jQuery, don't know if that affects anything. Do I have to add parenthesis or brackets somewhere?</p>
javascript jquery
[3, 5]
2,804,385
2,804,386
Replace a part of string using jQuery/JavaScript
<p>I have a variable as below</p> <pre><code>var a = "Hi this is test. &lt;img src='http://www.test.com/img1.jpg'&gt; Test ends here"; </code></pre> <p>I want to replace the <code>src</code> of image tag to some other image url lets say <code>http://www.test2.com/img2.jpg</code></p> <p>So the output should be</p> <pre><code>var b = "Hi this is test. &lt;img src='http://www.test2.com/img2.jpg'&gt; Test ends here"; </code></pre> <p>Both the image path would be dynamic.</p> <p>Please help.</p>
javascript jquery
[3, 5]
3,127,358
3,127,359
Jquery not working
<pre><code>(function($) { $(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); }(jQuery)); </code></pre> <p>Tried also</p> <pre><code>$(document).ready(function(){ /*$('body').css('position','relative'); $('body').animate({'left':'-9999px'},3000);*/ alert('hello'); }); </code></pre> <p>And firebug jumps:</p> <pre><code>jQuery is not defined [Detener en este error] }(jQuery)); </code></pre>
jquery javascript
[5, 3]
2,234,478
2,234,479
Inserting characters into a string - most efficient
<p>I need to insert a character into a string, A, every place there is a character B.</p> <p>For example xxxxxxxxBxxxxxxxxxxxxxxxxxBxxxxxxxxxxxxB</p> <p>becomes</p> <p>xxxxxxxxxxxABxxxxxxxxxxxxxxxABxxxxxxxxxxxxxxxxxxxAB</p> <p>I see that Javascript (replace) and PHP (str_replace) have replace functions, so that I can just replace each occurence of B with AB.</p> <p>Is this the most efficient way to do this?</p>
php javascript
[2, 3]
3,204,149
3,204,150
What's wrong with this code?
<p>For some reason, every piece of code that's below this snippet won't run...</p> <p>I don't see anything wrong with it ...</p> <pre><code>window.navigationDropdownTimeout = 0; $(".navigation li.expanded &gt; a").hover(function(){ clearTimeout(window.navigationDropdownTimeout); $(".navigation ul ul.menu").hide(); currentSubnav = $(this).next(); currentSubnav.fadeIn(); currentSubnav.hover( function(){ clearTimeout(window.navigationDropdownTimeout); $(this).fadeIn("fast"); }, function(){ thisHere = $(this); window.navigationDropdownTimeout = window.setTimeout(function(){thisHere.fadeOut("fast");},1500); }); }); </code></pre>
javascript jquery
[3, 5]
1,957,789
1,957,790
am getting an error Microsoft JScript runtime error: 'Array' is undefined
<p>Microsoft JScript runtime error: <code>'Array'</code> is undefined</p> <pre><code>var Page_Validators = new Array(document.getElementById("rfvOthers"), document.getElementById("rfvREJECT_REASON_COMMENTS")); </code></pre> <p>Can Anybody Tell me what may be the solution for this</p> <p><strong>Update</strong><br> on click of button am using the Following Function that cause the issue<br> it works fine in ie8 while it cause error in ie 9</p> <pre><code>function ClientValidation() { if ($("#hidTabValue").val() == "15268") { $("#trOthers").show(); ValidatorEnable(document.getElementById('rfvOthers'), true); ValidatorEnable(document.getElementById('rfvREJECT_REASON_COMMENTS'), false); $("#trREJECT_REASON_OTHER").hide(); $("#hidOther").val($("#txtOthers").val()); } } </code></pre> <p>Am Hiding the Asp.net Required field Validator on Condition basis and Face this Error</p>
javascript jquery asp.net
[3, 5, 9]
5,682,074
5,682,075
php force download on mobile browsers
<p>I'm trying to force download a image file (jpg for example) using php. So I have a script here <strong>force.php</strong> and here would be the code:</p> <pre><code>header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header('Content-Description: File Transfer'); header("Content-Type: image/jpeg"); header('Content-Length: ' . filesize($file)); header('Content-Disposition: attachment; filename=test.jpg'); readfile($file); </code></pre> <p>Now the problem is for some browsers (mobile phone browsers especially), it'll work properly and prompt test.jpg for the user to save. However on some browser, it'll prompt force.php as download. Any solution?</p> <p>Thank you!</p>
php android
[2, 4]
5,922,215
5,922,216
Homepage image slider stops working on horizontal scrolling website
<p>I've been working on a site found here: </p> <p><a href="http://www.myheavenbridal.com.au" rel="nofollow">http://www.myheavenbridal.com.au</a></p> <p>I have a JS problem where the homepage slider stops working once clicking the main navigation links.</p> <p>ie/ clicking on 'Contact Us' will slide over to the contact page - then clicking back on the 'Home' button returns the user to homepage, however the slider stops loading images.</p> <p>Any help as to why this is happening or how to fix it would be much appreciated.</p>
javascript jquery
[3, 5]
1,374,951
1,374,952
jQuery - Animate & Time interval
<pre><code>&lt;script&gt; $(document).ready(function() { $.get("database.php", function(data){ var xp = data + "%"; $('#exp_bg').animate({ width: xp }, 1500, function() { }); }); }); &lt;/script&gt; </code></pre> <p>Database.php:</p> <pre><code>&lt;?php $xp = 50; $level = 100; $xp_percent = $xp * 100 / $level; echo $xp_percent; ?&gt; </code></pre> <p>What i'm trying to do, is that if $xp_percent increases in database.php, then #exp_bg's width will animate into desired width without refresh.</p> <p>I tried to do that with time interval, which takes data from database.php every speciefed interval of time, but i failed doing that. </p> <p>Could anyone help me with that?</p>
php jquery
[2, 5]
1,504,856
1,504,857
Passing value from JScript to ASP.NET Control
<p>I am trying to pass a value from a JScript function to an ASP.NET Control but I am not able to make it work. What am I doing wrong here:</p> <p>aspx.cs</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication5._Default" %&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 runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; function saveMyData() { var myData = "TestData"; var hiddenInput = document.getElementById('&lt;%=HiddenField1.ClientID %&gt;'); hiddenInput.Value = myData; } &lt;/script&gt; &lt;/head&gt; &lt;body onload="javascript:saveMyData();"&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt; &lt;br&gt;&lt;input type="submit" value="Press Me!"&gt;&lt;br&gt; &lt;--New Code &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Code Behind:</p> <pre><code>using System; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; namespace WebApplication5 { public partial class _Default : Page { protected HtmlInputHidden HiddenField; protected void Page_Load(object sender, System.EventArgs e) { string value = HiddenField1.Value; } } } </code></pre> <h1>**UPDATE**</h1> <p>I added in a Submit button but I am still not able to assign the myData Value to the Hidden Control, any thoughts?</p>
c# javascript asp.net
[0, 3, 9]
4,587,645
4,587,646
Android - Black Screen after clicking BACK in an Activity with an AltertDialog after Search Activity
<p>I have an Activity which displays an alert dialog priot to the content. Also a search activity is called before this activity.</p> <p>Now when i press back on this activity i am lead to a black screen (which i assume is eighter because of the dialog [unlikely] or from the search activity). Only when i press BACK twice i get to the activity i was before.</p> <p>How can i get rid of this?</p> <p>Thank you.</p>
java android
[1, 4]
4,436,352
4,436,353
ASP.NET javascript. Put it in code behind or put it in .aspx file?
<p>Why do people put javascript in the code behind ? I think it is ugly to have 100 (see below) of these.... Is there some basic reasons that javascript must be in the code behind in some instances? And when it should in the aspx. ?? </p> <pre><code> // now we gotta recalc fields szCalcBenefitsTotal += " CalcCostFromPct('" + tbSocialSecurityPercent3.ClientID + "', '" + tbSocialSecurity3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbMedicarePercent3.ClientID + "', '" + tbMedicare3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbHealthInsurancePercent3.ClientID + "', '" + tbHealthInsurance3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbLifeInsurancePercent3.ClientID + "', '" + tbLifeInsurance3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbVacationPercent3.ClientID + "', '" + tbVacation3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbSickLeavePercent3.ClientID + "', '" + tbSickLeave3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; szCalcBenefitsTotal += " CalcCostFromPct('" + tbRetirementPercent3.ClientID + "', '" + tbRetirement3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');"; </code></pre>
asp.net javascript
[9, 3]
4,516,907
4,516,908
Link button control using asp.net
<p>I have set of link buttons in my masterpage and one button in my content page. i want when i click the any one of link button in the masterpage the value in the content page will change. How i can do this. Can any one able to help me because i am new in asp.net Thank you </p>
c# asp.net
[0, 9]
6,032,691
6,032,692
Validate youtube and other video site url
<p>i want to provide a option for user to add video from the following video sites </p> <ol> <li>Dailymotion</li> <li>Metacafe</li> <li>YouTube - <a href="http://stackoverflow.com/questions/3452546/javascript-regex-how-to-get-youtube-video-id-from-url/4811367#4811367">Javascript REGEX: How to get youtube video id from URL?</a></li> <li>Google Video</li> <li>Hulu</li> <li>Yahoo! Video</li> <li>Vimeo - <a href="http://stackoverflow.com/questions/2916544/parsing-a-vimeo-id-using-javascript">Parsing a Vimeo ID using Javascript?</a></li> <li>MySpace Videos</li> </ol> <p>So would like to validate the data both in javascript as well as php. Do the url structure of these site change or they stay usually constant . Any suggestions are welcome . </p> <p>EDIT: I have got some solution for a few and i have update the question . I want for others preferably Regex solution </p>
php javascript
[2, 3]
4,525,648
4,525,649
Android - BroadcastReceiver inside a thread
<p>Is it possible to have broadcastReceiver running inside a thread (just broadcastReceiver)? As far as I know, this can't be done unless there is a way to keep the thread alive (even tough there is no work). Please correct me if I'm wrong.</p> <p>This is what I want to do: I have a client and a server program that run without knowing when anyone of them will be ready. The client will keep trying to send a request to the server while at the same time monitoring a reply from the server. Upon receiving a reply from the server, that means the server is online. </p> <p>I have tried to use thread (on the client) to keep sending a request to the server with a periodical sleep. And then have the client main thread to do a while loop with a periodical sleep (hoping to catch a reply when there is a broadcast from the server). Unfortunately, this does not work. </p> <p>The client extra thread has been verified to send a request, the server has send a reply, but for some reason the client main thread does not receive anything. Implementation of the broadcastreceiver on both server and client have been verified to work, so that's not the issue.</p> <p>Anyone has a better solution/approach for this problem? </p>
java android
[1, 4]
4,463,576
4,463,577
iFrame scrollTop on a non-local domain
<pre><code>$("#topofpage").click(function() { $("#iframe_display").scrollTop(); }); </code></pre> <p>This doesn't work, it says 'permission denied'. The URL must reside in the same domain for only <code>scrollTop</code> to work? Why is this? Is there any way around it? </p> <p>How about using server side code using .load instead or something ?</p>
javascript jquery
[3, 5]
4,767,926
4,767,927
Why does this super simple jquery not work?
<p>I'm having hard time getting this snippet to work. I have made a minimal example. You can view it online: <a href="http://jsfiddle.net/qnnZe/" rel="nofollow">http://jsfiddle.net/qnnZe/</a> where it is <strong>working!</strong></p> <p>test.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;meta charset="utf-8"&gt; &lt;script src="jquery.min.js"&gt;&lt;/script&gt; &lt;script src="test.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;I am going to test right now.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>test.js</p> <pre><code>$("p").click(function () { $(this).hide("slow"); }); </code></pre> <p>However, <strong>on my server it does not work</strong>. Here is the link to my server: <a href="http://techinf.de/sleepytime/test.html" rel="nofollow">http://techinf.de/sleepytime/test.html</a></p> <p>As always, any help appreciated.</p>
javascript jquery
[3, 5]
3,039,637
3,039,638
Using C++ dll having header file in C#
<p>I am totally new in c++ and I want to use C++ dll (having header file) in c# program. </p> <p>please find below header file. </p> <pre><code>#pragma once #define DAILY_PERIOD 24*60 #define MIN_PERIOD 1 #ifdef API_DLL #define METHOD_TYPE __declspec(dllexport) #else #define METHOD_TYPE __declspec(dllimport) #endif struct Quote { unsigned long Date; float Price; float Open; float High; float Low; float Volume; float OpenInterest; }; class METHOD_TYPE CMinuteApiCallback { public: virtual int quote_notify( const char* symbol, int interval, int nMaxSize, Quotation *pQuotes, unsigned long echo)=0; }; class METHOD_TYPE CMinuteApi { public: CMinuteApi(void); int Initialise(char *serialkey, CMinuteApiCallback* callback); int GetQuote(char * symbol, int periodicity, unsigned long lasttimeupdate, unsigned long echo); int DeleteQuote(char * symbol, int periodicity); ~CMinuteApi(void); }; </code></pre> <p>So please let me know how can I call all these methods in my c# program.</p>
c# c++
[0, 6]
5,672,495
5,672,496
Equivalent of Runtime class (of java) in c#
<p>Is their is an Equivalent of Runtime class (of java) in c# Actually I am trying to convert these operation to c#</p> <p>Runtime runtime = Runtime.getRuntime(); return runtime.totalMemory() - runtime.freeMemory();</p>
c# asp.net
[0, 9]
1,184,864
1,184,865
How to I re-enable the ability to select an element in ie and firefox?
<p>I have used the following script to disable the highlighting of script on a table...</p> <pre><code>function disableSelection(target) { if (typeof target.onselectstart != "undefined") //IE route target.onselectstart = function () { return false; }; else if (typeof target.style.MozUserSelect != "undefined") //Firefox route target.style.MozUserSelect = "none"; else //All other route (ie: Opera) target.onmousedown = function () { return false; }; target.style.cursor = "default"; } </code></pre> <p>I want to be able to reverse the effects of the above method so that when a user clicks on an input in a td they can select all the text using the jQuery.select() method.</p> <p>I dont really understand how to reverse the effects when I tried...</p> <pre><code>function enableSelection(target) { if (typeof target.onselectstart != "undefined") //IE route target.onselectstart = function () { return true; }; else if (typeof target.style.MozUserSelect != "undefined") //Firefox route target.style.MozUserSelect = "none"; else //All other route (ie: Opera) target.onmousedown = function () { return false; }; target.style.cursor = "default"; } </code></pre> <p>It doesnt work, I get object not found errors in IE. Hope someone can help this is for an important bit of work that I have to get done for the weekend.</p>
javascript jquery
[3, 5]
2,915,829
2,915,830
Android querying external MySQL database
<p>I had some problem understanding the following line of code. What exactly does it do and how does it help me query the database from android </p> <pre><code>$q=mysql_query("SELECT * FROM people WHERE birthyear&gt;'".$_REQUEST['year']."'"); while($e=mysql_fetch_assoc($q)) $output[]=$e; print(json_encode($output)); </code></pre> <p>I know the initial part of it means select every record from table people where birthyear...</p> <p>But after that I get confused. I am calling this php function from android using http post</p> <pre><code>ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("year","1980")); HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.0.2.2/retrieve.php"); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); is = entity.getContent(); </code></pre> <p>Where is an input stream. Can someone help me out? </p>
php android
[2, 4]
3,001,155
3,001,156
How can I set the right parameters of dataset.Table[0].Compute(string expression,string filter)?
<p>I can not get the right result from the following code block:</p> <pre><code>object ob = ds_bug.Tables[0].Compute("Count(id)",str_vertical +"= '"+"' and "+str_horizontal+" = '"+first_row.Cells[j].Text.ToString()+"'");// ds_bug has been filled some data. </code></pre> <p>str_vertical and str_horizontal are two fields from the ds_bug.Tables[0], and I can see their values are right too when I debug the code.</p> <p>Is there any problem I set the filter with a string like " a = '##' and b = '##' " ?</p>
c# asp.net
[0, 9]
115,683
115,684
select list title is not showing on mouse hover
<p>I created a Select list and applied jquery UI <code>selectmenu plugin</code> like:</p> <pre><code> &lt;select id="test" title="This is not showing on mouse hover"&gt; &lt;option..&gt; &lt;/option&gt;.. &lt;/select&gt; $("#test").selectmenu(); </code></pre> <p>Now my problem is that the <strong>title</strong> which i gave to my <code>select list</code> is not showing on mousehover. Whats the problem ?</p>
javascript jquery
[3, 5]
930,808
930,809
Get list of Non System Applications
<p>I'm able to get a list of installed packages using the package manager, but this includes various system packages . Are there any filters i can apply on this list to only show the apps that would show up when bringing up the application list from the home screen?</p>
java android
[1, 4]
327,628
327,629
How to add a Drawable to WebView
<p>Json</p> <pre><code> { "text": " «Le président du Bloc du Changement et de la Réforme", "imagepath": "http://www.example.com/dori%20chamoun-saidaonline.jpg" } </code></pre> <p>I get the text and fetch image from url as drawable </p> <pre><code> introtext = jArray.getString("introtext"); </code></pre> <p>and</p> <pre><code> InputStream is = bufferedHttpEntity.getContent(); Drawable image = Drawable.createFromStream(is, "src"); </code></pre> <p>My problem is, i want to display both the image and text in same WebView.</p> <p>any help?</p>
java android
[1, 4]
5,771,251
5,771,252
Dynamically loading aspx page
<p>I found two methods for loading page html dynamically for aspx but only issue is that my txt file is on another server and required to method ask for virutalpath or physical path on webserver.</p> <p>Is there any way so I can load from azure from url not from filepath or if i can pass only string to PageParser or BuildManager.</p> <p>Error:</p> <pre><code>The relative virtual path 'http:/tplexcontent.blob.core.windows.net/commonresources/test123.txt' is not allowed here. </code></pre> <hr> <pre><code> protected void Page_Load(object sender, EventArgs e) { //Method 1 var pageView = PageParser.GetCompiledPageInstance("/Page2.aspx", "http://tplexcontent.blob.core.windows.net/commonresources/test123.txt", HttpContext.Current); (pageView).ProcessRequest(HttpContext.Current); //Method 2 LoadPage("http://tplexcontent.blob.core.windows.net/commonresources/test123.txt"); } public static void LoadPage(string pagePath) { // get the compiled type of referenced path Type type = BuildManager.GetCompiledType(pagePath); // if type is null, could not determine page type if (type == null) throw new ApplicationException("Page " + pagePath + " not found"); // cast page object (could also cast an interface instance as well) // in this example, ASP220Page is a custom base page _Default pageView = (_Default)Activator.CreateInstance(type); // call page title pageView.Title = "Dynamically loaded page..."; // process the request with updated object ((IHttpHandler)pageView).ProcessRequest(HttpContext.Current); } </code></pre>
c# asp.net
[0, 9]
5,170,833
5,170,834
Is it possible to disable all the physical phone buttons?
<p>I am developing a security apps, when the phone is lost or stolen, the phone screen is locked automatically and if the theft tries to login to the phone by randomly enters password, the phone will record until 3 failed attempts.</p> <p>After 3 failed attempts, the current layout will change to a black layout with nothing inside the layout, and I will set the timer for this layout, during this layout no any key can wake this layout up unless the timer is expired. I have successfully implement the timer but when I pressed the back button on the phone the layout back to the login layout. How can I disable all the phone buttons? Is it possible? Thanks</p>
java android
[1, 4]
3,173,605
3,173,606
jQuery: Rotate images using a button
<p>I am trying to rotate 2 images. For now, I have this code:</p> <pre><code>$('img').on({ 'click': function () { var src = ($(this).attr('src') === 'img1_on.jpg') ? 'img2_on.jpg' : 'img1_on.jpg'; $(this).attr('src', src); } }); </code></pre> <p>It works perfectly: when I click on an image, the other appears. What I would like to do is exactly the same, but using a button to rotate the images, and not click on the image itself.</p>
javascript jquery
[3, 5]
2,508,970
2,508,971
Message Alert Tone
<p>I am working on an App that gets sms alerts and would like to control volume of alert tone based on device volume. How do I adjust alert notification sound in alignment with device master volume. Following code doesn't change volume of alert in my app based on device volume. Thank you.</p> <pre><code> volume = audioMan.getStreamVolume(AudioManager.STREAM_RING); mPlayer.setVolume(volume, volume); </code></pre>
java android
[1, 4]
4,561,880
4,561,881
JQuery: get the element that's on the middle of the visible screen, while scrolling the page
<p>I need to know if there is a way I can determine if a div is in the center of the screen.</p> <p>My HTML is as bellow:</p> <pre><code>&lt;div id="container"&gt; &lt;div class="box" id="box0"&gt; text &lt;/div&gt; &lt;div class="box" id="box1"&gt; text &lt;/div&gt; ..... &lt;div class="box" id="box100"&gt; text &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Is there a way to determine when a div will be in the center of the visible screen, considering that the page is scrollable? So basically, when the user is scrolling down the page, the div that's in the middle of the visible screen should be selected.</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,664,979
2,664,980
Confirm dialog (Alert) inside AsyncTask
<p>So I have a long process running inside AsyncTask but it might need to confirm something from user while processing, I know how I can show confirm dialog but how to retrieve the output and keep wait till use confirms.</p> <pre><code>this.runOnUiThread(new Runnable() { public void run() { boolean output = ConfirmUser(message); } }); </code></pre>
java android
[1, 4]
609,570
609,571
extending jquery issue
<p>I was reading this source code and there seems to be error. can anybody say what is happening</p> <pre><code>var JX = { extend: function(bc, sc, o) { var f = function() {}; f.prototype = sc.prototype; bc.prototype = new f(); bc.prototype.constructor = bc; bc.superclass = sc.prototype; for (var m in o) bc.prototype[m] = o[m]; } }; JX.Component = function() { JX.Component.superclass.init.apply(this, arguments); }; JX.extend(JX.Component, jQuery, {}); $(document).ready(function() { var mydiv = new JX.Component(document.createElement('div')); mydiv.text("Hello World").click(function(){alert("You Clicked Me!")}); mydiv.appendTo(document.body); alert("heee"); }); </code></pre> <p>after appendTo there is a error</p>
javascript jquery
[3, 5]
1,149,363
1,149,364
How can I set timeout for redirected or for new opened page on other server?
<p>I want to redirect my page to other page like to google.com or to open google.com as additional page in the browser.</p> <p>There is any way to close other opened google-page (if it was opened as a new page) or return to my page (if my page was redirected to google-page) after 10 minutes of timeout?</p> <p>I tried with $_SESSION, it didn't work. Any ideas? Thanks.</p>
php javascript jquery
[2, 3, 5]
5,961,499
5,961,500
jQuery plugin for textarea with options of inserting special characters
<p>I am looking for jQuery plugin that has options of selecting different fonts, gives different options to user to insert special characters. Please let me know if it is possible through some other javascript or html code</p>
javascript jquery
[3, 5]
1,655,876
1,655,877
Upon Submitting a Button, Replacing RatingBar with a TextView?
<p>I have a Ratings Bar that allows users to vote. I want them to select the star total on the bar, hit a button to submit, and upon submitting , the Ratings Bar is replaced by a TextView that says something like "Thank you for voting!" </p> <p>How can I do this in Java code?</p> <p>Also, for bonus points, is there a quick way to make this a transition. Maybe the textview fade in?</p>
java android
[1, 4]
5,153,402
5,153,403
redirect to an image
<p>Why can't I redirect page to a image for example:</p> <pre><code>Response.Redirect("http://www.domain.com/images/image.gif"); </code></pre> <p>This doesn't show me the image. Also placing conten type image/gif doesn't show the image.</p>
c# asp.net
[0, 9]
5,018,350
5,018,351
clearing the content of the html editor
<p>i do have text-box and two check boxes which i am able to clear its values on button click: </p> <pre><code>$("#cleartext").live('click', function () { $(this).parents('form').find('input[type="text"]').val(''); $(".check").attr("checked", false); }); </code></pre> <p>but i do have a textarea in which i am using the html editor but i am not able to clear the value of it so please suggest me on this the view of this elements are as follows:</p> <pre><code> &lt;input type="text" id="title" name="title" required title="required" placeholder="title" data-bind="value:title" /&gt; &lt;input type="checkbox" id="active" name="active" class="check" data-bind="checked: active=='true'" /&gt;Active &lt;input type="checkbox" id="logon" name="logon" class="check" data-bind="checked: use_logo=='true'" /&gt;Logo &lt;textarea id="iiii" name="iiii" class="htmleditor" rows="9" cols="50" style="width: 600px; height: 190px;"&gt;&lt;/textarea&gt; &lt;button type="button" class="btn" id="cleartext"&gt;New Contract&lt;/button&gt; </code></pre>
php jquery
[2, 5]
3,380,844
3,380,845
Get Touch Coordinates Relative To A View (ScreenToClient Equivalent?)
<p>I have an image I am displaying to a user in my android application.</p> <p>I want to be able to tell where they 'touch' the image.</p> <p>I can easily get the screen coordinates by implementing an OnTouchListener</p> <pre><code> private OnTouchListener image_Listener = new OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_UP) { float x = event.getX(); float y = event.getY(); return true; } return false; } }; </code></pre> <p>However, these are absolute coordinates. What I really need is a function to convert this into coordinates relative to a View..</p> <p>I have done a bit of digging, but I can't seem to turn up anything, aside from me trying to implement a ScreenToClient method myself..</p> <p>Does anyone know of a good solution to this, or am I just going to have to roll my own?</p> <p>It seems like the kind of method that would be available - that's why I'm asking.</p> <p>Thank you all for your time.</p> <p>EDIT: I'm not so sure that the coordinates aren't already relative to the view. I could have swore reading that coordinates were absolute, but after some tinkering - I have things working as I expected.. Sorry for the noise guys.</p>
java android
[1, 4]
5,866,812
5,866,813
asp:menu in safari and chrome
<p>I have seen some posts of the asp:menu and the browsers Chrome and Safari here, but nevertheless, I think the problem that I have is different than other problems.</p> <p>I am using the following code in order to display the menu:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (Request.UserAgent.IndexOf("AppleWebKit") &gt; 0) { Request.Browser.Adapters.Clear(); } ... } </code></pre> <p>However, the problem is still there if I start the browsers for the very first time, the menu is displayed vertically instead of horizontally. After a page refresh, the menu works fine... How is that possible? Or is the problem that simple,and I need to place the code in somewhere earlier (eg Page_PreInt).</p> <p>Thanks in advance, Patto</p>
c# asp.net
[0, 9]
2,280,698
2,280,699
Android/Java - Issue
<p>The code is like this:</p> <pre><code>private DatabaseHelper mOpenHelper; @Override public boolean onCreate() { mOpenHelper = new DatabaseHelper(getContext()); System.out.println("done"); return true; } </code></pre> <p>Now Eclipse is showing me an <strike>error</strike> warning on the first line of this code "private DatabaseHelper mOpenHelper", that the object mOpenHelper is not used anywhere, whereas in the very next lines of code, I am initializing it. Please tell me why is this happening?</p> <p>Thanks,<br> -D</p>
java android
[1, 4]
5,521,884
5,521,885
Javascript interaction between ASP.NET web controls
<p>I have a UserControl A which contains </p> <ul> <li>a dropdown</li> <li>a placeholder</li> </ul> <p>At runtime the placeholder will be populated with some UserControl B.</p> <p>There are certain times which I need to trap the javascript onchange event in the dropdown to call a javacript function in B (to do a clientside update of B). What is a good design/practice for how to do this? </p> <p>The naive way is to make the asp:dropdownlist a public member then send it into a public method of B:</p> <pre><code>// In controlling code ... userControlB.Initialize(userControlA.TheDropDownList); ... // In usercontrol B public void Initialize(DropDownList dropdownFromA) { dropdownFromA.Attributes.Add("onchange", "myBfunction()"); } </code></pre> <p>But something smells bad with this approach. I would like to keep A and B as loosely coupled as possible. Any better ideas?</p>
asp.net javascript
[9, 3]
2,495,606
2,495,607
Using javascript and $_SESSION's to record wanted user information over pagination
<p>What I have so far is a paginated page, showing all users in a database system. Each page shows 30 users and has a checkbox next to each user, what I need is a way for users to select and deselect these users and for these selections to propagate through, so if the user goes back to page 1 from page 2, all users from page 1 will still be checked.</p> <p>I also need a way to record this information, so that once the user has looked at all the pages and clicks a submit form all checked users information can be processed. I am thinking of using javascript to record the information and php sessions to store it, but with the way I am trying now, when a user clicks a checkbox, it is not ticked.</p> <p>Does anyone have a better way of doing this/see how I can fix this problem?</p> <p>Thanks.</p> <pre><code>&lt;script type="text/javascript"&gt; function log_export($str) { document.check.data.value = $str; document.check.submit(); } &lt;/script&gt; &lt;?php if(isset($_POST['data'])) { echo $_POST['data']; } ?&gt; &lt;form name="check" method = "post" action = ""&gt; &lt;input type="hidden" name="data"&gt; &lt;input type="checkbox" name="A" onclick="log_export('1')" /&gt; &lt;input type="checkbox" name="B" onclick="log_export('2')" /&gt; &lt;input type="checkbox" name="C" onclick="log_export('3')" /&gt; &lt;/form&gt; </code></pre>
php javascript
[2, 3]
4,518,894
4,518,895
how to upload folder to server in asp.net c#
<p>I think the Folder upload is supported java applet. But how can i use java applets in Asp.net c# Please tell me about this, without the Flash and silverlight.</p>
c# asp.net
[0, 9]
4,102,858
4,102,859
org.apache.commons.net.nntp crashing android
<p>Hay Guy, I'm using org.apache.commons.net.nntp to connect to a nntp server, however running a simple nntp.connect(host, port) crashes the android.</p> <p>Anyone got any ideas? Do java packages work with android straight out of the box? or do they need editing?</p> <p>Thanks</p> <pre><code>import org.apache.commons.net.nntp.*; public class newsdroid extends Activity { NNTP usenet; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { usenet.connect("ssl-eu.astraweb.com", 563); } catch (SocketException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } </code></pre>
java android
[1, 4]
5,693,169
5,693,170
android application can run on emulator fine but very slow when run on android phone
<p>My developed android application can run on emulator fine but when I export it to .apk and install to my galaxy S it very slow to show any content.</p> <p>My application have to connect with web service and database that run on localhost. I try to move web service and database to another host that faster but it doesn't solve my problem. Any one can suggest me what should I do? </p> <p>Thank you for any suggestion.</p> <p>Ps. I develop my application by using Java with Eclipse and Tomcat</p>
java android
[1, 4]
4,774,609
4,774,610
Bindind Repeater to Stack List
<p>Here is code. Its not showing any compile or run time error. I debugged also then till data binding works fine. But then also controls not shown in web page!</p> <p>Sample.aspx:</p> <pre><code> &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:PlaceHolder ID="_placeHolder1" runat="server"&gt; &lt;/asp:PlaceHolder&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>Sample.aspx.cs:</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { _placeHolder1.Controls.Add(CreateReapeater()); } private Control CreateReapeater() { Repeater _repeater1 = new Repeater(); Stack _stack1 = new Stack(); for (int i = 0; i &lt; 7; i++) { _stack1.Push(i); } _repeater1.DataSource = _stack1; _repeater1.DataBind(); return _repeater1; } </code></pre>
c# asp.net
[0, 9]
2,147,291
2,147,292
Open save as dialog on newly opened window
<p>How in JS/jQuery do I pop open the "Save As" dialog for a newly opened window. Basically I am scraping some data off of a web page. As such I am opening a new window via:</p> <pre><code>dataWindow = window.open('blank','dataWindow'); </code></pre> <p>I then write the output to the blank window but I want to automatically pop open the "Save As" dialog to save the content of the window to a file (text/csv). How would I do this. I tried:</p> <pre><code>dataWindow.document.execCommand("saveAs",true,".txt"); </code></pre> <p>but it doesn't seem to do anything.</p>
javascript jquery
[3, 5]
5,564,453
5,564,454
How to make sure all elements contain a specific class in jQuery?
<p>I need to check to make sure that all certain elements that are children of their parent container have a specific class. Can someone tell me how to do this in jQuery?</p> <p>if all paragraph tags of div tag have the class "correct"</p> <p>-> yep, all of them have the class</p> <p>otherwise, not all paragragh tags in div tag have that class</p> <p>-> noope, they all do not have the required class</p>
javascript jquery
[3, 5]
4,056,800
4,056,801
Options Menu on Spinner
<p>I'm looking for a way to add items to a spinner from within the spinner item list dialog.</p> <p>Ideally, I could hit the menu button and select an option to add, prompt the user with an edittext dialog and update the item list. Is there a way to make the options menu accessible on a dialog?</p> <p>I thought I might need to create an activity but then how do I make it look like a spinner item list dialog and how would I get it to show up when the spinner is clicked?</p> <p>All I'm trying to do is add an unobtrusive way to launch a prompt to add items to the spinner item list from within the dialog. Any ideas?</p>
java android
[1, 4]
2,324,524
2,324,525
How to tell if obj is jquery or plain javascript
<p>This is probably a stupid question but is there a way to tell programmatically if the object is jquery or just plain javascript?</p> <p>For example:</p> <pre><code>Utils.Listbox.MoveItemsUp = function(listbox) { if(listbox.isJquery()) { listbox.each(function(){}); } else { for(var i = 0; i &lt; listbox.options.length; i++){} } }; </code></pre>
javascript jquery
[3, 5]
1,003,012
1,003,013
How to detect if a click() is a mouse click or triggered by some code?
<p>How to detect if a click() is a mouse click or triggered by some code?</p>
javascript jquery
[3, 5]
4,543,965
4,543,966
password regex validation
<p>I'm trying to get one regex that'll do the following:</p> <ul> <li><p>Min length's 6 and max. length 8</p></li> <li><p>No white-space characters</p></li> <li><p>There is at least one alphabetic character and numeric character</p></li> <li>Not contains Turkish character (ı,ö,ğ,ç,ş,ü)</li> </ul> <p>Exp (valid pass) ; tester1, TESTER1, 12345a, invalid pass ; tester*,tester%</p> <p>I've this regex : <code>^.*(?=^.{6,8}$)(?=.*[a-z])((?=.*\d)|(?=.*[A-Z])|(?=.*[\W])).*$</code></p> <p>Can somebody show and teach me how to do this?</p>
c# asp.net
[0, 9]
5,968,014
5,968,015
UI design suggestions for Display and Switching between Multiple Layouts
<p>I'm trying to create an app that offers the user 3 different kinds of layouts. The only common portion for all 3 would be the TextView (located at the top) that would display information specific to the currently displayed layout and 3 buttons to select the required layouts.</p> <p>Is there some way we can create this UI in XML to keep only one constant part(the upper TextView) and dynamically display any one of the 3 layouts below it? Would it be better to create separate XML's for each of the layouts (each including the upper TextView in them)? OR would doing this via code be better?</p> <p>Fast switching between the 3 layouts is important.</p> <p>Appreciate any insights on this.</p> <p>TIA</p> <p>[EDIT 1] Actually they are 3 different layouts, with several "child" layouts and views within each of them. Could a ViewFlipper be used for switching between these? I was thinking that a ViewFlipper was only for switching between View elements?</p> <p>I do have them in individual XML's right now but am looking for some way to load and unload them fast. Not sure how to do the hiding thing, will try reading up on that. [/EDIT 1]</p>
java android
[1, 4]
120,574
120,575
How to pass dynamic id text box value to another page without refreshing with jquery and php
<pre><code>$('.btncomment').click(function () { var id = $(this).attr('id'); $.post('SaveTopicInformation.php', { tid: commentform.(topic_ + id).value, topicdetail: commentform.(topicdetail_ + id).value, userid: commentform.(user_ + id).value }); }); </code></pre> <hr> <p>I have to pass the 3 text box value to another page. First of all, I display the all the record from database. then, I have comment link for each row. I like to give comment and save the comment for eache record. I use by jquery and php. please help me out. I can't finger out how to pass dynamic text box's value by bynamic name.</p>
php jquery
[2, 5]
4,261,116
4,261,117
e.which ENTER key enabled only if input field focus
<p>I am using a e.which of jquery for running a function on press of ENTER, but I want this function to be called only if the particular input field is focused (where the cursor is blinking).</p> <p>My current jquery function.</p> <pre><code>$(document).keyup(function(e) { if (e.which == 13) { var page = $("#userpage").val(); if(page &gt; 0) { $("#search").click(); } else { $('.save').click(); } } }); </code></pre> <p>I want that <strong>$("#search").click();</strong> to be called only if the <strong>#search_text</strong> is focused or has some input, because I have few more input fields and users tend to press enter, and on Enter this function is called.</p> <p>Thank You.</p>
javascript jquery
[3, 5]
84,406
84,407
Check Date and Display Until Event Date
<p>I want to list an event in the sidebar and have it automatically disappear on the day after the event.</p> <pre><code>&lt;h6&gt;Next Meeting&lt;/h6&gt; &lt;dl id="nextmeeting"&gt; &lt;dt&gt;&lt;a href="members-meetings.html"&gt;Oct 15, 2011&lt;/a&gt;&lt;/dt&gt; &lt;dd&gt;La Quinta Inn &amp; Suites&lt;/dd&gt; &lt;dd&gt;303 Blum, San Antonio&lt;/dd&gt; &lt;/dl&gt; </code></pre> <p>So, on October 16th, I want that info to be hidden. I am sure there is a simple PHP or JavaScript solution.</p> <p>Thanks in advance.</p>
php javascript
[2, 3]
5,975,899
5,975,900
how to use bind() instead of live()?
<p>I'm trying to understand how to use bind in jquery.</p> <p>I have a page which, after a button press, does the following code:</p> <pre><code>var html = []; html.push('&lt;select name="weddingturn" id="weddingturn"&gt;'); var a = firstweddingturn; var b = Number(firstweddingturn) + 16; while (a &lt; b) { // do some code html.push('&lt;option name="asdf"&gt;' + a + '&lt;/option&gt;'); a++; } // end while html.push('&lt;/select&gt;'); $('#div1').append(html.join('')); </code></pre> <p>I also want to catch any changes to that select, once it is set up.</p> <pre><code>var firstweddingturn = '400'; $('#weddingturn').live('change',function() { alert ("Wedding select change triggered!"); //var wedturn = $('#weddingturnselectid').val(); //$('#div3').append('&lt;br&gt;Wedding turn selected, ' + wedturn + '&lt;/br&gt;') }); </code></pre> <p>I would greatly appreciate someone showing and explaining how to use bind() in this instead of live().</p> <p>For context sake, please see here: <a href="http://stackoverflow.com/questions/7126429/jquery-created-select-and-triggering-on-change">jquery created select, and triggering on change</a></p>
javascript jquery
[3, 5]
2,841,009
2,841,010
Does jquery .width(value) resize the images within a container?
<p>The question is simple, and hope the answer is as well. I have a div(call it div A) which is dynamically resized according to the viewport dimensions. The div contains a couple of images(which are around 3000px * 3000px) which I am loading in two divs(call it div B and div C) below each other inside Div A. Div B and Div C are set to 200px x 200px and the images are set to 100% of Div B and Div C. I want to know if the following code : </p> <p>$('#divA').width(foo)</p> <p>will also resize the images in children div B and div C.</p>
javascript jquery
[3, 5]
5,535,231
5,535,232
Reading the IMG within an A on click jQuery
<p>I'm trying to adapt my script to read the alt attribute of an img within an a.</p> <p>For some reason, this isn't work:</p> <pre><code>$("#thumbs a").click(function(event) { event.preventDefault(); var title = $(this + " img").attr("alt"); alert(title); }); </code></pre> <p>It returns a value of <code>[object Object]</code>. </p> <p>I'd appreciate some help, thanks.</p>
javascript jquery
[3, 5]
2,029,940
2,029,941
How to use global variables in ObjectDataSource.SelectMethod?
<p>I'm using ListView + DataPager + ObjectDataSource mix. </p> <p>In the implementation of my SelectMethod of an ObjectDataSource I'd like to access a global variable set in the PageLoad() event (the method will return just the proper number of items per page). Although the variable is initialized in PageLoad() it appears to be null in SelectMethod. How can I change that?</p> <pre><code> &lt;asp:ObjectDataSource ID="ItemsObjectDataSource" runat="server" EnablePaging="True" SelectMethod="WrapSearchResults" SelectCountMethod="CountSearchResults" TypeName="Catalogue"&gt; &lt;SelectParameters&gt; &lt;asp:QueryStringParameter Name="startRowIndex" QueryStringField="page" Type="Int32" DefaultValue="0" /&gt; &lt;asp:Parameter Name="maximumRows" Type="Int32" DefaultValue="10" /&gt; &lt;/SelectParameters&gt; &lt;/asp:ObjectDataSource&gt; </code></pre> <hr> <pre><code>SearchOption search; protected void Page_Load(object sender, EventArgs e) { search = new SearchOption(SessionParameters.Get(Session).User); } public IEnumerable&lt;ResultWrapper&gt; WrapSearchResults(int startRowIndex, int maximumRows) { search.Limit = maximumRows; &lt;-- null pointer exception } </code></pre>
c# asp.net
[0, 9]
3,337,760
3,337,761
Change hyperlinks dynamically using jquery
<p>I want to change the param of link dynamically.</p> <p>For e.g. </p> <ol> <li>Link1</li> <li>Link2</li> <li>Link3</li> </ol> <p>by default their url is ?item=text i.e. for link1(href="?item=link1") etc.. but when i click link1 the url of link2 and link3 should be link2(?item=link2&amp;item=link1) link3(?item=link3&amp;item=link1)</p> <p>any idea how to acheive this?</p> <p>Thanks, </p>
javascript jquery
[3, 5]
2,376,792
2,376,793
How To Get A Value Out Of A DetailsView DataItem Property
<p>I am accessing a DetailsView from the following event</p> <pre><code> public void dvDetails_DataBound(Object sender, EventArgs e) </code></pre> <p>I am casting the sender to my detailsview like so</p> <pre><code>DetailsView dv = (DetailsView)sender; </code></pre> <p>Now when I look in "dv" I can see the DataItem property has the data I want in it under a field name, but I dont know how to write the code access the value??</p> <p>The field name is shown in the dataitem property as "_DTMON_F", I tried to say </p> <pre><code>Datetime myDate=dv.DataItem["_DTMON_F"] </code></pre> <p>BUT C# doesnt like the syntax, can someone help me with this?</p>
c# asp.net
[0, 9]
374,020
374,021
.classpath is hidden, which doesn't allow me to add any jar files
<p>I have downloaded a sample in Samsung BLE SDK, but the .classpath file is hidden in the sample folder and i can't add any jar files in this project because of that. I always get this error:</p> <p>"could not write file in .classpath" </p> <p>How can i make this .classpath file visible?</p>
java android
[1, 4]
3,416,751
3,416,752
Session State Issue
<p>When visiting a page, I am storing a value in session state. When I click back on the browser, the value in session reverts to its original value. Why does this happen? I am not resetting the value when i go back.</p> <p>This happens on iPhone and iPad - all other browsers do NOT roll back the session state value.</p> <p>Thanks in advance.</p> <p>I am using this javascript code (code in both pages is identical):</p> <pre><code>function pageLoad() { // Get the current url path var url = document.URL; PageMethods.IsNavigatingBackward(url, handleCallback); } function handleCallback(isBackward) { if (isBackward) { // Go back to previous page history.back(); } else { // Set the current url in the session var url = document.URL; PageMethods.SetCurrentPage(url, getLocation); } } </code></pre> <p>And the code behind:</p> <pre><code>[WebMethod] public static bool IsNavigatingBackward(Uri url) { string currentPath = url.LocalPath; string lastPath = (string)HttpContext.Current.Session["LastPage"]; bool isBackward = false; NavigationList table = NavigationList.GetInstance(); if (table.IsBackwardNavigation(currentPath, lastPath)) { isBackward = true; } return isBackward; } [WebMethod] public static void SetCurrentPage(Uri url) { HttpContext.Current.Session["LastPage"] = url.LocalPath; } </code></pre>
iphone asp.net
[8, 9]
3,239,648
3,239,649
Parsing Data as integer
<pre><code>&lt;script&gt; var intVar = parseInt($(.span).data('1')); alert(data) // output Nan &lt;/script&gt; --------------- &lt;span id ="span" class ="span" data-1="4" /&gt; </code></pre> <p>i want 'intVar' as integer, but unable to parse 'data-1'</p>
javascript jquery
[3, 5]
2,600,063
2,600,064
jQuery.appear to fire only when the entire element in is viewport
<p>I'm currently using <a href="https://github.com/morr/jquery.appear" rel="nofollow" title="Click here to view">jQuery.appear</a> to change the class of elements as they come into the viewport. The plugin works great, except that it fires right as the top of the element comes into view. I am wanting to adapt it so it only fires when the entire element is inside the viewport, or near to being.</p> <p>CODE:</p> <pre><code>$('someselector').appear(); $('someselector').on('appear', function() { $(this).removeClass('on').addClass('off'); $(this).siblings().removeClass('off').addClass('on'); }); </code></pre>
javascript jquery
[3, 5]
4,611,265
4,611,266
Android: Is there a way to execute JavaScript from my app?
<p>I was hoping to find something in the Android sdk similar to the <code>javax.script</code> package in Java; but haven't been able to find anything. Am I missing a way to execute JavaScript from my app?</p>
javascript android
[3, 4]
1,125,362
1,125,363
I want to split a number into single digit and change it into the binary in android
<p>I have a number 83 I want to split this number like 8 and 3 then want to change the number into binary form in android and want the result.how can I do this.Please help me</p> <p>Thanks</p>
java android
[1, 4]
4,087,880
4,087,881
C# app blocks when calling method from dll
<p>I'm currently exploring DLL exported functions and P/invoke in C#. I've created very simple .dll:</p> <p>Test.h</p> <pre><code>#ifndef TEST_DLL_H #define TEST_DLL_H extern "C" __declspec(dllexport) const char * __cdecl hello (); extern "C" __declspec(dllexport) const char * __cdecl test (); #endif // TEST_DLL_H </code></pre> <p>Test.cpp</p> <pre><code>#include &lt;stdlib.h&gt; #include "test.h" #include &lt;string.h&gt; const char* hello() { char *novi = (char *)malloc(51); strcpy(novi, "Test."); return novi; } const char * test() { return "Test."; } </code></pre> <p>I've compiled it and used in C# project like this:</p> <pre><code> [DllImport("test.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hello(); [DllImport("test.dll", CallingConvention = CallingConvention.Cdecl)] public static extern string test(); private void button1_Click(object sender, EventArgs e) { MessageBox.Show(test()); IntPtr a = hello(); MessageBox.Show(Marshal.PtrToStringAnsi(a)); } </code></pre> <p>But it isn't working. <code>test()</code> gets called successfully and I get back correct string. But <code>hello()</code> just hangs up the program. If I remove malloc line from the <code>hello()</code> definition and return constant, everything works, so I guess there's a problem with malloc that I'm now aware of.</p> <p>Also, somewhere I've seen that string shouldn't be used when return type is char*. If that's true, why should we use IntPtr?</p>
c# c++
[0, 6]
5,776,983
5,776,984
I'm getting "The report definition for report 'xxxx.rdlc' has not been specified" in my RDLC report
<p>I've created an rdlc report. I have a reportViewer on my form. When I try to load the report I get : "The report definition for report 'xxxx.rdlc' has not been specified". I can't figure this out. I have a datatable with the data I need for the report. I take this dataTable and I load it back to my database, to a table called "FinalReport". (The reason i'm doing this, is because that rdlc requires some sort of a dataSource.) I have a table inside my report (table1). This is my code (inside my form, where the report viewer is located):</p> <pre><code>this.finalDataReportTableAdapter.Fill(this.nehasitDataSet.FinalDataReport); localReport.ReportEmbeddedResource = @"Resources\VisibleAssets.rdlc"; //I'm not so sure about the following line, but it's the only line that prevented me from getting an error ("no reportdefinition defined" using (StreamReader rdlcSR = new StreamReader(@"Resources\VisibleAssets.rdlc")) { localReport.LoadReportDefinition(rdlcSR); localReport.Refresh(); } this.reportViewer.RefreshReport(); </code></pre> <p>I also connected the report to the dataTable and the reportViewer to the report. I really can't see the problem, and I searched Google for it.</p> <p>Any help will be highly appreciated.</p>
c# asp.net
[0, 9]
2,652,116
2,652,117
Deprecated Thread methods are not supported without stop() method
<p>I programmed game, which is supposed to use <code>.startActivity</code> on activity which should display score, the problem is, that instead of properly displaying the activity, i'm getting <strong>"Deprecated Thread methods are not supported"</strong>. I googled this error and i removed all <code>Thread.stop()</code> in my application, but it did not helped. Could there be any other reason why i'm getting this type of error?</p> <pre><code>public class GameFrame extends Activity implements OnTouchListener, OnLossListener { Panel game; @Override public void onCreate(Bundle savedInstanceState) { Display d=getWindowManager().getDefaultDisplay(); super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); Point p=new Point(d.getWidth(),d.getHeight()); game=new Panel(this,p); setContentView(game); game.setOnTouchListener(this); game.setOnLossListener(this); } public boolean onKeyDown (int kc,KeyEvent ke){ if (kc==23){ game.shoot(); } return true; } public void onPause(){ super.onPause(); game.thread.setState(false); game.mech.setState(false); this.finish(); } @Override public boolean onTouch(View v, MotionEvent me) { if (v.equals(game)){ game.setPosOfPlane((int)me.getX()); } return true; } @Override public void lost(int score) { Intent i=new Intent (this,EndGame.class); i.putExtra("score",score+""); startActivity (i); } </code></pre> <p>}</p>
java android
[1, 4]
4,278,128
4,278,129
Binding dropdownlist
<p>I have got a requirement to bind a dropdownlist using db values.I gave that dropdownlist datasource as a list of class, ie <code>ddlUser.datasource=List &lt;User&gt;;</code></p> <p>The class user contains following properties <code>UserID</code>, <code>Firstname</code> and <code>Lastname</code>. </p> <p>Its datavalue field is <code>UserID</code>. </p> <p>I want to show the text of dropdown as a string ie <code>Firstname+" " + Lastname</code>.</p>
c# asp.net
[0, 9]
3,037,852
3,037,853
setcookie ajax php issue
<p>I want to set cookie through AJAX. But I get warning "Cannot modify header" any ideas ?</p> <pre><code>&lt;?php if($_POST['name']){ setcookie("autosave_blogo_id", "value", time()+10800, '/'); } ?&gt; $("#button").click(function(){ $.ajax({ var indata = $('#b_pav').val(); type: "POST", url: "&lt;?php echo "http://" . $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?&gt;", data: indata, success: function(msg){ alert(msg); } }); return false; }); </code></pre>
php jquery
[2, 5]
444,346
444,347
javascript and php not quite working
<p>You can look at the application here: <a href="http://jsfiddle.net/YYMJS/6/" rel="nofollow">application</a></p> <p>I know the code doesn't work in jsfiddle but I have included my code in the jsfiddle so that you can see the whole code and the way it is laid out. <a href="http://jsfiddle.net/YYMJS/6/" rel="nofollow">jsfiddle</a></p> <p>Now if textbox is empty, it displays "false" in alert and displays a message which is fine.</p> <p>The problem though is this:</p> <p>If I type the correct or incorrect room number value in the textbox, it always states it is "false" and does not come with a javascript message.</p> <p>What should happen is if textbox value matches database, then it should alert "true" and display a javascript message "room is Valid", if textbox value doesn't match database then it should alert "False" and display a javascript message "room is Invalid" How can I achieve this?</p> <p>You can test the application, enter in these figures in the textbox if you wish for testing:</p> <p>Valid room number CW5/10 , Invalid room number CN2/10.</p> <p>Below is where error occurs:</p> <pre><code> var js_var = []; &lt;?php while($data = mysql_fetch_assoc($roomquery)){ ?&gt; js_var.push(&lt;?php $data['roomChosen']; ?&gt;); &lt;?php }?&gt; </code></pre> <p>Jsfiddle application url updated above</p>
php javascript
[2, 3]
329,910
329,911
Hide table rows with expired content
<p>Say I use a table to display scheduled content, and I want rows to disappear after their date has passed.</p> <pre> Row 1 has Table title Row 2 has Date A Row 3 has Scheduled content A1 Row 4 has Scheduled content A2 Row 5 has Date B Row 6 has Scheduled content B1 Row 7 has Scheduled content B2 Row 5 has Date C Row 6 has Scheduled content C1 Row 7 has Scheduled content C2 etc. </pre> <p>After Date A has passed, I want rows 2-4 to disappear/be hidden.</p> <p>I do this website on a volunteer basis, and there is nobody else available to help. I delete the expired rows on a daily basis, but I'm going on vacation and will be unplugged for two weeks. </p> <p>I don't have any example code, I'm a rookie. If you mean my html code, it's just a simple table.</p> <p><em><strong>Sorry for not responding sooner, Jakub (<a href="http://stackoverflow.com/users/158014/jakub">http://stackoverflow.com/users/158014/jakub</a>). Spent 12+ hours in hospital ER with my daughter right after my last edit yesterday. I will come back and fix the post to conform to Stackoverflow standards ASAP.</em></strong></p>
javascript jquery
[3, 5]
2,477,388
2,477,389
i want to sent string from android device to java desktop application im using following code
<p>In android device which is client i use following code</p> <pre><code>sock = new Socket("10.0.2.2", 3390); // r = new BufferedReader(new InputStreamReader(sock.getInputStream())); out = new BufferedWriter(new OutputStreamWriter(sock .getOutputStream())); String s = "abc"; out.write(s); </code></pre> <p>while in server side which is java desktop application i use following code</p> <pre><code> InputStream m_Input = null; ServerSocket MyService = null; try { MyService = new ServerSocket(3390); serviceSocket = MyService.accept(); m_Input = serviceSocket.getInputStream(); } catch (IOException e) { System.out.println(e); } </code></pre> <p>when i run both the client side i.e android does not send request to server for reading data i use follwoing code</p> <pre><code>byte[] data = null; try { int ch = 0; int length = m_Input.read(); if (length &gt;0) data= new byte[length]; length = 0; while (length != data.length) { ch = m_Input.read(data, length, data.length-length); if (ch == -1) { // System.out.println("ch is 0"); break; } length +=ch; } } catch (IOException e) { System.err.println(e); } return new String(data); } </code></pre>
java android
[1, 4]
2,556,705
2,556,706
Focus DIV out of a DIV array
<p>I am trying to add a to create an array of text boxes and every-time one is created is supposed to be focused. This is my not working code. any help would be much appreciated. thanks. </p> <pre><code>var emails = new Array(); var count = 0; //function to add more extra emails $('#additional_emails').focus(function() { emails[count] = '&lt;input type="text" size="30" id="email_list'+ count + '" value ="'+count+'" /&gt;&lt;br&gt;'; $('#here_emails').append( $(emails[count]).focus() ); count++; }); </code></pre>
javascript jquery
[3, 5]
1,471,406
1,471,407
Audio/Video/Text chat in ASP.Net app
<p>I need to develop a chat system in ASP.Net. I have gone through lots of SO question asked on similar topic, but did'nt find any one satisfactory. Is it possible to create it from scratch or do i need to go for some API's. My requirement is limited to my site users only, can say intranet based.</p> <p>Please help me.</p>
c# asp.net
[0, 9]
1,833,835
1,833,836
when i upload a file it showing error like c:\inetpub\vhosts
<p>I have develop a small web application in asp.net (c#) for uploading files into data base it is working fine in my local machine .But when i tested in the server it showing error like</p> <pre><code> C:\inetpub\vhosts\crosstouch.com\httpdocs\Images\100898.jpeg' is denied </code></pre> <p>what can i do to resolve this problem please help me....</p>
c# asp.net
[0, 9]
4,249,591
4,249,592
Hint text is not being removed
<p><a href="http://jsfiddle.net/udit_sharma/GFknc/" rel="nofollow">http://jsfiddle.net/udit_sharma/GFknc/</a></p> <p>I have created this fiddle. which have a input box and it has hint-Text. When i am focused in this input box it's hint-Text is being cleared properly. and when i focused-out of this input box hint-Text is being showed again if there is nothing entered by user.</p> <p>But there is an issue .let say you are focused in input-box and clicked on another tab in the browser now if you comeback to this fiddle again notice that hint-Text is being shown while it was empty while leaving this page. and also its not clearing this while clicking in and out of the input box. ? </p> <p>So the issue i found is when i click on another tab onblur is not being called so that variable "valueChanged" is not being set to false. So while focusing again it is not clearing the default hint-Text value.</p> <p>So i am not getting why onBlur is not being called. If any one have clue about this, please tell or is there any other way to do this functionality ?</p>
javascript jquery
[3, 5]
1,179,243
1,179,244
jQuery toggle on different area
<p>I am trying to copy the Like button of Facebook, but the problem is on the specific place to click to change the button.</p> <p>When it's not yet liked, the user should click anywhere on the button and the button will change on the gray state (already liked). This is already done.</p> <p>But the problem is when unliking it, I think I'm not using jquery correctly so that it should set to the blue state(not liked), only if it is clicked on the image.</p> <p>Here's what I've made, take a look at it so you can understand better: <a href="https://glenrdsgn.com/button/" rel="nofollow">https://glenrdsgn.com/button/</a></p>
javascript jquery
[3, 5]
3,701,278
3,701,279
jQuery Slide Left Animation
<p>I have four <code>div</code>'s or <code>td</code>'s and what I am trying to do is if I click on any one, then all of them slide left, the remaining three should disappear, and the one I clicked should remain.</p> <p>I also want a neat animation effect.</p> <p>I have tried this but it gives some error for style:</p> <pre><code>//xControl is a link inside the td $(xControl).parent().siblings().each(function fn() { setTimeout(function fn() { $(this).animate({ width: 'toggle' }); }, 800); }); </code></pre> <p>I have also tried:</p> <pre><code>$(this).hide("slide", { direction: "right" }, 500); </code></pre> <p>This doesn't work either.</p> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
4,025,698
4,025,699
How to Insert Data from DataTable to Oracle Database Table :
<p>I've data in <code>DataTable</code> with 2 rows and 3 columns. I want to insert that data into <code>Oracle</code> table. </p> <p>How can I insert? please give me with some example.</p> <p>And also</p> <p>How can I pass datatable to storedprocedure in <strong>ORACLE</strong>...</p> <p>I pass datatable in below mensioned manner, but datatable type problem is comming. how can I solve this?</p> <pre><code>cmd.Parameters.Add("@Details",dtSupplier); (OR) cmd.Parameters.Add("Details", DbType.Single).Value = dtSupplier.ToString(); </code></pre>
c# asp.net
[0, 9]
1,776,643
1,776,644
How do I set the value of an input-element via jQuery, when I only know it's "name"-attribute
<p>I need to reset some text-boxes which only have an unique name (not an unique id). I tried it with jQuery, but my code seems to do nothing:</p> <pre><code>$('input[name=customergroupname]').value=""; </code></pre>
javascript jquery
[3, 5]
2,761,953
2,761,954
How to store a copy of complete web page at server side as soon as it is rendered on client browser?
<p>Requirement is to keep a copy of complete web page at server side same as it is rendered on client browser as past records.These records are revisited. </p> <p>We are trying to store the html of rendered web page. The html is then rendered using resources like javascript, css and image present at server side. These resources keep on changing. Therefore old records are no longer rendered perfectly.</p> <p>Is there any other way to solve above? We are also thinking converting it into pdf using IText or apache FOP api but they does not consider javascript effect on page while conversion. Is there any APIs available in java to achieve this? </p> <p>Till now, no approach working perfectly. Please suggest.</p> <p>Edit: In summary,requirement is to create a exact copy of rendered web page at server side to store user activities on that page. </p>
java javascript
[1, 3]
5,041,572
5,041,573
Allow window.open to open new window and not popup
<p>I have this JS code:</p> <pre><code>window.open(loginurl, '_blank'); </code></pre> <p>coming from a condition for example:</p> <pre><code>if (userloggedin) { //popup another page } else { window.open(loginurl, '_blank'); } </code></pre> <p>"loginurl" is an login URL that I would like to open in new window.</p> <p>Problem: This will be blocked in most browsers (Firefox and Chrome) because it behaves like a popup.</p> <p>I would like a solution that will still utilizes my login URL variable (not altering the if else statement), open it in new window without any warnings of a popup that is being blocked.</p> <p>I am searching for ways but I never found a solution. If somebody can provide some tips or insights. That would be highly appreciated.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
728,898
728,899
Creating node with prefix
<p>How can i create a node like d2l_2p0:difficulty in xml file using asp.net</p>
c# asp.net
[0, 9]
4,913,864
4,913,865
how do i download doc from google insight in java
<p>i was able to get this code for c# which works perfectly fine..but due to dependancy issues i need the java/ python equivalent of it.. </p> <pre><code>class Program { static void Main(string[] args) { var client = new WebClient(); String userName = "*******"; String password = "*******"; var response = client.DownloadString("https://www.google.com/accounts/ClientLogin?accountType=GOOGLE&amp;Email="+userName+"@gmail.com&amp;Passwd="+password+"&amp;service=trendspro&amp;source=test-test-v1"); var sid = response.Split('\n')[0]; client.Headers.Add("Cookie", sid); String downloadURL = "http://www.google.com/insights/search/overviewReport?cat=0-7&amp;geo=BR&amp;date=today%207-d&amp;cmpt=geo&amp;content=1&amp;export=1"; byte[] csv = client.DownloadData(downloadURL); Console.WriteLine(Encoding.Unicode.GetString(csv)); Console.ReadLine(); } } </code></pre>
java python
[1, 7]
5,736,210
5,736,211
How to dynamically create many Jquery color pickers (eyecon)?
<p>I am using this jQuery color picker for a CMS theme creator: <a href="http://www.eyecon.ro/colorpicker/" rel="nofollow">http://www.eyecon.ro/colorpicker/</a></p> <p>They are currently set up like this for each color picker:</p> <pre><code>&lt;div class="colorSelector" id="colorSelector3"&gt;&lt;div style="background-color: #0000ff"&gt;&lt;/div&gt;&lt;/div&gt; </code></pre> <p>With this for the javascript:</p> <pre><code>$('#colorSelector3').ColorPicker({ color: '#0000ff', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $('#colaAlpha a').css('color', '#' + hex); $('#colorSelector3 div').css('backgroundColor', '#' + hex); } </code></pre> <p>});</p> <p>The problem is I need to create a large amount of color pickers and it would be great to have one function where I pass in the id of the picker and the id of the element/s to be changed. Is this possible?</p> <p>This didn't work:</p> <pre><code>function colorPickMulti(itemid, cp){ $(cp).ColorPicker({ color: '#0000ff', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); return false; }, onChange: function (hsb, hex, rgb) { $(itemid).css('color', '#' + hex); $(cp + ' div').css('backgroundColor', '#' + hex); } }); } </code></pre> <p>Could I create the functions dynamically some way? Any help would be great! Thanks.</p>
javascript jquery
[3, 5]
3,442,144
3,442,145
Gaining access to content inserted dynamically with ajax
<p>This is the fragment of code inserted with ajax:</p> <pre><code>&lt;form&gt; &lt;label for = "task-name"&gt;Name&lt;/label&gt; &lt;input type = "text" id = "task-name" /&gt; &lt;label for = "task-description"&gt;Description&lt;/label&gt; &lt;input type = "text" id = "task-description" /&gt; &lt;input type = "hidden" id = "task-col" /&gt; &lt;input type = "hidden" id = "task-row" /&gt; &lt;input type = "submit" id = "add-task" onclick="return false" value="Add" /&gt; &lt;/form&gt; </code></pre> <p>This is the JS code which insert the previous element in the DOM:</p> <pre><code>$('html').on('click', '.task-pop', function(){ var pos = $(this).parent().parent().attr('class').split("-"); ajaxObj = getXmlHttpObject(); ajaxObj.onreadystatechange = function(){ if(ajaxObj.readyState == 4 &amp;&amp; ajaxObj.status == 200){ $('#pop-hold').html(ajaxObj.responseText); $('#task-col').val(pos[0]); $('#task-row').val(pos[1]); } }; ajaxObj.open("GET","resources/component/newTask.jsp"); ajaxObj.send(null); $('#pop-blk').css('display','block'); $('#pop').show("fast"); }); </code></pre> <p>As you can see I'm trying to add some values to the hidden inputs <code>#task-row</code> and <code>#task-col</code> from the content added dynamically.</p> <p>The page is properly displayed and no error is thrown but those two fields are never accessed. How can I solve this?</p>
javascript jquery
[3, 5]
963,613
963,614
Cannot find previous inserted element in jquery ready()
<p>My code doesn't work, it seems the previous inserted element cannot be found by later script. </p> <p>i updated basic syntax errors as the first three answners, but it seems still doesn't work.</p> <p>code :</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://code.jquery.com/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/jquery-migrate-1.1.1.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready( function() { $('#menu').html('&lt;a href="page4.html" class="dynamicLoad"&gt;ddd&lt;/a&gt;'); }); $(document).ready( function() { $( 'a.dynamicLoad' ).click( function( e ) { e.preventDefault(); // prevent the browser from following the link e.stopPropagation(); // prevent the browser from following the link $( '#myDiv' ).load( $( this ).attr( 'href' ) ); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="menu"&gt;mymenu&lt;/div&gt; &lt;div id="myDiv"&gt;aaaaaaaaaaaa&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
4,710,091
4,710,092
Change input background color if the value of the input is valid in database
<p>The logic i am trying to do is:</p> <pre><code>input field starts white (Normal); after somebody finish typing, if the email does not exists, the input gets light red; if the email exists in the database, the input becomes white again; </code></pre> <p>I have my code like this:</p> <p>index.php</p> <pre><code>&lt;?php include 'my database connection page'; include 'page that return me an array with all the emails'; ?&gt; &lt;form method="POST"&gt; &lt;input type="text" name="email" id="email_field" onFocus="changeColorEmail(this)"&gt; &lt;input type="submit"&gt; &lt;/form&gt; </code></pre> <p>scripts.js</p> <pre><code>function changeColorEmail(which) { which.value = which.value.split(' ').join('') if (which.value == "&lt;? echo $user_data['user_email'] ?&gt;") { which.style.background = '#ffffff'; }else { which.style.background = "#ffebe8"; } } </code></pre> <p>Any ideas are appreciated!</p> <p><strong>user.php</strong> (contain a function that verify if the email exists in database)</p> <pre><code>function email_exists($email){ return (mysql_result(mysql_query("SELECT COUNT(user_id) FROM user WHERE user_email = '$email'"), 0) == 1) ? true : false; } </code></pre>
php javascript
[2, 3]
5,347,210
5,347,211
How to hide a table when it blur/or click document that outside the table
<p>How to hide a table when it blur/or click document that outside the table</p>
javascript jquery
[3, 5]
1,935,582
1,935,583
jQuery autocomplete problem: how to handle 'Not in list' case
<p>Let me clarify: I'm using standard jQuery autocomplete plugin (bassistanse.de) and bind it to a KeyValueCollection serialized to JSON (ASP.NET MVC). All works fine, except I want to be able to notify user when he/she types in a value which isn't present in DB, i.e. value not in list.</p> <p>What are possible ways of solving this?</p> <p>Ideally, I would like to handle both 'first time error' and 'error after valid choice' cases.</p> <p>Handling 'blur' event doesn't help, since user can click drop down item (effectively losing focus), and after that the selection immediately will have been made.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
570,376
570,377
Abstract Iphone/Android Function Call from Javascript?
<p>In Iphone, I need to use,</p> <pre><code> window.location = 'myscheme://FunctionName?Param1=Value1&amp;.........'; </code></pre> <p>But In Android,</p> <pre><code>Android.FunctionName(params); </code></pre> <p>This works for me,</p> <pre><code>if(window.Android) Android.FunctionName(params); else window.location = 'myscheme://FunctionName?Param1=Value1&amp;.........'; </code></pre> <p>But doing this for each and every function is pain for me. Is it possible to abstract these details and use a single function to call both.</p>
javascript android iphone
[3, 4, 8]