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
5,711,059
5,711,060
How to know that a particular element is present or not?
<p>How to know that a particular input type is present or not in a <code>div</code>?</p> <p>If I use</p> <pre><code>$("#inputId").val() </code></pre> <p>And there is no element present on this, then js gives an error.</p> <p>So how could I know that the input element named <code>inputId</code> is present or not?</p> <p>Reply me ASAP</p>
javascript jquery
[3, 5]
388,047
388,048
How to create Fibonacci Sequence in Java
<p>I really suck at math. I mean, I REALLY suck at math. I'm trying to make a simple fibonacci sequence class for an algorithm I'll be using. I have seen the python example which looks something like this:</p> <pre><code>a = 0 b = 1 while b &lt; 10: print b a, b = b, b+a </code></pre> <p>The problem is that I can't really make this work in any other language. I'd like to make it work in Java, since I can pretty much translate it into the other languages I use from there. This is the general thought:</p> <pre><code> public class FibonacciAlgorithm { private Integer a = 0; private Integer b = 1; public FibonacciAlgorithm() { } public Integer increment() { a = b; b = a + b; return value; } public Integer getValue() { return b; } } </code></pre> <p>All that I end up with is doubling, which I could do with multiplication :( Can anyone help me out? Math pwns me. </p>
java python
[1, 7]
2,016,426
2,016,427
What is the best way to create an array of all images found in a string?
<p>I am looking to create an array of all the images in a string of HTML. </p> <p>I've tried using the following but it generates errors if the complete URL path is not present in the src. </p> <pre><code>var found = $(html).find('img'); </code></pre>
javascript jquery
[3, 5]
280,917
280,918
List.Add() thread safety
<p>I understand that in general a List is not thread safe, however is there anything wrong with simply adding items into a list if the threads never perform any other operations on the list (such as traversing it)?</p> <p>Example:</p> <pre><code>List&lt;object&gt; list = new List&lt;object&gt;(); Parallel.ForEach(transactions, tran =&gt; { list.Add(new object()); }); </code></pre>
c# asp.net
[0, 9]
1,985,485
1,985,486
How the generate TreeView in asp.net?
<p>Consider the following table. It has 3 filed with the following data. Now I want to show the data in TreeView Control in asp.net and c# I will select all the data in a DataTable. </p> <pre><code>category_id category_name parents_id 1 Root NULL 2 Teacher 1 3 Student 1 4 TeacherA 2 5 TeacherB 2 6 TeacherC 2 7 StudentA 3 8 StudentB 3 9 StudentC 3 </code></pre>
c# asp.net
[0, 9]
106,249
106,250
what is the easiest way to retain values of fields while switching from page to page
<p>I am using Multiview. And I am switching between views. Each view contains lots of fields. I am going to another view from the current view to add some data. And after adding data from the new view, I am returning to the previous view. Now on this view I want to populate fields which I have entered before switching. Currently I am using ViewState to retain previous values. But this costs lot as there are lots of fields on a single view. Is there any other way to do this task?</p>
c# asp.net
[0, 9]
378,223
378,224
jQuery.data() with CSS
<p>I change with <code>setAttribute('color', 'black')</code> the CSS of some element. After this element will be stored in a jQuery.data() object. But in my data() object the CSS which I defined before won't be stored. </p> <p>What am I doing wrong?</p> <p>Thanks for the help!</p>
javascript jquery
[3, 5]
3,989,892
3,989,893
Sending Email from GridView
<p>i am trying to send all the email listed in my GridView but for somereason, the email does not get sent out. I am suspecting my Send function (smtpClient.Send(mailMessage); is not working or i am missing something. Pls help as i have spent so many hours on figuring out this. thanks</p> <pre><code>protected void chkAll_CheckedChanged(object sender, EventArgs e) { foreach(GridViewRow gr in GridView1.Rows) { CheckBox cb = (CheckBox)gr.FindControl("chkItem"); if(((CheckBox)sender).Checked) cb.Checked = true; else cb.Checked = false; } } protected void Button3_Click(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(); foreach(GridViewRow gr in GridView1.Rows) { CheckBox cb = (CheckBox)gr.FindControl("chkItem"); if(cb.Checked) { sb.Append(GridView1.DataKeys[gr.RowIndex]["Email"].ToString()); sb.Append(","); } } //Create instance of main mail message class. System.Net.Mail.MailMessage mailMessage=new System.Net.Mail.MailMessage(); mailMessage.From = new System.Net.Mail.MailAddress( System.Configuration.ConfigurationManager .AppSettings["fromEmailAddress"]); mailMessage.Priority = System.Net.Mail.MailPriority.High; //Text/HTML mailMessage.IsBodyHtml = false; mailMessage.Body = "Hello, here is new email"; mailMessage.Subject = "RCA APPROVAL IS REQUIRED"; System.Net.Mail.SmtpClient smtpClient=new System.Net.Mail.SmtpClient(); try { smtpClient.Send(mailMessage); Response.Write("&lt;B&gt;Email Has been sent successfully.&lt;/B&gt;"); } catch (Exception ex) { Response.Write(ex.Message); } } </code></pre>
c# asp.net
[0, 9]
5,910,858
5,910,859
Keydown pauses after first keyress, and subsequent keypresses
<p>Go <a href="http://jsfiddle.net/M7TKc/" rel="nofollow">Here</a></p> <p>Use UP and DOWN keys</p> <p>When I press a key, the red box moves down, pauses, then moves the rest.</p> <p>How do I remove the pause?</p>
javascript jquery
[3, 5]
3,693,305
3,693,306
Change color of an id
<p>I'm new at this. I would like to know if you can help me. I wold like to chance the color of an id (a rectangle). I want the color to change every 5 seconds to some colors i already have chosen and when clicked on the rectangle, it will assume the color at the time. Thank you.</p>
javascript jquery
[3, 5]
312,504
312,505
How do I use RegisterClientScriptBlock to register JavaScript?
<p>ASP.NET 2.0 provides the <code>ClientScript.RegisterClientScriptBlock()</code> method for registering JavaScript in an ASP.NET Page.</p> <p>The issue I'm having is passing the script when it's located in another directory. Specifically, the following syntax does not work:</p> <pre><code>ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", "../dir/subdir/scriptName.js", true); </code></pre> <p>Instead of dropping the code into the page like <a href="http://msdn.microsoft.com/en-us/library/aa479390.aspx#javawasp2_topic7" rel="nofollow">this page</a> says it should, it instead displays <code>../dir/subdir/script.js</code> , my question is this:</p> <p>Has anyone dealt with this before, and found a way to drop in the javascript in a separate file? Am I going about this the wrong way?</p>
javascript asp.net
[3, 9]
5,468,363
5,468,364
Is there any other parameter like `this` in div name.first in javascript
<p>I see some thing like </p> <p><code>$(#content).children(".p:first");</code></p> <p>call the first <code>&lt;p&gt;</code> tag, except <code>first</code>, Is there any other parameter? thanks.</p> <p>exaple:</p> <pre><code>&lt;div id="content"&gt; &lt;p&gt;aaa&lt;/p&gt; &lt;p&gt;bbb&lt;/p&gt; &lt;p&gt;ccc&lt;/p&gt; </code></pre> <p> use <code>$(#content).children(".p:first");</code> echo </p> <pre><code>&lt;div id="content"&gt; &lt;p&gt;aaa&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Is there any <code>$(#content).children(".p:second");</code> or <code>$(#content).children(".p:last");</code> can be set?</p>
javascript jquery
[3, 5]
5,905,169
5,905,170
Asp.net digit grouping while typing
<p>In asp.net project, I want to group digits while typing in a textbox. Example: 123456123456 123.456.123.456</p> <p>My aim is not grouping ip adress. I want it to read numbers easily. eg : 12.000.152.156.123.156 </p> <p>How can i do this?</p>
javascript asp.net
[3, 9]
5,315,834
5,315,835
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]
4,155,897
4,155,898
How and where do I learn programming languages?
<p>I really want to learn a ton of programming languages like javascript and c++, but I have no idea where or how. I watched a tutorial series for C++ on Youtube and I read the javascript tutorial on W3schools, but I need more detailed tutorials and a way to practice. </p> <p>How did you guys learn? I'll take the college courses when I get a chance, but how else?</p>
javascript c++
[3, 6]
2,019,050
2,019,051
NullRefrenceException was unhandled by user code
<p>Code below is placed in page_Load. How I should handle this to bypass UrlReferrer when you enter page directly first time and there is no referrer? What I am missing here?</p> <pre><code> if (HttpContext.Current.Request.UrlReferrer.AbsoluteUri != null) { urlReferer = HttpContext.Current.Request.UrlReferrer.AbsoluteUri.ToString(); } else { urlReferer = ""; } </code></pre>
c# asp.net
[0, 9]
969,110
969,111
Problem occured in IE8 Compatibility view?
<p>I am using the Jquery and asp.net pages in my web application. In IE8 compatibility some of control width not getting render properly : dialog open with some auto width but the dialog title width not getting properly width as its content gets. Also some of the drop down list shown with very less width size. </p> <p>How to solve the problem .....</p> <p>Thanks..</p>
jquery asp.net
[5, 9]
4,161,602
4,161,603
swap images in grid view using OnTouchListener
<p>I am making an application where i need to swap images in grid view . here is the code ... how could i achieve swapping :</p> <p>activity</p> <pre><code>public class GameActivity extends Activity implements OnTouchListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Intent intent = getIntent(); setContentView(R.layout.layout_game); //create grid view splitImage(); GridView gridView = new GridView(this); gridView = (GridView)findViewById(R.id.grid_view); final ImageAdapter images = new ImageAdapter(this,chunkedImages); final GridView gV = gridView; gridView.setAdapter(images); gridView.setOnTouchListener(this); } public boolean onTouch(View v, MotionEvent me) { switch(me.getAction()) { case MotionEvent.ACTION_DOWN : Toast.makeText(GameActivity.this, "down ", Toast.LENGTH_SHORT).show(); break; case MotionEvent.ACTION_UP : Toast.makeText(GameActivity.this, "up " , Toast.LENGTH_SHORT).show(); break; case MotionEvent.ACTION_MOVE : //Toast.makeText(GameActivity.this, "move", Toast.LENGTH_SHORT).show(); break; } return true; } } </code></pre> <p>on touching the image it gives toast as down and on removing the fingure gives up . But how to swap image i could not understand.</p>
java android
[1, 4]
2,052,808
2,052,809
Changing the caption of Yes-No button in jqdialog
<p>how can we change captions of Yes-No buttons in jqdialog box of jQuery ?</p>
javascript jquery
[3, 5]
4,951,713
4,951,714
Timing ASP.NET Page load
<p>What is the best way to measure the code run time in ASP.NET page?</p> <p>Here is my code, trying to time the page load and writing to log. </p> <pre><code> private Stopwatch PageTimer = null; protected void Page_Init(Object Src, EventArgs E) { if (!IsPostBack) { PageTimer = new Stopwatch(); PageTimer.Start(); } } protected override void OnPreRender(EventArgs e) { if (!IsPostBack) { PageTimer.Stop(); Logger.SectionEnd("PageTimer", PageTimer, "", true); } base.OnPreRender(e); } </code></pre>
c# asp.net
[0, 9]
1,461,965
1,461,966
asp.net login control with another panel
<p>How to use login and signup button, in which whenever user clicks on that link login and signup form will open in same window like in flipkart.com. How to do that task in my website? I am making an ecommerce website...</p>
c# jquery asp.net
[0, 5, 9]
655,412
655,413
table tooltip css
<p>I have generated a <strong>dynamic table</strong> from asp.net code behind page and adding <em>Table.ToolTip</em> value. How to add table.tooltip style?</p> <pre><code>tbl = new Table(); tbl.ID = "tblstatus"; tbl.Style.Add("border-collapse", "collapse"); tbl.ToolTip = "tool tip message"; </code></pre>
c# asp.net
[0, 9]
3,826,709
3,826,710
I usually wait for a collection of asynchronous events to finish using a setInterval poller. Is there a better way?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8726046/multiple-ajax-calls-inside-a-each-function-then-do-something-once-all-of-the">Multiple ajax calls inside a each() function.. then do something once ALL of them are finished?</a> </p> </blockquote> <p>Consider the following function:</p> <pre><code>function suggestSong(songs){ console.log("Suggesting song from songs:", songs); var self = this; var totalRelatedVideos = []; var count = 0; $.each(songs, function(){ count++; self.getRelatedVideos(this.videoId, function(relatedVideos){ count--; totalRelatedVideos = totalRelatedVideos.concat(relatedVideos); }); }); var maxWaitTime = 1000; var waitTime = 200; var elapsedTime = 0; var waitInterval = setInterval(function(){ elapsedTime += waitTime; if(count == 0 || elapsedTime &gt;= maxWaitTime){ clearInterval(waitInterval); console.log("I found related videos: " + totalRelatedVideos.length); } }, waitTime ); }; </code></pre> <p>This is how I currently implement waiting for a collection of asynchronous events to finish before executing another piece of code. There's a lot of code to do very little, though. I was wondering if there's a less obtuse way of achieving the same result?</p>
javascript jquery
[3, 5]
1,569,256
1,569,257
String to byte array
<p>I have to convert a string to byte (16 bit) in JavaScript. I can do this in .net in following code but I have to change this for old classic asp App which uses JavaScript.</p> <pre><code>string strShared_Key = "6fc2e550abc4ea333395346123456789"; int nLength = strShared_Key.Length; byte[] keyMAC = new byte[nLength / 2]; for (int i = 0; i &lt; nLength; i += 2) keyMAC[i / 2] = Convert.ToByte(strShared_Key.Substring(i, 2), 16); </code></pre> <p>This is the JavaScript function but doesn't return same out put as above .net code.</p> <pre><code>function String2Bin16bit(inputString) { var str = ""; // string var arr = []; // byte array for (var i = 0; i &lt; inputString.length; i += 2) { // get chunk of two characters and parse to number arr.push(parseInt(inputString.substr(i, 2), 16)); } return arr; } </code></pre>
c# javascript asp.net
[0, 3, 9]
2,019,556
2,019,557
Is there a way using Jquery to detect the back button being pressed cross browsers
<p>I have a website that is on a slide show and when the user presses the back button I would like it to go back to the album view not the prior and prevent page. Is there a way of doing this? thanks for any help or advice.</p>
javascript jquery
[3, 5]
848,227
848,228
submit a form when hitting the browser back button
<p>I have a page for asking queries to an SQL database. Its only purpose is to allow students to exercise. Depending on the students activity the page rewrites itself with new content so that the student may enter a query, have the resulting table shown or get an error message.</p> <p>All is working through forms that post data to the same page.</p> <p>However, if a student uses the back button or the forward button (after hitting the back button) data gets lost as I cleanse the $_POST variable content to get ready for new action.</p> <p>There is, however, a "go back" button that assembles data to restore the previous page by POSTing the required data. Is it possible to use some kind of technique, javascript, html5, PHP or whatever to actually submit the form that posts the assembled data when hitting the browser back button?</p> <p>I am using HTML 5, PHP 5 and some JavaScript (not JQuery but if it gives me an option ...)</p>
php javascript
[2, 3]
5,745,429
5,745,430
Display Data from text boxes in Grid Format
<p>My Question can i display data in grid format using in javascript/jquery but without fetching data from DB only in front end. suppose: </p> <pre><code>textfield1 textfield2 add more (link) </code></pre> <p>When click on add more link then user entered data display like:</p> <pre><code>Firstname Lastname amit kumar textfield1 textfield2 add more (link) </code></pre> <p>and immediately both textfield blank. Also same next step.</p> <p>pls let me know.</p>
javascript jquery
[3, 5]
3,328,634
3,328,635
the microsoft.ace.oledb.12.0 provider is not registered on the local machine
<p>I have the following program in which i want to insert the values in MS-Access.I am getting the error "the microsoft.ace.oledb.12.0 provider is not registered on the local machine"</p> <p>I have already installed the database engine as per suggestion of some developers, still i am getting the error.</p> <p>I am writing the code on Vista machine with VS-2008 and MS-Access-2007.</p> <p>Please help me to resolve the error</p> <p>public partial class Form1 : Form</p> <pre><code>{ public Form1() { InitializeComponent(); } OleDbConnection con; OleDbCommand cmd; private void btnSubmit_Click(object sender, EventArgs e) { try { con = new OleDbConnection("Provider=Microsft.ACE.Oledb.12.0;Data Source=C:\\Users\\Satish\\Documents\\Testing.accdb"); con.Open(); string cmdText = "Insert Into UserDetail (UsrName,Age,Address,MobileNo) Values ('" + txtName.Text.ToString().Trim() + "','" + txtAge.Text.ToString().Trim() + "','" + txtAddress.Text.ToString().Trim() + "','" + txtMobile.Text.ToString().Trim() + "')"; cmd = new OleDbCommand(cmdText, con); cmd.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } </code></pre>
c# asp.net
[0, 9]
1,353,660
1,353,661
js file cant use jquery
<p>I have a weird bug where I include this files in my section</p> <pre><code>&lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; &lt;script src="js/barScriptOOP.js"&gt;&lt;/script&gt; </code></pre> <p>in the barScriptOOP.js I have this </p> <pre><code>function position_bar(){ //global variable this.sizes = Array(); } //class methods =&gt; getData (from xml file), draw(draws the bar ) position_bar.prototype ={ getData: function(is_load){ var xmlData = Array(); $.ajax({ type: "GET", url: "Bar.xml", dataType: "xml", context: this, success: function(xml) { //extracting new data - some code here xmldata = "blabla"; this.draw(is_load, xmlData); } })//end ajax }, //other functions </code></pre> <p>when I use this script, I get a '$.ajax is not a function' error. 1. I tried editing out <code>this.draw(is_load, xmlData);</code> and it didn't errored me. my programs rpeatly calls the getData function.</p> <p>note: I also get a <code>'$.browser is undefined'</code> error which is in the other function(this is the first error I get).</p> <p>meaning ==> the going to another function unables jquery.</p> <p>any idead what is going on here?</p>
javascript jquery
[3, 5]
1,563,842
1,563,843
Get value of TemplateFields in Gridview
<p>I have a problem with getting value of template field; Gridview is in ContentPlaceHolder1;</p> <p>I'm trying to get value in GridView1_RowCreated event</p> <pre><code>int RowIndex = GridView1.Rows.Count - 1; GridView1.Rows[RowIndex].Cells[0].Text = " " + AltKatLinkler; </code></pre> <p>But this code returns me null or empty.</p> <p>There is my column, column index is 0. Note: I fill GridView by using SqlDataSource. There is no problem i can see row content in browser but i cant access from codebehind.</p> <pre><code>&lt;asp:templatefield headertext="Haberler" sortexpression="KategoriID" xmlns:asp="#unknown"&gt; &lt;ItemTemplate&gt; &lt; a href='&lt;%# "KategoriGoster.aspx?KategoriID=" + Eval("KategoriID")%&gt;'&gt; &lt;%# Eval("KategoriAd")%&gt; &lt;%# Eval("Açıklama")%&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre>
c# asp.net
[0, 9]
605,017
605,018
Is there a PHP equivalent of "new Array (number)" in javascript?
<p>I was trying to convert basic Javascript function into PHP, and I saw that one of the variables was declared <code>var Variable = new Array (13)</code>.</p> <p>I know that PHP variables are declared like: <code>$variable = array()</code></p> <p>but what about the "13" in <code>new Array(13)</code>? does that translate to <code>$variable = array(13)</code>? I've tried that but it didn't seem to work.</p> <p>This in Javascript</p> <pre><code>var results = new Array (13); </code></pre> <p>becomes this in PHP, am I correct?</p> <pre><code>$results = array(13); </code></pre>
php javascript
[2, 3]
4,143,548
4,143,549
please help turn a simple Python2 code to PHP
<p>Sorry to bother again, but I really need help transforming this Python2 code into PHP.</p> <pre><code>net, cid, lac = 25002, 9164, 4000 import urllib a = '000E00000000000000000000000000001B0000000000000000000000030000' b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8) c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfill(8) string = (a + b + c + 'FFFFFFFF00000000').decode('hex') data = urllib.urlopen('http://www.google.com/glm/mmap',string) r = data.read().encode('hex') print float(int(r[14:22],16))/1000000, float(int(r[22:30],16))/1000000 </code></pre> <p>Would be great if someone could help, thanks in advance!</p> <p>EDIT:</p> <blockquote> <blockquote> <blockquote> <p>I see. Can you edit your post to include what you've translated so far please. </p> </blockquote> </blockquote> </blockquote> <pre><code>&lt;?php $net = 25002; $cid = 9164; $lac = 4000; $a = '000E00000000000000000000000000001B0000000000000000000000030000' $b = hex($cid)[2:].zfill(8) + hex($lac)[2:].zfill(8) $c = hex(divmod($net,100)[1])[2:].zfill(8) + hex(divmod($net,100)[0])[2:].zfill(8) $string = ($a + $b + $c + 'FFFFFFFF00000000').decode('hex') $data = 'http://www.google.com/glm/mmap'.$string $r = $data.read().encode('hex') print float(int($r[14:22],16))/1000000, float(int($r[22:30],16))/1000000 ?&gt; </code></pre>
php python
[2, 7]
5,134,400
5,134,401
What's the difference between jQuery.bind() and jQuery.on()?
<p>And why is .on() now preferred in jQuery 1.7?</p>
javascript jquery
[3, 5]
4,256,087
4,256,088
Zooming also count as window resize?
<pre><code>$(window).resize(function(){ console.log('resize'); setheight(); }); </code></pre> <p>I just want to activate when user actually resize the window by draging the edge of the window but not zooming, but it actually activate the function while zoom in and zoom out, how to prevent that??</p>
javascript jquery
[3, 5]
3,559,091
3,559,092
Horizontal scroll on textview on android?
<p>I'm working on a calculator. I noticed that in the default android calc you can scroll the textview horizontally. I looked up the documentation and found out about the attribute <code>android:scrollHorizontally</code> but after adding it to the textview I still cannot do horizontal scroll, there is no further info about it on the documentation leading me to think that only adding the attr should suffice. This is the calculator's textview:</p> <pre><code> &lt;TextView android:id="@+id/edit_text" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight=".8" android:singleLine="true" android:scrollHorizontally="true" android:gravity="center|right" android:text="0" /&gt; </code></pre> <p>When characters exceed the textview width the string is trimmed and ... appear at it's end. What am I doing wrong?</p>
java android
[1, 4]
3,879,394
3,879,395
Prevent event from parent element to child element in jquery
<p>I have bound event as below:</p> <pre><code> $(document).delegate('.budget', 'click', function(e){ if ($(this).hasClass('collapsed')) { $(this).removeClass('collapsed'); $(this).addClass('expanded'); } else if ($(this).hasClass('expanded')) { $(this).removeClass('expanded'); $(this).addClass('collapsed'); } }); </code></pre> <p>Basically this toggles between expand and collapse.</p> <p>I have another event bound as below:</p> <pre><code> $('[id^="tree"]').delegate('.collapsed', 'click', function(e){ var elementId = $(this).attr('id'); hideChildElement(elementId); }); </code></pre> <p>The elements bound by the second event binding are parents of elements binded by first event binding. What happens is that on clicking on the element from the first binding event method also triggers the event bound by second event binding. I want to prevent any events from binding from second event binding to 1st event binding method. </p> <p>If element A is bound to click event from first event binding and B is bound to second event binding (A is inside B or A is child of B), I dont want any event of B to propagate to A. Note I tried <code>e.stopImmediatePropagation();</code> but did not worked</p>
javascript jquery
[3, 5]
185,457
185,458
Saving and restoring state in android
<p>I have searched through this and a few other sites for the answer, but I have been unable to find it. I am trying to save a boolean and an int using onSaveInstanceState and onRestoreInstanceState, but I can't seem to get it to work. It doesn't crash or anything, but it either isn't saving it or it isn't restoring it, or I am stupid and have no idea what I am doing. </p> <hr> <p>Here is what I have for my activity, do I need to have it in my onCreate somewhere or something?</p> <pre><code>public class CannonBlast extends Activity { /** Called when the activity is first created. */ private panel panelStuffz; @Override public void onCreate(Bundle savedInstanceState) { final Window win = getWindow(); super.onCreate(savedInstanceState); panelStuffz = new panel(this); requestWindowFeature(Window.FEATURE_NO_TITLE); win.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(panelStuffz); } @Override public void onSaveInstanceState(Bundle savedInstanceState){ savedInstanceState.putInt("HighLevel", panelStuffz.getLevel()); savedInstanceState.putBoolean("soundstate", panelStuffz.getSound()); super.onSaveInstanceState(savedInstanceState); } @Override public void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); panelStuffz.setHighLevel(savedInstanceState.getInt("HighLevel")); panelStuffz.setSound(savedInstanceState.getBoolean("soundstate")); } @Override public void onResume(){ super.onResume(); } @Override public void onPause(){ super.onPause(); panelStuffz.setThread(null); } @Override public void onStop(){ } </code></pre> <p>I tried putting stuff in the onStop, but it crashes, which is why its empty, in case that matters, thanks in advance</p>
java android
[1, 4]
311,027
311,028
Cannot implicitly convert type 'int' to 'int[]'
<p>I have declared my <code>int[]</code> as follows</p> <p><code>int[] iroleID = new int[] { };</code></p> <p>My code for getting the values from database and assigning to <code>iroleid</code> is as follows</p> <pre><code>if (oAuthenticate.getTaskID(out m_oDataSet1, "uspgetTaskID")) { for (int iTaskid = 0; iTaskid &lt; m_oDataSet1.Tables[0].Rows.Count; iTaskid++) { iroleID = Convert.ToInt32(m_oDataSet1.Tables[0].Rows[iTaskid]["RoleID"].ToString()); strTaskID = m_oDataSet1.Tables[0].Rows[iTaskid]["TaskID"].ToString(); arrTaskID.Add(strTaskID); } } </code></pre> <p>But i am getting an error as mentioned <code>Cannot implicitly convert type 'int' to 'int[]'</code> can any one help me</p>
c# asp.net
[0, 9]
2,485,970
2,485,971
could jquery live solve this problem? table links are bound to click, ajax refresh of rows ruins things
<p>I have a table, that I loop through using jquery and modify the href of each link.</p> <p>IF someone pages through the table, the links are refreshed using ajax (page doesn't reload).</p> <p>Now all my links are not modified since the table has refreshed.</p> <p>Paging is done via a drop down list.</p> <p>Can jquery live help in some way to re-apply the modifications to the urls that I do when the page initially loads up?</p> <pre><code> $("#someTableID").each(function () { // modify href of links in each row, append ?user=342 to it. } </code></pre>
javascript jquery
[3, 5]
742,128
742,129
How to know when the phone receives a message
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2735571/detecting-sms-incoming-and-outgoing">Detecting SMS incoming and outgoing</a> </p> </blockquote> <p>I want to write a app that run silently. The app needs to be notified about new messages. It just needs to to know when a new message is received, doesn't need to read the content of the message.</p> <p>How can I achieve this?</p> <p>Update: Is there a function which checks if there are any new messages at a given time. My idea is to then put this check in a loop, and check for new messages regularily.</p>
java android
[1, 4]
4,557,443
4,557,444
JQuery plugins stop working on appending querystring parameters
<p>I'm new with Javascript programming, I need to insert this code in the body of a page, I take some Get parameters from URL and I attach them to the iframe string:</p> <pre><code>&lt;script&gt; document.write("&lt;iframe width='700' height='500' frameborder='0' src=https://www.mysite.com/abs/indexabs.php?stid=261&amp;lg=en&amp;step2=1&amp;"+unescape(window.location.href.slice(window.location.href.indexOf('?') + 1)))+"&gt;&lt;/iframe&gt;" &lt;/script&gt; </code></pre> <p>This code runs and loads the iframe content...but there are other jQuery elements on the page, that don't run anymore (i.e. Nivo slider, Jquery UI datepicker)</p> <p>Is there a different manner to do the same without jQuery incompatibility?</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,238,954
5,238,955
Upload files using ASP.NET
<pre><code>&lt;form action="http://s0.filesonic.com/abc" method="post" enctype="multipart/form-data"&gt; &lt;input type="file" name="files[]" /&gt; &lt;button type="submit"&gt;submit&lt;/button&gt; &lt;/form&gt; </code></pre> <p>The above code uploads the files to file sonic server, but I want to do this using programmatically using C#, basically my requirement is that the program creates the form and file control and sends the file to the Filesonic server URL mentioned in action attribute..</p> <p>I have gone through many links but with no success, I have gone through the following links with no success.</p> <p>Upload files with HTTPWebrequest (multipart/form-data)</p>
c# asp.net
[0, 9]
5,163,921
5,163,922
Sending data to php page with java
<p>I am trying to send the POST data from java to a PHP page. However it is not working. Whatever I echo in the php page works fine but when I send data it gives- 'undefined index' What could be the problem ? This is my java file.</p> <pre><code>import java.net.*; import java.io.*; class Main { public static void main(String args[]) throws IOException { URL url = new URL("http://localhost/CD/user/test"); String result = ""; String data = "fName=" + URLEncoder.encode("Atli", "UTF-8"); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); try { connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); // Send the POST data DataOutputStream dataOut = new DataOutputStream( connection.getOutputStream()); dataOut.writeBytes(data); dataOut.flush(); dataOut.close(); BufferedReader in = new BufferedReader(new InputStreamReader( url.openStream())); String g; while ((g = in.readLine()) != null) { result += g; } in.close(); } finally { connection.disconnect(); System.out.println(result); } } } </code></pre> <p>And here is my php controller:</p> <pre><code>public function test(){ $test=$_POST['fName']; $all="This is a "; $all=$all." ".$test; echo $all; } </code></pre> <p>When I just send a url request , I get the ouput as 'This is a'. So it is connecting to the url and everything but while sending data, it is not working. Please help! Thank you.</p>
java php
[1, 2]
2,738,298
2,738,299
How to link an Android library jar to a regular Java project?
<p>First I know that this probably sounds like it isn't the best way to do this but changing the overall design is out of my control so please don't post answers to do it a different way. I have a plain Java project that I am linking to my Android application. I need to use some Android stuff inside the Java project so I just linked to the android.jar file. This worked fine for using the Android library until I try to compile which complains about not having a default.properties file. I tried adding the default.properties file to the root of the project but the problem is still there. Any help on this would be great.</p> <p>Thanks</p>
java android
[1, 4]
711,315
711,316
AsyncFileUpload upload complete not working properly
<p>I am using ajaxToolkit:AsyncFileUpload in my asp.net application. In AsyncFileUpload1_UploadedComplete server side event, I am trying to make a label visible and change it text but button is not being enabled. </p> <p>I am using client side event of the asyncfileupload control as well like this:</p> <pre><code>function UploadComplete(sender, args) { var filename = args.get_fileName(); var contentType = args.get_contentType(); var text = "Size of " + filename + " is " + args.get_length() + " bytes"; if (contentType.length &gt; 0) { text += " and content type is '" + contentType + "'."; } document.getElementById('&lt;%= lblStatus.ClientID %&gt;').innerText = text; } </code></pre> <p>All label, button and file upload controls are outside updatepanel. I tried putting controls inside updatepanel as well but same result.</p> <p>Pleas suggest solution</p>
c# asp.net
[0, 9]
303,234
303,235
POST BACK in PHP or JAVASCRIPT?
<p>how can I post back the data that are already in the text field?</p> <p>example: if I miss one of the required field an error will prompt when i click the submit button.</p> <p>How can I make an post back data in that form using php or javascript and make the cursor of the mouse directly located to the field that caused an error?</p>
php javascript
[2, 3]
2,790,657
2,790,658
How to replace the urls into clickable links except anchor text & anchor href?
<pre><code>$str="hi this http://google.com &lt;a href="http: //yahoo.com"&gt;http://yahoo.com&lt;/a&gt;"; </code></pre> <p>i want to convert <a href="http://google.com" rel="nofollow">http://google.com</a> to clickable link in above string but i don't want convert already anchor text &amp; anchor href.</p> <p>how can i achieve that one using php / javascript?</p>
php javascript
[2, 3]
5,414,169
5,414,170
Get textfield values from JavaScript driven form and append those values to a div
<p>I need to grab two textfield values on button submit and then insert them into some HTML and append that HTML to a div.</p> <p>The test page is at <a href="http://seafoammedia.com/dealer/quote/form.php" rel="nofollow">http://seafoammedia.com/dealer/quote/form.php</a> with the main javascript file being jtracker.js</p> <p>The code I've inserted into jtracker.js to try and do this is:</p> <pre><code>$('.jtWidgetGetQuote').click(function(){ $("#map").append("&lt;img src='http://maps.google.com/maps/api/staticmap?maptype=roadmap&amp;amp;markers=size:mid|color:red|"+ fieldNames['origZip'] +"|"+ fieldNames['destZip'] +"&amp;amp;size=270x170&amp;amp;sensor=true' alt='' /&gt;") }) </code></pre>
javascript jquery
[3, 5]
4,257,134
4,257,135
fastest way to find element position using javascript?
<p>I've used jquery's offset().top, but when running it 4000 times in a loop the browsers freezes for a few seconds. Is there a faster way to get this? </p> <p>This is happening on the iPAD the desktop is faster.</p> <pre><code>for (counter=1; counter&lt;4000; counter++) { yPos = Math.round($("#star_"+counter).offset().top); </code></pre>
javascript jquery
[3, 5]
259,011
259,012
Get coordinates of image within a box
<p>I need to grab the following coordinates topX, topY, bottomX, bottomY, as they represent a box around a source image. They are equal to:</p> <p>topX = X coordinate at top left corner on source image<br> topY = Y Coordinate at top left corner on source image<br> bottomX = X coordinate at bottom right corner on source image<br> bottomY = Y coordinate at bottom right corner on source image</p> <p>Here is a sample plugin that calculates these values. The source image width = 1024px and the height = 750px:</p> <p><a href="http://thindery.com/jsfiddle/crop_move.html" rel="nofollow">http://thindery.com/jsfiddle/crop_move.html</a></p> <p>However, I have a new plugin that does more functionality than the above plugin, but I can't figure out how to get these 4 variables I need.</p> <p>here is the jsfiddle <a href="http://jsfiddle.net/thindery/cv96e/" rel="nofollow">http://jsfiddle.net/thindery/cv96e/</a></p> <p>i tried to create my own <code>boxedCoords()</code>, based on how the original plugin calculated the values. However i'm still new to jQuery and I can't get it to work. </p> <p>anybody have an idea how I can get these 4 variables?</p>
javascript jquery
[3, 5]
3,577,429
3,577,430
web deploy causing bad image exception
<p>I have an asp.net web application that uses an unmanaged 32 bit dll that I have successfully running on my development machine, but when I use web deploy to move the code to our test server, I start seeing BadImageFormat exceptions. </p> <p>I set the target in visual web developer to x86 and both machines are running 64 bit os's (windows 7 and windows server 2008 r2). I'm not sure what other differences there could be causing the problem. Thanks for any help you can provide. </p>
c# asp.net
[0, 9]
1,331,254
1,331,255
createuserwizard adding roles to users
<p>Hi I have a createuserwizard controls and I would like assign ROLES when creating a user.</p> <p>Any idea how to do it? Thanks</p> <p>Here my code C#</p> <pre><code> &lt;asp:CreateUserWizard ID="uxCreateUserWizardInput" runat="server" LoginCreatedUser="False"&gt; &lt;WizardSteps&gt; &lt;asp:CreateUserWizardStep runat="server" /&gt; &lt;asp:CompleteWizardStep runat="server" /&gt; &lt;/WizardSteps&gt; &lt;/asp:CreateUserWizard&gt; </code></pre> <p>I found out answer to my questions here <a href="http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx" rel="nofollow">http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx</a></p>
c# asp.net
[0, 9]
302,317
302,318
Running js file only once
<p>I have a small intro with fadein's etc.. But i would only like this to run once. I dont want to run the intro every time the user returns to the home page. Is there a way to run a js file once?</p>
javascript jquery
[3, 5]
1,074,012
1,074,013
how can I execute javascript code every a specific time interval?
<p>I want to ping the server every 2 minutes using jquey? I thought about an open loop with setTimeout function but I think this would crush the browser , any suggestions ?</p>
javascript jquery
[3, 5]
4,882,163
4,882,164
jQuery, Javascript : Javascript wrapped in jQuery(), $() - what does it mean?
<p>I'm having trouble understanding a type of jQuery selection, and I hope someone can explain it to me in clear terms.</p> <p>It's taken from <a href="http://stackoverflow.com/questions/7193425/how-do-you-animate-fb-canvas-scrollto">this Stack Overflow question</a>.</p> <p>Basically, it has the common jQuery: <code>$( selector )</code>.</p> <p>But inside that it has <code>$({ y: iFrameScrollY })</code>.</p> <p>I've never seen this before. <strong>What does it mean to have <code>{ ... }</code> and <code>someVal: anotherVal</code> inside the brackets?</strong></p> <p><em>Also, please recommend a different title for this question, to make it easier for others to find it.</em></p>
javascript jquery
[3, 5]
1,708,663
1,708,664
preventDefault does not behave equal in different browsers
<p>I use jQuery preventDefault on a keydown event: <a href="http://jsbin.com/ixaqok/edit#javascript,html" rel="nofollow">http://jsbin.com/ixaqok/edit#javascript,html</a> When running the example code in Firefox and Opera the keypress event still is fired, but in Chrome, IE8 and Safari it's not.</p> <p>Why? Is preventDefault not supposed to work the same in all browsers?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,535,753
4,535,754
Making a value submission form for a jquery graph
<p>How can I make a page that has 4 or so text boxes for input and then on submission generates a jquery <strong>HightCharts</strong> graph?</p> <p>Any starting point would be awesome</p>
php jquery
[2, 5]
3,835,585
3,835,586
Create ArrayAdapter
<p>I need to do to ArrayAdapter for ListView that will contain the image and the two fields, but I can not figure out how to do it. I can try make this</p> <pre><code>ArrayAdapter adapter = new ArrayAdapter(this, R.layout.list, new ArrayList&lt;ArrayList&lt;string&gt;&gt;{ tmp, wallResults.get("text"), }, new int[]{ R.id.text1, R.id.text2}); </code></pre> <p>But it's not work</p> <p>This is list.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="wrap_content"&gt; &lt;LinearLayout android:layout_width="265dip" android:orientation="vertical" android:layout_height="wrap_content"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/text1" android:textSize="25dip" android:text="This is text1"/&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/text2" android:text="This is text2"/&gt; &lt;ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/text2" android:text="This is text2"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre>
java android
[1, 4]
748,944
748,945
Using Java in Android app to copy code, update name and create new class
<p>I have a java class with a specific function. It allows the user to save a cars setup. I need to create a button that allows them to create as many of these using the existing code and layout over and over and over and be able to separate them by which track they are on, which type of race they are participating in and so on...so every time they hit CREATE NEW TUNE it needs to save it to a different shared prefs name as well or store some other way that i dont know how to implement yet</p> <p>I am very new to this. </p> <p>I have no idea how to do this so i havent tried anything. I do know how to use shared preferences to complete this task but with 82 Tracks and Shared Preferences thats at least 4290 java pages to create. </p> <p>Any help appreciated. </p>
java android
[1, 4]
5,926,733
5,926,734
Event not executing inside the iframe
<p>I am adding content in the <code>iframe dynamically</code> and that content are binded with an event using <code>.live() function</code> :</p> <pre><code> &lt;body&gt; &lt;div id="container"&gt; &lt;iframe id="if" src="something"&gt;&lt;/iframe&gt; &lt;/div&gt; &lt;script&gt; /* binding event */ $(document).ready(function() { $("p").live("mouseover", function() { /* do something */ }); }); /* appending content */ $("#if").contents().find("#someid").append("&lt;p&gt;&lt;/p&gt;"); &lt;/script&gt; &lt;/body&gt; </code></pre> <p>The <code>p tag</code> added successfully but the event is not executed on mouseover. Whats the problem? </p> <p><strong>Note</strong> : I can`t add the binding event script inside the iframe. </p>
javascript jquery
[3, 5]
3,037,128
3,037,129
Session of ASP.net page gets expired even I have made changes in web.config's session timeout value
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/648992/session-timeout-in-asp-net">Session timeout in ASP.NET</a> </p> </blockquote> <p>Hello Guys, In my ASP.net Application, my Session get expired if a page remains open untouched for 10-15 minutes, even through my web.config file i have changed the session timeout property to 60.</p> <p>Can u suggest some solution.</p>
c# asp.net
[0, 9]
486,482
486,483
Beginner to JSON and PHP
<p>Sorry about the simple question.</p> <p>I am posting a JSON object to a PHP page using the following code:</p> <pre><code> $.get("ProcessName.php", { name: "John" }, function(data){ alert("Data Loaded: " + data); }); </code></pre> <p>What code do I need to write in ProcessName.php to have the alert show the name is John?</p> <p>I realise I could process the JSON object on the client but this is a simple example to help me understand how PHP pages read JSON objects sent from the client. I have ready many questions and beginner tutorials but they all seem to skip this simple step or maybe I am missing something.</p> <p>Thanks,</p>
php jquery
[2, 5]
4,093,753
4,093,754
What is the alternative using not CSS selector in Jquery 1.8.0?
<p>When using Jquery to exclude elements from selection I like to use <b>CSS :not</b> selector because of faster performance <a href="http://jsperf.com/jquery-css3-not-vs-not" rel="nofollow">:not() VS .not()</a> , but from Jquery 1.8.0 it is not working anymore:( Is there some other alternative to use with same or better performance (except <b>.not()</b> ) in Jquery? THX!!</p> <p>This works with Jquery 1.7.2 <br/><a href="http://jsfiddle.net/AmKBS/" rel="nofollow">Fiddle here</a> <br/>But NOT with Jquery 1.8.0 <br/><a href="http://jsfiddle.net/E7gBM/" rel="nofollow">Fiddle here</a></p> <pre><code>$(document).ready(function(){ $("ul li:not(:first)").hide(); }); </code></pre>
javascript jquery
[3, 5]
1,503,632
1,503,633
e.stopPropagation() - is the clicked element a propagation or the original?
<p>How can you check whether the element is the original element or a propagation of the clicked element?</p> <hr> <h3>Edit</h3> <p>If I do this, <code>'propagation'</code> is always alerted:</p> <pre><code>this.row.click(function(e){ if(e.target === this) alert('origin'); else alert('propagation'); //e.stopPropagation(); }); </code></pre>
javascript jquery
[3, 5]
246,830
246,831
Alert which checkbox[x] of array was clicked?
<p>My code onclick for each checkbox function is:</p> <pre><code>function testc() { var values1 = new Array(); jQuery.each(jQuery("input.id1"), function() { values1.push(jQuery(this).attr("name")); }); var values2 = new Array(); jQuery.each(jQuery("input.id76"), function() { values2.push(jQuery(this).attr("name")); }); //build arrays var attname = "[name='"+values1[this]+"']"; //there should also be indexof clicked checkbox jQuery("input:[type=checkbox]"+attname+"").attr("checked", true); alert(values1.findIndex(jQuery(this).attr("name"))); } </code></pre> <p>What's wrong? :/ I think the problem is how I'm getting indexes.</p>
javascript jquery
[3, 5]
5,152,570
5,152,571
2 IntentServices accessing the same data on file system.. safe?
<p>I'm relatively sure with this, but I need your opinion. I have two IntentServices on Android, both have access to the application's private file system.</p> <p>The filesystem works like a queue - the first IntentService only performs write operations, that means it does nothing other than creating new files. The second IntentService only reads and deletes files from the application's filesystem.. similar to the "producer/consumer" principle. </p> <p>In my opinion, there is no need to do any syncing or locking operations, even if both services have their own threads. I am correct here?</p> <p>Thank you</p>
java android
[1, 4]
5,731,917
5,731,918
javascript countdown timer for session timeout
<p>I want to alert the user that the session timeout is about to expire. I want to have a popup with an OK button and show the seconds ticking down on the popup. Can i do this with just java script? Im OK with using C# code behind also.</p> <p>Right now it detects session timeout and pops up telling them the session has expired.</p> <pre><code>&lt;script type="text/javascript"&gt; var sessionTimeout = "&lt;%= Session.Timeout %&gt;"; function DisplaySessionTimeout() { sessionTimeout = sessionTimeout - 1; if (sessionTimeout &gt;= 0) window.setTimeout("DisplaySessionTimeout()", 60000); else { alert("Your current Session is over due to inactivity."); } } &lt;/script&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
2,956,895
2,956,896
How to get the order of dynamically created DropDownLists
<p>I've created some drop down lists using JavaScript, ASP.NET. </p> <p>A user can add as many drop down lists as he wants by clicking a "+" button and removing them by clicking a "-" button.</p> <p>If it's hard to understand what I mean pls see " <a href="http://stackoverflow.com/questions/10101262/how-to-implement-a-list-of-dropboxes-in-c-sharp">How to implement a list of dropboxes in C#</a> ".</p> <p>And now I'd like to implement the code behind and want to define the order of the drop down lists, but I don't know which one is my first drop down list, etc.</p> <p>We assume that all <code>&lt;asp:DropDownList&gt;</code> contain the following for list elements: method1, method2, method3 and method4. If a user selects an element, a method in the codebehind is implemented. </p> <p>Example: dropboxlist1: select list item method2,<br> dropboxlist2: select list item method1,<br> dropboxlist3: select list item method3, </p> <pre><code>string txt= ""; if (dropboxlistID.Text == "method1"){ txt = method1Imp(); } else if (dropboxlistID.Text == "method2") { txt = method2Imp(); } else if (dropboxlistID.Text == "method3") { txt = method3Imp(); } else { } </code></pre> <p>But at this moment I don't have any idea which drop down lists came first and which method should be performed on my string first.</p>
c# javascript asp.net
[0, 3, 9]
1,957,523
1,957,524
Prevent link <a> without href from clicking
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1164635/how-to-enable-or-disable-an-anchor-using-jquery">How to enable or disable an anchor using jQuery? </a> </p> </blockquote> <p>I have this:</p> <pre><code>&lt;a onclick="javascript:btnSave_onclick();" class="button"&gt;Save&lt;/a&gt; </code></pre> <p>Basically, the link is acting like a button.</p> <p>However, there are some conditions when I need to make it disabled. How to do this?</p>
javascript jquery
[3, 5]
768,715
768,716
How to realize dynamic chained menu in php and jQuery/ajax?
<p>I'm trying to realize the function similar to the website: <a href="http://visualjquery.com/" rel="nofollow">site</a>. I know it's done with jQuery. But can someone guide me with more details? </p> <p>Thanks very much.</p> <p>Edit:</p> <p>The function i need is the chained menu and a result set on the right side. I want the chained menu to be generated automatically from mysql. </p>
php jquery
[2, 5]
290,781
290,782
how to Call cs function from html button
<p>Html Button input id="Button1" type="button" value="button" runat="server"/></p> <p>.cs file: </p> <p>public void display() { Response.Redirect("default.aspx"); } </p> <p>How to call the display function which is in .cs file from html button click </p>
c# asp.net
[0, 9]
2,440,888
2,440,889
sending arguments with onserverClick
<p>How can i send argument with onserverclick event </p> <p>Here is my code:</p> <pre><code>&lt;a href="javascript:void(0)" ID="platformHyperLink" runat="server" class="platformElementHL" onserverclick='&lt;%# platformHyperLink_Click("+Eval("PLATFORM_ID").ToString()+")"%&gt;' /&gt;click&lt;/a&gt; </code></pre> <p>server code:</p> <pre><code>protected void platformHyperLink_Click(object sender, EventArgs e) { findDevice.Visible = true; LinkButton lk = sender as LinkButton; ClearAndHide(false); findDevice.Visible = true; DeviceSelectedValueHiddenField.Value = null; ModelSelectedValueHiddenField.Value = null; OsSelectedValueHiddenField.Value = null; Label PlatformNameLabel = lk.NamingContainer.FindControl("PlatformNameLabel") as Label; platformName = PlatformNameLabel.Text; SelectYourDeviceLabel.Visible = true; platformID = Convert.ToInt32(lk.CommandArgument.ToString()); DataTable DT = WebsiteDataHelper.GetPlatformDevice(platformID); if (DT.Rows.Count == 0) { DeviceListBox.Visible = false; // DeviceNoDataFound.Visible = true; SelectYourDeviceLabel.Visible = false; } else { SelectYourDeviceLabel.Visible = true; DeviceListBox.Visible = true; // DeviceNoDataFound.Visible = false; for (int i = 0; i &lt; DT.Rows.Count; i++) { string text = DT.Rows[i]["DEVICE_NAME"].ToString(); string val = DT.Rows[i]["DEVICE_ID"].ToString(); RadListBoxItem item = new RadListBoxItem(text, val); DeviceListBox.Items.Add(item); } } } </code></pre> <p>The problem is that i can't access platformHyperlink and i don't know why please help me </p>
c# asp.net
[0, 9]
1,710,907
1,710,908
How to load image once
<p>am rendering around 3000 records , </p> <p>So row like Customer Profile edit </p> <p>Customername , Action</p> <pre><code> 1 john editimage | Delete image 2 john editimage | Delete image 3 john editimage | Delete image 4 john editimage | Delete image 5 john editimage | Delete image ... ... 3000 john editimage | Delete image </code></pre> <p>So every time edit and delete images loading ,</p> <p>chk this image<img src="http://i.stack.imgur.com/ZNM11.jpg" alt="alt text"></p>
php javascript
[2, 3]
5,151,869
5,151,870
Pointer deferencing and manipulating objects which are being pointed to - equivalent constructs in Java
<p>Hello<br> In C++ you can do the following:</p> <pre><code>int x = 5 cout &lt;&lt; x; // prints 5 int* px = &amp;x; (*px)++; cout &lt;&lt;x; // prints 6 </code></pre> <p>Is there an equivalent construct in Java</p>
java c++
[1, 6]
3,698,768
3,698,769
Setting image using a method but image's not displaying
<pre><code>&lt;div class="sp1" style="background-image:url(&lt;%#GetImage()%&gt;);" runat="server"&gt;&amp;nbsp;&lt;/div&gt; </code></pre> <p>Tested my method by assigning the String(containing my image's path) returned by it to a label..its getting the path alright..then why wont it display when I run the code?</p> <p>when I viewed the page's source..this is what I see..</p> <pre><code> &lt;div class="sp1" style="background-image:url(&amp;lt;%#GetImage()%&gt;);"&gt;&amp;nbsp;&lt;/div&gt; </code></pre>
c# asp.net
[0, 9]
1,983,178
1,983,179
Get access to all css style properties?
<p>I want to get access to all <strong>CSS</strong> properties (not only for a specific selector or element but all) through <strong>JavaScript</strong>. </p> <p>I want to iterate through all properties of the <code>.style</code> collection.</p> <p>How can i do this?</p>
javascript jquery
[3, 5]
2,431,560
2,431,561
How do i call a function every day between 10 am to 11 am
<p>I create a function in c# and published on server. But now i want to run this function between 10am to 11am only. How can i create this?</p>
c# asp.net
[0, 9]
4,558,100
4,558,101
ASP.NET: Build user control that take a list as parameter?
<p>How can I build an user control that takes a list as a parameter, i.e:</p> <pre><code>&lt;foo:TabMenu runat="server"&gt; &lt;Tabs&gt; &lt;Tab Label="Tab1" PanelId="pnlTab1"/&gt; &lt;Tab Label="Tab2" PanelId="pnlTab2"/&gt; &lt;Tab Label="Tab3" PanelId="pnlTab3"/&gt; &lt;/Tabs&gt; &lt;/foo:TabMenu&gt; </code></pre>
c# asp.net
[0, 9]
5,101,218
5,101,219
How to show human-readable "time ago"
<p>My user last logged in at 15:50:09 Wednesday, January 25, 2012 IST how can i show it as "10 minutes ago". Is there any js?</p>
javascript jquery
[3, 5]
3,668,420
3,668,421
Cannot convert string to int, must be simple but i m missing somewhere
<p>here, i want to check only if the column Active is Yes, then get into the if loop. But it gives me an error "Cannot convert from string to int" for the last condition in if. What do you guys i can do. Thanks!!</p> <pre><code>if (ds != null &amp;&amp; ds.Tables != null &amp;&amp; ds.Tables.Count &gt; 0 &amp;&amp; ds.Tables[0].Rows.Count &gt; 0 &amp;&amp; ds.Tables[0].Columns[0].ColumnName["Status"] == "Y") { disableloc.DataSource = ds; disableloc.DataBind(); } else { ds = null; disableloc.DataSource = ds; disableloc.DataBind(); </code></pre> <p>The stored procedure is SELECT ML.locationname, rtrim(ML.address) + (CASE WHEN ML.Address2 IS NOT NULL THEN ('' '' + rtrim(ML.Address2)) ELSE '''' END) + '' - ''+ ML.city + '', ''+ ML.state as address, ML.locationid, ML.merchantid, case when ML.active &lt;> ''Y'' then ''Deactive'' else ''Active'' end [Status], (SELECT count(*) as retval FROM merchant_statistics WHERE type = ''merchant'' AND locationID= ML.LocationID AND status = ''clicked'') as stat, ''&nbsp;'' as button,'' '' as blank ,<br> dbo.GetCouponCountForLocations(@_merchantid,ML.locationID) couponCount, MP.DomainName, (SELECT Count(*) FROM Promotion WHERE LocationId = ML.locationid AND PostType = 1) AS jobs FROM merchant_location ML , Merchant_Pages MP WHERE MP.LocationID = ML.LocationID AND ML.merchantid = @_merchantid Order By '</p>
c# asp.net
[0, 9]
5,918,948
5,918,949
Using SharedPreferences inside MyXMLHandlerTemp
<p>I have a class named <strong>MyXMLHandlerTemp</strong> which <strong>extends DefaultHandler</strong>. The class is used for parsing data. </p> <p>I want to use <strong>SharedPreferences</strong> inside MyXMLHandlerTemp class but it gives me error saying </p> <blockquote> <p>getSharedPreferences(String,int) is undefined for the type MyXMLHandlerTemp </p> </blockquote> <p>Is it possible to use SharedPreferences inside MyXMLHandlerTemp? If not then what can be alternative solution?</p>
java android
[1, 4]
5,423,231
5,423,232
Extracting page title using javascript
<p>I'm trying to extract the page title of an external site by using a url.</p> <p>You know how "document.title" returns the title of the page the JS is running on? I was wondering if I could say "'http://google.com'.title" (doesn't work) or something similar to get the title of another page.</p> <p>UPDATE: I did some searching and apparently this can be done with JQuery. see <a href="http://www.google.com/search?q=jquery+extract+page+title" rel="nofollow">http://www.google.com/search?q=jquery+extract+page+title</a>. and if I understand correctly JQuery is kind of an extension of javascript and its supported in what I'm doing. so can someone post the JQuery code that can accomplish this?</p> <p>this is the basic idea: there is an input box labled "url". And a button labled "Convert to page title" and the intention is that the value of the input box will change to the Title of the url given by the user (after they click on the button)</p> <p><code>function getTitle(url) {</code></p> <pre><code> var title = [CODE HERE]; return title; </code></pre> <p><code>}</code></p> <p>thank you!</p>
javascript jquery
[3, 5]
525,962
525,963
sending an arraylist back to the parent activity
<p>i am trying to pass an arraylist back to my parent activity</p> <p>Here is the simple code.</p> <pre><code>private ArrayList&lt;Receipt&gt; receipts = new ArrayList&lt;Receipt&gt;(); Intent data = new Intent(); data. // what to do here? setResult(RESULT_OK, data); //************************************ </code></pre> <p>This is basic receipt Class</p> <pre><code>public class Receipt { public String referenceNo; public byte[] image; public String comments; public Date createdOn; public Date updatedOn; </code></pre> <p>Tell me how can i add it in my intent and how can i retrieve it back in parent activity from </p> <pre><code>onActivityResult(final int requestCode, int resultCode, final Intent data) </code></pre>
java android
[1, 4]
71,723
71,724
jquery ui - making dialogs more "dynamic"?
<p>I have a page that uses multiple dialogs for different things. Some dialogs may have buttons that others do not while other may need to be a different height than another... All of them have a set of params that will not change. My question, can I have a default like:</p> <pre><code>$('.someElement').dialog({ width: 999, show: 'slide', hide: 'slide', ETC: 'some other option' }); </code></pre> <p>and use it for all of my dialogs, then pass buttons or height to it dynamically when I open a dialog? It just seems wrong to have something like the above for every dialog I need...</p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,990,128
4,990,129
Window.onload event and $(document).ready()
<p>I am learning jQuery. Could someone please explain what the difference between the <code>window.onload</code> event and <code>$(document).ready()</code> in jQuery is? </p> <p>Regards, JN</p>
javascript jquery
[3, 5]
4,964,419
4,964,420
Change selected dropdown by ID
<p>I've seen that you can change the selected dropdown item by value but I'd like to do it by the option ID because the values are created dynamically. I am creating a questionnaire with a dropdown menu, the section with questions, and a previous/next button. The values of the dropdown are dynamically created in a php array.</p> <p>The way I have it set up is similar to this:</p> <pre><code>&lt;select id="myDropdown"&gt; &lt;option id="1" value="dynamicallycreated1"&gt;&lt;/option&gt; &lt;option id="2" value="dynamicallycreated2"&gt;&lt;/option&gt; &lt;option id="3" value="dynamicallycreated3"&gt;&lt;/option&gt; &lt;/select&gt; </code></pre> <p>The select is created through php with the index of the array acting as the ID. There are previous/next buttons on the page to move back/forward from section to section. I want the dropdown to change to the appropriate item when the user clicks the next or previous button. I can easily grab the index through my current javascript so how can I change the dropdown using this index as the ID? Thanks!</p>
php javascript jquery
[2, 3, 5]
4,766,119
4,766,120
using this.addClass (Jquery)
<p>I am trying this.addclass in jquery to add a class to a DIV, that could be unknown. Can this be solved in this way? </p> <pre><code>&lt;style&gt;.classOne { font-size:24px; color:#009900;}&lt;/style&gt; &lt;script&gt; function hello() { alert(); $(this).addClass('classOne'); } &lt;/script&gt; &lt;div class="something" onclick="hello();"&gt; Test information &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,981,669
5,981,670
using jquery in two usercontrol in the same page
<p>I have two user control in my page uc1 and uc2. I want to make sure that the js function inside these two user control fire when the document is ready.</p> <p>When I am using '$(document).ready({function(){//something});' in both the user control only the function of the first user control is loading. the function for the second user control was not called.</p> <p>Can't I use '(document).ready' in two different user control in the same page? If not then how can I make sure that the respective methods are called only when the document is ready?</p>
jquery asp.net
[5, 9]
981,212
981,213
Search a multitude of arrays
<p>Hey, I am searching each array separately for specific inputs from a user.</p> <pre><code>if ($.inArray(i.val(), helloInputArray) &gt; -1) { //IF HELLO if (hello == 0) { //HAVE YOU ALREADY SAID HI? r = Math.floor(Math.random()*4); o.html(o.html()+helloOutputArray[r]); hello = 1; i.val(''); } else { //IF YOU'VE ALREADY SAID HI... o.html(o.html()+'I already said hi to you!&lt;br /&gt;'); i.val(''); } } else if ($.inArray(i.val(), byeInputArray) &gt; -1) { //IF GOODBYE if (bye == 0) { r = Math.floor(Math.random()*4); o.html(o.html()+byeOutputArray[r]); i.val(''); } else { o.html(o.html()+'I already said goodbye... Go away!'); i.val(''); } } </code></pre> <p>Is there any way I can just search all arrays at once, as I'm going to need to search each array for a string.</p> <p><em>ahem</em></p> <p>so - If I typed 'ae', then I want it to go through every item in every array and return ALL the strings with 'ae' in it.</p> <p>^_^ &lt;( bad wording... )</p>
javascript jquery
[3, 5]
3,533,424
3,533,425
How to avoid "the property of undefined" error without having huge if statement in JavaScript?
<p>I usually find myself working with deep objects like this:</p> <pre><code>var x = { y: { z: { a:true } } } </code></pre> <p>And somewhere in the code:</p> <pre><code>if( x.y.z.a === true ){ //do something } </code></pre> <p>And in some cases any of the x,y,z variables could be undefined, in which case you would get "<strong>Cannot read property * of undefined</strong>"</p> <p>Potential solution is:</p> <pre><code>if( x &amp;&amp; x.y &amp;&amp; x.y.z &amp;&amp; x.y.z.a === true ){ //do something } </code></pre> <p>jsfiddle: <a href="http://jsfiddle.net/EcFLk/2/">http://jsfiddle.net/EcFLk/2/</a></p> <p>But is there any easier/shorter way? Inline solutions (without using special function) would be great. Thanks.</p>
javascript jquery
[3, 5]
1,489,683
1,489,684
How to create a function that calls a ClientValidationFunction?
<p>Is this possible to do this in Javascript and how? </p> <pre><code>function MyClick(){ ValidateTime(sender, args); // what is the right way to call it? } function ValidateTime(sender, args) { //sender and args;these arguments are from a validator control } </code></pre> <p>I need for MyClick to call that <code>ClientValidationFunction(ValidateTime)</code>.</p>
javascript jquery asp.net
[3, 5, 9]
3,511,303
3,511,304
Text View and Intent
<p>So I have an activity that extends listview, and I want to create another activity that has 2 edit text fields. The second activity is opened when I click a menu item... I already did this but I don't know how to make 2 text fields in the second activity. And I was wondering if the second activity has an xml file ? and where it is or how can I change the layout of that activity. Thanks a lot!</p>
java android
[1, 4]
4,005,263
4,005,264
constant/literal String pointer
<p>What are the benefits of doing:</p> <pre><code>String *hello_world; hello_world="Hello World"; </code></pre> <p>vs</p> <pre><code>String hello_world; hello_world="Hello World"; </code></pre> <p>For the first one, the characters that make up the string literal or constant, are stored inside a string table by the compiler and <code>hello_world</code> points to the string in the table.</p> <p>In the second one we set aside memory for the string.</p> <p>Is this just a memory usage? In that case wouldn't it always be better to have strings point to the string table created by the compiler to save memory? </p> <p>Also should you always use pointers instead of indexing an array? Or is this really dependent on the size of our data?</p> <p>Thank you.</p>
java c++
[1, 6]
5,130,591
5,130,592
why java script cannot access this asp.net var?
<p>I have this c# user control class:</p> <pre><code>public partial class UserControls_JsTop : System.Web.UI.UserControl { public static string sidebarBannerUrl = getSideBarBannerImgUrl(); protected void Page_Load(object sender, EventArgs e) { } public static string getSideBarBannerImgUrl(){ DataClassesDataContext db = new DataClassesDataContext(); var imgUrl = (from b in db.Banners where b.Position.Equals(EBannersPosition.siderbar.ToString()) select b).FirstOrDefault(); if (imgUrl != null) return imgUrl.Path; return String.Empty; } } </code></pre> <p>I try to acces the static var in a js script:</p> <p>load it here:</p> <pre><code>&lt;script type="text/javascript"&gt; var categoryParam = '&lt;%# CQueryStringParameters.CATEGORY %&gt;'; var subcategory1Param = '&lt;%# CQueryStringParameters.SUBCATEGORY1_ID %&gt;'; var subcategory2Param = '&lt;%# CQueryStringParameters.SUBCATEGORY2_ID %&gt;'; var imgUrl = '&lt;%# UserControls_JsTop.sidebarBannerUrl %&gt;'; &lt;/script&gt; </code></pre> <p>and use it here (imgUrl):</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $(function () { $(document.body).sidebar({ size: "30px", // can be anything in pixels length: "270px", // can be anything in pixels margin: "300px", // can be anything in pixels position: "left", // left / bottom / right / top fadding: "0.8", // 0.1 to 1.0 img: imgUrl, openURL: "www.twitter.com/amitspatil" }); }); &lt;/script&gt; </code></pre> <p>I do not understand why it is empty. Please trust me that there is a record in DB with that condition.</p> <p>I think there is some js problem when loading the var...</p> <p>Do you know where?</p> <p>thanks</p>
c# asp.net jquery
[0, 9, 5]
5,817,089
5,817,090
How to rearrange an array in JQuery
<p>I have this being POSTed to my script</p> <pre><code>Array ( [0] =&gt; Array ( [name] =&gt; test1 [value] =&gt; test1 value ) [1] =&gt; Array ( [name] =&gt; test2 [value] =&gt; test2 value ) ) </code></pre> <p>What I want is:</p> <pre><code>Array ( [0] =&gt; Array ( [test1] =&gt; test1 value ) [1] =&gt; Array ( [test2] =&gt; test2 vlaue ) ) </code></pre> <p>This is the JQuery I am using to post the data. Can someone tell me what I need to achieve this?</p> <pre><code>var vals = $("#post").find('input,select,textarea').serializeArray(); vals.push({ name: 'article', value: CKEDITOR.instances.article.getData() }); var qs = $.param(vals); $.post('test.php', { data: vals }, function (data) { if(data.success == 0) { } }, 'json'); </code></pre> <p><strong>EDIT:</strong> What I am looking to do is to simply access each key value on my server like this:</p> <pre><code> echo $_POST['test1']; ... </code></pre>
javascript jquery
[3, 5]
4,622,912
4,622,913
very simple javascript failing
<p>Working Example:</p> <p>This is almost identical to code I use in another places on my page but fails here for some reason.</p> <pre><code>&lt;?php //$p = "test"; ?&gt; &lt;script&gt; alert('posts are firing? '); parent.document.getElementById('posts').innerHTML = "test"; &lt;/script&gt; </code></pre> <p>Failing example: (alert still works)</p> <pre><code>&lt;?php $p = "test of the var"; ?&gt; &lt;script&gt; alert('posts are firing? '); parent.document.getElementById('posts').innerHTML = '&lt;?php $p; ?&gt;'; &lt;/script&gt; </code></pre>
php javascript
[2, 3]
670,709
670,710
POST or GET method?
<p>We have a service provider that allows us to connect to his payment page for payments, however the code he uses is php but we would like to do it in asp.net.</p> <p>Problem is I don't really understand what the method should be, <code>POST</code> or <code>GET</code>, basically we need to redirect to the client with underlying parameters(not query strings) and then our current page that calls the request must be redirected to the client page with the parameters as well.</p> <p>I do get the response witch is basically markup, but that's not what I want, I want it to redirect to the payment page, can someone please tell me what I do wrong.Thanks Here is my code I use for the <code>POST</code> Method:</p> <pre><code>string query = string.Format("description={0}&amp;amount={1}&amp;merchantIdent={2}&amp;email={3}&amp;transaction={4}&amp;merchantKey={5}", description.ToString(), amount.ToString(), merchantIdent.ToString(), email.ToString(), id.ToString(), merchantKey.ToString()); // Create the request back string url = "https://www.webcash.co.za/pay"; HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); req.Method = "POST"; req.AllowAutoRedirect = true; req.ContentType = "application/x-www-form-urlencoded"; req.ContentLength = query.Length; req.AllowAutoRedirect = true; StreamWriter stOut = new StreamWriter(req.GetRequestStream(),System.Text.Encoding.ASCII); stOut.Write(query); stOut.Close(); // Do the request StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream()); string response = stIn.ReadToEnd(); stIn.Close(); </code></pre>
c# asp.net
[0, 9]
2,770,209
2,770,210
Android keyboard not opening for input tag bound to touchstart
<p>Markup:</p> <pre><code>&lt;section id="loginform"&gt; &lt;input type="text" id="username" placeholder="Username"/&gt; &lt;input type="password" id="password" placeholder="Password"/&gt; &lt;input type="submit" value="login" id="login"/&gt; &lt;/section&gt; </code></pre> <p>JavaScript:</p> <pre><code>$('#loginform #username').bind('touchstart', function(e) { $(this).focus() }) $('#loginform #password').bind('touchstart', function() { $(this).focus() }) </code></pre> <p>Opening this site on Android (4.0) and clicking in the input-field for username or password, no keyboard pops up... If I do some code like this:</p> <pre><code>$('#loginform #username').bind('touchstart', function(e) { alert("android why u no keyboard show!?") $(this).focus() }) </code></pre> <p>Then the keyboard will pop up... Alerting <code>e.isDefaultPrevented()</code> returns <code>false</code></p> <p>Any idea of what can be wrong?</p> <p>Thanks</p>
javascript android jquery
[3, 4, 5]
2,134,722
2,134,723
Getting file full path when uploading file in html in firefox
<p>I want to get the full file path when uploading a file.</p> <p>. If we use safari or IE browser i am getting full file path but in firefox it is not working</p> <p>how can i get the full file path name by using javascript or jquery in firefox.</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,109,644
1,109,645
How to get the values in gridview row, in which the radio button is selected using c#
<p>I am using the gridview control, if the use selects a row using the radio button control in a row, On the selected index change i want to get the all the values in the row using c#.</p> <p>How?</p>
c# asp.net
[0, 9]