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
6,007,671
6,007,672
Building a file cache
<p>I am looking for any information regarding the design and performance of a file cache. This is not for a website.</p> <p>I'm working on a program that I may, potentially, want to maintain a small file cache to help speed up things (since it will be running on a mechanical disk, it may be possible to further increase performance by preloading the next file, and ensuring the CPU always has something to work on). </p> <p>Would I just fire off a thread to load a file when I determine it's a good time, or are there more interesting / standard behaviors that might give better performance?</p> <p>Many Thanks.</p>
c# c++
[0, 6]
2,325,658
2,325,659
Enter Key as Tab and Move Focus to next Control in asp.net
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4494552/change-enter-from-submission-to-tab">Change Enter from submission to Tab?</a> </p> </blockquote> <p>Hi Experts How to override tab key with enter key in asp.net web form and move to next control on enter key</p>
javascript asp.net
[3, 9]
2,062,070
2,062,071
Sending and receiving data PHP to android JAVA
<p>I am currently working on an app for Android that receives data from server. The problem that I do not really know how to make the data-transfer to the server and back to the app, I use PHP like an engine that accepts and returns data, but I'm not sure how good and effective it is.. Does anyone know how WAZE works and can give me a direction to my problem?</p>
java php android
[1, 2, 4]
5,588,685
5,588,686
Android java.net.UnknownHostException: Host is unresolved (strategy question)
<p>I have android code that uses a background process to routinely (e.g. hourly) connect to a content source on the web to check for updated content. As new users download the app and run it for the first time, it seems (and this is just a "seems at the moment) that in this first-run situation, because the DNS for our servers are not cached already on the device, those first series of connections fail with dreaded UnknownHostException: Host is unresolved. And of course, the application tries again later and (again, "it seems like") it is all working -- perhaps because the OS has had time to actually resolve the address.</p> <p>So, my question(s) are: (1) Do other Android developers see this behavior with their deployed applications as well? First time, a series of "host unresolved" issues that work themselves out later. (2) Does anyone have a better strategy for "warming up the DNS" so-to-speak so that the first real connections work? or perhaps do you just re-try with some back-off looping when you encounter this exception? I was contemplating having a separate thread that tries to fetch a small text file from our server and have it just loop until it gets it and maybe (not sure about this part) block the other outgoing network connections until it succeeds.</p> <p>In any event, I have read through a chunk of the answers to various similarly worded questions here on Stack Overflow and I just to assure everyone that</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt; </code></pre> <p>is set in my Manifest file :)</p>
java android
[1, 4]
1,006,613
1,006,614
Getting default Server time in jQuery?
<p>How can I get the web-server time using jQuery?</p>
php javascript jquery
[2, 3, 5]
4,120,475
4,120,476
PHP variable to Javascript variable
<p>I am currently working on making a simple php script to edit certain aspects of a game in JavaScript. When attempting to pass variables from the script to the game using forms, the variable data does not seem to transfer. As of now, the script is meant to edit the RDG value of one player in the game. The code is as follows:</p> <p>script.php:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Form&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="get" action="tron2.html"&gt; &lt;p&gt;What are your player 1's RGB values: &lt;input type="text" name="color1r" /&gt; Red &lt;input type="text" name="color1g" /&gt; Green &lt;input type="text" name="color1b" /&gt; Blue &lt;/p&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And the portion of the code in javascript where variables are assigned</p> <pre><code>&lt;?php $color1r = $_POST["color1r"]; $color1g = $_POST["color1g"]; $color1b = $_POST["color1b"]; ?&gt; &lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt; Tron2 &lt;/TITLE&gt; &lt;script&gt; var x = "&lt;?= $color1r; ?&gt;"; var y = "&lt;?= $color1g; ?&gt;"; var z = "&lt;?= $color1b; ?&gt;"; //more code for the game </code></pre> <p>When the game runs, the color of the player stays black, so the values of x,y,z must all be 0. Is there any reason why the values aren't being passed?</p>
php javascript
[2, 3]
3,058,000
3,058,001
Testing URL equivalence in JavaScript/JQuery (obtaining canonical form of URL)
<p>The same URL can be represented in many different representations.<br> e.g. Assuming the browser's currently loaded page is<code>http://www.example.com/about.html</code></p> <p>The following URLs can be considered equivalent from the browser's point of view:</p> <ul> <li><code>http://www.example.com/contact-us.html</code> and <code>http://www.example.com/contact-us.html</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>contact-us.html</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>.</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>/contact-us.html</code></li> </ul> <p>With this in mind, is there an easy way to determine this equivalence using JavaScript?</p> <p>Or, is there a way of obtaining a canonical form of a URL such that the canonical forms can be compared as a way of reaching the answer?</p>
javascript jquery
[3, 5]
3,612,208
3,612,209
Change scroll direction at Anchor point
<p>on my site I have 6 divs each div the same height and width of the browser window, so 5 are out of view, 3 left aligned then 3 more on top, as so....</p> <p><img src="http://i.stack.imgur.com/ZRwWY.png" alt="enter image description here"></p> <p>When my visitors scroll, id like to scroll along to the 3rd div, then scroll up to the 4th, then continue scrolling horizontally. Is this possible with jQuery, and if so how can it be done? </p>
javascript jquery
[3, 5]
788,732
788,733
How to draw on Canvas using multi-threading?
<p>I have been developing the application for drawing, and there is the following code for it:</p> <pre><code>public class PainterView extends View implements DrawingListener { private Context context; private Painter painter; private Bitmap background; private Bitmap bitmap; private Paint bitmapPaint; private Path path; private Paint paint; private float x; private float y; public PainterView(Context context, Painter painter) { super(context); this.context = context; this.painter = painter; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); } @Override protected void onDraw(Canvas canvas) { if (bitmap != null) { canvas.drawBitmap(background, 0, 0, bitmapPaint); canvas.drawBitmap(bitmap, 0, 0, bitmapPaint); canvas.drawPath(path, paint); } } @Override public boolean onTouchEvent(MotionEvent event) { x = event.getX(); y = event.getY(); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: painter.touchStart(x, y); break; case MotionEvent.ACTION_MOVE: painter.touchMove(x, y); break; case MotionEvent.ACTION_UP: painter.touchUp(); break; } return true; } @Override public void onPictureUpdate(Bitmap background, Bitmap bitmap, Paint bitmapPaint, Path path, Paint paint) { this.background=background; this.bitmap = bitmap; this.bitmapPaint = bitmapPaint; this.path = path; this.paint = paint; invalidate(); } public void setPainter(Painter painter) { this.painter = painter; } } </code></pre> <p>This code catches all touch event, send this event to model, this save coordinates and send bitmap to view for drawing. </p> <p>I'm using this code, and it is working good, but my client tells me that drawing is not smooth breaks or missing at some places. So I need to use multithreading for it. So, please, tell me, how I can do it? Or may I increase the productivity using another way?</p>
java android
[1, 4]
1,908,152
1,908,153
JavaScript Photo Slider
<p>I'm working on making a JS script that will go in the header div and display a few pictures. I looked into JQuery Cycle, but it was out of my league. The code I wrote below freezes the browser, should I be using the for loop with the timer var?</p> <pre><code>&lt;script type="text/JavaScript" language="JavaScript"&gt; var timer; for (timer = 0; timer &lt; 11; timer++) { if (timer = 0) { document.write('&lt;img src="images/one.png"&gt;'); } if (timer = 5) { document.write('&lt;img src="images/two.png"&gt;'); } if (timer = 10) { document.write('&lt;img src="images/three.png"&gt;'); } } &lt;/script&gt; </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
428,908
428,909
creating strings inside a for each loop? or creat them outside, use inside?
<p>i have the following code below and was lookign to clean it up, but am not sure if it needs clean up or not. </p> <pre><code>foreach (SearchResult sr in mySrchColl) { string strValIn = sr.Properties["in"][0].ToString(); string strValOut= sr.Properties["out"][0].ToString(); } </code></pre> <p>do i change this to something like this:</p> <pre><code>string strValIn = ""; string strValOut= ""; foreach (SearchResult sr in mySrchColl) { strValIn = sr.Properties["in"][0].ToString(); strValOut= sr.Properties["out"][0].ToString(); } </code></pre> <p>whats the difference or are these two identical?</p>
c# asp.net
[0, 9]
3,078,134
3,078,135
Disable jQuery effect on page refresh
<p><strong>Overview</strong></p> <p>I have div#lead_form that SlideDown in 5 seconds after page loads. And in that div, I have a submit button. Everytime someone clicks submit, the form within #lead_form will validate the input fields and refresh the page. </p> <p><strong>Issue</strong></p> <p>Everytime the form validates, it refreshes the web page and the div#lead_form SlideDown takes 5 seconds to slide in. What I want to do is, have a true false variable and check if the submit button has been clicked, if true, disable the div#lead_form SlideDown effect?</p> <p><strong>My HTML</strong></p> <pre><code>&lt;div id="lead_form"&gt; &lt;div id="button"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>My jQuery</strong></p> <pre><code>$(document).ready(function() { $("#lead_form").hide(0).delay(4000).slideDown(5000); }); </code></pre> <p><strong>Findings</strong></p> <p><a href="http://stackoverflow.com/questions/1712589/jquery-how-to-sequentially-run-an-animation-only-once-after-animation-on-a">This is not exactly what I'm after, but similar?</a></p>
php jquery
[2, 5]
3,374,237
3,374,238
Append POST data javascript
<p>Using either Javascript and/or Jquery how can I append POST data to a form to submit. I have in my server side code that will check to see if the post data dictionary contains a certain key.</p> <p>I already have a form in the code. So I would just like to use javascript to add a new key to the POST data.</p>
javascript jquery
[3, 5]
2,480,299
2,480,300
how to set OnClientClick to be true?
<p>I wonder how to use jquery click a button and set it's OnClientClick to be true, so the validation process will not run. I use</p> <pre><code>$("[id$='btn_Save']").attr('OnClientClick', true); $("[id$='btn_Save']").Click(); </code></pre> <p>But it does not work.</p>
jquery asp.net
[5, 9]
3,581,610
3,581,611
jQuery check if browser support position: fixed
<p>How do I check if browser supports <code>position:fixed</code> using jQuery. I assume I have to use <code>$.support</code> I think, but how?</p> <p>Thank you for your time.</p>
javascript jquery
[3, 5]
3,030,809
3,030,810
How reload div every 3 minutes
<p>I have a div with id "myDiv" and i would like to update it every three minutes with content from a php file. Any help would be really appreciated. Thanks</p>
php jquery
[2, 5]
4,663,542
4,663,543
Using methods of classes in android programming
<p>Hi everyone I am a beginner in android, please help. I have DBAdapter class which has different methods to manipulate my db. I want to call the method i.e. insert when button is clicked. However it only works outside of listener (View.OnClickListener). </p> <pre><code> package com.dbclass; import android.app.Activity; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class DBActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btn1 = (Button)findViewById(R.id.Button01); btn1.setOnClickListener(btn1Listener); DBAdapter db = new DBAdapter(this); db.open(); long id; // this needs to go to setOnclick method id = db.insertTitle( "0470285818", "Alanel", "Wrox"); Cursor c = db.getAllTitles(); if (c.moveToFirst()) { do { DisplayTitle(c); } while (c.moveToNext()); } db.close(); } public void DisplayTitle(Cursor c) { Toast.makeText(this, "id: " + c.getString(0) + "\n" + "ISBN: " + c.getString(1) + "\n" + "TITLE: " + c.getString(2) + "\n" + "PUBLISHER: " + c.getString(3), Toast.LENGTH_LONG).show(); } private View.OnClickListener btn1Listener = new View.OnClickListener() { @Override public void onClick(View v) { // db.insertTitle("0470285818", "Alanel", "Wrox"); } }; } </code></pre>
java android
[1, 4]
4,214,364
4,214,365
Having trouble to run report from server from web applicaton
<p>I am using ASP.NET 2005, C# and Crystal Reports 8.5 for development. It's running fine on my development computer, but when I try to to run from the server it is giving me an error.</p> <blockquote> <p><strong>Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.</strong></p> </blockquote> <p>I have these Crystal Reports dlls referenced in my bin folder:</p> <ul> <li>CrystalDecisions.CrystalReports.Engine.dll</li> <li>CrystalDecisions.ReportSource.dll</li> <li>CrystalDecisions.Shared.dll</li> <li>CrystalDecisions.Web.dll</li> <li>CrystalDecisions.Windows.Forms.dll</li> </ul>
c# asp.net
[0, 9]
3,890,165
3,890,166
use php to change a html elements inner text
<p>I have a basic form, which i need to put some validation into, I have a span area and I want on pressing of the submit button, for a predefined message to show in that box if a field is empty.</p> <p>Something like</p> <pre><code>if ($mytextfield = null) { //My custom error text to appear in the spcificed #logggingerror field } </code></pre> <p>I know i can do this with jquery (document.getElementbyId('#errorlogging').innerHTML = "Text Here"), but how can I do this with PHP?</p> <p>Bit of a new thing for me with php, any help greatly appreciated :)</p> <p>Thanks</p>
php javascript
[2, 3]
147,578
147,579
Identifying a certain common section on pages in a website
<p>I have a list of common links for product pages, and I need to go through and grab all the links for the product image on each product page.</p> <p>Eg I have got this far: I have a whole spreadsheet full of links like this</p> <pre><code>http://www.apc.com/products/moreimages.cfm?partnum=WSYSW100KF </code></pre> <p>the problem is I need the acutal image links for another column on my spreadsheet (it;s going to be used for a import on a eccomerce shop)</p> <p>the thing is these image links don't seem to match up in any way and can be quite varied </p> <pre><code>http://www.apcmedia.com/resource/images/500/Front_Left/98EC66CA-5056-AE36-FE51936B432B1C17_pr.jpg </code></pre> <p>I have identified though that these images sit in what looks like a common area on the product page code</p> <pre><code>&lt;div align="center"&gt;&lt;img align="center" src="http://www.apcmedia.com/resource/images/500/Front_Left/98EC66CA-5056-AE36-FE51936B432B1C17_pr.jpg"&gt;&lt;/div&gt; </code></pre> <p>How can I indetify that <code>&lt;img align="center" src=""&gt;</code> part in Jquery on each page ?</p> <p>I'm thinking if I iterate through all those links, then I can grab the releavnt direct Image link, grab it and repopulate into another spreadsheet column.</p> <p>I'm just not 100% on how to achieve this, any advice would be greatly appreciated.</p> <p>Thanks</p>
php jquery
[2, 5]
1,651,049
1,651,050
Javascript converting example to real code issue - arrays
<p>I'm trying to use the userBox plugin and in the example we have the following array being built:</p> <pre><code>var data = [ {text: "Adam Adamson", id: "[email protected]"}, {text: "Betsy Boop", id: "[email protected]"}, {text: "Jooles Jooles", id: "[email protected]"} ]; </code></pre> <p>I want to build my array at runtime using JSON data I receive from my webservice. In my code I have tried to mimic this array with the following. </p> <pre><code> var data = new Array(); for (var i = 0; i &lt; msg.d.ListExercise.length; i++) { $("userlist").append("msg.d.ListExercise[i].exercise_value"); if (i &gt; 0 &amp;&amp; i &lt; msg.d.ListExercise.length - 1) { data.push('{text: ' + '"' + msg.d.ListExercise[i].exercise_value + '"' + ' , id: ' + '"' + msg.d.ListExercise[i].exercise_id + '"' + '},'); } if (i == msg.d.ListExercise.length - 1) { data.push('{text: ' + '"' + msg.d.ListExercise[i].exercise_value + '"' + ' , id: ' + '"' + msg.d.ListExercise[i].exercise_id + '"' + '}'); } } </code></pre> <p>From what I understand in the example he building a string array. I have verified that the array is being added to and that the data is being added to it. However, when I pass my array into the plugin code it shows the word 'Undefined' 135 times (the length of the array).</p> <p>My Array looks something like this:</p> <pre><code>{text: "Standard Push-Up" , id: "1"}, {text: "Wide Front Pull-Up" , id: "2"}, {text: "Vertical Punches" , id: "135"} </code></pre> <p>What is the best way to get my data into his array example in javascript?</p>
javascript jquery
[3, 5]
4,153,486
4,153,487
ASP.NET how to check type of the file type irrespective of extension
<p>If somebody renames the extension of any file (other than excel) to xls and xlsx (please dont ask me why :-( ), I need to check for its validity (if that is still a valid excel file). I am using mime type and Its not working. Am I missing anything?</p> <pre><code>const string excel2007MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; const string excel2003MimeType = "application/vnd.ms-excel"; string excelExtention = string.Empty; excelExtention = System.IO.Path.GetExtension(myFilePath.PostedFile.FileName).ToLower(); string mimeType = myFilePath.PostedFile.ContentType; Response.Write("mime type" + mimeType + Environment.NewLine); if( ( !(excelExtention == ".xls" &amp;&amp; mimeType == excel2003MimeType) || !(excelExtention == ".xlsx" &amp;&amp; mimeType == excel2007MimeType) ) ) { Response.Write ("only excel file is permitted"); } </code></pre> <p>I rename a jpg file to xlsx file and upload. If I print out variable mimetype, Its value is "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet". I am not sure why because the content is not an excel file. Its an image.</p>
c# asp.net
[0, 9]
492,811
492,812
Weird repeater problem
<p>I have a Repeater control in my aspx page:</p> <pre><code>&lt;asp:Repeater ID="repeater" runat="server" EnableViewState="false"&gt; &lt;ItemTemplate&gt; &lt;%# Eval("someAttribute") %&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>On Page_Load I have the following code:</p> <pre><code>if (String.IsNullOrEmpty((string)Request.QueryString["action"])) s.OpenConn("SELECT * FROM someTable;"); else s.OpenConn("SELECT * FROM someTable WHERE id=1;"); if (s.Read()) { repeater.DataSource = s.GetRead(); repeater.DataBind(); } </code></pre> <p>The problem is that when I enter ?action=something, data is not displayed on the page. But if I remove ?action=something, I get all the data.</p> <p>Am I doing something wrong?</p>
c# asp.net
[0, 9]
5,042,161
5,042,162
Android: ListView Display
<p>I have a list View and I'm trying to put the data from a method unto a list view but it's not showing up on the android phone. I've trying almost everything. Please help me. This is the code for the list...</p> <pre><code>int[] numbers = new int[5]; CardDataBase database = new CardDataBase(numbers); ListView list = (ListView)findViewById(R.id.listView1); List&lt;String&gt; view = database.getFrontSet(); ArrayAdapter &lt; String &gt; listAdapter = new ArrayAdapter &lt; String &gt;( MainActivity.this , android . R . layout . simple_list_item_1 , view ); list.setAdapter(listAdapter); </code></pre> <p>The getFrontSet() method should return a list if strings when called. But nothing is shown on the listView on the phone. The code for the CardDataBase class is also provided, it might also be the problem...</p> <pre><code>class CardDataBase{ private int card; private String front; private String back; private int[] cards = new int[5]; private String[] fronts = new String[5]; private String[] backs = new String[5]; public CardDataBase(int[] nums) { this.cards = nums; for(int i = 0; i &lt; cards.length; i++) { fronts[i] = setFront(cards[i], String.valueOf((Object)cards[i])); backs[i] = setBack(cards[i], getBack(cards[i])); } } public String setFront ( int N, String front ) { card = N; this.front = front; return this.front; } public String setBack ( int N, String back ) { card = N; this.back = back; return this.back; } public List&lt;String&gt; getFrontSet ( ) { List&lt;String&gt; list = new ArrayList&lt;String&gt;(); for(int i = 0; i &lt; cards.length; i ++) { list.add(fronts[i]); } return list; } } </code></pre>
java android
[1, 4]
5,460,325
5,460,326
Uncaught ReferenceError: $ is not defined?
<p>How come this code throws an "Uncaught ReferenceError: $ is not defined" - when it was OK before? </p> <pre class="lang-js prettyprint-override"><code>$(document).ready(function() { $('#tabs &gt; ul').tabs({ fx: { opacity: 'toggle' } }); $('#featuredvid &gt; ul').tabs(); }); </code></pre> <p>Results in tabs don't close anymore.</p> <p>jQuery is referenced in the header:</p> <pre class="lang-php prettyprint-override"><code>&lt;script language="JavaScript" type="text/javascript" src="&lt;?php echo get_option('siteurl') ?&gt;/js/sprinkle.js"&gt;&lt;/script&gt; &lt;script language="JavaScript" type="text/javascript" src="&lt;?php echo get_option('siteurl') ?&gt;/js/jquery-1.2.6.min.js"&gt;&lt;/script&gt; &lt;script language="JavaScript" type="text/javascript" src="&lt;?php echo get_option('siteurl') ?&gt;/js/jquery-ui-personalized-1.5.2.packed.js"&gt;&lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
424,193
424,194
how to open new browser window on button click event
<p>How to open new browser window on button click event in C# ASP.NET?</p> <p>Please share any example.</p> <p>I am doing following code please let me know where I am going wrong</p> <pre><code>btn_Click() { if(condition==true) { this.Page.ClientScript.RegisterStartupScript(this.GetType(),"page_index_script2", "openNewWindow();", true); } } javascript function is function openNewWindow() { alert('HI'); window.open('http://www.stackoverflow.com'); } </code></pre> <p>When I run the code from javascript function Alert works but new window is not getting opened.</p>
c# asp.net
[0, 9]
5,648,541
5,648,542
Toggle 2 divs with 2 links
<p>I'm pretty new to jquery and here's what I'm trying to do:</p> <p>I have two links: link1 - link2 And 2 divs: div1, div2</p> <p>What I would like to do:</p> <p>If you click on link1 it slideDown the div1, if you click on link1 again, it slideUp div1 BUT If you click on link1 and then on link2 I want the div1 to slideUp and then slideDown the div2</p> <p>Here's the code that I was playing with:</p> <pre><code>$(document).ready(function(){ $("#div1").hide(); $("#div2").hide(); $('.link1').click(function(){ $("#div2").slideUp(); $("#div1").slideToggle(); }); $('.link2').click(function(){ $("#div1").slideUp(); $("#div2").slideToggle(); }); }); </code></pre>
javascript jquery
[3, 5]
3,694,923
3,694,924
put value in textarea using jquery
<p>I want to put the value in textarea using the jquery. I'm using the following code. It is not working.</p> <pre><code> &lt;link rel="stylesheet" href="css/jquery.wysiwyg.css" type="text/css" /&gt; &lt;script type="text/javascript" src="js/jquery.wysiwyg.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function wedit(topic){ $("#wysiwyg").html(topic); alert(id+topic+instructor+date+video); } &lt;/script&gt; &lt;form name="theform" action="" method="post"&gt; &lt;table border="0" cellpadding="10" cellspacing="10" width="680px"&gt; &lt;tr&gt;&lt;td width="150"&gt;Topic:&lt;/td&gt;&lt;td&gt;&lt;span id="wtopic"&gt; &lt;textarea name="wysiwyg" id="wysiwyg" &gt;&lt;/textarea&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="submit" name="submit" value="Save" title="Save" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; </code></pre> <p>It is working in case of text but in case of textarea it is showing empty value. please let me know how can I put the text into the textarea through jquery or javascript??</p>
javascript jquery
[3, 5]
4,698,018
4,698,019
What's the default timeout of using HttpGet and DefaultHttpClient?
<p>The code is like below. If I don't set any timeout parameters, what is the default time out for "new DefaultHttpClient().execute(mConnection)"?</p> <pre><code>mConnection = new HttpGet(mURL); mResponse = new DefaultHttpClient().execute(mConnection); </code></pre> <p>Thanks.</p>
java android
[1, 4]
4,983,885
4,983,886
jQuery dynamically add validation rules to n-number of fields
<p>I'm using the jQuery validation plugin to validate a form. The form fields are generated dynamically. I have an email:</p> <pre><code>&lt;input type="text" name="customer_email_&lt;?=$i?&gt;" value="" id="customer_email_&lt;?=$i?&gt;" /&gt; </code></pre> <p>This input field is in a php loop and can be generated n-number of times. The idea is to check if the entered e-mail is unique. When the user enters something in any of the fields generated I'm sending an AJAX call that is checking in the database if the e-mail is unique.</p> <pre><code> var pass_count_array = [&lt;?=$js_array?&gt;]; // generated by php jQuery.each(pass_count_array, function(index, p) { //check if the e-mail is unique jQuery.validator.addMethod("unique_email_"+p, function(value, element) { return check_unique_email(p); }); var current_email = "customer_email_"+p; jQuery("#tair_form").validate({ rules : { current_email: { "unique_email_"+p : true } }); }); </code></pre> <p>The code above is looping through all the fields, adding a custom validation method unique_email_1, unique_email_2, etc. The problem here is that the validation rules doesn't accept this:</p> <pre><code>"unique_email_"+p : true </code></pre> <p>Any ideas how to apply the custom validation method to every e-mail input field?</p>
php javascript jquery
[2, 3, 5]
3,323,996
3,323,997
Getting started with writing a desktop app that talks to an iPhone
<p>I'm thinking of writing an app to selectively transfer photos/music to and from my iPhone, mostly for fun and personal convenience. However, I'm stuck at the very beginning -- where do I look to find information on how to do this?</p> <p>Pretty much every link I see talks about developing applications that run on the iPhone, but nothing about desktop app for interfacing with an iPhone.</p> <p>I'm on Windows (no access to a Mac, but I'll take suggestions for that for when I eventually acquire one), and I'm most familiar with C#, but other languages are definitely an option.</p> <p>Can anybody offer me a few pointers on getting started? Thanks.</p> <p>Edit: to clarify further, I don't need information on how to write applications that run ON the iphone. There are plenty of resources out for that. :) What I'm looking for it some pointers on how to "talk" to an iPhone or an iPod through the USB cord, if that's even possible.</p> <p>Edit #2: I found <a href="http://libimobiledevice.org/" rel="nofollow">libmobiledevice</a> library that effectively does what I'm talking about on Linux. I don't think I'm too keen on attempting to port it over to Windows, though. :)</p>
c# iphone
[0, 8]
2,848,970
2,848,971
autocomplete display distinct items
<p>How do I display distinct items in the autocomplete list? I don't want the duplicates to show up in the list. I'm reading the data from an XML file.</p> <p>Here's my web service code:</p> <p>[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService]</p> <pre><code>public class WebService : System.Web.Services.WebService { [WebMethod] public string[] GetItemsList(string prefixText, int count) { List&lt;string&gt; suggestions = new List&lt;string&gt;(); using (XmlTextReader reader = new XmlTextReader(HttpContext.Current.Server.MapPath("flightdata3.xml"))) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element &amp;&amp; reader.Name == "departurelocation") { string itemName = reader.ReadInnerXml(); if (itemName.StartsWith(prefixText, StringComparison.InvariantCultureIgnoreCase)) { suggestions.Add(itemName); if (suggestions.Count == count) break; } } if (reader.NodeType == XmlNodeType.Element &amp;&amp; reader.Name == "destinationlocation") { string itemName = reader.ReadInnerXml(); if (itemName.StartsWith(prefixText, StringComparison.InvariantCultureIgnoreCase)) { suggestions.Add(itemName); if (suggestions.Count == count) break; } } } } return suggestions.ToArray(); } } </code></pre>
c# asp.net
[0, 9]
2,059,818
2,059,819
Creating JSONObjects in android
<p>I need to form a JSON object like this. </p> <pre><code>{ "GroupID": 24536, "Section": [1,2,3,4,5] } </code></pre> <p>Here is what i have tried, but the section array is not getting properly formed when i look at my object structure. </p> <pre><code>JSONObject Object = new JSONObject(); Object.put("Group", GroupID); int[] section = {1,2,3,4,5}; Object.put("Section", section); </code></pre>
java android
[1, 4]
307,893
307,894
How can I retrieve all mouse coordinates between mousedown to mouseup event
<p>As per the jQuery docs below code can be used to capture mouseup and mouse down events. But my requirement is bit different</p> <pre><code>$("#dic").mouseup(function () { }).mousedown(function () { }); </code></pre> <p>But How can I calculate mouse moving co-ordinates between mousedown position to mouseup position. Please help me on this. How can I apply mousemove event between mousedown and mouseup</p>
javascript jquery
[3, 5]
1,292,235
1,292,236
slow jquery performance
<p>I have about 200 small icons (4kb) on my web page on click on a menu i want the icons to dim out im using this function</p> <pre><code>if (which!="all") { $(function () { // SET OPACITY TO 20% $("."+which).stop().animate({opacity: '0.2'}, 100); }); } </code></pre> <p>for some reason the performance is very slow and it takes a long time for the icons to dim out How can i speed up the performance ?</p> <p>thanks </p>
javascript jquery
[3, 5]
4,986,346
4,986,347
How to use custom list adapter for android?
<p>I work this in my sample application</p> <p>like this link</p> <p><a href="http://stackoverflow.com/questions/12508092/how-can-i-change-the-color-dynamically-in-listview-base-on-the-value-from-xml-pa">How can I change the color dynamically in listview base on the value from xml parse?</a></p> <p>Please Help Me thank you</p> <p>:)</p>
java android
[1, 4]
178,132
178,133
How to call div content in widows.open()
<p>Actually i have a asp:LinkButton in aspx page and i just want that whenever user clicks on asp:LinkButton open popup on dat asp:LinkButton its already done and i have given another link to it(its ur website's link only) and its working fine, but the problem is now i want to open a popup with checkboxes with the cities name.</p> <p>i have made one type of you can say block in a DIV on the same aspx page in the bottom and now i want is to call this div content in the script above in windows.open..</p> <p>Please help me out .. asap</p> <p>Thank You!</p>
javascript asp.net
[3, 9]
3,879,512
3,879,513
jquery.val() on the page works, off the page does not? Why?
<p>I had the following: </p> <pre><code>&lt;script type="text/javascript"&gt; var noteid = $('#noteid').val(); &lt;/script&gt; &lt;input type="hidden" name="noteid" id="noteid" value="321"&gt; </code></pre> <p>This works great... but now I'm trying to move the JavaScript off the page into a linked JS file like so: </p> <pre><code>&lt;script type="text/javascript" src="/js/note_beta.js"&gt; &lt;/script&gt; &lt;input type="hidden" name="noteid" id="noteid" value="321"&gt; </code></pre> <p>This ext JS file has the code: "var noteid = $('#noteid').val();" but it isn't working... Is there a trick to getting this to work when it isn't on the page itself?</p> <p>Thanks</p>
javascript jquery
[3, 5]
433,568
433,569
Problem with jQuery mouseleave firing when container has select box
<p>I have a two containers -- one is nested inside of another. When I hover over the parent, I want the child container to appear. When I mouseout, I want the child container to fadeout. The problem I'm having is the child container has a form that contains a "select box". When the user selects the select box -- the mouseleave event is accidentally fired. </p> <p>How can I stop the select box from tripping the mouseleave event?</p> <p>You can see my working code here: <a href="http://jsfiddle.net/rsturim/9TZyh/3/">http://jsfiddle.net/rsturim/9TZyh/3/</a></p> <p>Here's a summary of my script:</p> <pre><code>$('#parent-container').live("mouseenter", function () { var $this = $(this), $selectOptionsContainer = $this.find('#child-container'); $selectOptionsContainer.stop().fadeTo('slow', 1.0); }).live("mouseleave", function (e) { var $this = $(this), $selectOptionsContainer = $this.find('#child-container'); $selectOptionsContainer.stop().hide(); }); </code></pre> <p><strong>edit</strong>: appears fine in WebKit-based browsers. Fails in Firefox and IE7-IE9.</p>
javascript jquery
[3, 5]
1,393,828
1,393,829
jQuery Lite Content Slider - Adding class to current slide
<p>Is it possible to add a "current" class to the slide div that is not hidden? I've been poking at this for a while and was wondering if I'm missing something obvious.</p> <p><a href="http://jsfiddle.net/e7VZS/1/" rel="nofollow">http://jsfiddle.net/e7VZS/1/</a></p>
javascript jquery
[3, 5]
3,014,570
3,014,571
Toggle and animate height of a ul within a li
<p>I have a list inside a li which needs to slide into view when the parent li is clicked.</p> <p>My code works nicely but if i click any li all of the sub lists show where as i want it only to apply to the one that was clicked...</p> <pre><code>$("#offering li").click(function() { $("#offering li ul").animate({height: "toggle"}, 1000); }); &lt;ul id="offering"&gt; &lt;li class="t current"&gt;&lt;a href="#solutions"&gt;&lt;span&gt;sage solutions&lt;/span&gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;50&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;200&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;CRM&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li class="m"&gt;&lt;a href="#management"&gt;&lt;span&gt;solutions&lt;/span&gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;50&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;200&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;CRM&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li class="b"&gt;&lt;a href="#thirdparty"&gt;&lt;span&gt;third party additions&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
2,990,053
2,990,054
Changing attribute of dynamically generated tags with JQuery
<p>I have a requirement to rewrite <code>src</code> and/or <code>href</code> attribute of tags on a page using Jquery. I have tried this <a href="http://api.jquery.com/attr/" rel="nofollow">sample code.</a> It works for tags which are already in the html page, however for tags dynamically generated by Javascript it does not work. </p> <p>Any solution for this kind of requirement that every time tags are generated like <code>img</code> tag I need to change it's attribute. </p> <p>Sample Code:</p> <pre><code>&lt;script&gt; $("img").attr({ src: "/images/hat.gif", title: "jQuery", alt: "jQuery Logo" }); $("div").text($("img").attr("alt")); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,395,973
1,395,974
passing datat from one page to another using javascript
<p>function fillRoomList(){</p> <pre><code> var val; var room=&lt;?php echo $room_number; ?&gt;; var from=&lt;?php echo $from_date; ?&gt;; var to=&lt;?php echo $to_date; ?&gt;; var combo = document.getElementById("bldgList"); if(combo.selectedIndex &gt;= 0){ val = combo.options[combo.selectedIndex].value; } $.ajax({ type: 'POST', url: 'http://localhost/Project/GetBuildingData1.php', **data: "id="+3+ " &amp;bldg_number="+val+"&amp;room_number="+room+ "&amp;from_date="+from+ "&amp;to_date="+$to,** async: false, success:function(resp) { $("#roomList").html(resp); } }); </code></pre> <p>//<strong>data: "id="+3+ " &amp;bldg_number="+val+"&amp;room_number="+room+ "&amp;from_date="+from+ //"&amp;to_date="+$to,</strong> in above two line i am passing some variables but i don't know whats mistake in it i am not getting the desired output,may be i am doing some mistake in above two lines.I have noticed that when i change my above two line to <strong>//**data: "id="+3+ " &amp;bldg_number="+val</strong> it runs successfully but i also require some other variables that are receiving on getBuildingData1.php </p>
php javascript
[2, 3]
4,839,870
4,839,871
How to get inner HTML of element inside a list item, within a delegate?
<p>I have this bit of HTML :</p> <pre><code>&lt;li eventId="123"&gt; &lt;img src="image.jpeg"/&gt; &lt;h3 id="eventName"&gt;Event Name&lt;/h3&gt; &lt;p id="eventDescription"&gt;&lt;/p&gt; &lt;/li&gt; </code></pre> <p>I want to be able to pull out the <code>&lt;h3&gt;</code> and <code>&lt;p&gt;</code> via jQuery so that I can update their values.</p> <p>I have a delegate bound to the list items, and on click I'm trying to grab hold of <code>&lt;h3&gt;</code> and <code>&lt;p&gt;</code> using :</p> <pre><code>function eventIdClicked() { // This gets hold of "123" OK theEvent.id = $(this).get(0).getAttribute('eventId'); // How to get the other 2 inner html? var existingEventName = $(this).get(1).getAttribute('eventName'); var existingEventDesc = $(this).get(2).getAttribute('eventDescription'); $.mobile.changePage("home.html"); } </code></pre> <p>Am I able to do this?</p>
javascript jquery
[3, 5]
920,167
920,168
Java add and set functions
<p>I'm a python programmer, but currently I'm reading through Java code to get some ideas. I have no programming experience at all with Java and I don't know how it's possible, but I couldn't get any information using Google about these functions.</p> <pre><code>if(pv.size() -2 &lt; j) pv.add(j+1, localpv.get(j)); else pv.set(j+1, localpv.get(j)); </code></pre> <p>This is the piece of code I need to decypher. <code>pv</code> and <code>localpv</code> are both vectors (I believe they are equivalent to lists in python?), and something is added to them. I can guess that one of them is adding them to a vector at a certain position (<code>j+1</code>), but then I have no idea what the other one does.</p> <p>Can you please explain those two lines for me and maybe telling what are they equivalent to in python?</p>
java python
[1, 7]
3,774,822
3,774,823
Any PHP -> jQuery libraries out there?
<p>Have any bridge libraries been developed for PHP that provide access to the jQuery framework? Ideally it would be nice to have something fairly extensible so that creating jQuery-based content using PHP code would be fairly easy and customizeable. Does such a thing exist yet?</p>
php javascript jquery
[2, 3, 5]
210,824
210,825
Loading an image buried within several divs when the parent div is shown by a .show jQuery command
<p>I have a jQuery script running on an ASP site that shows hidden DIVs when the id of a select form matches the div's ID:</p> <pre><code>$(document).ready(function(){ $('select[name$="_77"]').change(function() { $(".select_77").hide(); $(".select_77[id='" + this.value + "']").show(); }) }) </code></pre> <p>The form truncated to only one option for this example:</p> <pre><code>&lt;select name="option____jdfhj387___77"&gt; &lt;option value="1922"&gt;Raisins&lt;/option&gt; &lt;/select&gt; </code></pre> <p>And this is one of the many divs that gets unhidden:</p> <pre><code>&lt;div id="select_image"&gt; &lt;div class="select_77" id="1922" style="display:none;"&gt; &lt;div class="border"&gt; &lt;div class="content"&gt; &lt;img src="photos/option/1922.jpg"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The photos are medium sized, and it takes roughly 20-30 seconds for the page to load when I have 200+ of these images. Is there anyway to have the image load only when the parent div becomes visible, without having to manually put in every image url inside the script?</p>
javascript jquery
[3, 5]
792,837
792,838
jQuery scroll fails for iframe (firefox)
<p>I cannot get scroll to work, here is the complete stuff: <a href="http://zed.mit.edu/scroll2/buc.php" rel="nofollow">http://zed.mit.edu/scroll2/buc.php</a></p> <p>I'm trying to refresh the page while maintaining the scroll position of the iframe inside.</p> <p>I'd like to have an alert when I actively scroll the iframe, these two both fail:</p> <pre><code>$(top).frames['#iframe_bucinid'].scroll(function() .... $('#iframe_bucinid').scroll(function() ... </code></pre> <p>The page's iframe is defined as:</p> <pre><code>&lt;iframe class="inframe" src="bucin.php" name="bucin" id="iframe_bucinid"&gt; </code></pre> <p>Notice that getting the scrollTop works with </p> <pre><code>top.frames['bucin'].document.body.scrollTop </code></pre>
javascript jquery
[3, 5]
5,840,799
5,840,800
Difference between these two things
<p>I have a doubt regarding this writing this below statement </p> <ol> <li><p><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"/&gt;</code></p></li> <li><p><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"/&gt;</code></p></li> </ol> <p>Here i didn't mentioned the type in the Second Statement.But still am getting the jquery or $ symbol.Cud any explain me ?</p> <p>Here i am using VS 2010.</p>
asp.net jquery
[9, 5]
137,824
137,825
Problems running a Java program from within PHP
<p>I'm writing a PHP script that basically calls a Java program with a string, has Java create a file whose name is that string, and returning that file. Also, it's all midi.</p> <pre><code>$output_file = mt_rand(10000000,99999999) . ".mid"; system("java MCS " . $_FILES["file"]["tmp_name"] . " " . $output_file . " " . escapeshellarg($_POST['message'])); header('Content-type: audio/midi'); header('Content-Disposition: attachment; filename="output.mid"'); readfile($output_file); unlink($output_file); </code></pre> <p>Only problem is I get this problem: Error occurred during initialization of VM java.lang.Error: Properties init: Could not determine current working directory. </p> <p>I have tried using <code>exec</code>. The script completes but the java program doesn't run.</p>
java php
[1, 2]
3,578,136
3,578,137
jQuery Drag and Drop List WITHOUT reordering
<p>I am trying to find or create a javascript based drag and drop list interaction unlike the standard reordering case. In my situation, I need to have it such that dragging a row with data onto another row with data will swap the two, and dragging a row with data onto an empty row will move it to the drop target.</p> <p>Essentially, I have a list of "slots" and I am moving items around in these slots. Reordering like what jquery-ui sortable provides is definitely NOT desired here.</p> <p>I'm thinking I'll have to build something using jquery-ui droppable, but I'm surprised that no one else has created such a component. Am I missing something?</p>
javascript jquery
[3, 5]
341,507
341,508
Having <?php tags inside a js .html() method?
<p>If we have: </p> <pre><code>html('&lt;a href="blabla.org"&gt;go here&lt;/a&gt;') </code></pre> <p>Can we have <code>&lt;?php</code> tags inside inside href on this case, or it's a bad practice? </p> <p>Thanks. MEM</p>
php javascript
[2, 3]
1,789,641
1,789,642
want to show "Loading" text using javascript?
<p>I am using <code>SmtpClient</code>'s <code>Send</code> method in ASP.NET to send email from a contact-us page. While the message is being sent, I want to show a loading image. More specifically, when a user presses the send button to send the email, the loading image will appear, and once the message is sent, the loading image will disappear. I know I can use <code>onclick</code> method to display the loading image. But how can I remove this image once the message is sent? </p>
javascript asp.net
[3, 9]
2,595,113
2,595,114
How to created auto naming concept
<p>Thanks for previous replies,</p> <p>How to compare String with ListArray, and whenever the string match the array list it automatically includes any integer value and this integer value should incremented whenever the search will begins. is this possible to do. </p>
java android
[1, 4]
5,589,358
5,589,359
Asp.Net : Could not load the assembly 'App_Web_default.aspx.cdcab7d2'. Make sure that it is compiled before accessing the page
<p>I am Getting this error when i am uploading it over the web server.</p> <pre><code> Could not load the assembly 'App_Web_default.aspx.cdcab7d2'. Make sure that it is compiled before accessing the page. </code></pre> <p>how could i remove that error???? Thanks......</p>
c# asp.net
[0, 9]
932,143
932,144
Value does not fall in expected range
<p>When creating simple control I am getting this error, I have no clue why this is occurring.</p> <p><img src="http://i.stack.imgur.com/98Mum.png" alt="enter image description here"></p> <p>For any control it is giving same error.Please help me out from this.</p> <p>Here is the code : </p> <pre><code>&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt; </code></pre> <p>Thanks Aman</p>
c# asp.net
[0, 9]
3,651,495
3,651,496
How can I store the int ID of a drawable in an XML TypedArray
<p>My goal is to store all the int IDs of certain drawables in a TypedArray, so that I can access the IDs in sequential order. For instance:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;array name="bitmap_ids"&gt; &lt;item&gt;@drawable/icon1&lt;/item&gt; &lt;item&gt;@drawable/icon2&lt;/item&gt; &lt;item&gt;@drawable/icon3&lt;/item&gt; &lt;item&gt;@drawable/icon4&lt;/item&gt; &lt;item&gt;@drawable/icon5&lt;/item&gt; &lt;/array&gt; &lt;/resources&gt; </code></pre> <p>This does not yield the int result that I am looking for so that I can later do something such as:</p> <pre><code>TypedArray typedArray = mResources.obtainTypedArray(R.array.bitmapIds); int[][] t = new int[width][height]; int index = 0; for (int i = 0; i &lt; width; i++) for (int j = 0; j &lt; height; j++) { t[i][j] = typedArray.getInt(index, -1); index++; } </code></pre> <p>and even later:</p> <pre><code>return BitmapFactory.decodeResource(mResources, t[x][y]); </code></pre> <p>which would be equivalent to:</p> <pre><code>return BitmapFactory.decodeResource(mResources, R.drawable.icon1); </code></pre> <p>Any hint or insight would be greatly appreciated. Thanks in advance.</p>
java android
[1, 4]
5,736,484
5,736,485
Refresh js and css every session
<p>i want that a user make the login, the js and css are force to refresh themself</p> <p>How can i do?</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,495,139
1,495,140
fire css change before end of code
<p>I'm sure this question has already been asked, but I can't found the good keyword to feed google with. I can't even find a good title for my question. I want to do this :</p> <pre><code>$(".selector").click(function() { $(this).css("background-color", "red"); if (confirm("Do you want to do this ?") { // do this } else { $(this).css("background-color", "transparent"); } }); </code></pre> <p>But the css change is fired only after I confirm. How can I fire it before the confirm (or during the confirm) ?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,473,767
3,473,768
what's the best way to add a class to the div with a class of post every 4 seconds using jquery?
<p>what's the best way to add a class to the div with a class of post every 4 seconds using jquery?</p> <pre><code>&lt;div class="34 post"&gt; &lt;img width="311" height="417" src="#" class="#" alt="newspapers" /&gt; &lt;h2&gt;&lt;a href="#"&gt;Headline News Part 2&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;testing new content&lt;/p&gt; &lt;/div&gt; &lt;div class="9 post"&gt; &lt;img width="311" height="417" src="#" class="#" alt="newspapers" /&gt; &lt;h2&gt;&lt;a href="#"&gt;Headline News Part 2&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;testing new content&lt;/p&gt; &lt;/div&gt; &lt;div class="6 post"&gt; &lt;img width="311" height="417" src="#" class="#" alt="newspapers" /&gt; &lt;h2&gt;&lt;a href="#"&gt;Headline News Part 2&lt;/a&gt;&lt;/h2&gt; &lt;p&gt;testing new content&lt;/p&gt; &lt;/div&gt; </code></pre> <p>so i want the first to have a class of "display" then after 4 seconds, i want to remove the class on that one and add it to the second one. and then after 4 more seconds, remove it from the second and add it to the third. when it gets to the end it loops back around.</p>
javascript jquery
[3, 5]
1,544,587
1,544,588
This difference
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1051782/jquery-this-vs-this">jQuery $(this) vs this</a> </p> </blockquote> <p>This code in this <a href="http://jqueryfordesigners.com/jquery-look-tim-van-damme/" rel="nofollow">video Tutorial</a></p> <p>in a Very useful blog <a href="http://jqueryfordesigners.com/" rel="nofollow">jquery for designers</a></p> <pre><code>$('.navigation').each(function () { var $links = $('a',this); $links.click(function () { var $link = $(this), link = this; if ($link.is('.selected')) { return; } $links.removeClass('selected'); $link.addClass('selected') }); }); </code></pre> <p>What is the difference between <code>$(this)</code> and <code>this</code>?</p> <p>Please explain the simple difference in coding.</p>
javascript jquery
[3, 5]
271,465
271,466
Execute an event when everything is clicked except one element?
<pre><code>'&lt;div class="lightbox-con"&gt; &lt;div class="lightbox-shade"&gt;&lt;/div&gt; &lt;span class="logo"&gt;&lt;/span&gt; &lt;div class="controls"&gt; &lt;span class="arrow back"&gt;&lt;/span&gt;&lt;span class="close"&gt;&lt;/span&gt;&lt;span class="arrow forward"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="caption"&gt; &lt;p class="caption-text"&gt;&lt;/p&gt; &lt;span class="logo2" &gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt;' </code></pre> <p>The markup above is a lightbox. Given it's already in an overly state, how do I close/remove it when everything is clicked except the <code>.arrow</code> elements? I tried so many ways and one of them is this:</p> <pre><code>$(':not(.arrow)').click(function(){ $('.lightbox-con').remove(); }); </code></pre> <p>The code above won't even allow the lightbox to launch :-\</p>
javascript jquery
[3, 5]
1,630,210
1,630,211
How to find the position of the certain element inside a div?
<p>I am trying to find the image position inside my div</p> <p>my Html</p> <pre><code>&lt;div&gt; &lt;p&gt;test&lt;/p&gt; &lt;img src='test1.jpg'/&gt; &lt;p&gt;test&lt;/p&gt; &lt;p&gt;test&lt;/p&gt; &lt;img src='test2.jpg'/&gt; &lt;p&gt;test&lt;/p&gt; &lt;img src='test2.jpg'/&gt; --the user clicks this image and I want to know the time it appears. In this case, 2 is what I need. &lt;p&gt;test&lt;/p&gt; &lt;img src='test2.jpg'/&gt; &lt;p&gt;test&lt;/p&gt; &lt;/div&gt; </code></pre> <p>I have</p> <pre><code>var imagePosition=0; $('img').click(function(){ var imgSource=$(this).attr('src'); $(this).closest('div').find('img').each(function(){ if($(this).attr('src')==imgSource){ imagePosition++; } }) }) </code></pre> <p>I can find out how many time the same images appear but I can't tell which image the user clicks and it's position. Are there anyways to do this? Thanks so much!</p>
javascript jquery
[3, 5]
273,343
273,344
Check if css class is contained in div
<p>For this div: </p> <pre><code>&lt;div class="table room"&gt; &lt;/div&gt; </code></pre> <p>Is it possible to use the <code>attr</code> parameter to check if the div contains the CSS class "room"?</p>
javascript jquery
[3, 5]
2,254,742
2,254,743
Jquery get the key/value - key from asp drop down
<p>I have the following in my code:</p> <pre><code> &lt;asp:DropDownList id="City" runat="server"&gt; </code></pre> <p>I tried using the following to get the key from the key value but it shows up as undefined although I selected from the dropdown</p> <pre><code> var city = $("#city option:selected").val(); alert(city); </code></pre>
jquery asp.net
[5, 9]
5,337,895
5,337,896
How to get a number from the Call log and use it to save to an Object - Android
<p>From the android device i do need to select a number from the CAll Log and use it to set in my own object . I am looking at CallLog.Calls but only outgoing is provided?</p>
java android
[1, 4]
2,305,539
2,305,540
NoSuchMethod error for ImageView.setColorFilter
<p>So I have a ListView that color codes an icon based on the priority of each item in the list. For example, priority 1 workorders have a red workorder icon. Priority 2 = yellow, etc.</p> <p>I use ImageView.setColorFilter(Color.whatever) to change the color of the icon and it works great on my Samsung Galaxy Tab and HTC Hero, however when I load the app onto an HTC Droid Eris, I get an error:</p> <pre><code>java.lang.NoSuchMethodError:android.widget.ImageView.setColorFilter </code></pre> <p>I have no idea why it works fine on everything else, but not this phone. Any ideas? I'm thinking perhaps it might be due to the Eris having Android 2.1 whereas the rest are 2.2 or higher. But I wouldn't think such a basic method was not included before 2.2!</p> <p>Any and all help is greatly appreciated! This community always helps when I'm stumped and Google won't spit back any relevant results! Thanks in advance!</p>
java android
[1, 4]
4,536,441
4,536,442
Help in Converting Small Python Code to PHP
<p>please i need some help in converting a python code to a php syntax the code is for generating an alphanumeric code using alpha encoding</p> <p>the code : </p> <pre><code>def mkcpl(x): x = ord(x) set="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" for c in set: d = ord(c)^x if chr(d) in set: return 0,c,chr(d) if chr(0xff^d) in set: return 1,c,chr(0xff^d) raise Exception,"No encoding found for %#02x"%x def mkalphadecryptloader(shcode): s="hAAAAX5AAAAHPPPPPPPPa" shcode=list(shcode) shcode.reverse() shcode = "".join(shcode) shcode += "\x90"*((-len(shcode))%4) for b in range(len(shcode)/4): T,C,D = 0,"","" for i in range(4): t,c,d = mkcpl(shcode[4*b+i]) T += t &lt;&lt; i C = c+C D = d+D s += "h%sX5%sP" % (C,D) if T &gt; 0: s += "TY" T = (2*T^T)%16 for i in range(4): if T &amp; 1: s += "19" T &gt;&gt;= 1 if T == 0: break s += "I" return s+"\xff\xe4" </code></pre> <p>any help would be really appreciated ... </p>
php python
[2, 7]
3,661,177
3,661,178
jQuery :cant use split function
<p>I am using jQuery autocomplete pluggin .</p> <p>I have the following code</p> <pre><code>$().ready(function() { function findValueCallback(event, data, formatted) { $("&lt;li&gt;").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result"); } </code></pre> <p>});</p> <p>I am trying to split the value coming in data.When i alert it,It is showing properly.But i cant use a split method to extract some data from it .(the data is "ASP.ASPItems.23" , I want to take that 23 from it</p> <p>When i use split,I am getting an error like "split is undefined"</p> <p>My split code</p> <pre><code>var subjectId=data.split(".")[2] </code></pre> <p>CAn any one advice how to go ahead</p>
javascript jquery
[3, 5]
1,577,195
1,577,196
Load function is not working after satisfying if condition in jQuery
<p>In the code below, the if condition is working as I have checked with an alert but load function is not working.</p> <p>My code:</p> <pre><code>$("a").click(function() { hreff = $(this).attr('href'); if(hreff == "something" ) { $("#dump").load("someurl"); } }); </code></pre>
javascript jquery
[3, 5]
4,403,793
4,403,794
Multiple Ajax loading indicators on 1 page
<p>I have a page with 2 separate forms that can be submitted via Ajax (jQuery). For each of these forms I'd like to show a loading indicator to the user. I have found a nice piece of code that can easily show these icons, but it only works when there's 1 form.</p> <pre><code>$('.ajaxloader').hide().ajaxStart(function () { $(this).show(); }).ajaxStop(function () { $(this).hide(); }); </code></pre> <p>ajaxloader is a class which shows the loading image as a CSS background image. To use it, I just need to add something like: <code>&lt;span class="ajaxLoader"&gt;Busy ...&lt;/span&gt;</code></p> <p>When I test this with my page (that has 2 forms), and I submit one of the two, then both loading indicators appear (which is quite obvious). Now my question is, how can I show the indicator that needs to be shown? I was thinking about giving the span-tag an id attribute, but then I don't know how to proceed. I want this to be as generic as possible, so I don't have to hardcode and duplicate code a lot.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,200,638
3,200,639
jquery how to check if browser tab/window the selected is on our page?
<p>How do check if a the user has the browser's tab/window currently on our page</p> <pre><code>function userisonourpage() { //do something } </code></pre> <p>And when a user switches the tab/window to our page ?</p> <pre><code>function tabswitched() { //dom something here too } </code></pre> <p>Just like in many places u switch to the page and the title changes i know the title can be changed with : <code>document.title</code> but dont know how to implement those functions.</p> <p>Thanks :D</p>
javascript jquery
[3, 5]
5,252,793
5,252,794
How to convert Binary data from database to String(text)
<p>I have uploaded my MS word file in Database in binary format. I am able to retrive it back. But I am planning to open up the word file in read only mode. I have done much operations on the file which I have stored in databse like trackrevisions,protection etc. Now I just want only one thing to happen. I want to convert the binary data efficiently back to text(string) which was origianlly stored in the database. Here are some ways I am trying to get text back from binary but all of them return symbols(format not supported) rather than text.</p> <pre><code>string str1 = System.Text.ASCIIEncoding.ASCII.GetString(bytes); string x = Encoding.ASCII.GetString(bytes).ToLower(); </code></pre> <p>Any suggestions</p>
c# asp.net
[0, 9]
5,153,281
5,153,282
How to obtain the current time differences between two timezones
<p>I want to calculate the current time differences between US/Central timezone and British Summer Time. I mean, currently these both timezones have daylight savings going on, so they have a 6 hours time difference. But after Sunday October 31 2010, daylight savings will be off for British summer time, at which moment there will be a 5 hours time differences between these two timezones. </p> <p>Is there any way I can calculate these varying time differences?</p>
c# asp.net
[0, 9]
459,101
459,102
How do I make a jquery modal always centered on the page?
<p>I've see than this is the problem with most jquery modal popup boxes. So i'm wondering, is there any jquery code that will keep the jquery modal always centered in the page? I know this can be achieved with pure javascript code but what about jquery? </p>
javascript jquery
[3, 5]
3,468,263
3,468,264
Jquery getting list of values of hidden inputs within a div
<p>I am trying to get a list of values within a div that I will format later using the .each() method. They are input values which are hidden my html and jquery call looks like this.</p> <pre><code>&lt;div id="container_0"&gt; &lt;input type="hidden" id="check_data" value=10&gt; &lt;input type="hidden" id="check_data" value=20&gt; &lt;/div&gt; </code></pre> <p>Jquery: </p> <pre><code>var list = $('#container_0 input#check_data'); $(list).each( function() { alert($(this).val()); } ); </code></pre> <p>This however is not returning any values. Any help would be greatly appreciated.</p>
javascript jquery
[3, 5]
5,554,174
5,554,175
A single Validation across whole application
<p>I have an appliaction in which there are multiple text fields in one jsp , and there are many jsp which contain such text fields. Right now , i have the validation function which is called for every text box. Now i want to have a single validation (say allowing only ascii characters) across every text box by calling it once. Will it be possible for me to call it once at application level or once on every jsp page(on the submit button) when the whole page gets submitted .</p>
java javascript
[1, 3]
4,298,787
4,298,788
Reduce jQuery functions
<p>Is there a way to reduce jQuery to functions that I need.</p> <p>In this case, I only want to use getJSON with the callback function. I don't need anything else of jQuery. Is there any way to cut this out?</p> <p>Thanks, Mike</p>
javascript jquery
[3, 5]
352,758
352,759
Why can't I send data from c# to Javascript file in asp.net?
<p>I have a list of a class created in c# that I have to send its values to a javascript file. I have created a string in c# and put the values of the list in it:</p> <pre><code>count = 0; JString = "["; for(i=0; i&lt;x; i++) { JString += "{Source:" + A[i] + ", Number:" + 3 + ", Target:" + B[i] + "},"; count++; } JString = JString.Remove(JString.Length - 1, 1); //to remove the last , JString += "]"; GraphData.Text = "" + "var JString =" + JString + " ;" + "var count =" + count + " ;"; </code></pre> <p>GraphData is a label to save the string.</p> <p>In the JavaScript file, I added:</p> <pre><code> $("#GraphData").val(); //to get the string sent </code></pre> <p>But it's not working this way. Am I doing something wrong? </p> <p>Thanks in advance:)</p>
c# javascript asp.net
[0, 3, 9]
5,307,863
5,307,864
The click event does not seem to work with a select element in IE
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2895608/click-trigger-on-select-box-doesnt-work-in-jquery">Click trigger on select box doesn&#39;t work in jQuery </a> </p> </blockquote> <p>I am trying to do the following to simulate a click on a select element:</p> <pre><code>setTimeout(function () { $('#' + id).trigger('click'); }, 1000); </code></pre> <p>This works in Firefox but not IE. Is there some possible work around for IE?</p>
javascript jquery
[3, 5]
2,223,379
2,223,380
How do I run a function only when a div gets loaded?
<p>I want to run a function only when a div gets loaded.</p> <p>When I load the page, a number of files are loaded. At the end of the list, PHP echoes a div. When this one is displayed, jQuery should run a function.</p> <p>I can do this with a click-event, but I want it to work automatically, without pushing a button.</p> <p>This is how it works with a click:</p> <pre><code>$("#PP_end_show").live("click",function(){ $("#PP_head_bar").slideToggle("slow"); $("#PP_info_file_wrap").slideUp("slow"); }); </code></pre> <p>This is the <code>div</code> echoed by PHP:</p> <pre><code> &lt;?php echo "&lt;div id=\"PP_end_show\"&gt;&lt;/div&gt;"; ?&gt; </code></pre> <p>The output is generated after an AJAX call:</p> <pre><code>&lt;form id="PP_search_input" method="post" name="search_ID" ONSubmit="xmlhttpPost('PP_search_stream_client.php', 'PP_search_input', 'PP_thumb_output', '&lt;img src=\'images/wait.gif\'&gt;');return false; "&gt; &lt;input name="search_string" type="text" class="PP_input" id="search_string" value="&lt;?php echo $_POST['search_string']; ?&gt;"/&gt; &lt;button type="submit" class="PP_submit" id="search_submit"&gt; search &lt;/button&gt; </code></pre> <p>at the end of the generated output the specific div will be printed and should trigger the new jQuery function.</p>
php javascript jquery
[2, 3, 5]
2,592,936
2,592,937
Decimal digit problem
<p>On Asp.Net, in my textbox, i do not want to enter after zero three numbers. For example if you enter textbox 0.222 it should be 0.22. After 0.22 you should not enter anything. How can i make this?</p> <p>Thanks</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
5,545,955
5,545,956
$(this) in plugin options
<p>I'm new to writing jQuery plugins, and I'm confused as to how to let users use $(this) in their options. As a simple (and redundant) example, say I wanted to let a user append their selection's text to an element they supply in their options, like so:</p> <pre><code>$(function() { $('#stuff').appender({ 'placement' : this }); }); </code></pre> <p>And the plugin code is:</p> <pre><code>(function($) { $.fn.appender = function(options) { var opts = $.extend({}, $.fn.appender.defaults, options); return this.each( function() { var $el = $(this); $(opts.placement).append( $el.text() ); }); }; $.fn.appender.defaults = { 'placement' : 'body', } })(jQuery); </code></pre> <p>If the user supplies 'body' or $('#wrapper') for 'placement' in the plugin options, of course it works as expected. But when using 'this' or '$(this)', it refers to the document itself rather than the element in the selection.</p> <p>This is a pretty crappy example of a plugin, but the thing I would like to learn is how to allow plugin users to use $(this) or its attributes as values for options.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
4,277,477
4,277,478
Callback failing if contains ajax
<p>I'm trying to add a callback to a pre existing function in the jquery plugin nitelite <a href="https://github.com/premasagar/nitelite" rel="nofollow">https://github.com/premasagar/nitelite</a> - The callback works fine <a href="http://jsfiddle.net/HPc4e/2/" rel="nofollow">http://jsfiddle.net/HPc4e/2/</a> - unless I have ajax in the callback?</p> <p>Appropriate section of close function:</p> <pre><code>// Blah blah ... else { showFlash(); this.overlay.remove(); this.container .empty() .remove(); $(this).triggerHandler('close'); // Add callback if (typeof callback == "function") { callback(); } } return this; </code></pre> <p>Callback:</p> <pre><code>lb.close(undefined, 'click', function() { $.ajax({ type: 'POST', url: url, data: {submit: $(this).val()}, dataType: 'json', success: function(data) { lightbox('Lightbox 2', '&lt;p&gt;Oh hi&lt;/p&gt;', 'lightbox2'); } }); }); </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
5,998,772
5,998,773
Using the EventArgs
<p>what is the java equivalent method "getSource()" in C# language</p> <pre><code>public void actionPerformed(ActionEvent e) { if(e.getSource().equals(button1)){ //some code here } } </code></pre>
c# java
[0, 1]
2,724,772
2,724,773
Post jQuery dialog values to server in ASP.NET
<p>I'm new to jQuery. I've got a dialog with several input boxes in it. I want the user to be able to hit a button and have the values posted back to the server - idealy to be picked up in a server event. What are the ways to achieve this?</p> <p>Many thanks.</p>
asp.net jquery
[9, 5]
2,418,687
2,418,688
word processor in c# or c++
<p>I learned C Sharp for one purpose, to write a word processor that includes my needs. For example that you could play with the spaces between words, and the spaces between the lines, raise one word higher from the row, and many other similar things. When I start working on it in c# - winForms I see the possibilities are very limited, Indeed there are ways to do almost everything With effort, but my question is if I on the right way, maybe c# is not the language to it, maybe I should work with c++. What do you think?</p>
c# c++
[0, 6]
1,590,370
1,590,371
How to implement Windows service kind of infrastructure in ASP.NET
<p>I have limitations to host Windows Services in my web hosting provider. But i need run small task frequently.</p> <p>Do we have any other framework/api which provides similar infrastructure like "Windows Services" from ASP.NET?</p>
c# asp.net
[0, 9]
305,428
305,429
Learning how to program real things
<p>How would you guys recommend I actually learn to program real things?</p> <p>I mean, I know how to do basic academic things. I can implement a templated stack/queue/map/etc. data structure in C++ or Java or whatever. I can make a text-based hangman game or whatever. Etc etc.</p> <p>But how can I learn to program something real, something useful? I've done project Euler up to question 100 or so, and I feel like that's given me more mathematical maturity but not programming maturity. Should I buy a book and follow exercises, struggle through interesting projects, etc.?</p> <p>In short, how did you guys transition from academic exercises to real, fun and/or useful programs?</p>
java c++
[1, 6]
5,407,738
5,407,739
jquery increase by 1
<p>Afternoon,</p> <p>I would like to increase the number in this code by 1 for each question displayed.</p> <pre><code> new_question = "&lt;div id=\"" + res.qId + "\"&gt;" + "&lt;h1&gt;Question 1&lt;/h1&gt;" + "&lt;p&gt;&lt;i&gt;" + res.question + "&lt;/i&gt;&lt;/p&gt;" + "&lt;div class=\"answer-grid\"&gt;" + "&lt;div id=\"a1\" class=\"answer\"&gt;" + "&lt;p&gt;" + res.answer1 + "&lt;/p&gt;" + "&lt;p&gt;" + res.answer2 + "&lt;/p&gt;" + "&lt;p&gt;" + res.answer3 + "&lt;/p&gt;" + "&lt;/div&gt;" + "&lt;/div&gt;"; </code></pre> <p>With this it would show, question 1, question 2, and so on...</p> <p>How would i go about doing this in jQuery please?</p> <p><em><strong>Update</em></strong> Victor provided what i needed, thanks all for your help. Updated code below.</p> <pre><code> var questionNumber = 1; $.each(result, function (index, res) { new_question = "&lt;div id=\"" + res.qId + "\"&gt;" + "&lt;h1&gt;Question " + (questionNumber++) + "&lt;/h1&gt;" + "&lt;p&gt;&lt;i&gt;" + res.question + "&lt;/i&gt;&lt;/p&gt;" + "&lt;div class=\"answer-grid\"&gt;" + "&lt;div id=\"a1\" class=\"answer\"&gt;" + "&lt;p&gt;" + res.answer1 + "&lt;/p&gt;" + "&lt;p&gt;" + res.answer2 + "&lt;/p&gt;" + "&lt;p&gt;" + res.answer3 + "&lt;/p&gt;" + "&lt;/div&gt;" + "&lt;/div&gt;"; $('#pinfos').append(new_question); </code></pre>
javascript jquery
[3, 5]
1,921,953
1,921,954
Use jquery to keep adding numbers to a variable on click
<p>I'd like to know how to keep adding number to a varible. For instance the number starts at 0 then every time you click the button it adds 20. So the first click would change the variable to 20 then the next click 40. This is as far as I can get..</p> <pre><code>var n = 0; $('#button).live('click', function() { newval = n+20; $('.number').append($('&lt;p/&gt;', {text: newval})); }); </code></pre>
javascript jquery
[3, 5]
4,384,313
4,384,314
Retrieving iframe contents after a form submitted to it
<p>I have a form with an iframe as its target, and I want to retrieve its contents after the form has been submitted.</p> <p>The problem is if I do something like: </p> <pre><code>$('form').submit(function (e) { e.preventDefault(); var content = $('iframe').contents(); }); </code></pre> <p>I get nothing because the form only submits after this. Is there any event that I can use AFTER the iframe received its content?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
5,503,206
5,503,207
jquery display image
<p>I'm trying to learn jquery. So, first I thought of validating a textbox and check if its length is less than 4 display a stop image adjacent to it.Otherwise, if it is greater than 4 display tick image. SO, i did this</p> <pre><code> $(document).ready(function () { $('#' + '&lt;%= tbstreet1.ClientID %&gt;').keyup(isValid); function isValid() { var street1Length = $('#' + '&lt;%= tbstreet1.ClientID %&gt;').val().length; if (street1Length &gt; 4) { ShowStop(check); } }; function ShowStop(isCheck) { if ($('#' + '&lt;%= tbstreet1.ClientID %&gt;').blur()) { if (isCheck == true) { $('#' + '&lt;%= status.ClientID %&gt;').html('&lt;img align="absmiddle" src="~/tick.gif" /&gt; '); } else $('#' + '&lt;%= status.ClientID %&gt;').html('&lt;img align="absmiddle" src="~/stop.gif" /&gt; '); } }; function ActivateSave() { $("#MainContent_btn_save").removeAttr("disabled"); $("#MainContent_btn_save").attr("enabled", ""); }; }); </code></pre> <p>This is my aspx code</p> <pre><code> &lt;asp:Label runat="server" ID="street1" Text="Street1" &gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID="tbstreet1" runat="server" &gt;&lt;/asp:TextBox&gt; &lt;div id="status" runat="server"&gt;&lt;/div&gt; </code></pre> <p>However, when i run it i dont get the image. Can u please let me know the mistake i've been doing?</p>
jquery asp.net
[5, 9]
4,467,527
4,467,528
Response.AddHeader attachment doesn't work
<p>here's the code I have:</p> <pre><code> Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=file.xlsx"); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.BinaryWrite(pck.GetAsByteArray()); Response.End(); </code></pre> <p>The problem is that when this code is run (On button click) I do not a file for download in my browser (tried in Chrome \ IE).</p> <p>pck is an excel file (Generated with <a href="http://epplus.codeplex.com/" rel="nofollow">epplus</a> library). I don't even know how to debug this part of the code. it's doing nothing.</p> <p>Here's the error I'm getting in my browser:</p> <blockquote> <p>Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.</p> <p>Details: Error parsing near 'PKX��@ϖ�'.</p> </blockquote>
c# asp.net
[0, 9]
431,394
431,395
How to clip text in android canvas?
<p>I'm creating kids learning application in android. I created Imageview on which text is displayed and i applied canvas for Imageview so i can able to paint on whole canvas. Upto this working fine.</p> <p>Now my problem is i have to clip the text present in canvas imageview. I know to clip the region with shapes like Rect , Circle but dont know how to clip the text in android canvas... Also the clipped region must allows me to paint only the clipped region ( not the region other than text view in Imageview .)</p> <p>Help with some sample code is appreciated.</p>
java android
[1, 4]
4,638,017
4,638,018
Javascript this in jQuery
<p>I saw some old code that had:</p> <pre><code>&lt;input type="submit" name="submit" onsubmit="somefunction(this)" /&gt; </code></pre> <p>I was jQuery'ing the script, how do I get the pure javascript (this) object in jQuery?</p> <pre><code>$("input[name=submit]").click(function() { somefunction(// ?? is it $(this) ); }); </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
1,702,308
1,702,309
Who passed the "args" to the main method?
<p>I tried to run a small c# and java program (using VS and NetBeans not from the command line) and print the value of the args[0] but I got an <code>IndexOutOfRangeException</code>.<br/> I know that the <code>args</code> is for passing in command line parameters but it is <strong>still</strong> in the main method any way, So how the program will run if there is no <code>args</code> parameter passed to it ?</p>
c# java
[0, 1]
5,908,217
5,908,218
How to access a server side variable in the databound event of the formview
<pre><code> protected void dvUserMaster_DataBound(object sender,EventArgs e) { string CustCreatedBy = DataBinder.Eval(e.ToString(),"strcustomer_name").ToString(); string EmpCreatedBy = DataBinder.Eval(e.ToString(), "stremployee_name").ToString();} </code></pre> <p>strcustomer_name is the string which i want to evaluated to certain condition. How to access the value of the string from the cs file at the databound event of the formview</p> <p>Thanks,</p>
c# asp.net
[0, 9]
2,559,776
2,559,777
Will this code work? Javascript/asp.net (Code not working)
<pre><code> &lt;td class="style4"&gt; &lt;input type="text" ID="txtFirstName" runat="server" maxlength="50" class="DefaultTextbox" style="width:180px;" value="First Name" onfocus="if(this.value=='First Name') {this.value = '';document.getElementById('spanFirstName').visible=false;}" onblur="if(this.value=='') this.value = 'First Name'" /&gt; &lt;/td&gt; &lt;td&gt; &lt;span id="spanFirstName"&gt;Should be less than 50 characters.&lt;/span&gt; &lt;/td&gt; </code></pre> <p>I want to do something like this</p> <pre><code>onfocus = "if(this.value=='First Name') { this.value = ''; document.getElementById('spanFirstName').visible=false; }" onblur = "if(this.value=='') this.value = 'First Name'" </code></pre>
asp.net javascript
[9, 3]
5,888,996
5,888,997
jQuery .index() in javascript
<p>As per the jQuery api, the complementary operation to .get(), which accepts an index and returns a DOM node, <code>.index()</code> can take a DOM node and returns an index. Suppose we have a simple unordered list on the page:</p> <pre><code>&lt;ul&gt; &lt;li id="foo"&gt;foo&lt;/li&gt; &lt;li id="bar"&gt;bar&lt;/li&gt; &lt;li id="baz"&gt;baz&lt;/li&gt; &lt;/ul&gt; </code></pre> <p><code>.index()</code> will return the position of the first element within the set of matched elements in relation to its siblings:</p> <pre><code>alert('Index: ' + $('#bar').index(); </code></pre> <p>We get back the zero-based position of the list item:</p> <pre><code>Index: 1 </code></pre> <p>I just want to know, how can we do the same using <strong>JavaScript</strong>?? </p>
javascript jquery
[3, 5]