Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,409,623
5,409,624
Arrays in Javascript
<p>I always had this silly doubt in mind but never had come up with the solution.</p> <p>I have seen several kind of arrays but I don't know the difference between them. I don't know how to explain exactly but it's most when passing parameters with jQuery.</p> <p>See:</p> <p><code>{ 'choices[]': ["Jon", "Susan"] }</code> in <code>$("#objectID").load("test.php", { 'choices[]': ["Jon", "Susan"] } );</code></p> <p>What's the {}? (does this mean it's an array?). Why is <code>choices[]</code> quoted? I have already seen unquoted ones, what's the difference? I presume that <code>choices</code> is the associative name and <code>["Jon", "Susan"]</code> is the value, is it right?</p>
javascript jquery
[3, 5]
4,031,074
4,031,075
Can I assign a value to a variable which Sticks to this variable in every scope?
<p>Can I assign a value to a variable (int) and never lose this value inside any scope ?<br/> the problem is I am assigning the value to the variable in some scopes but the variable returns to its default value (zero) in other scopes.. Example :</p> <pre><code> protected void Button_AddNewCourse_Click(object sender, EventArgs e) { ID = 10; } </code></pre> <p>so when I am trying to use <code>ID</code> in other functions it falls back to zero </p> <pre><code> protected void AnotherFunction(object sender, EventArgs e) { // Variable ID here is zero } </code></pre>
c# asp.net
[0, 9]
3,020,596
3,020,597
jQuery: Clone event(s) from one element to another
<p>Is it possible to clone event from one element, to another.</p> <p>For example: </p> <pre><code>$('.somelink').click({data:data},somefunc); </code></pre> <p>I need event in another place in document for element with different class.</p>
javascript jquery
[3, 5]
2,365,366
2,365,367
how can I add a progress bar with showing percentage level while uploading file in asp.net
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11714858/create-file-upload-progress-bar-asp-net-and-javascript">Create File Upload Progress Bar ASP.NET and JavaScript</a> </p> </blockquote> <p>I have to create an web application in asp.net with C#.net in that i have to display progress bar to show uploading status of file how should i can do this?</p>
c# asp.net
[0, 9]
5,301,024
5,301,025
Android App WIDGET - voice recognizer
<p>Is it possible to run an app widget in background with voice recognizer open?</p> <p>Thank you. Flinx</p>
java android
[1, 4]
2,928,758
2,928,759
Android Garbage Collection in Lunar Lander
<p>In the Lunar Lander example (Provided by Google's Android site), there is a main loop in a method called "run()". Here it is below:</p> <pre><code> @Override public void run() { while (mRun) { Canvas c = null; try { c = mSurfaceHolder.lockCanvas(null); synchronized (mSurfaceHolder) { if (mMode == STATE_RUNNING) updatePhysics(); doDraw(c); } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { mSurfaceHolder.unlockCanvasAndPost(c); } } } } </code></pre> <p>So now, my question is this: Isn't it bad to keep nulling c every loop and thereby causing more garbage collection? Maybe I don't understand this well enough, but why must it be nulled?</p>
java android
[1, 4]
248,626
248,627
ASP.NET and C# FileUpload
<p>I have a asp file upload for pictures and what I want to do is, when the file chosen has the same name as the previous file it should pop something up that says "This image name already exists, do you want to replace it? if yes then it would just override the current picture with the new one but if not then just leave it alone. How can I do this?. Right now I have this. Also if the solution is in javascript I could also use that (but i am not too good with javascript :) ) Thank you</p> <pre><code>&lt;div class="style"&gt; Choose an Image:&amp;nbsp;&lt;asp:FileUpload ID="getImage" runat="server" Width="150px" BorderStyle="Inset" EnableViewState="true" /&gt; &lt;asp:RegularExpressionValidator ID="RegularExpressionValidator" runat="server" ControlToValidate="getImage" CssClass="Error" Display="dynamic" ValidationExpression=".*(\.[Jj][Pp][Gg]|\.[Gg][Ii][Ff]|\.[Jj][Pp][Ee][Gg]|\.[Pp][Nn][Gg])" ErrorMessage="Select a correct file format"&gt;&lt;/asp:RegularExpressionValidator&gt; &lt;/div&gt; </code></pre> <p>Please be aware I am a total newbie with Javascript so if that is what's going to work please explain as if I was a 5 year old.</p> <p>I really appreciate the help.</p>
c# javascript asp.net
[0, 3, 9]
4,857,332
4,857,333
How can I put score code in my program?
<p>Can you help me with my program im making an android game word guessing game.. i want to have a score for every words the user will answer</p>
java android
[1, 4]
5,189,108
5,189,109
How to use the widget handle network components?
<p>Have a code to disable and enable Wi-Fi adapter:</p> <pre><code>String service = Context.WIFI_SERVICE; wifi = (WifiManager)getSystemService(service); public void Connected(){ if (!wifi.isWifiEnabled()){ if (wifi.getWifiState() != WifiManager.WIFI_STATE_ENABLING) wifi.setWifiEnabled(true); } </code></pre> <p>But how to implement it in a widget?</p>
java android
[1, 4]
5,130,252
5,130,253
Autocomplete jQuery & php problem
<p>i am trying to get a list of names from MySQL table useing php and jQuery autocomplete function but i get no result.could you help plz</p> <p>here is jQuery </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script language="javascript" type="text/javascript"&gt; function findmatch(str){ if (str.length&gt;0){ $('#found').load('SelectQury.php?n='+str); } }//fun &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;input type="text" name="text" id="textfield" autocomplete="off" onkeyup="findmatch(this.value);"/&gt; &lt;div id="found" &gt;non found&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>php code</p> <pre><code>if(isset($_POST['text'])){ $s=$_POST['text']; $query="SELECT FROM student WHERE name LIKE '$s%'"; $result=mysql_query($query) or die ('Wrong query : ' . mysql_error() ); $string=''; while($row = mysql_fetch_assoc($result)){ $string.= $row['name']; } echo $string; }else{ echo 'wrong GET keywoord'; }//ifisset </code></pre>
php jquery
[2, 5]
3,371,456
3,371,457
Sorting items in Select with remember what is selected
<p>I wanted to sorting items in select, but all solution what I finded have selecting last item in select. And it's problem if you edit existing data in forms.</p> <p>How solve this?</p> <p>Please don't ask me, why I didn't sorting items at server side.</p>
javascript jquery
[3, 5]
3,170,146
3,170,147
JQuery - how to find all elements matching given strings?
<p>I've stuck with my task.</p> <p>How to select all <code>&lt;span class="title"&gt;</code> elements on the page:</p> <pre><code>&lt;div class="my-page"&gt; &lt;span class="title"&gt;first&lt;/span&gt; &lt;span class="title"&gt;second&lt;/span&gt; &lt;span class="title"&gt;third&lt;/span&gt; &lt;span class="title"&gt;fourth&lt;/span&gt; &lt;span class="title"&gt;fifth&lt;/span&gt; &lt;/div&gt; </code></pre> <p>that are present on the list (fetched from servlet in JSON format) and stored inside some variable?</p> <p>I've tried sth like:</p> <pre><code>success : function(data, statusText, jqxhr) { var arr = data.selectedTitles; jQuery.each(data.favTools, function(i, v) { var title = v; jQuery('span.title:contains(title)').css("text-decoration", "underline"); }); } </code></pre> <p>Any suggestion would be greatly appreciated:)</p>
javascript jquery
[3, 5]
4,032,924
4,032,925
How to set up Python server side with javascript client side
<p>So there is already a Python program set up that runs on the console that I must build upon. I will be building a web GUI interface for the application using Javascript. How would I:</p> <p>a. Go about handling the input/output of this Python program without touching the original code.</p> <p>b. Go about sending console-line inputs to the Python program via Javascript calls. I've looked into raw HTTP requests/AJAX, but I'm not sure how exactly I would go about sending that as input to the Python program.</p>
javascript python
[3, 7]
4,322,453
4,322,454
Recommended way to format numbers in a locale aware way?
<p>Lets assume we have one million.</p> <p>In english it should be formatted as 1,000,000 in german it should be 1.000.000.</p> <p>Thanks</p>
java android
[1, 4]
1,815,255
1,815,256
javascript if else statement
<p>i'm trying to make images on my site a bigger size if you click on them. <br/>i want to undo the enlarged view if you click on the picture again.</p> <pre><code>$("img").click(function(){ var grown = 'false'; if (grown == 'true') { $(this).animate({width: 300, height: 200}, 1000 ); var grown = 'false'; console.log(grown); } else if (grown == 'false') { $(this).animate({width: 600, height: 400}, 1000 ); var grown = 'true'; console.log(grown); } }); </code></pre> <p>enlarging works, but the <code>grown</code> variable seems to always be stuck on <code>true</code>, so it won't ever shrink back. is my logic flawed? any help greatly appreciated!</p>
javascript jquery
[3, 5]
4,699,619
4,699,620
After omitting $ from input gettting NaN in javascript asp.net
<p>In javascript , I have given like this,( edited adding Pasman response )</p> <pre><code> var y= document.getElementById('&lt;%= DataItemValue4.ClientID%&gt;').firstChild.nodeValue.replace('$', ''); alert(Number(y)); y = y *48; </code></pre> <p>the value I am reading here is integer type amount with $, ex: $200, $10 etc., and after omitting <code>$</code> symbol, i get ex: <code>200, 10</code>. Now before i do arithmetic operations on y, alert shows me value as NaN,even if i don't write Number() also i am getting same problem. how to get numerical y and able to perform arithmetic operation on it. Can you guys help me out, </p> <p>thanks a ton.michaeld</p>
javascript asp.net
[3, 9]
3,679,622
3,679,623
Using boolean variable in jquery .prop() while unchecking checkboxes. How can I manage it?
<p>I've the following code in jquery:</p> <pre><code> $('.checklist_true').click(function(e) { $('.checkid').prop({checked: true}); e.preventDefault(); }) $('.checklist_false').click(function(e) { $('.checkid').prop({checked: false}); e.preventDefault(); }) </code></pre> <p>I would like to replace .checklist_false and true classes with one, and would like to read a value to a variable containing boolean true/false. (originally .checklist classes attached to tags. But if I try this:</p> <pre><code>var tf = new Boolean($(this).prop('rel')).valueOf(); $('.checkid').prop({checked: tf}); </code></pre> <p>It always evaluates to ture and checks the box. Can somebody explains me why?</p>
javascript jquery
[3, 5]
2,933,990
2,933,991
Colour resource ID returning wrong value
<p>I am trying to set the text colour programatically from a colour resource during onCreate and am getting some wierd results.</p> <p>I have a colour resource defined in res\colors.xml:</p> <pre><code>&lt;resources&gt; &lt;color name="wheelFill"&gt;#C0FFFFFF&lt;/color&gt; &lt;/resources&gt; </code></pre> <p>my activity then uses the following code to retrieve the colour:</p> <pre><code>int WheelColour = getResources().getColor(R.color.wheelFill); </code></pre> <p>Finally I assign it to a Paint:</p> <pre><code>mBackgroundPaint.setColor(WheelColour); </code></pre> <p>When I run my application the colour does not get set an I get a log message from the getColor line claiming that "Color value 'List' must start with #". 'List' is the value of one of my string resources so clearly something is getting messed up there.</p> <p>If I bypass the resource and use:</p> <pre><code>int WheelColour = Color.argb(0xC0, 0xFF, 0xFF, 0xFF); </code></pre> <p>Everything works correctly so it has to be the getColor call but I can't see what's wrong with it. (I have tried explicitly using a context which made no difference).</p> <p>Has anybody else come across this or sucessfully managed to set paint colours from colour resources?</p>
java android
[1, 4]
747,151
747,152
a question on conversion logic
<p>I am designing a unit converter using android.i m using logic which is not nice logic i think and i m giving some code here too.can anyone suggest me any better logic????</p> <pre><code>public void temperature(String value1,String value2) { if(value1.equals("Celsius") &amp;&amp; value2.equals("fahrenheit") ) { double i=Double.parseDouble(at1.getText().toString()); double value=i*33.8; Double d=new Double(value); at2.setText(d.toString()); } else if(value1.equals("fahrenheit") &amp;&amp; value2.equals("Celsius")) { double i=Double.parseDouble(at1.getText().toString()); double value=i*(-17.2222); Double d=new Double(value); at2.setText(d.toString()); } </code></pre> <p>There is like this many unit in every category like angle,computer.this is only a small example of temperature category.</p>
java android
[1, 4]
4,686,948
4,686,949
Purpose of Object class in Android Application
<p>I am working on Android development. I stumbled upon the Object class. I read the docuementation and it doesn't say much about the purpose of the class. I think it comes in handy when an application has multiple threads. Is there other spots it can be beneficial?Can anyone give me some idea when to use it and the benefits of using it?</p>
java android
[1, 4]
1,920,006
1,920,007
How do I click coordinate on page?
<p>This is probably such a simple question, but after reading a few tutorials and other posts on Stack Overflow, I couldn't get what I was looking for.</p> <p>Using the <code>.click()</code> function in jQuery, I want to click a specific <code>X</code>, and <code>Y</code> location on the page. All I found were tutorials on how to find coordinates, but not specifically click them.</p>
javascript jquery
[3, 5]
5,371,149
5,371,150
Page scroller like SQL Designer
<p>How can i make a page scroller with jquery like SQL Designer panel here one image of it: <a href="http://screensnapr.com/v/jX0Pk1.png" rel="nofollow">http://screensnapr.com/v/jX0Pk1.png</a></p> <p>link: <a href="http://ondras.zarovi.cz/sql/demo/" rel="nofollow">http://ondras.zarovi.cz/sql/demo/</a> please see at right bottom that panel.</p> <p>Thanks for any help.</p>
javascript jquery
[3, 5]
3,203,203
3,203,204
one web application multiple database for each client difficulties with recognizing clients Request.Url.Host
<p>I have one <code>asp.net(iis7)</code> web app and multiple database in back-end.</p> <p>Every client has different url for example:</p> <p><strong>client1.test.com<br> client2.test.com</strong> </p> <p>Application should read url <code>(HttpContext.Current.Request.Url.Host)</code> and determine which database use.</p> <p>The problem is that from <code>iis7 HttpContext.Current.Request.Url.Host</code> in class not working(Request is not available in this context ).</p> <p>I don't have idea how to replace this mechanism. One web app for every client is not a solution.</p>
c# asp.net
[0, 9]
2,258,235
2,258,236
Upload image byte[] with POST
<p>How to send Image or Video with post request with lot off other parameters with post request ? I have image and video in byte[] format and I am trying like </p> <pre><code> HttpClient httpClient = new DefaultHttpClient(); http.setURI(URI.create(url)); MultipartEntity reqEntity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); ByteArrayBody bab = new ByteArrayBody(a.getData(), a.getQuestionId() + ".jpg"); reqEntity.addPart("type", new StringBody("photo")); reqEntity.addPart("data", bab); http.setEntity(reqEntity); HttpResponse response = httpClient.execute(http); </code></pre> <p>it pass through code but it doesn't upload anything ( bab !=null ). Does anybody have any idea what is wrong, I cannot provide more info, other team is at ws ?</p>
java android
[1, 4]
5,795,757
5,795,758
Using LoadControl on pages with server controls
<p>I'm trying to create a user control template that I can send as email.</p> <p>In a utility class I have a method that contains this code:</p> <pre><code>StringBuilder sb = new StringBuilder(); Page p = new Page(); UserControl ctrl = (UserControl)p.LoadControl("~/EmailTemplates/OrderConfirmation.ascx"); StringWriter sw = new StringWriter(sb); Html32TextWriter htw = new Html32TextWriter(sw); ctrl.RenderControl(htw); </code></pre> <p>This correctly writes the user controls text, but if I want to use a server control such as a listview inside of the controls page, the listview is never evaluated. It seems that only inline code blocks are evaluated. How can I get around this?</p>
c# asp.net
[0, 9]
632,605
632,606
How to keep spaces in the formatted expression in jqMath
<p>I am using <a href="http://mathscribe.com/author/jqmath.html" rel="nofollow">jqMath</a> for Math equation formatter. I don't want to remove spaces and newline character from the expression. How can I do that? I have tried a lot but I coudn't find any solution. </p>
javascript jquery
[3, 5]
1,073,302
1,073,303
Simple jQuery .change question
<p>I am new to jQuery and am having difficulty getting a .change event to call a named function. When I use an anonymous function, it works fine.</p> <p>This works fine:</p> <pre><code>$(function() { $("select").change(function() { alert("hello"); }); }); </code></pre> <p>This does not work (i.e. has not effect):</p> <pre><code>$(function() { $("select").change(processSelection()); function processSelection() {alert('Hello!');}; }); </code></pre> <p>Any assistance much appreciated!</p>
javascript jquery
[3, 5]
3,902,601
3,902,602
Can I chain function calls in jQuery?
<p>I want to execute the following:</p> <pre><code>$('#AccountID').change(SelectAccounts); and then (SelectProducts) </code></pre> <p>Is there some way I can make the function SelectProducts execute after SelectAccounts all on the same line?</p>
javascript jquery
[3, 5]
1,488,268
1,488,269
How to POST these variables?
<p>The script called <em>New script</em> is suppose to output 2 integer variables <code>anchor</code> and <code>signed</code>.</p> <p>I would like to replace <em>Old script</em> with <em>New script</em>, but as you can see, they are very different.</p> <p><strong>Question</strong></p> <p>How do I submit/post <code>anchor</code> and <code>signed</code> in <em>New script</em>?</p> <p><strong>New script</strong></p> <pre><code>$(window).load(function() { $('form').delegate('input:submit', 'click', function() { var anchor = this.name; var checkboxState = $('#' + anchor).find('input:checkbox').is(':checked'); var signed = 0; if (checkboxState == true) { signed = 1; } alert(anchor + ' ' + signed); return false; }); }); </code></pre> <p><strong>Old script</strong></p> <pre><code>// sends the form content to server side, and stay on page $('form').live('submit', function() { $.post($(this).attr('action'), $(this).serialize(), function(response) { // do something here on success }, 'json'); // don't redirect return false; }); </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;form action="/cgi-bin/receiver.pl" method="post"&gt; </code></pre>
javascript jquery
[3, 5]
3,411,757
3,411,758
show changes after a refresh
<p>Is it possible to highlight changes in the DOM after each AutoRefresh. What are some different approaches?</p> <p>Thanks, rod.</p>
asp.net jquery
[9, 5]
257,225
257,226
Retrieving an element by array index in jQuery vs the each() function
<p>I was writing a "pluginable" function when I noticed the following behavior (tested in FF 3.5.9 with Firebug 1.5.3).</p> <pre><code>$.fn.computerMove = function () { var board = $(this); var emptySquares = board.find('div.clickable'); var randPosition = Math.floor(Math.random() * emptySquares.length); emptySquares.each(function (index) { if (index === randPosition) { // logs a jQuery object console.log($(this)); } }); target = emptySquares[randPosition]; // logs a non-jQuery object console.log(target); // throws error: attr() not a function for target board.placeMark({'position' : target.attr('id')}); } </code></pre> <p>I noticed the problem when the script threw an error at <code>target.attr('id')</code> (<code>attr</code> not a function). When I checked the log, I noticed that the output (in Firebug) for target was:</p> <pre><code>&lt;div style="width: 97px; height: 97px;" class="square clickable" id="8"&gt;&lt;/div&gt; </code></pre> <p>If I output <code>$(target)</code>, or <code>$(this)</code> from the <code>each()</code> function, I get a nice jQuery object:</p> <pre><code>[ div#8.square ] </code></pre> <p>Now here comes my question: why does this happen, considering that <code>find()</code> seems to return an array of jQuery objects? Why do I have to do <code>$()</code> to <code>target</code> all over again?</p> <pre><code>[div#0.square, div#1.square, div#2.square, div#3.square, div#4.square, div#5.square, div#6.square, div#7.square, div#8.square] </code></pre> <p>Just a curiosity :).</p>
javascript jquery
[3, 5]
3,201,013
3,201,014
JQuery Dialog while PHP requesting
<p>I have this php files:</p> <p>index.php</p> <pre><code>echo '&lt;a href="./edit.php?id=1"&gt;Edit&lt;/a&gt;'; </code></pre> <p>and the edit.php</p> <pre><code>&lt;?php $id = $_REQUEST['id']; if ($icao != NULL) { header("Location: ./index.php?id=$id"); } ?&gt; </code></pre> <p>When I click in the Edit link PHP redirect you to index.php. How I can put a JQuery Dialog when the PHP request and redirect is doing? I know the code to do a JQuery Dialog but I don´t know where I need to put the dialog.</p>
php jquery
[2, 5]
3,257,605
3,257,606
how can i use referenced libraries
<p>Hi I made one jar file with 3 classes.They work fine they are supporting file for getting HXM data.Now when i made jar i want to use it in my next project.I imported it and now it is in referenced libraries.But i can not find how can i use the libraries. in old project from i take the 3 .class file they have the paths: sk.csabi.hxm.*</p> <p>but now how can i import and use them?</p> <p>thanks</p>
java android
[1, 4]
4,243,406
4,243,407
Why does a aspx/cs project copied locally does not work?
<p>Why does a aspx/cs project copied locally does not work?</p> <p>I have copied the aspx/cs project right off the server and I put all the code right into my local host area. I opened the csproj file in visual studio with no problems I ran it and it did not crash. But what it does do is this. It says the Internet Explorer cannot display the page. Any ideas?</p> <p>I have done a rebuild and it still fails. (good news is there is no compile errors)</p>
c# asp.net
[0, 9]
1,635,827
1,635,828
Best|Useful tools for ASP.NET/C# Devs?
<p>What tools do you use to develop .net apps? Things that make life easier|quicker. Fiddler was just recommended to me but I'm not sure how it works yet, though it looks interesting. I also use Notepad++ as a quick text editor. Aside from that, it's just VS studio for me.</p>
c# asp.net
[0, 9]
3,586,706
3,586,707
Accessing Dynamic Checkbox control's ClientID inside DataList control's OnItemCreated Event
<h2>ClientID property of Dynamic CheckBox</h2> <h2>Problem: I need to attach some javascript function for each of checkboxes with uniqueID inside Datalist.</h2> <p>When I'm trying to access ClientID inside <strong>OnItemCreated</strong> event in the code behind, it always resulting in the same ID which I've specified in design aspx page[It's not generating the unique ID]. Note: While It results in proper Unique ID generation when I access in <strong>OnItemDataBound</strong> command. Any reasons why? Following is the Code...</p> <pre><code>protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { CheckBox chk = (CheckBox)e.Item.FindControl("chkUID"); if (chk != null) { chk.Attributes.Add("OnClick", "javascript:selectDiv(" + chk.ClientID.ToString() + ");"); } } } </code></pre>
c# asp.net
[0, 9]
2,959,200
2,959,201
client side check of image size, extension and single click to open file-dialog window in IE?
<p>am working visual studio 2005</p> <p>I have a Fileupload control to upolad Image. After I select the Image path using fileupload control I have kept one button named Upload to upload image into temp folder for preview. In server only am checking the size and extension. its working good but what I need is</p> <ol> <li>the size and extension should checked at client side istelf</li> <li>In IE browser, if I double click the textbox of fileupoad control, its opening the "file dialog" window to select the image. I want single click to open the "file dialog"</li> </ol> <p>Please anyone give me a idea..</p>
c# javascript asp.net
[0, 3, 9]
278,735
278,736
Code block + literal in asp.net custom control
<p>I'm searching for 2 days now to accomplish the following: I want a custom control which will take inline text + code blocks.</p> <p>Example of what I want to achieve:</p> <pre><code>&lt;asp:MyCustom runat="server"&gt; Hello there, &lt;%= User.Name%&gt; &lt;/asp:MyCustom&gt; </code></pre> <p>Here is what I currently have:</p> <pre><code>[ParseChildren(true), PersistChildren(true)] public class MyCustom { [PersistenceMode(PersistenceMode.InnerDefaultProperty)] public ITemplate Text { get; set; } //Constructor public MyCustom() { Text = new StringITemplate(text); } } </code></pre> <p>On top of that, the control is actually a member of a list of a parent user control that inherits from "UserControl", overrides the Render method. Also, there is a class StringITemplate, which allows assigning plain strings to the ITemplate property as well.</p> <p>Ultimately, I want to achieve the following:</p> <pre><code>&lt;asp:MyCustomItemControl runat="server"&gt; &lt;Items&gt; &lt;asp:Item&gt;Hello there, &lt;%= User.Name%&gt;&lt;/asp:Item&gt; &lt;asp:Item&gt;&lt;%= SomeOtherString%&gt;&lt;/asp:Item&gt; &lt;/Items&gt; &lt;/asp:MyCustom&gt; </code></pre> <p>Right now, I would be happy if my first request actually worked. Seems like hell to get a grip on the wilderness of web/user/custom/server - controls in asp.net and their properties.</p> <p>The complete code of what I have right now, can be looked at here: <a href="http://pastebin.com/3gic2Y0u" rel="nofollow">http://pastebin.com/3gic2Y0u</a></p> <p>Thanks for reading :)</p>
c# asp.net
[0, 9]
5,004,544
5,004,545
jQuery imgAreaSelect
<p>I have 3 different divs with images in them. Each div with a different width and height. I am using jQuery imgAreaSelect on them all. Cropping works fine. My problem is i would like when the cropping window opens to start with an initial crop. I would like this initial crop to be the biggest possible porportions for the given aspect ratio.</p> <p>The code I am working with is:</p> <pre><code>var aspectratio1 = $('#cutout_'+cutout_id).height() / $('#cutout_'+cutout_id).width(); aspectratio = "1:" + aspectratio1; var image_width = $('#CutoutImage').width(); var image_height = $('#CutoutImage').height(); var aspect = 1 / aspectratio1 ; var NewWidth = Math.round(image_height * aspect); var left = ((image_width - NewWidth) / 2); var right = Math.round(NewWidth + left); var x1 = left; var y1 = 0; var x2 = right; var y2 = image_height; $('#CutoutImage').imgAreaSelect({ aspectRatio: aspectratio, instance: true, zIndex: 9999, x1: x1, y1: y1, x2: x2, y2: y2 }); </code></pre> <p>This seems to not be working properly. Any help or insight is much appreciated.</p> <p>Thank you very much</p>
javascript jquery
[3, 5]
1,946,108
1,946,109
javascript onchange query issue
<p>I have the following javascript at the head of my file.</p> <pre><code>&lt;?php echo "&lt;script language='JavaScript'&gt;\n"; echo "var times = new Array();\n"; echo "times[0] = 0;\n"; foreach($times as $time) { echo "times[". $time-&gt;DESC ."] = " . $time-&gt;FEE . ";\n"; } echo "&lt;/script&gt;\n"; ?&gt; </code></pre> <p>i then have a dropdown, where the options are the same $time->DESC,</p> <p>i have an onchange, and i want to set another text box value to equal the PBT_FEE according to the PBT_DESC</p> <p>i have</p> <pre><code>onchange="document.getElementById('Price').value = times[this.value];" </code></pre> <p>i presume that times[this.value] should call for the fee according to the matching descriptions, but i get no output</p>
php javascript
[2, 3]
2,583,020
2,583,021
Append an onClick event to an anchor tag using jquery?
<p>I am trying to add an onClick event to an anchor tag ...</p> <p>Previously i had ...</p> <p><code>&lt;a href="somlink.html" onClick="pageTracker._link(this.href); return false;"&gt;</code></p> <p>But i am trying to avoid the inline onClick event because it interferes with another script..</p> <p>So using jQuery i am trying the following code ...</p> <pre><code>&lt;script&gt; $(document).ready(function() { $('a#tracked').attr('onClick').click(function() {window.onbeforeunload = null; pageTracker._link(this.href); return false; }); }); &lt;/script&gt; </code></pre> <p>with the html like so <code>&lt;a id="tracked" href="something.html"&gt;</code></p> <p>So my question is should this be working, and if not what would be the best solution?</p>
javascript jquery
[3, 5]
644,450
644,451
Android SDK not installing on win 7 64-bit
<p>I am trying to install Android SDK on windows 7 64-bit but it doesn't work. I keep getting <a href="http://goo.gl/4Xe5I" rel="nofollow">this screen</a>:</p> <pre><code>JAVA SE Development Kit (JDK) not found. Error: Failed to find Java version for 'C:\Windows\system32\java.exe': [2] The system cannot find the file specified. (...) If you believe you have a JDK installed and it was not properly recognized, simply set an environment variable JAVA_HOME to point to it. </code></pre> <p>I tried setting <code>JAVA_HOME</code> to <code>C:\Windows\System32\java.exe</code> (which is my install path) and it still doesn't work.</p> <p>In the command line i tested the version with <code>java -version</code> and it works perfectly.</p> <p>Tried the old trick of back and next but sadly doesn't work.</p> <p>this is so disappointing.... any suggestions?</p>
java android
[1, 4]
5,516,907
5,516,908
LinkedList<T> (2.0): removing items iteratively
<p>I need to iterate through a <code>LinkedList&lt;T&gt;</code> (in .NET 2.0) and remove all the items according to a given criteria. It was easy way under Java, since I could do the following:</p> <pre><code>Iterator&lt;E&gt; i = list.iterator(); while (i.hasNext()) { E e = i.next(); if (e == x) { // Found, so move it to the front, i.remove(); list.addFirst(x); // Return it return x; } } </code></pre> <p>Unfortunately, in the .NET behavior of <code>IEnumerator&lt;T&gt;</code> (the equivalent of <code>Iterator&lt;E&gt;</code>) there's no <code>remove</code> method to remove the current element from the collection. Also, in the <code>LinkedList&lt;T&gt;</code> there's no way to access an element at a given index, to accomplish the task by iterating back from the last to the first.</p> <p>Have you got any idea on how to do it? Thank you very much!</p>
c# java
[0, 1]
5,643,060
5,643,061
OnClient Click javascript using Freetextbox
<p>My javascript doesnt detect my function using Freetextbox..</p> <p>here's my code in javascript: I don't know if is the right code for Freetextbox.</p> <pre><code>function validateFreetextbox() { if(document.FTB_API["txt_Decs"].GetHtml == '' ) { alert("Please Fill up desciption."); return false; } else { return true; } } </code></pre> <p>here's the code in my asp.net/C# button.</p> <pre><code> &lt;asp:Button ID="btn_Add" runat="server" OnClick="btn_Add_Click" Text="Add" Width="231px" Font-Size="11px" Font-Bold="false" ForeColor="#333333" onclientclick=" validateFreetextbox()" /&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
3,425,426
3,425,427
How to display images from a folder in a gridview?
<p>How to display images from a folder in a gridview whose path is stored in ms sql database?</p>
c# asp.net
[0, 9]
5,157,522
5,157,523
slideshow with jquery fancybox and iframe
<p>I am trying to see if it is possible to create slideshow of html pages similar to flipboard.com landing page.</p> <p>I am able to load the html page using iframe in fancybox.</p> <p>The page is at: <a href="http://yshara.com/test.html" rel="nofollow">http://yshara.com/test.html</a></p> <p>My html/javascript looks like:</p> <pre><code>&lt;body onload="$('.extLink').trigger('click');"&gt; &lt;div class="container"&gt; &lt;div id="nextslide"&gt; &lt;a class="extLink" href="http://google.com"&gt;Search the world with different sites.&lt;/a&gt; &lt;a class="extLink" href="http://yahoo.com"&gt;Next&lt;/a&gt; &lt;a class="extLink" href="http://Bing.com"&gt;Next&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>I was wondering if any of you javascript experts can help me with this one.</p> <ol> <li>The first page is google.com, but it skips it to the next one, yahoo.com</li> <li>How do I cycle back to the first page?</li> </ol> <p>Thanks in advance for your help.</p>
javascript jquery
[3, 5]
3,453,343
3,453,344
How to trap 403 errors in C#
<p>I have a TRY / Catch in my C# code and I want to trap a 403 error so that I can send the user to a registration page.</p> <p>Is there a property in EXCEPTION for status code (403) or do I have to parse the message ({"The HTTP request was forbidden with client authentication scheme 'Negotiate'."}) ?</p> <p>I have the following </p> <p>try</p> <p>access web service</p> <p>catch (Exception err)</p> <p>So I want to be able to find the 403 code in Exception, or should I be using something other than Exception here ?</p>
c# asp.net
[0, 9]
4,319,457
4,319,458
How to convert date and time stored in string to 24 format time in android?
<p>I have my date and time stored in string i.e my string contains str ="18/01/2013 5:00:00 pm". How can I convert it to 24 format time in android?</p>
java android
[1, 4]
5,174,986
5,174,987
How to Hide Sliding div on Document Ready
<p>I am trying to slide up and down a div (<code>.nav</code>) by clicking on another div (<code>#toggleMenu</code>) </p> <p>Now my problem is when I run the page the (<code>.nav</code>) div pops up very fast. I used the <code>$(".nav").hide();</code> to hide the div but this is happening after loading the (<code>.nav</code>) very fast.</p> <p>here is the code I have </p> <pre><code>$(document).ready(function() { $(".nav").hide(); $("#toggleMenu").click(function () { $('.nav').slideToggle(); }); }); </code></pre> <p>and the css style is as:</p> <pre><code>.nav { border: 0px solid #ccc; border-width: 0px 0; list-style: none; margin: 0; padding: 0; text-align: left; } </code></pre>
javascript jquery
[3, 5]
3,733,782
3,733,783
How can I set up a function so it's called rather than inline
<p>I was given the following code:</p> <p>accept</p> <p>Something like this:</p> <pre><code>$("input[id^='position_']").change(function() { //get the value of the input field marked with "position_x" var posX = $(this).val(); var idArr = $(this).attr("id"); var idTmp = idArr.split("_"); var id = idTmp[1]; var divX = $("div[id='"+id+"']").html(); make an ajax call passing the two parameters. $.ajax({ type: "POST", url : "your_url", data: "pos_x="+posX+"&amp;div_x="+divX, success: function(response) { alert(response); } }); }); </code></pre> <p>I like to keep things simple. Is there a way that I can split this code into a function and then have the function be called here: <code>$("input[id^='position_']").change(function() {</code></p> <p>Also the function seems kind of complex. What I need is for when a user clicks an input field then I will get the value of that field along with the value of another field in the same row and then send to Ajax. </p> <p>Can anyone see a way I could simplify this?</p>
javascript jquery
[3, 5]
1,582,630
1,582,631
why asp.net wont delete my row?
<p>Im trying to delete a row from my Database,</p> <p>this is my code :</p> <pre><code>sql = "delete sum_lines from sum_lines join sum_tbl on sum_lines.summary_id = sum_tbl.id where sum_tbl.user_id = @userId and sum_lines.line_id ='@lineId'"; SqlConnection con = new SqlConnection(conString); dataObj = new DataObj(); SqlCommand com = new SqlCommand(sql, con); com.Parameters.Add(new SqlParameter("@userId", userId)); com.Parameters.Add(new SqlParameter("@lineId", lineId)); con.Open(); com.ExecuteNonQuery(); con.Close(); </code></pre> <p>the thing is, that if Im trying my sql statement in the management tool , it works perfectly. but it wont effect on my database when my code is running.</p> <p>it DOES go to this code, I can see in my debug mode, but it wont effecting for some reason . any inputs ?</p>
c# asp.net
[0, 9]
53,564
53,565
How to add new items in our project dynamically from our program?
<p>Is there is any method to add new items or existing items in our project from our program?</p> <p>For example: if i need to add example.aspx page from my program then how to add it?? And it should save in solution explorer.</p>
c# asp.net
[0, 9]
2,082,963
2,082,964
equivalent to push() or pop() for arrays?
<p>i am trying to add, remove and reference items from an array i create in my main java file, but i am having trouble figuring out the correct syntax. in actionscript they have push() and pop() for adding and removing items in an array, is there an equivalent in android?</p>
java android
[1, 4]
334,886
334,887
Attach event listener to dynamic element
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8021436/jquery-1-7-turning-live-into-on">jQuery 1.7 - Turning live() into on()</a> </p> </blockquote> <p>I used to love the <code>.live()</code> function that jQuery had. You would add it and voila, any future elements that matched the identifier would have that function.</p> <p>Then it got deprecated and it was advised to use <code>.on()</code>. But it doesn't work. Below is my code that is placed in <code>$(document).ready()</code>.</p> <p><strong>This works</strong></p> <pre><code>$('#membership_number').live('change',function(e) { alert("VALUE CHANGED"); }); </code></pre> <p><strong>This doesn't</strong></p> <pre><code>$('#membership_number').on('change',function(e) { alert("VALUE CHANGED"); }); </code></pre> <p>Is there another way to achieve the same effect as <code>.live()</code> or am I just not using <code>.on()</code> correctly?</p>
javascript jquery
[3, 5]
4,649,559
4,649,560
Dynamic Dropdown onselect
<p>What I am trying to do is when a item is selected from my dropdown menu, it would make a input box appear with the description selected on the dropdown menu, so that it can be edited and updated back into the database,</p> <p>I am unsure how to handle the javascript:</p> <p><strong>Dropdown Code:</strong></p> <pre><code>&lt;select name="captionSelect" id="captionSelect"&gt; &lt;?php foreach ($get_images as $image){ echo '&lt;option value="'.$image['id'].'"&gt;'.$image['description'].'&lt;/option&gt;'; }; ?&gt; &lt;/select&gt; </code></pre>
php javascript
[2, 3]
174,885
174,886
JQuery to load external pages in DIV
<p>I am using jquery to load external pages in index.html Menu links have function - About</p> <pre><code>function about() {jQuery('#container').load('about.html');} </code></pre> <p>I am using jquery function on each child page to get the data from xml. Apparently, wen I call the jquery just once on index.html and use same for child it works differently. When I single click it empty the <code>#container</code> but doesnt external file data. But when I double click on menu tab then i see the data. I am really lost and need help to figure out as wat m doing wrong. hashworld.com.au/test/test.html I have uploaded code here please have a look</p>
javascript jquery
[3, 5]
2,297,615
2,297,616
kamens jQuery-menu-aim in RTL version
<p>can someone help me in kamens jQuery-menu-aim plugin (<a href="https://github.com/kamens/jQuery-menu-aim" rel="nofollow">https://github.com/kamens/jQuery-menu-aim</a>) ? Overview: <a href="http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown" rel="nofollow">http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown</a> I'm trying to update this to works in RTL version... Any suggestions ?</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
1,987,642
1,987,643
Socialite.js callback or loaded event
<p>I'm implimenting <a href="https://github.com/dbushell/Socialite" rel="nofollow">Socialite.js</a> for the first time. [It is a js plugin for loading social media plugins after page load, or whenever] It seems really great but I want to hide the loading plugins and display them after Socialite has done its magic. [opacity 0>1 with css transitions] The documentation says nothing about a callback and I can't find anything on google.</p> <p>I would like to know:</p> <ul> <li>if Socialite has a callback?</li> <li>or if it gives a finished event I can listen for?</li> <li>or another way to detect if my social plugins [both fb and twitter] are loaded?</li> </ul>
javascript jquery
[3, 5]
5,040,991
5,040,992
Not able to read contact's all values
<p>I have made an application of reading all contacts and its values from android address book, but i am not able to read all the vlaues of contact. Currently i am getting only its name and mobile number. </p> <p>How can i get its all phone numbers,all eamil values and address values ?</p> <p>Thanks in advance...</p>
java android
[1, 4]
4,260,574
4,260,575
Can't add duplicate row to the asp.net Table Control
<p>I have an asp.net table control like this:</p> <pre><code> TableHeader A Text | Textbox </code></pre> <p>What I want to do is, in the page_load event, duplicate second row with all the controls within it, change the text in the first cell and add as a new row. So here is my code:</p> <pre><code> for (int i = 0; i &lt; loop1counter; i++) { TableRow row = new TableRow(); row = myTable.Rows[1]; //Duplicate original row char c = (char)(66 + i); if (c != 'M') { row.Cells[0].Text = c.ToString(); myTable.Rows.Add(row); } } </code></pre> <p>But when I execute this code it justs overwrites on the original row and row count of the table doesn't change. Thanks for help....</p>
c# asp.net
[0, 9]
148,833
148,834
javascript/jquery: get info for a remote image
<p>I have an image that has "src" pointing to an external server, like this:</p> <pre><code> &lt;img src="http://somewhere.com/script.php?id=1234"&gt; </code></pre> <p>The image returned is .png and it can be returned as a "X" image or "O" image.</p> <p>How can I determinate if the image is X or O with javascript/jquery? Calculating md5 of the loaded image? In case how can I access to the image bytes and calculate md5?</p>
php javascript jquery
[2, 3, 5]
3,072,940
3,072,941
rearrange randomly placed divs on click
<p>i have a couple of draggable divs that are placed randomly on the page when loaded</p> <p>i want these divs to be rearranged to a pre-specified location on the click of a link, how would i go about doing this?</p> <p>here's the jsfiddle: <a href="http://jsfiddle.net/BbKsq/7/" rel="nofollow">http://jsfiddle.net/BbKsq/7/</a></p> <pre><code>$("#web01,#web02").each(function () { var randHigh = Math.floor(Math.random() * ($(window).height() - 200)); var randWide = Math.floor(Math.random() * ($(window).width() - 200)); $(this).offset({ top: randHigh, left: randWide </code></pre>
javascript jquery
[3, 5]
3,015,977
3,015,978
How to change Repeater DataSourceID?
<p>I have a repeater and and and I set its <code>DataSourceID</code> .</p> <pre><code>&lt;asp:Repeater ID="rpProducts" runat="server" DataSourceID="ItemDataSource" &gt; &lt;HeaderTemplate&gt;....&lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; .... &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>But I some time I want to change the <code>DataSourceID</code> and load data and again set the <code>ItemDataSource</code>.</p> <p>This is my code for change the rpProducts <code>DataSourceID</code> .</p> <pre><code>rpProducts.DataSourceID = null; rpProducts.DataSource = goods; rpProducts.DataBind(); </code></pre> <p>So then again I want to set the <code>DataSourceID</code> to <code>ItemDataSource</code>.</p> <p>How can I do it?</p> <p>I try like this. but is not working</p> <pre><code> rpProducts.DataSourceID = null; rpProducts.DataSourceID = ItemDataSource.ToString(); </code></pre>
c# asp.net
[0, 9]
2,933,379
2,933,380
Unable to send context, constructor is undefined
<p>I have a DbAdapter class to handle the database stuff in my app, but for some reason I can't call it from a new class I have created (although it works in others).</p> <p>The code I'm using from the new class is:</p> <pre><code>DbAdapter mDbHelper = new DbAdapter(this); mDbHelper.open(); </code></pre> <p>It doesn't seem to like the "this". The code for my DbAdapter class is:</p> <pre><code> public DbAdapter (Context ctx) { this.mCtx = ctx; } </code></pre> <p>I'm sure this is really stupid question, but if anyone can point me in the right direction it would be much appreciated.</p> <p>Many thanks,</p> <p>Pete.</p>
java android
[1, 4]
3,288,743
3,288,744
Differences between ScriptManager and ClientScript when used to execute JS?
<p>Can somebody explain for me what the differences are between ScriptManager and ClientScript?</p> <p>ClientScript works well when I use it in Button_Clicked event, but it doesn't work when I use it in the GridView_RowUpdated of a GridView. (The GirdView is wrapped inside an update panel). Then I tried ClientScript and it worked perfectly in this case.</p>
c# asp.net
[0, 9]
3,899,736
3,899,737
Need help to understand accelerometer code
<p>I have read through a lot of code but I do not understand how you can make an image move using the accelerometer sensor, I understand how to register it but I do not understand how to actually make an image or a shape draw move in sync with the accelerometer axis, I am using android java to do this. Please can someone help me as I am really struggling. Thank you for your time and help. </p>
java android
[1, 4]
3,889,035
3,889,036
ApiDemos 3.0/3.1 won't build because of unresolved types
<p>I'm trying to build ApiDemos for API levels 11 (3.0) and 12 (3.1). I've updated to the latest version both tools (revision 11) and platform tools (revision 4). In addition, I have the compatibility package installed.</p> <p>When I try to build the ApiDemos project I get thousands of errors, of which Eclipse shows 100 of the following:</p> <pre><code>ActionBar cannot be resolved to a type ActionBarDisplayOptions.java /ApiDemos3.1/src/com/example/android/apis/app line 34 Java Problem ActionMode cannot be resolved to a type Grid3.java /ApiDemos3.1/src/com/example/android/apis/view line 133 Java Problem alertDialogIcon cannot be resolved or is not a field AlertDialogSamples.java /ApiDemos3.1/src/com/example/android/apis/app line 82 Java Problem animator cannot be resolved or is not a field FragmentHideShow.java /ApiDemos3.1/src/com/example/android/apis/app line 55 Java Problem Animator cannot be resolved to a type AnimationLoading.java /ApiDemos3.1/src/com/example/android/apis/animation line 73 Java Problem </code></pre> <p>I need help getting the samples to build properly. Thanks.</p>
java android
[1, 4]
2,379,815
2,379,816
Check all checkboxes inside an iframe (when inviting guests to a facebook event)
<p>i'm trying to check all checkboxes when inviting guests to a facebook event. Facebook has changed something i think beacuse i usually used this code and now it is not working:</p> <pre><code>var elms=document.getElementsByName("checkableitems[]"); var lunghezza = elms.length; for (i=0;i&lt;lunghezza ;i++){if (elms[i].type="checkbox" )elms[i].click()}; </code></pre> <p>I discovered that the modal windows to invite guests is inside an iframe but i can't checkboxes inside it!</p> <p>I've used </p> <pre><code>jQuery('iframe#iframe_sbx_id').find('input[type=checkbox]').click() </code></pre> <p>but it doesn't work because find() returns an empty set. Any idea on how to do it?</p>
javascript jquery
[3, 5]
4,629,808
4,629,809
How to get child elements of $self, jquery is OK
<pre><code>$('#cont &gt; fieldset').each( function(index){ var $self = $(this); // Here how to get child elements? How to write this selector? //$('$self &gt; div') ?? this seems does not work. }); </code></pre>
javascript jquery
[3, 5]
5,777,515
5,777,516
how to load the pdf file inside iframe in asp.net?
<p>I want to display Pdf file inside iframe control.I have added my code like this below.</p> <pre><code>in asp page, &lt;iframe width=500 height=500 runat="server" id="myPDF" src="pdf_003.pdf"&gt;&lt;/iframe&gt; in page_load myPDF.Attributes.Add("src", "pdf_003.pdf"); </code></pre> <p>When i run the project, then the pdf file is not visible inside the iframe.Instead of this, it shown the save as dialog box for save to disk or open in pdf reader.</p> <p>it is correctly shown in internet explorer but not any other browser...</p> <p>How do i view the pdf file inside iframe control in all other browser?</p> <p>Please Guide me to get out of this issue?</p>
c# asp.net
[0, 9]
1,155,770
1,155,771
Connecting online players
<p>I want to create a game that connects two players. The players have to login and then proceed to the playing page.</p> <p>I have created the code for displaying the online players (from the activePlayer table). What I want is : the player chooses the opponent form the online players list and then the playing page displayed to both players.</p> <p>I am a beginner in developing a multiplayer game.</p> <p>Can anyone give me an idea of how to implement that. </p>
php javascript
[2, 3]
5,716,207
5,716,208
How can I get a HTML data value as a string with jQuery?
<p>I have the following in my source HTML:</p> <pre><code>&lt;li&gt;&lt;a href="#" data-value="01"&gt;Test&lt;/a&gt;&lt;/li&gt; </code></pre> <p>I want to get the value of the data attribute so I am using the following:</p> <pre><code>var abc = $(this).data('value'); </code></pre> <p>This works okay BUT not if there is a leading zero. For example the above placed the value "1" into abc. </p> <p>Is there a way that I can get it not to convert the "01" into "1" ?</p>
javascript jquery
[3, 5]
1,228,129
1,228,130
how to stop script from running
<p>I have been trying to figure this out and probably asked the same question for the fifth time. Some day I will loose my mind. Any way</p> <p>Here is what I am doing </p> <p>I have four tabs. The contents in the tabs are dynamically generated. Sometimes they are very long and messes with page layout. So I am doing this to restrict them upto 540 charecters</p> <pre><code>&lt;script&gt; $(function(){ var myDivThree = $('#pdpTab6'); myDivThree.html(myDivThree.html().substring(0,540)); $(myDivThree).append('&lt;div id="readThree"&gt;Read More&lt;/div&gt;'); //this is what I am doing to show the extra content $('#readThree').click(function(){ $('#popThree').show(); }); $('.closePop').click(function(){ $('#popThree').fadeOut(); }) }); &lt;/script&gt; </code></pre> <p>The weird thing is If a tab contains less than 540 charecters I see read more twice. I would prefer if a tab contains less than 540 charecters not to run the script at all. Am i day dreaming or is it doable?</p>
javascript jquery
[3, 5]
3,817,219
3,817,220
Update HTML H4 tag using jQuery
<p>I am having trouble changing the "text" between an HTML tag using jQuery. When someone clicks on a "radio button", the text should be updated in a certain HTML element. Here is my HTML:</p> <pre><code>&lt;div class="radio-line" id="radio-manager"&gt; &lt;input type="radio" id="rad-400" name="radio-manager" value="No" /&gt; &lt;/div&gt; </code></pre> <p>HTML to be updated on radio check:</p> <pre><code>&lt;h4 class="manager"&gt;Manager&lt;/h4&gt; </code></pre> <p>When someone clicks on the radio above, the "Manager" text should become "Employees". I tried some jQuery code but cannot quite figure it out.</p>
javascript jquery
[3, 5]
431,416
431,417
get text from attribute and format it
<p>I have a div elements with <code>data-seat</code> and <code>data-row</code> property:</p> <pre><code>&lt;div class='selected' data-seat='1' data-row='1'&gt;&lt;/div&gt; &lt;div class='selected' data-seat='2' data-row='1'&gt;&lt;/div&gt; &lt;div class='selected' data-seat='3' data-row='1'&gt;&lt;/div&gt; &lt;div class='selected' data-seat='1' data-row='2'&gt;&lt;/div&gt; &lt;div class='selected' data-seat='2' data-row='2'&gt;&lt;/div&gt; </code></pre> <p>I want print friendly message for selected seats:</p> <pre><code>var selectedPlaceTextFormated =''; $(".selected").each(function () { var selectedPlace = $(this); selectedPlaceTextFormated += "Row " + selectedPlace.attr("data-row") + " (seat " + selectedPlace.attr("data-seat") + ")\n"; }); alert(selectedPlaceTextFormated); </code></pre> <p>This code works well and shows the following:</p> <pre><code>Row 1 (seat 1) Row 1 (seat 2) Row 1 (seat 3) Row 2 (seat 1) Row 2 (seat 2) </code></pre> <p>But, I want group seats by row, i.e I want the following:</p> <pre><code>Row 1(seats: 1,2,3) Row 2(seats: 1,2) </code></pre> <p>also, order by row number. How can I do this?<br> Thanks. <a href="http://jsfiddle.net/gJFJW/1/" rel="nofollow">DEMO</a></p>
javascript jquery
[3, 5]
230,465
230,466
jQuery insertAfter doesn't work in some situations
<p>I want to add a hidden input after some element. I am using this code:</p> <pre><code>$("&lt;input type="text"&gt;").insertAfter(".addProduct"); </code></pre> <p>It doesn't work. But if I replace to it works.</p> <pre><code>$("&lt;span&gt;ddd&lt;/span&gt;").insertAfter(".addProduct"); </code></pre> <p>It works. Help me.</p> <p>Thank you.</p>
php javascript jquery
[2, 3, 5]
5,495,312
5,495,313
Editing different types of files from gridview
<p>I have a gridview with coloumns ID, filename, type, date &amp; time and view. There is one fileupload control which uploads the file from computer to some folder named abc. From this folder the filenames are copied to the database table and they are displayed in the gridview. There is one view column in the gridview which when clicked opens the files (.doc, .xlsx,.pptx etc). But these opened files are not not editable. They can just be viewed. My question is, is there any option where I can edit these documents and store back to the same abc folder-> database table -> gridview?</p>
c# asp.net
[0, 9]
5,484,264
5,484,265
click event not firing on newly created list item
<p>I have two lists and when you click on the second list the first list removes the first item and add to the second list but when I click on the newly created list item it doesn't fire why is that. <a href="http://fiddle.jshell.net/g84K9/" rel="nofollow">jsFiddle demo</a></p> <pre><code>$('#SearchList li a').bind("click", function () { var $this = $(this).unwrap('&lt;a href="#"&gt;&lt;/a&gt;').remove().text(); var $that = $('#Search li:first').remove().text(); $('&lt;li&gt;' + $this + '&lt;/li&gt;').insertBefore('#Search li:first') $('#SearchList').append('&lt;li&gt;&lt;a href="#"&gt;' + $that + '&lt;/a&gt;&lt;/li&gt;'); }); &lt;ul id="Search"&gt; &lt;li&gt;Electronics&lt;/li&gt; &lt;li&gt;Image&lt;/li&gt; &lt;/ul&gt; &lt;ul id="SearchList"&gt; &lt;li&gt;&lt;a href="#"&gt;Interests&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Entertainment&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Clothing&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Pharmacy&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Home &amp; Garden&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,588,595
4,588,596
Very simple jQuery not working
<p>Simply put, my <code>jQuery</code> is not working.</p> <p>Here is my code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;jQuery 101&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;h1&gt;Hello, world!&lt;/h1&gt; &lt;p&gt;Test&lt;/p&gt; &lt;/div&gt; &lt;script src="/scripts/jquery/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script&gt; alert('hello world'); $(document).ready(function(){ $("p").click(function(){ $(this).hide(); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The included <code>jQuery</code> file is definitely in the filesystem and the <code>alert()</code> function is working, however this simple jQuery example is not working. This may be a rookie error, but I'm not really sure why.</p> <ul> <li>Using <code>JBoss AS 7.1.1.Final</code> for deployment</li> <li>Using <code>Google Chrome</code> for viewing</li> </ul> <p><b>EDIT:</b> I managed to fixed the original issue: it was due to the fact that i was not referencing the scripts correctly. as the 'scripts' folder is located at the root of the webapp, when i changed the reference to this:</p> <pre><code>&lt;script src="../scripts/jquery/jquery-1.9.1.min.js"&gt;&lt;/script&gt; </code></pre> <p>(Note the two preceeding dots) It seemed to work fine!</p>
javascript jquery
[3, 5]
2,557,886
2,557,887
Remove a confirm() dialog via javascript/jquery
<p>In a javascript function, I do this for quick prototyping:</p> <pre><code>if(confirm("are you sure you want to do this")) { // do something } else { // do something else } </code></pre> <p>If I get a specific event over a websocket, I want to remove this dialog in javascript/jquery. Any ideas how to do that? Is there a DOM id or something for that? Extra-Points if not even the else-block is executed when removing the dialog :)</p>
javascript jquery
[3, 5]
3,453,444
3,453,445
Need help regarding RSS Feed and wordpress
<p>i need to read rss feed from wordpress url. so here is the url <a href="http://bbaremancareers.wordpress.com/feed/" rel="nofollow">http://bbaremancareers.wordpress.com/feed/</a></p> <p>i just need to pick up title,content,publish date,title hyperlink url and media file url etc.</p> <p>i just could fetch only title and content but i need to know how can i fetch also publish date,title hyperlink url and media file url.</p> <h2>here is my code</h2> <pre><code> protected void Button1_Click(object sender, EventArgs e) { var reader = XmlReader.Create("http://bbaremancareers.wordpress.com/feed/"); var feed = SyndicationFeed.Load&lt;SyndicationFeed&gt;(reader); Console.WriteLine("Latest posts from " + feed.Title.Text); foreach (var item in feed.Items) { string strTitle = item.Title.Text; string strContent = item.Summary.Text; } } </code></pre> <p>so please add more code in my existing code to fetch extra data like publish date,title hyperlink url and media file url from the wordpress url <a href="http://bbaremancareers.wordpress.com/feed/" rel="nofollow">http://bbaremancareers.wordpress.com/feed/</a>.</p> <p>please help. thanks</p>
c# asp.net
[0, 9]
2,142,355
2,142,356
javascript doesnt work on a link
<p>I have got this html:</p> <pre><code> &lt;a style="display:block; padding:100%; text-decoration: none;" href="http://google.com " class="Jasmin" id="target_site_to_visit"&gt; &lt;span data-app-id="88" class="btn" id="visit_site" style="right:22px; top:65px; padding:5px;z-index: -99999;"&gt;VISIT SITE&lt;/span&gt; &lt;/a&gt; </code></pre> <p>and this jquery:</p> <pre><code> (function($){ $('#target_site_to_visit').live('click',function(event){ event.preventDefault(); var appName=$('#target_site_to_visit').attr('class'); $.post('db/update_site_viewed.php',{ name:appName }, function(data){ throw new Error("AppName: "+appName); },'html').error(function(data){ throw new Error("Error: "+data.responseText); }); document.location.href=$('#target_site_to_visit').attr('href'); }); })(jQuery); </code></pre> <p>A problem exists, whenever the button is clicked.. the post method is executed which puts the data into the database. But that only happens when the last line in jquery doesnt exist: document.location.href.. the redirection effects the post somehow..and doesnt probably doesnt give the post method to execute..resulting in no record being inserted to the db (or in other post method doesnt execute).. is it possible that that is the cause..cause the redirection does effect the execution of the post method</p>
javascript jquery
[3, 5]
3,638,761
3,638,762
Get File from File Path and Upload - Jquery
<p>I have an output of </p> <pre><code>C:/Path/file/file.mp3 </code></pre> <p>now I need to fetch the file from the path and upload using jquery</p> <p>and store that file to 'audioData' variable...</p> <pre><code>$.ajax({ type: "POST", url: 'URL', data: { image: imageData, audio: audioData } // etc }); </code></pre> <p>How can I get in php? as a FILE or POST ? </p>
php jquery
[2, 5]
391,739
391,740
Bitmap Parameter Invalid
<p>I am facing an error when trying to create a bitmap directly from a string that contains file name and path.</p> <p>My Code is described below:</p> <pre><code>if (!string.IsNullOrEmpty(Request.QueryString["imagename"])) { string Image = Request.QueryString["imagename"]; Bitmap originalBMP = new Bitmap(Server.MapPath(@"UserImages/" + Image)); // Calculate the new image dimensions int origWidth = originalBMP.Width; int origHeight = originalBMP.Height; int sngRatio = origWidth / origHeight; int newWidth = 50; int newHeight = newWidth / sngRatio; // Create a new bitmap which will hold the previous resized bitmap Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight); // Create a graphic based on the new bitmap Graphics oGraphics = Graphics.FromImage(newBMP); // Set the properties for the new graphic file oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic; // Draw the new graphic based on the resized bitmap oGraphics.DrawImage(originalBMP, 0, 0, newWidth, newHeight); // Save the new graphic file to the server Response.ContentType = "image/PNG"; newBMP.Save(Response.OutputStream, ImageFormat.Png); originalBMP.Dispose(); newBMP.Dispose(); oGraphics.Dispose(); } </code></pre> <p>But the following code is producing an error that Parameter is Invalid:</p> <pre><code>Bitmap originalBMP = new Bitmap(Server.MapPath(@"UserImages/" + Image)); </code></pre>
c# asp.net
[0, 9]
1,719,086
1,719,087
Make checkbox value append to textbox, separated by semicolon (copy e-mail addresses)
<p>I'd like to have a list of checkboxes (e-mail addresses). When boxes are clicked, a textfield blanks and is replaced with values of all checked checkboxes, only separated by "; ".</p> <p><a href="http://jsfiddle.net/7b5fk/1/" rel="nofollow">http://jsfiddle.net/7b5fk/1/</a> is -almost- what I want, except I don't want the comma spacing. I've tried multiple approaches but still can't get rid of the comma.</p>
javascript jquery
[3, 5]
4,074,790
4,074,791
How to find an element with a specific attribute that has a specific value
<p>How do a find an element which has the attribute "question-id" and equals a specific value? From there, i need to find the closest div (the wrapper of this element).</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,605,244
2,605,245
How to find the duplicates in an array using jquery
<p>I have a jQuery array:</p> <pre><code>var arr = $('input[name$="recordset"]'); </code></pre> <p>I am getting the value of array like 8 or 6 </p> <p>If array values are repeating or duplicate I need to show <em>"please do not repeat the values"</em>. If not I need to proceed further.</p> <p>Using jQuery can anybody tell me how to find the duplicate values?</p>
javascript jquery
[3, 5]
448,187
448,188
Create a reusable javascript function
<p>At the moment I'm using the below function to perform a simple slide...</p> <pre><code>function jeans(jean, links) { $(links).hide(); $(jean).hover( function() { $(links).show('slow'); }, function() { $(links).hide('slow'); });} </code></pre> <p>And calling it where required with...</p> <pre><code>jeans('#red-jeans', '#red-jeans ul'); jeans('#blue-jeans', '#blue-jeans ul'); jeans('#yellow-jeans', '#yellow-jeans ul'); </code></pre> <p>I'd like to be able to perform this by just attaching a class on the parent "#red-jeans". </p> <p>I'm tring something like</p> <pre><code>function jeans(selector) { $(selector 'ul').hide(); $(selector).hover( function() { $(selector 'ul').show('slow'); }, function() { $(selector 'ul').hide('slow'); });} </code></pre> <p>...but my syntax is atrocious!</p> <p>If someone can point me in the right direction it would be very much appreciated!</p> <hr> <p>The issue is now that the slide runs on every element I've got the class on. Can anyone recommend an amend that would only activate it on the current hover? I presume a (this) is needed somewhere...</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,461,836
2,461,837
any information on using bluetooth for a game?
<p>I am looking for any information on being able to send data back and forth on android devices such as booleans, strings or whatever, would this be easy to do and where would I look for any help on this, I am fairly new to developing for android so begginer stuff is very much appreciated, also would i just be able to send and receive data or would i have to send a file with the data inside of it?</p>
java android
[1, 4]
2,832,538
2,832,539
jQuery How to kill a Created Div?
<p>What I have at the moment is a list of products (divs) that, when hovered over, a duplicate div is created and positioned over the original div (offset a bit and restyled using css). This new div is larger and offers more information that was being shown in the list view.</p> <p>When I hover off the new div it is .remove()'d, however I have found that it does not do this immediately, and if I move my mouse fast enough the hover event is fired, but the mouseleave event is not (as such the new div is just left on screen).</p> <p>What I have at the moment to detect when to remove the new div:</p> <pre><code>jQuery('.newDiv').mouseleave(function(){ jQuery(this).remove(); }); </code></pre> <p>How do I get my new div to check that the mouse is on/off it so that I can kill it correctly?</p>
javascript jquery
[3, 5]
1,783,798
1,783,799
How do I get a variable out of a try/catch block?
<p>I've been trying to get this right for 2 days and am about ready to throw something .....</p> <p>I have a JSONArray which I'm processing in a try/catch block but it doesn't seem to pass the variable out at the end.</p> <p>My code:</p> <pre><code>try{ //Get the element that holds the results ( JSONArray ) JSONArray getresults = json.getJSONArray("results"); //Loop the Array for(int i=0;i &lt; getresults.length();i++){ HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); JSONObject e = getresults.getJSONObject(i); totalpass = e.getJSONObject(i).getString("ftotalpass"); } } catch(JSONException e) { Log.e("log_tag", "Error parsing data "+e.toString()); } </code></pre> <p>I've tried all manor of declaring the variable before, in, after the try/catch block but I just cannot get it to pass to the rest of my code.</p> <p>What am I doing wrong?</p>
java android
[1, 4]
2,686,019
2,686,020
append PHP in jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7016701/creating-jquery-ajax-requests-to-a-php-function">Creating jQuery AJAX requests to a PHP function</a> </p> </blockquote> <p>How can i write PHP in Jquery </p> <p>is there is a way to do this </p> <pre><code> $('button').click(function(){ &lt;?php session_destroy();?&gt; }) ; </code></pre>
php jquery
[2, 5]
613,630
613,631
jquery function call on page both onload and onclick?
<p>i am working on jquery calender but i need to call a function both on page load and then on click. when the page load for the first time it should automatically call and execute the function and for 2nd time and onward it should be call through click. is it possible?? if yes please help me.</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#fullDate").datepicker({ showOn: "button", buttonImage: "images/calender.jpg", buttonImageOnly: true, onClose: function(dateText, inst) { $('#year').val(dateText.split('/')[2]); $('#month').val(dateText.split('/')[0]); $('#day').val(dateText.split('/')[1]); } }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
256,917
256,918
Load javascript function after other function
<p>I have two functions. I'd like <code>moduleList()</code> to load AFTER <code>reloadModules()</code>:</p> <pre><code>reloadModules(); moduleList(); function reloadModules() { $.get(v2_settings_url + 'v2_nav/', null, function(responseText) { $('#dock ul').html(responseText).parent().fadeIn(); }); $.get(v2_settings_url + 'v2_edit_bar_nav/', null, function(responseText) { var target = $('#edit-nav-bar-settings-div'); target.html(responseText); }); }; </code></pre>
javascript jquery
[3, 5]
534,834
534,835
Dynamic value in popup
<p>PHP Code:</p> <pre><code>$cour = mysql_sql('SELECT c.id, c.category, cc.name, c.fullname,c.summary FROM mdl_course c, mdl_course_categories cc WHERE c.id = cc.course'); echo '&lt;table&gt;'; foreach($cour as $cou) { $coursename = $cou-&gt;fullname; $courseid = $cou-&gt;id; $summary = $cou-&gt;summary; echo ' &lt;tr style="border:1px solid #BACC82;"&gt; &lt;td&gt;&lt;a onclick="ShowHide(); return false;"&gt;'.$coursename.'&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;!--SHOW AND HIDE DIV--&gt; &lt;div id="enclosure" style="display:none;"&gt;'.$summary.'&lt;/div&gt;'; } echo '&lt;/table&gt;'; </code></pre> <p>Javascript code:</p> <pre><code>function ShowHide(id) { $('#enclosure_'+ id).animate({"height": "toggle"}, {duration: 1000}); } </code></pre> <p>This was working as you guys suggested on Stackoverflow, but I need in the same manner as a small popup (with smooth) in jQuery. Now the summary informaion should display in a popup Could anyone help me?</p>
php jquery
[2, 5]
4,198,309
4,198,310
Measuring viral coefficient if sharing source is through facebook or twitter
<p>So the standard way of measuring the viral coefficient is via email addresses i.e. current user xyz@xyz.com invites 10 people via email so that you have their email addresses and can tell how many signed up and can therefore calculate the viral coefficient.</p> <p>How would you calculate and program for the viral coefficient if the current user xyz@xyz.com shares a link on your page to facebook or twitter because you wouldn't know how many people they have invited or have their email addresses. Even if you put an estimate of say 100 people referred to your site, how would you know if the new user was referred from user xyz@xyz.com?</p>
php javascript jquery
[2, 3, 5]
5,122,887
5,122,888
Jquery & query string
<p>the below way i call my pageload function by jquery. so please tell me how to pass query string.</p> <pre><code>&lt;script type="text/javascript" src="script/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#Customers').change(function() { $.ajax({ contentType: "text/html; charset=utf-8", data: "CustomerID=" + $('#Customers').val(), url: "FetchCustomer.aspx", dataType: "html", success: function(data) { $("#CustomerDetails").html(data); } }); }); }); &lt;/script&gt; </code></pre> <h2>i have few questions like</h2> <p>1) when type: "POST", then contentType: "application/json; charset=utf-8", has to be application/json? it can not be html?</p> <p>2) when type: "POST" then url can't be like url: "Customer.aspx?ID=101/FetchCustomer" i mean i can npt then pass qiery string.</p> <p>guide me plzz....thanks.</p>
jquery asp.net
[5, 9]
1,544,279
1,544,280
Android: Prevent app from being killed
<p>I've made an Android app that plays a radio stream. It works well, low cpu and ram consumption. But if I open other apps like Facebook or even browse the internet, sometimes my radio application gets killed. </p> <p>Is there a way I can prevent this from happening?</p>
java android
[1, 4]
4,279,216
4,279,217
Using variables in a jQuery function
<p>This line $(''+fullId+'') is giving me problems. I've created an array in a different function that gets the #id's of all the inputs in the DOM. </p> <p>Now with this function i'm trying to create a blur and focus jQuery function. I've set the variable fullId to prepend the '"#' and append the '"' to the variable name, but how do I get it to work?</p> <p>$(''+fullId+'') is not doing the trick and neither does $(fullId)</p> <pre><code>function focusBlur () { var inputId = 0; var fullId = 0; for(var i=0; i&lt;size; i++) { inputId = arr.shift(); fullId = "\"#"+inputId+"\""; $(''+fullId+'').blur(function() { }); $(''+fullId+'').focus(function() { }); } } </code></pre>
javascript jquery
[3, 5]
1,248,488
1,248,489
Why is my attribute value not changing using jQuery's .attr(x,y)
<p>I am trying to change the value of the<code>onclick</code>attribute:</p> <pre><code>&lt;span onclick="addPropertyToQuery(this)" tagId="${property.id}" class="half-padding half-margin tag"&gt; </code></pre> <p>The addPropertyToQuery() method looks something like this</p> <pre><code>function addPropertyToQuery(clicked){ // // Other stuff // $(clicked).attr('onclick','removePropertyFromQuery(this)'); alert($(clicked).attr('onclick')); } </code></pre> <p>I can't see what I am doing wrong, what is most confusing is that the alert gives the correct value.</p>
javascript jquery
[3, 5]