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,993,766 | 4,993,767 | jQuery multi level selector does not work but .children does | <p>I have this javascript code which works fine</p>
<pre><code>var QuestionID = panel.siblings('.QuestionIDWrapper').children('input[type=hidden]').val();
</code></pre>
<p>but if I convert it to use a multi level jQuery selector like this:</p>
<pre><code>var QuestionID = panel.siblings('.QuestionIDWrapper input[type=hidden]').val();
</code></pre>
<p>I don't get any value in QuestionID.</p>
| javascript jquery | [3, 5] |
5,077,209 | 5,077,210 | using JQuery to search a treeview | <p>i have a texbox and a treeview. i want the user to search in the treeview by typing in the textbox. i think the best way to do it is using JQuery.<br>
how can i search for a word inside a treeview , color it, and focus on it using JQuery?<br>
a simple example would be great...</p>
<p>i am using ASP TreeView. Sample code for my TreeView is: </p>
<pre><code> TreeNode n = new TreeNode();
n.Text = "scatman";
TreeNode q = new TreeNode();
q.Text = "hehe";
n.ChildNodes.Add(q);
TreeNode q3 = new TreeNode();
q3.Text = "blabla";
n.ChildNodes.Add(q3);
TreeNode t = new TreeNode();
t.Text = "test";
q.ChildNodes.Add(t);
TreeNode n1 = new TreeNode();
n1.Text = "lol";
t.ChildNodes.Add(n1);
TreeNode p = new TreeNode();
p.Text = "daddy";
TreeView1.Nodes.Add(n);
TreeView1.Nodes.Add(p);
TreeNode s = new TreeNode();
</code></pre>
| c# jquery | [0, 5] |
4,553,483 | 4,553,484 | Weird Java issue in regular If statement | <p>I am developing an Android App in eclipse and I have this if statement:</p>
<pre><code>private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;
if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)){
return true;
}
</code></pre>
<p>The <code>freq</code> is 2462 and for some odd reason it fails to get into the statement. When I change the source into:</p>
<pre><code>private static final int MAX_FREQ=2484;
private static final int MIN_FREQ=2412;
if ((freq >= MIN_FREQ) && (freq <= MAX_FREQ)){
Log.e(TAG,""Bla Bla");
return true;
}
</code></pre>
<p>this one works ... :-/ ? What am I missing ?</p>
| java android | [1, 4] |
3,006,274 | 3,006,275 | How do i create variable names using contents of an array using javascript | <p>i have created an array,</p>
<pre><code>var myBuildingName=['A1','A2','A3','A4'];
</code></pre>
<p>where A1,A2,A3 and A4 are the names obtained through user input.
i now want to create arrays that have names A1,A2,A3 and A4.</p>
<p>i have tried using</p>
<pre><code>for(var i=0;i<myBuildingName.length;i++)
{
var myBuildingName[i]=[];
}
</code></pre>
<p>but it does not work...</p>
<p>please help.</p>
| javascript jquery | [3, 5] |
3,431,633 | 3,431,634 | looping through javascript array each time starting at new index | <p>i have a javascript array like this:</p>
<pre><code> array = [
{"Command": "SetDuration","QuestionId": "2","NewDuration": "1"},
{"Command": "SetDuration","QuestionId": "2","NewDuration": "1"},
{"Command": "SetDuration","QuestionId": "7","NewDuration": "7"},
{"Command": "SetDuration","QuestionId": "6","NewDuration": "7"}
]
</code></pre>
<p>my task is loop through it 1 time in a minute, starting at incremented index each time, so that after 3 minutes i would start from array[4]
How to accomplish this?
Thanks!</p>
| javascript jquery | [3, 5] |
4,990,888 | 4,990,889 | How do I get the text of the next span element? | <p>Below is my HTML. I'm at the <code><select></code> element, how do I get the text from the next span element on the page? I've tried several things, including <code>$( this ).nextAll( 'span:first' ).text();</code> where <code>$( this )</code> is my select element, but I'm not getting the desire result.</p>
<pre><code><ul id="questions">
<div>What do you want information about?</div>
<li>
<p>
<select><!-- This is where I'm at. -->
<option>Click to select...</option>
<option data-next_select_name="foos">
a foo
</option>
<option data-next_select_name="bars">
a bar
</option>
</select>
</p>
<div>
<a>
<span>a foo</span><!-- I want the text out of this span. -->
<div><b></b></div>
</a>
<div>
<div><input type="text" /></div>
<ul>
<li>Click to select...</li>
<li>
a foo
</li>
<li>
a bar
</li>
</ul>
</div>
</div>
<p></p>
</li>
</ul>
</code></pre>
| javascript jquery | [3, 5] |
2,837,969 | 2,837,970 | Cross Domain javascript call using porthole not working in firefox | <p>I have a website(<strong>abc.com</strong>) in which a iframe(<strong>efg.com</strong>) is opened in a facebox.i have used porthole to do a java-script cross domain scripting, but this is working fine in chrome but not in firefox and internet explorer.</p>
<p>is there any other way to send a message in a cross domain environment using javascript?</p>
| php javascript | [2, 3] |
5,453,036 | 5,453,037 | ASP.NET Repeater Control linking to detailed view via QueryString parameters | <p>I have a Repeater Control using an XMLDataSource to produce a list of movies (Movies.aspx). I need to link to a detailed page via query parameters like MovieDetails.aspx?movie=Matrix. What control do I use on the MovieDetails.aspx page to render a single movie, preferably using ItemTemplate and my own HTML. </p>
<p>My data source:</p>
<pre><code><asp:XmlDataSource ID="MoviesXmlDataSource" runat="server"
DataFile="~/Movies.xml" XPath="movies/movie"></asp:XmlDataSource>
</code></pre>
<p>I read the StackOverflow post <a href="http://stackoverflow.com/questions/1489517/send-string-with-querystring-in-repeater-control-in-asp-net">Send string with QueryString in Repeater Control in ASP.net</a> and list my items via a repeater like this:</p>
<pre><code> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="MoviesXmlDataSource">
<HeaderTemplate>
<ul class="productlist">
</HeaderTemplate>
<ItemTemplate>
<li>
<a href="MovieDetails.aspx?movie=<%#Eval("title")%>"></a>
<img src="Images/<%#Eval("image") %>" /><br/>
<b><%#Eval("title") %></b>
</li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
</code></pre>
<p>On my MovieDetail.aspx I get the query string parameter as expected. However, I don't know how to fetch this item from my XMLDataSource and render it nicely. I figured out how to do this using GridView and then render a DetailsView depending on what you click in the grid, but it's so ugly. Repeater lets me specify my own HTML, but only for a list and not a single item. </p>
| c# asp.net | [0, 9] |
1,870,202 | 1,870,203 | How to change img src on document ready before browser downloads images? | <p>On my page I have some images on thisdomain.com/images. on document.ready(), I change the src attribute of images to thatdomain.com/images. Firebug's Net tab shows me that images are downloaded from both thisdomain.com and thatdomain.com. How can I prevent the browser from downloading images from thisdomain.com?</p>
<pre><code>$(document).ready(function(){
$("img").each(function() {
var $img = $(this);
var src = $img.attr("src");
$img.attr("src", src.replace(/thisdomain.com.com\/images/i, "thatdomain.com\/images"));
});
});
</code></pre>
<p>EDIT: ASP.NET server-side override of Render() using code "in front" i.e., <script runat="server"> I just added this to the aspx page without recompiling code-behind. It's a bit hack-ish but it works.</p>
<pre><code><script runat="server">
static Regex rgx = new Regex(@"thisdomain.com/images", RegexOptions.Compiled | RegexOptions.IgnoreCase);
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
{
base.Render(htmlwriter);
string html = htmlwriter.InnerWriter.ToString();
string newHtml = rgx.Replace(html, "thatdomain.com/images");
writer.Write(newHtml.Trim());
}
}
</script>
</code></pre>
| asp.net jquery | [9, 5] |
232,532 | 232,533 | how do i store a path to an image in my drawable folder to my database in android? | <p>i have a database and need to store an image from drawable folder's paht into it.</p>
| java android | [1, 4] |
2,832,502 | 2,832,503 | Jquery Count up Animation? | <p>I have a a counter that needs to count up from $0 to $10,000 in x seconds (most likely 3 seconds).</p>
<p>Just straight text, kind of like a millisecond countdown timer, but upwards and with a dollar sign.</p>
<p>I'd rather not use a bulky plugin as this just needs to loop through 1-10,00 in x seconds and update every 100ms or so.</p>
<p>I'm stuck at creating the loop that will update, where should I start?</p>
<hr>
<p>Here is what I've got so far on a click event:</p>
<pre><code> function countUp() {
console.log('counted');
}
setInterval("countUp()", 1000)
</code></pre>
| javascript jquery | [3, 5] |
5,434,505 | 5,434,506 | When is it proper to add a return at the end of a JavaScript function? | <p>I have seen some developers place a return at the end of their JavaScript functions like this:</p>
<pre><code>$(".items").each(function(){
mthis = $(this);
var xposition = some .x() position value;
if(xposition < 0){
mthis.remove();
return;
}
});
</code></pre>
<p>Is having a return even necessary? I know that <code>return false</code> cancels out of a loop early and I know that <code>return x</code>, returns a value, but having just return??? What does that mean?</p>
<p>Sorry - I forgot to put an end } at the very end of the code. the return is in the if conditional.</p>
<hr>
<p><strong>New Update - just discovered that the intent of the loop was to cancel out the nth .item that entered the loop. so return false is my replacement for a simple return; (which means undefined anyway). Thanks everyone for the help!</strong></p>
| javascript jquery | [3, 5] |
1,329,551 | 1,329,552 | How to Separate a List into Two Lists | <p>In my form, I have multiple fields (hidden text boxes) which has the same name (eform_id).
(For example i have 7 hidden textboxes which contains values like this 1234,-1235,1236,1237,-1238,-1239,1240...</p>
<p>I am getting those values to my js file like this.</p>
<pre><code>var eformDetailIds=$("[name=eform_id]").map(function(){
return $(this).val() }).get();
</code></pre>
<p>Now my requirement is I have to separate this eformDetailIds into two lists..(or a string of comma separated values) so that first list contains all positive values and second list contains all negative values..</p>
<p>This is a very urgent requirement and I am seeking your help in this.
Please help me with suitable code which resolves my problem.</p>
<p>Thans in advance
-sathya</p>
| javascript jquery | [3, 5] |
10,292 | 10,293 | jquery select text | <pre><code><div>select this<strong>dfdfdf</strong></div>
<div><span>something</span>select this<strong>dfdfdf</strong></div>
</code></pre>
<p>how do i use jquery or just javascript to select the value of the div tag but not include any child elements</p>
<pre><code>//output
select this
</code></pre>
| javascript jquery | [3, 5] |
1,347,147 | 1,347,148 | DetailsView not showing | <p>I have a gridview add a link button "Edit":</p>
<pre><code><asp:LinkButton ID="btnViewDetails" runat="server" text="Edit" CommandName="Select"></asp:LinkButton>
</code></pre>
<p>and </p>
<pre><code>protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
using (var dataContext = new NewsStandAloneDataContext(Config.StandaloneNewsConnectionString))
{
DetailsView1.ChangeMode(DetailsViewMode.Edit);
DetailsView1.Visible = true;
var dataList =
dataContext.sp_Name(Convert.ToInt32(GridView1.SelectedValue), Value1);
ScriptManager.RegisterStartupScript(this, GetType(), "show1", "openEditWindow();", true);
DetailsView1.DataSource = dataList;
DetailsView1.DataBind();
}
}
</code></pre>
<p>But my details view doesnot show anything.<br>
Can someone help me out please?</p>
| c# asp.net | [0, 9] |
320,622 | 320,623 | Send cross domain request with post method | <p>How to send cross domain request from Javascript with Post method to Php file with large request data?</p>
<p>I have tried with $.ajax , $.post but have same issue as alerting POST failed.</p>
<p>Here is my HTML file[call.html] with Javascript at desktop::</p>
<pre><code><html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.ajax({
type: 'POST',
url: 'http://localhost/GP/ALternate/file.php',
crossDomain: true,
data: '{"l":2}',
dataType: 'json',
success: function(responseData, textStatus, jqXHR) {
var value = responseData.someKey;
alert(value);
//document.getElementById('w').innerHTML = value.d;
},
error: function (responseData, textStatus, errorThrown) {
alert('POST failed.');
}
});
</script>
<div id ='w'></div>
</body>
</html>
</code></pre>
<p>Here is my php [file.php] script at localhost:</p>
<pre><code><?php
header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
$f= $_GET["l"];
echo "{'d' : '".$f."'}";
?>
</code></pre>
| php javascript | [2, 3] |
2,437,784 | 2,437,785 | I need help starting out with programming | <p>A couple of days ago, I began learning c++. I downloaded visual studio, looked at tutorials, and wrote some simple programs. I was doing good until I got the pointers. Whats the point of "pointing" to a variable when you can just reference the actual variable. It was really confusing me.</p>
<p>So I began looking online at other languages. I debated java, python, ruby, perl, c#, Visual basic, and I couldn't decide. I wanted to make something with a GUI, so everywhere I went, I got pointed to c#. I began looking at that, and it seems fine, but there is no way of working with "unlimited" sized variables.</p>
<p>So before I go too far into c#, is java a better choice? How about python? What language would be the best for general-purpose programming? </p>
<p>Thanks</p>
| c# java python | [0, 1, 7] |
4,403,079 | 4,403,080 | Adding and removing classes in jQuery | <p>I have a jQuery snippet written where if any of my inputs in a specific table are entered it changes the class of the rest of the inputs on that table, but if the user fills in an input field, and then deletes their input it still changes the class, though it shouldnt. here is my attempt at doing this.</p>
<pre><code> $('#lostTable :input').change(function(){
var $lostTableInput = $('#lostTable :input:not(input[type=hidden])');
var hasData = false;
$lostTableInput.each(function(){
if($(this).val().length > 0){
hasDataLf = true;
return false;
}
});
$lostTableInput.toggleClass('R', hasDataLf);
// this above part works for changing the class, and below is my attempt at changing
// it back if the user deletes the data that was entered in.
$lostTableInput.each(function(){
if($(this).val().length == 0) {
$lostTableInput.removeClass('R');
}
}
)
}
);
</code></pre>
| javascript jquery | [3, 5] |
5,859,674 | 5,859,675 | How to pass query in a dynamically created linkbutton in asp.net | <p>I wanna to pass query in a dynamic link button. I can add it dynamically but unable to pass query on that. Apart from that LinkButton_onClick handler is not working.</p>
<p>Pls tell me how to proeed?</p>
| c# asp.net | [0, 9] |
5,565,951 | 5,565,952 | problem with window scrolling with asp.net button control | <p>In web application, i tried scrolling the window vertically by increasing a y axis height to 500 with a javascript that is attached to OnClientClick event of a asp.net button control with id Button1.</p>
<p>The script i have used is</p>
<pre><code><script language="JavaScript">
function scrollToWindow()
{
window.scrollTo(0,500);
}
</script>
</code></pre>
<p>and the button code is as follows</p>
<pre><code><asp:Button ID="Button1" runat="server"
Text="Scroll to bottom" OnClientClick="scrollToWindow()" />
</code></pre>
<p>If i run this page and click that button, the page scroll is not working properly. when i put alert inside that script and debug, i found that the page is actually scrolling to 0,500 but again its rendering to its normal position because of some reasons. could someone help to overcome this issue and let me know the reason behind that??</p>
| javascript asp.net | [3, 9] |
5,204,381 | 5,204,382 | How to send A get Request by php with parameters if the hosting don't have the CURL extension? | <p>I need to send a sms when the user submit the form, i have 2 ways send it by javascript</p>
<pre><code>$.ajax({
url: encodeURI('http://gate.smsaero.ru/send/?user=myuser&password=mypassword&to=4920942894&text=test&from=fromTest'),
type: 'GET',
crossDomain: true,
dataType: 'jsonp',
success: function() { alert("Success"); },
error: function() { alert('Failed!');
}
</code></pre>
<p>but here i have a problem that i get an error about the login and password is incorrect, is here a encoding problem or something may be?</p>
<p>or send it by php with parameters but the hosting does not provide CURL library, how can i send it?</p>
| php javascript | [2, 3] |
5,126,337 | 5,126,338 | convert 2D array into chess board | <p>I am trying to make android chess game. I already have the engine working with a text based UI like this: </p>
<pre><code>bR bN bB bQ bK bB bN bR 8
bp bp bp bp bp bp bp bp 7
## ## ## ## 6
## ## ## ## 5
## ## ## ## 4
## ## ## ## 3
wp wp wp wp wp wp wp wp 2
wR wN wB wQ wK wB wN wR 1
a b c d e f g h
White's move:
</code></pre>
<p>I would like to convert this 2D array into graphical UI. All the moves work correctly and print out the result or the error if the move was successful or not. I know it would be something like a gridview kind of thing. I am not looking for code but a sort of algorithm or a process where I can convert this 2D array in a view for example: e2 e4 moving the pawn will result in this</p>
<pre><code> bR bN bB bQ bK bB bN bR 8
bp bp bp bp bp bp bp bp 7
## ## ## ## 6
## ## ## ## 5
## ## wp ## ## 4
## ## ## ## 3
wp wp wp wp wp wp wp 2
wR wN wB wQ wK wB wN wR 1
a b c d e f g h
Black's move:
</code></pre>
<p>I would like to redraw the board after the move was successful using the data in the 2D array. The board data seen above is stored in the data array.</p>
| java android | [1, 4] |
5,629,720 | 5,629,721 | How to affect an Li with a certain class in jQuery? | <p>I am using a jQuery gallery plugin, the thumbs are all in an unordered list and the main image is to the right in a div.</p>
<p>The plugin adds the class "selected" to the li whose main image is currently being shown. As soon as the plugin moves on to the next image, the selected class is removed from the li and added to the next li.</p>
<p>I want to affect the li that currently has the class "selected" applied to it. I can't just do this:</p>
<p><code>$('li.selected').whateverRules();</code></p>
<p>because jQuery is applying the class dynamically, the class isn't there from the document ready state hence it doesn't work.</p>
<p>I also can't use <code>.live()</code> because I have no event to attach. So how can I work with this?</p>
<p>How can I affect the li which currently has a class of "selected" if this class was added dynamically?</p>
| javascript jquery | [3, 5] |
5,253,060 | 5,253,061 | jQuery Calling an ASMX Web Service that Returns Data | <p>I am using jsTree to organize pages created by users. Upon right-clicking and pressing "Rename" I want to fire a JS function that hits a function in my code behind without post back (if possible). I want it to grab whichever item's I'm on ID and rename it in the database and update the jsTree.</p>
<p>Here is a sample code-behind function:</p>
<pre><code>[System.Web.Services.WebMethod]
protected void RenamePage(object sender, EventArgs e)
{
DataTable dt = new DataTable();
using (SqlConnection con = new SqlConnection(Global.conString))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("contentPageUpdate", con))
{
cmd.Parameters.Add("@title", SqlDbType.VarChar).Value = Global.SafeSqlLiteral(txtPage.Text, 1);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
}
con.Close();
//Update Content Page Repeater
using (SqlCommand cmd = new SqlCommand("contentPageGetAll", con))
{
using (SqlDataAdapter da = new SqlDataAdapter(cmd))
{
da.Fill(dt);
}
}
}
}
</code></pre>
| c# jquery asp.net | [0, 5, 9] |
1,032,160 | 1,032,161 | First Time Script | <p>when you first land on this site you show a first time div tag appear up top (like a toolbar) which sits offering a link to the FAQ page.</p>
<p>Nice touch! Is this done with jQuery or do you have an example of the code?</p>
<p>Any help appreciated.</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
861,988 | 861,989 | User generated page? Android | <p>First off, if this is a dumb question, I apologize ahead of time but I cannot seem to find what I need through searching online so I figured I would just ask...</p>
<p>Secondly as a little background info... I'm quite new to Android Development, and actually Java in general. No formal training or prior experience till about a month ago when I decided to give it a try. I am self teaching myself as I go through websites such as this one and a book I found for development of Android apps. </p>
<p>Okay, I am attempting to develop myself an app for school to keep a list of all my classes, and assignments for each of them. I have the DB created, the page to add a class through edit text and have the list view setup to populate from the DB. So what I am looking for now is how to make it so when I click on a class from the list view it will open a page that is specific to that class. </p>
<p>I'm unsure of what I am looking for would be generally referred to or called so I'm struggling trying to search for examples. I know you can create a dialog and am assuming it is generally the same coding wise but having to background I am lost since I don't know what to look for.</p>
<p>If this wasn't specific enough of a description of what I am looking for please let me know where I need to clarify my question.</p>
<p>Take care,<BR>
Josh</p>
| java android | [1, 4] |
1,965,144 | 1,965,145 | Pictures saved on sdcard on android | <p>I had a problem when saving picture on sdcard from my app.
that when i am taking a picture and saving it on sdcard and go to my app and take a new one and save it on sdcard the previous preview picture appear and when view it on my computer it appear corrupted ?</p>
<p>why this problem ?</p>
<pre><code>public static void save(Bitmap bm, String path) {
OutputStream outStream = null;
try {
outStream = new FileOutputStream(new File(path));
bm.compress(Bitmap.CompressFormat.JPEG, 100, outStream);
outStream.flush();
outStream.close();
bm.recycle();
System.gc();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
enter code here
</code></pre>
| java android | [1, 4] |
543,574 | 543,575 | How can I make a box hide when mouse hovers other element | <p>Im making a webpage and at the moment it has a full screen background image with an overlaying div containing all the page text content slightly off center an about 500px wide so the image is visible behind it. I'd like to be able to hover the mouse over the background image which would cause the text box to close close up exposing the background image to be fully viewed, however the content box needs to open again when the mouse moves </p>
<p>I hope that makes sense, can anyone help me?</p>
| javascript jquery | [3, 5] |
5,859,703 | 5,859,704 | How to multiple event handles and pass data in jquery | <p>I want to attach multiple events to a single element. But I want to attach different data to each event. The way to attach multiple events in jquery is as follows:</p>
<pre><code> $("div.test").on({
click: this.clickEventCalled,
mouseenter: this.mouseEnterEventCalled
mouseleave: this.mouseLeaveEventCalled
});
</code></pre>
<p>but i want to be able to do something like this</p>
<pre><code> $("div.test").on("click", { name: "Karl" }, clickEventCalled);
</code></pre>
<p>And i was wondering if there was a more elegant way of doing this than</p>
<pre><code> var self = this;
$("div.test").on({
click: function(event){
self.clickEventCalled(event,{name:"Karl"})
},
mouseenter: function(event){
self.mouseEnterEventCalled(event,{name:"Ben"})
},
mouseleave: function(event){
self.mouseLeaveEventCalled(event,{name:"Ken"})
}
});
</code></pre>
| javascript jquery | [3, 5] |
5,918,907 | 5,918,908 | How do you add HTML dynamically with JS (In Strings?) | <p>I read before that HTML thats used only for JS should not be in the HTML? So how do you store markup to be used for JS added content. eg. Markup for jQuery Dialogs, controls, buttons etc.</p>
<p>Some possibilities I see are: </p>
<p><strong>As a string</strong> <a href="http://jsfiddle.net/g7g7t/" rel="nofollow">http://jsfiddle.net/g7g7t/</a></p>
<pre><code>$(function() {
var dialogHtml = '<div><label>Username</label><input type="text" name="username" /><br /><label>Password</label><input type="password" name="password" /></div>';
var $dialog = $(dialogHtml).dialog({
title: 'Dynamic Dialog'
})
});
</code></pre>
<p>That can get messy very quickly</p>
<p><strong>As external file</strong> <a href="http://jsfiddle.net/3zFeT/" rel="nofollow">http://jsfiddle.net/3zFeT/</a> (does not work)</p>
<pre><code>$(function() {
$.get("http://pastebin.com/raw.php?i=pFTCdN81", function(html) {
$(html).dialog({ title: "Dynamic Dialog" });
});
});
</code></pre>
<hr>
<p>What method do you use?</p>
| javascript jquery | [3, 5] |
5,534,741 | 5,534,742 | Passing values between web pages | <p>I need to pass a dollar amount from one webpageto another webpage without letting the user modify the values when the values are passed between these pages.
ie Page 1 (entry page) to Page 2 (confirmation page)</p>
<p>What is the best way to do this?</p>
| c# asp.net | [0, 9] |
1,274,677 | 1,274,678 | Get folder name from full file path - C#, ASP.NET | <p>How to get the folder name from the full path of the application?</p>
<p>This is file path,</p>
<p>"c:\projects\roott\wsdlproj\devlop\beta2\text"..</p>
<p>Here "text" is the folder name.</p>
<p>How can I get that folder name from this path?</p>
| c# asp.net | [0, 9] |
4,900,428 | 4,900,429 | Can't reach my (final) button inside my OnClickListener function | <p>My final goal of this snippet is to: </p>
<ol>
<li>call a Dialog(Interface) from a button.</li>
<li>let the end user select an option (in a list of 5 options)</li>
<li>change the button text to the selected option</li>
</ol>
<p>Currently I have this:</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
setLayoutState();
// rest of code omitted
}
</code></pre>
<p>then the setLayoutState() that instatiates the button</p>
<pre><code>public void setLayoutState() {
setContentView(R.layout.main);
Button rate = (Button) findViewById(R.id.ratebutton);
rate.setOnClickListener(onRatePress);
}
</code></pre>
<p><b>So here:</b> <i>setOnClickListener calls to a separate function (to keep things clean, the Activity has got a lot of buttons)</i></p>
<pre><code>private final View.OnClickListener onRatePress = new View.OnClickListener() {
public void onClick(View v) {
final ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
context, R.array.rates, android.R.layout.select_dialog_item );
adapter.setDropDownViewResource(android.R.layout.select_dialog_item);
new AlertDialog.Builder(context).setTitle("Rate this item!")
.setAdapter(adapter, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Common.makeToast(context,adapter.getItem(which) + "", 3000);
Button rate = (Button) findViewById(R.id.ratebutton);
rate.setText(adapter.getItem(which)+"");
// TODO: user specific action
dialog.dismiss();
}
}).create().show();
}
};
</code></pre>
<p>While <b>this works fine</b> I was wondering if there is a way I can pull this off <b>without</b> redeclaring the Button rate inside the Dialog's onClick</p>
<p>I've already tried declaring the button as final in the top part, but that won't let me call the button in the Dialog's onClick.</p>
| java android | [1, 4] |
65,150 | 65,151 | javascript validation for email format accepting incorrect email format @abcd.com.gmail, | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/46155/validate-email-address-in-javascript">Validate email address in Javascript?</a> </p>
</blockquote>
<p>I have to do validation for Email format, I am using the CODE below line to restrict Special Characters. </p>
<pre><code>onkeypress="return AlphaNumericBox(event,this,'@._);"
</code></pre>
<p>But now the Problem is I don have any proper validation for the exact format for example its also accepting text like <code>" @abcd.com.gmail,.. "</code> Is there any javascript validation for this?
any idea?</p>
<p>Thanks in advance.</p>
| c# javascript asp.net | [0, 3, 9] |
5,783,808 | 5,783,809 | Assign JavaScript values to C# Variable | <p>I have a Javascript function that pulls down variables, like so:</p>
<pre><code> function OnClientCloseSecure(oWnd, args) {
var arg = args.get_argument();
if (arg) {
var ResultCode = arg.ResultCode;
var PONumber = arg.PONumber;
}
}
</code></pre>
<p>I need to assign ResultCode and PONumber to a variable in C# or if that isn't possible a label in c#.</p>
<p>Are any of these options possible? If so, how would I go about doing that? I've tried several things with no luck. Thanks! </p>
| c# asp.net | [0, 9] |
4,838,558 | 4,838,559 | image control not refresh the stream when saving snapshot images to avi file - ASP.net, C#, AForge.net | <p><br /> I am trying to get a snapshot from MJPEG stream of a Panasonic IP Camera and save all the jpeg snaphot image to avi file as a video file while the live video stream is loading to an image control of asp.net using aforge.net, and now I am facing a problem as the following: <br /><br /> - the live video stream stops loading while getting the snapshot using webresponse. <br /> <br/> Below is the codes: <br/> </p>
<pre><code>try
{
WebRequest request = WebRequest.Create(SnapShotURL);
request.Credentials = new NetworkCredential(txtUserName.Text.Trim(), txtPassword.Text.Trim());
response = request.GetResponse();
Stream responseStream = response.GetResponseStream();
bmpSnapshot = new Bitmap(responseStream);
}
catch (Exception ex)
{
}
finally
{
imgStream.ImageUrl = "";
response.Close();
}
</code></pre>
<p>Your help is highly appreciated.</p>
| c# asp.net | [0, 9] |
4,203,486 | 4,203,487 | jquery priority execution | <p>Can anyone help me with this:</p>
<pre><code>$('#n').click(function() {
$(this).parent().append('<a href="javascript:void()">&nbsp;delete</a>');
$(this).next().click(function() {
alert('clicked'); //this not working
});
$(this).blur(function() {
$(this).next().remove();
});
});
</code></pre>
<p><a href="http://jsfiddle.net/vkun9/" rel="nofollow">JS Fiddle demo</a>; the problem is that the <code>blur()</code> event is executed before <code>click()</code> event.</p>
| javascript jquery | [3, 5] |
2,463,995 | 2,463,996 | Can I do more have javascript do two things at once? | <p>I have a strange need. I would like to do the following in javascript:</p>
<ol>
<li>when a function is called I want
to change the color of a DIV and
then 1/2 second later I would like
to change it back</li>
<li>at the same time as (1) I would
like to make an Ajax call. The call
typically takes one second</li>
</ol>
<p>In other words I would like step 1 and step 2 to start at the same time. </p>
<p>My knowledge of javascript is pretty basic. Is this kind of thing possible? How about if I use jQuery, would that make it easier?</p>
| javascript jquery | [3, 5] |
4,549,982 | 4,549,983 | Javascript: Disabling drop-down based on other drop-down | <p>I have a Javascript function in my website. I don't know Javascript very well but, I want to modify it.</p>
<p>This section loads a third drop box, depending on the first two.</p>
<p>I want to modify it to disable the third one if the second drop box <code>locatie</code>'s value is <code>util</code>.</p>
<pre><code>jQuery( function () {
jQuery("#util, #loc").change( function() {
var locatie = jQuery("#loc").val();
var utilitate = jQuery("#util").val();
if ( (locatie!= '---') && (utilitate!='---') )
jQuery.getJSON("index.php?option=com_calculator&opt=json_contor&format=raw",{ locatie: locatie, utilitate: utilitate }, function (data) {
var html = "";
html += "<option name=den_contor value ='contor' >Alege Contorul</option>";
if ( data.success == 'ok' )
for (var i in data.val)
html += "<option name=den_contor value ='"+ i+"' >" + data.val[i]+ " </option>";
jQuery("#den_contor").html( html )
})
})
});`
</code></pre>
<p>Thanks,
Sebastian</p>
| javascript jquery | [3, 5] |
5,557,102 | 5,557,103 | How to write a link within a php/html form | <p>I want to input som text to generate an update link in a form field, but since the fields are populated from a sql database and is within php section of the code i need help to figure out how to write the link correctly.</p>
<p>the link is:</p>
<pre><code><a href="javascript:void(0);" onclick='$.get("do.php",{ cmd: "ban", id: "<?php echo $rrows['id']; ?>" } ,function(data){ $("#ban<?php echo $rrows['id']; ?>").html(data); });'>Ban</a>
</code></pre>
<p>And this is the section where i want the link placed, marked my_link:</p>
<pre><code>$result = mysql_query("SELECT * FROM logg WHERE UserGroup='".$_SESSION['user_group']."' AND CompletedEvent='0' ORDER BY RegDate DESC");
echo "<table border='1'>
<tr>
<th>RegDate</th>
<th>RegByUser</th>
<th>Event</th>
<th>Status</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['RegDate'] . "</td>";
echo "<td>" . $row['RegByUser'] . "</td>";
echo "<td>" . $row['Event'] . "</td>";
echo "<td>" my_link "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
</code></pre>
<p>I hope someone can show the the right way to write this link.</p>
| php javascript | [2, 3] |
817,330 | 817,331 | DataTable row grouping. Getting the Microsoft JScript runtime error | <p>I am trying to add the datatable row grouping where the .rowGrouping takes the first column and group the row accordingly. Here is my code so far:</p>
<pre><code>$(document).ready(function () {
var oResultGrid = $("[id$='gvReportData']");
if (fixEmptyDataRow(oResultGrid)) {
var oTable = oResultGrid.dataTable({
"bPaginate": false,
"bFilter": false,
"bInfo": false
}).rowGrouping();
}
else {
oResultGrid.dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[1, 'asc']]
}).rowGrouping();
</code></pre>
<p>When I run the code, I keep getting this error. Any help is greatly appreciated. Thanks.</p>
<p>0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method </p>
| jquery asp.net | [5, 9] |
3,046,024 | 3,046,025 | Event handler on multiple events | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1646187/bind-multiple-events-to-jquery-live-method">Bind multiple events to jQuery 'live' method</a> </p>
</blockquote>
<p>I have the following function:</p>
<pre><code>$("td.delivered").click(function() {
$(this).html($("<input/>", {
id: 'inp',
style: 'width:80px;',
placeholder: "YYYY-MM-DD",
change: function() {
selectdone(this, title_id, status_type);
},
blur: function() {
selectdone(this, title_id, status_type);
},
onkeypress=="Return": function() { // pseudo-code
selectdone(this, title_id, status_type);
}
})
);
}
</code></pre>
<p>The following works, what would be a better way to write it?</p>
<pre><code> change: function() {
selectdone(this, title_id, status_type);
},
blur: function() {
selectdone(this, title_id, status_type);
},
onkeypress: function(e) {
if (e.keyCode == 13) {
selectdone(this, title_id, status_type);
}
}
</code></pre>
<p>How would I write this more concisely, making the <code>selectdone</code> function fire on <code>change</code>, <code>blur</code>, and <code>return</code>?</p>
| javascript jquery | [3, 5] |
6,003,416 | 6,003,417 | PHP variable to JS - over and over | <p>Sorry my Gods, but....</p>
<p>I have php, file, and in this php i set the language, and include the necessary lang file:</p>
<pre><code> ...
if ($lan=='ge') {$_SESSION['lang']='german';...}
if ($lan=='en') {$_SESSION['lang']='english'; ....}
}
if ($_SESSION['lang']=='english'){
include ..english
}else{
include ...german
}
</code></pre>
<p>I use Yshout in my site, and want to make it multilang. In the JS file the developer use some text which i have to make it multilanguage. </p>
<p>So in JS file the first line:</p>
<pre><code>`<?php header('Content-type: text/javascript');?>
</code></pre>
<p>And in the php: </p>
<pre><code> <script src="/js/yshout.php" type="text/javascript"></script>
</code></pre>
<p>Now i can use PHP in JS file. So i try to use instead of the fix text. But no results, 'coz JS don know $text variable. If i include the language file in the JS then OK, but i have to include the necessery language file, this is not work, 'coz JS dont know the $_SESSION['lang'] varible when he run.</p>
<p><strong>Which is the simplest way to tell JS which language file have to be included and how can i do that?</strong></p>
<p>Thank you </p>
| php javascript | [2, 3] |
754,694 | 754,695 | Create file export and save from ASP.NET page | <p>I have an ASP.NET web page that contains a grid view of user data. I need to take the data in the gridview, generate an excel file, and allow the user to save that excel file to their local machine.</p>
<p>What would be the best way to accomplish this in code? Would it be possible to display a file save dialogue and then create the file from the grid data after the user selects the directory and filename? I've accomplished this in software development but never dealt with it in web development.</p>
<p>Thanks</p>
| c# asp.net | [0, 9] |
466,913 | 466,914 | "application yamba has stopped unexpectedly" error ("Learning Android" O'Reilly book) | <p>I try to run the code in chapter 6 but every time I get in the emulator an "the application yamba has stopped unexpectedly" error massage. </p>
<p>This is the code:</p>
<pre><code>import winterwell.jtwitter.Twitter;
import winterwell.jtwitter.TwitterException;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class StatusActivity extends Activity implements OnClickListener {
private static final String TAG = "StatusActivity";
EditText editText;
Button buttonUpdate;
Twitter twitter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.status);
editText = (EditText) findViewById(R.id.editText);
buttonUpdate = (Button) findViewById(R.id.butonUpdate);
buttonUpdate.setOnClickListener(this);
twitter = new Twitter("student", "password");
twitter.setAPIRootUrl("http://yamba.marakana.com/api");
}
class PostToTwitter extends AsyncTask<String, Integer, String>{
@Override
protected String doInBackground(String... statuses) {
// TODO Auto-generated method stub
try{
Twitter.Status status = twitter.updateStatus(statuses[0]);
return status.text;
} catch (TwitterException e){
Log.e(TAG, e.toString());
e.printStackTrace();
return "Failed to post";
}
}
@Override
protected void onProgressUpdate(Integer... values) {
// TODO Auto-generated method stub
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
Toast.makeText(StatusActivity.this, result, Toast.LENGTH_LONG);
}
}
public void onClick(View v) {
// TODO Auto-generated method stub
String status = editText.getText().toString();
new PostToTwitter().execute(status);
Log.d(TAG, "onClicked");
}
}
</code></pre>
<p>Can anyone explain what is the problem?</p>
| java android | [1, 4] |
973,755 | 973,756 | jquery selector for an element MISSING a child element | <p>I am needing help forming a jquery selector to return elements which are missing a particular child element.</p>
<p>Given the following HTML fragment:</p>
<pre><code> <div id="rack1" class="rack">
<span id="rackunit1" class="rackspace">
<span id="component1">BoxA</span>
<span id="label1">Space A</span>
</span>
<span id="rackunit2" class="rackspace">
<span id="label2">Space B</span>
</span>
<span id="rackunit3" class="rackspace">
<span id="component2">BoxA</span>
<span id="label3">Space C</span>
</span>
</div>
<div id="rack2" class="rack">
<span id="rackunit4" class="rackspace">
<span id="component3">BoxC</span>
<span id="label4">Space D</span>
</span>
<span id="rackunit5" class="rackspace">
<span id="label5">Space E</span>
</span>
<span id="rackunit6" class="rackspace">
<span id="component4">BoxD</span>
<span id="label6">Space F</span>
</span>
</div>
</code></pre>
<p>Find for me the rackunit spans with NO component span.
Thus far I have:
$(".rack .rackspace") to get me all of the rackunit spans, not sure how to either exclude those with a component span or select only those without one...</p>
| javascript jquery | [3, 5] |
3,531,815 | 3,531,816 | Learn Java or C++ | <p>I am a C programmer , have no experience in JAVA. I will be taking an online course of algorithms from tomorrow but it is in JAVA . In December second week I have regionals of ACM
ICPC and for that I require to learn C++ or JAVA , and I have some experience in C++ before
as it is quite similar to C. </p>
<p>Now I am very confused, Should I learn JAVA or C++ as I can not do both. My aim is ACM ICPC but then the course would have helped me a lot. I have to learn C++ or Java as otherwise we have to program every little bit in C , so we don't have so much time in competition. Please consider my time constraint while giving your advice. I have only 3 months</p>
| java c++ | [1, 6] |
5,633,366 | 5,633,367 | Identifying Array Object | <p>How to know whether an object is array or not?</p>
<pre><code> var x=[];
console.log(typeof x);//output:"object"
alert(x);//output:[object Object]
console.log(x.valueOf())//output:<blank>? what is the reason here?
console.log([].toString()); also outputs <blank>
Object.prototype.toString.call(x) output:[object Array] how?
</code></pre>
<p>since console.log([].toString()); outputs :<em>blank</em> </p>
<p><strong>1st:</strong></p>
<p>why i get blank at 2nd last statement?</p>
<p><strong>2nd:</strong></p>
<p>Is there a way to know exactly what an object is: Array or plain Object({}) without the help of their respective methods like x.join() indicates x is an Array,not in this way.</p>
<p>Actually,in jquery selection like $("p") returns jquery object so if i use</p>
<pre><code>console.log(typeof $("p"));//output:"object
</code></pre>
<p>I just wanted to know the actual Name of the Object.Thats it.Thank u for u help</p>
| javascript jquery | [3, 5] |
3,239,317 | 3,239,318 | how to display hide and show select box? | <p>I google a lot for my requirement.So i am posting this question.
my requirement is when a user select a value from dropdown based on that value a div to be displayed. But in default all the divs with values to be displayed.</p>
<p>here is my code:</p>
<pre><code><select name="lab_1" id="title" >
<option value="All" onclick="showAll();" >All</option>
<option value="one" onclick="showOther();">One</option>
<option value="two" onclick="showOther();">Two</option>
</select>
<div id="All" >
hiihdhfhdf
<div id="otherTitle" style="display:none;" >
select
</div>
<div id="otherTitle2" style="display:none;" >
ramsai
</div>
</div>
<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>
<script>
$(function() {
$('#title').change(function() {
var all= $("#All").val();
alert('hi');
if(all==""){
$("#otherTitle").show();
$("#otherTitle2").show();
}
else if (this.value == "one") {
$("#otherTitle").show();
$("#otherTitle2").hide();
}
else if (this.value=="two"){
$("#otherTitle2").show();
$("#otherTitle").hide();
}
});
});
</script>
</body>
</code></pre>
<p>Here with above code when i click all my divs are not displaying but when i go to one or two options it is showing all the values.
I have 42 divs is there any other solution for all those divs in jquery or below mentioned are the only solutions for that</p>
<p>Thank you in advance</p>
<p>Ramsai</p>
| javascript jquery | [3, 5] |
5,163,546 | 5,163,547 | Android - 1 divided by 2 = 0 | <p>I have been trying to use my new IOIO for android, and needed to find a frequency of a signal.<br>
So I converted the signal to binary and then did 1 divided by the time between 1's. Although when I did this I found that I got 0 as my output. I then decided to see what 1 / 2 gave me, and to my surprise it also gave 0! Anyone have any idea why this is the case?</p>
<p>Code:
<code>private float frequency = 1/2;</code> </p>
<p>Could this be todo with using <code>Float.toString(frequency)</code>?</p>
| java android | [1, 4] |
936,854 | 936,855 | Float percentage producing wrong answer | <pre><code>System.out.println("Percentage (90): " + (_leftBranch.getHeight() / 100) * 90 + " Height: " + _leftBranch.getHeight());
</code></pre>
<p>Gives the output:</p>
<pre><code>Percentage (90): 270 Height: 359
</code></pre>
<p>When infact it should be 323.1.</p>
<p>Can anyone tell me what's going on here?</p>
| java android | [1, 4] |
2,581,800 | 2,581,801 | XML listview issue | <p>Trying to set a listview up with the results of my database query.</p>
<p>Anyway, I'm getting a weird XML refrence id error from my listview. Can anyone see the issue here? Im guessing its the '@id' reference causing the problem?</p>
<p>Heres my XML:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/contentList"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</code></pre>
<p>And my java class:</p>
<p>The error is on the 'R.id.conactList'.</p>
<pre><code>ListView listContent = (ListView)findViewById(R.id.contentList);
</code></pre>
| java android | [1, 4] |
3,666,207 | 3,666,208 | Word document (.doc & .docx) to pdf conversion using C# in ASP.NET | <p>I am looking for an easy way to convert doc and docx extension files to pdf using C# and ASP.NET. I had previously used iTextSharp for the purpose but that requires creating a document from the scratch. But I want a way to convert the Word files as it is to pdf. Like if it includes images, tables etc they must be converted to pdf as it is. Is there any free library or code? Thanks in advance.</p>
| c# asp.net | [0, 9] |
1,420,760 | 1,420,761 | Audio tag attribute issue | <p>I need to create audio tag with bunch of attributes.</p>
<p>I have </p>
<pre><code>var audioPlayer=document.createElement('audio');
var audioSource=document.createElement('source');
audioSource.type="audio/mp3";
audioPlayer.controls="controls";
audioPlayer.autoplay="autoplay";
$('div').append(audioPlayer);
</code></pre>
<p>My html become:</p>
<p>in Chrome</p>
<pre><code><audio controls autoplay id='test', class='classname'>
</audio>
</code></pre>
<p>in FF</p>
<pre><code><audio controls='' autoplay='' id='test', class='classname'>
</audio>
</code></pre>
<p>What should i do to create these in javascript? Thanks a lot!</p>
| javascript jquery | [3, 5] |
1,304,818 | 1,304,819 | Android equivalent to iphone indexed UITableView | <p>I am porting an iPhone app over to the Android platform. One of the views has a very large list of data and on the iPhone app, there's a scrollbar of sorts on the right hand side that displays the letters of the alphabet and allows the user to quickly scroll through the list this way. I am having trouble finding such functionality in Android. Is there a simple way to implement this?</p>
| iphone android | [8, 4] |
5,001,372 | 5,001,373 | How to remove anything from string after whitespaces in java | <p>I have a String like this: <code>12/16/2011 12:00:00 AM</code><br>
now i want to show only date part i.e <code>12/16/2011</code> on Textview<br>
and remove the other part. What shall i need to do for this?? </p>
<p>Any help will be appricated
Thanks.</p>
| java android | [1, 4] |
4,265,971 | 4,265,972 | How to parse a variable in Javascript | <p>I'm trying to use this code:</p>
<pre><code>var field="myField";
vals[x]=document.myForm.field.value;
</code></pre>
<p>In the html code I have</p>
<pre><code><form name="myForm">
<input type='radio' name='myField' value='123' /> 123
<input type='radio' name='myField' value='xyz' /> xyz
</form>
</code></pre>
<p>But this gives me the error:</p>
<pre><code>document.myForm.field is undefined
</code></pre>
<p>How can I get <code>field</code> to be treated as a variable rather than a field?</p>
| javascript jquery | [3, 5] |
3,350,164 | 3,350,165 | How to get value in html control on postback in asp.net | <p>I have an html control (not a server control) like textarea. How can I get the value in this control from the server side when I cause a postback by clicking on a button, without writing the value in the url.</p>
| c# asp.net | [0, 9] |
4,649,994 | 4,649,995 | Invoke anoymous event handler using reflection? | <p>I have implemented my own event registration for a client-server UI framework, much like in ASP.NET. I store an event's name (e.g. "<code>Click</code>") in a dictionary and as the value I remember </p>
<p><code>oEventHandler.Method.DeclaringType.AssemblyQualifiedName.ToString() + "." + oEventHandler.Method.Name.</code></p>
<p>Then to reinvoke the event handlers later on, I recreate the delegate:</p>
<pre><code>var oEventHandler = Delegate.CreateDelegate( typeof( BLUIEventHandler ), oPage, sEventMethod, false )
</code></pre>
<p>and invoke it on the page:</p>
<pre><code>oEventHandler.Invoke( oPage, this, oEventArgs );
</code></pre>
<p>This works fine for event handlers that are part of the ASPX page, like</p>
<pre><code>var oTheButton = new UIButton();
oTheButton.Click += this.HandleClick;
private void HandleClick() {}
</code></pre>
<p>but fails for anonymous delegates:</p>
<pre><code>var oTheButton = new UIButton();
oTheButton.Click += delegate {/* Will never be called. */};
</code></pre>
<p>The resulting string for a non-anymous delegate is:</p>
<pre><code>"MyTest.Rene.UI.Foo, BDRS, Version=8.10.1.19703, Culture=neutral, PublicKeyToken=null.HandleClick"
</code></pre>
<p>For an anoymous delegate it is:</p>
<pre><code>"MyTest.Rene.UI.Foo+<>c__DisplayClass1, MyTest, Version=8.10.1.17866, Culture=neutral, PublicKeyToken=null.<OnInitializeLayout>oTheButton__0"
</code></pre>
<p>However when I try to recreate the anonymous delegate, I get a binding error.
Is there a way to get back to the anymous delegate and invoke it?</p>
| c# asp.net | [0, 9] |
1,856,337 | 1,856,338 | JQuery on MouseOver | <p>I have an image of a product, with a "new product" image on top. When i throw the mouse on top of that, it takes it as if the mouse left the product picture.</p>
<p>Also, when i mouseover, the div that appears should not disappear because the mouse enters that.</p>
<p>Here is the current example:
<a href="http://jsfiddle.net/euhcc/8/" rel="nofollow">http://jsfiddle.net/euhcc/8/</a></p>
| javascript jquery | [3, 5] |
5,270,939 | 5,270,940 | Android to PHP error- Unidentified Index | <p>when sending data to a php server through android I cam across this error: "Notice: Undefined index: IT in C:\xampp\htdocs\hello.php on line 4". After a few hours of messing around with it I can't solve my issue.</p>
<p>hello.php : </p>
<pre><code><?php
mysql_connect("localhost","user","pass");
mysql_select_db("mmo");
$r=mysql_query("update players set X = '".$_REQUEST['IT']."' where 22=22");
if(!$r)
echo "Error in query: ".mysql_error();
mysql_close();
header('Refresh: 0.01; URL=http://localhost/hello.php');
?>
</code></pre>
<p>update method in android:</p>
<pre><code>public void UpdateSeverWithPlayer()
{List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
nameValuePairs.add(new BasicNameValuePair("IT","3"));
try{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://10.0.2.2/hello.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}catch(Exception e){
Log.e("log_tag", "Error in http connection"+e.toString());
}}
</code></pre>
<p>I am working on the android emulator and do have the internet permission. As always help is greatly appreciated.
EDIT 1: It appears the issue is in the android and not the php code.</p>
| php android | [2, 4] |
5,507,406 | 5,507,407 | Using jQuery to set multiple selects using each | <p>I have a page full of selects, and they all have a common class. I need to set every one of them to their first option. Easy, right? But what I finally wound up getting to work feels like such a hack... is there a better way?</p>
<pre><code>$('.myclass').each(function() {
var firstOptSelector = '#' + $(this).attr('id') + ' option:first'; // HACK
$(firstOptSelector).attr('selected','selected');
});
</code></pre>
| javascript jquery | [3, 5] |
5,955,918 | 5,955,919 | Having trouble building a calculator | <p>I am trying to build a simple calculator to learn javascript/jquery but seem to be getting quite confused on how to make it work. Basically at the moment I dont seem to be able to update my tally correctly, instead of the numbers/values being added together in a sum they are being concatenated instead, if anyone could give me some guidance on how I can get back on the right path with this and any other advice on how to make the code more efficient then that would be great. I don't want anyone to give me the correct script just yet.</p>
<p><a href="http://jsfiddle.net/kyllle/edRk9/4/" rel="nofollow">http://jsfiddle.net/kyllle/edRk9/4/</a></p>
<p>Thanks all in advance for your advice</p>
| javascript jquery | [3, 5] |
963,798 | 963,799 | JQuery sorting a table without the plugin | <p>Is there a jquery function to sort a table. I am aware of the JQuery Tablesorter plugin but I want to avoid using it if possible.</p>
<p>As a FYI - The table that I have a header with custom images to indicate ascending and descending. The data type could be pretty much any type.</p>
<p>EDIT:Can I do sorting of a table in Javascript?</p>
| javascript jquery | [3, 5] |
5,909,665 | 5,909,666 | Does Android do All the things that Java can do? | <p>I know android not includes all of java's library.
but I just want to know can I add the jars to replace with some of java's lib. not included in Android?
thank you all in advance.</p>
| java android | [1, 4] |
1,536,323 | 1,536,324 | Increase element ID by one after every click? | <p>I am trying to clone multiple divs on my page by using the jQuery <code>.clone()</code> method. The problem is, as soon as a div is cloned, it needs to have a unique ID. The cloned ID has to be there too. I was thinking I could keep the old ID and then just add a number on, increasing as more div's are on the page. </p>
<p>Example: base ID = one, so div one would be <code>id</code>, then div two would be <code>id-2</code>, then div three would be <code>id-3</code>, etc.</p>
<p>Is this possible? My attempt at this is below:</p>
<pre><code>$("a").click(function(){
var target = $(this).attr("href");
var id = $(target).attr("id");
$(target).clone().attr("id",id + $(id).size()).attr("class","drag").appendTo("body");
});
</code></pre>
<p>Each <code>a</code> tag looks like this:</p>
<pre><code><a href="#one">One</a>
<a href="#two">Two</a>
</code></pre>
<p>Then the cloned element looks like this:</p>
<pre><code><div class="drag base" style="background-color:blue" id="one"></div>
<div class="drag base" style="background-color:green" id="two"></div>
</code></pre>
| javascript jquery | [3, 5] |
191,250 | 191,251 | what is sprintf in c#? | <p>what does this c++ code look like in c#?</p>
<pre><code> sprintf(ff, "\\\\.\\%s", device);
</code></pre>
| c# c++ | [0, 6] |
1,853,648 | 1,853,649 | jQuery's .then() not executing onFailure function even though GET request encountered an error | <p>I am trying to convince <a href="http://api.jquery.com/deferred.then/" rel="nofollow">.then()</a> to execute it's failure condition.</p>
<p>I have the following. Note that taskID has been replaced with -1 to induce failure.</p>
<pre><code>load: function (taskID) {
$.when(
$('#OrderDetails').load('../../csweb/Orders/OrderDetails'),
$('#TaskDetails').load('../../csweb/Orders/TaskDetails/?taskID=' + -1),
$('#DeviceDetails').load('../../csweb/Orders/DeviceDetails'),
$('#Provisioning').load('../../csweb/Orders/Provisioning'),
$('#Activity').load('../../csweb/Orders/Activity')
).then(onDisplayLoadSuccess, onDisplayLoadFailure);
}
var onDisplayLoadSuccess = function () {
console.log("onDisplayLoadSuccess!");
};
var onDisplayLoadFailure = function () {
console.log("onDisplayLoadFailure!");
};
</code></pre>
<p><img src="http://i.stack.imgur.com/7bqOo.png" alt="enter image description here"></p>
<p>From <a href="http://api.jquery.com/jQuery.when/" rel="nofollow">documentation of .when()</a>:</p>
<blockquote>
<p>In the case where multiple Deferred objects are passed to jQuery.when, the method returns the Promise from a new "master" Deferred object that tracks the aggregate state of all the Deferreds it has been passed. The method will resolve its master Deferred as soon as all the Deferreds resolve, or <strong>reject the master Deferred as soon as one of the Deferreds is rejected</strong>.</p>
</blockquote>
<p>Since one of my load requests fails -- shouldn't then be executing onDisplayLoadFailure?</p>
| javascript jquery | [3, 5] |
3,052,312 | 3,052,313 | problem with setInterval(); and clearInterval | <p>I have a problem involving setinterval. It's probably best to show an example so here's a link here:</p>
<p><a href="http://boudaki.com/testing/carouselTest" rel="nofollow">http://boudaki.com/testing/carouselTest</a></p>
<p>Basically I'm having problems making this work like I need it to. When the page loads the content rotates every three seconds and the numbered buttons on the right do so also. when you click on a button the buttons extend and the animation is stopped - all good. Then when you click the little close button at the bottom of the buttons the animation resumes - all good....but then when you come to click on the numbered buttons again the animation keeps on going. Why?</p>
<p>There's rather a lot of code but the setIntervals and clear intervals are:</p>
<ul>
<li>line 69: on document.ready start the animation off -assign timerId to a global var</li>
<li>line 87: When the user clicks on the numbered button clearinterval in that animation</li>
<li>line 102: when the user clicks on the close button start the animation again</li>
</ul>
<p>That's it....I just don't get why it doesn't stop the animation the second time around??? Can anyone see why?</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
1,757,728 | 1,757,729 | Executing dynamically passed function call with jQuery | <p>I have this function call passed as a string:</p>
<pre><code>var dcall = "tumbsNav(1)";
</code></pre>
<p>Is it possible to execute this dynamically like exec in SQL??</p>
<pre><code>exec(dcall)
</code></pre>
| javascript jquery | [3, 5] |
1,729,385 | 1,729,386 | See if current page equals relative link - JavaScript | <p><em>I know that different versions of this question has been asked in the past, although this exact question has not been asked (and none of the other answers suit my purposes);</em> </p>
<p><strong>So, here goes</strong>: I have a relative link in JavaScript (which is stored as a string) and I am trying to see if that string equals the current URL for the page I'm on </p>
<p>(<em>for example</em> if the JS link is <code>"/test"</code> and the url is <code>http://example.com/test</code> the function should return true, whereas if the string is <code>"/test"</code> and the current url is <code>http://example.com/derp</code> the function should return false).</p>
<p><strong>Lastly:</strong></p>
<ul>
<li>Hash tags in the URL should be ignored</li>
<li>Get variables should also be ignored</li>
</ul>
<p>I am looking for a function in JavaScript (or jQuery) that does this -or something that does something that gets me closer to doing this (I have to assume there is one, simply because this language (+ this framework) has so many methods for handling the URL); if there isn't one <em>can someone point me to a jQuery plugin that does this</em> or <em>show me a piece of custom written code</em> to do this (I <strong>can't</strong> be the first one to ask for this!)</p>
| javascript jquery | [3, 5] |
3,743,614 | 3,743,615 | Make jQuery no conflict | <p>I am creating a web widget to be posted on other websites. In the widget it will call jQuery and I dont want the jQuery to conflict with other JavaScript libraries that the website may have installed. When I load the jQuery I would like to call jQuery like this:</p>
<pre><code>JQuery_MYSite('id').find('selector');
</code></pre>
<p>I found out if I do this then <code>$</code> will not be able to be used even if the other website uses <code>$.</code> </p>
<hr>
<p>When the widget loads it find out if jQuery is loaded. If so, then it will use the <code>$</code> to call jQuery. But I know <code>$</code> is not unique to just jQuery - other javascript libraries use it. So how can I use my own jQuery prefix with without interfering with the website owners prefix.</p>
| javascript jquery | [3, 5] |
1,524,917 | 1,524,918 | using jquery to determine total file size | <p>when I define the file as a variable with jquery selector I get this error :
Uncaught TypeError: Array.prototype.map called on null or undefined. if I use :</p>
<pre><code>var file = document.getElementById('file');
</code></pre>
<p>instead of </p>
<p><code>var file = $('#file').val();</code> </p>
<p>then it works, but I'm curious why using jquery selector doen't work. Thanks</p>
<pre><code>$('#file').on('change', function(){
var file = $('#file').val();
var sizes = [].map.call(file.files, function(v) {return v.size;});
var totalSize = sizes.reduce(function(a, b) {return a + b;}, 0);
});
</code></pre>
| javascript jquery | [3, 5] |
5,918,125 | 5,918,126 | If conditon is not working | <p>I have written a conditonal if for checking whether the string FKLoadStatus is "C".But its not working even when the string FKLoadStatus returns the value "C" itself...will anyone check there is any error in the code......
I am ascessing the value of FKLoadStatus from sqllite database</p>
<pre><code> sql=" SELECT trim(FKLoadStatus) as FKLoadStatus , tblLoad.PKLoad, " +
"date(tblLoad.PlannedLoadDate) AS PlannedLoadDate, tblLoad.Carrier," +
" tblLoad.FKCarrierDriver, COUNT(tblDelivery.FKLoad) AS NoOfDeliveries ," +
" DriverReportTime FROM tblLoad LEFT OUTER JOIN tblDelivery" +
" ON tblLoad.PKLoad = tblDelivery.FKLoad WHERE PKLoad = ? " +
" GROUP BY FKLoadStatus , tblLoad.PKLoad, tblLoad.PlannedLoadDate, " +
" tblLoad.Carrier, tblLoad.FKCarrierDriver , DriverReportTime";
dbAdapter = new DatabaseAdapter(this);
dbAdapter.open();
cursor=dbAdapter.ExecuteRawQuery(sql,strpkManifest);
if (cursor.moveToFirst())
ManifestNo.setText(cursor.getString(cursor
.getColumnIndex("PKLoad")));
ManifestDate.setText(cursor.getString(cursor
.getColumnIndex("PlannedLoadDate")));
Carrier.setText(cursor.getString(cursor.getColumnIndex("Carrier")));
CarrierDriver.setText(cursor.getString(cursor.getColumnIndex("FKCarrierDriver")));
DepotReportTime.setText(cursor.getString(cursor.getColumnIndex("DriverReportTime")));
NoofDeliveries.setText(cursor.getString(cursor.getColumnIndex("NoOfDeliveries")));
FKLoadStatus=cursor.getString(cursor.getColumnIndex("FKLoadStatus"));
if FKLoadStatus!="C" )
{
confirm_Depot_button.setEnabled(true);
}
else
{
confirm_Depot_button.setEnabled(false);
}
</code></pre>
| java android | [1, 4] |
1,520,856 | 1,520,857 | How to encrypt web config? | <p>I wanted to encrypt the connection string section in the web config.</p>
<p>I did it using visual studio command prompt using this command.</p>
<p>aspnet_regiis.exe -pef “connectionStrings” C:\Projects\DemoApplication</p>
<p>and it encrypted the section and it worked fine.</p>
<p>and I did the same thing using code behind calling this method.it also worked fine but it give me wrong cipher value and I decripted it and matched with previous decript value and those are different.</p>
<pre><code> string provider = "RsaProtectedConfigurationProvider";
string section = "connectionStrings";
System.Configuration.Configuration confg = ConfigurationManager.OpenExeConfiguration(txtLocation.Text + @"\web.config"); ;
System.Configuration.ConfigurationSection configSect = confg.GetSection(section) as ConnectionStringsSection;
if (configSect != null)
{
configSect.SectionInformation.ProtectSection(provider);
confg.Save();
}
</code></pre>
<p><strong>My question is why the two way of encrypting generate different values. even if both using the same provider "RsaProtectedConfigurationProvider"</strong></p>
| c# asp.net | [0, 9] |
4,266,453 | 4,266,454 | return value after callback function Not Working | <p>I don't Know is below a valid question? or Just my stupidity. </p>
<pre><code> function IsSlaExists(department) {
var flag = "";
$.ajax({
type: "POST",
data: "Type=ISSLAEXISTS&Department=" + encodeURI(escape(department)),
url: "class-accessor.php",
success: function (data) {
//flag=data;
flag = "YES";
}
});
return flag;
}
alert(IsSlaExists('department'));
</code></pre>
<p>i'm trying to return the value of <code>flag</code> but function returns blanks even if i set the value of flag maually.
what i'm doing wrong?</p>
| javascript jquery | [3, 5] |
5,757,761 | 5,757,762 | Runing a cpp binary on php could speed up my code? | <p>I'm a php developer as well as cpp developer. I was wondering: if I make a cpp binary and I run it on php. Will that make my process run faster?</p>
<p>For example: </p>
<p>I have to compare 1,000 array elements and execute a process for each of them and in some cases I had to run it over and over again ( recursively) . Yes is messup but it works !.</p>
| php c++ | [2, 6] |
2,481,533 | 2,481,534 | change VAT price with radio button using jquery and php without reloading | <p>I'm not sure if I am making this more complex then what it is... What I want to do: depending on which button the user presses $price should be calculated and displayed without the page beeing reloaded. The $price variable gets its data from a database. I cannot get this to work so if someone could help me would be fantastic, thanks linda</p>
<p>my form</p>
<pre><code><form id="f1" method="POST">
<label for="r1">Exkl. moms</label><input type="radio" name="radio" value="exkl" checked="checked" id="r1"/>
<label for="r2">Inkl. moms</label><input type="radio" name="radio" value="inkl" id="r2"/>
</form>
<div id="results"></div>
<?php
if(($_SESSION['user_info']['moms'])=="inkl"){
$price*1.25;
}
?>
</code></pre>
<p>jquery</p>
<pre><code>function showValues() {
var str = $("#f1").serialize();
$.ajax({
type: "POST",
url: "momsTest2.php",
data: str,
success: function(html){
$('#results').html(html);
}
});
}
$(":radio").change(showValues);
showValues();
</code></pre>
<p>momsTest2.php page</p>
<pre><code>session_start();
$_SESSION['user_info']['moms'] = $_POST['radio'];
</code></pre>
| php jquery | [2, 5] |
76,595 | 76,596 | Recommended way to format numbers in a locale aware way? | <p>Lets assume we have one million.</p>
<p>In english it should be formatted as 1,000,000 in german it should be 1.000.000.</p>
<p>Thanks</p>
| java android | [1, 4] |
5,074,567 | 5,074,568 | How to get an element in a parent frameset with jquery? | <p>I have a main page with frames within a frameset:</p>
<pre><code><FRAMESET>
<FRAMESET >
<FRAME name="menu" src=<%=menu%>>
<FRAME marginWidth="0" src=<%=bottom%> >
</FRAMESET>
<FRAMESET>
<FRAME src=<%=title%>>
<FRAME name="main"src=<%=main%>>
</FRAMESET>
</FRAMESET>
</code></pre>
<p>I'm in the <code>main</code> frame and i neet to get a <code>myspan</code> <code>span</code> who is in the <code>menu</code> frame.</p>
| javascript jquery | [3, 5] |
3,305,089 | 3,305,090 | Android browser donwload APK from secured serverdir | <p>Is it possibly to download a apk-file from a dir htaccess secured dir on a server via the standard browser ?</p>
<p>I've tried it and if I delete the htaccess secure it'll be done. But I want to secure the file. Does anybody know a workaround ?</p>
| java android | [1, 4] |
12,956 | 12,957 | Need UserVoice feedback page functionality | <p>I like the feedback link that's static while the page scrolls and I want to add something similar to my site. See www.bind.pt, right side, for example. However I don't want to use UserVoice. I want to use a popup window with a form-to-email functionality.</p>
<p>Is there a similar sample asp.net component or Javascript that's available for a lazy developer like me for re-use?</p>
| asp.net javascript | [9, 3] |
155,138 | 155,139 | How to get all the contents inside an HTML tag for selected div asp.net codebehind | <p>Is it possible to get all form variables inside the selected div?</p>
<p>e.g: <code>this.Page.Request.Form[""]</code> this will return all data but can it get data within a selected div?</p>
<p>e.g : </p>
<pre><code><div id="a">
<input type = "text" id="input1">
<input type = "text" id="input2">
</div>
<div id="b" style="display:none">
<input type = "text" id="input1">
<input type = "text" id="input2">
</div>
</code></pre>
<p>both div are must.</p>
| javascript jquery asp.net | [3, 5, 9] |
2,152,759 | 2,152,760 | Load next twitter user from Array and get their tweets with blogger.js | <p>I have a javascript array of twitter usernames. I load the first twitter user and their last 5 tweets using blogger.js. I want to have an html button/link for previous and next to load the next/previous username and their tweets replacing the current username and tweets (inner html) by calling blogger.js. How do I iterate over the javascript array using onclick and keep track of where I am in the array? I can call blogger.js from the function I call with onclick. Am I going about this the right way by trying to use jquery? Just looking for some ideas and guidance. </p>
| java javascript jquery | [1, 3, 5] |
657,080 | 657,081 | I want a tab control in asp.net with previous and next button | <p>I want a tab control which will have say 4 tabs. in the content of 1st tab, there will be a button named as "Next". Onclick of "Next",it should go to 2nd tab or switch to 2nd tab. Similar way, 2nd tab will have "Previous" and "Next" buttons which will switch to 1st and 3rd tab respectively.</p>
| c# jquery asp.net | [0, 5, 9] |
2,886,255 | 2,886,256 | How do i update database by checkedchanged events of the checkbox | <p>How do i update database with out page refresh through checkedchanged events of the checkbox present in the itemtemplate of the gridview.</p>
<p>Please any help..</p>
| c# asp.net | [0, 9] |
4,535,728 | 4,535,729 | Animating an image's perspective using jQuery? | <p>I was wondering if there was any jQuery library that will allow us to change the perspective of an image.</p>
<p>I know that modern browsers already support vendor specific <code>rotate()</code> in CSS but it doesn't quite give the desired result. Most of them just vary the width of the image but doesn't shrink the height of one side and increase the height of one side to produce the effect that you are viewing the image from another angle.</p>
<p>Any more details that you may need, please tell me. Thanks!</p>
<p><strong>EDIT</strong></p>
<p>I already tried transforms but they don't increase the height of the side that is moving towards you and decrease the one that is moving away from you. And I don't do full rotations, i just tilt the image a few degrees so the change in height has to really be there</p>
| javascript jquery | [3, 5] |
4,719,197 | 4,719,198 | What is the space complexity of HashTable, Array, ArrayList, LinkedList etc(if anything more) | <p>I want to know the space complexities of the basic data structures in popular languages.</p>
| c# java javascript c++ python | [0, 1, 3, 6, 7] |
2,361,070 | 2,361,071 | Javascript get output from separate php script | <p>I want javascript to be able to call a php script (which just echos a string) using jQuery.</p>
<p>I think <code>$.get</code> is the right way, but not too sure.</p>
<p>I then want to use the returned string as a javascript variable.</p>
| php javascript jquery | [2, 3, 5] |
3,858,363 | 3,858,364 | encrypting jquery .load() function | <p>I'm calling a php page using .load()</p>
<p><code>.load('page.php?user='+user+'&page='+page)</code></p>
<p>if you go to the actual page.php and type <code>page.php?user=1&page=2</code>
you get the same result, how could I stop this from happening?
encrypting data maybe?</p>
<p>Could someone point me in the right direction, cheers.</p>
<p>@lonesomeday,</p>
<p>this answer works for me, yours was correct though:</p>
<p><code>if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { it's an ajax request validate id and continue! } else { this is not an ajax request, get out of here! }</code> </p>
<p>submitted by "ifaour"</p>
| php jquery | [2, 5] |
3,596,131 | 3,596,132 | control window.onbeforeunload event | <p>From out of curiosity can i Control window.onbeforeunload event like check if the user decided to leave the page or stay in it and can I raise an alert or some function based on his decision if yes please tell me </p>
<pre><code><script type="text/javascript">
$(window).bind("beforeunload",function(){
if(//stay on page)
alert("i want to stay on the page");
else //leave page
alert("i want to leave the page");
});
</script>
</code></pre>
<p>I understand that window.onbeforeunload is an event that give the user a message to tell him that maybe you forget to do something before you leave but this quest is just out of curiosity and thank you </p>
| javascript jquery | [3, 5] |
1,286,969 | 1,286,970 | Resources for C++ programmer to learn JS | <p>I am proficient in C++, I dont know Java Script and want to learn JS, What should be the way/process for me? I know basic html, CSS.</p>
| javascript c++ | [3, 6] |
2,614,962 | 2,614,963 | Best way to detect Mac OS X or Windows computers with javascript or jQuery | <p>So I'm trying to move a "close" button to the left side when the suer is on mac and the right side on PC. Not I'm doing it with user agents, but they can be too easily spoofed for it to be real O.S. detection. Is there a surefire way to detect Mac OS X or Windows? If not, what's better then user agent sniffing?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
1,829,993 | 1,829,994 | How to make android edit text uneditable when switch is off? | <p>I am brand new to android development and I am having difficulties trying to make my editText uneditable after a switch is set to off. The problem is that The switch function doesn't work. Even after it is set to off, I can still edit the text.
here is my code : </p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
this.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
final View switch1 = (Switch) findViewById(R.id.editSwitch);
final EditText mEdit = (EditText) findViewById(R.id.bioTxt);
switch1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (switch1.getContext().toString().equals("On")) {
mEdit.setEnabled(true);
}
else if (switch1.getContext().toString().equals("Off")) {
EditText mEdit = (EditText) findViewById(R.id.bioTxt);
mEdit.setEnabled(false);
}
}
});
};
}
</code></pre>
| java android | [1, 4] |
4,995,330 | 4,995,331 | Difference beetwen assigning properties to element or putting it directly in markup | <p>What is the difference in doing this:</p>
<pre><code><a href="<%=this.GetUserProfilePermalink()%>"><%=this.GetUsername()%></a>
</code></pre>
<p>and this:</p>
<pre><code><a id="hlUser" runat="server"></a>
</code></pre>
<p>in codebehind:</p>
<pre><code>hlUser.HRef = GetUserProfilePermalink();
hlUser.InnerText = GetUsername();
</code></pre>
<p>I noticed my codebehind is more readable doing it first way because I moved all assinging to markup however if I miss something somewhere it's hard to find mistake due to "too many character in literal" error.What is the difference and what is the preferable way of doing this?</p>
| c# asp.net | [0, 9] |
3,498,790 | 3,498,791 | PHP and jQuery update textbox with checkbox value | <p>I have the following functionality I would like to build into a form using jQuery:</p>
<p>I have a list of values:
Invoice No: 110, Amount: 240.00
Invoice No: 111, Amount: 399.00
Invoice No: 112, Amount: 150.00</p>
<p>Next to each row there is a checkbox which is set to checked by default. Right at the bottom there is a textbox with the total 789.00 for the set of data. I would like to update the textbox when one of the checkboxes are de-selected & selected with the total of invoice amounts which checkboxs are checked.</p>
<p>The form will then be submitted to itself with the value of the textbox set.</p>
<p>Any suggestions welcome, as I'm a noob with jQuery.</p>
| php javascript jquery | [2, 3, 5] |
3,884,076 | 3,884,077 | Get a class of part it after typing. `keyup` | <p>Why i always get a value(bu0) of typing in 3 field different(<code>class="bg_units bu0"</code>, <code>class="bg_units bu1"</code>, <code>class="bg_units bu2"</code>) ?</p>
<p>I want if user typing value in field bu0 get dynamic part 2 <code>class="bg_units bu0"</code> of class (.bu0), as for other:</p>
<ul>
<li>if typing each value on field bu0 =get class=> <code>.bu0</code> </li>
<li>if typing each value on field bu1 =get class=> <code>.bu1</code> </li>
<li>if typing each value on field bu2 =get class=> <code>.bu2</code></li>
</ul>
<p><strong>EXAMPLE:</strong> <a href="http://jsfiddle.net/jJaYT/" rel="nofollow">http://jsfiddle.net/jJaYT/</a></p>
<pre><code>$('.eghamat').live('keyup',function () {
var $this = $(this),
$div = $this.closest('div.find_input'),
bu_num = '.' + $div.find('.bg_units').attr('class').split(" ")[1];
alert(bu_num);
});
</code></pre>
| javascript jquery | [3, 5] |
1,265,423 | 1,265,424 | ways to hide/show a div with a toggle in jQuery | <p>i'm looking into implementing something similar to the li's in <a href="https://chrome.google.com/webstore/category/extensions?hl=en" rel="nofollow">chrome extension page</a>.
Should i use <a href="http://api.jquery.com/slideToggle/" rel="nofollow">jQuery slideToggle</a>? maybe someone can provide some sort of a sample
code i could start off with? (i'm new to jQuery)</p>
| javascript jquery | [3, 5] |
50,654 | 50,655 | Restarting from beginning after clearInterval | <p><a href="http://dl.dropbox.com/u/2953799/test.html" rel="nofollow">link to test site</a></p>
<p>I want to restart the animation from the beginning once it stops at the last image. I tried the code below but it won't return to the first image. </p>
<pre><code>$(document).ready(function () {
window.setInterval("slideshow()", 3000);
});
function slideshow() {
var time = window.setInterval("slideshow()", 3000);
next = $(".next");
inside = parseInt($(".inside").css("left"));
if (inside == -3080) {
window.clearInterval(time);
inside == 0;
}
else {
next.trigger("click");
}
}
</code></pre>
| javascript jquery | [3, 5] |
5,772,921 | 5,772,922 | Anchor with "computed" URL | <p>I have a JS script that appends to the HTML page the pairs: input + anchor</p>
<p>Can I compute the URL before the redirect happens? </p>
<p>Now I have link that looks like this:</p>
<pre><code><a href="#" onclick="myFunct();return false;">link</a>
</code></pre>
<p>and <code>myFunct</code> uses <code>window.location.href</code> to redirect webpage. The problem with this approach is that I cannot (obviously) CTRL+click on the link for opening goal link in a new tab.</p>
<p><strong>Details:</strong></p>
<ul>
<li><p>The link URL is known after obtaining the URL from the server - this operation is very expensive for me and I would like to do that only in case it is absolutely necessary. </p></li>
<li><p>The idea is: user chooses a link, he/she clicks it, url is obtained from server and user is redirected (in the same window or in a new tab if he/she uses CTRL+click)</p></li>
</ul>
<p>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.