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
3,417,861
3,417,862
.focus() Jquery one event only being run
<p>Hi I have this simple method which gets triggered when i click inside a textbox.</p> <pre><code>&lt;script type="text/javascript"&gt; function pageLoad() { $('input:text').focus(function () { $('.txt-error-message-icon-email').fadeOut("slow"); $('input:text').removeClass('txt-error-message'); }); } </code></pre> <p></p> <p>Basically the .focus event is supposed to fade out a div and remove a class when i click inside the textbox. This is working however when i click the textbox only the div fades then when i click out of the textbox and click it again the css class is removed. Why are these two events not happening on one .focus event?</p>
javascript jquery
[3, 5]
5,976,597
5,976,598
Download file in javascript is not working in Chrome
<p>below is the code</p> <pre><code>function ExportToExcel() { if ($("#dateRange").val() != "") { var frm = $("#frmProjectReport").serialize(); var url = "/Reports/ProjectExcelReport?" + frm; Download(url); } } function Download(url) { alert(url); //var win = window.open(url, "DownloadWin", "resizable=0,status=0,toolbar=0,width=600px,height=300px"); var win = window.open(url, "DownloadWin", "width=600px,height=300px,scrollbars=yes ,menubar=no,location=no,left=0,top=0") win.focus(); win.moveTo(100, 100); } </code></pre> <p>its working in all browser except chrome.</p> <p>I have used frame also as below code but it does't work in case of huge data..</p> <pre><code> function Download(url) { try { $("#fileIframe").html(""); var iframe = $('&lt;iframe name="postframe" id="postframe" class="hidden" frameBorder="0" src="about:none" /&gt;'); $('#fileIframe').append(iframe); $('#frmProjectReport').attr("action", url); $('#frmProjectReport').attr("method", "post") $('#frmProjectReport').attr("target", "postframe") $('#frmProjectReport').submit(); //win = window.open(url, "DownloadWin", "width=600px,height=300px,scrollbars=yes ,menubar=no,location=no,left=0,top=0") //win.focus(); //win.moveTo(100, 100); } catch (e) { alert(e) } } </code></pre>
javascript jquery
[3, 5]
1,723,874
1,723,875
calling a method from the page
<p>I have to discriminate some page elements (image, css, ...) on the base of what a user choose at the first page.</p> <p>I use <code>&lt;%=Expression%&gt;</code> like this:</p> <pre><code>&lt;img id="imgBackground" src='&lt;%= this.GetLinkBasedOnUser("img/background1.jpg") %&gt;' /&gt; </code></pre> <p>The method GetLinkBasedOnUser do a simple string concatenation. I like this way because I'm try to keep the "user interface" separate from the code.</p> <p>BUT...</p> <pre><code>&lt;link href="&lt;%= this.GetLinkBasedOnUser('css/cssStyle1.css') %&gt;" rel="stylesheet" type="text/css" /&gt; </code></pre>
c# asp.net
[0, 9]
5,645,197
5,645,198
Any php code to make embed code of video?
<p>I Want a php code to turn a youtube/dailymotion/vimeo/metacafe... URL into an EMBEDABLE code so i can show it using <code>echo</code> , it is really hard to read the API of every website, so i'm wondering if there is a class or code to do this.</p> <p>Note: if there isn't anyone, then maybe a jQuery facebox alternative who supports more than youtube.</p> <p>Thanks</p>
php jquery
[2, 5]
5,122,567
5,122,568
C++ Equivalent to a Scanner's .nextFloat() method?
<p>I'm starting to write C++ and I'm trying to read a text file that is formatted like this:</p> <pre><code>32.0 12.43 503.2 3.212 </code></pre> <p>etc.</p> <p>In Java, I could use a <code>Scanner</code> with <code>.nextFloat()</code>, and put the contains into an <code>Array</code>. I am trying to achieve the same thing with C++. How is this done?</p>
java c++
[1, 6]
939,158
939,159
php jquery javascript
<p>I'm trying to figure out what to output for a GET script call using JQuery. I'm setting up a PHP service that's going to return a script call - these are my technical constraints as I understand them. Any suggestions? </p> <p>Cheers.</p>
php javascript jquery
[2, 3, 5]
2,453,477
2,453,478
redirect by clicking submit button
<p>I am writing a code in which I need to redirect to the another page to another link by clicking the submit button But there is something wrong Because I am not redirecting to that page.</p> <pre><code>&lt;input id="submit1" type="submit" value="submit" onclick="location.href='hi.php'"&gt; </code></pre>
php javascript
[2, 3]
4,622,197
4,622,198
how to access parent window javascript variable inside child window(pop-up)?
<p>i have html page which has global javascript variable with name custName="scott". i open the pop-up window with window.open. Now if i access the custName inside pop-up window with window.opener.custName ,i get values as undefined. I am not getting how to access parent window javascript variable inside child window(pop-up)?</p>
javascript jquery
[3, 5]
5,264,349
5,264,350
How to page refresh, if $_POST variable exists?
<p>I have some post form. On click submit button, turn to another page. I need refresh page once time, if some $_POST variable exists.</p>
php javascript jquery
[2, 3, 5]
553,126
553,127
Sending querystring variable to new popup window
<p>My JavaScript code is this:</p> <pre><code>var newwindow; function poptastic(url) { newwindow = window.open(url, 'name', 'height=400,width=200'); if (window.focus) { newwindow.focus() } } </code></pre> <p>And my C# code:</p> <pre><code> foreach (GridViewRow row in GvComments.Rows) { Button btnReplay = (Button)row.FindControl("btnReplay"); string url = "javascript:poptastic('Configuration.aspx?id=" + e.CommandArgument + "')"; btnReplay.Attributes.Add("onclick", url); } </code></pre> <p>I think the C# code has problem, because when I use this JavaScript code in a tag it works, but in <code>attribute.add</code> not working.</p>
c# javascript asp.net
[0, 3, 9]
568,105
568,106
Get the number of rows which contain a certain value in one of the columns and display the number in a label
<p>I have a gridview and sqldatasource.</p> <p>I want to display in a label, the number of rows from the gridview which contains a certain value in one of the columns (in the <code>form_load</code> event)</p> <p>I thought about looping through all columns of the gridview but it will take a lot of time for this and maybe there's another way of doing this.</p> <p>Can someone help me finding the "other way"?</p> <p>Thanks,</p>
c# asp.net
[0, 9]
5,628,785
5,628,786
Binding database data to the GridView in ASP.Net
<p>I try to bind database data to the gridview in c# and asp.net. But I couldn't see the datas in the gridview.Rows are added to the gridview but they are empty. When I run that query in SQLServer, it gives the correct result.I didn't add or change any code to the asp part.Should I? I couldn't find where is the problem :( please help..</p> <pre><code>myConnection = WebConfigurationManager.ConnectionStrings["KutuphaneConnectionString"].ConnectionString; connect = new SqlConnection(myConnection); command = new SqlCommand(); connect.Open(); command.Connection = connect; string komut = "SELECT K.ad,K.yazar,K.baskiNo,O.sonTeslimTarihi FROM OduncIslemleri O,Kitap K WHERE O.kullaniciId=" + Session["id"] + " AND O.kitapId = K.id;"; try { SqlCommand sqlCommand = new SqlCommand(); sqlCommand = connect.CreateCommand(); sqlCommand.CommandText = komut; SqlDataAdapter sda = new SqlDataAdapter(sqlCommand.CommandText, connect); SqlCommandBuilder scb = new SqlCommandBuilder(sda); //Create a DataTable to hold the query results. DataTable dTable = new DataTable(); //Fill the DataTable. sda.Fill(dTable); GridView1.DataSource = dTable; GridView1.DataBind(); } catch (SqlException) { //Console.WriteLine(e.StackTrace); } reader.Close(); connect.Close(); </code></pre>
c# asp.net
[0, 9]
3,423,636
3,423,637
jQuery first and last of given character
<p>I'm trying to be able to select the first and last instances of a given character(s) within a span element.</p> <p>e.g.</p> <pre><code>&lt;span class="foo"&gt;hello (this is hello)&lt;/span&gt; </code></pre> <p>I want to be able to find the first bracket and the last bracket within this span and append a class them so the output might be:</p> <pre><code>&lt;span class="foo"&gt;hello &lt;span class="bar"&gt;(this is hello)&lt;/span&gt;&lt;/span&gt; </code></pre> <p>Is this possible? I've looked at <code>first</code> in jQuery but it seems to only work for selecting elements rather than characters.</p>
javascript jquery
[3, 5]
871,561
871,562
reading preference value
<p>i am working on android and trying to read a value from my preference file. but when i run.a message appears in emulator.the <strong>the application has stopped unexpectedly</strong> here is my preference file name pref.and it is inres/xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;CheckBoxPreference android:defaultValue="false" android:key="@string/first"/&gt; &lt;/PreferenceScreen&gt; </code></pre> <p>this is main activity where i am reding the value.</p> <pre><code>package code.finalwork; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.widget.EditText; public class FinalWorkActivity extends Activity { private String pref_file="pref.xml"; EditText text=(EditText) findViewById(R.id.editText1); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SharedPreferences pref=getSharedPreferences(pref_file,Context.MODE_PRIVATE); Boolean val= pref.getBoolean("firstuse", true); if(val) { text.setText("first use"); } else { text.setText("Not first use"); } } } </code></pre> <p>please someone figure out the problem.</p>
java android
[1, 4]
5,240,585
5,240,586
How to modify/recreate Html.fromHtml()?
<p>I am not that good to understand all the possibility of Java, especially if it's not my code.</p> <p>So, <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/text/Html.java#Html.fromHtml%28java.lang.String%29" rel="nofollow">http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/text/Html.java#Html.fromHtml%28java.lang.String%29</a> , is it all I need to modify Html.fromHtml() ?</p> <p>But I don't understand how it's works : Is it a good way to create a new class like Html2 and copy/paste all the code ? When I do that I have some errors that I don't understand :</p> <pre><code>private static class HtmlParser { private static final HTMLSchema schema = new HTMLSchema(); } </code></pre> <p>He tells my Htmlschema cannot be resolved to a type, and to add the class HtmlSchema... but where can i find it ?</p> <p>And this : </p> <pre><code>return XmlUtils.convertValueToInt(color, -1); </code></pre> <blockquote> <p>XmlUtils cannot be resolved.</p> </blockquote> <p>The rest of the errors have been solved with the help of Eclipse</p>
java android
[1, 4]
3,592,070
3,592,071
best way to ajax load-in external javascript files with jquery?
<p>I have a one page web application, which means alot of javascript. External scripts like facebook connect etc most visitors wont use, so i'd like to know the BEST method of loading js files on an event (click, hover, timer etc). Idealy with jquery.</p>
javascript jquery
[3, 5]
1,000,922
1,000,923
Creating new views from array elements, bad practice?
<p>I want to display an array of elements like a list inside a scrollView. It seems like people around here are not happy with putting ListViews inside ScrollViews, so I figured I might try and create my own list. </p> <p>I have some entries (typically not more than 10 entries, entries are around a normal sentence in length) in an array that I want to iterate over, creating a TextView for each entry, so that each entry has it's own TextView. My concern is though that this may be bad practice, or that this kind of operation will simply slow down my application too much. </p> <p>Am I being to concerned with performance here?</p>
java android
[1, 4]
2,813,128
2,813,129
Javascript - How to save exact whitespace count between words from textarea
<p>How to save exact whitespace count between words from textarea when putting it's value into html?</p> <pre><code>&lt;textarea&gt;word "10 whitespaces here" word "20 whitespaces here" word&lt;/textarea&gt; </code></pre> <p>html:</p> <pre><code>&lt;div style="width:50px;overflow:hidden;"&gt;word "10 whitespaces here" word "20 whitespaces here" word&lt;/div&gt; </code></pre> <p>So that all text inside div would be visible.</p>
javascript jquery
[3, 5]
1,678,270
1,678,271
Reference .dll method unable to create folder in web server
<p>I have a reference .dll method which will create folder in SpecialFolder.</p> <p>So in .aspx.cs, i execute this method but it throw me an exception</p> <pre><code>"Access the ..... is denied" </code></pre> <p>However,if i create it in my web application without using the reference to create, it have no problem.</p> <p>Anyone know what's the problem and solution?</p> <p>This is the create directory method definition:</p> <pre><code>string TempPDFPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), Path.Combine("TempPDFStorage", System.Guid.NewGuid().ToString())); if (!Directory.Exists(TempPDFPath)) { Directory.CreateDirectory(TempPDFPath); } </code></pre>
c# asp.net
[0, 9]
3,061,450
3,061,451
How to run jQuery code in the JavaScript onclick function?
<p>Clicking on the "close" <code>anchor</code> does not close the notification.</p> <p>Below is my code: </p> <pre><code>function show_notification_on_top(message, type) { content = "&lt;a class='notify-close' onclick='$(\"#notification-box\").fadeOut(\"slow\");' href='#'&gt;close&lt;/a&gt;"+ "&lt;p&gt;"+message+"&lt;/p&gt;"; $("#notification-box").fadeIn('slow', function() { $("#notification-box").delay(60000).fadeOut('slow'); }); $("#notification-box").html( content ); } </code></pre>
javascript jquery
[3, 5]
660,174
660,175
How to convert 24 hr format time in to 12 hr Format?
<p>In my application i want to convert the given CDT formatted 24 hr string in to CDT formatted 12 hr string, How to convert a given 24 hr format string in to 12 hr format string??</p> <p>Thanks, Ram.</p>
java android
[1, 4]
2,898,447
2,898,448
Getting Java Lang Null pointer exception in Android
<p>I've been coding an android app and i've suddenly started getting an error, the error log says there is Java.Lang.Null.pointer.exception on line 23 of my Game.java yet none of the code concerning that has been changed. Here is the code: Any ideas?</p> <p>Main class</p> <pre><code>public void onClick(View v) { switch (v.getId()) { case R.id.about_button: Intent i = new Intent(this, About.class); startActivity(i); break; case R.id.ext_button: finish(); break; case R.id.new_button: openNewGameDialog(); break; } } private void openNewGameDialog() { new AlertDialog.Builder(this) .setTitle(R.string.diff_head) .setItems(R.array.difficulty, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialoginterface, int i) { startGame(i); } }) .show(); } private void startGame(int i) { Intent intent = new Intent(this, Game.class); intent.putExtra(Game.KEY_DIFFICULTY, i); startActivity(intent); } </code></pre> <p>Game.java</p> <pre><code>public class Game extends Activity { public static final String KEY_DIFFICULTY = "w1279057.CW1.difficulty"; public static final int DIFFICULTY_NOVICE = 0; public static final int DIFFICULTY_EASY = 1; public static final int DIFFICULTY_MEDIUM = 2; public static final int DIFFICULTY_GURU = 3; Random rand = new Random(); line 23 &gt;&gt; int diff = getIntent().getIntExtra(KEY_DIFFICULTY, DIFFICULTY_NOVICE); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); </code></pre>
java android
[1, 4]
2,671,198
2,671,199
A working example of how to use cookie.js
<p>I was wondering if you could help/show me how to use cookie.js for my example I have been stressing trying to figure this out. I must saty in advance that I am new to programming full stop so I I humble and would love a plain example of how to use cookie.js</p> <p>I wish to maintain the same state on my sub menu div after page refresh. I have constructed a jsFiddle to show how the navigation works without a cookie. </p> <p><a href="http://jsfiddle.net/replacement4/nKFt7/60/" rel="nofollow">http://jsfiddle.net/replacement4/nKFt7/60/</a></p> <p>This is my attempt using cookies. </p> <p><a href="http://jsfiddle.net/replacement4/nvf3V/3/" rel="nofollow">http://jsfiddle.net/replacement4/nvf3V/3/</a></p> <p>I hope it is something simple and I've just miss understood... </p>
javascript jquery
[3, 5]
3,421,102
3,421,103
jQuery lazy loading image with throttling?
<p>I've been given a design for a commercial affiliate-related website where the homepage has 2500+ images on it. Two directions I'm thinking about to ease the loading of the images is to utilize a lazy image loading script.</p> <p>I've been messing with the jQuery JAIL (Async Image Loader) script. I have it set so that it loads all the visible images when the page loads. Then after a couple seconds it begins downloading all the rest of the images on the page that are below the fold. This is typically like 2400+ images.</p> <p>The problem is that when the browser is told to download 2400 images it basically freezes up, or at least freezes up the scrollbar until it's done.</p> <p>Are there any jQuery image loading scripts that are similar to the JAIL but that allow for some type of throttling? Anything really to help from freezing up the page.</p> <p>I'm also looking into css sprites but for various technical reasons and time constraints it might not be feasible.</p>
javascript jquery
[3, 5]
1,307,153
1,307,154
how can i make $(document).on('touchstart') function work on ipad?
<p>I'm simply toggling the class when a specific button is clicked, when the user clicks outside document i then want to remove the class. This works fine if I change the event to click and test on desktop but on iPad nothing seems to happen. Can anyone offer any suggestions on how to make this work?</p> <pre><code>$shoppingIcon.on('click', function(e) { var $this = $(this); $this.prev($productInfo).toggleClass('active'); }); $(document).on('touchstart', function() { $productInfo.removeClass('active'); });​ </code></pre>
javascript jquery
[3, 5]
1,238,626
1,238,627
how to make an ajax request after sending data by post?
<p>i meet a problem, when try to make an ajax request after sending data by post.</p> <p>let's assume i have a index.php file. In the form i send data by post to the same file, and after posting i want to make ajax request, but it don't doesn't happen, because it "wants" to ask about resending data, but it doesn't show in popup window.</p> <p>So, how can i disable the question about resending data, to be possible to make an ajax request?</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
5,441,689
5,441,690
How to append html to <head> with jQuery
<p>I am trying to append a Facebook open graph tag (based on dynamically generated content on the page) to the head of my html.</p> <pre><code> $(document).ready(function(){ var stat = $('#random-message').text(); stat = jQuery.trim(stat); //set facebook Open Graph description $('head').append('&lt;meta property="og:description" content="'+stat+'"/&gt;'); }); </code></pre> <p>this by itself is working fine. <a href="http://jsfiddle.net/mrengy/HQMCz/4/" rel="nofollow">js fiddle</a> </p> <p>When I combine it with a dynamically loaded Twitter script (below)</p> <pre><code>$(document).ready(function(){ var stat = $('#random-message').text(); stat = jQuery.trim(stat); //set tweet button data text $('a.twitter-share-button').attr('data-text',stat); //set facebook Open Graph description $('head').append('&lt;meta property="og:description" content="'+stat+'"/&gt;'); //insert twitter API Script - problematic $('#tweet-like').append('&lt;script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;'); }); </code></pre> <p>it chucks a wobbly. <a href="http://jsfiddle.net/mrengy/2jEXp/1/" rel="nofollow">js fiddle</a> In js fiddle, it inserts some special characters into the body, and none of the rest of the script (including inserting the meta tag) is working. Strange because the Twitter script "widgets.js" is working on my page, but the meta tag does not appear.</p>
javascript jquery
[3, 5]
358,784
358,785
text area like FCK editor
<p>I would like to develop a html editor just like FCKeditor, but i dont know how they display the html code in text area like region, Will U pls help me with that? for having that textarea, which prase html codes and displays just like a web page?</p>
php javascript
[2, 3]
5,507,035
5,507,036
type @, show a name list like facebook status box
<p>in facebook status box, if you type '@', then a list of friends' names appear. I am trying to implement such a status box.</p> <p>But the problems are:</p> <p>On typing '@', where should the 'div's location be and how to show the list? I just can't make anything out of it.</p> <p>I went through <a href="http://stackoverflow.com/questions/7497824/how-to-highlight-friends-name-in-facebook-status-update-box-textarea">this</a> question of SOF, but that actually does not discuss that.</p> <p>Anybody there to shed light on it as much as possible?</p> <p>My choice is jquery.</p>
javascript jquery
[3, 5]
2,515,733
2,515,734
Javascript: Glitch with function
<p>I'm currently trying to make the function below work correctly. Recently added the IF ELSE variables to it, and after the my script no longer works. If I remove it of course, everything goes back to normal, minus that feature of course. What am I doing wrong exactly? Thanks in advance!</p> <pre><code>var image3 = $("#image3"); $(function() { $("#ID-OF-LINK-1").click(function() { $("#image1").attr("src","./image1.jpg"); $("#image2").attr("src","./image2.jpg"); if (image3.src != "./image3.jpg"){ ("#image3").attr("src","./image4.jpg"); } else ("#image3").attr("src","./image3.jpg"); } }) }) </code></pre>
javascript jquery
[3, 5]
63,729
63,730
Android - Calling a method in one activity from another, without starting new activity
<p>I'm developing an Android app using GreenDroid. The application is just for testing atm, so it all it contains is an ActionBar with a refresh button, three tabs, and an activity for each of those tabs. </p> <p>All I'm trying to achieve at the minute is showing a toast message when the refresh button is pressed on the ActionBar, but I want the toast message to be called from within one of my activities, we'll call it Listener1Activity which is the activity that sits in the first tab ... this is because Listener1Activity will eventually contain a list that I want to reload when the ActionBar button is pressed, if I can get it working with a simple toast message for now then I can sort out that later. </p> <p>I've looked into intents, broadcasts, but nothing seems to fit.</p> <p>I <em>don't</em> want the activity starting new each time the button is pressed, I just want a method in it to call and show the toast. </p> <p>So basically, it's just like having 2 activities running at the same time, and a button press in one calling a method in the other. Isn't it? Or have I got that wrong?</p> <p>SenderActivity and Listener1Activity. </p> <p>In iOS, I would just send an NSNotification from SenderActivity, and add an observer in Listener1Activity. What would be the best way to achieve this in Android?</p> <p>Thanks!</p> <p>Steven</p>
java android
[1, 4]
1,202,002
1,202,003
Stuck for how to accomplish a task
<p>Here's what I'd like to do: we have a list of members who need to be redirected to a series of forms on URLs. We have around 5 forms and 200members. They would be greeted at a site, enter their First and Last name and then be redirected to the applicable form which we selected for them. Starting from scratch with this so any hints as to process would be hugely appreciated. Thanks in advance! </p>
java php
[1, 2]
4,488,343
4,488,344
facebook or twitter style load more option
<p>I've been trying to create a facebook or twitter like load more option as an alternative for ordinary pagination. I've been trying to create a feature without any external plugins, just using jQuery alone. The load more option works fine minus one feature, that is scrolling the newly appended div element coming to users view.. I will add the codes and a jsfiddle link to show what I am trying to get here.</p> <p><a href="http://jsfiddle.net/xFu3M/11/" rel="nofollow">JSfiddle</a></p> <pre><code>$("#loadMore").on("click", function(e) { e.preventDefault(); var divCollection = number; for (var k = 0; k &lt; 5; k++) { $("#loadMore").before("&lt;div class='subDivs' id='indID1" + number + "'&gt;" + number + "&lt;/div&gt;"); number++; } alert("indID" + parseInt(divCollection)); goToByScroll("indID" + parseInt(divCollection)); // try change to indID4 }); function goToByScroll(id) { var el = $('#' + id); console.log(el); var elOffs = el.offset().top; var parOffs = el.closest('.contentBody').offset().top; $('.contentBody').stop().animate({ scrollTop: elOffs - parOffs }, 100); } </code></pre>
javascript jquery
[3, 5]
5,760,787
5,760,788
Many setTimeouts for scrolling events
<p>I want to show a tooltip when mousewheel scroll even is triggered. Here is the current code:</p> <pre><code>if (window.hideTimeout) { clearTimeout(window.hideTimeout); } handle.qtip('show'); window.hideTimeout = setTimeout(function() { handle.qtip('hide'); }, 1000); </code></pre> <p>This works correctly, however it runs slowly in Firefox when scrolling quickly, presumably because of the many setTimeouts being used. I was wondering if there is a better solution to this? I want the tooltip to hide if there have been no scroll events for a second, essentially.</p> <p>THanks</p>
javascript jquery
[3, 5]
881,697
881,698
How did the guys at DeviantArt implemented the Shadowing in their images?
<p>I just want to know how the guys at <a href="http://browse.deviantart.com/?order=24&amp;offset=24" rel="nofollow">DeviantArt.com</a> implemented the shadowing on each images.</p> <p>If you look at the thumbnails, you'll see that the images are shadowed a bit. I think they done it with Javascript because when I turned off my Javascript the shadows were gone. And they are also using jQuery btw.</p>
javascript jquery
[3, 5]
1,112,184
1,112,185
with jquery round the numbers to downward to nearest integer for all textboxes in page?
<p>In a web page I have many textboxes which from server may have value in int or float format.</p> <p>Requirement is to check values in client side before page load and if any textbox has float or decimal values (for example 1.00 or 1.67) round values to downward to nearest integer in textboxes.</p> <p>Please guide me how to do this. I understand it a little that it will need to be done on page load or document ready event of jquery and will need to use Regex but don't know how to write this syntex. Help me please</p>
javascript jquery asp.net
[3, 5, 9]
4,084,518
4,084,519
AutoComplete Animation
<p>I'm using JQuery for AutoComplete. I'm using onFocus() to start the autocomplete.</p> <p>I am having problems showing the animation for the AutoComplete:</p> <pre><code>var j$ = jQuery.noConflict(); function getAutoCompleteDesignations(){ var availableTags = new Array(); availableTags = {!JSONDesignationString}; $('[id$=tags]').autocomplete({ source: availableTags }); } </code></pre> <p>How can I get the animation to show upon typing in the input box?</p>
javascript jquery
[3, 5]
2,899,301
2,899,302
Quickest way to require authentication in asp.net webform?
<p>As of right now, I have the user register/log in and then if successful, redirect them to the homepage. However, this is extremely artificial as the user can simply type the url and go to any page they want. I'm fairly new to this and I've heard forms authentication mentioned multiple times as a way to do what I need: a simple means to prevent a user from accessing any page and once they haven't done a "Request" in awhile, I want them to be "logged out" and sent back to the log in page. I guess, in the end, I have three questions:</p> <p>1) Can someone provide me a link to a great tutorial on authentication? I don't want to get too far in depth if I can avoid it.</p> <p>2) Also, is it recommended to use cookies for this or not? I've heard different views on this?</p> <p>3) I was told I can set this up in the web.config as well as in code behind? Is this true? If so, which do you recommend?</p> <p>Thank you very much and I apologize for the broad question(s). If you need any more information, please let me know.</p>
c# asp.net
[0, 9]
4,769,296
4,769,297
Hover img fadeIn next or fadeIn first img
<p>I have simplified what I am trying to achieve from my previous question. </p> <p>This is a example of the script I am trying to write: <a href="http://dev.web2works.co.uk/img-hover/" rel="nofollow">example</a> when you hover over the image you can see the problem. Possible fix with a delay?</p> <p>I have a list of product each with 2-5 thumbnail images. I want to create a hover function that cycles through the images hiding/showing the next image.</p> <p>I did try to stack the images using z-index although this was causing too much of a problem. </p> <p>This is the hover function that I have put together so far:</p> <pre><code>$(".image_cycle img").live("hover", function(){ if ($(this).next("img").is(":hidden")) { $(this).next("img").fadeIn("slow",function(){ $(this).siblings("img").hide(); }); } else { $(this).parent().find("img:first").fadeIn("slow",function(){ $(this).siblings().hide(); }); } }); </code></pre>
javascript jquery
[3, 5]
2,685,338
2,685,339
unable to load email attachment from MemoryStream
<p>Not sure why my email attachment comes out empty everytime. While debugging getAttachment(), the size of the contentDisposition of "att" is -1 while "doc" has 280000 bytes. I am pulling my hair out. What am I missing? </p> <pre><code>public Attachment getAttachment(BareBonesDoc doc, string name) { MemoryStream mem = new MemoryStream(doc.DocumentFile); Attachment att = new Attachment(mem, doc.ContentType); switch (doc.ContentType) { case "application/pdf": name += ".pdf"; break; case "application/vnd.ms-excel": name += ".xls"; break; case "application/vnd.openxmlformats-officedocument.wordprocessingml.document": name += ".docx"; break; case "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": name += ".xlsx"; break; case "application/msword": name += ".doc"; break; default: throw new Exception("The " + name + " file is an unsupported content type."); } att.Name = name; return att; } public BareBonesDoc getAwardAgreementAsBareBonesDoc(int termID, int grantAppID, string studentName) { AwardAgreementReport thisReport = new AwardAgreementReport(); thisReport.ReportParameters["termID"].Value = termID; thisReport.ReportParameters["grantAppID"].Value = grantAppID; thisReport.ReportParameters["studentName"].Value = studentName; return getReportAsPdfBareBonesDoc(getReportAsPdfByteArray((Telerik.Reporting.Report)thisReport)); } </code></pre>
c# asp.net
[0, 9]
3,585,930
3,585,931
Custom dialog having mutiple editText and spinners in Android?
<p>I am trying to put custom dialog in buttons on click event, and dialog box having multiple textViews and spinners in Android.</p> <p>How it possible?</p>
java android
[1, 4]
836,037
836,038
New to asp. Problems connecting to database. Not sure about correct method to use
<p>I've been using asp forms for the past week or so. Mostly I've been getting used to gridview and using the site.master to display menus on each page and using the connectionstring in web.config to access my sql server database.</p> <p>But I'm not finding gridview all that versatile and am a little confused as to how this is all supposed to work. I've come from PHP and ASP seems a world different. What I want to do is to loop a table and print out records but i want to use my own loop and not gridview so i can have custom columns as well. so i can create dynamic links with different gets and things like that. In PHP there was syntax to connect to the DB, write the loop and then print the html inside it by echoing or something like that.</p> <p>In aspx I am using C# as my language so am I to understand that i literally write c# code in between &lt;% --code-- %> for this to happen</p> <p>So asp is basically an abiltiy to script using c# or VB</p> <p>Lastly should I write the DB connection in code behinds Page_load or just at the top of the aspx file...</p> <p>Sorry about the newbie question, I would really appreciate being pointed to a suitable tutorial as well which explains all this if anyone can help. I found the w3schools stuff which I usually use to be quite confusing.</p>
c# asp.net
[0, 9]
5,909,801
5,909,802
get params in android and iphone
<pre><code>?IMEI=i&amp;CellId=c&amp;LAC=Local_Area_Controller&amp;NetId=i&amp;ContId=i&amp;Lat=l&amp;Long=l </code></pre> <p>how to get all params above inside titanium application? </p>
javascript iphone android
[3, 8, 4]
2,918,242
2,918,243
import xml to mdb
<p>I'm trying to export a SQL-Server query to an XML file now and I want to import that file to Access. I don't understand how to do this.</p> <p>Here is the code I use to generate the XML: </p> <pre><code>protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SqlSconn"].ConnectionString); con.Open(); string strSQL = "select * from dbo.table_"+test.Text.ToString()+""; SqlDataAdapter dt = new SqlDataAdapter(strSQL, con); DataSet ds = new DataSet(); dt.Fill(ds, "" + test.Text.ToString() + ""); ds.WriteXml(Server.MapPath("temp.xml")); } </code></pre>
c# asp.net
[0, 9]
4,770,395
4,770,396
Is catching a specific exception less expensive than catching a generic one?
<p>Say I'm loading a Bitmap onto my Android device. There are many possible exceptions that can be thrown. For the sake of simplicity let's take <code>NullPointerException</code> and <code>OutOfMemoryError</code>.</p> <p>Now I have two pieces of code.</p> <p><b>Code 1</b></p> <pre><code>try{ //load the bitmap } catch(Exception e) { //do something } </code></pre> <p><b>Code 2</b></p> <pre><code>try{ //load the bitmap catch (NullPointerException e) { //do something } catch(OutOfMemoryError e) { //do something else } </code></pre> <p>Is one piece of code more effective than the other <b>performance</b> wise? If so, why?</p>
java android
[1, 4]
3,823,185
3,823,186
Easy modification on a jQuery url
<p>In the following url I want to include also <code>&amp;id=&lt;?php echo $id; ?&gt;</code> How can I do it?</p> <p><code>url: "loadmore.php?lastid=" + $(".postitem:last").attr("id"),</code></p>
javascript jquery
[3, 5]
235,529
235,530
JQuery Progress Circle + fade page?
<p>Using JQuery how would I make the page dim / fade and display a progress circle in the center which is animated? I'd like to do this when the user fills out a form and clicks submit and is awaiting a response.</p>
javascript jquery
[3, 5]
3,893,970
3,893,971
wait or sleep or something
<p>A numerical time value (not shown here) is available to this method in real time, that could conceivably be used to place a temporary hold on the following stop from being carried out:</p> <pre><code>public void stopRec(){ audioRecord.stop(); try { dos.close(); } catch (IOException e) { e.printStackTrace(); } } </code></pre> <p>Let's say a time forward has commenced and we're now t=0.25 into the ellapsed count. But user is moving to invoke the above <em>now</em>, and I want to prevent that underlying method from transpiring until t>0.5 into the count.</p> <p>It's fine if the user wants to (and does) press the close button, go ahead, and I'll throw a wait message on screen that will say more or less "Fine, stopping...." But the thing won't actually stop until >0.5 occurs behind the scenes.</p> <p>How would a wait statement (I wouldn't imagine a loop would be good because of wasted CPU cycles) be used in the above scenario? Thanks for any help.</p>
java android
[1, 4]
736,704
736,705
C# webbrowser - trigger right click
<p>I'm writing some code on Visual Studio in order to get some information from a web page. Now I need to open the context menu of an html element and I was looking for something like that:</p> <pre><code>webbrowser.Navigate("javascript: document.getElementsByClassName('className')[1].rightclick();void(0);"); </code></pre> <p>but, unfortunately, I noticed that only the click() function exists in Javascript. Is there any workaround?</p> <p>Thank you all!</p>
c# javascript
[0, 3]
5,173,110
5,173,111
Switch Membership Profile to other Profile without password?
<p>I've an application where every user stores his settings with the AspNetSqlProfileProvider in the aspnet_Profiles table. Now I want to give the administrator the possibility to switch to another user to see his settings. But I don't know the windows password of the other user (and I don't want to know it) so I'm not able to use the windows impersonate function, right?</p> <p>So is there any possibility to switch to another user profile without password?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
4,365,790
4,365,791
Getting value in <select>, using JQuery
<p>I need to get a current value of SELECT tag. And for this I'm using <code>$('select').val()</code>, but this return only default value and it's don't changed. May be I can help me?</p> <pre><code>$('div#buy input').fancybox({ ajax : { type : "POST", data : { id: $('input[name="id"]').val(), count: $('#count').val() } } }); &lt;select id="count"&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;option&gt;3&lt;/option&gt; &lt;option&gt;4&lt;/option&gt; &lt;option&gt;5&lt;/option&gt; &lt;/select&gt; </code></pre>
javascript jquery
[3, 5]
955,435
955,436
detecting change in a text input box using jquery/javascript
<p>in html and javascript, I can use keyup, focus, blur to detect most of the content changes in a text input, however if the user do a copy and paste into the text input, how do I capture this change? The issue here is that the input is already in focus when user paste into it.</p>
javascript jquery
[3, 5]
3,186,030
3,186,031
jquery touch slide not images slider
<p>any one knows a cool touch "slider" for jquery mobile app I want to cycl a link-image + text with some effects that wil work fine n PhoneGap, android,Iphone</p>
javascript jquery
[3, 5]
2,907,698
2,907,699
sync and async request java android
<p>I'm using geocoder which makes a sync request. I'm also making an async request to another service on another thread. I need both results inorder to procede to the next step in my android app. What is the proper way to make sure both results are returned before moving on?</p>
java android
[1, 4]
3,704,105
3,704,106
workout with the php returned array to jquery
<p>my this php code is working for the $.ajax call which is below this code</p> <pre><code> $family = mysql_real_escape_string($_REQUEST['send_txt'], $link); $query = "SELECT imgurl FROM images WHERE family='$family'"; //Query database $result = mysql_query($query, $link); //Output result, send back to ajax as var 'response' $imgurl=array(); //$i=0; if(mysql_num_rows($result) &gt; 0){ //Fetch rows while($row = mysql_fetch_array($result)){ $imgurl[]=$row['imgurl']; } } echo $imgurl; </code></pre> <p>jquery code</p> <pre><code>$(document).ready(function() { $('ul.sub_menu a').click(function() { var txt = $(this).text(); $.ajax({ type: "POST", url: "thegamer.php", data:{send_txt: txt}, success: function(data){ $('#main-content').html(data); } }); }); }); </code></pre> <p>it outputs just Array written at the #main-content div how to work with that array which are basically image paths</p>
php jquery
[2, 5]
3,694,651
3,694,652
Validation method error
<p>I have the following method to ensure that an entered username does not already exist.</p> <pre><code>protected void checkUsername(object source, ServerValidateEventArgs args) { string connString = "Data Source=server;Initial Catalog=database;User Id=username;Password=password;"; string cmdText = "SELECT COUNT(*) FROM igs_users WHERE username = @username"; using(SqlConnection conn = new SqlConnection(connString)) { conn.Open(); using(SqlCommand cmd = new SqlCommand(cmdText, conn)) { cmd.Parameters.AddWithValue("@username", username); Int32 count = (Int32)cmd.ExecuteScalar(); args.IsValid = true; } } } </code></pre> <p>When I run it, I get the following error.</p> <p>System.ArgumentException was unhandled by user code HResult=-2147024809 Message=No mapping exists from object type System.Web.UI.WebControls.TextBox to a known managed provider native type. Source=System.Data</p> <p>The debugger gives me this error for the below line.</p> <pre><code>Int32 count = (Int32)cmd.ExecuteScalar(); </code></pre> <p>Any idea what's wrong with this code?</p>
c# asp.net
[0, 9]
1,310,443
1,310,444
Beginner ASP.NET C# question about dynamically changing master pages
<p>OK, here's the thing... You fetch the user's IP address and based on his/her country you redirect the user to a specific webpage. Now, how do you change the master page dynamically? This is how I am redirecting the user :-</p> <p><a href="http://stackoverflow.com/questions/3690278/fetching-ip-address-and-displaying-country-in-c-and-asp-net">Geolocation Error with IP Address 127.0.0.1</a></p> <p>It's not like the user clicks some button or something and you then change the master page. I want it changed when the user is redirected, so how exactly do I go about it?</p> <pre><code>public partial class testClass: System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { if (redirected to site1) { Use this master page1 } else if (redirected to site2) { Use this master page2 } } } </code></pre> <p>So how do I check what SITE the user has been redirected to? Also HOW to apply the specific master page now that the user has been redirected?</p> <p>I just need an idea how to go about it.</p> <p><strong>[EDIT] please check the code block below. How do I fetch the URL that the user has been redirected to? I actually need just the "iso3166TwoLetterCode" variable's value (see the link to my earlier question, please) and based on that will be changing the master page. I can't figure out how to fetch that value or even use that class (that's got this variable) in my testClass</strong>.</p> <pre><code> protected void Page_PreInit(object sender, EventArgs e) { if (user Has been redirected to www.site.in ) { this.MasterPageFile = "master1.master"; } if (user Has been redirected to www.site.fr ) { this.MasterPageFile = "master2.master"; } } </code></pre>
c# asp.net
[0, 9]
3,575,861
3,575,862
ASP.NET: Path in place of URL arguments
<p>I've been taking URL arguments in ASP.NET like so:</p> <p><code>www.mysite.com/thread.php?id=123</code></p> <p>However, I'd like to use the cleaner method that you often see which looks like:</p> <p><code>www.mysite.com/thread/123</code></p> <p>How can I do this (get the arguments) in ASP.NET? What's the usual procedure for setting up a system like this?</p>
c# asp.net
[0, 9]
3,028,358
3,028,359
Patterns for avoiding jQuery silent fails
<p>Is there any good practice to avoid your jQuery code silently fail? </p> <p>For example: </p> <pre><code>$('.this #is:my(complexSelector)').doSomething(); </code></pre> <p>I know that every time this line get executed, the selector is intended to match at least one element, or certain amount of elements. Is there any standard or good way to validate that?</p> <p>I thought about something like this:</p> <pre><code>var $matchedElements = $('.this #is:my(complexSelector)'); if ($matchedElements.length &lt; 1) throw 'No matched elements'; $matchedElements.doSomething(); </code></pre> <p>Also I think unit testing would be a valid option instead of messing the code.</p> <p>My question may be silly, but I wonder whether there is a better option than the things that I'm currently doing or not. Also, maybe I'm in the wrong way checking if any element match my selector. However, as the page continues growing, the selectors could stop matching some elements and pieces of functionality could stop working inadvertently. </p>
javascript jquery
[3, 5]
3,199,123
3,199,124
Jquery $.get returns Internal Server Error
<p>I'm trying to built a CRUD application with PHP and jQuery and i'm facing some problems. My main file is index.php, where i include another file called config.php and i define a switch statement. In turn, config.php includes other files and in the end of it i have some css and js includes.</p> <p>This is index.php</p> <pre><code>&lt;?php require_once('config.php'); switch($_GET['action']) { case "add": addRow(); break; case "delete": deleteRow();break; default: listRows();break; } ?&gt; </code></pre> <p>This is Config.php</p> <pre><code>&lt;?php require_once('includes/Table.php'); require_once('includes/Language.php'); ?&gt; &lt;link type="text/css" rel="stylesheet" href="css/sorter/style.css"/&gt; &lt;script src="js/jquery.tablesorter.js"&gt;&lt;/script&gt; &lt;script src="js/jquery.tablesorter.pager.js"&gt;&lt;/script&gt; </code></pre> <p>The files are included correctly because everything so far works fine. The listRows() function is executed by default and lists a table, where in every row i have edit and delete buttons. The tricky part is that when i click on the delete button in a row, i call again the index.php file useing jQuery $.get method, passing in the url the parameter action=delete. This method returns an Internal Server Error and i believe that the problem resides in the require statements, because when i tried the following it worked.</p> <pre><code>&lt;?php switch($_GET['action']) { case "add": addRow(); break; case "delete": echo 1; break; default: require_once('config.php'); listRows();break; } ?&gt; </code></pre> <p>The problem is that I want to use the included files in the delete case as well. Is there any solution?</p> <p>Thanks a lot.</p>
php jquery
[2, 5]
1,715,663
1,715,664
android app builder
<p>my question is i want to create an app builder website form where user can select the design and widgets now when his selection completed and he clicks on complete i want to genearte apk file form back end how can i achieve it any help</p>
java android
[1, 4]
2,196,262
2,196,263
increasing understanding of variable scope and declaration
<pre><code>(function() { var content = [ { title: 'My awesome blog post', thumbnail: 'images/bane.jpg', }, { title: 'My second awesome blog post', thumbnail: 'images/joker.jpg', }, ], template = $.trim( $('#blogTemplate').html() ), frag = ''; $.each( content, function( index, obj ) { frag += template.replace( /{{title}}/ig, obj.title ) .replace( /{{thumbnail}}/ig, obj.thumbnail ); }); $('body').append(frag); })(); </code></pre> <p>Hello There,</p> <p>I was just wondering why it is that the code block that is contained within a self invoking anonymous function cannot have the following variable declarations prefixed with the var keyword like so:</p> <pre><code> var template = $.trim( $('#blogTemplate').html() ), var frag = ''; </code></pre> <p>Adding the var keyword to the local variables in this function - <code>template</code> and <code>frag</code> seems to break my code and I really don't understand why, however if I declare <code>template</code> and <code>frag</code> on a global scope outside of the function as shown below then my code works. </p> <pre><code>var template; var frag; </code></pre> <p>If this relates to scope and anyone has the time to explain it would be much appreciated. Ideally I would like to prefix <code>template</code> and <code>frag</code> with the var keyword to increase readability.</p>
javascript jquery
[3, 5]
4,004,707
4,004,708
How to validate if an HTMLLIElement is hidden with jQuery
<p>I'm iterating through a variable called content, it contains several HTMLLIElement objects. How can i use jQuery's or JavaScript's functions with this object?, what I'm trying to do is the kind of validation written in the commented code.</p> <pre><code> $.each(content, function(index, value){ //if(!value.is(':hidden')){ console.log(index + ' : ' + value); //} }); </code></pre> <p>What I'm getting is </p> <blockquote> <p>Uncaught TypeError: Object # has no method 'is'</p> </blockquote> <p>If I do <code>value.getAttribute('style');</code> I get <code>'display: none;'</code></p>
javascript jquery
[3, 5]
2,251,799
2,251,800
Communication between user controls on the page - C#/ASP.NET
<p>If there are 2 user controls on a page and both of them have checbox controls. Checking/Unchecking a checkbox in one user control should check/uncheck the one in the other user control. </p> <p>I see there is a need for user control communication. </p> <p>Any way I can do this on the client side? (I don't want to use server side code)</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,056,506
3,056,507
How can I set image for item in ListView?
<p>I have code for creating adapter for ListView:</p> <pre><code>ListView films=(ListView)findViewById(R.id.listViewCurrentFilms); ArrayList&lt;HashMap&lt;String, String&gt;&gt; list=getList(); String[] fields=new String[]{"title", "director", "cast"}; int[] resources=new int[]{R.id.textViewFilmName, R.id.textViewDirector, R.id.textViewStart}; SimpleAdapter adapter=new SimpleAdapter(this, list, R.layout.film_item, fields, resources); films.setAdapter(adapter); </code></pre> <p>But I have an ImageView in film_item, and I also need to bind different images from drawable for each item in ListView. How can I do it? Thank you. </p>
java android
[1, 4]
2,028,457
2,028,458
jquery date input plugin
<p>I would like to know if there is a date input plugin for jquery that work like this <a href="http://www.jqwidgets.com/jquery-widgets-demo/" rel="nofollow">plugin</a> epecifically the datetimeinput. This input check that the values are correct and only let the user to input the numbers not the <code>/</code> characters for the date.</p> <p>I know that there are some mask inputs plugins out there but I would like one that validates and only lets the user to input correct date.</p> <p>Regards</p>
javascript jquery
[3, 5]
1,827,437
1,827,438
Find radio button list from gridview rows in javascript
<p>I have two grid views containing 12 and 24 rows resp. Each row contains radiobutton list(Yes/No). Below both the grids, there is one more radio button list. In first grid, all radio buttons are by default "Yes". If any one selects know, the radio button below the grids should become disabled with selection ="No". In second grid the radio buttons are by default "No". If any one selects Yes, the radio button below the grid should become disabled with selected value="No". All these work should be done through javascript... </p> <p>How can I do so...???</p>
javascript asp.net
[3, 9]
3,341,788
3,341,789
jQuery check if <input> exists and has a value
<p>For example, if I have</p> <pre><code>&lt;input type="text" class="input1" value="bla"/&gt; </code></pre> <p>Is there a way to check if this element exists and has a value in one statement? Or, at least, anything shorter then</p> <pre><code>if($('.input1').length &gt; 0 &amp;&amp; $('input1').val() != '') </code></pre> <p>Just getting frustrated here with mile-long conditions :( Thanks!</p>
javascript jquery
[3, 5]
437,455
437,456
jquery optgroup selection according to label
<p>Hello i am getting value dynamically which is my label in optgroup. now using jquery i want to show only that optgroup which matches with my dynamic value. </p> <pre><code>&lt;select class="form-select" id="test"&gt; &lt;option value="_none"&gt;- None -&lt;/option&gt; &lt;optgroup label="Personal / Web Conferencing"&gt; &lt;option value="257"&gt; 1 &lt;/option&gt; &lt;option value="374"&gt; dd &lt;/option&gt; &lt;option value="332"&gt;&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label="Personanew"&gt; &lt;option value="257"&gt; 1 &lt;/option&gt; &lt;option value="374"&gt; dd &lt;/option&gt; &lt;option value="332"&gt;&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label="Personalsss"&gt; &lt;option value="257"&gt; 1 &lt;/option&gt; &lt;option value="374"&gt; dd &lt;/option&gt; &lt;option value="332"&gt;&lt;/option&gt; &lt;/optgroup&gt; &lt;optgroup label="Personalsss"&gt; &lt;option value="257"&gt; 1 &lt;/option&gt; &lt;option value="374"&gt; dd &lt;/option&gt; &lt;option value="332"&gt;&lt;/option&gt; &lt;/optgroup&gt; &lt;/select&gt; </code></pre> <p>How to do this using jquery. i dnt have any idea about this . how to play with optgroup Thanks a lot</p>
javascript jquery
[3, 5]
1,521,136
1,521,137
How can I populate data from an Excel worksheet to grid?
<p>I am working on an application where I have to get email IDs from an Excel sheet and send out an email to each ID. I have tried to display the email IDs in a grid as a test. My application is not throwing any errors but it is not executing in the required manner.</p> <p>Can anyone help figure out why this is happening?</p>
c# asp.net
[0, 9]
680,149
680,150
Spider web chart in JQuery
<p>How to create the Spider Web Chart using JQuery? Is there any one can help me to create the Spider Web Chart using JQuery in ASP.Net?</p>
asp.net jquery
[9, 5]
130,294
130,295
i want to generate payperiod for each month
<p>On the first time I created pay period schedule, which is the type is Monthly, for example , Start, End, Transaction, and Functions of pay period is like below:</p> <ol> <li>01-Jan-12 12:00 AM, 30-Jan-08 11:59 AM, 31-Jan-08 12:00 PM</li> </ol> <p>The above one is first month payperiod. next month it ill create like this automatically and inserted into database what i do?</p> <ol> <li>01-Feb-12 12:00 AM,28-Feb-12 11:59 PM,29-Feb-12 12:00 PM</li> </ol> <p>please help me.. </p>
c# asp.net
[0, 9]
3,207,070
3,207,071
Highlight day in Android calendar?
<p>Is there a way to highlight a day (or days) on calendar in my Android application?</p>
java android
[1, 4]
3,665,788
3,665,789
Java solution for C++ style compiler directive
<p>I have a Java array:</p> <pre><code> String[] myArray = {"1", "2"}; </code></pre> <p>Depending on a condition that is known at compile time I would like to assign different values:</p> <pre><code> String[] myArray = {"A", "B", "C"}; </code></pre> <p>In C++ I would use something like </p> <pre><code>#ifdef ABC // ABC stuff here #else // 123 stuff here #endif </code></pre> <p>but what to do in Java?</p>
java c++
[1, 6]
2,259,831
2,259,832
Keeping the submit button disabled until a change is made
<p>In my VB.NET project, I have a UI with some text input fields and a save/submit button. I want the save button to be in a disabled state on page load, and remain that way until a change is made to one of the inputs. And the save button should get disabled again if the values entered by the user are the same as they were at page load. So basically, the save button should be enabled only when there is an actual change.</p> <p>How can I do this using jquery? </p>
javascript jquery asp.net
[3, 5, 9]
3,535,634
3,535,635
copy text from alertdialog in android?
<p>Is there anyway to make the text in an alertdialog "selectable" or "copyable" in android? Or do I have to use some other widget instead of alertdialog?</p> <p>Thanks in advance.</p>
java android
[1, 4]
5,363,544
5,363,545
Android onsaveinstancestate()
<p>so i get the main idea of how to use </p> <pre><code> protected void onSaveInstanceState (Bundle outState) </code></pre> <p><a href="http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)" rel="nofollow">http://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)</a></p> <p>also from <a href="http://stackoverflow.com/questions/151777/saving-activity-state-in-android">Saving Activity state in Android</a></p> <p>but my problem is what if this was the first time the application is being created? then nothing would have been stored in the bundle before....and if so then when i try to call something out from the bundle that hasn't been saved before what do i get?null? for example i have this in my code</p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); String [] b=savedInstanceState.getStringArray("MyArray"); } @Override public void onSaveInstanceState(Bundle savedInstanceState) { super.onSaveInstanceState(savedInstanceState); String [] a={"haha"}; savedInstanceState.putStringArray("MyArray", a); } </code></pre> <p>in the FIRST time the application is ever opened what would the value of b be? and after the application has been used once what would the value of b be?</p> <p>Many thanks!</p>
java android
[1, 4]
3,315,822
3,315,823
Custom fonts in android
<p>I am trying to use custom fonts in a textview:</p> <pre><code>tv=(TextView)findViewById(res); Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/font.ttf"); tv.setTypeface(font); </code></pre> <p>But when I run I get the following error:</p> <pre><code>W/System.err( 542): java.lang.RuntimeException: native typeface cannot be made </code></pre> <p>Whats the issue?</p>
java android
[1, 4]
188,809
188,810
Display ticket remaining time
<p>I am programming small page and I want to display expiration time of authentication ticket. I mean not the end, but remaining time. Current code is follows:</p> <pre><code> DateTime cas = (DateTime)ticket.Expiration.Date; DateTime cas1 = DateTime.Now; DateTime cas2 = cas1.Subtract(cas); </code></pre> <p>However, VS says "Cannot implicitly convert system.timespan into system datetime". Pls help. Thanks a lot.</p>
c# asp.net
[0, 9]
116,303
116,304
How to handle application upgrades from free to paid version on Android
<p>I plan to go with the free version in order to promote the paid version. Few questions:</p> <ol> <li>In your experience, is it helps?</li> <li>After a user has installed the free version, if he wants to install the paid version, he needs to remove the free version first ?</li> <li>how it effects downloads rates ?</li> <li>What is the correct way to do it?</li> </ol>
java android
[1, 4]
5,314,356
5,314,357
Submit without refresh in php
<p>I've read a lot of post regarding the topic. I've seen lots of answers and pointing to use ajax. Is there any other way to not refresh the page on form submit?</p> <p>E.g Sample form</p> <pre><code>&lt;form method="post"&gt; &lt;input type="radio" name="test" value="Start"&gt;Start&lt;br /&gt; &lt;input type="radio" name="test" value="Stop"&gt;Stop&lt;br /&gt; &lt;input type="submit" value="GO"&gt; &lt;/form&gt; </code></pre> <p>Is there a javascript way of doing it without using ajax and jquery?</p> <p>Thanks,</p>
php javascript
[2, 3]
3,573,678
3,573,679
ASP.NET JavaScript popup window failing at getting a property
<p>In my ASP.NET application, my popup window is returning null for a specific variable. </p> <p>When I click a button this JavaScript gets fired:</p> <pre><code>function Picker_OrderDefaultFirst() { OpenPageWithParam('OrderPermanentItems', '?ID=' + "&lt;%=CommitteeUId %&gt;" + "&amp;btn=1", returnOrderPicker); return false; } </code></pre> <p><code>returnOrderPicker</code> looks like: </p> <pre><code>function returnOrderPicker() { alert("Test fra returnOrderPicker"); } </code></pre> <p><code>OpenPageWithParam</code> looks like: </p> <pre><code>function OpenPageWithParam(PageName, Query, ReturnFunction) { var _window = null; InitBlocker(); switch (PageName) { case "OrderPermanentItems": _window = PopupCenter(ROOT_DIR + "/Forms/Pickers/PermanentItemsPicker.aspx" + Query, PageName, 590, 600); break; } _window.ReturnFunction = ReturnFunction; return _window; } </code></pre> <p>I'm setting the popup window's property <code>ReturnFunction</code> to be <code>ReturnFunction</code> of data from previous page. (In this example <code>returnOrderPicker</code> Function). </p> <p>But, when window pops up, the value of <code>window.ReturnValue</code> is <code>undefined</code>. </p> <p>Calling in popup window looks like: </p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; window.onload = function (sender, eventArgs) { alert(window.ReturnFunction + " Window PermanentItemPickerPopup "); } &lt;/script&gt; </code></pre> <p>Any ideas? </p>
c# javascript asp.net
[0, 3, 9]
3,570,766
3,570,767
how to count special character in a string
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11238184/string-functions-how-to-count-delimiter-in-string-line">String Functions how to count delimiter in string line</a> </p> </blockquote> <blockquote> <p>I have a string as str = "one$two$three$four!five@six$" now how to count Total number of "$" in that string using java code.</p> </blockquote>
java android
[1, 4]
796,044
796,045
jquery .empty() conflict with keypress event
<p>This is meant to allow a user to type in a message and then press enter to send it. This should clear the box so that the user can type in a new message. The problem is that the standard result of pressing enter (creation of a newline) is occurring <em>after</em> the .empty() event....so the text vanishes and is replaced by a newline, which is quite undesirable. How can I circumvent this?</p> <pre><code> $('#messagebox').keypress(function(event) { if (event.keyCode == '13') { send(); $('#messagebox').empty(); } }); </code></pre>
javascript jquery
[3, 5]
1,070,659
1,070,660
Javascript: displaying fancy alerts with javascript file
<ul> <li>I have an Javascript file(<code>handler.js</code>) while is basically an ajax request/response cycle</li> <li>On receiving data, I do <code>alert(data)</code> and it works fine</li> <li>I want to show fancy alerts like one in Jquery, how can I create fancy alerts from with in <code>handler.js</code>?</li> </ul>
javascript jquery
[3, 5]
3,523,464
3,523,465
Assigning a php array into a javascript array
<p>I am trying to assign a PHP array into a javascript variable like this: </p> <pre><code>var jsArray = &lt;?php echo $phpArray; ?&gt;; </code></pre> <p>But it doesn't work.<br> What am I doing wrong?</p>
php javascript
[2, 3]
1,767,189
1,767,190
Select first of multiple instances
<p>I have 3 <code>&lt;section&gt;</code>s on a page with the class <code>.slider</code> and within these there are several <code>&lt;article&gt;</code>s. For the purpose of making these work as tabbed content I want to use jQuery to hide all but the first of each these <code>&lt;article&gt;</code>s.</p> <p>The following:</p> <pre><code>$(".slider &gt; article:not(:first)").hide(); </code></pre> <p>hides everything but the first <code>&lt;article&gt;</code> in the first <code>&lt;section&gt;</code>, I need it to iterate through the three <code>&lt;section&gt;</code>s and hide the first in each of these. I assume I need to use <code>each()</code> to loop through them, but I can't make anything work.</p>
javascript jquery
[3, 5]
1,185,848
1,185,849
How to build a JS toggler that either opens or closes based on the click
<p>I have the following: </p> <p><a href="http://jsfiddle.net/y2aFF/" rel="nofollow">http://jsfiddle.net/y2aFF/</a> </p> <p>This will open box1 or open box 2 if you click back and forth. What it doesn't do is if box 1 is open and you click box 1, I want it to close box 1. Same goes with box 2. Any elegant way to do this with js/jQuery?</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,950,327
5,950,328
Passing a variable's value not reference in an OnClickListener()
<p>I'm trying to set up a large number OnClickListeners through a for loop. Each view should run a method when clicked; view 0 should run the method with the value 0, view 1 with the value 1, etc. However, if I declare the OnClickListener using a variable which increments through the for loops, the OnClickListener remembers the reference to the variable rather than the value of the variable at the time it was declared.</p> <p>That's probably not very clear - here's the code:</p> <pre><code>for (int i = 0; i &lt; 20; i++) { cells[i] = (ImageView) findViewById(cellIDs[i]); cells[cellnumber++].setOnClickListener(new OnClickListener() { public void onClick(View v){ cellClicked(cellnumber, v); } }); } </code></pre> <p>That correctly sets up the OnClickListeners for each cell, but whichever one is clicked, it always runs calls cellClicked with value of 21. I know I can manually set up the OnClickListeners using cell[0] ... cellClicked(0, v), but is a way to do it so that the ClickListener is passed the value of the variable rather than a reference to the variable in the for loop?</p> <p>(I saw a few pages which said that Java normally operates with passing values and not references, but I assume the Android libraries somehow do it differently and hence my difficulties here.)</p> <p>Thanks for your help! Steve</p> <p>PS: Sorry if this question goes up twice; the page appeared to freeze the first time I tried posting.</p>
java android
[1, 4]
1,480,747
1,480,748
Using JavaScript, how can I reset all the select's in my form so that the first option for each is selected?
<p>I have a form containing only select fields, a submit button and a reset button. </p> <pre><code>&lt;form id="search_form"&gt; &lt;select id="country"&gt; &lt;option value="-1"&gt;Select Country&lt;/option&gt; &lt;option value="22"&gt;USA&lt;/option&gt; &lt;option value="23"&gt;Germany&lt;/option&gt; ... &lt;/select&gt; &lt;select id="regions"&gt; &lt;option value="-1"&gt;Select Region&lt;/option&gt; ... &lt;/select&gt; &lt;input type="reset" value="Reset /&gt; &lt;/form&gt; </code></pre> <p>Each of the select fields has a default option with a value of "-1".</p> <p>When a user clicks on the reset button, I want all the selects to show the option with this "-1" value as being selected.</p> <p>What is the best way to do this using JQuery?</p>
javascript jquery
[3, 5]
2,777,631
2,777,632
Cloning an element and adding it to Dom multiple times
<pre><code>//I am cloning a dom element and inserting it in dom element multiple times &lt;div class='toBeCloned'&gt;some text&lt;/div&gt; &lt;div id='target'&gt;&lt;/div&gt; var _clone=$('.toBeCloned').clone(true);//create clone var _target=$('#target'); //this is target _target.append(_clone); //append target _target.append(_clone); //append target _target.append(_clone); //append target //this should add 3 elements but it's adding only one </code></pre>
javascript jquery
[3, 5]
714,916
714,917
JQuery image swap inside a div
<p>I'm trying to achieve something similar to <a href="http://www.georgetowncupcake.com/menu.html" rel="nofollow">this</a>.</p> <p>The image will be coming from a feed url, I'm unsure of how to prevent each of them opening up in a new window, here is what I have so far:</p> <p><strong>Javascript:</strong></p> <p>jquery/1.3.2/jquery.min.js</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(function($){ $('#more-views a').click(function(){ $('#main-image img').fadeOut('slow').delay(2000).remove(); //$('#main-image').append('&amp;lt;img src="' + $(this).attr('href') + '" alt="" style="display:none;" /&amp;gt;'); $('#main-image').append('&lt;img src="' + $(this).attr('data') + '" alt="" style="display:none;" /&gt;'); $('#main-image img').fadeIn('slow'); return false; }); }); &lt;/script&gt; </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="more-views"&gt; &lt;a data="http://www.domain.com/image1.jpg"&gt; 1 Day&lt;/a&gt; &lt;a data="http://www.domain.com/image2.jpg"&gt; 5 Days&lt;/a&gt; &lt;a data="http://www.domain.com/image3.jpg"&gt; 1 Month&lt;/a&gt; &lt;/div&gt; &lt;div id="main-image"&gt; &lt;img src="http://www.domain.com/image1.jpg" alt="1d" /&gt; &lt;/div&gt; </code></pre> <p>Please help! Thanks!</p>
javascript jquery
[3, 5]
5,112,926
5,112,927
Asp.Net usercontrol codebehind: reference nested class from another usercontrol
<p>Edit: apparently it was a hickup in VS intellisense. Costed me quite some time, sight. Thanks for the help anyway.</p> <p>What I'm trying to do is to reference an inner class from one codebehind to the other, I've managed to be able to reference the outer class using <code>@ reference</code> and <code>classname</code>. However I can't access the inner class. So to be more precise: </p> <pre><code>public partial class A : System.Web.UI.UserControl { public class Inner { } } </code></pre> <p>And now in another .ascx(.cs) file:</p> <pre><code>public partial class B : System.Web.UI.UserControl { somemethod() { //reference A.Inner...how? } } </code></pre> <p>The reason for using the innerclass is that I'm bound to a framework, and can't add other things then the two .aspx controls.</p>
c# asp.net
[0, 9]
2,401,117
2,401,118
How do I increase the scope of a variable in JavaScript?
<p>I've got the following code:</p> <pre><code>$('.task-list').each(function(list, response) { response = $('#' + this.id).sortable('toArray'); }); console.log(response); </code></pre> <p>The error I'm getting is response is undefined. I tried adjusting line 2 to be <code>var response</code> but got the same error.</p> <p>I'm trying to build an array of data by looping over the items on the page and then submitting a single ajax response to the server to update it.</p>
javascript jquery
[3, 5]
3,653,504
3,653,505
How to return the ID of this span under a LI nodeObject using javascript or Jquery
<p>So I have </p> <pre><code>&lt;li&gt; &lt;span id="foobar"&gt; abc &lt;/span&gt; &lt;/li&gt; </code></pre> <p>I now have <code>li</code> as an nodeObject. I could get <code>"LI"</code> by using <code>li.nodeName</code>.</p> <p>Now how could I get <code>"foobar"</code> out of <code>li</code> which is an ID of a span inside it.</p> <p>I tried:</p> <pre><code> $node = li; alert($node&gt;span.Id); </code></pre> <p>but not working, thanks!</p>
javascript jquery
[3, 5]
65,478
65,479
Detect when radio button is checked
<p>I have a form build in code behind.</p> <p>What I am trying to do is detect when a radio button is checked, and when its checked changes.</p> <p>I have the following</p> <pre><code>RadioButton radio = new RadioButton() { ClientIDMode = System.Web.UI.ClientIDMode.Static, AutoPostBack=true, ID = "rbOther" + testEquipment.Id, GroupName = "grp" + testEquipment.Id, Checked = false }; radio.CheckedChanged += new EventHandler(radio_CheckedChanged); </code></pre> <p>testEquipment is a instance of a object that stores the some data.</p> <pre><code>tdBrandName.Controls.Add(new TextBox() { ClientIDMode = System.Web.UI.ClientIDMode.Static, ID = "txtBrandName" + testEquipment.Id, Text = serviceStationTestEquipment != null ? serviceStationTestEquipment.BrandName : string.Empty, Width = new Unit(300), Enabled = serviceStationTestEquipment != null ? serviceStationTestEquipment.Other : false }); tdBrandName.Controls.Add(new RequiredFieldValidator() { Display = ValidatorDisplay.Dynamic, ControlToValidate = "txtBrandName" + testEquipment.Id, Text = "Required field", ErrorMessage = "Test Equipment Tab: Field is required", CssClass = "validationerror", Enabled = serviceStationTestEquipment != null ? serviceStationTestEquipment.Other : false, ID = ID = "reqValidator" + testEquipment.Id }); </code></pre> <p>I then want to disable the textbox and the requiredfieldvalidator when the radio button is clicked. There is three ie. none, default, other</p> <p>When other is selected the textbox must become enabled along with the required field validator.</p> <pre><code>void radio_CheckedChanged(object sender, EventArgs e) { RadioButton check = sender as RadioButton; if (check == null) return; string Id = check.ID.Replace("rbOther", ""); TextBox text = check.Parent.Parent.FindControl(string.Format("txtBrandName{0}", Id)) as TextBox; text.Enabled = check.Checked; RequiredFieldValidator validator = check.Parent.Parent.FindControl(string.Format("reqValidator{0}", Id)) as RequiredFieldValidator; validator.Enabled = check.Checked; } </code></pre>
c# asp.net
[0, 9]
3,963,862
3,963,863
cant change variable
<p>I'm trying to make a navigation area and am trying to switch tabs with the active variable. This is just for the nav button, but later I'd like to make a rotator too by switching the variable.</p> <p>Here is my code:</p> <pre><code> active = 1; function hover() { $(nav1).live('mouseenter', function() { active = 2; }); if ( active == 1) { $(tab1).fadeIn('fast'); } else if ( active != 1) { $(tab1).fadeOut('slow'); } if ( active == 2) { $(tab2).fadeIn('fast'); } else if ( active != 2) { $(tab2).fadeOut('slow'); } } hover(); </code></pre>
javascript jquery
[3, 5]
5,293,945
5,293,946
Split String using delimiter that exists in the string
<p>I have a problem and I am wondering if there is any smart workaround.</p> <p>I need to pass a string through a socket to a web application. This string has three parts and I use the '|' as a delimiter to split at the receiving application into the three separate parts.</p> <p>The problem is that the '|' character can be a character in any of the 3 separate strings and when this occurs the whole splitting action distorts the strings.</p> <p>My question therefore is this: Is there a way to use a char/string as a delimiter in some text while this char/string itself might be in the text?</p>
c# java
[0, 1]
519,879
519,880
java code to receive GCM push notification and save them in SQLite DB on android phone
<p>I am a beginner in PHP, JAVA and GCM Service.</p> <p>I built an app that has two parts:</p> <p>1)PHP Server side </p> <p>2)Java android client side</p> <p>I set the GCM and registered the phone and I got an ID.</p> <p>I set the server to sent Data to GCM server successfully. </p> <p>My question is:</p> <p>what is the Java code I have to write to receive the push notification from the GCM server and save it on the SQLite DB i built in the android app?</p> <p>Thanks in advance!</p>
java android
[1, 4]
1,249,550
1,249,551
Swallowing exception thrown in catch/finally block
<p>Usually I come across situations where I have to swallow an exception thrown by the clean up code in the <code>catch</code>/<code>finally</code> block to prevent the original exception being swallowed.</p> <p>For example:</p> <pre><code>// Closing a file in Java public void example1() throws IOException { boolean exceptionThrown = false; FileWriter out = new FileWriter(“test.txt”); try { out.write(“example”); } catch (IOException ex) { exceptionThrown = true; throw ex; } finally { try { out.close(); } catch (IOException ex) { if (!exceptionThrown) throw ex; // Else, swallow the exception thrown by the close() method // to prevent the original being swallowed. } } } // Rolling back a transaction in .Net public void example2() { using (SqlConnection connection = new SqlConnection(this.connectionString)) { SqlCommand command = connection.CreateCommand(); SqlTransaction transaction = command.BeginTransaction(); try { // Execute some database statements. transaction.Commit(); } catch { try { transaction.Rollback(); } catch { // Swallow the exception thrown by the Rollback() method // to prevent the original being swallowed. } throw; } } } </code></pre> <p>Let's assumed that logging any of the exceptions is not an option in the scope of method block, but will be done by the code calling the <code>example1()</code> and <code>example2()</code> methods.</p> <p>Is swallowing the exceptions thrown by <code>close()</code> and <code>Rollback()</code> methods a good idea? If not, what is a better way of handling the above situations so that the exceptions are not swallowed?</p>
c# java
[0, 1]