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 |
---|---|---|---|---|---|
1,739,841 | 1,739,842 | firewall for mobile devices running on android platform | <p>i am developing a firewall for mobile devices as my final year project could anybody help me out in getting the codes for any of my project...pls pls pls its urgent!</p>
| java python | [1, 7] |
1,611,852 | 1,611,853 | Unable to install Google API in Android | <p>I want to create a map view application in android. If I click the Third Party Add-ons to install Google Api, I'm getting this error </p>
<blockquote>
<p>Failed to fetch URL <a href="https://dl-ssl.google.com/android/repository/addons_list.xml" rel="nofollow">https://dl-ssl.google.com/android/repository/addons_list.xml</a>, reason:<br>
File not found</p>
</blockquote>
| java android | [1, 4] |
1,301,155 | 1,301,156 | Android - entry nember | <p>how would i go about adding an entry number at the start of a saved line of text to a .txt file. eg.</p>
<ul>
<li>01, entry one</li>
<li>02, entry two</li>
<li>03, entry three</li>
</ul>
<p>and so on</p>
<p>here is my code to write to the file</p>
<pre><code>public void onClick(View v) {try {
BufferedWriter out = new BufferedWriter(new FileWriter("/sdcard/input_data.txt", true));
out.write(txtData.getText() + "," + dateFormat.format(new Date()));
out.close();
</code></pre>
| java android | [1, 4] |
538,554 | 538,555 | Where not working in LINQ operation | <p>I have a problem where when I run the below, even if the call to OptionsMatch returns false (that method returns a bool) I still get the item in the resulting list finalItems</p>
<pre><code>public List<SavedItemOption> GetValidOrderOptions(OptionsList itemOptions, List<SavedItemOption> savedItemOptions)
{
List<SavedItemOption> finalItemOptions = savedItemOptions.Where(y => itemOptions.Any(x => OptionsMatch(x,y) && (y.actID == x.Id))).ToList();
return finalItems;
}
</code></pre>
| c# asp.net | [0, 9] |
5,667,674 | 5,667,675 | Inner classes: Android vs Java | <p>I'm aware that inner classes are not recommended in Android because they hold a reference to the enclosing class. However, in Java, the outer class is only GCed when the inner class is no longer referenced. That means, in Android, provided you have a non-static reference in the outer activity class to the inner class, the inner class cannot exist longer than the outer activity class because the activity can only be destroyed if it doesn't hold a reference to the inner class anymore (at least that is what I'm inferring). So what's the problem using non-static inner classes then (since they can't obviously exist longer than the outer activity if you infer from java)? Am I missing something?</p>
<p>Thanks!</p>
| java android | [1, 4] |
4,793,090 | 4,793,091 | How do I wait for multiple jquery posts to complete? | <p>I'm trying to clear a busy icon and re-enable my delete button once the multiple jquery posts have completed. Here is my current code:</p>
<pre><code> $('#deleteimgs').live('click', function(e) {
e.preventDefault();
if ($('input[name="chk[]"]:checked').length > 0 ) {
$('#deleteimgs').button('loading');
$('#saveicon').show();
var boxes = $('input[name="chk[]"]:checked');
$(boxes).each(function(){
var id = $(this).attr('id').substr(7);
var self = this;
$.post("/functions/photo_functions.php", { f: 'del', imgid: id}, function(data){
if (data.success) {
$(self).hide();
$("#img_"+id).hide(250);
}
}, "json");
});
$('#saveicon').hide();
$('#deleteimgs').button('reset');
}
});
</code></pre>
<p>My hide call and reset call are being trigger prior to completion of the foreach loop. Is there a way to wait for completion before making these two calls?</p>
<pre><code>$('#saveicon').hide();
$('#deleteimgs').button('reset');
</code></pre>
| javascript jquery | [3, 5] |
2,692,717 | 2,692,718 | What's the equivalent of the >> Java operator in C# | <p>I'm converting some Java code to C# and I came across the >> operator. What is that operator called and what is the equivalent in C#?</p>
<p>I'm trying to convert the following code:</p>
<pre><code>final int pointerIndex = (action & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT;
</code></pre>
<p>Thanks,</p>
| c# java | [0, 1] |
1,260,156 | 1,260,157 | Why invalidate must be called by UI thread | <p>Anyone know why <a href="http://developer.android.com/reference/android/view/View.html#invalidate%28%29" rel="nofollow">invalidate</a> must be called by UI thread? </p>
<p>As in Java Swing, the <code>repaint</code> function can be called by both non-UI thread and UI thread. <code>repaint</code> is performing a very similar task as <code>invalidate</code> <em>(this method causes a call to this component's paint method as soon as possible. Otherwise, this method causes a call to this component's update method as soon as possible.)</em>.</p>
| java android | [1, 4] |
4,007,374 | 4,007,375 | ("kg"=="kg") returns false. How Do I tell java, that this comparison returns true? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/995918/java-string-comparison">Java string comparison?</a> </p>
</blockquote>
<p>I was trying to do this:</p>
<pre><code>boolean exit = false;
while(exit==false && convStoreIndex<convStoreLength) {
if(conversionStore[convStoreIndex].getInUnit()==inUnit) {
indexCount++;
exit=true;
}
convStoreIndex++;
}
</code></pre>
<p>but the if-condition never went true, even if the two Strings were the same(checked this in the debugger).
so I added some lines:</p>
<pre><code>boolean exit = false;
while(exit==false && convStoreIndex<convStoreLength) {
Log.v("conversionStore["+String.valueOf(convStoreIndex)+"]", conversionStore[convStoreIndex].getInUnit()+"|"+inUnit);
String cs = conversionStore[convStoreIndex].getInUnit();
String iu = inUnit;
Log.v("cs", cs);
Log.v("iu", iu);
Log.v("Ergebnis(cs==iu)", String.valueOf(cs==iu));
if(conversionStore[convStoreIndex].getInUnit()==inUnit) {
indexCount++;
exit=true;
}
convStoreIndex++;
}
</code></pre>
<p>and here is the extract from LogCat:</p>
<pre><code>09-15 11:07:14.525: VERBOSE/cs(585): kg
09-15 11:07:16.148: VERBOSE/iu(585): kg
09-15 11:07:17.687: VERBOSE/Ergebnis(cs==iu)(585): false
</code></pre>
<p>the class of conversionStore:</p>
<pre><code>class ConversionStore {
private String inUnit;
[...]
public String getInUnit() {
return inUnit;
}
}
</code></pre>
<p>Who is going crazy, java or me?</p>
| java android | [1, 4] |
4,092,788 | 4,092,789 | How do I set maximum margin-top in jquery animation? | <p>I have the following code in jQuery, that animates a div marginTop. </p>
<p>How do I set it so that once the margin top is equal 900px, disable the click event?</p>
<pre><code>$("#tmbUp").click(function(){
$("#tmbHolder").animate({"marginTop": "-=100px"}, "slow");
});
$("#tmbDown").click(function(){
$("#tmbHolder").animate({"marginTop": "+=100px"}, "slow");
});
</code></pre>
| javascript jquery | [3, 5] |
5,482,917 | 5,482,918 | jQuery trigger an element's event | <p>My question is same as this <a href="http://stackoverflow.com/questions/7999806/jquery-how-to-trigger-click-event-on-href-element">one</a></p>
<p>I also faced the same problem which is <code>href</code> not triggered for event 'clicked'
.Then I changed to <code>alt</code> and element is <code>span</code> . Here is my code </p>
<pre><code><li><h2><span id='aa' alt="#inbox"><span>Inbox</span></span></h2></li>
</code></pre>
<p>This line is my 2nd child of <code>ul</code> . I want to trigger/click this line when the page is loaded. </p>
<p>But I want to know how to trigger this span's(#aa) click event.Following codes are tried.but not worked.<br>
first try:</p>
<pre><code>var href = $('#aa').attr('alt');
window.location.href =href; // this gave me 404 error
</code></pre>
<p>2nd try:</p>
<pre><code> $('#aa').trigger("click") // this has no change
</code></pre>
<p><strong>Edit</strong> a function will be executed when the above mentioned li>span is clicked. I want that li's span be clicked automatically when the page has loaded. <a href="http://stackoverflow.com/questions/7999806/jquery-how-to-trigger-click-event-on-href-element">this question</a> 's answers say some problems when <code><a href></code> is used.Therefore, I used <code>span</code> tag instead. I use jQuery 1.6 </p>
| javascript jquery | [3, 5] |
4,752,551 | 4,752,552 | javascript function to convert date from mm/dd/yyyy to yyyymmdd | <p>In asp.net when am selecting date using calender control it displays in textbox as </p>
<blockquote>
<p>mm/dd/yyyy (eg.5/19/2011)</p>
</blockquote>
<p>format but in my sql database it is stored as varchar datatype in </p>
<blockquote>
<p>yyyymmdd(20110519)</p>
</blockquote>
<p>format without any separators '/' or '-'. </p>
| c# javascript asp.net | [0, 3, 9] |
5,892,137 | 5,892,138 | Graphics spoilt by intermittent jumps | <p>I have written a game app with bitmaps moving around the screen. It employs a separate thread which writes directly to a canvas. On my Samsung Galaxy Y the animations seems smooth throughout the game, however on a "Tabtech m7" tablet the smooth graphics appear to be interrupted by intermittent freezes of about half a second duration, and spaced about three or four seconds apart. Is it possible that it is just a feature of the (cheap) tablet hardware, or is it more likely that it's some aspect of my programming? And if it's me, how could I go about diagnosing the cause?</p>
| java android | [1, 4] |
1,601,684 | 1,601,685 | Best way to read contents of web.config | <p>I need to read the contents of the Web.Config and send them off in an email, is there a better way to do the following:</p>
<pre><code> string webConfigContents = String.Empty;
using (FileStream steam = new FileStream(
Server.MapPath("~/web.config"),
FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (StreamReader reader = new StreamReader(steam))
{
webConfigContents = reader.ReadToEnd();
}
}
</code></pre>
<p>I dont want to lock the file. Any ideas?</p>
<p><em>Edit - I need a raw dump of the file, I cant attach the file (Webhost says nay!), and im not looking for anything specific inside it</em></p>
| c# asp.net | [0, 9] |
2,286,893 | 2,286,894 | jQuery .live and page refresh issue | <p>Why this code fails to prevent a page refresh?</p>
<pre><code>$('a').each(function() {
var me = $(this);
var mytarget = me.attr('href');
var is_link_to_self = mytarget.indexOf("index.php");
if(is_link_to_self !== false) {
me.live('click', function() {
$('#content').load(mytarget);
return false;
});
}
});
</code></pre>
| javascript jquery | [3, 5] |
450,759 | 450,760 | Jquery animation based on matching strings on page load | <p>I have the following code</p>
<pre><code> $('.rsName').ready(if{($('.companyName').html() == $(this).html()){
$(this).siblings(".rsDistribution").slideDown('slow', function() {});
});
</code></pre>
<p>What I'm trying to do, is check if rsName and companyName are equal. If they are equal, I'd like to slide down the .rsDistribution which is a sibling div of rsName.</p>
<p>Any ideas why this isn't working?</p>
| javascript jquery | [3, 5] |
2,341,490 | 2,341,491 | serialize variable merge? | <p>I want to add data of <code>ExtrasGroupID</code> variable into <code>options</code> serialize variable (or what is other way), how can that be done?</p>
<p>Example below:</p>
<pre><code>var ExtrasGroupID = $("#SelectExtrasGroup option:selected").val();
var options = $("#FormExtrasOptionsList").serialize();
$.post("ajax.php", options,
function(data) {
console.log(data)
});
</code></pre>
| javascript jquery | [3, 5] |
4,741,926 | 4,741,927 | Runtime.getRuntime exec | <p>I have created a class to handle root commands in an android app, which is working just fine mostly. I create the process with Runtime.getRuntime().exec("su") and then enter commands using DataOutputStream and get the data from the commands using DataInputStream and the deprecated readLine. (I have tried using BufferedReader instead, but no difference to the issue).</p>
<p>My problem is that the app will hang if the command produces an error. F.eks. if I execute the command "[ -f /test ] && md5sum /test" || echo 0" I will have no problems. However, if I execute "md5sum /test" and the file does not exist, I will have to force-close the app as it will get nowhere. In this example the solution is of cause just to check for the file like in the first example, but not every situation is this simple. Issues can happen, and when they do, people should not have to force-close applications.</p>
<p>Is there a way to fix this issue?</p>
| java android | [1, 4] |
3,874,578 | 3,874,579 | How to add EventHandler OnCommand for ImageButton programaticly? | <p>I have code, where i add ImageButton to table programaticly and I need to assign event handler to this ImageButton. When I write ASP/HTML code, there is attribute OnCommand, but in C#, there is nothing like this. Just CommandName and CommandAttribute.</p>
<pre><code>ImageButton ib = new ImageButton { CommandName = "Edit", CommandArgument = id.ToString(), ImageUrl = "~/Images/icons/paper_pencil_48.png", AlternateText = "Edit document" };
</code></pre>
| c# asp.net | [0, 9] |
4,605,172 | 4,605,173 | Search and store in Hashtable | <p>I have a Text in editor in that some text has anchor tag now I want to find all the the hyperlink tag in <strong>HashTable</strong> with <strong>name</strong> as value and <strong>src</strong> as key, like my text in editor is: </p>
<p>"<em>Proin ac <a href="http://askiitians.com" rel="nofollow">vijendra singh</a> mi non nunc euismod adipiscing. Sed quis purus elit. <a href="http://www.transtutors.com/" rel="nofollow">ASP.NET</a> nec ipsum tellus. <a href="http://www.transwebtutors.com/" rel="nofollow">My test page</a> posuere egestas diam sit amet vehicula. Fusce vitae nibh.</em>"
Now I want to store all these three link in hash table. Please suggest me how to store that in hashtable.</p>
| c# asp.net | [0, 9] |
3,900,998 | 3,900,999 | Why is Base64 string different in C# and Android | <p>I have convert one image into base64 string and that output same with online website.</p>
<p>But the same image when I convert it from Android is different.</p>
<p>Can you please explain why C# and Android base64 strings are different for the same image.</p>
<p>C#.NET Code</p>
<pre><code>string cImagePath = @"G:\bg-listing.png";
byte[] imagebyte = StreamFile(cImagePath);
String result = System.Convert.ToBase64String(imagebyte);
System.IO.StreamWriter outFile;
try
{
outFile = new System.IO.StreamWriter(Application.StartupPath + "//image2base641.txt",
false,
System.Text.Encoding.Default);
outFile.Write(result.ToString());
outFile.Close();
}
catch (System.Exception exp)
{
// Error creating stream or writing to it.
System.Console.WriteLine("{0}", exp.Message);
}
</code></pre>
<p>Android Code</p>
<pre><code>Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(), R.drawable.image);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bitmapOrg.compress(Bitmap.CompressFormat.JPEG, 100, bao);
byte [] ba = bao.toByteArray();
String ba1=Base64.encodeToString(ba,Base64.DEFAULT);
</code></pre>
<p>Both image base64 are different.</p>
<p>Please help me.</p>
| c# android | [0, 4] |
4,920,646 | 4,920,647 | Conditional templates in Java? | <p>In C# I can do this:</p>
<pre><code>public class QuadTree<T> where T : IHasRect
</code></pre>
<p>Is there a way to do something similar in Java?</p>
| c# java | [0, 1] |
905,368 | 905,369 | GridView edit fill textbox of form | <p>i make one form which i'm using number of textbox and than fill the gridview</p>
<p>after editing visible in gridview i want to fill textbox of the form click of the edit in </p>
<p>gridview how i can solve it?</p>
| c# asp.net | [0, 9] |
2,263,276 | 2,263,277 | Validate the string entered is of mm/dd/yyyy format | <p>I have a datepicker control for the users to pick the date, however, they also need to enter the date manually. As such, I need to validate the date entered by the user in the textbox.</p>
<p>Below is the code that I am using to validate </p>
<pre><code> DateTime Test;
if ((!string.IsNullOrEmpty(strtdate)))
{
bool valid = DateTime.TryParseExact(strtdate, "MM/dd/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out Test);
}
</code></pre>
<p>The date entered by the user is 6/29/2011, however it gives the bool valid value as false though it is correct.</p>
<p>What am I missing here? Please let me know, its urgent.</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
4,689,920 | 4,689,921 | Load javascript via jQuery ajax | <p>is it possible to use jQuery %Json function to load a javascriptfile.js asynchronously?</p>
| javascript jquery | [3, 5] |
5,660,339 | 5,660,340 | Show and hide loading image while loading PHP data | <p>I am using jQuery and PHP to save content that the user inputs in a database. While the PHP is doing its thing I want to show a loading GIF image just to show that it is saving their data. I realize that it probably does take that long for it to run the code so i want to be able to show the image for at least 1 second if it takes less time than that</p>
| php jquery | [2, 5] |
5,865,446 | 5,865,447 | Lazy loading images | <p>I'm looking for a JQuery plugin that supports lazy loading images. The <a href="http://www.appelsiini.net/projects/lazyload">Lazy Load JQuery plugin</a> is no longer supported and does not work in Firefox.</p>
<p>Does anyone know a good alternative that supports most modern browsers?</p>
<p>I'm also open to other approaches. I have a hidden div with images that I don't want to load unless the div is made visible. Let me know if there are better approaches to deferring the image load in this situation.</p>
| javascript jquery | [3, 5] |
3,620,185 | 3,620,186 | Invalid int: ""? | <p>I'm trying to save the state of my app and I thought it all looked good but i keep getting this error:</p>
<pre><code>10-07 15:18:35.386: E/AndroidRuntime(1818): Caused by: java.lang.NumberFormatException: Invalid int: ""
</code></pre>
<p>And it keeps highlighting my codes that say:</p>
<pre><code>textView(something) = Integer.parseInt(textView(something).getText().toString());
</code></pre>
| java android | [1, 4] |
2,273,937 | 2,273,938 | When to close custom build jQuery dropdown | <p>I made a very simple dropdown using a <code><div></code> (parent), <code><span></code> (current selection) and <code><ul></code> (options).
It works fine. What I now want to do is if the user clicks anywhere on the page, have it close, like a "real" <code><select></code> element.</p>
<p>What I do now is this:</p>
<pre><code>$(document).delegate('body','click',function(){
if(isExpanded){close();}
});
</code></pre>
<p>And it works. What I am worried about is performance. Is it wise to listen for click events on the document node? Is there a better way?</p>
<p>Thank you.</p>
| javascript jquery | [3, 5] |
5,974,269 | 5,974,270 | jQuery on() event only working with $(document) | <p>I'm using jQuery's <code>.on()</code> event handler and it's only working when I use <code>$(document)</code>.</p>
<p>This works:</p>
<pre><code>$(function() {
$(document).on("click", ".search .remove", function(e) {
console.log("clicked");
});
});
</code></pre>
<p>This does not work:</p>
<pre><code>$(function() {
$(".search .remove").on("click", function(e) {
console.log("clicked");
});
});
</code></pre>
<p>Nothing happens on that second one...no errors or anything. It just doesn't fire.</p>
| javascript jquery | [3, 5] |
5,434,371 | 5,434,372 | Track all outgoing URL requests from browser using jQuery | <p>I need to block the UI when user clicks on any hyperlinks that points to different page on my website.
I know there is a way to track all jquery ajax requests using ajaxStart and ajaxStop and i can use these methods to block my UI when browser is waiting for response from the server.
But is there any way to intercept all outgoing page requests from all major browsers (firefox, Chrome and IE) ?</p>
| javascript jquery | [3, 5] |
3,707,223 | 3,707,224 | Finding position of cursor with window scroll | <p>Is there any way to find the cursor is at the top of a HTML element with window scroll function. </p>
<p>EDIT: I have to call the below script to suspend the window scroll function if the cursor is at the top of one div:</p>
<pre><code>document.addEventListener('DOMMouseScroll', function(e){
console.log(e);
e.stopPropagation();
e.preventDefault();
e.cancelBubble = false;
return false;
}, false);
</code></pre>
| javascript jquery | [3, 5] |
353,890 | 353,891 | JQuery: what's the non-JQuery equalavent of "$("#myDIV li").eq(1)"? | <p>I'm trying to de-couple my dependence on JQuery, as such - I have the following JQuery:</p>
<pre><code>$("#myDIV li").eq(1).html('...');
$("#myDIV li").eq(2).html('...');
$("#myDIV li").eq(3).html('...');
</code></pre>
<p>How do I perform the above code without using JQuery (just plain JavaScript).</p>
| javascript jquery | [3, 5] |
2,852,271 | 2,852,272 | How do I interactively reduce (or stop) jquery carosel transiton speed? | <p>In the link <a href="http://www.getushopping.com/" rel="nofollow">http://www.getushopping.com/</a> code for the top slider which shows 7 images at a time is: </p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$('#mycarousel').jcarousel({
wrap: 'circular'
/*,size:9*/
,visible:7
,auto:true
});
});
</script>
</code></pre>
<p>I am new to javascript and jquery and I am facing many troubles. I want to reduce the transition speed and I also want want to stop the carosel when the mouse cursor hovers over it.</p>
| javascript jquery | [3, 5] |
1,616,885 | 1,616,886 | How can i define my own event in jQuery? | <p>How can i define my own event in jQuery?</p>
| javascript jquery | [3, 5] |
1,014,895 | 1,014,896 | Jquery/JavaScript code binding to collection | <p>I have a dynamically generated table of records and for each row, I have an anchor tag with class name set to 'hdelete' to enable me invoke delete method on the particular row's link that is clicked. I have some code currently that is support to hook up all the anchors with class ='hdelete'</p>
<pre><code> $("#tbl_srecords").click(function (e) {
$(e.target).hasClass("hdelete") ? fnDeletehrecord($(e.target)) : null; //Run the delte row function here
});
</code></pre>
<p>The code above does not seem to work. what it currently does is select just the first occurence of anchor with class='hdelete'. Anyone with a better idea on how to best implement this? </p>
| javascript jquery | [3, 5] |
474,057 | 474,058 | onload for div tag | <p>I have div tag, after some event, I insert (change old content) into this tag, several images and also texts, for example:</p>
<pre><code> $("#some_button").on("click", function () {
$("#mydiv").html("<div>aaaa</div><img src='1.jpg'><div>bbb</div><img src='2.jpg'>");
});
</code></pre>
<p>I want, that after load "mydiv" tag full content, alert("mydiv contonet is loaded"). That is, some like this:</p>
<pre><code>$("#mydiv").onload( function () {
alert("mydiv contonet is loaded");
});
</code></pre>
<p>Tell please, how can this make?</p>
| javascript jquery | [3, 5] |
4,759,807 | 4,759,808 | Is there a way to check if a user is logged in using JQuery? | <p>I want to be able to display a message if a user is not logged in if they try rating a user by clicking a rating. Is there a way to add it to my JQuery code below or can I pass it to my PHP script?</p>
<p>I'm using PHP</p>
<p>Here is the JQuery code.</p>
<pre><code>$('#rate li a').click(function(){
$.ajax({
type: "GET",
url: "http://localhost/update.php",
data: "rating="+$(this).text()+"&do=rate",
cache: false,
async: false,
success: function(result) {
// remove #ratelinks element to prevent another rate
$("#rate").remove();
// get rating after click
getRating();
getRatingAvg();
getRatingText2();
getRatingText();
},
error: function(result) {
alert("some error occured, please try again later");
}
});
</code></pre>
| php jquery | [2, 5] |
4,058,872 | 4,058,873 | saving audio file to SD card | <p>I have written a program that records audio and saves it to external storage SD card. I can also playback the audio. The audio file is saved according to time stamp. The problem is that when the recording is saved, it is saved with two additional files that are both 0KB and cannot be opened. I'm not sure if this is a problem with the time stamp, but working at it for a while. I'm just a novice programmer so its taking me a while to solve this. If anyone might can give suggestions that would be greatly appreciated. </p>
<p>Thanks</p>
| java android | [1, 4] |
4,720,763 | 4,720,764 | Why does this work in jsfiddle but not in my document | <p>I found a wonderful jsfiddle that someone has made and wanted to use part of it in my project:</p>
<p><a href="http://jsfiddle.net/manuel/29gtu/" rel="nofollow">http://jsfiddle.net/manuel/29gtu/</a></p>
<p>It works on the jsfiddle but not in my HTML document. Here is what in my document:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery-1.7.2.js"></script>
<script>
$("button").click(function() {
var id = $("#id").val();
var text = "icon-"+id;
// update the result array
var result = JSON.parse(localStorage.getItem("result"));
if(result == null)
result = [];
result.push({id: id, icon: text});
// save the new result array
localStorage.setItem("result", JSON.stringify(result));
// append the new li
$("#bxs").append($("<li></li>").attr("id", "item-"+id).html(text));
});
// on init fill the ul
var result = JSON.parse(localStorage.getItem("result"));
if(result != null) {
for(var i=0;i<result.length;i++) {
var item = result[i];
$("#bxs").append($("<li></li>").attr("id", "item-"+item.id).html(item.icon));
}
}
</script>
</head>
<body>
<ul id="bxs" class="tabs">
</ul>
<input type="text" id="id" /><button>save</button>
</body>
</html>
</code></pre>
<p>The code is copied and pasted from the fiddle. I think it has to do with me not having a plugin for local storage.
For that jsfiddle to work, do I need some external plugin that I am missing?</p>
| javascript jquery | [3, 5] |
3,917,575 | 3,917,576 | Issues with .remove() | <p>I 've been monkeying around with alternate solutions for my expand/collapse accordion bars for a while now and can't seem to come up with a proper function to replace the trigger words "Open" with "Close" when necessary. </p>
<p>I know this is simple stuff, and in a year hopefully I'll look back and laugh. Until then, any quick help with the jsFiddle <code>http://jsfiddle.net/mtubb/</code> from someone more experienced then I would be very helpful. </p>
| javascript jquery | [3, 5] |
1,681,862 | 1,681,863 | how to make our asp .net website work both in pc and mobile | <p>I want to create a website in asp .net .</p>
<p>All I know is if a I create my website it will work in pc.</p>
<p>But i want to know will it work in mobiles.</p>
<p>If not what i should do .</p>
<p>Thanks In Advance.</p>
| c# asp.net | [0, 9] |
3,574,492 | 3,574,493 | Extracting user entry from text box and storing it in a variable in javascript | <pre><code>// text Box
&nbsp;&nbsp;<asp:TextBox ID="TextBox3" runat="server" BackColor="Silver"
BorderColor="Silver" ontextchanged="TextBox3_TextChanged"
style="margin-left: 6px" Width="154px"></asp:TextBox>
// Submit button
&nbsp;<asp:Button ID="Button6" runat="server" BackColor="Silver"
onClientclick='store_memID()' style="margin-left: 20px" Text="Submit"
Width="102px" Font-Bold="True" Height="28px" />
<script type = "text/javascript">
// Function to caputure client-input- Member_ID.
function store_memID() {
var mem_ID = document.getElementById('TextBox3').value;
return confirm('TimeLine is displayed for: ' + mem_ID);
}
</script>
</code></pre>
<p>When I run the code and enter a value into the text box and then press the submit button:-
"Microsoft JScript runtime error: Unable to get value of the property 'value': object is null or undefined".</p>
<p><br><br>
Else, if I remove the '.value' :-</p>
<pre><code><script type = "text/javascript">
// Function to caputure client-input- Member_ID.
function store_memID() {
var mem_ID = document.getElementById('TextBox3');
return confirm('TimeLine is displayed for: ' + mem_ID);
}
</script>
</code></pre>
<p>and then run the program, enter value in text box and press submit then i get :-</p>
<p>"TimeLine is displayed for: Null"</p>
<p>I have been looking into solving this problem. not sure whats going wrong... </p>
<p><em><strong>Edit (fix):- Server Side ID for my text box is 'TextBox3' but this doesn't necessarily match up with the client side ID.
to get Client Side ID:- '<%=TextBox3.ClientID%>'</em></strong> </p>
| javascript asp.net | [3, 9] |
453,748 | 453,749 | confirmation about deleting a record from database | <p>I am using php and javascript. I want to delete a record from database after a giving "Yes" and "No" confirmation to user. I am using confirmbox by google but don't know what should be my code structure inside that. I am new to programing. Can any one help me please</p>
<p>How can I add this php function on javascript</p>
<pre><code>function deleteRecord($id)
{
$sql = "DELETE FROM user_database WHERE user_id = ".$id;
mysql_query($sql) or die("Can not delete");
}
</code></pre>
<p>And on page</p>
<pre><code><script type="text/javascript">
function show_confirm()
{
var r=confirm("Press a button!");
if (r==true)
{
alert("You pressed OK!");
}
else
{
alert("You pressed Cancel!");
}
}
</script>
</head>
<body>
<input type="button" onclick="show_confirm()" value="Show a confirm box" />
</code></pre>
| php javascript | [2, 3] |
4,045,926 | 4,045,927 | Page.User.Identity.Name returns empty string | <p>For some Page.User.Identity.Name always returns an empty string. Any ideas. I simply want to print it to the screen. IIS is set for integrated windows security.</p>
<p>Response.Write("Name = " + Page.User.Identity.Name);</p>
<p>Oops just noticed i hadnt set authentication to windows auth. Silly me</p>
| c# asp.net | [0, 9] |
2,555,233 | 2,555,234 | jQuery: onclick, edit field and show+save into an variable | <p>Right now I have this in Javascript without jQuery:</p>
<p>Here is it: <a href="http://jsbin.com/ewihu3" rel="nofollow">http://jsbin.com/ewihu3</a></p>
<p>It's working just fine, but I wish to use jQuery for making the code simpler and shorter.</p>
<p>I want exactly same things to do as on the example above, that when you click on the text, it should turn into an input field. And on blur it should display what you've edited in the box, and then make a variable (like e.value on the example above) so I can send that in a ajax call later.</p>
<p>How can i do this in jQuery?</p>
| javascript jquery | [3, 5] |
4,269,170 | 4,269,171 | How to call method of .aspx from .cs file | <p>I created web page in that i used javascript in .aspx file. </p>
<p>I have a save-button,but in the source code i used javascript for save button, where i declared a function called <code>OnClientClick="javascript : validateTextTest()"</code> and in the head of source code i called this function <code>validateTextTest()</code>.</p>
<p>Below is the save button in source code:</p>
<pre><code><asp:Button ID="Save" runat="server"
onclick="Save_Click" Text="Save"
OnClientClick="javascript : validateTextTest()" Width="63px" />
</code></pre>
<p>Now i need to call a function <code>validateTextTest()</code> in save button of .cs file.Because i have two to three textboxs, if i leave one texbox out of three textbox it should not insert into DB.</p>
<p>So please tell me how to call the function in .cs file.</p>
| javascript asp.net | [3, 9] |
2,461,460 | 2,461,461 | how to close client pop up windows | <p>How do I close all child popup windows which are already opened using jquery, after the user logs out?</p>
| javascript jquery | [3, 5] |
2,418,274 | 2,418,275 | Learning Javascript vs. jQuery | <p>I got the Wrox.Beginning.JavaScript.3rd.Edition and wanted to start learning it from scratch, then my boss came along and said that why bother, learn jQuery.
Can I understand jQuery and work with it although I am a newbie and have limited knowledge in ASP.net, vb.net, some C#, and basic HTML?!</p>
| javascript jquery | [3, 5] |
2,228,721 | 2,228,722 | Customising a JQuery Element | <p>Is it inadvisable to add methods to a JQuery element? </p>
<p>eg: </p>
<pre><code>var b = $("#uniqueID");
b.someMethod = function(){};
</code></pre>
<p><strong>Update</strong></p>
<p>Just to clarify, I am working on a JS-driven app that is binding JSON data to local JS objects that encapsulate the business logic for manipulating the actual underlying DOM elements. The objects currently store a reference to their associated HTML element/s. I was thinking that I could, in effect, merge a specific <em>instance</em> of a jquery element with it's logic by taking that reference add adding the methods required. </p>
| javascript jquery | [3, 5] |
2,277,966 | 2,277,967 | How to get width and height of a view | <p>I have a class called game that extends View that is added to a LinearLayout. I know that it is displaying my View but i need to get the width and height of the view in order to draw some of my images. Here is my constructor code:</p>
<pre><code>public Game(Activity activ)
{
activ.setContentView(R.layout.game);
...
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
setLayoutParams(lp);
layout = (LinearLayout)activ.findViewById(R.id.game_layout);
layout.addView(this);
...
}
</code></pre>
<p>now when i do this.getWidth() and this.getHeight() i keep getting a return value of 0. How can i get the width and the height of my view?</p>
| java android | [1, 4] |
232,920 | 232,921 | set the loading progress bar in my application | <p>how to set progress bar this is my code plz send me the code.....</p>
<pre><code> Button b1= (Button) findViewById(R.id.button1);
b1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loadFeed(statutory);
}
});
</code></pre>
| java android | [1, 4] |
3,800,745 | 3,800,746 | How to set an event on the parent element using jQuery | <p>help me figure out how to set an event on the parent element (<code><tr></code>)
I can't find the error in the condition</p>
<pre><code><script type="text/javascript">
$('table tbody tr').each(function(){
$(this).find('a:first').click(function(){
if($(this).parents().get(1).tagName == 'TR') {
$(this).parents().get(1).find('tr').css('background', 'red'); //What's wrong?
}
});
</script>
<table>
<tbody>
<tr>
<td><a href="#">text</a></td>
<td>text</td>
</tr>
</tbody>
</table>
</code></pre>
<p>Unfortunately, the formatting, I don't see any more special tag</p>
| javascript jquery | [3, 5] |
5,292,926 | 5,292,927 | Executing javascript within PHP | <p>I believe it is possible to execute a java script function within PHP, but will it then remain server side as opposed to client side? Can I, within PHP, call a .js function, passing it some args, and have it return to the PHP that called it?</p>
<p>A script I want to use returns XML, and I want to get the user inputs using PHP, pass them to the .js function <em>residing on the server</em>, then take the returned xml and parse it back in the PHP part.</p>
<p>I ask because I see people commenting that because .js is client side and PHP is server side, they don't get along. I was hoping that by executing the .js function in the PHP, I could spoof the .js call as coming from the local machine (the server).</p>
<p>Thanks for any information!</p>
| php javascript | [2, 3] |
2,080,657 | 2,080,658 | Error with taking spinner data from database | <p>Booking.java</p>
<pre><code>package one.two;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.SimpleCursorAdapter;
import android.widget.Spinner;
public class Booking extends Activity
{
private DBAdapter db;
private Spinner colourSpinner;
private String txtArrival;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
db = new DBAdapter(this);
db.open();
setContentView(R.layout.booking);
Cursor c = db.getSpinnerData();
startManagingCursor(c);
String[] from = new String[]{DBAdapter.KEY_ARRIVAL};
int[] to = new int[]{R.id.txtArrival};
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, c, from, to );
adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
Spinner colourSpinner = (Spinner) findViewById(R.id.myspinner);
colourSpinner.setAdapter(adapter);
}
</code></pre>
<p>Where would i declare my {KEY_ARRIVAL} as i already have my KEY_ARRIVAL declared in my DBAdapter.java. But there is an error stating KEY_ARRIVAL cannot be resolved?</p>
| java android | [1, 4] |
4,426,742 | 4,426,743 | Is partial class in C# and in C++ defining functions in multilple CPP files are same? | <p>In C++ we can declare a class in a .h file and can have the definitions for functions across multiple files. Is this concept same by using partial keyword with classes in C#?</p>
| c# c++ | [0, 6] |
4,186,553 | 4,186,554 | String from codebehind to array in Javascript | <p>Hi all i have code that reads from a DB and populates a string in the code behind</p>
<pre><code>List<string> rows = new List<string>();
DataTable prods = common.GetDataTable("vStoreProduct", new string[] { "stpt_Name" }, "stpt_CompanyId = " + company.CompanyId.ToString() + " AND stpt_Deleted is null");
foreach (DataRow row in prods.Rows)
{
prodNames += "\"" + row["stpt_Name"].ToString().Trim() + "\",";
}
string cleanedNanes = prodNames.Substring(0, prodNames.Length - 1);
prodNames = "[" + cleanedNanes + "]";
</code></pre>
<p>This produces something like ["Test1","Test2"]</p>
<p>In javascript i have </p>
<pre><code>var availableTags = '<% =prodNames %>';
alert(availableTags);
</code></pre>
<p>How can i access this like an array in javascript like</p>
<pre><code>alert(availableTags[5]);
</code></pre>
<p>and get the full item at the given index.</p>
<p>Thanks any help would be great</p>
| c# javascript | [0, 3] |
2,011,956 | 2,011,957 | jquery array of checkboxes contains the last one checked | <p>I have a group of checkboxes that I'm trying to pass through POST via AJAX/PHP. When I fill the array it's only picking up the last one. </p>
<p>HTML</p>
<pre><code><input type="checkbox" name="committee[]" value="membership">Membership <br/>
<input type="checkbox" name="committee[]" value="operations">Operations <br/>
<input type="checkbox" name="committee[]" value="membership">Board <br/>
</code></pre>
<p>Javascript</p>
<pre><code>$("#save").click(function (e) {
...
var committee = { 'committee[]' : []};
$('input:checked').each(function(){
committee['committee[]'].push($(this).val());
});
$.ajax({
url: 'save.php',
type: 'POST',
data: {
...
committee: committee
}
});
});
</code></pre>
<p>On the <code>save.php</code> all I'm doing at this point is <code>print_r($_POST);</code> and seeing that only the last checked box shows up. I know it's something I'm doing wrong in the <code>input:checked</code> function, but I'm not sure what. </p>
| php jquery | [2, 5] |
4,377,984 | 4,377,985 | closing element opened by toggle() function | <p>How to close element opened by toggle() function when I click on any place in browser window. For example StackExchange link on this site. When I click on this link div appears, but if I click on any place in window, it disappears.</p>
| javascript jquery | [3, 5] |
2,810,881 | 2,810,882 | load jquery before elements on a page | <p>How do i load jquery before all the html elements to stop unstyled content flashing before jquery kicks in.</p>
<p>I know you can do this with <code>display:none</code> in the css but I would like to know how to do it in an accesible way.</p>
<p>heres an example</p>
<p><a href="http://satbulsara.com/tests/" rel="nofollow">http://satbulsara.com/tests/</a></p>
| javascript jquery | [3, 5] |
2,727,199 | 2,727,200 | jQuery - setting an element's text only without removing other element (anchor) | <p>I have an element like this:</p>
<pre><code><td>
<a>anchor</a>
[ some text ]
</td>
</code></pre>
<p>And i need to set it's text in jQuery, without removing the anchor.</p>
<p>The element's contents could vary in order (text before or after), and the actual text is unknown.</p>
<p>Thanks</p>
<p><strong>New Update</strong></p>
<p>This is what i came up using, assumes only a single text node:</p>
<pre><code> function setTextContents($elem, text) {
$elem.contents().filter(function() {
if (this.nodeType == Node.TEXT_NODE) {
this.nodeValue = text;
}
});
}
setTextContents( $('td'), "new text");
</code></pre>
| javascript jquery | [3, 5] |
3,531,443 | 3,531,444 | How to get the value of an ASP.net variable into a javascript textbox | <p>I'm writing some Javascript code for an ASP.net page.</p>
<p>I have the string "foo" assigned to a string variable <code>myString</code>.</p>
<p>I would like to assign the value of <code>myString</code> to a JavaScript variable, so I write in my ASP.net code:</p>
<pre><code><script type='txt/javascript' language='javascript'>
var stringFromDotNet = '<%=myString%>';
</script>
</code></pre>
<p>This works fine as long as <code>myString</code> does not contain quotation marks or line-breaks, but as as soon as I try to assign something with quotation marks or line-breaks, all hell breaks loose and my code doesn't work. As a matter of fact, I can see that this code is vulnerable to all sort of injection attacks.</p>
<p>So... What can I do get the value of <code>myString</code> assigned to a variable in JavaScript?</p>
<p><i>Update</i>: I've tried creating a page with just an ASP:Hidden field. It looks like the values inside are html encoded.</p>
| javascript asp.net | [3, 9] |
4,605,776 | 4,605,777 | jQuery setting specific numbers in select menus | <p>I am working on this website here <a href="http://offline.raileisure.com/" rel="nofollow">http://offline.raileisure.com/</a></p>
<p>on the right there are some options to book a reservation..</p>
<p>Where it says No. of Adults and No. of Children, i need this to be limited to x per property..</p>
<p>i.e. if the Station Masters House is selected its maximum occupancy is 8 people..</p>
<p>So if 5 Adults are selected i need the Children select menu to only show the differemce between 5-8 if that makes sense..</p>
<p>Otherwise someone could book 5 children and 5 adults... and that would be more than the maximum 8...</p>
<p>Same as if the carriage is chosen the maximum occupancy is 4</p>
<p>Thanks</p>
<p>Lee</p>
| javascript jquery | [3, 5] |
1,723,883 | 1,723,884 | how to hide div with jquery when click anywhere except one div? | <p>I am making a search input on focus it shows a div with options with following:</p>
<pre><code>$("#search").focus(function(){
$("#options").fadeIn("fast");
});
</code></pre>
<p>I am hiding the div back with this function</p>
<pre><code> $("#search").blur(function(){
$("#options").fadeOut("fast");
});
</code></pre>
<p>now the problem is even when user clicks at any checkbox in <code>#option</code> it hides. How I can stop it hidding when clicking checkboxes?</p>
| javascript jquery | [3, 5] |
4,384,135 | 4,384,136 | Crop image from Gallery with predefined bitmap | <p>I'm using the following code to crop my image with the standard media gallery.</p>
<pre><code>public void cropImage3(boolean scale, boolean return_data, boolean faceDetection, boolean circleCrop, Bitmap btmp) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null);
intent.setType("image/*");
intent.putExtra("crop", "true");
intent.putExtra("data", btmp);
intent.putExtra("scale", scale);
intent.putExtra("return-data", return_data);
intent.putExtra(MediaStore.EXTRA_OUTPUT, getTempUri());
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
intent.putExtra("noFaceDetection",!faceDetection);
}
</code></pre>
<p>i'm using the data parameter to specify a bitmap to use with the Gallery Crop Activity.
This works, however, it first shows the chooser, then i have to select a (random) image and only then it shows the predefined bitmap that i put here intent.putExtra("data", btmp);</p>
<p>Now my question is how i can immediatly show the predefined bitmap to show in this activity before selecting an image.</p>
| java android | [1, 4] |
5,800,708 | 5,800,709 | how to restart main activity while retaining some data | <p>This is my first app and I'm trying to write a simple Liar's Dice game. </p>
<p>I wrote everything in the main activity class, rolls random dice, textedit boxes to enter bids and buttons to bid and call. </p>
<p>So after the game runs, how do I get it to keep track of the score and run again? </p>
<p>I've tried making another activity screen with a restart button and have it go there after the game ends so I can restart the main activity. However I am able to press back(phonekey) from that screen and get stuck at the end of the previous game. </p>
<p>Also I am trying to use an array to keep track of the wins and losses but not sure how to go about bringing it back and forth from the activities.</p>
| java android | [1, 4] |
4,525,546 | 4,525,547 | Is there a way to shorted this code? | <p>I have this javascript code that replaces the css class on mouse over. I'm wondering if there is way to have it shorten.</p>
<p>Here's my code.</p>
<pre><code>$(".mainMenu ul.homeMenu li").hover(function(){
if ($(this).find(".symbol").attr("class").indexOf("meetings") >= 0)
{
$(this).find(".symbol").removeClass("meetings_white").addClass("meetings");
}
else if ($(this).find(".symbol").attr("class").indexOf("restaurant") >= 0)
{
$(this).find(".symbol").removeClass("restaurant_white").addClass("restaurant");
}
else if ($(this).find(".symbol").attr("class").indexOf("serenity") >= 0)
{
$(this).find(".symbol").removeClass("serenity_white").addClass("serenity");
}
else if ($(this).find(".symbol").attr("class").indexOf("photo") >= 0)
{
$(this).find(".symbol").removeClass("photo_gallery_white").addClass("photo_gallery");
}
});
</code></pre>
| javascript jquery | [3, 5] |
3,199,025 | 3,199,026 | Javascript variable problem | <p>I have a variable in javascript:</p>
<pre><code>var activeSearchButton = document.getElementById('<%=btnSearch.ClientID %>');
</code></pre>
<p>I want to set it like this:</p>
<pre><code><asp:TextBox ID="WFTo" runat="server" onchange="activeSearchButton = document.getElementById('<%=btnWFSearch.ClientID %>');"></asp:TextBox>
</code></pre>
<p>When I am trying to use the varible in javascript function, it is null. And the source shows:</p>
<pre><code>onchange="activeSearchButton = document.getElementById('&lt;%=btnSearch.ClientID %>');"
</code></pre>
<p>I noticed '& lt;' instead of "<". Is this the reason of my problem? Why does this happen? Or maybe there is another reason?</p>
<p>Thank you very much.</p>
| javascript asp.net | [3, 9] |
2,262,817 | 2,262,818 | Trying to delete multiple files from a single directory whose names match\contain a particular string | <p>I wish to delete image files. The files are named <code>somefile.jpg</code> and <code>somefile_t.jpg</code>, the file with the <code>_t</code> on the end is the thumbnail. With this delete operation I wish to delete both the thumbnail and original image.</p>
<p>The code works up until the <code>foreach</code> loop, where the <code>GetFiles</code> method returns nothing.
The string.Substring operation successfully returns just the file name with no extension and no <code>_t</code> e.g: <code>somefile</code>.</p>
<p>There are no invalid characters in the file names I wish to delete.
Code looks good to me, only thing I can think of is that I am somehow not using the searchpattern
function properly.</p>
<pre><code>filesource = "~/somedir/somefile_t.jpg"
</code></pre>
<hr>
<pre><code>var dir = Server.MapPath(filesource);
FileInfo FileToDelete = new FileInfo(dir);
if (FileToDelete.Exists)
{
var FileName = Path.GetFileNameWithoutExtension(FileToDelete.Name);
foreach(FileInfo file in FileToDelete.Directory.GetFiles(FileName.Substring(0, FileName.Length - 2), SearchOption.TopDirectoryOnly).ToList())
{
file.Delete();
}
}
</code></pre>
| c# asp.net | [0, 9] |
726,240 | 726,241 | Onchange Event in JavaScript or Jquery | <p>Please help me. I need to change a textbox value when i give value in another textbox. see i have three text box first one is Qty another Amount and third will be a Total Amount.
here i will give a value for Qty and amount. Now third textbox i mean Total amount will be appear automatically. </p>
<p>Please help me...</p>
| javascript jquery | [3, 5] |
1,893,994 | 1,893,995 | Android CursorAdapters, ListViews and background threads | <p>This application I've been working on has databases with multiple megabytes of data to sift through. A lot of the activities are just ListViews descending through various levels of data within the databases until we reach "documents", which is just HTML to be pulled from the DB(s) and displayed on the phone. The issue I am having is that some of these activities need to have the ability to search through the databases by capturing keystrokes and re-running the query with a "like %blah%" in it. This works reasonably quickly except when the user is first loading the data and when the user first enters a keystroke. I am using a ResourceCursorAdapter and I am generating the cursor in a background thread, but in order to do a listAdapter.changeCursor(), I have to use a Handler to post it to the main UI thread. This particular call is then freezing the UI thread <em>just long enough</em> to bring up the dreaded ANR dialog. I'm curious how I can offload this to a background thread totally so the user interface remains responsive and we don't have ANR dialogs popping up.</p>
<p>Just for full disclosure, I was originally returning an ArrayList of custom model objects and using an ArrayAdapter, but (understandably) the customer pointed out it was bad memory-manangement and I wasn't happy with the performance anyways. I'd really like to avoid a solution where I'm generating huge lists of objects and then doing a listAdapter.notifyDataSetChanged/Invalidated()</p>
<p>Here is the code in question:</p>
<pre><code>private Runnable filterDrugListRunnable = new Runnable() {
public void run() {
if (filterLock.tryLock() == false) return;
cur = ActivityUtils.getIndexItemCursor(DrugListActivity.this);
if (cur == null || forceRefresh == true) {
cur = docDb.getItemCursor(selectedIndex.getIndexId(), filter);
ActivityUtils.setIndexItemCursor(DrugListActivity.this, cur);
forceRefresh = false;
}
updateHandler.post(new Runnable() {
public void run() {
listAdapter.changeCursor(cur);
}
});
filterLock.unlock();
updateHandler.post(hideProgressRunnable);
updateHandler.post(updateListRunnable);
}
};
</code></pre>
| java android | [1, 4] |
105,885 | 105,886 | jQuery click event not firing when appending new button | <p>When I click the 'Show' button the show listener is invoked and a new hide button is displayed. But why is the hide button not invoked when I then click 'Hide' ?</p>
<pre><code> $('.myCss').append('<input type="button" class="show" value="Show"/>');
$('.show').on('click', function () {
console.log('show clicked');
$('.myCss').append('<input type="button" class="hide" value="Hide"/>');
});
$('.hide').on('click', function () {
console.log('hide clicked');
$('.myCss').append('<input type="button" class="show" value="Show"/>');
});
</code></pre>
| javascript jquery | [3, 5] |
5,030,255 | 5,030,256 | jQuery: Fire click on event on a span | <p>I saw a post earlier today and have been playing around with: <a href="http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html" rel="nofollow">http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html</a></p>
<p>What I'd like to be able to do is when a span gets clicked, to fire the click event on a different element in the page:</p>
<pre><code><div class='editable sampleItem pointer' id='qqq'>click me!!!</div>
</code></pre>
<p>Is that possible?</p>
| javascript jquery | [3, 5] |
900,164 | 900,165 | Creating Android magazine application with APPMK | <p>I'm try to make an Android magazine application. Until now, the best and the simplest way is using <strong>APPMK</strong> <a href="http://www.appmk.com/" rel="nofollow">http://www.appmk.com/</a>. and my questions are : </p>
<ol>
<li>Is it possible customize between using APPMK and coding in eclipse editor?</li>
<li>Can I retrieve the magazine's content from HTML, XML or JSon? Because in <strong>APPMK</strong>, the content get from pdf files.</li>
</ol>
| java android | [1, 4] |
4,097,303 | 4,097,304 | Comparing parts of a byte[] to determine whether two byte[] could be the same | <p>I have a Cursor adapter where I potentially have a number of images in a grid setup. </p>
<p>When the <code>bindView</code> method runs it needs to complete very quickly and therefore as part of a performance/efficiency boost I would like to compare the images before I make any changes(so I don't start running my Async Tasks etc multiple times). However, I can't store the entire <code>byte[]</code> (e.g. in the ViewHolder) as this clearly eats through memory.</p>
<p>However, I was thinking I could take a part of an image byte array (20 characters or so) and compare it with what is currently in the ViewHolder and if different this could be verified.</p>
<p>Is this a viable option or is there a better way to do this? Secondly, what part of the <code>byte[]</code> is going to produce the most unique set of characters?</p>
| java android | [1, 4] |
2,880,803 | 2,880,804 | Get variable from PHP to JavaScript | <p>I want to use a PHP variable in JavaScript. How is it possible?</p>
| php javascript | [2, 3] |
4,600,913 | 4,600,914 | How to use live method with zclip plugin? | <p>How to use live method with this -> <a href="http://www.steamdev.com/zclip/" rel="nofollow">http://www.steamdev.com/zclip/</a></p>
<p>Edit:</p>
<pre><code>$(document).ready(function(){
$('a#copy-description').zclip({
path:'js/ZeroClipboard.swf',
copy:$('p#description').text()
});
</code></pre>
<p>i need to use live method cuz <code>a#copy-description</code> will be generate via javascript.</p>
| javascript jquery | [3, 5] |
5,860,948 | 5,860,949 | Error function not invoked in AJAX using Jquery | <pre><code> $("#submit").click(function(){
$.ajax({
type: "POST",
url: "session.php",
data: "name=John123&location=Boston",
success: function(a, msg2){
$('#feedback').removeClass().addClass('success').text(a +' '+msg2).fadeIn('slow');
},
error: function(a, b, c){
$('#feedback').removeClass().addClass('error').text('This is' +b).fadeIn('slow');
},
</code></pre>
<p>I'm trying to invoke error function using the following code in PHP:</p>
<pre><code>if ($_POST['name'] != "John") {
$message['error'] = true;
$message['message'] = "Hmm, please enter a subject in the subject field.";
echo json_encode($message);
}
else
{
echo $_POST['name'];
}
</code></pre>
<p>But I'm always getting success function invoked. Is there any way i can get error function invoked.</p>
| php jquery | [2, 5] |
5,435,012 | 5,435,013 | Want to show a message box using javascript | <p>Hi everyone I have a web form in which I am having a button on clicking which data back up is being taken, I used the following javascript :</p>
<pre><code><script language="javascript" type="text/javascript">
function showPleaseWait() {
document.getElementById('PleaseWait').style.display = 'block';
}
</script>
<asp:Button ID="btnTakebackup" runat="server" Text="Take Backup" Enabled="true"
onMouseDown="showPleaseWait()" CausesValidation="false" />
<div id="PleaseWait" style="display: none;">"Please Wait Backup in Progress.."</div>
</code></pre>
<p>Hi I am using a button to take a back up.</p>
<p>Now I want to show a message in <code>btnTakebackup_Click()</code> event, whether Back up was successful or not.
I used <code>Response.Write("<script>alert('abcd');</script>");</code> in <code>btnTakebackup_Click()</code> event.
But the problem is that I want to show the page also, which is not showing instead white background is showing.</p>
<p>Thanks in advance...</p>
| c# javascript asp.net | [0, 3, 9] |
5,681,758 | 5,681,759 | jQuery/JS simulation | <p>I'm not an expert in jQuery or Javascript (I have only started with it recently), so this might sound like a silly question:
I have 4 tabs, all of which are clickable. So, I made 2 functions, 1 to actually execute on click, and one to only "simulate" the click, so I could change the tabs every 5 seconds. What I've done is, set a bool variable "click" to false, which is set to "true" if the actualy click function is executed, so the automatic tab switching stops. And below both of these functions I added a while loop like this:</p>
<pre><code>var nr = 0;
while(!klik){
tabss.eq(st % 4).click().delay(5000); //this is the "simulation"
st++;
}
</code></pre>
<p>now, it opens up the first tab as it's suppose to, but after 5 seconds nothing happens. Any suggestions? I sorta want is like a slideshow that stops, when users clicks something.</p>
| javascript jquery | [3, 5] |
326,020 | 326,021 | routing in javascript or php function | <p>I was wondering if there is a way of doing this:</p>
<p>let's say I'm calling this method:</p>
<p><code>object.segment1_segment2_segment3();</code></p>
<pre><code>// or
$object->segment1_segment2_segment3();
</code></pre>
<p>What you have to know is that segment1_segment2_segment3() is not necessarily an existing method, and I want my program to guess which existing function to call, based on the segments in the object's method.</p>
<p>I don't know if i'm clear enough but, I would like to know if you think it's possible, and what would be the cleanest way to do such a MAGIC thing ^^</p>
<p>good day to you mister reader ^^</p>
| php javascript | [2, 3] |
2,145,008 | 2,145,009 | Having jQuery inside of an iframe modify the parent window | <p>i have a page which has an iframe.</p>
<p>in the iframe, I want jQuery to remove an element from the patent page, so I'm trying:</p>
<pre><code>parent.$('#attachment-134').remove();
</code></pre>
<p>But that doesn't work. Any ideas? thanks</p>
| javascript jquery | [3, 5] |
4,053,457 | 4,053,458 | Simple Android App Without XML | <p>I'm teaching a few colleagues Java with the intent to go into Android game programming. Is there a way to display a box on the screen, and when you touch it it changes colors, without creating an Activity (this is in Eclipse) and diving into the ugly world of XML?</p>
| java android | [1, 4] |
2,196,190 | 2,196,191 | Pushing a document.ready callback: is it possible? | <p>I already have a jQuery(document).ready fragment defined. Since I'm working on a large-scale modular project, I would like to allow components to push callbacks to the document.ready event in order to run their own code without modifying the global javascript file.</p>
<p>One viable way is to define an array of callbacks into which each component (portlet, actually) will be pushing its own callback, and then have global ready callback scan the array and run each callback.</p>
<p>I wonder if there is a jQuery way to directly push a callback. I believe that if I set jQuery(document).ready from somewhere else in the code I would be surely overwriting what was already set, and not running the global initialization callback.</p>
<p>What do you suggest me to do?</p>
<p>I also read that the ready function can be used only on the document object, so I cannot bind it to HTML objects.</p>
<p>My current purpose is to map <code>Ice.onSendReceive</code> on a certain button (I'm using ICEFaces 1.8). But I would also like to extend this possibility to other function calls and avoid using <code>window.setTimeout</code></p>
| javascript jquery | [3, 5] |
88,211 | 88,212 | Deserialize a string that contains a repeating set of elements | <p>I'm getting the response string as follows:</p>
<pre><code>Navigator[sizenavigator:INTEGER (Size)
modifier:size
score:1.300855517 type:INTEGER unit:kB
hits:7744
hitsUsed:7744
ratio:1
min:65
max:66780
mean:3778
sum: 29259942
frequencyError:-1
entropy:1.300855533
points:
Name:Less than 1
Interval: ->1023
Value:[;1023]
Count:1121
Name:Between 1 and 2
Interval: 1024->2047
Value:[1024;2047]
Count:3325
Name:Between 2 and 3
Interval: 2048->3071
Value:[2048;3071]
Count:1558
Name:More than 3
Interval: 3072->
Value:[3072;]
Count:1740
]
</code></pre>
<p>As you can see <strong>Name, Interval, Value, Count</strong> is repeating and this will repeat 'n' no. of times. How can I de-serialize it by creating a type (class) for this process ?</p>
<p>Say if the class is somewhat like:</p>
<pre><code>class Navigator
{
string modifier;
string score;
.
.
string Name;
string Interval;
string Value;
int Count;
}
</code></pre>
<p>How can we get the repeated values for <strong>Name, Interval, Value, Count</strong> ??</p>
<p>Thanks in advance.</p>
| c# asp.net | [0, 9] |
3,108,438 | 3,108,439 | How to delay an inflate with a button | <p>Well I'm a new one in this word an I'm trying to delay an inflate because when you pressed a button an animation in other buttons happen and the inflate too.</p>
<p>But you cannot see animations because inflate comes quickly, so I want to delay the inflate like 2000ms so you can see first the animations and then the information that is in the inflate.</p>
<p>I'm using the same button for call the animations and the inflate.</p>
<p>Here's my code:</p>
<pre><code> case R.id.btnsalud:
//This is the code for animations
//This is the loader for all the animations that is used for the button
{final Animation animBounceForSalud = AnimationUtils.loadAnimation(this, R.anim.bounce);
final Animation animBounceForSalud1 = AnimationUtils.loadAnimation(this, R.anim.bounce1);
//This object is the objects (buttons) whom is applied the animation
final Button animSalud = (Button)findViewById(R.id.btnobra);
final Button animSalud1 = (Button)findViewById(R.id.btnprotesta);
//This object (button) is the one which applies the animation to the other buttons
Button btnBounceSalud = (Button)findViewById(R.id.btnsalud);
animSalud.startAnimation(animBounceForSalud);
animSalud1.startAnimation(animBounceForSalud1);
animSalud.setVisibility(500);
animSalud1.setVisibility(500);}
//This is the code for inflate
//Check if the Layout already exists
LinearLayout hiddenLayout1 = (LinearLayout)findViewById(R.id.hiddenLayout);
if((hiddenLayout1 == null)){
//Right here is where you can defined in which layout is going to
//inflate the hidden layout
LinearLayout myLayout = (LinearLayout)findViewById(R.id.inflateposition0);
View hiddenInfo = getLayoutInflater().inflate(R.layout.salud, myLayout, false);
myLayout.addView(hiddenInfo);
}
break;
</code></pre>
<p>Any answer will be apreciated :D</p>
| java android | [1, 4] |
3,137,504 | 3,137,505 | <type= "input" runat = "server"> | <p>I know that we have client side controls and we have server side controls. Client side controls are basic HTML controls with and all the other tags while server side controls are like <code><asp:Button></code> and <code><asp: Textbox></code>.</p>
<p>Now when I talk about something like I know that this is going to be executed at the server so it is a server control but it does not qualify for for an asp control at the same time. </p>
<p>How is it functionally different than control?</p>
| c# asp.net | [0, 9] |
4,544,054 | 4,544,055 | Getting window ScrollTop pixel per pixel | <p>I'd like to know if it is possible to scroll height (scrollTop) with 1 step increments.</p>
<p>Currently I'm using:</p>
<pre><code>$(window).scroll(function(e) {
console.debug($(this).scrollTop());
});
</code></pre>
<p>But when I scroll too fast, console shows me:</p>
<pre><code>0
1
2
150
350
....
</code></pre>
<p>Is there any way to get the increment one by one?</p>
| javascript jquery | [3, 5] |
4,530,556 | 4,530,557 | jQuery -> check the visibility of an element | <p>I have a div element which will be shown/hidden in many places.
Is it possible if I do a </p>
<pre><code>$("#divtobetracked").hide();
</code></pre>
<p>or a </p>
<pre><code>$("#divtobetracked").show();
</code></pre>
<p>that another action is fired?
Because if .hide() of the element, a button should also be hidden, and if the element wil be shown, a button should also be displayed.</p>
<p>So, I think I can write a function which toggle and do the things I want and I call the function if I want to show/hide the element.</p>
<p>But, is there another possibility, sth. like a .live() event?</p>
<p>Best Regards.</p>
| javascript jquery | [3, 5] |
4,702,853 | 4,702,854 | List all session info | <p>I want to display all the session information of my asp.net page (aspx) in the page. How can I do that?</p>
<p>The programming language is C#.</p>
<p>Thanks for the help.</p>
<p>Best regards</p>
| c# asp.net | [0, 9] |
5,838,188 | 5,838,189 | Grabbing hash from URL? | <p>I want it so that if someone visits:</p>
<p><a href="http://www.site.com/#hash" rel="nofollow">http://www.site.com/#hash</a></p>
<p>It puts the data after the hash into the input box with the id <code>url</code></p>
<p>and then it submits the form.</p>
<p>Here is my code:</p>
<pre><code><form method="post">
<input id="url" placeholder="Enter" name="url">
<input type="submit" id="visit" value="Visit" class="submit">
</form>
</code></pre>
<p>How can I do this?</p>
| javascript jquery | [3, 5] |
416,907 | 416,908 | jquery and php relations | <p>how can i store jquery ajax result in a php variable?
i mean i want to get result of ajax jquery and store it in php variable and ECHO it later</p>
| php jquery | [2, 5] |
2,490,165 | 2,490,166 | Menu hover effect in Joomla Script | <p>i need script sucha as here: <a href="http://demo.opensourcecms.com/joomla/administrator/index.php" rel="nofollow">http://demo.opensourcecms.com/joomla/administrator/index.php</a></p>
<p>Admin Username: admin</p>
<p>Admin Password: demo123</p>
<p>Script as menu hover effect. </p>
<p>Where I find this script?</p>
| javascript jquery | [3, 5] |
5,337,233 | 5,337,234 | How to fire a custom intent? | <p>I have created a <code>BroadcastReceiver</code>. Now how can I launch my custom <code>Intent</code> to test the receiver? AFAIK I cannot use Android JUnit test since the test does not have the application <code>Context</code> needed to launch an <code>Intent</code>!</p>
| java android | [1, 4] |
837,853 | 837,854 | jQuery simple slider is not looping | <p>I have a simple slider for 5 different div tags, and a fixed ticker at the end of the page. It works fine but it's not looping.</p>
<p>*not: I got this code from a previous topic here (I am a beginner)</p>
<p>HTML:</p>
<pre><code><body>
<div id="slide1">text 1</div>
<div id="slide2">text 2</div>
<div id="slide3">text 3</div>
<div id="slide4">text 4</div>
<div id="slide4">text 5</div>
<div id="footer">java script ticker goes here</div>
</body>
</code></pre>
<p>Script:</p>
<pre><code>/* Hide all but first promo div */
$("div[id^=slide]:gt(0)").hide();
/* Setup Interval */
setInterval(function(){
/* Hide visible div, get reference to next promo div */
reference = $("div:visible:not(#footer)").hide().next("div[id^=slide]");
/* If there is not a next promo div, show the first promo div */
reference.size() ? $(reference).fadeIn() : $("div:first").fadeIn() ;
/* Do this every five seconds */
}, 5000);
</code></pre>
| javascript jquery | [3, 5] |
3,804,132 | 3,804,133 | Javascript's Confirm on RadioButtonList not working in FireFox | <p>Below is my <code>java-script</code> code,</p>
<pre><code>function show_confirm() {
var r = window.confirm("Are you sure to create invoice?");
if (r == true) {
return true;
}
else {
return false;
}
}
</code></pre>
<p>Used this <code>Radiobuttonlist</code>, <code>onclick= "return show_confirm()"</code> not working in FireFox.
Can you please suggest me to write confirm message with radiobuttonlist selected change event using javascript.</p>
| javascript asp.net | [3, 9] |
5,308,041 | 5,308,042 | after modify script, sEcho result not same | <p>how to make the response result at <code>sEcho</code> become not zero?</p>
<pre><code>{"sEcho": 0,
</code></pre>
<p>i've been use this code but result still zero..</p>
<pre><code> $sOutput .= '"sEcho": '.intval($_POST['sEcho']).', ';
</code></pre>
| php jquery | [2, 5] |
892,184 | 892,185 | ASP.Net global error handler for all... but a few | <p>i want to implement a global error handler for my asp.net website.</p>
<p>I usually implement this in the global.asax by logging the error and redirecting to an error page.</p>
<p>So far so good, but in this case we have calls to asmx webservices from Jquery, and, sorry to say, Errors thrown in the asmx webservice are used in the calling Jquery.
So when errors are thrown from an asmx file, i want to log them and rethrow them</p>
<p>The only thing i could come up with is to check for the .asmx extension in the stacktrace, but was hoping for some other way (don't know why, but string checking just feels awkward)</p>
| c# asp.net | [0, 9] |
4,317,705 | 4,317,706 | what is the alternative class for AudioInputStream in java (Android)? | <p>About a year ago I started to built an application for android.
Now when I try to run it I get an exception about AudioInputStream class, After a short research that I did using GOOGLE I found out that android doesn't support this class anymore...
Is their any alternative for it?</p>
<p>This is the code that I wrote:</p>
<pre><code> private void merge2WavFiles(String wavFile1, String wavFile2, String newWavFilePath) {
try {
File wave1 = new File(wavFile1);
if(!wave1.exists())
throw new Exception(wave1.getPath() + " - File Not Found");
AudioInputStream clip1 = AudioSystem.getAudioInputStream(wave1);
AudioInputStream clip2 = AudioSystem.getAudioInputStream(new File(wavFile2));
AudioInputStream emptyClip =
AudioSystem.getAudioInputStream(new File(emptyWavPath));
AudioInputStream appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, emptyClip),
clip1.getFormat(),
clip1.getFrameLength() + 100
);
clip1 = appendedFiles;
appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, clip2),
clip1.getFormat(),
clip1.getFrameLength() + clip2.getFrameLength()
);
AudioSystem.write(appendedFiles, AudioFileFormat.Type.WAVE, new File(newWavFilePath));
} catch (Exception e) {
e.printStackTrace();
}
}
</code></pre>
| java android | [1, 4] |
1,239,963 | 1,239,964 | Why in JavaScript parent variable takes the value of child variable? | <p>Help me please with next problem. </p>
<pre><code>var a = _b; //_b and _c is arguments. _b is array of objects (length = 1), _c is integer value
if (a.length != 0)
{
$.each(a,function(k,v){
if (v.c!= _c)
a.splice(k,1);//here a becomes empty, but _b becomes empty too. i don't know why.
});
if (a.length != 0){
_b = a;
}
}
</code></pre>
<p>what am I doing wrong?</p>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.