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
1,947,679
1,947,680
jQuery - calling function with parameters inside method
<p>I'm wondering how is possible to call a function with parameters inside a method. I have 2 functions and i'd like to call function deleteCode() when clicked on list element which is created by addCode() function. I'm sure the solution is really simple, but i just can't see it right now. Many thanks!</p> <pre><code>function addCode(code) { $('#codeList').append('&lt;li class="codeList" onClick="deleteCode(code);"&gt;' + code + '&lt;/li&gt;'); } function deleteCode(code) { $('#'+code).remove(); } </code></pre>
javascript jquery
[3, 5]
1,194,715
1,194,716
javascript access xmlhttprequest
<p>I am returning xmlhttprequest and am trying to access xmlhttprequest.responseText</p> <p>I can use console.log and see the value of xmlhttprequest.state, but when I try to see the value of xmlhttprequest.responseText nothing comes up. Here is the responseText I get when I log the xmlhttprequest object.</p> <pre><code>{"name":"05571C-83E2A2-D4F3F0-6D7EE3-58A5F6-606843_2009-1.jpg", "size":54823, "type":"application\/octet-stream", "url":"\/admin\/..\/uploads\/05571C-83E2A2-D4F3F0-6D7EE3-58A5F6-606843_2009-1.jpg", "large_url":"\/admin\/..\/uploads\/large\/05571C-83E2A2-D4F3F0-6D7EE3-58A5F6-606843_2009-1.jpg", "medium_url":"\/admin\/..\/uploads\/medium\/05571C-83E2A2D4F3F0-6D7EE3-58A5F6-606843-2009-1.jpg", "thumbnail_url":"\/admin\/..\/uploads\/thumbs\/05571C-83E2A2-D4F3F0-6D7EE3-58A5F6-606843-2009-1.jpg"}" </code></pre> <p>I am simply trying to get this data so I can parse it with jquery.</p> <p>Any ides?</p>
javascript jquery
[3, 5]
1,430,624
1,430,625
How to create list of color on Java, Android?
<p>I need to create Spinner for list of colors. I will take selected item, get selected color and set this color for another elements. I want to set list of colors in .xml, because I have a few spinners, and want to create resource for it. But if I create a simple list of key -pair , in code I have to create many blocks (if else) for checking colors. How can I create and use resource file (pairs "string-int") for spinner? Thank you</p>
java android
[1, 4]
693,325
693,326
Android stop mediaplayer when preparingAsunc
<p>How can I stop media player during loading when I'm using mediaplayer.prepareAsunc(), (after setting path of radiostream).. when I'm finishing activity, it's start playing, after loaded.. how can I stop it during loading? without System.exit(0) method?</p>
java android
[1, 4]
566,925
566,926
Porting from xAMP to an MS solution
<p>Recently I had to replace the system we use to create timecards and keep track of employee attendance at our branch. When I first took on this project I was given no requirements and so I proposed making the new system as a webapp using Apache, PHP and MySQL which was accepted. I still have a few features to write but I have all critical functionality implemented and is about to be deployed at our branch for a first trial run. In order to allow this webapp to be accessible externally for our teams working at our client location, we had to present the project to HQ which liked to product but not what it was built on. They have nobody in their IT department who are familiar with Apache, PHP or MySQL and also don't trust any of those to be secure. They'd much prefer if it would be built on IIS, ASP.NET and MSSQL. Actually, they would like me to make a SharePoint add-on out of this. Since they would like to deploy this system at our other branches they asked me to port it to those MS products. I'm not too happy about this to say the least but I don't have much of a choice because they won't allow it to be an external service otherwise. </p> <p>I have done C# before but have only used ASP before .NET and they only thing I remember about ASP is that I hated it (not exactly useful in my current situation) I'd like it if somebody could give me some recommendation to transition from xAMP to an MS solution or point me to a site that could help me. I haven't found anything satisfactory so far.</p> <p>Also, I'm using Dwoo right now and I was wondering if there is a template engine for ASP.NET that is compatible with Dwoo/Smarty markup. What I have seen so far of ASP.NET makes me think a template engine isn't as necessary in ASP.NET as it is in PHP because of the way code and html is separated. Maybe trying to stick a template engine in there isn't a good idea but I'd love to be able to save my html and just port the server code. </p>
php asp.net
[2, 9]
4,958,063
4,958,064
strange enum problem in c#
<p>I have this enum:</p> <pre><code>public enum SupportedISOCurrencySymbol { DKK = 208, EUR = 978, NOK = 578, SEK = 752 } </code></pre> <p>I save the value for an order in the approved_orders table, Currency field.</p> <p>I populate the sql insert query with a parameter like:</p> <pre><code>cmd.Parameters.AddWithValue("?Currency", this.Currency); </code></pre> <p>Well, If i do debug on the above line I clearly see that this.Currency has value <strong>DKK</strong>.</p> <p>Why then it inserts in the DB: <strong>208</strong>?</p> <p>Do you have any ideea?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
1,321,488
1,321,489
force screen output before a Thread.sleep
<p>If I try to do a screen output (Toast or setContentView) before a Thread.sleep it will not be displayed until after the sleep (or all the sleeps in the thread). This means that if I do an output after the Thread.sleep it will overwrite the first output. If I so a forceLayout on the View before calling the Thread.sleep it does no good. It appears that Android stores up all the output and displays them at the end of the program. If I run such code as straightforward Java apps on the PC it works as just fine as intended.</p>
java android
[1, 4]
398,583
398,584
I Need An App For My Ecommerse WebSite - Looking For Background Info
<p>I have an eCommerce website that serves a small business. Customers are asking for a mobile app. I built the website myself (html, javascript, VB.net, ASP.net) and I'm constantly tweaking it as we are a new concept and sort of feeling our way forward. I'm not really a programmer - I just taught myself what I needed to know to get what I needed. I know nothing about apps so any info is helpful.<br> Some fundamental questions I have: </p> <p>If I have the website and an app this means that any changes I make to the site (options, features) I will then need to make those changes in the app which means doubling my time spent writing code. Or am I going to have separate apps for android and iPhone which means three times the coding???</p> <p>What language would the apps be written in? I guess I could get someone to write the app and then I could learn from their code and do the ongoing changes myself.</p> <p>What other things should I be considering???</p> <p>Any and all feedback is greatly appreciated.</p>
android iphone
[4, 8]
5,996,640
5,996,641
Skipping lines in android java strings
<pre><code> Giveaway Updates - v1.0.0 ------------------------------------- Application has been created--------------------------------------- </code></pre> <p>I checked the application in the emulator. There is exactly 4 dashes in the same line as giveaway updates in which i wanted to only have giveaway updates there. It looks like this ATM</p> <pre><code>Giveaway Updates - v1.0.0---- ----------------------------- Application has been created- ----------------------------- </code></pre> <p>how can i make it so it would be like this?</p> <pre><code>Giveaway Updates - v1.0.0 ----------------------------- Application has been created ----------------------------- </code></pre>
java android
[1, 4]
1,314,932
1,314,933
all text inputs are blank when validating
<p>My question is that how can I get the validation message to appear if there is any blank text input per question?</p> <p>Here is a fiddle so you can test it: <a href="http://jsfiddle.net/cbyJD/87/" rel="nofollow">http://jsfiddle.net/cbyJD/87/</a></p> <p>Below is the validation() function code:</p> <pre><code>function validation() { // only keeping track of the final message var alertValidation = "", // toggle for showing only one error showOnlyOneError = true; $("input[data-type='qmark']").each(function(i) { var questions = $(this).attr("data-qnum"); var marks = parseInt($("[class*=q" + (i+1) + "_ans_text]").text()); var txtinput = $(this).val(); // the message for this question var msg = ''; if (txtinput == '') { msg += "\n\u2022 You have not entered in a value in all the Indivdiaul Marks textbox \n"; } if (marks &lt; 0) { msg += "\n\u2022 Your Total Marks Remaining does not equal 0 \n - You Need To Remove " + Math.abs(marks) + " Marks"; } else if (marks &gt; 0) { msg += "\n\u2022 Your Total Marks Remaining does not equal 0 \n - You Have " + marks + " Marks Remaining"; } // if there is an error for the question, add it to the main message if (msg.length) { alertValidation += alertValidation.length ? '\n\n' : ''; alertValidation += "You have errors on Question Number: " + questions + "\n"; alertValidation += msg; // stop if we only care about the first error return !showOnlyOneError; } }); // show the error messages if (alertValidation != "") { alert(alertValidation); return false; } return true; } </code></pre>
javascript jquery
[3, 5]
3,489,063
3,489,064
update not working
<pre><code>protected void Page_Load(object sender, EventArgs e) { txtHidden.Text = Request.QueryString["YKcode"]; Display(); } private void Display() { SqlDataReader reader; SqlConnection con = new SqlConnection("Data Source=Localhost;Initial Catalog=MLC000022;User ID=sa;Password=Adama6DaY; Integrated Security=True"); SqlCommand cmd = new SqlCommand("SELECT " + " dbo.GMYAKU.NAME, " +"FROM " + " dbo.GMYAKU " + " WHERE " + " (dbo.GMYAKU.YKCODE = ('" + txtHidden.Text + "'))",con) ; con.Open(); reader = cmd.ExecuteReader(); if (reader.Read()) { this.TextBox1.Text = reader["NAME"].ToString(); } else { // 読めないので画面を初期化する } cmd.Connection.Close(); cmd.Dispose(); con.Close(); } protected void Button1_Click(object sender, EventArgs e) { string connetionString = null; SqlConnection cnn; SqlCommand cmd; connetionString = ("Data Source=Localhost;Initial Catalog=MLC000022;User ID=sa;Password=redacted; Integrated Security=True"); string strSQL ; strSQL = "UPDATE GMYAKU SET"; strSQL += " NAME = '" + (TextBox1.Text) + "'"; strSQL += " WHERE"; strSQL += " YKCODE= '" + txtHidden.Text + "'"; cnn = new SqlConnection(connetionString); try { cnn.Open(); cmd = new SqlCommand(strSQL, cnn); cmd.ExecuteNonQuery(); cmd.Dispose(); // cnn.Close(); //MessageBox.Show(" ExecuteNonQuery in SqlCommand executed !!"); } catch (Exception ex) { // MessageBox.Show("Can not open connection ! "); } Response.Redirect("Default.aspx"); } </code></pre>
c# asp.net
[0, 9]
5,094,624
5,094,625
Multiplying doubles. Answer keeps rounding
<p>Im trying to multiple a double price variable with a int item quantity variable.</p> <p>Currently I am having an issue with the correct format to display the result of the calculation. for example:</p> <p>I have twi items in my database, one has a price value of 2.99, the other 4.00. Each item quantity is 1. this brings the total to 6.99. I want this displayed but instead my interger value is rounding to 7.</p> <p>Here is the code:</p> <pre><code> object foundQty = ds.Tables[0].Rows[i]["coffeeQty"]; int Qty = Convert.ToInt32(foundQty); double price = setPriceList(IDOfCart); combinedPrice = price * Qty; holdingPrice += Convert.ToInt32(combinedPrice); </code></pre> <p>Can anyone tell me why this a double value is not being displayed?</p>
c# asp.net
[0, 9]
5,724,505
5,724,506
Combining two or more 3gp and mp4 files into a single file
<p>In my project, there is a scenario to combine two or more 3gp or mp4 files into a single file.<br> I succeeded to combine avi and wmv files using <a href="http://splicer.codeplex.com" rel="nofollow">Splicer</a> from CodePlex</p> <p>But my requirement is to combine 3gp and mp4 files. I am using asp.net (c#).</p> <p>I will be thankful if anyone provide me guidelines to achieve this using c#.</p> <p>Thanks in advance, Sujith.S</p>
c# asp.net
[0, 9]
5,092,220
5,092,221
jQuery reset setInterval timer
<p>My Jquery:</p> <pre><code>function myTimer() { var sec = 15 var timer = setInterval(function() { $('#timer').text(sec--); if (sec == -1) { clearInterval(timer); alert('done'); } } , 1000); } $("#knap").click(function() { myTimer(); }); $("#reset").click(function() { // set timer to 15 sec again.. }); </code></pre> <p>I want the timer to be reset when clicked on #reset. </p>
javascript jquery
[3, 5]
3,637,978
3,637,979
PHP devs that moved to Python, is the experience better?
<p>I'm planning on moving to Python and I have a couple of additional questions along with the title:</p> <ol> <li>did you have more fun with python?</li> <li>are you as productive as when you're using PHP?</li> <li>what made you change to python?</li> <li>Would you do a project again in PHP? If so, why?</li> </ol> <p>Your answers would really be useful for us PHP devs wanting something more I guess :)</p> <p>Thanks in advance!</p>
php python
[2, 7]
4,035,964
4,035,965
Trying to edit value of TextView on LongClick -- Almost working
<p>I have two elements (TextView) in my XML layout that when a LongClick is pressed it will prompt the user to enter in a new value and then when the DONE button is clicked it should show the newly inputed value to the tvScoreHome using setText().</p> <p>When I do a Long Click on the mentioned element the edit field and keyboard appear as expected. However, it won't allow me to type anything. When I type something it nothing shows up (but the device vibrates as if a button was pressed) and when the DONE button is clicked it vibrates as well but it does not exit the keyboard and show anything in the tvScoreHome element.</p> <p>Any ideas why?</p> <pre><code> // set the onLongClickListener for tvScoreHome tvScoreHome.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { final EditText userInput = (EditText) findViewById(R.id.userInput); InputMethodManager imm = (InputMethodManager) context.getSystemService(Service.INPUT_METHOD_SERVICE); userInput.setVisibility(View.VISIBLE); imm.showSoftInput(userInput, 0); tvScoreHome.setText( userInput.getText() ); userInput.setVisibility(View.INVISIBLE); return true; } }); </code></pre>
java android
[1, 4]
2,746,064
2,746,065
Why does my sliding content keep going after one time?
<p><a href="http://roseannebarr.tumblr.com" rel="nofollow">This is my blog</a>, and if you sit for a couple seconds and watch the "Audio" tile, it moves. Another tile appears that says "cat". "Cat" will slide to the left and "Audio" will reappear, and then "Audio" will slide back to the left. However, after this, Audio never reappears, and instead keeps going. I unhid the music player so you can watch as it just keeps going. What is wrong with my javascript to have this happen?</p> <p>Also, how would I change the javascript so Audio will slide left, Cat comes in from the right, but cat will slide BACK right and Audio will slide in from the left?</p> <pre><code>&lt;script type="text/javascript"&gt; var swap = false; var w = 125; var h = 115; var i = 0; var x = 0; var q = 1; var t; window.onload=function(){ i = initPortfolio(); setTimeout("portfolioRotate()",2000); } function initPortfolio(){ $('.portfolio-item').each(function(index){i = i+1;}); for(var n=1;n&lt;=i;n=n+1){ lpos = w * n - w; $('#item-'+n).css('left',lpos); } $('.offs').css('display','block'); x = i * w - w; return i; } function portfolioRotate(){ swap = false; $('.portfolio-item').delay(4000).animate({left:'-='+w},500,function(){ nn = this.id.split("-")[1]; if(q==nn &amp;&amp; swap==false){ $('#item-'+q).css('left',x); if(q&lt;i){q=q+1}else; swap = true; u=setTimeout("portfolioRotate()",4000); } }); } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,569,505
4,569,506
News section snipits
<p>I have created a news section for a website I'm working on. I'd like to show the first few words of the article then a link to the rest. I'm kicking myself because I remember a few months ago seeing an article on exactly how to do this, but I have no idea where I found it. </p> <p>I know how to grab the first so many characters from a string but it gets more tracking when you are trying to grab words instead. If anyone could point me in the direction of a tutorial or article along these things I’d be very grateful.</p>
c# asp.net
[0, 9]
5,711,944
5,711,945
jquery ui Autocomplete causing error with headers
<p>I'm getting an error when trying to redirect. It only started after I installed a search box with autocomplete. When I pull the bit of code out, the page redirects properly again. I know it isn't my php.ini settings.</p> <p>This is the error I'm getting:</p> <blockquote> <p>Warning: Cannot modify header information - headers already sent by (output started at /home/content/67/6231767/html/nav.php:9) in /home/content/67/6231767/html/admin/includes/functions2.php on line 7</p> </blockquote> <p>Here is the code that is causing the problem. Thanks for your help!</p> <pre><code>$(function() { $.ajax({ url: "/admin/includes/links.xml", dataType: "xml", success: function( xmlResponse ) { var data = $( "link", xmlResponse ).map(function() { return { value: $( "title", this ).text(), id: $( "url", this ).text() }; }).get(); $( "#tags" ).autocomplete({source: function (request, response) { var term = $.ui.autocomplete.escapeRegex(request.term) , startsWithMatcher = new RegExp("^" + term, "i") , startsWith = $.grep(data, function(value) { return startsWithMatcher.test(value.label || value.value || value); }) , containsMatcher = new RegExp(term, "i") , contains = $.grep(data, function (value) { return $.inArray(value, startsWith) &lt; 0 &amp;&amp; containsMatcher.test(value.label || value.value || value); }); response(startsWith.concat(contains)); }, select: function( event, ui ) { window.location.href = ui.item.id; } }); } }); }); </code></pre>
php javascript jquery
[2, 3, 5]
2,631,450
2,631,451
Passing javascript parameter from codebehind error
<p>I use this script to call a javascript from codebehind.</p> <pre><code>ClientScript.RegisterStartupScript(this.GetType(), "Exist", "&lt;script language='javascript'&gt;ConfirmRedirect('" + url + "','" + msg + "');&lt;/script&gt;", true); </code></pre> <p>and my javascript code is</p> <pre><code>function ConfirmRedirect(url,msg) { alert(msg); window.location.href = url; } </code></pre> <p>Am getting ')' expected error. What am missing here? If am calling javascript without paramters then it is working.</p>
javascript asp.net
[3, 9]
4,625,122
4,625,123
Hide the span with a class name jquery
<p>I am stuck on what to do when hiding a span that has a certain class name. I can't use <code>this</code> because it refers to the input. Here is my script:</p> <pre><code>//uncheck all checkboxes $("input[type=checkbox]").prop("checked", false); $("input[type=checkbox]").each( function (index) { $(this).addClass("doc" + index); }) $("input").change( function () { var docName = $(this).parent().find("span"); var className = $(this).attr("class"); if(this.checked) { $("span.noneAttached").fadeOut('slow', function () { docName.clone().appendTo(".attachedDocuments").addClass(className).after("&lt;br /&gt;").text(); }); } else if (!this.checked &amp;&amp; ($(".attachedDocuments &gt; span").hasClass(className))) { //hide the span with the class name } }); </code></pre> <p>The <code>else if</code> checks to see if a checkbox is not checked and if the parent div contains any children with the class name. If so, hide it.</p> <p>Where do I go from here? I am sure this answer is obvious, but I am just not seeing it.</p>
javascript jquery
[3, 5]
4,881,326
4,881,327
Sending multiple PHP files with AJAX
<p>Usually when I want to create new content in a php file and implement it somewhere in my site I do something like this (JS and PHP):</p> <pre><code> case 'someCasename': ... include_once 'file.php'; break; ... success: function(data){ $("#idSelector").html(data); } </code></pre> <p>and the new content is displayed at the selected element.</p> <p>But im curious on if its possible to send multiple php files at the same time. Not sure if this is really necessary and I've not come across a single time where I need to do this but I thought of the it and wanted to ask. This last code is most likely very very wrong but I just want to showcase what i mean:</p> <pre><code> case 'someCasename': ... $phpArray = array("file1" =&gt; include_once 'file1.php', "file2" =&gt; include_once 'file2.php', "file3" =&gt; include_once 'file3.php'): echo $phpArray; break; ... success: function(data){ $("#idSelector").html(data.file1); $("#idSelector").html(data.file2); $("#idSelector").html(data.file3); } </code></pre> <p>Is something like this even remotly possible? You cant json_encode php files can you?</p>
php jquery
[2, 5]
1,634,103
1,634,104
Send two request simultaneously 1st request with C# WebClient and 2nd request with Ajax
<p>hey guys, i have a page in asp.net c#, in that im doin' some video upload functionality, so my video upload code is in <code>Page_Load()</code> method and i'm using <code>WebClient</code> to upload a video file. and i have a <code>animated gif</code> image on page</p> <p>Now the problem is when <code>Page_Load()</code> method is called my files getting uploaded using WebClient, while that time the Page is not yet render, so i get a blank page.. i want that <code>gif</code> image get animated while uploading is goin' on... </p> <p><strong>Note:</strong> i have to use <code>WebClient's UploadFile()</code> method only.</p> <p>So i was thinking is there any way that i can run my Upload functionality in new thread and let the page be Rendered.. or can ajax be helpfull in this scenario ??</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { UploadFile();//this method actually calls an API which uses WebClient to upload file } </code></pre> <p>Another problem is to get a track of upload, that API gives a <code>url</code> which sends json response saying how much percent upload completed, so i also what to send request to this upload tracking <code>url</code> while my Uploading is goin' on simultaneously..</p>
c# asp.net
[0, 9]
1,682,828
1,682,829
how to get the latest files added to android phone
<p>Hi I would like to get the latest files added to the android sdcard using usb file transfer. I am using file.lastModified() to search for new files. But if a folder with bunch of files is transferred from laptop/other means to android phone. The folder and its files, their last modified value did not change in the android phone and hence if i use file.lastModified to filter newly added files, they don't show up. But in some phones, when i do the same process, the lastmodified gets updated for all of them in the phone. </p> <p>How do I catch the files if the lastmodified is not updated if the file is transferred? </p>
java android
[1, 4]
4,377,061
4,377,062
moving more web presentation logic to javascript via jQuery
<p>I am building a new web based application in asp.net. Our backend has existing WCF/REST services that are returning JSON. I also have a JavaScript library that wraps up calling/consuming these JSON services for me client-side. This enables the app to make client-side AJAX calls and do things like a client-side repeater (Rick Strahl has posted about doing this with jQuery). This works quite nicely, and provides a snappy web 2.0 feel.</p> <p>The question is, given the backend I have, and a JS library for plumbing - should I build out all my major list controls and other functionality completely client-side?? I have built out a couple pages with this already, and it is a little jarring to see nothing in my code behind! I am trying to get opinions on pros and cons of this approach.</p> <p>Again, the JS library is built, the backend is build - so its just a question of should I build out pages and logic using jQuery (client-side repeaters and such), or the more traditional server-side approach.</p> <p>Thoughts and suggestions are very welcome!!</p>
asp.net javascript jquery
[9, 3, 5]
1,786,276
1,786,277
Track File Download hits/count in ASP.Net
<p>Is there a way to inherently/manually log the number of times a specific file is accessed in an ASP site. For instance, I've got a few .mp3 files I have on my server and I would like to know how many times each file has been visited.</p> <p>What's the best way to track this?</p>
c# asp.net
[0, 9]
227,735
227,736
what is the best strategy to handle messages between UI code (Activities) and business logic code
<p>I'm looking the best way to Implement the messages and notifications between activities and the business logic code, I used listeners but I had to register and unregister to avoid that activity do any thing while it is not active.have any body use better strategy </p>
java android
[1, 4]
1,657,856
1,657,857
How to hide Login and Register button after login by user?
<p>I'm working on a school project. I'm able to login user successfully who registered. But when he/she loged-in how can I hide <code>Login</code> and <code>Register</code> page link. I'm using <code>css</code> and <code>&lt;ul&gt;</code> for them. And after <code>sign-out</code> how can I show them again.<br> Here is the coding of my links on <code>MasterPage</code> </p> <pre><code>&lt;td id="tabs2" style="width:190px"&gt; &lt;ul id="logreg"&gt; &lt;li&gt;&lt;a href="Login.aspx" &gt;&lt;span&gt;LogIn&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="Registration.aspx"&gt;&lt;span&gt;Register&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/td&gt; </code></pre> <p><img src="http://i.stack.imgur.com/GQxyN.jpg" alt="enter image description here"></p> <p>And how can I use lable like a button to <code>SignOut</code>.</p>
c# asp.net
[0, 9]
2,541,718
2,541,719
jquery submit - change input value before post
<p>I am trying to change the value of an input textbox before submitting a form using something like the following:</p> <pre><code>$('#form1').submit(function () { $('#MyTextBox').val('test'); }); </code></pre> <p>However, when debugging the btnSubmit_Click method on the server side, both Request.Form[MyTextBox.UniqueID] and MyTextBox.Text contain the "old" value of #MyTextBox. It appears that the form is being submitted before the javascript completes running. Any idea why this is happening? The javascript definitely runs because if I add an alert, it pops up. If instead of using the form submit function, I use the click button, it works and the new value gets posted to the server:</p> <pre><code>$('#btnSubmit').click(function () { $('#MyTextBox').val('test'); }); </code></pre> <p>The submit button is defined as:</p> <pre><code>&lt;asp:Button ID="btnSubmit" runat="server" CausesValidation="True" Text="Submit" OnClick="btnSubmit_Click" ValidationGroup="submitRequest" /&gt; </code></pre> <p>Also on a separate note, is it better practice to use Request.Form[MyTextBox.UniqueID] or MyTextBox.Text in the server side method or does it not matter?</p>
jquery asp.net
[5, 9]
5,232,747
5,232,748
How to convert sql time to hh:mm AM/PM?
<p>I have time tag as a created_on="1324987878" ,i want to time as a 5:41 PM.</p>
java android
[1, 4]
5,898,409
5,898,410
how can I calculate number of options tag when I get the select box with $this
<p>I have a question as to how can I calculate number of options tag when I get the select box with $this.</p> <p>Like that:</p> <pre><code> $("select[name=rabetas]").click(function(){ var $this = $(this); </code></pre> <p>And...?</p> <p>how can I do this?</p>
javascript jquery
[3, 5]
3,981,242
3,981,243
Some sort of an array to create multiple Step Form?
<p>a nice member here helped me out to create a form which adds steps as you go. I modified it a bit to allow you to change the answers to some of those questions by clicking a change button. Of course, I realized my limits and applied it to only the first question, and badly... The way I was approaching this was to give each question and button it's own unique id, which I think is probably the wrong way to approach this?</p> <p>This is what I want and I partially accomplished some:</p> <ul> <li>Fill out a field, press NEXT</li> <li>Field 1 Turns into readonly text and a ChangeButton appears</li> <li>a new field appears below that you can fill out</li> <li>By pressing CHANGE on field one, field2 becomes non-editable and field1 is now editable. The change button also turns to "Save". By clicking save, you make field 2 editable and field1 non-editable again.</li> <li>this continues on forever :)</li> </ul> <p>I tried what I found on the internet but I hope that someone who's better at this could help me out a bit if that's ok :) Here's my Jfiddle <a href="http://jsfiddle.net/pufamuf/TEyVL/3/" rel="nofollow">http://jsfiddle.net/pufamuf/TEyVL/3/</a></p> <p>Thank you!</p>
javascript jquery
[3, 5]
3,188,582
3,188,583
What are some best practices for transporting data from PHP to Javascript?
<p>My projects are becoming more and more JS heavy. The issue is that most of my data is on the server side (PHP). What are some clean ways for transporting this data over to the client side (code samples for extra brownie points)? </p> <p>Some ways I am considering - which of these are best?:</p> <p>1) Use php to "echo" directly to js variables. 2) Use php to write to HTML elements and then use js to retrieve from the dom. 3) Use ajaxcall</p> <p>Thoughts?</p>
php javascript
[2, 3]
3,957,550
3,957,551
How to fade all body/document except this active tab?
<p>I have a simple dropdown navigation. How can I fade the entire document when a list item is hovered in this case but still keep the list item and it is children at full opacity?</p> <p>What can I add to this simple code?</p> <pre><code>$("#menu &gt; li:has(ul)").hover(function(){ $(this).find('ul:first').css({visibility: "visible",display: "none"}).show(); },function(){ $(this).find('ul:first').css({visibility: "hidden"}); }); </code></pre>
javascript jquery
[3, 5]
2,736,286
2,736,287
No validation functionality when using System.Net.Mail
<p>It seems that when I configure my email settings in the code behind for a contact page the validation controls no longer work. I have required field validation and regular expression validation to validate email addresses. Validation works on click event before I insert email configurations which requires me to use System.Net.Mail. Here is the code behind:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Net.Mail; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Contact : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.To.Add("[email protected]"); mail.From = new MailAddress(EmailAddressTextBox.Text); mail.Subject = SubjectTextBox.Text; mail.Body = "email address: " + EmailAddressTextBox.Text + "&lt;br /&gt;" + MessageTextBox.Text; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential ("[email protected]", "password"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Port = 587; smtp.Send(mail); EmailAddressTextBox.Text = String.Empty; SubjectTextBox.Text = String.Empty; MessageTextBox.Text = String.Empty; } } </code></pre>
c# asp.net
[0, 9]
129,619
129,620
How to pass query in a dynamically created linkbutton in asp.net
<p>I wanna to pass query in a dynamic link button. I can add it dynamically but unable to pass query on that. Apart from that LinkButton_onClick handler is not working.</p> <p>Pls tell me how to proeed?</p>
c# asp.net
[0, 9]
5,949,180
5,949,181
show Label Back Color Name on Item Click
<p>I have a DataList with a Label which shows some colors for a Product. I want these Colors to be clicked and Print Name of the Color. Here is how i am showing colors using a DataList. When User Clicks a label The Name of the color should show(i.e Red, Black) and also go in the Database against that Product. Please Guide how i can Print the Name of the Color and also make this a Clickable Label inside DataList. Thanks in Advance</p> <pre><code>&lt;asp:DataList runat="server" ID="dtlcolor" DataSourceID="SqlDataSource1" RepeatColumns="3" RepeatDirection="Horizontal"&gt; &lt;ItemTemplate&gt; &lt;asp:HiddenField runat="server" ID="lblcolorID" Value='&lt;%# Eval("ID") %&gt;' /&gt; &lt;asp:Label runat="server" ID="lblcolor" Width="25px" Height="25px" BackColor='&lt;%# System.Drawing.ColorTranslator.FromHtml(Eval("Color").ToString())%&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/asp:DataList&gt; </code></pre>
c# asp.net
[0, 9]
1,007,115
1,007,116
Find whether an element contains in a jquery selector
<p>Let say I have, </p> <pre><code>&lt;a id="a123"&gt;&lt;/a&gt; </code></pre> <p>Now I need to check whether $("a") selector contains $("#a123") element.</p>
javascript jquery
[3, 5]
5,000,634
5,000,635
Java Protected method in an Interface?
<p>i am trying to create a interface where its methods are protected or only visible to the class that implements it.</p> <p>The issue is this. i have two classes that do more or less the exact same thing but with different parameters and behaviour, but the actual steps it takes is identical.</p> <p>i was thinking ok i have two similar classes so lets just create a interface that both these classes implement. Should be ok right? well it is. it does the job but with a serious flaw, All and i mean all of the methods it overrided in these two classes are now visible to the naked eye.</p> <p>They can be accessed as they are defined "public". there goes encapsulation :(</p> <p>Another solution i thought of was using a abstract class but wait, you can only extend one abstract class and the two classes i am using already extend a class(in my case a android Service class) so out goes that idea too.</p>
java android
[1, 4]
2,762,817
2,762,818
Get the value of a hidden column in a gridview with javascript
<p>I have a function (below) that works wonderful but now I need to hide the column 'CustomerID' which gives me the value for var CustomerID = grid.rows[i].cells[1].innerText; If I hide this column the function no longer works well it works but it's grabbing the wrong value. Can anyone help with this?</p> <p>The hidden field looks like this...</p> <pre><code>&lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:Label id="lblCustomerId" runat ="server" text='&lt;%# Eval("CustomerID")%&gt;'/&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>function:</p> <pre><code>function mapSelectedClick() { var customerIDs = ""; var grid = document.getElementById('&lt;%=grdCustomers.ClientID %&gt;'); var count = 0; for (var i = 1; i &lt; grid.rows.length; i++) { var cell = grid.rows[i].cells[0]; var CustomerID = grid.rows[i].cells[1].innerText; for (var j = 0; j &lt; cell.childNodes.length; j++) { if (cell.childNodes[j].type == "checkbox") { if (cell.childNodes[j].checked) { customerIDs += CustomerID.toString() + ','; count++; } } } } if (count == 0) { alert("Please select at least one customer to map."); return false; } customerIDs = customerIDs.substring(0, customerIDs.length-1); window.open("MapCustomers.aspx?CustomerIDs=" + customerIDs); } </code></pre>
javascript asp.net
[3, 9]
3,595,360
3,595,361
Loading message and setTimeout
<p>I have the following script:</p> <pre><code>$(function() { $(".message").hide(); function simulate_ajax_call() { $.ajax({ url: "/echo/json/", success: function(){ alert("done"); $(".message").empty().html("done"); $(".message").delay(1000).fadeOut(500); } }); } $('.button').click(function() { $(".message").fadeIn(500); setTimeout("simulate_ajax_call()", 5000); }); }); </code></pre> <p>With the following HTML:</p> <pre><code>&lt;input type="button" value="button" class="button" /&gt; &lt;div class="message"&gt;loading...&lt;/div&gt; </code></pre> <p>For some reason the <code>setTimeout</code> part is not working. i.e. it does not seem to call the function after 5000ms.</p> <p><a href="http://jsfiddle.net/oshirowanen/kHEVa/" rel="nofollow">jsFiddle</a>.</p>
javascript jquery
[3, 5]
440,639
440,640
Margin/Padding of the stars in a RatingBar (or position and size)?
<p>I try to make an custom RatingBar for my Application which has a different image for each of the 4 stars. With the following onDraw method it works quite good on my mobile.</p> <pre><code>public class MyBar extends RatingBar { private int[] starArrayColor = { R.drawable.star_1_color, R.drawable.star_2_color, R.drawable.star_3_color, R.drawable.star_4_color }; private int[] starArrayGrey = { R.drawable.star_1_grey, R.drawable.star_2_grey, R.drawable.star_3_grey, R.drawable.star_4_grey }; (...) @Override protected synchronized void onDraw(Canvas canvas) { int stars = getNumStars(); float rating = getRating(); float x = 10; for (int i=0;i&lt;stars;i++) { Bitmap bitmap; Resources res = getResources(); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setDither(true); if ((int) rating-1 == i) { paint.setAlpha(255); bitmap = BitmapFactory.decodeResource(res, starArrayColor[i]); } else { paint.setAlpha(70); bitmap = BitmapFactory.decodeResource(res, starArrayGrey[i]); } Bitmap scaled = Bitmap.createScaledBitmap(bitmap, 75, 75, true); canvas.drawBitmap(scaled, x, 12, paint); x += 96; } } } </code></pre> <p>But the "calculation" of the x/y position and size of the images suc*s! Its just trial and error to get the right coordinates...</p> <p>How can I calculate the position/size etc. to get it working properly on every device?</p> <p>In the sources of AbsSeekBar/Progressbar I have found variables called mPaddingTop, mPaddingBottom etc. Is there a way to get those values?</p>
java android
[1, 4]
4,030,432
4,030,433
extract the ajax response in jQuery?
<p>How can i extract the returned response of the ajax response? to catch the response i should write:</p> <pre><code>$.post('server.php',{x : 9}, function(response){ alert(response); }); </code></pre> <p>Now, how can i take the " response " out of the function(){} ?, because it doesn't exist outside .. and i wanna compare it with some other value, i attempted to assign it to a global var and to a jQuery object " $response ", but it always "undefined" while the " response " it self have the correct value !.. Generally i want it this way, if possible :)</p> <pre><code>response= $.post('..',{.. : ..}); </code></pre> <p>Thanks in advance :)</p>
javascript jquery
[3, 5]
329,712
329,713
jQuery ajax load a page with an automatic download
<p>I have a page that produces a PDF and automatically downloads the file. </p> <p>I have to submit some variables to the page for the PDF be produced. Right now I have it submitting a form using jQuery like this <code>$("#expForm").submit();</code>. I am submitting form jQuery because I have to apply some logic before the form is submitted.</p> <p>This works fine and a PDF pops up right away.</p> <p>The problem is I need to have some sort of loading icon come up because the exporting page loads a lot of data and I do not want to confuse the user.</p> <p>I tried doing this using <code>$.post('exp.html', $("#expForm").serialize() ,function(data) {});</code></p> <p>The export page loads but it does not pop up the PDF. If I open the link from Firebug's console the PDF then loads.</p> <p>Does anyone know of a way to make it auto download the PDF with using the <code>$.post()</code></p> <p>Any help on this would be great. Thanks</p>
javascript jquery
[3, 5]
4,963,033
4,963,034
How can stop change event?
<pre><code>var InDate = trim($(".inDate").val()); if (InDate == '') { $(".inDate").val(dateDisplayFormat); } //Bind date picker daymarker.bindElement(".inDate", { onSelect: function(date) { $(".inDate").trigger('change'); }, dateFormat:jsDateFormat }); $(".inDate").change(function() { //some validation functions are called here. }); </code></pre> <p>Lets say that i have two rows with indate and outdates.</p> <p>for example:</p> <pre><code>Indate outDate 2011-02-20 2011-02-24 2011-02-25 2011-02-27 </code></pre> <p>so when i change the first date using the date picker indate change will be called twice.so because of the it is not possible to give the validation message.Lets say my first date is wrong.and second date is correct.because of that validation message will get hidden.</p> <p>Is there a way that i can stop the second trigger if the first date is wrong???</p>
javascript jquery
[3, 5]
2,769,851
2,769,852
extract and show album art of mp3 file in android
<p>I'm trying to implement a small mp3 player on android. So far so good, but I cant implement the following feature:</p> <p>When playback of the file starts, check the file, get the artwork and display it. (the artwork is embedded)</p> <p>I've seen several libraries which claim to be capable of doing so, but I did not manage to implement it. (jaudiotagger, jid3)</p> <p>Did somebody ever implement this and can show me some code?</p> <p>Thank, Nico</p>
java android
[1, 4]
2,565,132
2,565,133
remembering what $(this) is
<p>I have the following script which changes a jquery made object's color to blue:</p> <pre><code>$(".objects_list").live('click', function(event) { $(this).css("color", "blue"); }); </code></pre> <p>How do I remember what $(this) is so I can change the color again but from a different function or from an event of a different object?</p>
javascript jquery
[3, 5]
4,384,347
4,384,348
Button updates its own OnClientClick and then executes that?
<p>I am a .NET newb so please bear with me.</p> <p>I am working on an online store. It requires the visitor to choose quantities they want and then click a button to choose a date for those items (tours). </p> <p>I have two buttons - one reads their choices and updates the OnClientClick value of the other and when that one is clicked it executes a popup. The project requires me to do the whole process with just one button. Here's the rough outline of the particulars:</p> <p>Setup button:</p> <pre><code> //Calculates parameters to send to popup based on control contents. public void btnSetup_Click(object sender, EventArgs e) { StringBuilder sbParams = new StringBuilder(); TotalQty += basketItem.Quantity; Sku = variant.Sku; sbParams.Append(string.Format("?sku={0}&amp;Qty={1}",Sku.Substring(0,4),TotalQty)); popup = string.Format("window.open('http://somesite.ocm/cal.asp{0}','Reservation Calendar','width=265,height=465')",sbParams.ToString()); btnCalendar.OnClientClick = popup; } </code></pre> <p>Calendar button:</p> <pre><code> // Shows popup via OnClientClick public void btnCalendar_Click(object sender, EventArgs e) { AddPopup.Show(); } </code></pre> <p>It works fine as a two-step process, click Setup and then click Calendar buttons. If I move the setup code into the calendar routine it fails. I'm sure this is because the Calendar button's OnClientClick is not set when it is clicked.</p> <p>What is a best-practices type of way to do this without restructuring the whole program. As I'm new to .NET programming I don't want to wreck the thing.</p>
c# javascript asp.net
[0, 3, 9]
4,722,870
4,722,871
How can I pass a variable as the value for jQuery .attr?
<p>Using <a href="http://api.jquery.com/attr/" rel="nofollow">jQuery attr()</a> what would be the proper syntax to pass a variable in as the value. What I am trying to do is :</p> <pre><code>var under700 = 'image.jpg' $('.two_images img').attr('src', (under700) ); </code></pre> <h2>Edit</h2> <p>Judging from the responses, I may have oversimplified this. Here is the rest of the function if that adds any clarity.</p> <pre><code> $(document).ready(function() { function imageresize() { var contentwidth = $('#two_up').width(); var under700 = '&lt;?php bloginfo('template_url'); ?&gt;/scripts/timthumb.php?src=&lt;?php echo $image_img_tag[0] ?&gt;&amp;w=340' if ((contentwidth) &lt; '700'){ // I also tried defining the variable here $('.two_images img').attr('src', under700 ); } else { // this one works fine $('.two_images img').attr('src','&lt;?php echo $image_img_tag[0] ?&gt;'); } } imageresize();//Triggers when document first loads $(window).bind("resize", function(){//Adjusts image when browser resized imageresize(); }); </code></pre>
javascript jquery
[3, 5]
5,752,155
5,752,156
Implementing Voting Up and Down Arrows
<p>I am looking for a method in which allows a user to press up and down on two sets of arrows like the ones here and a number gets implemented within. When user presses on the up arrow they get a positive number and when the user presses down they get a negative number exactly like the ones here. </p> <p>Are there any examples like this online? I have looked at the jQuery libraries and could not find anything. </p> <p>How can this be done?</p>
jquery asp.net
[5, 9]
2,485,959
2,485,960
Is there a way to hide javascript code?
<p>I have this script that starts with <code>&lt;script&gt;</code> and finishes with <code>&lt;/script&gt;</code></p> <p>People can actually see it if they go to the source code of the page.</p> <p>Is there a way to avoid that? I mean to make that code invisible as if it where PHP?</p>
php javascript
[2, 3]
3,923,863
3,923,864
Get auto incremented div id so that it can be used with ajax to return a value back to php
<p>Using mysql_query results to create an html form like below with auto incremented prefixed value for div ids: </p> <pre><code>&lt;div id="favorite'.$count.'"&gt; &lt;form action="javascript:void(0);" method="post"&gt; &lt;input type="hidden" name="sec" value="'.$ident_inpt.'"/&gt; &lt;input type="hidden" name="t" id="t'.$count.'" value="mo-'.$usr.'-'.$rmid.'-'.$_SESSION['STORE'].'"/&gt; &lt;input type="submit" value="'.$lang['590'].'" class="favorites" onclick="upd_favorite();"/&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>How can I get the ids of favorite### and t### so that I can get the loop going?</p> <p>I use this but only works with static ids:</p> <p><code>$('#favorite').html(ajaxRequest.responseText);</code></p> <p>and: <code>var addit = document.getElementById("t").value;</code></p> <p>Thanks in advance for any suggestion.</p>
javascript jquery
[3, 5]
4,121,761
4,121,762
How do I reference the "title" given the id?
<pre><code>var data = {}; data.event = [ { "id":"998", "title":"Foo", "thumb":"", "source":"" }, { "id":"999", "title":"Bar", "thumb":"", "source":"" } ] </code></pre> <p>Given that id=998 I need to extract the value of the "title" and I'm a bit lost as to the proper syntax.</p>
javascript jquery
[3, 5]
3,158,312
3,158,313
jQuery ajax on multi-step form
<p>Hi everyone I'm trying to incorporate jQuery AJAX on my multi-step form so that it updates a certain div to the one on the process.php page but it keeps loading the results on a new page. How can I get it to update the div without refreshing the page?</p> <p>This is the jQuery code I'm using:</p> <pre><code>$.ajax({ url: 'process.php', data: $('form[name="booking"]').serialize(), dataType: 'html', type: 'POST', success: function(data) { // this is the bit that needs to update the div $('#last-step').fadeOut(300, function() { $('#result').html(data).fadeIn(300); }, complete: function (data) { // your code here }, error: function (url, XMLHttpRequest, textStatus, errorThrown) { alert("Error: " + errorThrown); } }); </code></pre> <p>This is the code for my multistep form: <a href="http://jsfiddle.net/xSkgH/47/" rel="nofollow">http://jsfiddle.net/xSkgH/47/</a>.</p> <p>Many thanks in the advance</p>
php jquery
[2, 5]
287,677
287,678
Jquery Div sort and order =)
<p>The problem i have is i need to group certain divs together and reorder them, and if it was all animating it would be cool. Please see below:</p> <pre><code>&lt;div id="away"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="offline"&gt;Some Content&lt;/div&gt; &lt;div id="away"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="offline"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="away"&gt;Some Content&lt;/div&gt; </code></pre> <p>So i kinder need to group the id’s together the order by: 1.online 2.away 3.offline</p> <p>So:</p> <pre><code>&lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="online"&gt;Some Content&lt;/div&gt; &lt;div id="away"&gt;Some Content&lt;/div&gt; &lt;div id="away"&gt;Some Content&lt;/div&gt; &lt;div id="away"&gt;Some Content&lt;/div&gt; &lt;div id="offline"&gt;Some Content&lt;/div&gt; &lt;div id="offline"&gt;Some Content&lt;/div&gt; </code></pre> <p>I can't seem to get my head arround this one =(.</p> <p>I'm using Jquery on the rest of the site.</p> <p>Any ideas =), Cheers, Sam T</p>
javascript jquery
[3, 5]
5,848,811
5,848,812
add incrementing class to images inside a div
<p>Okay I dont think anyone has covered this yet.</p> <p>I have a div with x amount of images inside it. I need to add the class 00x to each image where the x starts at 1 and goes up everytime for each image. I have tried doing this with a for in statement however cant seem to make it work. I am using the jquery library so feel free to suggest jQuery related fixs. Here is my html:</p> <pre><code>&lt;div id="fixed"&gt; &lt;img src="/prodimages/Ad060-2.jpg" /&gt; &lt;img src="/prodimages/Ad060-2.jpg" /&gt; &lt;img src="/prodimages/Ad060-2.jpg" /&gt; &lt;/div&gt; </code></pre> <p>so I need it to select all images inside #fixed and then add the class 00 + i where i++ for each image. I need something like a php foreach. I dont really understand how for in works.</p> <p>Please advise. :)</p>
javascript jquery
[3, 5]
4,505,966
4,505,967
javascript file is returning an error log that Im not sure about
<p>One of my javascript files is returning an error log on the following line</p> <pre><code>if(strinput.indexOf('&lt;?')&gt;-1||strinput.indexOf('!xml')&gt;-1||strinput.indexOf('xml')&gt;-1) </code></pre> <p>and the error is</p> <pre class="lang-none prettyprint-override"><code>[20-Apr-2012 14:06:32] PHP Parse error: syntax error, unexpected '!' in /home6/mywebsite/public_html/phpspellcheck/include.js on line 295 </code></pre> <p>but if I remove the ! the error changes to</p> <pre class="lang-none prettyprint-override"><code>[20-Apr-2012 14:15:40] PHP Parse error: syntax error, unexpected T_STRING in /home6/mywebsite/public_html/phpspellcheck/include.js on line 295 </code></pre> <p>Any help would be very appreciated. Thanks in advance.</p>
php javascript jquery
[2, 3, 5]
2,320,395
2,320,396
Javascript wrong alert order
<p>I have a javascript call like this:</p> <pre><code>usernameTest('queijo'); alert('a'); </code></pre> <p>The function <code>usernameTest()</code> is working and, for debugging, it alerts the string "t" or "f".</p> <p>Why, when I load this page, the first alert shown is "a" and only after "t" or "f"? (Btw, jQuery is loaded into the page too.)</p> <p>[EDIT]</p> <p>Source Code:</p> <pre><code>function usernameTest(username) { var unReg = /^[0-9a-zA-Z_]{1,20}$/; if(!unReg.test(username)) return false; $.ajax({ type : 'POST', url : 'checkuser.php', data : 'username=' + username, cache : false, success : function(response) { if(response == 1) { alert('f'); return false; } else { alert('t'); return true; } } }); } </code></pre> <p>[EDIT2]</p> <p>I already know the problem is that is calls AJAX. The new main question is now another. I'm calling it like that (in the proper place, not the code for debugging);</p> <pre><code>if(!usernameTest(argument)) //do something </code></pre> <p>How can I do something like this?</p>
javascript jquery
[3, 5]
2,352,413
2,352,414
Javascript demo hosting
<p>I have a blog <a href="http://justgagan.wordpress.com/" rel="nofollow">http://justgagan.wordpress.com/</a>, where I want to show some demo of my javascript's scripts. I know I could do this with tweaking my example for WordPress, but it will increase my pages load time, since I had to add this on body. Is there any site, which could host my example in raw form and provides Apis for embedding that example in my blog. Link would also work for me.</p>
javascript jquery
[3, 5]
771,479
771,480
Cannot use php tag in javascript tag
<p>I'm trying to use php tag in a javascript function. But unfortunately its not working. I even used <code>&lt;?php</code> but still not working. I checked php.ini file and there the short tag is already enabled.</p> <p>Any sort of suggestion will be appreciated. </p>
php javascript
[2, 3]
3,271,044
3,271,045
Best way to incorporate javascript in php?
<p>This is the way I am currently doing it. </p> <pre><code> &lt;?php //show footer echo "&lt;script type='text/javascript'&gt;\n"; echo "alert('Congrats');\n"; echo "&lt;/script&gt;"; ?&gt; </code></pre> <p>Is there a better way than just to echo it?</p>
php javascript
[2, 3]
163,217
163,218
ASP.Net codebehind can't access component from page?
<p>For an unknown reason, I have 1 page that I can't access by ID to any of the component.</p> <p>Here is some informations. The page use asp:Content because the website use MasterPage. Inside the asp:Content, this page has a asp:FormView with some data that I cannot access from the CodeBehind.</p> <p>Here is the Page declaration:</p> <blockquote> <p>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="InfoAccount.aspx.cs" Inherits="Private_InfoAccount" MasterPageFile="~/MasterPagePrincipal.master" %></p> </blockquote> <p>Here is the code in the page behind that doesn't compile :</p> <pre><code>protected void FormView1_PreRender(object sender, EventArgs e) { DateBirthdayValidator.MaximumValue = DateTime.Now.Date.ToString("dd-MM-yy"); } </code></pre> <p>Here is the error : </p> <blockquote> <p>Error 2 The name 'DateBirthdayValidator' does not exist in the current context</p> </blockquote> <p>I have search in google, I got some answer about using FindControl but it doesn't work. Any idea?</p> <h2>Edit1:</h2> <p>I can access the FormView1 component but no the validator inside the EditItemTemplate. How can I access control that is inside the EditTemplate?</p> <h2>Edit2:</h2> <p>If I try: <code>FormView1.FindControl("DateBirthdayValidator")</code> it compile but always return null. So still doesn't work but at least I can access the FormView1...</p>
c# asp.net
[0, 9]
2,647,636
2,647,637
Exchanging messages between UI Thread and Background Networking Thread
<p>I am currently working on an android app just for personal use. The app communicates with a server by TCP sockets. If the user makes an input it needs to be sent immediately. Also there can be messages from the server at any given time which need to be shown on the UI. For all the networking stuff I have a background thread in mind.</p> <p>Since I need to pass messages From the UI to the networking thread at any user input and also messages from the networking thread to the UI at any given time my question follows: How can I pass the messages? I already read about the Handler class for 3hours and I couldn't figure out anything. How do handlers work? What would be a neat and smooth running implementation of that? I look more for a strategy to accomplish this goal, not necessarily implementation details.</p> <p>Thank you so much in advance!</p>
java android
[1, 4]
16,506
16,507
How to update drop down values with postback(Client Side) in asp.net c#
<p>I have one radio button list and one drop down list inside the modal popup extender in my asp.net web application.Two radio buttons are there in the radio button list such as r1,r2. Drop down list having values like A,B,C,D,E,F. I need when I select r1 it will fills the values A,B,C in the Drop down list. When I select r2 it will fills the values E,F in the drop down. But one condition the page will not to be post pack. Can any one know the solution for that problem? I will really helpful for my project.</p> <p>Thank you...</p>
c# asp.net
[0, 9]
1,311,263
1,311,264
PHP convert javascript when echo
<p>I have following PHP echo statement:</p> <p><code>echo "&lt;td&gt;&lt;a href='delete-news.php?deleteID=".$id." onclick='return confirm('Really delete?');'&gt;Delete&lt;/a&gt;&lt;/td&gt;"; </code></p> <p>which is convert to html as: </p> <p><code>&lt;td class="last-td nth-8"&gt;&lt;a delete?');'="" confirm('really="" return="" href="delete-news.php?deleteID=5 onclick="&gt;Delete&lt;/a&gt;&lt;/td&gt;</code></p> <p>As you can see something has gone wrong? What is the problem? I have already tried swaping <code>" "</code> for single <code>' '</code>.</p>
php javascript
[2, 3]
5,677,618
5,677,619
The server tag is not well formed.(databinder.eval)
<p>I am trying to working the following code.</p> <pre><code> &lt;asp:DataGrid ID="Grid" runat="server" DataKeyField="KeyID" CssClass="grid" ... &lt;asp:CheckBox runat="server" ID="checkBox-&lt;%#DataBinder.Eval(Container.DataItem,"KeyID")%&gt;" AutoPostBack="false"&gt;&lt;/asp:CheckBox&gt; </code></pre> <p>When I run the code,I have got the below error:</p> <pre><code>Error 25 The server tag is not well formed. </code></pre> <p>Note : This is working without runat="server". What is the remedy for this problem ?</p>
c# asp.net
[0, 9]
2,606,725
2,606,726
use jQuery to ask if div got a background image?
<p>Is it possible to use jQuery to check if #page has got a background image - #page could look like this:</p> <pre><code>&lt;div id="page" style="background-image: url(xxx)"&gt;&lt;/div&gt; </code></pre> <p>if it contains a background image, it should add a class to #page</p>
javascript jquery
[3, 5]
3,157,092
3,157,093
How to fetch Android Market data when there is no API?
<p>As far as I can tell, there is no API (official or unofficial) to access information about Apps on the Android Market (info such as Title, Icon, Description, Downloads, Comments, etc..) However, there are a few <a href="http://androidstats.com/" rel="nofollow">websites</a> that have managed to compile this information anyway.</p> <p>My question is: How is this being done?</p> <p>A couple of guesses.</p> <ul> <li>Manually (not likely, due to volume)</li> <li>Implemented the protocol used by the official app (by decompiling or observing packets)</li> <li>Running some kind of debugger with the official app to extract the live data</li> <li>Using some kind of automation + screen shots + text recognition (seems complicated)</li> <li>Modifying the (open) source to write a log file</li> </ul> <p>I'm just curious how this was done because I sure can't figure it out. Thanks. </p>
java android
[1, 4]
5,557,934
5,557,935
How to dynamically show further information with jQuery and PHP?
<p>I have list of courses from MySQL and when I click the course it should display the correct course description to the right and again when I click the next course, the previous should hide and get the current click course description, Here is the code I did</p> <p>jQuery</p> <pre><code>$(document).ready(function() { $("#toggle_value").click(function(){ $("$courseid").show("slow"); }); }); </code></pre> <p>PHP Code</p> <pre><code>$cour = get_records_sql('SELECT c.id, c.summary FROM mdl_course c'); echo '&lt;table style="background:white;border:2px solid blue"&gt;'; foreach($cour as $cou) { $coursename = $cou-&gt;fullname; $summary = $cou-&gt;summary; echo '&lt;tr style="border:1px solid #BACC82;"&gt; &lt;td&gt;&lt;div class="toggle_button"&gt;&lt;a href="javascript:void(0);" id="toggle_value"&gt;'.$coursename.'&lt;/a&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; &lt;div id="div1" style="display:none;top:440px; border:0px solid #000;float:right;background-color:white; padding:5px;"&gt; } echo '&lt;/table&gt;'; </code></pre>
php jquery
[2, 5]
5,281,280
5,281,281
A asp.net page that tracks changes of a web page?
<p>An asp.net page that tracks a web page changes. and if any changed occurred then it should send mail to my mailbox which I have configured using smtpclient.</p> <p>I've coded for this task, but don't know where to place the code which section is executed always? Is there any possibility for this? </p> <p>If not, then this page should be opened (viewed) always(24x7) or is there any way to open my asp.net page in the server?</p>
c# asp.net
[0, 9]
4,597,258
4,597,259
how to show random values in textarea, such as every time page load it will show different message in a textarea
<p>how to show random values in textarea, such as every time page load it will show different message in a textarea with jquery. i have a list of phrases and i want to load each phrase in textarea on page load.</p>
php jquery
[2, 5]
1,282,695
1,282,696
Find control from html to c# in asp.net
<p>I have problem that how to get html control id in c# code behind page.?? thanks in advance......</p>
c# asp.net
[0, 9]
4,854,395
4,854,396
Get ClientID in Javascript
<p>I have a javascript file that Select a button using jQuery and check it for validation.the code is:</p> <pre><code>$(document).ready(function () { $('#&lt;%= btn_Insert.ClientID %&gt;').on("click", function (event) { if (Validate() != true) { event.preventDefault(); } }); function Validate() { return (1 == 1); }); </code></pre> <p>but I can' get <code>ClientID</code> for button and I get this Error:</p> <blockquote> <p>Object doesn't support this property or method</p> </blockquote> <p>where is my mistake?How I can get Client ID for a server side Button?</p> <p>thanks</p> <p><strong>EDIT 1)</strong></p> <p>When I add script in <code>head</code> part of page it works but when I write it to a JS file and add reference to it in <code>head</code> part it does not work</p>
javascript jquery asp.net
[3, 5, 9]
3,349,846
3,349,847
Deciding on User Control to Use at Runtime
<p>I have 2 user controls defined on a page:</p> <pre><code>&lt;%@ Register Src="Foo.ascx" TagName="FooControl" TagPrefix="acme" %&gt; &lt;%@ Register Src="Bar.ascx" TagName="BarControl" TagPrefix="acme" %&gt; . . . &lt;acme:FooControl ID="myFoo" runat="server" Visible="false" /&gt; &lt;acme:BarControl ID="myBar" runat="server" Visible="false" /&gt; </code></pre> <p>At runtime, I'd like to set one of the user control's properties in various locations in the page's code. For example:</p> <pre><code>protected void SomeMethod() { if (isSomeCondition) { myFoo.Visible = true; } else { myBar.Visible = true; } // ... if (somethingElse) { if (isSomeCondition) { myFoo.Prop1 = 123; } else { myBar.Prop1 = 123; } } // ... } </code></pre> <p>I know that I can have the 2 user controls inherit from a common Interface, but is there another (possibly better) way?</p>
c# asp.net
[0, 9]
5,280,481
5,280,482
how to get the rating value on click on stars
<p>i am using jquery rating plugin. in all examples they have a submit button near to rating stars. so that submit button do this.form.serialize. but i want to save the rating to db without clicking on the submit button. i am not giving submit button to users. if anybody has done this already can you help me please. these are the jquery examples.</p> <p><a href="http://www.fyneworks.com/jquery/star-rating/#tab-Testing" rel="nofollow">http://www.fyneworks.com/jquery/star-rating/#tab-Testing</a></p>
javascript jquery
[3, 5]
1,807,536
1,807,537
Check the current Row is a data row or not
<p>I have a gridview with 10 rows i am displaying 6 rows in each page i have a text box and and image button in each row when i click the image button all the functionalities are working but when i click the page index it is displaying an error in row command how can i check whether the row type is data row or not in gridview row command event. the code that i am using is as follows</p> <pre><code>protected void gvgridview1_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow gvRow = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer); TextBox txtgvGroupName = (TextBox)gvRow.FindControl("txtgvGroupName"); ImageButton imgbtn = (ImageButton)gvRow.FindControl("imgbtn"); if (e.CommandName == "Edit") { imgbtn.Visible = false; } } </code></pre>
c# asp.net
[0, 9]
2,643,920
2,643,921
How to know if a Date is within the same day of other date
<p>If I have a two Dates in Java (Android) (Date1 and Date2), how can I know if the Date2 is within the same day of the Date1? (Note: not if the Date2-Date1 &lt; 24 hours). Some examples (suppousing same month and year)</p> <pre><code> Date1: day=14 hour=00:00 Date2: day=14 hour=00:00 --&gt; Result TRUE Date1: day=13 hour=23:59 Date2: day=14 hour=00:00 --&gt; Result FALSE Date1: day=14 hour=05:00 Date2: day=14 hour=00:00 --&gt; Result TRUE Date1: day=14 hour=00:00 Date2: day=15 hour=00:00 --&gt; Result FALSE </code></pre> <p>Thanks</p>
java android
[1, 4]
2,178,759
2,178,760
Member method consting in Java?
<p>In C++, a member method can be const if it does not modify the class. For example:</p> <pre><code>class Foo { public: float getValue() const; }; </code></pre> <p>Is there something similar I must do in Java classes? How exactly does consting work in Java? (Aside from adding the final keyword before a member variable declaration and initializing it)</p> <p>Thanks</p>
java c++
[1, 6]
1,794,666
1,794,667
Select by next instance of class with jQuery
<p>I'm looking to convert a function that selects by id to select the next instance of a given class. </p> <p>Here is the code.</p> <pre><code>function swap3(oldDivId, newDivId) { var oldDiv = document.getElementById(oldDivId); var newDiv = document.getElementById(newDivId); oldDiv.style.display = "none"; newDiv.style.display = "block"; } </code></pre>
javascript jquery
[3, 5]
4,287,125
4,287,126
How can i parseFloat a php var inside javascript
<p>I need to parseFloat this then to replace the dot with a comma:</p> <pre><code>sum="&lt;?php echo substr($_tarif_membre,0,-2).'.'.substr($_tarif_membre,-2,2) ?&gt;" * $('#tarif_membre').val() total_total= sum.replace('.',',') $('#total_total').val(sum) </code></pre> <p>if i dont multiply the php echoed variable by <code>$('#tarif_membre').val()</code> it will still show the result as a float:12.00 (as it is echoed from php) but if i multiply by <code>$('#tarif_membre').val()</code> the result will show 12, why? and why does the replace method does not work(i need to show comma separated values)</p>
php javascript
[2, 3]
268,176
268,177
Loading welcome animation only once jquery/php
<p>In my site i have a welcome animation (created with jquery) which runs when any one opens my website (<strong>www.mysite.com</strong>). Then the same user going to anther page in my site for example <strong>www.mysite.com/about</strong> then click back to home (<strong>www.mysite.com</strong>) the animation again shows up. How can i restrict this ?</p> <p>Share some logic like putting a session or settimeout or something like that.</p>
php jquery
[2, 5]
168,496
168,497
Jquery plugin not working
<p>I am very new to jQuery. I am trying to use a plugin called Searchable Dropdown, that I got from here: <a href="http://jsearchdropdown.sourceforge.net/" rel="nofollow">http://jsearchdropdown.sourceforge.net/</a> . but I cannot figure out how to make it work.. What am I doing wrong?</p> <pre><code>&lt;head&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" &gt;&lt;/script&gt; &lt;script src="scripts/jquery.searchabledropdown-1.0.8.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script&gt; $(document).ready(function() { $("select").searchable(); }); &lt;/script&gt; &lt;/head&gt; &lt;?php echo "&lt;form method='post' action='' id='employeesselection'&gt; &lt;select name='select_employee' id='select_employee'&gt;"; while($row=mysql_fetch_array($employees)){ $selected = ($row['Id'] == $_POST['select_employee'])?'selected="selected"':''; echo '&lt;option '.$selected.' value="'.$row['Id'].'"&gt;'.$row['Etunimi'].' - '. $row['Sukunimi'].'&lt;/option&gt;'; } echo "&lt;/select&gt;&lt;/form&gt;"; </code></pre> <p>The select is working fine but searching in the select as the jQuery should enable, is not working.</p>
php jquery
[2, 5]
2,688,081
2,688,082
how to maintain timestamp in various countries
<p>I have a problem with timestamp.Let me tell you suppose a user uploads a picture somewhere in USA at 4.30 am and if another user sees this picture in japan.It would show 4.30 am as the date saved in database would be 4.30 am but it should be 4.30 pm to the japanese people, as they are 12 hours faster than america.</p> <p>So I was thinking to get the current server time using php lets say it is <code>a</code>and also get the current time of user using javascript functions say it is <code>b</code> and then find the difference between <code>b</code> and <code>a</code> and that result should be added to the date stored in the database.</p> <p>so server may show 4.30 am and js function gives 4.30 pm it would give 12 hrs difference so this 12 hrs should be added to the date saved in the database.This is what i thought of doing but im not sure if there are any inbuilt plugins in doing the task because every site will be using this type of feature may be they might be using someones open source code.</p> <p>Also there might be any other better solutions? kindly let me know if there is any other way to do? and is my algorithm is right? i was thinking it is little bit time consuming getting the difference and adding those to all the posts would be little time consuming but let me know it please.any help is greatly appreciated.Thanks</p>
php javascript
[2, 3]
669,458
669,459
using an asp.net literal inside the <title> element
<p>This is such a simple scenario that I can't see what can possibly be going wrong. I'm using asp.net 4.0 (haven't tried older versions)</p> <pre><code>&lt;title&gt;Welcome to Page: &lt;asp:Literal ID="Literal1" runat="server"&gt; &lt;/asp:Literal&gt;&lt;/title&gt; </code></pre> <p>When the page is rendered, the title comes out as just the contents of the literal control without the "welcome to page" text in it. If you don't believe me, try it for yourself</p> <p>Can anyone explain?</p> <p>Andy</p>
c# asp.net
[0, 9]
4,600,779
4,600,780
What's the best JQuery book?
<p>I am a good javascript/asp.net developer, but i am just starting to learn JQuery, Whats the best book to learn JQuery? Books i like their style: Complete reference How to program</p>
javascript jquery asp.net
[3, 5, 9]
1,819,967
1,819,968
Can't loop through elements created by jquery
<p>I've added a bunch of links to a div like this:</p> <pre><code>$('#links').append('&lt;a href="http://example.com/"&gt;Example&lt;/a&gt;'); </code></pre> <p>But when I try to loop through them with <code>$('#links a').each</code> it only finds the links that are already there in the HTML.</p> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
3,746,921
3,746,922
Getting part of referring url with jquery
<p>I'm trying to set a cookie with a value that is made up of part of a referring url. The referring url looks something like:</p> <pre><code>http://webct.university.ac.uk/webct/urw/lc715920578061.tp721521425061/courseMenu.dowebct? </code></pre> <p>and I need to extract:</p> <pre><code>lc715920578061.tp721521425061 </code></pre> <p>for reuse in another function. Would this be regex? Could anyone help with the syntax?</p> <p>Many thanks Matthew</p>
javascript jquery
[3, 5]
5,771,079
5,771,080
How to rewite javascript function with php
<p>I have a script.I will show sample.</p> <pre><code> &lt;form&gt; &lt;textarea id='input'&gt;&lt;/textarea&gt; &lt;input onclick="convert()" value="go function" /&gt; &lt;textarea id="output"&gt;&lt;/textarea&gt; &lt;/form&gt; &lt;script type="text/javascript" &gt; function convert() { src = document.getElementById("input").value; document.getElementById("output").value = Z1_Uni(src); } function Z1_Uni(input) { var output=input; var tallAA = "\u102B"; var AA = "\u102C"; var vi = "\u102D"; var ii = "\u102E"; var u = "\u102F"; var uu = "\u1030"; } &lt;/script&gt; </code></pre> <p>This sample will be show output result with javascript.I want to rewrite with php.</p> <p>sample is following.</p> <pre><code>&lt;form action="convert.php" method="post"&gt; &lt;textarea id="input" name="input"&gt;&lt;/textarea&gt; &lt;input type="submit" Value="go to convert page"&gt; &lt;/form&gt; </code></pre> <p>Convert.php</p> <pre><code>&lt;?php $input=$_POST['input']; $output=(?????????????? ); //(Here javascript function will be work.I want to know this step.) ?&gt; </code></pre> <p>Sample link is here <a href="http://mrdba.info/zawgyi-converter/" rel="nofollow">http://mrdba.info/zawgyi-converter/</a></p>
php javascript
[2, 3]
1,779,890
1,779,891
jQuery addEventListener not working as intended
<p>I have the following code:</p> <pre><code>$('.uiModalWrapper').live('click', function() { var modal = $(this).find('.uiModal'); modal.addClass('shake'); modal.addEventListener('webkitAnimationEnd', function() { modal.removeClass('shake'); }); }); </code></pre> <p>Which should add a class called shake to an element when it's clicked and then remove it again when the webkitAnimationEnd event takes place. However it causes an error <code>Uncaught TypeError: Object [object Object] has no method 'addEventListener'</code></p> <p>Any ideas on how to fix this? Thanks</p>
javascript jquery
[3, 5]
1,383,188
1,383,189
extract value from spinner and use it to calculations -- NullPointerException
<p>I want to use the "value" from the spinner.</p> <p>When the user makes the choice i want to use that value in order to do some calculations.</p> <p>My problem is :</p> <p>1) How to get properly the value (item).I am using sth like "item.MyOnItemSelectedListener ==0".</p> <p>2) What the value should be?For example ,above i have ==0 .This means the first choice from the spinner list?</p> <p>The code:</p> <pre><code>public class number_cores extends Activity implements OnClickListener { .. final Spinner spinner = (Spinner) findViewById(R.id.spinner); ... public void onCreate(Bundle savedInstanceState) { .... //spinner-drop_list ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( this, R.array.init_or_final, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new MyOnItemSelectedListener()); } ... public void cores_func(){ ... double fcores=0; MyOnItemSelectedListener obj=new MyOnItemSelectedListener(); if ( obj.getPosition()==0) fcores=initcores*Math.exp(-l*ttime); else if (obj.getPosition()==1) fcores=initcores/Math.exp(-l*ttime); ..} //spinner class public class MyOnItemSelectedListener implements OnItemSelectedListener { private int position; public int getPosition() {return position;} public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { position=pos; } public void onNothingSelected(AdapterView &lt;?&gt; parent) { // Do nothing. } } </code></pre> <p>Thanks!</p>
java android
[1, 4]
3,794,201
3,794,202
JQuery/PHP - Only showing a button for Administrator account
<p>I have a web site which allows users to logon to a control panel that allows users to change content of the web site.</p> <p>When creating the users you can set the account type: (PHP)</p> <p>i.e. <code>UserAccount::get_accounttype() == 1</code> full access</p> <p>and <code>UserAccount::get_accounttype() == 0</code> part access</p> <p>I have stopped access to certain pages by using a redirect as follows:</p> <pre><code>if (UserAccount::get_accounttype() == 0 { header("Locaction: webpage.php"); } </code></pre> <p>However on certain pages I am wanting to hide certain buttons so that users with <code>UserAccount::get_accounttype() == 0</code> can't use or see them.</p> <p>I am just wondering what the best way to achieve this would be?</p> <p>I know I can hide buttons in jQuery using <code>$('target').hide();</code> but how would I do this from a PHP function?</p>
php jquery
[2, 5]
2,479,630
2,479,631
Convert existing C++ (.h and .cpp) files to java for Android
<p>I am developing for Android under Eclipse. I have some c++ (.h and .cpp) files that I wish to use in my Android application. I have read <a href="http://home.pacifier.com/~mmead/jni/cs510ajp/index.html" rel="nofollow">Programmming in C/C++ with the Java Native Interface</a> and now I know how to make .so file and import it to Android. But the main problem is that:</p> <p><strong>Is there any tool that converts c++ (.h and .cpp) file to java style files which I can compile and create .so library ? I have heard about JNI - javah and javac can that tools help me and if they can so HOW ?</strong></p> <hr> <p><strong>Edited:</strong></p> <p><strong>javah is a useful tool that creates a C-style header file from a given class. The resulting header file describes the class file in C terms. Although it is possible to manually create the header file, this is almost always a bad idea. javah knows exactly how Java types and objects map into C types. For example, an int in Java maps to a long in C, and a long in Java maps to a 64-bit value, _int64, in native code. How to use this javah?</strong></p> <p><strong>Anybody have expiarance of how to use functions that are implemented in .so library in android application ? If anybody have code examples or useful articles links please give.</strong></p> <p>Thanks in advance !</p>
java c++ android
[1, 6, 4]
3,804,946
3,804,947
Triggering full screen in browser with JavaScript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1125084/how-to-make-in-javascript-full-screen-windows-stretching-all-over-the-screen">How to make in Javascript full screen windows (stretching all over the screen)</a> </p> </blockquote> <p>Currently I tried to do something like, when you click a fullscreen button current window will become full screen. I tried to use the following script, but it doesn't work. Any ideas on how to make this work?</p> <pre><code>&lt;script type="text/javascript"&gt; window.onload = maxWindow; function maxWindow() { window.moveTo(0, 0); if (document.all) { top.window.resizeTo(screen.availWidth, screen.availHeight); } else if (document.layers || document.getElementById) { if (top.window.outerHeight &lt; screen.availHeight || top.window.outerWidth &lt; screen.availWidth) { top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,688,003
1,688,004
Select next element in the page source using jQuery
<p>I have an arbitrarily deep list of the form:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I am trying to build a function "nextElement" that returns a jQuery selector.</p> <p>The first time the function is called, it returns the first li in the list. The second time it is called, it returns the next li in the page. Etc. </p> <p>I'd like this function to pay no attention to siblings, parents, children, etc. All I care about is that everytime it is called, the next li in the source gets chosen.</p> <p>Any suggestions on how to go about approaching this?</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,404,481
5,404,482
accessing an id within another id jquery
<p>Here's what I'm trying to do. I'm trying to get a block of code written in div then modify some of the div/id to different names and so I can send them to the form with unique names. Any ideas on how to do this? My idea right now is to first set the variable to to the div that I'm copying then access the other div's within it, but that doesn't seem to work. Any ideas?</p> <pre><code>var i = 0; $("#custom_rates").click(function() { var sublet_dates_seen = $("#sublet_dates_seen").clone(); // all id's below are within #sublet_dates_seen sublet_dates_seen.getElementById('#CustomPricePerNightPrice').attr('name','data[CustomPricePerNight][price][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateMonth').attr('name','data[CustomPricePerNight][start_date][month][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateDay').attr('name','data[CustomPricePerNight][start_date][day][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightStartDateYear').attr('name','data[CustomPricePerNight][start_date][year][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateMonth').attr('name','data[CustomPricePerNight][end_date][month][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateDay').attr('name','data[CustomPricePerNight][end_date][day][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightEndDateYear').attr('name','data[CustomPricePerNight][end_date][year][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightMinimumNights').attr('name','data[CustomPricePerNight][minimum_nights][' + i ']'); sublet_dates_seen.getElementById(('#CustomPricePerNightMaximumNights').attr('name','data[CustomPricePerNight][maximum_nights][' + i ']'); sublet_dates_seen.appendTo(".avi_specialrates"); i = i + 1; return false; }); </code></pre>
javascript jquery
[3, 5]
4,237,461
4,237,462
loop through numbered class and append shortened url
<p>I am using a bitly script to shorten urls and insert the resulits into a span tag.</p> <p>Using jquery, how would I loop through the following list ids and replace the long url with the shortened one.</p> <pre><code>&lt;ul class="vertical-list list-parent"&gt; &lt;li id="license_key_0"&gt; &lt;div class="primary two-quarter unit-link"&gt; &lt;span&gt;http://localhost:3000/projects/313f7f5586b39cd9bf7a894894564036&lt;/span&gt; &lt;/div&gt; &lt;/li&gt; &lt;li id="license_key_1"&gt; &lt;div class="primary two-quarter unit-link"&gt; &lt;span&gt;http://localhost:3000/projects/287a990d17b680fe410329cb95af89b9&lt;/span&gt; &lt;/div&gt; &lt;/li&gt; &lt;li id="license_key_2"&gt; &lt;div class="primary two-quarter unit-link"&gt; &lt;span&gt;http://localhost:3000/projects/ff381cdb94070e1903c5f6fddc31b148&lt;/span&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>The jquery:</p> <pre><code>(function ($j) { function get_short_url(long_url, login, api_key, func) { $j.getJSON( "http://api.bitly.com/v3/shorten?callback=?", { "format": "json", "apiKey": api_key, "login": login, "longUrl": long_url }, function (response) { func(response.data.url); }); } var login = "my_login"; var api_key = "my_api_key"; var long_url = "m"; get_short_url(long_url, login, api_key, function (short_url) { console.log(short_url); }); })(jQuery); </code></pre>
javascript jquery
[3, 5]
5,906,428
5,906,429
Do jQuery and JavaScript have different namespaces?
<p>I have this code in jQuery..</p> <pre><code>$(document).ready(function(){ var fieldCounter = 0; ... </code></pre> <p>I have a jQuery function that increments this value.</p> <p>This works, but I can't access this value on the page from a non-jQuery function? The reverse is also true, if I scope it in JavaScript e.g.</p> <pre><code>&lt;script type="text/javascript"&gt; var fieldCounter = 0; </code></pre> <p>I can access it from javascript but jQuery can't view it?</p> <p>I'm probably doing something really dumb?</p>
javascript jquery
[3, 5]
5,132,637
5,132,638
Javascript does not take hidden text box value?
<p>I am using this javascript function to show different popups if location count varies. Here the txthiddenloccount value is null if the txtbox's visibility is false. If the visibility is true, it works fine. What strange is this??? Can someone help me out. </p> <pre><code>function isPageValid() { var validated = Page_ClientValidate('groupProfile'); var loccount = document.getElementById("ctl00_ContentPlaceHolder1_txthiddenloccount").value; if(validated) { if(loccount == '1') { var mdlPopup = $find('&lt;%= ModalPopupExtendersavechanges.ClientID %&gt;'); if(mdlPopup) { mdlPopup.show(); } } else { var mdlPopup = $find('&lt;%= ModalPopupExtenderMerchantUpdate.ClientID %&gt;'); if(mdlPopup) { mdlPopup.show(); } } } } </code></pre>
c# javascript asp.net
[0, 3, 9]
420,744
420,745
Javascript to Jquery, add text in input onclick
<p>How can I change this javascript code to JQuery.</p> <pre><code>&lt;script type="text/javascript"&gt; function addTextTag(text){ document.getElementById('text_tag_input').value += text; } &lt;/script&gt; </code></pre> <p>When a user click the link text automaticaly is added in input.</p> <p>This is the HTML: </p> <pre><code>&lt;input id="text_tag_input" type="text" name="tags" /&gt; &lt;div class="tags_select"&gt; &lt;a href="#" onClick="addTextTag('text1, '); return false"&gt;text1&lt;/a&gt; &lt;a href="#" onClick="addTextTag('text2, '); return false"&gt;text2&lt;/a&gt; &lt;a href="#" onClick="addTextTag('text3, '); return false"&gt;text3&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Here is the demo: <a href="http://jsfiddle.net/Smartik/j8qGT/" rel="nofollow">http://jsfiddle.net/Smartik/j8qGT/</a></p>
javascript jquery
[3, 5]
5,380,665
5,380,666
Webview not loading javascript
<p>I have loaded an html to the webview. I want to increase the font size of the p tag dynamically. For that I made a javascript and loaded after loading the html. But it is not working. What may be the problem??</p> <p>Thanks in advance</p> <pre><code>mWebView.getSettings().setJavaScriptEnabled(true); mWebView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { String javascript="all_paras = document.getElementsByTagName('p');\n"; javascript=javascript+"for(i=0;i&lt;all_paras.length;i++) {all_paras[i].style.fontSize = '30px';}"; mWebView.loadUrl("javascript:(" + javascript + ")()"); System.out.println("Script executed.."); } }); </code></pre>
javascript android
[3, 4]