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
641,667
641,668
jQuery ajax form submit in asp.net
<p>I am new to <code>asp.net</code>. I have used <code>jQuery</code> with <code>php</code> for submitting forms and other operations.</p> <p>I tried submitting form to an <code>.aspx</code> page and it worked fine,<br> But i read it some where that its a wrong approach.<br> How can i do it through <strong><em>web-service</em></strong> or <strong><em>WCF</em></strong> ?</p>
jquery asp.net
[5, 9]
4,677,360
4,677,361
webservice returns rounded number instead of decimal
<p>I have a web service that returns a decimal value into my json string but it rounds it off on numbers that are 400.00 to 400 instead, but if it has 400.50 it returns 400.50 which is what i want how do i return a value that is 400 to 400.00 in that format </p> <p><strong>Error</strong></p> <pre> {"Message":"LINQ to Entities does not recognize the method \u0027System.String ToString(System.String)\u0027 method, and this method cannot be translated into a store expression."," </pre> <p><strong>Code</strong></p> <pre> Products = ( from p in db.Products where p.DepartmentId == qDepartment.Id join i in db.ProductImages on p.Id equals i.ProductId into products from x in products.Where(y => y.Dimension == "180X180") select new Product { Id = p.Id, Title = p.Title, ShortDescription = p.ShortDescription, Brand = p.Brand, Model = p.Model, Image = x.Path, FriendlyUrl = p.FriendlyUrl, SellPrice = p.SellPrice.ToString("N2")/*Error Here changed type to string*/, DiscountPercentage = p.DiscountPercentage, Votes = p.Votes, TotalRating = p.TotalRating }).ToList(); </pre>
jquery asp.net
[5, 9]
2,345,598
2,345,599
Trying to interpret ASP.Net Error
<p>So I put my code like this:</p> <pre><code>&lt;%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt; &lt;asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"&gt; &lt;% using System.Data.SqlClient public Static Main { connection = new SqlConnection(); connection.ConnectionString = "Data Source=localhost:8080;Initial Catalog=dbo.Table1;"; connection.Open(); dataadapter = new SqlDataAdapter("select * from customers", connection); } %&gt; &lt;h2&gt;This is a test for a database connection&lt;/h2&gt; &lt;%Response.Write(dataadapter) %&gt; &lt;/asp:Content&gt; </code></pre> <p>And I got the following error message:</p> <pre><code>Source Error: Line 6: using System.Web.UI.WebControls; Line 7: Line 8: public partial class _Default : System.Web.UI.Page Line 9: { Line 10: protected void Page_Load(object sender, EventArgs e) </code></pre> <p>The only thing I can get out of it is that I might have put in some code incorrectly? This error is very opaque to me.</p> <p>Is there something wrong with my syntax?</p>
c# asp.net
[0, 9]
1,918,610
1,918,611
jQuery multi level selector does not work but .children does
<p>I have this javascript code which works fine</p> <pre><code>var QuestionID = panel.siblings('.QuestionIDWrapper').children('input[type=hidden]').val(); </code></pre> <p>but if I convert it to use a multi level jQuery selector like this:</p> <pre><code>var QuestionID = panel.siblings('.QuestionIDWrapper input[type=hidden]').val(); </code></pre> <p>I don't get any value in QuestionID.</p>
javascript jquery
[3, 5]
5,512,275
5,512,276
Javascript detect when inner html has changed
<p>I have tried attaching the even onchange and change(with jquery) to an element that updates every couple seconds. Neither of these events are raised when the inner html is changed. How can I detect with with javascript or jquery?</p>
javascript jquery
[3, 5]
5,911,233
5,911,234
How to print value of .hasClass via console?
<p>using the Firebug console I'm trying to test whether this code is working:</p> <pre><code>$(window).bind("load", function() { $('#tab1link').click(function() { $('#tab2').hide(); $('#tab2').removeClass('selected'); $('#tab1').show(); $('#tab1').addClass('selected'); }); $('#tab2link').click(function() { $('#tab1').hide(); $('#tab1').removeClass('selected'); $('#tab2').show(); $('#tab2').addClass('selected'); }); }); </code></pre> <p>but this:</p> <pre><code>console.log($('#tab2').hasClass('selected')) </code></pre> <p>returns the error:</p> <pre><code> TypeError: $("#tab2").hasClass is not a function { message="$("#tab2").hasClass is not a function", more...} </code></pre> <p>Does anyone know why the above console command is incorrect? (Not a jQuery expert...)</p> <p>Based on the link below, I think it should work... <a href="http://api.jquery.com/hasClass/" rel="nofollow">http://api.jquery.com/hasClass/</a></p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,626,279
3,626,280
How do I get the value of td using hierarchy?
<pre><code>&lt;tr&gt; &lt;td&gt;#&lt;/td&gt; &lt;td&gt;2009&lt;/td&gt; &lt;td&gt;&lt;a class="delete_this"&gt;Click&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I want to use jquery and get the text of 2nd (second) "td" when clicking the anchor. I want the "td" in the same tr as the anchor...</p> <p>How do I do this?</p> <p>So far I have</p> <pre><code>$(document).ready(function(){ $(".delete_this').click(function(){ var myNUmber = $(this).parent()....///And this i should write the code to get the text for second td in tr where the anchor belongs to }) }) </code></pre>
javascript jquery
[3, 5]
5,158,865
5,158,866
Java: Equivalent of Python's range(int, int)?
<p>Does Java have an equivalent to Python's <code>range(int, int)</code> method?</p>
java python
[1, 7]
3,913,142
3,913,143
How to capture when a user is leaving ASP.Net page unexpectedly
<p>I need to prompt a user when they are leaving my ASP.Net page unexpectedly with a message to ask if they are sure they want to leave. A post back or when the save button is clicked should not fire the warning. There are a bunch of articles covering this but I am brand new to this and appear to have got my wires crossed.</p> <p>The recommended way appears to be to use the window.onbeforeunload event but behaves unexpectedly for me. This is fired when the page loads as opposed to when the page unloads.</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; window.onbeforeunload = confirmExit; function confirmExit() { return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?"; } &lt;/script&gt; </code></pre> <p>If I use the JQuery implementation it fires when the page unloads but the problem is it fires before the code behind is executed. So I cannot set a variable on the client saying don’t fire the event this time as it is a post back or a Save.</p> <pre><code>$(window).bind('beforeunload', function () { return 'Are you sure you want to leave?'; }); </code></pre> <p>Can anyone point me in the correct direction as I know I am making basic mistakes/miss-understanding?</p> <p>Edit:</p> <p>So I am nearly there:</p> <p>var prompt = true;</p> <pre><code>$('a').live('click', function () { //if click does not require a prompt set to false prompt = false; }); $(window).bind("beforeunload", function () { if (prompt) { //reset our prompt variable prompt = false; //prompt return true; } }) </code></pre> <p>Except the problem is in the above code I need to be able to differentiate between the clicks but I haven't been able to figure that out yet i.e. I am missing a condition here "//if click does not require a prompt set to false". </p> <p>Any ideas?</p> <p>Thanks, Michael </p>
javascript jquery
[3, 5]
3,874,874
3,874,875
Getting class value
<p>I have an image, onclick on wich i make some <code>ajax</code> requests. i need to pass a variable from <code>$_GET[]</code> to my onclick function, so i deside to do the following</p> <pre><code>&lt;img id="img1" class="&lt;?=$_GET['value']"?&gt; /&gt; </code></pre> <p>and jquery</p> <pre><code>$("#img1").click(function() { how can i get the class value here??? }); </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
3,740,950
3,740,951
View receives touch events when covered by other view
<p>My Android app has a layout that looks like this:</p> <pre><code>--------------------- | | | button | &lt;- View panel A | | --------------------- | | | | &lt;- view panel B (a SurfaceView) | | |-------------------| </code></pre> <p>I use a relative layout so that panel B fills the whole screen and panel A is at the top of the screen covering the top of panel B. A is slightly transparent so you can see B under it. Pressing the button on panel A works as expected.</p> <p>My problem: <b>if I press anywhere on panel A outside of the button, panel B receives a touch event. How can I stop this behaviour?</b></p>
java android
[1, 4]
3,678,123
3,678,124
Attach event listener to dynamic element
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8021436/jquery-1-7-turning-live-into-on">jQuery 1.7 - Turning live() into on()</a> </p> </blockquote> <p>I used to love the <code>.live()</code> function that jQuery had. You would add it and voila, any future elements that matched the identifier would have that function.</p> <p>Then it got deprecated and it was advised to use <code>.on()</code>. But it doesn't work. Below is my code that is placed in <code>$(document).ready()</code>.</p> <p><strong>This works</strong></p> <pre><code>$('#membership_number').live('change',function(e) { alert("VALUE CHANGED"); }); </code></pre> <p><strong>This doesn't</strong></p> <pre><code>$('#membership_number').on('change',function(e) { alert("VALUE CHANGED"); }); </code></pre> <p>Is there another way to achieve the same effect as <code>.live()</code> or am I just not using <code>.on()</code> correctly?</p>
javascript jquery
[3, 5]
2,535,556
2,535,557
Calling a javascript function multiple times
<p>I have a couple of those:</p> <pre><code> &lt;div class="enunt"&gt;text here&lt;/div&gt; &lt;div class="ans"&gt;&lt;input type="text" id="amount1" style="border: 0; color: #f6931f; font-weight: bold;" /&gt;&lt;/div&gt; &lt;div id="slider1" class="slide"&gt;&lt;/div&gt; </code></pre> <p>The others have the same structure, but the ids differ by their index number. And I need a function to set up the JQuery sliders. What I did is this:</p> <pre><code> function slider(i) { $( '#slider' + i ).slider({ value:4, min: 1, max: 7, step: 1, slide: function( event, ui, i ) { $( '#amount' + i ).val( ui.value ); } }); $( '#amount' + i ).val( $( '#slider' + i ).slider( "value" ) ); } </code></pre> <p>And call it like so:</p> <pre><code>for (var i=1; i&lt;6; i++) slider(i); </code></pre> <p>This does not work at all. Where is my mistake ? It's my first JQuery app, so please be nice.</p>
javascript jquery
[3, 5]
1,212,525
1,212,526
gridview Binddata
<p>I'm working with a nested grid view. The second one should be bound by using a stored procedure. The parameter for the stored procedure is <code>gridview1.selected</code> value and the connection string should be taken from config.connection string. My code is:</p> <pre><code>SqlCommand cmd = new SqlCommand("spname", new SqlConnection(Config.connectionstring)); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("parametername", GridView1.SelectedValue); cmd.Connection.Open(); control.DataSource = cmd.ExecuteReader(); control.DataBind(); </code></pre> <p>But it doesn't work. Any ideas, please?</p>
c# asp.net
[0, 9]
1,524,545
1,524,546
jQuery: how to scroll to certain anchor/div on page load?
<p>Lately im trying to use jquery more often and right now im having some problem i'd like to solve with jquery hope u could help me.</p> <p>I have some web page that includes some anchor tag (lets say the anchor is located in the middle of the page) and on the event onload i want the page to start on that certain anchor tag location meaning the page will be "scrolled" automaticaly to a certain location.</p> <p>That was my previous solution (which is quite ugly since it adds #i to my url)</p> <pre><code>window.onload = window.location.hash = 'i'; </code></pre> <p>Anyway could u tell me how can i do it with jquery?</p> <p><strong>notice: i don't want the user to feel any slide or effect while getting to this location</strong></p>
javascript jquery
[3, 5]
5,628,067
5,628,068
Need help editing and understanding jQuery portfolio template for Dribbble API
<p>I need some help understanding what the below does:</p> <pre><code>var inner = ""; var innerP1 = '&lt;li style="list-style-type:none;"&gt;&lt;div class="dribbble"&gt;&lt;div class="shot"&gt;&lt;a href="'; var innerP2 = '"&gt;&lt;img src="'; var innerP3 = '"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="likes"&gt;' var innerP4 = ' Likes&lt;/div&gt;&lt;div class="comments"&gt;' var innerP5 = ' Comments&lt;/div&gt;&lt;div class="name"&gt;' var innerp6 = '&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;' function render(filter){ for (var i = 0; i&lt;filter.shots.length;i++){ inner = inner + innerP1 + filter.shots[i].url + innerP2 + filter.shots[i].image_url + innerP3 + filter.shots[i].likes_count + innerP4 + filter.shots[i].comments_count + innerP5 + filter.shots[i].title + innerp6; }; </code></pre> <p>I want to remove some of the field here; all i really want is the image with the link and title. What do the "var" functions do and can't I just combine all the html into one of them?</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
5,393,662
5,393,663
Check select box values and compare them with an input
<p>I would like to check if a textfield, newTeamName is already in a list of teamnames stored in a select box. Unfortunately, my code does not work - what's wrong with it? Oh and I have no console problems.</p> <pre><code> optionList = []; $('#chooseTeam option').each(function() { optionList.push($(this).val()) }); if (form.newTeamName.value in optionList) { $("#text-error").html("Team exists"); $('#text-error').fadeIn(400).delay(3200).fadeOut(800); return false; } </code></pre> <p>Small Update:</p> <p>Oh and my form.name.value's work fine as they work for other if statements.</p>
javascript jquery
[3, 5]
3,084,425
3,084,426
Works in jsFiddle but not on live site
<pre><code>var add_time = function ($category) { 'use strict'; var time_element = $('&lt;input size="7" class="time" placeholder="00:00" pattern="(?:(?:\\d:)?[0-5])?\\d:[0-5]\\d" title="Please insert a time in the form of [[h:]m]m:ss." /&gt;'); if ($('.time').length === 0) { time_element.insertAfter($category.find('.add_time_button')); } else { time_element.insertAfter($('.time')); } }; $('.add_time_button').click(function () { 'use strict'; add_time($(this).parentsWhen('.category')); }); </code></pre> <p>I don't get it. No console errors. Everything looks fine to me. Ran it through JSFiddle. Nothing. Sigh. The question is all in the title. Here's the jsFiddle: <a href="http://jsfiddle.net/gtr053/N2HmG/" rel="nofollow">http://jsfiddle.net/gtr053/N2HmG/</a></p> <p>To future readers, this will be a 404 someday soon. Live site: <a href="http://bama.ua.edu/~tscrompton/annotation/" rel="nofollow">http://bama.ua.edu/~tscrompton/annotation/</a></p>
javascript jquery
[3, 5]
968,621
968,622
Check if User has clicked "Ok" for "onbeforeunload event"
<p>I am checking when the user closes the browser window, if he says ok, how i do I trigger some action, like opening another window or saving a form. If he chooses "cancel", it should stay in the same page (which is working now). pls share some idea on how to approach this issue</p> <p><a href="http://jsfiddle.net/sk5yc/13/" rel="nofollow">Sample Code</a></p>
javascript jquery
[3, 5]
2,391,697
2,391,698
Trying to use jQuery to show/hide multiple lists independently
<p>I have a web page where I am trying to hide extra bits of information by default. These extra bits take the form of lists of items that I want users to be able to show or hide by clicking a JavaScript link. </p> <p>Initially, I used this code: <a href="http://jsfiddle.net/4Yk39/2/" rel="nofollow">http://jsfiddle.net/4Yk39/2/</a></p> <pre><code> jQuery(document).ready(function() { jQuery('.bhlink').click(function(){ jQuery('ul.billhistory').slideToggle(); }); }); </code></pre> <p>... and it works just fine, except that clicking any of the JavaScript links on the page causes <em>all</em> the lists to appear or disappear, which is not what I want. I want only the list right below the JavaScript link to slide out when clicked. In other words, I need the lists to appear or disappear independently.</p> <p>The code I'm working with now (derived from the answer to another StackOverflow question) is here: <a href="http://jsfiddle.net/smZct/" rel="nofollow">http://jsfiddle.net/smZct/</a></p> <pre><code>$(document).ready(function () { $(".billhistory").slideUp(); $(".bhlink").click(function() { var billhistory = $(this).closest("p").find(".billhistory"); var txt = billhistory.is(':visible') ? 'Click to view' : 'Click to hide'; $(this).text(txt); billhistory.stop(true, true).slideToggle("slow"); }); }); </code></pre> <p>As far as I can tell, everything is set up properly, but when I click the link to show a list, the link changes to say "hide", but lists do not actually appear.</p> <p>What am I doing wrong?</p>
javascript jquery
[3, 5]
5,768,763
5,768,764
convert normal window to modal window?
<p>Is there any way to convert normal window to modal window?</p> <p>I have a grid with a image column. As I click the image a window is appearing with the image.(using javascript window.open(...) )</p> <p>But, as I click a different image in the grid a second window is appearing with respective image. I dont want the user to be able to do anything else before closing the current window.</p>
c# asp.net javascript
[0, 9, 3]
5,177,369
5,177,370
Default Record Voice in Android
<p>i notice in the Android Default Voice Recorder that can sense how loud is your voice and <a href="http://www.androidtapp.com/wp-content/uploads/2009/08/OI-Shopping-Voice-Recording.jpg" rel="nofollow">show it to you in UI parameter</a> .</p> <p>Can i use this from the intent or how can i program a code that sense the loudness of the voice in Android.</p>
java android
[1, 4]
975,086
975,087
how to make sure everything is loaded in ajax using jquery
<p>Hello everyone I got trapped when Im using jquery loading some content into my page. The code is like this:</p> <pre><code>$("#holder").fadeout(); $("#holder").load("test.html", callbackfn); function callbackfn(){ $("#holder").fadein(); } </code></pre> <p>test.html</p> <pre><code>&lt;div style="background-image:url(1.jpg);"&gt;test&lt;/div&gt; </code></pre> <p>That's the main idea, and actually it works quiet fine except that #holder is faded in before pictures are fully loaded. How can I make sure everything in test.html is fully loaded before #holder is displayed?</p>
javascript jquery
[3, 5]
2,671,126
2,671,127
jQuery expandable menu
<pre><code>&lt;div id="firstDiv"&gt; &lt;div id="secondDiv"&gt; &lt;ul id="accordionMenu"&gt; &lt;li&gt;&lt;a href="#"&gt;menu item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;menu item&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;suboption 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;suboption 2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;menu item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;menu item&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;menu item&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How to make it expandable?</p> <p>I have the following JavaScript code:</p> <pre><code>$(document).ready(function() { // Collapse everything but the first menu: $("#accordionMenu &gt; li &gt; a").not(":first").find("+ ul").slideUp(1); // Expand or collapse: $("#accordionMenu &gt; li &gt; a").click(function() { $(this).find("+ ul").slideToggle("fast"); }); }); </code></pre>
javascript jquery
[3, 5]
2,807,381
2,807,382
How do I make an applcation's launch icon run the preferences activity?
<p>I would like an app's launch icon run the app's preferences activity (as it has no Activities, only a Service).</p> <p>The preferences are defined in res/xml/preferences.xml.</p> <p>Please help me regarding this.</p>
java android
[1, 4]
3,345,185
3,345,186
Platform for develop on multi OS-Phone
<p>I want develop on Android and iPhone...</p> <p>How Platform can i use?</p>
iphone android
[8, 4]
938,869
938,870
autotrader.com posting
<p>Does anybody know if autotrader.com offers an API or something that would help with mass postings of vehicles? Or does anybody have any idea of what to use to create something like this? I was thinking of maybe a mouse location and click over a browser window type of thing.</p>
c# c++
[0, 6]
4,732,067
4,732,068
JQuery: Help with $("#div")
<p>I just started using JQuery, as such, I'm cleaning up old code of mine to use JQuery throughout.</p> <p><strong>Question</strong>: How would I convert the following code to use JQuery?</p> <pre><code>// enable the other link document.getElementById("asc").setAttribute("href", "#"); document.getElementById("asc").onclick = function() {displayHomeListings("asc")}; document.getElementById("asc").style.textDecoration = "none" //disable this link document.getElementById("desc").removeAttribute("href"); document.getElementById("desc").onclick = ""; document.getElementById("desc").style.textDecoration = "underline" </code></pre>
javascript jquery
[3, 5]
4,243,684
4,243,685
The constructor Intent is undefined
<p>I have the content module loaded, the specific error I'm getting is: <code>The constructor Intent(new View.OnClickListener(){}, Class&lt;ContactWidget&gt;) is undefined</code></p> <p>Any ideas on this? I got this from the tutorial here: <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html" rel="nofollow">http://developer.android.com/guide/topics/ui/notifiers/notifications.html</a></p> <pre><code>package com.example.contactwidget; import android.app.Activity; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class ContactWidget extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Button calc1 = (Button) findViewById(R.id.calc_button_1); calc1.setOnClickListener(buttonListener); setContentView(R.layout.main); } private static final int HELLO_ID = 1; private OnClickListener buttonListener = new OnClickListener() { public void onClick (View v) { String ns = Context.NOTIFICATION_SERVICE; NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns); int icon = R.drawable.icon; CharSequence ticketBrief = "Button Pressed Brief"; CharSequence ticketTitle = "Button pressed"; CharSequence ticketText = "You pressed button 1"; long when = System.currentTimeMillis(); Notification notification = new Notification(icon, ticketBrief, when); Intent notificationIntent = new Intent(this, ContactWidget.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0); notification.setLatestEventInfo(getApplicationContext(), ticketTitle, ticketText, contentIntent); mNotificationManager.notify(HELLO_ID, notification); } }; } </code></pre>
java android
[1, 4]
1,710,175
1,710,176
Using C++ from Python? (not boost)
<p>I'm currently using boost-python to wrap a small C++ library and make it usable from Python. However, I'd like to stop using boost (mainly due to reasons relating to building/linking). So what other options are there?</p> <p>Is there something that's equally convenient to use?</p>
c++ python
[6, 7]
3,353,925
3,353,926
Do you use lock in your web applications?
<p>After posting this question:</p> <p><a href="http://stackoverflow.com/questions/781189/how-to-lock-on-an-integer-in-c">http://stackoverflow.com/questions/781189/how-to-lock-on-an-integer-in-c</a></p> <p>Many of the answers made me feel that I'm a 'sinner' for using lock in my web apps. I never thought this is a problem (if used wisely), what about you? Do you ever use it in your web applications?</p> <p>I don't see how a web application can be written without locking, for example if you want to load some data from a database and you want to be sure that no other thread will load it (also for singletons), normally you use locking, for example:</p> <pre><code>private _locker = new object(); private YourClass[] _data; public YourClass[] Data { get { if(_data == null) { lock( _locker) { // get your data _data = GetYourData(); } } return _data; } } </code></pre> <p>Is there a problem with this?!</p> <p>Edit:</p> <p>Please note that I'm referring to a single server scenario here, for a server farm you need some distributed locking mechanism, but you don't expect every site you create to get millions of hits in a couple of weeks, do you? What if you need locking, should you create your site with that distributed locking, isn't that too much for an application which you have no idea whether it will ever need to be scaled or not? Besides computers have gotten really fast these days, one server can handle tons of traffic and this has been proven so many times, some examples are plentyoffish.com and this very site you're using right now, do some googling and I'm sure you'll come across so many others.</p>
c# asp.net
[0, 9]
4,577,767
4,577,768
Passing variable string to create arrays (Android)
<p>I am a newb to Android and Java and want to write a funtion that will display a list based on a varable that I pass to the function. </p> <p>The function is below and the code below creates an array out of a string called type, but what I want to do is pass it a variable string and have it build a list based on that string. </p> <p>So if I wanted the type list I would say <code>list_it("type")</code></p> <p>But if I try something like <code>getResources().getStringArray(R.array.thelist);</code> it doesn't work.</p> <p>Can someone point me in the right direction?</p> <pre><code>public void list_it(String thelist){ String[] types = getResources().getStringArray(R.array.type); ArrayAdapter&lt;String&gt; mAdapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_item1, types); setListAdapter(mAdapter); ListView lv = getListView(); lv.setTextFilterEnabled(true); } </code></pre>
java android
[1, 4]
2,230,747
2,230,748
Handle heavy service call with multithreading or parallel processing
<p>I have a Service method as mentioned below</p> <pre><code>GetDetails(List&lt;int&gt; ids) </code></pre> <p>The problem is that the above service method works fine if the number of ids (Count) is less than 50...anything above 50 ids throws an error... this is how the service was built and I do not have any control to change this service method...</p> <p>Now I have a situation where I have to make a call to this service method for 1000 Ids which means the above service method will not work unless I am guessing to do some kind of multithreading/parallel stuff...my question is...is there a way to make this work and at the same time to not compromise with the performance a lot...any help will be deeply appreciated...</p> <p><strong>Update</strong> The error is a handled exception and the service says "request cannot be handled"...this service was worked by a team which is remote and I donot have a control over it...</p>
c# asp.net
[0, 9]
3,740,215
3,740,216
Page_Unload not firing when using response.redirect(somepage,true)
<p>I'm closing a WCF endpoint in the page_unload of an asp.net page, when using response.redirect() the page_unload event doesn't fire and i'm ending up with ophanned endpoint references.</p> <p>I thought the page_unload should fire everytime.</p> <p>Anyone shed any light.</p> <p>Thanks</p>
c# asp.net
[0, 9]
58,683
58,684
How to shutdown and reboot the emulator through code in android?
<p>I have implemented the code like:</p> <pre><code>Intent i = new Intent(Intent.ACTION_REBOOT); sendBroadcast(i); </code></pre> <p>it get the error(runtime):</p> <pre><code>java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.REBOOT from pid=*** and uid=*** </code></pre>
java android
[1, 4]
3,919,756
3,919,757
jQuery get attribute
<p>I'm trying to get the source attribute of all images withing a specific div but somehow it keeps telling me that the function .attr() doesn't exist...</p> <p>That's the function. Firebug also tells me that "this" is an image element. I'm using jQuery v1.3.2</p> <pre><code>$('#products LI DIV IMG').each(function() { var image = this; alert(image.attr('src')); }); </code></pre> <p>Any idea how to fix that?</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
5,063,673
5,063,674
Farbtastic jQuery Color Picker Callback Issues
<p>I'm trying to play around with the Farbtastic: <a href="http://acko.net/dev/farbtastic" rel="nofollow">http://acko.net/dev/farbtastic</a> color picker plugin but I'm having some issues.</p> <p>I want to setup a callback function so that I can change the bg color like so:</p> <pre><code> $('#picker').farbtastic(function(){ $("body").css("background-color",$.farbtastic('#picker').color); }); </code></pre> <p>This works fine, but by doing this, the input field no longer updates the hex value in real time.</p> <p>How can I make it so the hex value within the input field AND the body background color update both at the same time?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,366,675
3,366,676
Accessing $_SESSION from android
<p>I built a website with PHP, and now and am working on an application to go with it, (however I am not new to php nor Android, just to them together) and I am able to login, and get Status Code: 200 response (successful login), however in the headers list when I print out</p> <pre><code>Header[] heads = response.getAllHeaders(); </code></pre> <p>Does not show the fact that (in php) I called</p> <p><code>header("Location: success.php")</code> or <code>"Location: failure.php"</code> for failure, so I'm not sure why it is returning the 200 at all, it just is.</p> <p>but what I really need to know how to access my <code>$_SESSION</code> variables I set in the php code so I can go about my navigation signed in just like I would on my website. If you need more information, just ask.</p>
php android
[2, 4]
4,106,381
4,106,382
Anchor tag's onClick is not working
<p>I am creating an anchor tag on the fly. It gets created, but for some reason the <code>onClick</code> is not working.</p> <p><strong>Here is my generation code:</strong></p> <pre class="lang-cs prettyprint-override"><code>HtmlGenericControl emailsubject = new HtmlGenericControl("div"); emailsubject.ID = count++ + "emailSubject"; emailsubject.InnerHtml = "Subject: " + "&lt;a id=\"summa\" href=\"#\" onClick=\"subject_Click();\"&gt;" + results2["EmailSubject"].ToString() + "&lt;/a&gt;"; </code></pre> <p><strong>Here is my <code>onClick</code> function:</strong></p> <pre class="lang-cs prettyprint-override"><code>public void subject_Click() { Response.Write("Clicked"); } </code></pre>
c# asp.net
[0, 9]
2,512,601
2,512,602
jquery Malsup's form plugin and Ketchup validation to work together?
<p>i'm having lots of problems getting the 2 plugins to work together... </p> <p>heres the script i'm currently using, which doesn't work... it submits the form without validation...</p> <pre><code> &lt;script&gt; function validate() { $('#contact_form').ketchup(); } function showResponse() { $('#form_content').html('thanks you for submitting the form'); } $(document).ready(function() { $('#contact_form').ajaxForm( { beforeSubmit: validate, success: showResponse } ); }); &lt;/script&gt; </code></pre> <p>if i add a 'return false' in the validate function then the ketchup validation is triggered and the form is correctly validated, but even if it passes validation it doesn't submit.</p> <p>anyone got any suggestions for how to get these 2 scripts to play nice together?</p> <p>cheers</p> <p>dog</p>
javascript jquery
[3, 5]
3,994,693
3,994,694
Ignore commas in a text input field when submitting
<p>So I've made this search that does what its supposed to do front-end wise. However, when submitting I'd like the query to ignore commas.</p> <p>Right now I'm using commas to make a comma separated search. The whole thing is, when I submit; the comma's are included and thus messes up my search values. </p> <p>Is there any way to ignore comma's upon submit?</p> <p>Example: Searching <code>[Example][Test]</code> will actually return <code>Example,Test</code>.</p> <p>I've made a <a href="http://jsfiddle.net/YEr6m/27/" rel="nofollow">fiddle here</a></p> <p>Any suggestions and help is greatly appreciated. </p>
javascript jquery python
[3, 5, 7]
1,757,331
1,757,332
Javascript - How to change a new value on drop down
<p>When we change the <code>name="quantity"</code> and the <code>$product['price']</code> value will changing too. Here will have dynamic quantity and price. How to do that using jquery/javascript.</p> <pre><code>&lt;?php $select = "SELECT * FROM `products` ORDER BY `id` DESC LIMIT 10"; $query = mysql_query($select) or die(mysql_error()); ?&gt; &lt;ul&gt; &lt;?php while($product = mysql_fetch_array($query)) { ?&gt; &lt;li&gt; &lt;p&gt;&lt;?php echo $product['name'];?&gt;&lt;/p&gt; &lt;p&gt; Quantity &lt;select name="quantity"&gt; &lt;?php for($i=1;$i&lt;=$product['quantity'];$i++) { ?&gt; &lt;option value="&lt;?php echo $i; ?&gt;"&gt;&lt;?php echo $i; ?&gt;&lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt;&lt;?php echo $product['price'];?&gt;&lt;/p&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; </code></pre> <p>Let me know :)</p>
php javascript jquery
[2, 3, 5]
765,935
765,936
Pass data using jQuery Trigger event to a Change event handler?
<p>Is there a way to pass data to a "change" event via jQuery's trigger method?</p> <p>The issue here is that a "click" event triggers the upload menu. Once the image is selected, the "change" event is fired, however. The data I passed into the trigger event's second parameter is passed to the click event, not to the change event. In the example below, "data" is undefined.</p> <p><strong>Trigger Image Change</strong></p> <pre><code>$('.change_main_image').live('click', function() { $('input[name=photo].change_uploader').trigger('click', ["some string"]); }); </code></pre> <p><strong>Event Handler</strong></p> <pre><code>$('input[name=photo].change_uploader').live('change', function (e, data) { alert(data); // undefined //canvas resize and upload script }); </code></pre>
javascript jquery
[3, 5]
3,416,000
3,416,001
recieving header(location:) as a callback from a php script in jquery .ajax
<p>With this jquery : </p> <pre><code>$.ajax({ type: "POST", url: "tosql.php", data: { content: content }, success: function() { } }); </code></pre> <p>I was wondering if I could receive a header(location: ) from the php, to redirect to another page with specific values stored in the url. Here is the url: <code>header(location: 'morefive.php?document='.urlencode($id))</code></p>
php jquery
[2, 5]
3,567,037
3,567,038
Getting a server control property value via Java Script
<p>I want to access a boolean property of my User Control through Java Script. For this I do:</p> <pre><code>..=document.getElementById('&lt;%= dtPickerBirth.ClientID%&gt;').IsValidDate; </code></pre> <p>As you might guess IsValidDate is a boolean value and I want to access it. Is there anything wrong with this code? I use this for validation purposes but it does not work.</p>
javascript asp.net
[3, 9]
3,984,962
3,984,963
disable paste (control V) in IE for an input text box
<p>Is there a way to disable the paste (control V) into a text box using javascript/jquery for IE? </p> <p>I do not have access to the markup unfortunately or I would use onPaste="return false". Can it be attached with Jquery? </p> <p>If it cannot be disabled at least is there a way to detect it so that when the paste event occurs just remove the text from the input text box.</p> <pre><code>&lt;input type="text" maxlength="" size="25" value="Enter letters here" name="TEXTBOX___97___470GCPC___31" autocomplete="off"&gt; </code></pre>
javascript jquery
[3, 5]
2,372,446
2,372,447
Using :not selector with $(this)
<p>I have the following line which works OK</p> <pre><code>$("#myDiv img:not(:eq(0))").hide(); </code></pre> <p>I want to write a similar line but using "this". So:</p> <pre><code>$(this":not(:eq(0))").hide(); </code></pre> <p>But that doesn't work... Any ideas where it's gone wrong?</p>
javascript jquery
[3, 5]
3,558,064
3,558,065
I want to dynamically display submenu in asp .net
<p>I want to <code>display submenu dynamically from database</code>.But I am getting an error in line menuBar. <code>FindItem(dr["ParentMenuId"].ToString()).ChildItems.Add(mnu);</code> that object reference not set to an instance of an object. also I am <code>unable to display my submenu</code>. What is the error please tell me.</p> <p>My code is:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (! IsPostBack) getMenu(); } private void getMenu() { SqlConnection con = new SqlConnection(@"Data Source=ST015\SQLEXPRESS;Initial Catalog=MyData;Integrated Security=True"); con.Open(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); string sql = "Select * from Categories"; SqlDataAdapter da = new SqlDataAdapter(sql, con); da.Fill(ds); dt = ds.Tables[0]; // DataRow[] drowpar = dt.Select("ParentMenuId=" + 0); foreach (DataRow dr in dt.Select("ParentMenuId=" + 0)) { menuBar.Items.Add(new MenuItem(dr["MenuName"].ToString(), dr["MenuId"].ToString(), "", dr["MenuDescription"].ToString())); } foreach (DataRow dr in dt.Select("ParentMenuId &gt;" + 0)) { MenuItem mnu = new MenuItem(dr["MenuName"].ToString(), dr["MenuId"].ToString(), "", dr["MenuDescription"].ToString()); menuBar.FindItem(dr["ParentMenuId"].ToString()).ChildItems.Add(mnu); } con.Close(); } </code></pre> <p>}</p>
c# asp.net
[0, 9]
2,855,872
2,855,873
Undefined index: uploaded_file in C:\wamp\www\upload_test\upload_media_test.php on line 5
<p>Here is my php file</p> <pre><code> &lt;?php $target_path1 = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path1 = $target_path1 . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path1)) { echo "The first file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded."; } else{ echo "There was an error uploading the file, please try again!"; echo "filename: " . basename( $_FILES['uploaded_file']['name']); echo "target_path: " .$target_path1; } ?&gt; </code></pre> <p>May I know how to solve this problem? <img src="http://i.stack.imgur.com/dTAGA.png" alt="error"></p>
php android
[2, 4]
2,003,477
2,003,478
ClearInterval won't stop
<p>I'm using jQuery to "blink" some text when loading (after an AJAX call), but whenever I call clearInterval, I get an "undefined" error.</p> <p>Here's a snippet of my code:</p> <pre><code>OrderId="a12345"; var AllIDs = {}; AllIDs[OrderId] = setInterval( function() {j$("#" + OrderId + "_MessageListSize").fadeIn(200).fadeOut(200)}, 200 ); </code></pre> <p>Then later, after the AJAX call completes:</p> <pre><code>OrderId="a12345"; var myid = AllIDs[OrderId]; clearInterval(myid); </code></pre> <p>Why won't clearInterval stop the animation? Does it have to do with how I'm using <strike>associative arrays</strike> object literals?</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
2,334,759
2,334,760
Passing array of strings from c# to javascript
<p>I am building two arrays in c# and pass them to a js function like this:</p> <pre><code> //call js to show the map with the markers string[] lats = new string[10]; string[] longs = new string[10]; for (int i = 0; i &lt; 10; i++) { lats[i] = dv[i]["Latitude"].ToString(); } for (int i = 0; i &lt; 10; i++) { longs[i] = dv[i]["Longitude"].ToString(); } StringBuilder sbLats = new StringBuilder(); string[] latsArray = lats.ToArray&lt;string&gt;(); //Build the JS array. sbLats.Append("["); for (int i = 0; i &lt; latsArray.Length; i++) { sbLats.AppendFormat("'{0}', ", latsArray[i]); } sbLats.Append("]"); StringBuilder sbLongs = new StringBuilder(); string[] longsArray = longs.ToArray&lt;string&gt;(); //Build the JS array. sbLongs.Append("["); for (int i = 0; i &lt; longs.Length; i++) { sbLongs.AppendFormat("'{0}', ", longsArray[i]); } sbLongs.Append("]"); ScriptManager.RegisterStartupScript(this, this.GetType(), "mapMarket", "buildMapWithMarkers('map_market', " + latsArray + ", " + longsArray + ", " + "false" + ");", true); </code></pre> <p>For some unknown reason this throws an exception here (in the aspx page, part of generated js):</p> <pre><code>buildMapWithMarkers('map_market', System.String[], System.String[], false) </code></pre> <p>which says:</p> <pre><code>Uncaught SyntaxError: Unexpected token ] </code></pre> <p>Can you please tell me where I am wrong?</p>
c# javascript
[0, 3]
5,371,609
5,371,610
How to hide an element inside HTML iframe?
<p>I have a page that have toolbar at top and an iframe below the toolbar. It is Stumbleupon style. Some web pages that are loading into iframe has flash objects and those open on my modal div. How can I hide flash objects in iframe? You may see it in action here: <a href="http://www.yemeklog.com/1-pakistana-yardim-zamani.html" rel="nofollow">http://www.yemeklog.com/1-pakistana-yardim-zamani.html</a> Please click on "Yorum" text on toolbar.</p>
javascript jquery
[3, 5]
456,171
456,172
Jquery bind click and hover, how to check if click
<p>I have combined function like this(simplified version):</p> <pre><code>$('label').bind('click hover', function() { $('label').removeClass("active"); $(this).addClass("active"); }); </code></pre> <p>How can I add an <code>if</code> to check if it is a click?</p>
javascript jquery
[3, 5]
4,425,880
4,425,881
Difference between the classes System.StringComparer and System.StringComparison?
<p>What is the difference between these two classes ?</p> <p>I have used <code>System.StringComparer.OrdinalIgnoreCase()</code> and <code>System.StringComparison.OrdinalIgnoreCase()</code> and both yield the same results. Do they have any difference or they both same ?</p>
c# asp.net
[0, 9]
3,833,063
3,833,064
jQuery.editable: Need to strip HTML breaks on edit
<p>I have a field that I'm outputting text into after doing an nl2br(). I've made the field editable by users. However, I don't want users to see the <code>&lt;br&gt;</code>s when they click edit.</p> <p>This is my function:</p> <pre><code>$(this).editable({ type: 'textarea', submit: 'Save', cancel: 'Cancel', editClass: 'editable', onEdit: function(content) { $(this).html($(this).text()); }, ... }); </code></pre> <p><code>$(this).html($(this).text())</code> doesn't work. By the time the onEdit fires, the text inside the tag is gone. Any ideas? I can paste more code if needed, but I didn't think it was necessary.</p> <p>If I do a <code>$(this).val('whatever');</code> instead, nothing gets replaced.</p>
javascript jquery
[3, 5]
269,230
269,231
How may I obtaining value of label element using substring in label's for attribute using jQuery?
<p>I am trying to obtain the value of label elements using jQuery (or javascript). The only search term I have is a substring of the label element's for attribute. In the example code shown below, this would be 'Okuku'.</p> <pre><code>&lt;label class="required" for="Nigeria-Osun-Okuku"&gt;The Township of Okuku&lt;/label&gt; </code></pre> <p>The Script:</p> <pre><code>$("label[for='Nigeria-Osun-Okuku']").text(); </code></pre> <p>would return </p> <blockquote> <p>The Township of Okuku</p> </blockquote> <p>but I don't have the complete 'for' value: Nigeria-Osun-Okuku <strong>but the last substring of it: 'Okuku'</strong>. </p> <p>How can I script to search, match and <strong><em>return: The Township of Okuku</em></strong> ? Thanks</p>
javascript jquery
[3, 5]
1,989,682
1,989,683
Site tour for first time user for all pages
<p>What is the best way to identify a user to visit a page in a site for the first time. I've written a script which shows a tour of the page. Since tours should be shown only once. I need to know.</p> <p>For example consider a domain example.com if a user login for the first time i need to show a tour on the '/' page.. When the user navigates to '/page1' i should show the tour for that page. when the user go backs to '/' i shouldn't show the tour. But when user goes to '/page2' i should show the tour on page2.</p> <p>I could able to find the first time when the user logs in by a single query.! but How can i do that for each and every page. My idea was to make a query to database every time when the user navigates but i know it's not the best way. </p> <p>Note: Cookies can be used to track anything.</p>
php javascript jquery
[2, 3, 5]
2,570,613
2,570,614
Problems converting from an object to XML in java
<p>What I'm trying to do is to convert an object to xml, then use a String to transfer it via Web Service so another platform (.Net in this case) can read the xml and then deparse it into the same object. I've been reading this article: </p> <p><a href="http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#start" rel="nofollow">http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php#start</a></p> <p>And I've been able to do everything with no problems until here:</p> <pre><code>Serializer serializer = new Persister(); PacienteObj pac = new PacienteObj(); pac.idPaciente = "1"; pac.nomPaciente = "Sonia"; File result = new File("example.xml"); serializer.write(pac, result); </code></pre> <p>I know this will sound silly, but I can't find where Java creates the new File("example.xml"); so I can check the information.</p> <p>And I wanna know if is there any way to convert that xml into a String instead of a File, because that's what I need exactly. I can't find that information at the article.</p> <p>Thanks in advance.</p>
java android
[1, 4]
2,465,996
2,465,997
Sugestion for FB meta tags using jquery and php
<p>here is my problem:</p> <p>i have FB app, where i am getting data from json and using that data for making list of items in my main window, i can click on every item, and after i click it opens in new ajax window where i get more info about that item</p> <p>problem is about meta tags for FB, cos i have LIKE button for every item, so when i click on it, i can post that item on FB wall with infomations like title, picture and description</p> <p>i have this situation: when i click on item in my main window, it opens in new ajax window, and i manually add item it to the URL like this:</p> <pre><code>window.location.href=window.location.href + "?id=" + ID + "#id=" + ID; </code></pre> <p>and php code is this:</p> <pre><code> &lt;?php if(isset($_GET['id'])){ $json = file_get_contents("http:....." . $_GET['id'] . "&amp;..."); $json_array = json_decode($json); print '&lt;meta property="og:title" content="' . $json_array-&gt;title . '" /&gt; '; } ?&gt; </code></pre> <p>it all work all right, but i get problem with refreshing page, cos every time i click on item in my main window it open new window cos i add GET parameter in url</p> <p>so how can i avoid refreshing page and still have functionality for describe like option on FB wall</p>
php jquery
[2, 5]
3,042,894
3,042,895
Rotating an image - readonly
<p>I found code to rotate an image. My problem is that when I save it, the image is already opened, and in use by me (As, I opened it to rotate it).</p> <p>How can I avoid this?</p> <pre><code> public static void RotateImage(string filePath, float angle) { //create a new empty bitmap to hold rotated image using (var img = Image.FromFile(filePath)) { using(var bmp = new Bitmap(img.Width, img.Height)) { //turn the Bitmap into a Graphics object Graphics gfx = Graphics.FromImage(bmp); //now we set the rotation point to the center of our image gfx.TranslateTransform((float) bmp.Width/2, (float) bmp.Height/2); //now rotate the image gfx.RotateTransform(angle); gfx.TranslateTransform(-(float) bmp.Width/2, -(float) bmp.Height/2); //set the InterpolationMode to HighQualityBicubic so to ensure a high //quality image once it is transformed to the specified size gfx.InterpolationMode = InterpolationMode.HighQualityBicubic; //now draw our new image onto the graphics object gfx.DrawImage(img, new Point(0, 0)); //dispose of our Graphics object } img.Save(filePath); } </code></pre> <p>edit: Updated code as per Anthony's advice.</p> <p>edit:</p> <p>Just some FYI, this was accomplished in a couple of lines...</p> <pre><code>public static void RotateImage(string filePath, float angle) { //create a new empty bitmap to hold rotated image byte[] byt = System.IO.File.ReadAllBytes(filePath); var ms = new System.IO.MemoryStream(byt); using (Image img = Image.FromStream(ms)) { RotateFlipType r = angle == 90 ? RotateFlipType.Rotate90FlipNone : RotateFlipType.Rotate270FlipNone; img.RotateFlip(r); img.Save(filePath); } } </code></pre>
c# asp.net
[0, 9]
683,864
683,865
JavaScript wrong scope
<p>I have the JS scope mixed up. I am trying to assign to values to coordinates and use them later, but for some reason i always get the coordinates as null. </p> <pre><code> var thing = (function($){ var obj = function(config) { $.extend(obj.config, config); obj.init(); }; $.extend(obj, { coordinates: {}, browser_geolocation: function() { if (navigator.geolocation) { var timeoutVal = 10 * 1000 * 1000; navigator.geolocation.getCurrentPosition( obj.browser_coordinates, //set coordinates maps.browser_error, { enableHighAccuracy: true, timeout: timeoutVal, maximumAge: 0 } ); } else { alert("Geolocation is not supported by this browser"); } }, browser_coordinates: function(position) { obj.coordinates.long = position.coords.longitude; obj.coordinates.lat = position.coords.latitude; }, }); $(function() { maps.browser_geolocation(); maps.browser_geolocation(); console.log(obj.coordinates); }); return obj; }(jQuery)); </code></pre> <p>I cant seem to figure out what I am doing wrong?</p>
javascript jquery
[3, 5]
4,975,990
4,975,991
jQuery: position element next to another and fix it there
<p>I want to position ElementA next to ElementB like specified here: <a href="http://stackoverflow.com/questions/158070/jquery-how-to-position-one-element-relative-to-another">jQuery: How to position one element relative to another?</a></p> <p>with the only difference being that I want ElementA to move around with ElementB if ElementB is moved. </p> <p>Is it possible to somehow fix a certain element's position to another? It's not feasible for me to recalculate ElementA's position every time ElementB is moved.</p> <p><strong>UPDATE</strong></p> <p>In my situation, ElementB was a <code>td</code> element. Apparently, <code>td</code> elements can't be relatively positioned, which was why ElementA wasn't moving with ElementB. An easy fix for this was simply adding a relatively positioned <code>div</code> inside ElementB and then placed ElementA in there.</p>
javascript jquery
[3, 5]
1,865,522
1,865,523
Want to pass php variable as argument in javascript function?
<p><br> i want to pass my php variable in one javascript function.<br> i know it seems simple but i don't know where am i missing something?</p> <pre><code> &lt;?php while($gg=mysql_fetch_array($lg)) { ?&gt; &lt;td id="add_td"&gt; &lt;?php $id = $gg['p_id']; echo "&lt;a onclick=cnf('Are you sure you want to delete that?',$id)&gt;"; ?&gt;Delete&lt;/a&gt; &lt;/td&gt; &lt;?php } ?&gt; </code></pre> <p>and in my javascript function</p> <pre><code>function cnf(msg,id) { cnf = confirm(msg); if(cnf) { parent.location.href = 'p_update.php?d=' + id; } } </code></pre> <p>so i need to know on which id that user had clicked so that i will only delete that id from database.<br> if i try this thing then it showing error on "cnf" function and its saying like "unterminated string literal"?<br></p>
php javascript
[2, 3]
5,821,630
5,821,631
Create a radial gradient programmatically
<p>Im trying to reproduce the following gradient programmatically. </p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;gradient android:startColor="@color/startcolor" android:centerColor="#343434" android:endColor="#00000000" android:type="radial" android:gradientRadius="140" android:centerY="45%" /&gt; &lt;corners android:radius="0dp" /&gt; &lt;/shape&gt; </code></pre> <p>How can I set programmatically the paramether? Thanks</p> <pre><code> android:centerY="45%" </code></pre>
java android
[1, 4]
3,909,129
3,909,130
Transcompile jQuery to JavaScript
<p>I know all internal jQuery functions are written in JavaScript, so it should technically be possible to just evaluate jQuery to JavaScript.</p> <p>I have a snippet of JavaScript that uses jQuery that I need to use in an environment where jQuery isn't available. I know I could translate it by hand, but it is quite a lot of code. Is there a tool out that that does this?</p> <p>Just to make it clear: with a lot of effort I could probably get jQuery in the environment but I would like to have a solution that is a bit more resource friendly. If there is no tool like this I'll just try to translate the code by hand, I was just wondering whether there was such a tool.</p>
javascript jquery
[3, 5]
3,813,818
3,813,819
Requesting something via ajax - how to stop other requests until this one is done
<p>I have a php script that outputs json data. For the purposes of testing, i've put sleep(2) at the start.</p> <p>I have a html page that requests that data when you click a button, and does <code>$('.dataarea').append(data.html)</code></p> <p>(php script returns a json encoded array. data.html has the html that i want to put at the end of <code>&lt;div class="dataarea"&gt;...HERE&lt;/div&gt;</code>.</p> <p>The trouble is, if i click the button too fast (ie. more than once within two seconds (due to the sleep(2) in the php script)), it requests the php file again.</p> <p>how can i make it only do one request at a time?</p> <p>i've tried this (edited down to show the important parts):</p> <pre><code>amibusy=false; $('#next').click('get_next'); function get_next() { if (amibusy) { alert('requesting already'); } else { amibusy=true; // do the request, then do the append() amibusy=false; } } </code></pre> <p>but this doesn't seem to work. i've even tried replacing the amibusy=true|false, with set_busy(), and set_not_busy(). (and made a function am_i_busy() { return amibusy; })</p> <p>but none of this seems to work. what am i missing?</p>
javascript jquery
[3, 5]
5,086,978
5,086,979
Targeting Next Div Element in Jquery
<p>Here is the HTML</p> <pre><code>&lt;a style="border: medium none; display: block;" class="agendaNav" href="#"&gt;&lt;img class="rightArrow" src="/images/arrowdown.png"&gt; WEEK AT A GLANCE&lt;/a&gt; &lt;div class="agendaDay"&gt; Content In Here &lt;/div&gt; </code></pre> <p>The Same link / class is repeated several times and I use the following JQuery:</p> <pre><code>$('.agendaNav').click(function(event){ event.preventDefault(); if($(this).find('.rightArrow').attr('src')=='/images/arrowdown.png'){ $(this).find('.rightArrow').attr('src', '/images/arrowright.png'); $(this).attr('style', 'border-bottom: 1px solid #fff; display: block;'); } else { $(this).find('.rightArrow').attr('src', '/images/arrowdown.png'); $(this).attr('style', 'border: none; display: block;'); } $('.agendaDay').toggle('fast'); }); </code></pre> <p>If you take a look here:</p> <p><a href="http://icuc2011.com/agenda" rel="nofollow">http://icuc2011.com/agenda</a></p> <p>You'll see that it changes every class of agendaDay which makes sense, but I only want to change the one directly after the 'a' tag that was clicked, I tried this:</p> <pre><code>$(this).next('.agendaDay').toggle('fast'); </code></pre> <p>But then the arrow changes but the div of class agenda day doesn't change at all, what am I doing wrong?</p>
javascript jquery
[3, 5]
3,586,213
3,586,214
count the textbox values using javascript
<p>I have dynamically added rows using javascript.now I have to sum the values in the text boxes.if i click add button the same row will be added.now i have one fixed textbox.if i enter the values in the textbox it should add and get displayed in the fixed textbox on keypress.how can i do this with javascript or jquery</p> <p>here is my html and jquery scripts to addd the row</p> <p>input id="name" type="text" input id="add" type="button" value="+" input id="Button1" type="button" onclick="removeRowFromTable();" value="x" </p> <p>I have used jquery to add the rows dynamically and javascript to delete the rows</p> <pre><code>$(document).ready(function() { $("#add").click(function() { $('#mytable tbody&gt;tr:last').clone(true).insertAfter('#mytable tbody&gt;tr:last'); $('#mytable tbody&gt;tr:last #name').val(''); $("#mytable tbody&gt;tr:last").each(function() {this.reset();}); return false; return false; }); }); </code></pre> <p>function removeRowFromTable() { var tbl = document.getElementById('mytable'); var lastRow = tbl.rows.length; if (lastRow > 2) tbl.deleteRow(lastRow - 1); }</p>
javascript jquery
[3, 5]
3,185,553
3,185,554
ASP.NET Routing webform query
<p>I have a ASP.net Web forms project that I am working on. I need to have a add club page where the admin can add a club to the website.</p> <p>When the club is added it creates a small website within my website for that club automatically. I think this uses some form of string builder.</p> <p>Then that club should be able to store their own details on that page.</p> <p>I was going to do this doing asp.net routing. Would this be the correct way of going about this?</p> <p>Having looked at different examples i would need to have the url for the webpage automatically generated</p>
c# asp.net
[0, 9]
5,086,037
5,086,038
Calling a function and pass it a json object
<p>I have a json object named data like below</p> <p><img src="http://i.stack.imgur.com/1Rw9b.png" alt="enter image description here"></p> <p>And I have a function denomination in a string like below</p> <p><img src="http://i.stack.imgur.com/G8x09.png" alt="enter image description here"></p> <p>test is the name of the function I would like to call and pass it the json object data.</p> <p>here is the test function:</p> <pre><code>test = function (data) { alert('I am the test function'); } </code></pre> <p>I already try:</p> <pre><code>eval(func(data)); </code></pre> <p>It doesn't work.</p> <p>Any idea?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,714,964
1,714,965
How can delete Click event?
<p>How can I completely delete the $(selector).click() event?</p> <p>I created option buttons and I would like to stop the click event so that the user won't be able to change the option already selected.</p> <p>How to complete the overriding of the click (or any other) event on jquery?</p>
javascript jquery
[3, 5]
2,389,480
2,389,481
Next count no. clients connected to the server
<p><a href="http://stackoverflow.com/questions/8854176/get-a-list-of-all-active-sessions-in-asp-net">Get a list of all active sessions in ASP.NET</a> the above linked show the get active session but how to used this method when i used the application_start or user form load it returns null.</p> <p>i want to calculate the how many user active in current session or server .this question is linked with my previous question <a href="http://stackoverflow.com/questions/9495241/next-count-no-clients-connected-to-the-server">.Next count no. clients connected to the server</a></p> <p>i have used the get IP address &amp; add to the arraylist &amp; counting the IP address collection its working but when the already login user get close the application the IP address not remove from the arraylist . i have used the session_end event to remove the IP aadress when i try to remove the IP address the again get the IP address from context it throws exception . but session end event throws after specific timeout . but i want to remove the IP address when client disconnected or close the browser.</p>
c# asp.net
[0, 9]
1,138,925
1,138,926
selected text in iframe
<p>How to get a selected text inside a iframe.</p> <p>I my page i'm having a iframe which is editable true. So how can i get the selected text in that iframe.</p>
javascript jquery
[3, 5]
1,419,997
1,419,998
calling php function in jquery
<p>I have one file json.js and one php function in php file .in json.js i want to check value returned by php function if value returned by fucntion is 0 jquery should perform :$(':input').prop('disabled', true); otherwise nothing –</p> <pre><code>function loadJson (table, id) { $.get("json-object.php", {'table': table, 'id':id}, function (data) { console.log(data); $.each(data, function (k, v) { if ($('input[name="'+k+'"]').is('input[type="text"]')) { $('input[name="'+k+'"]').val(v); } if($('select[name="'+k+'"]').val(v)){ get_input_value(k,v); } if ($('input[name="'+k+'"]').is('input[type="checkbox"]')) { get_input_value(k,v); } console.log(k+' ==&gt; '+v); // Here I want to check condition of php function if value returned by fucntion is 0 it should perform :$(':input').prop('disabled', true); otherwise nothing // }); }, 'json'); } </code></pre> <p>My php function:</p> <pre><code>function ronly($id) { //$id=$_POST['noces']; $sql = "SELECT COUNT(noces) FROM alterdetail WHERE noces = '$id'"; $sql.=';'; //echo "QUERY &lt;br/&gt;"; //echo $sql; $res = mysql_query($sql); $row = mysql_fetch_array($res); if($row['COUNT(noces)'] &gt; 0) { echo "you can not alter data"; return 0; } else { echo " data new "; return 1; } } </code></pre>
php jquery
[2, 5]
2,532,483
2,532,484
How do I target a jquery click function where identical links exist (ie within a php foreach)?
<p>Similar to what Facebook does on its newsfeed, I want to allow commenting on numerous feed items, which I'm pulling via a php foreach statement. This is creating identical classes. So when I click .show_comments it activates everything.</p> <p>I went through SO and found something akin to what you see below...but it's not working for me.</p> <p>How do I target individual .show_comments to animate and toggle the selected item?</p> <pre><code>$j(function() { $j(this).find('.show_comments').click(function(){ $j(this).find('.comments').slideDown("fast"); $j(this).find(".answer_comments").toggle(); }); $j(this).find('.hide_comments').click(function(){ $j(this).find('.comments').slideUp("fast"); $j(this).find(".answer_comments").toggle(); }); }); </code></pre>
javascript jquery
[3, 5]
4,370,680
4,370,681
Is there internal layout with icon and text?
<p>I know that there are many iternal layouts which I can use for adapters - android.R.layout.simple_list_item_1, android.R.layout.select_dialog_item, etc. But is there any internal layout which I can use for making item with icon and text (image_<em>_</em>_text)? Why android.id should I use for it? </p>
java android
[1, 4]
960,214
960,215
C# - Loading remote image and sending to browser using .ashx file
<p>I'm trying to load a remote image from my Amazon S3 bucket and send it to browser in binary. I'm also trying to learn ASP.Net at the same time. I've been a classic programmer for many years and need to change. I started yesterday and have my first headache today.</p> <p>On a page in my application I have this image element:</p> <pre><code>&lt;img src="loadImage.ashx?p=rqrewrwr"&gt; </code></pre> <p>and on loadImage.ashx, I have this exact code:</p> <pre><code>------------------------------------------------- &lt;%@ WebHandler Language="C#" Class="Handler" %&gt; string url = "https://............10000.JPG"; byte[] imageData; using (WebClient client = new WebClient()) { imageData = client.DownloadData(url); } public void ProcessRequest(HttpContext context) { context.Response.OutputStream.Write(imageData, 0, imageData.Length); } ------------------------------------------------- </code></pre> <p>There is probably quite a lot wrong with this, as it's my first attempt at .net and don't know what I'm doing. To start with, I'm getting the following error but sure there's more to come.</p> <pre><code>CS0116: A namespace does not directly contain members such as fields or methods </code></pre> <p>This is on line 3, which is <code>string url = "https://............"</code></p>
c# asp.net
[0, 9]
5,015,633
5,015,634
Data from database show/hide onclick trouble
<pre><code>&lt;?php $getNews = $db-&gt;prepare("SELECT * FROM news ORDER BY id DESC LIMIT 4"); $getNews-&gt;execute(); $news = $getNews-&gt;fetchAll(); foreach ($news as $newspost) { echo $newspost['title'] ; ?&gt; &lt;a style="cursor:pointer;" onclick="return toggleMe('problem')"&gt;read/hide&lt;/a&gt; &lt;?php echo '&lt;br /&gt;'; echo 'Posted by '; echo $newspost["user"]; echo ' at '; echo $newspost["created"]; ?&gt; &lt;div id="&lt;?php echo $newspost['id']; ?&gt;" style="display:none;"&gt; &lt;?php echo $newspost['message']; ?&gt; &lt;/div&gt; &lt;?php echo '&lt;br /&gt; &lt;br /&gt;'; } ?&gt; </code></pre> <p>What I had in mind was that it shows/hides the text from the newspost when you hit the read/hide link next to the title of the newspost.<br> I can fit the <code>$newspost['id']</code> in the representing div but because the <code>onclick="return toggleMe('problem')"&gt;</code> has both <code>"</code> and <code>'</code> in it I need another way to fit it in there, I searched a lot but couldn't find what I was exactly looking for.</p>
php javascript
[2, 3]
1,321,109
1,321,110
Passing dynamic value via param
<p>I am using this plugin <a href="http://valums.com/ajax-upload/" rel="nofollow">http://valums.com/ajax-upload/</a>. I am using this code :</p> <pre><code>var uploader = new qq.FileUploader({ // pass the dom node (ex. $(selector)[0] for jQuery users) element: document.getElementById('file-uploader'), // path to server-side upload script action: '/server/upload', params: {item1:$('#txtName').val() } }); </code></pre> <p>Now when the request is made to server always the blank value goes to server instead of what the actual value is (I changed the value of textbox after the page has been loaded). I think the first default value of textbox is passed in this case. My question how can I pass the dynamic value of textbox to server ?</p>
javascript jquery
[3, 5]
145,865
145,866
Why jquery class selector select items that has part of the classname?
<p>if i have :</p> <pre><code>&lt;div class="carBig"&gt;&lt;/div&gt; </code></pre> <p>and</p> <pre><code>&lt;div class="car"&gt;&lt;/div&gt; </code></pre> <p>and $(".car").size();</p> <p>i get 2 items ..</p>
javascript jquery
[3, 5]
4,112,956
4,112,957
Can I get a jQuery object from an existing element
<p>I have a function</p> <pre><code>function toggleSelectCancels(e) { var checkBox = e.target; var cancelThis = checkBox.checked; var tableRow = checkBox.parentNode.parentNode; } </code></pre> <p>how can I get a jQuery object that contains tableRow Normally I would go <code>$("#" + tableRow.id)</code>, the problem here is the id for tableRow is something like this <code>"x:1280880471.17:adr:2:key:[95]:tag:"</code>. It is autogenerated by an infragistics control. jQuery doesn't seem to <code>getElementById</code> when the id is like this. the standard dom <code>document.getElementById("x:1280880471.17:adr:2:key:[95]:tag:")</code> does however return the correct row element. </p> <p>Anyways, is there a way to get a jQuery object from a dom element?</p> <p>Thanks, ~ck in San Diego </p>
javascript jquery
[3, 5]
3,446,968
3,446,969
Make the Alphabet enter capital if there is a space before it when entering text in the textbox
<p>I want to make the ALPHABET capitalize entered by the user in the textbox if there is a space before it.</p> <p>Example user writes "test new" so "n" should be a capital and it will be so smooth that it feels like the user pressed the shift key</p> <p>I think we can do the same in keydown event (jquery)</p> <p>The code is something that i tried is:</p> <pre><code>$('.name').live("keydown", function (e) { try { if ($('.name').val().length &gt; 1) { if ($('.name').val().substring($('.name').val().length - 1) == " ") { // HERE can we do something like e.shift key etc to get desired result } } } catch (err) { alert(err); } }); </code></pre>
javascript jquery
[3, 5]
5,130,940
5,130,941
Why does this code block say "not all code paths return a value"?
<p>I wrote following code...but i am getting Error like:</p> <p><strong>Error 1 'LoginDLL.Class1.Login(string, string, string)': not all code paths return a value</strong></p> <p>Please help me...</p> <p>Thanks in advance...</p> <p>My code is as given below...</p> <pre><code>public int Login(string connectionString,string username,string password) { SqlConnection con=new SqlConnection(connectionString); con.Open(); SqlCommand validUser = new SqlCommand("SELECT count(*) from USER where username=@username", con); validUser.Parameters.AddWithValue("@username", username); int value=Convert.ToInt32(validUser.ExecuteScalar().ToString()); if (value == 1) { //check for password SqlCommand validPassword = new SqlCommand("SELECT password from USER where username=@username", con); validPassword.Parameters.AddWithValue("@username", username); string pass = validPassword.ExecuteScalar().ToString(); if (pass == password) { //valid login return 1; } else { return 0; } } else if (value == 0) { return 2; } } </code></pre>
c# asp.net
[0, 9]
3,448,851
3,448,852
jQuery DatePicker set time and date
<p>Hello I was asked to modify some code. We got something like this:</p> <pre><code>$("#expiration_datepicker").datetimepicker( "option", "disabled", false ).attr('value', ''); $("#expiration_datepicker").datetimepicker( { dateFormat: 'mm-dd-yy', showOn: 'button', buttonImage: '../chassis/images/calendar.gif', buttonImageOnly: true, minDate: 0, maxDate: '+5Y', duration: '', &lt;c:if test="${formIsReadonly or form.newsItemId == '-1'}"&gt;disabled: true,&lt;/c:if&gt; constrainInput: false, timeFormat: 'hh:mm' }); </code></pre> <p>Looks like this is setting up the date picker</p> <p>How Can I set it up to default show todays date and time?? like dd-m-yy hh:mm</p>
javascript jquery
[3, 5]
3,284,857
3,284,858
Label showing "System.Web.UI.WebControls.Label"
<pre><code>double peratusE = ((double)(bilanganE / calonAmbil)) * 100.00; Label peratusELabel = row.Cells[16].FindControl("peratusELabel") as Label; peratusELabel.Text = String.Format("{0:0.00}", peratusELabel); </code></pre> <p>i use that particular code to calculate the percentage and to assign the percentage value to a label. however, when running it, it displays "System.Web.UI.WebControls.Label" instead of the value.</p> <p>for your information: i use </p> <pre><code>double peratusD = ((double)(bilanganD / calonAmbil)) * 100.00; Label peratusDLabel = row.Cells[14].FindControl("peratusDLabel") as Label; peratusDLabel.Text = String.Format("{0:0.00}", peratusD); </code></pre> <p>but this time it works just fine. i'm stucked.</p>
c# asp.net
[0, 9]
4,131,304
4,131,305
how to accept only alphabetical pressed keys ( for "autocomplete" purpose )
<p>am wondering ... how to only accept alphabetical pressed keys from the keyboard .. i am using the jQuery .keypress method ... now i wanna know how to filter the passed key ... </p> <p>i am trying to build a simple autocomplete plugin for jQuery ...i know a about jQuery UI, but i want to do it myself ...</p> <p>thanks in advance :)</p>
javascript jquery
[3, 5]
1,996,059
1,996,060
Yes no dialog with progress
<p>I was wondering if anyone has an example of a yes no dialog that when yes is pressed it shows the progress of the background activity.</p> <p>When yes is pressed my application inserts data into an SQL server database and it can take some time. Although the dialog is model while this happens it would be nice to show the user that something is working.</p> <p>Cheers,</p> <p>Mike.</p>
java android
[1, 4]
3,586,212
3,586,213
Are zero length timers still necessary in jQuery?
<p>I am finally getting around to really implementing some jQuery solutions for my apps (which is seeming to also involve a crash course in javascript).</p> <p>In studying examples of plugins, I ran across this code. I'm assuming the author created the zero length timer to create some seperation of the running code, so that the init functon would finish quickly.</p> <pre><code>function hovertipInit() { var hovertipConfig = {'attribute':'hovertip', 'showDelay': 300, 'hideDelay': 700}; var hovertipSelect = 'div.hovertip'; window.setTimeout(function() { $(hovertipSelect).hovertipActivate(hovertipConfig, targetSelectById, hovertipPrepare, hovertipTargetPrepare); }, 0); } </code></pre> <p>Is needing this type of seperation common? <br/> Is creating the zero length timer still the best way to handle this situation, or is there a better to to handle this in jQuery?<br/> </p> <p>Thanks,<br/> Jim</p>
javascript jquery
[3, 5]
4,102,555
4,102,556
How to get the textbox value from a hidden field value assigned
<p>I have written the following script to get the value of hidden field to a text box when text box is empty on hitting tab but it did not works so can any one tell what's wrong in this</p> <pre><code>&lt;script type="text/javascript"&gt; function Tab() { var PayDate = document.getElementById('txtDate').value; var hdn1 = document.getElementById('hdn1'); if (PayDate == null) { // Retreive the next field in the tab sequence, and give it the focus. document.getElementById('txtDate').value = hdn1.value; } } &lt;/script&gt; &lt;asp:HiddenField ID="hdn1" runat="server" /&gt; &lt;asp:TextBox ID="txtDate" runat="server" onChange="Tab();"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btn" runat="server" Text="Button" /&gt; </code></pre> <p>On my page load i write this</p> <pre><code>if (!IsPostBack) { hdn1.Value = "1-2-2001"; } </code></pre> <p>But i am not getting the value of hidden field assigned to text box when i am hitting tab can any one help me</p>
javascript asp.net
[3, 9]
5,856,297
5,856,298
Why are my values not being kept between instances of a type?
<p>I have the class:</p> <pre><code>public class pro { private string url = string.Empty; public string GetURL() { return url; } public void SetURL(string value) { url = value; } } </code></pre> <p>In this line I'm getting value:</p> <pre><code>string url = li1.Value; pro itm = new pro(); // I have create Proprtie so I'm calling that itm.SetURL(url); // here I'm setting value </code></pre> <p>Then later:</p> <pre><code>pro itm = new pro(); //properties object I have created string url = itm.GetURL(); // I'm not getting value which I have set in first </code></pre> <p>class.</p> <p>I have create Proprties also; what am I doing wrong?</p>
c# asp.net
[0, 9]
5,088,406
5,088,407
sending parameters from ASP.NET to javascript
<p>I want to call a javascript function from my ASP.NET (C#) code, I want to pass a variable (string) with another string like below:</p> <pre><code>tag_label.Attributes.Add("onmouseover", "tooltip.show('my text'+'"+myString+"'&lt;br/&gt;'another text);"); </code></pre> <p>how should I pass these values? also I want to have new line in my tooltip (<code>&lt;br/&gt;</code>), what should I do? I've tried several ways (using <code>'</code>, <code>+</code> and other methods) to send all these values but I get javascript error, is there any sample? please help me thanks</p>
javascript asp.net
[3, 9]
3,576,633
3,576,634
How can I take the user to a new page, along with some variables, using Javascript/jQuery, without causing a URI Too Large error?
<p>Using Javascript/jQuery, I need to take the user to a new page when a button is clicked, and also send along a bunch of variables to the new page. At the moment I'm doing it like this:</p> <pre><code>location.href=window.location.href + '/new_note?id='+$('#note_id').val()+'&amp;note_subnotes='+encodeURIComponent(window.JSON.stringify(sub_notes)) </code></pre> <p>This works okay, but the problem is that <code>sub_notes</code> is an array of hashes, which can get pretty large. If I have more than a few hashes in the array, I get this error:</p> <pre><code>Request-URI Too Large WEBrick::HTTPStatus::RequestURITooLarge </code></pre> <p>So obviously the URI is too big. How can I do this without running into this problem? Thanks for reading.</p>
javascript jquery
[3, 5]
4,366,118
4,366,119
global asax file
<p>What is the global asax file for? I'm looking to declare a user-specific dictionary of objects that'll be used throughout the pages of the application. Where do I declare this dictionary?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
1,829,689
1,829,690
Why heder('Location:index')not working but window.location.href='index.php' is working?
<p>I have the Index file like this</p> <pre><code>&lt;?php include('file1.php'); include('file2.php'); ?&gt; </code></pre> <p>in file1.php I am having the code like below.</p> <pre><code>&lt;?php echo "hai"; ?&gt; </code></pre> <p>I am trying to redirect the page by using <code>header('Location:index.php')</code>.It throws an error something like the output already started.I know for header if we give the echo statement it throws an error.In this situation I am trying to redirect by using Javascript <code>window.location.href='index.php'</code> .It gives me the expected output and there is no error.Why?.</p>
php javascript
[2, 3]
3,406,429
3,406,430
Filtering mobile browsers by failure to execute using jQuery
<p>Just getting some css together for a mobile web app (using the xhtml-basic/xhtml-basic11 dtd) and was trying to think of a reliable way to filter for mobile browsers. I've taken a look at <a href="http://detectmobilebrowser.com" rel="nofollow">http://detectmobilebrowser.com</a> but that appears to filter on the basis of a list of string matches. </p> <p>Here's what I'd like to do:</p> <p>1 - In the css, set the parts of the page to hide from mobile browsers to not display</p> <pre><code>#hideMeFromMobiles{display:none;} </code></pre> <p>2 - Call a script using a reliable library that is pretty much certain to fail in mobile browsers. The script does something like this (pseudocode)</p> <pre><code>if browser.window.width &gt;= 480px then { $(#hideMeFromMobiles).addStyle(display:block;) } </code></pre> <p>The idea is for the script to fail non-destructively on mobile browsers and run succesfully in desktop web browsers.</p> <p>My question is this:</p> <p>Firstly will this work? Is there some reason this is a dead-end and I should move to another solution?</p> <p>And secondly, could someone confirm the correct jQuery syntax?</p> <p>Thanks for your help, Dug</p>
javascript jquery
[3, 5]
3,860,188
3,860,189
android resize layout when keyboard appears
<p>I would like to reposition layout when keyboard appears, for example when editing a text field, in order to get visibility on focused field. I tried windowSoftInputMode but I cannot get any difference. How to reach it? Thank you.</p> <pre><code>&lt;activity android:name="com.xxxx.projecte1.TabBar_Activity" android:theme="@android:style/Theme.NoTitleBar" android:configChanges="keyboardHidden|orientation|screenSize" android:windowSoftInputMode="adjustResize" /&gt; </code></pre>
java android
[1, 4]
4,986,033
4,986,034
Java to C# Conversion
<p>I need to convert several Java classes to C#, but I have faced few problems.</p> <p>In Java I have following class hierarchy:</p> <pre><code>public abstract class AbstractObject { public String getId() { return id; } } public class ConcreteObject extends AbstractObject { public void setId(String id) { this.id= id; } } </code></pre> <p>There are implementation of AbstractObject which do not need to have setId() defined, so I cannot move it up in the hierarchy.</p> <p>How to convert this to C# using properties? Is that possible?</p>
c# java
[0, 1]
9,184
9,185
asp:LinkButton code to open new browser window/tab after other code
<p>For my internal webpage at work, I display a DataGrid based on entries in a SQL table (not directly, but with some processing on entries).</p> <p>Each row in the DataGrid has a button that the user clicks. I need this button to open a new window or tab (I believe I can't decide as this is based on browser config) and also change a value in the SQL table to say the button was clicked.</p> <p>If I use an asp:Hyperlink then the page opens nicely, but I don't know how to update SQL. Vice-versa if I use an asp:LinkButton I can get the SQL updated but can't get a new page to open.</p> <p>Is what I am trying to do impossible?</p> <p>Thanks</p> <p>EDIT:</p> <p>I've tried both these in my .cs file, but neither worked:</p> <pre><code>ClientScript.RegisterStartupScript(GetType(), "openwindow", "window.open('" + url + "','_preview'"); Response.Write("&lt;script type='text/javascript'&gt;detailedresults=window.open('" + url + "');&lt;/script&gt;"); </code></pre>
c# asp.net
[0, 9]
1,424,344
1,424,345
Why doesn't this work?
<p>I want to change the value of an element with javascript.</p> <pre><code>&lt;span id="mixui_title"&gt;Angry cow sound?&lt;/span&gt; &lt;script type="text/javascript"&gt; $("#mixui_title").val("very happy cow"); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
2,510,249
2,510,250
jQuery IF statement (Only if a web browser on a desktop) not a mobile device / iPad
<p>is there a easy way with jQuery to essentially have a jQUery/JS if statement along the lines of:</p> <pre><code>IF User is on a web Browser on a desktop... not a mobile device / iPad </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]