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,871,479 | 1,871,480 |
Adding A Row To An Empty GridView?
|
<p>I want to add a row inside an empty gridview, i tired the following code but no luck so far:</p>
<pre><code> GridViewRow oRow = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Insert);
TableCell oCell = new TableCell();
oCell.Text = "XXX";
oRow.Cells.Add(oCell);
gvMemberShip.Controls.Add(oRow);
</code></pre>
<p>Note: i ran this code on Page_Load Event.</p>
|
c# asp.net
|
[0, 9]
|
3,796,976 | 3,796,977 |
jquery/javascript security
|
<p>I am using jQuery to disable some form buttons. Simple stuff. But how can I prevent users from editing the DOM and enabling the button themselves so they can work around the restrictions I put in place?</p>
|
javascript jquery
|
[3, 5]
|
792,586 | 792,587 |
run a function when a user clicks on any list element
|
<p>This is probably a very common question, but I was unable to find an answer myself;</p>
<p>All my list elements call the function setQuery like this</p>
<pre><code>onClick="admin_stats.setQuery(this);"
</code></pre>
<p>rather than [hardcode] add this to every list element, is there a way to simply have it run when a list element is clicked?</p>
<p>I'm not very familiar with jQuery Live or binding/unbinding, but I think they would play a role here?</p>
<p>Before I reinvent a rather square-looking wheel I thought I might ask =)</p>
<p><hr>
edit: my list elements look like</p>
<pre><code><ul>
<li id="usersPerMonth" onClick="admin_stats.setQuery(this);">Users per Month</li>
<li id="statsByUser" onClick="admin_stats.setQuery(this);">Stats by User</li>
</ul>
</code></pre>
<p>the this.attr("id") is then used to look up what the actually SQL text looks like, from a json-style variable:</p>
<pre><code>queries : {
usersPerMonth : " ... some sql ...",
statsByUser : " ... some sql ...",
...
}
</code></pre>
<p>so that's why I have the divs named that way (and I'm open to design suggestions)</p>
|
javascript jquery
|
[3, 5]
|
2,795,511 | 2,795,512 |
jQuery if statement doesnt seem to work
|
<p>I have an if statement and for some reason I cant seem to get it to work, Can anybody see why?</p>
<p><a href="http://jsfiddle.net/7YKgS/1/" rel="nofollow">http://jsfiddle.net/7YKgS/1/</a></p>
<p>I have a span tag that contains a string and im trying ot say if this string == X then do this, if not do something else.</p>
|
javascript jquery
|
[3, 5]
|
3,217,646 | 3,217,647 |
json and php question
|
<p>I am using the following in php to return the driving distance details between 2 locations:</p>
<pre><code>$url = 'http://maps.google.com/maps/nav?q=from:London%20to:Dover';
$data = @file_get_contents($url);
</code></pre>
<p>A JSON object is returned, i am not familiar with JSON can somebody please demonstrate how I can get the "Meters" element from this object into a string.</p>
<p>Thanks in advance.</p>
|
php javascript
|
[2, 3]
|
1,388,357 | 1,388,358 |
Compare today datetime to match (First, second, third, fourth, fifth) weekday(mon, tuesday ect.) of current month
|
<p>Is There any built in function in c# to compare Compare today's datetime to match like: (First, second, third, fourth, fifth) weekday(mon, tuesday ect.) of current month</p>
<p>or can any one please provide the custom solution for the same.</p>
<p>Regards</p>
|
c# asp.net
|
[0, 9]
|
829,134 | 829,135 |
Seperate Values which are saved in one column
|
<p>i have one column. In that column is saved the fullname(firstname, surname) of a Person. Sometimes it is saved like</p>
<pre><code>Michael, Myers
</code></pre>
<p>and sometimes the name is saved like</p>
<pre><code>Michael Myers
</code></pre>
<p>without a comma between them. </p>
<p>If i load the column and save it to a variable it looks of course like: <code>Michael, Myers</code> or <code>Michael Myers</code>.</p>
<p>The Question is: If i load the column from the database, how can i save the the firstname and the surname independently of each other in different variables. </p>
|
c# asp.net
|
[0, 9]
|
5,328,401 | 5,328,402 |
jQuery alert after 100 pixels scrolled
|
<p>Is it possible to fire an alert after a user scrolls 100 pixels. </p>
<p>Here's what I have so far but I know I'm missing something;</p>
<pre><code>$(window).scroll(function() {
if (document.documentElement.clientHeight +
$(document).scrollTop() == "100px")
{
alert("You've scrolled 100 pixels.");
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,514,220 | 1,514,221 |
populate a textarea using javascript
|
<p>Basically I am using the SCEditor and want a button on forum posts or articles comments called "Quote" where it grabs the text from the message and pastes it into the textarea, i have this code:</p>
<pre><code><script type="text/javascript">
jQuery.noConflict(); //disable global $ for jQuery
jQuery(document).ready(function($){
$(function(){
$('#quote').click(function() {
$('textarea').sceditor('instance').insert("[quote=admin]Some text[/quote]");
});
});
});
</script>
</code></pre>
<p>Now that works, it will put "[quote=admin]Some text[/quote]" into the textarea. Problem is I need that to be dynamic somehow so i don't have to copy that code above every comment if that makes sense? So instead of this:</p>
<pre><code>insert("[quote=admin]Some text[/quote]");
</code></pre>
<p>That section would grab all the text from the box below it? Rather than me manually replacing the quoted bit with the text in the post.</p>
<p>So basically replace the quoted bit above with the contents from different divs based on clicking a Quote link?</p>
|
javascript jquery
|
[3, 5]
|
1,668,762 | 1,668,763 |
Handling a ArrayList or List type of C# in jquery
|
<p>I want to bind the HTML select element with the database.</p>
<p>I want to bind the text and value of select element</p>
<p>The problem is dont want to return the string array with text and value of each option combined using some symbol rather i want to return an array list or some List</p>
<p>Now after returning using PageMEthods i cannot iterate over the result to get the id and value of select options.</p>
<p>I cannot use JSON i have to use PageMethods only.</p>
<pre><code>ArrayList obj = new ArrayList();
var countries = EntityService.ServiceInstance.GetCountries();
foreach (var country in countries)
{
ListItemClass temp = new ListItemClass();
temp.ListItemText = country.country_name.ToString();
temp.ListItemValue = country.id.ToString();
obj.Add(temp);
}
return obj;
</code></pre>
<p>What I want is how can I get the ID and country name in jQuery</p>
<p>Any help is appreciated.</p>
<p>Thanks</p>
<p>PROBLEM SOLVED:</p>
<p>I need to write :</p>
<p>where <strong>test</strong> is the return type of method </p>
<pre><code>$.each(test,
function (intIndex, objValue) {
$.each(objValue, function (intIndex1, objValue1) {
alert(objValue1);
})
}
);
</code></pre>
<p>But dont know whether this is a correct approach or not.</p>
|
jquery asp.net
|
[5, 9]
|
2,924,929 | 2,924,930 |
Fastest way of getting a list of installed packages in an Android device
|
<p>I'm getting a list of packages installed in an Android devices very similar to the code here - <a href="http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon" rel="nofollow">http://www.androidsnippets.com/get-installed-applications-with-name-package-name-version-and-icon</a></p>
<p>The problem is that it takes quite a while to complete detection of all apps. I've discovered that the slow operations are those that call p.applicationInfo.loadLabel() and p.applicationInfo.loadIcon(). Once I comment those out and set them to dummy info, the detection is almost instantaneous.</p>
<p>Since I would still like to retrieve the app name and icon, I can't simply comment them out. Is there a faster way of retrieving this data?</p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
2,294,781 | 2,294,782 |
OutofMemory Exception (when cropping an Image)
|
<p>I am trying to crop an Image that coming from a byte array. Unlucky, I get the OutofMemory Exception in my cropImage function. this part show how I write it on a file.</p>
<pre><code>System.IO.MemoryStream ms = new System.IO.MemoryStream(strArr);
System.Drawing.Rectangle oRectangle = new System.Drawing.Rectangle();
oRectangle.X = 50;
oRectangle.Y = 100;
oRectangle.Height = 180;
oRectangle.Width = 240;
System.Drawing.Image oImage = System.Drawing.Image.FromStream(ms);
cropImage(oImage, oRectangle);
name = DateTime.Now.Ticks.ToString() + ".jpg";
System.IO.File.WriteAllBytes(context.Server.MapPath(name), strArr);
context.Response.Write("http://local.x.com/test/" + name);
</code></pre>
<p>and this part is my crop Image function which is obvious what it is doing..</p>
<pre><code>private static System.Drawing.Image cropImage(System.Drawing.Image img, System.Drawing.Rectangle cropArea)
{
System.Drawing.Bitmap bmpImage = new System.Drawing.Bitmap(img);
System.Drawing.Bitmap bmpCrop = bmpImage.Clone(cropArea,
bmpImage.PixelFormat);
return (System.Drawing.Image)(bmpCrop);
}
</code></pre>
<p>and this is how I construct my strArr</p>
<pre><code>System.IO.Stream str = context.Request.InputStream;
int strLen = Convert.ToInt32(str.Length);
byte[] strArr = new byte[strLen];
str.Read(strArr, 0, strLen);
string st = String.Concat(Array.ConvertAll(strArr, x => x.ToString("X2"))); // try 4
</code></pre>
|
c# asp.net
|
[0, 9]
|
351,902 | 351,903 |
Trigger the change event of a textbox in jQuery
|
<p>I have an asp:TextBox with asp:RegularExpressionValidator to validate if it's a number. Obviously an onchange event will be attached to this textbox while rendering. Also I add a change event at $(document).ready to make some calculation when the value is changed.</p>
<pre><code><asp:TextBox id="myText" runat="server" />
<asp:regularexpressionvalidator id="myRev" ControlToValidate="myText" runat="server">*</asp:regularexpressionvalidator>
$(document).ready(function(){
$('[id$=myText]').bind('change',function(){
//do something
}).change(); //force the change event at the very beginning
});
</code></pre>
<p>My function will be executed later than the .net generated js because of the register time. But the asp.net js throws an error. I traced in the js:</p>
<pre><code> function ValidatorOnChange(event) {
...
}
</code></pre>
<p>and found that all of event.fromElement,event.toElement,event.srcElement are null which causes the exception. Did I do something wrong? Any solutions? Thanks.</p>
<p><strong>EDIT</strong></p>
<p>It's proved to be a MS bug, working fine in ASP.NET 4 vs2010.</p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
3,659,594 | 3,659,595 |
JavaScrip/jQuery - How to check if a string contain specific words
|
<pre><code>$a = 'how are you';
if (strpos($a,'are') !== false) {
echo 'true';
}
</code></pre>
<p>In PHP, we can use the code above to check if a string contain specific words, but how can I do the same function in JavaScript/jQuery?</p>
|
javascript jquery
|
[3, 5]
|
1,203,365 | 1,203,366 |
Validating more that one email field
|
<p>Im using <a href="http://jorenrapini.com/blog/javascript/the-simple-quick-and-small-jquery-html-form-validation-solution" rel="nofollow">Joren Rapini's validation code</a> to for my online form. <a href="http://jorenrapini.com/blog/javascript/the-simple-quick-and-small-jquery-html-form-validation-solution" rel="nofollow">Joren's Website</a></p>
<p>It allows you to check to see if an email address has been correctly entered, but I have 2 email addresses that I want to validate in the form.</p>
<p>Any idea how I would do this?</p>
<p>I've tried adding in email = $("#youremail"); as well as the one that's currently in the code which is email = $("#receiveremail"); but it only works for one.</p>
<pre><code>$(document).ready(function(){
// Place ID's of all required fields here.
required = ["youremail", "name", "receiveremail", "message"];
// If using an ID other than #email or #error then replace it here
email = $("#receiveremail");
errornotice = $("#error");
// The text to show up within a field when it is incorrect
emptyerror = "Please fill out this field";
emailerror = "Not a vaild email";
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,966,194 | 1,966,195 |
Code after Javascript for loop with Ajax not executing
|
<p>Why is the "hello" alert at the end of this code not executing? Everything else is working fine, but the alert doesn't fire. What am I missing? PS, I am a beginner when it comes to Javascript...</p>
<pre><code>$('.save_button').click(function(){
var numItems = dataseries.length;
var item;
var sequence;
var question = <%[email protected]%>;
for (i=0;i<numItems;i++){
var requestObj = {
question_id: "<%[email protected]%>",
user_id: "1",
}
item = $('.item_list li[data-seq='+i+']').attr('id');
requestObj["item_id"] = item.toString();
requestObj["x"]= dataseries[i][0][0];
requestObj["y"]= dataseries[i][0][1];
if (requestObj["item_id"]!="null"){
var a = $.ajax({
url: "<%=responses_path%>",
data: requestObj,
type: "POST",
dataType: 'script',
success: function(data, textStatus, jqXHR) {
},
error: function(jqXHR, textStatus, errorThrown) {
alert('error!');
},
headers: {
'X-CSRF-Token': '<%= form_authenticity_token.to_s %>'
}
});
}
}
alert("hello");
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,280,125 | 1,280,126 |
Performance Extension Method vs. Instance Method
|
<p>Is there any performance difference between an instance method and an extension method?</p>
|
c# asp.net
|
[0, 9]
|
2,348,639 | 2,348,640 |
In JQuery, how do I remove a comma after removing an element?
|
<pre><code>var body = 'Alex, <a href="blah" title="jason">Jason</a>, Kate, how are you?";
</code></pre>
<p>I want to use JQuery to remove the anchor element from body, and then also remove the comma after the anchor, if there is any. Note: to make it easy, the comma will always be after the anchor with no other characters in between.</p>
|
javascript jquery
|
[3, 5]
|
4,906,544 | 4,906,545 |
Javascript : Best way to declare functions to be used globally?
|
<p><strong>My javascript file is getting pretty big (3000+ lines) and I'm getting confused as to how to layout my file and delare functions so that they can called anywhere in the file.</strong></p>
<p>To summarise my JS file looks a little like this at the moment:</p>
<pre><code>//ALL GLOBAL VARIABLES FIRST DECLARED HERE
var var1 , var2 ,var3
$(document).ready(function(){
//JQUERY STUFF
});
//ALL FUNCTIONS THAT NEED TO BE GLOBAL DECLARED HERE
function myFunction(){
//do some stuff here
}
</code></pre>
<p>I am running into problems with this as some functions I call in places don't seem to be declared at the time of calling or aren't available globaly. It's all very confusing now! </p>
<p><strong>Could someone suggest the best way to layout a big js/jquery file with certain JS Functions, Objects and Variables available to be referenced anywhere in the file.</strong></p>
<p><strong>UPDATE:</strong></p>
<p>So to simplify it this correct (see my comments)?</p>
<pre><code>window.MainModule = (function($, win, doc, undefined) {//WHAT IS BEING PASSED IN HERE?
var foo, bar, modules; //VARIABLES ACCESSIBLE ANYWHERE
var modules["foobar"] = (function() {//WHAT IS A MODULE? WHEN WOULD I USE A SEPERATE MODULE?
var someFunction = function() { ... };//DECLARING MY FUNCTIONS?
...
return {
init: someFunction,//IS THIS WHERE I USE/BIND MY FUNCTIONS TO EVENTS AND ELEMENTS?
...
};
}());
// hoist a variable into global scope
window.Global = someLocal;
return {
init: function() {//FUNCTION TO INIT ALL MODULES?
for (var key in modules) {
modules[key].init();
}
}
};
}(jQuery, this, document));
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,741,690 | 1,741,691 |
Android Application Error
|
<p>Hi every one i am new to android application. i am reading data from xml which is in server .. for hotel list its reading properly but when i click any of the hotels i am redirecting to another page there its showing an error " application has stopped unexpectedly please try again" i dont where i am wrong can any one pls help me in dis.. thanks in advance</p>
|
java android
|
[1, 4]
|
851,962 | 851,963 |
How to change the Date format that we get from text field "16-JUL-2010" to 20100716 using php or using jquery
|
<p>How to change the Date format that we get from text field "16-JUL-2010" to 20100716 using php or using jquery</p>
|
php jquery
|
[2, 5]
|
2,965,438 | 2,965,439 |
Java or C++ to learn as a first prgramming language
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/345907/should-freshers-learn-java-or-c">Should freshers learn Java or C++?</a> </p>
</blockquote>
<p>I am a high schooler and am unsure whether to learn Java or C++. I would like to major in aerospace engineer so i want to learn the language that is the most useful in that field. If you guys have a better language that i should learn besides these two, recommend it. I will in my future learn both but for now i want to just learn one and get comfortable with it as i do not have any rush to learn the languages. Also if you guys have any books, or online places where i can learn this on my own, tell me.</p>
|
java c++
|
[1, 6]
|
3,487,817 | 3,487,818 |
Set URL argument for Page_Load in some menu item click Javascript
|
<p>I am reimplementing an ASP.NET application with a main page (Call it "MyMainPage") which contains a user control. (Call it "MyNavControl") Within that user control is a menu control provided by a third party. Items added to this third party control have an "Href" property that is passed a URL. The code to create a menu subitem, contained within the codebehind of the .ascx for MyNavControl, goes something like this:</p>
<pre><code>ThirdParty.MenuItem subitem = new ThirdParty.MenuItem();
subitem.Href="MyMainPage.aspx?_page=PremiumCustomer&_title=Premium";
</code></pre>
<p>MyMainPage also contains a user control representing the bulk of the page body. Let's call that MainBodyControl.ascx. The Page_Load() for the main page sets up some session values which are used in the Page_Load() for MainBodyControl.</p>
<p>When the menu item on the main page is clicked, the main page's Page_Load() will be passed the arguments specified in the menu item control's "Href" value. So:</p>
<pre><code>protected void Page_Load(object sender, System.EventArgs e)
{
string sPageType = "";
if (this.Request[ "_page" ] != null) {
sPageType = this.Request[ "_page" ].ToString();
}
}
</code></pre>
<p>Here's my question: I'm replacing the third party controls with standard ASP.NET controls, so the current "Href" property mechanism can no longer be used. What would be the best way, in some JavaScript assigned to a menu item's click event, to set a new value for "_page" or "_title" above.</p>
|
javascript asp.net
|
[3, 9]
|
1,142,257 | 1,142,258 |
Javascript .keyCode vs. .which?
|
<p>I thought this would be answered somewhere on SO, but I can't find it.</p>
<p>If I'm listening for a keypress event, should I be using .keyCode or .which to determine if the enter key was pressed?</p>
<p>I've always done something like the following:</p>
<pre><code>$("#someid").keypress(function(e) {
if (e.keyCode === 13) {
e.preventDefault();
// do something
}
});
</code></pre>
<p>But, I'm seeing examples that use .which instead of .keyCode. What's the difference? Is one more cross-browser friendly than the other?</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
2,388,891 | 2,388,892 |
md5-encrypted string returns different from database than it is inserted
|
<p>So, I try to check if passwords match.</p>
<p>This is the encryption I use, once when the data is inserted in the database, once to check if the inserted password on the login field matches the one from the database:</p>
<pre><code> byte[] pass = Encoding.UTF8.GetBytes(password);
MD5 md5 = new MD5CryptoServiceProvider();
string newPass = Encoding.UTF8.GetString(md5.ComputeHash(pass));
</code></pre>
<p>But every time I try to login (with correct details), it does not work. In the debugger, this is the string that comes from the database:</p>
<pre><code>?]??$PL??f??6?
</code></pre>
<p>And the one encrypted from the login field:</p>
<pre><code>�]��$PL��fඇ�6�
</code></pre>
<p>I suppose it's an encoding problem, but can't seem to figure it out myself.</p>
|
c# asp.net
|
[0, 9]
|
5,395,735 | 5,395,736 |
What does slash equal in javascript do?
|
<p>I was recently reviewing some Javascript code in a jQuery plug-in and came across this line of code:</p>
<pre><code>duration /= 2;
</code></pre>
<p>It appears from other code that the duration variable is a numeric value.</p>
<p>Can someone explain exactly what that does with the slash equal?</p>
|
javascript jquery
|
[3, 5]
|
78,355 | 78,356 |
Encrypt and decrypt
|
<p>I wrote Decrypt and Encrypt with C# and used it in my project, and right now it works But I am wondering that I have to write Decrypt and Encrypt with JavaScript for Sniff or it is enough?</p>
|
c# javascript
|
[0, 3]
|
5,346,404 | 5,346,405 |
Automatic FormsAuthentication.Signout() when user close tab in asp.net
|
<p>How to make automatic FormsAuthentication.Signout() when user close the tab/pages in asp.net C#</p>
|
c# asp.net
|
[0, 9]
|
4,686,426 | 4,686,427 |
Will a script continue to run even after closing a page?
|
<p>if i call a php file via jquery ajax, that contains a script to do some stuff that takes a while, fon instance uploading a big video, and then i close the page: does the php script keep loading the video or not?</p>
|
php javascript
|
[2, 3]
|
1,783,994 | 1,783,995 |
Populate a javascript array with links of a specific class
|
<p>I'm looking to take a website source and populate an array with a collection of links, filtered by their <code>a class</code>.</p>
<p>Say, for instance, the links were <code><a class="title"></code>, how could I target each class and add the URL to an array?</p>
<p>Would Javascript or jQuery work better?</p>
|
javascript jquery
|
[3, 5]
|
433,542 | 433,543 |
Marshaling exported string vector from C++ dll
|
<p>How can you marshal a vector of strings exported from a C++ dll ? I would like them to be separated before used in my C# program. Could you help me out ? </p>
|
c# c++
|
[0, 6]
|
2,725,153 | 2,725,154 |
Entityspaces showing some row from table
|
<p>I am trying to display some row of many rows in a table with the source code of Entityspaces. Does someone can tell me how? Thanks in advance...</p>
|
c# asp.net
|
[0, 9]
|
5,489,906 | 5,489,907 |
Error in multiple .ready() functions binding
|
<p>I have a page with some parts of it loaded with jQuery. Many of those parts have javascript code similar to:</p>
<pre><code>console.log( "script X loaded");
$(document).ready( function() {
console.log( "script X executed");
// ... some code ...
});
</code></pre>
<p>The issue is that all of those functions where executed until I have updated to jQuery 1.7.1</p>
<p>Now in al least one of them the function is not excuted as it is in others, In console I can read:</p>
<pre><code>script A loaded
script A executed
script B executed
</code></pre>
<p>And it ends without executing script B. I have tried to test it erasing all code inside the function in script B.</p>
<p>Do you have any clue about what may be happening?</p>
<p>Thank you!</p>
|
javascript jquery
|
[3, 5]
|
2,891,396 | 2,891,397 |
Why isn't java.text.Normalizer available for my Android app?
|
<p>I'm developing an Android app and in Eclipse, <code>java.text.Normalizer</code> can't be imported. It's like Eclipse can't find it. I saw another SO question asking about <code>Normalizer</code> alternatives to Android apps that are < version 2.3. Is the class limited only to certain Android SDK versions?</p>
|
java android
|
[1, 4]
|
2,520,030 | 2,520,031 |
How to save file in the memory of phone?
|
<p>I have been developing an application which needs to download a file from the Internet and save it into memory; application doesn't need to save directly on to the SD card, because the SD card may be full. How can I save the file in memory using Java? Thank you. </p>
|
java android
|
[1, 4]
|
3,504,211 | 3,504,212 |
Set Value of a Dynamically Generated DropDown
|
<p>I have a dropdown menu that gets automatically populated. I need to set its selected value to a certain option whose ID is being passed in. This code seems to work with dropdowns that were created on page load:</p>
<pre><code> $('select[id$=DropDown1] option').each(function (index) {
if ($(this).val() == _PassedInValue) {
$(this).parent().val($(this).val())
}
})
</code></pre>
<p>But, it doesn't seem to work with dynamically generated content. Is there something I am missing or is there another way to approach this?</p>
|
javascript jquery
|
[3, 5]
|
4,651,927 | 4,651,928 |
Binding event handler to any possible event
|
<p>I know i can bind event handler to multiple events, but is it possible to fire event handler for all events regardless of event type that occurs on specific element?</p>
<p>i meant something like this:</p>
<pre><code> $("#myElement").bind(function(){
//this will fire on any event
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,206,562 | 1,206,563 |
looping through json data in JavaScript
|
<p>This is similar to <a href="http://stackoverflow.com/questions/2556476/ajax-coldfusion-cfc-json-hello-world">this question</a>, but I thought I'd reword it a bit differently in order to make myself more clear.
I have this json coming back from a $.ajax call:</p>
<p>{"COLUMNS":["PERSONID","FIRSTNAME","LASTNAME"],"DATA":[[1001,"Scott","Wimmer"],[1002,"Phillip","Senn"],[1003,"Paul","Nielsen"]]}</p>
<p>Q: In JavaScript, how do I parse through it to make a table such as:</p>
<pre><code><table>
<thead>
<tr>
<th>PersonID</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1001</td>
<td>Scott</td>
<td>Wimmer</td>
</tr>
<tr>
<td>1002</td>
<td>Phillip</td>
<td>Senn</td>
</tr>
<tr>
<td>1003</td>
<td>Paul</td>
<td>Nielsen</td>
</tr>
</tbody>
</table>
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,966,788 | 2,966,789 |
Replicating functionality of stackoverflow's tag system
|
<p>On stackoverflow, while in the Tag-inputbox if you hold the left key button, it will go all the way to the left and open every tag for editing, same goes for the right key, and the backspace.
<br>I am trying to replicate the same functionality on mine.</p>
<p>I have the following code: <a href="http://jsfiddle.net/hAKMN/" rel="nofollow">JSFiddle</a></p>
<p>The problem with the current code is that I am not sure how to implement the arrow keys movements.</p>
<p>Any ideas?</p>
|
javascript jquery
|
[3, 5]
|
2,168,846 | 2,168,847 |
Use The Code Only One Time In my asp.net
|
<p>I have a class there is a code and this class is execute every time when website start.</p>
<p>I want to use the class run only single time when my website is start.</p>
<p>What can I do...?</p>
|
c# asp.net
|
[0, 9]
|
2,114,254 | 2,114,255 |
Abstract class with static methods. Is that correct?
|
<p><strong>Task</strong>: I want to use some methods for many classes. Methods are same, so there is no need to implement them for each class. In my case - I work with android SDK and I send http request to server.</p>
<p><strong>Problem</strong>: There is idea to use construction like this:</p>
<pre><code>class abstract MethodsCarrier{
public static void method1(){ /*something*/ }
public static int method2(){ /*return something*/ }
}
</code></pre>
<p>It works, there is no problems. But I'm not sure about making this class abstract. Is it's a right way at all?</p>
|
java android
|
[1, 4]
|
3,584,718 | 3,584,719 |
using RFID reader in a asp site
|
<p>I have create a web site and I need to read data which is created by rfid reader.
this device has some dll which can be use in windows application.
I want to know that is there any way to use those dll in my site in order that I read data from RFID reader? if not is there any way to use that device in web site?</p>
|
c# asp.net
|
[0, 9]
|
3,727,457 | 3,727,458 |
check if value changed upon change() trigger
|
<p>I noticed that change() can be triggered for a <code><select></code> even if the option was not changed.</p>
<p>See my <a href="http://jsfiddle.net/emMx6/" rel="nofollow">jsfiddle</a> example.</p>
<p>Changing the selection will change the text input displayed. However (and I do know it's a bit of stretch) if you:</p>
<ul>
<li>select the drop down by clicking on its label <code>Selection:</code> </li>
<li>press down on the keyboard (assuming <code>Show A</code> was selected) </li>
<li>then select <code>Show A</code> with the mouse pointer it will trigger change(). </li>
</ul>
<p>Is there an easy workaround for this (right now I'm thinking of using a variable to keep track what the last selection was upon change())?</p>
<p><strong>EDIT:</strong>
It seems it is a Chrome-specific problem. I was able to <em>fix</em> the problem by using a variable to keep track of what the last selected item was. I guess this a bug left for the jQuery/Chrome developers.</p>
|
javascript jquery
|
[3, 5]
|
1,272,174 | 1,272,175 |
how do I return values from an array to populate href values
|
<p>var standard = $(function(){</p>
<pre><code> //should return reversed iterated standard anchor array
$.each(standard_anchor,function(value){ return (value) })
});
</code></pre>
<p>/////</p>
<p>$(function(){</p>
<pre><code> /* should replace all a href values with reversed iterated standard anchor data */
$('a [href]').reverse().each().attr('href', function(){ return ( standard) });
});
</code></pre>
<p>/////</p>
<p>so that's what I tried but it didn't work, and I don't know why it didn't work, any suggestions?</p>
<p>standard_anchor is the array name, and var standard is a function I thought could return those array values when used in a function.</p>
|
javascript jquery
|
[3, 5]
|
1,989,009 | 1,989,010 |
Update scripts folder that get added into a new asp.net web application
|
<p>How do I make Visual Studio add the latest version of Jquery to the scripts folder when I create a new Asp.Net application on Visual Studio 2010?</p>
<p>Thanks</p>
|
c# asp.net
|
[0, 9]
|
5,629,472 | 5,629,473 |
How to use push with sub-arrays?
|
<p>I have 3 arrays like:</p>
<pre><code>var arr1 = [];
var arr2 = [];
var arr3 = [];
//When I want to add something into array then I use
arr1.push("text");
arr2.push("text");
</code></pre>
<p>but is it possible to make something like the following example?</p>
<pre><code>//example:
var arr = [];
arr['group1'].push("text1");
arr['group2'].push("text2");
arr['group2'].push("textn");
//and then iterate like:
for(item in arr['group1'])
console.log(item);
</code></pre>
<p>is it even possible to do something like that? I have tried but does not work.</p>
|
javascript jquery
|
[3, 5]
|
442,648 | 442,649 |
Smooth natural motion when page scroll
|
<p>I am newbie in JS. Right now i am working on an effect in which i want when page scroll first time then the natural motion animation starts but it's creating a problem because when i scroll the element animation became fast.</p>
<p>Check this more you got the idea.</p>
<p><a href="http://jsfiddle.net/byvLy/" rel="nofollow">http://jsfiddle.net/byvLy/</a></p>
|
javascript jquery
|
[3, 5]
|
1,983,376 | 1,983,377 |
While-loop divs not reacting
|
<p>I have a list of divs created using a while-loop</p>
<pre><code>while($row = mysql_fetch_array($result)){
$output = "<div id='drag'>$row[id] - $row[name] - $row['email']</div>";
echo $output;}
</code></pre>
<p>When I try to make those divs highlighted for a few seconds.
Only the first div seems to be reacting.</p>
<pre><code>$("#drag").effect("highlight", {}, 2000);
</code></pre>
<p>Is there any strategy to make all the output be highlighted this way? And is there a way to make a certain div or divs highlighted?</p>
|
php javascript
|
[2, 3]
|
2,401,900 | 2,401,901 |
Detect 30% from browser window bottom using scrollTop()
|
<p>My code can detect browser window bottom like below and then run <code>last_msg_funtion();</code> : </p>
<pre><code>$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height() - $(window).height()){
last_msg_funtion();
}
});
</code></pre>
<p>My problem is user need to scroll down until bottom(<em>footer</em>) then <code>last_msg_funtion();</code> will run but i want adjust the detection maybe around 30% from bottom</p>
<p>See image below :
<img src="http://i.stack.imgur.com/x5afI.jpg" alt="enter image description here"></p>
<p>My Site : <a href="http://www.micespanel.com/classified.php">Click Here</a></p>
<p>Full Code : <a href="http://www.9lessons.info/2009/07/load-data-while-scroll-with-jquery-php.html">Click Here</a></p>
|
javascript jquery
|
[3, 5]
|
60,405 | 60,406 |
Pass event to parent view?
|
<p>I have a layout which contains five TextView. When user clicks any of the five TextView, it will do the same thing: open another activity. So, the OnClickerListener behavior to the five TextView is the same.
Is it possible that I only add OnClickListerner to one view, e.g. to layout, so I don't have to add OnClickListerner to each of the five TextView?
Put it another way, if none of the children components receives CLICK event, will the CLICK event passed through to their parent, the layout? </p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
4,389,051 | 4,389,052 |
Parsing Line Breaks in PHP/JavaScript
|
<p>EDIT: Ok, thanks for your help guys. Using zerkms' suggestion, I have managed to get <code><br></code> tags inserted instead of carriage returns, so it is displayed properly on the page and doesn't break the javascript. The problem is now that when the user clicks on this text, it becomes a textarea and is therefore inline editable. However, the text string now has the tags displayed in it, rather than just having the editable text over multiple lines.</p>
<p>Any suggestions?</p>
<p>ORIGINAL QUESTION: I have a text area in my PHP application where users can enter notes in a project. Sometimes this is displayed on the page via PHP and sometimes it is displayed via javascript. The problem is, if the note is across multiple lines (i.e. the user presses enter while entering notes in the text area), it causes the JS to fail. It's fine when it's being done by the PHP.</p>
<p>The line of code in question is:</p>
<pre><code>var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor"><?php print $notes; ?></textarea>';
</code></pre>
<p>So, if the note is over multiple lines, the PHP builds the pager as:</p>
<pre><code>var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor">This is
a test note
over multiple lines
</textarea>';
</code></pre>
<p>And this obviously causes problems for the js. So my question is, what can I do to prevent this? As the code is being built by PHP before it even gets to the browser, I'm thinking that the best approach may be to parse it in the PHP so that the output is something more like this:</p>
<pre><code>var editnotes='<textarea class="desc_text" style="width:20em;" id="notes_editor">This is<br/>a test note<br/>over multiple lines<br/></textarea>';
</code></pre>
<p>Will this work? How would I do it?</p>
<p>Thanks</p>
|
php javascript
|
[2, 3]
|
2,205,291 | 2,205,292 |
how to sort an ArrayList by its objects properties?
|
<p>Say I have an ArrayList of custom object, such as </p>
<pre><code>class fileOjb
{
String path;
String format;
int size;
int dateadd;
}
</code></pre>
<p>How should I sort it by
- path, format, size or dateadded?</p>
<p>Thanks!</p>
|
java android
|
[1, 4]
|
3,228,708 | 3,228,709 |
checkbox filtering system
|
<p>I came across this page at <a href="http://www.walmart.com/browse/Computers/Desktop-Computers/_/N-96fg?browsein=true&catNavId=3951&ic=48_0&ref=%20428236" rel="nofollow">walmart.com</a> and on the left side of the page is a checkbox filtering system that is done on the client side. When you check the price checkbox selection it filters out the brands and disables enables/disables them etc.</p>
<p>When i had a look at the source code the checkboxes have no values and when i tried to find the <code>REFINEMENT.clicked</code> event I couldn't find it when I downloaded the page. It's a very big page with lots of code and would prob take a long time to go through it.</p>
<p>I was wondering how could I implement this filtering system in jquery for the client side. You could use a array that stores values but how would i know which properties the filters have as each page would show different filters (other than price range) based upon the product type.</p>
<p>If someone could point me in the right direction or give an example as to what to do that would help.</p>
|
javascript jquery
|
[3, 5]
|
2,756,955 | 2,756,956 |
How to reference <a> within <li> with jQuery
|
<p>I want to replace the <code>HREF</code>s in a list with new URLs.</p>
<p>I have something like this:</p>
<pre><code><ul id="sidebarItems">
<li><a href="/PartBasicInfo/XX">Part Basic Info</a></li>
<li><a href="/SupplierContracts/XX">Supplier Contracts</a></li>
</ul>
</code></pre>
<p>I'm trying this (I know there are lots of ways to do it), but not having any luck. Any ideas?</p>
<pre><code>function SetUrlParams() {
$("#sidebarItems > li > a").each(function (idx, a) {
a.attr("href", "MyURLOfChoice");
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,781,129 | 3,781,130 |
run function onclick of disabled checkbox
|
<p>I have a checkbox that I do not want the user to have direct access to. I want them to accept some terms. To do this I want them to be able to click on a disabled checkbox which opens this mini popup (not checking the box) that contains the terms so the reader can read them and accept them. Once they accept them the popup will close and the checkbox will be checked. The issue I have is i cant figure out to run a function onclick of the disabled checkbox.</p>
|
javascript jquery
|
[3, 5]
|
4,811,746 | 4,811,747 |
Cast javascript object to array. How to?
|
<p>I have made this sandbox test:</p>
<pre><code><html>
<head>
<title>whatever</title>
<script type="text/javascript">
function myLittleTest() {
var obj, arr, armap;
arr = [1, 2, 3, 5, 7, 11];
obj = {};
obj = arr;
alert (typeof arr);
alert (typeof obj);
// doesn't work in IE
armap = obj.map(function (x) { return x * x; });
alert (typeof armap);
}
myLittleTest();
</script>
</head>
<body>
</body>
</html>
</code></pre>
<p>I realize I can use jQuery's function $.map for making that line of code work, but, what am I missing on javascript datatypes?</p>
|
javascript jquery
|
[3, 5]
|
5,558,996 | 5,558,997 |
Show another div if earlier div height<300px
|
<p>I am working on dynamic page where height of the page is concern.</p>
<p>So, What I want is if height of <code><div id="a"></code> <strong>< 300px</strong> , <strong>Then only show</strong> new <code><div id="b"></code></p>
<p>How can I achieve this ?</p>
<p>Thanks.</p>
<ul>
<li>Mandar</li>
</ul>
|
javascript jquery
|
[3, 5]
|
5,962,214 | 5,962,215 |
In asp.net, how can I tell what triggered an additional page_load call?
|
<p>Greetings.</p>
<p>Is there a good way to determine what is calling my Page_Load method? I've got a few Componentart WebUI grids that call it, although I've checked all of those (using the gridName.IsCallback property). I've also got an update panel, but I'm not sure how to check if it is the caller.</p>
<p>I'm betting there is a property somewhere that will tell me.</p>
<p>Thanks!</p>
|
c# asp.net
|
[0, 9]
|
809,377 | 809,378 |
Better alternatives to know whether a control is valid in javascript?
|
<p>I want to know whether a control is valid or not in javascript. Is there a direct client side API available in Asp.Net which can tell me whether a control is valid or not?</p>
<p>Eg. If I have 2 validators attached to a textbox, I need a function that can tell me whether the textbox is valid or not. If even 1 validator is not valid then it should return false.</p>
<p>I can't seem to find a function that can give me this. Here is a little helper that I wrote which does the job but is inefficient:</p>
<pre><code>function isControlValid(control) {
for (i = 0; i < Page_Validators.length; i++) {
var validator = Page_Validators[i];
var controlId = validator.controltovalidate;
if ($(control).attr('id') == controlId && validator.isvalid == false) {
return false;
}
}
return true;
}
</code></pre>
<p>Anybody has any better alternatives?</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
365,222 | 365,223 |
Selecting elements by attributes of given value
|
<p>I have the table below. I also have this array who's values correspond to the data-id attributes of the rows <strong>[52,24,12]</strong>. One and only one row will exist in the table for each array value. I would like to increment the count column for each row which exists in the array. For instance, 12 would change to 13, 32 would change to 33, and 6 would change to 7. A jQuery solution is preferred, however, a native JavaScript solution would suffice. Thank you</p>
<pre><code><table>
<thead>
<tr><td>count</td></tr>
</thead>
<tbody>
<tr data-id="24"><td>32</td></tr>
<tr data-id="52"><td>12</td></tr>
<tr data-id="42"><td>4</td></tr>
<tr data-id="84"><td>2</td></tr>
<tr data-id="12"><td>6</td></tr>
</tbody>
</table>
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,599,443 | 1,599,444 |
how to send data from front end android client to back end code java server in cloud computing through sockets
|
<p>Hello I am working on cloud computing project. I need to send 2 dimensional array from android client(front end) ,and this data is to be sent to server(java code back end). How we can send this through socket programming. What are the request response code related to send or receive data from sever to client and vise versa.</p>
|
java android
|
[1, 4]
|
144,360 | 144,361 |
hide validation error when an input receives focus
|
<p>Here is the code:
- here i've declared my variables:</p>
<pre><code> var first = $('#first');
var firstError = $('#firsterror'); // the errors are in span tags (if it matters)
// and so on...
first.blur(validateFirst);
last.blur(validateLast);
username.blur(validateUsername);
password.blur(validatePassword);
confpassword.blur(validateConfpassword);
month.blur(validateMonth);
day.blur(validateDay);
year.blur(validateYear);
gender.blur(validateGender);
$('#myForm').submit(function(){
if( validateFirst() & validateLast() & validateUsername() & validatePassword() & validateConfpassword() & validateMonth() & validateDay() & validateYear() & validateGender() ){
return true;
}else{
return false;
}
});
function validateFirst(){
if(first.val().length < 5){
first.addClass('error_input');
firstError.text('You left this empty!');
firstError.addClass('error');
return false;
}else{
first.removeClass('error_input');
firstError.text('');
return true;
}
};
// and so on... I would like the code to work as so: When an input recives focus the error should hide else the code should run exactly as it is.
</code></pre>
<p>thank you..</p>
|
javascript jquery
|
[3, 5]
|
1,316,701 | 1,316,702 |
setImageresource in android - how to use it for many pictures in a loop
|
<p>it is a rather simple question. I have 5 imageViews and 5 images in drawable folder. ImageViews are named <code>imageView1</code>...<code>imageView5</code> and images are named <code>image1</code>...<code>image5</code></p>
<p>I want how can I write the following elegantly:</p>
<pre><code> imageView1.setImageResource(R.drawable.image1)
imageView2.setImageResource(R.drawable.image2)
imageView3.setImageResource(R.drawable.image3)
imageView4.setImageResource(R.drawable.image4)
imageView5.setImageresource(R.drawable.image5)
</code></pre>
<p>As you understand, there are not just 5 imageViews, but there are many more and I want to write it in a loop. I am having problems because <code>R.drawable.imageX</code> is integer not string.</p>
|
java android
|
[1, 4]
|
2,437,405 | 2,437,406 |
jquery toggle from two triggers
|
<p>I have 2 check boxes that shows and displays some divs.</p>
<p>The first check box when toggled will show <strong>bank name and bank address</strong>. The second box when checked will show <strong>bank name and bank branch</strong>. </p>
<p>What I want to achieve is that: when both check boxes are checked, the user should see <strong>bank name, bank address and bank branch</strong> and obviously when both boxes are not checked, the user should see nothing.</p>
<p>I'm having problems getting the logic right for the toggle function as both checkbox will seek to toggle bank name on/off irregardless of its current state. Clicking on checkbox2 will remove <strong>bank name</strong> from being displayed which is not what I want.</p>
<p>I think I should be using some sort of global variable to help me keep track of it but I cant seem to get it to work. </p>
<p>My code here: <a href="http://jsfiddle.net/mJbbc/" rel="nofollow">http://jsfiddle.net/mJbbc/</a></p>
|
javascript jquery
|
[3, 5]
|
5,607,660 | 5,607,661 |
jQuery UI interfering with Show()
|
<p>I use the following code to collapse/show divs in my content page:</p>
<pre><code>$(document).ready(function() {
// Hookup event handlers and execute HTML DOM-related code
$('#nameHyperLink').click(function() {
var div = $('#nameDiv');
var link = $('#nameHyperLink');
if (div.css('display') == 'none') {
link.text('Hide Data');
div.show('100');
}
else {
link.text('Show Data');
div.hide('100');
}
});
});
</code></pre>
<p>When I include the jquery UI script file, this code no longer works. The text for the hyperlink changes, but the div is not actually displayed.</p>
<p>Why is this?</p>
|
asp.net jquery
|
[9, 5]
|
5,962,895 | 5,962,896 |
PHP equivalent of indexOf
|
<p>I have the following JS:</p>
<pre><code>if(window.location.href.indexOf("search.php") != -1
|| window.location.href.indexOf("list.php") != -1
|| window.location.href.indexOf("view.php") != -1
|| window.location.href.indexOf("contact.php") != -1) {
</code></pre>
<p>But want to convert it to PHP. What is the equivalent of indexOf in PHP or the best way to do this in PHP.</p>
<p><strong>I don't understand the strpos examples people are linking to below. Perhaps an example more in line with what I have done in JS?</strong></p>
|
php javascript
|
[2, 3]
|
5,950,552 | 5,950,553 |
HTML command-line-like text box
|
<p>I'm trying to make a text box that executes custom commands with custom syntax, it's for teaching children how to program, a simple example is that if the user wrote an ($) sign the program alerts a message (you are now writing a variable name), on the same text box if he added (!=) the alert says not equal, and so on.</p>
<p>Right now I'm doing it using jqyery keyup event, by running several regex tests and on each test the alert box alerts, I want to ask if there's a better approach to do this. is there a better one?</p>
|
javascript jquery
|
[3, 5]
|
3,221,145 | 3,221,146 |
Run function after mouse down for set time jQuery/JS
|
<p>Basically when you hold down any of the buttons with the class of <code>block_delete</code> for more than 1 second, the <code>OpenLoader()</code> should run. I googled and looked around on here and then made this, it kind of works:</p>
<pre><code>var functionDeleteBlockDia = function() {
$(".block_delete").mouseup(function (){
event.preventDefault();
});
$(".block_delete").mousedown(function (){
setTimeout(function(){
OpenLoader();
}, 1000);
});
}
</code></pre>
<p>The problem I'm having is that on mouseup the <code>OpenLoader();</code> dies, I tried to unbind mouseup even though there's no function attached to it, I tried to attach <code>event.preventDefault();</code> on it as you can see above, but it still didn't work. </p>
|
javascript jquery
|
[3, 5]
|
436,738 | 436,739 |
Getting mouse events to function on dynamically loaded elements
|
<p>I have a simple mouseover event that I am trying to work on elements that are loaded with ajax. For example I have a div that when you mouseover hide/show another div. When I load these divs through ajax they no longer work. For example :</p>
<pre><code><div class="block">
<div class="something">MOUSEOVER</div>
<div class="else" style="display: none" >HI</div>
</div>
$(document).ready(function(){
//using on hoping to catch the mouse events
$('.block').on('mouseenter',function(){
$(this).children('.else').fadeIn('fast');
});
$('.block').on('mouseleave',function(){
$(this).children('.else').fadeOut('fast');
});
});
</code></pre>
<p>This works fine straight up like <a href="http://jsfiddle.net/RwZWP/" rel="nofollow">this</a> : </p>
<p>But when I load those elements from another page :</p>
<pre><code>$j('#trigger').load( url + " .block");
</code></pre>
<p>The mouse events are no longer recognized. I thought this is what <code>live</code>, <code>on</code>, <code>delegate</code> were for. Can someone help me figure this out please.</p>
|
javascript jquery
|
[3, 5]
|
2,023,585 | 2,023,586 |
Accessing files stored in emulated storage
|
<p>I currently have an application that downloads files from a server and by default they are stored under /storage/emulated/0/ . I set it up so they download to a folder called "data". The files successfully download and unzip to /storage/emulated/0/data/unzipped , however, when I try to load an html file, stored under the data folder, into a webview, I get an error saying the file can't be found. I double checked the file path of the html file using Astro File Manager and was able to verify I have the right file path. Here is the statement I use to load the html file into the webview.</p>
<pre><code>wb.loadUrl(Environment.getExternalStorageDirectory()
+ "/data/unzipped/output.html");
</code></pre>
<p>I have tried it with and without the .html extension and still no luck. Any ideas? Are there are restrictions on accessing the emulated storage?</p>
|
java android
|
[1, 4]
|
4,141,277 | 4,141,278 |
Prevent ddl from triggering unsaved changes warning while still executing OnSelectedIndexChanged event
|
<p>I'm using this jquery code to detect unsaved changes and warn users before they navigate away.</p>
<pre><code> var _changesMade = false;
$(document).ready(function () {
$('form').bind($.browser.msie ? 'propertychange' : 'change', function () {
_changesMade = true;
});
$(window).bind('beforeunload', function () {
if (_changesMade)
return 'There are unsaved changes which will be lost if you continue.';
});
});
</code></pre>
<p>It works fine except on a page where I have a cascading dropdownlist. I added this code to the asp:DropDownList control</p>
<pre><code>onChange = "_changesMade=false; return false;"
</code></pre>
<p>and it stops the warning, but it also stops the OnSelectedIndexChanged server code from executing, so now the second drop down is not being populated with the correct data. How can I prevent the popup and still execute the server code when the dropdownlist is changed?</p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
754,764 | 754,765 |
hide or show large number of elements using jquery or javascript
|
<p>I have a situation in a web application, where based on certain conditions, I have to hide or show large number of div elements, numbers ranging from say <strong>500</strong> to <strong>98000</strong></p>
<p>.</p>
<p>What I am doing is I am applying a common class on all the div elements and then iterating the whole set of elements to check whether or not they are fitting in the circumstances and hence are shown or hide.</p>
<p>This logic works fine when the numbers are say in the range of <em>500</em> to <em>10000</em>, but above this range, it is taking quiet some good amount of time to display the result.</p>
<p>I am afraid for really large numbers, this logic may result in some browsers getting hanged.</p>
<p>So, what could be a better approach to handle the above mentioned situation, in most of the browsers </p>
|
javascript jquery
|
[3, 5]
|
3,314,953 | 3,314,954 |
Making smarter jQuery code
|
<p>I was wondering if anyone has any idea on how I could rewrite this simple jquery code to be more efficient. It's of course working fine now but I imagine adding say 10 more items would make the code really big. I thought maybe I could add the classes to arrays and use some kind of loop? Not sure if that's the right approach though.</p>
<p>Here it is on jsfiddle:
<a href="http://jsfiddle.net/QVS9X/42/" rel="nofollow">http://jsfiddle.net/QVS9X/42/</a></p>
<p>and here's a sample of it:
JS:</p>
<pre><code>$(".image1").mouseout(function() {
$(".default").show();
$(".cat1").hide();
}).mouseover(function() {
$(".default").hide();
$(".cat1").show();
});
$(".image2").mouseout(function() {
$(".default").show();
$(".cat2").hide();
}).mouseover(function() {
$(".default").hide();
$(".cat2").show();
});
</code></pre>
<p>HTML:</p>
<pre><code><div class="image1 image">
<p>Hover for cat 1</p>
</div>
<div class="image2 image">
<p>Hover for cat 2</p>
</div>
<div class="image3 image">
<p>Hover for cat 3</p>
</div>
<div class="default">
<p>Default Text</p>
</div>
<div id="cats">
<p class="cat1">Category 1 text</p>
<p class="cat2">Category 2 text</p>
<p class="cat3">Category 3 text</p>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
1,389,041 | 1,389,042 |
condition == between string and constant
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java">How do I compare strings in Java?</a> </p>
</blockquote>
<p>Someone can tell me why this condition</p>
<pre><code>if (lista.getString(0)=="username")
</code></pre>
<p>do not return true? I've used to try</p>
<pre><code>if (lista.getString(0)==lista.getString(0))
</code></pre>
<p>and dont work, and i have understand that is a language problem.</p>
|
java android
|
[1, 4]
|
5,097,117 | 5,097,118 |
Load Javascript for a widget Worpress
|
<p>I want to load a special Javascript File just when the widget is loaded in the sidebar. Where do I have to put my <code>wp_enqueue_script(...)</code> lines?</p>
<pre><code>class controller_widget extends WP_Widget {
function controller_widget() {
$this->color = "red";
$this->dir = plugin_dir_url(__FILE__);
$widget_ops = array('classname' => 'controller_widget', 'description' => __('Benutzerfreundlicher Controller zur eingrenzung von Objekten'));
$control_ops = array('width' => 350, 'height' => 400);
$this->WP_Widget('controller_widget', __('Controller'), $widget_ops, $control_ops);
// At the moment I load the code here, but I want to proof that it is just loaded when the widget really is shown in the sidebar.
}
}
function widget( $args, $instance ) {...}
}
</code></pre>
<p>Thank you!</p>
|
php javascript
|
[2, 3]
|
2,839,202 | 2,839,203 |
Restrict input field to two decimals with jQuery
|
<p>I have an input field which I want to restrict so that the user only can input a number with the maximum of two decimals. Want to do this using jQuery.</p>
<p>Could I use jQuery <strong>toFixed()</strong> function somehow?</p>
<p>Thanx!</p>
|
javascript jquery
|
[3, 5]
|
3,030,712 | 3,030,713 |
ImageView In TableLayout
|
<p>I want to add a ImageView in TableLayout. I do all things, but it isn't shown anything. How can I fix it?</p>
<p>This is my code:</p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.buddy_list);
TableLayout buddy_list_layout = (TableLayout)findViewById(R.id.buddy_list_layout);
TableRow tableRow = new TableRow(this);
TableLayout.LayoutParams layoutParams1 = new TableLayout.LayoutParams(
TableLayout.LayoutParams.FILL_PARENT,
50);
ImageView imageView = new ImageView(this);
imageView.setImageResource(R.drawable.troll_logo);
TableLayout.LayoutParams layoutParams2 = new TableLayout.LayoutParams(50, 50);
tableRow.addView(imageView, layoutParams2);
buddy_list_layout.addView(tableRow, layoutParams1);
} // end -> method -> onCreate
</code></pre>
|
java android
|
[1, 4]
|
3,573,056 | 3,573,057 |
creating simple cookies in asp.net c#
|
<p>My application needs to store cookies. When a user logs on I want to make sure that if the cookie does not exist create it and store value, but if it does modify it.</p>
<pre><code>if(cookieExist)
{
cookiename = "value";
}
else
{
create a new cookie
then store the value;
}
</code></pre>
<p>Thanks for any help</p>
|
c# asp.net
|
[0, 9]
|
232,270 | 232,271 |
Select every element of a ul li using jquery
|
<p>I have a menu in form of ul li, and I want to a add different css class to every child of the li.</p>
<p>Here is the javascript code:</p>
<pre><code>$("#menu").ready(function () {
$("#menu ul li").addClass("menu_background1");
});
</code></pre>
<p>css:</p>
<pre><code>.menu_background1 {
background:#FF0;
}
.menu_background2 {
background:#66C;
}
</code></pre>
<p>How should I select every child using jQuery? Every child should have different css class..</p>
|
javascript jquery
|
[3, 5]
|
3,891,190 | 3,891,191 |
jQuery children returns a boolean?
|
<p>I've come across this line and I can guess what it's doing but shouldn't there be a <code>length > 0</code> on the children or will it always return/can be used as a boolean?</p>
<p>Or does jQuery's children return a boolean, or is this person relying on the existence of the returned children?</p>
<pre><code>append(($(this).children()) ? '<div class="vAlignWrapper" style="overflow: hidden;">' + $(this).html() + '</div>' : '&nbsp;').
</code></pre>
<p>I'm trying to debug a large JS file and I'm trying to make sure each line does what its supposed to do.</p>
|
javascript jquery
|
[3, 5]
|
4,255,587 | 4,255,588 |
Beginning Android Programming - Building a short Quiz
|
<p>Okay, so I'm writing my first Android app and am basically stuck. The app is a short 4 question quiz with two choices per question. This creates 16 possible results, which I've created descriptions for. I want the app to display the description corresponding to the user's responses on each of the questions after the 4th question is answered. </p>
<p>Right now I am storing the values in a string, which is supposed to build upon the previous string answer, after each question. So the first answer is t1, the second answer is t2, and so on. Here is the code for the second question:</p>
<pre><code>public class Question2 extends Question1 implements OnClickListener
{
private Button b1;
private Button b2;
public String t2;
public TextView text2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.question2);
b1=(Button)findViewById(R.id.gamma);
b2=(Button)findViewById(R.id.delta);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
text2 = (TextView)findViewById(R.id.TextView02);
}
public void onClick(View v) {
Intent a = new Intent(this, Question3.class);
if(v == b1)
{
t2= t1+"gamma";
text2.setText(t2);
startActivity(a);
}
if(v == b2)
{
t2= t1+"delta";
text2.setText(t2);
startActivity(a);
}
}
}
</code></pre>
<p>My problem is that the strings won't hold the values I assign them in the previous question. I have a textview that briefly displays the values returned by the question's answer string (t2 for Question2) and it displays nullalpha or nullbeta, depending on the user's response. </p>
<p>How do I retain the t1's previously assigned value into Question2 so I can add to it? For instance, if t1 = "alpha" from Question1, and the user selects button b1 in Question2 how do I make t2 actually equal "alphagamma" instead of "nullgamma"? Is this even possible with strings?</p>
<p>Any answers and suggestions are much appreciated.</p>
|
java android
|
[1, 4]
|
5,195,003 | 5,195,004 |
using a div:title tag attribute instead of a:href attribute to toggle divs
|
<p>I have this script that uses an a:href attribute tag to swap divs out. I'd like to instead use a div tag with the title attribute.</p>
<p>Working code</p>
<pre><code>$(document).ready(function () {
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs2 ul li:first').addClass('active');
$('#tabs2 ul li a').click(function () {
$('#tabs2 ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).fadeIn(1000);
return false;
});
});
</code></pre>
<p>My attempt at using this with a div tag but is not working</p>
<pre><code><div id="tabs2">
<ul class="nav">
<li class="pc"><div class="tab-1" title="tab-1">text</div></li>
</ul>
</div>
</code></pre>
<pre><code>$(document).ready(function () {
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs2 ul li:first').addClass('active');
$('#tabs2 ul li div').click(function () {
$('#tabs2 ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('title');
$('#tabs div').hide();
$(currentTab).fadeIn(1000);
return false;
});
});
</code></pre>
<p>Not getting any errors but its not working for some reason. </p>
|
javascript jquery
|
[3, 5]
|
1,239,651 | 1,239,652 |
how can i get particular text using jquery
|
<p>how can i get only the cheque number(<code>AA12GH56</code>) not the other texts, here is my code:</p>
<p>HTML:</p>
<pre><code><p>your cheque number is :AA12GH56 <br /> your bank credit balance is :32,999</p>
</code></pre>
<p>Javascript:</p>
<pre><code>$(document).ready(function(){
$('p').click(function(){
var cheque_no=$(this).text();
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,889,304 | 3,889,305 |
Can i write Cocoa Touch[iPhone] applications in C++ language
|
<p>1) Can i write iPhone applications in pure C++ language, i know that we can use Objective-C++, i just want to know if we can also write it in pure C++ language.</p>
<p>2) while creating MAC OX application inXCode, we have an option to create C/C++ application, will the same options work for me to write iPhone applications?</p>
<p>Thank You</p>
|
iphone c++
|
[8, 6]
|
4,498,219 | 4,498,220 |
shim for the required attribute for IE9 users
|
<p>According to <a href="http://caniuse.com/#search=required" rel="nofollow">CanIuse</a>, the required attribute is not supported in IE9.
Is there a shim to provide the same functionality as the native required attribute if the browser doesn't support it?</p>
|
javascript jquery
|
[3, 5]
|
5,842,361 | 5,842,362 |
Android App Dev (Beginner)
|
<p>My question is in two parts, I guess that makes it two questions :-).</p>
<p>I have a strong interest in beginning to develop Android applications. I have some knowledge of programming HTML and CSS but no other languages. My research has yielded many folks indicating knowledge of Java is a must-have in order to develop complex apps. </p>
<p>My first question is: should I start with learning Java or use a Java book as a reference guide? If learning Java is the way I should go (I am not looking to shortcut this process) what books can you recommend that would provide exercises to assist?</p>
<p>Any advice is much appreciated. Thanks in advance.</p>
|
java android
|
[1, 4]
|
301,202 | 301,203 |
Prevent AlertDialog from closing
|
<p>I have a custom AlertDialog with a bunch of checkboxes. I want to prevent the AlertDialog from closing if none of the checkboxes are selected. Is this possible?</p>
<p>I know I can close momentarily and re-open it, but I would rather not do this as I have some code within the setPositiveButton which I do not want to repeat. </p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
3,341,310 | 3,341,311 |
Best way to write a polling capable application
|
<p>I'm trying to build a basic application which will have 2 separate components which are:<br>
1. Continually poll an external process and store the results within a DB<br>
2. Grab the results from the DB and display it in a webpage</p>
<p>I'm looking to do this in .Net so I would normally say to do the first component in a Windows Service and the second in ASP.net with a relational dbms like sql server.</p>
<p>The problem with this is that i want to use webhosting to deploy this and they don't tend to allow Windows Services (unless you pay a fortune). So is it feasible to do the polling component in a seperate asp.net page, or maybe create a spawning worker thread within a single asp.net page that will do the polling for me?</p>
<p>Any opinions/input appreciated.<br>
Thanks :)</p>
|
c# asp.net
|
[0, 9]
|
2,033,316 | 2,033,317 |
How do I make jQuery modify only one div, instead of all divs of the same class?
|
<p>Each page of my site has 10 (almost) identical divs, varying only in the text within. When a certain part of a div is clicked, I want a different part of that div to be modified.</p>
<p>I'm using this code:</p>
<pre><code>$(document).ready(function(){
$(".notLogged img").mouseover(function(){
$(this).parent()>$("span").html("You must be logged in to vote.");
})
})
</code></pre>
<p>I thought this would work as follows: For all <code>img</code> elements within a "notLogged" classed div, a mouseover would cause a different part of that div to change.</p>
<p>However, that's not what happens. Whenever that mouseover event is triggered, <em>all</em> divs with the "notLogged" class are modified.</p>
<p><strong>How can I modify this code so only the div in which the mouseover originated is modified?</strong></p>
|
javascript jquery
|
[3, 5]
|
1,563,664 | 1,563,665 |
Coversion from datetime of format "01 Oct 2012 23:59:59:000" to "01-10-2012 23:59:59" in C#
|
<p>My database contains the "From Date" in the form <strong>"2012-10-01 23:59:59.000"</strong> while taking the value to front end its comming as <strong>"01 Oct 2012 23:59:59:000"</strong>. So how can i get the date without "Oct" format. </p>
<p>I tried this also</p>
<pre><code> foreach (DataRow dr in _dt.Rows)
{
dr["FromDt"] = String.Format("{0:dd-MM-yyyy hh:mm tt zzz}", dr["FromDt"]);
dr["ToDt"] = String.Format("{0:dd-MM-yyyy}", dr["ToDt"]);
}
</code></pre>
<p>But Couldn't..</p>
<p>I refered all those quires iin stackoverflow to my best knowledge. Please sugest some ways.
Thanks in advance</p>
<p>I Used these following trils also-</p>
<pre><code> DateTime dt = DateTime.Parse(dr["FromDt"].ToString());
dr["FromDt"] = String.Format("{0:dd-MM-yyyy hh:mm tt zzz}", dr["FromDt"]);
</code></pre>
|
c# asp.net
|
[0, 9]
|
5,819,969 | 5,819,970 |
Making a control visible on a seperate page, but not visible on the page which contains the control
|
<p>I have a masterpage (which we will call 'default'). This contains a second page (web user control) - 'second'. And finally a third 'print' page. The 'print' page is also a web user control, however, it merely has a placeholder that contains the 'second' page.</p>
<p>Is there a way I can add a control to the 'second' page - such as a literal, and only have it visible on the 'print' page? </p>
|
c# asp.net
|
[0, 9]
|
5,599,518 | 5,599,519 |
JQuery: get radio button value
|
<p>I have the following HTML:</p>
<p>HTML:</p>
<pre><code><input type="radio" name="abc" value="0" selected="selected" style="display:none" />
<input type="radio" name="abc" value="1" />1+
<input type="radio" name="abc" value="2" />2+
<input type="radio" name="abc" value="3" />3+
</code></pre>
<p>JQuery to get the selected radio button</p>
<pre><code>$('input:radio[name=abc]:checked').val();
</code></pre>
<p>Why doesn't the code above work on page load, BEFORE a user selected a radio button? It's strange because the code above does work AFTER a user selected a radio button.</p>
<p>It seems to me that I have set the default radio button value to be <code>0</code>, but if you</p>
<p>Meaning, if the radio button value is selected, return the selected value - otherwise, return 0 (when no value has been selected)</p>
|
javascript jquery
|
[3, 5]
|
950,484 | 950,485 |
How to rotate menu 180 degrees android
|
<p>Okay so I am developing an app that will have to players playing against each other. The two players will be opposite each other so I want to be able to the rotate the activity 180 degrees when it is one of the players moves. So far I have been able to do it by overriding any views onDraw() method and applying the rotation there. So I want to have a menu that is possible to rotate by 180 degrees depending on the which players move it is. So how would I rotate the menu by 180 degrees.</p>
|
java android
|
[1, 4]
|
4,864,554 | 4,864,555 |
Overflow menu entries with icon?
|
<p>If I click on the "overflow" action bar icon, I only see my menu items as text, but the icon is not displayed!
Is this the default behaviour? How can I force showing the icon?</p>
<p>If you look at <a href="http://developer.android.com/design/patterns/actionbar.html" rel="nofollow">http://developer.android.com/design/patterns/actionbar.html</a> > "Sharing data" image, it at least seems to be possible to have icons there. But how?</p>
|
java android
|
[1, 4]
|
3,313,934 | 3,313,935 |
setOnClickListener(new OnClickListener(){})
|
<pre><code>package android.example;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class Android_eg1 extends Activity {
Button bt;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
bt=(Button)findViewById(R.id.click);
bt.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "You made a mess", Toast.LENGTH_LONG).show();
}
});
} //onCreate()
}//class
</code></pre>
<p>I am new to java and I know basics of core java.
This is the sample program i tried to know about the event handling through a button class.
I could not understand this part :</p>
<pre><code>"bt.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "You made a mess", Toast.LENGTH_LONG).show();
}
});"
</code></pre>
<p>Inside the setOnClickListener(parameter) why are they giving a function definition?(public void onClick(View v) })</p>
<p>Is this acceptable?</p>
|
java android
|
[1, 4]
|
2,089,828 | 2,089,829 |
Javascript -- Attach events in loop
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8909652/adding-click-event-listeners-in-loop">adding ‘click’ event listeners in loop</a> </p>
</blockquote>
<p>I make a demo.So let's see the HTML first.</p>
<pre><code><a href="#" id="testA">testA</a>
<a href="#" id="testB">testB</a>
<div id="showA">showA</div>
<div id="showB">showB</div>
</code></pre>
<p>And i want to bind <code>click</code> events to Elements <code>a</code> . and when it clicks, <code>alert</code> the related <code>div</code>. (click <code>id="testA"</code>,alert <code>id="showA"</code> ...)</p>
<p>And i write the jQuery code.</p>
<pre><code>var arr = ["A","B"];
for(var i=0;i<arr.length;i++){
$("#test"+arr[i]).click(function(){
alert($("#show"+arr[i]).text())
});
}
</code></pre>
<p>But it doesn't work. I debug this code and find that this code <code>alert($("#show"+arr[i]).text())</code></p>
<p>only run when I click the <code>a</code> element . and when I click <code>a</code> . the variable <code>i</code> is <code>3</code> already.</p>
<p>So what should I do?</p>
|
javascript jquery
|
[3, 5]
|
4,741,418 | 4,741,419 |
How to get all CSS classes of an element?
|
<p>I have an element with multiple classes and I'd like to get its css classes in an array. How would I do this? Something like this:</p>
<pre><code>var classList = $(this).allTheClasses();
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,737,364 | 2,737,365 |
jquery history of input select (easy)
|
<p>I have an input field called email class keyup-an. I validate it easy with this, but it works or when an individual inputs the field manually. How do i make it work also for selecting historical data. when you click email and yesterday you put [email protected], the history list drops down and you can select it, but its not a keyup. </p>
<p>I TRIED the same function after but with .change or .click and it didnt work. Can you guys please suggest?VALID</p>
<pre><code>$('.keyup-an').keyup(function() {
$('span.error-keyup-1').hide();
var inputVal = $(this).val();
var numericReg = /^[a-zA-Z0-9_ ]{2,30}$/;
if(!numericReg.test(inputVal)) {
$(this).css('background', '#FAC3C3');
$(this).after('<span class="error error-keyup-1">Validationfail</span>');
}
else {
$(this).css('background', 'lightgreen');
}
});
</code></pre>
<p><img src="http://i.stack.imgur.com/Uq4pN.png" alt="jquery history"></p>
|
javascript jquery
|
[3, 5]
|
3,396,887 | 3,396,888 |
calculate difference between two double values exactly
|
<p>I want to calculate the difference between two double values</p>
<p>for example : lat1=12.2345673 and lat2=12.2345672 . here i want result as 0.0000001. this much exactly i am not getting while calculate double res=Double.compare(lat1,lat2) in eclipse. it showing 0.0.
Please specify the exact formula to overcome this</p>
|
java android
|
[1, 4]
|
1,495,786 | 1,495,787 |
Why use .on() for adding event instead of directly adding event?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/8601482/jquery-on-vs-click-methods">jquery on vs click methods</a> </p>
</blockquote>
<p>From API:</p>
<p>.on() : Attach an event handler function for one or more events to the selected elements.</p>
<p>Example code:</p>
<pre><code>$("#dataTable tbody tr").on("click", function(event){
alert($(this).text());
});
</code></pre>
<p>We can just write something like: </p>
<pre><code>$("#dataTable tbody tr").click(function() {
alert($this).text();
});
</code></pre>
<p>Why bother wrapping the event inside .on() ? </p>
<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.