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
2,730,375
2,730,376
Inserting PHP code inside JavaScript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1849812/php-in-javascript">php in javascript?</a> </p> </blockquote> <p>I need to check an if condition inside the inner html property of javascript. And so for that I need to use php inside it. So is it possible. I tried the following and it doesn't seem to work.</p> <pre><code>document.getElementById().innerHTML = "&lt;?php if ($number == 1) { echo $ex; } else { echo $ey; } ?&gt;"; </code></pre> <p>So please help me out with this problem.</p>
php javascript
[2, 3]
3,210,268
3,210,269
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]
75,267
75,268
Retrieving jQuery.data() values from within setInterval
<p>I've been stuck on this problem for a while now. I'm using jQuery's .data() method to store state in a plugin I'm writing. Everything works fine, except for when I try to retrieve these data values from within a setInterval block. I am able to see the jQuery object inside the setInterval block, but I'm not able to see values stored by the data() method.</p> <pre><code>tminusStart: function() { return this.each(function() { var $tminus = $(this).data("tminus.state", "running"); var intervalId = setInterval(function(tm) { if ($tminus.tminusIsRunning()) { $tminus.tminusDecrementCounter(); $tminus.data("tminus.settings").tick_event(); if ($tminus.tminusTimeRemaining() &lt;= 0) { $tminus.data("tminus.settings").expiration_event(); } $tminus.text(tminus.tminusTimeRemaining); } else { clearInterval(intervalId); } }, 1000, $tminus); }); } </code></pre> <p>In the above code, the $tminus does return the jQuery object alright, but the calls to the functions - which are calling the .data() method - return undefined; so does the .data("tminus.settings") call.</p> <p>Any help in understanding why .data() isn't working here would be greatly appreciated.</p> <p>Rewrite of function removing cruft:</p> <pre><code>tminusStart: function() { var tminus = this; tminus.data("tminus.state", "running"); return this.each(function() { console.log(tminus.data("tminus.state")); // "running" var intervalId = setInterval(function() { console.log(tminus.data("tminus.state")); // undefined }, 1000); }); } </code></pre> <p>I need to know why it's undefined in the setInterval block</p>
javascript jquery
[3, 5]
4,827,371
4,827,372
making a variable an instance of a class
<p>I'm in a-level computing and I was wondering if someone could please tell me the definition of this. If I have a class with methods etc, then I make another class where I kind of generate a variable of that first class. What is this actually called? It's the variable definition I'm after shown below "whatisThis" is this a class object?</p> <pre><code>MyClass1 { ... } MyClass2 { MyClass1 whatisThis = new MyClass1(); } </code></pre>
c# java
[0, 1]
2,601,321
2,601,322
Wordpress Javascript / jQuery conflicts
<p>I'm really stuck on a problem. I have already searched Google and even asked on twitter but no avail. My problem is with Wordpress, when trying to use thickbox and jQuery slider on the same page my slider becomes static.</p> <p>(Without the jQuery script) If I remove the jQuery script for {Nivo slider} then my lightbox works.</p> <p>(Without thickbox javascript) When I don't use the thickbox javascript my slider works.</p> <p>(The Problem) When using both scripts thickbox overwrites the slider causing it to show the images below one another (not hidden) and the slider stops working all together.</p> <p>However I have tested using the two scripts on Drupal on my local host and they work fine together however on Wordpress it does not work.</p>
php javascript jquery
[2, 3, 5]
5,029,386
5,029,387
Can we display Hyperlink from Javascript alert on ASP.NET Page?
<p>I have the following text that needs to be displayed from Javascript ALert.</p> <p>I am wondering if we can display the hyperlink from the alert itself?</p> <pre><code>alert('User already exists in the system, please &lt;a href='../Login.aspx'&gt;login&lt;/a&gt;'); </code></pre> <p>Appreciate your responses</p> <p>Thanks</p>
c# asp.net javascript
[0, 9, 3]
831,014
831,015
Dynamically generated table rows never update
<p>I have an ASP.NET table I'm using to create a dynamic section of a form (the user can add multiple items with no limit). The table is defined in the markup of the page with the first row.</p> <p>The code is along the lines of the following:</p> <pre><code>TableRow row = new TableRow(); TableCell tc = new TableCell(); tc.Controls.Add(new TextBox()); row.Cells.Add(tc); myTable.Rows.Add(row); myTable.DataBind(); </code></pre> <p>This works fine when I add the first row, but when I add subsequent rows, they never get added. It's like the table stops at the first addition and I can't figure out what I'm doing wrong.</p>
c# asp.net
[0, 9]
3,560,279
3,560,280
Why are singletons considered to be a bad practice?
<h3>Duplicate:</h3> <blockquote> <p><a href="http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons">What is so bad about Singletons?</a></p> </blockquote> <p>I was reading <a href="http://stackoverflow.com/questions/678669/concurrency-asp-net-best-practises-worst-practises">this</a> question, and was surprised to see that (s)he considered a singleton to be considered a "bad practice," and in fact thought that this was common knowledge.</p> <p>I've used singletons quite a bit in any project that uses iBatis to load the queries from XML. It great improves speed in these instances. I'm not sure why you wouldn't use them in a case like this.</p> <p>So... why are they bad?</p>
c# asp.net
[0, 9]
2,397,151
2,397,152
How do I replace HTML escapes in an input stream before parsing it to XML?
<p>I have an input stream which is being converted to XML, and read. When I get down to some text elements in the XML, they are truncated. I believe the parser is dropping everything after escaped HTML such as &amp; Here is the code getting the input stream and then getting the text element.</p> <pre><code>String hvurl = "https://www.mysite.com/api/a/" + answerId; in = OpenHttpConnection(hvurl); Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { db = dbf.newDocumentBuilder(); doc = db.parse(in); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } ... //Now when I get the text element, it's truncated //---get the &lt;varietalTitle&gt; elements under the &lt;varietal&gt; // element--- NodeList varietalTitleNodes = (varietalElement).getElementsByTagName("varietaltitle"); //---convert a Node into an Element--- Element varietalTitleElement = (Element) varietalTitleNodes.item(0); //---get all the child nodes under the &lt;varietaltitle&gt; element--- NodeList varietalTitleTextNodes = ((Node) varietalTitleElement).getChildNodes(); //---retrieve the text of the &lt;varietalid&gt; element--- strVarietalTitle = ((Node) varietalTitleTextNodes.item(0)).getNodeValue(); </code></pre>
java android
[1, 4]
2,771,184
2,771,185
JQuery - Extend and Access Superclass
<p>Is there a way to access the super object when extending objects using $.extend?</p> <p>I would like to extend an object, override a method, but call the overridden superclass method in the subclass method. </p>
javascript jquery
[3, 5]
5,461,295
5,461,296
Want to create a multilingual javascript object, how to handle if lots of labels?
<p>I want to create a javascript file for multilingual functionality</p> <p>i.e. display the error message in the correct language.</p> <p>If I have allot of labels for a page, error messages, etc., what is a smart way of making this so the actual output on the page isn't huge?</p> <p><strong>i guess the best way is to somehow output the labels that I need ONLY?</strong></p> <pre><code>lang.getkey('username'); </code></pre> <p>will output the correct label, depending on the language.</p>
javascript jquery
[3, 5]
1,942,893
1,942,894
Stop recursion and start over
<p>I have the following function, that is called once in my program. When there is no user interaction it starts over again and again by recursion when the array is printed out. But when a user clicks on a link the function shall be stopped first (no more output from the array) and then be started again with new parameters. </p> <pre><code>function getText(mode){ var para = mode; var url = "getText.php?mode=" + para; var arr = new Array(); //get array via ajax-request var $div = $('#text_wrapper'); $.each(arr, function(index, value){ eachID = setTimeout(function(){ $div.html(value).stop(true, true).fadeIn().delay(5000).fadeOut(); if(index == (arr.length-1)){ clearTimeout(eachID); getText(para); } }, 6000 * index); }); } </code></pre> <p>My code doesn't really stop the function but calling it once more. And that eventuates in multiple outputs and overlaying each other. How can I ensure that the function stops and runs just one at a time?</p> <pre><code>$(document).ready(function() { $("#div1, #div2").click(function(e){ e.preventDefault(); var select = $(this).attr("id"); clearTimeout(eachID); getText(select); }); }); </code></pre>
javascript jquery
[3, 5]
2,449,734
2,449,735
check if user is visiting pure root url
<p>I'd like to run a js script if a user is visiting my site's root url. I am using this code:</p> <pre><code>&lt;script type="text/javascript"&gt; if(location.pathname == "/") { window.open ('#107','_self',false); } &lt;/script&gt; </code></pre> <p>However <a href="http://example.com/?foo=bar#hash" rel="nofollow">http://example.com/?foo=bar#hash</a> will also run the script, since the pathname excludes the query string and location hash.</p> <p>It currently behaves like this:</p> <pre><code>http://example/ Root /?querystring Root /#hash Root /page Not root </code></pre> <p>I want it to behave like this:</p> <pre><code>http://example/ Root /?querystring Not root /#hash Not root /page Not root </code></pre> <p>Any suggestions? Thanks.</p>
javascript jquery
[3, 5]
1,142,409
1,142,410
Question about JQuery - Get values of some selected items by class
<p>Hey Guys, I have a form with 4 select tags:</p> <pre><code>&lt;select class="section_1"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;/select&gt; &lt;select class="section_1"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;/select&gt; &lt;select class="section_1"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;option value="3"&gt;Option 3&lt;/option&gt; &lt;/select&gt; &lt;select class="section_1"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;option value="3"&gt;Option 3&lt;/option&gt; &lt;option value="4"&gt;Option 4&lt;/option&gt; &lt;/select&gt; </code></pre> <p>I want to get by jquery all the classes of "section_1" and their selected options value.</p> <p>I got now: $(".section_1")... by how I continue?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
759,500
759,501
What is this xPath trying to capture?
<p>I have come across this bit of jQuery and I am failing to understand what the xPath (?) means in this context:</p> <pre><code>var all_line_height = $(this).find("*[style*='line-height']"); </code></pre> <p>I haven't seen this before, is it looking for an element that contains line-height in its style attribute?</p> <p>I did a small test and it doesn't pick up on it.</p>
javascript jquery
[3, 5]
4,242,262
4,242,263
Write/Read any object to/from Android memory
<p>I'm currently writing to methods to:</p> <ul> <li>read object from memory</li> <li>write object to memory</li> </ul> <p>I tried to save a String object and read it again, yet my code didn't work.</p> <p>This is my code:</p> <pre><code>public void writeObjectToMemory(String filename, Object object) { FileOutputStream fos; try { fos = game.openFileOutput(filename, Context.MODE_PRIVATE); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeObject(object); os.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public void readObjectFromMemory(String filename, Object object) { FileInputStream fis; try { fis = game.openFileInput(filename); ObjectInputStream is = new ObjectInputStream(fis); object = is.readObject(); is.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (StreamCorruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } </code></pre>
java android
[1, 4]
2,529,838
2,529,839
Access list element in javascript
<p>I am getting this list from server(php): </p> <pre><code>["Ak-Bulak","Balykchy","Batken"] </code></pre> <p>how can i access it and put into selects options thru js, what i tried is: </p> <pre><code>for (var i in data) { $('#cities').append('&lt;option&gt;'+ data[i] +'&lt;/option&gt;'); } </code></pre> <p>it putting every chars as one option: <code>&lt;option&gt;[&lt;/option&gt;</code>, <code>&lt;option&gt;"&lt;/option&gt;</code>...</p> <p>how can i access each element here? not each char.. </p>
php javascript jquery
[2, 3, 5]
5,022,528
5,022,529
Can't make "Reload" script inside PHP work
<p>This is what runs after submitting a form:</p> <pre><code>else { echo '&lt;br/&gt; Tu chisme se agregó con éxito.'; echo '&lt;script type="text/javascript"&gt;window.location.reload(true);&lt;/script&gt;'; } </code></pre> <p>Basically after the users submits the form it does a couple of things and finally displays a text saying that the post has been submitted successfully and then a second echo tries to reload the page. However I wasn't able to make it work. It displays the text but it doesn't reload the page. What's the problem with the code? Please ask for any info. Thanks</p>
php javascript
[2, 3]
1,896,188
1,896,189
switching images in application
<p>I have decided that i want to use images for the quesiton of my application, where as before i was using text.</p> <p>The code below changes the questions, which are stored in a string array.</p> <p>I now have an array of images also called questions</p> <p>How would i change image for each question here?</p> <p>instead of setText what would i use?</p> <pre><code> ques.setText(questions[rnd2]); if(questions[rnd2]=="x") { change_question(rnd2); } } questions[rnd2]="x"; </code></pre> <p>Thank you in advanced.</p> <p>KCCman</p>
java android
[1, 4]
1,403,675
1,403,676
window.open not working when attached on onload event in chrome and safari
<p>I have attached some javascript on onload event of the form. this script contains window.open. Although this works fine in all the browsers window.open doesn't open a new window nor it gives nay error message in google chrome and firefox.</p> <p>I want to first check the screen resolution if it is less than 1024 then I would open it in a new window without menu,toolbar and others so that the user has more space to work on.</p>
asp.net javascript
[9, 3]
856,318
856,319
how does this jquery count get updated?
<p>I am trying to figure out how this javascript works. <a href="http://www.pickhealthinsurance.com/u/search?age=25&amp;people=1&amp;smoker=false&amp;zip=20001" rel="nofollow">On this website</a> that someone else created, if you check the HMO Plan type checkbox in the top left corner, the count changes for Maternity, Prescriptions, and HSA Eligible.</p> <p>In the source I see code such as </p> <pre><code>data-key="hsa", id="f_hsa", name="f_hsa" &lt;span class "count"&gt;10&lt;/span&gt; data-hsa='0' / data-hsa='1' </code></pre> <p>If I change a row to have data-hsa='1' and not '0', I see the count changes. I am trying to figure out where the code that is retrieving the new count is. The function has to be somewhere, but I don't see it.</p>
javascript jquery
[3, 5]
3,856,138
3,856,139
Using live() with validation and submitting via ajax()
<p>I have this in JQuery:</p> <pre><code>$("form").validate({ rules: { captcha: { required: true, remote: { url: "gb_include/captcha.php", type: "post" }, } }, messages: { captcha: "Correct captcha is required." }}); $("form").submit(function(){ if($(this).valid() == true){ /* submit via ajax */ } </code></pre> <p>But I have to us <code>.live()</code> because the form is loaded after <code>$(document).ready()</code> how can i do that ?</p>
javascript jquery
[3, 5]
5,253,516
5,253,517
Trigger onBlur on multiple elements as a single unit
<p>I have two inputs that together form a single semantic unit (think an hours and minutes input together forming a time input). If both inputs lose focus I want to call some Javascript function, but if the user merely jumps between those two, I don't want to trigger anything.</p> <p>I've tried wrapping these two inputs in a div and adding an onBlur to the div, but it never triggers.</p> <p>Next I tried adding onBlurs to both inputs and having them check the other's :focus attribute through jQuery, but it seems that when the onBlur triggers the next element hasn't received focus yet.</p> <p>Any suggestions on how to achieve this?</p> <p>EDIT: Someone questioned the purpose of this. I'd like to update a few other fields based on the values contained by both these inputs, but ideally I don't want to update the other fields if the user is still in the process of updating the second input (for instance if the user tabs from first to second input).</p>
javascript jquery
[3, 5]
1,007,612
1,007,613
jQuery select img with src
<p>I want to select an image (with jQuery) by the src attribute. The Image is inside an ul and a collection of div's. The id of the ul is "sortable".</p> <p>Here is my HTML:</p> <pre><code>&lt;ul id="sortable"&gt; &lt;li id="pic_0"&gt; &lt;div class="sortEleWrapper"&gt; &lt;div class="imgWrapper"&gt; &lt;img src="/test1.jpg"&gt; &lt;/div&gt; &lt;input type="text" name="picText" id="picText" value="""" style="width:105px;color:#aaa" class="sortInput"&gt; &lt;/div&gt; &lt;input type="hidden" id="picSrc" name="picSrc" value="/test1.jpg"&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>etc.</p> <p>and here is my js:</p> <pre><code>if($('#sortable').find('img[src="/test1.jpg"]').length &gt; 0){ alert('img exists'); }else{ alert('img dosnt exists'); } </code></pre> <p>My problem is, that they don't find any image. But if I write the js like this:</p> <pre><code>if($('img[src="/test1.jpg"]').length &gt; 0){ alert('img exists'); }else{ alert('img dosnt exists'); } </code></pre> <p>so they find the image. Can anybody help me plz.</p> <p>PS: sorry for my poor english, but I'm german =)</p>
javascript jquery
[3, 5]
4,059,458
4,059,459
hide child element on click
<p>I am trying to hide "arrow_o" on click of "thead" but it is not working. Does jquerys "children" not work in tables?</p> <p>html</p> <pre><code>&lt;thead class="thead"&gt; &lt;tr&gt; &lt;th&gt; &lt;div class="arrow_o"&gt;&lt;/div&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; </code></pre> <p>js</p> <pre><code>$(document).ready(function() { $('.thead').click(function() { $(this).children('.arrow_o').hide(); }); }); </code></pre>
javascript jquery
[3, 5]
233,911
233,912
Send/Receive byte[] via TCP Socket
<ol> <li>I would like to send/receive sqlite database files (*.db) in byte[] over TCP socket connection? <br/></li> <li>Is there a similar method in Java/Android for Socket.Poll() C#?</li> </ol> <p>I'm new in Java / Android</p>
java android
[1, 4]
3,384,406
3,384,407
Error when trying to get document.getElementsByName(name)
<p>I have been trying to use this code in one of my projects:</p> <p><a href="https://github.com/cemerick/jsdifflib" rel="nofollow">https://github.com/cemerick/jsdifflib</a></p> <p>EDIT: Link to code in question <a href="http://jsfiddle.net/BvFNf/3/" rel="nofollow">http://jsfiddle.net/BvFNf/3/</a></p> <p>The code in its current form uses:</p> <pre><code>var byId = function (id) { return document.getElementById(id); } base = difflib.stringAsLines(byId("baseText").value), newtxt = difflib.stringAsLines(byId("newText").value), </code></pre> <p>However I am trying to use the name field instead:</p> <pre><code>var byName = function (name) { return document.getElementsByName(name); } base = difflib.stringAsLines(byName("field1")[0].value), newtxt = difflib.stringAsLines(byName("field2")[0].value), </code></pre> <p>The append child code is as follows:</p> <pre><code> diffoutputdiv.appendChild(diffview.buildView({ baseTextLines: base, newTextLines: newtxt, //opcodes: opcodes, baseTextName: "Base Text", newTextName: "New Text", contextSize: contextSize, viewType: viewType })); </code></pre> <p>I also added <code>' name="field1" '</code> to the html.</p> <p>The full source can be found here: <a href="http://pastebin.com/7y3SQYFM" rel="nofollow">Pastebin Code</a> The error I keep getting is:</p> <pre><code>Uncaught TypeError: Object #&lt;NodeList&gt; has no method 'appendChild' demo.html:69 diffUsingJS demo.html:69 onclick demo.html:98 </code></pre> <p>The data being returned is equivalent to the original byID data set. Please help.</p>
javascript jquery
[3, 5]
3,257,585
3,257,586
howto get $('input[name=...]').val() from $('form')[...];
<p>This my html code</p> <pre><code>&lt;div id="list_refer_1"&gt; &lt;form id="refer_1_0"&gt; &lt;input type="hidden" name="channel" value="1"&gt; &lt;input type="hidden" name="url" id="input_1_0" value="http://localhost:8000/"&gt; &lt;input type="button" onclick="pullrefer(1, 0);" value=" - "&gt; http://localhost:8000/ &lt;/form&gt; &lt;form id="refer_1_xxxxx"&gt; ///xxxxx is timestamp &lt;input type="hidden" name="channel" value="1"&gt; &lt;input type="hidden" name="url" id="input_1_1" value="http://127.0.0.1:8000/"&gt; &lt;input type="button" onclick="pullrefer(1, 1);" value=" - "&gt; http://127.0.0.1:8000/ &lt;/form&gt; &lt;form id="refer_1_2"&gt; &lt;input type="hidden" name="channel" value="1"&gt; &lt;input type="hidden" name="url" id="input_1_2" value="http://localhost*"&gt; &lt;input type="button" onclick="pullrefer(1, 2);" value=" - "&gt; http://localhost* &lt;/form&gt; ... </code></pre> <p>i can get value by </p> <pre><code>$('#list_refer_1 #refer_1_0 input[name=url]').val(); </code></pre> <p>but i want get</p> <pre><code>$('input[name=url]').val() from $('#list_refer_1 **form**')**[1]**; </code></pre> <p>howto get it? Thank you.</p>
javascript jquery
[3, 5]
3,911,361
3,911,362
Combining document ready scripts?
<p>I'm using a simple show-hide script on various IDs. The issue is as it stands right now each is a seperate JS that calls the document ready function via jQuery. </p> <p>Is there a way to combine this into one more flexible script or at least into one script in some form or another. Thank you so much for your time in advance!</p> <p>Below is an example:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#loadDummy7").hover( function () { $("#dummy7").show(); }, function () { $("#dummy7").hide(); }); }); &lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#loadDummy8").hover( function () { $("#dummy8").show(); }, function () { $("#dummy8").hide(); }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,223,518
2,223,519
Creating dynamic asp.net label with Javascript
<p>I have a asp.net label inside a </p> <pre><code> &lt;td&gt; &lt;asp:Label ID="errorMesaage" runat="server"&gt; &lt;/td&gt; </code></pre> <p>I want to create an asp.net label dynamically and append it to this td using JAVASCRIPT. Then after appending this td would have another error message with a different id. I also need a script that would also remove the item from the </p> <p>Any help is appreciated.</p>
javascript asp.net
[3, 9]
5,943,896
5,943,897
How to disable all the controls on the page after the countdown timer stops in asp.net?
<p>I have tried to disable the next button in the following code but its not working....pls help... </p> <pre><code> protected void timer1_Tick(object sender, EventArgs e) { CurrentTime = CurrentTime.AddSeconds(-1); LblTime.Text = "Time Left: " + CurrentTime.TimeOfDay; if (CurrentTime.TimeOfDay == DateTime.MinValue.TimeOfDay) { LblTime.Text = "Oops!! Time Up"; timer1.Enabled = false; btnnext.Enabled = false; } </code></pre>
c# asp.net
[0, 9]
153,359
153,360
my array "is not a function" error message
<p>I am trying to store some DOM information into an Array so I can use it elsewhere.</p> <p>This works if I use a Variable, but if I try to use an Array I get "Arrayname is not a function" error message? I'm not sure why this would work in a Variable and not an array.</p> <p>This is the code I'm running:</p> <pre><code>function testmove(total) { for (var x=1; x&lt;=total; x++) { allstore(x) = jQuery('#block-views-items-block .views-row-1').children('div'); x++; } } </code></pre> <p>This works:</p> <pre><code>function testmove(total) { store1 = jQuery('#block-views-items-block .views-row-1').children('div'); } </code></pre> <p>Am I missing something/doing something wrong here?</p>
javascript jquery
[3, 5]
376,524
376,525
How to set the screen resolution dynamically in Asp.Net application with C# as language
<p>How to set the screen resolution dynamically in Asp.Net application with C# as language</p> <p>I have created an asp.net app on my machine where the resolution is</p> <blockquote> <p>set to 1280 x 1024. When my users view the form on their screen, some of the controls display differently than on my screen. One solution I have is to use some javascript to determine the resolution of their screen and redirect them to a duplicate form suited better for their resolution but I would have to maintain multiple forms. Anybody know of a better way to handle resolution problems in asp.net? Thanks in advance</p> </blockquote>
c# asp.net
[0, 9]
2,343,415
2,343,416
aspx.net Adding meta tag sifts control ID
<p>I have aspx application then i added <code>&lt;META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"&gt;</code> to the head and after that all controlls ID where shift up by 1 ctl03_lHeading -> is now ctl04_lHeading .. </p> <p>Is this common behavior?</p> <p>thanks</p>
c# asp.net
[0, 9]
4,904,471
4,904,472
Referring to an object's ID in a jQuery append statement
<p>I have this element:</p> <pre><code>&lt;div class="isthisyou" id="unique_identifier"&gt;&lt;/div&gt; </code></pre> <p>I want to use jQuery to insert a link into the div:</p> <pre><code>$('isthisyou').append('&lt;a href="auth/create_account/'+this.id+'"&gt;Is this you?&lt;/a&gt;'); </code></pre> <p>Right now <code>this.id</code> is returning <code>undefined</code> instead of <code>unique_identifier</code>. What am I doing wrong?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,115,682
3,115,683
Get first item from comma delimited object
<p>Hi I have an object rowObject passed into a javascript function. When I inspect it by putting it into an alert I see something like:</p> <pre><code>435,345,345345,56456 </code></pre> <p>What I want to acheive is to get the first interger ie. 435 from the list.</p> <p>I know how to do this in server side code but client side code.</p> <p>Can someone please help me with this?</p>
javascript jquery
[3, 5]
4,828,850
4,828,851
Javascript to close browser window simultaneously with dialog box
<p>I'm working on an asp.net web form. This form has a button to open a new window (report window) and show a report. But first the user has to select a client from the list in the form before he/she can see the report. For validation matter, I use code to check whether the user has selected one of the client or not, the validation is done in the new window (report window).<br><br> The validation is set to show a javascript dialog box if the user hasn't selected one of the client, it's working fine, the dialog box show the message with a single <strong>OK</strong> button. Is it possible to close the window concurrent with the dialog box when the user click the <strong>OK</strong> button ?</p>
javascript asp.net
[3, 9]
5,952,541
5,952,542
Removing a script tag with a specific content using jquery
<p>I have a page that i dont have access to its an obvius site. I would like to remove a script html tag with a content. For now i have this but is not working. I am using userscripts like coding!</p> <pre><code>function main(){ var def = $('script[type="text/javascript"]').html(); $('script[type="text/javascript"]').each(function() { if (def == 'document.write("&lt;scr"+"ipt type=\'text/javascript\' src=\'http://storing.com/javascripts/"+(new Date()).getTime()+"/3e155555e1b26c2d1ced0f645e_1_1.js\'&gt;&lt;/scr"+"ipt&gt;")') $('script[type="text/javascript"]').remove(); } } </code></pre> <p>UPDATE: </p> <pre><code>&lt;script type="text/javascript"&gt;document.write("&lt;scr"+"ipt type='text/javascript' src='http://somedomain.com/javascripts/"+(new Date()).getTime()+"/3e1a0cd37f25a6e1b26c2d1ced0f645e_1_1.js'&gt;&lt;/scr"+"ipt&gt;")&lt;/script&gt; </code></pre> <p>This is the whole script what i want to remove... it inserts a div that i am removing right now i just wanted to know if there is any other method. BUt as i see the only is the hosts file thing :)</p>
javascript jquery
[3, 5]
4,600,764
4,600,765
How to make a "tags box" using jquery (with text input field + tags separated by comma)
<p>I am working on a web application that allows users to post content by tags but the thing is, how would I make a nice block around a tag if its separated by a <strong>comma</strong> and the text field value would still be the same only the view to the user would differ.</p> <p>An example would be such as YouTube or StackOverflow, for now I don't need it to check a database or anything.</p> <p>Thanks! </p>
javascript jquery
[3, 5]
5,225,773
5,225,774
passing a parramter from php to javascript back to php
<p>I have a php page, which using javascript, creates a popup window which contains another php page. the php page in the popup window is basically a form, and will use that value to insert into a database. Using the following function to load the php page in a popup:</p> <pre><code>phppopup('edit_status.php?cmd=EditStatusData') function phppopup(page){ child1 = window.open (page, "Ebay Auctions", "height=600,width=600,status=yes,toolbar=no,menubar=no,location=no"); child1.document.close(); } </code></pre> <p>How can i pass a value from the calling page to the page in the popup?</p> <p>I am trying at the moment:</p> <pre><code>echo "&lt;p&gt;&lt;a href=\"#\" onclick=\"updateByEdit('". $username ."', '". $subcat ."')\"&gt;Edit User Info&lt;/a&gt; &lt;p&gt;&lt;a href='#' onclick=\"makewindows2('edit_status.php?cmd=EditStatusData&amp;pk=". $pk ."'); return false;\"&gt;Historie&lt;/a&gt;; </code></pre> <p>Which generates the following html:</p> <pre><code>&lt;a href="#" onclick="updateByEdit('trendsandbrands', 'fakeapproved')"&gt;Edit User Info&lt;/a&gt; &lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;strong&gt;&lt;a href="#" onclick="phppopup('edit_status.php?cmd=EditStatusData&amp;amp;pk='); return false;"&gt;Historie&lt;/a&gt; </code></pre> <p>It works fine for updateByEdit, why not for phpopup?</p> <p>$pk is just an integer, which display fine in the page it the window is called from.</p>
php javascript
[2, 3]
4,581,569
4,581,570
Headaches with radios in Jquery
<p>I have 2 radios:</p> <pre><code>&lt;input id="a_15_0" type="radio" value="abc" name="a_15"/&gt; &lt;input id="a_15_1" type="radio" value="xyz" name="a_15"/&gt; </code></pre> <p>Both are unselected. I have only the name of the radio, i.e <code>a_15</code>, but not the IDs.</p> <p><strong>1)</strong> How can I get the value of the selected option of this radio? E.g if the user clicked 'xyz', how can I get it? Right now I'm using:</p> <pre><code>var val=$('[name="a_15"]').val(); </code></pre> <p>Which always gives abc even when xyz is selected.</p> <p><strong>2)</strong> How can I get xyz to be selected through javascript, without knowing the ID of the radio which says xyz? Doing:</p> <p>$('[name="a_15"]').val('xyz');</p> <p>Changes the value of both radios to xyz rather than selecting the one whose value had been xyz.</p> <p>Do I need to use <code>document.myForm.a_15.value</code>? Would that work consistently?</p>
javascript jquery
[3, 5]
898,993
898,994
Is there a way to call Java from JavaScript in Webview?
<p>Is there any way to call Java from JavaScript in Webview like this </p> <blockquote> <p><a href="https://github.com/ochameau/NativeBridge" rel="nofollow">https://github.com/ochameau/NativeBridge</a></p> </blockquote> <p>in Android?</p>
javascript android
[3, 4]
5,297,908
5,297,909
Wrapping a LinearLayout around a TextView
<p>I have the following code that populates a ListView with a TextView in the XML Layout file. But if I try to wrap a LinearLayout around the TextView it crashes!</p> <p>Code:</p> <pre><code>setListAdapter(new ArrayAdapter&lt;MyData&gt;(getApplicationContext(), R.layout.articlelist, items)); ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { MyData d = items[position]; Bundle bundle = new Bundle(); bundle.putString("theArticleText", d.getText()); Intent newIntent = new Intent(getApplicationContext(), ArticleDetail.class); newIntent.putExtras(bundle); startActivityForResult(newIntent, 0); } }); </code></pre> <p>Working XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" /&gt; </code></pre> <p>Non working XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:textSize="16sp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Any ideas why this is happening??? Also what I want to do is add an icon next to each item in the list, am I heading in the right direction???</p> <p>Cheers,</p> <p>Mike.</p>
java android
[1, 4]
2,521,640
2,521,641
Get the number of weeks between two Dates.
<p>Im working in a project and I got two types in Date. I want to calculate the number of weeks between these two dates. The dates can be in diffrent years. Is there any good solution for this? </p> <p>I have tried to implemenent this with Joda-time which was suggested in other topics.. </p> <p>Im not familar with this library, but I tried to do something like this:</p> <pre><code>public static int getNumberOfWeeks(Date f, Date l){ Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTime(f); c2.setTime(l); DateTime start = new DateTime(c1.YEAR, c1.MONTH, c1.DAY_OF_MONTH, 0, 0, 0, 0); DateTime end = new DateTime(c2.YEAR, c2.MONTH, c2.DAY_OF_MONTH, 0, 0, 0, 0); Interval interval = new Interval(start, end); Period p = interval.toPeriod(); return p.getWeeks(); } </code></pre> <p>But this is completely wrong... any suggestions ? </p>
java android
[1, 4]
1,255,739
1,255,740
ASP.NET Routing webform query
<p>I have a ASP.net Web forms project that I am working on. I need to have a add club page where the admin can add a club to the website.</p> <p>When the club is added it creates a small website within my website for that club automatically. I think this uses some form of string builder.</p> <p>Then that club should be able to store their own details on that page.</p> <p>I was going to do this doing asp.net routing. Would this be the correct way of going about this?</p> <p>Having looked at different examples i would need to have the url for the webpage automatically generated</p>
c# asp.net
[0, 9]
2,350,999
2,351,000
Where are the executable/launch files stored in Android
<p>Hello I am trying to find out where the binaries for launching an app in Android are stored. I am trying to launch an app using <strong>adb shell</strong> and the emulator and can't find where its located any ideas?</p>
java android
[1, 4]
95,248
95,249
Using javascript and jquery, to populate related select boxes with array structure
<p>Using answers to <a href="http://stackoverflow.com/questions/57522/javascript-array-with-a-mix-of-literals-and-arrays">this question</a>, I have been able to populate a select box based on the selection of another select box. ( <a href="http://stackoverflow.com/questions/57522/javascript-array-with-a-mix-of-literals-and-arrays#58062">I posted my answer here</a>) Pulling the data from an array structure built server-side, stored in a .js file and referenced in the html page.</p> <p>Now I would like to add a third select box. If I had 3 sets of data (model, make, options) something like this (pseudo code):</p> <pre><code>cars : [Honda[Accord[Lx, Dx]], [Civic[2dr, Hatchback]], [Toyota[Camry[Blk, Red]], [Prius[2dr,4dr]] </code></pre> <p>Ex: If Honda were selected, the next select box would have [Accord Civic] and if Accord were selected the next select box would have [Lx Dx]</p> <p>How can I</p> <p>1) create an array structure to hold the data? such that</p> <p>2) I can use the value from one select box to reference the needed values for the next select box</p> <p>Thanks</p> <p><strong>EDIT</strong></p> <p>I can create the following, but can't figure out the references in a way that would help populate a select box</p> <pre><code>var cars = [ {"makes" : "Honda", "models" : [ {'Accord' : ["2dr","4dr"]} , {'CRV' : ["2dr","Hatchback"]} , {'Pilot': ["base","superDuper"] } ] }, {"makes" :"Toyota", "models" : [ {'Prius' : ["green","reallyGreen"]} , {'Camry' : ["sporty","square"]} , {'Corolla' : ["cheap","superFly"] } ] } ] ; alert(cars[0].models[0].Accord[0]); ---&gt; 2dr </code></pre>
javascript jquery
[3, 5]
1,368,117
1,368,118
How should I remove these <li> elements based on time?
<p>I have 5 <code>&lt;li&gt;</code> elements on page load. </p> <p>Other <code>&lt;li&gt;</code> elements are added randomly at every number of seconds. I need to remove the <code>&lt;li&gt;</code> elements that have been on the page longer than a minute. </p> <p>I was thinking of having an attribute called <code>data-created-at</code> which stores the time it was added. And then have a looped function (via js, in the same page) that checks for <code>&lt;li&gt;</code> elements to be removed.</p> <p>If above is a sound approach. Should I store the time for <code>data-created-at</code> in milliseconds?</p> <p>Good idea? Or is there a better way to go about this? +1 for anyone who gives a code snippet along with their description.</p>
javascript jquery
[3, 5]
35,427
35,428
Dynamically create ASP.NET button control using jQuery
<p>I know this can be done for regular HTML buttons, but can asp:Button be created dynamically using jQuery?</p> <p>Here's my button with an onclick that calls a server-side function:</p> <pre><code>&lt;asp:Button ID="btnYesGPS" runat="server" Text="Yes" CssClass="formButton" onclick="btnYesGPS_Click" /&gt; </code></pre> <p>Thank you for any guidance on this.</p>
jquery asp.net
[5, 9]
2,414,359
2,414,360
A click function not working
<p>my a click jquery function is not working, it just doesn't give any errors at console at all too. Here is the link -</p> <pre><code>&lt;a href="#lang" id="language"&gt;Edit&lt;/a&gt; </code></pre> <p>and here is the click function</p> <pre><code>$('a').click(function() { var item = $(this).attr("id"); alert(item); return false; }); </code></pre> <p>It doesn't popout the alert box, nor it does show me error in console.</p> <p>Okay, someone asked for more info -</p> <p>The link is added with jquery, by pressing button, and as id it takes one of the input fields value and inserts it as link with id from input field. There are no duplicate ids, all javascript scripts are located at the end of head tag, and the a click function is located last in part.</p>
javascript jquery
[3, 5]
1,994,698
1,994,699
How do I combine the best of two Apps into one?
<p>I have two similar iPhone and Android Apps (2 each) in the near future we will be combining/merging the best of these two Apps into one App. The App does have a user login that would need to be combined, but a common data file, so authentication should not be an issue. How do I deploy the combined App via the App Store and Google Market for users of the existing Apps? How can I phase the old out and let users know about the new merged App? I thought we could build the MOTHER App and deploy it as a version release in the App Store and Market, but can I deploy the same App version for two separate Apps? For the sake of an example, think of it as Bank of America merging their Apps with CitiBank under a single brand (CitiMobile is now BofA Mobile)</p> <p>Thanks in advance your your valuable insight. </p>
iphone android
[8, 4]
2,909,917
2,909,918
Relative position in DOM of elements in jQuery
<p>Given two jquery objects, Is there some way I tell which one is "further ahead" in the document tree than the other? In other words, with a document</p> <pre><code> &lt;p id="p1" &gt;&lt;/p&gt; &lt;div id="div1"&gt; &lt;p id="p2"&gt;&lt;/p&gt; &lt;/div&gt; &lt;p id="p3"&gt;&lt;/p&gt; </code></pre> <p>Is there some function that behaves thus?</p> <pre><code>$("#p1").isBefore($("#p2")); // == true $("#p3").isBefore($("#p2")); // == false $("#p1").isBefore(#("#p3")); // == true </code></pre> <p>Note that I care about position in the HTML tree of the document, not physical position on the screen.</p>
javascript jquery
[3, 5]
2,254,545
2,254,546
create a game like crosswords in Android
<p>I would like to create a game like crosswords, which will have a drag and drop, zoom functionality . Can somebody direct me how can I proceed for this? Is there any 3rd party Jar needed to develop?</p> <p>Which view is perfect for this, I mean, to create a chess board like UI and letters on top of it.</p> <p>I need to drag one letter from 1 column to another.</p>
java android
[1, 4]
5,710,778
5,710,779
jParallax trouble
<p>Hey everyone! I have a problem with this plugin. I have no idea what is wrong here... All I did was the same as in the examples.</p> <p><strong>HTML</strong> </p> <pre><code>&lt;div id="parallax"&gt; &lt;div style="width: 830px; height: 280px;"&gt; &lt;img style="position:absolute; top:0px; left:350px;" alt="" src="images/smile1.png"/&gt; &lt;/div&gt; &lt;div style="width: 800px; height: 250px;"&gt; &lt;img style="position:absolute; top:200px; left:0px;" alt="" src="images/smile1.png"/&gt; &lt;/div&gt; &lt;div style="width: 1000px; height: 260px;"&gt; &lt;img style="position:absolute; top:100px; left:150px;" alt="" src="images/smile1.png"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>CSS</strong></p> <pre><code>#parallax { background:#ccc; position:absolute; overflow:hidden; width:700px; height:300px; } </code></pre> <p><strong>JS</strong> </p> <pre><code> &lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery('#parallax').jparallax({}); }); &lt;/script&gt; </code></pre> <p>and nothing happened... pictures are standing without any movements... any ideas?</p>
javascript jquery
[3, 5]
2,542,652
2,542,653
scrollTo top of a div
<p>lets say I have this:</p> <pre><code>var infoBox = $(".info"); </code></pre> <p>lets say then I am expanding one <code>infoBox</code> and I want the document to scroll to the top of that <code>infoBox</code> sot hat I can see its whole content.</p> <p>I know i should first find the offset, the distance of <code>infoBox</code> from the top and left of the document and I also know <code>offset()</code> returns <code>top</code> and <code>left</code>.</p> <p>Is this what should do then?</p> <pre><code>var offset = infoBox.offset(); $(document).scrollTo(offset.top); </code></pre>
javascript jquery
[3, 5]
3,288,429
3,288,430
IP Address Parameter in ASP.Net
<p>I have a stored procedure that inserts a few columns into a database, IP Address, Name, Comments. I am not sure how to get the ip address of the users machine. Perhaps I am to create a variable of the same type (INT) and then store the IP Address in there. I am kinda of lost on this one. </p> <pre><code>static int IPAddress() { get { return Request.UserHostAddress; }; }//How do I pass from here into my stored procedure? cmdI.Parameters.Add(new SqlParameter("@IPAddress", cmdI)); cmdI.Parameters.Add(new SqlParameter("@Name", cmdI)); cmdI.Parameters.Add(new SqlParameter("@Comments", cmdI)); </code></pre>
c# asp.net
[0, 9]
3,672,080
3,672,081
Getting the height from CSS, not from an element in the DOM
<p>I'm creating multiple elements and adding them to the DOM. As I add them the height of the container grows based on the height of the items being added. All the items being added are the same, based off of a CSS class. I would like to set the height of the container DIV before the individual items are added, as they are delayed by an ajax call.</p> <p>Is there a way to get what the item height will be from the CSS class definition itself rather than having to wait to read it from an element in the DOM?</p>
javascript jquery
[3, 5]
1,577,820
1,577,821
how to send a variable from jquery to a template?
<p>how to send a variable from jquery to a template?</p>
javascript jquery
[3, 5]
1,485,928
1,485,929
How do I change the scrollbar's height on this site?
<p>I can't set the scrollbar's height on <a href="http://www.demo.creamama.fr/plugin-scrollbar/" rel="nofollow">this site</a>. Its default height is the window screen's height. How do I change the height?</p> <p>【I repeat the details,the link <a href="http://taxi.bodait.com/scrollbar2.html" rel="nofollow">http://taxi.bodait.com/scrollbar2.html</a> has the problem,how i do to change the height,everyone look look,thanks】</p>
javascript jquery
[3, 5]
5,254,226
5,254,227
how to make Dynamic Scrolling list in asp.net
<p>how to make Dynamic Scrolling list in asp.net ?</p> <p>i have a text file that contain sentences, and i want</p> <p>to show those sentences in dynamic scrolling list in my webform (like news)</p> <p>how to do it ?</p> <p>can i get any sample code ?</p>
c# asp.net
[0, 9]
5,455,102
5,455,103
How do i Turn ON/OFF the Caps lock key
<p>We can able to detect the Caps lock key is ON/OFF using Jquery. My question is </p> <p>"can we possible to Turn ON/OFF the Caps lock key using Jquery or Javascript in Keypress event".</p> <p>And also using C#, How to achieve this?</p> <p>Thanks in advance !!!</p>
c# javascript jquery
[0, 3, 5]
1,470,697
1,470,698
jQuery Setting global var
<p>I am using the following JS code in multiple places;</p> <pre><code>$(this).attr("name") </code></pre> <p>I use it in diff places as;</p> <pre><code>var currentKey = $(this).attr("name"); currentKeyVal = retrievedUserDataObj[$(this).attr("name")]; currentKeyVal = UserDataObj[$(this).attr("name")]; </code></pre> <p>Now my question is is it possible to somehow make it as global variable so that the above code does not repeat ?</p> <p>I am not sure if it can be made gloabl because of $(this) ?</p> <p><strong>EDIT</strong> Actual/Optimized code;</p> <pre><code> function setFormFieldValues() { var currentKey,currentKeyVal; if (supports_html5_storage()) { var retrievedUserDataObj = JSON.parse(localStorage.getItem('UserDataObj')); localStorageSupport = true; } $(".formFieldUserData").each(function(){ var $this = $(this); currentKey = $this.attr("name"); currentKeyVal = UserDataObj[currentKey]; //Set with default values initially if (localStorageSupport) { if(retrievedUserDataObj) //called when there are some values in localStorage currentKeyVal = retrievedUserDataObj[currentKey]; } else { if ($this.val() != "") currentKeyVal = $this.val(); } $("#"+currentKey).val(currentKeyVal); //Input text box $("#"+currentKey+"Txt").html(currentKeyVal); // Form label }) } </code></pre>
javascript jquery
[3, 5]
3,135,451
3,135,452
How to create mobile size emulator in Android 3.0?
<p>If i create the emulator for Android 3.0, it opens for tablet size. Is it possible to create emulator for mobile in Android 3.0?</p>
java android
[1, 4]
4,533,206
4,533,207
jquery-how to detect child id?
<pre><code>&lt;div id="first"&gt; &lt;div id="here"&gt;...&lt;/div&gt; &lt;/div&gt; &lt;div id="second"&gt; &lt;div id="here"&gt;...&lt;/div&gt; &lt;/div&gt; </code></pre> <p>jquery:</p> <pre><code>$("#second #here").click(function(){}); </code></pre> <p>how to write jquery to detect when I click the second ?</p>
javascript jquery
[3, 5]
2,221,071
2,221,072
Web page interfacing with COM port to control page
<p>I'm looking at creating a project that has a touch screen panel on a com port and a front facing website.</p> <p>I want the touch screen panel to interface with the web page, it will have two buttons (left &amp; right) and I want those actions to "do something" on the web page.</p> <p>I'm trying to work out which programming/scripting language would be best to, I could use JS but I believe that'd mean polling a c/perl/php script that is listening on the COM port considering JS has no socket capabilities.</p> <p>Would it be easier if I used ASP.NET/C# - would it cause me less headaches?</p> <p>Any input is appreciated.</p>
c# php javascript asp.net
[0, 2, 3, 9]
212,905
212,906
Webcontrol as a property of another webcontrol
<p>In asp.net sometimes a webcontrol needs to reference another webcontrol such as the gridview needs the id of the datasource object that it will bind to.</p> <p>I have a property of my webcontrol that is a string (the id of the webcontrol I want to reference). How do I access the actual webcontrol based on this id?</p>
c# asp.net
[0, 9]
3,351,100
3,351,101
How to strip HTML <p> tags injavascript without using regex
<p>I reading a text using .Html() and copying the content to the textarea. I don't want to keep anything except the <code>&lt;br/&gt;</code> tag wich I intend to replace to keep the new line formatting. Basically, I have <code>&lt;p&gt; &lt;p/&gt;</code> which I no more want to keep when I am copying to the textarea. How can I do that without using regex expression?</p> <pre><code>$("#myText").val($.trim($(this).closest('tr').next('tr').find('.mytext').html().replace('&lt;br/&gt;', '/r/n')); </code></pre> <hr>
javascript jquery
[3, 5]
5,392,573
5,392,574
Javascript loader
<p>I have an image carousel on my page with some fairly small images. the issue is not with the images but with the script itself. I want to display a javascript loader image while the entire plugin is loaded and is ready for action. </p> <p>when i launch the page, the carousel <code>&lt;li&gt;</code> first display like a normal list, then get formed into the carousel. i want to avoid that and display a loader image while the entire thing is loaded. </p>
javascript jquery
[3, 5]
3,221,635
3,221,636
Are there way start activity over lock screen?
<p>I need start activity over lock screen. It can be small activity on lock screen or fully new lock screen. It must start with lock button click</p> <p>How to do this? I already have activity, broadcast reciver and service to do all job, but don't know how to put activity over lock screen.</p>
java android
[1, 4]
4,544,072
4,544,073
Variable pointer to interface between C# and C++
<p>I am currently stuck trying to do this conversion. I have a C++ wrapper that exposes a function...</p> <pre><code>public __gc class InternalModuleConfig : public ModuleConfig { Object* InternalModuleConfig::CommitChanges(IModuleConfig* config) { VARIANT variant = {0}; m_pModuleConfig = config; HRESULT hr = m_pModuleConfig-&gt;CommitChanges(&amp;variant); if (FAILED(hr)) { VariantClear(&amp;variant); return Marshal::GetObjectForNativeVariant(&amp;variant); } return NULL; }; }; </code></pre> <p>I am trying to call this function in c# but failing at it. I have an interface in C# with the following namespace:</p> <p>DirectShow.IModuleConfig</p> <p>Now I am trying to take my existing interface and get a pointer to it to use as the variable for CommitChanges in C# however I always get an conversion error.</p> <p>This is the barebone with what I'm trying...</p> <pre><code>InternalModuleConfig config; config.CommitChanges(ref (filter as IModuleConfig)); </code></pre> <p>This does not work... I'm a bit confused as to how to apply the type IModuleConfig* for the parameter.</p> <p>Any ideas?</p> <p>EDIT: This is the interface the InternalModuleConfig is based on:</p> <pre><code>public __gc interface ModuleConfig : public IDisposable { public: virtual Object* CommitChanges(IModuleConfig* config) = 0; IModuleConfig* m_pModuleConfig; }; </code></pre>
c# c++
[0, 6]
5,061,923
5,061,924
JQuery: How to round an integer up or down to the nearest 10
<p>My JS skills are not good enough to do the following task so I am calling on the community! I could learn to do this, but I need to get this task done quickly, so I appreciate any help.</p> <p>I would like to round a number passed by a user to the nearest 10. For example, if 7 is passed I should return 10, if 33 is passed I should return 30.</p> <p>I am using JQuery, I had a look for this sort of function but couldn't find one, it's too specific I guess. Hopefully, the Math library can be used?</p> <p>Thanks all</p>
javascript jquery
[3, 5]
774,046
774,047
Jquery: please help explain this code because I need to tweak it
<p>Can someone explain this to me? I'm trying to understand exactly why drop down lists inside a li tag work okay but when using a form the menu disappears when clicked anywhere. </p> <pre><code>menu.find('ul li &gt; a').bind('click', function (event) { event.stopPropagation(); } </code></pre> <p>It works in combo with:</p> <pre><code>$("html").click(function() { menu.find('.active').removeClass('active'); }); </code></pre> <p>Full code with menu example: </p> <p><a href="http://jsfiddle.net/e4yy4/" rel="nofollow">http://jsfiddle.net/e4yy4/</a></p>
javascript jquery
[3, 5]
1,421,231
1,421,232
pass php variable value to javascript
<p>Im trying to pass the value of a php variable into javascript but i just cant get it to work. Am I doing anything wrong? Below is the line of code I'm working with.</p> <pre><code>var dist = parseInt("&lt;?php echo json_encode($distance); ?&gt;"); </code></pre>
php javascript
[2, 3]
749,529
749,530
jQuery validation without "form" tag
<p>According to <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">http://docs.jquery.com/Plugins/Validation</a> the "form" tag is necessary in order to do validation. In my case I don't have form tag. How can I validate(required field) my textbox on click of "button" type control</p>
javascript jquery
[3, 5]
244,426
244,427
Checkbox onclick is not working in IE8 but working in IE9
<p>I'm creating dynamic checkbox and attaching onclick event with that. Below is the code:</p> <pre><code>var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var checkbox = document.createElement("input"); checkbox.type = 'checkbox'; checkbox.onclick = testClick(); cell1.appendChild(checkbox); function testClick() { alert("Hello"); } </code></pre> <p>The above piece of code is working fine with IE9 but not with IE8. I'm using Jquery 1.7.1.</p> <p>Any help will be greatly appreciated. Thanks..</p>
javascript jquery
[3, 5]
5,695,390
5,695,391
Bind tag vs codebehind set, best practices
<h2>I would like to know what is the best practice between using bind tag and setting direct property to a control in asp.net.</h2> <p><hr /></p> <p>aspx.cs</p> <pre><code>public string Description {get; set;} </code></pre> <p>aspx</p> <pre><code>&lt;asp:Literal ID="txtDescription" runat="server" Text='&lt;%# Description %&gt;' /&gt; </code></pre> <p><hr /></p> <p>aspx.cs</p> <pre><code>public string Description { get { return txtDescription.Text ; } set { txtDescription.Text = value; } } </code></pre> <p>aspx</p> <pre><code>&lt;asp:Literal ID="txtDescription" runat="server" /&gt; </code></pre> <p><hr /></p> <p>The first being best to separate design from code giving the liberty of changing even ID without breaking code. But it seems we can get very long bind tag sometime like this really short example:</p> <pre><code>Text='&lt;%# ((fn_SearchReminders)Container.DataItem).dtDateActivation.Value.ToString("yyyy-MM-dd - hh:mm") %&gt;' </code></pre>
c# asp.net
[0, 9]
4,467,883
4,467,884
How to read PDF file with url in Android
<p>My Code is :</p> <pre><code>File file = new File(docpath); String mimetype = "application/pdf"; Uri path = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(path, mimetype); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); </code></pre> <p>If I want to use the application/pdf method What should I do?</p>
java android
[1, 4]
5,430,817
5,430,818
Jquery / Javascript - most efficient way to build a select menu?
<p>I'm using jquery and trying to tune my select menu builder to run much quicker. </p> <p>I was using each and append, however I've since switched to a standard for loop and currently trying to convert my options from using append to concatenated string appended to my select option using .html(). I seem to be at a loss trying to convert my var option object back to an html string. Could someone please tell me what I might be doing wrong. </p> <pre><code>$.selectMenuBuilder = function(json) { var myselect = $("#myselect"); var list = "&lt;option value=\"\"&gt;&gt; Select Account Number&lt;/option&gt;"; var l= json.funding.length; for(var i=0;i&lt;l; i++) { var funding = json.funding[i]; var option = $("&lt;option value=\"" + funding.id + "\"&gt;" + funding.accountNumber + "&lt;/option&gt;") if(someLogic) { option.attr("selected", "selected"); } //Having trouble here converting option object back to html. list += option.html(); } list += "&lt;option value=\"addnew\"&gt;+ New Account Number&lt;/option&gt;"; myselect .html(list); } </code></pre>
javascript jquery
[3, 5]
2,055,987
2,055,988
How to blank the hidden field value from Jquery
<p>Assume that a hidden field </p> <pre><code>&lt;input type="hidden" id="hdn" name="hdn" value="100" /&gt; </code></pre> <p>So i want to blank the value of hidden field using Jquery. In javascript we can blank using this syntax</p> <pre><code>document.getElementById("hdn").value = ''; </code></pre> <p>but i want it using jquery.</p>
javascript jquery
[3, 5]
2,575,182
2,575,183
Setting the width of columns with an array as parameter
<p>I have the following function:</p> <pre><code>function LoadColWidth(thewidtharray) { for (i = 0; i &lt; thewidtharray.length; i++) { $('#MyGrid .tr:first').eq(i).width(thewidtharray[i]); } }; var NarrowWidth = new Array(70, 72, 97, 72, 97, 72, 96, 76, 76, 76, 76, 75); </code></pre> <p>I'm calling LoadColWidth with different arrays as the parameter and the goal is to resize the width of columns. I'm struggling with the jquery call: it's supposed to loop through each columns by index but it's not working. Any suggestions?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,064,578
1,064,579
Prevent keyboard from showing character bubble
<p>when typing on the keyboard a bubble appears to display the character that you pressed , I am looking for a way to prevent it from doing that !!</p> <p><img src="http://i.stack.imgur.com/imGQr.png" alt="enter image description here"></p>
java android
[1, 4]
1,435,963
1,435,964
Write to file when cache expires
<p>How to write to a file the content of cache when Cache expires.</p>
c# asp.net
[0, 9]
3,855,639
3,855,640
move event handler with jQuery
<p>I have an issue which is driving me crazy and as a last resort I am placing a question here.</p> <p>I want to move the onclick event from an element to the onfocus event of the same element and I am using the following code:</p> <pre><code>$("#theElement").bind("focus", {}, $("#theElement").data("events").click); $("#theElement").unbind("click"); </code></pre> <p>Maybe you have guess it. IT DOES NOT WORK.</p> <p>How do I make this work? I am getting a "fn.apply is not a function" message in the following piece of code from jquery 1.3.2:</p> <pre><code>proxy: function( fn, proxy ){ proxy = proxy || function(){ return fn.apply(this, arguments); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || proxy.guid || this.guid++; // So proxy can be declared as an argument return proxy; } </code></pre> <p><strong>EDIT:</strong> I'm sorry, I should have mentioned. This comes from a plugin which does some stuff when clicking an element. I want to make the same thing when the element gets focus not when it is cliked so the simplest solution I thought off was this since I can't modify the code for the plugin.</p> <p><strong>EDIT:</strong> Found the problem. It is similar to what @sje397 posted in his answer, not</p> <pre><code>$('#theElement').data('events').click[0] </code></pre> <p>but</p> <pre><code>$('#theElement').data('events').click[3] </code></pre> <p>For some reason, even if only one event is registered the thing ends up as 3 (the guid in that piece of code from jquery).</p>
javascript jquery
[3, 5]
145,296
145,297
Upgrading .NET Framework
<p>I want to update my project from .net framework 2 and asp.net 2 to the newest versions. Is there any possible issues I may have?</p>
c# asp.net
[0, 9]
4,381,949
4,381,950
Do I need to put a dollar before variable names with javascript?
<p>I have the following code:</p> <pre><code>var formSubmitHandler = function (link, form) { //e.preventDefault(); var $form = form; var val = $form.valid(); var action = $(form).data('action'); var entity = $(form).data('entity'); </code></pre> <p>Do I need the line "var $form = form"? Can I just later on do "var val = form.valid(); ?</p> <p>It's not my code so I am wondering why the developer added the $ before the form and assigned it?</p> <p><strong>Update:</strong></p> <p>Thanks for all your replies. If as has been said it's just to indicate that it's a jQuery variable then could I just remove that line by changing the function parameters to (link, $form) ?</p>
javascript jquery
[3, 5]
3,870,808
3,870,809
PHP to C# and Vice versa
<p>I'm in this project:</p> <p>A web page that's gonna be used by the front-end company people to query and update data from a SQL DB. I'm working with visual studio and the code behind (C#) is almost done, so the interactions between SQL and C# and ok. My original idea was to work with ASP.NET which is familiar to me, but that's not gonna be possible. I have to switch to PHP. So, today is my first day learning PHP, checking <a href="http://php.net/manual/en/index.php" rel="nofollow">http://php.net/manual/en/index.php</a> and a lot of things seem quite similar to ASP.NET so I guess it won't be that hard. </p> <p>Anyways, some questions popped up quite fast as I wanted to script something else than a "hello world"</p> <p>. Is there an easy way to get/send C# variables from my class using a php page? I've read soemthing about using XML in order to do so, but still I'm scratching my head, is there another, easier, way to do this?</p>
c# php
[0, 2]
2,360,390
2,360,391
Simulate multiple keypresses in javascript
<p>I would like to simulate the user pressing tab then enter when they press enter. I know this sounds bad, but I have an asp.net web application that will only allow me to have one form with runat="server" on it so when the user hits return the main form gets submitted. I have another textbox on the page though (that ideally should have it's own form but can't because it is asp), and when enter is hit from there obviously the main form is submitted. The simplest way I could think is to simulate tab then enter using javascript, but I have been unsuccessful in that. I am welcome to any other solutions to this problem. So far I have simulated pressing tab, but I don't know how to simulate more than one keypress though.</p> <p>Here is the code I have so far, I imagine return 9; needs to be replaced with something else. JQuery will also do.</p> <pre><code>function suppressEnter (e) { var keyPressed; if (window.event) { keyPressed = window.event.keyCode } // IE else if (e) { keyPressed = e.which }; // Netscape if (keyPressed == 13) { return 9; } else { return true; } } </code></pre> <p>EDIT: return 9 + 13; works in chrome, but not IE</p>
javascript jquery asp.net
[3, 5, 9]
450,437
450,438
Delay in show after 2 second by jquery
<p>I want if user moved the mouse for two seconds (Keep the mouse button for two seconds) on a class, show to he hide class. how is it? ()</p> <p>If you move the mouse tandem (several times) on class, You will see slideToggle done as automated, I do not want this. How can fix it?</p> <p><strong>DEMO:</strong> <a href="http://jsfiddle.net/tD8hc/" rel="nofollow">http://jsfiddle.net/tD8hc/</a></p> <p>My tried:</p> <pre><code>$('.clientele-logoindex').live('mouseenter', function() { setTimeout(function(){ $('.clientele_mess').slideToggle("slow"); }, 2000 ); }).live('mouseleave', function() { $('.clientele_mess').slideUp("slow"); })​ </code></pre>
javascript jquery
[3, 5]
5,480,737
5,480,738
jqGrid celledit under certain conditions
<p>I want the cells to be in edit mode when a certain condition is true. I'm using cellEdit true and editable in the column but in some occasions the user shouldn't be able to edit some cells of the same column even though the column is editable=true. I need to use cell editing not inline editing.</p> <p>Any thoughts?</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,252,503
2,252,504
To read all text of all font-family of particular image using MODI in c# asp.net
<p>I have written code for converting text from image using MODI as follows:</p> <pre><code>public void CheckFileType(string directoryPath) { IEnumerator files = Directory.GetFiles(directoryPath).GetEnumerator(); while (files.MoveNext()) { //get file extension string fileExtension = Path.GetExtension(Convert.ToString(files.Current)); //get file name without extenstion string fileName = Convert.ToString(files.Current).Replace(fileExtension, string.Empty); try { //OCR Operations ... MODI.Document md = new MODI.Document(); md.Create(Convert.ToString(files.Current)); md.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true); MODI.Image image = (MODI.Image)md.Images[0]; //create text file with the same Image file name FileStream createFile = new FileStream(fileName + ".txt", FileMode.CreateNew); //save the image text in the text file StreamWriter writeFile = new StreamWriter(createFile); writeFile.Write(image.Layout.Text); writeFile.Close(); } catch (Exception) { //MessageBox.Show("This Image hasn't a text or has a problem", //"OCR Notifications", //MessageBoxButtons.OK, MessageBoxIcon.Information); } } } protected void btnbrowse_Click(object sender, EventArgs e) { CheckFileType(@"C:\OCR"); } </code></pre> <p>It works fine. But the problem is it does not recognize all the text from image. Please help me.</p>
c# asp.net
[0, 9]
2,234,714
2,234,715
Display different aspx file in a popup in asp
<p>I am currently developing an ASP.net application. I am generating a table (standard HTML table not GridView) and populating it with data from a MySQL Database. One column of the table has hyperlinks which should link to a dynamic aspx web page that will display certain information based on the database.</p> <p>When the user clicks on the hyperlink I want to display a pop up that hovers over the top of the original content, not opening a new browser window just displaying like a popup window which will darken the contents of the background content. </p> <p>I have tried to google search this but did not find anything.</p> <p>Thanks for any help you can provide. </p>
c# asp.net
[0, 9]
540,817
540,818
What is the most simple slider to slide divs?
<p>I have 9 small divs with content on my page. I need to show only 3 of them to user, and give user ability to push "arrow" to see next 3 divs. Div example: </p> <pre><code> &lt;img src="/img/icons/1.png" alt="" width="150" height="100"&gt; &lt;div class="elementwrap"&gt; &lt;h3&gt;&lt;a href="/info/view/1"&gt;Title&lt;/a&gt;&lt;/h3&gt; &lt;p&gt;Description&lt;/p&gt; &lt;/div&gt; &lt;div class="addlinks"&gt; &lt;a href="/info/view/1#reviews" class="comments"&gt;0&lt;/a&gt; &lt;a href="/info/view/1" class="readmore"&gt;Read more&lt;/a&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
1,197,811
1,197,812
jQuery post/ajax post problem
<p>HI im trying to send a jquery post/ajax to send some variables to a php file. </p> <pre><code>&lt;script src="/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var music =''; var genre =''; var language =''; var nasheedid = "&lt;? echo $postid; ?&gt;"; var session = "&lt;? echo $_SESSION['SESS_TMP']; ?&gt;"; $(function(){ $('.submit').click(function(){ var postdata = {pmusic: music, pgenre: genre, plang: language, psession: session}; $.ajax({ type: 'post', cache: false, url: 'addmusic.php', data: postdata, success: function (msg) { alert(msg); }, dataType: "text", }); }); }); </code></pre> <p>now regardless of where i post the stuff to, (even if i change the url to url: blahblah.php123 I still get the same results (which is):</p> <p>The alert displays the entire source code of the file (that the above code is on)</p>
php jquery
[2, 5]
5,929,019
5,929,020
The control of up and down or left and right key on keyboard using jquery in Android
<p>I am using jquery and jquery mobile to develop the program.</p> <pre><code>$(document).keydown(function(e) { if ( e.which == 19) { // get the up key alert("111111"); }) </code></pre> <p>I check online. It is said only Android versions 4.1.1 can support keyboard. Otherwise I need to write about the return value. </p> <p>Who knows how to use jquery set the keyboard? </p> <p>Thanks in advance!</p>
android jquery
[4, 5]
2,628,618
2,628,619
How to get the value from a function
<p>How do I get a value from a function inserted into my HTML.</p> <p>I have tried this:</p> <pre><code>function testReturn(value) { var ReturnValue = value; return ReturnValue; } html = "&lt;div&gt;' + testReturn(2) + ' &lt;/div&gt;"; </code></pre> <p>I get an error saying <code>Undefined</code></p>
javascript jquery
[3, 5]
3,367,957
3,367,958
How can i focus last append value in a textview/ scrollview
<p>I trying to focus the last append value in the text box. But unfortunately i cant able to bring it up. Can you please help me to solve this.</p> <pre><code>&lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="115dp" android:orientation="vertical" &gt; &lt;ScrollView android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="165dp" android:background="#FFFFFF" &gt; &lt;TextView android:id="@+id/tvHistory" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:gravity="right" android:focusable="true" android:text="" android:textColor="#000000" /&gt; &lt;/ScrollView&gt; </code></pre> <p>Scroll view and append is working correctly. But i want to focus last append value with a color</p> <pre><code>tvHistory.append(tvInput.getText()+"\n"); </code></pre>
java android
[1, 4]
3,787,073
3,787,074
How to get only one element
<p>For example I have a function that has one argument, it can be DOM element ID or className. How can I select only first element wrapped with jQuery?</p> <p><code>$(value).get(0)</code> and <code>$(value)[0]</code> returns just the plain DOM element, not a jQuery wrapped element.</p>
javascript jquery
[3, 5]
2,431,979
2,431,980
Format currency in jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4682789/format-currency-using-javascript">Format currency using javascript</a> </p> </blockquote> <p>I used to format the price of the product by asp.net :</p> <pre><code>&lt;%: string.Format("{0:C}", Price)%&gt; </code></pre> <p>Now I want to format it by javascript/jquery.</p> <p>Can anyone show me please.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
208,775
208,776
Enhancing the SimpleCursorAdapter to check the data in Android?
<p>I have a sqlite database. I am able to query it and get a cursor with results. It populates the data well in a list view which has 1 image view and 2 text views. However the cursor result set which has 2 columns is of text. This is shown in the 2 text views. Everything till here works fine.</p> <p>Now based on the value of one of the column I need to show different images in the image view in the list item. How do I do this. As of now I am using the below code. How do I modify it to get a image view changes based on the column value?</p> <p>Cursor mCursor = mDbHelper.fetchAll(); startManagingCursor(mCursor);</p> <pre><code> String[] from = new String[]{"TITLE","BODY"}; int[] to = new int[]{R.id.text1,R.id.text2}; SimpleCursorAdapter listValues = new SimpleCursorAdapter(this, R.layout.row_item, mCursor, from, to); setListAdapter(listValues ); </code></pre>
java android
[1, 4]
4,744,168
4,744,169
how to make readLine() of Filereader to go to previous location
<p>I am creating one text file which will connected to some server. this text file will receive its contents from the server. It will receive the some text data continuously.</p> <p>To limit the file size , I am checking no.of lines in the file and if exceeds the mark I am clearing file content. Server will write from the beginning.</p> <p>Below is the code I have used to do this :</p> <pre><code>LineNumberReader myReader = new LineNumberReader( new FileReader(new File("mnt/sdcard/abc.txt"))); while(true) { while(myReader.readLine() != null) { counter ++; } if(counter &gt; 100 ) { PrintWriter writer = new PrintWriter("/mnt/sdcard/abc.txt"); writer.print(""); writer.close(); writer = null; counter = 0; } } </code></pre> <p>But after I clear the contents in a file my "counter" not increasing. But my file is having some data. I think after reading done I have set my "myReader" to some intial..? If its how to set that to initial so that .readLine() should start from begining.</p>
java android
[1, 4]