Unnamed: 0
int64 302
6.03M
| Id
int64 303
6.03M
| Title
stringlengths 12
149
| input
stringlengths 25
3.08k
| output
stringclasses 181
values | Tag_Number
stringclasses 181
values |
---|---|---|---|---|---|
4,360,564 | 4,360,565 | Reinitializing jCarouselLite at runtime | <p>Can anyone tell me how to reinitialize jCarouselLite plugin at runtime. I have 5 sliders in one page and I want to perform switching between sliders. All code is done. what I want is to re-initialize "jCarouselLite" plugin at run time of current slider. My code is as follows: </p>
<pre><code> if(isNext){
/* Removing Slider */
$(current_selector).jCarouselLite = null;
$(".btn_prev"+current).unbind('click');
$(".btn_next"+current).unbind('click');
/* Re-initializing Slider */
$(current_selector).jCarouselLite({
btnPrev: ".btn_prev"+current,
btnNext: ".btn_next"+current,
circular: false,
visible: 1,
});
}else{ alert("in prev");}
</code></pre>
<p>Any Help would be appreciated. Thanks.</p>
| javascript jquery | [3, 5] |
2,544,306 | 2,544,307 | changing date format from dd/MM/yyyy to MM/dd/yyyy | <p>I have a datepicker which shows date in format dd/MM/yyyy(i know i coould change there itself but by client want it that way) and in database its in format MM/dd/yyyy so i do want to convert in that way.</p>
<p>e.g. in text box 23/09/2010 and in c sharp its convert to mm/dd/yyyy(txtbo1.text)</p>
<p>Regards
Indranil.</p>
| c# asp.net | [0, 9] |
1,681,383 | 1,681,384 | Can Python dictionaries to be as handy as PHP array? | <p>Recently, I'm working on a Python-based project and facing a issue with dictionaries. In PHP I can easily create a multiple dimension array by the following instruction:</p>
<pre><code>$user = "Tom";
$type = "New";
$userlist[$user]['count'] += 1;
$userlist[$user][$type] += 1;
</code></pre>
<p>PHP will create a new element within an array if it doesn't exist, which is very convenient for coding. Can Python dictionaries provide the same and handy function as PHP?</p>
| php python | [2, 7] |
1,214,462 | 1,214,463 | Basic Android development questions | <pre><code>onCreate(Bundle State)
{
TextView label = new TextView(this);
lable.setText("My new Label");
}
</code></pre>
<p>I read that the <code>TextView</code> has a reference to the <code>Activity</code>.
What does it mean for something to have a reference on something else?</p>
| java android | [1, 4] |
4,885,389 | 4,885,390 | list filter: for each word matched, increment by 1 | <p><a href="http://jsfiddle.net/nicktheandroid/yshcR/2/" rel="nofollow">http://jsfiddle.net/nicktheandroid/yshcR/2/</a></p>
<p>you can type into the input box any of the words you see in the list, when a full word is typed that matches a word in the list, it will hide all list-items that do not contain any of the words that are typed into the input. You can type multiple words, and it will match multiple <code>li</code>'s. I appended a span: <code>.keywordcount</code> to the end of each <code>li</code>. I'm trying to get each <code>.keywordcount</code> span to increase or decrease by the number of matched words in that <code>li</code>. So if I typed "canada denmark" into the input box, every <code>li</code> that contains those 2 words should have their <code>.keywordcount</code> span incremented to "2". If an <code>li</code> only contained 1 of those words, then it's <code>.keywordcount</code> would be "1".</p>
<p>I've tried everything I can but I can't figure it out.</p>
| javascript jquery | [3, 5] |
199,858 | 199,859 | How can I tell if iPhone is returning from background in javascript? | <p>I know that the iPhone stops javascript from running when an app is sent to the background (ie pressing the home button while the app is running), but I would like to be able to detect if this has happened when the javascript starts up again when the app is reactivated.</p>
<p>One solution I've been trying is to have an iterator constantly running to "check in" and then running a check against that to tell if the app has gone to background.</p>
<pre><code>var lastCheckinTime = new Date().getTime();
function checkin(){
lastCheckinTime = new Date().getTime();
}
setIterator( checkin, 1000 );
// Later, some code that needs to know if iphone went to background
var now = new Date().getTime();
if( (now - lastCheckinTime) > 1100 ) {
// run sent to background code
</code></pre>
<p>Is there a better way to do this? The problem I've found with this method is that it doesn't work if the user quickly closes and reopens the app, but I haven't figured out a better way of detecting this yet.</p>
| javascript iphone | [3, 8] |
1,109,911 | 1,109,912 | Update a control's value from a static class in ASP.NET | <p>Say that I have an ASP.NET page with a Label control and the following static class which executes a scheduled job:</p>
<pre><code>public static class Job
{
// The Execute method is called by a scheduler and must therefore
// have this exact signature (i.e. it cannot take any paramters).
public static string Execute()
{
// Do work
}
}
</code></pre>
<p>When the job is done, the execute method should update the value of the Label control on the page.</p>
<p>I've done some research and the only way seems to be to use HttpContext.Current.CurrentHandler. However, this is undesirable for me since it can potentially return null. </p>
<p>Since the Execute method cannot take any parameters (see comment), passing the Page instance as an argument is not an option.</p>
<p>Is there any other way to update the control from the static class?</p>
<p>NOTE: the Execute method must be static because I'm creating an EPiServer scheduled job, which requires a static Execute method (that doesn't take any parameters).</p>
| c# asp.net | [0, 9] |
4,495,227 | 4,495,228 | Supersized 3.0 view through iPhone | <p>Using the supersized script <a href="http://buildinternet.com/project/supersized/" rel="nofollow">http://buildinternet.com/project/supersized/</a> on a new site. Same thing happens with the demo site. <a href="http://buildinternet.com/project/supersized/3/core.html" rel="nofollow">http://buildinternet.com/project/supersized/3/core.html</a></p>
<p>When I view it through my iPhone / Android, not seeing the bottom of the site, basically unable to scroll down.</p>
<p>Does this have to do with the CSS or that this script does not work with ?</p>
<p><strong>EDIT:</strong>
Did not know that jQuery not capable of working on mobile devices. Guess that why they came up with jQuery mobile...</p>
| javascript iphone | [3, 8] |
4,621,909 | 4,621,910 | Best Practices: Including PHP in your JavaScript code | <p>I'm a PHP phr34k addicted to JavaScript on the quest for some knowledge. If one were to include php code in their scripts, what would be the best method? I have provided some sample code as an example on how I would go about including PHP in my scripts. </p>
<p>Is this a valid method?</p>
<p><strong>index.php</strong></p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PHP with JavaScript?</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="test.js.php"></script>
</head>
<body>
</body>
</html>
</code></pre>
<p><strong>test.js.php</strong></p>
<pre><code><?php
$foo = 'bar';
?>
$(document).ready(function() {
var foo = '<?php echo $foo; ?>';
alert(foo);
});
</code></pre>
<p>Thanks again!</p>
| php javascript jquery | [2, 3, 5] |
5,179,964 | 5,179,965 | How to use Enterprise Security Application block? | <p>Looking to implement authentication/authorisation for ASP.NET app</p>
<p>Was looking into using Provider model MembershipProvider SQLServerMembershipProvider etc as makes good sense to me.</p>
<p>However I'm looking into the Enterprise Security Application block as well. My question is can/should the two be used in tandem?</p>
| c# asp.net | [0, 9] |
3,794,707 | 3,794,708 | how to validate the null string array (Android Java) | <p>I have a question about how to check either the array string got the null value.
My code is like below but still got the string return even the value is null.</p>
<blockquote>
<p>for (int i=17;i<29;i++)</p>
<p>{ </p>
<p>if (!label[i].equals(null) || !label[i].equals("") || label[i] != null || label[i] != "")</p>
<p>{</p>
<pre><code>Log.d("Get additional label","Additional label = "+label[i]);
}
}
</code></pre>
</blockquote>
<p><strong>Problem Solved</strong></p>
<p>The problem solved when I change from</p>
<blockquote>
<p>if (!label[i].equals(null) || !label[i].equals("") || label[i] != null || label[i] != "")</p>
</blockquote>
<p>to </p>
<blockquote>
<p>if (label[i].length() != 0)</p>
</blockquote>
<p>Thanks for those who replied :)</p>
| java android | [1, 4] |
1,618,359 | 1,618,360 | How can I wrap header text in Gridview? | <p>Hi I am writing some code to display some records in Grid view. I am using Firefox as my Default browser. I wish to wrap a header text. but Firefox is not supporting the wrap property. How can I achieve this?</p>
| c# asp.net | [0, 9] |
5,344,965 | 5,344,966 | jQuery tab controls placed on bottom don't work | <p>I am using this solution to have <a href="http://stackoverflow.com/questions/3689660/jquery-conflict-with-identical-scripts/3689751#3689751">multiple tabs in one page</a>.</p>
<pre><code>$(".tab_content").not(':first-child').hide();
var tabs = $('.tabs li');
tabs.filter(':first-child').addClass('active');
tabs.click(function() {
var current = $(this);
if(!current.hasClass('active')){
current.addClass('active').siblings().removeClass('active');
var activeTab = current.find("a").attr("href");
current.parent().next().children().hide().filter(activeTab).fadeIn();
}
return false;
});
</code></pre>
<p>I need to place the tabs controls after the tab content.
But it won't work. If tabs controls placed before the tabs content, it works fine.
Can you help me?</p>
<p>Here is my <a href="http://jsfiddle.net/pivi/pnm98/" rel="nofollow">jsfiddle</a>: </p>
| javascript jquery | [3, 5] |
5,139,262 | 5,139,263 | What is the namespace for CurrencyManager in ASP.NET? | <p>What is the namespace for <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.currencymanager.aspx" rel="nofollow">CurrencyManager</a> in ASP.NET?</p>
<p>Like in Windows Forms we use System.Windows.Forms namespace for the CurrencyManager class, but for ASP.NET what is the namespace I have to use for the CurrencyManager class?</p>
| c# asp.net | [0, 9] |
3,131,640 | 3,131,641 | Get URL of ASP.Net Page in code-behind from another page | <p>I am trying to find away to determine a pages url from the page object. It seems you can only get the path of the current context.</p>
| c# asp.net | [0, 9] |
80,927 | 80,928 | Identifying the Form that is being Submitted using JQuery | <p>I have several forms on a page with different ids and I want to find out which is submitting and its id. How can I do this?</p>
<pre><code>//stop all forms from submitting and submit the real (hidden) form#order
$('form:not(#order)').submit(function(event) {
event.preventDefault();
</code></pre>
<p>The above stops all forms submitting and I would like put in a conditional saying if this form, then do this etc.</p>
<p>Any help appreciated.</p>
<p>Thanks all</p>
| javascript jquery | [3, 5] |
1,500,151 | 1,500,152 | Save each box height and assign it on click | <p>I have a set of boxes and I save each height like that:</p>
<pre><code>$(function(){
$(".box").each(function(){
boxSize = $(this).height();
});
</code></pre>
<p>Then I call it like this:</p>
<pre><code> button.click(function(){
$(".box").height(boxSize);
});
});
</code></pre>
<p>But it doesn't, i would like boxSize to be specific for each box, anyone?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
5,804,809 | 5,804,810 | How to get HTML of HtmlControl object in backend | <p>I have a short snippet of C# code like this:</p>
<pre><code>HtmlGenericControl titleH3 = new HtmlGenericControl("h3");
titleH3.Attributes.Add("class", "accordion");
HtmlAnchor titleAnchor = new HtmlAnchor();
titleAnchor.HRef = "#";
titleAnchor.InnerText = "Foo Bar";
titleH3.Controls.Add(titleAnchor);
</code></pre>
<p>What I want is a way to return a string that looks like this:</p>
<pre><code><h3 class="accordion"><a href="#">Foo Bar</a></h3>
</code></pre>
<p>Any thoughts or suggestions?</p>
| c# asp.net | [0, 9] |
5,998,897 | 5,998,898 | How would you draw a matrix in Android Development? | <p>The size of the matrix would be input by the user with variables h, w.</p>
<p>Given this how would I create a matrix of that size on the screen allowing the user to enter in values inside the matrix.</p>
| java android | [1, 4] |
3,027,150 | 3,027,151 | How do I read #2 at the end of a URL? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/298503/how-can-you-check-for-a-hash-in-a-url-using-javascript">How can you check for a #hash in a URL using JavaScript?</a> </p>
</blockquote>
<p>Currently I am generating Urls that look like this:</p>
<p>InspectionPhotos.aspx?inspectionId=10001649#/2</p>
<p>The #2 is for a photogallery plugin, and this would mean go the second photo.</p>
<p>I would like to show a div only if there is a #/[anynumber] but if its just
InspectionPhotos.aspx?inspectionId=10001649
then not show anything.</p>
<p>How could I do this check? Either asp.net on pageload or a client side javascript would be fine.</p>
<p>Thanks.</p>
| javascript asp.net | [3, 9] |
4,995,976 | 4,995,977 | Is there a way to force a user to scroll to the bottom of a div? | <p>I don't need to auto-scroll to the bottom of a div, rather force the user to scroll there themselves. I've got a legal agreement that I'd actually like people to read. Possible using regular JS or jQuery?</p>
| javascript jquery | [3, 5] |
654,597 | 654,598 | video event listener within iframe | <p>i'm using daily motion cloud (www.dmcloud.net) to host a video which is embedded within my site as an iframe. the standard code they gave for embedding looks like this:</p>
<pre><code><iframe width="640" height="360" frameborder="0" scrolling="no" src="http://api.dmcloud.net/player/embed/50071a76947399130e000cf1/5007219606361d1595000d2d?auth=1658005007-0-zddb6jin-a18fde4cb11266dad1c817b9c8bc1aca&autoplay=1&force_asset_name=mp4_h264_aac_hq"></iframe>
</code></pre>
<p>i need to add an event listener (or something similar) where i can determine when a user has finished watching the video, and then i display some content. How can this be done? </p>
| javascript jquery | [3, 5] |
395,479 | 395,480 | Need to Create Abstract Class for Items | <p>I need to create a class for Items? I planned to create it using Abstract Class. So other classes like Stores, Purchase, BOM can use the Items. I need to create some methods in Abstact class like ItemName, ItemDesc, ItemMake, etc., So that I can use it in any other classes, how to achieve this?</p>
| c# asp.net | [0, 9] |
2,972,809 | 2,972,810 | Why do spaces appear in my string? | <p>I have this function below which returns all IDs of checked boxes on my page seperated by a comma. It works great but the problem is, it seems to put a lot of white space after each checkbox ID. I can't seem to figure out why?</p>
<pre><code>/*Returns selected checkbox ID in string seperated by comma */
function get_selected_chkbox(){
var checked_string = '';
$('#report_table').find("input[type='checkbox']").each(function(){
if(this.checked){
checked_string = checked_string + this.id + ',';
}
});
alert(checked_string);//test1 ,test2 ,
return checked_string;
}
</code></pre>
<p>Thanks all for any help</p>
| javascript jquery | [3, 5] |
2,430,064 | 2,430,065 | Control Drop Down Appearance | <p>Currently we have drop down that people can add project names to. When people add a long project name it widens the drop down and throws off the layout of the page.</p>
<p>I would like to be able to control the width of the drop down list on the web form, but display wider if needed when a user clicks on it so they can read the complete name.</p>
<p>Is there a way to do this?</p>
| c# asp.net | [0, 9] |
2,245,769 | 2,245,770 | Change all Elements (html) of a div on changing the language? | <p>I have a dropdown menu on my page which has language selector options. on selecting the language i want my labels and buttons html to be changed according to the language?
<strong>My Code</strong></p>
<pre><code>var arr = [];
// gets all the ids starting with comp_
$('div[id^="comp_"]').each(function(){
arr.push(this.id);
labels = $(this).find('label');
buttons = $(this).find('button');
//get all labels inside the current div
$(labels,buttons).each(function(){
$(this).html("");
});
});
console.log(arr);
},
</code></pre>
<p>*<em>Problem *</em>
It only changes the label element reference and not the button reference.can i run the function on multiple element references?</p>
<p><strong>It Works if I do this but i dont want to repeat the same code again for diffferent references</strong></p>
<pre><code> var arr = [];
// gets all the ids starting with comp_
$('div[id^="comp_"]').each(function(){
arr.push(this.id);
labels = $(this).find('label');
buttons = $(this).find('button');
//get all labels inside the current div
$(labels).each(function(){
$(this).html("");
});
$(buttons).each(function(){
$(this).html("");
});
});
console.log(arr);
},
</code></pre>
| javascript jquery | [3, 5] |
1,453,234 | 1,453,235 | ASP.NET server tags are not well formed | <p>I want to use some server tags in OnClientClick of LinkButton</p>
<pre><code><asp:LinkButton ID="lnkbtnID" OnClientClick='<%# "window.open('SomePage.aspx?Id=" + Eval("reqID") + "');" %>' runat="server" Text='<%# Eval("reqID")%>'>
</asp:LinkButton>
</code></pre>
<p>how to write this, it is giving the error that Server tags are not well formed.</p>
<p>So how to write this correctly?</p>
| c# asp.net | [0, 9] |
4,875,109 | 4,875,110 | jQuery: write variable between 2 quotation mark | <p>I want to create a loop for input so that the variable img get number 1 to 5 like this: </p>
<pre><code>img1, img2 ... img5.
</code></pre>
<p>How to write <code>$i</code> after img?</p>
<pre><code>for ($i=1;$i<=5;$i++) {
function(data) { $('input[name="img1"]').val(data) });
}
</code></pre>
<p><strong>Note:</strong> img is between <strong>two</strong> quotation mark.</p>
<p>it's edite:</p>
<pre><code>user = $('input[name="name"]').val();
for (var i = 1; i <= 5; i++) {
$.post("test.php", { name: user, num: i },
function(data) {
$('input[name="img'+i+'"]').val(data)
});
}
</code></pre>
| javascript jquery | [3, 5] |
578,238 | 578,239 | how to move image using Android Java ? | <p>Hello and a good Day ...</p>
<p>I have a project but I hang in moving an object or image .. </p>
<p>my question is " How to move the image by clicking on it" ?
change a position from x = 1 to x = 4 </p>
| java android | [1, 4] |
1,813,510 | 1,813,511 | Ajax HtmlEditorExtender accepting empty spaces | <p>I am using an Ajax HtmlEditorExtender for Description field in my application.</p>
<p>My Sample Code:</p>
<pre><code><asp:TextBox ID="txtDescription" TextMode="MultiLine" Height="100" CssClass="text" runat="server" />
<ajax:HtmlEditorExtender ID="HtmlEditorExtender2" TargetControlID="txtDescription" runat="server">
<Toolbar>
<ajax:Bold />
<ajax:Italic />
<ajax:Underline />
<ajax:HorizontalSeparator />
<ajax:JustifyLeft />
<ajax:JustifyCenter />
<ajax:JustifyRight />
<ajax:JustifyFull />
<ajax:HorizontalSeparator />
<ajax:InsertUnorderedList />
<ajax:ForeColorSelector />
</Toolbar>
</ajax:HtmlEditorExtender>
</code></pre>
<p>This description textbox is accepting empty spaces when i tried with space bar and enter key.
The Description field is mandatory and so it should not accept empty spaces. </p>
<p>I am unable to validate this control(<strong>txtDescription</strong>) using FilteredTextBoxExtender/RequiredFieldValidator/Javascript validation.</p>
<p>Help me out pls!!</p>
| c# javascript jquery | [0, 3, 5] |
2,425,717 | 2,425,718 | checkboxes in asp.net using c# | <p>Hy all..I want to ask you how is it possible when a checkbox is checked data from a table is shown based on that checked checkbox.So I have 2 tables: Countries and Cities. I displayed all the countries within a checkboxlist so each country has a checkbox.Now I want when I check a checkbox the cities regarding the country checked to appear.This is my code for displaying the countries:</p>
<pre><code> SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["erp"].ConnectionString);
con.Open();
string intero = "Select * from judete";
SqlCommand cmd = new SqlCommand(intero, con);
SqlDataReader rdr;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
CheckBoxList check = new CheckBoxList();
check.Visible = true;
check.Items.Add(new ListItem(rdr[1].ToString()));
Panel1.Controls.Add(check);
foreach (ListItem item in check.Items)
{
item.Text = rdr.GetString(1);
}
}
</code></pre>
<p>My question is: how can i retrieve the cities based on what checkbox is checked? Thanks in advance and sorry for repeating but I didn't figure it out yet.</p>
| c# asp.net | [0, 9] |
244,952 | 244,953 | parsing css measures | <p>When i write a jQuery plugin i like to specify options for spacings the CSS way.
I wrote a function that returns a CSS String as values in a object. </p>
<p>5px 10px returns top: 5px, right: 10px, bottom: 5px, left: 10px</p>
<p>Now i often use the returned values to do some calculations and its not very nice to have to extract the measuring unit every time...</p>
<p>I suck in writing regular expressions could someone help me complete this function:</p>
<pre><code>this.cssMeasure = function(cssString, separateUnits){
if ( cssString ){
var values = {}
}else{
return errorMsg
}
var spacing = cssString.split(' ')
var errorMsg = 'please format your css values correctly dude'
if( spacing[4] ) {
return errorMsg
} else if ( spacing[3] ) {
values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[3]}
} else if ( spacing[2] ) {
values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[1]}
} else if ( spacing[1] ) {
values = {top: spacing[0], right:spacing[1], bottom:spacing[0], left:spacing[1]}
} else {
values = {top: spacing[0], right:spacing[0], bottom:spacing[0], left:spacing[0]}
}
if (separateUnits) {
$.each(values, function(i, value){
/*
at this place i need to extract the measuring unit of each value and return them separately
something like top: {value: 10, unit: 'px'}, right: {bla} and so on
*/
})
}
return values
}
</code></pre>
<p>if you have any idea how to improve this function i am open to your comments.</p>
| javascript jquery | [3, 5] |
791,426 | 791,427 | Adding items to C# dictionary from JavaScript | <p>What, if any, is the accepted way of adding a key-value pair from ASP.NET/JavaScript code to a C# dictionary? TIA.</p>
| c# javascript asp.net | [0, 3, 9] |
1,242,936 | 1,242,937 | Is it good to write javascript functions inside functions and not use 'new' on the main function? | <p>I now know this works:</p>
<pre><code>function outerfunction(arg1, arg2, arg3) {
var others;
//Some code
innerFunction();
function innerFunction() {
//do some stuff
//I have access to the args and vars of the outerFunction also I can limit the scope of vars in the innerFunction..!
}
//Also
$.ajax({
success : secondInnerFunction;
});
function secondInnerFunction() {
// Has all the same benefits!
}
}
outerFunction();
</code></pre>
<p>So, I am not doing a 'new' on the outerFunction, but I am using it as an object! How correct is this, semantically?</p>
| javascript jquery | [3, 5] |
3,122,432 | 3,122,433 | Set up Notifications in Andriod application? | <p>I have app for job search, it works over httppost to activate PHP function and get filtered(depends what kind of search user choose)data(JSon format) from mysql database on server. <br/>
What I want to do now is to put one checkbox for notifications, and if user check it before click on search, to be able to get notifications in Status bar about new jobs he didn't see at the first time, for example ("You have 10 new jobs in your search"). And after he click on notification application will open on the page with the list of jobs he already seen + new jobs, just I want to somehow show user which jobs are new. <br/>
I was thinking that maybe I can wrap the new data in a different color. <br/>
Can anyone give me idea how can I do it? <br/>
And how can I now when database have new data, how to monitor it? <br/>
Thanks in advance, <br/>
Wolf. </p>
| java android | [1, 4] |
3,038,690 | 3,038,691 | Regarding Combining Two Small Javascript Codes | <p>Basically the question is self explanitory. I can't figure out how to combine small snippets of javascript rather than having two separate files.</p>
<p>The two codes are :</p>
<pre><code>$(function(){
$('.navbar li').each(function(){
if(window.location.href.indexOf($(this).find('a:first').attr('href'))>-1)
{
$(this).addClass('active').siblings().removeClass('active');
}
});
});
$(function(){
$('.dropdown-menu li').each(function(){
if(window.location.href.indexOf($(this).find('a:first').attr('href'))>-1)
{
$(this).removeClass('active')
}
});
});
</code></pre>
<p>Another question, is the first <code>$(function()</code> necessary?</p>
<p>Thanks for you help.</p>
| javascript jquery | [3, 5] |
161,283 | 161,284 | ContextMenu shrinks when opened via JS Interface | <p>I am developing an android app. One of the activities works as follows: I display some HTML in a WebView and via Javascript detect a long touch with the following code:</p>
<pre><code>var touching = null;
$('.post').each(function() {
this.addEventListener("touchstart", function(e) {
window.clearTimeout(touching);
touching = window.setTimeout(postLongTouch, 500, $(this).attr("id"));
}, false);
this.addEventListener("touchmove", function(e) {
window.clearTimeout(touching);
}, false);
this.addEventListener("touchend", function(e) {
window.clearTimeout(touching);
}, false);
});
function postLongTouch(id) {
window.JSInterface.showPostContextMenu(id);
}
</code></pre>
<p>I attached a JSInterface to the WebView with the function <code>showPostContextMenu(id)</code> in it. It looks as follows: </p>
<pre><code> public void showPostContextMenu(String id) {
mHandler.post(new Runnable() {
public void run() {
mHackerView.showContextMenu();
}
});
}
</code></pre>
<p>Where <code>mHackerView</code> is some view on the activity and is registered for a context menu. I needed to add the Handler Stuff because this crashed since Android 4.1 due to, I suppose, the different Threads the WebView and the UI run in. </p>
<p>Now what happens is the following: When I touch a bit too long on the WebView, then the Context Menu is shown for a second but then shrinks to a white line. This does not happen, when I touch a little less long. The function <code>showPostContextMenu</code> is only called once, I checked that. It doesn't help calling <code>unregisterForContextMenu</code> for the view right after I opened the ContextMenu. </p>
<p>What causes this behaviour? Is it maybe again because of the different threads of the UI and the WebView? Is there any better way I could display a context menu and at the same time know information about the HTML element on which the user clicked? (This is the reason I use JS here...)</p>
| java android | [1, 4] |
1,534,045 | 1,534,046 | How to show an alert before download a file | <p>This is my question i have an aspx page that has to show a popup message and when the user clicks ok begin download
any help would be appreciated</p>
| javascript asp.net | [3, 9] |
808,368 | 808,369 | PHP mixed with ASP | <p>I have a problem, just redone a homepage that was in ASP (ASPX) to a PHP.
The problem is that i have some links out there that gos like this www.example.com/work.aspx?jid=23 .</p>
<p>I need to take controll over the links a redriect them to the main page.</p>
<p>How to do that? I have created a work.aspx file that i have written som text just for test. When i try to change the file content to do a "Response.Redirect" the file dosent seam to update.. Why?</p>
<p>Regards</p>
| php asp.net | [2, 9] |
2,829,422 | 2,829,423 | Javascript Constant Setting Variable | <p>When running this code, the whatever value is first passed in with the constructor <code>Test(callbacks)</code> becomes the callback that is always called, even in later instantiations of <code>Test</code></p>
<pre><code>function Test(callbacks) {
if (callbacks) {
if (callbacks.callback) {
this.callback = callbacks.callback;
}
}
this.options.complete = $.proxy(this.options.complete, this);
}
Test.prototype = {
options: {
type: "GET",
complete: function() {
this.callback();
}
},
callback: function() { console.log("OVERRIDE ME"); },
execute: function() {
$.ajax(this.options);
}
};
var eins = {callback: function() {console.log("AAA");}};
var zwei = {callback: function() {console.log("BBB");}};
var A = new Test(eins);
var B = new Test(zwei);
A.execute();
B.execute();
</code></pre>
<p>Running this code, every time you will get the output <code>AAA</code>. How does <code>function() {console.log("AAA");}</code> become a constant value for the prototype?</p>
| javascript jquery | [3, 5] |
4,070,544 | 4,070,545 | Looping setTimeout | <p>I'm currently trying to wrap my head around some JavaScript.</p>
<p>What I want is a text to be printed on the screen followed by a count to a given number, like so:</p>
<blockquote>
<p>"Test"</p>
<p>[1 sec. pause]</p>
<p>"1"</p>
<p>[1 sec. pause]</p>
<p>"2"</p>
<p>[1 sec. pause]</p>
<p>"3"</p>
</blockquote>
<p>This is my JS:</p>
<pre><code>$(document).ready(function() {
var initMessage = "Test";
var numberCount = 4;
function count(){
writeNumber = $("#target");
setTimeout(function(){
writeNumber.html(initMessage);
},1000);
for (var i=1; i < numberCount; i++) {
setTimeout(function(){
writeNumber.html(i.toString());
},1000+1000*i)};
};
count();
});
</code></pre>
<p>This is my markup:</p>
<pre><code><span id="target"></span>
</code></pre>
<p>When I render the page, all I get is "Test" followed by "4".</p>
<p>I'm no JavaScript genius, so the solution could be fairly easy. Any hints on what is wrong is highly appreciated.</p>
<p>You can play around with my example here: <a href="http://jsfiddle.net/JSe3H/1/" rel="nofollow">http://jsfiddle.net/JSe3H/1/</a></p>
| javascript jquery | [3, 5] |
782,268 | 782,269 | Can you write Javascript object init shorthand C# style? | <p>I have the following Javascript:</p>
<pre><code>function TestModel()
{
this.name = "Testvalue";
this.id = 0;
}
var test = new TestModel();
alert(test.name);
</code></pre>
<p>If I want to initialize an object with different parameters without the use of a constructor I would need to call the following code:</p>
<pre><code>var test = new TestModel();
test.name = "other value";
test.id = 5;
alert(test.name);
</code></pre>
<p>What I would like to do is something similar to the C# style:</p>
<pre><code>class TestModel
{
public string name = "Testvalue";
public int id = 0;
}
TestModel test = new TestModel() { name = "other value", id = 5 };
System.Windows.MessageBox.Show(test.name);
</code></pre>
<p>But if I try something like that in javascript it won't work.</p>
<p>In short: I am trying to init a object in 1 line without the use of a constructor. Is this possible in javascript?</p>
| c# javascript | [0, 3] |
2,852,054 | 2,852,055 | Using JavaScript/ JQuery, can you make a link on click code fire | <p>Using FireFox, Javascript and JQuery and I am a noob at all :-)
My understanding is that it is impossible to use any of the above to make the client browser execute an anchor click via code.<br>
ie: the page I am working on has a button with an anchor tag to update the data being displayed (next 15 records).<br>
Is this true? if not, can someone please assist with some guidance?</p>
<p>The LINK code that I am looking at is this one:</p>
<pre><code><li>
<a href="#statistic=general;page=4;name=" target="self" class="ABC">
<span class="btnBg">&nbsp;</span>
<span class="icn next">&nbsp; </span>
</a>
</li>
</code></pre>
| javascript jquery | [3, 5] |
2,467,388 | 2,467,389 | select image on drive with javascript | <p>I have created a website, when the admin dblclick on the image then he can choose for a new one. That I will accomplish with javascript. But, I don't have any idea to do that, the following code is the html.
<img src="http://i.stack.imgur.com/lVyBE.png" alt="enter image description here"></p>
<pre><code><form action="controller.php" method="post" class="popupform" id="form_changeillustration" enctype="multipart/form-data">
<dl>
<dt><label for="newillustration">choose a new photo: </label></dt>
<dd><input type="file" name="newillustration" id="newillustration" /></dd>
<dt>&nbsp;</dt>
<dd class="buttonrow">
<input type="hidden" name="page" value="{$PAGE}" />
<input type="hidden" name="module" value="newillustration" />
<input type="submit" class="btnOk" value="edit" />
<input type="button" class="btnCancel" value="cancel" />
</dd>
</dl>
</form>
</code></pre>
| php javascript jquery | [2, 3, 5] |
1,427,495 | 1,427,496 | How to find latitude or longitude of a image | <p>i have to find information from a image with latitude longitude ..
instead this code if any one have any suggestion.</p>
<pre><code>$info = exif_read_data('monstersinc.jpg');
echo "<pre>";
var_dump($info);
</code></pre>
<p>How can i do it...</p>
| php javascript jquery android | [2, 3, 5, 4] |
1,064,836 | 1,064,837 | Get values from multiple inputs jQuery | <p>Can someone please let me know how to get values from several input fields?
I have a list with several inputs like this:</p>
<pre><code><li>
<label>Additional Title: </label><input type='text' name='additionaltitlename' ... />
</li>
<li>
<label>Additional Title: </label><input type='text' name='additionaltitlename' ... />
</li>
</code></pre>
<p>I have a pretty similar thing written on Javascript (on form submit):</p>
<pre><code>...
var extratitles = document.getElementsByName('additionaltitlename');
var str = '';
for (var i = 0; i < extratitles.length; i++) {
str = str + '|' + extratitles.item(i).value;
}
}
</code></pre>
<p>But now I need to write same thing on jQuery, as before form submit I need to make a preview (post it through ajax and get HTML response).
I tried to combine it with jQeury like this:</p>
<pre><code>$('#getpreviewbutton').click(function(){
// and paste here the javascript code from above:
var extratitles = document.getElementsByName('additionaltitlename');
var str = '';
for (var i = 0; i < extratitles.length; i++) {
str = str + '|' + extratitles.item(i).value;
}
}
});
</code></pre>
<p>but it's probably wrong, as it's not working for me.
I guess I just need to know how to get the array of elements in jQuery and how to work with them through loop, will figure out the rest.</p>
| javascript jquery | [3, 5] |
5,293,612 | 5,293,613 | Running PHP under ASP.NET | <p>ASP.NET web server can allows to deploy PHP code, even full applications like phpBB. is it possible? please guide me</p>
<p>by googling i found this</p>
<p>check this link</p>
<p><a href="http://www.communitymx.com/content/article.cfm?cid=F8079" rel="nofollow">http://www.communitymx.com/content/article.cfm?cid=F8079</a></p>
<p>and in the time of running the PersonalWebSite projet getting error </p>
<p>Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
and other projet is not oppening </p>
| php asp.net | [2, 9] |
3,193,001 | 3,193,002 | how to send dynamically created controls to the file on the server side? | <p>I am building a designer in which a user can select the contols from the tool box to build a form, the controls build up in the center table through java script. the table expands dynamically. when the user clicks the save button, these dynamically created controls doesnot save in the file on the server.(i.e save form on the server)</p>
<p>can any one help me how i can do this.</p>
| c# javascript asp.net | [0, 3, 9] |
5,039,186 | 5,039,187 | Generate public-private key pair and show them in textbox in asp.net | <p>I am student and learning the asp.net,</p>
<p>My requirement is to generate the public-private key pair and show them in the</p>
<p>textbox separately ,</p>
<p>What is the public-private key pair and how we can generate this , can any body explain please</p>
<p>Thanks alot. </p>
| c# asp.net | [0, 9] |
1,569,864 | 1,569,865 | javascript equivalent of jquery code | <p>Can someone help what's the javascript equivalent of below jquery line. </p>
<pre><code>$("#abc option[value='1']").text();
</code></pre>
<p>abc is the id of selectbox</p>
| javascript jquery | [3, 5] |
3,774,524 | 3,774,525 | JQuery : Submit event not firing on FireFox | <p>I can't understand why the submit event described below is not firing on FireFox and IE.
Ok for Chrome</p>
<blockquote>
<pre><code>$("#frame-right").on("submit", "form", function(event){
alert('Submit done')
});
</code></pre>
</blockquote>
<p>Can you help me?</p>
<p><strong>EDIT</strong></p>
<p>The forms are submitting by pressing a "submit" button, but the forms are included in page loaded through .load() function and not exist when the function above is defined.</p>
<p>FYI, at the same place, I defined this function which is working fine on all browser</p>
<pre><code>$("#frame-right").on("click","a",function(event){
alert('link clicked');
}
</code></pre>
<p>Is the "submit" event can be bound dynamically like "click" event?</p>
<p><strong>EDIT 2</strong></p>
<p>Thanks for your reply.
The problem is that after a load() function, the form loaded cannot be submitted with Firefox</p>
| javascript jquery | [3, 5] |
2,184,713 | 2,184,714 | non-AJAX jquery POST request | <p>i am trying to use the jquery POST function but it is handling the request in AJAX style. i mean its not actually going to the page I am telling it to go.</p>
<pre><code>$("#see_comments").click(function() {
$.post(
"comments.php",
{aid: imgnum},
function(data){
});
});
</code></pre>
<p>this function should go to comments.php page with the aid value in hand. its posting fine but not redirecting to comments.php.</p>
<p><strong>@Doug Neiner</strong>
clarification:<br>
1. I have 15 links (images). i click on a link and it loads my javascript. the JS knows wat imgnum i opened. this imgnum i want in the comments.php. i have to use this javascript and no other means can do the trick. the JS is mandatory.
2. your method successfully POSTs the aid value. but in the comments.php when i try to echo that value, it displays nothing.
3. I am using Firebug. in the Console, it shows the echo REQUEST i made in Step (2) successfully. </p>
| javascript jquery | [3, 5] |
5,809,729 | 5,809,730 | how to update a price based on form selections | <p>if you take a look at this site <a href="http://www.graphicfirm.com/product.php?productid=2010" rel="nofollow">http://www.graphicfirm.com/product.php?productid=2010</a></p>
<p>see how the price changes when you select something from the select options? How is this being done?
each select looks something like this</p>
<pre><code><select onchange="javascript: check_options();" name="product_options[326831]" id="po326831">
<option value="564273">No</option>
<option value="564272">Yes (+ $10.00)</option>
</select>
</code></pre>
<p>what i dont understand is that the select options have a value that does not include the price that will be accumulated with the total. I'm guessing that each item such as 564272 is in an associative array with a price associated with it. can someone write me an example? i tried learning whats on that page but the javascript is really messy. I also tried to look up a small example online and i couldnt. if you know can you link me to one? also if this method has a name let me know</p>
<p>thanks</p>
| javascript jquery | [3, 5] |
2,054,593 | 2,054,594 | Remove attr in input:style after click with jQuery | <p>How can remove just <code>background-color: rgb(255, 196, 196);</code> in following select:style after click with jquery?</p>
<pre><code><input name="star" style="width: 60px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 196, 196); background-position: initial initial; background-repeat: initial initial; ">
</code></pre>
| javascript jquery | [3, 5] |
4,705,127 | 4,705,128 | Send data from android to webserver | <p>What can i use to send/receive data between an android client and a webserver.
Data can typically include:
Text, Images or videos.
As far as i have looked into, i cannot use JSON, since i cant sent images using this.</p>
| java android | [1, 4] |
481,429 | 481,430 | calling REST service using Jquery/javascript | <p>I need to call a REST Service from my classic ASP application.
I heard that the best way to call a REST service is using Jquery.
Its not working for me. I dont know what mistake I am doing here .
Here is my code.</p>
<pre><code><script language="javascript" scr="inc\javascript\jquery-1.7.2.js" ></script>
<script language="javascript">
$(document).ready(function(){
CallService();
});
function CallService()
{
alert("HelloWorld");
var Type = "POST";
var ServiceUrl = "http://mysite/restservice.svc";
var ContentType = "application/xml; charset=utf-8";
var DataType = "xml";
var ProcessData = false;
$.ajax({
type : Type, //GET or POST or PUT or DELETE verb
url : ServiceUrl, // Location of the service
//data : varData, //Data sent to server
contentType : ContentType, // content type sent to server
dataType : DataType, //Expected data format from server
processdata : ProcessData, //True or False
// success : function(msg) {//On Successfull service call
// ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,169,582 | 4,169,583 | Access Server Object on Client Side | <p>I have a object which gets populated on the server side. I want to access this object on Client side that is on aspx page ( using Javascript). </p>
| c# javascript asp.net | [0, 3, 9] |
3,378,062 | 3,378,063 | How can I get part of the following string? | <p>Lets say I have an absolute url /testserver/tools/search.aspx that I store in a variable url.</p>
<p>I want to check if url == /tools/search.aspx without having to use /testserver.</p>
<p>A more complete example would be:</p>
<p>My testserver contains the url <a href="http://www.testserver.com/tools/Search.aspx" rel="nofollow">http://www.testserver.com/tools/Search.aspx</a>,</p>
<p>but my live server contains the url <a href="http://www.liveserver.com/tools/Search.aspx" rel="nofollow">http://www.liveserver.com/tools/Search.aspx</a></p>
<p>If I compare a variable url which stores the testserver url to the liveserver url, it will fail, thats why I want to just check the /tools/Search.aspx portion.</p>
| c# asp.net | [0, 9] |
4,149,294 | 4,149,295 | Android image resize | <p>I have images stored on sd card(size of each ~ 4MB). </p>
<p>I want to resize each, than set it to ImageView. </p>
<p>But I cannot do it using <code>BitmapFactory.decodeFile(path)</code> becouse Exception<br>
<code>java.lang.OutOfMemoryError</code> is appeared. </p>
<p>How can i resize image without loading it in the memory. Is it real?</p>
| java android | [1, 4] |
2,456,318 | 2,456,319 | Databound Value in href javascript link | <p>I've trawled the net looking for the syntax to get this working and i'm hoping this is a quick fix else i'll go mad. Basically I have a nested repeater and the button below hides another nested repeater.</p>
<p><code>((location_details)((RepeaterItem)Container.Parent.Parent).DataItem).tbl_location.location_id</code> evaluates perfectly well (3824 in the case i'm testing), but when I try to pass it so that its a string parameter for the javascript function it fails everytime.</p>
<pre><code><asp:Linkbutton ID="lb_showhide_oloc_gnotes" runat="server" Text="Expand/Close"
href='javascript:sltoggle('" + <%# ((location_details)((RepeaterItem)Container.Parent.Parent).DataItem).tbl_location.location_id %> +" '); return false;' />
</code></pre>
<p>Any ideas what i'm missing (I know the above syntax is wrong I must have changed it 100 times already but you get the idea).</p>
<p>thanks!</p>
| c# javascript asp.net | [0, 3, 9] |
3,868,303 | 3,868,304 | Why so many inner classes in Android? | <p>I am a new fish in Android development. While reading books and Android source code I found out that there so many inner classes in the Android application. Why does Android need so many inner classes?</p>
<p>I am confused by these inner classes.</p>
| java android | [1, 4] |
4,438,124 | 4,438,125 | asp.net print the results of a sql command | <p>I have the following sql command:</p>
<pre><code>SqlCommand cmd = new SqlCommand("SELECT * FROM tbl WHERE ID = 'john' ", con);
</code></pre>
<p>How can i output the results of the following command in C# to my webpage?</p>
| c# asp.net | [0, 9] |
3,436,519 | 3,436,520 | What is correct way to a remove few characters at the end of string C# | <p>Consider the following code, what is the correct way to a remove the last two <code><br/></code> tags from the end of string in C#? I have followed very naive method, to achieve this. Can you please suggest improvements.</p>
<pre><code>List<string> MessageList; // populated from data source
Label lblHtmlOutput = new Label();
StringBuilder sb = new StringBuilder();
foreach (var item in MessageList)
{
sb.Append(item + "<br/><br/>");
}
sb.Remove(sb.Length - 11, sb.Length - 1);
</code></pre>
| c# asp.net | [0, 9] |
3,633,470 | 3,633,471 | Get the suffix of a dynamically selected id within a hover method | <p>I have the following JQuery selector with a hover method attached to it:</p>
<pre><code>$("a[id^='foo']").hover(
function () {
$(this).css("color", "#eeeeee");
},
function () {
$(this).css("color", "#ffffff");
}
);
</code></pre>
<p>However, I want to alter a td decoration underneath the links with the 'foo' prefixes on their id's, which have a 'bar' prefix. For clarification: foo1, foo2, foo3 and bar1, bar2, bar3. How can I figure out what id is currently in effect and use its corresponding suffix within the same hover method? </p>
<p>Technically in semi-pseudo code I want to achieve this result</p>
<pre><code>$("a[id^='foo']").hover(
function () {
$(this).css("color", "#eeeeee");
// var x = charAt($(this).id.length-1)
// $("#bar"+x).css("color", "#eeeeee");
},
function () {
// ...
}
);
</code></pre>
<p>I tried variations with $this.id, but I get undefined values.</p>
<p>Thanks for the help!</p>
| javascript jquery | [3, 5] |
2,701,294 | 2,701,295 | Can I simplify multiple if - else statements? | <p>I have the following code in javascript?</p>
<pre><code>if ($(form).data('action') == "Edit") {
xx
} else if ($(form).data('action') == "Create"){
xy
} else if ($(form).data('action') == "Delete"){
xz
}
</code></pre>
<p>Is it possible for me to simplify this and also have some default path?</p>
| javascript jquery | [3, 5] |
4,025,107 | 4,025,108 | loop jquery object | <p>I simply try to assign a background color to each div.
it looks simple but it doesn't work.</p>
<pre><code>var divElements = $("div");
var colorArray =["444", "344", "345", "472", "837", "043", "345", "472", "837", "043"];
for (var i=0; i< divElements.length; i++){
divElements[i].css("background","#"+colorArray[i])
}
</code></pre>
<p>I also tried to use jQuery's each</p>
<pre><code>$("div").each(function(i) {
divElements[i].css("background","#"+colorArray[i])
})
</code></pre>
<p>How do code this in javaScript generic "for loop" and jQuerys .each()</p>
| javascript jquery | [3, 5] |
1,009,288 | 1,009,289 | prepend a div and hide it with this object | <pre><code><div id="newsSubmit"><b>Add random snippet</b></div>
<script>
$("#newsSubmit").click(function(){
$("body").append("<div class='lol'>Ok, DELETE this snippet (click here)</div>");
});
$(".lol").click(function(){
$(this).fadeOut();
});
</script>
</code></pre>
<p><a href="http://jsfiddle.net/apzdt/6/" rel="nofollow">http://jsfiddle.net/apzdt/6/</a></p>
<p>How can I fix it? It's not working</p>
| javascript jquery | [3, 5] |
1,138,886 | 1,138,887 | jQuery select JavaScript generated elements | <p>I am using JavaScript to generate some HTML tables on the fly. After filling out this dynamic table, I employ jQuery to 'grab' some of the inputs and do some small calculations for form validation. However, my jQuery selector does not work with the dynamic HTML form. Can anyone give me some suggestions? Thanks!</p>
<p>Here is the code:</p>
<pre><code><script>
//generate HTML table
$('<tr><th><label for="id_CAM_1">Input:</label></th><td><select name="CAM_1_'+i+'" id="id_1_'+i+'"><option value="1">Option 1</option><option value="2">Option 2</option></select></td></tr>').appendTo('.table');
// jQuery selector, which does not work dynamically
$('select[name=CAM_1_'+i+']').change(function() {
var ss1=$(this).val()
alert(ss1)})
</script>
</code></pre>
| javascript jquery | [3, 5] |
5,551,206 | 5,551,207 | Java and what to do with it | <p>I've been browsing through several websites and several topics on this website.</p>
<p>Now I'm just a starting programmer and I want to make a good decision.</p>
<p>From what I understand is that Java is used alot for server stuff, and web applets but not really for computer applications running on a client, it's also used for Android programming and several other mobiles.</p>
<p>I'm really interested in Android programming, I really love to program for mobile devices, in this case Android because I really think it has a lot of potential and I don't like the iPhone.</p>
<p>If I want to program on Android I have to learn Java (aside from Mono).
but if my decision changes over the next couple of years I don't think Java is the right language to get a job that programs computer applications.</p>
<p>I think I get a job where I have to program server stuff, rather than computer applications.</p>
<p>That's why I think C# is a good choice. I can program for Windows Phone 7 (I hope that will get big). and I have the feeling C# is more widely used for computer applications.
so I think C# is more versatile looking at Mobile programming and computer programming.</p>
<p>Or am I totally wrong thinking this?</p>
| java c# android | [1, 0, 4] |
6,023,441 | 6,023,442 | lightweight jQuery countdown | <p>I've seen some really nice looking jQuery plugins to count down the number of day, hours, minutes and seconds. They use images and look great.
But I'm looking for a simple little countdown that populates a div with the number of seconds remaining.
I'm going to use it in conjunction with:</p>
<pre><code>function submitform() {
document.forms[0].submit();
}
jQuery(function($) {
setInterval("submitform()",20000);
});
</code></pre>
<p>I just want something real unobtrusive in the corner somewhere to let them know that the page is about to refresh all by itself.</p>
| javascript jquery | [3, 5] |
3,981,836 | 3,981,837 | pick contacts with same name and more than two number | <p>I have tried to pick the contacts from phone by using following method in my project.It working fine.....But in some case i will not work...For Ex: In case of Same Name with More than one number like personal/Home..In this stage it will pick only first number.so i am unable to pick contacts from me. kindly give solutions.....</p>
<p>entered code here</p>
<pre><code> public void onActivityResult(int reqCode, int resultCode, Intent data) {
super.onActivityResult(reqCode, resultCode, data);
switch (reqCode) {
case (PICK_CONTACT) :
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
String id =c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
String hasPhone =c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if (hasPhone.equalsIgnoreCase("1")) {
Cursor phones = getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ id,
null, null);
phones.moveToFirst();
cNumber = phones.getString(phones.getColumnIndex("data1"));
System.out.println("number is:"+cNumber);
}
/*name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Textcontact.setText(name);*/
edt.setText(cNumber);
}
}
break;
}
}
</code></pre>
<p>Thanks...</p>
| java android | [1, 4] |
1,619,571 | 1,619,572 | How to save array of the Bitmap? | <p>I have been developing the application for drawing, and I have the problem: my application has array of pages (Bitmap), and I need to save/open it. I thought that I can use mechanism of serialization, but Bitmap isn't serializable and I don't know how I can save array of Bitmaps into 1 file that user can change file's location. So, please, give me advice about it. Thank you. </p>
| java android | [1, 4] |
5,938,554 | 5,938,555 | Get part of string to cursor | <p>I need to take value from beginning of input to cursor. val() return whole string. How can I only this part which I`m interested in?</p>
| javascript jquery | [3, 5] |
3,870,045 | 3,870,046 | Call aspx page from another PC | <p>I have a project developed in .net, and the URL for that is <code>http://localhost:2688/WebSite2/Default.aspx</code> and it is working fine when i run it,How can i access it from another PC?</p>
<p>I have tried <code>http://IP_HERE:2688/WebSite2/Default.aspx</code> but it does not work ..</p>
| c# asp.net | [0, 9] |
1,808,950 | 1,808,951 | File locked by which process (android)? | <p>Currently I am developing one android application in which I have a file on sdcard and I have to find out process id of all process which are accessing this file.</p>
<p>Using the android.os.FileObserver we can know only whether the file is accessed by any process. But how to get process id of that process?</p>
| java android | [1, 4] |
4,716,176 | 4,716,177 | controls in asp.net repeater | <p>I have a repeater, which basically has a text box in it and I have implemented a paging function on the repeater, the repeater only shows 25 rows at a time. What I want to do is, get each text box for each row in the repeater, but at the moment I am only getting the text boxes that are shown on the repeater (the first 25 rows). What can I change in my code to get every single row?</p>
<p>My code is as follows:</p>
<pre><code>foreach (Control control in repeaterSegmentList.Controls)
{
foreach (Control innerControl in control.Controls)
{
if (innerControl.ID != null)
{
if (innerControl.ID == "Priority")
{
((TextBox)innerControl).Text = txtPrio.Text;
}
}
}
}
</code></pre>
<p>thanks in advance.</p>
| c# asp.net | [0, 9] |
1,509,239 | 1,509,240 | JQuery - get attr/text from HTML string in a variable | <p>I have a HTML string that I'm passing through a function and I want to be able to perform Jquery methods on that variable from inside the function - such as <code>.attr('href')</code> or <code>.text()</code>. I'm sure there is a simple solution for this and something more elegant then temporarily appending the DOM.</p>
<p><strong>HTML</strong></p>
<pre><code><div class="here"></div>
</code></pre>
<p><strong>Javascript</strong></p>
<pre><code>link = '<a href="http://www.google.com">Google</a>';
// This works
$('.here').html(link);
works = $('.here').text();
console.log(works);
// This doesn't
not = link.text();
console.log(not);
</code></pre>
<p><a href="http://jsfiddle.net/dfgYK/" rel="nofollow">http://jsfiddle.net/dfgYK/</a> </p>
| javascript jquery | [3, 5] |
5,429,663 | 5,429,664 | How to transform a flat array-like sequence to an associative map? | <p>Essentially, I want an equivalent of this Python function in JavaScript:</p>
<pre><code>def to_dict(coll, key):
return {i[key]: i for i in coll}
assert to_dict([
{'key': 1, 'value': 1},
{'key': 2, 'value': 2},
{'key': 3, 'value': 3},
], 'key') == {
1: {'key': 1, 'value': 1},
2: {'key': 2, 'value': 2},
3: {'key': 3, 'value': 3},
}
</code></pre>
<p>I know I can construct it by hand, but is there a concise way? (jQuery or Underscore.js can be used)</p>
| javascript jquery | [3, 5] |
83,303 | 83,304 | Checking to see if a frame exists with jQuery | <p>I have found I can do the following:</p>
<pre><code>if($('#notice', parent.frames['header'].document).length>0) { alert("It is here!"); }
</code></pre>
<p>to check for an item in another frame.<br />
Is there a way to find out of the frame exists? Specifically I am looking to see if parent.frames['header'].document is there.</p>
<p>Is there a reliable way of doing this?</p>
<p>Update:
Here's my frameset code:</p>
<pre><code><frameset rows="104,*,22" frameborder="NO" border="0" framespacing="0">
<frame src="header.php" id="header" name="header" scrolling="no" title="Header and Menu" noresize>
<frame src="main.php" title="Main content" name="main">
<frame src="footer.php" name="footer" title="Footer" scrolling="NO" noresize>
</frameset>
</code></pre>
<p>I'm trying to make sure that I can access a div that lives inside of "header".
The downside is that, in some cases, main is replaced with another frameset.</p>
| javascript jquery | [3, 5] |
3,252,460 | 3,252,461 | jQuery selector $() functionality in an independent function | <p>I'm looking for an advanced function to select elements in the dom without using jQuery or any other library.</p>
<p>Something that will accomplish the same thing that the $(selector) function does in jQuery.</p>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
1,419,124 | 1,419,125 | ObjectDataSource -> Method taking two params one being Connection String | <p>I am updating an old website to a more modern look. They want the ability to <code>CRUD</code> their datatables so users can easily edit/update/delete things without going to special pages.</p>
<p>To do this I'm setting up an ObjectDataSource to their old methods.</p>
<p>Their methods take a param of Connection String </p>
<pre><code>GetCustStaff(string cstGID, string ConnString);
</code></pre>
<p>How do I tell the ObjectDataSource that the ConnString value comes from the web.config?</p>
<pre><code>ConfigurationManager.AppSettings.Get("Connection").ToString()
</code></pre>
<p>The only options it gives me to fill the Param are <code>(None, Cookie, Control, Form, Profile, QueryString, Session, RouteData).</code> </p>
<p>Anyone have any idea how I can circumvent this?</p>
| c# asp.net | [0, 9] |
4,884,121 | 4,884,122 | Javascript ContextMenu in IE7 | <p>We are using div tag in aspx and javascript functions to show context menu in our web application. In IE6 the sub menus in the context menu are getting displayed at the correct x and y coordinates what we have hard-coded in our application. But in IE7 and IE8, the sub menus are getting overlapped and in some machines the menus are going behind the window. Can any one please tell what is wrong or any other alternatives to display conext menu and submenu?</p>
<pre><code><HTML>
<HEAD>
<TITLE>Nested popup windows</TITLE>
<script>
var firstPopupDiv = null;
var popup = null;
var vpopup = null;
function tag_onclick()
{
var popup = window.createPopup();
var div = popup.document.createElement("DIV");
div.style.backgroundColor = "green";
div.style.width = 200;
div.style.height = 200;
div.onclick = div_onclick;
popup.document.body.appendChild(div);
firstPopupDiv = div;
vpopup = popup.document.parentWindow;
popup.show(30, 30, 200, 200, maindiv);
}
function div_onclick()
{
var fpopup = vpopup.createPopup();
fpopup.document.body.innerHTML = "<div id=\"MarkupSubMenu\" style=\"position:relative\">&nbsp;&nbsp;Markups</div>";
fpopup.document.body.style.backgroundColor = "red";
fpopup.show(230, 30, 200, 200, firstPopupDiv); // Not shown at 230!
}
</script>
</HEAD>
<BODY>
<div id="maindiv" onclick="tag_onclick()">Click me</div>
</BODY>
</HTML>
</code></pre>
| asp.net javascript | [9, 3] |
3,018,504 | 3,018,505 | iFrame Validation | <p>I currently have an iframe within my main page that has a number of checkboxes that need to be actioned prior to leaving the iframe, i.e, if the user commences checking the checkboxes and half way through they then click back on the main page, i.e leaving the iframe, I would like to be able to trap/validate that they have left the iframe and prompt them with a message indicating this, say with a "Note: You will lose all data entered here - Leave: Yes/No?" type message.</p>
<p>Any help/websites would be appreciated.</p>
<p>Thanks.
Tony.</p>
| javascript jquery | [3, 5] |
5,065,608 | 5,065,609 | Pass variable into selector in foreach loop | <p>I have a set of ids being generated in a foreach loop</p>
<pre><code><?php foreach ($_Collection as $_item): ?>
<img class="<?php echo $_product->getId() ?>" src="<?php echo Mage::helper('catalog/image')->init($_product, 'small_image')->resize(100, 75); ?>" />
</code></pre>
<p>I want to be able to grab specific divs with ajax by using the class that is generated as it will match both in this and the target document. So I was hoping to try something like this in the same foreach loop :</p>
<pre><code>$(document).ready(function() {
var item = "<?php echo $_product->getId() ?>";
$('img .'+item).click(function (){
$('#result').load('ajax-page .'+item+')
})
</code></pre>
<p>This is just for an example but I am sure there are multiple things wrong. For one what is printed looks like ... </p>
<pre><code>var item = "156294";
$j('img .'+item).click(function (){
$j('#result').load('ajax-page .item')
});
</code></pre>
<p>For starters... how can I pass the <em>item</em> variable to the selector from within this loop?</p>
| php javascript jquery | [2, 3, 5] |
3,238,657 | 3,238,658 | How do threads interact with listeners in Android? | <p>In an Android app, I need several listeners (for network changes, location changes, etc.).</p>
<p>As far as I can see, these are called in a thread (or threads) which are not my main background service thread. (I'm creating a service-only app.)</p>
<p>My question is:</p>
<p>Can my app be hit by listeners firing simultaneously, or does Android mitigate this by invoking my listeners in a single thread? </p>
<p>Secondly, if the listeners aren't 'sequentialised', are the individual listeners re-entrant?</p>
<p>In other words, can I carry out complex processing in my listeners, or should they just dump what happened into a synchronized list, for later processing my background service thread (and wakeup the background service thread from its sleep while they're at it).</p>
<p>There seems to be very little coverage of thread synchronisation in Android example docs and books.</p>
<p>Thanks,</p>
<p>Chris.</p>
| java android | [1, 4] |
1,128,652 | 1,128,653 | C#: a mechanism to generate regular files | <p>following regular files (date_time.zip) would be generated at 15-min interval in ASP.NET site with Timer.</p>
<p>1027_0100.zip, 1027_011*.zip, 1027_0130.zip, ...</p>
<p>My question is I need a mechanism to restore files which are somehow missed within 3 days, like 1026_0000.zip. What data structure/algorithm would you recommend to use to implement? </p>
<p>PS: I intend to use another Timer to regularly restore missing files.</p>
<p>Thank you!</p>
| c# asp.net | [0, 9] |
5,893,906 | 5,893,907 | Looping in jQuery | <p>I am tring to loop loop a jQuery command 5 times. Here is my code:</p>
<pre><code> for(var i = 0; i < 5; i++) {
$("#droppable_"+i).droppable({
activeClass: 'ui-state-hover',
hoverClass: 'ui-state-active',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight').find('p').html('Dropped!');
}
});
}
</code></pre>
<p>For some reason I can't get it to work. Can someone help me please?</p>
| javascript jquery | [3, 5] |
1,020,773 | 1,020,774 | Event for radio button being selected? | <p>Is there some event for a radio button being selected?</p>
<p>I know I can use "click" but I believe it is possible to style radio buttons in some browsers such that clicking an outter area of a radio button might not select the radio button.</p>
<p>What event should I use?</p>
| javascript jquery | [3, 5] |
4,205,136 | 4,205,137 | ASP.NET web service throw System.Net.WebException when upload file | <p>I have a a web service in asp.net which need to upload files to another server. The code run well when I play under Debug mode in Visual Studio. But when I host in IIS and call it, it throw System.Net.WebException. Here is my code:</p>
<pre><code> [WebMethod]
public string UploadFileToServer(string m_fileName, string m_username, string m_url)
{
string m_localFilePath = _currentDirectory + "\\" + m_username + "\\" + m_fileName;
FileStream m_localFileStream = File.Open(m_localFilePath, FileMode.Open, FileAccess.Read);
var reader = new BinaryReader(m_localFileStream);
byte[] m_rawBytes = new byte[m_localFileStream.Length];
reader.Read(m_rawBytes, 0, m_rawBytes.Length);
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(m_url);
request.Method = "POST";
request.KeepAlive = false;
Stream m_requestStream = request.GetRequestStream();
m_requestStream.Write(m_rawBytes, 0, m_rawBytes.Length);
m_requestStream.Close();
m_localFileStream.Close();
HttpWebResponse m_response = (HttpWebResponse)request.GetResponse();
StreamReader m_reader = new StreamReader(m_response.GetResponseStream());
string s = m_reader.ReadToEnd();
return s;
}
catch (Exception ex)
{
return ex.ToString() + ex.Message;
}
}
</code></pre>
<p>It is very frustrated for me and it's not possible to turn it on my Visual Studio all the time. Any suggestion or solutions? Thanks.</p>
| c# asp.net | [0, 9] |
4,094,525 | 4,094,526 | JQuery: How do I get a DID ID? | <p>I have the following HTML:</p>
<pre><code><div class="house">...</div>
</code></pre>
<p>But in my code I dynamically insert in DIV ID's to make the code then look like this:</p>
<pre><code><div class="house" id="id_1">...</div>
</code></pre>
<p><strong>Question</strong>: How can I get the DIV ID by only knowing the CLASS using JQuery? I've tried something like the following but it doesn't work.</p>
<pre><code>$('.house').getID();
</code></pre>
| javascript jquery | [3, 5] |
3,409,107 | 3,409,108 | How come it's like this? | <p> <a href="http://jsfiddle.net/DerekL/whY4B/" rel="nofollow"><strong><em><code>http://jsfiddle.net/DerekL/whY4B/</code></em></strong></a></p>
<pre><code>$("p").each(function(i) {
var btn = $('<button>button</button>'),
span = $('<span>span</span>');
$(this).after(btn).after(span);
});
</code></pre>
<p>So here I have <code><p></code>s in my HTML and I use <code>.after()</code> to create buttons and spans:</p>
<pre><code>$(this).after(btn).after(span);
</code></pre>
<p><code>btn</code> comes first, and <code>span</code> comes last. But the result is the opposite: <code>btn</code> comes last, and <code>span</code> comes first.</p>
<p>What the heck? How come it's like that and it is very confusing. Please help.</p>
| javascript jquery | [3, 5] |
2,043,532 | 2,043,533 | document.ready is getting called multiple times | <p>Within my php app I have multiple templates that get combined to form a single page. so say your on the about us page, the template would look like this</p>
<pre><code><?php
$this->render("header.php");
?>
my about us page
<?php
$this->render("footer.php");
?>
</code></pre>
<p>which is just a fancy way of doing an include(). However, header.php has some javascript that gets ran on document.ready via the jquery framework, and so does the page that requires the header. so you have something like this</p>
<pre><code><?php
$this->render("header.php"); // has its own $(document).ready
?>
<script type="text/javascript">
$(document).ready(function(){
console.log("test");
});
</script>
my about us page
<?php
$this->render("footer.php");
?>
</code></pre>
<p>The bug that I'm experiencing is that document.ready is getting called once for every document.ready on the page. in the above case console shows </p>
<p>test</p>
<p>test</p>
<p>If I comment out the rendering of header.php, the document.ready gets called just once like I want. </p>
<p>Besides using a semaphore, is a better way to prevent this? I tried buffering the output, but that doesn't seem to work. </p>
<p><strong>Edit: added final output per request</strong></p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
// do some javascript like highlighting
// form elements with specific classes
});
</script>
display header here
<script type="text/javascript">
$(document).ready(function(){
console.log("test");
});
</script>
my about us page
display footer
</code></pre>
| php jquery | [2, 5] |
5,886,231 | 5,886,232 | Pass C# ASP.NET array to Javascript array | <p>Does anyone know how to pass a C# ASP.NET array to a Javascript array? Sample code will also be nice.</p>
<p>Sorry if I was vague earlier guys. The question is actually quite simple. Let's say for simplicity that in my aspx.cs file I declare:</p>
<p><code>int [] numbers = new int[5];</code></p>
<p>now I want to pass "numbers" to the client side and use the data in the array within javascript. How would I do this?</p>
| c# javascript asp.net | [0, 3, 9] |
5,119,790 | 5,119,791 | Android: trying to make a count down from dec 21 using GregorianCalendar class | <p>I'm trying to make a simple app that will display a count down timer to December 21.</p>
<p>I have the following code</p>
<pre><code> GregorianCalendar gToday = new GregorianCalendar();
GregorianCalendar gEndOfWorld = new GregorianCalendar();
gEndOfWorld.set(2012,12,1);
</code></pre>
<p>My idea was to minus the 2 dates. but It seems like there is no method to subtract dates. Is their a way to accomplish this?</p>
| java android | [1, 4] |
3,429,693 | 3,429,694 | change encoding when using class with remote scripting in c# | <p>I have a class in c# in that store some user messages, and return it as a string</p>
<p>the problem is when using hebrew character ,it return to the page as symbols.</p>
<p>I am using "remote scripting" by Brent Ashley, to update the server side ,so I get those </p>
<p>strings to the javascript using this method.</p>
<p>if I use the remote scripting to communicate with the server side, without calling the class methods,I can get strings just right,so I think it's more like class encoding then remote scripting encoding.</p>
<p>Thanks</p>
| c# javascript asp.net | [0, 3, 9] |
1,874,718 | 1,874,719 | how to access a web control inside a userControl from aspx page | <p>i have 2 textbox controls inside a usercontrol TextBoxUC.ascx<br>
i have a page.aspx that contains the usercontrol. how can i get a reference to each textbox using javascript from page.aspx?</p>
| c# asp.net javascript | [0, 9, 3] |
3,283,881 | 3,283,882 | How to differentiate between click and drag/drop event? | <p>I have a problem with element which is both draggable and also has a click event.</p>
<pre><code>$('.drag').mousedown(function() {
//...
});
$('.class').click(function() {
//...
)};
<div class="drag class"></div>
</code></pre>
<p>When I drag and drop the element, the click event gets fired, too. How to prevent that?</p>
| javascript jquery | [3, 5] |
5,586,107 | 5,586,108 | How to pass a variable value from the code behind to an external javascript file (jquery file)? | <p>Suppose I have this:</p>
<pre><code><asp:LinkButton runat="server" CssClass="lFilename" ID="grdlinkFilename" Text='<%#Eval("FILEPATH")%>' CommandArgument='<%#Eval("FILEPATH")%>' OnCommand="grdlinkFilename_click"> </asp:LinkButton>
</code></pre>
<p>How can I pass the <code><%#Eval("FILEPATH")%></code> to an external javacript(jquery) file?</p>
<p>Someone please help me with this.</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
5,757,032 | 5,757,033 | Javascript - Image change an resize to full background | <p>As a quick explanation, I created an image that resizes to fill the background using this function which works great:</p>
<pre><code>function resize_bg(element_id){
$("#"+element_id).css("left","0");
var doc_width = $(window).width();
var doc_height = $(window).height();
var image_width = $("#"+element_id).width();
var image_height = $("#"+element_id).height();
var image_ratio = image_width/image_height;
var new_width = doc_width;
var new_height = Math.round(new_width/image_ratio);
if(new_height<doc_height){
new_height = doc_height;
new_width = Math.round(new_height*image_ratio);
var width_offset = Math.round((new_width-doc_width)/2);
$("#"+element_id).css("left","-"+width_offset+"px");
}
$("#"+element_id).width(new_width);
$("#"+element_id).height(new_height);
return true;
}
</code></pre>
<p>So no problem for the full background image. The problem appears, when I change the image source using Javascript. In other words, I have 1 image set as background but on hover of certain elements on the page, the image changes but it doesn't change the resize right. So the first image on load is resized and positioned correctly, but when I switch the image using .attr('src',newimg) the image is not resized correctly even though I call the function again.</p>
<p>Here is the code I use to change the image and resize it:</p>
<pre><code>$('#menu_work li a').hover(function(){
$('#content').hide();
var img_src = $(this).next('img').attr('src');
$('#full_screen_img').attr('src', img_src );
resize_bg();
$('#full_screen_img').show();
},function(){
$('#full_screen_img').hide();
$('#content').show();
});
</code></pre>
<p>Thanks for any help.</p>
| javascript jquery | [3, 5] |
4,103,081 | 4,103,082 | JQuery load script on a click event | <pre><code>$('#selector').click(function() {
// here I would like to load a javascript file
// let's say /js/script-on-click-event.js
});
</code></pre>
<p>Is that somehow possible? I'm not sure but I remember reading about a function that does this in JQuery documentation but I cannot find it here, maybe it's been deprecated or I saw it elsewhere?</p>
<p>Basically what I want is to load a script on a click event.</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.