Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,709,764
5,709,765
jquery/javascript content replace?how reusable
<p><a href="http://img163.imageshack.us/img163/6248/93306989.jpg" rel="nofollow">http://img163.imageshack.us/img163/6248/93306989.jpg</a></p> <p>the images above show what i want,</p> <p>i'm using Facebox to do the pop up content,so how can i make the pop up content dynamic?</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('.openExample').click(function() { $.facebox($('#exampleSource').val()); return false; }); }); &lt;/script&gt; </code></pre> <p>the code above work just fine,but how can edit to reusable???</p> <pre><code>&lt;form&gt; &lt;textarea id="exampleSource" class="expand"&gt; &lt;html&gt; &lt;body&gt; &lt;h1&gt;Heading&lt;/h1&gt; &lt;p&gt;paragraph.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; &lt;/textarea&gt; &lt;input type="Submit" value="Submit" class="openExample" /&gt; &lt;input type="reset" value="Reset" /&gt; &lt;/form&gt; </code></pre>
javascript jquery
[3, 5]
398,779
398,780
JQUERY outline textfield to show error
<p>I have a <code>textfield</code> and at the moment i disable the submit button when the <code>textfield</code> does not <code>hold three charactes</code>. What i want to do now is also outline the <code>textfield</code> <strong>bold red</strong> and still have the <code>submit</code> button disabled, however i cannot seem to be able to outline the <code>textfield</code> and disable the submit <code>button</code> at the same time.</p> <p>my code for disabling the submit button is as follows is it possible to be able to outline the <code>textfield</code> when the <code>length is &lt; 3</code> in this function to? </p> <p>thankfull for any help </p> <pre><code>$(function() { $('input[name="updateMessage"]').attr('disabled','disabled'); $('input[name="selectMessageForUpdate"]').keyup(function(){ if($('input[name="selectMessageForUpdate"]').val().length &lt; 3) { $('input[name="updateMessage"]').attr('disabled','disabled'); } else { $('input[name="updateMessage"]').removeAttr('disabled'); } }); }); </code></pre>
javascript jquery
[3, 5]
681,315
681,316
Javascript how to add target="_parent" in document.location.href
<pre><code>document.location.href="http://verttgrettest.com/testpaper.aspx?VideoId=1" </code></pre> <p>Javascript how to add target="_parent" in document.location.href</p>
javascript jquery
[3, 5]
3,530,694
3,530,695
Add code to created DOM Elements using live()
<p>I'm trying to set this code on new elements been added by jQuery using live()</p> <pre><code>var frcode = '&lt;iframe scrolling="no"&gt;&lt;/iframe&gt;'; $('.foo:nth-child(3n),.foo:last-child').after(frcode); $('.foo:first').before(frcode); </code></pre> <p>I tried livequery plugin but not working good with me</p> <p>the Livequery plugin i tried to use </p> <pre><code>$(".foo:nth-child(3n),.foo:last-child").livequery(function(){ $(this).after(frcode); }); $(".foo:first").livequery(function(){ $(this).before(frcode); }); </code></pre>
javascript jquery
[3, 5]
743,451
743,452
Passing 2 sets of data using JQuery .Ajax?
<p>I have a search box:</p> <pre><code>&lt;input class="box" name="search" type="text" id="search_input" /&gt; </code></pre> <p>And a <code>json_encode</code> array called <code>$findall</code>. Using jQuery <code>$.ajax()</code> I want to be able to pass the array AND the "keyword" from the input via the data field. The code below has set the keyword from the search_input as the variable dataString</p> <pre><code>$.ajax({ type: "GET", url: "core/functions/searchdata.php", data: dataString, //data:{availableDevicesArray : availableDevices }, beforeSend: function() { $('input#search_input').addClass('loading'); }, success: function(server_response) { $('#searchresultdata').append(server_response); $('span#category_title').html(search_input); } </code></pre> <p>I can pass either dataString or the array, but not both which I need. How is it possible to pass them both?</p> <p>UPDATE:</p> <p>My PHP to get the array is:</p> <pre><code>mysql_select_db($database_database_connection, $database_connection); $query = "SELECT * FROM Device_tbl"; $result=mysql_query($query, $database_connection) or die(mysql_error()); $findall = array (); while($row = mysql_fetch_array($result)){ $findall[] = $row; } </code></pre> <p>and I am storing the availbleDevices array like so:</p> <pre><code>var availableDevices = &lt;? echo json_encode($findall); ?&gt;; </code></pre>
php jquery
[2, 5]
4,941,271
4,941,272
Trigger an Asp.net menu click in code
<p>How can I trigger a Asp.net menu click in code behind? (it's a Webcontrol.Menu)</p> <p>Ideally I don't want to do this but it is embedded in a horrible Sharepoint webpart that I am trying to add a feature to and don't have time to rewrite it.</p> <p>The click on the menu item sets the index of a MultiView control to show one of the views. I need to trigger the whole page lifecycle again.</p>
c# asp.net
[0, 9]
2,199,459
2,199,460
Make back button go to a different page
<p>I'd like to JavaScript, or JQuery (or any plug in actually) to force the browser to load a specific page when the back button is clicked. </p> <p>Basically insert a page into the browser's history.</p> <p>I've found a way of doing it below, but it seems long winded. Am I missing something?</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Back button test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; window.history.pushState('other.html', 'Other Page', 'other.html'); window.history.pushState('initial.html', 'Initial Page', 'initial.html'); &lt;/script&gt; Initial page &lt;br /&gt; &lt;script type="text/javascript"&gt; window.addEventListener("popstate", function(e) { if(document.URL.indexOf("other.html") &gt;= 0){ document.location.href = document.location; } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
3,506,941
3,506,942
Passing parameters on JQuery .trigger
<p>I am using JQuery trigger but am not sure what the correct syntax is to pass parameters in my situation. Here is where I am making the call :</p> <pre><code>$('#'+controlName).trigger(event); </code></pre> <p>Here is where I am doing the event binding :</p> <pre><code>$(window).on('onPartialRendered', onPartialRendered); </code></pre> <p>And here is my event handler :</p> <pre><code>var onPartialRendered = function () { ..... }; </code></pre> <p>Everything works fine until I try to pass parameters. What would be the correct way to do it as per my example?</p>
javascript jquery
[3, 5]
5,962,523
5,962,524
jquery each() with setInterval
<p>I have an object filled with various elements that I wish to iterate through using <code>each()</code> and then perform an action on the element whose turn it is. So:</p> <pre><code>var arts = $("#press-sqs &gt; article"); shuffle(arts); $(arts).each(function(){ setInterval(function() { // in here perform an action on the current element in 'arts' }, 2000); }); </code></pre> <p>( <code>shuffle()</code> is a basic shuffle function )</p> <p>What I can't figure out is how to access the current element as a selector and perform an action on it. <code>$(this)</code> is <code>$(window)</code>.</p> <p>Finally I would then need the function to start the iteration again once it reaches the end of <code>art</code> and keep on looping ad infinitum.</p>
javascript jquery
[3, 5]
4,996,063
4,996,064
qtip unable to display Tool Tip
<p>in aspx page inside <code>head</code> tag:<br></p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { InitializeToolTips(); }); function InitializeToolTips() { $.toolTipRequest("txtText", "Text tip"); $.toolTipRequest("imgGirl", "You want to see image"); } (function($) { $.toolTipRequest = function(id, data) { $('#' + id).qtip({ content: { data: { id: data } }, position: { corner: { target: 'leftBottom', tooltip: 'topLeft' } }, style: { name: 'blue' } }); } })(jQuery); &lt;/script&gt; </code></pre> <p>Code run and didnt show any error in console but i am unable to display message(Tool tip).What is my mistake.Thanks.</p> <p>I got a solution.So for future ref. i post it here.<br> instead of<br></p> <pre><code>content: { data: { id: data }}, </code></pre> <p>i use<br></p> <pre><code> content: { text: data }, </code></pre>
jquery asp.net
[5, 9]
3,718,131
3,718,132
how to add .apk and sqlite database file in android mobile?
<p>My application is developed now &amp; i want to test it on mobile phone. I want to add .apk &amp; .sqlite file into an android mobile. but i dont get a specific solution for it. pls tell me an solution for this.</p>
java android
[1, 4]
3,892,271
3,892,272
Posting Data to another domain thru code-behind of Asp.NET
<p>Since we can't post data to cross domains, I want to post the data to my aspx page and a code-behind code will take the data and submit to cross domain <em>(which is not being operated by me, so I don't have permission to modify source code for jsonp)</em> and also the website to which I pass my post data is also returning a cookie which includes shopping cart info and I need to store it on my local browser cache as well.</p> <p>Can you provide me some code on how to accomplish that?</p> <p>Thanks..</p> <p>What I know is I need to use <code>WebResponse</code> and <code>WebRequest</code> classes for that manner.</p>
javascript asp.net
[3, 9]
3,763,064
3,763,065
World Map with Custom Marker Positions- ASP.NET
<p>I'm looking for some suggestions as to how I could implement a World Map with custom positioned markers. My client would like a world map that represents the locations of his Licensees.</p> <p>I have been provided with the following xml as the data source for the map.</p> <pre><code> &lt;Licensee id="1"&gt; &lt;Continent&gt;Africa&lt;/Continent&gt; &lt;Brand&gt;All&lt;/Brand&gt; &lt;CompanyName&gt;ABC Industries PLC&lt;/CompanyName&gt; &lt;Country&gt;Nigeria&lt;/Country&gt; &lt;xRef&gt;123&lt;/xRef&gt; &lt;!-- does not exist --&gt; &lt;yRef&gt;123&lt;/yRef&gt; &lt;!-- does not exist --&gt; </code></pre> <p>Above is an example of 1 Licensee in the xml. The xRef and yRef data does not exist yet. My first idea was to make use of the ASP.NET image library which could overlay a marker for each Licensee onto a world map. </p> <p>It would read the co-ordinates from xRef/yRef fields - these would actually reflect the positioning of the marker on the image (eg xRef = 0, yRef = 0 means very top left corner of the world map).</p> <p>The client has requested a 'managed' solution, so that when he adds more licensees to the xml the new licensees will appear on the world map, hence why I need to programmatically generate these map markers.</p> <p>The client is 'ok' with the fact that when he adds a new Licensee he will have trial/error the exact positioning of the marker (pixel offset).</p> <p>I just wanted to know if anyone else has a better idea before I start working on this. Ideally we would like to avoid flash.</p> <p>It is quite likely we will dump the xml into a database and provide a front end for the client.</p>
c# asp.net
[0, 9]
1,986,892
1,986,893
How should I convert Java code to C# code?
<p>I'm porting a Java library to C#. I'm using Visual Studio 2008, so I don't have the discontinued Microsoft Java Language Conversion Assistant program (JLCA).</p> <p>My approach is to create a new solution with a similar project structure to the Java library, and to then copy the java code into a c# file and convert it to valid c# line-by-line. Considering that I find Java easy to read, the subtle differences in the two languages have surprised me.</p> <p>Some things are easy to port (namespaces, inheritance etc.) but some things have been unexpectedly different, such as visibility of private members in nested classes, overriding virtual methods and the behaviour of built-in types. I don't fully understand these things and I'm sure there are lots of other differences I haven't seen yet.</p> <p>I've got a long way to go on this project. What rules-of-thumb I can apply during this conversion to manage the language differences correctly?</p>
c# java
[0, 1]
1,191,584
1,191,585
How to indent particular row in datagridview
<p>I have a gridview and and I am creating it dynamically, I get parent and child tables records and binding the data to a single data grid view. I need to indent the row which is from child table a bit to the right so that i can differentiate the record from parent record.</p> <pre><code>private void CreateDynamicGridView(DataTable tables, GridView gv) { try { DataTable _dtSearchList = tables; strColumnCount = _dtSearchList.Columns.Count.ToString(); foreach (DataColumn col in _dtSearchList.Columns) { BoundField bfield = new BoundField(); bfield.DataField = col.ColumnName; bfield.HeaderText = col.ColumnName; gv.Columns.Add(bfield); } gv.DataSource = _dtSearchList; gv.DataBind(); } catch (Exception ex) { } } </code></pre>
c# asp.net
[0, 9]
73,040
73,041
"syntax error on token ";" ,, expected" after private ... adapter
<p>It writes syntax error on token ";" ,, expected after the line <code>private ArrayAdapter adapter ;</p> <pre>package ru.for_listactivity; import android.os.Bundle; import android.app.ListActivity; import android.view.Menu; import android.widget.ArrayAdapter; public class MainActivity extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } final String[] catnames = new String[] { "Рыжик", "Барсик", "Мурзик", "Мурка", "Васьк", "Томасина", "Бобик", "Кристина", "Пушок", "Дымка", "Кузя", "Китти", "Барбос", "Масяня", "Симба" } ; private ArrayAdapter&lt;String&gt; adapter ; // here is a problem adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, catnames); } </code></pre>
java android
[1, 4]
1,285,672
1,285,673
Is Using a Static Configuration Class Good Practice?
<p>In my project I am developing at the moment, I have many configuration settings. Things such as</p> <ul> <li>Alarm times</li> <li>Amount of items to retrieve from the server</li> <li>LocationManager integers such as minium location </li> </ul> <p>These are all static final and are all in a class that corresponds to the value.</p> <p>My question is, are there any problems with moving all of these values to a single static class? </p> <p>My thinking is that when it comes to testing and tweeking the app, it will be easier to manage. </p>
java android
[1, 4]
5,544,915
5,544,916
Replace words in a string
<p>I have an array as follows:</p> <pre><code>var arr = ["apple", "banana", "carrot"]; </code></pre> <p>I want to replace all sentences which have the words similar to the array</p> <pre><code>function replaceString(fruits){ return fruits.replace(arr, "---"); } </code></pre> <p>So if I pass a string - "An apple a day keeps", it should return "An --- a day keeps" </p> <p>How can I do it?</p>
javascript jquery
[3, 5]
1,121,119
1,121,120
how can I include php in jQuery?
<p>Let's say I have some html file like this:</p> <pre><code>&lt;body&gt; &lt;div&gt;&lt;/div&gt; &lt;/body&gt; </code></pre> <p>Given that I have referenced jQuery correctly, and I have a .js file like:</p> <pre><code>$(document).ready(function(){ $('div').html(4); }); </code></pre> <p>That will output 4 when the html is viewed in a browser. Why does it not show anything when I do this?</p> <pre><code> $(document).ready(function(){ $('div').html(&lt;?php echo 4; ?&gt;); }); </code></pre>
php jquery
[2, 5]
4,639,547
4,639,548
Using javascript inside a Java program
<p>I am trying to invoke a javascript script inside my java program in order to change the selection of a drop down box. I am attempting to pass my html-scrape Document object gotten from jsoup.connect into my script to select a different value. The default option in the drop menu is 1 month (these are timeframes of data to present); I want to change it to 18 months. This is the method I have devised.</p> <pre><code>public static void dateFix(Document sData){ ScriptEngineManager mgr = new ScriptEngineManager(); ScriptEngine motor = mgr.getEngineByName("JavaScript"); motor.put("htmlCode", sData); try{ motor.eval("function dateFix(num) {" + "var selObj = htmlCode.getElementById(" + "ddlTimeFrame" + ");"+ "selObj.selectedIndex = num;}"); } catch(ScriptException e){ } Invocable invocableEngine = (Invocable) motor; try{ invocableEngine.invokeFunction("dateFix(6)"); }catch(ScriptException e){ } catch(NoSuchMethodException e){ } catch(Exception e){ } } </code></pre> <p>Thanks for your consideration. Cheers.</p>
java javascript
[1, 3]
4,619,132
4,619,133
Bind serverside function with Hyperlink control in asp.net web form page
<p>I have few controls on asp.net web form page and i want to link a code behind function to Hyperlink to resolve URL</p> <p>HTML &amp; Code Behind Example</p> <pre><code>&lt;asp:HyperLink ID="hyplnkVideo" runat="server" NavigateUrl='&lt;%# this.getVideoPageURL()%&gt;'&gt; &lt;div id="dAlbumCategory" class="AlbumCategoryIcon"&gt; &lt;asp:Image ID="Image1" ImageUrl='~/Images/gallery/Videos.png' runat="server" /&gt; &lt;/div&gt; &lt;/asp:HyperLink&gt; protected String getVideoPageURL() { string url; int PageID = Helper.GetPageIDbyName("Videos.aspx", Request["Language"]); url = "~/en/Videos.aspx?PageID=" + PageID + "&amp;Language=" + Request["Language"]; return url; } </code></pre> <p>This Hyperlink control is not inside any grid view or repeater control. I tried several way but for some reason it doesn't call the function.</p> <p>I would appreciate help in this regard</p>
c# asp.net
[0, 9]
2,527,201
2,527,202
jquery remove matching classes?
<p>I have a list of stuff with thing like</p> <pre><code> &lt;ul&gt; &lt;li&gt; &lt;div class="pack1 active1"&gt;&lt;span&gt;$3.99&lt;/span&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="pack2"&gt;&lt;span&gt;$5.99&lt;/span&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="pack3 active3"&gt;&lt;div id="ribbon"&gt;&lt;span&gt;40&lt;/span&gt;&lt;/div&gt;&lt;span&gt;$6.99&lt;/span&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="pack4"&gt;&lt;span&gt;$10.99&lt;/span&gt;&lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="pack5"&gt;&lt;span&gt;$259.99&lt;/span&gt;&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>and I want to remove all the active* classes on click. I've tried to do something like <code>$('*[class^="active"]').removeClass()</code> but that isn't working</p> <p>Any help?</p>
javascript jquery
[3, 5]
3,230,245
3,230,246
the main cause of application force close on android
<p>What is the main cause of force close on android? Is there any way to help avoid unwanted force close problem when coding an android application?</p>
java android
[1, 4]
1,422,232
1,422,233
jQuery .load problems. Not effected by parent javascript file
<p>When trying to load a file using the <code>.load</code> function, that newly loaded file isn't affected by my jQuery in the parent file that it's being loaded into. Instead of adding the <code>&lt;script src=''&gt;&lt;/script&gt;</code> code in every page that's being loaded, is there a better way to get my javascript file working within those files? Or is that the only way to have the javascript work within the newly loaded files?</p>
javascript jquery
[3, 5]
1,795,604
1,795,605
.stop() doesn't work with hover selector
<p>This is my code: </p> <pre><code>$(function(){ $("#deals ul li ul").hover(function(){ $(this).stop().find(".trans").fadeIn("fast"); $(this).stop().find(".text").fadeIn("fast"); return false; },function(){ $(this).find(".trans").fadeOut("fast"); $(this).find(".text").fadeOut("fast"); }); return false; }); </code></pre> <p>When you hover a few times quickly it will load those actions per second and stop() should make it stop but it doesn't work here, any thoughts would be appreciated.</p>
javascript jquery
[3, 5]
1,246,118
1,246,119
Universal Animation Queue in jQuery?
<p>I'm trying to create this sliding effect but the only problem I'm having is queuing. </p> <pre><code>$(this).animate({'left' : '0%'}, randTime, function() { $(this).animate({'boxShadow' : 'none'}); setTimeout(function() { $container.children('.slice').addClass('noshadow'); $('body &gt; div:not(#'+container+') .slice').each(function() { restartAnimation($(this)); }); $container.children('.content').fadeIn(); }, (aLength+100)); }); </code></pre> <p>The container variable above is the current container. I did :not(container) so the current container would continue animating. This is all in a function that has two attributes, the ID of the container element and the way the animation is going to run (just keywords run through if statements). Then I will have a menu which activates the animations like this:</p> <pre><code>if($(this).attr('name') == 'home') { animation('home', 'top'); } else if { ..... </code></pre> <p>The restart animation function simply restarts all other animating elements to their original positions so they can be run again. Now, the problem is, there is delay until the restart function runs, so if you click two menu items within the delay time you end up with the restart function running and then everything gets quite confused. </p> <p>I need a way to restart the animation back to its original position so it's ready to run again, but not interfere and restart other animating elements. Otherwise we end up with a huge mess. I've set up a quick jsFiddle so you can try out the effect. The code is a little messy at the moment, I was planning on tidying everything up once I finished, but this queuing problem has really got me stuck. <a href="http://jsfiddle.net/qe7dj/" rel="nofollow">http://jsfiddle.net/qe7dj/</a></p>
javascript jquery
[3, 5]
643,671
643,672
scan barcode using android phone camera using ASP.net webpage?
<p>i am asp developer. i want to use android phone camera as scanner. How can i do that? the output need to goes in textbox on web page. Is there is any API or Javascript for this?</p>
javascript android asp.net
[3, 4, 9]
726,420
726,421
Java/Android regex test if in a string is a link
<pre><code>Pattern.compile("((http\\://|https\\://|ftp\\://|sftp\\://)|(www.))+((\\S+):(\\S+)@)?+(([a-zA-Z0-9\\.-]+\\.[a-zA-Z]{2,4})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_\\?\\.'~]*)?"); </code></pre> <p>I have this pattern, I'd like to test if there is a link in my string. I'd like to linkify those text in a <code>TextView</code>.</p> <p>The code does not work when the link contains a <code>&amp;</code> character. </p> <p>full code:</p> <pre><code>Pattern httpMatcher = Pattern.compile("((http\\://|https\\://|ftp\\://|sftp\\://)|(www.))+((\\S+):(\\S+)@)?+(([a-zA-Z0-9\\.-]+\\.[a-zA-Z]{2,4})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_\\?\\.'~]*)?"); String httpViewURL = "myhttp://"; Linkify.addLinks(label, httpMatcher, httpViewURL); </code></pre>
java android
[1, 4]
5,977,315
5,977,316
Cookie grabber in Php or javascript
<p>I want to make a scrip through which i can grab the visitors cookis and store it in the txt file.can it be possible if so then help me.Doesn't matter it should be in php or javascript.</p>
php javascript
[2, 3]
1,982,877
1,982,878
jQuery: Microsoft JScript runtim error: Object Expected
<p>I am new to jQuery. I am trying to display or hide a span based on the selection of a checkbox. Here's my code:</p> <pre><code>&lt;script type = "text/javascript"&gt; $('#chkShowDescriptions').change(function () { var display = this.checked ? 'block' : 'none'; $('.desc').css('display', display); } ); &lt;/script&gt; &lt;p&gt; &lt;input type = "checkbox" id = "chkShowDescriptions" name = "chkShowDescriptions" /&gt;Show Descriptions &lt;/p&gt; @if(@item.Description != null) { &lt;span class = "desc" style = "font-size: 0.7em; color: Gray; text-align: justify; display: none;"&gt; Description: @item.Description&lt;br /&gt; &lt;/span&gt; } </code></pre> <p>However, I get a run-time exception that says: <code>Microsoft JScript runtime error: Object expected</code></p> <p>I am using IE 8 on Windows 7.</p>
javascript jquery
[3, 5]
2,130,280
2,130,281
JS to jQuery to the fullest
<p>I have this:</p> <pre><code>function createObject() { var request_type; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ request_type = new ActiveXObject("Microsoft.XMLHTTP"); } else { request_type = new XMLHttpRequest(); } return request_type; } var http = createObject(); var nocache = 0; function insert() { document.getElementById('insert_response').innerHTML = "To Sek .. " var bID= encodeURI(document.getElementById('bID').value); var kommentar= encodeURI(document.getElementById('kommentar').value); nocache = Math.random(); http.open('get', 'insert.php?bID='+bID+'&amp;kommentar=' +kommentar+'&amp;nocache = '+nocache); http.onreadystatechange = insertReply; http.send(null); } function insertReply() { if(http.readyState == 4){ var response = http.responseText; document.getElementById('insert_response').innerHTML = response; if ($("#box[value=1]").length &gt; 0) { window.parent.showMessage("Video Is OK"); } } } </code></pre> <p>And i want to "shorten" the code, and make it use jQuery to the fullest. eg, i have heard of serialize(); instead of using http.open etc.., but how should i use it in this case? </p> <p>And do i really need all that in createobject() to make the http?</p>
javascript jquery
[3, 5]
3,208,053
3,208,054
SQL Syntax highlighting in a textbox
<p>In my webpage, i have a textbox and a 'execute' button. User can type a query in the textbox and clicks on execute button, it will produce results. I want to do sql syntax highlighting in the textbox as the user types. That is, when user types <code>SELECT abc FROM table</code>, I want to show <code>SELECT</code> and <code>FROM</code> in blue color as he types. (like how it is in toad)</p> <p>I tried to do like following. </p> <p>1) Having a onkeyup event of the textbox fired. </p> <p>2) in javascript, i check if the last typed character is a space. </p> <p>3) Then take the whole text of the textbox and split them into words (using space as delimiter) </p> <p>4) Check each word and see if it is a keyword (i have all the keywords in a list). </p> <p>5) if it is a keyword, i add font tags for that particular word like <code>&lt;FONT COLOR='BLUE'&gt;SELECT&lt;/FONT&gt;</code></p> <p>So, now my final output would be <code>&lt;FONT COLOR='BLUE'&gt;SELECT&lt;/FONT&gt; * &lt;FONT COLOR='BLUE'&gt;FROM &lt;/FONT&gt; table</code></p> <p>Problem is i am not able to assign this output to <code>textbox.innerHTML</code>. Javascript throws error.</p> <p>I suppose, textbox's <code>innerhtml</code> cannot take html tags. Is that true?</p> <p>Is there an alternative to achieve my objective. (I am trying to do in javascript and i dont want to use any third party stuff)</p>
c# javascript asp.net
[0, 3, 9]
4,502,838
4,502,839
jquery issue with on and live
<p>I have the following code:</p> <pre><code>var $reviewButton = $('span.review_button'); $reviewButton .live('click', function(){ $('#add_reviews').show(); } ) </code></pre> <p>Later in the script, I use an AJAX call to load some content and another instance of $('span.review_button') enters the picture. I updated my code above to use '.live' because the click event was not working with the AJAX generated review button. </p> <p>This code works, as the .live(click //) event works on both the static 'span.review_button' and the AJAX generated 'span.review_button'</p> <p>I see however that .live is depracated so I have tried to follow the jquery documentations instructions by switching to '.on' but when I switch to the code below, I have the same problem I had before switching to '.live' in which the click function works with the original instance of 'span.review_button' but not on the AJAX generated instance:</p> <pre><code>var $reviewButton = $('span.review_button'); $reviewButton .on('click', function(){ $('#add_reviews').show(); } ) </code></pre> <p>Suggestions?</p>
javascript jquery
[3, 5]
5,281,569
5,281,570
jQuery - Imitate Click
<p>I want to imitate an anchor click when a user clicks on the containing <code>&lt;TD&gt;</code> but having problems.</p> <p>This is the JS part:</p> <pre><code>$('contactTab').click(function() { $('contactTabLink').trigger("click"); }); </code></pre> <p>And this is the HTML part:</p> <pre><code>&lt;td class="previewTabs" id="contactTab"&gt; &lt;a class="previewTabLink" id="contactTabLink" rel="#contactOverlay"&gt;CONTACT&lt;/a&gt; &lt;/td&gt; </code></pre> <p>When somebody clicks the <code>&lt;TD&gt;</code> contactTab, it should trigger a click event on <code>&lt;A&gt;</code> contactTabLink which then launches an Overlay. My problem is that the JS function with click listener is NOT firing at all.</p> <p>Can anybody see where I am going wrong?</p> <p>EDIT 1:</p> <p>I have changed the selectors to have #'s but it still won't fire the function.</p>
javascript jquery
[3, 5]
3,775,920
3,775,921
Get download url from youtube htmlcontent getting error
<p>here is way to do it.. but it's showing error in row of split.. I don't know how to fix it.. please help..</p> <pre><code>private String getDownloadUrlFromHtmlContent(String htmlContent) { String downloadUrl = null; String[] videoIdMatches = htmlContent.split(/\"video_id\":\s*\"([^\"]+)\"/); return downloadUrl; } </code></pre>
java android
[1, 4]
4,470,534
4,470,535
asp.net error Cannot close stream until all bytes are written
<p>I have an web application that works fine when uploading pictures but when uploading larger videos to picasa, I sometimes get an error message. Is there a way I can know that the steam is not needed anymore so I can close it (using the keyword "using" or something) thanks for any advice. Error</p> <blockquote> <p>System.Net.WebException: The request was aborted: The request was canceled. ---> System.IO.IOException: Cannot close stream until all bytes are written.</p> </blockquote> <pre><code> PicasaEntry entry = service.Insert(postUri, videoEntry);//This is the line that does the call PhotoAccessor googlePhoto = new PhotoAccessor(entry); stream.Close();//Fails here </code></pre>
c# asp.net
[0, 9]
2,352,582
2,352,583
Insert text after specific character?
<p>Is it possible to insert a <code>div</code> after a certain amount of characters in a paragraph of text?</p> <p>If I have a <code>div</code> full of text, like so:</p> <pre><code>&lt;div class="content"&gt; Vivamus luctus urna sed urna ultricies ac tempor dui sagittis. &lt;/div&gt; </code></pre> <p>And I want to insert a <code>div</code> after the 13th character:</p> <pre><code>Vivamus luctu&lt;div&gt;s urna sed urna ultricies ac tempor dui sagittis </code></pre> <p>Can I do this with jQuery/Javascript?</p> <p>I am receiving the bounds for where I want to insert a <code>div</code> from <code>getSelection().extentOffset</code> which results in a number, say <code>13</code> which is where I want to insert the <code>div</code>.</p> <p>I was able to get this to partially work, like so:</p> <pre><code>$("div").on("mouseup", function () { var start = window.getSelection().anchorOffset; var end = window.getSelection().extentOffset; console.log(start + ", " + end); console.log($(".content").text().substring(start, end)); $('.output').html($('.content').html().substring(0, start) + '&lt;span class="highlight"&gt;' + $('.content').html().substring(start, end) + "&lt;/span&gt;" + $('.content').html().substring(end)); }); </code></pre> <p>But that replaces the entire text when the bounds change, meaning that there can't be more than one section wrapped in a <code>div</code>.</p>
javascript jquery
[3, 5]
1,438,810
1,438,811
Does Android support jquery?
<p>I am developing an Android application,here I have decided to put page flip rotation.Just wanted to know whether Android supports jquery so that it would be easier for me to implement the logic</p>
jquery android
[5, 4]
5,574,203
5,574,204
Is there a better method to structure this if statement
<p>It just seems a mess to me, my mind tells me there has to be a better way.</p> <p>I have 6 controls on a web page.</p> <pre><code>if (printer_make_1.Text != "" &amp;&amp; printer_model_1.Text != "" &amp;&amp; printer_make_2.Text != "" &amp;&amp; printer_model_2.Text != "" &amp;&amp; printer_make_3.Text != "" &amp;&amp; printer_model_3.Text != "") { // Do something } </code></pre> <p>What is the best/most efficient way to do this?</p>
c# asp.net
[0, 9]
5,268,663
5,268,664
How to echo something in C# in an .aspx file
<p>I know you can do this</p> <pre><code>&lt;%= Request.Form[0] %&gt; </code></pre> <p>But how do you do something like this?</p> <pre><code>&lt;% if(Request.Form[0]!=null) echo "abc"; %&gt; </code></pre>
c# asp.net
[0, 9]
4,883,044
4,883,045
mix javascript and php
<p>i have file: <strong>file.php</strong></p> <p>in this file is:</p> <pre><code>&lt;script type="text/javascript"&gt; //.... var sumJS = 10; &lt;?php $sumPHP = sumJS ?&gt; &lt;/script&gt; &lt;?php echo "Sum = " . $sumPHP ?&gt; </code></pre> <p>How can i assign sumJS for $sumPHP ?</p> <p>if i would like make this conversely then i make:</p> <pre><code>$sumPHP = 10; &lt;script type="text/javascript"&gt; var sumJS; sumJS = &lt;?php echo $sumPHP ?&gt;; alert(sumJS); &lt;/script&gt; </code></pre> <p>but how can i make this for my problem?</p>
php javascript jquery
[2, 3, 5]
675,066
675,067
Help making a multiple choice quiz with jFormer (jQuery and PHP)
<p>I was wondering if anyone could help me out with a multiple choice quiz I'm making with <a href="http://www.jformer.com/" rel="nofollow">jFormer</a>.</p> <p>Basically I'm really new to PHP and I'm having trouble with the following:</p> <ul> <li>Finding out how to arrange radio buttons vertically (at the moment I'm basing my quiz on the 'Survey' Demo (<a href="http://www.jformer.com/demos/survey/" rel="nofollow">http://www.jformer.com/demos/survey/</a>) and it won't let me rearrange the radio buttons. Instead, when I do, it treats each radio button separately and you can only pick the first one.</li> <li>All my radio buttons are labeled A - E (e.g. <code>&lt; input id="statement1-choice3" type="radio" value="C" name="statement1" / &gt;</code>) How do I then calculate the outcome so that those who picked a majority of A answers get shown a different div to those who picked a majority of B answers?</li> </ul> <p>Thanks in advance,</p> <p>Ella</p>
php jquery
[2, 5]
2,126,947
2,126,948
Problem in assigning js value to php variable
<p>How can i assign a javascript value to a php variable,</p> <p>This is what i want to do:</p> <pre><code>&lt;?php $pag = echo "&lt;script language ='javascript'&gt;var pn = document.getElementById('t').value; document.write(pn); &lt;/script&gt;"; ?&gt; </code></pre> <p>But getting error as: Parse error: syntax error, unexpected T_ECHO</p> <p>or is there any other way to do, but i want to assign that valur to php variable. can somebody help here?</p>
php javascript
[2, 3]
5,460,774
5,460,775
Show progress while loading image to server, using MultipartEntity
<p>I sending image to server using this code:</p> <pre><code>public void loadImage(final File image) { new Thread(new Runnable() { public void run() { try{ MultipartEntity entity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); entity.addPart("image", new FileBody(image)); HttpResponse response=sendMultipart("http://myurl.net", entity); }catch(Exception e){ } } }).start(); } public HttpResponse sendMultipart(final String URL,MultipartEntity entity) throws IOException{ HttpPost httpPost=new HttpPost(URL); httpPost.setEntity(entity); return sendRequest(httpPost); } public HttpResponse sendRequest(final HttpRequestBase mhttp) throws IOException{ HttpParams params=new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, REST.CONNECTION_TIMEOUT); HttpConnectionParams.setSoTimeout(params, REST.SERVER_TIMEOUT); HttpClient httpClient=new DefaultHttpClient(params); HttpResponse response=httpClient.execute(mhttp); //if we're been redirected then try to get relocated page if(response.getStatusLine().getStatusCode()!=HttpStatus.SC_OK){ Header [] headers=response.getHeaders("Location"); if(headers!=null &amp;&amp; headers.length!=0){ String newUrl=headers[headers.length-1].getValue(); HttpGet httpGet=new HttpGet(newUrl); response=httpClient.execute(httpGet); } } return response; } </code></pre> <p>Question is: how to get loading progress?</p> <p>Please note, that question is NOT "how to show progress", "how to load image". I've decided that it's better to use AsyncTask, but I still don't know how to get progress.</p>
java android
[1, 4]
4,026,684
4,026,685
improveddown causing scrollbar flickering
<p>I have used improveddropdown jquery plugin... my page has 10-20 dropdowns.. when the page loads the vertical scrollbars starts flickering.. it flickers because the improveddrodown jquery runs on dropdowns which takes some time... how to avoid this flickering of the scrollbar?</p>
jquery asp.net
[5, 9]
5,072,551
5,072,552
javascript to jquery
<p>How do I write the following line which is in javascript in jQuery? </p> <pre><code>var variablename = new functionname('some variable'); </code></pre> <p>This is my js code: <code>var rt = new ResizeableTextbox('myRT');</code> </p> <p>I need to use this in the following code segment: </p> <pre><code> if($(this).text() =='String') { $("&lt;label id=labelstr"+stringinc+" &gt;"+label+"&lt;/label&gt;").appendTo(".menu li"); $("&lt;input id=inputstr"+stringinc+" type= 'text' &gt;&lt;/input&gt;").appendTo(".menu li"); //in place of this I need that javascript code. } </code></pre> <p>How do I do that? The function Resizeable is defined in a separate js file. Please help me out. </p>
javascript jquery
[3, 5]
1,303,145
1,303,146
Is there a replaceWholeText Equivalent in jQuery? - How to replace TextNode
<p>Is there a way in jQuery to replace only the textNode of an element without destroying any child DOM elements?</p> <pre><code>&lt;a href="#"&gt;&lt;span&gt;Text we don't want replaced&lt;/span&gt; Text we want replaced&lt;/a&gt; </code></pre> <p>When using <code>jquery.text([content])</code> it will replace any child nodes as well as the text content. Thus resulting in...</p> <pre><code>&lt;a href="#"&gt;Replaced Text&lt;/a&gt; </code></pre> <p>To get around this issue, I use the javascript function: replaceWholeText, but is there a better more jQuery-esque way of doing this?</p> <pre><code>$('a.button')[0].lastChild.replaceWholeText('Replacement Text'); </code></pre> <p>Second question: Will this work in all browsers?</p> <p>jsfiddle example showing both the jQuery and Javascript methods: <a href="http://jsfiddle.net/highwayoflife/ABfMS/1/" rel="nofollow">http://jsfiddle.net/highwayoflife/ABfMS/1/</a></p>
javascript jquery
[3, 5]
3,983,991
3,983,992
Initial step for Creating a web application in Asp.net using c#
<p>Could you advice a basic step for creating a web application using c#? I am confused about how to use it, since I don't know how to write an event for a button, etc. I also don't know the difference between an input button and an asp.net button.</p>
c# asp.net
[0, 9]
5,662,517
5,662,518
jQuery / PHP - Lazy loading gallery keeps trying to fetch images even when they've all loaded
<p>I've got an image gallery that is showing one image per row inside of a div. I don't want the next image to load until it reaches the edge of the viewport (to save on server resources). All the images are named sequentially in the same folder (img/1.jpeg, img/2.jpeg, img/3.jpeg, ...).</p> <p>I'm using a modified jQuery plugin to do this, but it still keeps trying to fetch the next image after all the images in the directory have been loaded. <strong>It's the last if statement I'm having trouble with here.</strong></p> <p>How do I stop the function from running once the last image in the directory has loaded?</p> <pre><code>&lt;?php // Count total number of images in the directory $directory = "img/"; $totalImages = count(glob("" . $directory . "*.jpeg")); ?&gt; &lt;script type="text/javascript"&gt; $('document').ready(function(){ scrollalert(); }); function scrollalert(){ var scrolltop=$('#scrollbox').attr('scrollTop'); var scrollheight=$('#scrollbox').attr('scrollHeight'); var windowheight=$('#scrollbox').attr('clientHeight'); if(scrolltop&gt;=(scrollheight-(windowheight))) { // Fetch next image var nextImgNum=$('#content img').length + 1; $('#content').append('&lt;img src=\"book1/'+nextImgNum+'.jpeg\" /&gt;&lt;br /&gt;'); updatestatus(); } if(nextImgNum&lt;=&lt;?php echo $totalImages ?&gt;) { setTimeout('scrollalert();', 0); } } &lt;/script&gt; </code></pre> <p>Any tips to optimize this script are greatly appreciated too :)</p>
php javascript jquery
[2, 3, 5]
4,679,903
4,679,904
How to compare character ignoring case in primitive types
<p>I am writing these lines of code:</p> <pre><code>String name1 = fname.getText().toString(); String name2 = sname.getText().toString(); aru = 0; count1 = name1.length(); count2 = name2.length(); for (i = 0; i &lt; count1; i++) { for (j = 0; j &lt; count2; j++) { if (name1.charAt(i)==name2.charAt(j)) aru++; } if(aru!=0) aru++; } </code></pre> <p>I want to compare the chars of two string ignoring the case. Simple <code>IgnoreCase</code> won't work then how do i do that? Adding <code>65</code> is also not working. help!</p>
java android
[1, 4]
866,122
866,123
'Activating' JavaScript for each page in large web sites
<p>I am working on a medium size web site that has plenty of custom JavaScript written for it.</p> <p>At present all the script is stored in seperate JS files for each area of functionality. These are then minified and combined into a single, large JS file during our build process.</p> <p>For each page, the relevant JavaScript is usually executed based on the presence of an element with a particular class on the page. For example:</p> <pre><code>$(document).ready(function() { var foo = $("div.dostufftome") if(foo) { // dostuff } } </code></pre> <p>I'm concerned that this approach seems a little fragile, and also potentially quite slow.</p> <p>The only other alternative I can see is to put the 'activation' code inline in the HTML in a CData section, with the bulk of the code in the attached JS file.</p> <p>Grateful for any advice.</p>
javascript jquery
[3, 5]
2,159,547
2,159,548
VAR thevalue = $.function(myownfunction); ? wrong?
<p>i am using a jquery function as a variable in my javascript file .</p> <pre><code>var thevalue = $.function(myownfunction); </code></pre> <p>but when i run it and firebug tells me that <strong>$.function(myownfunction);</strong> is not a function. The function fetches a value and i want to change it into a VAR so other functions can use this variable instead of repeating the fetch.</p> <p>p/s $.function(myownfunction); is just an example .</p> <p>Have a nice day and thanks.</p>
javascript jquery
[3, 5]
3,119,032
3,119,033
how to find and apply style to grand parent div?
<p>Is there a way I can find the grand parent of a div and apply style to it?</p> <pre><code>&lt;div class="wrapBoxes"&gt; &lt;div class="filters"&gt;&lt;/div&gt; &lt;div class="wrapContainer"&gt; &lt;-- Need to apply style to this --&gt; &lt;div class="leftNav"&gt;&lt;/div&gt; &lt;div id="container"&gt; &lt;div class="box"&gt;&lt;/div&gt; &lt;-- From here --&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Something with this logic?</p> <pre><code>$(".box").find(grandParent).applyWhateverCss to GrandParent </code></pre>
javascript jquery
[3, 5]
2,200,189
2,200,190
jquery saving data until phonegap app closes?
<p>Is there a way to write data to a storage that gets erased when phonegap mobile app closes? I used localStorage (html5) but this data does not get erased when app closes. How could I save data that last until app closes and I can't save it to variable because I use a lot of .js files and methods and don't want to pass all this variables with parameters.</p>
javascript jquery
[3, 5]
5,315,498
5,315,499
How to get TD value using jquery
<p>I am trying to get the TD value using Value attribute.... </p> <p>Suppose i have fallowing html mark-up </p> <pre><code>&lt;td nowrap="nowrap" value="FO2180TL" class="colPadding" id="salesOrderNumber1"&gt;bla bla &lt;td&gt; </code></pre> <p>then i tried this- </p> <pre><code>var soNum = $('#salesOrderNumber1').val() </code></pre> <p>Which should return me <code>FO2180TL</code> but it didn't. How Can i get that TD value...<br> Thanks in advance!!!</p>
javascript jquery
[3, 5]
4,602,202
4,602,203
Front end Java, back end C++ , how to join?
<p>Lets give an over-basic example, I have a program which goes through a directory and grabs the list of files in the directory. Assume for argument's sake that this HAS to be done in C++. I then wish to present the list of files using Java Swing? </p> <p>How is this done?</p>
java c++
[1, 6]
2,959,687
2,959,688
jQuery.parseJSON single quote vs double quote
<p>What actually the difference between this?</p> <p>This works fine:</p> <pre><code>var obj1 = jQuery.parseJSON('{"orderedList": "true"}'); document.write("obj1 "+ obj1.orderedList ); </code></pre> <p>but it does not work:</p> <pre><code>var obj2 = jQuery.parseJSON("{'orderedList': 'true'}"); document.write("obj2 "+ obj2.orderedList ); </code></pre> <p>Why is that?</p>
javascript jquery
[3, 5]
4,274,989
4,274,990
JavaScript - Invoking Methods that Reference this
<p>Not sure what I'm doing wrong here, I just want to be able to have functions of an object reference the object scope</p> <p>myscipt.js</p> <pre><code>function MyFoo () { this.name = 'myname'; } function MyBar () { this.myFoo = new MyFoo(); function setMyFoosName( name ) { this.myFoo.name = name; } } </code></pre> <p>somepage.html</p> <pre><code>&lt;scipt&gt; $('document').ready( function() { $.myBar = new MyBar(); } ... some action ... $.myBar.setMyFoosName( 'new name' ); &lt;/script&gt; </code></pre> <p>this throws an exception:</p> <pre><code>this.myFoo.name = name; this.myFoo is not defined </code></pre>
javascript jquery
[3, 5]
2,130,096
2,130,097
Jquery Find if response contains element
<p>How do you find if the response contains the element form </p> <pre><code> $.ajax({ url : $(this).attr('action'), type : 'POST', success : function(response){ if($(response).find('form').length) { alert("hii"); } } }); </code></pre> <p>Form could be the topmost element of the response or somewhere in middle </p>
javascript jquery
[3, 5]
1,241,615
1,241,616
Wireless Localization
<p>Is there any API that shows signal strength as a parameter? I'm working on a software that does indoor localization using signal strength! I want to know how to retrieve signal strength from wireless adapter driver?</p>
c# java
[0, 1]
1,612,691
1,612,692
javascript setInterval()
<p>I have this code:</p> <pre><code>function noti() { document.title = document.title + " 1" } setInterval("noti()", 1000) </code></pre> <p>The problem is it outputs: </p> <blockquote> <p>My title 1 1 1 1 1 1 1 ..... to infinite.... 1</p> </blockquote> <p>Is there any possible way to output this as "My title 1"</p> <p>the <strong>noti()</strong> function serves as a purpose when everytime an update occurs in the database, <em>whatever is the length gathered from the database</em> it will be outputed into the users <strong>title bar</strong>. </p> <blockquote> <p>So, "My title 1", where "My title" is the name of the user and "1" the length coming from the database</p> </blockquote>
javascript jquery
[3, 5]
2,422,303
2,422,304
jQuery .load() not working when called from loaded content
<p>My primary navigation [Our Clients, Our Culture, Our People] uses .load() to pull the content and display it in a div on the same page w/o refresh.</p> <p>I would like for links within the new content to do the same, just display whatever content is being referenced in this same div. However, when they're clicked it goes directly to the new page.</p> <pre><code>$(function(){ $("a.aboutContent").click(function (e) { e.preventDefault(); $("#aboutContainer").load($(this).attr("href")); }); }); </code></pre> <p>So, when <code>&lt;a href="ourpeople.htm" class="aboutContent"&gt;Our People&lt;/a&gt;</code> is clicked, it pulls ourpeople.htm in to the #aboutContainer div. If you click on a link inside of ourpeople.htm, I'd simply like for that content to display in the same #aboutContainer div. I'm assigning the aboutContent class to links in the subpages as well, but it still isn't working.</p>
javascript jquery
[3, 5]
3,337,056
3,337,057
what is the best practice of binding jQuery click event to each anchor tag on every row of a table
<p>There is a grid (just html table) that lists users and you can delete a specific user by clicking on delete link. The usual way I do is </p> <pre><code>&lt;% foreach (var user in Model.Users) {%&gt; &lt;tr &gt; &lt;td align="right"&gt;&lt;%= user.Name %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= user.Level %&gt;&lt;/td&gt; &lt;td align="center"&gt; &lt;a href="#" onclick="return deleteUser('&lt;%= user.Name %&gt;');"&gt; &lt;%= Html.Image("trash.gif") %&gt; &lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;% )%&gt; </code></pre> <p>but I want to attach click event to the link in a non-obtrusive way. I mean, I do not want to specify javascript method inside the tag. I am not sure what is the best way to achieve it with jQuery, binding multiple multiple anchor tags with parameter passing.</p>
javascript jquery
[3, 5]
2,486,420
2,486,421
making gridview rows bold
<p>I want to bold all the rows of the gridview on the click event of the button in javascript so for e,g I have this button</p> <pre><code>&lt;asp:button runat="server" text="Test" onclientClick="makerowsBold();"/&gt; </code></pre> <p>.</p>
javascript asp.net
[3, 9]
1,246,994
1,246,995
How to store name-value pairs in asp.net profile
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1277656/store-a-generic-dictionary-in-an-asp-net-profile">Store a generic dictionary in an asp.net profile?</a> </p> </blockquote> <p>I want to save name-value pairs in a asp.net profile, how can i do this?</p>
c# asp.net
[0, 9]
4,377,299
4,377,300
javascript parseInt when value = 0
<p>I'm using jquery.grep to clean a string and return only digits.</p> <p>This is what I have:</p> <pre><code>var TheInputArray = TheInput.slice(); var TheCleanInput = jQuery.grep(TheInputArray, function (a) { return parseInt(a, 10); }); </code></pre> <p>I take a string, split it into an array and use the parseInt function to check if it's a number. The problem is that when the value of a is 0, it skips that element. What changes do I need to do to make this code work?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
934,944
934,945
CheckBox [Entering the index to database]
<p>Add a check box to the form and then how to insert respective value 1 if checked else 0 to the database where I have a field which is of type integer. </p>
c# asp.net
[0, 9]
388,176
388,177
Jquery increase/decrease number in input text by up/down arrows keyboard
<p>I have a basic quantity field and would like to allow the user to increase/decrease the number within this input box based on the keyboard up/down.</p> <p>Following on from: EndangeredMassa answer on keyboard code <a href="http://stackoverflow.com/a/375426/560287">http://stackoverflow.com/a/375426/560287</a> how would I add this into a keyup function?</p> <pre><code>var keynum = 0; if(window.event) { keynum = e.keyCode; } // IE (sucks) else if(e.which) { keynum = e.which; } // Netscape/Firefox/Opera if(keynum == 38) { // up //Move selection up } if(keynum == 27) { // down //Move selection down } </code></pre>
javascript jquery
[3, 5]
4,822,709
4,822,710
HTMLPurify - Disable Javascript
<p>I use HTMLPurify for disabling JavasSript in a textarea.</p> <p>My problem is: </p> <pre><code>$config = HTMLPurifier_Config::createDefault(); $purifier = new HTMLPurifier(); $va = $purifier-&gt;purify($va); </code></pre> <p>This removes script tags, but does not remove <code>[a href='javascript:...']link[/a]</code></p> <p>What should I do to remove the bad links and retain good links?</p>
php javascript
[2, 3]
1,025,843
1,025,844
Java/Android: Reading/writing a byte array over a socket
<p>I have an Android application where I'm trying to send a picture to a server. I did this using Base64 encoding and it worked quite well, but it took too much memory (and time) to encode the picture before sending it.</p> <p>I'm trying to strip the Android application down to where it just simply sends the byte array and doesn't fiddle around with any kind of encoding scheme so it'll save as much memory and CPU cycles as possible.</p> <p>This is what I would like the Android code to look like:</p> <pre><code>public String sendPicture(byte[] picture, String address) { try { Socket clientSocket = new Socket(address, 8000); OutputStream out = clientSocket.getOutputStream(); BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); out.write(picture); return in.readLine(); } catch(IOException ioe) { Log.v("test", ioe.getMessage()); } return " "; } </code></pre> <p>The server is written in Java. How do I write the server code so I can properly retrieve the exact same byte array? My goal is to save as many CPU cycles on the Android as possible.</p> <p>So far, all the methods I've tried resulted in corrupt data or a thrown exception.</p> <p>Any help will be appreciated.</p>
java android
[1, 4]
1,795,874
1,795,875
How to load image from a website in android?
<p><a href="http://www.bestandroidblog.com/android-phones/which-android-phone-will-take-the-title-of-the-best-android-phone-of-2012/" rel="nofollow">This</a> site contains more than one image. But in a webview I just want to load any one of these images. How to do it?</p>
java android
[1, 4]
3,552,621
3,552,622
Are extra $(...) calls bad?
<p>If I have code that pulls down a jQuery object, and then makes some further calls on it</p> <pre><code>$("a.postSyncLink").click(function () { var resultsTarget = $("span", $(link).parent().next()); resultsTarget.html("&lt;img style='position: absolute;' src='" + waitImgUrl + "'/&gt;&lt;span&gt;Sync in progress&lt;/span&gt;"); $.get($(this).attr("data-url"), function (returnVal) { resultsTarget.text(returnVal); }); }); </code></pre> <p>Is it considered bad practice to subsequently (and unnecessarily) wrap that object in the jQuery function? Does jQuery optimize superfluous calls like this?</p> <pre><code>$("a.postSyncLink").click(function () { var resultsTarget = $("span", $(link).parent().next()); $(resultsTarget).html("&lt;img style='position: absolute;' src='" + waitImgUrl + "'/&gt;&lt;span&gt;Sync in progress&lt;/span&gt;"); $.get($(this).attr("data-url"), function (returnVal) { $(resultsTarget).text(returnVal); }); }); </code></pre>
javascript jquery
[3, 5]
158,100
158,101
jQuery $.removeAttr("selected") changes selected option
<p>Please take a look at the example: <a href="http://jsfiddle.net/HHDpK/1/">http://jsfiddle.net/HHDpK/1/</a></p> <p>As you see the difference between two choosers is only the line</p> <pre><code>$("#chooser-1 .y").removeAttr("selected"); </code></pre> <p>But as a result their states are different (especially in Chrome). Am I missing anything, or it is a bug?</p>
javascript jquery
[3, 5]
3,538,773
3,538,774
jquery dropdown selector AutoPostback
<p>In jQuery is there any way to distinguish between postbacking dropdowns and non-postbacking ones(ASP.NET 3.5):</p> <pre><code>$('select').change(function(e) { //something like this if ($(this).attr('AutoPostback') == true) { //do something here } else { //do something else } </code></pre> <p>Think have to call server side function from script here to determine AutoPostback.</p>
asp.net jquery
[9, 5]
1,594,736
1,594,737
configuration settings in asp.net
<p>We have a static html/webform site, the site lacks search functionality, I was able to get yahoo BOSS (Build your Own Search Service) after a few hours yesterday, i got it working (still working on adding missing features like pagination) , I was wondering about the configuration options of the class, as I have a BossSearch.cs in App_Code, with some fields that are set at the top:</p> <pre><code>public class BossSearch { String sResultsPage = "~/searchResults.aspx"; String sSearchString=""; String sApiKey = ConfigurationSettings.AppSettings["BossApiKey"]; String sSite = "www.oursite.com"; //without http:// String sQuery = "http://boss.yahooapis.com/ysearch/web/v1/{0}%20+site:{1}?appid={2}&amp;format=xml&amp;start={3}&amp;count={4}"; String sStart = "0"; Uri address; WebProxy webproxy = new WebProxy("http://192.168.4.8:8080"); bool bUseProxy = true; int nResultsPerPage = 10; int nTotalResults = 0; ... </code></pre> <p>As you can see, i get the BossApiKey from the web.config file, but all others I have them in the declared in the class, should I put all of them in the web.config file? if I'm thinking of reusing the class (should i say class library?) in other websites as well? can I turn it into a dll and what would the advantages be? i read somewhere that a dll has its own config file, is this the way to store those settings? </p> <p>Apologies for my ignorance, since I'm not that familiar with developing applications (still studying)</p>
c# asp.net
[0, 9]
3,478,376
3,478,377
File.isFile() returns false while trying to create a file in android from local drive
<p>I tried creating a pdf file into my device out of a file in my local drive. But File.isFile() method returns false.It returns true if i compile the program as a simple java file. Is tht android would not locate a file in the local by reading the path or I/o operations in android are totally different to java i/o.How to make android recognise the file in the path mentioned. Any suggestions? </p> <pre><code>String path = "D:\\priya_Docs\\Android pdfs\\Professional_Android_Application_Development.pdf"; File file = new File(path); System.out.println("Located a file " + file.isFile()); String filesArray = file.getPath(); File getFile = file.getAbsoluteFile(); FileInputStream fis = new FileInputStream(getFile); FileOutputStream fos = (FileOutputStream) openFileOutput( "Androiddoc.pdf", Context.MODE_PRIVATE); System.out.println("File Created"); byte[] buff = new byte[1024]; int len; while ((len = fis.read(buff)) &gt;= 0) { fos.write(buff, 0, len); } fis.close(); fos.close(); </code></pre>
java android
[1, 4]
3,392,274
3,392,275
can't access variable in another function inside object literal
<p>I have following code of <code>javascript</code></p> <pre><code>var Obj = { init: function () { this.over = $('&lt;div /&gt;').addClass('over'); $('body').append(this.over); $('.click').on('click', this.show); }, show: function () { console.log(this.over); } } Obj.init(); </code></pre> <p>When this does is when user clicks a <code>.click</code> link then it triggers <code>show</code> function and logs out the dom element created in <code>init</code> function. <strong>But the problem is then it logs out undefined. Why?</strong> How to solve it?</p>
javascript jquery
[3, 5]
2,581,762
2,581,763
What is a better way to write this Javascript hover function?
<p>This works but of course is a bit redundant. Items can also be dynamically added so I need to have it always increment by one. What is a better way to write this into one function?</p> <p>Update: Just added the markup. Bascially when a user hovers any of the list item a classname should be attached to the banner div. e.g., banner_0, banner_1, etc.</p> <pre><code>&lt;ul id="list"&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item5&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item6&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" data=""&gt;item7&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="banner" class=""&gt;&lt;/div&gt; $('#list a').eq(0).hover( function() { $('#banner').addClass('banner_0'); }, function() { $('#banner').removeClass(); } ); $('#list a').eq(1).hover( function() { $('#banner').addClass('banner_1'); }, function() { $('#banner').removeClass(); } ); $('#list a').eq(2).hover( function() { $('#banner').addClass('banner_2'); }, function() { $('#banner').removeClass(); } ); $('#list a').eq(3).hover( function() { $('#banner').addClass('banner_3'); }, function() { $('#banner').removeClass(); } ); </code></pre>
javascript jquery
[3, 5]
105,124
105,125
How do I populate second textbox based on the value entered in first textbox using jquery?
<p>I am trying to populate the text fields based on the value entered in the first textbox field from the database but I am not getting any response when I enter some value into the first textbox field. Please check the code</p> <p>Javascript:</p> <pre><code> &lt;script type="text/javascript"&gt; $("#tin").blur(function () { $.post("tin_handle.php", { tin: $(this).val() }, function (data){ $("#cname").val(data.cname); $("#caddress").val(data.caddress); }); &lt;/script&gt; </code></pre> <p>Tin_handle.php:</p> <pre><code>&lt;?php $tn = trim($_POST['tin']); require_once("sqlconnect.php"); $q="SELECT CONCAT(address,',',city,',',state) AS caddress,cname,tin FROM company WHERE tin=$tn; $r = @mysqli_query ($dbc, $q); //$arr=array(); while ($row = mysql_fetch_array($r)) { $arr=array('cname'=&gt;$cname, 'caddress'=&gt;$caddress); echo json_encode($arr); } ?&gt; </code></pre>
php jquery
[2, 5]
5,532,902
5,532,903
I have a website that whenever I debug it the browser gives me and error.
<p>I have no idea what is causing this error, if you need to see my code just let me know, its a MasterPage.master that is attached to my default.aspx. </p> <p>This is the error I get in the browser:</p> <pre><code>Server Error in '/WebSite1' Application. -------------------------------------------------------------------------------- Content controls have to be top-level controls in a content page or a nested master page that references a master page. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): Content controls have to be top-level controls in a content page or a nested master page that references a master page.] System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8690104 System.Web.UI.Page.get_Master() +51 System.Web.UI.Page.ApplyMasterPage() +15 System.Web.UI.Page.PerformPreInit() +45 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456 </code></pre>
c# asp.net
[0, 9]
1,730,863
1,730,864
what is the easiest way to retain values of fields while switching from page to page
<p>I am using Multiview. And I am switching between views. Each view contains lots of fields. I am going to another view from the current view to add some data. And after adding data from the new view, I am returning to the previous view. Now on this view I want to populate fields which I have entered before switching. Currently I am using ViewState to retain previous values. But this costs lot as there are lots of fields on a single view. Is there any other way to do this task?</p>
c# asp.net
[0, 9]
2,870,042
2,870,043
List of deltas between ASP.NET 2.0 and ASP.NET 3.5
<p>Is there a source for quickly getting up to speed with the general, programming deltas between ASP.NET 1.1/2.0 and ASP.NET 3.5? For example, I understand that cookies are no longer encouraged and you should use properties??? </p> <p>Is there a list out there somewhere?</p>
c# asp.net
[0, 9]
2,832,424
2,832,425
TimelineJS start_zoom_adjust
<p>I am trying to implement this and i'm pretty much done besides content but I want to adjust the start zoom but everywhere I try adding it, it doesn't work. example of what I tried is below.</p> <pre><code>&lt;div id="timeline"&gt; &lt;!-- Timeline.js will be placed here --&gt; &lt;/div&gt; &lt;script src="http://code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script src="assets/js/timeline-min.js"&gt;&lt;/script&gt; &lt;script src="assets/js/script.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var timeline_config = { start_zoom_adjust: '-10' } &lt;/script&gt; </code></pre> <p>I also tried adding it to the script.js but that didn't work either...</p> <pre><code>$(function(){ var timeline = new VMM.Timeline(); timeline.init("data.json"); var timeline_config = { start_zoom_adjust: '10' } }); </code></pre> <p>Can anyone help? I'm ready to be done with this project.</p>
javascript jquery
[3, 5]
2,314,868
2,314,869
tool to identify words and sentences with similar meaning
<p>how do I create and program a tool to identify words and sentences with similar meaning in 2 files/docs eg:today is sunny and what an eventful and sunny day.</p> <p>any tools already available??</p>
c# javascript
[0, 3]
1,305,533
1,305,534
Realize Countdown using PHP and JavaScript
<p>I want to write a countdown, which get the time from a server (php) and then counts down on the client side (JavaScript). Unfortunately I have only a few experience with JavaScript or JQuery. At this time the script looks like this:</p> <pre><code>&lt;?php $endTime = mktime(00, 00, 00, 01, 01, 2012); $actTime = time(); $difTime = $endTime - $actTime; $seconds = $difTime; ?&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ window.setInterval(function() { var seconds = $('div#timer').html(); var updateTime = eval(seconds)- eval(1); $('div#timer').html(updateTime); }, 1000); }); &lt;/script&gt; &lt;div id="timer"&gt;&lt;?php echo $seconds ?&gt;&lt;/div&gt; </code></pre> <p></p> <p>Now I want to convert the remaining seconds into days, months, minutes and seconds. However, I do not really know how I should realize that with the function setInterval. Can anyone help me? Maybe there are better ways as working with the UNIX-Timestamp? </p> <p>Thank you in advance!</p> <p>Martin</p>
php javascript jquery
[2, 3, 5]
2,172,035
2,172,036
declaring a variable blocks my code
<p>is something wrong here? declaring those variables stops the execution of my code :(</p> <pre><code>var color = $('fieldset input[type=checkbox]').data("color"); if(color === orange){var bgy = '-1'} else{var bgy = '-37'}; </code></pre> <p>If you need more info please ask me :)</p>
javascript jquery
[3, 5]
1,584,282
1,584,283
jquery.AutoComplete.js adaptive width
<p>If <code>row[0]</code> is too long, the width of the yellow part does not adapt.</p> <p>How can I solve this?</p> <p><img src="http://i.stack.imgur.com/fGzuh.jpg" alt="enter image description here"></p> <pre><code> $(document).ready(function () { var b = $("#&lt;%=TextBox1.ClientID %&gt;").val(); $("#&lt;%=txtSearch.ClientID%&gt;").autocomplete('Search_CS.ashx?id=' + b, { max:10, formatItem: formatItem, // width:300 width: $("#p0").width() + $("#s0").width() } ); }); function formatItem(row) { return " &lt;p id=\"p0\"&gt;"+row[0] +" &lt;/p&gt;"+ " &lt;span id=\"s0\"&gt;about&amp;nbsp;13456Items&lt;/span&gt;"; } </code></pre> <p></p> <p>tks in advance!</p>
javascript jquery
[3, 5]
1,384,691
1,384,692
convert number from 12 to 12.00
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5648205/in-php-how-to-print-a-number-with-2-decimals-but-only-if-there-are-decimals-al">In PHP, how to print a number with 2 decimals, but only if there are decimals already?</a> </p> </blockquote> <p>Brothers I want to convert me any way I entered into a text field automatically turns 12 to 12.00</p> <p>How possible work by php and javascript</p> <p>Thanks</p>
php javascript
[2, 3]
876,565
876,566
JS library that has the the ability to serialize/re-hydrate elements state
<p>I am looking for a component/framework that has the the ability to serialize/re-hydrate the elements, or UI components upon the next page view. Something analogous to <code>$.serialize()</code> but for an element's properties (examples: visibility,width, top, left ).</p> <p>All the functionality in jQuery is there to do this manually, but I am looking for a framework that has explored the problems/pitfalls of this functionality better than I have to date.</p> <p>Server side I am using asp.net, but it is really the client-side functionality that I am looking for. I expect the actual state to be persisted in a cookie, or more persistent manner on the server.</p> <p>I realize the functionality I am looking for is implemented in web parts. I am hoping get a light-weight framework to work with. I am not too excited about investing in web parts.</p> <p>An example of what I am trying to achieve: I would like to create a page with 5 to 10 divs, laid out in a grid-live fashion. A dashboard-like UI. there is a default layout, but users can hide some areas &amp; expand others to get the best view of the data that they care about. Aside from just divs, There may be other widgets: tabs, accordions, ect. They do not need to be, but lets assume the UI is powered by jQuery UI. The next time the user logs in, I should be able to restore the state of the page by the user.</p> <p>Before I begin working on a custom functionality, I want to make sure that I am not re-building a wheel.</p>
javascript asp.net
[3, 9]
2,256,448
2,256,449
javascript unexpected token COOKIE
<p>so i have this problem, i'm using a index.inc.php file to set a cookie and this is a must.</p> <p>The problem of setting a cookie with server-side language is that it will not take effect on the first load. The javascript is on the template file index.tpl (Using XTemplate), the COOKIE2 and COOKIE3 are values defined on the PHP, they are cookie values, but on the first load, always empty.</p> <pre><code>var ligarei = getCookie('ligarei'); if(ligarei != "nao"){ var cookie2 = {COOKIE2}; var cookie3 = {COOKIE3}; var timeout = cookie3 - cookie2; var timeout2 = 60 - timeout; $(document).ready(function() { if(timeout &gt; 60){ popthat(); } else if(timeout &lt; 60){ setTimeout("popthat()", timeout2 * 1000); } }); } </code></pre> <p>The first getCookie function is ok, it doesn't matter if it's empty or null, but the problem is on the var cookie2 and cookie3, the result after compiled is:</p> <pre><code>var cookie = ; </code></pre> <p>And this is giving me a unexpected token error .</p> <p>Any hints on how to solve this?</p> <p>Thanks very much.</p>
php javascript jquery
[2, 3, 5]
2,105,713
2,105,714
javascript check if text anchor text inside a link overflows
<p>Is it possible to check if the anchor text overflows when i have this css/html ?</p> <pre><code>&lt;a href="#" style"overflow:hidden; width:100px; display:block;&gt; This is a very long text. This is a very long text. This is a very long text. &lt;/a&gt; </code></pre> <p>i use Jquery or pure javascript</p>
javascript jquery
[3, 5]
2,183,206
2,183,207
Keeping the correct style classes
<p>In my drag and drop game there is a grid that is populated with words that are hidden from the user. The aim of the game is to spell these words with the aid of a sound and a picture. The user spells a word by dragging and dropping the relevant letters onto the grid. If the letter is correct it will glow green with the class "wordglow3". If it is wrong it will glow red with "wordglow". At the moment I am having a problem because if I drop the correct letter on a word it glows red when it should glow green. It is weird because everything else works like it should after this happens, but I cannot find the source of the problem. Can anyone help?</p> <p>Here is the script that applies the classes accordingly...</p> <pre><code> drop: function(event, ui) { that = $('.spellword')[guesses[word].length]; word = $(that).data('word'); guesses[word].push($(ui.draggable).attr('data-letter')); if ($(that).text() == $(ui.draggable).text().trim()) { $(that).addClass('wordglow3').css('color', 'white'); $(".minibutton").hide(); $('.next').hide(); } else { $(that).addClass('wordglow'); $('.drag').css("color", "white"); $(".minibutton").hide(); $('.next').hide(); } </code></pre> <p>Fiddle to help - <a href="http://jsfiddle.net/smilburn/Dxxmh/57/" rel="nofollow">http://jsfiddle.net/smilburn/Dxxmh/57/</a></p>
javascript jquery
[3, 5]
1,321,322
1,321,323
Gridview How to catch unique constraint value error in a control
<p>I have a gridview and sqldatasource to bind data from datatable to the gridview .</p> <p>When I'm updating a value from a cell with a new one , and the value already exists in other cell of the gridview , I will get contraint error for unique value in a new page and it looks really bad for user.</p> <p>How can I catch that error and display in a label another text to warn the user the value already exists? </p> <p>So , I'm not adding something to gridview from an event and there's nothing I can catch. I need to make a general rule or something and I don't know how.</p> <p>I've tried this but it didn't worked , is not showing up .</p> <pre><code>protected void GridViewUpdateEventHandler(Object sender, GridViewUpdatedEventArgs e) { if(e.Exception!=null) { lblForError.Text="Value already exists"; //etc } } </code></pre> <p>Thanks</p>
c# asp.net
[0, 9]
2,502,478
2,502,479
Adding classes to list items based on theirs child's ID's
<p>I was wondering how to achieve something like this using jQuery:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#id-220" class="id-220 id-320 id-321 id-322"&gt;Nunc tincidunt&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-320" class="id-320 id-321 id-322"&gt;Proin dolor&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-321" class="id-321 id-322"&gt;Aenean lacinia&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-322" class="id-322"&gt;Aenean lacinia&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>If I have only this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#id-220"&gt;Nunc tincidunt&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-320"&gt;Proin dolor&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-321"&gt;Aenean lacinia&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#id-322"&gt;Aenean lacinia&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So, basically I want that each list item is looking for its sibling's ID and add them by order as class. First list item has 3 siblings, and by that it must have 4 classes (his own and 3 from siblings) and so on ... I hope that I explained it well... TNX!</p>
javascript jquery
[3, 5]
5,325,675
5,325,676
Creating a callback handler to handle multiple callbacks in Android
<p>I have an Android application that interfaces 3rd party hardware through a vendor-supplied library. When data from the hardware is ready to be processed, the library calls back to my application.</p> <p>The 3rd party library, due to it's design, only makes one callback to the application. However, my app has a few different asynchronous tasks that it would like to do when the callback is called (for example, logging, update the UI display, call external programs). Trying to fan out the event, in a way, to different methods. So, I'm thinking about doing this in my Application class:</p> <pre><code>interface MyCallback { public void doSomething(ArrayList&lt;DataClass&gt;); } public class MyApp extends Application { ... private MyCallback cb; public void registerCallback (MyCallback callback) { cb = callback; } public methodCalledBy3rdPartyAPIOnData (ArrayList&lt;DataClass&gt; data){ cb.doSomething(ArrayList&lt;DataClass&gt; data); } </code></pre> <p>which would work for a single method to call, but I'm having an issue on how to do this for a series of callbacks...and making sure they get called asynchronously. Are there any examples or best practices for doing this sort of thing in an Android application, or in Java in general?</p>
java android
[1, 4]
1,298,081
1,298,082
Make a container div disabled
<p>I have a HUGE dynamic form with lots of fields. If one of the parameters is missing I should make all fields disabled (read not clickable). I was wondering if I can instead make the container div disabled using jQuery/JavaScript?</p>
javascript jquery
[3, 5]
3,619,846
3,619,847
Where's the "new" keyword? Android Tutorial Woes
<p>While working my way through the Android tutorials, I came across something I don't understand. It's probably extremely simple, but I just need an idea why it's this way.</p> <p>In the tutorial: <a href="http://developer.android.com/resources/tutorials/views/hello-autocomplete.html" rel="nofollow">http://developer.android.com/resources/tutorials/views/hello-autocomplete.html</a></p> <p>The tutorial seems to construct a new AutoCompleteTextView using:</p> <pre><code>AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autocomplete_country); </code></pre> <p>I assume their using the constructor:</p> <pre><code>AutoCompleteTextView(Context context, AttributeSet attrs) </code></pre> <p>I think their AttributeSet is the "<code>findViewById(R.id.autocomplete_country)</code>"; while their context is the <code>(AutoCompleteTextView)</code>. Is this right?</p> <p>Also... where's the new keyword, the comma, and why is there a pair of parenthesis?</p> <p>I always thought it'd have to be:</p> <pre><code>AutoCompleteTextView textview = new AutoCompleteTextView(context here, attrs here); </code></pre> <p>Where am I going wrong?! </p>
java android
[1, 4]
5,356,425
5,356,426
How can I manage the maximum number of participants?
<p>I'm using php and mysql. I created a registration form for some activities of an event. For example, for the activity A, the user must choose the hour: 9h, 11h, 14h... The user choose only one option. (select boxes). This form contains 2 activities, so for each activity and for each hour I have a maximum number of participants to manage. </p> <p>I would like to include a maximum number of participants for each option. 9h: 30 participants, etc. So if a user choose for example 9h and the maximum number of participants is already reached, it should display a message to the user when he selects the box 9h.. If this is not the case, the registration should be accepted and the number of attendee incremented. I would like to know how can I do this? Is there a simple way to manage this?</p>
php javascript jquery
[2, 3, 5]
3,604,899
3,604,900
Error in asp.net c# code
<p>I have the following code, this code was recommended to me by stackoverflow user on my previous post, its throwing some error</p> <pre><code>protected void Button2_Click(object sender, EventArgs e) { String a = DropDownList1.SelectedItem.Value; String b = DropDownList3.SelectedItem.Value.PadLeft(3, '0'); String c = TextBox2.Text.PadLeft(5,'0').ToString(); String d = TextBox3.Text.ToString(); String digit = a+ b + c + d; string sql = "select * from testcase.main where reg_no =?"; try { using (OdbcConnection myConn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=testcase;User=root;Password=root;Option=3;"), OdbcCommand cmd = new OdbcCommand(sql, myConn)) { myConn.Open(); //** cmd.Parameters.AddWithValue("?", digit); using (odbcReader MyReader = cmd.ExecuteReader()) { //** while (MyReader.Read()) { String f = MyReader["pet_name"].ToString(); String g = MyReader["res_name"].ToString(); Label9.Visible = true; Label9.Text = f; Label10.Visible = true; Label10.Text = "VS"; //Label11.Visible = true; Label11.Text = g; } } } } catch (Exception e1) { Response.Write(e1.ToString()); } } </code></pre> <p><strong>the error is:</strong></p> <pre><code>Error 1 Cannot use more than one type in a for, using, fixed, or declaration statement </code></pre> <p>How can i resolve this error??what is the problem in declaration?</p>
c# asp.net
[0, 9]
3,378,981
3,378,982
How to set input type="number" on dynamic textbox in c# codebehind
<p>I have a dynamically created textbox in a c#/asp.net web page that I want to adapt to mobile browsers. </p> <blockquote> <p>TextBox qtybox = new TextBox();<br> qtybox.ID="qtybox";<br> qtybox.Text = "0";<br> qtybox.Width = 30;<br> container.Controls.Add(qtybox);</p> </blockquote> <p>I see that on a I can set this in HTML, if it were a straight HTML form:</p> <blockquote> <p>&lt; input type = "number" ></p> </blockquote> <p>in order to bring up the numeric keyboard. </p> <p>How can I do this with my dynamic textbox in codebehind, or can I? Is there an alternate way to put a numeric input control on my page dynamically in codebehind that would work better? Do I need to use Javascript to "hack" the control after it renders? (I'd rather have a .NET way of doing it if possible.)<br> Thanks</p>
c# asp.net
[0, 9]