Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
4,824,105
4,824,106
how to send parameters with file in android
<p>I am uploading image in android. Currently my code only uploads file but I also want to send some parameter. I am trying following</p> <pre><code>FileInputStream fileInputStream = new FileInputStream(sourceFile); URL url = new URL(upLoadServerUri); conn = (HttpURLConnection) url.openConnection(); // Open a HTTP connection to the URL conn.setDoInput(true); // Allow Inputs conn.setDoOutput(true); // Allow Outputs conn.setUseCaches(false); // Don't use a Cached Copy conn.setRequestMethod("POST"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("ENCTYPE", "multipart/form-data"); conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary); conn.setRequestProperty("uploaded_file", fileName); dos = new DataOutputStream(conn.getOutputStream()); dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""+ fileName + "\"" + lineEnd); dos.writeBytes(lineEnd); //Sending data dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name=\"paramName\"" + lineEnd); dos.writeBytes(lineEnd); dos.writeBytes(globalUID); </code></pre> <p>and on the server side I am using php. here is how I am trying to get that parameter</p> <pre><code>$param = $_POST["paramName"]; target_path1 = "./places_photos/" . $param; </code></pre> <p>But my current code does upload file but it does not send parameters. How can I send parameters and how can I get them on server side?</p> <p><strong>Update</strong></p> <p>Currently, the image is saved in <code>places_photos</code> directory which is mentioned in <code>$target_path1</code> variable. What I want is to save that image in user's directory and that directory is named as user id. But unfortunately I am not getting userid on server side. How can I send userid to server along with file?</p>
java php android
[1, 2, 4]
2,638,220
2,638,221
Deleting Gridview rows using Javascript
<p>I have a javascript function to clear my form which includes a gridview, I previously tried another way to delete the rows without postback but somehow when I tried to add a new row, all the previous bounce back. Maybe I am using viewstate to maintain my gridview, not too sure but below is what I am doing which works well but somehow it only deletes one row, I guess probably when the postback occurs, the loop got wiped out. Any advice? I need the loop to delete all my gridview rows. Thanks! </p> <pre><code> for (i = 0; i &lt; camGv.rows.length; i++) { window.__doPostBack('ctl00$cphBody$gvCamVoucher', 'Delete$0'); } </code></pre>
javascript asp.net
[3, 9]
358,658
358,659
confirmation box before closing page
<p>Is it possible to have a confirmation box before closing the page and not on every page load or navigating away but the confirmation box will just appear when the user closes the window?</p>
javascript jquery
[3, 5]
458,707
458,708
jquery: $(window).scrollTop() but no $(window).scrollBottom()
<p>I want to place an element to the bottom of the page whenever the user scrolls the page. It's like "fixed position" but I can't use "position: fixed" css as many of my clients' browser can't support that.</p> <p>I noticed jquery can get current viewport's top position, but how can I get the bottom of the scroll viewport?</p> <p>So I am asking how to know: $(window).scrollBottom() </p>
javascript jquery
[3, 5]
2,860,076
2,860,077
How do I run a python file that is read into a std::string using PyRun
<p>I am embedding Python into my C++ program, and have used PyRun_SimpleString quite effectively but now am having trouble.</p> <p>What I have done is loaded a python.py file a std::string but am now having troubles running it. PyRun_SimpleFileEx didn't seem to do the trick either so some help would be great!</p> <pre><code> std::string content; if(!ail::read_file(python_script, content)) { error("Failed to load Python script \"" + python_script + "\""); return false; } if(prompt_mode) initialise_console(); content = ail::replace_string(content, "\r", ""); Py_Initialize(); initialise_module(); std::string script_directory; if(get_base_name(python_script, script_directory)) PyRun_SimpleString(("import sys\nsys.path.append('" + script_directory + "')\n").c_str()); write_line("Script dir: " + script_directory); ////-python_script H:\\CRAW\\craw\\script\\craw.py //content.c_str() //FILE *fp; //fp = fopen("H:\\CRAW\\craw\\script\\craw.py", "r"); //PyRun_SimpleFileEx(fp, "craw.py", 1); if(PyRun_SimpleString(content.c_str()) != 0) { write_line("The main Python script contained errors."); return false; } //PyRun_SimpleString(("execfile('" + ail::replace_string(python_script, "\\", "\\\\") + "')").c_str()); return true; </code></pre>
c++ python
[6, 7]
745,877
745,878
Pass a value from one page to another use button or link and code?
<p>In asp.net, C#, I actually want 3 conditions on a particular click to delete a record: 1. Ask for confirmation 2. Redirect to another page 3. Pass the id of the record to be deleted internally(not present in any text field or anything) to the next page whose record has to be deleted</p> <p>If i use a link i an fulfill the 2nd and 3rd condition by using a query string</p> <p>but if i use a button, then i can fulfill the 1st and 2nd condition. </p> <p>and in the onclick i redirect it to the next page.</p> <p>I tried with postback url also, it gives the value 0.</p> <p>Can anybody tell me what should i use and how so that all the 3 conditions are fulfilled?</p>
c# asp.net
[0, 9]
3,683,454
3,683,455
Javascript URL Location
<p>I want to check to see if part of my url location have this in it: ?TEST=NEWJERSEY</p> <p>How do i write that?</p>
javascript jquery
[3, 5]
5,520,786
5,520,787
How to determine Browser type from Server side using ASP.NET & C#?
<p>I want to determine the browser type in code-behine file using C# on ASP.NET page.</p> <p>If it is IE 6.0, I have to execute certail lines of code.</p> <p>Can anybody provide code sample.</p> <p>Appreciate your help.</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,536,690
3,536,691
how to set a style to a linkbutton in grid as deletebutton for enable and disable effects
<p>I have a linkbutton in grid as a deletecolumn. I disable it when a user doesn't have permission to delete records, but when the button is disabled or enabled its appearance is the same. I need to set a style to change it's appearance when it's enable state is changed. Here is my code:</p> <pre><code> LinkButton lbDeleteCommand = e.Item.Controls[e.Item.Controls.Count - 2].Controls[0] as LinkButton; LinkButton lbEditCommand = e.Item.Controls[e.Item.Controls.Count - 1].Controls[0] as LinkButton; if (lbDeleteCommand != null) { lbDeleteCommand.Text = "&lt;img alt='' src='../images/Delete.gif' border='0' /&gt;"; lbDeleteCommand.ToolTip = "حذف اطلاعات"; lbDeleteCommand.Font.Name = "Tahoma"; lbDeleteCommand.Attributes["onclick"] = "return confirm('آیا از حذف اطلاعات انتخاب شده مطمئن هستید؟','هشدار')"; lbDeleteCommand.Enabled = false; } </code></pre> <p>please help me. thanks</p>
c# asp.net
[0, 9]
5,949,906
5,949,907
Unable to debug a ResourceNotFoundException
<p>I'm having a little trouble trying to debug a <code>Resources$NotFoundException</code>. I'm trying to add items from an enum to a <code>AlertDialog</code> dynamically:</p> <p>Here's the code from my <code>Activity</code>:</p> <pre><code>final ArrayList&lt;CharSequence&gt; lstChoices = new ArrayList&lt;CharSequence&gt;(); for (TrendingManager.Filter fltFilter : TrendingManager.Filter.values()) { lstChoices .add(getResources() .getString( getApplicationContext() .getResources() .getIdentifier( fltFilter.name().toLowerCase(), "string", getApplicationContext() .getApplicationInfo().packageName))); } </code></pre> <p>Here's the list of enums:</p> <pre><code>public class TrendingManager { public static enum Filter { ONLY_PRIVATE, ONLY_PUBLIC, ONLY_HQ, ONLY_LQ }; } </code></pre> <p>I have all those 4 enums defined in my <code>strings.xml</code> and it works on my phone but I get crash reports from a user's phone which says:</p> <pre><code>android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.content.res.Resources.getText(Resources.java:260) at android.content.res.Resources.getString(Resources.java:344) at com.mridang.myapp.Trend.onOptionsItemSelected(Trend.java:230) at android.app.Activity.onMenuItemSelected(Activity.java:2564) ... ... ... </code></pre> <p>I'm really lost with as to why this happens. Any ideas as to why the resource isn't found?</p>
java android
[1, 4]
276,628
276,629
In JQuery how do I get the DIV that the mouseover/mouseenter came from?
<p>I need to get the div that the mouse was previously on before it entered the element.</p> <p>How do I get this in JQuery?</p>
javascript jquery
[3, 5]
3,883,969
3,883,970
javax authentication failed
<p>I am trying out an email app on android.I take the username and password first<br> then on the next activity i take the recipiend address subject and msg and send the email. I get the error <strong>JavaX authentication failure</strong>.Here is my Mail authentication and sending code.OnClick function of the send button calls this class</p> <pre><code>public class MailHandler { final String username; final String password; public MailHandler(String username,String password){ this.username=username; this.password=password; } public void sendMail(String Sub,String msg,String sender,String cc,String to) { Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(sender)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to)); message.setSubject(Sub); message.setText(msg); Transport.send(message); System.out.println("Done"); } catch (MessagingException e) { throw new RuntimeException(e); } } } </code></pre>
java android
[1, 4]
4,596,744
4,596,745
How to adjust 3 ImageViews in a LinearLayout
<p>I defined a LinearLayout:</p> <pre><code>&lt;LinearLayout android:id="@+id/top_menu" android:layout_width="fill_parent" android:orientation="horizontal" android:background="@drawable/backrepeat" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/topLeft" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="left" android:src="@drawable/library_top_left"&gt; &lt;/ImageView&gt; &lt;ImageView android:id="@+id/topMiddle" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:src="@drawable/library_top_middle"/&gt; &lt;ImageView android:id="@+id/topRight" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="right" android:src="@drawable/library_top_right"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>I'd like that one image is on the left side of the screen, one in the middle, and one on the right side. However all of them are on the left side. How can I fix that?</p>
java android
[1, 4]
4,876,102
4,876,103
Getting the username from LDAP - Can you tell me what's wrong?
<p>I'd like to ask you how can i dinamically get a username from ldap. As you can see below, i entered the username 'smith2'</p> <pre><code>$_SERVER["REMOTE_USER"] = 'smith2'; $param = $_SERVER["REMOTE_USER"] </code></pre> <p>And I can get his first name, like this:</p> <pre><code>$ldap1 = new ldapl; $fname=$ldap1-&gt;getFname($param); </code></pre> <p>This is useful because I have some forms with some fields which are filled by default (name, first name, etc).</p> <p>It must be dynamic. Each person has a PC, so the person Y should see his name, first name, etc The person X his name, first name, etc.</p> <p>I deleted the line $_SERVER["REMOTE_USER"] = 'smith2'; and i did like this: </p> <pre><code>$fname=$ldap1-&gt;getFname($_SERVER["REMOTE_USER"]); </code></pre> <p>But it does not work, it displays anything. Can you tell me whats wrong?</p> <p>Is there a simple way to do this?</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
5,094,338
5,094,339
Target child UL with jQuery
<p>I have an unordered list on my page containing lists within each LI. </p> <p>Currently they're all set to display none, but on click Id like to toggle the display setting. </p> <p>Ive written the following only I cant seem to get it too work, has anybody an idea of where im going wrong?</p> <pre><code>//Product range expander $('.product-range ul li a').click(function() { $(this).find('.product-range ul li ul').slideDown('slow'); //$('.product-range ul li a').next('ul').toggle(); return false; }); </code></pre>
javascript jquery
[3, 5]
4,289,435
4,289,436
Invoking a function with jsonp
<p>I have some html5 postMessage code:</p> <pre><code> window.addEventListener("message", FA.recieveMessage, false); </code></pre> <p>That listener invokes this function:</p> <pre><code>FA.recieveMessage = function(e){ if (e.data == "closeFA"){ console.log("Type of data: "+e.data); } }; </code></pre> <p>Now on ie8 this code doesnt work, cause it doesnt support html5 messaging. So I thought if there is a way to invoke that function by sending an ajax request of type jsonp!?</p> <p>Is there a way to emulate messaging with jsonp?</p> <p>if i do send jsonp request to another server, does it mean that it is a new request and it wont be aware of all the events that were triggered now?</p> <p><strong>UPDATE</strong></p> <p>Okay here is what I want. I want to close an iframe. So on one page, I have got this javascript:</p> <pre><code> $.ajax({url: 'http://api.apps.com/html/'+FA.appID, data: {}, dataType: 'jsonp', timeout: 10000, jsonp: "closeIFrame" }); </code></pre> <p>This should instruct the apps/html page to invoke the closeIframe function is that right?</p> <pre><code>function closeIFrame() { jQuery("#fa-iframe-container").fadeOut(300, function(){ jQuery(this).remove(); }); FA.bannerShown = false; </code></pre> <p>} </p>
javascript jquery
[3, 5]
3,661,227
3,661,228
Need help with jQuery conditional that removes container element based on matched text
<p>here is my markup:</p> <pre><code> &lt;div&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;ul class="eventslist"&gt; &lt;li&gt;This event would be discarded&lt;/li&gt; &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div&gt; &lt;h3&gt;Title&lt;/h3&gt; &lt;ul class="eventslist"&gt; &lt;li&gt;Earnings - This event would be included&lt;/li&gt; &lt;ul&gt; &lt;li&gt;...&lt;/li&gt; &lt;li&gt;...&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>I need help writing a conditional that would go through each UL class="eventslist" on the page, and check that the first LI under UL class="eventslist" contains the word "Earnings" (it can be anywhere in the text, and capitilization should be ignored). If it doesn't, the entire DIV wrapped around the UL should be removed along with everything inside it. </p> <p>Any help is greatly appreciated!</p>
javascript jquery
[3, 5]
1,028,217
1,028,218
In jQuery, what's the difference between text() and innerHTML?
<p>I have div elements and hold text/string inside them, then I try to iterate them, and text() doesn't work, but innerHTML work just fine.</p> <pre><code>var arr = $('div.elm'); $.each(arr, function(i,j){ alert(j.text()); // it's not working console.log(j.text()); // nothing's in log alert(j.innerHTML); // works fine! }); </code></pre>
javascript jquery
[3, 5]
3,471,319
3,471,320
C++ to Java Code Conversion
<p>I have in C++</p> <pre><code>r.bits[k] &amp;= 0xFF ^ msk; </code></pre> <p>So in Java </p> <pre><code>r.bits[k] = r.bits[k] &amp; 0xFF, </code></pre> <p>but what is the meaning of the caret symbol? <code>msk</code> also will contain hexadecimal values. I know the caret symbol is a type of pointer in C++ but not sure what it is doing here. Please explain.</p>
java c++
[1, 6]
1,827,276
1,827,277
use asp.net to re-order images in server
<p>I have an asp.net website where people can upload their image files. I have code to upload multiple files at once.</p> <p>I also have a requirement where I need to populate a List that lists image file names in order.</p> <p>So after a user uploaded 10 image files, he should be able to arrange pictures in any order he likes.</p> <p>I was thinking of using ListBox showing file names, but when there are many files, it is difficult to remember which file shows what image. I was also reading about drag-drop using jQuery but have no experience in jQuery. AJAX and couldn't find an example that show images on screen and drag and drop them into box1, box2, box3....</p> <p>Any help would be appreciated. Thanks</p>
jquery asp.net
[5, 9]
5,999,573
5,999,574
How to access hidden field from usercontrol
<p>I have a hidden variable in my aspx page i.e mainpage.aspx</p> <pre><code>&lt;asp:HiddenField runat="server" id="hdnCommonvCode" /&gt; </code></pre> <p>mainpage.aspx contains tabcontainer control. On each tab an usercontrol is added. If i try to access this hidden field <code>alert($find("&lt;%=hdnCommonvasCode.ClientID %&gt;"));</code> from usercontrol it shows compiler error msg</p> <pre><code>Compiler Error Message: CS0103: The name 'hdnCommonvCode' does not exist in the current context </code></pre>
javascript asp.net
[3, 9]
3,523,652
3,523,653
Foursquare website feed clone?
<p>Hey, I really like the way foursquare's website feed is built.</p> <p>Does anyone know how to build it in jQuery?</p> <p><a href="http://foursquare.com/" rel="nofollow">http://foursquare.com/</a></p> <p>thanks,</p>
javascript jquery
[3, 5]
5,426,768
5,426,769
What is the best way to display string items stored in Enumerable<string> object?
<p>This may seem an easy question, but is there a best way in terms of the method or syntax for displaying items stored in an Enumerable object of type string in a TextBox? (and other controls)</p> <p>I have the following code:</p> <pre><code> if (CategoryTypes.Count() &gt;= 1) { foreach (var category in CategoryTypes) { txtCategories.Text += category + ", "; } } </code></pre> <p>Is there a better way of doing this?</p>
c# asp.net
[0, 9]
1,454,849
1,454,850
What is the purpose of (win) in javascript?
<p>I have the following code:</p> <pre><code> $.modal({ content: '&lt;p&gt;Are you sure you want to delete?&lt;/p&gt;', title: 'Delete confimation', maxWidth: 500, buttons: { 'Yes': function(win) { win.closeModal(); }, 'No': function(win) { win.closeModal(); } } }); </code></pre> <p>Can someone explain what (win) means? I can see it used a few times but I am not sure what it is doing?</p>
javascript jquery
[3, 5]
2,910,136
2,910,137
Function treats string as single value instead of parsing
<p>I'm using a tags plugin that takes input like this just fine:</p> <pre><code>$(this).tagHandler({ assignedTags: [ 'test','from','reddit' ] }); </code></pre> <p>If however I create a variable named tags that is a string:</p> <pre><code>tags = "'test','from','reddit'"; </code></pre> <p>And attempt to use it in the function it gets treated as a single string.</p> <pre><code>$(this).tagHandler({ assignedTags: [ tags ] }); </code></pre> <p>Instead of being processed through the function I end up with 'test','from','reddit' as a single tag.</p> <p>I have a feeling this is a common problem but haven't found the right search phrase to identify the solution.</p>
javascript jquery
[3, 5]
1,632,793
1,632,794
Storing values returning from a function in Java for Android
<p>I have a function <code>getString(i,j)</code> returning string value for every i,j and I wish to store it in some data structure. Below is the code.</p> <pre><code>for(int i=0; i&lt;16; i++) for(int j=0; j&lt;16; j++) Log.d(TAG,this.objNew.getString(i,j)); </code></pre> <p><code>objNew</code> is the object helping to access <code>getString</code> function in another file. (this.objNew.getString(i,j)) returns a string value i.e. it will return 256 string values when executed in loop.</p> <p>I tried <code>String[][] arr</code> i.e. <code>arr[i][j] = this.objNew.getString[i][j]</code>, but it didn't work.</p> <p>Any ideas how can I store into some data structure and display the values.</p> <p>Please suggest</p>
java android
[1, 4]
1,117,619
1,117,620
I have a block of code that works and I wanted to ask what exactly is happening here?
<p>The semicolon (;) at the end of the code is the thing which is got me lost.</p> <pre><code>private View.OnClickListener onSave = new View.OnClickListener() { public void onClick(View v) { EditText name=(EditText)findViewById(R.id.name); EditText address=(EditText)findViewById(R.id.addr); r.setName(name.getText().toString()); r.setAddress(address.getText().toString()); } }; </code></pre>
java android
[1, 4]
3,469,920
3,469,921
Reading a text file with jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1981815/jquery-read-a-text-file">jquery - Read a text file?</a> </p> </blockquote> <p>I want to read a local text file, using jQuery. So I try this:</p> <pre><code>$.get('file_to_read.txt', function(data) { do_something_with(data) }); </code></pre> <p>However, jQuery interprets "file_to_read.txt" as an html file and I get a Javascript error because it's not properly formatted and "do_something_with" does not have its desired effect, since data is not a string.</p> <p>the jQuery doc says I need to specify the datatype. However, they only list html, xml, json and script as the possible data files; what should I do with a plain txt file I want to load directly into a string?</p>
javascript jquery
[3, 5]
1,402,304
1,402,305
ASP.NET Role Management
<p>I am new at ASP.NET and developing my first web based application at ASP.NET.I should do role management.There are three kinds of folder in project; 1.ADMIN 2.MEMBER 3.ANOYNOMUS I wanna set the roles at web.config side.How can I do it at web.config? I couldn't find useful info at web, about the database side of this subject? Should I have a table which is about only roles?Or should I add 'Role' property to the Admin and Member tables.. Thanks in advance for your replies..</p>
c# asp.net
[0, 9]
441,127
441,128
Automatiacally Generating text input and dropdown select on click using javascript/Jquery
<p>I am trying to build a system like when any user clicks on an "Add" button, it creates two text fields and two drop down selects automatically. I searched on google for the tutorial but all I have managed to find is only how to add text fields, but I need to add Select drop down with remove option.</p> <p>I have some knowledge in PHP but little in Javascript or Jquery. </p> <p>Would you please kindly help? </p> <p>Here is the code that I have found:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;script&gt; function generateRow() { var d=document.getElementById("div"); d.innerHTML+="&lt;p&gt;&lt;input type='text' name='food'&gt;"; var e=document.getElementById("div"); e.innerHTML+="&lt;input type='text' name='food'&gt;"; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" name="form1" method="post" action=""&gt; &lt;label&gt; &lt;input name="food" type="text" id="food" /&gt; &lt;/label&gt; &lt;div id="div"&gt;&lt;/div&gt; &lt;p&gt;&lt;input type="button" value="Add" onclick="generateRow()"/&gt;&lt;/p&gt; &lt;p&gt; &lt;label&gt; &lt;input type="submit" name="Submit" value="Submit" /&gt; &lt;/label&gt; &lt;/p&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
4,854,331
4,854,332
jQuery loaded within a Javascript ( js ) file
<p>This is a very simple script that should load jQuery. I can see in the Firebug Scripts tab that jquery is loading but I get '$ is not defined" errors when I try to use it. Can anyone help me understand what's wrong?</p> <pre><code>//function to add scripts function include(file) { var script = document.createElement('script'); script.src = file; script.type = 'text/javascript'; script.defer = true; document.getElementsByTagName('head').item(0).appendChild(script); } //add jQuery include('https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); //See if jQuery is working $(document).ready(function() { $('#internal').show(); }) //////////// //RETURNS: "$ is not defined $(document).ready(function() {" </code></pre> <p>The odd thing is if don't try to use jQuery in this same script instead I load another js file that uses jQuery it does work</p> <pre><code>//function to add scripts function include(file) { var script = document.createElement('script'); script.src = file; script.type = 'text/javascript'; script.defer = true; document.getElementsByTagName('head').item(0).appendChild(script); } //add jQuery include('https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'); //add my custom script that wants to use jQuery include('scripts/testScript.js') </code></pre> <p>testScript.js</p> <pre><code>$(document).ready(function() { $('#external').show(); }) </code></pre> <p>I appreciate any advice with this.</p>
javascript jquery
[3, 5]
1,617,542
1,617,543
Pop up window in asp.net?
<p>How can i bring up my messages in a pop up window with asp.net-C#? im cool with javascript ! Is there any idea related with c#?</p>
c# asp.net
[0, 9]
25,320
25,321
Javascript find text on page
<p>I need to run a search and replace on HTML similar to the following... I need to have "Find Next" "Replace" and "Replace All" options.... the trick is that I need to run an AJAX request to update the values in the database for each field once the value is replaced.</p> <p>The only trouble I'm running into is that I"m unsure exactly how to search the contents of <code>#sheet</code> and replace the values with the new value the user has provided.</p> <pre><code>&lt;div id='sheet'&gt; &lt;div class='item' id='field-18583'&gt;This is yet another test&lt;/div&gt; &lt;div class='item' id='field-18585'&gt;This is test data&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I should say that it's possible I'll have TONS of text to search, so ideally I'd only find the next instance of the item that's being searched for, not all instances. So when I hit "Find Next", if I"m 3 items in, it'll go to the 4th.</p> <p>What's the best way in javascript to maintain the indexing on this without storing all found results in a variable and causing lag on the page?</p>
javascript jquery
[3, 5]
372,875
372,876
Call a Javascript Function with Jquery
<p>I have two functions in Javascript:</p> <pre><code>function getWindowWidth(){ var x = 0; if (self.innerHeight){ x = self.innerWidth; }else if (document.documentElement &amp;&amp; document.documentElement.clientHeight){ x = document.documentElement.clientWidth; }else if (document.body){ x = document.body.clientWidth; }return x; }function getWindowHeight(){ var y = 0; if (self.innerHeight){ y = self.innerHeight; }else if (document.documentElement &amp;&amp; document.documentElement.clientHeight){ y = document.documentElement.clientHeight; }else if (document.body){ y = document.body.clientHeight; } </code></pre> <p>These appear to set the height and width of the document window, based on the size of the window? I could be wrong here....</p> <p>What I have done is embeded a toolbar above this document, this toolbar can be hidden or shown at various points. </p> <p>I need the above function to be called when I use the following jQuery,</p> <pre><code>$("#Main").animate({top: "89px"}, 200); </code></pre> <p>Any assistance greatly appreciated!</p>
javascript jquery
[3, 5]
3,731,357
3,731,358
need a beginners android project to work on
<p>I have an itch to do development on android. I know some JAVA (just learned it) and I want to develop a simple android app for my phone or for an android tablet that I have (simple Chinese 7" tablet that I purchased off eBay).</p> <p>Is there a simple tutorial that I can follow that will get me up to speed?</p>
java android
[1, 4]
1,138,060
1,138,061
How to get the Id of an object which is added in codebehind using javascript
<p>Example:i am assigning this in .cs page</p> <pre><code> HiddenField hdnCharacter = new HiddenField(); HiddenField hdnMaxCharsError = new HiddenField(); Label lblMaxChrs = new Label(); lblMaxChrs.ID = "lblMaxchrs"; hdnMaxCharsError .ID = "hdnMaxCharsError "; hdnCharater.ID = "hdnCharater"; </code></pre> <p>How to get his ID and values using javascript in.js file i am trying to do custom control.so i dont have any page to add in aspcontrol. TR</p>
javascript asp.net
[3, 9]
1,482,494
1,482,495
Is it possible to create a html file using JQuery?
<p>Is it possible to create a html file and save it to a directory using JQuery?</p>
javascript jquery
[3, 5]
5,428,045
5,428,046
how can we assign a javascript array from mysql database with the help of php?
<p>I would like to know if we can select data from the database using php and assign it to a javascript array? if so what would be the syntax?</p> <p>I wrote the code below but it is not working</p> <pre><code>$js_array = "["; $result = mysql_query("SELECT item_name FROM tbl_item"); while( $row=mysql_fetch_array($result, MYSQL_NUM) ) { $js_array .= $row[0]; $js_array .= ","; } $js_array{ strlen($js_array)-1 } = ']'; ?&gt; &lt;script&gt; var cities = &lt;?php echo $js_array; ?&gt; for(var i=0; i&lt;4;i++) alert(cities.length); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
5,907,260
5,907,261
How to add text to a textarea with jquery or javascript
<p>Basically the function will be similar to the "quote" function on most forums. I need to click a button to grab some text and paste that into a textarea box.</p> <p>I've tried some things and they work, however, they don't work with everything. For example, they don't work when the text that I need to grab has white spaces or apostrophes or if the text is very long. Any help?</p> <p>I've tried most of the solutions outlined in this thread: <a href="http://stackoverflow.com/questions/946534/insert-text-into-textarea-with-jquery">Insert text into textarea with jQuery</a> and they do not work.</p>
javascript jquery
[3, 5]
4,023,214
4,023,215
Window width and resize
<p>I would like to calculate the number of icons e.g. 50px depending on the width of the window for a menu. So I started with: </p> <pre><code>$(window).width(); </code></pre> <p>While loading the page with document ready function the width will be given. OK!</p> <p>Now I would calculate the right amount of icons while resize the window. </p> <p><code>$(window).resize(function() { //resize just happened, pixels changed });</code></p> <p>Tasks</p> <ol> <li>Initial width of the window -> if user is not resizing the window</li> <li>Variable width of the window -> if user is resizing the window</li> </ol> <p>Each task is running but i don´t get it together.</p> <p>Can u help me --> THX!! </p> <p>How can i calculate the number of icons with an initial width of the window and while resizing the window?</p> <p>My Start:</p> <pre><code>var activeItemcount; checkWidth(); $(window).resize(checkWidth); function checkWidth() { windowSize = $(window).width(); // console.log(windowSize); var activeItemWidth = '100'; // width of the icons var maxWidth = windowSize; // max div width on screen activeItemcount = maxWidth / activeItemWidth; // max icon with actual screen width activeItemcount = Math.round(activeItemcount) -1; // calculation console.log(activeItemcount); var i = '0'; $('.platform-view').each(function(){ if(i &lt; activeItemcount ){ $(this).wrapAll('&lt;div class="iconview-1" /&gt;'); i++; }else{ $(this).wrapAll('&lt;div class="iconview-2" /&gt;'); } }); }; </code></pre>
javascript jquery
[3, 5]
3,326,189
3,326,190
Change margin value on table with value from a variable with jQuery?
<p>I select some tables using this:</p> <pre><code>$('.StatusDateTable').each(function() { var statusLight = $(this).find(".StatusLight").attr("src"); statusLight = statusLight.substring(33).slice(0,-9); if (statusLight == "Blue") { var columns = Math.abs((start - end)-1); var columnWidth = 40; var marginRight = Math.abs(columnWidth * columns); </code></pre> <p>Now I want to set margin-right="theValueOfmarginRightHere" on the current table, is this possible?</p> <p>I tried something like:</p> <pre><code>$(this).attr('margin-right=" + marginRight + "'); </code></pre> <p>but obviously it doesn't work.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
1,319,502
1,319,503
computer name of user along with ip address
<p>hi i am trying to get the ip address and computer name of my users . i am able to get ip address but computer name i am not getting , i tried these codes. </p> <pre><code>$ip=$_SERVER['REMOTE_ADDR']; gethostbyaddr($_SERVER['REMOTE_ADDR']); $_ENV['COMPUTERNAME']; </code></pre> <p>except ip address nothing worked for me. i want to get the client computer name</p> <p>i want to submit these ip address and computer name in my server.or is there any better way to identify the returning visitor as ip address keep on changing every hour for most of the users . i want to count how many times a user from a particular pc is coming to my website</p>
php javascript
[2, 3]
4,161,815
4,161,816
(Code Review) Java if statement involving logical and(&&) operator
<p>I have started programming a few weeks ago in java/android. I want to write a small tic tac toe game as an android app but I'm having trouble with my method that will check for the winner. It is as follows:</p> <pre><code> public void checkForWinner() { if( taken[0] &amp;&amp; taken[3] &amp;&amp; taken[6] || taken[0] &amp;&amp; taken[1] &amp;&amp; taken[2] || taken[2] &amp;&amp; taken[5] &amp;&amp; taken[8] || taken[6] &amp;&amp; taken[7] &amp;&amp; taken[8] || taken[0] &amp;&amp; taken[4] &amp;&amp; taken[8] || taken[2] &amp;&amp; taken[4] &amp;&amp; taken[6] || taken[1] &amp;&amp; taken[4] &amp;&amp; taken[7] || taken[3] &amp;&amp; taken[4] &amp;&amp; taken[5] == 1 ){} } </code></pre> <p>Here I have an array called taken that holds 9 integers, each of those integers being either a one, meaning player one owns that block, or a two, meaning player two ows that block. Current, I am trying trying all possible scenarios in which player one would be the winner but eclipse is telling me that <code>The operator &amp;&amp; is undefined for the argument type(s) int, int</code>. The error only seems to be showing for the first logical and operation of each line of the if statement. For example the first error goes up to <code>taken[0] &amp;&amp; taken[3]</code> and then disappears until the next line.</p>
java android
[1, 4]
547,220
547,221
Why children function doesn't work?
<p>I have the following markup:</p> <pre><code>&lt;div class="entityClass" ... &lt;div class="linksClass" ... &lt;img class="collapseClass" </code></pre> <p>I'm trying using JQuery to get the <code>img</code> child:</p> <pre><code>// _this is entityClass div var image = $(_this).children(".collapseClass"); </code></pre> <p>but it returns <code>0</code> in length!</p> <p>Any help</p>
javascript jquery
[3, 5]
3,576,557
3,576,558
jQuery validation field by range
<p>How can I validate field by range?</p> <p>I use additional-methods, but i don't know how providing parametr with range to my validation method via HTML.</p> <p>Something of a<br /> <code>&lt;input type="text" class="rangeField" rel="[10, 20]" /&gt;</code></p> <p>It's nice, if i can make a difference between integer and decimal in validation.</p>
javascript jquery
[3, 5]
2,791,099
2,791,100
Defining Types on Class declaration?
<p>Im relatively new to Java, and I recently came across a syntax that I have never seen before.</p> <pre><code>public class loadSomeData extends AsyncTask&lt;String, Integer, String&gt;{ etc..} </code></pre> <p>The part that confuses me is the stuff between the &lt;> brackets. I understand what each of the Types are used for in this class, but why declare them in the class declaration?</p> <p>More specifically what is this: <code>&lt;DataType&gt;</code> called in Java so I can research it?</p> <p>Thank you</p>
java android
[1, 4]
350
351
What is the difference between xxx.tostring() and (string)xxx?
<p>whats the difference in the two string methods below?</p> <pre><code>string str1 = dr["RAGStatusCID"].ToString(); string str2 = (string)dr["Description"]; </code></pre>
c# asp.net
[0, 9]
1,821,329
1,821,330
jquery: how to find an element which is comming 2 elements before current element
<p>i have a markup which look like this:</p> <pre><code>&lt;h3&gt;Paragraf3-dummytext&lt;/h3&gt; &lt;p&gt; &lt;a name="paragraf3"&gt; Quisque id odio. Praesent venenatis metus at tortor pulvinar varius. Lorem ipsum dolor sit &lt;/a&gt; &lt;/p&gt; </code></pre> <p>what i want to do is to find all 'a' tags with 'name' attribute and find the 'h3' tag for that anchor; im trying to do it like this:</p> <pre><code>var paragraf = []; var paragrafheading = []; $('a[name]').each(function() { paragraf.push($(this).attr('name')); paragrafheading.push($(this).prev().text()); </code></pre> <p>but it does not work becouse there is a 'p' tag around the text. Any suggestions would be appreciated. Thanks</p>
c# javascript jquery
[0, 3, 5]
4,427,800
4,427,801
break from .each jquery
<p>how can i break from jquery each with out <code>return FALSE</code>.</p> <p>consider the following</p> <pre><code>function check_quantity(){ var _q = $(".quantity"); _q.each( function(){ if( some_condition ){ break; // I WANT TO BREAK HERE AND NEED TO RETURN A TRUE INSTEAD OF FALSE // for some reasons there is no way to continue } } ); return FALSE; // if condition failed } </code></pre> <p>is there any work around ?</p>
javascript jquery
[3, 5]
1,378,009
1,378,010
JQuery Find Elements By Background-Color
<p>Trying to access the Selected row of a GridView by using JQuery to find the row with the background-color attribute set to the SelectedRowStyle background color. That color is #FF6600. I've tried</p> <pre><code>var row = $("tr").find().css("background-color", "#FF6600"); </code></pre> <p>But that just sets all the rows to orange.</p> <pre><code>var row = $("tr[background-color=#FF6600"); </code></pre> <p>That returns empty</p> <pre><code>var row = $("tr").find().attr("background-color"); </code></pre> <p>Returns undefined</p>
jquery asp.net
[5, 9]
3,054,334
3,054,335
why cant the php function wait for the click instead
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8239891/function-running-automatically-instead-of-a-click">function running automatically instead of a click</a> </p> </blockquote> <p>Hi Guys I am trying so many ways of accomplishing something, I would like the php code run when the js finds that click event instead it runs on page load is there anyway of doing this please help:</p> <pre><code>&lt;script&gt; jQuery('#next').click(function(){ $(this).data('clicked', true); }); if(jQuery('#next').data('clicked')) { function stop() { var stop_record = "&lt;?=$test-&gt;stoprec;?&gt;"; } } &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,794,510
3,794,511
Jquery Cloning a Menu of HTML Buttons
<p>I am trying to clone a series of buttons on the bottom of my app. I want the user to have access to the menu when they are scrolled all the way down as well. </p> <p>the problem arises when i add event handlers to the buttons using their ID. It seems the duplicate IDS are not working. The first instance of the menu works but the one below doesn't work.</p> <p>I guess I'm asking are duplicate ID's a no no and If so how do I get around this. Using classes to target the buttons?</p> <p>thanks,</p> <p>-Laurence</p>
javascript jquery
[3, 5]
4,521,102
4,521,103
how to response.write bytearray?
<p>This is not working:</p> <pre><code>byte[] tgtBytes = ... Response.Write(tgtBytes); </code></pre>
c# asp.net
[0, 9]
1,219,942
1,219,943
Is there an easy way to convert C# classes to PHP?
<p>I am used to writing C# Windows application. However I have some free hosted PHP web space that I would like to make use of. I have a basic understanding of PHP but have never used it's object oriented capabilities.</p> <p>Is there an easy way to convert C# classes to PHP classes or is it just not possible to write a fully object oriented application in PHP?</p> <p><strong>Update:</strong> There are no reliance on the .NET framework beyond the basics. The main aim would be to restructure the class properties, variable enums, etc. The PHP will be hosted on a Linux server.</p>
c# php
[0, 2]
4,810,793
4,810,794
Java to C# Conversion
<p>I have below Java code. I need to convert this code to C#.</p> <pre><code>public void updateZeroPointLast(BigDecimal bdID) { if (!qdsErosionElSave.isOpen()) { qdsErosionElSave.open(); } // Locate the row to update DataRow dr = new DataRow(qdsErosionElSave, "EL_ID"); dr.setBigDecimal("EL_ID", bdID); if (qdsErosionElSave.locate(dr, Locate.FIRST)) { // Update qdsErosionElSave Timestamp tsZeroPoint = qdsErosionElSave.getTimestamp("ZEROPOINT"); System.out.println(bdID + " " + tsZeroPoint.toString()); qdsErosionElSave.editRow(); qdsErosionElSave.setTimestamp("ZEROPOINTLAST", tsZeroPoint); qdsErosionElSave.post(); } } </code></pre>
c# java
[0, 1]
661,915
661,916
Can't get JavaScript to read an ID as a variable name
<p>What I'm trying to do is have an input field to edit some information. I'm setting it up so that as each field is changed (a combination of text boxes and checkboxes), AJAX updates the information and shows the changes in a profile box (server load is low, not concerned about efficiency here). If the user hits Escape, I want the value in the text box to revert to the original value (if they were editing a field that they changed their mind on). For the text boxes I've run into a variable issue - I know I can use arrays or hidden fields, but now I want to know how to make this version work :)</p> <p>I set my variable:</p> <pre><code> var first_name = "' || i.instructor_fname || '"; </code></pre> <p>I have my input field:</p> <pre><code>&lt;input type="text" id="first_name" value="' || i.instructor_fname ||'"&gt; </code></pre> <p>and the Escape function:</p> <pre><code>if (e.keyCode == 27) { if (document.activeElement.id != "" ) { $("#" + document.activeElement.id) .val(document.activeElement.id); } } </code></pre> <p>For first_name, the output is first_name. The value is set correctly, as the text boxes are populated correctly. It seems that I'm not getting 'first_name' to be read as a variable, but as a string. I've tried a few combinations of joining literals to it, but still no luck. Any ideas out there? Again, I know I can use other techniques for this, but it seems like figuring this out might come in handy for other projects.</p>
javascript jquery
[3, 5]
2,001,800
2,001,801
New Intent wont start first time
<p>I have 3 intents A->B->C</p> <p>from C to get back to A you bring up the menu and click home. This finishes B and C and opens A which in the manifest is set as a singletask.</p> <p>This all works perfectly, but when I try to open B from A again I have to click twice on the button that starts B. Whereas when the app first opens I have to click only the once to open B</p> <p>Why could this be like this?</p> <p>I think I know why. I think B is not finishing when I go from C to A. This is the code running on C</p> <pre><code> Intent Intent = new Intent(this, com.home.test.Home.class); this.setResult(1, Intent); startActivity(Intent); this.finish(); </code></pre> <p>And it should trigger this on B if I am correct</p> <pre><code> public void onActivityResult(int requestCode, int resultCode, Intent data) { this.finish(); } </code></pre>
java android
[1, 4]
4,732,841
4,732,842
Get class input with closest
<p>I want to get class <code>.mGMZs</code> in input <code>name=age</code> with <code>.closest</code>, I try it in following demo but i doesn't work as expected, how can I fix it?</p> <pre><code>&lt;div class="age"&gt; &lt;div class="column"&gt; &lt;input name="age[0][]" class="mGMZs" placeholder="Age(Geting class this)"&gt; &lt;div class="p_age"&gt; &lt;/div&gt; &lt;/div&gt; &lt;br /&gt; &lt;button&gt;Click Me&lt;/button&gt; &lt;/div&gt; $('button').live('click', function () { var class_age = '.' + $(this).closest('div.age').find('input[name="age"]').prop('name'); alert(class_age); }) </code></pre>
javascript jquery
[3, 5]
1,737,054
1,737,055
FLAG_ACTIVITY_CLEAR_TOP hangs before clearing all activities?
<p>I have an activity stack like this A -> B -> C. I am launching activity A with clear top from C. Now what happens is it will finish C instantly, then it will resume A, then about 2 seconds later it will finish B. I am confused what is causing this two second delay before killing activity B.</p>
java android
[1, 4]
1,837,247
1,837,248
Javascript Call from ASP.NET GridView - Parameter not getting passed
<p>I use a jQuery popup window to show a new page with a parameter in the query string.</p> <pre><code> &lt;script language="javascript" type="text/javascript"&gt; function ShowProfile(clickedItem) { $.fn.colorbox({ html: '&lt;iframe SCROLLING="Yes" frameborder="0" src="SiteVP.aspx?siteid="' + clickedItem + ' width="999" height="550" /&gt;', width: "999px", height: "550px", close: 'Continue' }); } </code></pre> <p>The popup window works just fine, but can't get "siteid" value to be passed. On the new page siteid is "". This is the code in ASP.NET</p> <pre><code>&lt;td style="width:80%"&gt; &lt;a href="javascript:ShowProfile('&lt;%#Eval("Site").ToString().Replace("'", "\'")%&gt;')"&gt; &lt;%#Eval("Site") %&gt; &lt;/a&gt; &lt;/td&gt; </code></pre> <p>Can't for the life of me figure out what could possibly be wrong with such a simple javascript call. Please help.</p>
javascript asp.net jquery
[3, 9, 5]
2,831,939
2,831,940
Hyperlink a column in gridview
<p>I'm using boundfield to display columns:</p> <pre><code>&lt;Columns&gt; &lt;asp:BoundField DataField=”AccountCode” HeaderText=”Account Code”&gt; &lt;ItemStyle Font-Size=”Large” /&gt; &lt;/asp:BoundField&gt; &lt;asp:BoundField DataField=”AccountName” HeaderText=”Account Name” FooterText=”Enter Footer Text”&gt; &lt;FooterStyle CssClass=”FooterStyle” /&gt; &lt;/asp:BoundField &gt; &lt;asp:BoundField DataField=”Type” HeaderText=”Account Type” /&gt; </code></pre> <p></p> <p>I have 4 types of accounts (a, b, c , or d). I would like to hyperlink the account type column based on the 4 different account types. Basically, I would like to link to one of the 4 different webpages depending on which type of account was selected. I'm using C# in Visual Studio 2010. Any help would be greatly appreciated.</p>
c# asp.net
[0, 9]
1,518,017
1,518,018
update JS Var on chaging of a php var
<p>I got this prob. In a web page I have a DIV that display a counter ( a PHP variable, $count). I have also a JS function that change the INNERHTML property of the DIV. I'm not able to change the js var on the changing of the PHP one.</p> <p>HTML</p> <pre><code>&lt;DIV id="counter"&gt;0&lt;/DIV&gt; </code></pre> <p>PHP</p> <pre><code>while (----) { do_something; $count++; } </code></pre> <p>JS</p> <pre><code>function ChangeDiv() { document.getElementById("counter").innerHTML = // here the value of $count; } setinterval("ChangeDiv()",3600); </code></pre> <p>I want to to refresh the DIV every sec inserting in it the value of $count... but doing</p> <pre><code>document.getElementById("counter").innerHTML = &lt;?php echo($count); ?&gt;; </code></pre> <p>is wrong 'cause it will output just the initial value of $count.</p> <p>I tried to insert a parameter in the function ChangeDiv, but in that way I had to call the function every time $count changed, echoing a </p> <pre><code>echo("&lt;script&gt;ChangeDiv('".$count."');&lt;/script&gt;"); </code></pre> <p>...that's really not functional.</p> <p>Someone knows a simpler way to do it??</p>
php javascript
[2, 3]
889,133
889,134
How to run/execute form in a PHP page loaded in another using Javascript .load() without refreshing the parent PHP page?
<p>Sorry for the very long title but it's exactly what I'm looking for.</p> <p>I have a PHP page (let's call it the parent page) that loads another (the child page) in one div with the following code:</p> <pre><code>$("#compose_inputandoptions").load("compose_inputandoptions.php"); </code></pre> <p>In the child page called "compose_inputandoptions.php" I have a form like this:</p> <pre><code>&lt;?php&gt; echo $_POST['option']; ?&gt; &lt;form action="" method="post"&gt; &lt;p&gt; &lt;input type="text" name="option" /&gt; &lt;input type="submit" value="Valider" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <p>How can I obtain a value for the $_POST['option'] in the child page<br> when I submit the form which is in the child page<br> without refreshing the parent page?</p> <p>Thank you very much for your help!</p>
php javascript jquery
[2, 3, 5]
3,782,933
3,782,934
'System.Web.UI.WebControls.ListItem' in Assembly is not marked as serializable
<p>I have made a property, which looks like below.</p> <pre><code>public ListItem[] DropDownListItems { get { return (ListItem[])ViewState["DropDownListItems"]; } set { ViewState["DropDownListItems"] = value; } } </code></pre> <p>And this is how i assign it values</p> <pre><code>ListItem[] litem = new ListItem[7]; litem[0] = new ListItem("View", "RowView"); litem[1] = new ListItem("ReadView", "RowReadView"); litem[2] = new ListItem("WriteView", "RowWriteView"); litem[3] = new ListItem("DeleteView", "RowDeleteView"); this.DropDownListItems=litem; </code></pre> <p>But I get the following error</p> <p><strong>'System.Web.UI.WebControls.ListItem' in Assembly is not marked as serializable.</strong></p> <p>How to resolve it</p>
c# asp.net
[0, 9]
3,010,890
3,010,891
put extras in tabs
<pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TabHost tabHost = (TabHost) findViewById(R.id.tabhostscreen_tabhost); mLocalActivityManager = new LocalActivityManager(this, false); tabHost.setup(mLocalActivityManager); mLocalActivityManager.dispatchCreate(savedInstanceState); //after the tab's setup is called, you have to call this or it wont work TabHost.TabSpec spec; Intent intent; //set up your tabs here. It's easy to just do seperate activities for each tab, and link them in here. intent = new Intent().setClass(this, SomeActivity.class); spec = tabHost.newTabSpec("tagname1").setIndicator("tab indicator 1", getResources().getDrawable(R.drawable.icon)).setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, SomeOtherActivity.class); spec = tabHost.newTabSpec("tagname2").setIndicator("tab indicator 2").setContent(intent); tabHost.addTab(spec); } </code></pre> <p>Can i put extras into those tabs, and if it's true, how ?</p>
java android
[1, 4]
2,093,341
2,093,342
Change image source if file exists
<p>I have <a href="http://jsfiddle.net/rcebw/3/">http://jsfiddle.net/rcebw/3/</a></p> <p>The point of this is I will have numerous of these <code>inlinediv</code> divs. Each one has 2 divs inside it, one which holds an image and one which holds a link. These are generated dynamically from a list of the subsites on another site.</p> <p>What I want it to do is check each div with the class <code>inlinediv</code>. Get the inner text of the link in div <code>iconLinkText</code> and search for a file with that name at the site. (http://www.mojopin.co.uk/images/ for this test.) If it exists then change the image src to it.</p> <p>I am probably taking the absolutely wrong route for this but I can't seem to get it to work. When testing it can't even find the <code>inlinediv</code> div! Says it's null.</p> <p>I'm pretty new to jQuery but does anyone have any advice? (I don't even know if I've explained myself well!)</p>
javascript jquery
[3, 5]
591,323
591,324
Communication issue between PHP and jQuery
<p>I have a page generated from PHP like this:</p> <pre><code>&lt;?php //In my original code, this is retrieved from databas.. $users = array( array('id'=&gt;1, 'login'=&gt;'login1', 'email'=&gt;'email1') ); foreach($users as $user){ echo '&lt;tr&gt;&lt;td&gt;'.$user['login'].'&lt;/td&gt;&lt;td&gt;'.$user['email'].'&lt;/td&gt;&lt;td&gt;&lt;button class="button-delete"&gt;Delete&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;'; } ?&gt; </code></pre> <p>Then, in front side I have this script: </p> <pre><code>$('.button-delete').click(function(){ var id=0; alert(id); }); </code></pre> <p>My aim is to make Delete button perform an ajax call to delete the user. Till now I didn't got there yet, my problem is how to get the user ID?</p>
php jquery
[2, 5]
4,358,465
4,358,466
The variable name '@VarName' has already been declared Issue
<p>I am inserting multiple items into table based on a selection from drop down list. When I select one item from the drop down then everything works fine but when I select multiple items then I get this error</p> <pre><code>The variable name '@CompName' has already been declared. Variable names must be unique within a query batch or stored procedure. </code></pre> <p>what am i doing wrong? thanks here is my code</p> <pre><code>protected void DV_Test_ItemInserting(object sender, DetailsViewInsertEventArgs e) { foreach (ListItem listItem in cblCustomerList.Items) { if (listItem.Selected) { string Name= listItem.Value; sqlcon.Open(); string CompName= ((TextBox)DV_Test.FindControl("txtCompName")).Text.ToString(); string Num = ((TextBox)DV_Test.FindControl("txtNum")).Text.ToString(); SqlCommand cmd = new SqlCommand("select CompNamefrom MyTable where CompName= '" + CompName+ "' and Num = '" + Num + "' and Name= '" + Name+ "' ", sqlcon); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { lblmsg.Text = "Not Valid"; } else { dr.Close(); sqlcmd.CommandText = "INSERT INTO MyTable(CompName, Num, Name) VALUES(@CompName, @Num, @Name)"; sqlcmd.Parameters.Add("@CompName", SqlDbType.VarChar).Value = CompName; sqlcmd.Parameters.Add("@Num", SqlDbType.VarChar).Value = Num; sqlcmd.Connection = sqlcon; sqlcmd.ExecuteNonQuery(); DV_Test.ChangeMode(DetailsViewMode.Insert); sqlcon.Close(); } sqlcon.Close(); } } } </code></pre>
c# asp.net
[0, 9]
4,542,422
4,542,423
Wrap Each * on a Page Using jQuery
<p>I need to wrap each asterisks on a page with <code>&lt;span class="red"&gt;&lt;/span&gt;</code>. The few things I've tried don't work. I think what this boils down to is that I need to search the page for a specific character, and I can't figure out how to do that.</p>
javascript jquery
[3, 5]
5,260,512
5,260,513
Disable onbeforeunload for links
<p>How can I disable onbeforeunload for links?</p> <pre><code>var show = true; function showWindow(){ if(show){ alert('Hi'); return "Hi Again"; } } $('a').click(function(){ show = false; }); window.onbeforeunload = showWindow; </code></pre> <p>This is what I have, but it still shows when I click on an 'a' element</p> <p>Button code:</p> <pre><code>&lt;button type="submit" class="submitBtn"&gt;&lt;span&gt;Open Account&lt;/span&gt;&lt;/button&gt; </code></pre>
javascript jquery
[3, 5]
5,396,020
5,396,021
trigger 'click' after selected an option?
<p>I have select box which load addresses form via ajax. So user can select previous saved address. Inside address form , another select box which lists 'States'. A shipping is calculated based on 'States' select box change.</p> <p>I want to trigger a change after loading addresses. I used this code</p> <pre><code>$('select#addressed').change(function() { $('select#states').trigger('change'); }); </code></pre> <p>But this will trigger change before new address load.Any way to trigger after loading address?</p>
javascript jquery
[3, 5]
1,413,596
1,413,597
Calling some javascript method from a java class
<p>i want to call a javascript method from a servlet... is it possible??</p> <p>i have heard of something called mozila rhino but cannot understand its use, do any 1 has any idea???</p>
java javascript
[1, 3]
2,634,593
2,634,594
How to make a JSON object?
<p>I want to create the following JSON object, as seen from a console log:</p> <pre><code>Object . member: Object . id: 8286 </code></pre> <p>I've been trying:</p> <pre><code>'member' :[{'id': 8286}] </code></pre> <p>but get the following error: "Uncaught SyntaxError: Unexpected token :"</p> <p>What am I doing wrong? Thanks</p>
javascript jquery
[3, 5]
711,476
711,477
Resize photo taken by camera to fit screen
<p>I'm attempting to make an app that displays the photo after its taken. The issue is I can't seem to scale the bitmap with the same aspect ratio to the screen.</p> <p>I've tried imageView.setScaleType(ScaleType.FIT_XY); but it doesn't keep the ratio. Nor does any of the Android:Scale.</p> <p>What can I do?</p>
java android
[1, 4]
2,422,718
2,422,719
how to remove header information from mp3 file?
<p>is there anyway to remove header information from mp3 file such that mp3 file can't be played?</p> <p>regards, hitendrasinh gohil</p>
java android
[1, 4]
4,025,648
4,025,649
Sending JavaScript variable to PHP
<p>I have to send a value that is stored in a JavaScript variable to a PHP page. The PHP page is in a different folder than the JavaScript page.</p> <p>This JavaScript variable is in a method that fires when we click a button. </p> <p>How can I send that variable value to the PHP page?</p> <p>(This is an Eclipse project.)</p>
php javascript
[2, 3]
4,287,827
4,287,828
Creating my own dynamic (provider like) classes: Best approach?
<p>I'm not sure if this is the best place to post this question but I can't seem to find much on it (I guess my google-foo is weak).</p> <p>Let's say I have a website that sells products. These products go into my database, and are processed in various ways. Recently we've decided that our website wants to sell third party products as well. Each vendor is going to have an unknown way of connecting and getting / putting information. So my approach is this: </p> <ul> <li>Create an interface (IVendor) that has standard product interfacing methods for that vendor. </li> <li>Add a linking table between products and a new vendors table </li> <li>Store which type to use in the vendors table as a string and convert it to a type at runtime</li> </ul> <p>The goal is to minimize impact on the site codebase when a new vendor is added. Instead we'd mark a product as a particular vendor, and create a new implimentation of our IVendor for that product to use. </p> <p>I would love any ideas as to how this could be done better, or if I am approaching this in a way that makes sense. Thanks for your help.</p>
c# asp.net
[0, 9]
2,053,510
2,053,511
Set focus to validation summary?
<p>Hi I have an aspx page, where there are 2 validation summaries. One for master (at the top of page) &amp; one for details (at the bottom). </p> <p>On details validation, the focus just shifts on top of the page and not on my validation summary in details section. How to do this ? Any clue guys ?</p>
c# javascript asp.net
[0, 3, 9]
4,348,796
4,348,797
IE8 with jQuery width
<p>I am trying to set a width dynamically on a div. This is correctly working with Safari, Chrome and Firefox but not in IE8. This is using jQuery UI for the slider function. Here is my code so far:</p> <pre><code>var ourStoryPosts = $(".ourStory .grid_12mod").children(); var ourStoryLength = ourStoryPosts.length; var ourStoryWidth = $(ourStoryPosts[2]).outerWidth(true); var ourStoryWrapperWidth = ourStoryLength * ourStoryWidth; var maxSlider = ourStoryWrapperWidth - 1020; $(".ourStory .grid_12mod").width(ourStoryWrapperWidth); $(".ourStorySlider").slider({ step: 1, max: maxSlider, slide: function( event, ui) { $(".ourStory").css({ "left" : -ui.value }); } }); </code></pre> <p>As you can see, I am using variables to set these values. The <code>width()</code> method is not working as expected.</p> <p>I have tried using the <code>String()</code> constructor to explicitly cast to a string. I have tried using <code>+ "px"</code> at the end of the expression as well. Each time, the div is being set to <code>0px</code>. Why is this not working correctly?</p>
javascript jquery
[3, 5]
3,528,646
3,528,647
Execute an ASP.net method from JavaScript method
<p>I have a javascript method looks like this</p> <p>JSMethod(JS_para_1,JS_para_2) { ...... ,,,,, }</p> <p>and I have an ASP.NET method like this</p> <p>ASP_Net_Method(ASP_Para_1,ASP_Para_2) { .... ,,, }</p> <p>Now I want to call this ASP_Net_Method from my JSMethod by passing some parameters over there..</p>
c# asp.net javascript
[0, 9, 3]
5,547,469
5,547,470
Debug mode in a library
<p>I have an Android application with several "Log.d" calls along the code in order to following the events of the app. In order to enable or disable the debug messages I call the Log with</p> <pre><code> if (MyApp.debug) Log.d("Doing something"); </code></pre> <p>Where MyApp.debug is a final boolean that I change before compiling.</p> <p>Now I want to use some classes from the application as a library for another app, so I copied them into a new library project. The problem is that now in the library I have no a MyApp class.</p> <p>How can I make something similar for controlling from the app if the library must print the debug messages or not?</p> <p>Thanks in advance</p>
java android
[1, 4]
3,053,724
3,053,725
Changing button text of gridview
<p>I have a grid view which contains a button in a template field. I want to change the button text when the button click event is completed. Can somebody send me a sample code.</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
5,491,707
5,491,708
JavaScript dynamic parameters
<p>I have following code (html,js,jquery) snippet (<a href="http://jsfiddle.net/MUScJ/2/" rel="nofollow">http://jsfiddle.net/MUScJ/2/</a>):</p> <pre><code>&lt;script type="text/javascript"&gt; function someFunc(){ html = ''; z = 1; for(i=0; i&lt;5; i++){ html += '&lt;input type="button" value="Button_'+z+'"' + 'onclick="otherFunc(z);"&gt;'; z++; } $("#container").html(html); return true; } function otherFunc(z){ alert('z:' + z); return true; } &lt;/script&gt; &lt;div id="container"&gt;&lt;/div&gt; &lt;input type="button" value="Go" onclick="someFunc();" /&gt; </code></pre> <p>This script outputs five buttons with onclick event. JS function <code>otherFunc</code> always returns z variable equal to 6. Is it possible to overcome this ? I want every button have its specific z value - 1,2,3.. and etc.</p> <p>Any ideas ? </p>
javascript jquery
[3, 5]
1,632,217
1,632,218
Checking input box whether it is focused or not
<p>I want to change the appearance of the web page according to an input is focused or not, If it is not focused, it will display something and if it is focused, replace something with another things simultaneously.How can i do that that?Can it be done with PHP? Thanks</p>
php javascript
[2, 3]
4,663,573
4,663,574
How to stop SharePoint from writing JavaScript code over and over?
<p>I'm using PIE.js to force IE7 to use CSS3 styles. However, whenever an element on my SharePoint page contains the class that PIE is supposed to style, it actually inserts the code into the html when rendered. Then upon editing the page, the code is added again on top of the old code. So at first I start with a simple tag with a class, then I end up with 200+ lines of code. </p> <p>The question: How can I prevent SharePoint from literally writing the rendered code from the javascript?</p> <p>I know this is a larger issue than just PIE.js...any javascript append or prepend actually prints the code in SharePoint. </p>
javascript jquery
[3, 5]
672,412
672,413
jquery: not selector problem?
<p>The following snippet applies a #breadcrumb hash to each link once it's clicked. That works fine.</p> <pre><code>$('#main a').live('click',function() { $(this).attr('href', $(this).attr('href') + "#breadcrumbs"); }); </code></pre> <p>Now I want to make sure that happens just if a link does not already have a #hash in it. Otherwise what happens is I click a link and the outcome looks like this: <code>http://page.com/whatever#hash#breadcrumbs</code> I simply want to prevent that.</p> <p>However the following code does not work. If I add the :not selector none of the links adds the #breadcrumb hash (with or without already existing #hash)</p> <pre><code>$('#main a:not([href*="#"]').live('click',function() { $(this).attr('href', $(this).attr('href') + "#breadcrumbs"); }); </code></pre> <p>Any idea what I'm doing wrong here?</p>
javascript jquery
[3, 5]
3,004,517
3,004,518
What is the Java equivalent of creating an anonymous object in C#?
<p>In C#, you can do the following:</p> <p><code>var objResult = new { success = result };</code></p> <p>Is there a java equivalent for this?</p>
c# java
[0, 1]
5,690,094
5,690,095
Passing a string to a onItemClick-function
<p>I have a listview and when you click an item in the list I repopulate the list with some other data. The problem I have is to pass a string inside a onItemClick so I can use it there. How can I do that?</p> <pre><code> private void asdf(int myInt, String myString) { Bla bla bla bla... //I can access myString here OnItemClickListener itemListener = new OnItemClickListener(){ public void onItemClick(AdapterView&lt;?&gt; parent, View arg1, int position, long arg3) { //But how can I access myString here like the row below asdf(Integer.valueOf(aIdList.get(position).toString()),myString); } } } </code></pre>
java android
[1, 4]
2,698,109
2,698,110
colors.xml resource does not work
<p>I created a colors.xml file in my Android app under /res/values/colors.xml. The contents are...</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;color name="Green"&gt;#00ff00&lt;/color&gt; &lt;/resources&gt; </code></pre> <p>I try to update the background of my a TableRow using...</p> <pre><code> TableRow test = (TableRow)findViewById(R.id.tableRow2); test.setBackgroundColor(R.color.Green); </code></pre> <p>This does not set it as green, it is gray instead. No matter what values I add to the colors.xml file, it is always the same gray color. However this does work...</p> <pre><code> TableRow test = (TableRow)findViewById(R.id.tableRow2); test.setBackgroundColor(android.graphics.Color.GREEN); </code></pre> <p>Is something wrong with my colors.xml?</p>
java android
[1, 4]
5,056,067
5,056,068
make textbox work like dropdown box
<p>I am trying to replicate the functionality I have on a dropdown box that allows a user to select a tag and then return articles related to this term,.</p> <p>The textbox needs to accept a search term and work in the same way. I have tried everything I can think of but I am getting zero results.</p> <p>To replicate the behavior, select an item from the dropdown box and it will return articles. Then try typing the same term in the search box and it returns no articles.</p> <p>Any idea why? Here's the site:</p> <p><a href="http://www.api.jonathanlyon.com/getpocket/view.html" rel="nofollow">http://www.api.jonathanlyon.com/getpocket/view.html</a></p>
php javascript
[2, 3]
4,064,084
4,064,085
How to pass multiple arguments in CommandArgument in GridView?
<p>I was working on asp.net gridview control.Now I need to edit some row data.For that I was using this code:</p> <pre><code> &lt;asp:LinkButton ID="btnEdit" Text="Edit" runat="server" CommandName="QuickEdit" OnClick="btnEdit_Click" CommandArgument ='&lt;%# ((CheckBox)(((GridViewRow) Container).Cells[4].Controls[0])).Checked %&gt;'/&gt; </code></pre> <p>and the 'btnEdit_Click' method is :</p> <pre><code> protected void btnEdit_Click(object sender,EventArgs e) { LinkButton btn = (LinkButton)sender; switch (btn.CommandName) { case "QuickEdit": EditPanel.Visible = true; GridPanel.Visible = false; CheckBox cbRequiresState = (CheckBox)EditPanel.FindControl("checkRequiresState"); if (btn.CommandArgument =="True") { cbRequiresState.Checked = true; } else { cbRequiresState.Checked = false; } break; } } </code></pre> <p>Now, I need to pass more than one argument as CommandArgument to that 'btnEdit_Click' method.For that what I need to do? And plz suggest me a good way to utilize those Arguments in that method also. thnx in advance.</p>
c# asp.net
[0, 9]
1,964,779
1,964,780
Should I make a local variable $this when accessing $(this) multiple times?
<p>Example:</p> <pre><code>$("#footer-create-nav li").click(function () { var $this = $(this); $this.addClass('footer-create-active'); $this.siblings().removeClass('footer-create-active'); return false; } </code></pre> <p>vs how alot of my code looks:</p> <pre><code>$("#footer-create-nav li").click(function () { $(this).addClass('footer-create-active'); $(this).siblings().removeClass('footer-create-active'); return false; } </code></pre>
javascript jquery
[3, 5]
4,034,449
4,034,450
How can I use jQuery to move a div across the screen
<p>I need to make multiple divs move from right to left across the screen and stop when it gets to the edge. I have been playing with jQuery lately, and it seem like what I want can be done using that. Does anyone have or know where I can find an example of this?</p>
javascript jquery
[3, 5]
3,690,715
3,690,716
jQuery - getting final URL after all redirects
<p>I'm trying to get the final URL after all redirects happen. There are a few situations I'm trying to resolve:</p> <p>1) no redirect (trivial) 2) 302 redirect 3) JS injected redirect. Page loads, waits for 2 seconds and then redirects. 4) combination of 2 and 3</p> <p>I'm thinking that opening up a child window and waiting for a few seconds for all redirects to come through, but I'm not quite sure how to do this with jQuery.</p> <p>Any ideas or suggestions on a different approach?</p>
javascript jquery
[3, 5]
4,551,602
4,551,603
Capture clicking on a checkbox's title in jQuery
<p>I'd like to listen on the event of a user clicking on a checkbox's title (in addition to the checkbox itself). How can this be done?</p>
javascript jquery
[3, 5]
4,330,299
4,330,300
Error in callback rate with CountDownTimer?
<p>I have been building a small darkroom timer application, as I learn Android and java.<br> Ended up using CountDownTimer, as it does most of the work for me. :{)<br> However, I ran into what looks like an error in the class. </p> <p>My initial structure used the onTick() callback to decrement my time counter, and update the time-remaining display. If I set it up for example:</p> <pre><code> new CountDownTimer(60000, 100) { public void onTick(long millisUntilFinished) { mDisplayTime.setText(String.valueOf(millisUntilFinished)/1000); timeTenths -= 1; updateDisplay(); } public void onFinish() { // mDisplayTime.setText("Done!"); } }.start(); </code></pre> <p>The total timeout (60 seconds) is spot on, within half a second by my stopwatch.<br> However, the displayed count stops with 3.0 seconds on the clock.<br> Experimenting with it, I found a consistent 5% "shortage" in onTick() events.<br> I could change the second parameter to 950 milliseconds, but that's an ugly kludge...</p> <p>In the end, I changed the onTick() to display actual millisUntilFinished, which is fine, and eliminates my counter as well.</p> <p>Is this a known problem with CountDownTimer()?</p> <p>Dave</p>
java android
[1, 4]
2,267,022
2,267,023
Input textbox with Watermark hint and submitted value
<p>I have an html Input box to enter value used to run a PHP script. The value can also be passed using the URL and GET.</p> <p>Now I would like to have a watermark hint in my textbox. I used the code from this gentleman: <a href="http://www.drewnoakes.com/code/javascript/hintTextbox.html" rel="nofollow">http://www.drewnoakes.com/code/javascript/hintTextbox.html</a></p> <p>It works fine except that if I enter a value and submit the textbox does not show the value but the default hint. I would like to see the value instead. How can I do that?</p> <p>Here is partial code:</p> <pre><code>&lt;form method="get" action='index.php'&gt; &lt;input type="text" name='q' SIZE="50" value="search for anything here" class="hintTextbox"&gt; &lt;/form&gt; &lt;?php $Input = ""; if (isset($_GET['q'])) $Input = $_GET['q']; try { script($Input); } catch (Exception $e) { print $e-&gt;getMessage(); } ?&gt; </code></pre>
php javascript
[2, 3]
4,977,958
4,977,959
how can i get particular text using jquery
<p>how can i get only the cheque number(<code>AA12GH56</code>) not the other texts, here is my code:</p> <p>HTML:</p> <pre><code>&lt;p&gt;your cheque number is :AA12GH56 &lt;br /&gt; your bank credit balance is :32,999&lt;/p&gt; </code></pre> <p>Javascript:</p> <pre><code>$(document).ready(function(){ $('p').click(function(){ var cheque_no=$(this).text(); }); }); </code></pre>
javascript jquery
[3, 5]
3,657,285
3,657,286
Nested loop in JavaScript/jQuery not working
<p>Im calling a for loop inside a for loop and its not working, here's the code : </p> <pre><code>function PopulateMonths() { for (var m = 0; m &lt; 12; m++) { var $month = $('.d-month').clone(); $month.find('.d-header').text(m); $month = PopulateDays($month); $month.appendTo('#diary').show(); $month = null; } } function PopulateDays($month) { for (var d = 0; d &lt; 30; d++) { var $row = $('.d-row').clone(); $row.find('.d-day').text(d); $row.appendTo($month).show(); $row = null; } return $month; } </code></pre> <p>If I call PopulateDays manually 12 times it works fine, as soon as I try to loop 12 times using PopulateMonths() the page crashes, CPU usage goes through the roof so im assuming a lot of work is going on.</p> <p>What am I missing?</p>
javascript jquery
[3, 5]
2,680,481
2,680,482
Unable to retrieve value of the gridview column after making it invisible
<p>I have a gridview say gv1 . Which has 5 columns. I bind the gridview on the change of a dropdown selection. After binding I make the 4th(gv1.column[3]) and 5th(gv1.column[4])column visible false.</p> <pre><code>gv1.Columns[3].Visible = false; gv1.Columns[4].Visible = false; </code></pre> <p>I am unable to access the column value(these are id's) later. I tried making it visible before accessing still in vain.</p> <pre><code>{ gv1.Columns[3].Visible = True; gv1.Columns[4].Visible = True; int id = Convert.ToInt32(row.Cells[4].Text.ToString().Trim()); } </code></pre> <p>I get the error at 'id' "Input string was not in a correct format." I found ,All the column for each value is having null value.</p>
c# asp.net
[0, 9]