Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
4,790,820
4,790,821
Dynamically limit the amount of checkboxes that can be checked by user
<p>I've created a test and answer system. Each question can either have one or multiple answers, e.g "Please mark 1 answer", "Please mark 3 answers" etc.</p> <p>Is it possible to limit the amount of checkboxes that the user can check based on this? If the question requires 1 answer, then they can only check 1 of the checkboxes. </p> <pre><code>&lt;?php foreach ($rows as $row){ ?&gt; &lt;input type="checkbox" name="answer&lt;?php echo $counter; ?&gt;[]" value="&lt;?php echo the_sub_field('answer'); ?&gt;" /&gt; &lt;?php echo $row['answer']; ?&gt; &lt;?php } ?&gt; </code></pre> <p>It loops through this and pulls in each answer, the amount of answers needed for each questions is dynamic and is controlled by this field (where it can be 1, 2, 3 etc):</p> <pre><code>&lt;?php echo $repeater_row['required_answers']; ?&gt; </code></pre> <hr> <p>Using the jquery below, although this isn't dynamic:</p> <pre><code>$(document).ready(function () { if ($("input:checkbox:checked").length &gt;= 3) { $("input:checkbox").not(":checked").attr("disabled", 3); } $("input:checkbox").click(function () { var bol = $("input:checkbox:checked").length &gt;= 3; $("input:checkbox").not(":checked").attr("disabled", bol); }); }); </code></pre> <p><strong>How can I do it dynamically? Each question has it's answers named in sets, so the first question has an answer set called with their inputs named <code>name="answer1[]"</code> the second question has an answer set <code>name="answer2[]"</code> and so on.</strong></p>
php jquery
[2, 5]
1,789,023
1,789,024
How to make a Dictionary and Utility in C#?
<p>I have 15 web pages that has the same labels. But, in one case, I need to change all of their Text, in all pages. Other than writing them all by one, I want to make something general and public that I can use in all the pages. The ID's of the labels are same. I don't know how to do it with different web pages. Can you give me a hint? I don't know if its called Utility or Dictionary. A friend of mine mentioned it a few mins ago but I don't want to ask her again she already thinks I am dumb :(</p> <p>They are ASP.NET pages with C# also I am using Devexpress. I want to change only one web page at a time. But use the method for all web pages when they are shown (by the user). Not changing all the 15 at the same time. </p>
c# asp.net
[0, 9]
5,883,375
5,883,376
How can I get last characters of a string using JavaScript
<p>I have </p> <pre><code>var id="ctl03_Tabs1"; </code></pre> <p>Using JavaScript, how might I get the last five characters or last character?</p>
javascript jquery
[3, 5]
5,379,449
5,379,450
How to apply an algorithm for a C# container like functor in C++?
<p>In C++ to apply an algorithm for a collection or container, I overload the <code>operator()</code>. For example generate random number for a container: </p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;string&gt; #include &lt;algorithm&gt; #include &lt;cstdlib&gt; using namespace std; class rnd_gen { public: rnd_gen( int lo, int up ) : lo( lo ), up( up ) { } int operator()() const { return lo + rand() % up; } private: int lo; int up; }; int main() { vector&lt;int&gt; vt; vt.push_back( 3 ); vt.push_back( 1 ); vt.push_back( 2 ); generate( vt.begin(), vt.end(), rnd_gen( 10, 100 ) ); } </code></pre> <p>Is is possible to perform these kinds of operation without explicitly writing a for loop? Or any closest equivalent approach in C#.</p> <p>Thanks,<br> Chan </p>
c# c++
[0, 6]
5,762,488
5,762,489
displaying images in a slider
<p>I want to know is there an easy way in order to be able to place images in a loop as below in like a slider? The user sees first image in a slider and then by using arrows for example, be able to slide to next to next or previous image. If user is on last image and wants to go on next image, it displays the first image again. if user is on first image and click on previous, it goes on last image. So it stays continuous.</p> <p>Below is code where if there are no images then it displays a blank but if there are images, then displays those images in a slider:</p> <pre><code>&lt;?php //start:procedure image $img_result = ''; if(empty($arrImageFile[$key])){ $img_result = '&amp;nbsp;'; }else{ ?&gt; &lt;?php foreach ($arrImageFile[$key] as $i) { ?&gt; &lt;p&gt;&lt;img alt="&lt;?php echo $i; ?&gt;" height="200" width="200" src="&lt;?php echo 'ImageFiles/'.$i; ?&gt;"&gt;&lt;/p&gt; &lt;?php } ?&gt; &lt;?php } //end:procedure image </code></pre>
javascript jquery
[3, 5]
3,359,595
3,359,596
is there any way to check the information of client device in javascript or php, which request to server? is this device mobile, tablet or pc?
<p>I need to detects client device at server end using php or javascript? which is client device and which browser is using that device? </p>
php javascript
[2, 3]
5,994,750
5,994,751
jQuery Positioning and Animation
<p>So I have a piece of code: </p> <pre><code>jQuery.fn.center = function(parent) { parent = this.parent(); this.css({ "position": "absolute", "top": ((($(parent).height() - this.outerHeight()) / 2) + $(parent).scrollTop() + "px"), "left": ((($(parent).width() - this.outerWidth()) / 2) + $(parent).scrollLeft() + "px") }); return this; } </code></pre> <p>This code grabs an element and moves it to the center of the parent. Works nicely. There are a couple of things I would like it to do aside of what it's doing. </p> <ol> <li><p>I need it to float above all other elements in that parent. A z index more or less. I tried to apply a z-index, but it didn't seem to work. I dunno if I may have been doing it wrong, or if there is a better way. </p></li> <li><p>I need it to move back to the position it was in. The way this works, is the block is gonna be positioned on the page (via CSS), and when the user clicks, it moves it to the center of the page, as the code is already doing. Is there any way that, if a user clicks an exit button, I can program said button to move it back to where it originally was? i don't know if I can pass variables around in jQuery. </p></li> <li><p>This option is more for aesthetics, and i don't deem it necessary, but would like it if you have a little extra time. I would like the block to slide from it's position to the center of the page, and back, as opposed to just popping there. As I stated, this is just aesthetics and i really don't need that to happen. </p></li> </ol> <p>Much appreciated to anyone that can help me out.</p>
javascript jquery
[3, 5]
379,114
379,115
Do I need to detach my event handler before I reattach it to the new element?
<p>I'm writing a jQuery JS file that attaches an event handler to a link, but the event handler replaces the link with a new link retrieved via an ajax request. It's actually a +1, -1 function, so the link switches back and forth.</p> <p>It's my understanding that even when the link is clicked twice and returns to its original value, it will become a third unique object, correct? My question is, does it do me any good to detach the event handler each time? Because it doesn't throw an error when I remove the event handler after the link gets replaced, I'm <em>guessing</em> that the object and its event handler still exist in JS, they are just no longer in the HTML document, correct? It works fine whether I do or not, but I'm just now 100% sure how exactly the process works.</p> <p>Here's my .done() function:</p> <pre><code>.done(function(ReturnData){ PlusOneDiv.replaceWith(ReturnData); // Redefine variables and detatch/reattach event PlusOneLink.off('click'); // Is this line helpful at all? PlusOneDiv = $('#plusonediv'); PlusOneLink = PlusOneDiv.children('a'); PlusOneLink.on('click', submit_plus_one); </code></pre>
javascript jquery
[3, 5]
3,708,042
3,708,043
How to prevent the user to change page with jQuery
<p>I have a page with a form that is submittes via ajaxSubmit() (so, without changing the page).</p> <p>My goal is that, when the user try to change page (or even to close the browser), i ask him if really want to exit the page without sending the form (exactly as gmail does).</p> <p>Gmail for example do this with a window.confirm-like popup, but if it is possible, i'll like to handle it with custom messages and options.</p> <p>jQuery have the unload event:</p> <pre><code>$(window).unload( function () { alert("Bye now!"); } ); </code></pre> <p>but it permits me just to do something before exit the page; i need to 'block' the page exit, if the user click the relative button.</p> <p>So, how to handle (and cancel) the page-exit event?</p>
javascript jquery
[3, 5]
2,014,057
2,014,058
Dynamically changing the jQuery sortable placeholder value
<p>How do I use an if statement in the jQuery sortable plugin to dynamically determine the placeholder class?<br/><br/> If the item is being dragged around in <code>#listA</code> then I want the placeholder class to be <code>.ImInListA</code><br/> If the item is being dragged around in <code>#listB</code> then I want the placeholder class to be <code>.ImInListB</code></p> <p><br/> jQuery</p> <pre><code>$( "#listA, #listB" ).sortable({ connectWith: ".connected_sortable", placeholder: //if the current item is being dragged in #listA //use css class selector .ImInListA //else //use css class selector .ImInListB }).disableSelection(); </code></pre> <p>HTML:</p> <pre><code>&lt;ul id="listA" class="connected_sortable"&gt; &lt;li value="1"&gt;list_a_1&lt;/li&gt; &lt;/ul&gt; &lt;ul id="listB" class="connected_sortable"&gt; &lt;li value="2"&gt;list_b_2&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
2,733,721
2,733,722
Go to Top of Page when is postback
<p>I have an ascx control which has inside a Save Button and it is at the bottom of the page. When i click the save button and it postbacks the control remains at the bottom. Is that any whay to go to top after postback?</p>
c# asp.net
[0, 9]
4,279,725
4,279,726
Transfer data between activity with spinners
<p>i am new in Android development.</p> <p>Im trying to transfer selected data from multiple spinners (Search activity) to another activity (JSON Search result activity)</p> <p>and at the end i have button that open the search result</p> <p>Search activity: i have the java spinner</p> <pre><code>ArrayAdapter&lt;CharSequence&gt; whatlist = ArrayAdapter.createFromResource(this, R.array.whatlist, android.R.layout.simple_spinner_item); whatlist.setDropDownViewResource(R.layout.spinner_style); spwhat = (Spinner) findViewById(R.id.spWhat); spwhat.setAdapter(whatlist); spwhat.setOnItemSelectedListener(new MyOnItemSelectedListener()); </code></pre> <p>and the MyOnItemSelectedListener</p> <pre><code> public class MyOnItemSelectedListener implements OnItemSelectedListener { public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int pos, long id) { strs = new Bundle(); Intent i = new Intent(SearchActivity.this, SearchResult.class); strs.putString("setwhat", parent.getItemAtPosition(pos).toString()); i.putExtras(strs); } public void onNothingSelected(AdapterView&lt;?&gt; arg0) {} } </code></pre> <p>This is the button</p> <pre><code>btnsearch = (Button)findViewById(R.id.btnSearch); btnsearch.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent ia = new Intent(SearchActivity.this, SearchResult.class); SearchActivity.this.startActivity(ia); } }); </code></pre> <p>This is in the search result</p> <pre><code> Bundle extras = getIntent().getExtras(); if(extras!=null){ Integer item = extras.getInt("setwhat"); //Use a switch(item) here to switch to different links based on selection TextView tv = (TextView) findViewById(R.id.tvtv); tv.setText("Another Activity, Item is :" + item.toString()); </code></pre> <p>the text wont change. i have tried any tutorial on the web and searching here for a solution for hours.. anyone can help?</p>
java android
[1, 4]
5,853,321
5,853,322
formated output of JS contents into a HTML table
<p>i have a javascript file with the following content and would like to generate a dynamic html table with it's content</p> <pre>(function($) { My.Shortcuts = { a: 'Name', b: 'Elvis', c: 'Fun' }; My.Plugins.extend({ Name: { url: 'http://www.name.com' example: 'some example text here' }, Elvis: { url: 'http://www.elvis.com' }, Fun: { url: 'http://anothersite.com' } }); })(jQuery);</pre> <p>result should be a html table or div list like:</p> <pre>a | Name | http://www.name.com (some example text here) b | Elvis | http://www.elvis.com c | Fun | http://anothersite.com</pre> <p>unfortunately i have no clue how to do this?</p>
javascript jquery
[3, 5]
2,405,965
2,405,966
Check if javascript is already attached to a page?
<p>Is there any way to check if javascript file is already attached to the page by its file name.</p> <p>For eg : </p> <pre><code>if ("path-to-script/scriptname.js") already embeded { call related function } else { Append '&lt;script src="path-to-script/scriptname.js" type="text/javascript"&gt; &lt;/script&gt; ' call related function } </code></pre> <p><strong>Basically I dont want 1 script to be attached twice on the same page.</strong></p>
javascript jquery
[3, 5]
5,917,220
5,917,221
What's the effect of implementing the OnClickListener with an Activity?
<p>I don't understand why I have to implement the OnClickListener to use the OnClick-method. Assuming this code:</p> <pre><code>public class KlickitestActivity extends Activity implements OnClickListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public void onClick(View v) { // code what happens when a click is made } </code></pre> <p>From the class OnClickListener I only use the method onClick(View v) - and this one is overwritten. Why can't I just define the onClick-method without implementing the OnClickListener?</p>
java android
[1, 4]
4,739,476
4,739,477
Generate price from a list with Javascript variables
<p>I have a few variables:</p> <pre><code>var test1 = 1500; var test2 = 500; var test3 = 3000; var test4 = 20000; </code></pre> <p>And I have an another variable like this:</p> <pre><code>var list = 'test3,test1'; </code></pre> <p>This is not fixed obviously, so that can be <code>'test4,test1,test2'</code> etc..</p> <p>Now, I need a price variable. <code>test3+test1 = 4500</code></p> <pre><code>var price = '4500'; </code></pre> <p>But I don't have any idea how to do that. Here is what I have so far:</p> <pre><code>var names = []; $(':checkbox:checked').each(function() { names.push(this.name); }); var list = names.join(','); </code></pre> <p>Any ideas?</p>
javascript jquery
[3, 5]
3,206,914
3,206,915
Java code translation of Python array-splitting code
<p>Can someone please give the Java equivalent of the below python (which slices a given array into given parts) which was originally written by ChristopheD here:</p> <pre><code>def split_list(alist, wanted_parts=1): length = len(alist) return [ alist[i*length // wanted_parts: (i+1)*length // wanted_parts] for i in range(wanted_parts) ] </code></pre> <p>I don't know any python but can really use the above code in my Java app. Thanks</p>
java python
[1, 7]
426,951
426,952
Change table row display property
<p>I have an html page with a table that contains a hidden row:</p> <pre><code>&lt;table&gt; &lt;tr id="hiddenTr" style="display:none"&gt; ... &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I need to make it visible at client side using jquery. I tried this</p> <pre><code>$('#hiddenTr').show(); </code></pre> <p>and this</p> <pre><code>$('#hiddenTr').css('display', 'table-row'); </code></pre> <p>Both implementations don't work for me. Furthemore the second one is not crossbrowser.</p> <p><strong>UPD.</strong> Sorry, guys. That was my fault: I mistyped tr element id. That's strange $('hiddenTr') didn't return null...</p>
javascript jquery
[3, 5]
471,534
471,535
How to render .msg file content in ASPX page?
<p>I have some e-mails that i would like to store in SQL Server database and render within an asp.net web application. <br /> Currently the .msg files are stored in a BLOB field and and a link to download the file to user's system is given. <br /> However, I want to render the content of the message directly without giving the user any options to download it. The messages are in HTML format with embedded images.<br /> All suggestions are welcome.</p>
c# asp.net
[0, 9]
5,176,715
5,176,716
basic jquery .load
<p>i have this main page</p> <p>index.html</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $("#content").load('page.html'); $("#menu").click(function () { alert('Hello'); }); }); &lt;script&gt; &lt;div id="content"&gt;&lt;/div&gt; </code></pre> <p>and in page.html</p> <pre><code>&lt;div id="menu"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>the .load is working .. but the alert function is not working</p> <p>must i but the function in page.html??? or there is another way ??</p>
javascript jquery
[3, 5]
406,142
406,143
validating dropdownlist in gridview using javascript
<p>I have created a gridview with dropdownlist in asp.net(c#).i want to validate dropdownlist using jvascript.if i dont select anything from dropdownlist that time script shud display a message.i don know how to get the name or id of that dropdownlist</p>
c# asp.net
[0, 9]
5,631,647
5,631,648
How to attach image in input fields using Php/javascript?
<p>I am having one form in that input fields are <strong>regno,name,date of birth</strong> etc.</p> <p>With this input fields i need to attach image along with this input fields how I can do using <code>PHP/JavaScript</code></p>
php javascript
[2, 3]
4,813,356
4,813,357
How to redirect the page quickly when the user clicks the browser back button in asp.net
<p>I am building an application as server client concept, in which the server is an asp.net application. What i am trying to do is</p> <ol> <li>User enter the link and provide the login details in the login page.</li> <li>After authentication the user will be redirected to the main page, which is a master and child page.</li> <li>Now when i click the sign out button (which is available in master page) the sessions are cleared and redirected back to the login page.this is fine.</li> <li>But, When i try to click the back button in browser, i have been made to see the previous page and after few seconds i have been redirected back to the login page. </li> </ol> <p>May i know the reason, when the browser back button is click whether the page load event will be fired or what is the process going on behind the screens.How can i make the page to redirect quickly.</p> <p>Also i surfed the net and found that to avoid caching the page, i have added in all pages and master page, but no use of it. It remains the same.</p>
c# asp.net
[0, 9]
5,492,807
5,492,808
jQuery on() not firing on appended a tag
<p>I have a feeling this is an embarrassingly simple mistake I'm making but I just can't see it at the moment.</p> <p>I have a table which I'm dynamically appending rows to - the the final column of each row contains a link that, when clicked, should remove that row. At the moment, the rows are being added fine but I can't figure out why the event's attached to the remove buttons aren't firing. I've removed the removal code to test with console.log() but I'm seeing nothing in the console.</p> <p>I know on() should work with appended HTML, what am I missing?</p> <p><a href="http://jsfiddle.net/52Pbk/" rel="nofollow">http://jsfiddle.net/52Pbk/</a></p> <p>HTML:</p> <pre><code> &lt;div id="people"&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;th&gt;Second Name&lt;/th&gt; &lt;th&gt;Age&lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;a href="#" id="add"&gt;Add&lt;/a&gt; </code></pre> <p>JS:</p> <pre><code>var html = '&lt;tr&gt;'; html += '&lt;td&gt;&lt;input type="text" /&gt;&lt;/td&gt;'; html += '&lt;td&gt;&lt;input type="text" /&gt;&lt;/td&gt;'; html += '&lt;td&gt;&lt;input type="text" /&gt;&lt;/td&gt;'; html += '&lt;td&gt;&lt;a href="#" class="remove_btn"&gt;x&lt;/a&gt;&lt;/td&gt;'; html += '&lt;/tr&gt;'; $('.remove_btn').on('click', function() { console.log('REMOVE BUTTON CLICKED'); //$(this).parent().parent().remove(); return false; }); $('#add').on('click', function() { $('#people').append(html); return false; }); </code></pre>
javascript jquery
[3, 5]
1,957,501
1,957,502
Append a <div> in jQuery
<p>When I'm using this code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $.ajax({ type: "GET", url: "nyhederlang.xml", dataType: "xml", success: parseXml, error: function(){alert("Error: Something went wrong");} }); }); function parseXml(xml) { //print the title and the description $(xml).find("article").each(function() { $("#output").append("&lt;div&gt;"); $("#output").append("&lt;b&gt;" + $(this).find("title").text() + ":&lt;/b&gt; &lt;br /&gt;"); $("#output").append($(this).find("paragraphs").text()); $("#output").append("&lt;/div&gt;"); }); } &lt;/script&gt; </code></pre> <p>I get both div and /div in the beginning of #output.</p> <p>Why isn't /div placed at the end of #output?</p> <p>This is what it looks like:</p> <pre><code>&lt;div id="output"&gt; &lt;div&gt;&lt;/div&gt; &lt;b&gt;Some title text&lt;/b&gt; . . . . . </code></pre>
javascript jquery
[3, 5]
3,146,121
3,146,122
How can I add a "selected" class to just one row of a table when a row is clicked?
<p>I am using the following code:</p> <pre><code>$("#dataTable tbody").on("click", "tr", function (event) { if (!$(this).hasClass('row_selected')) { $(oTable.fnSettings().aoData).each(function () { $(this.nTr).removeClass('row_selected'); }); $(this).addClass('row_selected'); gridClickHandler($(this)); } }); </code></pre> <p>When a row is clicked then if the row is already selected nothing happens. If not then all the rows have the class removed and the current row has the row_selected class added. </p> <p>However this is slow as my tables have many rows. It does not look good with the current delay. What I thought of was moving the addClass to the start. But if I do that the the .each loop removes it. </p> <p>Is there a way I could make this work more efficiently (faster response)? </p> <pre><code>&lt;table id-"dataTable"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;January&lt;/td&gt; &lt;td&gt;$100&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;February&lt;/td&gt; &lt;td&gt;$80&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>
javascript jquery
[3, 5]
5,958,413
5,958,414
TrafficStats in Android
<p>Can you explain to me following, 1) getMobileTxPackets is static method in TrafficStats class, I would like to know the time frame at which this data is captured, when I call this function, it returns me the value, how and when is this value calculated. What if I would like to get the Tx Packet value as and when transmission happens or what if I want to register an listener for every transmission that happens from App, the API is very limited can you please help me on this. </p> <p>Thank you very much. </p>
java android
[1, 4]
2,485,102
2,485,103
appendTo not working with ie window.open
<p>i want to print a <code>div</code> data.<br> This is my code and work fine in all browser but not working in IE, any solution?</p> <p>Thanks in advance.</p> <pre><code>function printer(divid){ var thePopup = window.open( '', "Customer", "menubar=0,location=0,height=700,width=700" ); //var printReport =`enter code here` $('#'+divid).clone().remove('#buttionDiv'); var printReport = $('#reportdiv').clone(); printReport.find('.buttionDiv').remove(); printReport.appendTo( thePopup.document.body ); thePopup.print(); } </code></pre>
javascript jquery
[3, 5]
3,610,353
3,610,354
jQuery Wrapping some string with conditional
<p>i have string need to be wrapped by tag <code>HTML</code> with conditional like this: </p> <pre><code>&lt;h1&gt;Test&lt;/h1&gt; </code></pre> <p>Then nothing will happen</p> <pre><code>&lt;h1&gt;Test Lagi&lt;/h1&gt; </code></pre> <p>Then the first word will be wrapped by <code>span</code>, result <code>&lt;h1&gt;&lt;span&gt;Test&lt;/span&gt; Lagi&lt;/h1&gt;</code></p> <pre><code>&lt;h1&gt;Test Lagi ah&lt;/h1&gt; </code></pre> <p>Then only the first word will be wrapper by <code>span</code>, result:</p> <pre><code>&lt;h1&gt;&lt;span&gt;Test&lt;/span&gt; Lagi ah&lt;/h1&gt; </code></pre> <p>How to do that in jQuery?</p>
javascript jquery
[3, 5]
5,053,216
5,053,217
How to retrieve url parameters from a jquery load function?
<p>I have two htmls namely index.html and grid.html. I need to refresh grid contents according to the dropdown values being selected in the index.html file. </p> <p>In my index.html page I've this code,</p> <pre><code>$(document).ready(function() { $('#orderTypeOptions').change(function() { var oType = $('#oTypeOptions').val(); $('#ordersGrid').load('grid2.html?oType='+oType); }); }); </code></pre> <p>My question is, how can I retrieve the url parameter "oType" value in the grid page?. Can anyone help?</p>
javascript jquery
[3, 5]
5,951,457
5,951,458
jQuery, unable to store data returned by $.get function
<p>I am trying to turn <b>div#sidebar</b> into a sidebar in my app. My code looks like the one below.</p> <pre><code>$('#sidebar').userProfile(); jQuery.fn.userProfile = function() { $.get('/users/profile', function(data){ $(this).html(data); }); }; </code></pre> <p>It didnt work because, I found the <b><i>this</i> (inside the $.get function)</b> here contexts to the get request and not $('#sidebar'). Then I tried something like below.</p> <pre><code>$('#sidebar').userProfile(); #This doesnot work jQuery.fn.userProfile = function() { var side_bar = null; $.get('/users/profile', function(data){ side_bar = data; }); $(this).html(side_bar); console.log(side_bar); }; </code></pre> <p>This doesnt work either. In firebug console I see Null which I am setting on top when I am declaring the variable.Atlast I made it work by changing my code to something like below by hardcoding the selector.</p> <pre><code>#This works, but I cannot turn any element to a sidebar which is sick. jQuery.fn.userProfile = function() { $.get('/users/profile', function(data){ $('#sidebar').html(data); }); }; </code></pre> <p>But this is not I wanted because I wanted to turn any element to a sidebar. Where am I goin wrong or which is the correct way of doing it?</p>
javascript jquery
[3, 5]
1,544,518
1,544,519
Accesing local filesystem and extracting file metadata using web app
<p>I am trying to build a web application which can do this: 1. Through the web application User selects some files present on his machine's filesystem. 2. Web application then extracts metadata of selected files like filename, size, filetype and stores it in a database at server.</p> <p>So I need two things - 1. web app should be able to access the filesystem of user and 2. web app should be able to extract metadata of selected files.</p> <p>Is it possible to do this?</p> <p>Thanks!</p>
php javascript
[2, 3]
4,134,269
4,134,270
jquery drop down not working
<p>Trying to use <a href="http://labs.abeautifulsite.net/jquery-dropdown/" rel="nofollow">http://labs.abeautifulsite.net/jquery-dropdown/</a> for a simple drop down menu but for some reason, I cannot get it to work.</p> <pre><code>&lt;a href="#" data-dropdown="#dropdown-1"&gt;dropdown&lt;/a&gt; &lt;div id="dropdown-1" class="dropdown dropdown-tip"&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a href="#1"&gt;Item 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#2"&gt;Item 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#3"&gt;Item 3&lt;/a&gt;&lt;/li&gt; &lt;li class="dropdown-divider"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#4"&gt;Item 4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#5"&gt;Item 5&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#5"&gt;Item 6&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p><a href="http://jsfiddle.net/ywWjE/" rel="nofollow">http://jsfiddle.net/ywWjE/</a></p> <p>What am I doing wrong? It's probably something really simple but I'm just not seeing it.</p>
javascript jquery
[3, 5]
2,889,718
2,889,719
Pass a value from child.master to parent.master
<p>I need to pass a string value from the child.master to the parent.master. There is a funtion in parent.master </p> <pre><code>public void setMyString(string s) { myLiteral.Text = s; } </code></pre> <p>How can I access such method from my child.master?</p> <p>Thank you.</p>
c# asp.net
[0, 9]
3,368,301
3,368,302
jQuery get the text/html value of the first element with class xxxxx
<p>Ok, I have a series of Unordered Lists on a page I am working on. The list items of each unordered list have a class name for use with some click events that I have done. Now I am trying to find the :first/first() element of a given class name. Problem is, :first/first() return undefined. I know first() you can't specify a selector other than the element type (yet), and when I try </p> <pre><code>$('.selectorname :first').attr('rel'); </code></pre> <p>to get the rel value of that first one i still get undefined. So I'm a bit confused how to tackle this as its not working the way I had hoped.</p> <p><em><strong>EDIT</em></strong> The HTML as per request:</p> <pre><code>&lt;ul&gt; &lt;li class="selectorname" rel="something"&gt;Some Fun stuff..&lt;/li&gt; &lt;li class="selectorname" rel="something"&gt;Some Fun stuff..&lt;/li&gt; &lt;li class="selectorname" rel="something"&gt;Some Fun stuff..&lt;/li&gt; &lt;li class="selectorname" rel="something"&gt;Some Fun stuff..&lt;/li&gt; &lt;li class="selectorname" rel="something"&gt;Some Fun stuff..&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,183,490
4,183,491
Override jQuery functions
<p>Is there way to override jQuery's core functions ? Say I wanted to add an alert(this.length) in size: function() Instead of adding it in the source </p> <pre><code>size: function() { alert(this.length) return this.length; }, </code></pre> <p>I was wondering if it would be possible to do something like this :</p> <pre><code>if (console) { console.log("Size of div = " + $("div").size()); var oSize = jQuery.fn.size; jQuery.fn.size = function() { alert(this.length); // Now go back to jQuery's original size() return oSize(this); } console.log("Size of div = " + $("div").size()); } </code></pre>
javascript jquery
[3, 5]
1,172,348
1,172,349
why the change event is not called?
<p>When I set the text of a input text with: <code>$('#rif').val('bla bla bla');</code></p> <p>Why if I add a <code>.change()</code> event on that input text is not called?</p>
javascript jquery
[3, 5]
3,418,275
3,418,276
Steps of allowing OpenID
<p>how to make my Desktop Application to use openID , ahve any one idea about using "DotNetOpenAuth" to do it ? </p>
c# asp.net
[0, 9]
849,012
849,013
Global validation using jQuery
<p>Please Suggest me About any link for validation. I am going to create new application. it had more than 100 pages. Each page must include the field validation.This action will increase my time and also increase the coding. so i need a file that include all type of validation i just call that file where i need the validation for this i wrote validation code manually but it does not working due to the syntax error because the validation file has 50 fields name but the calling file had only 5 field so it shows syntax error. Is there any way to add global validation. THANKS IN ADVANCE</p>
php jquery
[2, 5]
279,172
279,173
URL breaking when it contains # in jQuery ajax request
<p>When I request a url with jquery Ajax that contains # sign, the string of the url after # gets cut off. For example:</p> <pre><code>http://somesitem.com/?name=Some#thing </code></pre> <p>When I observe this url being requested in firebug, I see that all that is being submitted is:</p> <pre><code>http://somesitem.com/?name=Some </code></pre> <p>I tried to use encodeURI function with no success. </p> <p>Any tips on how to submit the entire string containing the #?</p>
javascript jquery
[3, 5]
2,334,350
2,334,351
why this javascript code is not working?
<p>Do you know why this is failing, I mean alert is working (it shows me that if found the button) but text or background is not changed:</p> <pre><code> $('input[type=button]').click( function() { var button=document.getElementsByName("contactme"); alert(button.length + " elements!"); button.value="New Button Text"; button.style.backgroundImage="url(some_real_gif);" }); </code></pre> <p>HTML:</p> <pre><code>&lt;input type="button" name="contactme" value="test"/&gt; </code></pre> <p>Thanks...</p> <p>I have to use plain java script not jQuery..</p>
javascript jquery
[3, 5]
3,820,736
3,820,737
jQuery .hover() auto return to previous state
<p>I am wondering if there is a simple solution where after the user un-hovers, the data will return to its original state? My current solution is to save the original state, and load this data once the user has un-hover. This can become tedious as each hover changes alot of text fields, and it is a hassle to store all this information.</p> <p>I am essentially wondering if there is something in JavaScript/jQuery something like the CSS <code>:hover</code> where it will auto return to its original state?</p>
javascript jquery
[3, 5]
3,007,852
3,007,853
jquery obj.find problem in javascript
<p>I have this snippet of code, which fails at var link:</p> <pre><code>var obj = $(this[0]); var html = obj.html(); var link = html.find('a[href*=/comment/reply]'); </code></pre> <p>This is an ajax response from a submitted form. The output of what I get back from the var html is as follows:</p> <pre><code>===&gt;&lt;div class="comment-new-success"&gt;&lt;a id="new"&gt;&lt;/a&gt; &lt;a id="comment-482"&gt;&lt;/a&gt; &lt;div class="comment"&gt; &lt;div class="submitted"&gt;Submitted by &lt;a href="/user/1" title="View user profile."&gt;NAME&lt;/a&gt; on Sun, 07/10/2011 - 12:48.&lt;span class="new"&gt; *new&lt;/span&gt;&lt;/div&gt; &lt;div class="content clearfix"&gt;&lt;p&gt;123123123123122&lt;/p&gt; &lt;/div&gt; &lt;div class="links_box"&gt;&lt;ul class="links"&gt;&lt;li class="comment_delete first"&gt;&lt;a href="/comment/delete/482?token=e1fba5ef1c99c5a3760313b53f582972"&gt;delete&lt;/a&gt;&lt;/li&gt; &lt;li class="comment_edit"&gt;&lt;a href="/comment/edit/482"&gt;edit&lt;/a&gt;&lt;/li&gt; &lt;li class="comment_reply last"&gt;&lt;a href="/comment/reply/6/482"&gt;reply&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;&lt;===(string) </code></pre> <p>How do I properly get the "/comment/reply/6/482" variable as the var link in the above example. The code (I thought) should work fine, but doesn't</p>
javascript jquery
[3, 5]
3,865,302
3,865,303
Colorize number pairs
<p>I am using the jQuery Stopwatch plugin to track time on a browser based JavaScript game I am developing. This plugin outputs 00:00:00. I need to have each number pair (hours,minutes,second) in diffrent colors.</p> <p>I also outputs a dummy time before the game starts in HTML (00:00:00). I am able to colorize each number pair here but using 00 but this does not work on the output from the plugin. How can I do it on that output?</p> <p>This is the plugin code: </p> <p><a href="http://pastie.org/2709822" rel="nofollow">http://pastie.org/2709822</a></p> <p>Thankful for all help!</p>
javascript jquery
[3, 5]
2,231,243
2,231,244
outputting valid Javascript from Java
<p>I'm using Java 6. I want to output code for a Javascript variable ...</p> <pre><code> String jsValue = escapeForJS(value); String expression = "storedVars['myVar'] = \"" + jsValue + "\";"; </code></pre> <p>Is there anything standard that will do this? I came up with my own function, but would prefer to use something tried and true.</p> <pre><code> /* creates a JS expression that can be used within quotes. */ private String escapeForJS(String value) { value = value.replace("\n", "\\n"); value = value.replace("\r", "\\r"); value = value.replace("\"", "\\\""); return value; } </code></pre> <ul> <li>Dave </li> </ul>
java javascript
[1, 3]
4,295,600
4,295,601
Email date parser when right click on browser
<p>[EDIT] I rewrote the question to mention specifically the context menu. Thanks for the remark.</p> <p>I'm looking to create a date parser for email, so that in case of text selection and right click, there will be an option in the context menu to identify the selected text (say <code>7/6/2011 10:30 meeting with John</code>) and add to my calendar (I'm using Google's calendar).</p> <p>I was thinking of developing such a thing in Javascript, is there a way to hook up to the right-click context menu of the browser without the use of extensions? Or it's better to create desktop application that hooks up to the "copy" event? Is there a library for date parsing on Javascript or others?</p> <p>Thanks in advance.</p>
c# javascript
[0, 3]
3,281,559
3,281,560
Wait for iframe to load before next function is triggered?
<p>First off: I know things should be run asynchronously if possible.</p> <p>I have a function, called wrap:</p> <p>essentially it loads the current page as an iframe. I need it in order to keep the javascript running even when links are clicked on the page.</p> <pre><code>function wrap(){ event.preventDefault(); var pathname = window.location.pathname; $('body').html('&lt;iframe id="wrapper" src="'+ pathname +'" &gt;') $('iframe').load(function (){ //this is where the magic outght to happen }); } </code></pre> <p>When the wrap is run, i want to start manipulating the contents of the iframe. For the structure of the app, I would like need to do this from ouside of the wrap-function or with parameters that I pass in to the wrap function. I do this with a series of functions that execute animations, play sounds etc. (Stuff that takes time and should also be executed sequentially). This Is what i Would Ideally like it to look like.</p> <pre><code>wrap(); highlight('#one'); highlight('#two'); </code></pre>
javascript jquery
[3, 5]
2,086,176
2,086,177
jQueryRotate click issue
<p>i'm using the jQueryRotate.js extension to perform a rotation operation on a miniature arrow (to behave like that in os x aqua filesystems), as found here:</p> <p><a href="http://wilq32.adobeair.pl/jQueryRotate/Wilq32.jQueryRotate.html" rel="nofollow">http://wilq32.adobeair.pl/jQueryRotate/Wilq32.jQueryRotate.html</a></p> <p><code> $(document).ready(function() {</p> <pre><code> var rot=$('#expand-FT078Z8').rotate({maxAngle:25,minAngle:-55, duration:570, easing:$.easing.easeInOutExpo, bind: [ {"click":function(){rot[0].rotateAnimation(90);}} ] }); }); </code></pre> <p></code></p> <p>although, when I add another "click" function to return the arrow to its original position, as in this fashion:</p> <p><code> {"click":function(){rot[0].rotateAnimation(90);}}, {"click":function(){rot[0].rotateAnimation(0);}} </code></p> <p>the function breaks. this follows the usage instructions, as you can add more than one event. now, normally, i would save the state in a javascript variable, but that would seem to be outside the scope of this library. anyone know how i might go about making this happen? please let me know. thanks!</p>
javascript jquery
[3, 5]
1,493,927
1,493,928
Call Java from Javascript and pass integer
<p>I use java to evaluate a javascript file. This is using java.lang.String.format and shall pass an integer, but I get the exception for "java.util.IllegalFormatConversionException: d != java.lang.Double". My passed value seems to be converted to double.</p> <p>javascript:</p> <pre><code>java.lang.String.format("%02d", 1 ); </code></pre> <p>How can I enforce that the passed variable type is int?</p>
java javascript
[1, 3]
2,099,464
2,099,465
ASP.NET - clients without JavaScript
<p>I have some functionality on my page that JavaScript is currently handling. I want to make my page compatible with non-Javascript users. Is there a way I can say "If JavaScript is enabled, use my JavaScript routine, otherwise do a Postback and let the server-side handle it?"</p>
asp.net javascript
[9, 3]
3,889,872
3,889,873
JS Slider extention/option
<p>Hello I have a Slideshow. I will like to changed it up a bit.</p> <p>Basically the slider have a click though functionality using LIs menu which works good.</p> <p>But I wanted the option of one Arrow that will loop through the slideshow instead of clicking 1, 2,3, 4,5...</p> <p>Just wanted one click that says NEXT and it wil do the same thing like th current sliding.</p> <p>MY FIDDLE is here: <a href="http://jsfiddle.net/myislandshop/67fs2/5/" rel="nofollow">http://jsfiddle.net/myislandshop/67fs2/5/</a></p> <p>if this can be done with little change in the JS that will be cool.</p>
javascript jquery
[3, 5]
2,542,296
2,542,297
Load javascript after page load
<p>I have an external javascript that contains something like:</p> <pre><code>document.wrileln("&lt;script type='text/javascript' src='...'&gt;&lt;/script&gt;"); </code></pre> <p>In the original html i have something link</p> <pre><code>&lt;div id="banner"&gt; &lt;script type="text/javscript" src="&lt;the external javascript above&gt;"&gt;&lt;/script&gt; &lt;/div&gt; </code></pre> <p>How can i load that delayed?</p> <p>I've tried using window.setTimeout and append that javascript but its not working.</p> <p>Its important that the javascript to be loaded inside that div so the document.writeln executes in the right place.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
683,252
683,253
Show random classes
<p>Let's say I have some classes like:</p> <pre><code>&lt;div class="something" style="display: none"&gt;Some text I would like to show&lt;/div&gt; &lt;div class="something" style="display: none"&gt;Some text2 I would like to show&lt;/div&gt; &lt;div class="something" style="display: none"&gt;Some text3 I would like to show&lt;/div&gt; &lt;div class="something" style="display: none"&gt;Some text4 I would like to show&lt;/div&gt; &lt;div class="something" style="display: none"&gt;Some text5 I would like to show&lt;/div&gt; </code></pre> <p>And I want to show random class every few seconds. I suppose pseudo-code would be something like that:</p> <pre><code> setInterval(function() { $('.something').hide(); var rand_number = random(1, ('.something').length); $('.something').array[rand_number].show(); }, 5000); </code></pre> <p>Thanks.</p>
javascript jquery
[3, 5]
4,643,571
4,643,572
how did SO animate answer div
<p>I am wondering for some time now, how did SO do this animation on answers when you click on link answer, answer divs color changes for some time and it reverts back, I'm sure this question has been asked before but I just couldn't find it. Or this random example :</p> <p><a href="http://stackoverflow.com/questions/2706443/what-pitfalls-if-any-are-there-to-learning-c-c-as-a-first-language/2706531#2706531">http://stackoverflow.com/questions/2706443/what-pitfalls-if-any-are-there-to-learning-c-c-as-a-first-language/2706531#2706531</a></p> <p><strong>UPDATE</strong></p> <p>I see some good answers, but not quite what I'm looking for or maybe I'm sleepy , for ex:</p> <p>I have a div with id #footer , so if I type <a href="http://mysite.com#footer" rel="nofollow">http://mysite.com#footer</a> it will scroll me down to the footer div, how can I pass the argument which div to animate by just visiting the url <a href="http://mysite.com#footer" rel="nofollow">http://mysite.com#footer</a> </p>
javascript jquery
[3, 5]
2,360,707
2,360,708
(js/jquery) Rotating an image in FF/Saf/Chrome without Canvas OR Zooming a canvas item
<p>I am working on a project where I need to rotate and image to the users' liking then allow them to zoom a bit in and out.</p> <p>Using jquery.rotate.1-1.js in IE everything works perfectly (how rare) as MS wrote their own rotation tool (progid:DXImageTransform) so the img is rotated and then kept as an image. However looking at the JS I see that if the browser is not IE then a canvas is rendered (i've never really used canvas) which means that once the canvas is drawn with the image rotated I cannot zoom in on the image because if I understand it correctly the canvas doesn't actually hold the information.</p> <p>I've also attempted CSS3 transforms with my non-IE browser and have everything rotating correctly however when I try and zoom it's using now non-existant div sizes.</p> <p>Are there any tools out there that allow rotation and then zooming on the client-side? OR Is there a way to rotate an img tag in FF/Chrome/Saf &amp; maintain the rotate image after?</p>
javascript jquery
[3, 5]
1,509,877
1,509,878
jQuery selector context question
<p>I'm trying to do make the following selection:</p> <pre><code>$(".program", row) </code></pre> <p>Where "row" is a jQuery object containing two table rows. One of the tr's has the class 'program". This selector doesn't seem to find it. However the following works: </p> <pre><code>$(".title", row) </code></pre> <p>where div.title is a descendant of tr.program. </p> <p>If I use a jQuery object as a selector context, am I not able to match top-level elements of that jQuery object? </p> <p>thanks,</p> <p>-Morgan</p>
javascript jquery
[3, 5]
1,356,324
1,356,325
How to assign the selected value of Drop down to text box
<p>I'm trying to assign the selected value in the drop down to text box when ever I hit a button. I'm not able to see the selected value in the <code>TextBox</code>. Can someone please let me know what am I missing?</p> <p>My code is as follows:</p> <pre><code>public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click1(object sender, EventArgs e) { string strConn = "Initial Catalog=NavigateV6;Data Source=SVUSRYE-SQL3D1;User ID=dopis_user;Password=dopis_password;Persist Security Info=True;MultipleActiveResultSets=True"; SqlConnection mycn = new SqlConnection(strConn); DataSet ds = new DataSet(); SqlDataAdapter myda = new SqlDataAdapter("Select accountid FROM trn_account ", mycn); myda.Fill(ds); DDL.DataSource = ds; DDL.DataTextField = "AccountID"; DDL.DataValueField = "AccountID"; DDL.DataBind(); } protected void DDL_SelectedIndexChanged(Object sender, EventArgs e) { var selectedValue = ((DropDownList)sender).SelectedValue; if (!string.IsNullOrEmpty(TextBox1.Text)) TextBox1.Text = selectedValue; } } </code></pre> <p>ASPX:</p> <pre class="lang-xml prettyprint-override"><code>&lt;asp:DropDownList ID="DDL" runat="server" AutoPostBack="True" OnSelectedIndexChanged = " DDL_SelectedIndexChanged" &gt; &lt;/asp:DropDownList&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click1" Text="sumbit" /&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;/asp:Content&gt; </code></pre>
c# asp.net
[0, 9]
4,554,982
4,554,983
How pass variables from activity to service without restart service
<p>I need send data (ArrayList, Array, String, etc) from my <code>Activity</code> to my <code>Service</code>. If use <code>Intent</code> and <code>Bundle</code> nesessary Service restart. I need send data without restart Service (if Service is running use him, if not running start him and send new data).</p> <p>Also I need same send data from <code>BroadcastReceiver</code> to Service.</p> <p>What is best practice?</p>
java android
[1, 4]
1,055,014
1,055,015
Difference between finish() and this.finish() in android
<p>Providing <code>finish()</code> and <code>this.finish()</code> in <code>onPause()</code> or <code>onStop()</code> method is same?</p>
java android
[1, 4]
5,935,310
5,935,311
Why Data manipulation occur when refresh the page in Asp.net
<p>Why Data manipulation occur when refresh the page in Asp.net</p> <p>After submit the button to insert data to database table if i press f5 or browser refresh then again dulicate data is inserted why it is maintaining the textbox values and without clicking the submit button it is fired......? provide solution.........</p> <p>Thanks in Advance..........</p>
c# asp.net
[0, 9]
4,513,646
4,513,647
how to get the checked box input value by jquery or javascript?
<p>the input check box code:</p> <pre><code>&lt;li class="odd"&gt;&lt;input type="checkbox" class="forminput" name="VD10" checked="checked" value="http://test1.com"&gt; &lt;a href="#"&gt;example 1&lt;/a&gt;&lt;/li&gt; &lt;li class="even&gt;&lt;input type="checkbox" class="forminput" name="VD11" checked="checked" value="http://test2.com"&gt; &lt;a href="#"&gt;example 1&lt;/a&gt;&lt;/li&gt; &lt;li class="odd"&gt;&lt;input type="checkbox" class="forminput" name="VD12" checked="checked" value="http://test3.com"&gt; &lt;a href="#"&gt;example 1&lt;/a&gt;&lt;/li&gt;........ </code></pre> <p>the button code:</p> <pre><code>&lt;li&gt; &lt;input type="checkbox" id="checkall" name="checkall" checked="checked"&gt; &lt;label for="checkall"&gt;check all&lt;/label&gt; &lt;input type="button" value="copy the checked link" class="button"&gt; &lt;/li&gt; </code></pre> <p>now, i want to do when click the <code>copy the checked link</code> button. it will copy the checked input value to the clipboard? how do i do?</p>
javascript jquery
[3, 5]
2,041,747
2,041,748
How I turn label in asp red
<p>Hi I would like to turn label red in .aspx when user enters wrong answer into textbox.</p> <p>but not know how, hw I can do this?</p>
c# asp.net
[0, 9]
2,589,547
2,589,548
Return string from PHP database loop to Javascript array
<p>I'm trying to create a video slideshow using a Javascript array. The array needs to be populated from a database loop. The database of videos is created through a CMS.</p> <p>I am currently using "push" for my array, FeaturedVideos, but it's not working. How else do I put the returned string into the array?</p> <pre><code>&lt;% control getFeaturedMedia %&gt; &lt;script type="text/javascript"&gt; FeaturedVideos.push('&lt;div class="panel"&gt;&lt;h3&gt;$Title&lt;/h3&gt;&lt;div class="videoBox"&gt;&lt;% if Type = Vimeo %&gt;&lt;iframe src="http://player.vimeo.com/video/$VideoID?title=0&amp;amp;byline=0&amp;amp;portrait=0" width="275" height="184" frameborder="0"&gt;&lt;/iframe&gt;&lt;% else_if Type = YouTube %&gt;&lt;iframe class="youtube-player" type="text/html" width="275" height="184" src="http://www.youtube.com/embed/$VideoID" frameborder="0"&gt;&lt;/iframe&gt;&lt;% else %&gt;$Image.SetSize(275,184)&lt;% end_if %&gt;&lt;/div&gt;&lt;/div&gt;'); &lt;/script&gt; &lt;% end_control %&gt; </code></pre>
php javascript
[2, 3]
3,832,965
3,832,966
Weird behavior in Android's "if" block
<p>It walks like a bug, it chirps like a bug.... I need someone to confirm that it's a bug.</p> <p>I was trying to get phone numbers from the address book with this code:</p> <pre><code>public JSONObject getAllPhones() throws JSONException{ String mPhoneNumberProjection[] = new String[] { Contacts.Phones.NAME, Contacts.Phones.NUMBER, Contacts.Phones.TYPE }; Uri phoneNumbersUri = Contacts.Phones.CONTENT_URI; JSONObject result = new JSONObject(); JSONArray phones = new JSONArray(); Cursor myCursor = mApp.managedQuery(phoneNumbersUri, mPhoneNumberProjection, null, null, null); mApp.startManagingCursor(myCursor); if (!myCursor.isAfterLast()){ myCursor.moveToFirst(); do{ JSONObject aRow = new JSONObject(); for (int i = 0; i &lt; myCursor.getColumnCount(); i++){ Log.d(LOG_TAG, myCursor.getColumnName(i) + " -&gt; " + myCursor.getString(i)); aRow.put(myCursor.getColumnName(i), myCursor.getString(i)); } phones.put(aRow); } while (myCursor.moveToNext()); } result.put("phones", phones); result.put("phoneTypes", getPhoneTypes()); return result; } </code></pre> <p>But when there are no contacts, and !myCursor.isAfterLast() evaluates as "false", program steps into "for" loop. So it enters "if" block, skips several methods and lands in "for" loop... </p> <p>When I extract this loop into a separate function, everything works ok.</p> <p>I'm doing this in Eclipse Helios on 32-bit Vista. I tried cleaning the project, erasing Java cache, restarting computer, creating new AVD... I used Android 1.6 and Android 2.2, but the error stays on...</p> <p>Can someone explain what's going on?</p>
java android
[1, 4]
2,051,049
2,051,050
Unable to install Google API in Android
<p>I want to create a map view application in android. If I click the Third Party Add-ons to install Google Api, I'm getting this error </p> <blockquote> <p>Failed to fetch URL <a href="https://dl-ssl.google.com/android/repository/addons_list.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/addons_list.xml</a>, reason:<br> File not found</p> </blockquote>
java android
[1, 4]
4,392,725
4,392,726
Sign in to other website using asp.net
<p>Hey guys, I'm trying to make a website that can sign into other websites for the users, and grab certain information. For example: a web based game forum that automatically pulls your game statistics. My website would have to navigate to the game url, fill in the user name and password, sign in, then read the html once signed in (this is the easy part, for which I would simply use the HTML agility pack or something similar). Is this sign in process possible with asp.net?</p>
c# javascript asp.net
[0, 3, 9]
5,668,483
5,668,484
How does one identify an empty element using jQuery that might contain a comment tag?
<p>I'm trying to identify an empty element that might or might not contain a comment tag and/or white space.</p> <p>The following HTML structure is common place in the environment I'm working with:</p> <pre><code>&lt;div class="container container-no-title"&gt; &lt;div id="dnn_ctr6735_ContentPane" class="container-padding DNNAlignright"&gt; &lt;!-- Start_Module_6735 --&gt; &lt;div id="dnn_ctr6735_ModuleContent"&gt; &lt;!-- End_Module_6735 --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>My initial jQuery was:</p> <pre><code>$('.container-padding &gt; div').each(function() { if ($(this).is(":empty")) { $(this).parent('.container-padding').remove(); }; }); </code></pre> <p>But this doesn't account for whitespace or comment tags. I found other questions that addressed whitespace, but nothing that addresses comment tags, and I'd really like to keep this little snippet of jQuery simple.</p> <p>Cheers, Steve</p>
javascript jquery
[3, 5]
2,330,309
2,330,310
What language should I write my 2D game in?
<p>I'm thinking of writing a game. It's inspired by Minecraft/Terraria (but don't worry it will be different). </p> <p>My main question is what language I should write it in -- it'll be relatively simple graphics, more like Terraria than Minecraft. I know Java relatively well and Minecraft is written in it, but C++ seems like the industry standard for game development. However, I know next to no C++. I'm willing to learn but am worried how it will turn out for my first real project in the language. </p> <p>In addition to that, I'd also like suggestions on a good game engine for the language that you suggest. I'd like it to run on:</p> <ul> <li>Windows for sure</li> <li>Linux for sure</li> <li>Mac for sure</li> <li>Android would be really nice</li> <li>iOS is optional</li> </ul> <p>Thank you in advance!</p>
java c++
[1, 6]
1,705,543
1,705,544
jQuery hover functions IE error
<p>I've been having some difficulty with jQuery hover functions. Proberbly as a result of staring at the same code for far too long, but perhaps someone can help.</p> <p>I have the following function:</p> <pre><code> $("#div1").mouseover(function () { $("#div2:hidden").show(); }); $("#div1").mouseout(function () { $("#div2:visible").hide(); }); </code></pre> <p>Which I have also tried as:</p> <pre><code> $("#div1").hover(function () { $("#div2:hidden").show(); }, function() { $("#div2:visible").hide(); }); </code></pre> <p>Neither work AT ALL in IE. Everything I write using ANY mouseover, hover, mouseout or any other "mouse" function causes errors in IE. With other browsers it is perfect and what's more annoying is it occasionally works in IE, for instance on occasion the first and second time it will work - then it will error.</p> <p>Any help would be fantastic!</p>
javascript jquery
[3, 5]
3,013,962
3,013,963
How to dynamic adding rows into asp.net table?
<p>How can I add rows in a table from server-side?</p> <pre><code> if (!Page.IsPostBack) { Session["table"] = TableId; } else { TableId = (Table)Session["table"]; } protected void btnAddinRow_Click(object sender, EventArgs e) { num_row = (TableId.Rows).Count; TableRow r = new TableRow(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); TextBox t = new TextBox(); t.ID = "textID" + num_row; t.EnableViewState = true; r.ID = "newRow" + num_row; c1.ID = "newC1" + num_row; c2.ID = "newC2" + num_row; c1.Text = "New Cell - " + num_row; c2.Controls.Add(t); r.Cells.Add(c1); r.Cells.Add(c2); TableId.Rows.Add(r); Session["table"] = TableId; } </code></pre> <p>in debug I found out the number in the "TableID", but the rows are not drawn.</p> <p>Have you got an idea about this issue? Thanks</p>
c# asp.net
[0, 9]
5,040,340
5,040,341
jQuery Validation Plugin stopping form submission, submit button won't work
<p>The following script using jQuery validation plugin - <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">http://docs.jquery.com/Plugins/Validation</a> - is preventing the form from sending that is found here:</p> <p><a href="http://www.bestcastleintown.co.uk/book2.php" rel="nofollow">http://www.bestcastleintown.co.uk/book2.php</a></p> <p>Please fill in the form and watch the validation messages disappear then try to press send, this seems not to send and I don't understand why.</p> <p>When this script is removed the contact form will function correctly and allow sending. Therefore I think it is causing the problem. Any help or suggestions would be much appreciated.</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery.validator.setDefaults({ debug: true, success: "valid" });; &lt;/script&gt; &lt;script&gt; $(document).ready(function() { $("#aform").validate({ rules: { postcode: {required: true,minlength: 6}, phone: {required: true,number: true} } }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,283,175
5,283,176
Best way to rearrange positioning of images/divs with javascript/jquery?
<p>I took a peek at the source of <a href="http://wonderwall.msn.com" rel="nofollow">http://wonderwall.msn.com</a> and noticed how all the span tags that the blocks of the wall have don't seem to be associated with any ID. It makes me very curious how they are able to accomplish the animated repositioning of elements when you click on one of the blocks/images without associated ID.</p> <p>I am curious how you can click on say an image and get other images around it to move to the side. Is it some sort of formula or algoirthm?</p> <p>I would like to accomplish getting say, 5 spans/blocks, clicking on one, and getting others to animate/move to the sides.</p>
javascript jquery
[3, 5]
1,122,727
1,122,728
get text, and split it after a given string
<p>is there any javascript method to get text, and split it after a certain value? </p> <p>Like for instance, having: </p> <pre><code>&lt;p&gt;here is some text &lt;!-- read more --&gt; and here is some more&lt;/p&gt; </code></pre> <p>get this:</p> <pre><code>&lt;p&gt;here is some text&lt;/p&gt; &lt;p&gt;and here is some more&lt;/p&gt; </code></pre> <p>I suppose jQuery don't have the tools to achieve this.</p>
javascript jquery
[3, 5]
1,240,138
1,240,139
What is the difference between having a function in Jquery.Document and not having it in
<p>I am just wondering what is the difference between these two</p> <pre><code>File1.js $(function() { function MyFunction() { // some code here } }); File2.js $(function() { // call it. MyFunction(); }); </code></pre> <p><hr /></p> <pre><code>File1.js function MyFunction() { // some code here } File2.js $(function() { // call it. MyFunction(); }); </code></pre> <p>So what is the difference? When I did the first way and I tried to call MyFunction() from File2.js it never worked. I moved my function out of the Jquery.Document ready in File1.Js and it worked.</p> <p>I have some other functions that are in File1 and even though they are in document ready anything in File1 can seem to call it no problem.</p> <p>It just seems like across script files it has a problem calling functions when setup that way.</p>
javascript jquery
[3, 5]
51,652
51,653
jQuery listview plugin
<p>Is there any ListView widget plugin for jQuery? With resizable columns, sorting helpers, odd-even rows styles etc. Something like ListView class from Ext library but for jQuery (NOT table/grid).</p> <p><strong>UPDATED</strong> Have switched to ExtJS so question is not topical anymore.</p>
javascript jquery
[3, 5]
94,336
94,337
pageLoad() not firing in a dynamically loaded page using .NET 4.0 (Works fine on 3.5)
<p>I have a simple aspx page with a link to load another aspx page on right div (using JQuery load), like that:</p> <pre><code>&lt;%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="Scripts/jquery-1.6.2.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;script type="text/javascript"&gt; function loadPage() { $('#myRightdiv').load('Test.aspx', function () {}); } &lt;/script&gt; &lt;asp:Button ID="Button1" runat="server" Text="Load ..." OnClientClick="loadPage(); return false;" /&gt; &lt;div id="myRightdiv"&gt;&lt;/div&gt; &lt;/form&gt; </code></pre> <p> </p> <p>In my Test.aspx I have a pageLoad like that:</p> <pre><code>&lt;%@ Page Title="Test" Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="About" %&gt; &lt;html&gt; &lt;head id="Head1" runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt; &lt;script type="text/javascript"&gt; function pageLoad() { alert("pageloaded"); } &lt;/script&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>That works fine on ASP .NET 3.5 .... But using .NET 4.0 the pageLoad is not fired! </p> <p>Any idea or workaround?</p> <p>Thanks</p>
jquery asp.net
[5, 9]
1,543,394
1,543,395
Changing on('hover') to on('click') for touchscreen devices?
<p>I have a boolean variable called isTouchscreen and some on('hover', ...) events. If the isTouchscreen boolean variable equals true then I need to change on('hover') events to on('click') events. Is this possible?</p> <p>Something like:</p> <pre><code> $(".smart-suggestions").on("hover", ".option", function(){ $('.img-container img').show(); //and do more stuff.... }); if(touchscreen==true){ //change onhover event to onclick event } </code></pre>
javascript jquery
[3, 5]
3,007,625
3,007,626
PHP/ JS File Upload Progress Bar
<p>How do I create a file upload progress bar similar to getdropbox.com using PHP and/or JavaScript?</p> <p>Thanks, -Giles</p>
php javascript
[2, 3]
3,587,910
3,587,911
How do I turn a timestamp into a javascript date object?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/847185/convert-a-unix-timestamp-to-time-in-javascript">Convert a Unix timestamp to time in Javascript</a> </p> </blockquote> <p>Turn a unix timestamp into 2008-07-17T09:24:17Z</p> <p>How to do that?</p>
javascript jquery
[3, 5]
3,887,639
3,887,640
print bar-code without print dialog
<p>I want to create a bar-code using code-128, without displaying it on the form. I want to print it without showing print dialog through bar-code printer on client side. I am able to create bar-code, I have stored it in hidden div but how to proceed further?? How do I achieve this using JavaScript or C#?</p> <p>Also, how to set height, width parameter in code??</p>
c# javascript asp.net
[0, 3, 9]
297,680
297,681
Source attachment does not contain the source for the file MenuInflater.class
<h2>My code is as follows:</h2> <pre><code>package chapter.seven; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuInflater; public class UserInterface extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.mainmenu, menu); return true; } } </code></pre> <hr> <p>when I run it through the emulator, I keep getting the following error:</p> <p>Class File Editor Source Not Found!</p> <p>The source attachment does not contain the source for the file MenuInflater.class You can change the source attachment by clicking change Attached Source below:</p> <p>I don't understand why it cannot find the MenuInflater.class. I have looked all over the internet and cannot find a solution. Please help!</p>
java android
[1, 4]
2,105,572
2,105,573
extract addresses from google map
<p>how can i extract all addresses,corresponding latitude &amp; longitude of a city(eg:Bangalore) from google map using php/js and store in mysql table .can anyone help me.Its urgent.Thank Yo</p>
php javascript
[2, 3]
4,466,338
4,466,339
Listbox.Length always 0 in JS
<p>When I run the following JS I always get the confirm box popping up despite the list visibly having items.</p> <pre><code>&lt;asp:ListBox ID="list" runat="server" Width="135px" Rows="8" /&gt; function CheckListEmpty() { if ($("#list").length == 0) { if (confirm("Are you sure?")) { //they clicked OK so save and close return true; } else { //do nothing they hit cancel. return false; } } else return true; </code></pre> <p>}</p> <p>What am I doing wrong?</p>
asp.net javascript jquery
[9, 3, 5]
4,820,788
4,820,789
how I can read text from html textarea in asp.net page?
<p>I set html textarea in asp.net page with out runat="server" and I need set the text in string variable by C# in code behind </p>
c# asp.net
[0, 9]
935,226
935,227
Cannot call web service when deploying ASP.NET site to the server but can run on localhost
<p>When I try to run an ASP.NET site by calling a webservice in the sub virtual directory, I get the error below:</p> <p><strong>"The request failed with HTTP status 401: Unauthorized. "</strong></p> <p>This is the code that I wrote:</p> <pre><code>Dim ws As Odyssey.SupportServices.SupportServices ws = New Odyssey.SupportServices.SupportServices ws.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials </code></pre> <p>My virtual directory structure is shown below:</p> <p>CSACCsupp - <strong>Parent</strong> : The parent can call webservice without any issues.<br> Odyssey - <strong>Sub</strong> : The Sub cannot call webservice as shown in the error above.</p> <p>I think the problem is in the IIS security. Therefore, I went through the IIS security and compared the parent and sub; they are identical.</p> <p>I really do not know what to do next as I've tried many ways to set the security in IIS, but I am still in the dark.</p> <p>Could you please suggest on this issue?</p>
c# asp.net
[0, 9]
758,840
758,841
dynamically display products in two columns
<p>I have a jsfiddle <a href="http://jsfiddle.net/K5PGp/" rel="nofollow">http://jsfiddle.net/K5PGp/</a> that I am trying to modify so that it displays the "products" in two columns even if the browser is IE 8.</p> <p>For example, if all 8 products are displayed, it should look like this:</p> <h2>one two</h2> <h2>three four</h2> <h2>five six</h2> <h2>seven eight</h2> <p>If only 1,3,5,7 are displayed, it should look like this:</p> <h2>one three</h2> <h2>five seven</h2> <p>If only 2,4,6,8 are displayed, it should look like this:</p> <h2>two four</h2> <h2>six eight</h2>
javascript jquery
[3, 5]
3,024,529
3,024,530
Chaining multiple asynchronous methods in javascript
<p>I am writing a javascript library to abstract ajax requests to my HTTP API. Each of my javascript functions is a wrapper for jquery's ajax call, which makes a callback to the user on completion.</p> <p>Eg.</p> <pre><code>mylib.doThing( "foo", { success:function(){alert("done");}); </code></pre> <p>In the case where I want to execute mylib.doFoo twice in series, I have something like:</p> <pre><code>mylib.doThing( "foo", { success:function(){ mylib.doThing( "bar", { success:function(){alert("done");}); }); </code></pre> <p>For anything more that two steps, this gets messy very quickly.</p> <p>Is it possible to provide a cleaner syntax, perhaps more like the following? And how would I need to implement <code>mylib.doThing()</code>?</p> <pre><code>mylib.doThing("foo").mylib.doThing("bar").alert("done"); </code></pre>
javascript jquery
[3, 5]
1,639,276
1,639,277
I need the landmark points of a contour
<p>I need to detect the source of leakage of a gas. I have numerous images of contours of gas spread from a point source under various atmospheric conditions. The images, i have got using ALOHA software, which gives the contour of gas spread under atmospheric conditions. So, i need the landmark points of the contour with which i can train my neural network to redraw the graph and detect the source of leakage. the prob is in effort to get the landmark point, i might get some wrong coordinate because the contour i have is in the form of image(a graph(a grid)), so the algorithm might get confused in which black line it should consider for image processing. Please help me to get the landmark points of the contour. I wish I could upload an image for better clearance but I think there is no such possibility.Thank You</p>
java c++
[1, 6]
528,705
528,706
How to avoid the checkbox 'Stop execute scripts on this page' in the Javasript message box?
<p>How can I avoid the checkbox 'Stop execute scripts on this page' in the Javasript message box? <img src="http://i.stack.imgur.com/3ZvNQ.png" alt="enter image description here"></p> <p>Regards, David</p>
javascript asp.net
[3, 9]
523,040
523,041
Home button brings back to my app
<p>I am making a car launcher application, which contains shortcuts to other apps, when i'm in another app i'd like to press the home button and go back to my launcher So basically i need to override the home button outside of my app,the override has to work only when my app is opened in the background so when i close my app the home button will work as usual taking you to your default launcher</p> <p>Can i implement something like this or i'm asking too much?</p>
java android
[1, 4]
3,397,775
3,397,776
What should i learn after getting good knowledge of XHTML, CSS, Web Standards, Accessibility? Javascript or PHP?
<p>What should i learn after getting good knowledge of XHTML, CSS, Web Standards, Accessibility,Usability, Information Architecture and Adobe Photoshop?</p> <h2>Javascript/jquery</h2> <p>or </p> <h2>PHP</h2> <p>First I want to learn and be focus to learn anyone of these two? Which language would be good to learn first?</p>
php javascript
[2, 3]
4,130,986
4,130,987
How to Json Parsing In asp .net
<pre><code>http://www.taxmann.com/TaxmannWhatsnewService/Services.aspx?service=gettopstoriestabnews </code></pre> <p>This is my web service I have to parse and store all value in <code>String</code> please help me how to parse. </p> <p>using asp.net (C#) so that I can store :</p> <pre><code>news_id as it variable news_title as title variable news_short_description as description news_date as date ; </code></pre> <p>Please help me I'm new in .net I tried but not able to do </p>
c# asp.net
[0, 9]
572,545
572,546
How to kill session in jQuery function when I redirect to the logout page through jQuery?
<p>Hi all, I have gone through this example to end session when user was inactive for some amount of time which works fine</p> <p><a href="http://www.philpalmieri.com/js_sandbox/timedLogout/" rel="nofollow">http://www.philpalmieri.com/js_sandbox/timedLogout/</a></p> <p>But when it redirects back to <code>logout</code> page and if I access the page with sessions I am able to see the page access with the data. I don't want this to be done. When user logged out on inactive session through the <code>jQuery</code> function I would like to kill the session which I am having too? How can I achieve this?</p>
jquery asp.net
[5, 9]
4,548,393
4,548,394
Why does the html disappear?
<p>I would like to insert <code>&lt;div&gt;&lt;p&gt;Test&lt;/p&gt;&lt;/div&gt;</code> in another DIV at the top. So I try</p> <pre><code>$(document).ready(function(){ $('form').live('submit', function(){ var aform = $(this); $('#w').append('&lt;div&gt;&lt;p&gt;Test&lt;/p&gt;&lt;/div&gt;'); }); }); </code></pre> <p>HTML looks like</p> <pre><code>&lt;div id="w"&gt; &lt;div&gt;&lt;p&gt;Test&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>When I do that, it gets inserted, but goes away right after.</p> <p>Try click on the Save button in this example.</p> <p><a href="http://jsfiddle.net/Rv2w7/" rel="nofollow">http://jsfiddle.net/Rv2w7/</a></p>
javascript jquery
[3, 5]
1,519,273
1,519,274
Linking c++ and c#
<p>I'm trying to link the C++ defined libraries , so that they be used in C#. I have an <code>CString PastUsed</code> that holds a variable in C++, which I'm trying to access in C#.</p> <p>In C++, I stored the value of the variable <code>PastUsed</code> in the '.odl' file as <code>BSTR PastUsed</code>. I'm using <code>DISP_PROPERTY_EX</code> as a dispatch map.</p> <pre><code>DISP_PROPERTY_EX(Cpctr, "PastUsed", GetPastUsed, SetPastUsed, VT_BSTR). </code></pre> <p>I return the value of the String variable from <code>GetPastUsed</code>. But, I donot think this value is being saved in <code>PastUsed</code> (as defined in .odl). This I'm assuming is happening because when I try to access this variable (<code>PastUsed</code> from .odl) in C#, I get a com exception.</p> <p>The code I have in c# to retrieve the C++ defined variable is:</p> <pre><code>private void GetPastUsedDes_Click(Object eventSender, EventArgs eventArgs) { if (CheckInvalidButtonClick()) { return; } PrintLine("Dumping past Used"); AxPBSPRINTLib.AxPBSprint sPrint = mPBSPrintCtrl; String str = mPBSPrintCtrl.PastUsed; String str = Print.PastUsed; } </code></pre> <p>The <code>PastUsed</code> (here above one in c#) is the same string which is supposed to be containing the variable held in <code>Pastused</code> of c++ (as described in my first post). As soon as it hits the breakpoint of String str in c#, I get the exception:</p> <pre><code>Print.PastUsed = 'Print.PastUsed' threw an exception of type 'System.Runtime.InteropServices.COMException' </code></pre>
c# c++
[0, 6]
1,304,259
1,304,260
PHP array to echo javascript array that I can access?
<p>I have a php array called $user.</p> <p>At the minute I am getting the variables across to javascript by manually adding them like so.</p> <pre><code>var username = ' . $user['username'] . '; </code></pre> <p>And so on is there a way I can make php echo a javascript array that I can access?</p>
php javascript
[2, 3]
3,262,141
3,262,142
Getting problem related to webmethod
<p>i have varchar value in database like (1110000111) when i search through autocomplete extender it display like (2013) means it converted into binary to decimal format but my requirements is it should display in (11100000111) this format means in original format.</p> <p>so plz help me how can i achive this through webmethod one more think when i taking a value like (11111-00000-22222) that it display like (111100) that only</p> <p>my code is ........</p> <pre><code>[System.Web.Script.Services.ScriptMethod()] //WebMethod for Search Asset Number [System.Web.Services.WebMethod] public static List&lt;string&gt; SearchAssetNumber(string prefixText, int count) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager .ConnectionStrings["connStringForAutoComplete"].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT numAssetNo From AssetMaster where " + "numAssetNo like '%'+ @SearchText + '%'"; cmd.Parameters.AddWithValue("@SearchText", prefixText); cmd.Connection = conn; conn.Open(); List&lt;string&gt; vcName = new List&lt;string&gt;(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { vcName.Add(sdr["numAssetNo"].ToString()); } } conn.Close(); return vcName; } } } </code></pre>
c# asp.net
[0, 9]
4,901,043
4,901,044
processing returned json array in jquery
<p>I have a PHP page that returns a piece of HTML to set the values of a menu.</p> <pre><code>while($employee = mysql_fetch_array($query)) { $employee_menu = $employee_menu . '&lt;option value="'.$employee['id'].'"&gt;'.$employee['first'].' '.$employee['last'].'&lt;/option&gt;'; } echo json_encode ($employee_menu); </code></pre> <p>Then update it with jquery like this:</p> <pre><code>$.get('http://www.sharingizcaring.com/schedule/menutest.php', { job: $('#job').val() }, function(data) { $("#employee").html( data ); }); </code></pre> <p>For some reason the closing tags are being turned into &lt;\/option> and thus displaying as either:</p> <p>First Last &lt;\/option> First Last >\/option> </p> <p>In the menu (Chrome) or as one line: First Last &lt;\/option> First Last &lt;\/option> (Firefox)</p> <p>Is there something I need to do to the html besides json_encode before I pass it back or should I be returning an array and then creating the with jquery?</p>
php jquery
[2, 5]
2,963,172
2,963,173
formatting json data to be camelCased
<p>I get a json response from the server that looks something like this:</p> <pre><code>{ "Response": { "FirstName": "John", "LastName": "Smith", "NickNames": { "NameOne": "Johnny", "NameTwo": "JohnS", "NameThree": "Smithy" }, "Success": true, "Errors": [] } </code></pre> <p>Is there a way I can run this response through a function so that the key of each key value pair would be camelCased?</p> <p>So the output would look something like:</p> <pre><code>{ "response": { "firstName": "John", "lastName": "Smith", "nickNames": { "nameOne": "Johnny", "nameTwo": "JohnS", "nameThree": "Smithy" }, "success": true, "errors": [] } </code></pre> <p>If someone could point me in the right direction, that'd be great.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,594,722
3,594,723
How to make a continuous connection between php and python
<p>I want to make a real time application. So here is the scenario- I have data coming to my computer through one of my COM port, which then is fetched by python and shown. For this I have used just a simple python <code>serial</code> module which reads the data via serial port and shows it.</p> <p>Now this data is local to me. For high-end purpose, I need this data to be posted to one of my online website, which has <strong>apache</strong> webserver running, which will show the data worldwide.</p> <p>So for real-time, I need to continuously monitor the serial port, take the data it, and post it continuously to the web-server (PHP end). (Reading the serial data and posting it to server run in parallel).</p> <p>Now the problem is-</p> <ol> <li><p>How do I monitor the data coming from COM port <em>in parallel</em> to posting it to webserver?</p></li> <li><p>If I am sending data continuously, How do web-server get to know if the data is continuous? For this approach, I thought to save the data to database of webserver and make PHP script to continuously monitor the database. Tell me a better approach if you have</p></li> </ol>
php python
[2, 7]