Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
5,072,252 | 5,072,253 | Why does javascript replace only first instance when using replace? | <p>I have this</p>
<pre><code> var date = $('#Date').val();
</code></pre>
<p>this get the value in the textbox what would look like this</p>
<p>12/31/2009</p>
<p>Now I do this on it</p>
<pre><code>var id = 'c_' + date.replace("/", '');
</code></pre>
<p>and the result is </p>
<p>c_1231/2009</p>
<p>It misses the last '/' I don't understand why though.</p>
| javascript jquery | [3, 5] |
250,968 | 250,969 | How to use Broadcast receiver to Monitor Internet connection during running application | <p>hello guys I am currently making a Web Focused crawling</p>
<p>is there any method to watch or monitor the internet connection during the crawling process</p>
<p>if the internet suddenly goes down or dead then there will be an alert for it</p>
<p>thx</p>
| java android | [1, 4] |
4,630,809 | 4,630,810 | QueryString checking | <p>How to check if the web page contains any string queries at the page load?</p>
| c# asp.net | [0, 9] |
248,592 | 248,593 | NumberFormatException Error | <p>the code is : </p>
<pre><code>editText2=(EditText) findViewById(R.id.editText2);
editText3=(EditText) findViewById(R.id.editText3);
float from_value= Float.parseFloat(editText2.getText().toString());
editText3.setText(" "+(from_value * 100.0));
</code></pre>
<p>And the logcat error is : </p>
<pre><code>03-18 03:19:07.847: E/AndroidRuntime(875): Caused by: java.lang.NumberFormatException: Invalid float: ""
</code></pre>
<p>Please tell whats's wrong with this.
Thanking you in ancticipation.</p>
| java android | [1, 4] |
4,111,422 | 4,111,423 | How to copy an element to another with event handlers | <p>How can I copy an element to another element along with the event handlers attached.
Normally when we copy one element to another then event handlers are not copied.
How to do this ?</p>
| javascript jquery | [3, 5] |
4,508,331 | 4,508,332 | Trigger alert when database entries are added, not when they are removed | <p>I have a jQuery script running that makes a periodic AJAX call using the following code. </p>
<pre><code>var a = moment();
var dayOfMonth = a.format("MMM Do");
var timeSubmitted = a.format("h:mm a");
var count_cases = -1;
var count_claimed = -1;
setInterval(function(){
//check if new lead was added to the db
$.ajax({
type : "POST",
url : "inc/new_lead_alerts_process.php",
dataType: 'json',
cache: false,
success : function(response){
$.getJSON("inc/new_lead_alerts_process.php", function(data) {
if (count_cases != -1 && count_cases != data.count) {
window.location = "new_lead_alerts.php?id="+data.id;
}
count_cases = data.count;
});
}
});
</code></pre>
<p>This is the PHP that runs with each call: </p>
<pre><code>$count = mysql_fetch_array(mysql_query("SELECT count(*) as count FROM leads"));
$client_id = mysql_fetch_array(mysql_query("SELECT id, client_id FROM leads ORDER BY id DESC LIMIT 1"));
echo json_encode(array("count" => $count['count'], "id" => $client_id['id'], "client_id" => $client_id['client_id']));
</code></pre>
<p>I need to change the code so that the alert only triggers when a new entry is added to the database, not when an existing entry is removed. As it stands, the alert fires on both events.</p>
<p>Any help is greatly appreciated. </p>
| php javascript jquery | [2, 3, 5] |
124,791 | 124,792 | bind function to newly created element | <p>Thanks for any help.</p>
<p>I have a function. Inside this function, I create two buttons and assign two ids. </p>
<pre><code>var content =
'<div>
'<div id="stationPopUpbtn">' +
'<button id="createWave_updateStation" onclick="updateStationContent('+feature+')">Änderungen speichern</button>'+
'<button id="createWave_deleteStation" onclick="deleteFeature('+feature+')">Station löschen</button>'+
'</div>'+
'</div>';
</code></pre>
<p>later in the same function I want to do:</p>
<pre><code>$('#_updateStation').bind('click', function(){ // stuff });
</code></pre>
<p>But it doesn't work. The content is added as part of a popup (OpenLayers) which in return is added to the map..</p>
<pre><code> var popup = new OpenLayers.Popup.FramedCloud(
feature.id+"_popup",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(250, 100),
content,
null, // anchor
true, // closeBox exists
//closeBoxCallback
function(){
feature.style.pointRadius = 20;
map.removePopup(feature.popup);
}
);
</code></pre>
<p>EDIT:</p>
<pre><code>$(document).append(content);
//map.addControl(selectControl);
//selectControl.activate();
$(document).on('click', '#createWave_updateStation' ,function(){
console.log("TES");
});
$('#create_stationPopup').popup('open');
</code></pre>
| javascript jquery | [3, 5] |
4,364,000 | 4,364,001 | What is the best way keep track of your identifiers for your Jquery and CSS? | <p>This is more of an organisation question concerning Jquery.</p>
<p>Using the following simple example:</p>
<pre><code><a href="#" class="click">click me</a>
<script>
$(document).ready(function(){
$('.click').on('click',function(){
alert('Clicked!');
});
});
</script>
</code></pre>
<p>Now multiply this by a 1000 on your website, it can quickly get messy. You also can forget which classes you attributed for Jquery or for your CSS.
I usually try to avoid mixing both, so I add my classes for CSS and others for the Jquery, in case I change I the layout or use that section somewhere else, ... I can change the CSS. But how to do you remember which one is for CSS or Jquery? Do you name your classes "JSclassName" or something like that?</p>
<p>Let me know if I'm not clear and thanks for your help.</p>
| javascript jquery | [3, 5] |
5,880,222 | 5,880,223 | Using Interface to implement code on all activities | <p>I am trying to implement some code on every activity and don't want to copy and page the code into each activity. </p>
<p>Originally I just had a parent activity with the code then extended all of the others but I couldn't do this on ListActivities or ExpandableListActivities. </p>
<p>I think this will be done by using an interface class then having each activity implement this. However when I try to do this Eclipse gives me an error and says to remove the method body. </p>
<p>Here is what I have so far</p>
<pre><code>import android.content.Intent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.Toast;
public interface MenuOptions {
/**
* Method called when the hardware menu button is called. Uses optionmenu.xml for layout
*/
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.optionmenu, menu);
return true;
}
/**
* Event listener for the options menu. If home is pressed user is sent to home screen. If settings is pressed user is sent to setting screen
* User is passed as an extra
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent nextIntent = null;
switch (item.getItemId()) {
case R.id.home:
Toast.makeText(this, "You pressed the icon!", Toast.LENGTH_LONG).show();
nextIntent = new Intent(this, Home.class);
break;
case R.id.settings:
Toast.makeText(this, "You pressed the text!", Toast.LENGTH_LONG).show();
nextIntent = new Intent(this, Settings.class);
break;
}
nextIntent.putExtra("user", user);
startActivity(nextIntent);
return true;
}
}
</code></pre>
| java android | [1, 4] |
296,679 | 296,680 | Confused about javascript / jquery variable scope | <p>The pastPath variable in the code below is confusing me. I normally use C# and MVC which of course means I use HTML, JavaScript, and JQuery along with other associated web / mobile technologies.</p>
<p>When I run this code and click the .moreBtn pastPath reports it is set to the URL as I intended. Yet when I try to use .backBtn to set the URL and force my browser to go back to the previous page, I get either that pastPath is undefined, or that it is set to hello.</p>
<p>I know I am having a problem understanding scope here. I have read articles on JavaScript scope but I am wondering instead if someone can resolve this problem and explain how I get my URL from the first function into the second.</p>
<p>I will read more about scope in JavaScript later but it seems very different to scope in most other languages and I presently don't have time to look into it properly.</p>
<pre><code>$(document).ready(function ()
{
pastPath = "hello";
$(".moreBtn").click(function ()
{
var controller = $(".moreBtn").data('ctrl');
var action = $(".moreBtn").data('action');
loc = GetPathDetails("full"); //This simply returns the part of the URL I need.
pastPath = loc;
alert(pastPath);
var fullPath = loc + "/" + controller + "/" + action;
window.location = fullPath;
});
$(".backBtn").click(function ()
{
alert(pastPath);
//window.location = pastPath;
});
});
</code></pre>
<p>Thanks for your help.</p>
| javascript jquery | [3, 5] |
487,565 | 487,566 | Creating admin page in asp.net application | <p>I am considering best option to create multi-purpose admin page in my asp.net application. In that section should be searching users in database, adding users, review single users or whole groups, etc. I have two ways, how to do it:</p>
<ol>
<li><p>create single page for every option. It means: on first page will be some text box and search button, on second will be form with multiple textboxes to add new user, and so on.</p></li>
<li><p>place all needed controls to one page. Then use query string (something like aspx?mode=userAdd) to determine desired task and hide unneeded controls.</p></li>
</ol>
<p>Please, give me best idea, which one is better. (Or maybe you know completely different approach).</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
2,177,161 | 2,177,162 | When is it appropriate to use synchronous ajax? | <p>I was just reading another question about jQuery's synchronous ajax call, and I got to wondering:</p>
<blockquote>
<p>What circumstances make a synchronous version of an ajax call beneficial/necessary?</p>
</blockquote>
<p>Ideally I'd like an example, and why synchronous is better than standard ajax.</p>
| javascript jquery | [3, 5] |
2,031,242 | 2,031,243 | Change latin number to persian number and add commas by jQuery function | <p>I want change latin number to persian number and add commas, but it don't work true for me. what do i do?</p>
<p><a href="http://jsfiddle.net/39rKM/3/" rel="nofollow"><strong>Demo:</strong></a><br>
Please see my demo, output is <code>&#1,782;&#1,783;&#1,783;&#1,782;&#1,781;&#1,781;&#1,782;&#1,783;&#1,783;&#1,784;&#1,784;&#1,785;&#1,785;&#1,784;&#1,783;&#1,784;&#1,780;&#1,776;&#1,784;&#1,776;</code> not a right number.</p>
<pre><code>function numentofa(n) {
var digits = [],
r;
do {
r = n % 10;
n = (n - r) / 10;
digits.unshift(['&#', r + 1776, ';'].join(''));
} while (n > 0);
return digits.join('');
}
function addCommas(nStr) {
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
var oooook = addCommas(numentofa(67765567788998776676));
//$('.numbers').append(oooook);
alert(oooook);
</code></pre>
| javascript jquery | [3, 5] |
5,656,292 | 5,656,293 | Delaying a timed interval function? | <p>I have a function set up like so:</p>
<pre><code>setInterval(function () { get_fb(); }, 10000);
</code></pre>
<p>I'd like to reset the timer to 10 seconds whenever a user does something (like hover over an element or click an element)</p>
<p>How would I tell the program to do something like this?</p>
| javascript jquery | [3, 5] |
4,026,836 | 4,026,837 | Button to close application if user does not accept terms | <p>ok I've search all over the web for a solution to this. </p>
<p>I'm a newbie so please bear with me.</p>
<p>I have a application that requires a user to agree to a EULA which is a activity that I created. I have a accept and cancel button, when the accept button is pressed it stores data inside the sharedpreference to say that it was accepted.</p>
<p>My problem comes in on the cancel button. If I use a dialog instead of a activity it works fine with finish(); as it closes the app. but if I use the cancel button on the activity it closes that activity and proceeds to access the rest of the app. </p>
<p>What is the best way to tell my button that the app should be closed if the user does not accept the EULA.</p>
| java android | [1, 4] |
2,185,173 | 2,185,174 | Upload a file to multiple servers | <p>I see a ton of questions about uploading multiple files, but none about uploading a single file to multiple servers, so here goes...</p>
<p>I have an ASP.NET app that will be running on two load balanced servers, and I would like to allow users to upload files and have them end up on both servers. What is the cleanest way to do this? I am using IIS 6 btw.</p>
<p>Some ideas that come to mind are:</p>
<p>1) Use a virtual directory that points to some shared location that both servers can access. Will there be any access issues if the application runs at Network Service? I'm assuming the application will need to run as a user account that exists on the shared location machine. How should the permissions be set for this?</p>
<p>2) It would be nice if I could via jQuery post the request to both of my servers, referencing them by their port numbers. Even though the servers are on the same domain, this violates the same origin policy, right?</p>
<p>Is there another solution I'm overlooking? How do other sites do this?</p>
| c# asp.net jquery | [0, 9, 5] |
4,520,191 | 4,520,192 | I need to users to enter a time in one format, convert it to another, perform a calculation, then bring it back again | <p>I am building an app that will convert swimming times from yards to meters, and can't figure out some important stuff.</p>
<p>I need a user to enter a time as this: <code>minutes:seconds.hundredths</code><br>
But it has to come to me in milliseconds, so that I can perform the conversion. After that I need to put it back into that format and display it to the user.</p>
<p>For example, if someone swam a 200 yard Freestyle in 1:52.43, I need to figure out how to multiply it by 1.11 and add 3.2 seconds, then display it to the user as their converted time for a 50 meter length pool.</p>
| java android | [1, 4] |
4,882,624 | 4,882,625 | How can I performance tunning on that javascript code? (JQuery selector based) | <p>How can I performance tuning in that code</p>
<pre><code>var isHighLighted = this.HighlightCell(this.GetOutcomeInList(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
if (!isHighLighted) {
isHighLighted = this.HighlightCell(this.GetOutcomeInOtherBetsButton(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
}
this.HighlightCell(this.GetOutcomeInOthers(i), i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
var spacialcell = this.GetOutcomeInSpecial(i);
this.HighlightCell(spacialcell, i, "selectedByEditor "+((isCommonChoice) ? "Common" : "") );
if (spacialcell.length > 0) {
//Özel etkinliklerde kapalı alanları açar
var eventDetails = $(spacialcell).parent().parent().parent();
var eventHeaders = $(spacialcell).parent().parent().parent().prev().find('.Expand');
if (eventDetails.attr('status') != 'expand') {
eventDetails.show(); $(eventHeaders).not('.Collapse').addClass('Collapse');
BetFilter.ChangeExpandButtonStatus(this, false);
}
}
</code></pre>
<p>That function loop for each editor data in more than 1000 html cell elements. Editor data probably contains between 10 - 100 data. GetOutcomeInList, GetOutcomeInOtherBetsButton functions are jquery selectors returning spesific cells.</p>
| javascript jquery | [3, 5] |
2,550,459 | 2,550,460 | jQuery keeps the last click and sends more data | <p>Can somebody tell me why every time I click on a button where I have a jQuery post function, it sends twice the post, and the next time I press the button, it will send twice as much as the last time and so on? I searched on Google and I found <code>unbind()</code> but it is not working so well, and I don't know what to search on Google for solving this problem.</p>
<pre><code>$(document).ready(function(){
$("#button").click(function(){
$.post("includes/document.php",
function(data) {
$("#body").html(data);
});
});
});
</code></pre>
<p>The html:</p>
<pre><code><div id="body">
<div id="name">
<p>Username </p>
<input id="nameInput" type="text">
</div>
<div id="button">Press Me</div>
</div>
</code></pre>
| php jquery | [2, 5] |
3,779,227 | 3,779,228 | Adding Text under textbox based on value | <p>I have a text field and I want to put underneath this text field information based on the input. For example, lets say someone types abc, then I would like some text underneath the text field to say foo_abc. Is jquery the best way to accomplish something like this? Also, I have a drop down above the text field and would like to append information to this label under the text field based on what is selected. Is this possible?</p>
| javascript jquery | [3, 5] |
2,445,693 | 2,445,694 | How to trigger PHP/jquery when a button is clicked | <p>PHP noob here...so please excuse me if you find this to be a lame question.</p>
<p>I have the following form:</p>
<p>HTML </p>
<pre><code><form id="myForm" action="" method="post">
<div id="edit-box">
<INPUT type="submit" name="save-text" id="save-text" value="Save">
<textarea id="editor" name="editor">
<?php echo $content; ?>
</textarea>
</div>
</form>
</code></pre>
<p>PHP</p>
<pre><code>if ($_POST["save-text"]){
// get form data, making sure it is valid
$submit_date = date('Y-m-d H:i:s');
$content = mysql_real_escape_string(htmlspecialchars($_POST['editor']));
$url = "http://example.com/" . $key;
// build query
mysql_query("INSERT INTO `source`(`id`, `key`, `submit_date`, `ip`, `content`)
VALUES (null, '$key','$submit_date','$ip','$content')")
or die(mysql_error());
}
</code></pre>
<p>How can I make sure that the PHP script is run only when the submit button is clicked and no other time?</p>
| php jquery | [2, 5] |
173,029 | 173,030 | how to use PyV8 and httplib to interpret javascipt | <p>I would like to write my own web test engine that will request (get/post) my wsgi application and i would like my client to interpret the return page that contains some javascript code. </p>
<p>Basically it is how to use a PyV8 to make a headless browser.</p>
<p>Thx</p>
| javascript python | [3, 7] |
485,025 | 485,026 | Execute javascript when another function exists | <p>I'm writing two scripts in an web environment where I don't have control over the order in which they are loaded. Let's say the two scripts are called <code>MyUtil</code> and <code>DoSomething</code>.</p>
<p><code>MyUtil</code> contains utilities that I will bind to the <code>window</code> object using <code>window.myUtil = myUtil</code>. I'm then going to call methods of <code>myUtil</code> from within <code>DoSomething</code>.</p>
<p>If <code>MyUtil</code> is loaded first, everything will work. If it's loaded second, <code>window.myUtil</code> will be <code>undefined</code>.</p>
<p>How can I modify the code in <code>DoSomething</code> (and/or MyUtil) to wait until <code>window.myUtil</code> exists before <code>DoSomething</code> executes its code?</p>
<p><em>NB: I'm using jQuery 1.2.3.</em> </p>
| javascript jquery | [3, 5] |
1,619,874 | 1,619,875 | Get dynamic class each fieldset | <p>How can get(dynamic) each class <code>fieldset</code> that wrapping the elements in it?</p>
<p><strong>Like:</strong></p>
<p>if click on button <code>adult</code> =get class=> <code>.adult</code> from here in the html: <code><fieldset class="adult"></code><br>
if click on button <code>child wbed</code> =get class=> <code>.child wbed</code> from here in the html: <code><fieldset class="child wbed"></code><br>
if click on button <code>child bed</code> =get class=> <code>.child bed</code> from here in the html: <code><fieldset class="child bed"></code><br>
if click on button <code>baby</code> =get class=> <code>.baby</code> from here in the html: <code><fieldset class="baby"></code><br></p>
<p><strong>Example:</strong> <a href="http://jsfiddle.net/WErW9/7/" rel="nofollow">http://jsfiddle.net/WErW9/7/</a></p>
<pre><code>$('button').live("click", function (event) {
event.preventDefault();
$(this).remove();
var $this = $(this),
$div = $this.parent('fieldset');
var name = '.' + $(this).closest('fieldset').attr("class");
alert(name);
});
</code></pre>
| javascript jquery | [3, 5] |
4,147,917 | 4,147,918 | Is there a Java equivalent of Python's printf hash replacement? | <p>Specifically I am converting a python script into a java helper method. Here is a snippet (slightly modified for simplicity).</p>
<pre><code># hash of values
vals = {}
vals['a'] = 'a'
vals['b'] = 'b'
vals['1'] = 1
output = sys.stdout
file = open(filename).read()
print >>output, file % vals,
</code></pre>
<p>So in the file there are %(a), %(b), %(1) etc that I want substituted with the hash keys. I perused the API but couldn't find anything. Did I miss it or does something like this not exist in the Java API?</p>
| java python | [1, 7] |
4,600,624 | 4,600,625 | jQuery find - can I use a callback? | <p>So I'm trying to figure out if I can call a function inside of find() as below but I'm not getting anything returned to the console. Is this possible with find() or do I need to find an alternative? </p>
<pre><code>$(".tdInner1").find(".block", function () {
if( $(this).next().hasClass("continuation") ) {
console.log("yes");
} else {
console.log("no");
}
});
</code></pre>
| javascript jquery | [3, 5] |
903,314 | 903,315 | Restrict usage of webmethods outside the domain | <p>I'm writing a webmethod that will be used on reg form and will check if email address exist in the system. </p>
<p>The method will be called using jquery ajax.</p>
<p>Question is how can I restrict the usage of the webmethod only within my website, so it won't be abused in any other place like local machine running some loop that would load on my server.</p>
<p>I know there is something similar exist for not letting usage of images outside the domain, but have no clue how can it be done for webmethods?</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
5,377,757 | 5,377,758 | jQuery next method alternative | <p>jquery's next method is looking for next sibling. But i need next element which is not sibling. I just need to iterate next elements in selector.
For example: </p>
<pre><code>$('.wrapper .parent div').next(); // in here next method looks first element
// in selector and get next sibling of it.
</code></pre>
<p>What i want is next matched element in selector. Simply calling each method will provide it to me but i dont need to iterate whole collection.</p>
<p>slice method will help me iterate manualy by controlled me but providing slice parameters makes it harder to use. </p>
<p>What can be another solution. </p>
| javascript jquery | [3, 5] |
4,384,732 | 4,384,733 | Intercept javascript event | <p>Here's what I'm trying to do :</p>
<p>I have a page with some links. Most links have a function attached to them on the <em>onclick</em> event. </p>
<p>Now, I want to set a css class to some links and then whenever one of the links is clicked I want to execute a certain function - after it returns , I want the link to execute the onclick functions that were attached to it. </p>
<p>Is there a way to do what I want ? I'm using jQuery if it makes a difference.</p>
<p>Here's an attempt at an example :</p>
<pre><code>$("#link").click(function1);
$("#link").click(function2);
$("#link").click(function(){
firstFunctionToBeCalled(function (){
// ok, now execute function1 and function2
});
}); // somehow this needs to be the first one that is called
function firstFunctionToBeCalled(callback){
// here some user input is expected so function1 and function2 must not get called
callback();
}
</code></pre>
<p>All this is because I'm asked to put some confirmation boxes (using boxy) for a lot of buttons and I really don't want to be going through every button.</p>
| javascript jquery | [3, 5] |
3,736,642 | 3,736,643 | javascript validation on tiny mce text editor | <p>I want to validate (empty check) a tiny mce text editor using JavaScript. Does any one know this? I have used the normal empty check function. But it's not working. Does any one help me? also I want to know how validate empty check in FCk editor.</p>
| php javascript | [2, 3] |
4,773,957 | 4,773,958 | What is the simplest way to validate a date in asp.net C#? | <p>I'm using DateTime.ParseExact to parse a string from input. What is the simplest way to make sure the date complies to rules like max days in a month or no 0. month?</p>
| c# asp.net | [0, 9] |
5,167,242 | 5,167,243 | Initialize a class instance? | <p>I'm trying to initialize an instance of class <code>consoleDroid</code> with <code>consoleDroid console = new consoleDroid();</code>, but it throws a <code>class, interface, or enum expected</code> compile error. What's the right way to initialize the class?</p>
<p><strong>caseSelector.java:</strong></p>
<pre><code>package com.caseselector;
import android.app.Activity;
import android.os.Bundle;
consoleDroid console = new consoleDroid();
public class caseSelector extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
console.create();
}
}
</code></pre>
<p><strong>consoleDroid.java:</strong></p>
<pre><code>package com.caseselector;
import android.view.View;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.Button;
public class consoleDroid {
private static String output;
private Button consoleButton;
private TextView consoleView;
private EditText consoleInput;
public static void create() {
}
public static void write(String input) {
}
public static void writeLine(String input) {
}
public static String readLine(boolean print) {
return output;
}
}
</code></pre>
| java android | [1, 4] |
799,124 | 799,125 | asp.net page load time | <p>My question is that how to maintained page load time in c#</p>
<p>and what page time load is good for site to crawl google index</p>
| c# asp.net | [0, 9] |
5,194,193 | 5,194,194 | submit button does not work | <p>in this exp submit and login button(flash) does not work.it can't connect to db.</p>
<p>Visit: <a href="http://www.99points.info/2010/11/stylish-animated-login-signup-form-with-jquery-and-css/#more-1031" rel="nofollow">http://www.99points.info/2010/11/stylish-animated-login-signup-form-with-jquery-and-css/#more-1031</a></p>
| php jquery | [2, 5] |
992,729 | 992,730 | How can I use the jQuery-like selector in pure JavaScript | <p>What I looking for is:</p>
<pre><code>var arrinput = $('input[name$="letter"]')
</code></pre>
<p>How can I change that from jQuery style to a pure javascript style?</p>
<p>So I want the <code><input></code> tags which <code>name</code> is ended with "letter".</p>
<hr>
<p>I changed code a bit... My browser dont support querySelector and FYI I'm using webbrowser component on c# winforms </p>
| javascript jquery | [3, 5] |
5,558,019 | 5,558,020 | JQuery map vs Javascript map vs For-loop | <p>I'm implementing some code that is a natural fit for map. However, I have a significant amount of objects in a list that I'm going to iterate through, so my question is which is the best way to go abou this:</p>
<pre><code>var stuff = $.map(listOfMyObjects, someFunction())
var stuff = listOfMyObjects.map(someFunction())
</code></pre>
<p>or just</p>
<pre><code>var stuff = new Array();
for(var i = 0; i < listOfmyObjects.length; i++){
stuff.push(someFunction(listOfMyObjects[i]));
}
</code></pre>
| javascript jquery | [3, 5] |
5,742,133 | 5,742,134 | Return information(after server side-php processing) to the javascript client | <p>Here's the Question in its simplest of forms,</p>
<p>Steps:</p>
<p>1)When a User comes to my html page,he types a url (abc.html).</p>
<p>2)I want to get some processing done from the php server(using the URL,say abc.php has to get executed) without navigating away from the page in which the user is in,i.e.without navigating away from abc.html (based on suggestions from one of the answers,will be using iframes and src=abc.php)</p>
<p>3)The php script(present in abc.php) should return some data to abc.html</p>
<p>want to achieve this without using JSON/AJAX,can this be achievable at all?(If so,HOW--tutorials or any directions wud HELP A LOt!!)</p>
<p>Since i'm very new to this,i would like to know how to get the file abc.php to be processed by the server.As in where do you place the file for the abc.html to contact the server(abc.php) perform the required processing and return the result which has to be displayed in the same page(abc.html).</p>
<p>I've been searching everywhere with no successful results.Any kind of directions would help.</p>
<p>-New to web development</p>
| php javascript | [2, 3] |
788,147 | 788,148 | Create ASP.NET Profile | <p>I'm a sysadmin and I have to be able to create users. I wanna create a user and initialize its profile. How can I do this? I don't see any method in the ProfileProvider class for achieving this.</p>
| c# asp.net | [0, 9] |
1,883,600 | 1,883,601 | wait till jquery dialog box returns | <p>I need to open a popup window on clicking a button and used jquery dialog for this.</p>
<pre><code> $(document).ready(function(){
$("#dialog-form").dialog({
autoOpen : false,
height : 300,
width : 350,
modal : true,
buttons : {
"Add" : function() {
$("#tag1").text($("#textArea").val());
$(this).dialog("close");
},
Cancel : function() {
$(this).dialog("close");
}
},
close : function() {
$("#textArea").val("");
}
});
});
function openWindow(){
$("#dialog-form").dialog("open");
statement1;
statement2;
}
<button id="add" onclick="openWindow()">Add</button>
</code></pre>
<p>problem over here is when i click the button dialog box is opened, but before even i enter some text in the dialog box statement1 and statement2 are getting executed and then focus is coming to the dialog box.</p>
<p>How can i make the statement1 and statement2 to execute only after dialog box returns?</p>
<p>I don't want to add the statement1 and statement2 to the "Add" function. The reason for not adding the statements in the "Add" function is because i have multiple buttons and each of these should first open the dialog box and then will execute different set of statements. </p>
| javascript jquery | [3, 5] |
2,108,438 | 2,108,439 | Android To Do List | <p>In an android app, how would I go about saving data after the app is closed? I am trying to make a to-do list app, so I need the entries to stay after I close the app. </p>
| java android | [1, 4] |
3,813,172 | 3,813,173 | Is it advisable to store large strings in memory, or repeatedly read a file? | <p>Let's say I have various text/json/xml/whatever files (stored locally, in the assets directory), ranging in size from 20 - 500 KB. Assuming these files are going to be referenced frequently, throughout the application, is it better to:</p>
<p>A) Read the file once, the first time it's requested, and store the data in a variable</p>
<p>or</p>
<p>B) Read the file each time it's requested, grab the requested bit of information, and allow GC to clean up afterward?</p>
<p>Coming from web-dev, I generally use option (A), but I wonder if the storage limitation of mobile devices makes B preferred in this context (Android app development).</p>
<p>TYIA.</p>
| java android | [1, 4] |
5,153,828 | 5,153,829 | Removing Items From Dropdown list (client side) | <p>So I have a number of dropdown select list controls populated as part of a repeater. They might contain overlapping data, meaning that the first d d list control will have selections:</p>
<pre><code>a
b
c
</code></pre>
<p>Second one:</p>
<pre><code>c
d
e
</code></pre>
<p>Third one:</p>
<pre><code>d
e
h
</code></pre>
<p>and so on. </p>
<p>So what I would like to do is to srart removing the duplicate items from the reset of drop down controls once the user starts selecting those. I intend to use jQuery for this.</p>
| jquery asp.net | [5, 9] |
4,739,179 | 4,739,180 | jQuery - calling function variable from another function variable | <p>Why doesn't this work:</p>
<pre><code> var foo = function() {
...
};
var boo = function() {
...
el.foo();
}
</code></pre>
<p>?</p>
<p>I get a foo is undefined error. But I just defined it above...</p>
| javascript jquery | [3, 5] |
2,073,556 | 2,073,557 | get value from a gridView from javascript | <p>i have this code in ASP, I need to do the same, but from the client side. I´ve been searching but i couldn´t do the javascript work. I think this would be pretty simple.</p>
<pre><code> protected void btnProbar_Click(object sender, EventArgs e)
{
bool flag = false;
foreach(GridViewRow c in grdDatos.Rows)
{
if (c.Cells[0].Text == txtNroUnidad.Text)
{
flag = true;
}
}
}
</code></pre>
<p>If you could help me, I would apreciate that. Thanks you!</p>
| javascript asp.net | [3, 9] |
2,878,562 | 2,878,563 | php IF statement to load/not load Javascripts - Is this smart? | <p>I am not sure if this general question is even allowed in here but I try it anyways. I am creating a new site (just for fun and to "train" my skills). I am at a point where I have some lines of javascript code, but the code is not needed on every page.<br></p>
<p>So I have decided to paste ALL javascripts into a php file (javascript.php) and inside that file I have added following lines:<br><br></p>
<pre><code><?php $site_name = basename($_SERVER['REQUEST_URI'], ".php"); ?>
<?php if ($site_name == "index") { ?>
<script type="text/javascript">
//script 1
</script>
<?php } elseif ($site_name == "index1") { ?>
<script type="text/javascript">
//script 1
</script>
<?php } elseif ($site_name == "index2") { ?>
<script type="text/javascript">
//script 2
</script>
<?php } elseif ($site_name == "index3") { ?>
<script type="text/javascript">
//script 3
</script>
<?php } ?>
</code></pre>
<p><br>
It works fine.<br>But, as I am a coding newbie, I was wondering if this a smart solution? Could you girls and guys tell me your opionion and why it is smart/dumb to do this?<br>Thanks!</p>
| php javascript | [2, 3] |
4,331,540 | 4,331,541 | remove values from a string | <p>Does anyone know how I would remove all leading zeros from a string.</p>
<pre><code>var str = 000890
</code></pre>
<p>The string value changes all the time so I need it to be able to remove all 0s before a number greater than 0. So in the example above it needs to remove the first three 0s. So the result would be 890</p>
| javascript jquery | [3, 5] |
1,865,599 | 1,865,600 | solve linear equations with 3 variables that is given by user | <p>i'm trying to figure out how to write down a program in java to solve 2 equations that have 3 variables, which is given by the user:</p>
<pre><code>A11 * X1 + A12 * X2 = B1
A21 * X1 + A22 * X2 = B2
</code></pre>
<p>numbers are given by user, per say 1 2 3 4 5 6 (for a11 a12 a21 a22 b1 b2)
and the answers are "no solution" "many solutions" "single solution (x1,x2)
i'm stuck.... don't even know where to begin
help?</p>
| java javascript | [1, 3] |
5,269,623 | 5,269,624 | How to access key like en-us | <pre><code>var json = {
"key-1": {
"en-us": "translated text in English-US",
"fr": "translated text in French",
"hi": "translated text in Hindi",
"hiclient": "client translated text in"
},
"key-2": {
"en-us": "translated text in English-US",
"hi": "translated text in Hindi"
}
</code></pre>
<p>}</p>
<p>This is my json.
I want to get en-us values into the table.<br>
I am getting if it is an enus using jquery.</p>
| javascript jquery | [3, 5] |
3,809,358 | 3,809,359 | Image Resize Issue in asp.net | <p>i have an img tag </p>
<pre><code><asp:Image ID="imgCatalog" ImageAlign="middle" Height='<%#GetImageWidth(Eval("PictureName")) %>' ImageUrl='<%#GetImageUrl(Eval("PictureName")) %>' runat="server"/>
</code></pre>
<p>i want to resize every image during loading the page and i used GetImageWidth function.</p>
<pre><code>public Unit GetImageWidth(object ImageName)
{
string strimagename = Convert.ToString(ImageName);
//string strimagewidth = "";
int width = 0;
if (System.IO.File.Exists(Server.MapPath(GetImageUrl(strimagename))))
{
System.Drawing.Image img = System.Drawing.Image.FromFile(Server.MapPath(GetImageUrl(strimagename)));
if (img.Height > 1000)
{
//strimagewidth = "535px";
**width = 535;**
------------
}
else
{
//strimagewidth = img.Width.ToString() + "px";
width = img.Width;
}
img.Dispose();
}
return Unit.Pixel(width);
}
</code></pre>
<p>I want to set image height not image width.but i didnt get height property inside the function.Can any body help</p>
| c# asp.net | [0, 9] |
1,136,035 | 1,136,036 | Whats wrong with this ternary expression? | <p>I am simply trying to toggle between <code>display: block;</code> and <code>display: none;</code>.</p>
<pre><code>($('#menu').css('display') = "block") ? $('#menu').css('display', 'none') : $('#menu').css('display', 'block');
</code></pre>
| javascript jquery | [3, 5] |
409,086 | 409,087 | Robust Javascript parser in Java | <p>I am looking for a <em>robust</em> Javascript parser written in Java - by which I mean a Javascript parser that is able to handle most real world Javascript.</p>
<p>I am only interested in <em>parsing</em> Javascript, <em>not</em> in executing it.</p>
<p>I have found Rhino:
<a href="http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino/browse_thread/thread/1eff23a8ee57b991" rel="nofollow">http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino/browse_thread/thread/1eff23a8ee57b991</a></p>
<p>Am I missing anything? Is this the best solution?</p>
<p>Thank you!
Misha</p>
| java javascript | [1, 3] |
1,415,253 | 1,415,254 | Creating an Executable Script which accesses aspx form components and runs function | <p>Hello I have created and application which contains a gridview that is populated by an SQL database. I built a function which converts the gridview into an excel file and stores it on the server.</p>
<p>I would just like to know how I can write an executable script(which I will set to run at a certain time on the server) that will access the gridview in the .aspx file containing the gridview and run the convertToExcel() function located in the .cs file attached to the .aspx file and then close.</p>
<p>Thank you,
Fernando Diaz</p>
| c# asp.net | [0, 9] |
1,078,588 | 1,078,589 | Java: taking average of 16 image byte arrays in Android | <p>my android app is taking several images in a row. Every time I take a picture using takePicture() I convert the byte array into a PNG using BitmapFactory. My final goal is to get the average of 16 images. To speed up the process I was thinking of averaging the byte arrays before creating a PNG instead of creating 16 images and then trying to average them. Any suggestions on how to do this?</p>
<p>Simply, I want to do something like this: </p>
<pre><code>imgByteArray1 = [1,2,3,4]
imgByteArray2 = [4,3,2,1]
totalImgByteArray = imgByteArray1 + imgByteArray2
//totalImgByteArray will equal [5,5,5,5]
aveImgByteArray = totalImgByteArray / 2
//aveImgByteArray will equal [2.5,2.5,2.5,2.5]
</code></pre>
<p>Then from aveImgByteArray I can create a PNG file.</p>
<p>I'm using the same code as in <a href="http://stackoverflow.com/q/5545952/654781">Android 2.3.1 Camera takePicture() Multiple images with one button click</a> to capture the images.
First I'm collecting the byte arrays into one byte array:</p>
<pre><code>for(int i=0; i < data.length ; i++)
totalImgData[i] = (byte) (totalImgData[i] + data[i]);
</code></pre>
<p>Then I'm averaging across the array after I've collected for 16 images:</p>
<pre><code>for (int j=0; j < totalImgData.length; j++)
aveImgData[j] = (byte) (totalImgData[j] / 16);
</code></pre>
<p>This doesn't work... Sorry I'm a bit new to Android with Java.</p>
| java android | [1, 4] |
2,593,151 | 2,593,152 | Display ticket remaining time | <p>I am programming small page and I want to display expiration time of authentication ticket. I mean not the end, but remaining time. Current code is follows:</p>
<pre><code> DateTime cas = (DateTime)ticket.Expiration.Date;
DateTime cas1 = DateTime.Now;
DateTime cas2 = cas1.Subtract(cas);
</code></pre>
<p>However, VS says "Cannot implicitly convert system.timespan into system datetime".
Pls help. Thanks a lot.</p>
| c# asp.net | [0, 9] |
2,275,136 | 2,275,137 | Single javascript function for multiple web pages | <p>I have around 40 aspx pages in my website.
I want to use a javascript function which needs to be called when any of the 40 pages is loaded.
something like </p>
<p>I could have this function in the "head" section of each of the 40 aspx pages and then call in the body onload event. But I would like to have this function at a single place.
This is an existing app so I cannot create a master page and have all the pages derive from it.</p>
<p>Any ideas?</p>
| asp.net javascript | [9, 3] |
2,534,547 | 2,534,548 | ASP.net C# Name gridview collums after custom DataBind | <p>Is there the possibility to give a gridview's collums a custom name using programming code (C#) ? </p>
<p>F.E. I databind my gridview (wich is empty in my aspx, except for the layout) using following code :</p>
<pre><code> SqlCommand objCommand = new SqlCommand("SELECT M.Mod_ID, M.Mod_Naam, M.Mod_Omschrijving, M.Taal_Id, M.User_ID FROM Toewijzing T, Model M WHERE T.User_ID = '" + Session["userid"].ToString() + "' AND T.Toe_Status = '" + "ja" + "' AND M.Mod_ID = T.Mod_ID", con);
dr = objCommand.ExecuteReader();
gvIngevuld.DataSource = dr;
gvIngevuld.DataBind();
dr.Close();
</code></pre>
<p>How do I give these collums a costum name ? Like F.E. "Modelnr." for the first collum, "Modelnaam" for the 2nd, etc.
Olso i was wondering if there was an option to enable paging (per 20 records) and to enable sorting ?</p>
<p>Any help is welcome !
Thank you.</p>
| c# asp.net | [0, 9] |
5,946,501 | 5,946,502 | Why My application keep giving OutOfMemory Exception | <p>I am making a Web Focused crawling</p>
<p>and I am using String array to keep all the link</p>
<p>is there anyway to avoid this error </p>
<p>Thx</p>
| java android | [1, 4] |
5,108,302 | 5,108,303 | Php/Java Integration | <p>Have u experience of integration of php and Java. I've written a class in Java "Hello". Now I want to call its method from php when I create an instance of this class from php with </p>
<pre><code>$obj = new Java(Hello);
</code></pre>
<p>Then it gives me fatal error. I've tried many times to setup php ini variables etc but I couldn't find any thing. Please advice me how can I set it up. </p>
<p>Thanks in advance </p>
<hr>
<p><sup><strong>Reference: <a href="http://de.php.net/manual/en/book.java.php" rel="nofollow">http://de.php.net/manual/en/book.java.php</a></strong></sup></p>
| java php | [1, 2] |
1,751,599 | 1,751,600 | Persist Textbox in cookie/session automaticly | <p>I am attempting to persist what the users enters into a textbox without them clicking save. It would simply save what the user entered into the textbox so when they navigate away and then back to the page it will be reloaded. once they are click "done" the session will be removed.</p>
<p>I have been trying to do this with Jquery but I have been struggling as I am fairly new to JavaScript, can anyone point me in the right direction? </p>
| c# jquery | [0, 5] |
3,514,427 | 3,514,428 | Mouseover Pause JQuery | <p>I want to stop animation when the mouseover the text. But i dont know how to stop the animation on mouseover.</p>
<p>If anyone knows the code please help me.</p>
<p>Advance Thanks</p>
<p>My code is</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Animation</title>
<script type="text/javascript" language="javascript" src="js/jquery.min.js"></script>
<script>
function tick2(){
jQuery('#ticker_02 li:first').slideUp(function(){
jQuery(this).appendTo(jQuery('#ticker_02')).slideDown();
jQuery("#ticker_02 ul > li:lt(2)").show();
jQuery("#ticker_02 ul > li:gt(2)").hide();
});
}
setInterval(function(){ tick2 () }, 3000);
</script>
</head>
<body>
<ul class="ticker" id="ticker_02">
<li>Looong text.....</li>
<li>Looong text.....</li>
<li>Looong text.....</li>
<li>Looong text.....</li>
</ul>
</body>
</html>
</code></pre>
| php javascript jquery | [2, 3, 5] |
2,475,942 | 2,475,943 | How to Set timer function | <p>I am doing online Exam Management, I have set a time duration for an exam to 5 min.</p>
<p>When student attend this test, timer starts decreasing.</p>
<p>I made this timer using javascript.</p>
<p>What the problem is if the student refresh the page timer starts from first. How can I make the time to be static if page refreshed.</p>
| php javascript | [2, 3] |
3,479,391 | 3,479,392 | Android WebView with notification on new message | <p>I have messaging php based application where users login and send messages to each other.
I created an android app that is a WebView pointing to that website to give and in-app feeling to my users.</p>
<p>Now I'd like to add a notification feature to the app which will notify users every time they receive a message.</p>
<p>Is it possible to do so with a WebView based application ?</p>
<p>Thanks</p>
| java php android | [1, 2, 4] |
713,199 | 713,200 | Tracking down javascript error | <p>I inherited an old classic asp VB program which I have edited under VS 2010. There is rather long javascript function ("check(this)") that validates the user-entered data upon submit. But now when the user clicks "continue" I am getting the following error:</p>
<p><img src="http://i.stack.imgur.com/DZY1Y.png" alt="screen print of submit and error"></p>
<p>How best to track down this error? I am running Windows 7.</p>
| javascript asp.net | [3, 9] |
724,642 | 724,643 | How do I activate the click event for a button on Android? | <p>How do I activate the click event for a button on Android?</p>
| java android | [1, 4] |
2,043,327 | 2,043,328 | Dynamically create controls in aspx? | <p>I try several ways to create a few control in an .aspx page's code-behind. I have these problems: </p>
<p>1) name of each component<br>
2) place of these components<br>
3) access to these components in method event or totally in code behind</p>
<p>I want to create a few <code><asp:textbox></code> and put them in table rows. I'd like to then get value of these textboxes and do somthing with them.</p>
| c# asp.net | [0, 9] |
2,449,195 | 2,449,196 | Get multiple CSS properties with jQuery | <p>I know you can SET multiple css properties like so:</p>
<pre><code>$('#element').css({property: value, property: value});
</code></pre>
<p>But how do I GET multiple properties with CSS?
Is there any solution at all?</p>
| javascript jquery | [3, 5] |
1,823,396 | 1,823,397 | Adding Personal Google API into Fancybox | <p>I want to have my google api added to fancybox once my googlemaps img is click on.</p>
<p><a href="http://www.rhythmdesignz.biz/" rel="nofollow">heres the url</a></p>
<p>I would like that once the google img is clicked it opens a lightbox from fancybox and then runs the google api in light box.</p>
<p>I know I can just add a iframe and use fancybox to enter it in, but since Im learning javascript at the moment I would like to see how this would work.</p>
<p><a href="http://rhythmdesignz.biz/code/fancy-box/source/jquery.fancybox.pack.js" rel="nofollow">I have found the js code that is ran from fancybox here</a></p>
<p>The html from lightbox is</p>
<pre><code><div class="fancybox-outer">
<div style="overflow: visible; width: 350px; height: 280px;" class="fancybox-inner">
<img class="fancybox-image" src="images/directv_g_map.jpg" alt="">
</div>
</div>
</code></pre>
<p>I would not have posted this if I could have done this myself but after 10+ hours trying to do this Ive gotten frustrated that I cant clearly think.</p>
<blockquote>
<p>-Ive been attempting to have the google api do an window onclick = init; then run ----didnt work<br/>
-different versions of onclick and onload ---- didnt work<br/>
-The one I believed would have worked best would be the createElement, but I have been having trouble getting the id for the lightbox img since it only has the class tag.
I planned on editing the js file just to include a if statement which would the create a div id where I can then load my google api but yet no luck.<br/>
-if(src == "directv_g_map.jpg") then change src to google api</p>
</blockquote>
<p>again I still learning but would appreciate some help thank you</p>
| javascript jquery | [3, 5] |
2,969,306 | 2,969,307 | Error when trying to get document.getElementsByName(name) | <p>I have been trying to use this code in one of my projects:</p>
<p><a href="https://github.com/cemerick/jsdifflib" rel="nofollow">https://github.com/cemerick/jsdifflib</a></p>
<p>EDIT: Link to code in question <a href="http://jsfiddle.net/BvFNf/3/" rel="nofollow">http://jsfiddle.net/BvFNf/3/</a></p>
<p>The code in its current form uses:</p>
<pre><code>var byId = function (id) { return document.getElementById(id); }
base = difflib.stringAsLines(byId("baseText").value),
newtxt = difflib.stringAsLines(byId("newText").value),
</code></pre>
<p>However I am trying to use the name field instead:</p>
<pre><code>var byName = function (name) { return document.getElementsByName(name); }
base = difflib.stringAsLines(byName("field1")[0].value),
newtxt = difflib.stringAsLines(byName("field2")[0].value),
</code></pre>
<p>The append child code is as follows:</p>
<pre><code> diffoutputdiv.appendChild(diffview.buildView({
baseTextLines: base,
newTextLines: newtxt,
//opcodes: opcodes,
baseTextName: "Base Text",
newTextName: "New Text",
contextSize: contextSize,
viewType: viewType
}));
</code></pre>
<p>I also added <code>' name="field1" '</code> to the html.</p>
<p>The full source can be found here: <a href="http://pastebin.com/7y3SQYFM" rel="nofollow">Pastebin Code</a>
The error I keep getting is:</p>
<pre><code>Uncaught TypeError: Object #<NodeList> has no method 'appendChild' demo.html:69
diffUsingJS demo.html:69
onclick demo.html:98
</code></pre>
<p>The data being returned is equivalent to the original byID data set. Please help.</p>
| javascript jquery | [3, 5] |
2,215,968 | 2,215,969 | passing string from RadioButton android:text="@string/blue" to the next activity in android | <p>i have</p>
<pre><code><RadioGroup
android:id="@+id/sign_up_select_colour"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
<RadioButton
android:id="@+id/rdbtn_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/red" />
<RadioButton
android:id="@+id/rdbtn_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/blue" />
</RadioGroup>
</code></pre>
<p>i want to send the string <em>blue</em> to the next activity the same way i did with EditText here (with your help earlier);</p>
<pre><code>EditText editTextSignUpUserName = (EditText) findViewById(R.id.sign_up_user_name);
String signUpUserName = editTextSignUpUserName.getText().toString();
intent.putExtra("username", signUpUserName);
</code></pre>
<p>i've tried this;</p>
<pre><code>RadioButton selectedRadioButton = (RadioButton) findViewById(R.id.sign_up_select_colour);
String signUpColour = selectedRadioButton.getCheckedRadioButtonText().toString();
intent.putExtra("colour", signUpColour);
</code></pre>
<p>please and thanks.</p>
| java android | [1, 4] |
835,690 | 835,691 | Speed test: while() cycle vs. jQuery's each() function | <p>I have an array of objects called <code>targets</code> and I want to execute a function on each of those objects. The first method:</p>
<pre><code>targets.each(function() {
if (needScrollbars($(this))) {
wrap($(this), id);
id = id + 1;
}
});
</code></pre>
<p>This method gives execution speed of ~125ms. The second method is:</p>
<pre><code>var i=0;
while (targets[i] != undefined) {
if (needScrollbars($(this))) {
wrap($(this), id);
id = id + 1;
}
i = i+1;
}
</code></pre>
<p>This second method takes whopping 1385ms to execute and I get my head around that. Does anyone have any idea why a bare bones cycle runs slower than a function which I'm only guessing that's doing (just guessing) a whole lot more than a simple cycle?</p>
<p>Thank you.</p>
| javascript jquery | [3, 5] |
3,669,007 | 3,669,008 | Can i passing parameter to jquery, after inserting a new row which is in different php | <p>this is my jquery coding</p>
<pre><code>$('#btnKirimPesan').click(function(){
$('#bantu').load('kirim_pesan.php', {'emailPenerima': $('#emailPenerima').val(), 'isiPesan': $('.isiPesan').val()});
});
</code></pre>
<p>then this is on kirim_pesan.php</p>
<pre><code><?
include('../../config/buka_koneksi_db.php');
$query = "INSERT INTO pesan(emailPenerima, emailPengirim, statusBaca, isiPesan, waktuPesan) VALUES((SELECT emailUser FROM user WHERE MD5(emailUser) = '".$_POST['emailPenerima']."'), '".$_SESSION['email']."', 0, '".$_POST['isiPesan']."', NOW('d/m/Y/H/i/s'))";
$hasilQuery = mysql_query($query);
if(mysql_affected_rows()>=1)
$hasil = 1;
else
$hasil = 0;
include('../../config/tutup_koneksi_db.php');
?>
</code></pre>
<p>The jquery coding and query inserting new row is in different file. I want to reload a div in jquery file(it's php file) if only <code>$hasil = 1;</code>, if its == 0, I'll show dialog which say "your message has not been sent"...how can i do it??please help me...>,<...thx before</p>
| php jquery | [2, 5] |
1,951,691 | 1,951,692 | How to get animating caption overlay with javascript? | <p>I have a picture that I want to make it so that when you mouse over theimage, a black caption comes up over part of it like the one shown here:</p>
<p><a href="http://wonderwall.msn.com/" rel="nofollow">http://wonderwall.msn.com/</a></p>
| javascript jquery | [3, 5] |
2,719,883 | 2,719,884 | jQuery Javascript scrollTop not working as expected on Chrome to restore scrollbar position | <p>I'm using the following jQuery Javascript to save the scrollbar position before the unload event and reapply it again:</p>
<pre><code>$(document).ready(function () {
document.documentElement.scrollTop = $.cookie("scroll") || 0;
});
window.onbeforeunload = function () {
$.cookie("scroll", document.documentElement.scrollTop, { expires: 7 });
}
</code></pre>
<p>Basically I have a series of links that refresh the page and I would like the browser to restore the scrollbar position. Note I cannot use AJAX in this instance. It works a treat in Firefox. In Chrome and Safari however it only works when the browser window is refreshed, and not when the link is clicked to refresh the page. It's as if clicking the link isn't being recognised as onbeforeunload.</p>
<p>I have tried to modify the code to set the scroll cookie using a click event as follows with no luck:</p>
<pre><code>$(document).ready(function () {
document.documentElement.scrollTop = $.cookie("scroll") || 0;
});
$('a.lockscrollbar').click(function() {
$.cookie("scroll", document.documentElement.scrollTop, { expires: 7 });
}
</code></pre>
<p>FYI I'm using jQuery 1.4.2 with the jQuery cookie plugin.</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
4,444,718 | 4,444,719 | Search Criteria in PHP | <p>JAVASCRIPT</p>
<pre><code>function ShowContent(id) {
if(id.length < 1) { return; }
document.getElementById(id).style.display = "block";
}
</code></pre>
<p>PHP</p>
<pre><code>$test = mysql_query('SELECT userid,testid,testname FROM test_table WHERE userid = 9 ORDER BY name');
TestName : <select>
while($row=mysql_fetch_array($test))
{
$testname = $row['testname'];
$testid = $row['testid'];
echo '<option value='.$testid.'>'.$testname.'</option>
}
</select>
echo '<div id="testid" style="display:none;">
echo '<table>
<tr><th>USERID</th</tr>
<tr><th>TESTNAME</th></tr>
<tr><th>MARKS</th></tr>
publishtest = mysql_query('SELECT id,userid,publishtest,marks FROM publish_table WHERE userid= 9 GROUP BY id');
while($row=mysql_fetch_array($publishtest))
{
$userid = $row['userid'];
$testid = $row['id']; /*This is test id*/
$testname = $row['publishtest']; /* This is test name*/
$marks = $row['marks'];
echo '<tr><td>'.$userid.'</td>
<td>'.testid.'</td>
<td>'.testname.'</td>
<td>'.$marks.'</td>
</tr>
}
echo '</table>';
echo '</div>';
</code></pre>
<p>I need when I select test from select tag, then div should be displayed of that testid. I want either in javascript, jquery</p>
| php javascript jquery | [2, 3, 5] |
4,480,131 | 4,480,132 | execute a javascript function if the user is not active on the page? | <p>i'm looking for a javascript or jQuery function to execute my function newalert() if the user is not active on the page, ( maybe with some event to check the cursor position or something like this )</p>
<p>i will make it auto check using settimeout , i just want the function to check the availability of user like in gmail chat, when receiving a new IM and you are not watching the gmail page, it plays a bleep sound.</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
1,783,289 | 1,783,290 | JavaScript error in IE8 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/886668/window-onload-is-not-firing-with-ie-8-in-first-shot">window.onload() is not firing with IE 8 in first shot</a> </p>
</blockquote>
<p>I am getting a error while running the code in JavaScript on line 20. The line 20 code is just here:</p>
<pre><code>window.onload = setTimeout( function(){
$('#notification_div').slideUp(2000);
} , 6000);
</code></pre>
| javascript jquery | [3, 5] |
1,427,847 | 1,427,848 | Need help on text expander jQuery plugin | <p>I am trying to use this text expander/collapse jQuery <a href="http://plugins.learningjquery.com/expander/demo/index.html" rel="nofollow">plugin</a> to only display first snippets of text, but if I load this in the page the whole text would show up first and then when the plugin is fully loaded in to the browser it would collapse down(I could visually see this process). Is there any technique that you can teach me so that only collapsed text would display first?</p>
<p>Here is the plugin I am trying to use:
<a href="http://plugins.learningjquery.com/expander/demo/index.html" rel="nofollow">http://plugins.learningjquery.com/expander/demo/index.html</a></p>
| javascript jquery | [3, 5] |
1,634,535 | 1,634,536 | Adding buttons on xml file other than main | <p>I have two xml files in my application - <strong>main.xml</strong> and <strong>options.xml</strong>.</p>
<p>In both of them I use buttons. The problem is, that while interacting with the buttons in <strong>main.xml</strong>, I cannot do that with <strong>options.xml</strong>: if I write </p>
<pre><code>Button b = (Button)findViewById(R.id.b1);
</code></pre>
<p>, b is going to be null. What is the cause of this problem and how do I fix it?</p>
<p>Thank you in advance.</p>
| java android | [1, 4] |
1,658,053 | 1,658,054 | Catch only keypresses that change input? | <p>I want to do something when a keypress changes the input of a textbox. I figure the <code>keypress</code> event would be best for this, but how do I know if it caused a change? I need to filter out things like pressing the arrow keys, or modifiers... I don't think hardcoding all the values is the best approach.</p>
<p>So how should I do it?</p>
| javascript jquery | [3, 5] |
1,704,563 | 1,704,564 | Ajax upload file error with Google Chrome? | <p>I'm using noswfupload (ajax uploader) with my web application, and it work fine with Firefox and IE, but it's not working with Google Chrome. I found an error which show that "PHP Warning: Missing boundary in multipart/form-data POST data in Unknown on line 0"</p>
<p>could anyone tell me how to solve this problem?</p>
| php javascript | [2, 3] |
5,229,219 | 5,229,220 | List assets in a subdirectory using AssetManager.list | <p>My application has an assets directory in which I've dumped a bunch of text files I need to load at runtime.</p>
<p>I have a directory full of assets of a particular type (i.e., "assets/subdir") and I want to load all of the files in this directory, one at a time.</p>
<p>I have code like this:</p>
<pre><code>
AssetManager assetMgr = getAssets();
String[] assetsIWant = assetMgr.list("subdir");
for(String asset: assetsIWant) {
doAssetyThing(asset);
}
</code></pre>
<p>I've tried a zillion different versions of the parameter to assetMgr.list() and am not getting anywhere.</p>
<p>If I use "/", I get back a list containing the "assets" directory, and a few random other items (META_INF, for example). If I pass any other string (like "assets" or "assets/" or "/assets" or "/assets/" or "mysubdir" or "/mysubdir" or "assets/mysubdir" or ...) then I get back an empty array.</p>
<p>The documentation is unfortunately fairly incoherent.</p>
<p>Does anybody know what the correct formula for that list() parameter is? </p>
| java android | [1, 4] |
828,677 | 828,678 | How to Call javascript function from asp.net code behind | <p>How to call JavaScript function from ASP.NET code behind?</p>
<p>I have JavaScript function and I am using it in a <code>listview</code> with a parameter</p>
<p>I want to use it with another parameter in code behind ?</p>
<pre><code> <a href="ChatBox.aspx?id=<%# Eval("USR_UserID")%> "
onclick="openWindow(this.href,'chat<%# Eval("USR_UserID")%>',600,600);
this.blur();
return false;"><%# Eval("USR_UserName") %></a>
</code></pre>
<p>that is the <code>listview</code> side. How can I use <code>openwindow</code> function in code behind fore specific ID?</p>
| javascript asp.net | [3, 9] |
541,834 | 541,835 | Create the <li> for <ul> dynamically in C# | <p>I have to add <li> items dynamically, based on their value, to an unordered list (<ul>). How do I do that programatically?</p>
| c# asp.net | [0, 9] |
5,921,559 | 5,921,560 | Set Identity for non web request | <p>I want to set identity for a non web request. Currently I am using FormsAuthentication and I am getting user identity via this <em>User.Identity.Name</em> . Now I have to make the user login via API. I have the username/password for the user, how can I set the identity for this. </p>
| c# asp.net | [0, 9] |
5,663,934 | 5,663,935 | The "not:()" selector isn't working with ".live()" when event binding | <p>When I added <code>live()</code> to some mousedowns, my <code>not:</code> conditional stopped working.</p>
<pre><code> $("body :not(" + _self.somevar + ")").live('mousedown',
function(event){
event.stopPropagation();
// some more code
}
</code></pre>
<p>When it wasn't <code>live()</code> it worked. Now that I use <code>live()</code>, when I mousedown on that item, it fires when it shouldn't.</p>
<p>Anyone know why <code>not:</code> is no longer adhered to?</p>
| javascript jquery | [3, 5] |
4,922,279 | 4,922,280 | Is there an inbuilt way to use JQuery's .each() in reverse? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1394020/jquery-each-backwards">JQuery .each() backwards</a> </p>
</blockquote>
<p>What is the easiest way to use <code>.each()</code> in reverse? At the moment I am doing this:</p>
<pre><code>var temp = [];
$("#nav a").each(function()
{
temp.push($(this));
});
temp.reverse();
for(var i = 0; i < temp.length; i++)
{
var a = temp[i];
// Work with a.
}
</code></pre>
<p>It would be nice if I could do something like:</p>
<pre><code>$("#nav a").reverse().each(function()
{
// Work with $(this).
});
</code></pre>
<p>The context is that I have a collection of elements using <code>float: right</code> which displays them in reverse order and I want to iterate over them from left to right like normal.</p>
| javascript jquery | [3, 5] |
2,534,012 | 2,534,013 | Calling a javascript function while passing PHP variables | <p>I am trying use a javascript function while passing php variables in it. For example:</p>
<pre><code>onclick="alert(<?echo $row['username']?>)";
</code></pre>
<p>Now this does not work, instead gives an error-<code>ReferenceError: Can't find variable:right_username</code>(here the right_username is the answer i expect in the alert).</p>
<p>However if instead of <code>username</code> i use <code>EmpID</code>:</p>
<pre><code>onclick="alert(<?echo $row['EmpID']?>)";
</code></pre>
<p>EmpID being an int in the database works just fine.</p>
| php javascript | [2, 3] |
2,661,224 | 2,661,225 | asp.net include page like php | <p>im starting to learn asp.net :P, and in php i should use include(); to show something like a menu. but how can i do this in asp.net?</p>
<p>i dont mean a simple include, but a page where i can query a database to make the page dynamicly for example.</p>
<p>i hope you understand my problem.</p>
| php asp.net | [2, 9] |
1,523,677 | 1,523,678 | How to wait a fadeout effect and then remove the element? | <p>I have a <em>tr</em> which will be removed when clicked in delete button, but before doing .remove() or empty() I'd like to wait for some fadeOut() effect.</p>
<pre><code>$(this).closest('tr').fadeOut();
setTimeout("$(this).closest('tr').remove()",1000);
</code></pre>
<p>is not working, it only fades out.</p>
| jquery javascript | [5, 3] |
3,296,555 | 3,296,556 | Correct the connection string used for a SQL Server | <p>My default connection string is</p>
<pre><code><add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</code></pre>
<p>I have just created a SQL Server Compact database file called <code>myModel.sdf</code> in the <code>App_Data</code> folder, and I also created several tables inside it.</p>
<p>I am ASP.NET newbie and I don't know how to correct the above connection string so that my application will use the created <code>.sdf</code> file or its tables. Thank you for guiding me.</p>
| c# asp.net | [0, 9] |
525,177 | 525,178 | How to use activity to request data from service? | <p>Now, my program have an activity and a service. The service runs in the background and sometimes vibrates to ask users give some selection. I meet a problem here. I know broadcast could pass data from service to activity. But if the activity is not working, then it cannot receive the broadcast information, so if user feels vibration but after a period of time start the activity then the activity will miss the broadcast information and cannot ask user to choose a selection. So does anybody know how to actively request the data from the service by activity? I just want when I onCreate() or onResume() the activity, my app could update UI in time?</p>
<p>Thanks</p>
| java android | [1, 4] |
1,319,030 | 1,319,031 | iphone photo upload - PHP & Jqtouch library | <p>I am building a web site which supports IPhone also. Now I am quite confused as to find a way to upload the IPhone photos to my website.
Also it seems the "input type text" also doesnt work in IPhone. Have anybody worked on it....please suggest.</p>
| php iphone | [2, 8] |
5,006,486 | 5,006,487 | jQuery.html( something ) detect when injection is complete | <p>In a nutshell I want a callback to fire after the html has been injected and the content of that html has rendered. Reason being I need to know the height of the new content right away. Something like this:</p>
<pre><code> $('div').html(tonsofstuff);
console.log( $('div').height() ); //works in Firefox, but returns 0 in Chrome
setTimeout(function(){
console.log( $('div').height() ); //works everywhere, but takes too long
},3000);
</code></pre>
<p>The issue is occasionally in some browsers (and always in chrome) $('div').height() fires before the new content has a height.</p>
<p>My fantasy:</p>
<pre><code> $('div').html(tonsofstuff, function(){
console.log( $('div').height() );
});
or even
$('div').html(tonsofstuff).load(function(){
console.log( $('div').height() );
});
</code></pre>
| javascript jquery | [3, 5] |
2,503,164 | 2,503,165 | how can access data from a webserver using a windows application | <p>I would like to create a touch screen application.It will be a windows application, so using that how can i get data from a web server?</p>
| java php | [1, 2] |
5,880,578 | 5,880,579 | Store html form values in android storage | <p>How is it possible to store html form input values, via javascript in native android storage?</p>
| javascript android | [3, 4] |
2,980,730 | 2,980,731 | PHP arrays into javascript arrays | <p>I am a bit confused here on how I implement an array into JS from PHP....</p>
<p>I'm doing this for testing - eventually I'll use long polling or websockets if they get highly supported but this is what I have:</p>
<pre><code>$get = mysql_query("SELECT x,y,sid FROM player_town WHERE uid='1'") or die(mysql_error());
$row = mysql_fetch_assoc($get);
$data = json_encode($row);
</code></pre>
<p>Further down the script I then put in the head:</p>
<pre><code><script>var data = Array(<? $data; ?>)</script>
<script type="text/javascript" src="js.js"></script>
</code></pre>
<p>But in js.js it says undefined but $data is set. This is the error:</p>
<pre><code>x is not defined
</code></pre>
<p>In js.js I did <code>alert(data[x]);</code> and I get undefined.</p>
<p>My json_encode looks like this:</p>
<pre><code>{"x":"283","y":"99","sid":"1"}
</code></pre>
<p>Any ideas?</p>
| php javascript | [2, 3] |
4,040,837 | 4,040,838 | html page loading message | <p>My html page loads a bit slowly because of the jquery that's in it. I want an image that tells the user that it's loading, until the entire page get loaded. How should I go about doing this?<br>
Many thanks in advance.</p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
//my jquery here....
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
3,017,881 | 3,017,882 | Create SQL Server table at runtime using asp.net | <p>What I need to do is to create a table within my database at runtime to store some data then store it in another table and delete the current or Temp table. It is a security issue where I can not use session or caching in my application any help will be appreciated .</p>
| c# asp.net | [0, 9] |
2,955,234 | 2,955,235 | Jquery click function not working | <p>I'm trying to give some functionality to my button using jquery <code>click</code> function. But when i run the code the function wouldn't get invoke at all.</p>
<p>My code is:</p>
<pre><code> <script type="text/javascript">
$(function () {
$("#min").click(function(e){
$("#listFriends").css('display','none');
$("#friendsO").show();
});
</script>
</code></pre>
<p>And</p>
<pre><code><button id="min">[-]</button>
</code></pre>
<p>Please anyone tell me what mistake I made in this code.....Thanks..........</p>
| javascript jquery | [3, 5] |
4,018,865 | 4,018,866 | Large amount of constants in Java | <p>I need to include about 1 MByte of data in a Java application, for very fast and easy access in the rest of the source code. My main background is not Java, so my initial idea was to convert the data directly to Java source code, defining 1MByte of constant arrays, classes (instead of C++ struct) etc., something like this:</p>
<pre><code>public final/immutable/const MyClass MyList[] = {
{ 23012, 22, "Hamburger"} ,
{ 28375, 123, "Kieler"}
};
</code></pre>
<p>However, it seems that Java does not support such constructs. Is this correct? If yes, what is the best solution to this problem?</p>
<p>NOTE: The data consists of 2 tables with each about 50000 records of data, which is to be searched in various ways. This may require some indexes later, with significant more records, maybe 1 million records, saved this way. I expect the application to start up very fast, without iterating through these records.</p>
| java android | [1, 4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.