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 |
---|---|---|---|---|---|
597,233 | 597,234 | JQuery: Comparing date entered in textbox against today's date | <p>How do i make a check whether a date entered in a text box is greater than today's date? Format retrieved from text box e.g. 14/05/2013</p>
| javascript jquery | [3, 5] |
3,565,643 | 3,565,644 | how to execute a series of animations one after another using jquery? | <p>This will animate the second image after the first animation is complete: </p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
$('#image1').show("slide", { direction: 'left' }, 1000,
function() { $('#image2').show("slide", { direction: 'left' }, 1000)});
</script>
</code></pre>
<p>If I have four images I tried below - and only the first two images animate.</p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
$('#image1').show("slide", { direction: 'left' }, 1000,
function() { $('#image2').show("slide", { direction: 'left' }, 1000)},
function () { $('#image3').show("slide", { direction: 'left' }, 1000)},
function () { $('#image4').show("slide", { direction: 'left' }, 1000)});
</script>
</code></pre>
<p>So what would be an effective way to animate all the images (4) in sequence?</p>
| javascript jquery | [3, 5] |
3,620,746 | 3,620,747 | Failing to link button to intent | <p>When i try this code which reads what the user has clicked and compares it to the button name it only seems to work for one array rather then the 2nd one. If anybody can see why please help me </p>
<pre><code> case R.id.new_button:
final CharSequence[] items = {"N", "E", "M", "G"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a difficulty");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if ("N".equals(items[0]))
{Intent intent = new Intent();
Intent i0 = new Intent(B.this, Test1.class);
startActivity(i0);}
else if ("M".equals(items[2]))
{Intent intent = new Intent();
Intent i2 = new Intent(Brain.this, Test2.class);
startActivity(i2);;}
}
}).show();
AlertDialog alert = builder.create();
</code></pre>
| java android | [1, 4] |
5,555,585 | 5,555,586 | Simple JQuery click-and-show doesn't work | <p>I'm using this simple bit of JQuery to show/hide a div by clicking on the link, I've used the same code a few times before and it worked perfectly but now all of a sudden it refuses to work.</p>
<p>JQuery is properly included and the page doesn't give a Javascript error (or any other error for that matter).</p>
<p>JQuery:</p>
<pre><code><script type="text/javascript">
$(function() {
$('#addnew').css('display', 'none');
$('#shownew').click(function() {
$('#addnew').toggle();
return false;
});
});
</script>
</code></pre>
<p>HTML (link):</p>
<pre><code><a href='#' id='shownew'>Add News Item</a>
</code></pre>
<p>HTML (div):</p>
<pre><code><div id="addnew">
<form id="new_news" enctype="multipart/form-data" action="news.php" method="post">
Title:
<br/><input type="text" name="title" id="title" />
<p>Image (optional, will be shown after first paragraph)
<br/><input type="hidden" name="size" value="2000000"><input type="file" name="photo">
<p>Article body:
<br/><textarea cols='40' rows='5' maxlength='5000' name='body' id='body'></textarea>
<p><input type="submit" name="submit" id="submit" value="Submit" />
</form>
</div>
</code></pre>
<p>What could I possibly be missing here? As you see from the JQuery, the div is hidden to begin with. When I remove the line that says <code>$('#addnew').css('display', 'none');</code> the div is displayed correctly, but the link still doesn't toggle it on and off.</p>
| javascript jquery | [3, 5] |
5,450,789 | 5,450,790 | JQuery - also trigger change on click away | <p>I have a basic JQuery script that changes a few divs when you click - thus showing them - via toggle.</p>
<pre><code><script type="text/javascript">
$('#content_display').click(function() {
$(this).toggleClass('selected');
$('#content_display_selector_container').toggle();
});
</script>
</code></pre>
<p>However - to call the even you need to click only on the first main div with the ID of "content_display".</p>
<p><strong>My question is this:</strong> how can I hide these changes using JQuery if the user also clicks on BODY - i.e. if you click away, the divs go back to their original hidden state?</p>
<p>Thanks for helping a JQuery clutz!</p>
| javascript jquery | [3, 5] |
2,842,965 | 2,842,966 | jQuery / Javascript replace function only works once | <p>I have a button as such</p>
<pre><code><button id="toggle_photo">
<span id="photo_text">Hide Photos (1)</span>
<img class="icon" alt="Photos" src="/img/photos-16.png">
</button>
</code></pre>
<p>And jQuery / Javascript to change the text upon clicking</p>
<pre><code>$('#toggle_photo').click(function(){
var text = $('#photo_text').text();
$('#photo_text').text(
text.match(/Hide Photos/) ? text.replace("Hide", "Show") : text.replace("Show", "Hide"));
$('.photo_frame').toggle('slow');
});
</code></pre>
<p>This works the first time the button is clicked and the button text changed from <code>Hide Photo (1)</code> to <code>Show Photo (1)</code>. Next, the button html is replaced with new text via an AJAX call, new contents are the same except perhaps for the count, so it might show this instead</p>
<pre><code><button id="toggle_photo">
<span id="photo_text">Hide Photos (3)</span>
<img class="icon" alt="Photos" src="/img/photos-16.png">
</button>
</code></pre>
<p>However, this time the element didn't trigger a click event, why?</p>
| javascript jquery | [3, 5] |
1,142,218 | 1,142,219 | How do you handle with control binding in jquery | <p>I have a question about jquery and DOM manipulation. How do you handle with DOM controls for e.g.</p>
<p>I have to get value from text input so I could this in ways:</p>
<pre><code>var SomeClass = function() {
var control;
this.setControl = function(c) {
control = c;
}
this.getValue = function() {
return control.val();
}
}
$(document).ready(function() {
var sc = new SomeClass(); // of course control could be passed in contructor as well
sc.setControl($('#CONTROL'));
console.log(sc.getValue());
});
</code></pre>
<p><strong>OR</strong></p>
<pre><code>var SomeClass = function() {
var control = $('#CONTROL');
this.getValue = function() {
return control.val();
}
}
$(document).ready(function() {
var sc = new SomeClass();
console.log(sc.getValue());
});
</code></pre>
<p>what is your opinion? What is better or maybe this is pile of trash therefore what is the best solution. Plz dont send me to backbone, spine and so on Im interesed in only in jquery.</p>
<p>best!</p>
<p>EDIT:</p>
<p>do you separate logic from UI or you are mixing it?
more complicated example</p>
<p>in js file you have a class that uses text control and in the secound js file also you need values from this input. What you are doing? you just call everytime $('#control') or create a third js file where would be a separated "class" to manipulate this input? </p>
| javascript jquery | [3, 5] |
5,346,600 | 5,346,601 | JQuery - Add Selected Elements Together - Combine Child Slectors | <p>I would like to combine my Selector that selects an Element based on an mouseover Event. This is what I have so far.</p>
<pre><code>parentItem.mouseenter(function ()
{
var childItems = $(this).add(this + "li:first");
childItems.show();
});
</code></pre>
<p>I understand that I can't use 'this' by itself nor can I add the two together, because it isn't a string. </p>
<p>How would I accomplish this concept? Thanks.</p>
| javascript jquery | [3, 5] |
4,354,891 | 4,354,892 | Is it possible to add JavaScript after page load and execute it | <p>Say I have a JavaScript function that is inserted into the page after page load how can I then call that function. For example lets keep things simple. Say I make an Ajax call to get the markup of the script and the following is returned:</p>
<pre><code><script type="text/javascript">
function do_something() {
alert("hello world");
}
</script>
</code></pre>
<p>If I then add this markup to the DOM can I call <code>do_something()</code> later?</p>
<p>I'm use the jQuery JavaScript framework.</p>
| javascript jquery | [3, 5] |
4,537,458 | 4,537,459 | JQuery: Help with $("#div") | <p>I just started using JQuery, as such, I'm cleaning up old code of mine to use JQuery throughout.</p>
<p><strong>Question</strong>: How would I convert the following code to use JQuery?</p>
<pre><code>// enable the other link
document.getElementById("asc").setAttribute("href", "#");
document.getElementById("asc").onclick = function() {displayHomeListings("asc")};
document.getElementById("asc").style.textDecoration = "none"
//disable this link
document.getElementById("desc").removeAttribute("href");
document.getElementById("desc").onclick = "";
document.getElementById("desc").style.textDecoration = "underline"
</code></pre>
| javascript jquery | [3, 5] |
3,760,486 | 3,760,487 | Combat system in JQuery | <p>i would like to create a pretty simple combat system in JQuery, for a browser game. The idea is that i have combat statistics ( i already have that ), and i want to represent them back to the user in a nice graphical manner.</p>
<p>If you have played the game shakes and fidget, you can already see what i'm asking. If not, think that two parties are fighting, visualize two images. The first party attacks, then the second, then the first again and so on..</p>
<p>Ideally, each time a party attacks, i should show the damage done (probably like flashing the damage right on top of the image associated with that party). Then the health meter goes down (i actually have that bar, so it's not a problem).</p>
<p>My main problem, is how to do that in like a manner that seems like the story of the battle unravels. Should it be sort of like a timer ? And then, how do i actually present flashing values in a nice manner ?</p>
<p>Any related tutorials or resources on that topic would be greatly appreciated :)</p>
<p>NOTE that i'm looking for code help, samples even better, that would help me in actually coding that.</p>
| javascript jquery | [3, 5] |
4,784,531 | 4,784,532 | finding the index of an element in relation to a specific parent | <p>Looking at the example here - <a href="http://jsfiddle.net/uqYeQ/3/" rel="nofollow">http://jsfiddle.net/uqYeQ/3/</a></p>
<p>The first row behaves as expected, returning the index of the div within it's parent. </p>
<p>I'd like the 2nd row to behave in the same way, I'd like it to return between 0 and 4 depending on which div has been clicked. I'd like to know the index of the div that has been clicked in relation to it's parent list item. </p>
<p>I cannot change the html at all.</p>
| javascript jquery | [3, 5] |
3,375,288 | 3,375,289 | How to Check whether Session is Expired or not in asp.net | <p>i ve specified the session time out in web.config file..when the session is timeout im not getting redirect to login page but i am geting error saying object reference not set to an instance.</p>
<p>can any one tell me the solution for this?</p>
| c# asp.net | [0, 9] |
1,096,390 | 1,096,391 | Android browser in background | <p>I am developing a web page for android browser. The page will authenticate users. I placed an iframe that will refresh every 10 minutes to keep the user logging while the page is open. However if the user switch to another application placing the web browser in the background, the refresh to keep logged in stops. So when the user switch back to the browser the session is lost and errors pop up from my ajax call in that page.....
How could i handle this scenario when the browser is sent to the background and keep the session alive?
thanks</p>
| android asp.net | [4, 9] |
5,299,435 | 5,299,436 | Javascript slider not working or outputting anything to browser | <p>Im triyng to work with the basic jquery slider only for some reason I cant get it to work.</p>
<p>When I say it wont work, nothing shows up, none of my images nor text, and nothing is output in my error console. </p>
<p>Ive created a fiddle to show you an example</p>
<p><a href="http://jsfiddle.net/FYzqq/" rel="nofollow">http://jsfiddle.net/FYzqq/</a></p>
| javascript jquery | [3, 5] |
1,887,085 | 1,887,086 | ASP programmer thinking about learning PHP | <p>What's the best way to go about learning PHP when I've been doing ASP/ASP.NET? I'm not sure it's worth the time, but there seem to be so many projects doing it..</p>
<p>What do you think? Anyone crossed the worlds? How did you do it?</p>
| c# php asp.net | [0, 2, 9] |
5,858,405 | 5,858,406 | Auto-refreshing content (using template engine) using jQuery | <p>I'm looking for a way to use jQuery with a script index.php that is built bit-by-bit using a template engine, like so:</p>
<pre><code><?php
global $template;
page_header(); // Calls and displays header.html
$template->load('body', 'index.html'); // Loads index.html and calls it 'body'
*Code that assigns values to variables in index.html*
$template->display('body'); // Displays index.html
page_footer(); // Calls and displays footer.html
?>
</code></pre>
<p>where each line does as commented.</p>
<p>I want to build a function using jQuery that autorefreshes index.php, but only the 'body' part. I can't find any documentation on doing that, but I've looked at the following code:</p>
<pre><code>function update() {
$("#notice_div").html('Loading..');
$.ajax({
type: 'GET',
url: 'index.php',
timeout: 2000,
success: function(data) {
$("#current_game").html(data);
$("#notice_div").html('');
window.setTimeout(update, 10000);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#notice_div").html('Timeout contacting server..');
window.setTimeout(update, 60000);
}
});
};
</code></pre>
<p>But it gets really messy when this is in the header, because it calls the whole index.php page which nests the header, so we have a header in a header. Any suggestions?</p>
| php javascript jquery | [2, 3, 5] |
2,262,765 | 2,262,766 | Dynamically add Button to Panel | <p>I am adding a RadButton dynamically to a Panel. So I am creating the button as so:</p>
<pre><code> RadButton btnAwesome = new RadButton();
btnAwesome.AutoPostBack = true;
btnAwesome.Text = "Click me...";
btnAwesome.ID = "LinkButtonTest";
btnAwesome.Click += new System.EventHandler(lnkbtnEditRecord_Click);
</code></pre>
<p>and it it should call this method onclick:</p>
<pre><code> protected void lnkbtnEditRecord_Click(object sender, EventArgs e)
{
salesEditPanel.Visible = true;
resultPanel.Visible = false;
zipPanel.Visible = false;
ddlPanel.Visible = false;
topPanel.Visible = false;
}
</code></pre>
<p>It adds the button the Panel but it doesn't add the onclick to it. Any idea what I am missing?</p>
<p>Thanks!</p>
| c# asp.net | [0, 9] |
701,715 | 701,716 | JQuery Function Do something - Pause - Do something else | <p>I am creating a function where I could execute some jquery code ...then pause for say... 5 secs and then execute something else..</p>
<p>Something like this:</p>
<pre><code>function myFunc() {
var str1 = 'This is the starting text';
var str2 = 'This is the ending text';
$("#label").html(str1);
//I need a pause here (5000 ms) ---
$("#label").html(str2);
}
</code></pre>
<p>How can I get a pause in there?</p>
| javascript jquery | [3, 5] |
3,769,556 | 3,769,557 | How do I parse the free format address to save into the DataBase | <p>I have a text area that allow user the type in an address in free format, how do I parse the address user entered into address1, address2, city, state, zip and country and save into DB?</p>
| c# asp.net | [0, 9] |
192,830 | 192,831 | Float with either comma ',' or '.' | <p>I am experiencing a problem in Asp.net using C# when converting a string to float. At a local database, it works fine with '.' notation for float values but it does not work after uploading the website to the server. I think the server only understands ',' instead of '.'</p>
<p>I remember I read this somewhere that I can add some culture Info into the web.config in order to get float understand either '.' or ','</p>
<p>And how can I change it globally for a WinForm application? </p>
<p>Thanks in advance.</p>
| c# asp.net | [0, 9] |
2,051,109 | 2,051,110 | asp.net c# is checkbox checked? | <p>How do I determine if the checkbox is checked or not checked?
Very perplexed why this is not working - it is so simple!</p>
<p>On my web form:</p>
<pre><code><asp:CheckBox ID="DraftCheckBox" runat="server" Text="Save as Draft?" />
<asp:Button ID="PublishButton" runat="server" Text="Save" CssClass="publish" />
</code></pre>
<p>Code behind which runs in the click event for my save button:</p>
<pre><code> void PublishButton_Click(object sender, EventArgs e)
{
if (DraftCheckBox.Checked)
{
newsItem.IsDraft = 1;
}
}
</code></pre>
<p>When debugging it never steps into the If statement when I have the checkbox checked in the browser. Ideas?!</p>
<p><strong>I think there maybe some other code affecting this as follows...</strong></p>
<p>In Page_load I have the following:</p>
<pre><code>PublishButton.Click += new EventHandler(PublishButton_Click);
if (newsItem.IsDraft == 1)
{
DraftCheckBox.Checked = true;
}
else
{
DraftCheckBox.Checked = false;
}
</code></pre>
<p>newsItem is my data object and I need to set the checkbox checked status accordingly.
When the save button is hit I need to update the IsDraft property based on the checked status of the checkbox:</p>
<pre><code>void PublishButton_Click(object sender, EventArgs e)
{
if (IsValid)
{
newsItem.Title = TitleTextBox.Text.Trim();
newsItem.Content = ContentTextBox.Text.Trim();
if (DraftCheckBox.Checked)
{
newsItem.IsDraft = 1;
}
else
{
newsItem.IsDraft = 0;
}
dataContext.SubmitChanges();
}
}
</code></pre>
<p>So, isDraft = 1 should equal checkbox checked, otherwise checkbox should be un-checked. Currently, it is not showing this.</p>
| c# asp.net | [0, 9] |
3,823,088 | 3,823,089 | Load list of image from folder | <p>I have a folder of images, from 10 to 200, a webpage, a jquery fade and a php script that read folder full of images</p>
<p>Is there any way to make the php script scan a folder, get a list of image (in an array ?) and pass it to jquery script ? (first question)</p>
<p>Now, i can make a xml file from the result php list of files found or make a html <code><li></code> from the list in the html. is there ANY other way to do that ? (question #2)</p>
| php javascript jquery | [2, 3, 5] |
5,200,185 | 5,200,186 | android - best way to get a phone number with a name string such as "Bob" | <p>Goal: take results from recognizer stating a name in contacts, then dial their #.</p>
<p>Is their an intent that will do this without a page of code??</p>
<p>I have no hair left , as I have spent too much time reading/etc... PLEASE help??</p>
<p>Update:
I have learned basically to query base contact records with URI in ContactsContract.Contracts.CONTENT_URI as STEP #1 within @override OnCreate.</p>
<p>Then in OnActivityResults you must query the phone number table as they are separate , but you will need the user ID to get the # is why you 1st do step #1.</p>
<p>or can i avoid step #1 and just URI query the phone table?</p>
<p>THEN </p>
| java android | [1, 4] |
61,665 | 61,666 | jQuery - scroll down every x seconds, then scroll to the top | <p>I have a scrollable div that I want to scroll down 50 pixels every X seconds. That's fine and working.</p>
<p>I also have a seperate function that scrolls the div back to the top when it reaches the bottom. Also fine; working.</p>
<p>Now, I need to combine the two so the scrolldown is ignored until we have scrolled to the top again. </p>
<p>I have a 'working' example here, as you'll see it has some pretty nutty behavior: <a href="http://jsfiddle.net/JVftf/" rel="nofollow">http://jsfiddle.net/JVftf/</a></p>
<pre><code>window.setInterval(scrollit, 3000);
function scrollit() {
$('#scroller').delay(2000).animate({ scrollTop: $("#scroller").scrollTop() + 50 }, 'slow');
}
$('#scroller').bind('scroll', function () {
if ($(this).scrollTop() + $(this).innerHeight() >= $(this)[0].scrollHeight) {
$('#scroller').delay(2000).animate({ scrollTop: 0 }, 1000);
}
});
</code></pre>
| javascript jquery | [3, 5] |
5,538,112 | 5,538,113 | Why is JavaScript called JavaScript, if it has nothing to do with Java? | <p>Since JavaScript is not derived from Java, why does it have "Java" in the name?</p>
| java javascript | [1, 3] |
5,868,503 | 5,868,504 | Button back to main screen not working | <p>This problem I got is a little hard to explain but I simplify and make it as easy as possible. <br /> <br />
The Statement: <br />
As it is obvious in the following picture ,there are 9 divs which is sensitive to click and when you click in any of them another screen appears which is also obvious in second picture down here. <img src="http://i.stack.imgur.com/IDRPl.gif" alt="divs image"></p>
<p><br /></p>
<p>The Problem:
In the first DIV ,when I click back to Main Menu ,everything works fine but ,when I click on Second Div and click back to Main Menu ,the button doesn't work. I used the same backtoMain() method for both but obviously something is wrong.</p>
<p><img src="http://i.stack.imgur.com/0Hry9.gif" alt="second image"></p>
<p>The javascript code I use to make backToMainMenu button work: <br /></p>
<pre><code> function hideAllDivs () { /* the function that hides all divs */
jQuery('#thirdVision').hide();
jQuery('#forthVision').hide();
jQuery('#fifthVision').hide();
jQuery('#sixthVision').hide();
jQuery('#seventhVision').hide();
jQuery('#eightthVision').hide();
jQuery('#ninethVision').hide();
jQuery('#tenthVision').hide();
jQuery('#eleventhVision').hide();
//jQuery('#secondVision').show();
}
function returnToMenu () { /* the function that shows main screen which is secondVision */
hideAllDivs();
jQuery('#secondVision').show(1400); /* shows secondVision "First Picture" in 1 and a half second */
}
jQuery('#backToMain').click(function(e){ /* the function responsible for when "backtoMainMenu" button is clicked */
returnToMenu();
e.preventDefault();
});
</code></pre>
<p><br />
I've been working on it for about 3 days but couldn't figure out how to solve it.</p>
| javascript jquery | [3, 5] |
5,695,971 | 5,695,972 | Change dates inside span to match user's timezone | <p>I have this function:</p>
<pre><code>function get_time_zone_offset() {
var current_date = new Date();
return -current_date.getTimezoneOffset() / 60;
}
</code></pre>
<p>I want a jQuery code to change every span which class is 'timeago' title value to its value plus the number the function above returns. For example:</p>
<p>Before: </p>
<pre><code><span class="timeago" title="7/4/2012 9:28:30 AM">7/4/2012 9:28:30 AM</span>
</code></pre>
<p>After: </p>
<pre><code><span class="timeago" title="7/4/2012 12:28:30 PM">7/4/2012 12:28:30 PM</span>
</code></pre>
| javascript jquery | [3, 5] |
1,063,881 | 1,063,882 | Can I use a string as an Id? | <p>Still a Noob at Android Development..
So here's My Code</p>
<pre><code>for(int i=1;i<=6;i++){
for(int j=startat;j<=7;j++){
String constring = "r" + i + "c" + j;
//TextView dtv = (TextView) findViewById(R.id.constring); #commented this out
}
}
</code></pre>
<p>Is there a way I could use the string variable constring as an Id?</p>
| java android | [1, 4] |
5,531,126 | 5,531,127 | Mediaelementjs Is not working | <p>I am using Mediaelementjs.js for player. i have to play multiple song on a page and all the songs are coming dynamically. and there are multiple player on the page that is one for each song. and i have to play the song on click of a image not on the click of player button because the players are hidden. on image click following method is called and i am trying manually play the player. But its not showing any error and also not playing the song.</p>
<pre><code>function playAudio(id) {
jQuery('#audio' + id).get(0).play();
}
</code></pre>
| javascript jquery | [3, 5] |
2,546,196 | 2,546,197 | Javascript confirm without code in code behind | <p>I have a page with dynamically added imagebuttons, and i want them to send a confirm when you click them(for deletion).</p>
<p>Since they are dynamic i cant code anything in a .click event.</p>
<p>Hows the best way to do this? check if true or false and then send it to a delete function in code behind with the control as parameter? or any other way?</p>
<p>Thanks</p>
| javascript asp.net | [3, 9] |
4,062,206 | 4,062,207 | Calling a function as soon as an element is encountered | <p>Suppose I have an element on my page with id "some_id". I want to call a function as soon as I encounter this element. Something like following.</p>
<pre><code>$("#some_id").call_a_function(function () {
// do stuff
});
</code></pre>
| javascript jquery | [3, 5] |
1,222,164 | 1,222,165 | Jquery Change event for input and select elements | <p>I am trying to alert something when ever a drop down box changes and when ever something is typed into an input. I don't think I can use change for input fields? What would you use for input fields? Also, what about input fields of type file? Same thing. Here is what I have so far and its not working:</p>
<pre><code> $('input#wrapper, select#wrapper').change(function(){
alert('You changed.');
});
</code></pre>
<p>Thanks all</p>
| javascript jquery | [3, 5] |
2,424,309 | 2,424,310 | Best Books that shows how to use jQuery with ASP.NET | <p>I have searched the stackoverflow site to find if someone has recommended any good books that show how jQuery can be used with asp.net. All the threads lead to only good jQuery books. </p>
<p>Can anyone recommend me a good book that shows how to use jquery with asp.net? Any upcoming books are also ok</p>
| asp.net jquery | [9, 5] |
3,530,803 | 3,530,804 | window.scrollBy fires before hash/anchor scroll in Chrome and Safari | <p>Here's a frustrating problem. I use the following in script inside of a jQuery load block:</p>
<pre><code>window.scrollBy(0,-100);
</code></pre>
<p>I do it because I set a div to be fixed at the top of the page through scrolling, and this line will compensate so that the anchor you've clicked to (http://page.html#foo) is seen where it should be.</p>
<p>It works great in Firefox. In Chrome and Safari, it doesn't, because the load event appears to happen before the browser scrolls to the anchor.</p>
<p>Any suggestions?</p>
| javascript jquery | [3, 5] |
4,486,076 | 4,486,077 | How to organize Javascript and AJAX with PHP? | <p>My javascript is getting out of hand for my PHP application. I have 20 tags that link to various javascript files in a javascript folder.
Each javascript file basically controls one element on the DOM. And, if the javascript file uses AJAX, then it will have a corresponding PHP file that the AJAX will call.</p>
<p>For example, a js file might control a button on the page:</p>
<pre><code>$(document).ready(function () {
$("#button").live('click', function() {
$.ajax({
type: "POST",
data: ...
url: "button_click.php",
});
});
});
</code></pre>
<p>As you can see, this gets out of hand. What is the best way to organize all of the javascript?</p>
| php javascript jquery | [2, 3, 5] |
1,496,038 | 1,496,039 | How to make web site menus | <p>I want to make a menu on my website.<br>
If I move my mouse on it, the menu strip and its item will appear; if I move out of the menu the items disappear and only the menu name will remain.
Using visual web developer 2008 express edition and c#.<br>
Can any one help me?</p>
| c# asp.net | [0, 9] |
2,813,374 | 2,813,375 | Add a calendar event using a webpage button via webview | <p>I want to use a webview to pull up a page and on it is a label of an event and a button that says add to calendar. When pushed it will add the details of the event to the google cal on the android phone. </p>
<p>I am attempting to use content values but with no luck as of yet. This is what I have but I am open for suggestions. I think I have read every post on stackoverflow concerning this so I am looking for something new or more complete than whats been posted already. </p>
<pre><code>public class button7 extends Activity{
WebView wb = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.buttons);
wb = new WebView(this);
wb.setWebViewClient(new HelloWebViewClient());
wb.getSettings().setJavaScriptEnabled(true);
wb.loadUrl("http://whatever website.com");
setContentView(wb);
}
private class HelloWebViewClient extends WebViewClient {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
SetCalenderEntry(1,"Test","Is this working","At home");
return true;
}
}
private void SetCalenderEntry(int i, String subject, String body, String location)
{
ContentValues event = new ContentValues();
event.put("calendar_id", i);
event.put("title", subject);
event.put("description", body);
event.put("eventLocation", location);
long startTime = System.currentTimeMillis() + 1000 * 60 * 60;
long endTime = System.currentTimeMillis() + 1000 * 60 * 60 * 2;
event.put("dtstart", startTime);
event.put("dtend", endTime);
Uri eventsUri = Uri.parse("content://calendar/events");
getContentResolver().insert(eventsUri, event);
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && wb.canGoBack())
wb.goBack();
return super.onKeyDown(keyCode, event);
}
}
</code></pre>
| java android | [1, 4] |
2,312,161 | 2,312,162 | How do I get the browser scroll position in jQuery? | <p>I have a web document with scroll. I want to get the value, in pixels, of the current scroll position. When I run the below function it returns the value zero. How can I do this?</p>
<pre><code><script type="text/javascript" src="js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script type="text/javascript">
$(function (){
$('#Eframe').on("mousewheel", function() {
alert(document.body.scrollDown)
}
})
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,280,960 | 4,280,961 | textbox required equal false | <p>how do I make the textbox that required equal to false in this code </p>
<pre><code>$(document).ready(function () {
$("#<%= chkSpecialIntegration.ClientID %>").click(function () {
if (this.checked) {
$("#<%= ddlTypeSpecialIntegration.ClientID %>").show();
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = false; }
else{
$("#<%= ddlTypeSpecialIntegration.ClientID %>").hide();
document.getElementById('<%=txtTotalScoreDebit.ClientID %>').Required = true;
}
});
});
</code></pre>
| c# javascript | [0, 3] |
4,331,123 | 4,331,124 | Android application : how to manage handwriting input? | <p>I just want to know if there is some existing libraries to manage handwriting input/recognition?
I want to develop an application in which the user could write his text with a srylus, and not with a keyboard. I did research on Google and didn't find anything efficient for that.</p>
<p>Thank you, </p>
| java android | [1, 4] |
3,181,789 | 3,181,790 | Show a random quote on asp.net web page | <p>I'm working on an ASP.NET (C#) web project that is using master pages.</p>
<p>I'm looking for an easy way to display a random customer quote each time a page is loaded. </p>
<p>Since this is a fairly simple web project I'd like to stay away from storing the quotes in a database. Currently there is no database connections required for the project so I'd like to keep it as simple as possible -- perhaps storing the quotes in an XML file them using an XmlTextReader to read the file?</p>
<p>Any advice is appreciated.</p>
<p>Thanks</p>
<p><strong>Edit:</strong> I will need to store and pull both a quote and a customer name for the quote. </p>
| c# asp.net | [0, 9] |
5,901,512 | 5,901,513 | 3d games in android | <p>i want to create 3d games for android but i don't have any information about that. i want to do this in most advanced way like big companies. "most advanced way" means i don't use simple tools that rapidly return result but there is no way to creativity and CREATION. I need an standard way with complete resources and so on...</p>
<p>i want to know this too:
1- i need a game engine or i can create games with my own engine? how?
2- [important] i need to learn 3D Max or Maya etc...? </p>
<p>Every guidance will push me forward. Thanks </p>
| java android | [1, 4] |
4,162,256 | 4,162,257 | Difference Between commit and apply in Android SharedPreferences | <p>SharedPreferences are used to save Application data in Android.</p>
<p><code>commit()</code> and <code>apply()</code> both are used to save the changes in the shared preferences.</p>
<p>As mentioned in Android Library:</p>
<pre><code>public abstarct void apply():
</code></pre>
<blockquote>
<p>Unlike commit(), which writes its preferences out to persistent
storage synchronously, apply() commits its changes to the in-memory
SharedPreferences immediately but starts an asynchronous commit to
disk and you won't be notified of any failures. If another editor on
this SharedPreferences does a regular commit() while a apply() is
still outstanding, the commit() will block until all async commits are
completed as well as the commit itself.</p>
</blockquote>
<pre><code>public abstract boolean commit ():
</code></pre>
<blockquote>
<p>Commit your preferences changes back from this Editor to the
SharedPreferences object it is editing. This atomically performs the
requested modifications, replacing whatever is currently in the
SharedPreferences.</p>
</blockquote>
<p>Does this mean that the changes made by <code>commit()</code> are instant as compared with <code>apply()</code>? Which one is better?</p>
<p>If I need to use the same shared preference value in the next immediate activity, which one should I use? As I have seen if the value of Preference is updated it is not reflected till the application is restarted.</p>
| java android | [1, 4] |
2,630,611 | 2,630,612 | use javascript variable into python Block | <p>I want to use JavaScript variable into python Block.</p>
<pre><code><script>
$(document).ready(function() {
$("#WO_cpp_id").change(function() {
id = this.selectedIndex;
ajax('{{=URL(r=request,f='get_CIs',vars={'CPP_Id':'#here I want to use id variable')}}', ['WO_cpp_id'], 'WO_ci_id');
})
.change(); }); </script>
</code></pre>
<p>Thanks in Advance</p>
| javascript jquery python | [3, 5, 7] |
2,636,237 | 2,636,238 | jquery mouseenter fires continuosly | <p>I have a mousenter/mouseleave function that swaps out content when the element is being hovered over. however instead of it firing only on mouseenter it seems to keep continuously firing. I have created a jsfiddle <a href="http://jsfiddle.net/NCR4m/9/" rel="nofollow">here</a> so hopefully it will be easier to understand. </p>
| javascript jquery | [3, 5] |
3,323,754 | 3,323,755 | Jquery show img title in span | <p>I want show the image title in a span tag, I use this code, but there has nothing show in the span tag.</p>
<pre><code><script type="text/javascript" src="jquery-1.4.2.min.js" ></script>
<script type="text/javascript">
jQuery(document).ready(function( {
$('#thumb ul li a img').fadeIn(function() {
var $this = $(this);
$this.next('.showtitle').append($this.attr('title'));
});
});
</script>
...
<div class="thumb" id="thumb">
<ul class="ul">
<?php
$result = mysql_query("SELECT * FROM ...");
$strstr=1;
while ($row = mysql_fetch_array($result))
{
echo '<li class="li"><a href="' . $row['link']. '"><img src="'.$row['image'].'" title="'.$row['title'].'" class="img'.$strstr.'" /></a><span class="showtitle" /></li>';
$strstr++;
}
?>
</ul>
</div>
</code></pre>
<p>I have checked, the title is not empty in the database. How to write correctly? Thanks.</p>
| php jquery | [2, 5] |
3,341,209 | 3,341,210 | How to tell JavaScript to do nothing? | <p>I have a small chunk of code, like this:</p>
<pre><code>$("div.footerMenu li").click(
function () {
$("div.onScreen").hide();
$(this).children("div.onScreen").fadeIn('fast');
},function(){
$("div.onScreen").hide();
});//click
</code></pre>
<p>And when I click on < li > the div .onScreen shows nicely, but when i click on this div, that just showed up the functions is hiding in and showing again, but I dont want it to execdute this function again. So my question is: How can i somehow "detach/exclude/hide" this div from Javascript?</p>
<p>Im sorry for silli question, but that's beyond my skills :(</p>
<p><strong>update:</strong></p>
<p>The thing is that with this method and with others with .one() the rest of menu is not working. There is the site with the problem <a href="http://tnij.org/j7s1" rel="nofollow">tnij.org/j7s1</a> . I want this div that shows up stay there, when i click on it, but when i click on ther items <code><li></code> i want to other div's (submenus) to show up (warning - big images on that site ) -</p>
<p>the html looks like this: <ul> <li>HOME</li> <li>PLENER </li> <li>STUDIO </li> <li>INNE </li> </ul> </p>
| javascript jquery | [3, 5] |
1,246,672 | 1,246,673 | java.text.parseexception unparseable date in android | <pre><code>String dt=mDateButton.getText().toString();
String tm =mTimeButton.getText().toString();
try {
String format ="dd-MM-yyyy hh:mm a";
DateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
String v_date_str = dt + " " + tm;
// String setDate =sdf.format(dt + " " + tm);
Date v_date = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH).parse(v_date_str );
DateFormat formatter = null;
formatter = new SimpleDateFormat("dd-MMM-yyyy");
Log.d("sset: ", ""+formatter.format(v_date));
} catch (ParseException e) {
e.printStackTrace();
}
</code></pre>
<p>Note: where dt = 2013-03-02 and tm = 21:54 . but i got an error on 9th line. i dont know what's the reason. please help me to get out of this problem. thank you in advance.</p>
| java android | [1, 4] |
5,392,008 | 5,392,009 | jQuery 1.2.6 caching | <p>I'm doing quite a bit of DOM manipulation in my app, adding new nodes, and I've found that the children() function can get out of sync. I've got a tbody element with two rows, I use the children() function on this to do some manipulation with these rows. I then add two more rows to the tbody, when I use the children function again to do more manipulation I only get back the original two rows, not these plus the two rows I've just added. I'm doing a new call to children every time, not relying on any variable to auto-update. Is there any way to clear jQuery's cache - I've noticed problems like this a few times with selectors and got around it by selecting further up the DOM tree then navigating back down (i.e. don't select the tbody with a jQuery CSS selector, select the table then do table.tBodies[0].rows), but that won't work in this case.</p>
<p>Thanks,
Phil</p>
| javascript jquery | [3, 5] |
2,008,353 | 2,008,354 | javascript variable in quoted php code in javascript | <p>the title sounds weird, but here's my question.
I am making this loop in Javascript that needs to call PHP variables. </p>
<pre><code> var data = new Array("<?php echo count($result) ?>");
for (var i=0; i < "<?php echo count($result) ?>"; i++) {
data[i] = "<?php echo $result[i] ?>";
}
</code></pre>
<p>The third line is the problem.
I tried </p>
<pre><code> data[i] = "<?php echo $result [" + i + " ] ?>";
</code></pre>
<p>but it didn't work.</p>
<p>Any clever tip to solve this??</p>
| php javascript | [2, 3] |
1,191,794 | 1,191,795 | Jquery autocomplete .NET WebMethod | <p>I have Jquery autocomplete working with a HttpHandler - .ashx file. It works fine, I am wondering is there an easy way to use the autocomplete with a [WebMethod] right in the code behind - and are there any advantages to this? </p>
| c# jquery asp.net | [0, 5, 9] |
2,200,825 | 2,200,826 | stop() before a highlight is causing the color to not reset | <p>I have the following:</p>
<pre><code>$('#list_item_title', this).stop().effect('highlight', {color: '#8DD2F7'}, 700);
</code></pre>
<p>This occurs when a user tries to submit with 0 input.length. If the user presses enter several times, the highlights stack up which is why I added stop. Problem now is that the animation stops and the input color is a variation of the highlight color and not the neutral white background.</p>
<p>Any ideas? </p>
| javascript jquery | [3, 5] |
3,575,149 | 3,575,150 | Design tool for ASP.Net Pages | <p>I am looking for some tool so that I can design my web pages(layout, color etc...). Does anything exist like that? (Other than Visual Studio, Dreamweaver...)
(I dont want to write css for now)</p>
| c# asp.net | [0, 9] |
714,883 | 714,884 | How do i manipulate select box using jquery? | <p>I have some select boxes like the following:</p>
<pre><code><select id="my_box1" rel="cal_10">
<option value="A"></option>
</select>
<select id="my_box2" rel="cal_10.50">
<option value="A"></option>
</select>
....
<select id="my_boxn">
<option value="B"></option>
</select>
</code></pre>
<p>On changing, I want to add the related value (that is 10 and 10.50) only when the select boxes has the same option value.</p>
<p>For Example: if the first and second select box has option value as A, then I want to add it.</p>
<p>How can I do this using jQuery?</p>
| javascript jquery | [3, 5] |
5,764,036 | 5,764,037 | Can't add listeners to CalendarView events | <p>There is the following code:</p>
<pre><code> final CalendarView calendarView=(CalendarView)layout.findViewById(R.id.calendarView);
calendarView.setClickable(true);
calendarView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getActivity(), "Click", Toast.LENGTH_LONG).show();
}
});
calendarView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
Toast.makeText(getActivity(), "Touch", Toast.LENGTH_LONG).show();
return false;
}
});
calendarView.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Toast.makeText(getActivity(), "Long click", Toast.LENGTH_LONG).show();
return false;
}
});
</code></pre>
<p>I haven't got any messages yet. I need to set listeners for click by Date. I know about OnDateChangeListener, but it will work only if user changes the date, but if user clicks by the same date I haven't got any messages. Please tell me, how can I set listeners for click by dates. Thank you in advance. </p>
| java android | [1, 4] |
3,131,552 | 3,131,553 | Convert separator to enter character | <p>My SQL query retrieves one row of multiple columns. I have stored that in string with '|' separator to differentiate between columns.</p>
<p>And then prints that string in <code><textarea></code> field of <code>.aspx</code> page. </p>
<p>My question is there any way in which after that | separator next column comes in next line in textarea? Just like pressing <kbd>Enter</kbd> key?</p>
<p>Code:</p>
<pre><code>dtOutput = Generix.getData("dbo.EventMsg E Left Join dbo.ATMStatusHistory A On E.Code=A.Fault", "Distinct E.Fault_Short_Name", "A.Code In (" + sFaultNumber + ") And IsNull(Fault_Short_Name,'')<>''", "", "", 1);
sOtherFaults = "";
foreach (DataRow drOutput in dtOutput.Rows)
{
foreach (DataColumn dcOutput in dtOutput.Columns)
{
sOtherFaults += ((sOtherFaults == "") ? "" : ":") + Convert.ToString(drOutput[dcOutput]);
}
}
sOutput += "|" + sOtherFaults + "|" + sClosedFault + "|" + sTemp + "|";
Response.Write(sOutput);
</code></pre>
| c# asp.net | [0, 9] |
2,824,576 | 2,824,577 | change image url during runtime | <pre><code><asp:Image id="voteaccepeted"
ImageUrl="~/UserControls/Vote/Images/before_accept.png"
runat="server" class="vote-accept" />
</code></pre>
<p>i want to change image url during run time</p>
<pre><code>if( bestanswer == true)
{
// change url..
}
</code></pre>
<p>how i do it.</p>
| c# asp.net | [0, 9] |
2,499,061 | 2,499,062 | jquery binding a key value pair | <p>Hi I am using spring mvc in my application. The service returns a json response like,</p>
<pre><code>[
{
"Key1": "value1"
}
]
</code></pre>
<p>I need to bind only the value part from the response to a drop down list in a jquery dialog. i use an AJAX call to get the list of items and bind it. But it binds the whole row in the drop down list</p>
<p>The code I used for binding the response is</p>
<pre><code> <script type="text/javascript">
$(function() {
$
.ajax({
type : "GET",
url : "countries/getname",
contentType : "application/json; charset=utf-8",
dataType : "json",
success : function(msg) {
alert("MSG:"+msg);//this gives {"Key1": "value1"}
$.each(msg,function(key, val) {
alert("KEY::"+key);//key is returned as 0
alert("VALUE::"+val);//value is returned as{"Key1": "value1"}
$('<option />', {value: key, text: val}).appendTo("#sampleResp");
});
},
error : function() {
$("#sampleResp").get(0).options.length = 0;
$("#sampleResp").get(0).options[0] = new Option(
"None", "None");
}
});
});
</script>
</code></pre>
<p>The value field is the item and it has { "Key1": "value1"}. SampleResp is the ID of the dropdownlist </p>
<p>the jsp code is</p>
<pre><code><div>
<form:select path="sampleResp" cssClass="w200">
</form:select>
</div>
</code></pre>
<p>How to extract only the value part from the response and bind it in drop down using ajax call in jquery? Please help.</p>
| javascript jquery | [3, 5] |
4,403,065 | 4,403,066 | templating/partials with jquery? | <p>I want to generate something similar to a facebook wall type effect and everytime a post is created the wall is updated. I have built out how i would like the css/html to look with php but i want to do it through ajax now.</p>
<p>My question- Is their such a thing as jquery partials? like a view i can push into my html page. As my update statement has gone from </p>
<pre><code>sel.prepend('<li id="'+response[i].post_id +'"> ' + response[i].title + '</li>');
</code></pre>
<p>With my html below it will take a bit more to update the page</p>
Post Appearance
imgs/t_silhouette.jpg"/>
Users Name
title?>
img_url?>'/>*/?>
img_url?>"/>
link?>">link_title?>
link_caption?>
message?>
/imgs/cog.gif') no-repeat;margin-right:5px;">
Like · Comment · 7 March at 19:08 via APPNAME
| javascript jquery | [3, 5] |
4,027,214 | 4,027,215 | jQuery + setTimeout() + clearTimeout() not working in IE7 & 8 | <p>This works in Firefox and Chrome but not in IE.</p>
<p>In Internet Explorer the timers are not being cleared out and it appears each time update_slideshow() is called a new timer is created.</p>
<pre><code>// slideshow params
var currentSlide = 1;
var numSlides = 4;
var pause = false;
function pause_show(bool){
pause = bool;
}
// transitions the slides
function update_slideshow(slide){
if(slide > numSlides) slide = 1;
//is user tyring to pause/play this slide
if(currentSlide == slide){
switch(pause){
case false:
$("#ssbut" + slide.toString()).removeClass('pause').addClass('play');
pause = true;
break;
case true:
$("#ssbut" + slide.toString()).removeClass('play').addClass('pause');
pause = false;
break;
}
}else{ //user clicked on a button other than the current slide's
clearTimeout(slideTimer);
function complete() {
$("#slide" + slide.toString()).fadeIn(500, "linear");
if(!pause)
$("#ssbut" + slide.toString()).removeClass('inactive').addClass('pause');
else
$("#ssbut" + slide.toString()).removeClass('inactive').addClass('play');
}
$("#ssbut" + currentSlide.toString()).removeClass('play').addClass('inactive');
$("#slide" + currentSlide.toString()).fadeOut(300, "linear", complete);
currentSlide = slide;
if (typeof(slideTimer) != 'undefined') clearTimeout(slideTimer);
slideTimer = setTimeout("slideshow()",4000);
}
}
function slideshow(){
if (typeof(slideTimer) != 'undefined') clearTimeout(slideTimer);
if(!pause){
update_slideshow(currentSlide + 1);
}
slideTimer = setTimeout("slideshow()",4000);
}
var slideTimer = setTimeout("slideshow()",4000);
</code></pre>
| javascript jquery | [3, 5] |
1,767,999 | 1,768,000 | sharing a js functions between code in 2 files | <p>My jquery code is divided file is divided over 2 files. </p>
<p>In one of the file, I define a function</p>
<pre><code>function something(input){
//does something
}
</code></pre>
<p>calling this function only works when the caller line is in the same file. But I need to call it from both files. </p>
<p>If I switch the function to the second file, again I get the same issue. The code in the same file can read it, but not the code in the other file. </p>
| javascript jquery | [3, 5] |
3,532,066 | 3,532,067 | automatic scroll down on search | <p>I have a jsp page in which there are some contents which are hidden.</p>
<p><code>onclick</code> of the search button I have displays much content.</p>
<p>But I want an automatic scroll down so that user doen't have to take the burden to scroll down.</p>
<p>I hope I was</p>
| javascript jquery | [3, 5] |
3,294,642 | 3,294,643 | Pass a javascript variable to html. jQuery | <p>I have a variable in Javascript: </p>
<pre><code>var test ="whatever"
</code></pre>
<p>I just want to pass this variable inside a hidden input:</p>
<pre><code><input type="hidden" class="myinput" value="">
</code></pre>
<p>I tried:</p>
<pre><code>$('.myinput').attr('test');
</code></pre>
<p>But it does not seem to work.</p>
<p>Thank you for your help.</p>
| javascript jquery | [3, 5] |
4,184,996 | 4,184,997 | Javascript / jQuery flick between two images | <p>I'm struggling with the timer part. I can replace one image with another easily with javascript by calling the function. What I want to be able to do is set a timer to sit and change the images at a specific interval (say 1 second).</p>
<p>I've used jQuery to refresh an image every second before, but when I try and add a function inside to change the image, it just hangs.</p>
| javascript jquery | [3, 5] |
4,971,721 | 4,971,722 | Height div and image | <p>i have a problem with a div height. I have an image in a left div "image_view" and the height of this div is dinamically based on image.
On the right side I have a div with some informations. This div must have the same height of the image_view div. how can I do it?
This is my code now.</p>
<pre><code><div id="image_view">
<img src="<?php echo base_url().'upload/images/'.$nome_immagine; ?>" />
</div>
<div id="info_image" style="height:<?php echo $altezza.'px'; ?>">
content of this div
</div>
</code></pre>
<p>Thanks</p>
| php jquery | [2, 5] |
134,129 | 134,130 | Call a function only once | <p>I've 3 divs (<code>#Mask #Intro #Container</code>) so if you click on Mask, Intro gets hidden and Container appears.
The problem is that I just want to load this only one time, not every time I refresh the page or anytime I click on the menu or a link, etc.</p>
<p>How can I do this?</p>
<p>This is the script I'm using for now:</p>
<pre><code>$(document).ready(function(){
$("div#mask").click(function() {
$("div#intro").fadeToggle('slow');
$("div#container").fadeToggle('slow');
$("div#mask").css("z-index", "-99");
});
});
</code></pre>
<p>Thank you!</p>
| javascript jquery | [3, 5] |
2,271,225 | 2,271,226 | Javascript execute timer function only if window is in focus? | <p>Say I have two separate browser windows open:</p>
<pre><code>function onload() {
setTimeout("dosomething", 2000);
}
function dosomething() {
$.ajax({
url: "someurl",
success: function (data) {
document.write("Hello");
}
});
setTimeout("dosomething", 2000);
}
</code></pre>
<p>I want to make it so that hello is printed every two seconds only when the window is in focus. If the window is not in focus, then the timer would essentially pause (in other words, timer would stop ticking, dosomething would not be called) until the user clicks on the browser window that is not in focus, which the timer would resume and the Hello words would continue to be printed, while the other window would stop timer, vice versa.</p>
<p>How do I accomplish this?</p>
| javascript jquery | [3, 5] |
2,028,715 | 2,028,716 | android reading user input in a service | <p>I want to write an android app that would be a background service that would listen for either a specific gesture or key press in the and then trigger an action. Is it even possible to do such a thing with a service? If so could someone guide me the right direction. I have search high and low can could seem to find an answer.</p>
| java android | [1, 4] |
2,764,019 | 2,764,020 | Jquery, to set the display of an element width to block | <p>I'm looking to code the jquery to set the display of an element width id "results" to block?</p>
<p>Not sure if it's right, sorry im new to programming, help will be appreciate, thank you.</p>
<pre><code>$(document.ready(function(){
$('results').width(display:none;);
})
</code></pre>
| javascript jquery | [3, 5] |
1,206,729 | 1,206,730 | jquery attached event with class execute more than once | <p>I have some div`s with same class say:</p>
<pre><code><div id="1" class="same">..</div>
<div id="2" class="same">..</div>
<div id="3" class="same">..</div>
</code></pre>
<p>I attach eventhandler all div :</p>
<pre><code>$(".same").live({mouseenter : function{ /*code*/ },mouseout: function{ /*code*/ }})
</code></pre>
<p>Now my problem is when mouseenters to div <code>(id="1")</code> , the code for mouseenter function will executes 3 time may be because there are 3 divs with <code>class="same"</code> but i want it to execute only one time and without attaching the events with ids. Is this possible?</p>
| javascript jquery | [3, 5] |
913,387 | 913,388 | How can I edit JS from browser? | <p>Suppose I get, on a page, this simple html/script :</p>
<pre><code><a id="hey" href="#">try</a>
var myvar=false;
$('#hey').click(function () {
if(myvar)
{
alert("Well! You change it!");
}
});
</code></pre>
<p>clicking on the link, I won't never get the alert show up! So, how can I edit JS (changing <code>myvar=true;</code>) on browser? I use Firebug... I need these details to test a security-side of my own application.</p>
| javascript jquery | [3, 5] |
138,339 | 138,340 | to get checked items from listview and store it in array | <p>I am new to android..please help me.
how to get the checked items from listview and store it an array and display it in another listview in the next layout in the same activity?pls help....</p>
| java android | [1, 4] |
4,407,432 | 4,407,433 | Extend custom System.Web.UI.Page implementer to include custom property than can be accessed by page and master page | <p>I have created a class called BasePage which inherits System.Web.UI.Page. On this page I've declared a property called UserSession which I want to be able to access from any Page/MasterPage. </p>
<pre><code>public class BasePage : System.Web.UI.Page
{
string UserSession { get; set; }
public BasePage()
{
base.PreInit += new EventHandler(BasePage_PreInit);
}
private void BasePage_PreInit(object sender, EventArgs e)
{
UserSession = "12345";
}
}
</code></pre>
<p>My Default.aspx.cs page inherits the BasePage class and allows me to access the UserSession property as expected.</p>
<pre><code>public partial class Default : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(UserSession);
}
}
</code></pre>
<p>However, even though Default.aspx has MasterPage.Master assigned correctly, when I try and access the UserSession property from MasterPage.Master.cs it can't find it and won't build.</p>
<p>So what am I trying to achieve by doing this? I want to expose a UserSession object to every page in my application. Pretty simple you would have thought? Nope.</p>
| c# asp.net | [0, 9] |
4,909,757 | 4,909,758 | sort a dictionary (or whatever key-value data structure in js) on word_number keys efficiently | <p>how do I sort a dictionary by key like</p>
<pre><code>dict["word_21"] = "Hello Java";
dict["word_22"] = "Hello World";
dict["word_11"] = "Hello Javascript";
</code></pre>
<p>so that I get </p>
<pre><code>dict["word_22"] = "Hello World";
dict["word_21"] = "Hello Java";
dict["word_11"] = "Hello Javascript";
</code></pre>
<p>There are word_number combinations on indices only and the values are strings. The indices are distinct (no equal values) but could be "undefined" in an error case</p>
<p>Edit: Actually I need the descending and ascending order of it. But the descending order is what I need at the moment.</p>
| javascript jquery | [3, 5] |
4,390,017 | 4,390,018 | Java: Do global variables save memory and/or time? | <p>I am working on an Android app and a method I am writing might get called a bunch of times. In this method I am making updates to the user interface. Memory use and performance are important to me. The way I see it, I have 2 options for making the UI changes. </p>
<p>The first is to makes new objects every time. That is to say something like:</p>
<pre><code>public void myMethod(){
new View().makeVisible();
}
</code></pre>
<p>The second is to declare the object as a variable globally and reference it in the method. This might look like:</p>
<pre><code>View myView = new View();
public void myMethod(){
myView.makeVisible();
}
</code></pre>
<p>Obviously the if this method only called a few times any difference is going to be small. However if I am potentially calling this many times, and there are many variables being call/or created this way, does the second way increase performance?</p>
| java android | [1, 4] |
474,044 | 474,045 | How read a local xml file in android | <p>I am trying to read a local xml file from res/xml/myxml.xml
This is the xml,</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<Books>
<Number id ="1">
<Description>This is science book.
</Description>
</Number>
<Number id = "2">
<Description>This is about cooking.
</Description>
</Number>
</Books>
</code></pre>
<p>Here is the code,</p>
<pre><code>XmlResourceParser pars = res.getXml(R.xml.myxml);
while (pars.getEventType() != XmlResourceParser.END_DOCUMENT) {
if (pars.getEventType() == XmlResourceParser.START_TAG) {
if(pars.getName().equals("Number")) {
int id = pars.getAttributeIntValue(null, "id", 0);
}
}
pars.next();
}
pars.close();
</code></pre>
<p>The above code returns the last id of the xml.
How can I check to see if the id == certain integer, than display the description in the textview.
Sorry I am new to android and java. I will really appreciate your help.
Thanks</p>
| java android | [1, 4] |
1,173,969 | 1,173,970 | Change viewpager item based on click event of viewpagerindicator icon | <p>I am using Viewpager and viewpagerindicator to display some content. Currently if we swipe the indicator selected item will change. But I want the vice versa i.e when I click on circle I need to change viewpager item.</p>
<p>Here is the code</p>
<pre><code> <android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
app:fillColor="#FFCC0000"
app:snap="true"
/>
</code></pre>
| java android | [1, 4] |
4,134,832 | 4,134,833 | Nothing happens when using Regex in asp.net | <p>Regex really does nothing if i run this code:
input contains: "geeeeekdldn" </p>
<pre><code>Regex.Replace(input, @"g(.|\n)*?n", string.Empty);
</code></pre>
<p>normally after regex the value of input is "" but i still get "geeeeekdldn"
can someone help me please</p>
| c# asp.net | [0, 9] |
2,927,878 | 2,927,879 | Select value of a RadioButton | <p>I want to select a particular RadioButton based on its value</p>
<pre><code><input id="RadioJ" type="radio" name="grp1" value="AAA" />
<input id="FaroK" type="radio" name="grp1" value="BBB" />
<input id="MartreLK" type="radio" name="grp1" value="CCC" />
</code></pre>
<p>Something like this:</p>
<p>var radio = radio button whose value is BBB</p>
<p>Another thing i am looking is that if a button is clicked, all the radiobuttons which are hidden should be visible.</p>
| javascript jquery | [3, 5] |
2,586,513 | 2,586,514 | Android HTTP request | <p>In my app I need a feature that means users can email me by filling in a field. This sends via a HTTP request to a PHP script on my server. This then grabs the message and emails me.</p>
<p>What I need to be able to do if it is even possible is to have a way for the PHP script to confirm that the request originates from a Android device or even better a mobile device.</p>
<p>Any help appreciated.</p>
| java php android | [1, 2, 4] |
3,862,560 | 3,862,561 | Error when exporting data to PDF from C# | <p>I am writing a PDF file from C# like this:</p>
<pre><code>Response.ContentType = "application/vnd.pdf";
Response.AddHeader("content-disposition", "attachment;filename=test.pdf");
Response.Write("<table border='1px'>");
/* Print Headers */
Response.Write("<tr>");
Response.Write("<th colspan='" + colspan + "'style='background-color:SlateGray;font-size:16;height:25;color:white;'><b>List of Candidates "</b></th>");
Response.Write("</tr>");
Response.Write("<tr>");
</code></pre>
<p>When I save the file and open it, it throws an exception that file is not supported file type .. or file has been damaged.</p>
| c# asp.net | [0, 9] |
3,154,780 | 3,154,781 | Get Phone Number in Android SDK | <p>Is there a way to get the phone that is running my app's number within the app?</p>
| java android | [1, 4] |
3,318,888 | 3,318,889 | jQuery's dialog plugin | <p>What's the point of storing the ui-dialog-title object in the uiDialogTitle variable, if the variable is never used anywhere in code?</p>
<pre><code> uiDialogTitle = $('<span></span>')
.addClass('ui-dialog-title')
.attr('id', titleId)
.html(title)
.prependTo(uiDialogTitlebar);
</code></pre>
| javascript jquery | [3, 5] |
3,629,037 | 3,629,038 | How can I intercept the F5-button-clicked event using jQuery? | <p>I want to implement keyboard shortcuts using jQuery.</p>
<p>Specifically, I want to fire an event when e.g. F5 is clicked.</p>
<p>What kind of issues do you run into with keyboard shortcuts?</p>
<p><b>Also, any online chart that has all the keyboard mappings to numbers?</b></p>
| javascript jquery | [3, 5] |
90,850 | 90,851 | How to create an instance of an object in c# | <p>Greeting for the day!</p>
<p>I have a question in my mind and looking for answer from some days.
If my understanding is correct then only diff between Instance and object is :-</p>
<p>instance means just creating a reference(copy) .</p>
<p>object :means when memory location is associated with the object( is a runtime entity of the class) by using the new operator</p>
<p>Now i want to know how to create an instance of an object.
Please give explanation with sample code</p>
<p>Any help will be appreciated.
Thanks</p>
| c# asp.net | [0, 9] |
2,521,334 | 2,521,335 | getLocationOnScreen crashes, pls help | <p>I need to get the coordinates of my app on screen to use them as an offset for a popout.</p>
<pre><code> View tempView = (View) findViewById(R.layout.main);
int[] loc = {0,0};
tempView.getLocationOnScreen(loc); /// crashes here!
</code></pre>
<p>Tried this code, but the last line of it makes the app crash. Maybe the tempView I'm getting from the main layout somehow doesn't correspond with the layout on screen?</p>
<p>Any suggestions... thanks! :)</p>
<hr>
<p>added:
solved</p>
<pre><code> int[] loc = new int[2];
View tempView = (View) findViewById(R.id.LL_whole);
tempView.getLocationOnScreen(loc);
post( String.valueOf(loc[1]) );
</code></pre>
<p>works! :)</p>
| java android | [1, 4] |
5,391,788 | 5,391,789 | What is different between HttpCacheability.NoCache and Response.CacheControl = "no-cache"? | <p>what is the different between the two lines below? :</p>
<pre><code>Response.Cache.SetCacheability(HttpCacheability.NoCache);
</code></pre>
<p>and</p>
<pre><code> Response.CacheControl = "no-cache";
</code></pre>
| c# asp.net | [0, 9] |
4,531,990 | 4,531,991 | jquery unbind toggle event don't work | <p>i have a div element generate in runmode by javascript
I want first click show confirm message and next click remove click event
but die or unbind don't work!</p>
<pre><code>$('div').live('click',function(e) {
$(this).toggle(function () {
$(this).html("I'm sure!");
return false;
},
function (e) {
$(this).html("Deleting...");
$(this).die('click').die('click');
}).trigger('click');
});
</code></pre>
| javascript jquery | [3, 5] |
5,270,051 | 5,270,052 | Howcome refreshing my web app with F5 is extremely slow and hangs, while hitting enter on the address bar refreshes the page instantly? | <p>I have a web page which uses in PHP and a jQuery DataTable to show data from a database.</p>
<p>When I enter the URL and hit enter, the page loads instantly, and I can do this repeatedly and the page keeps loading instantly.</p>
<p>However, when I hit F5, the page goes blank and hangs, it is trying to load the page but is just too slow.</p>
<p>What would be causing this?</p>
| php javascript jquery | [2, 3, 5] |
1,898,987 | 1,898,988 | How to get the class names using jquery? | <p>Hey, I'm wondering how I can get the class names dynamically using jquery for the script below.</p>
<p>The HTML output looks like this:</p>
<pre><code><div id="main-info-1" class="maini">
<p>this is a paragraph.</p>
</div>
</code></pre>
<p>So, I'm trying to get the class name dynamically instead of hard coded like it is above.</p>
<p>There are two parts where I need to get the class names in the jquery script:</p>
<pre><code>1.) pc.children('div.maini').remove();
2.) maini_s = $('div.maini').remove();
</code></pre>
<p>As you can see the class 'maini' is hard coded and im unsure how to get the class name dynamically and put it properly in the script.</p>
<p>The jQuery file:</p>
<pre><code><script type="text/javascript">
// make them global to access them from the console and use them
// in handlePaginationClick
var maini_s;
var num_of_arts;
var ipp;
function handlePaginationClick(new_page_index, pagination_container) {
var pc = $(pagination_container);
pc.children('div.maini').remove();
for(var i=new_page_index*ipp; i < (new_page_index+1)*ipp ;i++) {
if (i < num_of_arts) {
pc.append(maini_s[i]);
}
}
return false;
}
$(document).ready(function() {
maini_s = $('div.maini').remove();
num_of_arts = maini_s.length;
ipp = 3;
// First Parameter: number of items
// Second Parameter: options object
$("#News-Pagination").pagination(6, {
items_per_page:ipp,
callback:handlePaginationClick
});
});
</script>
</code></pre>
<p>Any help on this would be awesome, thank you.</p>
| javascript jquery | [3, 5] |
1,583,314 | 1,583,315 | Unable to Get Ip address of the http request : Asp.Net [C#] | <p>I have a page, on which a request from other website drops in. I want to track IP address where the request is coming.</p>
<p>I am using Asp.Net C# & used three methods</p>
<pre><code>1) httpRequest.UserHostAddress
</code></pre>
<p>Tried Http Server variables as </p>
<pre><code>2) httpRequest.ServerVariables ["HTTP_X_FORWARDED_FOR"];
3) httpRequest.ServerVariables ["REMOTE_ADDR"];
</code></pre>
<p>But these methods are returning me my server address. As browser is taking this request as it is origonated at my end. But i want to get ip address of the page (Site) where the request is coming from. Can anyone help me in this.</p>
| c# asp.net | [0, 9] |
3,309,238 | 3,309,239 | How to open on click and dynamically pull in modal.html files | <p>I have:</p>
<pre><code> $(function () {
$('<div>').dialog({
modal: true,
open: function ()
{
$(this).load('Modal_ConfirmEmail.html');
},
width: 640,
});
});
</code></pre>
<p>and I need that to open when I click on test</p>
<p>Not sure how to do that.</p>
| javascript jquery | [3, 5] |
1,765,054 | 1,765,055 | Reading selected value of dropdown list in HTML by jQuery | <p>I am trying to read the value of the selectedID in a drop down list in html through jQuery but it keeps producing an error. Did I miss something?</p>
<pre><code><select style="width: 80px;" class="text ui-widget-content ui-corner-all" id="metaList">
<option value="4d5e3a8c418416ea16000000">Wikipedia</option>
<option value="4d5e3a8c418416ea16010000">Twitter</option>
<option value="4d5e3a8c418416ea16020000">DBPedia</option>
<option value="4d64cd534184162629000000">test</option>
</select>
</code></pre>
<p>I tried which used to work before</p>
<pre><code>var temp = $("#metaList").val();
</code></pre>
<p>but it produces NULL!</p>
| javascript jquery | [3, 5] |
5,758,283 | 5,758,284 | Backslash '\' in console.log() not appearing | <p>I'm trying to use a back slash in <code>console.log()</code> and within <code><p></p></code> but it seems that when the page loads, all back slashes are removed.</p>
<p><strong>Example JS</strong></p>
<p><code>console.log('\m/ Lets rock. \m/');</code></p>
<p><strong>Result</strong></p>
<p><code>m/ Lets rock. m/</code></p>
<p>How can I prevent it from being removed?</p>
<p><strong>EDIT:</strong> Backslash not forward slash. Running this on node.js with express, within the <code><head></code> tags of <code>layout.jade</code>. Backslash visible in REPL, but not when running on node in the web browser (Chrome & Firefox).</p>
| javascript jquery | [3, 5] |
3,114,524 | 3,114,525 | Breakpoint not triggers in Broadcast Receiver | <p>The title of the question pretty much sums it all, I want to debug my code in Broadcast Receiver but the break-point doesn't triggers, I am executing my android application from <strong>Debus As --> Android Application</strong>. Please help!</p>
<p>[edit]</p>
<p>Here is my Broadcast Receiver code:</p>
<pre><code>public class Alarm extends BroadcastReceiver {
@Override
public void onReceive(Context cxt, Intent intent) {
try {
Bundle bundle = intent.getExtras();
String taskName = bundle.getString("TaskName");
String taskRingTone = bundle.getString("TaskRingTone");
long endDateInMillis = bundle.getLong("EndDateInMillis");
//to disable alarm if enddate reached.
checkEndDate(cxt, (AlarmManager)cxt.getSystemService(Context.ALARM_SERVICE), endDateInMillis, pendingIntentId);
Intent reminder = new Intent(cxt, Reminder.class);
reminder.putExtra("TaskName", taskName);
reminder.putExtra("TaskRingTone", taskRingTone);
reminder.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
cxt.startActivity(reminder);
} catch (Exception e) {
e.printStackTrace();
}
}
</code></pre>
<p>}</p>
<p>and here is code i am using to register my receiver in the manifest:</p>
<pre><code> <receiver android:process=":remote" android:name="Alarm"></receiver>
</code></pre>
| java android | [1, 4] |
5,710,125 | 5,710,126 | How to restrict repeater rows in asp.net | <p>i have a asp.net repeater control .I have to display only two rows in the repeater .but my dataset has 10 rows ..is there a way to restrict the number of rows of a repater ?</p>
| c# asp.net | [0, 9] |
4,123,045 | 4,123,046 | Append a dot to element every interval | <p>I have a simple 'processing' <em>dot wait... dot wait.. dot wait..</em> for when a user submits a form.</p>
<p>I thought this could be accomplished quite easily with something like</p>
<pre><code><h2>Processing</h2>
</code></pre>
<p>and</p>
<pre><code>$(document).ready(function(){
setTimeout($('h2').append('.'), 500);
});
</code></pre>
<p>However it gets the first dot down, then throws back an error:</p>
<pre><code>Uncaught SyntaxError: Unexpected identifier
</code></pre>
<p>Where is my logic failing me on this one? What is the unexpected identifier?</p>
| javascript jquery | [3, 5] |
4,519,714 | 4,519,715 | How to call JQuery CheckBox Changed Event inside a Jquery Accordion Header? | <p>Thanks for all your valuable responses to the questions that I have asked before, those suggestions helped me a lot.
I have one more question here.
I am using a JQuery accordion control in my page,and the accordion header contains a checkbox,
Based on the checkbox selection, I need to retrieve some date from the DB.
So, I need the checkbox changed event to get fired, but The event never gets fired for some reason. I am building the checkboxes dynamically through code.</p>
<p><strong>Code:</strong></p>
<pre><code>string sa= '';
sa+= '<h3><a href=#><input type=checkbox runat=server OnCheckedChanged=chkScores_CheckedChanged id=chkScorecard' + i + '>Auckland Aces</input></a></h3><div><p>';
</code></pre>
<p>after creating checkboxes like above, I am adding them to the accordion div.</p>
<p>If you observe, I am giving <b>OnCheckedChanged</b> event, but that event is not firing.</p>
<p>Any idea..Why it is happening like that. I have been trying for past 6 hours on this, but no luck.</p>
<p>Can you guys please tell me if I am doing anything wrong, or is there any alternate approach to this.</p>
<p>Thanks and appreciate your feedback.</p>
| c# jquery asp.net | [0, 5, 9] |
3,552,917 | 3,552,918 | Open a new window using PHP | <p>Is there any way to open a new window or new tab using PHP without using JavaScript.</p>
| php javascript | [2, 3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.