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 |
---|---|---|---|---|---|
783,809 | 783,810 | Best way to change a form action upon submit | <p>Basically I have a form with a few drop-downs, but the page I'd like to be set as the action of the form submit would be based on the option chosen in one of the drop downs. I'd like to stick with one submit button, so it seems a little tricky. Can anyone point me in the right direction?</p>
| php javascript jquery | [2, 3, 5] |
5,279,824 | 5,279,825 | checkbox filtering system | <p>I came across this page at <a href="http://www.walmart.com/browse/Computers/Desktop-Computers/_/N-96fg?browsein=true&catNavId=3951&ic=48_0&ref=%20428236" rel="nofollow">walmart.com</a> and on the left side of the page is a checkbox filtering system that is done on the client side. When you check the price checkbox selection it filters out the brands and disables enables/disables them etc.</p>
<p>When i had a look at the source code the checkboxes have no values and when i tried to find the <code>REFINEMENT.clicked</code> event I couldn't find it when I downloaded the page. It's a very big page with lots of code and would prob take a long time to go through it.</p>
<p>I was wondering how could I implement this filtering system in jquery for the client side. You could use a array that stores values but how would i know which properties the filters have as each page would show different filters (other than price range) based upon the product type.</p>
<p>If someone could point me in the right direction or give an example as to what to do that would help.</p>
| javascript jquery | [3, 5] |
3,091,217 | 3,091,218 | Detect HTML in ASP.NET | <p>(clarification: this is an old question that has been tweaked for admin purposes)</p>
<p>There have been a fair amount of questions on this site about parsing HTML from textareas and whatnot, or not allowing HTML in Textboxes. My question is similar: How would I detect if HTML is present in the textbox? Would I need to run it through a regular expression of all known HTML tags? Is there a current library for .NET that has the ability to detect when HTML is inserted into a Textarea?</p>
<p>Edit: Similarly, is there a JavaScript Library that does this?</p>
<p>Edit #2: Due to the way that the web app works (It validates textarea text on asyncronous postback using the Validate method of ASP.NET), it bombs before it can get back to the code-behind to use HTML.Encode. My concern was trying to find another way of handling HTML in those instances.</p>
| c# javascript asp.net | [0, 3, 9] |
2,670,344 | 2,670,345 | Asp.Net(C#) Label Text inline | <pre><code><asp:TextBox ID="TextBox1" runat="server" Text='<%# DateTime.Now.ToLongDateString() %>'></asp:TextBox>
</code></pre>
<p>ı need textbox text set DateTime.Now.ToLongDateString() how to make ?
must inline</p>
| c# asp.net | [0, 9] |
3,479,220 | 3,479,221 | Use jQuery.data to get a boolean from a dom element? | <p>According to <a href="http://api.jquery.com/data/#data2" rel="nofollow">jQuery's .data() documentation</a> you can use the .data() method to <code>data</code> prefixed attributes from a dom element. For example:</p>
<pre><code>{# Include jquery.... #}
<div id='mydiv' data-foo='bar'></div>
<script>
var foo = $('#mydiv');
foo.data('foo'); // == 'bar'
</script>
</code></pre>
<p>That said, I'm curious how you set and pass boolean values in these dom objects. As far as I know, this does <strong>not</strong> work:</p>
<p><strong>Throws a javascript error:</strong></p>
<pre><code>{# Include jquery.... #}
<div id='mydiv' data-foo=false></div>
</code></pre>
<p><strong>Sets a string instead of a boolean:</strong></p>
<pre><code>{# Include jquery.... #}
<div id='mydiv' data-foo='false'></div>
<script>
var foo = $('#mydiv');
foo.data('foo'); // == 'false'
</script>
</code></pre>
<p>So, how do I set boolean values in the dom? <em>Or</em>, do I have to convert these string values to booleans in my javascript (which seems lame)?</p>
| javascript jquery | [3, 5] |
4,734,850 | 4,734,851 | Setting a Range for a Textarea based on User Input | <p>I have a textarea and I'm trying to check if someone enters <strong>{{link</strong> that I can have a modal pop up to let them complete some information. </p>
<p>What I have now is that if someone enters the letter k, it will go back 6 characters and then determine if the text matches <strong>{{link</strong> </p>
<p>But I'm having a problem in setting setting the start and end points for the range. I think that the problem is with identifying the node, but I'm not sure.</p>
<p>Mainly when someone enters a the letter "k", I'm just trying to go back to check if they had typed: <strong>{{link</strong> and if they did, it would launch a modal. </p>
<p>This is what I have that isn't working at the part where I'm trying to set the range and get the selection.</p>
<pre><code>$(document).on('keyup', 'textarea', function(e) {
if (e.keyCode == 75) {
var end = $('textarea').getCaretPosition();
var start = end - 6;
var node = $(this).get(0);
var range = document.createRange();
range.setStart(node, start);
range.setEnd(node, end);
var selection = range.toString();
if( selection == '{{link' ){
// we'll launch a modal here
}
}
});
$.fn.getCaretPosition = function() {
var el = $(this).get(0);
var pos = 0;
if ('selectionStart' in el) {
pos = el.selectionStart;
} else if ('selection' in document) {
el.focus();
var Sel = document.selection.createRange();
var SelLength = document.selection.createRange().text.length;
Sel.moveStart('character', -el.value.length);
pos = Sel.text.length - SelLength;
}
return pos;
}
</code></pre>
<p>This generates the error: Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1 at range.setStart(node, start);</p>
| javascript jquery | [3, 5] |
2,926,353 | 2,926,354 | Why can I not access the data attribute of an element with jQuery. | <p>I have the following HTML:</p>
<pre><code> <div class="button disabled dialogLink"
id="edit"
data-action="Edit" >
<div class="sprite-blank" ></div>
</div>
</code></pre>
<p>This javascript</p>
<pre><code>$('.dialogLink')
.click(function () {
adminDialog(this);
return false;
});
function adminDialog($link) {
"use strict";
link = {
action: $link.data('action') || ''
</code></pre>
<p>I get an error saying </p>
<pre><code>Uncaught TypeError: Object #<HTMLDivElement> has no method 'data'
</code></pre>
<p>Does anyone have an idea what I am doing wrong. It seems very simple code so I can't understand what's wrong.</p>
| javascript jquery | [3, 5] |
4,190,148 | 4,190,149 | Infinite Recursion using callback function in jQuery | <p>Experimenting with jQuery and trying to make a small slide show that rotates through three images. Here's my HTML:</p>
<pre><code><div id="slideShow">
<img src="images/slides/slide1.jpg" width="520" height="230" />
<img src="images/slides/slide2.jpg" width="520" height="230" />
<img src="images/slides/slide3.jpg" width="520" height="230" />
</div>
</code></pre>
<p>And here's the script:</p>
<pre><code>$(function ()
{
var $slides = $('#slideShow img').hide(),
slideIndex = 0;
slideTransition = function ()
{
slideIndex++;
(slideIndex == $slides.length) ? slideIndex = 0: null;
$slides.eq(slideIndex).fadeIn(3000);
$slides.eq(slideIndex).fadeOut(3000,slideTransition);
}
$slides.eq(0).fadeIn(3000);
$slides.eq(0).fadeOut(3000, slideTransition);
});
</code></pre>
<p>This actually works fine, but my gut is telling me that having the infinite recursion is a bad thing. Any suggestions on how to do this better?</p>
| javascript jquery | [3, 5] |
1,213,684 | 1,213,685 | How to pass the value of a list or an array from code behind to jquery? | <p>Let's say I want to scan my local drive or a particular local folder for all images. What I want to do is get all the location of all the images and store it in a list/array then after that JQuery will going to refer to the list/array for a slideshow.</p>
<p>Please help me with this.</p>
| c# jquery asp.net | [0, 5, 9] |
2,671,100 | 2,671,101 | how to upload ppt and display ppt in website using c# | <p>How can I display an uploaded power point presentation inside a c# asp.net web application?</p>
| c# asp.net | [0, 9] |
2,543,459 | 2,543,460 | How can I use my coding skills for good? | <p>By this autumn my two small websites should be generating around a total of $1200 a month with minimal/zero input which is enough to for me to live on comfortably enough. </p>
<p>Rather than embark on another business venture, I would love to spend the next few years doing something genuinely good or that helps other people that need it. I want to spend 4 or 5 years dedicating my time to a worthy cause and do the most I can to help with the web development & programming skills that I already have.</p>
<p>The problem is that I don't know where to start. I don't have an awesome idea of my own and am very sceptical of many large charities. Ideally I'd like to find a small project where everyone is unpaid and focused on helping.</p>
<p>Are there any such small organisations?</p>
<p>Does anyone have an idea for a project/website/app that can help people in need that they would like me to work on or work with them on?</p>
<p>I know this isn't a typical StackOverflow 2+2=? type question and some of you will be itching to delete it but considering the philanthropic nature of the IT industry (just look at S.O. itself) this is very relevant question to many developers either now or at some point in their careers. Given the recent events in Japan this question is particularly relevant with many people looking for ways they can help others with the skills/time that they have available.</p>
<p>Really looking forward to reading your thoughts/answers on this, thanks guys</p>
| c# java php javascript jquery | [0, 1, 2, 3, 5] |
658,412 | 658,413 | Any alternative of Turn.js(Its not working on IE8/7) | <p>There is any alternative of Turn.js. It's not working on IE8/7. I need flip effect on IE7\8. Please help.</p>
| javascript jquery | [3, 5] |
1,669,099 | 1,669,100 | How to disable the url address bar using javascript or jquery | <p>I've got a spring mvc framework and I want to disable the url address bar when the page loads! (It's not a public web application) How can I achieve this using javascript or jquery. </p>
<p>Update :</p>
<p>Guys, If I can make the url bar read only that would be okay too!</p>
| javascript jquery | [3, 5] |
2,357,482 | 2,357,483 | How can I automate chaining a series of ajax requests? | <p>Look at the lower part of my function: I want to repeat <code>info(url_part1 + next + url_part2, function(next) {</code> couple of times. Is there a smarter way than one presented below (maybe some kind of loop)? I've been thinking whole day and I can't devise anything.</p>
<pre><code> function info(link, callback) {
$.getJSON(link, function(json) {
$.each(json.data.children, function(i, things) {
$("#threadlist").append('<img src="' + things.data.url + '">');
});
callback(json.data.after);
});
}
var url_first = "http://www.reddit.com/r/aww/.json?jsonp=?";
var url_part1 = "http://www.reddit.com/r/aww/.json?after=";
var url_part2 = "&jsonp=?";
info(url_first, function(next) {
info(url_part1 + next + url_part2, function(next) {
info(url_part1 + next + url_part2, function(next) {
info(url_part1 + next + url_part2, function(next) {
info(url_part1 + next + url_part2, function(next) {
});
});
});
});
});
</code></pre>
<p>Js fiddle: <a href="http://jsfiddle.net/rdUBD/1/" rel="nofollow">http://jsfiddle.net/rdUBD/1/</a></p>
| javascript jquery | [3, 5] |
899,055 | 899,056 | Access to variable | <p>When I do a console trace on the positionSlides method its showing slideShow as undefined.
How can this be when I clearly instantiate it in the document.ready callback. I also make sure to make this variable global so both the slideShow and the slideShowNavigation would have access to both these variables.</p>
<pre><code>var slideShow, slideShowNavigation;
$(document).ready(function(){
slideShow = new SlideShow( $('#header #slideshow'), 980 );
slideShowNavigation = new SlideShowNavigation( $('#header').find("#leftArrow"), $('#header').find("#rightArrow") );
});
// SLIDE SHOW CLASS
function SlideShow( divContainer, slideWidth ){
// Check to make sure a new instance is created
if( ! (this instanceof SlideShow) ) return new SlideShow();
this.$imageContainer = divContainer;
this.slideWidth = slideWidth;
var maxImages = this.$imageContainer.children().length;
this.getMaxSlides = function(){
return maxImages;
}
this.positionSlides();
}
SlideShow.prototype.positionSlides = function(){
console.log('imageContainer = '+slideShow);
}
SlideShow.prototype.update = function( dir ){
}
// ARROW NAVIGATION FOR SLIDESHOW
function SlideShowNavigation( left, right){
if( ! (this instanceof SlideShowNavigation) ) return new SlideShowNavigation();
//this.updateArrows( slideShow.$imageContainer.find(":first") );
}
SlideShowNavigation.prototype.updateArrows = function( item ){
}
</code></pre>
| javascript jquery | [3, 5] |
4,114,062 | 4,114,063 | Ajax Autocomplete code not working(with database) | <p>I have wriiten a simple ajax autocomplete code in Asp.net ( C#)</p>
<p>This is the code</p>
<p><strong>ASPX</strong></p>
<pre><code><asp:TextBox ID="TextBox1" runat="server" Height="21px" Width="80px"></asp:TextBox>
<asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" MinimumPrefixLength="1" ServiceMethod="GetCompletionList" TargetControlID="TextBox1" UseContextKey="True"></asp:AutoCompleteExtender>
</code></pre>
<p><strong>CodeBehind</strong></p>
<pre><code>string connString = ConfigurationManager.ConnectionStrings["Station"].ToString();
string selectString = "SELECT *from Station";
List<String> CustList = new List<string>(count);
using (SqlConnection sqlConn = new SqlConnection(connString))
{
sqlConn.Open();
using (SqlCommand sqlCmd = new SqlCommand(selectString, sqlConn))
{
SqlDataReader reader = sqlCmd.ExecuteReader();
while (reader.Read())
CustList.Add(reader["DBRT"].ToString());//DBRT is the Column name
}
}
return (CustList.ToArray());
</code></pre>
<p>When i execute and run the program nothing happens. I dont know what has went wrong. Please guide me.</p>
| c# asp.net | [0, 9] |
3,933,292 | 3,933,293 | How can I do client side text formatting on a Data-bound field inside a repeater? | <p>I have a repeater control with some html controls being populated from some server side DataSource. The code for these controls inside the repeater looks something like this..</p>
<pre><code><img src='<%# DataBinder.Eval(Container.DataItem, "Path")%>' title='<%# DataBinder.Eval(Container.DataItem, "Name")%>' alt="">
</code></pre>
<p>I needed to format some of the text so I added a method to this code. The method I added is a server side method though. So I'm assuming this isn't exactly the best way to handle things in terms of performance. The code looked something like this...</p>
<pre><code><span><%# trimItemName((DataBinder.Eval(Container.DataItem, "Name"))%></span>
</code></pre>
<p>trimItemName(Object obj) is a server side method that will obviously trim the name.</p>
<p>Is there a way I can do this using javascript so doing a simple string trimming (or any other kind of formatting) doesn't have to be done on the server side?</p>
| c# asp.net javascript | [0, 9, 3] |
4,399,894 | 4,399,895 | javascript: how do I pass safe strings to an array for client side display without messing it up / ASP.NET C# | <p>platform: ASP.NET 3.5 / C#</p>
<p>My requirement is this:</p>
<p>I want to create a rather large array on the server side (in C#) and pass it to the browser via </p>
<pre><code>Page.ClientScript.RegisterArrayDeclaration("gBank", js);
</code></pre>
<p>My array is a 2-dimension array, and I am constructing it right to pass it to the client. Simple cases work fine.</p>
<p>My problem is the content of the array - there are several strings, for e.g.</p>
<pre><code>[[4, 'hello there', 'this is \n one'],[5,'again','there's another string']] etc.
</code></pre>
<p>These strings can have new lines, ',- and other such characters including < > etc. I did a replace '\n' with '\n' and that was fine, but other characters like ' mess up the array string in the client side.</p>
<p>How do I pass these strings 'safely' so that the array is not messed on the client side, and the content displays as-is?</p>
<hr>
<p>I found this code on Rick Stahl's blog</p>
<p><a href="http://www.west-wind.com/weblog/posts/114530.aspx" rel="nofollow">http://www.west-wind.com/weblog/posts/114530.aspx</a></p>
<p>and it seems to work pretty well.</p>
| c# javascript asp.net jquery | [0, 3, 9, 5] |
4,422,737 | 4,422,738 | Why are javascript comments downloaded to the browser? | <p>Using aspnet 3.5. </p>
<p>I have some javascript functions in my aspx file. </p>
<p>Why do the javascript comments get passed to the browser? It makes the download file unnecessarily large. </p>
| asp.net javascript | [9, 3] |
4,200,544 | 4,200,545 | writing javascript in ftl file | <p>I have an ftl file which is sending a notification e-mail. I need to change the subject line of these mails. So, far I have managed to change the subject and pass a URL in it. But my requirement is to pass a specific parameter from the URL. Can I write a java scriplet or javascript function inside this file. </p>
<p>Here is the snippet of code:</p>
<pre><code><@s.document "${emailDigestBean.containerHtmlUrl}">
<#if u.isHtml()>
<h1>${emailDigestBean.localizedText}</h1>
<#if emailDigestBean.briefDesc??>
<p id="message">${emailDigestBean.briefDesc}</p>
<p>Added By Me:${emailDigestBean.containerHtmlUrl}</p>
</#if>
</code></pre>
<p>${emailDigestBean.containerHtmlUrl}....contains the URL which I want to parse.</p>
<p>Thanks in advance.</p>
| java javascript | [1, 3] |
3,222,847 | 3,222,848 | how to pass list as parameter in function | <p>I have taken a list and insert some value in it</p>
<pre><code>public List<DateTime> dates = new List<DateTime>();
DateTime dt1 = DateTime.Parse(12/1/2012);
DateTime dt2 = DateTime.Parse(12/6/2012);
if (dt1 <= dt2)
{
for (DateTime dt = dt1; dt <= dt2; dt = dt.AddDays(1))
{
dates.Add(dt);
}
}
</code></pre>
<p>Now I want pass this List i.e dates as a parameter to some function like-</p>
<pre><code>somefunction(dates);
</code></pre>
<p>How exactly can i achieve this?</p>
| c# asp.net | [0, 9] |
2,593,689 | 2,593,690 | Problem with array script | <p>i want to give anchor tag to an image while checking the condition in slide show where my slide show is displayed using script</p>
<pre><code> <script type="text/javascript">
var res;
var hdnvalue = a = document.getElementById('HiddenField4').value;
var imgArr = hdnvalue.split(';');
var sp = [];
for (var count = 0; count < imgArr.length; count++) {
sp.push([imgArr[count], "", "", ""]);
}
var mygallery2 = new fadeSlideShow({
wrapperid: "fadeshow2",
dimensions: [568, 313],
imagearray: sp,
displaymode: {
type: 'auto',
pause: 2500,
cycles: 0,
wraparound: false
},
persist: false,
fadeduration: 500,
descreveal: "always",
togglerid: "fadeshow2toggler"
})
</script>
</code></pre>
<p>in this script i want to check the condition</p>
<pre><code> 'hdnLink' value->http://dev1.maxnet-tech.com/royalindustries/ProductList.aspx?s=4&sss1=17&sss2=3;;;
var cnLink = document.getElementById('hdnLink').value;
var cnSplit = cnLink.split(';');
var b = a.split(';');
if (cnSplit[0] != "") {
then add <a>tag th that image which is redirected to plroduclist page
}
else {
add img
}
</code></pre>
<p>how can i add tag to image acc to condition in an array like above script</p>
| javascript asp.net | [3, 9] |
3,822,744 | 3,822,745 | Beginner ASP.NET C# question about dynamically changing master pages | <p>OK, here's the thing... You fetch the user's IP address and based on his/her country you redirect the user to a specific webpage. Now, how do you change the master page dynamically? This is how I am redirecting the user :-</p>
<p><a href="http://stackoverflow.com/questions/3690278/fetching-ip-address-and-displaying-country-in-c-and-asp-net">Geolocation Error with IP Address 127.0.0.1</a></p>
<p>It's not like the user clicks some button or something and you then change the master page. I want it changed when the user is redirected, so how exactly do I go about it?</p>
<pre><code>public partial class testClass: System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (redirected to site1)
{
Use this master page1
}
else
if (redirected to site2)
{
Use this master page2
}
}
}
</code></pre>
<p>So how do I check what SITE the user has been redirected to? Also HOW to apply the specific master page now that the user has been redirected?</p>
<p>I just need an idea how to go about it.</p>
<p><strong>[EDIT] please check the code block below. How do I fetch the URL that the user has been redirected to? I actually need just the "iso3166TwoLetterCode" variable's value (see the link to my earlier question, please) and based on that will be changing the master page. I can't figure out how to fetch that value or even use that class (that's got this variable) in my testClass</strong>.</p>
<pre><code> protected void Page_PreInit(object sender, EventArgs e)
{
if (user Has been redirected to www.site.in )
{
this.MasterPageFile = "master1.master";
}
if (user Has been redirected to www.site.fr )
{
this.MasterPageFile = "master2.master";
}
}
</code></pre>
| c# asp.net | [0, 9] |
3,795,144 | 3,795,145 | How do i remove :hover? | <p>I have a small problem with a script.
I want to have a default action on :hover for those with javascript disabled but for those with javascript enabled i want another action (actually... same action, but i want to add a small transition effect).</p>
<p>So... How can i do this? I am using jquery.</p>
| javascript jquery | [3, 5] |
2,152,046 | 2,152,047 | Creating array lists using Json object file in android | <p>Please check out my following code</p>
<pre><code>String jsonString = writer.toString();
JSONObject jsonObj = new JSONObject(jsonString);
defaultCurrencyValue = jsonObj.getString(DefaultCurrencyKey);
currenciesTypes = jsonObj.get(CurrenciesKey);
</code></pre>
<p>This is what i get the values of curenciesType object class variable when i used Debugger</p>
<pre><code>currenciesTypes JSONObject (id=830084916104)
myHashMap HashMap (id=830084916120)
[0] HashMap$HashMapEntry (id=830084916440)
key "PKR" (id=830084916256)
value "Rs" (id=830084916368)
[1] HashMap$HashMapEntry (id=830084917208)
key "EUR" (id=830084917064)
value "€" (id=830084917176)
[2] HashMap$HashMapEntry (id=830084916696)
[3] HashMap$HashMapEntry (id=830084916952)
</code></pre>
<p>Please anyone can tell me how can i save <code>key</code> and its <code>values</code> in two array lists?</p>
<p>Best Regards</p>
| java android | [1, 4] |
5,903,808 | 5,903,809 | Multi step form with jQuery which degrades nicely if JS is turned off | <p>I currently had my form set up so that each section was refreshed using Ajax, however it didn’t degrade gracefully with JavaScript turned off and I’ve looked into putting each part of the form in to a separate view which works fine but isn’t that great to be honest.</p>
<p>I know the client wants it to look nice so I thought about using jQuery to show and hide forms, so if JavaScript is turned off then all of the forms build in to one long form. However the only problem I am facing is that after each section the user needs to submit this information for it to be validated before the next stage is completed. How can I do this if JavaScript is turned off because the other forms will be visible...</p>
<p>Any ideas? Thanks.</p>
| javascript jquery | [3, 5] |
4,453,905 | 4,453,906 | .each() on JQuery Dropdown | <p>I'm trying to create a JQuery Dropdown similar to the one used in bootstrap.</p>
<p>The problem which arises is that when an individual list item is clicked, all sub navigation's display block.</p>
<p>Now I know this issue can be resolved with .each() but my code does not seem to work.</p>
<p>Please find the example here; <a href="http://jsfiddle.net/N7xgC/" rel="nofollow">http://jsfiddle.net/N7xgC/</a></p>
<p>Apologies if this question has already been asked before.</p>
<p>B</p>
| javascript jquery | [3, 5] |
2,524,549 | 2,524,550 | send minus from jquery to php page | <p>now i want send the - i mean Minus one to php
but when send it its not sending as a word
i cant tell you because i dont understand
see
in php when write <code>"$var"</code> its return <code>$var</code> value but when write '$var' its returm $var
how i can make this in jquery</p>
<pre><code>var dataString = 'vote=-1';
$.ajax({
type: "POST",
data: dataString,
cache: false,
});
</code></pre>
| php jquery | [2, 5] |
5,736,675 | 5,736,676 | Auto hide element by jquery - code not work | <p>I have an element in aspx page with class= "._aHide" it carrying a message, And it is shown repeatedly.</p>
<pre><code><div id="Message1" class="._aHide" runat="server" visible="true"><p>My Message</p></div>
</code></pre>
<ul>
<li>aspx server side elements not created when page load if it's visible property = true.</li>
</ul>
<p>I need to hide this div after 7 seconds of show it, unless mouse over.</p>
<p>I created this code</p>
<pre><code>$(document).ready(function () {
var hide = false;
$("._aHide").hover(function () {
clearTimeout(hide);
});
$("._aHide").mouseout(function () {
hide = setTimeout(function () { $("._aHide").fadeOut("slow") }, 7000);
hide;
});
$("._aHide").ready(function () {
hide = setTimeout(function () { $("._aHide").fadeOut("slow") }, 7000);
hide;
});
});
</code></pre>
<p>But somthings wrong here</p>
<p>1- this code work for one time only, And I show this message many times.</p>
<p>2- All message boxes hides in one time, because I can't use $(this) in settimeout and I don't know why.</p>
<p>Thank you for your help, and I really appreciate it</p>
| javascript jquery | [3, 5] |
2,936,044 | 2,936,045 | Why isn't this working - using :not() with an event handler | <p>I seem to have another issue that I am not conquering. Real simple premise.
I have a mousedown event, and basically IF one particular element on the page is clicked, I want nothing to happen, else I want hide() some div.</p>
<pre><code> $(function(){
$("document :not(#_ignorelement)").mousedown(function(event){
if($('#_hidethiselement').length){
$('#_hidethiselement').hide();
}
})
})
</code></pre>
<p>That is not working at all. I also tried the following:</p>
<pre><code> $(document).not($("#_ignorelement")).mousedown(function(event){
$(document).not("_ignorelement").mousedown(function(event){
</code></pre>
<p>IF I can solve that, curious how I would actually have ":not" encompass the parent div, like so:</p>
<pre><code>$().not("_ignoreelement").parent().closest('div').mousedown(function
</code></pre>
<p>Because the element "_ignorelement" is an anchor tag that is in a div. Wonder how I can use the parent div perhaps, instead of the anchor tag.</p>
<p>Anyways, any help would be appreciated.</p>
| javascript jquery | [3, 5] |
4,852,537 | 4,852,538 | javascript length duration | <p>i have following function in php, how can i convert this in javascript?</p>
<pre><code> function length_duration ($seconds)
{
$hours = $mins = $sec = NULL;
//for seconds
if($seconds > 0)
$sec = ($seconds % 60 < 10) ? "0".($seconds%60) : ($seconds%60);
//for mins
if($seconds > 60)
$mins = (($seconds/60%60)<10) ? "0".($seconds/60%60).":" : "".($seconds/60%60).":";
//for hours
if($seconds/60 > 60)
$hours = (($seconds/60/60) < 10) ? "0".($seconds/60/60).":" : "".($seconds/60/60).":";
return $hours.$mins.$sec;
}
</code></pre>
| php javascript jquery | [2, 3, 5] |
5,972,629 | 5,972,630 | Submit multiple GET parameters from Android | <p>I have a PHP web service running that looks for a couple .GET variables. Here is the code I was using previously that worked with one param, but fails when I try for two. Any help would be really appreciated:</p>
<pre><code>//the year data to send
ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("db", Customer_ID));
nameValuePairs.add(new BasicNameValuePair("item_type", item_type));
//http post
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("url here");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}catch(Exception e){
Log.e("log_tag", "Error in http connection "+e.toString());
}
</code></pre>
| php android | [2, 4] |
530,960 | 530,961 | jQuery callback within the remove() function | <p>I need to call a function after a DIV has been removed from the page. </p>
<p>I have tried adding a callback like so, but no luck. Any suggestions?</p>
<pre><code>$(foo).remove( function() {
stepb();
});
</code></pre>
| javascript jquery | [3, 5] |
2,672,096 | 2,672,097 | How can I change the code so that it can execute? | <p>I use jQuery to develop mobile applications. The problem is that when I add 5 or 6 lines to the page, all goes well, but if I add say 120 lines it displays an error message: <code>Javascript execution exceeded timeout</code>.</p>
<pre><code>function succes_recu_list_rubrique(tx, results) { //après avoir rempli sqlite
console.log('ENTRééééééééééééééé---');
$('#lbtn').prepend("<legend>Sélectionner une rubrique</legend><br>");
for(var i=0; i<results.rows.length; i++) {
//Remplir tableau liste des identifiants étapes
$('#lbtn').append("<input name='opt1' checked type='radio' value="+results.rows.item(i).IdRubrique+" id="+results.rows.item(i).IdRubrique+" />");
$('#lbtn').append('<label for='+results.rows.item(i).IdRubrique+'>'+results.rows.item(i).LibelleRubrique+'</label>');
}
$('#lbtn').append('<a href="#page_dialog2" class="offer2" data-rel="dialog" data-role="button" >Consulter</a>').trigger('create');
$('#lbtn').append('<a href="#'+id_grp_rub+'" data-role="button" data-rel="back" data-theme="c">Cancel</a>').trigger('create');
}
</code></pre>
| javascript jquery | [3, 5] |
2,577,469 | 2,577,470 | Jquery load and page source refresh | <p>I am loading some table into a div with <code>jquery.load()</code>.
The problem is, that when it is loaded, I can't find it with <code>$("something");</code> and I can't see it in a page source.</p>
<p>What should I do?</p>
<p>My code:</p>
<pre><code>$("span#loadMeBadminton").load("badminton/gen/"+date);
</code></pre>
| php javascript jquery | [2, 3, 5] |
2,132,206 | 2,132,207 | jQuery slide changing with index and fadeout -- jumpiness | <p>I am working on a jQuery slideshow plugin. One of my methods involves switching back and forth between pictures. I have been pretty successful in creating it, here is an isolated case with the code thus far for the particular method:</p>
<pre><code>var images = $("#simpleslides").children("img");
$(".slideButtons ul li").on("click", "a", function() {
var anchorIndex = $(this).parent().index();
var $activeSlide = $("#simpleslides img:visible");
var $targetSlide = $(images[anchorIndex]);
if($activeSlide.attr("src") == $targetSlide.attr("src") || $targetSlide.is(":animated")) {
return false;
} else {
$activeSlide.css({ "z-index" : 0 });
$targetSlide.css({ "z-index" : 1 });
$targetSlide.stop().fadeIn("slow", function() {
$activeSlide.hide();
});
}
});
</code></pre>
<p>Here is a fiddle to see it in working action: <a href="http://jsfiddle.net/ase3E/" rel="nofollow">http://jsfiddle.net/ase3E/</a></p>
<p>For the most part, this works as you would expect it to. When a user clicks on the corresponding number, it fades in the picture. </p>
<p>However, I am running into some jumpiness and occasionally a complete <code>hide</code> of the slides when I am clicking around quickly. If you play with the fiddle, you will see what I am referring to Try clicking around on each image to see.</p>
<p>I have adopted <code>stop</code> which I thought would fix the problem but has not. I have put the <code>hide</code> method after the <code>fadeIn</code> callback, but that has also not helped the situation.</p>
<p>What am I doing wrong here??</p>
| javascript jquery | [3, 5] |
1,316,237 | 1,316,238 | c# session multidimensional array | <p>I'm trying to add form data from an asp.net wizard into a session array object. The object should store the question number and question answer selected by the user for each question. I'm trying to use a multidimensional array to store the question number and the associated answer. I would also be open to using a hashtable or dictionary solution.</p>
<p>This is the code I've got so far:</p>
<pre><code>string[,] strQandA = new string[10, 2] {{"1", Q1.SelectedValue}, {"2", Q2.SelectedValue}, {"3", Q3.SelectedValue}, {"4", Q4.SelectedValue}, {"5", Q5.SelectedValue}, {"6", Q6.SelectedValue}, {"7", Q7.SelectedValue}, {"8", Q8.SelectedValue}, {"9", Q9.SelectedValue}, {"10", Q10.SelectedValue}};
Session["mySession"] = strQandA;
</code></pre>
<p>Is this correct? Any help would be appreciated. Thanks</p>
| c# asp.net | [0, 9] |
697,080 | 697,081 | preventing android daily alarm from running the intent during alarm setup | <p>I followed the instructions in <a href="http://stackoverflow.com/questions/7845660/how-to-run-a-service-every-day-at-noon-and-on-every-boot">this thread</a> to create a daily alarm that starts a service at 12:30 each day which shows a notification. The problem I'm having is that setting the alarm also triggers the service (=> and the notification) every time the app starts.</p>
<p>Since I figured that the alarm will run only at the specified time (12:30) then I have no problem setting it when the app starts.</p>
<p>I realize that setting the alarm from scratch every time the app is launched is a bit ineffective since it only needs to be set once (I made it set on device boot as well), but it seemed like the easiest way.</p>
<p>So what's the best way to fix this? is there a way to set the alarm for the specified time without running the intent when setting?</p>
<p>Here's the code if you are interested (this function is called every time when launching the app):</p>
<pre><code>public static void setAlarm(Context context)
{
Intent intent = new Intent(context, AlarmReceiver.class);
intent.setAction("com.Rani.app.SET_NOTIFICATION_ALARM");
PendingIntent pendingIntent = PendingIntent.getBroadcast(context,
0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
Calendar dailyCheckTime = Calendar.getInstance();
dailyCheckTime.setTimeZone(TimeZone.getTimeZone("GMT"));
dailyCheckTime.set(Calendar.HOUR_OF_DAY, 12);
dailyCheckTime.set(Calendar.MINUTE, 30);
AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarm.cancel(pendingIntent);
alarm.setRepeating(AlarmManager.RTC_WAKEUP, dailyCheckTime.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pendingIntent);
}
</code></pre>
<p>thanks in advance.</p>
| java android | [1, 4] |
3,224,546 | 3,224,547 | How to play .avi video with android 2.2 sdk in java? | <p>I'm very new to android jdk,</p>
<p>anyone knows how to play <code>.avi</code> in it?</p>
| java android | [1, 4] |
4,894,142 | 4,894,143 | Image src not working in jquery | <p>i have a function,</p>
<pre><code>function showimage(a)
{
$("#lightboxholder").show("fast");
$('#lightboximage').attr('src', 'images/demo/190x90.gif');
}
</code></pre>
<p>when i go to localhost/svce and view in gallery.php, it doesnt show me the image, however if i replace <code>$('#lightboximage').attr('src', 'images/demo/190x90.gif');</code> by <code>$('#lightboximage').attr('src', 'http://localhost/svce/images/demo/190x90.gif');</code>
then it shows me the image, sorry for my bad english, thanks</p>
| javascript jquery | [3, 5] |
1,505,538 | 1,505,539 | How to multiply text box values with javascript | <p>I would like to multiply the values from two text boxes (txtBox1 should contain an Integer value, txtBox2 should contain a Float value) and place the result in a third text box. My code is below, but it doesn't work. The javascript function is called, otherwise it fails. Can someone please help me to code this correctly :\ ? Thank you</p>
<pre><code> //the javascript function
function CalculateTotal(id1, id2) {
var txt1 = document.getElementById(id1);
var txt2 = document.getElementById(id2);
var total = txt1 * txt2;
document.getElementById("txtTotal").value = parseFloat(total);
}
//c# code, programmatically adding attribute
txtBox1.Attributes.Add("onBlur", "CalculateTotal('txtBox1, txtBox2')");
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
2,096,218 | 2,096,219 | How to add a Hyperlink to a dynamic gridview column | <p>I have an issue hope someone can help.</p>
<p>I have a dynamic gridview. I need to have a hyperlink on gridview column. These hyperlink should open a popup to display certain data on clicking.</p>
<p>I tried this by having a dynamic template field . But even on binding the data , I'm unable to get the hyper link for the column. I'm able to get the data but not the hyperlink.</p>
<p>This is the HyperLinkTemplate class which is implementing ITemplate.</p>
<p>public class HyperLinkTemplate : ITemplate
{
private string m_ColumnName;
public string ColumnName
{
get { return m_ColumnName; }
set { m_ColumnName = value; }
} </p>
<pre><code>public HyperLinkTemplate()
{
//
// TODO: Add constructor logic here
//
}
public HyperLinkTemplate(string ColumnName)
{
this.ColumnName = ColumnName;
}
public void InstantiateIn(System.Web.UI.Control ThisColumn)
{
HyperLink HyperLinkItem = new HyperLink();
HyperLinkItem.ID = "hl" + ColumnName;
HyperLinkItem.DataBinding += HyperLinkItem_DataBinding;
ThisColumn.Controls.Add(HyperLinkItem);
}
private void HyperLinkItem_DataBinding(object sender, EventArgs e)
{
HyperLink HyperLinkItem = (HyperLink)sender;
GridViewRow CurrentRow = (GridViewRow)HyperLinkItem.NamingContainer;
object CurrentDataItem = DataBinder.Eval(CurrentRow.DataItem, ColumnName);
HyperLinkItem.Text = CurrentDataItem.ToString();
}
</code></pre>
<p>} </p>
| c# asp.net | [0, 9] |
5,378,351 | 5,378,352 | Avoiding having to go back twice after writing html with an onload=document.form.submit() to HttpContext.Current.Response | <p>So that's a long title, here's what I'm doing: To avoid having report parameters show up in the URL I'm doing this in a button click handler in the code-behind to show the report:</p>
<pre><code>System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.Write("<html><head></head>");
System.Web.HttpContext.Current.Response.Write("<body onload=\"document.mainform.submit(); \">");
System.Web.HttpContext.Current.Response.Write(string.Format(CultureInfo.InvariantCulture, "<form name=\"mainform\" method=\"post\" action=\"{0}\">", ReportURL));
foreach (string key in Params.Keys)
{
System.Web.HttpContext.Current.Response.Write(string.Format(CultureInfo.InvariantCulture, "<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", key, Params[key]));
}
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body></html>");
</code></pre>
<p>This works great, but when I go back from the report I'm taken to the page I just generated which immediately submits the form due to the onload event. I can hit back twice really quickly to go back past it but this isn't ideal. </p>
<p>I've tried opening a new window with JavaScript using ClientScript.RegisterStartupScript before writing the html but I don't know how (or if it's even possible) to get the HttpContext for the new window.</p>
<p>Thanks for any help!</p>
| c# asp.net | [0, 9] |
784,469 | 784,470 | Issue opening .aspx page in a new window from inside an ajax modal popup | <p>I am trying to open an preview.aspx page in a seperate window from INSIDE an ajax modal popup.
I have tried doing it with client side scripting using the onClientCLick preview.target _blank etc but this doesn't work at all.
I have now managed to at least get this working within my lbPreview_Click routine but this requires a 2nd click because i am using the Attributes.Add to open window (the only way it would work so far!):</p>
<pre><code>protected void lbPreview_Click(object sender, EventArgs e)
{
string recordNo = lblRecordNo.Text;
string details = txtQuery.Text;
string reason = ddReason.SelectedItem.Text;
string fullName = lblFullName.Text;
string path = "emailPreview.aspx?recordNo=" + recordNo + "&details=" + details + "&reason=" + ddReason.SelectedItem.Text + "&fullName=" + fullName + "";
lbPreview.Attributes.Add("onClick", "window.open('" + path + "');");
}
</code></pre>
<p>PLease note: I don't have the values to build my url path until the button has been clicked, so calling the details on page load or similar won't work either.</p>
<p>Any suggestions/help would be very much appreciated.</p>
<p>Kind Regards,
ukjezza.</p>
| c# asp.net | [0, 9] |
5,221,203 | 5,221,204 | Restoring closed webpage with jQuery | <p>I need to write a jQuery wizard which will have the use of Accordion. It will include 4 steps. Everything is ok but there is a requirement which is asking that "If the user closes the browser and loses their place in the wizard in the fourth step, they could be able to return to the wizard and navigate directly to the fourth step by clicking on the ‘Step 4’ accordion". What I understand is that when the browser is closed, the user can be able to land to the last 4th step as and when he re-opens the browser. How it is possible in jQuery or javascript because according to me when the browser will reopen, the DOM will be generated from the beginning and all the things will be loaded from start as well...
Can anyone help me out in this as this seems critical. Any help would be deeply appreciated.......</p>
| javascript jquery | [3, 5] |
5,470,945 | 5,470,946 | Why is Javascript called Javascript, if it has nothing to do with Java? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2018731/why-is-javascript-called-javascript-if-it-has-nothing-to-do-with-java">Why is JavaScript called JavaScript, if it has nothing to do with Java?</a> </p>
</blockquote>
<p>Why Javascript is called Javascript (there is no relation between Java and Javascript) why its not called HTMLScript or XMLScript. Any historical reason for this?</p>
| java javascript | [1, 3] |
4,204,780 | 4,204,781 | Are class level variables/objects acceptable? | <p>I have a simple web site built with asp.net. It typically only has 1 or 2 users at one time. My question is, is it ok to instantiate a class at the class level or should I be instantiating for each method. Here is an example. I have a class named Host with a name field and mac field. In my code behind for a specific page Is it ok to do this:</p>
<pre><code>public partial class addhosts : Page
{
private Host host = new Host();
private HostDal dal = new HostDal();
protected void myMethod()
{
host.Name = "myname"
host.Mac = "mymac"
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
dal.AddHost(host)
}
}
</code></pre>
| c# asp.net | [0, 9] |
4,651,427 | 4,651,428 | Timespan since last password reset | <p>I have created a small asp.net application that allows users to reset their passwords. I am able to retrieve that last time the password was reset from the Directory Searcher object, but I'm having trouble with checking the timespan since the last password reset. The users can reset their passwords again after 24 hours have passed, otherwise they well get an error stating that they are not able to update their password at this time. Any recommendations on how to best go about doing this?</p>
<pre><code>string passwordLastSet = string.Empty;
passwordLastSet = DateTime.FromFileTime((Int64)(result.Properties["PwdLastSet"][0])).ToString();
</code></pre>
<p>Thanks,<br>
Jason</p>
| c# asp.net | [0, 9] |
2,706,747 | 2,706,748 | remove element in jquery then append a new element? | <p>I am trying to remove an span element from HTML then replace that element with a new span element.</p>
<p>View the fiddle for a working example: <a href="http://jsfiddle.net/DCJ9X/" rel="nofollow">http://jsfiddle.net/DCJ9X/</a></p>
<pre><code><div id="foo">
<span>FadeOut</span>
</div>
<input id="go" type="button" value="lets go!" />
$('#go').click(function() {
$('#foo span').fadeOut(500, function() {
$(this).remove().parent().append('<span>FadeIn</span>').fadeIn(500);
});
});
</code></pre>
<p>As always I am grateful for your help stack!</p>
| javascript jquery | [3, 5] |
3,516,810 | 3,516,811 | how to handle any javascript load finished event using jquery | <p>I have a blog. I'm insert yahoo pipe. I need to remove yahoo pipe icon after script load finish.
script is here>></p>
<pre><code> <script src="http://l.yimg.com/a/i/us/pps/listbadge_1.1.js">
{"pipe_id":"24f8f6a880eb3be0711d541","_btype":"list","width":"100%","hideHeader":true}
</script>
</code></pre>
<p>My code is here>></p>
<pre><code>$("script[src=http://l.yimg.com/a/i/us/pps/listbadge_1.1.js]").load(function(){
$(".ybf").hide();
});
</code></pre>
<p>But this don't work. </p>
<p>How to handle script load finish?</p>
| javascript jquery | [3, 5] |
716,312 | 716,313 | select specific text on page and remove it | <p>Is is possible to select specific text string on the page directly without a id, class, etc...</p>
<p>I have this text string "ERROR: AffiliateID invalid" that I would like to remove from the page.</p>
<p>Is it possible?</p>
| javascript jquery | [3, 5] |
2,639,598 | 2,639,599 | jQuery delay with multiple selectors | <p>I know you can do something like this:</p>
<pre><code>$('#item').fadeOut().delay(1000).fadeIn();
</code></pre>
<p>which will fade the element with the id of item out, then wait a second before fading it back in again. But is there a way to fade one item out and a different one back in with a delay inbetween. I've tried this but it didn't work:</p>
<pre><code>$('#item1').fadeOut().delay(1000).('#item2').fadeIn();
</code></pre>
<p>Any help much appreciated</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,027,039 | 1,027,040 | How to isolate functionalities between multiple jQuery Plugins in Same Page | <p>If I have more than 1 instance of the same plugin on the same page how can I separate functionality. eg. in this demo <a href="http://jsfiddle.net/3jwAK/" rel="nofollow">http://jsfiddle.net/3jwAK/</a>, I have a plugin "<code>editor</code>" that appends a link simulating some plugin/widget button, that when clicked will append a line to the <code>textarea</code>. </p>
<p>The problem with it currently is it only targets the last <code>textarea</code></p>
<p>Code looks like </p>
<p><strong>JS</strong></p>
<pre><code>(function($) {
$.fn.editor = function(options) {
var helpers = {
rand: function() {
return Math.round(Math.random() * 20);
}
};
return this.each(function() {
$this = $(this);
var div = $("<a>", {
text: "Add Random Number",
href: "#",
click: function() {
$this.val( $this.val() + "\n" + helpers.rand() );
}
});
$this.before(div);
});
}
})(jQuery);
</code></pre>
<p><strong>HTML</strong></p>
<pre><code><textarea name="txtArea1" cols="50" rows="6" id="editor1"></textarea>
</code></pre>
<p><br />
</p>
| javascript jquery | [3, 5] |
2,836,930 | 2,836,931 | Unable to find meaning of }); curly bracket, round bracket in Android | <p>As a beginner in Android and having been away from programming for many years, I could not find an answer for this one on the internet. It involves the following code from a book I have been reading, but the syntax is common for Android. I couldn't work out what the }); represented. As someone who, in the past, has made an effort to make bracketing readable, I find this code amazing, surely a better way of showing this is possible?</p>
<p>Here's the code:</p>
<pre class="lang-java prettyprint-override"><code>CheckBox checkBox = (CheckBox)findViewById(R.id.chkAutosave);
checkBox.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
if (((CheckBox)v).isChecked())
DisplayToast("CheckBox is checked");
else
DisplayToast("CheckBox is unchecked");
}
});
</code></pre>
<p>Anyway does anyone know the meaning of the }); at the end?</p>
| java android | [1, 4] |
4,807,792 | 4,807,793 | Back button press twice before quitting app | <p>How can I configure the back button to be pressed twice before the app exits? I want to trigger </p>
<pre><code>@Override
public void onBackPressed() {
//custom actions
//display toast "press again to quit app"
super.onBackPressed();
}
</code></pre>
| java android | [1, 4] |
830,679 | 830,680 | Not able to download image using HttpURLConnection | <p>I am trying download file <a href="http://images.anandtech.com/doci/5434/X79%20Extreme9Box_575px.jpg" rel="nofollow">http://images.anandtech.com/doci/5434/X79%20Extreme9Box_575px.jpg</a></p>
<p>but not able to download it using HttpUrlConnection, ImageIO.read and even in php using file_get_contents.</p>
<p>I am not able to figure it out why this is happening but if I check this link in browser then header response is 200 both in firefox as well as opera</p>
<p>Please help me </p>
<p>Now I notice that I am receiving 400 code.</p>
<p>Exception in thread "main" java.io.IOException: Server returned HTTP response code: 400 for URL: <a href="http://images.anandtech.com/doci/5478/Screen" rel="nofollow">http://images.anandtech.com/doci/5478/Screen</a> Shot 2012-01-30 at 4.21.52 PM_575px.png
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)</p>
| java php | [1, 2] |
5,637,547 | 5,637,548 | String.split("*") returns Exception | <p>String.split("*") return Exception in Android Eclipse</p>
<p>Is there Any solution...</p>
| java android | [1, 4] |
272,073 | 272,074 | Prevent jquery slider's image show in the page on click | <p>i am using this jquery and html for change the clicked image on a display div it works fine but the issue is when i click a image in the display div its open in the page itself. How to Make the image as it as when user click on it.</p>
<pre><code> <script type="text/javascript">
jQuery('div#thumbs img').click(function () {
jQuery('#foo a').prop('href', jQuery(this).prop('src'));
jQuery('#foo img').prop('src', jQuery(this).prop('src'));
return false;
})
</script>
</code></pre>
<p><strong>my html</strong></p>
<pre><code> <div id="foo">
<a href="#">
<img src="images/demo_slider.jpg" name="Display" id="display" /></a>
</div>
<br />
<div id="thumbs">
<img src="images/a.jpg" width="56" height="56" alt="" />
<img src="images/b.jpg" width="56" height="56" alt="" />
<img src="images/c.jpg" width="56" height="56" alt="" />
<img src="images/d.jpg" width="56" height="56" alt="" />
</div>
</div>
</code></pre>
<p>edit:</p>
<p>If the user click the thumbs image it load to the div foo. then the user click the image in foo the clicked image opens in the same page(as the basic html functionality like open image in new tab) i need to prevent the image open on click.</p>
| javascript jquery | [3, 5] |
434,089 | 434,090 | how to import multiple sql file in android db using jquery | <p>I have multiple sql file in my assets folder and building app on android. I want this sql to import in android app database on by one using jquery. How to do that please help. I have done code for single file but i want it for multiple sql file. </p>
<pre><code>var filePath = 'database/crmaaaa_1.sql';
//alert(filePath);
$.get(filePath, function (response) {
var statements = response.split('\n');
var shortName = "crm1";
var version = '1.0';
var displayName = 'crm1';
var maxSize = 40000000; // bytes
// db = openDatabase(shortName, version, displayName, maxSize);
var db = window.openDatabase(shortName, version, displayName, maxSize);
// db.transaction(populateDB, errorCB);
db.transaction(function (transaction) {
jQuery.each(statements, function (index, value) {
// alert("query"+value);
if (value != '') {
transaction.executeSql(value, [], successHandler, function (e) {
alert("Error executing sql " + value);
});
}
});
});
});
</code></pre>
| android jquery | [4, 5] |
4,606,719 | 4,606,720 | Synchronous DOM with pseudo backend data? | <p>I have a pseudo-javascript backend for my webapp, and I am storing some data in an array, lets call it Dataset[].
Dataset[]'s data is directly reflected on a table in DOM. What is the best design pattern to keep the two synchronous? e.g. When data are added to Dataset[], it will show up in my dom?</p>
<p>Events? Data Binding? anything else? </p>
<p>thanks :)</p>
| javascript jquery | [3, 5] |
4,956,436 | 4,956,437 | The name 'Message' does not exist in the current context | <p>I keep getting the following error message at compile time: "The name 'Message' does not exist in the current context". All I'm trying to do is pop up a message box. Here are my namespaces declared at the top of my code behind page:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
</code></pre>
<p>And here is my code to show a message on a button click:</p>
<pre><code> protected void EmailAbout_Click(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Exception Handling Test";
myMessage.Body = "Test message body";
myMessage.From = new MailAddress("[email protected]");
myMessage.To.Add(new MailAddress("[email protected]"));
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
Message.Text = "Message sent";
}
</code></pre>
<p>Is this a case of a missing namespace? It seems so basic yet I can't figure it out? Thanks in advance!</p>
<p>Here is the markup page:</p>
<pre><code><%@ Page Title="About SalesPro" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="About.aspx.cs" Inherits="WebApplication2.About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
About, Inc.
</h2>
<p>
Some Stuff here...
</p>
<p>
<asp:Button ID="EmailAbout" runat="server" Text="Email Information"
onclick="EmailAbout_Click" />
</p>
</asp:Content>
</code></pre>
| c# asp.net | [0, 9] |
3,002,960 | 3,002,961 | jquery with check box in asp.net problem | <p>I'm trying change an input mask for textbox when the the check box has been check or unckecked but the problem that always is picking up the else condation only even the check box it is check or not.</p>
<p>please advice to fix this problem.</p>
<p>here is my code:</p>
<pre><code><%@ Page Title="" Language="C#" MasterPageFile="~/Imam.Master" AutoEventWireup="true"
CodeBehind="WebForm4.aspx.cs" Inherits="Imam_Contacts.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.maskedinput-1.2.2.js" type="text/javascript"></script>
<script type="text/javascript">
if ($('#chkhtml:checked').size() > 0)
{
jQuery(function($) {
$("#txthtml").mask("999-99-9999");
});
} else {
jQuery(function($) {
$("#txthtml").mask("99/99/9999");
});
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<input id="chkhtml" type="checkbox" checked="checked" />
</asp:Content>
</code></pre>
| asp.net jquery | [9, 5] |
3,667,294 | 3,667,295 | C++ vs C# for GUI programming | <p>I am going to program a GUI under windows (will be about 10,000 line code with my estimates) and don't know C# or C++ (QT library) to choose for my needs. Please help me to choose.</p>
| c# c++ | [0, 6] |
5,020,627 | 5,020,628 | How do I test if an element with a certain ID exists on a page in jQuery? | <p>In jQuery, I have written a piece of code that appears on every page of my website.</p>
<pre><code>var d = $('#someElement').offset().top;
</code></pre>
<p>However, not every page on my website has an element with an ID of "someElement". Unfortunately, on these pages that lack such an element, no jQuery code works.</p>
<p>To solve this problem, I want to test if an element on the page indeed has the ID of "someElement" and then only run the code snippet above if there is.</p>
<p>How do I perform this test? Will this test solve the problem? Thank you.</p>
| javascript jquery | [3, 5] |
1,000,583 | 1,000,584 | alignment of columns in drop down list | <p>I have used below code for showing and aligning columns in drop down list but my columns are not aligned, in the code I find max length for taking the space for first column but I do not know it does not work?</p>
<p><img src="http://i.stack.imgur.com/L5Bh9.jpg" alt="Drop Down list Alignment"></p>
<pre><code>protected void ddlProjectDocument_Load(object sender, EventArgs e)
{
var query = from p in _DataContext.tblDocuments
orderby p.DocumentNo
select p;
int maxs = 0;
foreach (tblDocument v in query)
{
if (v.DocumentNo.Length > maxs)
maxs = v.DocumentNo.Length;
}
foreach (tblDocument vv in query)
{
string doctitle = vv.DocumentNo;
for (int i = vv.DocumentNo.Length; i < maxs + 2; i++)
{
doctitle += "&nbsp;";
}
doctitle += "&nbsp;|&nbsp;";
doctitle += vv.TITLE;
// Use HtmlDecode to correctly show the spaces
doctitle = HttpUtility.HtmlDecode(doctitle);
ddlProjectDocument.Items.Add(new ListItem(doctitle, vv.DocId.ToString()));
}
}
</code></pre>
| c# asp.net | [0, 9] |
5,747,099 | 5,747,100 | JAVA DES in PHP | <p>I can't get the same result of encrypted text in JAVA from my php script.
This is my php code (client side - my side):</p>
<pre><code>$input = 'my text to be encrypted';
$key = 'my key';
$size = mcrypt_get_block_size(MCRYPT_DES, 'ecb');
$input = pkcs5_pad($input, $size);
$td = mcrypt_module_open(MCRYPT_DES, '', 'ecb', '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$data = mcrypt_generic($td, $input);
print base64_encode($data);
function pkcs5_pad ($text, $blocksize)
{
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
</code></pre>
<p>This is The base JAVA code (Server side):</p>
<pre><code>SecretKey key = new SecretKeySpec(keyBytes, "DES");
Cipher ecipher = Cipher.getInstance("DES/ECB/PKCS5Padding");
byte[] utf8 = str.getBytes("UTF8");
byte[] enc = ecipher.doFinal(utf8);
// Encode bytes to base64 to get a string
return new String(Base64Utils.encode(enc));
</code></pre>
<p>I know there's a padding problem in php that makes the difference in my result.
Can't find why.</p>
| java php | [1, 2] |
2,271,520 | 2,271,521 | JQuery `live()` and `submit()` problem | <p>I wanna do something like this, but this one looks like happing for infinite times.</p>
<pre><code>$("form").live("submit", function() {
if($(this).attr('action') != "ajax"){
$(this).submit();
return true; // even i do this!! but form is NOT submited!!
}
else { /* doing the ajax stuff! */ }
});
</code></pre>
<p>in Chrome and Firefox after a while the form gets submitted, something like 10seconds and in IE it crashes !</p>
<p>I know when i say form.submit means that i am submitting this and get called function again and again, how can i avoid this ?</p>
| javascript jquery | [3, 5] |
4,102,229 | 4,102,230 | Php javascript conflict with passing javascript to php | <p>I have a slight problem. I have several arrays in php with different team names. Each array contains teams of a certain league. When I click an add button I get the option to add a new entry to the calendar. I want the drop down to have only the teams for that league. onclick of the add button I call a javascript function that knows what division was clicked. However in order to give the javascript the information for which teams to display I have to pass it one of the php arrays. The problem I am having is telling php which array to pass to javascript depending on which league javascript is on. I don't want to specify the array myself because there is an option to add a league and this would mean having to code in more code each time a league is added. The point of the site is being dynamic.</p>
<p>here is some code.</p>
<pre><code>for ($i = 0;$i<$sizeof($leaguesarray);$i++){
$htmlimploded[$i] = implode($html[$i]);
}
</code></pre>
<p>here I have used emplode to make all of my php arrays readable into javascript.</p>
<pre><code>for (var h = 0; h<size; h++){ // goes through every league
if(h == leaguenum){ // finds the league for the clicked add button
// this is the line that I have trouble with I can't think of
//anyway of telling it which array to use since it is serverside code.
var myarray = ["<? echo $htmlimploded[]?>"];
}
}
</code></pre>
<p>Javascript code above.</p>
| php javascript | [2, 3] |
5,527,186 | 5,527,187 | Javascript virtual joystick for touchscreen tablets which use wekbit as browser? | <p>Hey there, i am developing a little game example based on html & javascript.</p>
<p>Question is:</p>
<p>Does anybody knows about some javascript virtual joystick asset?</p>
<p>or:</p>
<p>what would be a good approach to code it as simple as possible?</p>
<p>this is for a very basic maze game</p>
<p>i need the joystick to fire my up(), down(), left(), right() functions.</p>
<p>Solution must be exclusively based on javascript, since this targets some android tablet which doesn't support flash.</p>
<p>Thanks in advance for your time.</p>
| javascript iphone android | [3, 8, 4] |
5,481,091 | 5,481,092 | Writing and reading to and from a file for integers and strings | <p>I am trying to save a file (and then read it later) in java (android) using the following </p>
<pre><code>FileInputStream fis = openFileInput(filename);
</code></pre>
<p>and then maybe use BufferedReader/writer. Anyways, I am trying to save String and numbers and I was wondering what would be the best method to write and read from I/O for such case?
I was about to do the following for reading </p>
<pre><code>FileInputStream fis = openFileInput(filename);
InputStreamReader inputStreamReader = new InputStreamReader(fis);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
</code></pre>
<p>and for writing</p>
<pre><code>FileOutputStream fos = openFileOutput(filename, 20);
OutputStreamWriter outStreamReader = new OutputStreamWriter(fos);
BufferedWriter bufferedWriter = new BufferedWriter(outStreamReader);
</code></pre>
<p>but I noticed that the readLine will always return string of the line. so I have to go throught the conversion of Strings to Integer for some lines. Is this an efficient way of doing it (or correct way)? I feel I am missing something
Thank you</p>
| java android | [1, 4] |
6,008,814 | 6,008,815 | enabling and disabling clicks using jquery | <p>I have four buttons which has click able property. Clicking on button will make a div slide down and clicking again on same div should close the div. I want to add a condition like, when I have a div open, the click property on rest of the three buttons should be disabled, what I did is</p>
<pre><code>for (var i = 1; i <= 4; i++) {
$(".slide" + i).click(function () {
var openTab = $(this).attr('class');
openTab = openTab.replace('slide', '');
var facetGroup = $(this).attr("key");
if ($('#panel').is(':visible')) {
buttonCloser(openTab);
} else {
buttonOpener(openTab, facetGroup);
}
});
}
function buttonCloser(m) {
for (var j = 1; j <= 4; j++) {
if (j != m) {
//alert(j);
$(".slide" + j).bind("click");
} else {
$(".slide" + j).css({
"background-color": " #fff5c3",
"color": "#000000"
});
}
}
$("#panel").slideUp("slow");
}
function buttonOpener(m, n) {
for (j = 1; j <= 4; j++) {
if (j != m) {
$(".slide" + j).unbind("click");
} else {
$(".slide" + j).css({
"background-color": "#293345",
"color": "#fff5c3"
});
}
}
$("#panel").slideDown("slow");
refreshFacet(n);
}
</code></pre>
<p>The problem with this code is that the first time I open a div by clicking on slider, the other three click events are disabled, bt when I close that div, it will nt re-enable its click property. so it wont open anything..</p>
| javascript jquery | [3, 5] |
3,806,418 | 3,806,419 | Javascript Double-Click Element | <p>Hey guys.. Quick question:</p>
<p>I wrote a simple JS that opens lightBox for image viewing when an image link is clicked. Basically, using jQuery (yes, I was that lazy), I detect the click of an anchor tag, use a regex to make sure that the HREF attribute is to an image file, and if it is, it opens the image in lightBox. It all works fine, except one thing: The anchor needs two clicks before it will open lightBox. Why is that?</p>
<p>Here's the script I wrote:</p>
<pre><code> $(document).ready(function(){
var href;
var imageExtensions = /(.)+(.jpg)|(.png)|(.gif)|(.bmp)/;
//On click of any link
$("a").live("click",function(event){
href = $(this).attr("href");
//If the target URL is an image, use lightbox to open it
if(imageExtensions.test(href)){
event.preventDefault();
$(this).attr("class","lightboxIMG");
//Prevent the link from opening, and open lightbox
$(".lightboxIMG").lightBox();
$(this).attr("class","");
}
});
//END
});
</code></pre>
<p>I don't see what could be causing the user to have to click twice to activate lightBox. If you need a sample to see what I'm referring to, I'm currently using the script in a beta of my new website: <a href="http://ctrlshiftcreate.com/photography.php?photo=6&r%5Ffolder=" rel="nofollow">http://ctrlshiftcreate.com/photography.php?photo=6&r_folder=</a> </p>
<p>Click "View full size" to see what I mean. I'd greatly appreciate any help - thanks a lot!</p>
| javascript jquery | [3, 5] |
483,684 | 483,685 | reading unicode *.txt files? | <p>Currently I am reading .txt files with</p>
<pre><code> FileInputStream is = new FileInputStream(masterPath+txt);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String readLine = null;
while ((readLine = br.readLine()) != null)
{
...
</code></pre>
<p>But unicode characters do not appear as they should.</p>
<p>Any ideas how to change the above code, for unicode to work?</p>
<p>Thanks!</p>
| java android | [1, 4] |
4,635,092 | 4,635,093 | click() assigned in document.ready in jQuery | <p>Do assignments in document.ready (<em>click(fn)</em> specifically) apply to newly appended elements that match the selector?</p>
<p>If not, how can I assign it to this new elements? Do I have to write the assignment after every append or is there a better way?</p>
| javascript jquery | [3, 5] |
3,083,264 | 3,083,265 | Android request a url with out opening browser | <p>So I have an arduino with an Ethernet shield and I am currently controlling it using browser url commands eg "192.168.2.1/digital/2/1" (digital pin 2 goes high), i want to have an android button which requests that url without opening it in the browser.. is that possible and how would i do it?</p>
| java android | [1, 4] |
4,318,997 | 4,318,998 | why do I get htmlfile: Unknown runtime error JScript error | <p>I get this error thrown in line:</p>
<pre><code>displayElement.innerHTML = executor.get_responseData();
</code></pre>
<p>I try to update the inner html of a div, with the data received from java.
executor.get_responseData(); works well.
how should I debug from here?</p>
<p>Edit:
I use this functions for updating the data:</p>
<pre><code>function GetWebRequest(getPage, HTMLtarget)
{
displayElement = $get(HTMLtarget);
var wRequest = new Sys.Net.WebRequest();
wRequest.set_url(getPage);
wRequest.set_httpVerb("GET");
wRequest.set_userContext("user's context");
wRequest.add_completed(OnWebRequestCompleted)
wRequest.invoke();
</code></pre>
<p>}</p>
<pre><code>function OnWebRequestCompleted(executor, eventArgs)
{
if (executor.get_responseAvailable())
{
displayElement.innerHTML = "";
if (document.all)
{
displayElement.innerHTML = executor.get_responseData();
}
else // Firefox
{
displayElement.textContent += executor.get_responseData();
}
}
else
{
if (executor.get_timedOut())
{
alert("Timed Out");
}
else
{
if (executor.get_aborted())
alert("Aborted");
}
}
</code></pre>
<p>}</p>
<p>I ude the functions above like:</p>
<pre><code> function pageLoad() {
var name= document.getElementById("<%= SearchName.ClientID %>").value;
var target = 'OnrcWebPart.aspx?SearchName=' + name;
GetWebRequest(target, 'PeopleContent'); //I update the content inside div with PeopleContent id
}
</code></pre>
<p>I have this functions from th tutorial <a href="http://www.asp.net/ajax/videos/how-do-i-implement-the-incremental-page-display-pattern-using-http-get-and-post" rel="nofollow">http://www.asp.net/ajax/videos/how-do-i-implement-the-incremental-page-display-pattern-using-http-get-and-post</a></p>
<p>In the sample works well, but in my application it doesn't. Could it be because I use Masterpages?</p>
| javascript asp.net | [3, 9] |
206,495 | 206,496 | Android: crash when accessing user class from thread | <p>When I try to call one of my custom classes from a Thread constructor I get an exception, I've no idea why...</p>
<p>My Main app boils down to:</p>
<pre><code>public class GameView extends SurfaceView implements OnTouchListener, SurfaceHolder.Callback
{
class GameThread extends Thread
{
private GfxData m_GraphicsData;
public GameThread(SurfaceHolder surfaceHolder, Context context, Handler handler)
{
Log.i("****", "GameThread::GameThread");
m_GraphicsData.InitGfx();;
Log.i("****", "GameThread::end");
}
... (other required functions)
}
</code></pre>
<p>My GfxData class (the entire file)</p>
<pre><code>package mypackage.stuff;
public class GfxData
{
public GfxData()
{
}
public void InitGfx()
{
}
}
</code></pre>
<p>The class GameThread never reaches the end of the constructor; I've removed virtually everything from my GfxData class (which I'd intended to pass the context to so I could use it to manage my resources) but still it causes a crash; however if I remove the InitGfx() call everything is fine</p>
<p>I'm bamboozled! Help would be much appreciated.</p>
| java android | [1, 4] |
4,501,524 | 4,501,525 | Python over JavaScript? (Facts, please) | <p>I recently learned JavaScript an all of the sudden I hear about Python...</p>
<p>Should I go learn Python or just stick with my basic JavaScript knowledge?</p>
<p>If you have some "facts" I would love to hear them! Like efficiency, difficultylevel and so on, an so on...</p>
<p>Thanks :)</p>
| javascript python | [3, 7] |
803,870 | 803,871 | Whats the best way to deal with pages loaded via browser history in asp .net? | <p>I have an app which is very database and user intensive. The users are very keen on the browser history buttons for navigation.</p>
<p>Is there a way that I can absolutely guarantee that the page will reload if a user picks something out of their browser history? </p>
<p>What I regularly see is that a copy of the page will be shown from the browsers cache, rather than being reloaded.</p>
<p>I've tried:</p>
<pre><code>this.Response.Cache.SetNoStore()
this.Response.Cache.SetNoServerCaching()
this.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache)
</code></pre>
<p>And</p>
<pre><code>this.Response.Cache.SetExpires(DateTime.Now.AddSeconds ( -1 ) );
</code></pre>
<p>None of these seems to help, sometimes the browser will load the old cached version anyway.</p>
| c# asp.net | [0, 9] |
3,572,087 | 3,572,088 | .get() in jquery | <p>I asked a question with the above title a bit ago titled "gettting .get() in jquery to work" and I had made a silly mistake in the code which everyone jumped on. I fixed that but the .get() doesn't seem to be working. Its supposed to print the name John and 2pm on the bottom of the body and it doesn't. My path names are correct. Can someone help?</p>
<pre><code><html>
<head>
<title>Testing Site</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#id").click(function(){
$('#hello').css('background-color', 'blue');
$.get("test.php",
function(data){
$('body').append( "Name: " + data.name ) //John
.append( "Time: " + data.time ); //2pm
$('body').css('background-color', 'red');
}, "json");
});
});
</script>
</head>
<body>
<span id="hello">Hello World!</span>
<input type="button" id="id" value="Click Here"></input>
</body>
</html>
</code></pre>
<p>heres the php</p>
<pre><code><?php echo json_encode(array("name"=>"John","time"=>"2pm"));
?>
</code></pre>
| php jquery | [2, 5] |
233,196 | 233,197 | Html is rendered event | <p>I'm appending some code to my page using jQuery AJAX calls. This code is a mix of html and javascript. But I want javascript to be executed only when html part is ready. But what event is raised when appended html is rendered?</p>
<p>Here is an example:</p>
<pre><code><table id="sampleTable">
...
</table>
<script>
// this code should be executed only when sampleTable is rendered
$('#sampleTable').hide();
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,080,833 | 4,080,834 | How can i get the value of a html select element inside a repeater control on button click | <p>I have a repeater with select html inside the item template.</p>
<p>I could not use dropdown list as it does not support so i had to build select with inside a repeater.</p>
<p>On button click i want get the value of the selected item.</p>
<p>the inside the repeater does not have runat=server.</p>
<p>How can i do this?</p>
| c# asp.net | [0, 9] |
464,382 | 464,383 | Hiding button if PHP != session | <p>I have a few buttons that I don't want visible to a user if they are not logged it (if $_SESSION['uid'] ='';) What is the best way to do this? </p>
<p>The buttons that need to be hidden are:</p>
<pre><code> <input type='button' id='forgothide' value='Forgot My Password' >
<input type='button' id='loginhide' value='Login' >
</code></pre>
| php jquery | [2, 5] |
985,613 | 985,614 | Reload a .js file without pressing F5 | <p>i load a page with jquery <code>.load(file.php)</code> </p>
<p>i have a .js include in the file.php like: <code><script src='js/script.js' type="text/javascript" language="javascript"></script></code></p>
<p>When i load the file.php, he wouldn't load my JS file... does anybody know why and how to solve it?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
6,030,511 | 6,030,512 | 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] |
4,656,920 | 4,656,921 | When is it appropriate to use synchronous ajax? | <p>I was just reading another question about jQuery's synchronous ajax call, and I got to wondering:</p>
<blockquote>
<p>What circumstances make a synchronous version of an ajax call beneficial/necessary?</p>
</blockquote>
<p>Ideally I'd like an example, and why synchronous is better than standard ajax.</p>
| javascript jquery | [3, 5] |
711,922 | 711,923 | python received data | <p>if i want to write if the received data in string print Name : then the received data !!
i'm receiving data from android from an open socket to my python !! so how to do this in code to check if the received data is string!! </p>
| android python | [4, 7] |
1,301,114 | 1,301,115 | how to check div is last child from parent div | <p>In <strong>Jquery</strong> or <strong>JavaScript</strong> have a function like <code>.hasNext()</code>. I have the code: </p>
<pre><code>function showArrowClick() {
var activeContact = $('.contact.white_bg');
activeContact.removeClass('white_bg');
activeContact.next().addClass('white_bg');
}
</code></pre>
<p>and parent div is</p>
<pre><code><div class="list">
<div class="contact white_bg all_contacts">All</div>
<div class="contact">Contact1</div>
<div class="contact">Contact2</div>
</div>
</code></pre>
<p>After click last div need to do <strong>something</strong>. How can I do it?</p>
| javascript jquery | [3, 5] |
776,822 | 776,823 | Checking all checkboxes in list by single checkbox click | <p>On my webpage, I have a CheckBoxList and a single checkbox. When I click on the check box, all the Check Boxes in the CheckBoxList should get checked. My CheckBoxList has to be under Bodycontent placeholder because that's how the layout of webpage is, and I kept the script in the same placeholder.</p>
<pre><code><asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript">
function select(ch) {
var allcheckboxes = document.getElementById('<%=CheckBoxList1.ClientID %>').getElementsByTagName("input");
for (i = 0; i < allcheckboxes.length; i++)
allcheckboxes[i].checked = ch.checked;
}
</script>
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
RepeatDirection="Horizontal" RepeatLayout="Flow">
<asp:ListItem>Item A</asp:ListItem>
<asp:ListItem>Item B</asp:ListItem>
<asp:ListItem>Item C</asp:ListItem>
</asp:CheckBoxList>
<asp:CheckBox ID="allCheck" onclick="select(this)" runat="server" Text="Select all" />
<br />
</asp:Content>
</code></pre>
<p>The above doesn't do anything. On clikcing on the checkbox nothing happens! I have been stuck on this small issue from quite long and not able to do the same. Any suggestions what's wrong?</p>
| c# javascript asp.net | [0, 3, 9] |
1,847,544 | 1,847,545 | Disable submit button with saved time after page refresh | <p>I have account with two <code>input</code>s and one <code>submit</code> button.</p>
<p>After clicking the submit button, I want to disable it for 30 minutes, and if the user refresh the page, the timer should not be reset and the button should be disabled, may be with cookie?</p>
<p>I found this: <a href="http://stackoverflow.com/questions/8108490/time-control-of-a-submit-button">Time control of a submit button</a></p>
<p>But how do I make it to show how much time left on the button name?</p>
<p>Thanks.</p>
| javascript jquery | [3, 5] |
521,402 | 521,403 | Detect when security lock is on screen | <p>I have an game app which occasionally plays sounds. When the phone goes into standby onPause gets called and the game knows to go silent. But when I press the button on the side of my phone to wake it up out of standby, onResume is called and the game starts running and making sounds immediately - this would all be ok except that I have the security system on where you have to swype a certain pattern to unlock and the sounds come on even before the phone is unlocked. Is there some way to detect that the phone has yet to be unlocked?</p>
| java android | [1, 4] |
6,010,847 | 6,010,848 | insert text between 2 controls | <p>I want insert ":" between 2 dropdownlist in a cell.</p>
<pre><code>tableCell.Controls.Add(DropDownListOraInizio);
tableCell.Controls.Add(DropDownListMinutoInizio);
</code></pre>
<p>How can i do?</p>
<p>thanks</p>
| c# asp.net | [0, 9] |
3,846,825 | 3,846,826 | Undefined SELECT value in jQuery | <p>In my page I have the following SELECT:</p>
<pre><code><select class="span2" id="emLocality">
<option value="_none_">&nbsp;</option>
<option value="000696" selected>USA</option>
</select>
</code></pre>
<p>Then in JavaScript I run this snippet:</p>
<pre><code>var loc = $("emLocality").val();
console.log (loc);
console.log ($("#emLocality").val ());
</code></pre>
<p>and get the following output:</p>
<blockquote>
<p>undefined</p>
<p>000696</p>
</blockquote>
<p>Does anybody have an idea why?</p>
| javascript jquery | [3, 5] |
5,698,994 | 5,698,995 | Is using PHP to collate multiple JavaScript files going to be faster than including them all separately? | <p>I know that serving multiple small files is much slower than serving one larger file, this is why it's good to use a single CSS document as well as sprite sheets. I've also tried to include as much JavaScript into the smallest amount of files as I can for a while now, to avoid multiple requests from the viewer for more files, but having a variety of clearly different tasks in the same document gets confusing and messy.</p>
<p>I've been wondering if using PHP to combine a larger amount of JavaScript files into a single file and then serving that with the <code>content-type</code> set to <code>application/x-javascript</code> would get around this problem.</p>
<p>I'm assuming that because the server manages retrieving those files, the viewer will only request a single file. I do however have minimal knowledge around how the server will deal with that though, and if it's going to end up being the same issue just the other way around (and end up just as slow). I have a feeling that because the JavaScript is all hosted in the same place as the PHP that it shouldn't be the case.</p>
<blockquote>
<p>Will I receive the same benefit of only having a single JavaScript file if I actually have multiple files and serve them as a single document via PHP?</p>
</blockquote>
| php javascript | [2, 3] |
1,800,002 | 1,800,003 | store values in a array or hash from jquery selector for reuse | <p>How do I store values into an array or hash to be recalled individually without adding individual identifier?</p>
<pre><code>var myarray = [];
$(".express").each(function () {
myarray.push($(this).text());
});
fuction flashEXPRESS() {
$(".express").each(function () {
if ($(this).text() == 'NEW') { $(this).text() = myarray[???]; }
else { $(this).text() == 'NEW'}
});
}
var flashEXPRESSid = 0;
flashEXPRESSid = setInterval("flashEXPRESS()",1000);
</code></pre>
| javascript jquery | [3, 5] |
2,501,132 | 2,501,133 | passing array via query string | <p>I am passing a javascript array via <code>Request.QueryString["cityID"].ToString()</code>, but it shows me an error of "invalid arguments":</p>
<pre><code>blObj.addOfficeOnlyDiffrent(Request.QueryString["cityID"].ToString(),
Request.QueryString["selectTxtOfficeAr"].ToString());
</code></pre>
<p>The method declaration looks like:</p>
<pre><code>public string addOfficeOnlyDiffrent(string[] cityID, string selectTxtOfficeAr) { }
</code></pre>
| c# asp.net | [0, 9] |
331,352 | 331,353 | Connect java with javascript for data visualization in Browser | <p>I am working on a project where I access the APIs and get the output using <code>Java</code>. Now I want to display the data using some graphs and other data visualization tools in a browser. I have searched for some <code>JavaScript</code> libraries for that. But how can I connect java and javascript to get the output in a browser.</p>
<p>Can I do it with <code>JSP</code>? I don't want to use applets. Please suggest other ways also.</p>
<p>EDIT: If I use JSP then I will have to host a server. Is there a direct way without hosting a server?</p>
| java javascript | [1, 3] |
4,653,550 | 4,653,551 | Using setInvernal to call a query function every few seconds? | <p>Really easy one here, I'm sure - I'm a beginner who's struggling to integrate setInterval into my jQuery. I currently have this function, which rotates two images upon clicking them. I want this to happen automatically (every few seconds), and can't seem to find the right way to use setInterval.</p>
<p>Could anyone point me in the right direction? Thanks a lot for any help. </p>
<p>Philip </p>
<pre><code>$(document).ready(function(){
$("#spinitemholder1 .sponsorFlipphil1 img").click(function () {
$(this).animate({ "width": "0px", "margin-left": "135px" }, 500, function () {
$(this).parent().hide();
$(this).width(0);
$("#spinitemholder1 .sponsorFlipphil2 img").animate({ "width": "271px", "margin-left": "0px" });
$("#spinitemholder1 .sponsorFlipphil2").show();
});
});
$("#spinitemholder2 .sponsorFlipphil2 img").click(function () {
$(this).animate({ "width": "0px", "margin-left": "135px" }, 500, function () {
$(this).parent().hide();
$(this).width(0);
$("#spinitemholder1 .sponsorFlipphil1 img").animate({ "width": "271px", "margin-left": "0px" });
$("#spinitemholder1 .sponsorFlipphil1").show();
});
});
});
</code></pre>
| javascript jquery | [3, 5] |
2,268,981 | 2,268,982 | jQuery : displaying a div according to which image i clicked on | <p>i'm having a trouble to display text according to images i clicked on.</p>
<pre><code><ul id="boutique1">
<li><a href="#first"><img src="images/image1.jpg">nothing</a></li>
</ul>
</code></pre>
<p>When i click on these first link, i want to display that : </p>
<pre><code> <p id="first" style="display:none;">Hello World</p>
</code></pre>
<p>Into this div :</p>
<pre><code><div id="alert"></div>
</code></pre>
<p>Now, i have this jQuery function :</p>
<pre><code>$('#boutique1 a').live('click',function(){
$('#alert').html( $($(this).attr('href')) ).slideDown();
setTimeout(function(){ $('#alert').slideUp() },5000)
});
</code></pre>
<p>I don't know why it's not working.</p>
<p><strong>I only got the #alert div who is showing up empty</strong></p>
<p>thanks</p>
| javascript jquery | [3, 5] |
3,926,122 | 3,926,123 | How do I get the reference to the dom node I just appeneded in JQuery? | <p>I just appended some html to another JQuery object. I want to get a reference to the newly created dom node so that I can call another function on it. As seen in the code below, I am not getting a reference to what I wanted. Instead of the new node, I am getting the node with the original id.</p>
<pre><code>var a = $("#id").append("some_html");
a.live('click', function(event){
alert("hello!");
});
</code></pre>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.