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,577,105 | 1,577,106 | Javascript DoEvents equivalent? | <p>Here is my shortened code snippet:</p>
<pre><code>$(document).ready(function() {
$.get("/Handlers/SearchData.ashx",
function(data) {
json = $.evalJSON(data);
});
//do some other stuff
//use json data
alert(json == null);
});
</code></pre>
<p>Alert says true because evalJson is not done processing JSON data yet (21kb gzipped). I need to wait somehow for it to finish before using that data - exactly what I'd do with DoEvents in a while loop. </p>
| asp.net javascript jquery | [9, 3, 5] |
4,897,567 | 4,897,568 | How to check if a form has no input fields and if so set the focus to an anchor element | <p>Is there any way to check if a specific form has any input fields in it? Or if it has no input fields?</p>
<p><strong>Update:</strong></p>
<p>Also how do I return the focus to a button on page load if the condition is met?
The below doesn't seem to work</p>
<pre><code>var numInputs = $("#forgotPassword").find("input:visible").length;
if(numInputs == 0){
$('.button-class > a').focus();
}
</code></pre>
| javascript jquery | [3, 5] |
843,996 | 843,997 | How to check on inserting new values if they already exists? | <p>I have a gridview and sqldatasource to bind data to gridview.</p>
<ul>
<li>I have 3 columns in database : Name,Age,Birthday.</li>
<li>I have 3 textboxes and a button for adding new row with values from
textboxes in the data table , gridview.</li>
</ul>
<p>When I click the button for adding a new row with those information , I need to check if the value from textbox for "Name" already exists in the data table in the column "Name" if yes then the update is canceled and the user is asked to enter another value.</p>
| c# asp.net | [0, 9] |
4,179,803 | 4,179,804 | playing video in asp.net | <p>here i am working on a project in which a user can upload many videos and can view so now i want to develop something which played video file also on low bandwidth internet connection and i never did such as work before so i don't have any idea about so please suggest me some user tips and techniques.</p>
| c# asp.net | [0, 9] |
481,966 | 481,967 | How to catch application error outside global.asax? | <p>How to catch application error outside global.asax ? I want to catch unhandled exception outside global.asax </p>
| c# asp.net | [0, 9] |
1,454,989 | 1,454,990 | Convert string to date in a specific format without time | <p>I have a doubt that when I am converting a String to date then It will return it as:</p>
<p><strong>Sun Apr 30 00:00:00 GMT+05:30 2017</strong></p>
<p>but I want the format to be as:</p>
<p><strong>2017-04-30</strong></p>
<pre><code>Date last_date_date = new SimpleDateFormat("yyyy-MM-dd").parse("2017-04-30");
</code></pre>
<p>So Which method I need to apply for that?</p>
| java android | [1, 4] |
5,242,516 | 5,242,517 | Send POST array | <p>i wish to send some data as array from my iphone app to server</p>
<p>When i was posting single variables before i was sending the post as an NSString </p>
<pre><code>NSString *post =[[NSString alloc] initWithFormat:@"userName=%@&accountID=%@&",
username,accId];
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:url];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
</code></pre>
<p>Now i wish to send an array of these usernames and accountIds, how do i send an NSArray in a POST and then in php on my server how can i retrieve it?</p>
<p>Thanks</p>
| php iphone | [2, 8] |
5,449,180 | 5,449,181 | How to make two inputfields that show the same data? | <p>So I have one input field that needs to pop up in another place when the user changes a tab and presses a button,
but I figured tossing the div around would be too much hassle,
so is it instead possible to make two input fields but have them display the same input entered by the user?</p>
<p>Or is there an easier way?</p>
| javascript jquery | [3, 5] |
2,958,709 | 2,958,710 | separate each value with comma from multiple select | <p>I have a <code><select multiple='multiple'</code> and I need to show the selected value in a div or some other part of the page.</p>
<p>I did this but the string is all smushed together. How can I separate each value with a comma?</p>
<p>I made a <a href="http://jsfiddle.net/2C523/12/" rel="nofollow"><strong>live example</strong></a> with what I have so far.</p>
<p>Or if you prefer, here is the code:</p>
<p><strong>html:</strong></p>
<pre><code><select multiple='multiple' id="selMulti">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select>
<input type="button" id="go" value="Go!" />
<div style="margin-top: 10px;" id="result"></div>
</code></pre>
<p><strong>js:</strong></p>
<pre><code>$("#go").click(function(){
var selMulti = $("#selMulti option:selected").text();
$("#result").text(selMulti);
});
</code></pre>
<p>If you select the option 1 and 2, the result will be:</p>
<p><code>Option 1Option 2</code></p>
<p>What I need is:</p>
<p><code>Option 1, Option 2</code></p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
3,232,438 | 3,232,439 | Free website heatmap generator script | <p>I know there are commercial offerings that allow developers to drop a javascript file on their website and track / visually see via a heatmap where a users cusor rests and clicks but are there any open source or code samples in asp.net & javascript?</p>
<p>Like this..</p>
<p><img src="http://i.stack.imgur.com/DlEc9.png" alt="enter image description here"></p>
<p>I've already looked at this one <a href="http://www.labsmedia.com/clickheat/index.html" rel="nofollow">http://www.labsmedia.com/clickheat/index.html</a>. Any more??</p>
<p>Note : Don't want to use PHP.</p>
| javascript asp.net | [3, 9] |
1,405,192 | 1,405,193 | jquery scroll mouse wheel if input has hidden text with text-indent | <p>I have </p>
<pre><code><input type="text" readonly="readonly" style="width: 50px" value="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus viverra ullamcorper tellus, in varius erat mollis in. Suspendisse condimentum turpis sit amet tortor bibendum cursus lobortis enim posuere." />
</code></pre>
<p>The text is longer than the input width and the only way to view this is it you select the text which is hidden. </p>
<p>Is there a way to detect the scroll of the mousewheel up/down and change the <code>text-indent</code>?</p>
<p>I dont want this to effect the ability to select the text, e.g I wanted to copy/paste a single word "Phasellus". </p>
<p>Also be good if this worked for touch screen devices. </p>
<p><a href="http://jsfiddle.net/v4g8X/" rel="nofollow">jsFiddle</a></p>
<ol>
<li>It needs to only text-indent the text if its hidden (longer than the input width+padding+border)</li>
<li>Make it impossible to scroll too many and the text get completely hidden.</li>
</ol>
| javascript jquery | [3, 5] |
4,913,168 | 4,913,169 | Accessing a Class that is NOT declared in App_Code in ASP.NET | <p>I sometimes define Business Logic classes to "help" my ASPX code-behind classes. It makes the most sense to me to include them both in the code-behind file since they work together. However, I'd occasionally like to access the Business Logic classes from higher level classes defined in App_Code but they aren't automatically accessible outside of the file.</p>
<p>Thus, the question: it is easy to access classes defined in App_Code but how do I access classes defined elsewhere?</p>
<p>UPDATE: One other thing, the ASPX page class and the App_Code class are in the same namespace - that isn't the issue.</p>
<p>NOTE: I have taken the advice of those who have responded (thanks guys) and am refactoring to make class access easier. However, I don't think the question is actually answered yet (in the case of an ASP.NET Website project). I don't <em>need</em> the answer any more but, if someone could clarify what makes classes visible when they are outside of App_Code, it may well help someone else (or even me, down the road).</p>
| c# asp.net | [0, 9] |
2,894,275 | 2,894,276 | external JS does not work | <p>I have the following code:</p>
<pre><code><script language="javascript" type="text/javascript">
$.fn.dataTableExt.oPagination.input = {
"fnInit": function (oSettings, nPaging, fnCallbackDraw) {
....
},
"fnUpdate": function (oSettings, fnCallbackDraw) {
....
}
};
</script>
</code></pre>
<p>and it works, but when I create external file and put this code inside this file (of course without <code><script></script></code> ) - it does not work. Why?</p>
| javascript jquery | [3, 5] |
312,933 | 312,934 | jQuery help for checking if the asyc behavior is accomplished | <p>I have a function which has a jQuery.post being done, with POST parameters passed to it.</p>
<pre><code>function executeFunction(){
jQuery.post("../somefile.php", {executeFunction:true});
}
</code></pre>
<p>If I'm not wrong, this is async behavior. </p>
<p>Elsewhere in the code, I have:</p>
<pre><code>executeFunction(function(){
jQuery('#box').reload();
});
</code></pre>
<p>After the async behavior is done, I need to take the action of jQuery('#box').reload();</p>
<p>How do I put a check to see if the async behavior has been accomplished?</p>
| javascript jquery | [3, 5] |
393,819 | 393,820 | Launching activities within a tab in Android | <p>Here's the deal. I have an application with three tabs. Through various interactions with the items in the tabs I end up launching other activities. The client has reviewed this and would like the activities launched "within" the tabs, so the tabs remain visible and if the user clicks the tab it goes back to the original activity defined in the setContent function. Is this possible and how would I go about this from other activities? (ie the child activities, not the one that defines the TabHost and has access to call setContent)?</p>
| java android | [1, 4] |
3,197,997 | 3,197,998 | jQuery on submit only fires once | <p>I've got a form that is loaded dynamically, with a textarea that I must check for spam before submitting. So I wrote something like this:</p>
<pre><code>$(document).ready(function(){
$('form').live('submit',function(){
if ( $('form textarea').val().match(/https?:\/\/|www\.|\.com/) ) {
return false;
}
return true;
})
});
</code></pre>
<p>And it works fine, the first time. However, if I click on the submit button again, the form is submitted without going through the validation. There are some related questions in SO already, but I've tried their answers and can't seem to make it work. I tried for example attaching the listener to the document rather than the form, and using the <code>on</code> method rather than <code>live</code>, but with no luck yet. Any help is appreciated!</p>
| javascript jquery | [3, 5] |
4,841,637 | 4,841,638 | ASP.NET/UserControls: How do I sepparate the "controller" from the "view"? | <p>Is it possible to sepparate the ascx ("view") and the ascx.cs ("controller") pars of a user control. Id like to move the controller part to App_Code to be resued while the view part is changed between projects?</p>
| c# asp.net | [0, 9] |
1,706,287 | 1,706,288 | getting id passed through a href link in click function | <p>I've got a fairly straight forward question. Why can't I use <code>$('a.view').attr('id')</code> (Ref //1 in code) in my click function? I tried it and it failed to work but <code>this.id</code> works. I guess I primarily want to know the difference in the context of the code below:</p>
<p><strong>displayRecord.php (The following link calls the click function):</strong></p>
<pre><code>echo '<td><a href="#" style="text-decoration: none;" id="'.$data['id'].'" class="view" ><input type="button" value="View" /></a></td>';
</code></pre>
<p><strong>editTicket.php:</strong></p>
<pre><code>$('a.view').click(
function(e)
{
//1
var ticket_id = this.id;
dlg.load('displayRecord.php?id='+this.id, function(){
var escalationValue = '';
$.post('escalateValue.php',{post_ticket_id:ticket_id},
function(data) {
if (data == 'No'){
showCount();
}
});
dlg.dialog('open');
});
});
</code></pre>
| javascript jquery | [3, 5] |
3,378,320 | 3,378,321 | jQuery loop on carousel not working | <p>Adding a loop option does not make my carosel loop!</p>
<pre><code>`jQuery('#third-carousel').jcarousel({
vertical: true,
loop: true
});`
</code></pre>
<p>Using: /jquery/jquery-1.3.2.min.js</p>
<p>Carosel script:http://sorgalla.com/projects/jcarousel/lib/jquery.jcarousel.min.js</p>
<p>Can you help?</p>
| javascript jquery | [3, 5] |
4,578,696 | 4,578,697 | why javascript not work on masterpage | <p>work on asp.net vs 05 C#.Master page header contain the bellow code</p>
<pre><code><script type="text/javascript" language="javascript" src="JScript.js"></script>
</code></pre>
<p>from my one page i call the javascript method </p>
<pre><code> <asp:TextBox ID="txtLength" runat="server" >0</asp:TextBox>
<asp:TextBox ID="txtHeight" runat="server" onchange="javascript:DoChange();">0</asp:TextBox>
</code></pre>
<p>javascript method is below :</p>
<pre><code> {
alert("hello world");**//get this alert but don't get the bellow alert.**
var a=document.getElementById("txtLength");
var b=document.getElementById("txtHeight");
alert(a.value*b.value);
}
</code></pre>
<p>want to show value on message box .Actually want to calculate the Sft,How to ?</p>
| asp.net javascript | [9, 3] |
411,718 | 411,719 | monitoring user's activities using jquery | <p>I am building an examination app, in which i need users to stay on the app and answer some questions. I need to monitor when they fail to do so, like opening a new tab or browser to search for answers. Also when they minimize the app window etc. So is there any way to do this in jquery. Please don't down vote this question as I have searched for similar question on this site for answers. </p>
<p>Something like when mouse does not hover over body element of the document.?</p>
| php jquery | [2, 5] |
2,469,985 | 2,469,986 | compare values of cells in different rows in table using jquery | <p>I have a dynamically generated table with php that has same rows. Need to get value from cell 1 in row 1 and value from cell 1 in row 2 and compare them. If they are the same remove entire row or hide... Do that for the whole table... Any help is appreciated.. Thanks!!</p>
<p>Haave this so far:</p>
<pre><code>var numRows = $('table#changeSubjectKatedra tr').lenght;
var i = 0;
do {
var cur = $('input#'+i).val();
var next = $('input#'+(i+1)).val();
if(cur == next){
$('tr#'+i).remove();
}
i++;
} while(i<numRows);
</code></pre>
<p>The row in table looks like this:</p>
<pre><code><tr id='idNum'><td>someText<input type='hidden' value='someData' id='idNum'>
</td><td>someText</td></tr>
</code></pre>
| php jquery | [2, 5] |
4,761,601 | 4,761,602 | Accessing controls inside a dynamically generated control | <p>I'm creating instances of various controls at runtime in the Page_Load method of another control. The dynamically generated controls are then added to a Placeholder.</p>
<p>From inside the dynamically generated controls (in their own Page_Load method) I am trying to set the values of various Literals, but they are all null. </p>
<p>Can anyone shed some light on why I can't access these Literals?</p>
<p>Thanks
Ryan</p>
| c# asp.net | [0, 9] |
1,633,532 | 1,633,533 | How to use the ajax() function in JQuery? | <p>In my javascript file I have the following:</p>
<pre><code><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$.ajax({
type: 'post',
url: 'script.php',
data: '',
success: function(output) {
alert(output[0])
}
});
</script>
</code></pre>
<p>In my PHP file I have the following:</p>
<pre><code><?php
echo 'dog';
echo 'cat';
?>
</code></pre>
<p>Now I know I'm not passing any data through the ajax function, I just wrote the above to test one thing, that is:</p>
<p>When I alert <code>output[0]</code> I get the letter "d". Instead I want to be able to get "dog" and when I alert <code>output[1]</code> I want to be able to get "cat". How to achieve this?</p>
| javascript jquery | [3, 5] |
3,252,757 | 3,252,758 | How to code iphone web app with PHP/MySQl web server | <p>basically i have a site which made by php and mysql</p>
<p>i wanna to develop a iphone webapp (non-native app) to interact with my new mobile site (php+mysql)</p>
<p>im not sure how iphone webapp work, can it include the whole site directly?? </p>
<p>im quite worry about the connection with mysql database too</p>
<p>is it possible to do that?</p>
<p>can i develop the mobile site as normal web page?</p>
| php iphone | [2, 8] |
1,972,909 | 1,972,910 | Increment a double value | <p>I'm using this part of code in my system.</p>
<pre><code>double countA = 0.00;
double countB = 0.00;
if (myrow.grade == "A")
{
countA += 1.00;
}
else if (myrow.grade == "B")
{
countB += 1.00;
}
countALabel.Text = Convert.ToString(countA);
countBLabel.Text = Convert.ToString(countB);
</code></pre>
<p>The code is supposed to calculate how many student in my <em>examMarks</em> table that get "A" or "B" and display it using labels. However I keep getting <code>0</code> value even if there are students who get "A" and "B" in my table?</p>
<p>How do i get the increment value?</p>
| c# asp.net | [0, 9] |
2,025,756 | 2,025,757 | make the drop down menu show from another buttons click | <p>If I click on my <code>a href</code> button how do I make the drop down menu show? </p>
<pre><code><a href="#" onclick"makeIDCarsMenuShow()" >my button</a>
<select name="cars" id="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat" selected="selected">Fiat</option>
<option value="audi">Audi</option>
</select>
<script>
function makeIDCarsMenuShow(){
$('#cars').trigger('click');
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,826,575 | 4,826,576 | JavaScript get PHP Variable in URL | <p>How are you?
I need some help with javascript</p>
<p>I have this code of WHMCS (<a href="http://docs.whmcs.com/Data_Feeds" rel="nofollow">http://docs.whmcs.com/Data_Feeds</a>):
{literal}{/literal}</p>
<p>{literal} => Run JavaScript in WHMCS Templetes files
{/literal} => Finish JavaScript </p>
<p>I need to change the value&currency=1 with the variable in my URL.</p>
<p>For example index.php?currency=4 Have this code: {literal}{/literal}</p>
<p>Can you help me?</p>
<p>Regards, Alex :)</p>
| php javascript | [2, 3] |
3,511,709 | 3,511,710 | Asynchronous javascript issue | <p>I am trying to create a function which takes values from various html elements of the page to create a string and pass on to a variable. now this works great for all browsers except IE 8 and 9. IE tends to skip the part of fetching the values and goes straight to the variable and finds nothing.. </p>
<p>is there a way to sync it all so that it works in IE?</p>
<pre><code>function seturl() {
var qstring = returnQString();
$('span.keyword').text($.trim($('#hdnKeyWord').attr('value')));
$('input.search_box').attr('value', $.trim($('#hdnKeyWord').attr('value')));
$('#hdnSearchKeyword').attr('value', $.trim($('#hdnKeyWord').attr('value')));
$(".search_box").val($.trim($("#hdn_span_hdnKeyWord").text()));
$(".header_inner input[type='text']").focus();
$(".search_term input[type='text']").focus();
$('#locationurl').attr('value', qstring);
}
function returnQString(){
var qstring = $.trim($('#locationurl').attr('init')); //initial value of the url
qstring += "?type=" + $('#hdnSTSearch').attr('value'); // type of handler hit
qstring += "&keyword=" + encodeURIComponent($('#hdnKeyWord').attr('value')); // keyword addition
qstring += "&pagestart=" + $('#current_page').attr('value'); // pagestart(current page) addition
qstring += "&pagesize=" + $('#show_per_page').attr('value'); // per page size addition
qstring += "&facets=" // facetsearch
$.each(selectedFilter.items, function (index, value) {
qstring += value.filter + ",";
});
qstring += "&selectedSection=" + selectedSection // Section Select
return qstring;
}
</code></pre>
| javascript jquery | [3, 5] |
4,239,083 | 4,239,084 | Uri.parse() - MediaPath is null | <p>I want to parse a uri string like this:</p>
<pre><code>String fileName = playList.get(playListIndex);
// fileName = "video1"
String uri = String.format("android.resource://%s/R.raw.%s",getPackageName(), fileName);
// uri = "android.resource://com.example.fooApp/R.raw.video1"
mediaPath = Uri.parse(uri);
02-19 08:41:54.189: I/MediaPlayer(18730): path is null
</code></pre>
<p>It works when its like this, but I want that last bit "video2" to be dynamic.</p>
<pre><code> mediaPath = Uri.parse("android.resource://" + getPackageName() + "/"+ R.raw.video2); this workes
</code></pre>
| java android | [1, 4] |
558,015 | 558,016 | Add rows to a table inside a repeater in client side with jquery | <p>I have a repeater which contains a table. I am giving the user the ability to add a new row in the repeater by adding a new row to the table.</p>
<p>Can anyone give me ideas? As I am very new to jQuery, can someone give sample code?</p>
| c# asp.net jquery | [0, 9, 5] |
4,673,434 | 4,673,435 | Get ID from URL with jQuery | <p>I've got a url like this:</p>
<pre><code>http://www.site.com/234234234
</code></pre>
<p>I need to grab the Id after <code>/</code>, so in this case <code>234234234</code></p>
<p>How can i do this easily?</p>
| javascript jquery | [3, 5] |
5,494,838 | 5,494,839 | How to open and close a popup window after it's completely loaded (in a loop)? | <p>i have something like this for my own little bookmarklet:</p>
<pre><code>jQuery('#fire').click(function() {
for (counter=0; counter<links; counter++) {
var currentLink = jQuery('body').find('.imageWrap:eq('+counter+')').attr("href");
var newWindow = window.open(currentLink);
/* and here close the popup when the site is completely loaded */
}
});
</code></pre>
<p>can anyone help me out?</p>
| javascript jquery | [3, 5] |
3,121,432 | 3,121,433 | a code in javascript or php that captures the time a client uses a computer and what he has been used it for | <p>i was developing a web application which gets what a client is using the computer for and how much he has used the computer. could you please help me generate this code in php or java script.</p>
| php javascript | [2, 3] |
1,859,766 | 1,859,767 | Help with jQuery validation | <p>I'm having a problem coding for a form validation. I'll post the code below. Basically i want the form to submit if cboAction is on another selection.</p>
<p>cboAction has three values, <strong>[Select]</strong>, <strong>Insert</strong> and <strong>Search</strong>. So if Insert is selected in the combobox then the form should validate using jquery else if Search is selected then the form should get submitted. I tried putting an if statement in there but it didn't work. :(</p>
<p>Btw the form validation works, its just that i can't get the above working. Hope to hear from someone.</p>
<p>Thanks</p>
<pre><code>jQuery.validator.addMethod(
"selectOption",
function(value, element) {
if(element.value == "nothing") {
return false;
} else {
return true;
}
},
"Please select an option."
);
$(document).ready(function() {
$("#authorForm").validate({
rules: {
cboAction: {selectOption:false}
txtName: {required:true},
txtStreet: {required:true}
txtTown: {required:true},
cboState: {selectOption:true},
txtPostcode: {required:true},
txtMobile: {required:true},
txtEmail: {required:true, email:true}
},
messages: {
cboAction: "Please select an action"
txtName: {required: "Author's Name is a required field"},
txtStreet: {required: "Street is a required field"}
txtTown: "Town is a required field",
cboState: "Please select a state",
txtPostcode: "Postcode is a required field",
txtMobile:
{
required: "Mobile is a required field",
email: "Please enter a valid email adress"
}
}
});
});
</code></pre>
| javascript jquery | [3, 5] |
1,316,777 | 1,316,778 | Android in Eclipse autocompletes arg0, arg1, | <p>Come on, I know this is simple, but I can't find an answer. When I autocomplete in Android in Eclipse, the methods get param names like arg0, arg1, etc. Presumably, this would be better if I had source or something for Android located somewhere, but there are 14,000 git repositories for it and I don't know which to grab or what to do after.</p>
<p>Can someone help?? I don't want "View arg0" I want "View v" or something. :-)</p>
| java android | [1, 4] |
2,057,809 | 2,057,810 | set javascript array from DataTable in code behind | <p>Im trying to set an array in <code>Javascript</code>, and then give it values from the <code>DataTable</code> in the code behind like that :</p>
<pre><code>for (var i = 0; i < '<%=dt_questionVideo.Rows.Count - 1 %>'; i++) {
videoQarray[i] = '<%=Convert.ToInt32(dt_questionVideo.Rows['+i+'][0]) %>';
}
</code></pre>
<p>Im getting an error </p>
<blockquote>
<p>Too many characters in character literal</p>
</blockquote>
<p>how can I manuover this one ?</p>
| c# javascript asp.net | [0, 3, 9] |
1,659,335 | 1,659,336 | select random value NOT in array | <p>How would I select a random value (0 to 30) that is not in this array?</p>
<pre><code>var list = new Array(1,3,4,7,8,9);
</code></pre>
| javascript jquery | [3, 5] |
5,700,081 | 5,700,082 | Use JQuery to set css file body background url | <p>I'm trying to change my body's background dynamically in a jQuery window resize event.
The below is a simplified example that attempts to set the body background url property when the page loads, but its not the right syntax. Any ideas?</p>
<p>test.css:</p>
<pre><code>body {
margin: 0px auto;
font-family: HelveticaNeue;
}
</code></pre>
<p>test.html's JavaScript:</p>
<pre><code> $(document).ready(function() {
$("body").css("background", "url('image/setme.png')");
});
</code></pre>
| javascript jquery | [3, 5] |
4,938,642 | 4,938,643 | Commenting parts of a blog post or document with jquery | <p>I am interested in making an addon to an existing site where there is a system where users can post information, sort of like a blog post, and then regular comments like you see on any page are shown below the content of the post.</p>
<p>However I have been considering using something like this <a href="http://www.electrictoolbox.com/jquery-modify-right-click-menu/" rel="nofollow">http://www.electrictoolbox.com/jquery-modify-right-click-menu/</a></p>
<p>In order to make a custom dropdown menu where users can right click and comment that section of the page. What would be even better is if I could make it so that a user can highlight a section of text and then add a comment for that section. When another user then views the page he/she will see a highlighted block for the part of the content which the comment references to.</p>
<p>What i need help with is the highlighting part to activate a comment and how I would know what part the user is commenting. Or a way of knowing where the right click is done and then showing the comment box.</p>
<p>Some alternatives I have thought of is sending the highlighted part via post to a php file that then parses the content and updates the right area with the highlight, however this could cause conflicts for content which is the same. Another is of course to make each line of the content its own span or something where the id could be used to match the right row and highlight it, however the highlight and comment is a much better approach for me. </p>
<p>Anyone know if there are any existing examples of how to go about doing this?</p>
| javascript jquery | [3, 5] |
5,198,512 | 5,198,513 | jQuery reset count on key press after partial postback | <p>I have a <code>TextBox</code> inside an asp.net <code>UpdatePanel</code> that records the number of key presses with some jquery</p>
<pre><code>$(document).on("keypress", "#TextBox",function() {
$("#KeyPressCount").val(i += 1);
});
</code></pre>
<p>I do a partial postback after a button click inside the UpdatePanel and the jquery re-binds as expected and continues counting the key presses.</p>
<p>Now if I wanted to reset the count after the partial postback how would I go about doing that?</p>
<p>So if it had counted 20 key presses then a postback occurred it would reset to 0 and start counting again.</p>
<p>Any advice is appreciated.</p>
| jquery asp.net | [5, 9] |
2,049,676 | 2,049,677 | Replace image url in ASP.NET image button using JQuery? | <p>I am working in asp.net and mysql. Will shows the details of rooms in page with images that getting for mysql database,. In the Main Image will change when i click the small size image buttons. </p>
<p>I want to replace the Image1 ImageUrl "~/GetRoomImage.aspx?id=1" to "~/GetRoomImage.aspx?id=2" or "~/GetRoomImage.aspx?id=3" like this,. when clicking the regading imagebutton.</p>
<p>Please help me to get this in Jquery.</p>
<p><img src="http://i.stack.imgur.com/oJJFl.png" alt="enter image description here"></p>
<p>My Code,..</p>
<pre><code><asp:Image ID="Image1" runat="server" ImageUrl="~/GetRoomImage.aspx?id=1" Height="178" Width="178"></asp:Image> <br /><br />
&nbsp;
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/GetRoomImage.aspx?id=2" Height="30" Width="37" /> &nbsp;
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/GetRoomImage.aspx?id=3" Height="30" Width="37" />&nbsp;
<asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/GetRoomImage.aspx?id=4" Height="30" Width="37" />&nbsp;
<asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/GetRoomImage.aspx?id=5" Height="30" Width="37" />
</code></pre>
| jquery asp.net | [5, 9] |
5,677,555 | 5,677,556 | writing JavaScript with PHP | <p>I am trying to right some some JavaScript to define a variable using PHP. The variable has a little jQuery in it which should get rendered by the client. I say "should" but really mean I want it to. What should I do to make o2 the same as o1 (i.e. covert the jQuery)?</p>
<p>Thank you!</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=ISO-8859-1" />
<title></title>
<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
<script>
$(function() {
var o1={"foo":{"bar": "abc/index.php?="+$("#id").val()}};
console.log(o1);
<?php
$d='abc/index.php';
$json='{"foo":{"bar": "'.$d.'?id=\"+$(\"#id\").val()"}}';
//echo($json);
$json=json_decode($json);
//echo(print_r($json,1));
$json=json_encode($json);
//echo($json);
echo("var o2=".$json.";");
?>
console.log(o2);
});
</script>
</head>
<body>
<input type="hidden" id="id" value="123" />
</body>
</html>
</code></pre>
| php javascript | [2, 3] |
1,214,413 | 1,214,414 | How to make something load first before another in javascript and jquery | <p>I have a div with text in it and a background image. When I load the page the text always appear 1st(assume i have low speed internet connection). How can i make the background image load before text? Can You please give me solution in both jquery and javascript</p>
| javascript jquery | [3, 5] |
4,440,150 | 4,440,151 | How can I interact java program using python | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9333637/how-to-execute-java-program-using-python-considering-inputs-and-outputs-both">How to execute java program using python considering inputs and outputs both </a> </p>
</blockquote>
<p>I want my python variable should receive all the output of java program and using that variable i will display the output on the screen. also if there is a input to java program, I want that user will enter the input which will be stored in my python variable and using this variable, I want to pass the input to java program.. What should I do?? Please help..</p>
| java python | [1, 7] |
1,203,388 | 1,203,389 | Need help regarding submitting values through a form with select Box? | <p>I have a empty select box on a form. </p>
<p><code><select id='essentialDocs[]' ></select></code></p>
<p>through some script i add options to it. Basically it adds URL's. So at runtime html will look
like </p>
<pre>
<code><select id='essentialDocs[]' >
<option value='http://www.google.com' title='Google'>Google</option>
<option value='http://www.yahoo.com' title='yahoo'>Yahoo</option>
</select></code>
</pre>
<p>Now on submitting the form i want to get both of these key:value pairs</p>
<p>like Title:URL google:http://www.google.com</p>
<p>but on doing <code>$_POST['essentialDocs']</code> i only get values and not title's. What modification would help get me both. Also another thing i have on the form is i can switch the ordering of url's on screen. Please suggest some solution</p>
| php javascript | [2, 3] |
5,614,762 | 5,614,763 | Getting the first table cell value in a column with jQuery | <p>I have a table with some values. The first row and first column contain values of such called vertical and horizontal sizes respectfully. What I need to do is to click on a table cell and get the horizontal and vertical values for that clicked table cell. What it basically means - get the value of first table cell in the row where the clicked table cell is located and get the first table cell value of the column where the clicked table cell is located. I'm getting the horizontal value with the following code:</p>
<pre><code>var horizSize = $('th:first', $(this).parents('tr')).text();
</code></pre>
<p>But I'm not sure how to do that for the vertical line. How to get to the first table cell value of the column?</p>
<p>Thanks for helping. </p>
| javascript jquery | [3, 5] |
207,207 | 207,208 | How to use .append on a jQuery .load() function | <p>I'm trying to append the data being called rather than replacing it but I'm not sure why .append isn't working.</p>
<pre><code> $('.incoming3').load('t3.html #test3').append;
</code></pre>
| javascript jquery | [3, 5] |
31,014 | 31,015 | Asp.Net Page Load | <p>i have a weird problem ! i have ASP.NET website and i have a page with page_load which never get executedno matter what i do ,i deleted the page_load and doubled clicked the aspx page it generated page_load again i inserted my code inside and made breakpoint but it never get hit ! </p>
<p>All other Methods gets hit normal like button click and gridview events etc.</p>
<p>ASP.NET 4</p>
<p>it only happens with this page only.</p>
<p>any one ever faced this weird problem ?</p>
| c# asp.net | [0, 9] |
460,481 | 460,482 | Javascript storing data | <p>Hi I am a beginner web developer and am trying to build the interface of a simple e-commerce site as a personal project.The site has <strong>multiple pages with checkboxes</strong>.</p>
<p>When someone checks an element </p>
<ul>
<li>it retrives the price of the element and </li>
<li>stores it in a variable.</li>
</ul>
<p>But when I go to the next page and <strong>click on new checkboxes</strong> products the variable automaticly <strong>resets</strong> to its original state.</p>
<p>How can I save the value of that variable in Javascript?I am using the <strong>jQuery</strong> library.</p>
<p>EDIT:This is the code I've writen using sessionStorage but it still dosen't work when I move to next page the value is reseted.</p>
<p>How can I wright this code so that i dosen't reset on each page change.All pages on my website use the same script.</p>
<pre><code>$(document).ready(function(){
var total = 0;
$('input.check').click(function(){
if($(this).attr('checked')){
var check = parseInt($(this).parent().children('span').text().substr(1 , 3));
total+=check;
sessionStorage.var_name=0 + total;
alert(sessionStorage.var_name);
}else{
var uncheck = parseInt($(this).parent().children('span').text().substr(1 , 3));
total-=uncheck;
}
})
</code></pre>
| javascript jquery | [3, 5] |
5,637,955 | 5,637,956 | Android: Repeat a dispatchKeyEvent while while a button is selected, focused, or pressed | <p>My layout contains a button and an editText view. While the button is held down I want to have a keyboard key pressed over and over again until the button is released.
Here is the basic concept:</p>
<pre><code>while(button is held down){
dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_P));
dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,
KeyEvent.KEYCODE_P));
}
</code></pre>
<p>Can anybody help me with this?</p>
| java android | [1, 4] |
621,254 | 621,255 | setInterval and clearInterval not working with if() | <p>I am trying to do an AJAX refresh every 7 seconds on some data coming into an AJAX results <code>div</code>. </p>
<p>I need to control when it happens as I have lots of events like text editing and draggable stuff done through jQueryUI. I set up a function with a condition and an <code>if</code> statement to either set up an interval or clear it depending on the condition. </p>
<p>But my function seems to recognise a true state but not a false one. Any ideas or is their a better way to achieve what I want? Many thanks for your time!</p>
<pre><code>var intervalStart = true;
function setupAjaxInterval(condition){
if (condition == true) {
var refreshContent = setInterval(function() {
var datastring = 'refreshpage=true&projid=' + proj_id + '&uid=' + uid;
ajaxUploadData(datastring);
alert('pagerefresh');
}, 7000);
}
else if (condition == false) {
clearInterval(refreshContent);
alert('nofresh');
}
}
setupAjaxInterval(intervalStart);
//works for true but not false.
</code></pre>
| javascript jquery | [3, 5] |
680,853 | 680,854 | On JavaScript + asp.net | <p>In my asp.net page i have java script calendar,on which i want the selected date & then that date has to passed to the code behind's method. How should it be done???</p>
| asp.net javascript | [9, 3] |
3,701,364 | 3,701,365 | casting php arrays to c# hashtables | <p>I have some multi-dimensonial php arrays being passed down to my c# app. To pull values out on the c# side, i have to do something like:</p>
<pre><code>String example = (string)((Hashtable)((Hashtable)example_info["FirstLevel"])["SecondLevel"])["example_value"];
</code></pre>
<p>How would I go about removing the need to explicitly cast every dimension as a hashtable? Do I need a recursive function that builds some sort of List object out of example_info, or should I just not be using hashtables?</p>
| c# php | [0, 2] |
1,486,995 | 1,486,996 | Changing the datatype of column in datatable changes the cell text | <p>Ok, I start off by importing an excel file and then save the data into Data table and then putting it into Gridview. I wanted to copy the column header name into a row cell and it was giving error that Input string was not is a correct format. I tried changing the column data type and it works. But the data copied is different to the original. Here is the code I am using: </p>
<pre><code>DataTable dtf1 = new DataTable();
OleDbDataAdapter adapter = new OleDbDataAdapter(sql, con);
adapter.FillSchema(dtf1, SchemaType.Source);
dtf1.Columns[6].DataType = typeof(string);
adapter.Fill(dtf1);
dtf1.Rows[0][6] = dtf1.Columns[6].ColumnName.ToString();
</code></pre>
<p>The original data is a postcode number "3210" but it is copying it as something "F7".</p>
| c# asp.net | [0, 9] |
2,959,801 | 2,959,802 | Check all fields together? | <p>There are three field. i want check each a of field if have value, show class <code>.koko</code>. if on all field not have value, hide class <code>.koko</code>.</p>
<p>How is it?</p>
<p>in the this code, each field is check separate but i want check all fields together:</p>
<pre><code><input type="text" name="ok" class="ko" value="">
<input type="text" name="ok" class="ko" value="">
<input type="text" name="ok" class="ko" value="">
<div class="koko" style="display: none;">Hello, how are you?</div>
$('.ko').live("keyup", function () {
var $val = $(this).val();
$('.koko').show();
if ($val == '') {
$('.koko').hide()
}
});
</code></pre>
<p><a href="http://jsfiddle.net/P8fMj/" rel="nofollow">DEMO</a></p>
| javascript jquery | [3, 5] |
574,359 | 574,360 | How to populate listview adapter from outside Activity in a TabActivity | <p>I have the following problem.</p>
<p>I am in a tabActivity with 2 tabs. Every tab will launch the same activity, but there is a onTabChangeListener.
In this tabchange listener i need to set up the listview adapter that is different for each activity.
So i will have two different lists, and i want to change their adapter from TabActivity, from this onTabchangeListener, but i get the following error: system services not available to activities before oncreate()
The code for tabs is:</p>
<pre><code> host = getTabHost();
host.addTab(host.newTabSpec(TAG_AVAILABLE).setIndicator("First Tab")
.setContent(new Intent(this, MyActivity.class)));
host.addTab(host.newTabSpec(TAG_DOWNLOAD).setIndicator("Second Tab ")
.setContent(new Intent(this, MyActivity.class)));
host.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
@Override
public void onTabChanged(String s) {
MyActivity myActivity = new MyActivity();
int i = getTabHost().getCurrentTab();
if (i == FIRST_TAB) {
setAdapterForMyActivity(firstAdapter);
}
}
if (i == SECOND_TAB) {
setAdapterForMyActivity(secondAdapter);
}
}
}
});
}
</code></pre>
<p>The main question is how to set adapter of an listView which is in an Activity from TabActivity.
Thank you very much.</p>
| java android | [1, 4] |
4,557,838 | 4,557,839 | More efficient way script the heights of DIVs | <p>Im using this script to find the height of a DIV. I am using it on more than one DIV.
Is there a more efficient way to write this code?</p>
<pre><code>$(document).ready(function() {
$(".block00").height($(".subheader").height());
$(".block01").height($(".subheader").height());
$(".block02").height($(".subheader").height());
});
</code></pre>
| javascript jquery | [3, 5] |
5,714,313 | 5,714,314 | Execute ajax call right after all fields are filled | <p>So I need to check all the fields first:</p>
<pre><code><script type="text/javascript">
<!--
$(document).ready(function(){
$("#loginform").submit(function(){
</code></pre>
<p>LIKE:</p>
<pre><code> //CHECK INPUT
$('#loginform :input:not(:button)').each(function(n,element){
if ($(element).val()=='') {
$(".message").css('margin-top', '13px').html('<p>O campo '+element.id+' tem de ter um valor!</p>').fadeIn("slow").delay(2000).fadeOut(1000);
return false;
}
});
</code></pre>
<p>AND MAKE AJAX CALL AFTER ALL FIELDS ARE FILLED:</p>
<pre><code> //AJAX CALL
$.post(...
BLÁ BLÁ
return false;
</code></pre>
<p>How can I submit values after check all fields?
Thank you as always.</p>
<p>UPDATE:</p>
<p>The solution "I found".</p>
<p>First validate in client side.
Second validate server side.</p>
<p>With the first measure several ajax call's are prevented before all fields are ok!
With the second "move" we prevent malicious intentions.</p>
<p>Thank you very much.
I been learning so much with you :)</p>
| javascript jquery | [3, 5] |
5,380,644 | 5,380,645 | Is this a proper Android Game Loop? | <p>I grabbed this from the book I'm learning from.</p>
<pre><code>public void run()
{
// this is the method that gets called when the thread is started.
// first we get the current time before the loop starts
long startTime = System.currentTimeMillis();
// start the animation loop
while (running)
{
// we have to make sure that the surface has been created
// if not we wait until it gets created
if (!holder.getSurface ().isValid())
continue;
// get the time elapsed since the loop was started
// this is important to achieve frame rate-independent movement,
// otherwise on faster processors the animation will go too fast
float timeElapsed = (System.currentTimeMillis () - startTime);
// is it time to display the next frame?
if (timeElapsed > FRAME_RATE)
{
// compute the next step in the animation
update();
// display the new frame
display();
// reset the start time
startTime = System.currentTimeMillis();
}
}
// run is over: thread dies
}
</code></pre>
<p>Does it account for lag correctly and is it optimal?</p>
<p>What I mean is, if the video cannot update 60 times per second will the update() be called 60x per second?</p>
<p>Thanks</p>
| java android | [1, 4] |
5,253,193 | 5,253,194 | Develop an android and iPhone application with shared database | <p>I have a great idea for smartphone application, And I want to develop an application suited for both android and iPhone. In addition I need to use spatial database for geo indexing that will be shared for both applications. I am new to this app world and I have some questions.</p>
<ul>
<li>Is there away to develop for both machines? I know java but not objective c.</li>
</ul>
<p>My guess is that I need to separate the database from the computing to support both applications.</p>
<ul>
<li>What are the best cloud computing providers with spatial database support that can host the server?</li>
<li>Do I need 2 hosting servers or there is one server the can support the both of them?</li>
<li>which database provider can support geo indexing and support this intergraion,
I prefer providers with reasonable free quotas.</li>
</ul>
<p>Thanks. </p>
| android iphone | [4, 8] |
3,384,167 | 3,384,168 | $(this).attr() not working | <p>I'm testing a script that will allow my classmates to upload a picture and I'm using this code:</p>
<pre><code>var SomeVar = this.class //or similar like this.attr('class')
$('body').attr('style', 'background-image:' + SomeVar)
</code></pre>
<p>However, when I'm testing this code:</p>
<pre><code>function Prueba() {
var hola = this.class
alert(hola)
}
</code></pre>
<p>it alerts <code>undefined</code>.</p>
<p>You can see the webpage at <a href="http://8a13.zzl.org" rel="nofollow">8a13.zzl.org</a>.</p>
| javascript jquery | [3, 5] |
2,144,224 | 2,144,225 | Strip away all HTML tags and formatting (RegEx) | <p>I have RSS feed that I want to modify on fly, all I need is the text (and linefeeds) so everything else must be removed ( All images, styles, links )</p>
<p>How can I do this easily with ASP.NET c#</p>
| c# asp.net | [0, 9] |
2,583,363 | 2,583,364 | alternate row in classes exculde display none in jquery | <p>I have a list of <code>li</code> in a <code>ul</code> to apply css class, I am using following code.</p>
<pre><code>$('#' + firstContainer + ' li:nth-child(even)').addClass('AltRow');
$('#' + firstContainer + ' li:nth-child(odd)').removeClass('AltRow');
$('#' + secondContainer + ' li:nth-child(even)').addClass('AltRow');
$('#' + secondContainer + ' li:nth-child(odd)').removeClass('AltRow');
</code></pre>
<p>Now there are some <code>li</code> which are set to display none so I need to exculde those while applying class.</p>
<p>How to achieve that.</p>
| javascript jquery | [3, 5] |
6,011,305 | 6,011,306 | Long running thread + lifecycle | <p>I have a long-running thread which I start on app startup:</p>
<pre><code>public class MyHelper extends Thread {
private AtomicBoolean mRun;
public void run() {
while (mRun.get()) {
...
}
}
}
public class App extends Application {
private MyHelper mHelper;
public void onCreate() {
mHelper = new MyHelper();
mHelper.start();
}
}
</code></pre>
<p>We don't get any "app terminate" signal in Android though, so is the above keeping my app running forever in the background? There's no good place for me to know when to shut the thread down. </p>
<p>I wonder if the user pops the last activity from the stack (by hitting the back button), will my Application instance get destroyed even though the Thread is still possibly in a waiting state?</p>
<p>Thanks</p>
| java android | [1, 4] |
5,470,892 | 5,470,893 | Does ready() execute asynchronously? | <p>This is a common idiom:</p>
<pre><code><html>
<head>
<script>
(function($) {
$(document).ready(function(){
// some jQuery/JavaScript in here
}
})(jQuery);
</script>
</head>
....
</code></pre>
<p>So we using a JavaScript immediate function which executes some jQuery. Now usually, it is advised to put JavaScript down the end of the page to allow progressive rendering. My questions are:</p>
<ol>
<li>If you are using JavaScript in the head, what difference does it make if you make the function execute immediately?</li>
<li>Will <code>${document).ready(...)</code> block excution, or does it happen asynchronously?</li>
</ol>
| javascript jquery | [3, 5] |
2,581,865 | 2,581,866 | why there is no power operator in java / c ++? | <p>While there is such operator - ** in Python , i was wondering why java and c++ havent got one too.</p>
<p>It is easy to make one for classes you define in C++ with operator overloading ( and i believe such thing is possible also in java) , but when talking about primitive types such as int, double and so on , you'll have to use library function like Math.power (and usaully have to cast both to double).</p>
<p>So - why not define such operator for primitive types ?</p>
| java c++ python | [1, 6, 7] |
1,508,917 | 1,508,918 | Pass array in jQuery ajax | <p>My imaginery code:</p>
<pre><code>$(document).ready(function() {
$("#sub").click(function() {
info['moto'] = $("#moto").val();
info['motox'] = $("#motox").val();
$.ajax({
type: "POST",
url: "index.php",
data: "arr="+info,
success: function(msg){
$('.answer').html(msg);
}
})
})
})
</code></pre>
<p>How could I make, that after receiving it in .php file I could use POST method like this: <code>$_POST['moto']</code> and <code>$_POST['motox']</code> or something like that? What should I change? Thanks.</p>
| php jquery | [2, 5] |
3,590,628 | 3,590,629 | how to write php variable inside a javascript code | <p>this is the path i'm using in an img src attribute which i'm using in a php program</p>
<pre><code>'user/hangout_images/".$imag_addr." '
</code></pre>
<p>can anybody tell how to insert the path given above into the path given in the following javascript code?</p>
<pre><code>$(document).ready(function() {
$('#imageid').attr( "src", "/new/path/to/image.jpg" );
});
</code></pre>
| php javascript | [2, 3] |
90,865 | 90,866 | How to show only part of map on screen | <p>I'm developer of game Space STG II for Android phones... and I want to add to this game new option. To do this I need to know how to do movable screen. I want to do a battle like in Heroes Might & Magic, but in mobile phone screen is small... I don't know how developers show only a part on screen of all things on map. I want to make a small map in corner which show which part of map is shown on screen.
I can't find it :/ I spend 2 days and I found only 2d tile moving, but I need smooth moves. Please help. I will give activation codes for Space STG II for help.</p>
| java android | [1, 4] |
773,852 | 773,853 | jQuery and Object Oriented Javascript - How do I do it properly? | <p>I'm quite experienced with jQuery but I'm just getting into object oriented Javascript and want to make sure I'm doing it right.</p>
<p>Here's an example of what I'm doing so far... I'd appreciate tips/advice on how I can improve my approach:</p>
<pre>
// create a class for collapsable fieldsets
window.CollapsableFieldset = (function() {
function CollapsableFieldset(jQObject) {
// look for all the legend tags within this fieldset
jQObject.find("legend").click(function(event) {
// add or remove the "open" class to the fieldset
return jQObject.toggleClass("open");
});
}
return CollapsableFieldset;
})();
jQuery(document).ready(function() {
return $("fieldset.collapsable").each(function(i, element) {
return new CollapsableFieldset($(element));
});
});
</pre>
<p>So basically I'm creating a class that defines the behaviour I'm looking for and then in the jQuery block, I'm selecting each object that matches and creating a new instance of the class with that object as an argument.</p>
| javascript jquery | [3, 5] |
5,538,081 | 5,538,082 | Multiview Vrs Multiple aspx pages - which one is better..?? (regarding speed..) | <p>Hii..
I am using a Multiview for a application. Each aspx page contains Multiview.</p>
<p>A single multiview contains atleast 5 to 6 views. (so less no. of aspx pages). When user clicks any button such as say "Edit View" (where user can edit his entries), a diffrent view is displayed. So user feels that he is redirected to another page. So a single aspx page has lot of controls, lot of code - a lil bit heavy page. </p>
<p>Will it affect loading time? is it better to use different aspx pages?</p>
| c# asp.net | [0, 9] |
5,464,004 | 5,464,005 | SPLIT with \n Delimiter | <p>I need to split string with delimiter of <code>\n</code> when I use this code:</p>
<pre><code>String delimiter = "\n";
String[] temp;
temp = description2[position].split(delimiter);
for (int i = 0; i < temp.length; i++) {
holder.weeklyparty_text3.setSingleLine(false);
holder.weeklyparty_text3.setText(temp[i]);
}
</code></pre>
<p>but not get split string from <code>\n</code>.</p>
| java android | [1, 4] |
1,734,719 | 1,734,720 | Are there any general listeners defined in Android or Java | <p>Sometimes I want a simple generic Listener without defining my own class. Is there a predefined "something happened and here is a string or object or whatever" in Java or Android?</p>
| java android | [1, 4] |
1,274,767 | 1,274,768 | How to dynamically create and add textbox to a placeholder using AJAX? | <p>I'm trying to create text box dynamically. so I cal it through the AJAX function. </p>
<p>This is my code:</p>
<p><strong>Ajax function</strong></p>
<pre><code>function ChangedAdults(noofAdults) {
alert(noofAdults.value);
$.ajax({
type: 'POST',
dataType: 'json',
url: "/FlightBooking.aspx/Adults",
data: "{noOfAdults:'" + noofAdults.value + "'}",
contentType: "application/json; charset=utf-8",
success: function (result) {
$("#AdultsList").html(result.d);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});
}
</code></pre>
<p><strong>code behind</strong></p>
<pre><code>[WebMethod]
public static string Adults(int noOfAdults)
{
FlightBooking obj = new FlightBooking();
obj.CreateAdultsList(noOfAdults);
string test= "";
return test.ToString();
}
private void CreateAdultsList(int noOfAdults)
{
int n = noOfAdults;
for (int i = 0; i < n; i++)
{
TextBox MyTextBox = new TextBox();
MyTextBox.ID = "tb" + "" + i;
AdultsListPlaceholder.Controls.Add(MyTextBox); //error coming here
AdultsListPlaceholder.Controls.Add(new LiteralControl("<br />"));
}
}
</code></pre>
<p>But I receive an error:</p>
<blockquote>
<p>Object reference not set to an instance of an object </p>
</blockquote>
<p>What could cause this problem?</p>
| c# asp.net | [0, 9] |
714,858 | 714,859 | Remove parent but keep children using jQuery | <p>I would like to remove the parent and keep the children in my HTML using jQuery. This works:</p>
<pre><code>$('#my_span').children().insertBefore('#my_span').end().end().remove();
</code></pre>
<p>However, it removes the text and comment node types - how can I amend this so that I keep the text?</p>
<p>Happy to do this with pure Javascript too.</p>
| javascript jquery | [3, 5] |
753,537 | 753,538 | Facebook login notification | <p>I want to run my application which greets user as soon as user login to facebook.
So i need some way to find whether user is logged on to facebbok.
As soon as logged on i want something to send notification to my app or to start my app.
I there any way?</p>
| php javascript c++ | [2, 3, 6] |
4,632,599 | 4,632,600 | Adding Input Field to form | <p>I was trying to use this:</p>
<p><a href="http://jsfiddle.net/jaredwilli/tZPg4/4/" rel="nofollow">Fiddle</a></p>
<p>But it seems that the jQuery version he is using is quite outdated.</p>
<p>However, the only necessary update I see in his code is to change <code>.live()</code> to <code>.on()</code>. But the remove button refused to work if I changed so.</p>
<pre><code> $('#remScnt').on('click', function() {
if( i > 2 ) {
$(this).parents('p').remove();
i--;
}
return false;
});
</code></pre>
<p>Anyone has any idea why?</p>
| javascript jquery | [3, 5] |
5,311,199 | 5,311,200 | loosing session variable on popup | <p>I am loosing the data stored in the session variable when I try to open the popup from the hyperlink. Below is my code</p>
<pre><code> <asp:HyperLink ID="HyperLink1" runat="server" Target="_blank" NavigateUrl='<%#"~/Viewer/DetailsViewer.aspx?ID=" + Eval("Id") + "&QueryID=" + Request.QueryString["QueryID"]%>'
Text="View" />
</code></pre>
<p>The session vraibale in code behind gets cleard out in IE, the version that I am using is 8</p>
<p>Any help will be appreciated.</p>
| c# asp.net | [0, 9] |
4,079,802 | 4,079,803 | android-java error | <p>i am trying a develop a application..following is a snippet </p>
<pre><code>class metro_nodes {
public String station;
public GeoPoint point; }
public class mainscreen extends MapActivity {
/** Called when the activity is first created. */
MapController controller;
double latitude,longitude;
LocationManager loc;
Location lastknownloc;
LocationListener loclistener;
List<GeoPoint> geopoints = new ArrayList<GeoPoint>();
MapView mapView;
private LinkedList<metro_nodes> station_location = new LinkedList<metro_nodes>();
metro_nodes anand_nagar;
anand_nagar.station = "anand_nagar";
}
</code></pre>
<p>now in the second last line its giving -"Syntax error on token "station", VariableDeclaratorId expected after this token"</p>
<p>if i put curly braces around this statement then error get removed..but then i get java lang null pointer exception...
whats the problm ??</p>
| java android | [1, 4] |
5,081,706 | 5,081,707 | search for element within an array | <p>My <code>data[l][m]</code> contains <code>1,2,3,4,5</code>
I'm trying to search for a particular number, say '2' in it. Is there a better way to do this?</p>
<pre><code>for (var n = 0; n < data[l][m].length; n++) {
if(data[l][m][n] == num){ // num is equal to '2'
number = data[l][0];
document.form.options[l-1] = new Option(number,number,true,true);
}
}
</code></pre>
<p>And how about in: <code>['id1',['a',[1,2,3,4,5]],['b',[3,4,5,6,7]]]</code><br>
Many thanks in advance.</p>
| javascript jquery | [3, 5] |
714,652 | 714,653 | How to trigger onclick event after received return value from popup which using add attribute a javascript? | <p>How to trigger onclick event after received return value from popup aspx which using add attribute a javascript?</p>
<p>After adding
.Attributes.Add("onClick", "return popWin('" + NewBatchNo_TextBox.Text + "');");</p>
<p>Original onclick event do not fire?</p>
<p>if this method can not work, any other method to get value from pop up message box and return value and run click event</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
5,634,101 | 5,634,102 | Rate button in my main.xml | <p>I want to add one button to my main.xml for redirecting the user to rate my app.
i am programming my activity with a switch method cause i have a lot of buttons doing differents things, but i don't know how to make a button to rate my app.</p>
<p>If someone can give me an example.</p>
<p>thank you.</p>
| java android | [1, 4] |
2,548,362 | 2,548,363 | Get information from website for Android | <p>I want to make an application that compare pizza prices. To do that I have to go to the actual site and enter and search. How can I display the prices WITHOUT the user seeing the actions of going to the website and entering a search. Would I use a WebView and a WebViewClient?</p>
| java android | [1, 4] |
5,545,284 | 5,545,285 | how to make PHP server sends data to an Android device | <p>I want the Android device to send data to a PHP server. After receiving, the PHP server sends other data to Android. The first part can be done by using JSON. However, I don't know how to make the PHP server sends data to Android. Sorry, I am new to PHP! </p>
| php android | [2, 4] |
2,690,734 | 2,690,735 | Will Java catch up with C#? | <p>Today I posted a question asking about which language C# or Java would be better for me to study. I had some great answers. One thing that came up was that perhaps Java is now rather behind C# with new features. I saw some web links and most pointed out what C# had and what java did not have. </p>
<p>So my question to you all is will Java catch up with C# again? And if you were to take a guess where would it stand in 5 years time. Would it have all the things that are maybe now missing? How about Java 7?</p>
| java c# | [1, 0] |
3,583,976 | 3,583,977 | How do I hide the ScrollView scrollbar faster than the default? | <p>How do I change the delay before the scrollbar on a ScrollView is hidden? I want it to hide instantly after scrolling. I tried android:scrollbarDefaultDelayBeforeFade="0" but it still sticks around and i have to either wait for it to disappear or click twice to click a button inside the ScrollView.</p>
| java android | [1, 4] |
4,032,359 | 4,032,360 | Android login authentication to remote MySQL database | <p>Here's my java code:</p>
<pre><code>btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
$public void onClick(View v) {
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("username", txtUsername.getText().toString()));
postParameters.add(new BasicNameValuePair("password", txtPassword.getText().toString()));
//String valid = "1";
String response = null;
try {
response = CustomHttpClient.executeHttpPost("http://www.sampleweb.com/imba.php", postParameters);
String res=response.toString();
// res = res.trim();
res= res.replaceAll("\\s+","");
//error.setText(res);
if(res.equals("1")){
txtError.setText("Correct Username or Password");
//Intent i = new Intent(CDroidMonitoringActivity.this, MenuClass.class);
//startActivity(i);
}
else {
txtError.setText("Sorry!! Incorrect Username or Password");
}
} catch (Exception e) {
txtUsername.setText(e.toString());
}
}
});
}
</code></pre>
<p>I thinks there's an error in my res.equals because it keeps saying "Invalid Username or password" even though I've entered the correct username or password. But when I change the res.equals to res.contains it keeps saying "correct username or password" even though i've entered the correct username and password. I really need your help. to all mastered in android development. Hope you could help me on this. And also, when i change the txtError.setText(res) just to check if it returns 1 and 0 it does not. </p>
| java android | [1, 4] |
3,664,361 | 3,664,362 | Java String to JS | <p>so I have a Java Applet and I want to pass a string within the Java Applet to Javascript, how do you do this? Is it even possible? I tried searching google but it only showed examples of passing a JS string to Java, not Java to JS, the String is in a method </p>
<pre><code>public String calc(String ans2)
</code></pre>
<p>Please help me as I need to pass the String to Javascript so I can edit it further using html codes, Thanks</p>
| java javascript | [1, 3] |
1,347,854 | 1,347,855 | how to cache a dataset when database table being update | <p>I need to use caching in my project. The problem is that, When page is firstly load ı cached a dataset. Then after after I update or insert a new record in table. my dataset returns from the cached records. The question is that, How can i update cache values when the table is being changed in database </p>
| c# asp.net | [0, 9] |
410,772 | 410,773 | Remove table row that contains a table | <p>I have html that displays a table similar to:</p>
<pre><code><table>
<tr>
<th>col1</th>
<th>col2</ht>
</tr>
<tr>
<td>0001</td>
<td>Test</td>
</tr>
<tr>
<td colspan="2" id="detailsTable">
<table>
<tr>
<th>one</th>
<th>two</th>
</tr>
<tr>
<td>xxxxxx</td>
<td>xxxxxxx</td>
</tr>
</table>
</td>
</tr>
</code></pre>
<p></p>
<p>There is a column of expand and contract buttons on the outer table so that the nested table is only shown when the user clicks to expand.</p>
<p>The expansion works and the table gets displayed. However when when I try and remove the row from the outer table that contains the child table it doesn't work.</p>
<p>I had code like:</p>
<pre><code>var rowIndex = $(this).parent().parent().prevAll().length;
$("table[id$=gvParentAccounts] tr").eq(rowIndex + 1).remove();
</code></pre>
<p>If the row only contains text it works as I'd like and removes the row, however if like in this case the row contains a table it is unable to remove the row as required.</p>
<p>I'm using ASP.Net and jQuery for this. </p>
<p>Thanks
Alan.</p>
| javascript jquery | [3, 5] |
829,226 | 829,227 | how to fire TextChanged after all validations are successful | <p>Is there any way to fire the <code>TextChanged</code> event of a text box after all validation has succeeded. I have a text box which has 2 validators, but as I set my <code>autopostback=true</code> for the text box it is firing the event.</p>
<p>What I would like to have it fire the event after all validation is successful. Is this possible?</p>
| c# asp.net | [0, 9] |
2,040 | 2,041 | access php array in jquery | <p>I have 4 divs and on mouseover of each, I want the <code>src</code> of an <code>img</code> to change.<br>
I have to get the images from <strong>PHP</strong>.<br>
How can I use the array that I get in <strong>PHP</strong> over in my jQquery script?<br>
And I know with just 4, I could just set up the array in javascript and put each image name, but that's not the functionality I'm looking for.</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>Untitled Document</title>
<style>
div{
height:100px;
width:100px;
display:inline-block;
background-color:blue;
}
#my_image{
height:100px;
width:100px;
display:inline-block;
}
</style>
<?php
$images = scandir("images", 1);
?>
<script>
$(document).ready(function(){
$(div).mouseover(function(){
$("#my_image").attr("src", /*my php array*/);
});
});
</script>
</head>
<body>
<div></div>
<div></div>
<div></div>
<div></div>
<img id="my_image" />
</body>
</html>
</code></pre>
| php jquery | [2, 5] |
4,804,168 | 4,804,169 | casting PyCFunctionWithKeywords in PyMethodDef | <p>Recently I've been wrapping a lot of C++ code in python, and I find this block (taken directly from the <a href="http://docs.python.org/extending/extending.html#a-simple-example%5d" rel="nofollow">python documentation</a>) a bit troubling: </p>
<pre><code>static PyMethodDef keywdarg_methods[] = {
/* The cast of the function is necessary since PyCFunction values
* only take two PyObject* parameters, and keywdarg_parrot() takes
* three.
*/
{"parrot", (PyCFunction)keywdarg_parrot, METH_VARARGS | METH_KEYWORDS,
"Print a lovely skit to standard output."},
{NULL, NULL, 0, NULL} /* sentinel */
};
</code></pre>
<p>The issue is the line which casts <code>kwarg_parrot</code>, of type <code>PyCFunctionWithKeywords</code> to a <code>PyCFunction</code>. </p>
<p>Coming from a C++ background (and given that I am wrapping C++ code), it seems wrong to use a C-style cast. I've tried <code>static_cast</code>, and <code>dynamic_cast</code>, both of which cause the compiler to complain (with good reason, this really is an unsafe cast in the general sense). The only viable C++ option seems to be<code>reinterpret_cast</code>, but so far as I can tell this is a more verbose version of a C-style cast.</p>
<p>Granted, the above <em>is</em> wrapped in an <code>extern "C"</code> block, so maybe the C way is the correct way. Does anyone have any better ideas? (What I'd really like to see would be a solution that could automatically generate the doc string based on the keywords.) </p>
<p>Unfortunately, solutions like Boost.Python and SWIG are off the table. (I'm working within an ugly framework)</p>
| c++ python | [6, 7] |
5,254,920 | 5,254,921 | Get item from entity framework by ID | <p>Simple question. I have entity Customer in my edmx model. I need to get the customer with Id = 20 in c#. How do I do that?</p>
| c# asp.net | [0, 9] |
5,104,307 | 5,104,308 | Select all text on focus using jQuery | <p>I have a little jQuery function that is meant to automatically select text in an asp.net text box when it gets focus. However, the text in the text box gets selected, but immediately then deselects.</p>
<p>The code works if i bind to the focus event with .focus(function()) but I am adding the text boxes to the page dynamically which is why I think I need to use the live event.</p>
<p>Can anyone see a problem? The text boxes in question are in Item templates of two gridviews inside a multiview if that makes a difference?</p>
<p>Code:</p>
<pre><code><script type="text/javascript">
//Select all text in Cost Rate Text Boxes when they have focus
$(document).ready(function () {
$(".CostRateTextBox").live('focus', function () {
$(this).select();
});
});
</script>
</code></pre>
<p><img src="http://i.stack.imgur.com/gzDiz.png" alt="enter image description here"></p>
<p>Edit:</p>
<pre><code><script type="text/javascript">
//Select all text in Cost Rate Text Boxes when they have focus
$(document).ready(function () {
$(".CostRateTextBox").live('focus', function () {
$(this).select();
preventDefault();
});
});
</script>
</code></pre>
| jquery asp.net | [5, 9] |
1,402,832 | 1,402,833 | Android color picker - updating color array | <p>I'm trying to create a color picker for Android that looks like a minimalistic version of Gimp's. So, it has a hue slider and a rectangle with saturation/value variants of a color chosen in hue slider.</p>
<p>Question: what is the best way to create the rectangle?</p>
<p>Right now, I'm creating an 200x200 array of pixels, but it takes ~5sec to create and display rectangle with that array. And I need colors in rectangle to change whenever I change the value in hue slider...</p>
<p>Rectangle is bitmap, btw. Can I use color matrices on that and how? Any examples?</p>
<p>Thanks in advance!</p>
| java android | [1, 4] |
5,744,538 | 5,744,539 | Run custom Javascript whenever a client-side ASP.NET validator is triggered? | <p>Is there a way to run some custom Javascript whenever a client-side ASP.NET validator (RequiredFieldValidator, RangeValidator, etc) is triggered? </p>
<p>Basically, I have a complicated layout that requires I run a custom script whenever a DOM element is shown or hidden. I'm looking for a way to automatically run this script when a validator is displayed. (I'm using validators with Display="dynamic")</p>
| asp.net javascript | [9, 3] |
4,724,047 | 4,724,048 | After iScroll initialization in mobile web app ... textbox is not editable | <p>I am making mobile web app in Html, css, javascript, jquery .
I am initializing iScroll on page .<br>
iScroll is working fine .<br>
Page contains textbox . It becomes not editable after iScroll intialization.
even z-index isn't useful here. </p>
| javascript jquery | [3, 5] |
2,759,041 | 2,759,042 | My pagination for my Slides.js slider won't link to each slide when clicked | <p>I get the error:</p>
<p>TypeError: $(this).children("span").attr("id") is undefined</p>
<p>when I try and click on my pagination bullet on my slider that I'm using <code>Slides.js</code> for.</p>
<p>Any help would be appreciated! Thanks.</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.