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
4,390,958
4,390,959
Benefits to starting JavaScript "for" loops at 0, or just traditional?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://programmers.stackexchange.com/questions/110804/defend-zero-based-arrays">Defend zero-based arrays</a> </p> </blockquote> <p>I'm running code that loops through an array of HTML IDs.</p> <p>With the HTML IDs named content1, content2, …, content12, my loop looks like:</p> <pre><code>for (var i = 1; i&lt;13; i++) { var contentFind = $('#content'+i)[0]; </code></pre> <p>I know that the usual way to run loops is to start at i = 0. Is there any benefit to this, or is it just the traditional, standard or normal way to write loops?</p>
javascript jquery
[3, 5]
556,029
556,030
How can I inform the Gallery about the touch event happening in ScrollView?
<p>I have the following custom classes. Currently the scroll for the ScrollView works fine. If I override the onTouchEvent in ScrollView and make it return false, the Gallery works fine however the ScrollView scroll does not. How can I make it so both will work together?</p> <p>This is the CardGallery class which extends Gallery:</p> <pre><code>public class CardGallery extends Gallery { public CardGallery(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); // TODO Auto-generated constructor stub } public CardGallery(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // TODO Auto-generated method stub return super.onFling(e1, e2, velocityX, velocityY); //return false; } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // TODO Auto-generated method stub return super.onScroll(e1, e2, distanceX, distanceY); //return false; } @Override public boolean onSingleTapUp(MotionEvent e) { // TODO Auto-generated method stub return super.onSingleTapUp(e); } } </code></pre> <p>This is the CardScrollView class which extends ScrollView:</p> <pre><code>public class CardScrollView extends ScrollView { public CardScrollView(Context context) { super(context); } public CardScrollView(Context context, AttributeSet attrs) { super(context, attrs); } } </code></pre>
java android
[1, 4]
1,339,977
1,339,978
set cursor position in textarea at end once user clicked on textarea
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4715762/javascript-move-caret-to-last-character">Javascript: Move caret to last character</a> </p> </blockquote> <p>I am working on text area using jquery, to provide good UI validation. Currently I stuck at -</p> <p>Once user click in text area I want to set cursor position forcefully at end. Please provide me some jquery solutions so resolve this ?</p> <p>Thanks in advance -Pravin</p>
javascript jquery
[3, 5]
557,101
557,102
Converting single quotes to double quotes inside a title attribute
<p>I have an image title that has a tag with double quotes in it, and I need to convert it to single quotes for use in a photo slideshow. I don't have the option of changing anything other than the attribute name, so I can't escape the quotes inside the value. </p> <p>Here's my html:</p> <pre><code>&lt;div id="image-gallery"&gt; &lt;img alt="Alt Text" src="photo.jpg" title="Title &lt;a href="#link"&gt;here&lt;/a&gt;" /&gt; &lt;/div&gt; </code></pre> <p>I've tried grabbing the title and using replace to change the double quotes to single quotes, like so:</p> <pre><code>mystr=string = $("#image-gallery img").attr('title'); mystr=mystr.replace(/\"/g,'\''); </code></pre> <p>The title still drops off after the first double quote though. Any ideas?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
796,413
796,414
Loadind system shared library runtime in Android
<p>I need to write an application, which will be using a shared library. I need that application to be installed on devices with Android 1.6 and above. I have added the shared library information on the manifest file as follows:</p> <pre><code>&lt;uses-library android:name="com.google.android.maps" android:required="false" /&gt; </code></pre> <p>Now, the <strong>android:required</strong> field is added from Android 2.1 above and this tag will be ignored by the Android 1.6, and hence the application will fail to install saying " INSTALL_FAILED_MISSING_SHARED_LIBRARY".</p> <p>My question is that, is there any way by which, I need not define the shared library information in the manifest and instead I can load the system library ("com.google.android.maps" in my case) dynamically and use reflection to access the class and methods of the library?</p>
java android
[1, 4]
4,733,730
4,733,731
working with Jquery dyanmic created elements?
<p>my simple script is append few elements through jquery .<br> what im trying to do is to add some ajax call for those created elements .<br> the issue is the event never work for those elements and i tried a lot of Jquery methods but all fail .<br></p> <pre><code>$("#currentbuild").append('&lt;li class="cancelevent"&gt;&lt;/li&gt;'); $('.cancelevent').bind("click",function(e) { var eventid = $(this).attr('id'); e.preventDefault(); alert(eventid); }) </code></pre> <p>also i tried </p> <pre><code>$("#currentbuild").append('&lt;li class="cancelevent"&gt;&lt;/li&gt;'); $('.cancelevent').on("click",function(e) { var eventid = $(this).attr('id'); e.preventDefault(); alert(eventid); }) </code></pre> <p>but it never show up anything</p>
javascript jquery
[3, 5]
5,842,272
5,842,273
Pros and cons of using a Thread or TimerTask for an Android game
<p>Many Android game examples utilize a Thread to run a game engine on a particular interval. However, I've seen some other examples that use a TimerTask to run the game engine interval as well. I'm curious as to what other developers think the pros and cons of each approach are.</p>
java android
[1, 4]
2,871,633
2,871,634
How to do a USER NAME & PASSWORD protection in a web site before it is loading
<p>How can we able to protect a site using USERNAME and PASSWORD after we entering the URL and the site is before loading</p> <p>For ex: <a href="http://www.buildyourownbouquet.com/" rel="nofollow">http://www.buildyourownbouquet.com/</a></p> <p>I need exactly what it looks like...</p> <p>Thanks in Advance</p> <p>Fero</p>
php javascript
[2, 3]
2,545,258
2,545,259
Styling letters of a word within an input differently, possible?
<p>Wondering if this is even possible, but if I have a input containing text, for example lets say the word 'Test' is in the input. What I would like to be able to do is change the styling on the individual letters of the word 'Test'</p> <p>I would like the '<strong>Te</strong>' to be bold and then have the 'st' be regular. </p> <p>It wouldn't have to be bold, maybe I would like the 'e' to be red or something like that. </p> <p>Any ideas on how this might be accomplished?</p>
javascript jquery
[3, 5]
1,535,624
1,535,625
How can I pass arguments to event handlers in jQuery?
<p>With jQuery code like: <br/></p> <pre><code>$("#myid").click(myfunction); function myfunction(arg1, arg2) {/* something */} </code></pre> <p>How do I pass arguments to myfunction while using jQuery???</p>
javascript jquery
[3, 5]
5,046,416
5,046,417
mousedown div containment to parent(latest)
<p>My inner div is suppose to move around with the mouse cursor on mousemove but i want it to stop at the if statement if it is dragging with the isDragging variable so it will drag smoothly but it seems to not stop any suggestion and help would be appreciated update: <a href="http://jsfiddle.net/pPn3v/47/" rel="nofollow">jsFiddle</a></p> <pre><code>var yellow = $('#yellow'); var offset = yellow.offset(); var offsetWidth = offset.left + yellow.width(); var offsetHeight = offset.top + yellow.height(); var isDragging = false; var red = $('#red'); $('#red').hide(); yellow.on('mousedown', function(event) { $('#red').show(); }); yellow.on('mouseup', function(event) { $('#red').hide(); }); yellow.on('mousemove', function (e) { if(e.pageX &gt; offset.left + ($(red).width() / 2) &amp;&amp; e.pageX &lt; offsetWidth - ($(red).width() / 2) &amp;&amp; e.pageY &gt; offset.top + ($(red).height() / 2) &amp;&amp; e.pageY &lt; offsetHeight - ($(red).height() / 2) &amp;&amp; !isDragging ){ red.css("left", e.pageX - $(red).width() / 2 ); red.css("top", e.pageY - $(red).height() / 2); } $('#red').draggable( {'containment':'#yellow', start:function(event, ui) { isDragging = true; }, drag:function(event, ui) { isDragging = true; },stop:function(event, ui) { isDragging = false; } }); }); &lt;div id="yellow"&gt; &lt;div id="red"&gt;&lt;/div&gt; &lt;/div&gt; #yellow { position: absolute; width: 250px; height: 250px; background-color: Yellow; } #red { position: absolute; width: 100px; height: 100px; background-color: red; z-index: 100; } </code></pre>
javascript jquery
[3, 5]
200,329
200,330
how to pass a command line argument to a c++ file through a python code?
<p>i am compiling a c++ file in python code using this os.system("rc.cpp") and then os.system("./a.out") . I would like to pass a command line argument to the rc file . how do i do it?</p>
c++ python
[6, 7]
4,272,438
4,272,439
Sorting javascript array
<p>I have a global array in javascript say <code>jsonArr = ["location","department","grade"];</code></p> <p>now inside my method i am doing this</p> <pre><code>var newArr = []; newArr = jsonArr; var sorted_arr = newArr.sort(); </code></pre> <p>my newArr is getting sorted but problem is along with jsonArr also got sorted i dont want to sort jsonArr </p> <p>what is the problem can anyone plz help me ?</p>
javascript jquery
[3, 5]
4,600,322
4,600,323
t.tBodies(0).appendChild(r) is not working in firefox
<p><code>t.tBodies(0).appendChild(r);</code> is not working in firefox. This is javascript code and used to create dynamic table elements. Please advice. </p>
javascript asp.net
[3, 9]
5,816,403
5,816,404
jquery attr(name,value) method's value parameter
<p>I'm reading Bibeault's jQuery in Action and I'm having troublel understanding the <code>value</code> parameter of the <code>attr()</code> method. The book says that the parameter can be a function whose parameters are <code>index</code> and <code>previousValue</code>. What is the purpose of these parameters? I don't understand the text's explanation. </p> <p>Specifically I want to know:</p> <ol> <li>Are these parameters mandatory?</li> <li>What is an example of how these parameters are used?</li> <li>Can I use other parameters within the function?</li> </ol>
javascript jquery
[3, 5]
1,548,603
1,548,604
jquery toggleclass bug on iPhone
<p>The following code shows a menu called #wrap-footer by sliding it down when you click #menu-button. Clicking anywhere on the page except the menu makes it slide back up. </p> <p>When the menu is visible #menu-button has a class added to it called 'menu-open' (used for styling). When the menu is hidden again the class is removed. </p> <p>Note, Ive used the selectors '#wrap-header,#wrap-pre-footer,#wrap-content' rather than just 'html' or 'document' as the iPhone doest recognise these. </p> <pre><code>$(document).ready(function(){ $("#menu-button a").hide(); $('#menu-button').append('Menu'); $('#wrap-header,#wrap-pre-footer,#wrap-content').click(function() { $('#wrap-footer').slideUp('slow'); $('#menu-button').removeClass('menu-open'); }); $('#menu-button').click(function(event){ event.stopPropagation(); $('#menu-button').toggleClass('menu-open'); $('#wrap-footer').slideToggle('slow'); }); $("#wrap-footer").click(function(e) { e.stopPropagation(); }); }); </code></pre> <p>On desktop browsers everything is fine. However on the iPhone the slideToggle works fine but the toggleClass never removes the class. So if the menu is open, clicking on the page (but not #menu-button or #wrap-footer) minimises the menu and removes the class, but clicking #menu-button only minimises the menu and doesn't remove the class. </p> <p>Thanks </p>
jquery iphone
[5, 8]
1,706,072
1,706,073
Javascript multiply function failed when together
<p>Javascript function does not work when </p> <pre><code>function loadcontents(obj) { var params = $(obj).attr('href').split('?'); $.getJSON(IVIDPLAY_BASE_DIR+'content/load2.php?'+params[1], function(json) { if (json.returnval == 1) { $('#contents').fadeOut('fast', function() { $(this).html('json.contents').fadeIn('slow'); }); } } </code></pre> <p>is trigger to replace this div:</p> <pre><code>&lt;div class="content"&gt; &lt;a href="{$content2.url}" onclick="return loadContent2(this, 'page', '2')"&gt;Click Here &lt;/a&gt; &lt;/div&gt; </code></pre> <p>in another word, there is a function being refresh by the first function and it does not work, when the second one does work.</p> <p>However! when </p> <pre><code>loadContent2(this, 'page', '2') </code></pre> <p>is replace or remove</p> <pre><code>loadContent2(this, "page", "2") </code></pre> <p>like so, the first function work, but not the second!</p> <p>is there a way to by pass the quote issue? if it's a quote issue?</p> <p>any help highly appreciated!</p> <p>EDIT:</p> <p>fire bug show no error, but it's clearly not working as logically should.</p>
php javascript
[2, 3]
3,002,567
3,002,568
Develop an application Module wise in asp.net?
<p>How to develop an application in asp.net module wise In which we can add new module and remove existing module dynamically? Or Suppose we create an asp.net web application. how to convert that application in an module so that the application will work as a module of another application. </p>
c# asp.net
[0, 9]
5,784,020
5,784,021
pyfacebook and javascript query
<p>I'm using pyfacebook on the backend and javascript on the client side. Now if I want to pass a variable to the javascript from pyfacebook. how would I go about doing that, any ideas?</p>
javascript python
[3, 7]
1,898,339
1,898,340
How to make Dropdown List with checkboxes?
<p>How do we make a drop down list with checkboxes? C# lang is preferred for this.</p>
c# asp.net
[0, 9]
4,872,647
4,872,648
Javascript class scope
<p>I am unable to call this.RenderDeals() from inside my Post.success function. I assume this has something to do with scope? Could someone shed some light on the issue, and possibly suggest a workaround. I have tried using prototype and module pattern, both without any luck.</p> <p>FYI Post is an $.ajax wrapper that returns a jQuery Deferred object.</p> <pre><code> function Deals() { this.template = '#trTemplate'; this.container = '#containerTable'; this.GetDeals = function () { Post('Deal.svc/GetDeals') .success(function (result) { this.RenderDeals(result); }); }; this.RenderDeals = function (deals) { $(this.template).tmpl(deals).appendTo(this.container); } } var deal = new Deals(); deal.GetDeals(); </code></pre> <p>UPDATE:</p> <p>Ok, so I added the following line just above the GetDeals function:</p> <pre><code>var me = this; </code></pre> <p>and instead call</p> <pre><code>me.RenderDeals(result); </code></pre> <p>Appears to work correctly, but I'm not sure why.</p>
javascript jquery
[3, 5]
5,501,281
5,501,282
Disable autocomplete for all jquery datepicker inputs
<p>I want to disable <code>autocomplete</code> for all inputs using jquery ui datepicker without doing this to every input manually. How could be this done?</p>
javascript jquery
[3, 5]
3,320,753
3,320,754
Using Jquery to post single variable
<p>Hi I have a jquery function which prompts user to enter a value in a dialog box and posts the value to a script and then returns a value which posts a form value if the first value is correct. The second value (txtImport) is not being posted to the script (importFile)?</p>
php jquery
[2, 5]
3,686,776
3,686,777
When to fetch more content on infinite scroll?
<p>I'm building out an infinite scrolling feature for my site and am debating at what scroll point to inject more content into the page. I've seen some that perform the request at a fixed pixel distance from the bottom of the document, and others that feel more percentage based. What do large sites like Tumblr, Facebook, Pinterest, etc. do? Are there different use cases between fixed pixel distance and percentage? Here's my code:</p> <pre><code>// 20% var scrollPoint = ($(document).height()/5); if($(window).scrollTop() &gt;= $(document).height() - $(window).height() - scrollPoint) { console.log('Load more goodness'); } </code></pre> <p>Edit: On re-examining Facebook, it almost looks like they have a 'hot zone' where they pull in more content. If you use the mouse to scroll to the bottom you don't get an auto fetch of content.</p>
javascript jquery
[3, 5]
2,751,602
2,751,603
Create multi-dimensional array index in Javascript?
<p>I have a ajax request that is returning to me an object that looks roughly like the following:</p> <pre><code>[ {category: "Test Category", id: "1", name: "Test", language: "English"}, {category: "Test Category", id: "2", name: "Test2", language: "English"}, {category: "A test", id: "3", name: "Test3", language: "Spanish"}, {category: "Test Category", id: "4", name: "Test4", language: "Spanish"} ] </code></pre> <p>Basically I need a way to do the following:</p> <ul> <li>List all categories that exist in ONLY English or Spanish</li> <li>List all ID's that exist in a specified language</li> <li>List all ID's that exist in a specified category</li> </ul> <p>Now I'm fairly sure the best route to do this is to create my own temp arrays that can house that data but I'm not confident enough in Javascript to write the correct loop to get that data. I know in PHP I'd do something like <code>$category['Test Category'][] = 3</code> while looping.</p> <p>The idea is I need the ability to filter things based on the user selecting to filter by English and then by a category within that.</p> <p>Can someone point me in the right direction?</p>
javascript jquery
[3, 5]
423,325
423,326
MultiViewControl issues
<p>I'm presently in the process of reworking a MultiViewControl based wizard process for our web application. I am having an rough time trying to make sense of the order that events are happening (Page_Load, Init, prerender, etc). Does anyone out there on the interwebs have details on dealing with one of these controls? Please don't just say 'google' it. I've done that and have yet to find a good, comprehensive site yet.</p> <p>Admittedly, I haven't really elaborated on the problems I'm having with this control, so I'll try to do that:</p> <ol> <li>Primary problem is the initialization of UserControls that live in different Views. In the existing codebase, the programmer was using a combination of multiviewcontrol.ActiveViewIndex = WHATEVER and Response.Redirect("PageWithMultiView.aspx?nextstep") and it made it all very convoluted. My task is to attempt to remove the Response.Redirect calls and use only the setting of the ActiveViewIndex. Is this even possible? Also, there are some cases where I need to initialize a control in a particular view only on the initial load and not on subsequent postbacks. I can use something like the IsPostBack flag but this is only ever set to false on the initial load. Subsequent reloads IsPostBack == true. I basically want to have IsPostBack set to false for the initial load of each View. Can this be done without doing a Response.Redirect to itself?</li> </ol> <p>Hopefully this will make some sense to someone out there.</p> <p>Thanks. Greg.</p>
c# asp.net
[0, 9]
818,307
818,308
jQuery fire function on all class elements
<p><strong>I want to execute some function on all class elements. How can i do that?</strong></p> <p>I know i can use jQuery like this:</p> <pre><code>$('.myClass').css('background','red'); $('.myClass').hide(); $('.myClass').fadeIn(); // etc </code></pre> <p>but what i want is something like:</p> <pre><code>// i want to fire my function on all class elements $('.myClass').go(function(){ // my function using "this" object }); </code></pre> <p>i know i can use <code>document.getByClassName()</code> but i want to use jQuery, but i can't find proper page in documentation.</p> <p>notice i can't use <code>$('.myClass').ready()</code></p>
javascript jquery
[3, 5]
4,719,108
4,719,109
What is the correct way to handle client side and server side errors on the web?
<p>I'm new to web development (though not new to WinForms developmet) and I wanted to know the correct and efficient way to handle errors both on the client side as well as the server side.</p> <p>For example, user enters a bad zip code (using letters), I want to notify the user of the bad zip code entered, how do I handle this? </p> <p>I'm assuming this would be on the client side but can anyone show me an example code? What scripting language should you use? Should you display a message on the screen? Should you make an error message visible? What is the standard way of doing this?</p> <p>Example two: user clicks on something that runs a query in a server database. An error occurs. How do I notify the user of the error?</p> <p>Usually in Win Forms I can just do this:</p> <pre><code>try { CreateDirectoriesAndSystemFiles(); } catch (Exception ex) { ErrorLogger.LogError(ex.Source, ex.TargetSite.ToString(), "Error creating directories!; " + ex.Message); MessageBox.Show(ex.Message, "Error creating directories!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } </code></pre> <p>How can I mimic the above in a web environment?</p>
c# asp.net
[0, 9]
2,257,170
2,257,171
What does this attribute below mean?
<p>I have seen this example on the web:</p> <pre><code>$('#questionTextArea').each( function() { var $this = $(this); var $questionText = $("&lt;textarea class='textAreaQuestion'&gt;&lt;/textarea&gt;") .attr('name',$this.attr('name')) .attr('value',$this.val()); $question.append($questionText); }); </code></pre> <p>Where it says '.attr('name',$this.attr('name'))', what does that mean? Does that give the same 'name' attribute as the 'id' attribute #questionTextArea or the same 'name' as the 'class' attribute 'textAreaQuestion'?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,124,733
3,124,734
jquery .slideToggle wait till all other <li> are closed
<p>Hi all I use a php script to pull the names of the products from a mysql db and display them into a list, each list has 4 sub list elements that are displayed and hidden (toggled) via jquery. my issue is if i move my cursor from on product to the next then it starts opeing that products <code>&lt;li&gt;</code> elements before the other one has closed. Such to the effect that if i run my cursor up the list it looks like a slinky :D</p> <p>how can i tell the jquery to wait till all other toggles have finished before running the new one?</p> <pre><code>while($info = mysql_fetch_array( $result )) { $str .=" &lt;li id='mas".$info['name']."'&gt;&lt;span&gt;".$info['name']."&lt;/span&gt; &lt;ul id='sub".$info['name']."' class='sub' style='display:none'&gt; &lt;li&gt;&lt;span&gt;Scripts&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;Questions&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;Forum&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span&gt;Tips and Tricks&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;script type='text/javascript'&gt; $('#mas".$info['name']."').hover(function () { $('#sub".$info['name']."').slideToggle('slow'); }); &lt;/script&gt; "; } echo $str; </code></pre>
php jquery
[2, 5]
316,607
316,608
Cookies and session state in asp.net
<p>I want to take the name the user types in and then display this on another aspx page using session state.</p> <p>On the page where to user types the name the code I have is</p> <pre><code>Session["name"] = TextBox1.ToString(); //Store the session state in a variable called name from the text box. Response.Redirect("page2.aspx"); </code></pre> <p>Now on page2.aspx I have tried calling this variable but nothing seems to work.</p> <p>I have a empty label1 on the page so I want the name to be stored into the empty label</p> <pre><code>Label1 = Session["name"]; </code></pre> <p>The error message is convert type object to System.Web.UI.WebControlers.Label</p>
c# asp.net
[0, 9]
2,820,411
2,820,412
Android Java make a image move down
<p>How can i make a image just scroll down a straight line by it self?</p> <p>Like</p> <p>The Image starts up here and then it will just smoothly scroll down till it hits the bottom and stop</p> <p>Please look at this: <a href="http://tinypic.com/r/1z17iv9/7" rel="nofollow">http://tinypic.com/r/1z17iv9/7</a></p>
java android
[1, 4]
4,484,548
4,484,549
Context not resolved inside a runnable thread
<p>Here is the code inside main Activity class, which works fine..</p> <pre><code>public void onStart() { super.onStart(); mHandler = new Handler(); context = this; ... } </code></pre> <p>And the following code gives problem, don't know why:</p> <pre><code>public void onStart() { super.onStart(); new Thread(new Runnable(){ public void run(){ mHandler = new Handler(); context = this; ... } }).start(); } </code></pre>
java android
[1, 4]
2,093,450
2,093,451
How to access data in JSON format using javascript
<p>I'm trying to figure out on how to access data in JSON format and have gone a whole day searching for ways but I still can't find a solution to fit my needs. The closest relative question to my problem is <a href="http://stackoverflow.com/questions/14588928/accessing-json-data-in-a-javascript-variable">this question</a> but to no avail. </p> <p>Basically I am retrieving data from <code>$.ajax()</code> which returns in JSON format.</p> <pre><code>[{"v":"233","pv":"1.83","avd":"00:01:58","nv":"82.83%","br":"75.11%"}, {"v":"17","pv":"3.65","avd":"00:08:31","nv":"70.59%","br":"58.82%"}, {"v":"9","pv":"2.22","avd":"00:01:51","nv":"0.00%","br":"44.44%"}] [{"date":"2013-02-01","visits":63}, {"date":"2013-02-02","visits":30}] </code></pre> <p>My problem is how can I access the elements inside the JSON, say I want to get all values of "nv" or all values of "date" on the second bracket, in javascript? I Am new at things like these so am not familiar with the terminologies, sorry for that.</p> <p>Below is my code:</p> <pre><code>var Data = $.ajax({ url: url, type: 'POST', dataType:"json", async: false }).responseText; console.log(Data); </code></pre> <p><em>url</em> is a variable that is passed inside my function in case you might ask.</p>
javascript jquery
[3, 5]
4,462,068
4,462,069
Game: Algorithm for spawning enermies at game/window egdes
<p>I'm looking for an algorithm for spawning enermies at the egdes for the gameboard/window for an Android game. I'm doing the old SpaceWars/Shooting asteriods with spaceship and i need the asteroids to spawn at random locations outside the gameboard, where after they will move into the gameboard in different directions and speeds.</p> <p>It's easy to place the asteroids at random locations, but the tuff part (at least for me) is to give them the right move direction based on the random location they are giving.</p> <p>For example:</p> <p>Gameboard = 1280 x 720</p> <p>Asteroid random location = 1100, 0 (x, y)</p> <p>Right move direction:</p> <p>asteroid.x &lt; gameboard.x/2 - possible move directions = south and south east</p> <p>asteroid.x > gameboard.x/2 - posiible move directions = south and south west</p> <p>Then the asteroid have two possible move directions (that's how i define the gameplan for now): Direct south or south west.</p> <p>I could do a lot of if statements, but i'm hoping someone can help me with some kind of algorithm for the problem?</p>
java android
[1, 4]
3,873,668
3,873,669
Python equivalent of PHP's date()
<p>For simple formats its easy to come up with equivalents</p> <p>PHP:</p> <pre><code>date("Y-m-d") === "2012-07-25"; </code></pre> <p>Python:</p> <pre><code>date.strftime("%Y-%m-%d") == "2012-07-25" </code></pre> <p>But what is the Python equivalent of</p> <pre><code>date("jS F Y") === "25th July 2012"; </code></pre>
php python
[2, 7]
2,960,416
2,960,417
Calling code behind function from jquery Side
<p>How can I do call code-behind function from the client-side?</p> <pre><code>// Code-behind function: public void CodeBehindFunction(int i) { ... } </code></pre> <p>I want to call it from client-side...</p> <pre><code>// Client-side call: $(this). ?? </code></pre>
jquery asp.net
[5, 9]
2,013,578
2,013,579
IP Camera Android Application
<p>I am new in android application &amp; I want to make android application to view &amp; control IP cameras but I don't know from where I can start I want to know if there are specific cameras that can be controlled? or any IP camera can be controlled? as I want to choose between three types of VIVOTEK camera please any help</p> <p>Thanks in advance</p>
java android
[1, 4]
2,964,146
2,964,147
How to rotate matrix of button
<p>In my layout I have matrix of buttons with images so I want rotate buttons column wise alternatively right to left and left to right so I can see blank buttons without images.</p>
java android
[1, 4]
2,421,942
2,421,943
Does anybody knows any Android library which works just like Fancybox?
<p>Does anybody knows any Android library (or any fragments of code) to make thumbnails/ImageView enlarge just like the javascript plugin Highslide JS (<a href="http://highslide.com/" rel="nofollow">http://highslide.com/</a>)? This seems to be the standard method of how Facebook app enlarges images. I particularly like how images seems to effortlessly slides to the centre while zooming from the original location of the thumbnail.</p>
java javascript android jquery
[1, 3, 4, 5]
726,974
726,975
Create dynamic inline stylesheet
<p>What is the best way of creating dynamic style tags using js and/or jQuery?</p> <p>I tried this:</p> <pre><code>var style= jQuery('&lt;style&gt;').text('.test{}'); </code></pre> <p>This works in FF but pops an error in IE7 "Unexpected call to method or property access."</p> <pre><code>var style = document.createElement('style'); style.innerHTML='.test{}'; </code></pre> <p>Gives the same error. It doesn't matter if I use <code>innerHTML</code> or <code>innerText</code>. The strange thing is that it shows an error before appending the style tag.</p> <p>I suspect that <code>cssText</code> has something to do with it, but I'm not sure how.</p>
javascript jquery
[3, 5]
3,501,429
3,501,430
how do i open my class from main activity?
<p>Im attempting to open my class Speak2 from my main activity with code:</p> <pre><code>Intent i = new Intent("R.voice.Speak2"); startActivity(i); </code></pre> <p>Please advise?</p> <p>code:</p> <pre><code>public class recon extends Activity implements OnClickListener{ ListView lv; static final int check = 2000; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.voice); lv = (ListView)findViewById(R.id.lvVoiceReturn); Button b = (Button)findViewById(R.id.bVoice); b.setOnClickListener(this); } public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(recon.this , Speak2.class); startActivity(i); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); } </code></pre> <p>}</p> <p>My program is simple , button appears from voice.xml layout and when pressed launches the class activity Speak2, but some problem exists...</p>
java android
[1, 4]
1,781,380
1,781,381
The interface ColorSpace cannot define an initializer
<pre><code>public abstract interface Color { public static final float[] xyz2sRGB; static { float[] arrayOfFloat = new float[9]; arrayOfFloat[0] = 3.241F; arrayOfFloat[1] = -0.9692F; arrayOfFloat[2] = 0.0556F; arrayOfFloat[3] = -1.5374F; arrayOfFloat[4] = 1.876F; arrayOfFloat[5] = -0.204F; arrayOfFloat[6] = -0.4986F; arrayOfFloat[7] = 0.0416F; arrayOfFloat[8] = 1.057F; xyz2sRGB = arrayOfFloat; } </code></pre> <p>The compiler doesn't like the above code, returning the error:</p> <pre><code>The interface ColorSpace cannot define an initializer </code></pre> <p>Where am I going wrong?</p>
java android
[1, 4]
5,709,182
5,709,183
How to get the innerText of RadioButtonList
<p>I am able to use the following to get the value of the selected radio button (of the radio button list rblReason)</p> <pre><code>var reasonId = $('#rblReason').find('input[checked]').val(); </code></pre> <p>How can I get the innerText of the radio button selected? ty</p>
asp.net javascript jquery
[9, 3, 5]
4,594,546
4,594,547
resizeable textarea
<p>I've got such definition of textareaBox and textarea in CSS file:</p> <pre><code>.textareaBox { border: 1px solid #e5e5e5; width: 371px; height: 73px; float: right; padding: 5px 10px; } .textareaBox textarea { width: 370px; height: 67px; line-height: 18px; outline: none; border: none; font-size: 12px; color: #888888; font-family: "Segoe UI Light", segoeuil; </code></pre> <p>}</p> <p>On ASPX page I've placed</p> <pre><code>&lt;asp:Content ID=....&gt; &lt;link type="text/css" href="~/stylesheets/jquery-ui-1.9.0.custom.css" rel="Stylesheet"/&gt; &lt;script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="~/Scripts/jquery-ui-1.9.0.custom.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { $(".textareaBox").resizable(); }); &lt;/script&gt; </code></pre> <p>But textareaBox doesn't change its size. And textarea inside it always when it becomes bigger than textareaBox outside of the textareaBox.</p> <pre><code>&lt;div class="textareaBox"&gt; &lt;textarea ... rows="10" cols="10" class="textarea jq_black"&gt;&lt;/textarea&gt; &lt;/div&gt; </code></pre> <p>Where is the problem?</p>
jquery asp.net
[5, 9]
800,170
800,171
How to modify my jQuery script to add a math function and pass the result?
<p>You can find my jQuery in this fiddle <a href="http://jsfiddle.net/qSkZW/9/" rel="nofollow">http://jsfiddle.net/qSkZW/9/</a> where the value changes based on your dropdown selection.</p> <p>What I need is to multiply the selected quantity with a PHP variable. For example when<code>$price = '10';</code> and you select 3 for quantity, you get an output of 30.</p> <p>Also, how can I pass the result to display it in the next page ?</p> <p>Thank you.</p> <p>What I am trying to clone is the <strong>Your Purchase</strong> system found here <a href="https://www.groupon.com/deals/pizza-delight/confirmation?ms=false&amp;pledge_id=538463" rel="nofollow">https://www.groupon.com/deals/pizza-delight/confirmation?ms=false&amp;pledge_id=538463</a> that you add the quantity and you get the final price.</p>
php javascript jquery
[2, 3, 5]
1,738,902
1,738,903
Android - Broadcast Receiver screen off to Intent, not working....?
<p>I have code below that I have inserted into my onCreate method, but it dosent seem to work. I want it to launch other activity when screen goes off/battery button press. </p> <p>CODE:</p> <pre><code>protected void onStartCommand() { // TODO Auto-generated method stub super.onStart(); ScreenReceiver(); } public class ScreenReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { lock.reenableKeyguard(); Intent s = new Intent(Activity1.this , Activity2.class); startActivity(s); } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { lock.disableKeyguard(); } } } </code></pre> <p>Any help would be VERY appreciated? </p>
java android
[1, 4]
5,852,830
5,852,831
compare the password user input against from database
<p>i'm new to asp.net, i'm writing a login page for learning asp.net, here is the error with the script. When i enter the password only contains english letters, there are no errors, but when i enter the password contain digit/only digit for example, abc123 or 123, line 28 will produce an error, anyone knows what the problems?</p> <p>thanks</p> <pre><code>Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 26: string cmdStr2 = "Select Password from [user] where UserName = '" + TextBox2.Text + "'"; Line 27: SqlCommand pass = new SqlCommand(cmdStr2, con); Line 28: string password = pass.ExecuteScalar().ToString(); Line 29: Line 30: Label1.Text = password; Source File: c:\inetpub\web1\Login.aspx.cs Line: 28 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Login.Button1_Click(Object sender, EventArgs e) in c:\inetpub\web1\Login.aspx.cs:28 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563 </code></pre>
c# asp.net
[0, 9]
5,482,793
5,482,794
Trying to create header and footer for android app
<p>I have created a header and footer. In the header I inserted a menu button with a click event of starting another activity. </p> <p>How can i get the body frame by fixing header and in the same activity. The java code for this file is</p> <pre><code>public class DigitalFoodMenu extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_digital_food_menu); } public void Menu(View view) { Intent intent1=new Intent(getBaseContext(),Menuone.class); startActivity(intent1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.digital_food_menu, menu); return true; } } </code></pre>
java android
[1, 4]
3,072,945
3,072,946
How to break this string?
<p>I have a string "10/15/2010" </p> <p>I want to split this string into 10, 15, 2010 using c#, in VS 2010. i am not sure how to do this. If someone can tell me what function to use, it would be awesome. </p> <p>Thank you so much!!</p>
c# asp.net
[0, 9]
2,758,775
2,758,776
error in c# code of time zone info
<p>i am not using any java script. my code is:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { System.Collections.ObjectModel.ReadOnlyCollection&lt;TimeZoneInfo&gt; TimeZoneColl = TimeZoneInfo.GetSystemTimeZones(); DropDownList2.DataSource = TimeZoneColl; DropDownList2.DataBind(); } } protected void Button1_Click(object sender, EventArgs e) { string d = DateTime.Now.ToString(); string sel =DropDownList2.SelectedValue; Label1.Text = d; TimeZoneInfo tst = TimeZoneInfo.FindSystemTimeZoneById("Norway Standard Time"); Label1.Text = tst.ToString(); //TimeZoneInfo timeinfo = TimeZoneInfo.FindSystemTimeZoneById(sel); //Label3.Text =timeinfo.ToString(); try { DateTime tstTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.Local, tst); Label3.Text = tstTime.ToLongTimeString(); } catch (Exception E) { Console.WriteLine("Error" + E); } } </code></pre> <p>but there is an error in selection of zone in getzone found by id. here the zone can be selected in format of(tokyo standard time) but i want to select it from drop down list. so the drop down list contains the Other format.</p>
c# asp.net
[0, 9]
3,226,038
3,226,039
You are here links
<p>I would like to do links of pages that will tell where you are. In other words something like this;</p> <p>You are here: ASP Free Forums > Programming > ASP Development > </p> <p>I am using ASP.net c#.</p> <p>Any suggestions of how I can do this.</p>
c# jquery asp.net
[0, 5, 9]
3,238,127
3,238,128
Team Parallel development in ASP.NET
<p>I am developing an application written in ASP.NET (C#) which heavily use on Master Page and Session.</p> <p>As there will be enhancement in the same web application, and will be done by my teammate.</p> <p>is there any good approach that can enable we to work on the same solution, and delivery the change to UAT / PDN separately?</p> <p>the change control team of my company don't allow us to create 2 set of code in UAT and merge it into one set in PDN.</p> <p>any idea is welcome.</p> <p>Thanks.</p>
c# asp.net
[0, 9]
2,712,832
2,712,833
Remove address in jQuery Popup
<p>I have a jQuery Popup music player in my website, i want to remove the address bar showing the path to the plugin.</p> <p>The popup event in the JS file:</p> <pre><code>if( !window.fapPopupWin || window.fapPopupWin.closed ) { var windowWidth = 1070; var centerWidth = (window.screen.width - windowWidth) / 2; var centerHeight = (window.screen.height - totalHeight) / 2; window.fapPopupWin = window.open(options.popupUrl, '', 'menubar=no,toolbar=no,location=no,width='+windowWidth+',height='+totalHeight+',left='+centerWidth+',top='+centerHeight+''); if(window.fapPopupWin == null) { alert("Pop-Up Music Player can not be opened. Your browser is blocking Pop-Ups. Please allow Pop-Ups for this site to use the Music Player."); } $(window.fapPopupWin).load(function() { options.autoPlay = playIt; window.fapPopupWin.initPlayer(options, html); playlistCreated = true; }); </code></pre> <p>Any thoughts?</p>
javascript jquery
[3, 5]
4,993,669
4,993,670
from parent to child without traversing the full path
<p>My divs are nested like this. </p> <pre><code>&lt;div id="top"&gt; &lt;div class="child1"&gt; &lt;div class="child-child"&gt; &lt;div class="child-child-child"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="child2"&gt; &lt;div class="child-child"&gt; &lt;div class="child-child-child"&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Right now I'm going from <code>#top</code> to <code>.child-child-child</code> by doing this. </p> <pre><code>$('#top').children('.child1') .children('.child-child') .children('.child-child-child'); </code></pre> <p>Do I have to specify the full path like this? I want to omit the middle divs if there's a syntax that would let me do that. But I probably still need to specify whether I want to go through <code>.child1</code> or <code>.child2</code>.</p>
javascript jquery
[3, 5]
969,034
969,035
Android: Clean up AsyncTask
<p>Over time my app using a lot of AsyncTasks, and I noticed in the debugger that they don't go away and even when they are done they still show up as an active thread. Is there any way after the task is done to tell the garbage collector to kill it?</p>
java android
[1, 4]
4,612,313
4,612,314
how to get file without as it is
<p>Hi I am trying to read a html file and store its content but when I am converting it I am Getting all the special characters are converted to Question mark.</p> <p>I am using stream reader to read the file and stream writer to write the content of that file to another file after storing the content in the Database.</p>
c# asp.net
[0, 9]
5,852,604
5,852,605
Jquery: How can I place triggers on images already cached?
<p>Please see: <a href="http://flx.me/h/0504/" rel="nofollow">http://flx.me/h/0504/</a></p> <p>Source: <a href="http://pastebin.com/bDh5k3Qd" rel="nofollow">http://pastebin.com/bDh5k3Qd</a></p> <p>jquery.preload-min.js: <a href="http://jquery.com/plugins/project/Preload" rel="nofollow">http://jquery.com/plugins/project/Preload</a></p> <p>jquery.jplayer.min.js: <a href="http://www.happyworm.com/jquery/jplayer/0.2.4/developer-guide.htm" rel="nofollow">http://www.happyworm.com/jquery/jplayer/0.2.4/developer-guide.htm</a></p> <p>I'm using jquery.preload-min.js to preload images and to send a play trigger to jquery.jplayer.min.js to start playing a mp3 file.</p> <p>This works great when viewing the page for the first time (or force reloading all content). However, when the image has already been cached, it doesn't use the preloading script and thus does not send the play trigger to jplayer.</p> <p>How can I make it send a play trigger even when the image is cached?</p> <p>Thank you in advance,</p> <p>Dennis</p>
javascript jquery
[3, 5]
5,565,608
5,565,609
word processor in c# or c++
<p>I learned C Sharp for one purpose, to write a word processor that includes my needs. For example that you could play with the spaces between words, and the spaces between the lines, raise one word higher from the row, and many other similar things. When I start working on it in c# - winForms I see the possibilities are very limited, Indeed there are ways to do almost everything With effort, but my question is if I on the right way, maybe c# is not the language to it, maybe I should work with c++. What do you think?</p>
c# c++
[0, 6]
1,848,024
1,848,025
Is there a way to check if pipelining is enabled in php or javascript?
<p>Is there a way to check if pipelining is enabled in php or javascript? There are certain services in the browser you can access in about:config that speed up the browser without uncertainty so I wanna check if some of these are or even get the value aas a string if needed in php or javascript, is this possible? If it is possible in jQuery I would be please too ask for a reference.</p> <p>Mozilla browser</p>
php javascript
[2, 3]
5,762,700
5,762,701
How do I copy all elements and children between two elements into a temp element?
<pre><code>context = document.createElement("span"); start_element = my_start_element; end_element = my_end_element; // some how iterate through here (assuming start and end are different elements) [start_element .. end_element].each(function(current_element){ context.append(current_element); }); </code></pre> <p>pretty straight forward, just don't know how to do the loop part with the start and end nodes. =\</p>
javascript jquery
[3, 5]
5,954,496
5,954,497
learning android vs learning a programming language
<p>Hi!</p> <p>I'm a self-taught programmer. I've taught myself a little bit of web-related technologies (HTML, CSS, Javascript) and 2 "proper" langauges: Python and Java.</p> <p>Now, recently, I started to learn Android. I thought the process would be the same as it was when i learned the other technologies, but far from it.</p> <p>When i program a desktop app in Java, for example, i sit down, think about the code and just, well, code (just solving the problem, writing the code by heart). However, Android just seems impossible to figure out, i just don't get the hang of it. If i need to solve a problem, i don't know where to start and what to do. I just go to google and try to find some code that maybe works for my program. There's no problem solving through coding anymore, there's just : "Ok, i have a problem. Let's see if the huge API has some methods and if i can find some example code". I just don't get the hang of it. It feels like the only thing that i understand thoroughly in android is how to put a button on the screen.</p> <p>Has everyone gone through this stage when starting Android? When simple Java-Python desktop programming felt like pure mathematics, android feels more like engineering.</p>
java android
[1, 4]
3,740,738
3,740,739
calling jQuery from td
<p>i have created a table with a row and 4 columns.i declared attributes class,id for td element. when i click on the td i have to call the jQuery function to load pop up box. here instead load pop up i just want to display the alert box but it doesn't work. here is my code</p> <p>jQuery</p> <pre><code> &lt;script type="text/javascript" src="js/jquery-1.5.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(e) { alert("jquery"); $('.tbox').click(function(e) { tb_show("ThickBox","hi.html?height=120&amp;width=400","true"); } }); &lt;/script&gt; </code></pre> <p>html code:</p> <pre><code>&lt;table&gt; &lt;tr align="center"&gt; &lt;td class="tbox" id="tbox"&gt; &lt;?=$id?&gt; &lt;/td&gt; &lt;td class="tbox" id="tbox"&gt;&lt;?=$zoneName?&gt;&lt;/td&gt; &lt;/tr&gt;&lt;/table&gt; </code></pre> <p>how to call the jQuery?</p>
php javascript jquery
[2, 3, 5]
4,401,576
4,401,577
Could not load file or assembly 'System.Web.DataVisualization' or one of its dependencies
<p>I received this error:</p> <pre><code>Server Error in Application. Could not load file or assembly 'System.Web.DataVisualization' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.BadImageFormatException: Could not load file or assembly 'System.Web.DataVisualization' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.DataVisualization' could not be loaded. </code></pre> <p>After I received this error, I changed the property of <code>system.web.DataVisualization.dll</code> is <code>Copy Local= true</code>, and this dll is also in the bin directory. but the error remains constant.</p> <p>What should I have to do to get rid of this error. </p>
c# asp.net
[0, 9]
5,397,176
5,397,177
need help with jQuery when not hovering over a particular element
<p>I am having a navigation div (the id is navigation) i am thinking of writing a code that executes when i am not hovering over the navigation. Can somebody explain me how can that be possible with jQuery.</p> <pre><code> &lt;ul id='navigation'&gt; &lt;li&gt;a&lt;/li&gt; &lt;li&gt;b&lt;/li&gt; &lt;li&gt;c&lt;/li&gt; &lt;li&gt;d&lt;/li&gt; &lt;/ul&gt; </code></pre> <pre><code> #navigation li{ display:inline; float:left; width:50px; border-right:1px solid black; padding:2px; }</code></pre> <pre><code>jQuery("#navigation").mouseout(function(){ alert("hi"); });</code></pre> <p>Now with this code even when i am moving from one li to another mouseout function is called. However i am expecting it to be called everytime out of this navigation. </p>
javascript jquery
[3, 5]
5,308,967
5,308,968
Creating asp.net website dynamically on the fly
<p>I have an ASP.NET website I need some tool that generate copy of this site on server with a small changes in web.config file.</p> <p>For example: user fill in small form and it creates for him a new copy of this site with db on the server.</p>
c# asp.net
[0, 9]
2,790,113
2,790,114
Can't make work an ajax post to php
<p>Where it's my problem for me the code look's fine</p> <pre><code>$.post("../Backend/buscarCliente.php",{tipoBusqueda:"'"+$('#sltTipoBusqueda').val()+"'"},respuesta); </code></pre> <p>the php</p> <pre><code>&lt;?php //include all DAO files header('Content-Type: text/html; charset=utf-8'); require_once('include_dao.php'); echo $_POST['tipoBusqueda']; ?&gt; </code></pre> <p>i'm already debugged with charles debugging proxy and send this message, so i think the path it's good </p> <p><img src="http://i.stack.imgur.com/Mpv4w.png" alt="enter image description here"></p>
php jquery
[2, 5]
5,137,300
5,137,301
path to Assets to string?
<p>For example, this would be the path to a file on the external memory...</p> <pre><code>String path = Environment.getExternalStorageDirectory().toString()+"/myApp/face.jpg"; </code></pre> <p>But is there also such a path to the Asset folder?</p> <p>Cheers!</p> <p>P.S.</p> <pre><code>"file:///android_asset/1.png" </code></pre> <p>Gives a file not found.</p>
java android
[1, 4]
1,287,423
1,287,424
jQuery shortening long numbers with commas
<p>Could this be done with <code>javascript/jQuery</code>:</p> <pre><code>&lt;div class="number"&gt;99,123,123&lt;/div&gt; &lt;div class="number"&gt;123,123,123&lt;/div&gt; &lt;div class="number"&gt;1,123,123,123&lt;/div&gt; &lt;div class="number"&gt;1,123,123,123,123&lt;/div&gt; </code></pre> <p>To display as</p> <pre><code>99,123,123 // (only start converting after &gt; 8 total digits) 123M // M stands of million 1B 1T </code></pre> <p>But I also need to keep the actual number, and only display the converted number.<br> I still need to have access to the un-converted number.</p>
javascript jquery
[3, 5]
4,940,291
4,940,292
How do i set check box in "complete action using" window while selecting particular action?
<p>I am doing experiment on my app. In this, I have implemented one edit-text and send button. Now, whenever I am going to send message, I'd like to launch a Complete Action Using window that would allow me to choose between different messaging application that are installed on device. So, I am able to launch that Complete Action Using window, but I am not able to do see the default check-box there. Because of this, chooser window is coming every time. I want to make one of them as default. How can I get the default check-box in this window. is I am doing anything wrong? please help me.</p> <p>Thanks, Onkar</p>
java android
[1, 4]
2,374,434
2,374,435
c#.net website - How to let user choose a folder?
<p>I basically want to open a dialog box on the click of a button..The user will choose a destination folder and then a text file will be created in the chosen Folder using the path in the dialogue box.</p> <p>I have used asp.net's FileUpload to upload files but I don't know how to chose a folder using it. Or there's some other way to do this? please help . Thanks.</p>
c# asp.net
[0, 9]
5,451,741
5,451,742
Toggle view of modal button
<p>I have the following modal dialog:</p> <pre><code>$(document).ready(function() { $( "#addLocation" ).dialog({ modal: true, height: 820, width: 550, buttons: { "Add Location": function() { document.forms['mapform'].submitted.value='1'; document.forms["mapform"].submit(); }, Cancel: function() { $( this ).dialog( "close" ); } }, }); }); </code></pre> <p>How can I toggle the 'Add Location' button? I want it to display only when a certain button within the dialog is clicked.</p> <p>Thanks,</p>
javascript jquery
[3, 5]
72,663
72,664
Javascript: Exception and error strategy
<p>Does anybody know a good strategy for handling exceptions and errors. At the moment I have different pieces of code handling their own validation/errors/exception but I would really have a centralized strategy. I was thinking of some global notification system that passes some errors/exceptions to the user like validation. Other errors I would post to my back-end and log them.</p> <p>For example a validation error could contain the element that caused the error. That way I can add a class to highlight it and append some text before or after. </p> <p>So if anybody has some concrete examples on how to do this I would really appreciate it.</p>
javascript jquery
[3, 5]
5,505,040
5,505,041
JQuery keep class for selected menu
<p>I have the following menu on a header.php page that is included on each link page as follows:</p> <pre><code>&lt;nav id="main-nav"&gt; &lt;ul class="container_12"&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="home.php"&gt;&lt;? echo TEXT_DASHBOARD_HOME;?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="plans.php"&gt;&lt;? echo TEXT_DASHBOARD_PLAN;?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="voucher.php"&gt;&lt;? echo TEXT_DASHBOARD_VOUCH;?&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre> <p>Now when I click on any menu item I execute the following code contained on header.php:</p> <pre><code>$(document).ready(function() { $('nav &gt; ul &gt; li &gt; ul &gt; li').addClass('current').siblings().removeClass('current'); }); </code></pre> <p>and it works as soon as I stay on the same page, as soon as I click on another menu and I get redirected to another page and the class gets removed, how can I pass a variable of the <code>li.index()</code> that was clicked and add class to that specific <code>&lt;li&gt;</code>?</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
3,034,526
3,034,527
How to count visitor of one website from another website(which are on totally different domain)
<p>I want to count the visitor of a website(which is located totally different domain) from my website.Just like <a href="http://www.alexa.com/" rel="nofollow">Alexa is counting the visitor of all website</a> . How it can be done? Any idea or implementation please. Thanks in advance.</p> <p>For all i clarify my question.</p> <p><em>Suppose I want to count the visitor of www.yahoo.com. The total number of visitor, per day or per month etc. I know this will be very easy if i am the owner of www.yahoo.com, but if i have no connection with www.yahoo.com, then is it possible to know their visitor or any statistics?</em></p>
php javascript asp.net
[2, 3, 9]
1,453,963
1,453,964
Set a bool variable if an element has a class applied
<p>I am able to hide an element on the page in this way</p> <pre><code>$('.info_player &gt; .item_focus').hide(); </code></pre> <p>I need to set a variable on true or false if the element .info_player has the class .item_focus applied or not.</p> <p>How to make it with jquery?</p> <p>Please provide me a sample of code</p>
javascript jquery
[3, 5]
3,464,092
3,464,093
Jquery event handler not firing
<p>I have a web page that is having some javascript issues. I have tried looking over everything however I have a username field and when you click it (<code>.focus</code>) it should bring up a pop up. I used firebug in firefox to put break points right then the <code>.focus</code> function is called and it it is not fired even though I do focus on the username field. I have also looked over spelling and everything. Cant seem to find the issue. Hope someone can help. One more thing, this issue is happening in all browsers. </p> <p>page link: <a href="http://aliahealthcareer.com/SignUp" rel="nofollow">http://aliahealthcareer.com/SignUp</a></p>
javascript jquery
[3, 5]
5,354,294
5,354,295
How to get path to file using some external file managers apps Android?
<p>Is it possible to get File from sd card, which is picked using some 3rd apps (file manager) ?</p> <p>I mean that i have activity with button open file and when user press open it shows him suggestions to use some other app to open file, and when he pick open i get back to my activity with path of that file ?</p>
java android
[1, 4]
144,934
144,935
how can i get return value of javascript funtion
<p>my code like this</p> <pre><code> var key,value; //……some code…… function checkReg(i,j){ $.getJSON(api_checkExists,{"k":i,"v":j,"rand":Math.random()},function(c){ alert(c.status); return(c.status); }); } var temp=checkReg(key,value); alert(temp); </code></pre> <p>the problem is when i run it in my browser, </p> <p>it always fist alert undifined then alert the return value; seems like that can not get the return value of function checkReg .i wasso confused,what show i do?</p>
javascript jquery
[3, 5]
5,294,292
5,294,293
weird jquery problem in IE8/7
<p>the problem starts when i use </p> <pre><code>#mydiv{ margin:0 auto; } </code></pre> <p>all other browsers just works fine. this is an example</p> <pre><code>alert($("#mydiv").position().left); //output 0 $("#mydiv").animate({'left': '-=500'}); alert($("#mydiv").position().left); //output -499 </code></pre> <p>how can i solve that? is it a common ie problem? is there any solution for this?</p>
javascript jquery
[3, 5]
4,933,505
4,933,506
Loop through numerous variables
<p>I have 48 variables (TextViews), like tv1, tv2, tv3, tv4...tv48.</p> <p>I want to set a value for these variables, with a for loop, since I do not want to write down the same row 48 times.</p> <p>Something like this:</p> <pre><code>for (int i=1; i&lt;49; i++) { "tv"+i.setText(i); } </code></pre> <p>How to achieve this?</p>
java android
[1, 4]
1,148,433
1,148,434
jquery traversing an appended to ol/ul
<p>I'm trying to traverse a ul that has been appended to before traversing like so:</p> <pre><code>var items = []; $('#list').append('&lt;li id="item_10"&gt;item 10&lt;/li&gt;'); $('#list').each(function () { var item = $(this).attr('id'); items.push(item); }); alert(items.toString()); </code></pre> <p>But when I alert the output I don't see the item I added. Anyone have a clue on how I can add to a list then traverse it? </p>
javascript jquery
[3, 5]
1,225,570
1,225,571
FB like button callbacks not working
<p>Can anyone tell me why callbacks are not working for the like button code given below? The code is standard set up in javascript as I can see. First button is initialized, then api is loaded asynchronously and callback functions are provided. Thanks.</p> <pre><code>&lt;script&gt; window.fbAsyncInit=function(){ FB.init({ appId:'',//App ID status:false,// check login status cookie:true,// enable cookies to allow the server to access the session xfbml:true// parse XFBML }); // Additional initialization code here FB.Event.subscribe('edge.create', function(response) { //alert("user_id1:&lt;?php echo $user_id1; ?&gt;, user_id2:&lt;?php echo $user_id2; ?&gt;"); /*var data={ action:"ap_buttons_give_points", author_id:&lt;?php echo $author_id; ?&gt;, post_id:&lt;?php echo $post_id; ?&gt;, type:"like" } jQuery.post("&lt;?php echo $ajax_url; ?&gt;",data,function(resp){ });*/ alert('You just liked the page!'); }); FB.Event.subscribe('edge.remove', function(response) { /*var data={ action:"ap_buttons_take_points", author_id:&lt;?php echo $author_id; ?&gt;, post_id:&lt;?php echo $post_id; ?&gt;, type:"like" } jQuery.post("&lt;?php echo $ajax_url; ?&gt;",data,function(resp){ //alert("fb remove:"+resp); });*/ alert('You just unliked the page!'); }); }; // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
4,011,127
4,011,128
conditionally call JavaScript function
<p>I have a "Pay" button where we are starting to accept credit card. I need to call a Javascript function from the server side click event. I tried with Response.Write as below but that does not trigger my function that is defined in the separate .js file. What else can I do?</p> <pre><code> protected void btmMakePayment_Click(object sender, EventArgs e) { if (user selected credit card) { Response.Write("&lt;script language='javascript' type='text/javascript'&gt;OpenPayPalDialog();&lt;/script&gt;"); } else { continue with the current server side logic } } </code></pre> <p>Thank You in advance.</p>
c# javascript asp.net
[0, 3, 9]
2,018,605
2,018,606
Javascript / jQuery flick between two images
<p>I'm struggling with the timer part. I can replace one image with another easily with javascript by calling the function. What I want to be able to do is set a timer to sit and change the images at a specific interval (say 1 second).</p> <p>I've used jQuery to refresh an image every second before, but when I try and add a function inside to change the image, it just hangs.</p>
javascript jquery
[3, 5]
1,610,546
1,610,547
Android: How to retrieve file name and extension of a resource by resource ID
<p>I have the following:</p> <pre><code>getResources().getResourceEntryName(resourceId); </code></pre> <p>The problem is, that it retrieves only the file name without the extension.</p> <p>For example, if I have the following res/drawable/pic.jpg, the</p> <pre><code>getResources().getResourceEntryName(resourceId); </code></pre> <p>is returning the value "pic". The extension .jpg is missing.</p>
java android
[1, 4]
2,934,936
2,934,937
Do I need to specify object type when creating globals in Javascript?
<p>I have the following code: </p> <pre><code>var oTable = $('#dataTable').dataTable({ ... </code></pre> <p>I would like to declare oTable as a global but I am a bit confused. With javascript how do I do this and do I have to specify the object type when I declare it as a global?</p>
javascript jquery
[3, 5]
2,074,675
2,074,676
JQuery: .LOAD, how to get next call to happen AFTER the .LOAD completes?
<p>JQuery: .LOAD, how to get next call to happen AFTER the .LOAD completes?</p> <p>Basicly Im loading some information into a div which is dynamically adjusting the height of the DIV as it loads. </p> <p>I then want to run a call to adjust the height of the DIV, but can only properly calculate after the load completes in full.</p> <p>Thanks!</p>
php jquery
[2, 5]
111,213
111,214
Nested Elements with wildcard selector / Event Bubbling
<p>I want to bind to an element and add an outline to it when I over it. The problem is that when I hover over a nested element, the parent elements are also selected.</p> <p>When I hover over "5 deep" I should only have a border around that span and not all of its parents.</p> <p><a href="http://jsfiddle.net/7uQwr/" rel="nofollow">http://jsfiddle.net/7uQwr/</a></p> <p>How can I avoid this? Kind of an odd use case, but I dont have control over the markup here :) </p>
javascript jquery
[3, 5]
3,312,428
3,312,429
Very Simple Routing on One page website
<p>I'm developing a simple one page website, where the pages scroll horizontally using the scrollTo() javascript library. I have a home / about / contact page. I was wondering if there was a way to still use some form of URL routing like www.example.com/about, to get the about page, and would get updated in the browser when the page was clicked in the navigation.</p>
javascript jquery
[3, 5]
2,810,362
2,810,363
jQuery iframe file upload
<p>Im building a file upload with jQuery, but Im getting a jQuery error trying to set the attributes of the form:</p> <pre><code>$(document).ready(function () { $("#formsubmit").click(function () { var iframe = $('&lt;iframe name="postframe" id="postframe" class="hidden" src="about:none" /&gt;'); $('div#iframe').append(iframe); $('#theuploadform').attr("action", "/ajax/user.asmx/Upload") $('#theuploadform').attr("method", "post") $('#theuploadform').attr("userfile", $('#userfile').val()) $('#theuploadform').attr("enctype", "multipart/form-data") $('#theuploadform').attr("encoding", "multipart/form-data") $('#theuploadform').attr("target", "postframe") $('#theuploadform').submit(); //need to get contents of the iframe $("#postframe").load( function () { iframeContents = $("iframe")[0].contentDocument.body.innerHTML; $("div#textarea").html(iframeContents); } ); &lt;div id="uploadform"&gt; &lt;form id="theuploadform" action=""&gt; &lt;input id="userfile" name="userfile" size="50" type="file" /&gt; &lt;input id="formsubmit" type="submit" value="Send File" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;div id="iframe" style="width: 0px; height: 0px; display: none;"&gt; &lt;/div&gt; &lt;div id="textarea"&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
303,849
303,850
Toggle span elements in div on hover
<p>I am still relatively new to jQuery and am trying to hide the text I have contained in a few spans within a div on a hover, then show them again on a hover out. I feel like it it something relatively easy to do, I just havent had much success. Thank you!</p> <pre><code>$(".resultBox").hover(function() { // Perform actions only if targeted result box it is not enlarged if($(this).height() === RESULTBOX_DEF_HEIGHT &amp;&amp; $(this).width() === RESULTBOX_DEF_WIDTH) { // Toggle the highlight class matching the target box var targetBoxId = $(this)[0].id; $(this).toggleClass(targetBoxId + "BoxHighlight"); // Hide all text in the spans within this box } }); </code></pre>
javascript jquery
[3, 5]
5,522,471
5,522,472
casting php arrays to c# hashtables
<p>I have some multi-dimensonial php arrays being passed down to my c# app. To pull values out on the c# side, i have to do something like:</p> <pre><code>String example = (string)((Hashtable)((Hashtable)example_info["FirstLevel"])["SecondLevel"])["example_value"]; </code></pre> <p>How would I go about removing the need to explicitly cast every dimension as a hashtable? Do I need a recursive function that builds some sort of List object out of example_info, or should I just not be using hashtables?</p>
c# php
[0, 2]
3,235,967
3,235,968
How to detect if shift has been released?
<p>I want to be able to run a function when the shift key is released.</p> <p>I know the shift key can be detected with something like:</p> <pre><code>$(window).bind("keydown keyup", function(ev) { ... }); </code></pre> <p>It works very well for detecting key combinations (e.g. <code>shift+a</code>). Problem is, if you want to detect the shift key itself, this triggers a <code>keydown</code> with <code>ev.shiftKey=false</code>, <code>ev.which=16</code> and a <code>keyup</code> with <code>ev.shiftKey=true</code>, <code>ev.which=16</code>. I've tried to attach an event to this combination on <code>keyup</code>, but this fail in a very subtle way when both shift keys are pressed: for the second shift key you get both <code>keyup/keydown</code> with <code>true,16</code> and then you get another <code>keyup</code> with <code>true,16</code> when the first shift key is released. </p> <p>Is there any clean way to do this? Or should I just ignore the two shift key case?</p>
javascript jquery
[3, 5]
4,082,448
4,082,449
Attach Javascript variable to cookie
<p>I've been strugling, maybe someone can help me please? I've got a javascript counter on my page, trying to attach it to a cookie (<a href="http://stackoverflow.com/questions/7764051/javascript-counter-on-php-page">My first quetion about this</a>) so that if the user refreshes the page the counter does not start from 0 again:</p> <p><strong>page 1:</strong> </p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; var pageVisisted = new Date(); setInterval(function() { var timeOnSite = new Date() - pageVisisted; var secondsTotal = timeOnSite / 1000; var hours = Math.floor(secondsTotal / 3600); var minutes = Math.floor(secondsTotal / 60) % 3600; var seconds = Math.floor(secondsTotal) % 60; document.getElementById('counter').innerHTML = hours + ":" + minutes + ":" + seconds; }, 1000); &lt;/script&gt; &lt;?php setcookie(AboutVisit, pageVisisted); session_start(); ?&gt; &lt;/head&gt; </code></pre> <p><strong>Page2:</strong></p> <pre><code>$cookid = $_COOKIE['AboutVisit']; echo $cookid; </code></pre> <p><strong>But then I get the display: pageVisisted</strong></p>
php javascript
[2, 3]
4,426,365
4,426,366
jquery tree traversal issue
<pre><code>$('.field').blur(function() $('*').not('.adress').click(function(e) { foo = $(this).data('events').click; if(foo.length &lt;= 1) { // $(this').next('.spacer').children().removeClass("visible"); } $(this).unbind(e); }); }); </code></pre> <p>I'm trying to remove a class "visible, whenever I'm bluring a field classed .field, unless if I click an element with the class .adress. </p> <p>The field blur and adress-click is working as it should(I tired it with alert) but not the removal of class, does anyone know why?</p> <p>The removal of class works if the not(".adress")-function is removed! Like this:</p> <pre><code>$('.field').blur(function() { (this).next('.spacer').children().removeClass("visible"); }); </code></pre>
javascript jquery
[3, 5]
2,217,876
2,217,877
jQuery underscore notation
<p>Could anybody give me an explanation of the underscore in a jQuery plugin function? I have no idea of what "<em>_</em>" means. Example code below:</p> <pre><code>$.fn.bgStretch=function(o){ this.each(function(){ var th=$(this), data=th.data('bgStretch'), _={ align:'leftTop', altCSS:{}, css:{ leftTop:{ left:0, right:'auto', top:0, bottom:'auto' }, rightTop:{ left:'auto', right:0, top:0, bottom:'auto' }, leftBottom:{ left:0, right:'auto', top:'auto', bottom:0 }, rightBottom:{ left:'auto', right:0, top:'auto', bottom:0 } }, preFu:function(){ _.img .load(function(){ _.checkWidthFu() _.img </code></pre>
javascript jquery
[3, 5]
381,380
381,381
how to verify if my datatable is empty
<p>hello again y have populate my datatable using 1 button an array, next button 2 is going to send my datatable to excel, so what a i do is this using C#, and asp.net: out side of the button y declare my datable so i can be use in both buttons</p> <pre><code> System.Data.DataTable _myDataTable =new System.Data.DataTable(); </code></pre> <p>button 1 fill datatable: for this example lets say only 10 columns, caract=number of cells</p> <pre><code>for (int k=0; k &lt; 10; k++) { _myDataTable.Columns.Add(); } for (int j=0; j &lt; 10; j++) { TableRow r = new TableRow(); System.Data.DataRow row=_myDataTable.NewRow(); for (int i = 0; i &lt; caract+1; i++) { row[i]=(datar[j,i].ToString()); } _myDataTable.Rows.Add(row); Table1.Rows.Add(r); } </code></pre> <p>now button 2 allows to the user if he wants to save the data from the datatable to an excel, but first i verifi if the datable is empty</p> <pre><code>if(_myDataTable !=null || _myDataTable.Rows.Count == 0) { string name="productos"; Label2.Text="it has data"; } else{Label2.Text="NO data"; } </code></pre> <p>no i recibe the text that i have data yupi for me, but when i press button 2 to send the datatable to excel, it creats the document however is empty, so the next thing i would like to try is to verifi cell by cell if it has the data is supposed to have, but only have no idea how to extract the data from the datatable and to be display in a label. I appreciate any help</p>
c# asp.net
[0, 9]
1,365,855
1,365,856
how to build(url for web services also), deploy and use web services in java
<p>i have a server with oracle database for which i have to make web services. i searched a lot but didn't got a perfect solution from starting means building web service of URL having simple parameters and json parameters also. and then giving response of json. please tell me if i am sitting in front of my server then from where i have to start and what to do from start to end. i have to use it in android apps. please i am in trouble. because i never build web service before. thanx in advance.</p>
java android
[1, 4]
1,132,123
1,132,124
Image auto reload with a fade or preload?
<p>So I've got a basic system set up to reload webcam jpgs at a regular interval, but it's weird to see the file load. I'd rather have one fade into the other or at least wait for the whole image to load before it swaps the other one out.</p> <pre><code> $(document).ready(function() { setInterval('updateCamera()',1000); }); function updateCamera() { $('#camera').attr('src','cam_1.jpg?'+ new Date().getTime()); } </code></pre> <p>Here is the site, click on "Live Feed" www.graysonearle.com/frogutopia Any ideas?</p>
javascript jquery
[3, 5]