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 |
---|---|---|---|---|---|
804,044 | 804,045 |
ssh command in android app
|
<p>I'm new in Android app Dev.
I'm trying to connect my app to an ssh server and execute a simple command.
I wrote this code, No errors, no problem during execution on my Galaxy, but the command isn't executed. Any help would be appreciated. Thanks</p>
<pre><code>package com.example.testcomando;
import java.io.ByteArrayOutputStream;
import java.util.Properties;
import com.jcraft.jsch.*;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends Activity {
public static String executeRemoteCommand(
String username,
String password,
String hostname,
int port) throws Exception {
JSch jsch = new JSch();
Session session = jsch.getSession(username, hostname, 22);
session.setPassword(password);
// Avoid asking for key confirmation
Properties prop = new Properties();
prop.put("StrictHostKeyChecking", "no");
session.setConfig(prop);
session.connect();
// SSH Channel
ChannelExec channelssh = (ChannelExec)
session.openChannel("exec");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
channelssh.setOutputStream(baos);
// Execute command
channelssh.setCommand("touch z.txt");
channelssh.connect();
channelssh.disconnect();
return baos.toString();
}
Button add;
String str;
TextView tv;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
add=(Button)findViewById(R.id.button1);
tv=(TextView)findViewById(R.id.textView1);
add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
try {
str=executeRemoteCommand("root","pass","http://kkkk.nnn.org",22);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tv.setText(str);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
</code></pre>
|
java android
|
[1, 4]
|
2,629,131 | 2,629,132 |
jquery: how to find an element which is comming 2 elements before current element
|
<p>i have a markup which look like this:</p>
<pre><code><h3>Paragraf3-dummytext</h3>
<p>
<a name="paragraf3">
Quisque id odio. Praesent venenatis metus at tortor pulvinar varius. Lorem ipsum dolor sit
</a>
</p>
</code></pre>
<p>what i want to do is to find all 'a' tags with 'name' attribute and find the 'h3' tag for that anchor; im trying to do it like this:</p>
<pre><code>var paragraf = [];
var paragrafheading = [];
$('a[name]').each(function() {
paragraf.push($(this).attr('name'));
paragrafheading.push($(this).prev().text());
</code></pre>
<p>but it does not work becouse there is a 'p' tag around the text. Any suggestions would be appreciated. Thanks</p>
|
c# javascript jquery
|
[0, 3, 5]
|
489,359 | 489,360 |
How to store and reload a dynamic form via cookies?
|
<p>I have a form that the user can add rows to. When that form is submitted I need to store those values in cookies so I can reload the form when the page refreshes or the user leaves the site and returns. I've already got the form being built from javascript and am looking for some sort of js or php tool that will automatically store and reload forms, including dya=namic generation of forms.</p>
<p>Thanks!</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,661,133 | 4,661,134 |
Getting previous element of given in dom model
|
<p>I have list of elements on my page</p>
<pre><code>input
input
span
input
span
etc
</code></pre>
<p>I want to select each input that sits before each span, and after do, whatever i will have to. Is there any available ways to do that?</p>
|
javascript jquery
|
[3, 5]
|
4,421,510 | 4,421,511 |
Can someone help me add some dynamic info into my calendar
|
<p>First of all I want to say in advance that I truly appreciate anything that anyone can contribute to my question. I have a calendar and it has the ability to show events through jquery, but how can I place info from a database into this piece of code dynamically. I know php and fairly well, but I am not sure how to add the arrays through php. This is how it will be input into the calendar with it's available options.</p>
<pre><code>events: [
{
title: 'All Day Event',
start: new Date(y, m, 1)
},
{
title: 'Long Event',
start: new Date(y, m, d-5),
end: new Date(y, m, d-2)
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d-3, 16, 0),
allDay: false
},
{
id: 999,
title: 'Repeating Event',
start: new Date(y, m, d+4, 16, 0),
allDay: false
},
{
title: 'Meeting',
start: new Date(y, m, d, 10, 30),
allDay: false
},
{
title: 'Lunch',
start: new Date(y, m, d, 12, 0),
end: new Date(y, m, d, 14, 0),
allDay: false
},
{
title: 'Birthday Party',
start: new Date(y, m, d+1, 19, 0),
end: new Date(y, m, d+1, 22, 30),
allDay: false
},
{
title: 'Click for Google',
start: new Date(y, m, 28),
end: new Date(y, m, 29),
url: 'http://google.com/'
}
</code></pre>
<p>Again, I just want to say thank you for your help. All comments, whether logical or practical are greatly appreciated.</p>
|
php jquery
|
[2, 5]
|
4,294,889 | 4,294,890 |
JQuery: If a custom class contains a number greater than 'x' add CSS code
|
<p>I would like to add css to a assigned span class if it contains a number higher than 55, also this must on a page load and not a button trigger. </p>
<p>Thanks any help would be great. </p>
<p>Example below: (currently not working) </p>
<pre><code><span class="subTotalPrice">10</span>
<span class="subTotalPrice">5</span>
<span class="subTotalPrice">125</span>
<span class="subTotalPrice">55</span>
<script>
$(".subTotalPrice:contains(> 55)").css({'color':'red', 'text-decoration':'underline'});
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,720,673 | 5,720,674 |
how to set adapter for spinner
|
<p>how to set adapter to spinner if i have <code>ArrayList<HashMap<String, String>></code> coursesList
that contine information that i will display it</p>
<p>what is the correct type of adapter that i should use </p>
|
java android
|
[1, 4]
|
624,621 | 624,622 |
jQuery click.modalEvent
|
<p>Revising code of jQuery.reveal plugin (http://www.zurb.com/playground/reveal-modal-plugin) and trying to understand how it handles the modal behaviour, I see that it binds the closeModal function (that closes the popup) to the event <code>'click.modalEvent'</code>.</p>
<p>But I can't find any information about this event, I don't know if it belongs to javascript itself or if it's part of jQuery</p>
|
javascript jquery
|
[3, 5]
|
4,485,910 | 4,485,911 |
How to show multiple text fields on button click one by one
|
<p>I need to add 2-3 text fields on button click one by one, where 'L' is the ID of the textfield. I am trying this code, but instead of using jQuery I want to use simple javascript because I am implementing this code in a Joomla environment.</p>
<pre><code>function WrapperScript () {
JQuery('#wrapper1 button').click(function(){
for (var i=1;i<=4;i++)
{
var id='#L'+i;
var setting = JQuery(id).css('display');
if (setting=='none')
{
JQuery(id).css('display', 'block');
break;
}
}
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,455,914 | 2,455,915 |
printing binary tree in php based website
|
<p>I'm making a php+mysql based website and i need to draw a binary tree. Through googling i came to know that jquery is good for this. actually i am completelly unaware of jquery. so should i go for "jquery"? Any suggestion..</p>
|
php jquery
|
[2, 5]
|
1,413,844 | 1,413,845 |
how to use OnItemLongClickListener without setOnItemLongClickListener in Android?
|
<p>I am trying to use OnItemLongClickListener for a listView on Android. This code works fine when added to onCreate method.</p>
<pre><code>mContactList.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.e("MyApp", "get onItem Click position= " + position);
return false;
}
});
</code></pre>
<p>However when I try to implement OnItemLongClickListener interface and use this method in the class:</p>
<pre><code>@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.e("MyApp", "get onItem Click position= " + position);
return false;
}
</code></pre>
<p>nothing happens. What am I missing?</p>
|
java android
|
[1, 4]
|
2,362,324 | 2,362,325 |
Listview with multiple strings
|
<p>I am trying to create a Listview with multiple strings. </p>
<p>Right now I have a function that it will do</p>
<pre><code> while(i <= 10){
//GETS DATA FROM WEBPAGE ETC
a = DATAFROMWEBPAGE1;
b = DATAFROMWEBPAGE2;
c = DATAFROMWEBPAGE3
}
</code></pre>
<p>10 times with 10 different sections from the webpage and I wanted to put this in a list view with 3 textviews showing a, b, c. But I'm having a very hard time doing so.</p>
|
java android
|
[1, 4]
|
2,035,287 | 2,035,288 |
About good practices for creating and appending elements with JS
|
<p><strong>Example code</strong> </p>
<pre><code>var jqxhr=$.getJSON("http://search.twitter.com/search.json?callback=?",{q:query},
function(data) {
... question.
});
</code></pre>
<p><strong>Question</strong></p>
<p>Now i need to create for each tweet result something like this (for example...)</p>
<pre><code><article class="tweet">
<header>
<img class ="tweet_img"src="data.profile_image_url"/>
</header>
<p class="tweet-text">data.text</p>
</article>
</code></pre>
<p>Well, i know several ways to append each result to the document:</p>
<ol>
<li>Creating a big HTML string and add the data from <strong>JSONP</strong> and append this to some container. </li>
<li>Create a p element, a header element... work with them and after that append a final Element to some container.</li>
</ol>
<p>Now the question is: with your experience what is the correct way to do this?<br>
I mean the correct way using good principles. </p>
<p>Please dont ask about the html, it's dumb example.<br>
Thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,784,478 | 2,784,479 |
How to overwrite JQuery plugin function?
|
<p>How to overwrite a function which is from a JQuery plugin? I am trying to overwrite a function in csv2table plugin called mkTable() in my own javascript file. Is it possible? Here is the original definition:</p>
<pre><code>$.fn.csv2table= function(url,setting) {
function mkTable(id,rowsAry){
...
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,519,170 | 4,519,171 |
jquery / javascript - listen for change in window orientation mode on mobile devices
|
<p>I'm wondering if there's some sort of cross-device method of listening for orientation mode changes on mobile devices with jquery / javascript?</p>
|
javascript jquery
|
[3, 5]
|
3,696,512 | 3,696,513 |
Common techniques of cleaning memory in jquery
|
<p>I'm trying to debug some code that another developer wrote in jquery since page loads really slow and crashes the browser.
I need an advice how to test , debug big amounts of jquery code.
Need some good techniques in memory cleanup in point of view of existing code written by somebody else.
All the suggestions , tools , relevant links will be greatly appreciated.
I'm using firebug to debug the code.</p>
<p>Thanks for your time. </p>
|
javascript jquery
|
[3, 5]
|
6,019,871 | 6,019,872 |
jQuery post data return comparison not working
|
<p>I have this bit of code:</p>
<pre><code>function addEmail() {
email = $("#email").val();
atime = $("select#time").val();
tid = <?= $tid; ?>;
$.post("remindme.php", { email: email, time: atime, tid: tid },
function(data) {
if (data == "x") {
alert(data);
$('#remindme').modal('hide');
$('#quota').show();
}
else {
alert(data);
$('#remindme').modal('hide');
$('#remindersuccess').show();
}
});
}
</code></pre>
<p><code>remindme.php</code> echo's "x" if something is wrong.</p>
<p>I'm trying to compare the output from remindme.php but even though it echo's the x, the condition <code>data == "x"</code> does not work.</p>
<p>I added <code>alert(data)</code> and I can see it properly displaying the <code>x</code> when needed..</p>
|
javascript jquery
|
[3, 5]
|
1,727,511 | 1,727,512 |
PHP's 'gzuncompress' function in C#?
|
<p>PHP's 'gzuncompress' function in C#?
Is there a function similar to PHPs gzuncompress in C#? </p>
|
c# php
|
[0, 2]
|
4,039,599 | 4,039,600 |
Trouble with multiple age counters (timers)
|
<p>I have a page where I want to have "age counters" for bids put in by users. The number of users will vary from situation to situation, so that needs to be taken into consideration. I wrote this:</p>
<pre><code>function timer(i) {
// this selects a 'hh:mm:ss' timestamp
if ($("#time_0" + i).text() !== "") {
var now = new Date();
var date = now.toDateString();
var tStamp = new Date(date + "," + $("#time_0" + i).text());
var diff = now - tStamp;
var mins = Math.floor(diff / (1000 * 60));
var secs = Math.floor((diff / 1000) % 60);
if (mins < 10) {
mins = "0" + mins;
}
if (secs < 10) {
secs = "0" + secs;
} else if (secs == 60) {
secs = "00";
}
$("#user" + i + "-t").text(mins + ':' + secs);
}
}
$(document).ready(function() {
//
var ids = [];
$("td[id^='time_0']").each(function() {
var i = ($(this).attr("id")).slice(-1);
ids.push(i);
});
for (i in ids) { // in my example ids = [1,2,3]
setInterval(function() {timer(i);}, 1000);
}
});
</code></pre>
<p>The timer itself functions just as I want it to, but only for user #2 (the middle one). I thought that if I encountered this problem, it would be either the first or last user in the list that had a working timer, but I'm getting blank cells for users #1 and #3.</p>
<p>Does anyone have any ideas as to how I can fix this? Thank you for your time.</p>
<p>==Edit==</p>
<p>I made a bare-bones <a href="http://jsfiddle.net/UQZTt/2/" rel="nofollow">jsfiddle</a></p>
|
javascript jquery
|
[3, 5]
|
695,037 | 695,038 |
ajax jsonp request 503 response
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4778363/display-jquery-ajax-503-error-response">Display jQuery $.ajax 503 error response</a> </p>
</blockquote>
<p>I am making a call to an api which is a bit temoermental. Alot of the time it is responding with a 503. My problem is that when this happens it none of the functions (complete, error, success) are triggered. I am looking for a way to log this in my code. Any ideas greatly appreciated</p>
<pre><code> $.ajax ({
url : engine.getQuery(),
dataType : 'jsonp',
success : entErrorFunction,
complete : entErrorFunction,
error : entErrorFunction
});
var entErrorFunction = function(){
console.log('test2');
};
</code></pre>
|
javascript jquery
|
[3, 5]
|
671,510 | 671,511 |
How to convert string to sentence case in jQuery or C#?
|
<p>How can i convert a string to a sentence case? I don't wanna convert to title case. My requirement is to convert the string to sentence case.</p>
|
c# javascript jquery
|
[0, 3, 5]
|
5,203,650 | 5,203,651 |
Is enabling JavaScript in browser a MUST to get working ASP.NET pages?
|
<p>This is a newbie question (I'm sure it is). I have tried for the first time in a little ASP.NET web application I am working on what happens if I disable Javascript in a browser (I'm testing mainly with Firefox). </p>
<p>Result: My application is completely broken, although I didn't ever write any single line of Javascript.</p>
<p>For instance: I have a link button on a page from a LoginStatus control. Looking at the generated HTML code in my browser I see this:</p>
<pre><code><a id="ctl00_ctl00_LoginStatus" href="javascript:__doPostBack('ctl00$ctl00$LoginStatus$ctl02','')">Login</a>
</code></pre>
<p>Similar with some link buttons in a ListView control which allow to sort the list by certain data fields: The <code>href</code> of the generated anchor tag contains this: <code>javascript:WebForm_DoPostBackWithOptions(...)</code>.</p>
<p>So clicking on "Login" or trying to sort does not work without having Javascript enabled.</p>
<p>Does this mean: With disabled Javascript in the browser ASP.NET applications won't work properly? Or what do I have to do to get the application working with disabled Javascript? </p>
<p>Thanks for your feedback!</p>
|
asp.net javascript
|
[9, 3]
|
2,752,277 | 2,752,278 |
Android: How Reliable is InputStream.read() and its "-1" return?
|
<p>My question is related to a method <strong>InputStream.read()</strong> - socket programming.</p>
<p>Every source i have found states that when the server or client closes the connection, "-1" is returned.</p>
<p>But, "what if", just saying, "what if" the connection <em>is</em> closed but <strong>read()</strong> does not return "-1"? We rely on someone else's code. The reason i am worried is because in order to read the remote end's input, one will have to create an infinite loop and I have always been thought to stay away from infinite loops. With Java however, it looks like I do not have a choice! Here is a sample:</p>
<pre><code>int b = 0;
while (true)
{
b = inputStream.read()
if (b == -1) break; // connection closed
}
</code></pre>
<p>or </p>
<pre><code> while (b > -1)
b = inputStream.read()
</code></pre>
<p>What <em>if</em> something happens, and -1 never becomes true? One will end up in an infinite loop increasing the temperature of someone's device and wasting CPU cycles! How can one be certain? </p>
<p>References: [http://developer.android.com/reference/java/io/InputStream.html#read%28%29][1] and [http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html#read%28byte[],%20int,%20int%29][2] </p>
<p>I want to have a fail-safe check. What I have done in the loop is also do a check whether socket has become null and if so, break the loop.</p>
<pre><code> while (b > -1)
{
b = inputStream.read()
if (socket == null) break;
if (outputStream == null) break;
}
</code></pre>
<p>What else can I do to ensure the loop exists in case "-1" never becomes true?</p>
|
java android
|
[1, 4]
|
1,740,762 | 1,740,763 |
print from HTML to receipt printer using Jquery/php
|
<p>I have a small tool for address collection. I want to print a particular address through my Thermal Printer. Database is MySQL..I do an AJAX query to list down all the addresses I want to search based on a particular requirement (for ex mobile number). Coding is in PhP and JQuery. I list them down as a table. Now I want to add a print button next to all individual address rows, on clicking of which, I want to print that particular address in my receipt printer. </p>
<p>Its just gonna be 2 lines of printing. If I simply copy the address to a new HTML page and print it, the problem is that printer doesnt stop just after 2 lines..it prints the entire white space below. </p>
<p>Sorry but have never done or worked on Printers before. Please can some one help me with this. </p>
|
php jquery
|
[2, 5]
|
3,924,509 | 3,924,510 |
What would be the jquery equivalent of 'Dive into python'?
|
<p>I need to , well, dive into client side programming. Is there an equivalent to 'Dive into python' for jquery?</p>
<p>I see that jquery 1.4 has been released. Does this change anything w.r.t answers?</p>
|
javascript jquery python
|
[3, 5, 7]
|
4,211,269 | 4,211,270 |
ASP.net download page
|
<p>I have a Reports.aspx ASP.NET page that allows users to download excel report files by clicking on several hyperlinks. When a report hyperlink is clicked, I open a new window using the javascript window.open method and navigate off to the download.aspx page. The code-behind for the download page creates a excel file on the fly using openxml(in memory) and send it back to the browser. Here is some code from the download.aspx page:</p>
<pre><code> byte[] outputFileBytes = CreateExcelReport().ToArray();
Response.Clear();
Response.BufferOutput = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", "tempReport.xlsx"));
Response.BinaryWrite(outputFileBytes);
Response.Flush();
Response.Close();
Response.End();
</code></pre>
<p>My problem : Some of these reports take some time to generate. I would like to display a loading.gif file on my Reports.aspx page, while the download.aspx page is requested. Once the page request is completed, the loading.gif file should be made invisible.</p>
<p>Is there a way to achieve this. Perhaps some kind of event. I have mootools to my disposal.</p>
<p>Thanks</p>
<p>PS. I know that generating reports like this is not ideal, but thats a different story all together...</p>
|
asp.net javascript
|
[9, 3]
|
499,212 | 499,213 |
Validator inside Server control
|
<p>I have a server control that inherits from TableRow and INamingContainer.
I override the CreateChildControls and add three cells, in the first one I put a label, in the second one I put a textbox (lets call it A) with autopostback true and causevalidation true, a required validator and a range validator, in the third one another label.
Additionally, I have another textbox (B) with autopostback true and cause validation true, but in the webform, not in the server control.</p>
<p>When I write a <em>valid</em> value in the textbox A, the postback occurs but the rangevalidator is displayed. If after that, I change the value of the textbox B, the rangevalidator of the textbox A is not displayed and everything works as I expect.</p>
<p>What is wrong?</p>
|
c# asp.net
|
[0, 9]
|
2,045,469 | 2,045,470 |
Asp. net and Javascript pop up windows
|
<p>I am writing an intranet application and am considering the use of a pop up window. What are your thoughts on it?
I am not worried about accessibility since it's an intranet app. </p>
<p>The scenario is such as I need to be able to have the same code be used in a server page as well as in the middle of a process; which is why I decided when using it in the middle of the process, it's best to have it as a pop up window to running out of the real estate on the screen.</p>
<p>Any thoughts on this? I am hesitant to use a pop up window in such a manner as I usually only use it for error messages.
Thanks in advance.</p>
|
asp.net javascript
|
[9, 3]
|
463,726 | 463,727 |
Targetting dynamic text inside paragraph
|
<p>I have some contact information, in which I wish to wrap the telephone number in a <code><a></code>, with the number in the href, for smartphone support.</p>
<p>The initial markup:</p>
<pre><code><p class="myClass">
<a href="mailto:[email protected]">[email protected]</a><br />
Phone: 88 88 88 88<br />
Fax: 88 88 88 87<br />
</p>
</code></pre>
<p>Now, the markup will remain the same, however the numbers and addresses will change. Therefore, my first idea was to start an anchor after "Phone", and close it before the second break tag, then get that value and stick it in the href. Sadly, it doesn't work that way, as the tag is closed immediately.</p>
<pre><code>$("p.myClass:contains('Phone')").each(function(){
var org = "Phone: ";
var rep = "Phone: <a>";
$(this).html( $(this).html().replace(org, rep) );
$("</a>").insertBefore("p.myClass:contains('Phone') br:nth-child(3)");
});
</code></pre>
<p>So what I really want to end up with, is to have the phone number wrapped, like so:</p>
<p><code>Phone: <a href="tel:{number}">{number}</a></code></p>
<p>,where {number} is a dynamic value, and the rest of the markup remains the same. I'm looking for a solution that actually works, and which preferably cleaner than the mess I made above. :) Any ideas?</p>
|
javascript jquery
|
[3, 5]
|
2,136,093 | 2,136,094 |
Variable scope issue with javascript function
|
<p>I am trying to create a function with spin.js. The function loads the spinner, then if it is called again with it argument, then it stops the spinner. I can't get the variable scope right. So when I call the function to stop, I get an undefined on the <code>submitSpinner</code>.</p>
<p><a href="http://jsfiddle.net/atlchris/tQdZB/1/" rel="nofollow">http://jsfiddle.net/atlchris/tQdZB/1/</a></p>
<pre><code>function submitSpinner(stopSpinner) {
var theSubmitSpinner;
if (stopSpinner === true) {
theSubmitSpinner.stop();
$('#overlay').remove();
}
else {
$('body').append('<div id="overlay"><div id="spinner"></div></div>');
theSubmitSpinner = new Spinner({
lines: 13,
length: 15,
width: 5,
radius: 20,
color: '#ffffff',
speed: 1,
trail: 60,
shadow: false
}).spin(document.getElementById("spinner"));
}
}
submitSpinner();
$(function() {
$('#overlay').on('click', function() {
alert('click');
submitSpinner(true);
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,847,758 | 3,847,759 |
Is it possible to turn off the silent mode programmatically in android?
|
<p>Is it possible to turn off the silent mode programmatically in android?</p>
<p>A simple code can be very helpful. :)</p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
5,923,985 | 5,923,986 |
form_custom_elements.js error after dynamically loaded page
|
<p>We have some issues with form_custom_elements.js.
Part of the page is loaded dynamically through ajax and onclick event. All works good, but after clicking on next button, the JS apears: </p>
<p><strong>TypeError: inputs[b].previousSibling.style is undefined</strong> </p>
<p>and checkboxes we have on the page are missing, thus I assume, that the JS is not recognized.</p>
<pre><code>$('.next a, .prev a').live('click', function(){
var parameters = '';
var params = folder_id;
var page = $(this).attr('href');
parameters = {params:params,page:page};
$.ajax({
type: "POST",
url: url,
data: parameters,
dataType: "json",
success: function(data) {
if(data.success == 'yes'){
$('.content').load('file.php', {imapEmails:data.emails});
}
else{
alert('no');
}
}
});
return false;
});
</code></pre>
<p>file.php it is a div (thus doesn't have a 'head' section, where we call custom_form_elements.js, something like that, much more complicated, but just to show you:</p>
<pre><code><div id='content-inner'>
<input type="checkbox" name="a_checkbox" class="styled" />
this is a part of the page loaded
</div>
</code></pre>
<p>FYI: if the JS file is working properly, a span tag is dynamically appended to the input:</p>
<pre><code><div id='content-inner'>
<span class='checkbox'></span>
<input type="checkbox" name="a_checkbox" class="styled" />
this is a part of the page loaded
</div>
</code></pre>
<p>how to solve this JS error and make page work properly? I tried to call Custom.init on div load, but it does not work.</p>
|
php jquery
|
[2, 5]
|
819,214 | 819,215 |
Append a jQuery element to a string that contains html
|
<p>I have a jQuery wrapped element which I would like to append to a html row. I can't wrap my head around this, since append() seemingly accepts strings but not existing jQuery elements (I might be mistaken here).
I have a following setup:</p>
<pre><code>var row='<tr><td>data1</td><td>data2</td><td>';
var img=$('<img src="path/to/img.png"');
img.click(myClickHandler);
</code></pre>
<p>Now what I'm trying to do is to append this img element to my row and 'close' the row with a closing tag.
I'm doing it as follows:</p>
<pre><code>var jRow=$(row);
jRow.append(img);
jRow.append('</td></tr>');
</code></pre>
<p>After my row is ready I append it to my table:</p>
<pre><code>$('#tableId').append(jRow);
</code></pre>
<p>Well, all above doesn't work, because I get [Object Object] instead of image tag in my added row.</p>
<p>My goal is to have a row with an image in last cell and a working click handler.</p>
<p>Pleease, help.</p>
|
javascript jquery
|
[3, 5]
|
4,920,453 | 4,920,454 |
.show elements and .hide elements
|
<p>I've got this problem :</p>
<ul>
<li>I have got 6 "outer" div's each have a img tag inside.</li>
<li>Following each 6 div's are another div with content for each 6 divs</li>
</ul>
<p>I want when i click one "outer" div hide all outer div's and show me the next div content.</p>
<p>This is the function. Wich it works there <a href="http://jsfiddle.net/Weinz/jdFRw/4/" rel="nofollow">http://jsfiddle.net/Weinz/jdFRw/4/</a> </p>
<p>But on test site only hide .outerDiv doesn't show next .innerDiv</p>
<pre><code>$(function() {
$(".outerDiv").click(function() {
$(".outerDiv").hide();
$(".innerDiv").hide();
$(this).next("div").show();
});
$(".innerDiv").click(function() {
$(".outerDiv").show();
$(".innerDiv").hide();
});
});
</code></pre>
<p>The real html code is this </p>
<pre><code><div class="block outerDiv"><a href="#"><img src="images/placeholder.jpg" width="165" height="74" alt="Temp" /></a></div>
<div class="container innerDiv" style="display:none;">
</code></pre>
<p>I think the problem is on .next but i try diferent options and nothing work.</p>
<p>If i don't set the display in the innerDiv it works...</p>
|
javascript jquery
|
[3, 5]
|
3,173,191 | 3,173,192 |
selecting multiple rows using shift key using jquery
|
<p>I tried doing selecting multiple rows using jquery but this code look like cranky.</p>
<p>some more code added to above one.using shift + up arrow or down arrow using key board.</p>
<pre><code>c
</code></pre>
<p>where am i going wrong?</p>
|
javascript jquery
|
[3, 5]
|
2,447,850 | 2,447,851 |
Know of a good way to clean a string in .net to be used in Javascript?
|
<p>I am creating a javascript confirm message in my asp.net code:</p>
<pre><code>deleteButton.Attributes.Add("onclick", "javascript:return confirm('Are you sure you want to delete client " + clientName + "')");
</code></pre>
<p>The problem here is that the client name can have apostrophes and other problematic characters.</p>
<p>Does anyone know a <i>good, simple</i> way to clean the variable "clientName" so that I can safely use it in the javascript?</p>
<p>Thanks!</p>
|
asp.net javascript
|
[9, 3]
|
2,696,348 | 2,696,349 |
jQuery/Javascript Invalid left-hand side in assignment
|
<p>I am using this relatively simple code:</p>
<pre><code>var height = help ? 'minus' : 'plus';
var prop = $('#properties');
if(height == 'minus'){
prop.height(prop.height() -= 206);
} else {
prop.height(prop.height() += 206);
}
</code></pre>
<p>It fails on both lines that do the adding/subtracting! Any ideas?</p>
|
javascript jquery
|
[3, 5]
|
5,454,035 | 5,454,036 |
ERROR deleting item from database using confirm box
|
<p>I have the following code which retrieves items from my DB and displays them in a table. The file is manage-products.php.</p>
<pre><code>while($row = mysql_fetch_row($result)){
echo '</tr>';
echo ' <td class="product"><a href="manage-products-2.php">'.$row[1].'</a></td>';
echo'<td class="quantity">'.$row[5].'</td>';
echo '<td class="item_price">'.$row[4].'</td>';
echo '<td class="item_total">'.$row[6].'</td>';
echo '<td class="item_unsold"><a href = "manage-products.php?prod = '.$row[0].'" style="color:red">Delete</a></td>';//to delete an item
echo '</tr>';
}
</code></pre>
<p>I have the following code (which should be executed) when the DELETE link is clicked (also in manage-products.php)</p>
<pre><code>$prodid = $_GET['prod'];
if($prodid != ""){
echo '<script type="text/javascript">
var r = window.confirm("Are you sure you want to delete this product") ;
if(r == true){
$ . post ( "manage-products.php" , { result : r });
}
</script>';
$delete = $_POST['result'];
if($delete == true){
$SQL1 = "DELETE FROM tbl_product WHERE id = '$prodid'";
$result1 = mysql_query($SQL1);
}
}
</code></pre>
<p>When i click delete it says undefined index:prod. Please where is my error. Thanks</p>
|
php javascript
|
[2, 3]
|
2,012,873 | 2,012,874 |
jQuery Check if String Contains Word
|
<p>I'm working on an application where you can click on user names to add them to the reply list.
If the username is already added, it doesn't add their username again.
The problem I'm having is that if the user @assassin is added, and I try to add the user @ass, it finds @ass-assin and thinks that @ass is already added.
Here's my code:</p>
<pre><code>$('#mentions a.mention_user').live('click', function(e){if($('textarea#message').val().toLowerCase().search('@'+$(this).text().toLowerCase()) < 0){
$('textarea#message').val('@'+$(this).text()+' '+$('textarea#message').val());
}
e.preventDefault();
});
</code></pre>
<p>Thanks in advance!</p>
<p>EDIT: The text it'll be matching the usernames against will look similar to this: @user @joe @adam this is a message @someone</p>
|
javascript jquery
|
[3, 5]
|
791,785 | 791,786 |
Android rotate viewgroup with childs
|
<p>i have some serious problems understanding some basics of the android view hierarchy.
I have a <code>ViewGroup</code> that is bigger than the screen and overlaps the screen on all for sides. This <code>ViewGroup</code> has some <code>ChildViews/SubViews</code>, e.g. <code>Buttons</code>. Now, i want to rotate the entire <code>ViewGroup</code> with its SubViews about the middle point.</p>
<p>In iOS I simple can take a <code>UIView</code>, put some subviews on it and make an affine transform of the superview. With that, the super view and all its subviews rotate about the middle point.</p>
<p>Is there a similar way in Android?</p>
<p>I draw a little <a href="http://s1.directupload.net/images/130425/xcfncook.png" rel="nofollow">image</a> to show you my problem ;-)</p>
|
java android
|
[1, 4]
|
4,375,691 | 4,375,692 |
Find the ID of the window which generates alerts
|
<p>Is there a way to find out the id of the IE window that generates alert boxes? I assume it is the document or window itself.</p>
<p>Either simple html or jQuery can be used.</p>
<p>I tried something like:</p>
<pre><code>var id = $(this).parent().attr('id');
</code></pre>
<p>but to no avail.</p>
<p>Ultimately I want to find out the ID of the window/document which generates javascript alerts so I can override it.</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
4,666,002 | 4,666,003 |
Is it possible to find distance from bottom to cuirrent scroll state in jquery
|
<p>SUpoose i am in the middle of page length.</p>
<p>Is it possible to find , how much more distance in length or pixels from bottom.</p>
<p>Like when scroll bar hits the bottom then its 0 but if it 500px from the bottom then i need that 500px value.</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
3,502,604 | 3,502,605 |
How do I reference an element by name with [] brackets in it?
|
<p>How do you reference a element in jquery BY NAME that has the [] in it.</p>
<pre><code><select name="values[]" multiple="true">
<option value="1">1</option>
<option value="2">2</option>
<option value="2">2</option>
</select>
<script type="text/javascript">
$('[name=values[]]');
</script>
</code></pre>
<p>this should grab the element, but it does not work, I believe the [] in the name is messing it up, escaping it doesn't seem to work either. I can't figure out what I'm doing wrong</p>
|
javascript jquery
|
[3, 5]
|
2,978,138 | 2,978,139 |
Set selected value for dropdown based on the display value in jquery/javascript
|
<p>Does anyone know how can I set the selected value for dropdown based on the display value in jquery/javascript </p>
<p>Example:</p>
<pre><code><select id='test'>
<option value='sgf'>One</option>
<option value='sdf'>Two</option>
<option value='gfr'>Three</option>
<option value='dfg'>Four</option>
</select>
</code></pre>
<p>How Can I set the selected to value based on the display value? Let say, I want to set the selected when display value is 'Three'</p>
|
javascript jquery
|
[3, 5]
|
2,294,173 | 2,294,174 |
How to close a pop up window using the anchor's OnClick in javascript?
|
<p>I have a php page that opens a pop window. it contains the search results. each result is inside the anchor tags. </p>
<p>I can open a new tab containing the information in the parent window, but somehow the <code>OnClick</code> function does not work. what i want to do is when the user select a link, will open a new tab then the pop up window automatically close. I dont know why the <code>OnClick</code> event is not doing what I want. </p>
<pre><code><?php
<a href='edit.php?id=$id' target='_blank' onClick='self.close();'>Listq</a>
?>
</code></pre>
<p>the code above works but it closes the pop up before opening the <strong>new tab</strong>. please help. thanks. </p>
|
php javascript
|
[2, 3]
|
3,935,885 | 3,935,886 |
how to use a javascript many time on a page?
|
<pre><code><script type="text/javascript">
$(function() {
var newYear = document.getElementById('HF');
alert('hehe' + newYear);
$('#countdown').countdown({ until: newYear, format: 'DHMS', layout:
'<div id="timer">' + '<hr />' +
'<div id="timer_days" class="timer_numbers">{dnn}</div>' +
'<div id="timer_hours" class="timer_numbers">{hnn}</div>' +
'<div id="timer_mins" class="timer_numbers">{mnn}</div>' +
'<div id="timer_seconds" class="timer_numbers">{snn}</div>' +
'<div id="timer_labels">' +
'<div id="timer_days_label" class="timer_labels">days</div>' +
'<div id="timer_hours_label" class="timer_labels">hours</div>' +
'<div id="timer_mins_label" class="timer_labels">mins</div>' +
'<div id="timer_seconds_label" class="timer_labels">secs</div>' +
'</div>' +
'</div>'
});
});
</script>
</code></pre>
<p>How can i use this script many times on the page???I have three <code>listViews</code> ont the page so i want to use it 3 times??how can i do that??</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
4,364,181 | 4,364,182 |
android.view.InflateException: Binary XML file line #4: Error inflating class SwitchPreference
|
<p>I'm trying to read my app preferences and I get this error:</p>
<p>Settings activity:</p>
<pre><code>public class Settings extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
try
{
addPreferencesFromResource(R.xml.prefs);
}
catch (Exception ex)
{
Log.e("errorSettings", Log.getStackTraceString(ex));
}
}
}
</code></pre>
<p>Preferences XML File:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<PreferenceCategory android:title="General">
<SwitchPreference
android:title="Downloader"
android:defaultValue="true"
android:key="useDownloader"
android:summary="Enable to use" />
</PreferenceCategory>
</PreferenceScreen>
</code></pre>
<p>and on the application manifest I set this:</p>
<pre><code><uses-sdk android:minSdkVersion="9" android:targetSdkVersion="15" />
</code></pre>
<p>and the first error I get is:</p>
<pre><code>android.view.InflateException: Binary XML file line #4: Error inflating class SwitchPreference
</code></pre>
<p>Thanx upfront.</p>
|
java android
|
[1, 4]
|
5,589,073 | 5,589,074 |
'or' statement in function call
|
<p>In a file I am looking at, I saw a <code>||</code> statement in a javascript function call what does it mean? </p>
<pre><code>createObject(a_variable || b_variable)
</code></pre>
<p>Does the function take in a true/false value or it take in something else?</p>
<p>is the above code equivalent to </p>
<pre><code>createanotherObject(a_variable ? a_variable : b_variable)
</code></pre>
<p>Which I saw right next to it.</p>
|
javascript jquery
|
[3, 5]
|
911,970 | 911,971 |
get unique elements count jquery
|
<p>I have the following HTML</p>
<pre><code><input type="hidden" name="product_id" value = "1" class="product_id" />
<input type="hidden" name="product_id" value = "2" class="product_id" />
<input type="hidden" name="product_id" value = "5" class="product_id" />
<input type="hidden" name="product_id" value = "1" class="product_id" />
<input type="hidden" name="product_id" value = "2" class="product_id" />
<input type="hidden" name="product_id" value = "2" class="product_id" />
</code></pre>
<p>How can i get the <code>count</code> of <code>Unique</code> elements (Unique Value of elements) ?</p>
<p>Is this possible <code>without looping</code> ?</p>
<p>Expected Result :</p>
<pre><code>UNIQUE ID COUNT
-----------------
1 2
2 3
5 1
</code></pre>
<blockquote>
<p>What i have tried is something like below, But the problem with this
approach is that it will loop all the elements.As you can see that on
first iteration we can understand the count of <code>product_id</code> of <code>1</code>, So it need to skip any other elements with same <code>product_id</code>. I
have bunch of elements and i will not prefer looping all the elements.</p>
</blockquote>
<pre><code>$(".product_id").each( function(){
//CHECK THE COUNT AND SAVE IT TO SOME ARRAY
});
</code></pre>
<p>Update :</p>
<blockquote>
<p>Its Okay to downvote, But it will be very helpful if you put a comment
for that down vote. I specifically stated <code>without</code> looping because i
though that sometime it may possible with jQuery's powerfull CSS
selectors.</p>
</blockquote>
|
javascript jquery
|
[3, 5]
|
5,865,502 | 5,865,503 |
Javascript - Set date 30 days from now
|
<p>I need to set a date that would be 30 days from now taking into account months that are 28,29,30,31 days so it doesn't skip any days and shows exactly 30 days from now. How can I do that?</p>
|
javascript jquery
|
[3, 5]
|
5,836,110 | 5,836,111 |
jQuery live() failing with UI datepicker
|
<p>I'm using the jQuery UI datepicker and it's absolutely brilliant.</p>
<pre><code>$(document).ready(function() {
/*********************************************************************************************************
Purpose : To show datepicker calender
*********************************************************************************************************/
$('.DatePickerClass').datepicker(
{
showOn: "button",
buttonImage: "../Images/cal.jpg",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
dateFormat:"dd/mm/yy"
});
});
<asp:TextBox runat="server" CssClass="textbox DatePickerClass" Width="150" onblur="return CheckDate(this);">
</asp:TextBox>
</code></pre>
<p>How can I bind it with <code>live()</code>?</p>
<p>Any ideas?</p>
<p>I also tried <a href="http://stackoverflow.com/questions/1585918/jquery-live-works-but-not-with-datepicker">Jquery .live works but not with .datepicker</a>.</p>
<p>But since I need image button near text box it is not working as expected for me.</p>
|
jquery asp.net
|
[5, 9]
|
4,247,828 | 4,247,829 |
how I can read text from html textarea in asp.net page?
|
<p>I set html textarea in asp.net page with out runat="server" and I need set the text in string variable by C# in code behind </p>
|
c# asp.net
|
[0, 9]
|
4,009,276 | 4,009,277 |
how to get client ip address using asp.net header files?
|
<p>Can any one help me!!! It is an urgent task, Which i need to submit today.</p>
<p>how to get client ip address using asp.net header files? </p>
<p>Thanks in Advance.</p>
<p>Your's
PRK</p>
|
c# asp.net
|
[0, 9]
|
4,899,705 | 4,899,706 |
how to save the state of a page after F5
|
<p>How can I save the state of a page after to press F5.(with php or javascript)</p>
<p>I have this page, which if I I press the button 1, div 1 disappears, and if you press the div 1 again, it reappears.
the button 2 has the same function.
is there any way that if I press button 1(or button2) disappears the div, and then if I press F5 continue the div1(or div2) hidden, ??</p>
<pre><code><input type="submit" id="button1" name="button1" value="ID1"><br/>
<div id="div1" name="div1"/>
<b>Hello1</b><br>
<img src="pic1.png" height="100px" width="100px" />
</div>
<input type="submit" id="button2" name="button2" value="ID2"><br/>
<div id="div2" name="div2"/>
<b>Hello2</b><br>
<img src="pic2.png" height="100px" width="100px" />
</div>
<script>
$(document).ready(function(){
$("#button1").toggle(function(){
$("#div1").hide();
},
function(){
$("#div1").show();
});
});
//
$(document).ready(function(){
$("#button2").toggle(function(){
$("#div2").hide();
},
function(){
$("#div2").show();
});
});
</script>
</code></pre>
<p>Thanks in Advance</p>
|
php javascript
|
[2, 3]
|
651,203 | 651,204 |
jQuery - setInterval issue
|
<p>I am using jQuery to generate and add a random amount of Clouds to the Header of the page and move them left on the specified interval. Everything is working fine, execpt the interval only runs once for each Cloud and not again. Here is my code:</p>
<pre><code>if(enableClouds) {
var cloudCount = Math.floor(Math.random() * 11); // Random Number between 1 & 10
for(cnt = 0; cnt < cloudCount; cnt++) {
var cloudNumber = Math.floor(Math.random() * 4);
var headerHeight = $('header').height() / 2;
var cloudLeft = Math.floor(Math.random() * docWidth);
var cloudTop = 0;
var thisHeight = 0;
var cloudType = "one";
if(cloudNumber == 2) {
cloudType = "two";
}else if(cloudNumber == 3) {
cloudType = "three";
}
$('header').append('<div id="cloud' + cnt + '" class="cloud ' + cloudType + '"></div>');
thisHeight = $('#cloud' + cnt).height();
headerHeight -= thisHeight;
cloudTop = Math.floor(Math.random() * headerHeight);
$('#cloud' + cnt).css({
'left' : cloudLeft,
'top' : cloudTop
});
setInterval(moveCloud(cnt), 100);
}
function moveCloud(cloud) {
var thisLeft = $('#cloud' + cloud).css('left');
alert(thisLeft);
}
}
</code></pre>
<p>Any help is appreciated!</p>
|
javascript jquery
|
[3, 5]
|
3,592,920 | 3,592,921 |
javascript object problem
|
<p>I am trying to mocking mongodb map-reduce.</p>
<pre><code>function some_function(){
....
call_some (some_object);
....
}
function call_some (some_object){
// In here,
// How could I use this keyword instead of some_object?
// some_object.something => this.something
}
</code></pre>
<p>in javascript or jquery</p>
|
javascript jquery
|
[3, 5]
|
4,042,303 | 4,042,304 |
How to stay within a 'instance' using JQuery
|
<p>I'm currently learning JavaScript/JQuery, but have an issue at work that I'm running into.</p>
<p>I've assigned a class of 'question' to an<code><a></code>tag, and 'answer' to a<code><div></code>. When a user clicks on the question, the answer will slide down. However, the problem I'm running into is that when they click on a <code><a href="#" class="question"></code>, all of the <code><div class="answer"></code>'s are displayed.</p>
<p>How can I make it so that only one .answer for it's parent .question is displayed when clicked?</p>
<p>Here is my HTML:</p>
<pre><code><li class="question"><a href="#">Question 1</a>
<div class="answer"><p>This is answer for question 1</p></div></li>
<li class="question"><a href="#">Question 2</a>
<div class="answer"><p>This is answer for question 2</p></div></li>
</code></pre>
<p>Here is my jquery:</p>
<pre><code><script>
jQuery(document).ready(function ($) {
$('div.answer').hide();
$('li.question').click(function() {
$('div.answer').slideDown('fast');
return false;
});
});
</script>
</code></pre>
<p>and the site is: <a href="http://topactioninvestments.com/faq/" rel="nofollow">http://topactioninvestments.com/faq/</a></p>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
4,355,346 | 4,355,347 |
Online High Scores Solution
|
<p>Can anybody advise solution for implementing online high scores table for iPhone game ?
I mean simple engine to publish player result by http query and view global high scores table.
I'm weak in PHP so trying to find existing solution first.
Thanks.</p>
|
php iphone
|
[2, 8]
|
1,699,716 | 1,699,717 |
move pannel in webform
|
<p>how to move pannel in webform...pls help</p>
|
c# asp.net
|
[0, 9]
|
1,706,232 | 1,706,233 |
Image upload script to start other tasks to free up UI
|
<p>I have an Android application that provides image upload functionality. When a user selects a photo the app initializes a php script on a remote server - while the image is uploading there is a progress dialog giving feedback to the user. The upload script is performed in an AsyncTask.</p>
<p>Currently the php processing script pseudoprocess is:</p>
<pre><code>do some house keeping
upload image
image modifications (thumbnails, rotate)
send out push notifications
exit
</code></pre>
<p>Upon exit, the UI is freed up and the user has access to the uploaded image.</p>
<p>My question is in my script can/should I be doing the image modifications and push notifications outside this script? And if so how? In the Android Java I would start a background task, but is there someway to do this in PHP - and I don't mean by calling another script separately or cron jobbing something.</p>
<p>I mean something like:</p>
<pre><code>do some housekeeping
upload image
php call background task for modifications
php call background task for push
exit
</code></pre>
<p>So in that example the user interface would be finished processing, but the server may still be doing some stuff on the image. </p>
|
php android
|
[2, 4]
|
2,200,119 | 2,200,120 |
Saving Android application state
|
<p>I understand how to save an application's state by using SharedPreferences, onSavedInstanceState() & onRestoreInstanceState(), etc as outlined in a similar post ( <a href="http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state">http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state</a> ), but how do I save the last activity?</p>
<p>To be more specific, my application starts up and goes to a login screen. Once a user logs in and navigates through several activities, lets say he or she leaves the app using the home button or in some other way. Next time the user starts the app, it will go back to the login screen and do a login again. Instead, I want the app to start up and go to the last activity that was on top of the stack when the user left the app in the previous session.</p>
<p>How is the last activity saved so that it can be restored on app startup?</p>
|
java android
|
[1, 4]
|
19,664 | 19,665 |
Remove / stop javacript function that are already loaded, from running
|
<p>I'm trying to manipulate a site. When the site loads it initialize a script, Codaslider <a href="http://www.ndoherty.biz/2009/10/coda-slider-2/" rel="nofollow">http://www.ndoherty.biz/2009/10/coda-slider-2/</a></p>
<p>How can I stop it from running? Is it possible to remove it before document ready? </p>
<p>The function I want to remove is:</p>
<pre><code>$(function () {
$("#coda-slider-1").codaSlider({slideEffect: "easeInOutExpo"
, autoSlideInterval: 5500});
});
</code></pre>
<p>I've tried</p>
<pre><code>$('#coda-slider-1').codaslider().stop();
</code></pre>
<p>and</p>
<pre><code>$.codaSlider().stop();
</code></pre>
<p>without any luck. Is the last example possible? </p>
<p>Is it possible to remove the codaslider script entirely? Since I'm trying to manipulate a site that already have loaded the script. How can I dynamically erase / stop the script.</p>
|
javascript jquery
|
[3, 5]
|
2,052,231 | 2,052,232 |
"sexiest" libraries for content presentation
|
<p>maybe someone will classify this question as "subjective..." but i think it would be useful to have a place where put links to fancy jquery and non-jquery libraries for high impact content presentation ... can you list here your favorite? I'm interested in using it for a project for which i would like to amaze my customer.
Thanks in advance and greetings.
c.</p>
<p>[thanks for closing post ... i was simply looking for links like this: <a href="http://miniajax.com/" rel="nofollow">http://miniajax.com/</a>]</p>
|
javascript jquery
|
[3, 5]
|
5,167,329 | 5,167,330 |
Toggle button should come back to it's off position
|
<p>In android ICS 4.0.3 source in WifiEnabler.java class I am adding my code to disable wifi when battery voltage reaches below 3.4, the code is like below</p>
<pre><code>public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = mContext.registerReceiver(null, ifilter);
int voltage = batteryStatus.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);
if(voltage>0 && voltage<3400) {
mSwitch.setChecked(false);
mSwitch.setEnabled(false);
Toast.makeText(mContext, "Low Battery ! , WiFi Disabled", Toast.LENGTH_SHORT).show();
return ;
}
</code></pre>
<p>when the battery voltage reaches 3.4 the wifi will disable. But my problem is the wifi button should come back to it's original off position on it's own. This is not happening in my code. If the user drag it back it will come to off position. I want to do it it's own. the source code link is <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/settings/wifi/WifiEnabler.java/" rel="nofollow">http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/settings/wifi/WifiEnabler.java/</a></p>
|
java android
|
[1, 4]
|
2,284,545 | 2,284,546 |
How to set End Date plus one from Start Date using jQuery DatePicker
|
<p>I have successfully integrate <a href="http://jqueryui.com/demos/datepicker/" rel="nofollow">jQuery DatePicker</a> on my site and wondering how can I set the following:</p>
<ol>
<li>Don't allow selection of start date from current date plus 2 days. example if today's date is 7/20/12 then the visitor can select only date starting 7/22/12.</li>
<li>End date must start based on Start Date plus one. If start date is 7/23/12 then the end date should be 7/24/12.</li>
</ol>
<p>BTW, I am making a hotel reservation calendar.</p>
<p>Here's my code based from sample:</p>
<pre><code><script>
$(function() {
$( "#sd" ).datepicker();
});
$(function() {
$( "#ed" ).datepicker();
});
</script>
<tr>
<td>Check In</td>
<td>:</td>
<td><input name="sd" type="text" id="sd" value="<?php echo $_SESSION['checkin'] ?>" size="10"" maxlength="8" /></td>
</tr>
<tr>
<td>Check Out</td>
<td>:</td>
<td><input name="ed" type="text" id="ed" value="<?php echo $_SESSION['checkout'] ?>" size="10" maxlength="10" /></td>
</tr>
</code></pre>
|
php jquery
|
[2, 5]
|
1,328,226 | 1,328,227 |
JavaScript hide div element on scroll action
|
<p>I'm using this bit of code to hide a menu bar when users scroll on a page. It works fine on Chrome 17.0.963.78 but keeps on flickering in and out on other browsers, namely I.E. firefox and safari ..</p>
<pre><code>$(window).load(function(){
$(document).scroll(function(){
$('#inner_floating').fadeOut();
var scrollA = $('body').scrollTop();
setTimeout(function(){
if(scrollA == $('body').scrollTop()){
$('#inner_floating').fadeIn();
}
}, 100);
})
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
588,660 | 588,661 |
I want object keys to check for duplicates, but I also want to sort the objects later, what should I do?
|
<p>I have an array called <code>newposts</code></p>
<p>I itterate through it and if it meets certain criteria, I add it to another array:</p>
<pre><code>for (newpost in newposts){
if (!( newposts[newpost][0] in currentposts )){
var triploc1 = locations[newposts[newpost][1]].location;
var triploc2 = locations[newposts[newpost][2]].location;
var detour_distance = fourpoint_distance(newloc1, triploc1, triploc2, newloc2);
if (worthwhile_detour(original_distance,detour_distance)){
currentposts.push(posts[newposts[newpost][0]])
}
}
}
</code></pre>
<p>The second row, is intended to check for duplicates(<code>newposts[newpost][0]</code>) is an ID. When I wrote it I had forgotten that currentposts was an array. Obviously, this doesn't work. I need currentposts to be an array, because just below i sort it. I could ofcourse convert it into an array once the selection is done. But I'm new to javascript and believe someone might know a better way to do this. </p>
<pre><code>function sortposts(my_posts){
my_posts.sort(function(a, b) {
var acount = a.sortvar;
var bcount = b.sortvar;
return (bcount-acount);
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,045,911 | 4,045,912 |
Understanding JavaScript anonymous functions, variables, and scoping
|
<p>We're trying to understand variable scoping inside JavaScript anonymous functions.</p>
<p>This code only needs to work inside Webkit browsers since it's for a PhoneGap app.</p>
<p>Given the code block below, will the arguments to <strong>setTimeout</strong> always be the same for each item in <strong>all_packs</strong>, or will the changing value of <strong>pack_name</strong> (since it changes on each iteration of the jQuery loop) affect the arguments? In other words, each new row should be associated with a different item in <strong>all_packs</strong>. Is this the correct way to use anonymous functions, or will some rows end up referencing the same name?</p>
<p>We can't use <strong>this.name</strong> inside the <strong>tap</strong> anonymous function because <strong>this</strong> will no longer refer to the item inside <strong>all_packs</strong>. As a result, we first stashed the name inside <strong>pack_name</strong>.</p>
<p>Assume <strong>TAP_DELAY</strong> is a constant set elsewhere, <strong>start_work</strong> is a valid function, and <strong>all_packs</strong> is an array of objects.</p>
<pre><code> // Load each pack
$( all_packs ).each( function(index) {
// Set vars
var pack_name = this.name;
var row = $( '#templates .row' ).clone( true );
// Append new row
$( '#test' ).append( row );
// Valid pack?
if ( this.valid ) {
// Configure for tap
row.on( 'tap', function() {
setTimeout( start_work, TAP_DELAY, pack_name );
});
} else {
setTimeout( start_work, TAP_DELAY, this.name );
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
592,600 | 592,601 |
Java access object like array
|
<p>In PHP, there is an ArrayAccess interface which allows you to access an object like an array. Is there a Java-equivalant to this? It would be very handy.</p>
<p>thanks</p>
|
java php
|
[1, 2]
|
3,256,350 | 3,256,351 |
Set focus to a textbox in a nested iframe
|
<p>I use TinyMce in my app. So, I have nested body elements and iframes. One from my html page, and one from the TinyMce. To the body of the tinymce I append div with many textboxes. Their ids are hello1, hello2 etc.</p>
<p>How to set focus to 'hello1'?</p>
<p>This code:</p>
<pre><code>$iframe.contents().find('body').find('hello1')
</code></pre>
<p>returns the correct textbox.</p>
<p>But this:</p>
<pre><code>$iframe.contents().find('body').find('hello1').focus()
</code></pre>
<p>doesn't work. How to solve this?</p>
|
javascript jquery
|
[3, 5]
|
1,632,255 | 1,632,256 |
Uploadify v3.1 passing POST Data
|
<p>Iam getting Crazy with JQuery Uploadify V3.1.</p>
<pre><code>// setup fileuploader
$("#file_upload").uploadify({
'swf': 'flash/uploadify.swf',
'uploader' : 'upload/do-upload',
'debug' : false,
'buttonText': 'Files auswählen',
'multi': true,
'method': 'POST',
'auto': false,
'width': 250,
'queueSizeLimit' : 10,
'fileSizeLimit' : '100MB',
'cancelImg': 'img/uploadify-cancel.png',
'removeCompleted' : true,
'onUploadSuccess' : function(file, data, response) {
$('#message').append(data);
},
'onUploadError' : function() {
$('#message').html('<h2>Fehler beim Upload</h2>');
}
});
</code></pre>
<p>To start Download onClick </p>
<pre><code>// handle the event stuff
$("#event_start_upload").on({
click: function(){
var key = $('#key').val();
if (key.length < KeyLength) {
$('#form-encryption-control').addClass('error');
return;
} else {
$('#form-encryption-control').removeClass('error');
}
// some space for new download links
$('#message').empty();
$('#file_upload').uploadify('upload','*')
}
});
</code></pre>
<p>My Problem is: I have to pass addtional params to the serverSide, in Uploadify V2 there was an Method uploadifySettings to pass "scriptData" , but not in V3? Someone knows how this works?</p>
<p>If someone else needs the clue:</p>
<pre><code>'onUploadStart' : function(file) {
var key = $('#key').val();
$("#file_upload").uploadify('settings', 'formData', {'key' : key});
},
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,458,400 | 3,458,401 |
How do I send url parameters via GET method to PHP with JavaScript?
|
<p>Here's my JS code... </p>
<pre><code>function da(){
var a=document.forms["user"]["age"].value;
if(this.age.value < 18 || this.age.value > 85) {
alert('some text...');
this.age.focus();
return false;
}else{
window.location.href='file.php?&'+a;
}
}
</code></pre>
<p>It simply passes the parameters to the page where I'm standing...
Here's the form just in case (I'm a beginner keep in mind)...</p>
<pre><code><form name="buscar" method="GET"> Some text <input onmouseover="Aj2('d');document.getElementById('box').style.display='block';" onmouseout="clean();" type="number" name="age" id="age" > Age <div id="help" ><!-- --> </div><br />
<input type="button" value="Send" onclick="da()">
</form>
</code></pre>
<p>The Aj2 function is not the problem here...
Thanks for any help y might get...</p>
|
php javascript
|
[2, 3]
|
686,750 | 686,751 |
Android Getting null image data
|
<p>I am trying to get the image from the camera. It works fine. I can take a photo and show it on the image view. Actually, I want to send this photo to my server after took. To do that, I try to pull the image in <code>onActivityResult</code>. But, when i check the Intent data, it always return null.Even though, the application runs fine and display the image. Why am I getting null for Intent data? Could you please help me?</p>
<p>Here is the code: </p>
<pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case ACTION_TAKE_PHOTO_B: {
if (resultCode == RESULT_OK) {
Log.e("TAG","data: "+data);
display_Photo();
//Process the image to send but, data is null
}
break;
}
}
}
</code></pre>
<p><strong>Log cat:</strong> </p>
<p>data : Null</p>
|
java android
|
[1, 4]
|
1,888,264 | 1,888,265 |
Jquery post a Array
|
<p>I am having a Array which is generated by my Javascript in run time.
once that array is full with all the values I want to send it using POST to the server.
How can I do that ...</p>
<p>Pseudo code:</p>
<pre><code> for(i=0;i<result.data.length;i++)
{
result.data[i].id
}
$.post("receiver.php", { xxxxx }, function(data){ console.log(data);});
</code></pre>
<p>How can I get that xxxx updated in the post</p>
<p>I checked the documentation in jquery but they are expecting to give all the values in POST.I do not want to do that.
Also, I want to send post only once so that traffic will be less.</p>
|
javascript jquery
|
[3, 5]
|
5,431,121 | 5,431,122 |
javascript: function call to itself
|
<p>I suppose the following code:</p>
<pre><code>jQuery("#mybutton").click(function(){
//do something
});
</code></pre>
<p>How could I recall to this function "anonymous"?, I can not put a name to this function:</p>
<pre><code>var xfun = function(){
//do something
}
jQuery("#mybutton").click(xfun);
</code></pre>
<p>I can do something like this:</p>
<pre><code>var working = false;
jQuery("#mybutton").click(function(){
if (working){
var _this = this;
_this._eventType = e.type;
setTimeout(function() { jQuery(_this).trigger(_this._eventType); }, 200);
return false;
}
//do something
});
</code></pre>
<p>what I need is something like this:</p>
<pre><code>var working = false;
jQuery("#mybutton").click(function(){
if (working){
setTimeout( this_function, 200);
return false;
}
//do something
});
</code></pre>
<p>thanks.</p>
<p><strong>EDIT:</strong></p>
<p>Solution:</p>
<pre><code>jQuery("#mybutton").click(function(){
if (working){
var fn = arguments.callee;
var _this = this;
setTimeout(function(){fn.call(_this);}, 200);
return false;
}
//do something
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,697,369 | 2,697,370 |
how to run javascript and then do a postback?
|
<p>I am trying to create an add to 'favourites'button. When the user clicks this button the image has to be changed ( in js). After that I would like to do a postback the asp.net page? how can I make this work? sofar i got:</p>
<p>aspx</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 runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
function ChangeFavStar() {
if ($("#btnAddToFavs").attr('src') == 'starempty.jpg') {
$("#btnAddToFavs").attr('src') = 'staradded.jpg';
}
else {
$("#btnAddToFavs").attr('src') = 'starempty.jpg';
}
return true;
}
});
</script>
<style type="text/css">
#btnAddToFavs {
height: 79px;
width: 121px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ImageButton ID=btnAddToFavs runat=server
OnClientClick="ChangeFavStar();" ImageUrl="~/starempty.jpg"
Height="74px" Width="109px" />
</div>
</form>
</body>
</html>
</code></pre>
<p>cs behindcode</p>
<pre><code> protected void btnAddToFavs_Click(object sender, ImageClickEventArgs e)
{
//do stuff
}
</code></pre>
|
c# jquery asp.net
|
[0, 5, 9]
|
423,922 | 423,923 |
How to execute Java file from JavaScript on client's side
|
<p>I have a code/class/script in JAVA that I want to be executed when someone clicks on a button/anything that I will handle. What should be the code in JavaScript to launch that class/code/script/compiled program installed on the <b>client's</b> system?</p>
|
java javascript
|
[1, 3]
|
252,196 | 252,197 |
How do I access the sending textbox inside an 'onfocus' function?
|
<p>Given the following HTML and function:</p>
<pre><code><input type="text" onfocus="TextBoxFocus()" id="txtName" />
</code></pre>
<p>.</p>
<pre><code>function TextBoxFocus()
{
}
</code></pre>
<p>Is it possible to get the id of the calling textbox from inside the function? </p>
<p>Thanks
Kevin</p>
|
javascript jquery
|
[3, 5]
|
5,103,680 | 5,103,681 |
Validation in javascript for asp.net tree node
|
<p>I have a program with a tree control to assign user permissions like student can access only attendance and staff can assign attendance to students and so on...</p>
<p>I want to validate this with javascript to see that if no checkbox in tree is selected or all nodes in a tree is deselected or left empty ..i have to throw a validation error using javascript. I have attached by design coding and js coding i have used until now.</p>
<p>i tried the regular checkboxes validtion and it does not produce any result. Please help me</p>
<p>
</p>
<p><strong>Javascript</strong></p>
<pre><code>function AreAllSiblingsChecked(chkBox)
{
var parentDiv = GetParentByTagName("div", chkBox);
var childCount = parentDiv.childNodes.length;
for(var i=0; i<childCount; i++)
{
if(parentDiv.childNodes[i].nodeType == 1) //check if the child node is an element node
{
if(parentDiv.childNodes[i].tagName.toLowerCase() == "table")
{
var prevChkBox = parentDiv.childNodes[i].getElementsByTagName("input")[0];
//if any of sibling nodes are not checked, return false
if(!prevChkBox.checked)
{
return false;
}
}
}
}
return true;
}
</code></pre>
|
c# javascript asp.net
|
[0, 3, 9]
|
5,511,761 | 5,511,762 |
How can I show messagebox when user register successfully and redirect him to Login page?
|
<p>My signUp button event is </p>
<pre><code>protected void signup_Click(object sender, EventArgs e)
{
string con = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
SqlConnection conn = new SqlConnection(con);
conn.Open();
if (selectques.SelectedItem.Text == "Write your own question?")
{
SqlCommand cmd = new SqlCommand("insert into registration values('" + username.Text + "','" + passwrd.Text + "','" + emailadd.Text + "','" + alterquestion.Text + "','" + securityanswer.Text + "')", conn);
cmd.ExecuteNonQuery();
Response.Redirect("Login.aspx");
try {
ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Successful Registered');window.location='login.aspx';", true);
}
catch(Exception ex)
{
}
}
else
{
SqlCommand cmd = new SqlCommand("insert into registration values('" + username.Text + "','" + passwrd.Text + "','" + emailadd.Text + "','" + selectques.Text + "','" + securityanswer.Text + "')", conn);
cmd.ExecuteNonQuery();
Response.Redirect("login.aspx");
try
{
ClientScript.RegisterStartupScript(Page.GetType(), "Message", "alert('Successful Registered');window.location='login.aspx';", true);
}
catch (Exception ex)
{
}
}
}
</code></pre>
<p>After registering successfully how can I show a message of <code>Successful Registered</code> on login page or on the same page. I want to show the message through Popup window or messagebox.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
5,251,140 | 5,251,141 |
Info to display in a list in Android
|
<p>I will try to make this as clear as I can. Please let me know if there is anything I can clarify.</p>
<p>I am downloading information from an SQL table in a database online to the phone. In the LogCat, I have been able to go through the table and see all the information I want. I am wondering about how best to save the information on the phone. I do not think that is necessary to create a new local database. Should I create a cursor with the information from the online database or store it in some kind of structure?</p>
<ol>
<li>The data does not need to be stored for a long time and when the application is closed it is ok to lose it.</li>
<li>I want to be able to see information from one of the columns from the SQL table in a list format and then click on it and see all the information from the row of that item in another activity. I have done this in another part of the app but it is using data from a local database on the phone.</li>
</ol>
<p>Here is some code to help clarify:</p>
<pre><code>Log.d("Provider Tester", "Result printed is: " + result);
JSONArray jArray = new JSONArray(result);
for(int i=0;i<jArray.length();i++){
JSONObject json_data = jArray.getJSONObject(i);
Log.i("log_tag","Name: "+json_data.getString("Name")+
", DateTime: "+json_data.getString("DateTime")
);
</code></pre>
<p>I want to be able to show a list of names and then click on a name and see the corresponding date.</p>
|
java android
|
[1, 4]
|
4,652,899 | 4,652,900 |
Is it considered bad practice if you use an <input> for a textbox compared to <asp:Textbox>?
|
<p>I have an ASP.NET page that contains a form and a button. In order to use the <code>OnKeyPress</code> and a javascript function (to stop the user from using the enter key and without adding a <code>FilteredTextBoxExtender</code>) attribute I had to change the <code><asp:Textbox></code> to an <code><input></code> with <code>type="text"</code>.</p>
<p>Is this considered bad practice? Or are there valid situtations where should be used? </p>
<p>To ensure this question isn't subjective - are there any other ways to prevent the user using the enter key when typing in an ASP.NET textbox? (without putting code in the code behind)</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
4,672,404 | 4,672,405 |
write javascript to page based on a condition
|
<p>I need to remove some Javascript code based on a server side condition (PHP). What I currently have is a variable holding the Javascript code as text and based on the condition I either echo it or not. However, it's cumbersome to maintain. How do I go about doing it?</p>
<p>I also tried to use something like what follows, but it's not working.</p>
<pre><code><?php if(condition) { ?> <script> stuff here </script> <?php } ?>
</code></pre>
<p>I'm sorry for the formatting, I have no idea why the less-then sign is making the entire line disappear.</p>
|
php javascript
|
[2, 3]
|
3,268,718 | 3,268,719 |
Selective Framebursting
|
<p>i would like to implement selective Framebursting for my iframe application.</p>
<p>My iframe is available at <code>www.mywebsite.con/iframe.aspx?lic=1234</code></p>
<p>When the third party website hosting my iframe is (<code>PayedWebsited1.con</code> OR <code>PayedWebsited2.con</code>) AND the <code>lic=1234</code> option also exists, display the iframe. For any other cheaters, display bananas!</p>
<p>How can i do it?</p>
|
javascript jquery
|
[3, 5]
|
2,352,113 | 2,352,114 |
jQuery Sanity Check
|
<p>This is driving me crazy. Please someone tell me I'm not crazy:</p>
<pre><code>var constraints = $('.traffic-constraints :input');
console.log(constraints);
var i;
for (i = 0; i < constraints.length; i++) {
if (constraints[i].val() > 0) { //<-------- errorrzz
....
</code></pre>
<p>the console tells me that i do, in fact, have input objects in my selector (5 of them). however, i get the following error: <code>constraints[i].val is not a function</code></p>
<p>wtf?</p>
|
javascript jquery
|
[3, 5]
|
4,671,372 | 4,671,373 |
i want to get the attribute value to the same element
|
<p>i used this line of code but it didn't work </p>
<pre><code>$("a#link").attr("href",$(this).attr('tempref').val());
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,347,471 | 5,347,472 |
Jquery: calculating width of hidden input
|
<p>Pretty simple task: using jquery I need to calculate the width of an input before the input is visible on the screen.</p>
<p><a href="http://jsfiddle.net/ajbeaven/mKQx9/" rel="nofollow">http://jsfiddle.net/ajbeaven/mKQx9/</a></p>
<p>Here is the code for convenience:</p>
<pre><code><div style="display:none;">
<input />
</div>
<script type="text/javascript">
$(function () {
alert($('input').width());
$('div').show();
});
</script>
</code></pre>
<p>Alert always shows <code>0</code></p>
<p>How do I calculate width without having to forcibly make the element visible, calculate the width, then hide them again? </p>
|
javascript jquery
|
[3, 5]
|
6,017,609 | 6,017,610 |
It there an equivalent to PHP's extract in Python?
|
<p>Looking for the python equivalent of this.</p>
<p><a href="http://ca3.php.net/manual/en/function.extract.php" rel="nofollow">http://ca3.php.net/manual/en/function.extract.php</a></p>
|
php python
|
[2, 7]
|
5,862,981 | 5,862,982 |
Show the server-side generated HTML in a new window
|
<p>What is the best way to show the server-side generated HTML (full page) into a new popup window? It should be triggered upon clicking a button (causing a postback to the server).</p>
<p>Thanks</p>
<p>Edited:</p>
<p>The HTML content are dynamically generated in the code behind and the content is full page (<code><html> ... </html></code>). Upon clicking a button on the web page, I would like to get the generated html content and pass it to the browser and show it in a new popup window. The content will be the final result (UI) not HTML tags.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
1,770,292 | 1,770,293 |
jQuery Load Without Appending to Element
|
<p>I am using jQuery's load function to get template data from external html files. In most cases I prefer to storage the data in a variable and append it when I need to later on. For example, I may end up cloning the node several times, or appending other data to it etc etc. The point is I need to be able to load an element from an external file, but not append it to an existing document.</p>
<p>What I am doing now is simple:</p>
<pre><code>var storage = document.createElement('div');
$(storage).load('somehtmlfile.html #sampleTemplateDiv');
</code></pre>
<p>But its annoying to have to remove the html from inside the storage div every single time. It would be nice if I could do something similar without having to append to a redundant container div and I could just have the data from the html file waiting nicely in the storage variable. Is this possible?</p>
<p>A non-jquery solution would be perfectly acceptable.</p>
|
javascript jquery
|
[3, 5]
|
1,991,757 | 1,991,758 |
how do i retrieve the incoming phone call's number while ringing and store it in a variable in android?
|
<p>I am fairly new to and i would like my app to be able to retrieve the phone number of caller while ringing and store it how would i do this? </p>
<p>thank you in advance</p>
|
java android
|
[1, 4]
|
781,279 | 781,280 |
Re-center Modal Popup with Javascript
|
<p>I have a modal popup that initially shows some content but expands a div if a checkbox is selected. The modal expands correctly but doesn't recenter unless you scroll up or down. Is there a javascript event I can tack on to my javascript function to recenter the entire modal?</p>
|
asp.net javascript
|
[9, 3]
|
996,174 | 996,175 |
image dump from print screen
|
<p>How would you dump an image captured using the print sreen key into a <code>div</code> tag?</p>
|
javascript jquery
|
[3, 5]
|
5,808,991 | 5,808,992 |
Check if a URL's mimetype is not a web page
|
<p>I want to check if a URL's mimetype is not a webpage. Can I do this in Java? I want to check if the file is a rar or mp3 or mp4 or mpeg or whatever, just not a webpage.</p>
|
java android
|
[1, 4]
|
5,574,619 | 5,574,620 |
Javascript post to PHP and get back an array?
|
<p>So i have this piece of javascript, it posts to <code>foo.php</code> with value <code>val</code>, gets back <code>data</code>, empties the container and call function <code>graph</code> which will fill the container with a new chart.</p>
<pre><code>$.post("foo.php", {val: val}, function(data){
if(data.length >0) {
$('#container').html('');
graph(data);
}
});
</code></pre>
<p>in <code>foo.php</code>, how do I make it pass back an array instead of string? at the moment I just have an <code>echo</code> in <code>foo.php</code> that echos the data delimited by a comma, ie: <code>1,2,3,4,5</code>. then in the <code>graph</code> function I have a <code>split(',' data)</code> that creates an array for later use.</p>
<p>I mean, all this works fine, I'm just wondering if I can avoid the split step and have <code>foo.php</code> return an array directly.</p>
<p>thanks!</p>
|
php javascript
|
[2, 3]
|
5,191,462 | 5,191,463 |
Putting LinearLayout to LinearLayout Array
|
<p>i wanna create button 1 to 9 and i want to do that in loop. But in each 3 count, i want to create a new LinearLayout.</p>
<pre><code> final LinearLayout[] ll2 = new LinearLayout[10]; // create an empty array;
for(int i=1; i<=9;i++)
{
Button btnNums = new Button(this);
final LinearLayout[] ll2 = new LinearLayout[10]; // create an empty array;
for(int i=1; i<=9;i++)
{
Button btnNums = new Button(this);
btnNums.setText(i+"");
ll.addView(btnNums);
if(i%3==0){
ll2[i] = ll;
ll = null;
}
}
layout.addView(ll2[0]);
btnNums.setText(i+"");
ll.addView(btnNums);
if(i%3==0){
ll2[i] = ll;
ll = null;
}
}
layout.addView(ll2[0]);
</code></pre>
<p>This does not work. I get no error but when o run the app, it is stopped to work. What's the problem?</p>
|
java android
|
[1, 4]
|
3,209,701 | 3,209,702 |
is it possible to send email with javascript on a button?
|
<p>Is there a way to make an email sent to the email address in the input when button is clicked? form like:</p>
<pre><code><form action="/" method="post" name="form" target="_blank">
<h3><span>Subscribe to Newsletter</span></h3>
<p class="email_first">
<label for="email">Your Email</label>
<input id="EMAIL" class="email" type="email" name="EMAIL" value="Your Email Address:" size="30" />
</p>
<p class="submit"><button type="submit">Send</button></p>
</form>
</code></pre>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
1,853,067 | 1,853,068 |
How to set default application using Intents?
|
<p>If I need to play Youtube video using default youtube player of Android through Intents I can set it:</p>
<pre><code> Intent youtube=new Intent(Intent.ACTION_VIEW, Uri.parse(mLinks[mPosition].trim()));
youtube.setPackage("com.google.android.youtube");
startActivityForResult(youtube, 100);
</code></pre>
<p>But now I need to set default android media player through Intents. How can I do it? Which package name should I use? Thank you. </p>
|
java android
|
[1, 4]
|
168,223 | 168,224 |
I'm building a website that has dual languages with two flags as an entry page
|
<p>Now I wonder how would they have to configure routing so that when user requests stackoverflow.com/profilePage django handles the request and when user request stackoverflow.com/questions ASP.NET app handles the request</p>
|
c# php
|
[0, 2]
|
4,000,817 | 4,000,818 |
can't upload file on server
|
<p>I am trying use this example <a href="http://www.sajithmr.me/jrecorder/example2.html" rel="nofollow">http://www.sajithmr.me/jrecorder/example2.html</a> for recording audio and send it to my localhost server, but I have issue here. My code describe below</p>
<pre><code><script>
$.jRecorder(
{
host : 'http://localhost/Jrec/html/acceptfile.php?filename=hello.wav',
callback_started_recording: function(){callback_started(); },
callback_stopped_recording: function(){callback_stopped(); },
callback_activityLevel: function(level){callback_activityLevel(level); },
callback_activityTime: function(time){callback_activityTime(time); },
callback_finished_sending: function(time){ callback_finished_sending() },
swf_path : 'jRecorder.swf',
}
);
</script>
</code></pre>
<p>this my acceptfile.php</p>
<pre><code> if(!isset($_REQUEST['filename']))
{
exit('No file');
}
$upload_path = dirname(__FILE__). '/';
$filename = $_REQUEST['filename'];
$fp = fopen($upload_path."/".$filename.".wav", "wb");
fwrite($fp, file_get_contents('php://input'));
fclose($fp);
exit('done');
</code></pre>
<p>whalt should I do with $upload_path = dirname(<strong>FILE</strong>). '/;?<br>
when I press send data button the file doesn't upload into following directory ("files"). What is the problem here, Any help will be apriciated </p>
|
php javascript jquery
|
[2, 3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.