Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
5,538,364 | 5,538,365 | Clicking a button: disabling and executing the button's handler | <p>On the Button's Click event, ow can you disable the button, and also call its event handler?</p>
<p>I have tried this:</p>
<pre><code>protected void Button1_Click(object sender, EventArgs e)
{
Button1.Enabled = false;
}
</code></pre>
<p>This doesn't work in IE, Mozilla, or Chrome.</p>
| c# asp.net | [0, 9] |
87,006 | 87,007 | jQuery cycle fade Images on Hover | <p>What would be the best way to have a single image which when you hovered your mouse over it, it would cycle fade in/out into a series of other images (like 3 or 4) before returning back to the original? Also, it would stop fading/changing images and go back to the original image if you moved your mouse off of the image.</p>
<p>Any help is appreciated.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
5,934,837 | 5,934,838 | Object cannot be cast from DBNull to other types | <p>I am trying to save the gridview data into the database. To decide if it should be an Insert or update, i need to find out if the <code>Order_SelectionID</code> exists. Foreach Gridview row, i am trying to use the statement like the following in C# using Asp.Net.</p>
<pre><code>foreach (GridViewRow row in grdFavoriteMerchant.Rows)
{
if (grdFavoriteMerchant.DataKeys[row.RowIndex]["Order_SelectionID"].ToString() != "")
{
</code></pre>
<p>If <code>Order_SelectionID</code> exists and not a <code>NUll</code> or zero, i will have to "Insert", else an "Update". </p>
<p>This statement gives me an exception</p>
<blockquote>
<p>"Object cannot be cast from DBNull to other types."</p>
</blockquote>
<p>everytime when i am supposed to use an Insert. How can i correct it?</p>
| c# asp.net | [0, 9] |
266,653 | 266,654 | Long integer to 16 character Hex for Google Reader sync | <p>Python Code </p>
<pre><code>h = "%s"%("0000000000000000%x"%(i&0xffffffffffffffff))[16:]
</code></pre>
<p>I'd like to know how this would be done in PHP.</p>
<p>The application is for google reader syncronization.
An initial sync list comes with numeric values, but the actual article id hex.</p>
<p>Example Long Integer = <strong>8643979098044673995</strong></p>
<p>Example Google Reader Article ID = tag:google.com,2005:reader/item/<strong>77f5953120daafcb</strong></p>
| php python | [2, 7] |
4,049,421 | 4,049,422 | Why doesn't JQuery consolidate its constants? | <p>All my constants are near the top of my javascript file like below.</p>
<p>When I search the core JQuery file, nothing comes up for Constant and I can't see that they are pulling out constants? Do they not have any, do they have them spread out throught the code, if so, why don't they consolidate them?</p>
<p>I'm not concerned about the language construct <code>const</code> but the concept of pulling out your constants into one place like below.</p>
<pre><code>var Constant =
{
/**
* Code Configuration
*/
VALIDATE_ON: 1,
JSON_ON: 0,
/**
* Paths Configuration
*/
ROOT: '',
PICTURES: '../pictures/',
TEXT: '../text/',
FAVICON: '../images/logo_small.ico',
IMAGES: '../images/',
GATEWAY: 'class.ControlEntry.php',
/**
* General Constants
*/
ENTER_KEY: 13,
SECOND: 1000,
MINUTE: 60,
HOUR: 3600,
DAY: 43200,
AML:
{
"PASS": 0,
"FAIL": 1,
"NOTDEFINED": 2
}
};
</code></pre>
| javascript jquery | [3, 5] |
5,831,758 | 5,831,759 | Javascript - How to remove all extra spacing between words | <p>How can I remove all extra space between words in a string literal?</p>
<pre><code>"some value"
</code></pre>
<p>Should become</p>
<pre><code>"some value"
</code></pre>
<p>Also, </p>
<pre><code>" This should become something else too . "
</code></pre>
<p>Becomes</p>
<pre><code>"This should become something else too ."
</code></pre>
<p>Do not worry about moving the <code>.</code>. Just as above is fine. I know I can use <code>$.trim(str)</code> to achieve the trailing/ending space removal. But, I'm not sure how to do the 1 space between words trick.</p>
| javascript jquery | [3, 5] |
4,165,104 | 4,165,105 | Referencing javascript libraries locally or externally? | <p>We are currently developing an ASP.NET MVC application which will be deployed on a corporate intranet, with a slightly-modified customer facing version available on the public internet.</p>
<p>We're making use of a number of external javascript libraries (e.g. jQuery) and a discussion has come up regarding referencing the libraries - should we reference them from an external source (e.g. via the Google load jQuery method) or keep our own version locally and reference from there?</p>
<p>The project manager is a little concerned about having a 'dependency' on Google (or whoever) if we reference from there, and thinks that having our own copy of the library makes us more independent. On the other hand, I have heard there are a number of advantages to letting someone else host the library - for example, they handle versioning for us, Google aren't going anywhere anytime soon...</p>
<p>(for the purpose of the discussion assume the intranet we're hosting on has external access - obviously if it turns out it doesn't the decision is very much made for us!)</p>
<p>So. Does this matter? And if so, what should we do and why?</p>
<p>(I appreciate this is subjective - but it would be very useful to get advice from anyone with experience or thoughts on the matter. Not sure if this is a candidate for community wiki or not, let me know if I should have put it there and I'll know for future!)</p>
<p>Thanks :)</p>
| javascript asp.net jquery | [3, 9, 5] |
2,769,976 | 2,769,977 | Master Slave DropDownLists in client side without postback | <p>How can I have 2 dropdownlists, those are Master Slave, And when select a master item without any postback the slave dropdownlist updated?
And I am interest to use jQuery.post() ?</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
1,460,617 | 1,460,618 | How to show alert message when closing a window? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/333665/javascript-to-get-an-alert-when-closing-the-browser-window">Javascript To Get An Alert When Closing The Browser Window</a> </p>
</blockquote>
<p>I want to show an alert message "Please logout before closing the window" with an logout button, when an user tries to close the window and after clicking on logout button the window can be closed. How to achieve this?</p>
| javascript jquery | [3, 5] |
2,227,496 | 2,227,497 | animate move to the left and to the right? | <p>I want is to move my pagination to the left and to the right after clicked on <code>#prev_pag</code> and <code>#next_pag</code>. how is it and solve my problem?</p>
<p><strong>Eg:</strong> <a href="http://jsfiddle.net/szVKD/5/" rel="nofollow">http://jsfiddle.net/szVKD/5/</a></p>
<pre><code>$('#next_pag').click(function() {
$('#pagination').animate({
left: '-=100px'
},
500);
});
$('#prev_pag').click(function() {
$('#pagination').animate({
left: '+=100px'
},
500);
});
});
</code></pre>
| javascript jquery | [3, 5] |
4,757,986 | 4,757,987 | How to get the value of radio buttons via Jquery | <p>If I have the following radios:</p>
<pre><code><input name="color" id="color_blue" value="blue">Blue
<input name="color" id="color_red" value="red">Red
<input name="color" id="color_green" value="blue">Green
</code></pre>
<p>What's the easiest way to find out which radio the user selected? Preferably something like to:</p>
<pre><code>$("color").val();
</code></pre>
<p>Or something close to that.</p>
| javascript jquery | [3, 5] |
330,556 | 330,557 | Setting multiple value for select | <p>How can i set multiple values for multiple select. This is what i have tried so far in jquery. I looking for a jquery as well as pure js solution(just for my knowledge). </p>
<pre><code>for(x in gList)
{
$('#GList').val(gList[x]);
}
</code></pre>
<p>This is selecting only one and not all.</p>
<p>EDIT: I found another solution in jquery . Hope this too helps others. In the loop use</p>
<pre><code>$("#GList option[value=" + gList[x] +"]").attr("selected","selected") ;
</code></pre>
| javascript jquery | [3, 5] |
4,111,494 | 4,111,495 | how to set visible true and false for drop down list box using javascript in asp.net | <pre><code><asp:DropDownList ID="ddloption" runat="server" Visible="false">
<asp:ListItem Text="Active" Value="Active"></asp:ListItem>
<asp:ListItem Text="D-Active" Value="D-Active"></asp:ListItem>
</asp:DropDownList>
function boxchange(dd)
{
document.getElementById("<%= ddloption.ClientID%>").visibility = "visible";
}
</code></pre>
<p>ddloption is null, what i m getting...can you tell me how to work with this.</p>
| asp.net javascript | [9, 3] |
1,128,600 | 1,128,601 | My ASP.Net project is not running in Firefox but running in IE | <p>My Asp.Net project hosted in IIS. I am running this project through IIS. It is running successfully in IE7 but not running in Firefox. I am using Javascript in my ASP.Net project. Is there any changes in my project through run on Firefox ?</p>
<p>If any one know about this tell me.</p>
| c# asp.net | [0, 9] |
3,204,315 | 3,204,316 | Android phones for testing | <p>I heard that for testing android application you have to test them on 2 different phones(depends of resolution) What phones are recommended?</p>
| java android | [1, 4] |
842,075 | 842,076 | Get a process response | <p>I am looking for a way to get a response in a form of a javascript alert after a form has been submitted using a php script. I guess ajax should do this but Im not an Ajax guy yet. A simple sample code would help a lot. Thanks for reading</p>
| php javascript | [2, 3] |
313,049 | 313,050 | How does one pass string contains '\' from from asp.net server side to Javascript function? | <p>How does one pass string contains '\' from from asp.net
server side to javascript function?</p>
<p>After checking parameters at client side, all '\' replaced with '' even,
replacing '\' with '%5C' at server side doesn't work.</p>
<p>Any idea?</p>
| asp.net javascript | [9, 3] |
2,241,582 | 2,241,583 | How to show a form field ONLY if another is selected in JavaScript or jQuery? | <p>I have a form, like so:</p>
<pre><code><form action="" method="post">
<select name="pageType">
<option value="main">Main Page</option>
<option value="sub">Sub Page</option>
<option value="sub-sub">Sub-Sub Page</option>
</select>
<br />
<label>Choose Sub Sub Name:</label> <input type="text" name="sub-sub-name" />
<br />
<input type="submit" name="submit" value="GO!" />
</form>
</code></pre>
<p>What I would like to achive is for this text field (and it's label):</p>
<pre><code><label>Choose Sub Sub Name:</label> <input type="text" name="sub-sub-name" />
</code></pre>
<p>to <strong>only appear if the 3rd option (sub sub page) is selected</strong> from the drop down and not show up otherwise. How can this be done with either javascript or the jquery framework?</p>
<h2>EDIT</h2>
<p>by the way, it would be nice if this can be achieved without the page needing to refresh and losing previously submitted form data. I know form data can still be kept using variables that store the values even on page refresh, but I was hoping for that effect that I see on a lot of sites where the additional text area (or other form element) just appears without page refresh.</p>
| javascript jquery | [3, 5] |
3,138,638 | 3,138,639 | How to use www.addthis.com | <p>I need to use addthis.com plugin to my website, when they click the email link, i need to pass my own data to the plugin, that needs to be sent to client.</p>
<p>Is there anyway to accomplish my goal?</p>
| c# javascript | [0, 3] |
449,968 | 449,969 | How to catch selected value from Android Menu Radio Values | <p>I've created a radio button menu list .. </p>
<pre><code> final CharSequence[] items = { "3 sec", "5 sec", "7 sec" };
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Change Wallpaper Every..");
builder.setSingleChoiceItems(items, -1,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item],
Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
builder.show();
</code></pre>
<p>what I want to do is to catch the selected value from the above Char Sequence and to put to a variable . </p>
| java android | [1, 4] |
5,246,825 | 5,246,826 | How can I capture the WINDOWS USERNAME included to my below code? | <pre><code>private void UndeletableComments(LinqDataSourceUpdateEventArgs e)
{
//get a reference to the currently saved item ****NOTE (State) is the ClassName. It’s a table of states in this test database
var currentData = ((MyData)e.OriginalObject).Notes;
// make a copy of whatever is in the edit field and strip out the previous comments
var newData = ((MyData)e.NewObject).Notes.Replace(currentData, string.Empty);
//check both values for nulls
if (currentData != null && newData != null)
{
newData = ((MyData)e.NewObject).Notes.Replace(currentData, string.Empty);
}
// replace the data to be stored in the database with the currentdata + the newData
// I added a datestamp to see when the new comment was added.
((MyData)e.NewObject).Notes = string.Format("{0} Added:{1} at (2) --- {3}", currentData, DateTime.Now.ToShortDateString(), DateTime.Now.ToLongTimeString(), newData);
// I need to see the WINDOW USERNAME by capturing who added a new comments
</code></pre>
| c# asp.net | [0, 9] |
3,082,394 | 3,082,395 | how to bind the same event to checkboxes, dropdown select and multiple select components? | <p>there are checkboxes, dropdown select and multiple select components in my webform, I want that they bind the same event that will be triggered when items are check(unchecked) or selectd(unselected), show should do that? Is there a clever and neat way?</p>
| javascript jquery | [3, 5] |
3,648,907 | 3,648,908 | how to calcualate bounding box withing given distance | <p>I am developing a website in which i want to give a search functionality for user..the search feature will detect the users current location and will show all the business within 10 kilometer from the user's current location..
businesses are stored in database..
please can anyone help me?</p>
| php javascript | [2, 3] |
5,324,674 | 5,324,675 | DOM element not being found after cloning and appending unique ID | <p>So I'm creating a random string value:</p>
<pre><code>var randomString = function(stringLength) {
var i = 0;
stringLength = stringLength || 10;
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
var randomString = '';
for (i = 0; i < stringLength; i += 1) {
var rNum = Math.floor(Math.random() * chars.length);
randomString += chars.substring(rNum, rNum + 1);
}
return randomString;
};
</code></pre>
<p>And associating it with a list element on one pane:</p>
<pre><code>var addUniqueId = function($thumbnail) {
var random = randomString(10);
$thumbnail.attr('id', 'rand-' + random);
};
</code></pre>
<p>And then cloning it and moving that list element to the right:</p>
<pre><code> var cloneImage = function($thumbnail) {
addUniqueId($thumbnail);
var $lastImgAdded = $('.js-gallery-edit-pane li').last();
var span = $('<span />');
span.addClass('x').text('x');
var $clone = $thumbnail.clone(true, true).appendTo($('.js-gallery-edit-pane')).prepend(span).hide().fadeIn(200).unbind('click');
bindRemoveHandler($clone);
};
</code></pre>
<p>Then I add an overlay to the list element on the left to "gray" it out. Everything works at this point.</p>
<p>From there, a user can remove the recently cloned items on the right hand side by clicking the "X" on the image. This works fine and removes that recently cloned image, however, the original overlay is not being found. It should be associated with the random string value, so I'm just looking for that in <code>$('.js-gallery-select-pane').find('#rand-' + string).find('.overlay').remove();</code> but for some reason it's not finding it...</p>
<p>Any idea why?</p>
<p><a href="http://jsfiddle.net/CSM8d/" rel="nofollow">JSFiddle Demo</a></p>
| javascript jquery | [3, 5] |
356,411 | 356,412 | Toggle control - how to create plus minus button? | <p>My toggle control is working, but I would like to add a plus-minus button: when content appears it becomes "-" and when content is hidden it changes to "+". Can you help please?</p>
<pre><code> <div class='toggle'>
<h2>Read More</h2>
<div class="togglebox">
<div class="content">
<h3>
<p>
A new exciting way to broadcast your business to customers
A new exciting way to broadcast your business.Lorem ipsum
</p>
</h3>
<!--Content Here-->
</div>
</div>
</div>
<script>
$(document).ready(function(){
//Hide the tooglebox when page load
$(".togglebox").hide();
//slide up and down when click over heading 2
$("h2").click(function(){
// slide toggle effect set to slow you can set it to fast too.
$(this).next(".togglebox").slideToggle("slow");
return true;
});
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
1,689,324 | 1,689,325 | Clear gridview using javascript/jquery | <p>Afternoon all.</p>
<p>Another hour, another question!</p>
<p>I have the following bit of jquery up and running that essentially 'resets' control contents.</p>
<p><code>
tbxProdAC.Attributes.Add
("onclick", "$('#txtbxHowMany').val(''); SetRadioFocus('" + radProd.ClientID + "');");
</code></p>
<p>I have a gridview that pops up occasionally (don't worry, I have got that bit under control!) so what I would like to do is amend the above code so that when I click on txtProdAC, GridView1 is removed.</p>
<p>Further to this, how would one implement a checked/unchecked function with jquery i.e. if tbxProdAC was click, radiobutton1 is unchecked?</p>
<p>Again, as always, apologies for my ignorance.</p>
| javascript jquery | [3, 5] |
2,908,459 | 2,908,460 | Removing an Element on Certain Location | <p>Let's say the window's location is on <code>htt://stackoverflow.com/index.php</code>, I want to remove an element in the index page with jQuery. This is what I have and it's not working:</p>
<pre><code>$(document).ready(function() {
var location = window.location;
var locQuery = /index/i;
if (location.match(locQuery)) {
$('.someClass').removeClass();
}
});
</code></pre>
| javascript jquery | [3, 5] |
4,511,089 | 4,511,090 | Getting jquery to delay after adding a class | <p>I want a script to halt before continuing after adding a class, below are two attempts that seem to fail. </p>
<pre><code> window.setTimeout($("#"+item).addClass("highlight"), 5000 );
$("#"+item).addClass("highlight").delay(5000);
</code></pre>
<p>Where am I going wrong here?</p>
| javascript jquery | [3, 5] |
2,692,270 | 2,692,271 | Detect page zoom change with jQuery in Safari | <p>I have a problem with Safari in a web application that contains a position:fixed element. When the page is zoomed out (smaller 100%) things break and would need to be fixed by calling a function. So I'd like to detect the user's zooming. I found this jQueryPlug-in a while ago:</p>
<p><a href="http://mlntn.com/2008/12/11/javascript-jquery-zoom-event-plugin/" rel="nofollow">http://mlntn.com/2008/12/11/javascript-jquery-zoom-event-plugin/</a></p>
<p><a href="http://mlntn.com/demos/jquery-zoom/" rel="nofollow">http://mlntn.com/demos/jquery-zoom/</a></p>
<p>It detects keyboard and mouse events that might lead to a page zoom level change. Fair enough. It works on current FF and IE but not on Safari. Any ideas what could be done to do something simmilar in current WebKit browsers?</p>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
3,298,166 | 3,298,167 | dynamic selection country city using javascript | <p>I wrote the code for dynamic selection country city like this way.The code running fine on Mozila, Chrome, Opera, Safari and Internet Explorer <em>9</em>, but the dynamic selection of country city code is not working on Internet Explorer <em>8</em> and earlier versions.</p>
<pre><code><form method=post id="formname" name="formname" action=eaccountdb.php
enctype="multipart/form-data" onsubmit="return Validate();">
<table class="style2">
<tr>
<td>
<table align="left" width="100%">
<tr>
<td align="left">
<label for="country">Country*</label>
<?php
$country = $_GET['country'];
if ($country == null)
{
$data = mysql_query("select * from country where countryname !='$country'");
echo "
<select name='country' style='width:150px' id='country'
onchange='show_country(this.value);'>
<option>Select Country</option>";
while ($info = mysql_fetch_array($data))
{
echo "<option>". $info['countryname']."</option>" ;
}
echo "</select>";
}
...
</code></pre>
| php javascript | [2, 3] |
1,373,311 | 1,373,312 | Is C++ worth investing time in learning? | <p>With languages like C# that can basically do anything, I found a drawback that could not be the case in the future, and that is the lack of many open source 3rd party libraries that are well documented to choose from. However with C++, there are many libraries to choose from, and this is a big pro for me. One thing I want to get into is game programming, but XNA is too tied into Windows and Microsoft. OGRE looks fantastic to me, but it's a C++ library.</p>
<p>I have a basic knowledge of C++, but I don't know how to use pointers or know much about the STL. I do know that C++ does not hold your hand like C# does, but I'm willing to invest time in learning if it's worth it.</p>
| c# c++ | [0, 6] |
4,985,588 | 4,985,589 | Android EditText check assistance | <p>I have an editText field for which I want check that it meets with certain criteria, basically it has to contain 2ints and 3 strings, how can I check this before adding the element.</p>
<pre><code> EditText.getText().toString();
</code></pre>
<p>could I add a check that does comething like this</p>
<pre><code>public boolean checkString(String StringPassed) {
String s = StringPassed;
if(s.length == 5){
boolean hasString = false;
boolean hasInt = false;
String letters = s.substring(0, 2);
Pattern p = Pattern.compile("[a-zA-Z]");
Matcher m = p.matcher(letters);
if (m.matches()) {
hasString = true;
}
String numbers=s.substring(2,5);
try {
int num = Integer.parseInt(numbers);
String n = num + "";
if (num > 0 && n.length() == 3)
hasInt = true;
} catch (Exception e) {
}
if (hasInt && hasString) {
return true;
}
}else{
return false;
}
return false;
}
</code></pre>
<p>I then have a method which will say</p>
<pre><code>public void addString() {
String StringPassed = EditTextName.getString().toString();
checkString(String StringPassed);
if (StringPassed() == false) {
Display Toast;
}
else {
add;
}
}
</code></pre>
| java android | [1, 4] |
589,023 | 589,024 | what is it in Java standard library that Python's lacks | <p>I hear that Java's standard library is larger than Python's so I'm curious, what's missing in Python's?</p>
| java python | [1, 7] |
2,690,099 | 2,690,100 | communication between PHP and Javascript | <p>I want to send some data to Javascript from PHP.(these two file is different file in same folder)
For example, If I calculate some value in PHP side, I want to send the data to javascript and I use the data.
How can I do this??</p>
| php javascript | [2, 3] |
1,900,132 | 1,900,133 | Gridview in a Tooltip | <p>Is there a way to display a gridview in a tooltip?</p>
| c# asp.net jquery | [0, 9, 5] |
405,963 | 405,964 | 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] |
3,496,459 | 3,496,460 | How can a block diagram be dynamically generated in ASP.NET? | <p>Based on the data, I need to dynamically generate a graphic in my ASP.NET page.
What is the best way to do this. Is this easier to implement in Silverlight.</p>
| c# asp.net | [0, 9] |
984,481 | 984,482 | How to I only show the divs if that div has an input that isn't blank? | <p>I have a bunch of divs that are all hidden like this</p>
<pre><code><div class="elements">
<input value="something" type="text" value="" name="name">
<input value="" type="text" name="phone">
</div>
<div class="elements">
<input type="text" value="" name="name" class="contact_name">
<input value="something" type="text" name="phone">
</div>
<div class="elements">
<input type="text" value="" name="name" class="contact_name">
<input value="" type="text" name="phone">
</div>
<div class="elements">
<input value="something_again" type="text" value="" name="name">
<input value="" type="text" name="phone">
</div>
</code></pre>
<p>CSS</p>
<pre><code>.elements{display:none;}
</code></pre>
<p>I want to show only the element divs that have an input of that is not an empty string....so in the above example i would show the first, second and fourth divs because at least one input has a value...</p>
<pre><code>$('.elements').find('input').each(function)...
</code></pre>
<p>that is what i have so far but not sure how to search if there is at least one input that isn't blank</p>
| javascript jquery | [3, 5] |
4,044,941 | 4,044,942 | Is possible to create an android spinner with pull-down like notification bar? | <p>for my Android app need a selector that onclick or on pull-down show a dropdown list( not a dialog window), is possible to customize spinner to do this?</p>
| java android | [1, 4] |
4,898,570 | 4,898,571 | getting the contents of a function in an `onclick` attribute in my html with jQuery | <p>What?! I know, what a bad idea. </p>
<p>Firstly I have no control over the html that was output, its from a vendor and it is produced via their crazy system that our company has an agreement with. (let's not talk about the situation, I know it's not optimal)</p>
<p>In the html I have:</p>
<pre><code><a id="notify" onclick="location.href='index.php?foo=bar';return false;" href="javascript:;">Notify!</a>
</code></pre>
<p>In my JS If I do:</p>
<pre><code>console.log($("#notify").attr("onclick"))
</code></pre>
<p>I recive:</p>
<pre><code>onclick(event)
</code></pre>
<p>Which makes sense, but I need to change the onclick's attribute, so it reads to something like:</p>
<pre><code>onclick="location.href='index.php?foo=bar&zoobazz=moo';return false;"
</code></pre>
<p>better yet, if I could remove the onclick and replace the href attributes value with location.href.</p>
| javascript jquery | [3, 5] |
5,732,171 | 5,732,172 | Adding items to select (list box) of html/php through jQuery or javascript | <p>Is it possible to add items to a select (list box) of html/php through jQuery or javascript when a specific action is triggered by another control in jQuery/javascript? <em>(edited by <a href="http://stackoverflow.com/users/611306/alex-thomas">Alex Thomas</a>)</em></p>
| php javascript jquery | [2, 3, 5] |
762,998 | 762,999 | How can I send TCP requests from my phone? | <p>I have following task: to make Android application which connects to router, sends TCP requests for system and gets response. I have made Android application already which uses PHP web-services, but I never make application for TCP requests. Please, tell me, what means should I use for my task? Thank you.</p>
| java android | [1, 4] |
1,375,774 | 1,375,775 | shim for the required attribute for IE9 users | <p>According to <a href="http://caniuse.com/#search=required" rel="nofollow">CanIuse</a>, the required attribute is not supported in IE9.
Is there a shim to provide the same functionality as the native required attribute if the browser doesn't support it?</p>
| javascript jquery | [3, 5] |
2,561,828 | 2,561,829 | How to replace preview of post with full content using jQuery / Javascript? | <p>In a php variable <code>$preview</code> I save about 4 lines of a post without any tags. In the <code>$full</code> I save full of the post with tags.</p>
<p>This is what I used to have, an expand/collapse toogle <a href="http://fiddle.jshell.net/r4F8Q/22/" rel="nofollow">http://fiddle.jshell.net/r4F8Q/22/</a> when I was saving the entire post. But it doesn't look good without tags so I need to go one step forward.</p>
<p>My question is how to change it, so it shows <code>$preview</code> until the user clicks on expand and show the <code>$full</code> post?</p>
<p>Thank you</p>
| javascript jquery | [3, 5] |
4,791,834 | 4,791,835 | English to french asp.net resource file translation | <p>I have a asp.net resouce language file in english and I have to translate that resource file into french. how can this be achieved? There are lot of values on the resource file that needs to be translated. </p>
<p>is there any sample available on how this can be done by using google language translation or something?</p>
| c# asp.net | [0, 9] |
5,405,737 | 5,405,738 | Javascript/Jquery - How do I get the element that the user has selected with their cursor? | <p>If the user highlights the text within an <code><h1></code> with their cursor, how do I get that <code><h1></code> object? Or if they selected text within an <code><li></code>, how do i get that <code><li></code>?</p>
| javascript jquery | [3, 5] |
1,798,830 | 1,798,831 | Animating left to right | <p>I'm trying to achieve something that seems quite simple but I have hard time doing so.</p>
<p>How can I animate a div making its width 80% of original from left to right?
I want to keep the right margin where it is and moving the left one toward right.</p>
<p>Thanks and have a nice day.</p>
| javascript jquery | [3, 5] |
5,029,374 | 5,029,375 | Where in code should one keep data that doesn't change? | <p>I have defined models based on the tables in the database. Now there are some models whose data hardly changes. For example, the categories of the products that an e-comm site sells, the cities in which it ships the products etc. These don't change often and thus to avoid hitting the db, these are currently saved as static variables. </p>
<p>The question is where in code should these static variables be located. Currently, in ProductCategory class (which is also the model representation) a static List is defined which if empty calls the db and loads the Product Categories. Similarly, the City class has a similar static List and so on. </p>
<p>These static Lists are then used across the application. I was thinking of creating a class called StaticData and then keeping all the static Lists within this class. That is now instead of </p>
<pre><code>ProductCategory.AllCategories.Find(p => p.Id = 2)
</code></pre>
<p>I shall have </p>
<pre><code>StaticData.AllProductCategories.Find(p => p.Id = 2)
</code></pre>
<p>Which do you think is a better approach? I am also aiming for testability and decoupled code. </p>
<p>Also, is there a better way to achieve these? How do you do something similar in your code?</p>
| c# asp.net | [0, 9] |
3,598,809 | 3,598,810 | jQuery vs. $ - Creating jQuery scripts in JavaScript in WordPress using External Libraries | <p>I am trying to utilize Trent Richardson's Date Time Picker (<a href="http://trentrichardson.com/examples/timepicker/" rel="nofollow">see here</a>).</p>
<p>I am trying to get the selected time when the popup closes, so I am using the following code (in an external .js file):</p>
<pre><code>jQuery(function()
{
var startDateTextBox = jQuery('#start_date_field');
startDateTextBox.datetimepicker(
{
onClose: function(dateText, inst)
{
var testStartDate = startDateTextBox.datetimepicker('getDate');
alert(testStartDate);
}
});
});
</code></pre>
<p>However, the alert is coming up saying that the variable is undefined (which also happens when I step through the function). What am I doing wrong?</p>
<p>I opened up Trent's source and I noticed that he is using $ in place of jQuery - I saw elsewhere that you should always use jQuery in WordPress in order to put it into 'no conflict mode' - is that accurate? What are the ramifications of using $ instead of jQuery?</p>
| php jquery | [2, 5] |
5,685,221 | 5,685,222 | Delay page redirect after form submit using jquery / js? | <p>My code is:</p>
<pre><code><input class="toBasketButton" type="submit" value="">
</code></pre>
<p>Thanks in advance !</p>
| javascript jquery | [3, 5] |
5,290,131 | 5,290,132 | Problem with getJSON or PHP | <p><code>Display.php</code>:</p>
<pre><code><?php
include 'sql.php';
$dataget = mysql_query("SELECT `user`,`message`,`timestamp` FROM `messages`");
$arr = array();
while ($dataarr = mysql_fetch_assoc($dataget)){
$arr[] = $dataarr;
}
echo json_encode($arr);
?>
</code></pre>
<p><code>Index.php</code>:</p>
<pre><code><script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.getJSON('display.php', function(data) {
alert(data.0.user);
});
});
</script>
</code></pre>
<p>Trying to alert <code>data.0.user</code>.</p>
| php javascript jquery | [2, 3, 5] |
1,753,735 | 1,753,736 | Remap a key press in javascript / jquery | <p>Is there an "easy" way to map a keystroke to another key when on a page?</p>
<p><strong>Background:</strong></p>
<p>We are using a custom javascript grid for handling keyboard entry in a web application. Normally, the [enter] key allows the user to move to the next line, and the [tab] key allows the users to move to the right. The grid handles the keystrokes, and has some rather complicated logic when one is pressed.</p>
<p>Our users are requesting that we map the Plus Key [+] on the numeric keypad to [tab] so that they don't need to use two hands while keying. This seems logical (the are keying thousands of numbers in a row while holding papers with their other hand), but I can't figure out to do it.</p>
| javascript jquery | [3, 5] |
2,370,336 | 2,370,337 | Different background position every click | <p>Im trying to build sort of slide where when click on link ".animate" will change it position ( every time 100px more)</p>
<p>This: </p>
<pre><code>$(function(){
$('#m-main').click(function(){
$('slide').animate({top : "100px"}, {duration:500})
})
});
</code></pre>
<p>will work only once.</p>
<p>How can I make this working?</p>
<p>Many thanks for your help.</p>
| javascript jquery | [3, 5] |
1,558,627 | 1,558,628 | get value of inside a tag with jQuery.? | <p>How can by jQuery get value inside tag <code>b</code>?</p>
<pre><code><span>
<b>hi_1</b>
<b>hi_2</b>
<b>hi_3</b>
<b>hi_4</b>
<span>
</code></pre>
<p>I want this output with jQuery: <code>hi_1, hi_2, hi_3, hi_4</code><p>
Please give me example in <a href="http://jsfiddle.net/" rel="nofollow">jsfiddle</a>.</p>
| javascript jquery | [3, 5] |
255,122 | 255,123 | ASP.NET: Global hook in Response? | <p>Is there any way to intercept all ASPX Page Responses? I'd like to intercept all the pages served and inject a small JavaScript at the end of each. </p>
| asp.net javascript | [9, 3] |
1,749,701 | 1,749,702 | copying one array to another array | <p>I am an array in following format. I am reading following data from a file <code>data.json</code> like this</p>
<pre><code>$.getJSON('data/data.json', function (ids) {
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
teams = id;
$('<li>' + id + '</li>').appendTo(span);
}
});
</code></pre>
<p>here is data</p>
<pre><code>[
"109 200",
"109 201",
"102 202",
"103 202"
]
</code></pre>
<p>So what I want is to copy this array to another lets say <code>c</code> but in following form</p>
<pre><code>[
"109",
"109",
"102",
"103",
"200",
"201",
"202",
"202"
]
</code></pre>
<p>How can I do this using javascript or jquery?</p>
| javascript jquery | [3, 5] |
1,935,674 | 1,935,675 | ListView: Display data divided into groups? | <p>I would like to display the contents of a DataTable, divided into several groups depending on the value of one of the columns. So, if I have a DataTable (from SQL query) with:</p>
<pre><code>GroupID Name Description
1 foo bar
1 one two
2 some thing
</code></pre>
<p>I would like to place all records containing GroupID 1 in one div, all records with GroupID 2 in another div, and so on. How can I do this?</p>
<p>I'm writing in ASP.NET 4.0, with C# codebehind.</p>
| c# asp.net | [0, 9] |
2,067,433 | 2,067,434 | Better way of gathering multiple input | <p>I am trying to find a better way to gather multiple input. At the moment, I am using a slider to represent how many items a user wishes to enter. If a user say selects 3 then I am looking for a way to display a way for them to enter 3 items. </p>
<p>I guess what I need is say if a user selects 3 with the slider, then I need to display 3 input elements with a certain width using the same ID. Say like a bank may ask for your pin. Is this possible. In my example, #boxnumber is the div that needs to be created. Many thanks</p>
<pre><code>$(function() {
$("#boxnumber").hide();
$("#slider").live('change', function() {
if($(this).val()>0)
$("#boxnumber").addClass("ui-input-text").show(1000);
else
if ($(this).val()==0)
$("#boxnumber").hide(1000);
});
});
</code></pre>
<p>+++EDIT+++</p>
<pre><code><div id="boxnumber">
<label for="boxamount">Enter box numbers *</label>
<input type="text" name="boxamount" id="boxamount" value="" />
</div>
</code></pre>
<p>This input is initially hidden.</p>
| javascript jquery | [3, 5] |
2,161,034 | 2,161,035 | Include PHP inside javascript (.js) file | <p>I have a javascript file (.js file, not HTML file) containing several js functions. I want to call one of the PHP functions in a PHP file containing only several PHP function from within one of the js functions. Is that possible? Would I need to "include" the .php file containing the php function in the .js file? How would I do that? For example, say I had a file called myLib.php containing a function called "myFunc" that takes two parameters (param1 and param2). Then I have a .js file containing a function called "myJsFunc". How would a call the myFunc (PHP) from within the myJsFunc (javascript function)? Wouldn't I need to include the PHP file somehow in the javascript/.js file?</p>
| php javascript | [2, 3] |
1,265,414 | 1,265,415 | jQuery: test if element is first of MATCHED elements | <p>I have several divs that are alerts. The user dismisses them and after the final one (which is the FIRST in the DOM) I need to trigger some jquery magic.</p>
<p>Here's some simplified HTML:</p>
<pre><code><body>
<div class="">Bla bla bla</div>
<div class="alert">A</div>
<div class="alert">B</div>
</body>
</code></pre>
<p>Here's what I'm trying to do with jquery...</p>
<pre><code>$(".alert").click( function() {
if ( $(this).is(".alert:first") ) {
//do stuff
}
});
</code></pre>
<p>It doesn't work. The conditional never returns true. The only way I can get it to work is using <code>.index()</code> but that sucks because if the order of the markup changes it will break the script.</p>
<p>What am I doing wrong?</p>
<p>EDIT: The solution uses <code>.index()</code> but in a way that I did not realize was possible. It <em>is</em> relative to the matched selection if used in that way. Thanks!</p>
| javascript jquery | [3, 5] |
4,031,871 | 4,031,872 | Controlling one page with another using jQuery | <p>Using two separate browsers or computers, or for the sake of experimentation, two tabs, is there any way to push a command from one page to another that has some sort of listener object?</p>
<p>So for example: </p>
<p>controller.html has a link, when clicked triggers an action on viewer.html. </p>
<p>Is this possible? </p>
| php jquery | [2, 5] |
1,844,741 | 1,844,742 | using c# web service (asmx) in php | <p>i want to use c# web service with PHP and jQuery.
below code is posting data with $.ajax into php code. but inside i=of url i can't get any data from web service. how can help me for develop this code</p>
<pre><code>$.ajax({
type: "POST",
url: "http://www.w3schools.com/webservices/tempconvert.asmx/CelsiusToFahrenheit",
dataType: 'jsonp',
success: function(data) {alert('ok')},
error : function(e) {alert('error')}
});
</code></pre>
| php jquery | [2, 5] |
3,789,075 | 3,789,076 | jQuery datePicker plugin loading problem | <p>I'm trying to use the following plugin for date picking:</p>
<p><a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html" rel="nofollow">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html</a></p>
<p>And I'm trying to use the code from the first demo but I get an error that jQuery is not defined (last line of the plugin, where the function is closed).</p>
<p>I haven't used jQuery before so I'm hoping this is a simple error.</p>
<p>I've tried to call it as follows:</p>
<pre><code><script type="text/javascript" charset="utf-8">
$(function()
{
$('.date-pick').datePicker();
}
</script>
</code></pre>
<p>^ Inside the head of the page. There is also other jQuery code in the head, could this be causing a problem?</p>
<p>The plugin and other required JS are all present.</p>
<p>Adam</p>
| javascript jquery | [3, 5] |
2,965,334 | 2,965,335 | Android java how to have it select a random string from a predetermined list of strings | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6726963/random-string-from-string-array-list">Random string from string array list</a> </p>
</blockquote>
<p>How can I make it where i can press a button and it display one sting (words) at random from a long list of of other strings that i have already set.</p>
| java android | [1, 4] |
895,460 | 895,461 | Adding textbox values | <p>In Asp.net using c# ,I am having</p>
<pre><code>int sum = Convert.ToInt32(txtbox1.Text) + Convert.ToInt32(txtbox2.Text);
</code></pre>
<p>When i have an empty textbox, i get the error "Input string is not in a correct format".</p>
<p>So, I am wondering if there is a simple way to add textbox values only they are integers, if not take the textbox value as 0. </p>
<p>Thanks in advance!</p>
| c# asp.net | [0, 9] |
5,047,456 | 5,047,457 | Stop Sound when Hold key is pressed | <p>I want to stop media sound when the user press hold key or power key
I do this</p>
<pre><code> public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_ENDCALL || keyCode == KeyEvent.KEYCODE_POWER){
pauseSound();
}
return super.onKeyDown(keyCode, event);
}
</code></pre>
<p>But this override function didn't invoke when Power or end call is pressed</p>
<p>Any idea?</p>
| java android | [1, 4] |
77,713 | 77,714 | change language of html content using javascript dynamically | <p>I have created some html pages with the content in english language. Now i need to change the language to Mandarin language(Singapore language) dynamically based on user selection without redirecting the pages.Please anyone help me to do this.</p>
<p>Thanks in Advance.</p>
| javascript jquery | [3, 5] |
4,996,544 | 4,996,545 | display button only when page loads completely | <p>I have a button like this:</p>
<pre><code><input type="submit" id="product_197_submit_button" class="wpsc_buy_button" name="Buy" value="Add To Cart">
</code></pre>
<p>Now the thing is that if user clicks button before all scripts are loaded -> I get error in shopping cart. Is there a way to disable clicking on the button (or hide it from display) UNTIL complete page is loaded into users browser ?</p>
<p>Thanks,
Peter</p>
| javascript jquery | [3, 5] |
186,382 | 186,383 | Image removed but still using network traffic | <p>I have a strange problem here, and i can't find any usefull results using google search, so I now ask for your help.</p>
<p>I have a video stream on my HTML+Javascript(mostly jQuery) application.
It is embeded like this:</p>
<pre><code><img width='300' id='videoFeedImg' src='http://IP:PORT/PAGE' />
</code></pre>
<p>Where this PAGE is acutally a live updating stream of pictures. </p>
<p>It works great!</p>
<p>But the problem is, that it is used on a page where it only has to be displayed when the user clicks a button. This is no problem, I just create this image shown above with the append() function in jQuery.
When the button is clicked, it is created and it is shown in the Inspection tool under Network (and it is easy to see in the Task manager Nerworking page to), and is making pretty huge network traffic. </p>
<p>But no matter what i do, i can't kill this stream/bandwidth. I tried to:
1. replace src with someting else
2. remove the picture
3. detach everthing i attached
4. use all kinds of jQuery functions like .stop() on the image and .empty() and .html(""); on the parent .</p>
<p>The only thing that works is this:</p>
<pre><code>if (window.stop !== undefined) {
window.stop();
}
else if (document.execCommand !== undefined) {
document.execCommand("Stop", false);
}
</code></pre>
<p>But it is kind of drastic (maybe not??)</p>
<p>Does anybody have any good idears on how to stop this from loading/downloading?</p>
<p>Best regards
Bjarke</p>
| javascript jquery | [3, 5] |
2,076,930 | 2,076,931 | jquery bind on images? | <p>I've an img and a button, and I'd like to use jQuery bind to respond to onclick events. Bind works on the input button, but not on img. Here is my JavaScript code:</p>
<pre><code>function drawDetails (event) {
var id=0;
if ((typeof $(this).attr('id')) !== 'undefined') {
id = parseInt($(this).attr('id').replace(/[^0-9]+/g,''));
} else if((typeof e.id)!=='undefined') {
id = e.id;
}
alert("drawDetails " + id);
}
$("input[id^=camera-]").bind('click', drawDetails);
$("input[id^=details-]").bind('click', drawDetails);
</code></pre>
<p>HTML:</p>
<pre><code><img id="camera-10" src="camera.gif"/>
<input id="details-10" type="button" value="Details 10">
<img id="camera-11" src="camera.gif"/>
<input id="details-11" type="button" value="Details 11">
</code></pre>
<p>I've prepared a <a href="http://jsfiddle.net/eJ3rn/2/" rel="nofollow">JSFiddle</a> of it. How can I make the event fire also when the image is clicked? </p>
| javascript jquery | [3, 5] |
5,632,257 | 5,632,258 | How to retrieve domain name from a webview? | <p>I want to be able to retrieve the domain name in a webview in which the user is able to enter in the URL. I want to post the domain name instead of the URL if this is possible. Any help is greatly appreciated.</p>
| java android | [1, 4] |
2,469,446 | 2,469,447 | Add new div every 3 | <p>The focus is on the <code>else</code> bit, I am adding a div <code>$('<div id="content" class="span4"></div>').appendTo('.new');</code>, I need to check if I already added 3 divs, and if so, add a new <code>$('<div class="row-fluid new"></div>').insertAfter($row);</code> and then start again</p>
<pre><code>$(".navMore li a").on("click", function() {
var $el = $(this);
$('#content').removeAttr('id');
var $row = $el.closest('.row-fluid');
if($row.next('.new').length){
$('<div id="content" class="span4"></div>').appendTo('.new');
}
else {
$('<div class="row-fluid new"></div>').insertAfter($row);
$('<div id="content" class="span4"></div>').appendTo('.new');
}
});
</code></pre>
| javascript jquery | [3, 5] |
4,545,349 | 4,545,350 | jQuery, find li class name (inside ul) | <p>I have ul with a number of li inside. All li have an id "#category" but different classes (like ".tools", ".milk", ".apple").</p>
<p>Using jQuery. I do : </p>
<pre><code>$("li#category").click(function(){ some_other_thing ( .... )});
</code></pre>
<p>now i have to put a li's class "name" — (a string indeed) inside the some_other_thing() function instead of ....</p>
<p>How it can be done?</p>
| javascript jquery | [3, 5] |
3,887,976 | 3,887,977 | Text being updated in real time | <p>I need some text to be updated in real time depending on choices from dropdown boxes.</p>
<p>Here's an example: <a href="http://www.thatsoftwareguy.com/swguy_demo_1.3.7/index.php?main_page=product_info&cPath=65&products_id=183" rel="nofollow">http://www.thatsoftwareguy.com/swguy_demo_1.3.7/index.php?main_page=product_info&cPath=65&products_id=183</a></p>
<p>I know how to get an input box automatically updated, using the NAME and ID - but how do you give normal text a NAME and ID?</p>
| php javascript | [2, 3] |
1,747,949 | 1,747,950 | Display a variable in Android Widget | <p>I have a String variable that is declared and edited in the Main Activity.</p>
<p>I would like it to be display in a widget, but not sure how.</p>
<p>In the Widget file I have:</p>
<pre><code>remoteViews.setTextViewText(R.id.widgetAmount, String.valueOf(number))
</code></pre>
<p>but the number variable is declared in another class.</p>
| java android | [1, 4] |
4,719,605 | 4,719,606 | jquery read all document events | <p>Hello how to get all attached events to document ?
I tried this but it doesn't work</p>
<pre><code> $.noConflict();
jQuery(document).ready(function()
{
var events = jQuery(document).data("events");
//var isExistGlobalEvents = jQuery.data(jQuery(document).get(0), 'events').click;
if (!events) {
AddGlobalEvents();
// has loadedmetadata event
}
</code></pre>
| javascript jquery | [3, 5] |
3,902,661 | 3,902,662 | Webservices for trading mutual fund and shares in india | <p>I have to build a Online Mutual Fund section in a portal where users may purchase & sell mutual funds for One time & SIPs. (Payment Gateway System attached).
In another section need to provide reports for share trading based on filter criteria like user specific or portfolio specific. The share trading is done through only one trading house (e.g. Sharekhan, Angel Broking etc.). </p>
<p>Please help me on followings:</p>
<ol>
<li>From Where I will get the API or Web Services for Mutual Fund Trading and how payment gateway can be integrated with them?</li>
<li>From Where I will get the API or Web Services for Share Trading so I will filter based on customer and broking house? Is it acceptable?</li>
</ol>
| c# asp.net | [0, 9] |
1,976,164 | 1,976,165 | App crashing on count and dialog box | <p>i am using following code.</p>
<pre><code>public class MyCount extends CountDownTimer
{
public MyCount(long millisInFuture, long countDownInterval)
{
super(millisInFuture, countDownInterval);
}
@Override
public void onFinish()
{
displayAlertForRestart();
}
@Override
public void onTick(long millisUntilFinished)
{
counter.setText("Time Left: " + millisUntilFinished/1000 + " sec");
}
}
public void displayAlertForRestart()
{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setMessage("Do you want to Restart?");
builder.setTitle("Game Over");
builder.setInverseBackgroundForced(true);
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int which) {
Intent myIntent = new Intent(context,Level.class);
startActivity(myIntent);
dialog.dismiss();
finish();
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
</code></pre>
<p>LogCat error: Error at <code>alert.show();</code></p>
<pre><code>36: E/AndroidRuntime(9829): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@43cf1e38 is not valid; is your activity running?
</code></pre>
| java android | [1, 4] |
1,375,335 | 1,375,336 | Launching Intent using userID with if block | <p>I have this activity class that won't catch the if block. Because I'm a beginner, I couldn't think of any other way to catch the given userID("001") to launch a specific intent(AdminTab) after the Splash Thread. </p>
<p>Could someone please help me point out what i'm doing wrong or advice me with some sample code? Thank you!</p>
<p>public class Splash extends Activity{</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
final UserFunctions userFunction = new UserFunctions();
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
String id = "";
id = userFunction.getID(getApplicationContext());
try{
sleep(1000);
//Should open AdminTab if user id is "001"
if("001".equals(id)){
Intent i = new Intent(getApplicationContext(),
AdminTab.class);
startActivity(i);
}else{
Intent i = new Intent(getApplicationContext(),
UserTab.class);
startActivity(i);
}
} catch (InterruptedException e){
e.printStackTrace();
}finally {
}
}
};
timer.start();
}
</code></pre>
<p>This is the getID method from UserFunctions Class.
getUserID from a sqlite database handler.</p>
<p>UserFunctions.java</p>
<pre><code>public String getID(Context context) {
String id = "";
DatabaseHandler db = new DatabaseHandler(context);
Cursor cursor = db.getUserID();
if(cursor != null) {
while(cursor.moveToNext()) {
id = cursor.getString(0);
}
} else {
id = "";
}
cursor.close();
db.close();
return id;
}
</code></pre>
| java android | [1, 4] |
306,993 | 306,994 | How to check if there exists at least one li element with attr = something? | <p>So I want to check if there is any li element that has a attribute of "data-foo" and its value is "bar".</p>
<p>Would this work? :</p>
<pre><code>if ($('li[data-foo=bar]'))
{
//exists
}
else
{
//does not exist
}
</code></pre>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,765,646 | 5,765,647 | FileUpload Control not taking file name | <p>I am using FileUpload Control to upload images, I can select the image using that browse button, but when i try to preview that selected one, i am not getting the file name, its showing empty..</p>
<pre><code>protected void btnImgUpload_Click(object sender, ImageClickEventArgs e)
{
try
{
string strimage;
string strfilename, strextn;
if (fupImage.HasFile)
{
</code></pre>
<p>In the above code,<code>fupImage.FileName</code> property should have to selected Image name, but it remains as empty string "" , so <code>fubImage.HasFile</code> condition is going false. I am not getting why the condition is going false, while the file is selected,? what is the problem here?</p>
<p>Thanks in advance</p>
| c# asp.net | [0, 9] |
2,575,876 | 2,575,877 | Can i do the effect shown in this page using jquery? | <p>Please look at this page:</p>
<p><a href="http://www.nike.com/nikeos/p/nikegolf/en_US/" rel="nofollow">http://www.nike.com/nikeos/p/nikegolf/en_US/</a></p>
<p>In the slide number 2, there is a midpanel that does a growing effect onmouse over.Some panels step aside at the same time or simply grows over another. As you can see, the background changes, the box grows as well as its content. I think that is flash, but, is there a way to obtian the same results using jquery? I have certain jquery experience but i dont wich function would be usefull to combine to get those results</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
4,373,821 | 4,373,822 | Create links in single image | <p>I want to create some links in single image.I know we can do it with area map.i have used <a href="http://davidlynch.org/js/maphilight/docs/demo_usa.html#" rel="nofollow">this</a> link for help</p>
<p>Please have a look at link.</p>
<p>But now my requirement is to show the selected state as active.Along with this we also want to select multiple state at a time which should we active.</p>
<p><strong>select state with control key combination is below</strong></p>
<pre><code>click = function(e) {
e.preventDefault();
// Get clicked area element.
var i = e.srcElement || e.target;
/**
* Turn on/off alwaysOn option (boolean, false by default).
* Indicates whether to always show the hilighted areas.
*/
i.alwaysOn = !i.alwaysOn;
if (window.event) {
key = window.event.keyCode; //IE
if (window.event.ctrlKey)
isCtrl = true;
else
isCtrl = false;
}
else {
key = e.which; //firefox
if (e.ctrlKey)
isCtrl = true;
else
isCtrl = false;
}
// Apply changes.
if (isCtrl == true) {
i.alwaysOn = true;
$(i).data('maphilight', i).trigger('alwaysOn.maphilight');
}
else {
i.alwaysOn = false;
$(img).hasClass('maphilighted').each(function() {
$(this).data('maphilight', i).trigger('alwaysOn.maphilight');
/* here i want remove all selected (highlighted) state */
});
}
};
</code></pre>
| javascript jquery | [3, 5] |
3,854,993 | 3,854,994 | I'm getting a null pointer exception when I subclass an OnClickListener() | <p>I'm trying to subclass one of my <code>OnClickListener()</code> 's and I'm getting a 'null pointer' exception, but I'm not sure why.. I'm going nuts over this.. any help would be greatly appreciated..</p>
<p>Here is the code in my Utilities Class located in com.Tools</p>
<pre><code>public class Utilities
{
public static View.OnClickListener CreateOnClickListener(final Context context,final Class<?> cls)
{
final Activity act = new Activity();
View.OnClickListener listener = new View.OnClickListener()
{
public void onClick(View v)
{
Intent window = new Intent(context, cls);
act.startActivity(window);
act.finish();
}
};
return listener;
}
}
</code></pre>
<p>And when I call it from my main class I do this:</p>
<pre><code>final Button button1 = (Button) findViewById(R.id.button1);
button1.setOnClickListener(Utilities.CreateOnClickListener(MainMenu.this, SettingsMenu.class));
</code></pre>
<p>When I debug, the exception occurs on this line:</p>
<pre><code>act.startActivity(window);
</code></pre>
<p>Any ideas??? Thank you very much in advance!!!</p>
| java android | [1, 4] |
4,821,388 | 4,821,389 | file upload C# asp.net | <p>i am trying to upload files in asp.net and putting a specific path to be saved. windows user.</p>
<p>it is outputting me an error :</p>
<pre><code>System.UnauthorizedAccessException was unhandled by user code
Message=Access to the path 'C:\Users\USER\Desktop\fyp2\CMS TEST4\CMS\CMS\Upload' is denied.
</code></pre>
<p>my code is: </p>
<pre><code> var guid = Guid.NewGuid();
if (File.HasFile)
{
var length = File.PostedFile.FileName.ToString().Length;
var ind = File.PostedFile.FileName.ToString().IndexOf('.');
var sdfs=guid.ToString()+File.PostedFile.FileName.ToString().Substring(ind, length - ind);
File.PostedFile.SaveAs("C:\\Users\\USER\\Desktop\\fyp2\\CMS TEST4\\CMS\\CMS\\Upload");
}
</code></pre>
| c# asp.net | [0, 9] |
3,108,808 | 3,108,809 | javascript event listener for changes in an object variable | <p>I have an object variable that has several properties.</p>
<pre><code>MyVar = {"prop1" : 0, "prop2": 0....};
</code></pre>
<p>How do I write an event listener that listens for a change in any of the properties.</p>
<p>Thanks for your suggestions.</p>
| javascript jquery | [3, 5] |
3,560,670 | 3,560,671 | Search through document and find all inputs with titles | <p>I want to search through my document, and find all inputs with <code>title</code> attribute, but at the same the <code>title</code> attribute can not be empty. So it should look for every input with title attribute that has at least one character in length.</p>
<p>Then I would like to make some event on those inputs (like add them some CSS class).</p>
<p>Is that even possible with jQuery or other javascript library?</p>
| javascript jquery | [3, 5] |
2,591,542 | 2,591,543 | Why doesnt this asp.net Web Application Project compile on change to config? | <p>In a seperate question, yesterday, I was trying to figure out why I had issues with source code pulled from a working site on a server.</p>
<p>The server contains a fully functional website / database (.Net 2).</p>
<p>When I pulled the code down to my Box it wouldnt run. After some head scratching, and liberal use of Reflector on the dll, it became obvious that the source code I had didnt match what was in the bin fodler dlls.</p>
<p>I then noticed that I had Designer.cs files, which means it is a web application project as opposed to a website.</p>
<p>I then created a subdomain on the server, copied the code there and it all worked. So then I changed the web.config file, expecting that to force a recompile and show the same behaviour as I get locally. Only it didnt.</p>
<p>Removing the app.dll's from the bin folder caused an error, but again didnt make the applciation recompile / regenerate dll's.</p>
<p>So I think I have hit a gap in my knowledge. I can change an aspx file and see the change on the site. So I assume that all the code behind was compiled offline, and then uploaded, but the aspx files are still being served as usual html. </p>
<p>So, is this standard behaviour for a web based application as opposed to a website, and if so, is there any way I can make it rebuild on the server to prove to my client that the latest code base isnt on the server and this will be a much bigger job than he is expecting?</p>
| c# asp.net | [0, 9] |
3,731,402 | 3,731,403 | Why does jQuery "toggle" button trigger the Submit button on a form? | <p>I have built a fairly complex form which includes a hidden section that the user can toggle open for entering more information if necessary. However, when you click on this toggle button labeled <strong>I have more Nativities</strong>, it triggers the submit button and prematurely submits the form.</p>
<p>The form is in dev right now, but it can be found <a href="http://www.dayofservice.org/christmas/registration" rel="nofollow">here</a>.</p>
<p>The code I am using for the toggle button is: </p>
<pre><code><script type="text/javascript">
$(function() {
$("#schedule").accordion({ header: "h5", collapsible: true });
$("#more-nativities").hide();
$("#toggle").click(function() {
$("#more-nativities").slideToggle("slow");
});
});
</script>
</code></pre>
<p>The code for the submit button is pretty basic:</p>
<pre><code><input id="submit2" type="image" src="_images/btn_register.jpg" name="submit" alt="" onmouseover="javascript:this.src='_images/btn_register2.jpg'" onmouseout="javascript:this.src='_images/btn_register.jpg'"/>
</code></pre>
<p>The code for the toggle button is:</p>
<pre><code><button id="toggle">I have more nativities</button>
</code></pre>
<p>Any ideas as to why the toggle button is triggering the submit? And more importantly how to solve the problem?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
2,519,061 | 2,519,062 | Relationship between the textbox and image | <p>Hey,
Easy question for ASP.NET profenssionals:
I have a few dynamic generated textboxes in a row. In this row is also a image with an eventhandler "onclick". I will create a relationship between the textbox and the image.
I click on the image, choose a value and then the textbox will be filled.</p>
<p>Currently my controls have following dynamic generated ID's:</p>
<p><strong>Button:</strong></p>
<pre><code>ct100_cph_Detail_rpFields_ct109_rpCell_ct100_cbf_bed1_item_sym
</code></pre>
<p><strong>Textbox</strong></p>
<pre><code>ct100_cph_Detail_rpFields_ct109_rpCell_ct100_tb_bed1
</code></pre>
<p>This two controls must be in a relationship. The best solution for me is with JavaScript, because I have not much ASP.NET skills..</p>
<p>Thanks for help ! :-)</p>
| javascript asp.net | [3, 9] |
1,683,605 | 1,683,606 | How to create a temporary file (for writing to) in C#? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/16656/creating-tempory-folders">Creating tempory folders</a> </p>
</blockquote>
<p>I'm looking for something like the <code>tempfile</code> module in Python: A (preferably) secure way to open a file for writing to. This should be easy to delete when I'm done too...</p>
<p>It seems, .NET does not have the "batteries included" features of the <code>tempfile</code> module, which not only creates the file, but returns the file descriptor (old school, I know...) to it along with the path. At the same time, it makes sure only the creating user can access the file and whatnot (<code>mkstemp()</code> I think): <a href="http://docs.python.org/lib/module-tempfile.html">http://docs.python.org/lib/module-tempfile.html</a></p>
<hr>
<p>Ah, yes, I can see that. But GetTempFileName does have a drawback: There is a race condition between when the file was created (upon call to GetTempFileName a 0-Byte file gets created) and when I get to open it (after return of GetTempFileName). This might be a security issue, although not for my current application...</p>
| c# python | [0, 7] |
4,915,282 | 4,915,283 | Prevent onclick execution with jquery | <p>UPDATED</p>
<p>Html Code:</p>
<pre><code><input type="textbox" id="textbox" value="">
<input type="button" id="btn" value="Validate" onclick="document.write('VALIDATION PASSED')" />
</code></pre>
<p>JS Code:</p>
<pre><code>$(document).ready(function() {
$("#btn").click(function() {
if ($("#textbox").val().length == 0) {
alert("Validation error");
return false;
}
}).prop("onclick", null );
})
</code></pre>
<p>I have updated my code. So the issue is that after first click my onclick event stopped working. How I could fix it?</p>
<p>P.S. Please DO NOT change html code. I have some reasons to ask about it, but please could you please do it only with javascript? I realize that probably this is not the most easy way but I have some technical limitations in my application.</p>
<p>Thanks!</p>
<p>JSFiddle <a href="http://jsfiddle.net/B5GWx/12/" rel="nofollow">http://jsfiddle.net/B5GWx/12/</a></p>
| javascript jquery | [3, 5] |
2,877,296 | 2,877,297 | image embedded in a Custom Server Control | <p>How to use image in Custom Server Control ?</p>
| c# asp.net | [0, 9] |
5,059,351 | 5,059,352 | On delete confirmation window does not appears in php | <p>Please tell where I am wrong so that I can correct it? Its not giving error it should show confirmation window before it deletes record but it directly deletes record </p>
<pre><code><script type="text/javascript">
var elems = document.getElementsByClassName('confirmation');
var confirmIt = function (e) {
if (!confirm('Are you sure?')) e.preventDefault();
};
for (var i = 0, l = elems.length; i < l; i++) {
elems[i].addEventListener('click', confirmIt, false);
}
</script>
</code></pre>
<p>Link for delete:</p>
<pre><code><a href='".$_SERVER['PHP_SELF']."?action=delete&id=$id' class='confirmation'> Delete</a>
</code></pre>
<p>delete function:</p>
<pre><code>if(isset($_GET['action']) && trim($_GET['action'])=="delete")
{
$del="delete from contacts where id='".$_GET['id']."'";
mysql_query($del) or die(mysql_error());
header("Location: mainpage.php");
}
</code></pre>
| php javascript | [2, 3] |
1,692,011 | 1,692,012 | Toggle only the current div after you click its own toggle button? | <p>I have the following HTML structure:</p>
<p>(jade template language)</p>
<pre><code>#review-item-1.review-item
a.submit-review-toggle(href="#").review-item-toggle +
h3 Service
.review-overview
textarea(class='submit-review-overview', name='message', placeholder='Overview')
.review-photo
img(src="images/no-photo.png")
</code></pre>
<p>I want to be able to expand and collapse the height of the <code>.review-item div</code> (at the top):</p>
<pre><code>$(".submit-review-toggle").click(function() {
$(".review-item").animate({
height: "toggle",
}, "slow");
});
</code></pre>
<p>The problem is that I will have a lot of <code>.review-item</code> divs in a single page. So I need to just toggle the 'current' <code>.review-item</code> div after you click its own <code>.submit-review-toggle</code> button.</p>
<p>Any suggestions of how to accomplish this?</p>
| javascript jquery | [3, 5] |
19,210 | 19,211 | How to run a local function from inside an jQ's AJAX request? | <pre><code>var main = {
doSomething: function(){
function firstOne(){}
function secondOne(){
$.ajax({
success: function(){
firstOne(); /* here I want the previous function */
}
});
}
}
}
</code></pre>
<p>How can I run the firstOne() function from the marked line? It's a noobish question perhaps, but I don't get the JS namespace (and I tried).</p>
<p>Is that kind of defining functions good from a JS good practices point of view?</p>
| javascript jquery | [3, 5] |
803,042 | 803,043 | anr broadcast of intent. What is my mistake? | <p>anr broadcast of intent { act=android.provider.Telefony.SMS_RECEIVED cmp=com.site/.SmsReceived {has extras}} in}}</p>
<p>What is my mistake?</p>
<p>Shows the error when it comes to SMS. BroadcastReceiver: connects to sqllite and search number is the same sender SMS.</p>
| java android | [1, 4] |
4,545,744 | 4,545,745 | jQuery: For each attribute of an input element how do I get that input element's name? | <p>I'm looking at each input element that has an attribute named "isDate". I want to find that attributes parent input element's name attribute.</p>
<pre>
<input name="A0000" isDate="true" value="01/01/2020" />
<input name="A0001" isDate="true" value="01/01/2021" />
<input name="A0002" isDate="true" value="01/01/2022" />
<input name="A0003" isDate="true" value="01/01/2023" />
<input name="A0004" isDate="true" value="01/01/2024" />
<input name="A0005" isDate="true" value="01/01/2025" />
$("input[isDate="true"]).each(function(){
var _this = this;
// do stuff then...
// get name of input
var name = $(_this).parent().attr("name").val(); // this doesn't work
});
</pre>
| javascript jquery | [3, 5] |
5,482,725 | 5,482,726 | Using ID as a variable | <p>I'm trying to find the text of the span with the class name "link" but i have problems.</p>
<pre><code><div id="item-0" class="box">
.......
</div>
<div id="item-1" class="box">
<p><strong>Link: </strong><span class="link">http://www.domain.com/list44/</span></p>
<p><input type="submit" value="submit" class="load-button2"></p>
</div>
<div id="item-2" class="box">
.......
</div>
$(".load-button2").click(function(){
var id = $(this).closest('.box').attr('id');
alert(id); // showing the right box ID
var linkp = $(/*** what should i put here? ***/ "#" + id + " .link").text;
});
</code></pre>
| javascript jquery | [3, 5] |
540,274 | 540,275 | Jquery multiple forms in same page | <p>I have the following dynamically generated HTML</p>
<pre><code><div id="1">
<form name = "inpForm">
<input name="FirstName" type="text"/>
<input type="submit" value="Submit"/>
</form>
</div>
<div id="2">
<form name = "inpForm">
<input name="FirstName" type="text"/>
<input type="submit" value="Submit"/>
</form>
</div>
</code></pre>
<p>The outer divs have different IDs but the form names are the same. I am using Jquery to perform some validation when the form is submitted. However, when the second form is submitted, I always get the values of the first form.</p>
<pre><code>$(document).ready(function () {
$('form[name="inpForm"]').live('submit', function () {
alert($('input[name="FirstName"]').val());
return false;
});
});
</code></pre>
<p>How can I modify myJquery to find the "FirstName" element that matches the current form where the submit was triggered?
Thanks</p>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.