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 |
---|---|---|---|---|---|
5,293,583 | 5,293,584 | What's the difference between these two approaches to class initialization? | <p>I'm new to Android. Can someone explain the difference between these two approaches to class initialization?</p>
<pre><code>jamba = new JambaApplication();
jamba = (JambaApplication) getApplication();
</code></pre>
| java android | [1, 4] |
4,196,603 | 4,196,604 | Delete old divs if there are more than 20 | jQuery | <p>I need some help with my jQuery script.
I have a page that refreshes every 10 seconds and new divs from a feed are getting appended at.</p>
<p>My script counts the divs and removes the last div when there are more than 20 divs. This works fine if the feed just appends 1 div at a time. But the feed can also append multiply divs at the same time. When this happens the count can exceed the max of 20 divs. The problem with this is that my script just deletes 1 div and not all the divs that exceed the 20 count.</p>
<p>This is my code:</p>
<pre><code>var $auto_refresh = setInterval(function () {
var $articleCount = $('div').length;
if ($articleCount > 20) {
$('div:last-child').remove();
}
$autoUpdate();
}, 10000); // refresh every 10000 milliseconds for new items
</code></pre>
<p>I need to remove all extra divs so there are always 20 divs. I hope someone can help me out with this.</p>
| javascript jquery | [3, 5] |
5,387,944 | 5,387,945 | JQuery - How to change individual letters of the text on hover | <p>I'm trying to search a way how to make a function to change individual letters of the text on mouseover/hover and then changing it back when the mouse is off. </p>
<p>I have found a lot of ways how to do it in general and easy way, but I'm trying to do it in a <strong>NICE and FLUID</strong> way. Something like <strong>fluidly "fliping" the letter</strong> to another and then fliping back or something like this. I think you know what I mean.Is there a way to do it in jQuery ?</p>
<p>Thank you very much.</p>
| javascript jquery | [3, 5] |
4,158,092 | 4,158,093 | How to make Android emulator boot faster | <p>I'm currently stuck with using Atom CPU desktop for my Android app development. What are the ways to improve its boot time. When running the emulator I can see that the number of cores used by the emulator is just one, I'm running the emulator from within the Eclipse ADT plugin. </p>
<ul>
<li>How can I make the emulator use two cores instead of just one?</li>
<li>What are the emulator setting that will make boot faster?</li>
</ul>
<p>My android project will be mainly a PhoneGap + jQuery android app.</p>
| java android | [1, 4] |
171,497 | 171,498 | <asp:Button> not work properly : the action effect not run every once i press the button with my simple search? | <p>I have long table with a lot of cells
i make simple to find the specific cell and make it's background yellow like highlighting
The code is ok but when i press the search button once go to the searched cell and once after 2 times go to the searched cell .. i don't know what affect on the button action </p>
<p>the code is long i was hope to attach it but i will cope it here in the following: </p>
<p>// <strong><em>*</em>****</strong> my asp
<a href="http://www.mediafire.com/file/hsgvjgv838gffq5/Compaines.aspx" rel="nofollow">http://www.mediafire.com/file/hsgvjgv838gffq5/Compaines.aspx</a></p>
<p>// <strong><em>*</em>****</strong> the c# file
<a href="http://www.mediafire.com/file/w980kd4desbaxd7/Compaines.aspx.cs" rel="nofollow">http://www.mediafire.com/file/w980kd4desbaxd7/Compaines.aspx.cs</a></p>
<p>I hope any one can solve give me why that happen </p>
| c# asp.net | [0, 9] |
3,230,444 | 3,230,445 | Showing more text with jquery | <p>I am looking for a way to show more or less text. I want to show 600 characters by default and if show more is clicked it will show 600 more characters and then if clicked again shows 600 more until there are no more characters. I also would like a show less button to collapse the text back to its default 600 characters. I have pages with 5000+ words and this would make reading much easier and make it look nicer. Right now I am using this to show the first 600 chars and when show more is clicked it expands all the way.</p>
<pre><code>$(document).ready(function() {
var showChar = 600;
var ellipsestext = "...";
var moretext = "View more";
var lesstext = "View less";
$('.more').each(function() {
var content = $(this).html();
if(content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar-1, content.length - showChar);
var html = c + '<span class="moreelipses">'+ellipsestext+'</span>&nbsp;<span class="morecontent"><span>' + h + '&nbsp;&nbsp;</span><a rel="nofollow" href="" class="morelink">'+moretext+'</a></span>';
$(this).html(html);
}
});
$(".morelink").click(function(){
if($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});
</code></pre>
<p>Could somebody please edit this code to work like this or help me to achieve this any other way? I would really like to make my pages more presentable and readable and this would definitely do the trick. Thanks.</p>
| javascript jquery | [3, 5] |
4,780,600 | 4,780,601 | Basic Javascript: onclick event not working | <p>Given this simple javascript function:</p>
<pre><code>function update_cart() {
alert("--update--");
document.form1.command.value="update";
document.form1.submit();
}
</code></pre>
<p>and this button at the bottom of my form:</p>
<pre><code><input type="submit" value="Update" onclick="update_cart()" />
</code></pre>
<p>The data in the form is 'submitted' to the new URL. but the update_cart function is never called. I know because I never get an alert box, and the URL reads...?c=Albania&m=.... </p>
<p>Also, the form element</p>
<pre><code><input type="hidden" name="command"/>
</code></pre>
<p>does not get posted to the URL, either. URL reads ?command=&c=Albania...</p>
<p>I have tried the following: changed onclick to onsubmit, checking $_REQUEST variables, cutting and pasting the code from known working pages.</p>
<p>I'm at my wit's end, and would be grateful for any help!</p>
<p>Oh, yes: same behaviour in firefox 6, Opera 11.5, & IE7. I'm running WinXP SP3. </p>
<p>Thanking you,
Sadhu!</p>
| php javascript | [2, 3] |
4,749,843 | 4,749,844 | How to populate the TableLayout with ImageView dynamically in android jdk? | <p>I've a <code>TableLayout</code> element in my <code>main.xml</code>:</p>
<pre><code><TableLayout android:id="@+id/TableLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content"></TableLayout>
</code></pre>
<p>I don't want to hardcode the <code>ImageView</code> in <code>main.xml</code>.</p>
<p>How to embed the <code>ImageView</code> in <code>.java</code> ?</p>
| java android | [1, 4] |
5,523,319 | 5,523,320 | How do you randomly generate X amount of numbers, between the range of Y and Z in JavaScript? | <p>For example I would like to generate 5 <strong>unique</strong> numbers between 1 & 10. The results should be 5 numbers from 1 to 10(for example 2 3 4 8 10).</p>
| javascript jquery | [3, 5] |
556,812 | 556,813 | start a jquery function over | <p>Is it possible to start a function over, based on an <code>if</code> statement, in JQuery or Javascript? Something like how <code>return functionname();</code> is to PHP?</p>
<p>For example</p>
<pre><code>function awesomestuff {
//do stuff;
//do stuff;
if(x == 1) { //start function over }
//do stuff;
//do stuff;
}
</code></pre>
<p>I imagine this can be accomplished with an <code>if/else</code> statement, but if the function gets pretty big, it can get pretty messy. </p>
| javascript jquery | [3, 5] |
578,306 | 578,307 | Create an online directory for the contact application | <p>I'd like to create an online directory like the Facebook or Company LDAP ones.</p>
<p>I didn't find any documentation on the Android Developer website or here on Stack Overflow. Is this a private API ? I found <a href="https://market.android.com/details?id=fr.prados.contacts" rel="nofollow">an application which does that</a> on the market so I guess it is possible.</p>
<p>Any information would help.</p>
| java android | [1, 4] |
5,806,309 | 5,806,310 | Global javascript function | <p>I have a method which detects broken links with a .imageclass class like so:</p>
<pre><code>$('.imageclass').one('error', function() {
alert('broke');
});
</code></pre>
<p>That I want to be used in several files.<br> How would I go about doing this?<br>
I've tried using a separate js file with:</p>
<pre><code>function checkErrors(){
$('.imageclass').one('error', function() {
alert('broke');
});
}
</code></pre>
<p>and then calling this on each of the files:</p>
<pre><code>$(document).ready(function() {
checkErrors();
});
</code></pre>
<p>But it doesn't seem to work. <br>
The method is called however there is no alert when it spots a broken link. <br>
If I use:</p>
<pre><code>$(document).ready(function() {
$('.imageclass').one('error', function() {
alert('broke');
});
});
</code></pre>
<p>The alert occurs.</p>
| javascript jquery | [3, 5] |
5,677,834 | 5,677,835 | overwrite the preventDefault() in another method | <p>I have a this call</p>
<pre><code><a onclick="facebookLogin();" class="facebook_btn_homepage" href="/signup">
<img src="/images/facebook_btn2.png?1280194712" alt="Facebook_btn2"></a>
$('.facebook_btn_homepage').click(function(event){
event.preventDefault();
});
</code></pre>
<p>but in the function facebookLogin() i want to overwrite the </p>
<pre><code> function facebookLogin() {
FB.login(function(response) {
//i want to overwrite the preventDefault and go to another
//page because its trying to go to another url and the preventDefault
//is stopping the page from going to another url
</code></pre>
| javascript jquery | [3, 5] |
4,066,363 | 4,066,364 | how to wait until Array is filled (asynchronous) | <p>I have an array which is filled asynchronous and contains 28 items. I want to wait until the array is filled with all items.</p>
<pre><code>function checkIfFinished(){
return(Results.length >= 28);
}
var isfinished = false;
while(isfinished){
if(checkIfFinished()){
returnResults();
isfinished = true;
}
else
//Wait 100ms
}
</code></pre>
<p>Well, but in Javascript there is no wait function! I tried it with setTimeout, but I don't know how to insert it... I just get errors with too much recursion and stuff :D</p>
<p>Thank you!</p>
| javascript jquery | [3, 5] |
1,829,344 | 1,829,345 | What is the difference between “this”, “$this” and “$(this)”? | <p>What is the difference between these three forms:</p>
<pre><code>this
$this
$(this)
</code></pre>
| javascript jquery | [3, 5] |
72,223 | 72,224 | Syncing Android and Server | <p>I don't know what this is called, but it is something like syncing android application and a Web server. Examples are RSS Feeds and Weather Forecast</p>
<p>Does anyone know the concept behind developing application? I mean how do you sync the Android phone with a web server. Is there any programming needed in the server side and the client side(Android)</p>
<p>Are there any programming books that tackles this subject? Thanks.</p>
| java android | [1, 4] |
3,158,724 | 3,158,725 | Wrapping an Element using Pure JavaScript ! | <p>I have a series of <code>div</code> tags on my page & I want to wrap them all into a container. </p>
<pre><code><div class = "c" >blah blah </div>
<div class = "c" >blah blah </div>
<div class = "c" >blah blah </div>
</code></pre>
<p>I want to wrap all the above tags into a container as follows</p>
<pre><code><div class="container" >
<div class = "c" >blah blah </div>
<div class = "c" >blah blah </div>
<div class = "c" >blah blah </div>
</div>
</code></pre>
<p>I can do it using jQuery, I want learn how this is done in Pure Javascript ( I mean without any library or framework )
.
Can someone share the code to warp elements in javascript. </p>
<p>Thank you !!</p>
| javascript jquery | [3, 5] |
1,651,512 | 1,651,513 | HTMLEditor (From AJAXToolkit) Check if content is empty | <p>I have an HTMLEditor in my aspx file with id = "txtText"</p>
<p>I am trying to write a JQuery function which checks if the content of the editor is empty.</p>
<p>I originally had:</p>
<pre><code>function check()
{
if($('#txtText').val() == '')
{
return false;
}
return true
}
</code></pre>
<p>However when I added an alert box to find out why this doesn't work. I realized that the .val() property of the HTMLEditor is always undefined (whether the editor has text or has no text).</p>
<p>I tried using $('#txtText').content(), which is how I am accessing the data in the code-behind(C#), but that does not seem to work in JQUERY.</p>
<p>After doing some research I found this site: <a href="http://forums.asp.net/t/1549543.aspx/1" rel="nofollow">http://forums.asp.net/t/1549543.aspx/1</a></p>
<p>I have very smiliar code, such that I also made my own custom editor which inherits from the one in AJAXToolkitEditor.</p>
<pre><code><cc1:CustomEditor ID="txtEditor" Height="600px" runat="server" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Button ID="Button1" OnClientClick="getImageContent()"
runat="server" Text="Button" OnClick="saveContent" />
<asp:HiddenField ID="HiddenField1" runat="server" />
</code></pre>
<p>The posted code does not work for me:</p>
<pre><code>function getImageContent() {
var editor = $find("txtEditor");
var editPanel = editor.get_editPanel();
var designPanel = editPanel.get_modePanels()[0];
var s = designPanel.get_content();
document.getElementById("HiddenField1").value = s;
</code></pre>
<p>}</p>
<p>The line var editor = $find("txtEditor") is a null value.</p>
| jquery asp.net | [5, 9] |
918,854 | 918,855 | Javascript Call PHP in Sister Folder | <p>I have the following tree:</p>
<pre><code>root
-js_src
-php_src
-images
</code></pre>
<p>Now, how do i reliably call the PHP files from the Javascript? The PHPs are located in the <code>php_src</code> folder while the javascript is in the <code>js_src</code> folder.</p>
| php javascript | [2, 3] |
5,627,571 | 5,627,572 | Get culture based on language | <p>How can I get culture based on language ?
For example if I will pass language = CHS it will retrieve zh-CN based on National Language Support (NLS) API Reference: <a href="http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/goglobal/bb896001.aspx</a></p>
<p>I belive .Net framework should provide us with method that support that .</p>
<p>your responce will be highly appreciated !</p>
| c# asp.net | [0, 9] |
1,019,999 | 1,020,000 | How can I insert my own JavaScript into page? | <p>I'm using Internet Explorer as the default browser. (Firefox is not an option). </p>
<p>There are some web apps that I like but whose layout and workflow does not quite agree with me. </p>
<p>Given that I am merely a visitor to the website, is it possible to insert <a href="http://jquery.com/" rel="nofollow">jQuery</a> into the webpages I'm browsing so that I can re-arrange the web content and call the javascript functions included? Sort of like using jQuery as a scripting language for IE?</p>
| javascript jquery | [3, 5] |
695,998 | 695,999 | Trying to understand this code (pub/sub library) | <p>This is Peter Higgins's pub sub library: <a href="https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js" rel="nofollow">https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js</a></p>
<pre><code>(function (d) {
var cache = {};
d.publish = function (topic, args) {
cache[topic] && d.each(cache[topic], function () {
this.apply(d, args || []);
});
};
d.subscribe = function (topic, callback) {
if (!cache[topic]) {
cache[topic] = [];
}
cache[topic].push(callback);
return [topic, callback];
};
d.unsubscribe = function (handle) {
var t = handle[0];
cache[t] && d.each(cache[t], function (idx) {
if (this == handle[1]) {
cache[t].splice(idx, 1);
}
});
};
})(jQuery);
</code></pre>
<p>I don't understand the logic and the functionality of <code>publish</code>:</p>
<pre><code>cache[topic] && d.each(cache[topic], function () {
**this.apply(d, args || []);** //what is happening here?
});
</code></pre>
<p>What is the purpose of this part? except the fact that it publishes the event</p>
| javascript jquery | [3, 5] |
3,180,605 | 3,180,606 | Combine relative baseUri with relative path | <p>I'm looking for a clean way to combine a relative base Uri with another relative path. I've tried the following, but <code>Uri(Uri, string)</code> and <code>UriBuilder(Uri)</code> require absolute Uris (throwing InvalidOperationException: This operation is not supported for a relative URI).</p>
<pre><code>// where Settings.Default.ImagesPath is "~/path/to/images"
// attempt 1
_imagePath = new Uri(Settings.Default.ImagesPath, image);
// attempt 2
UriBuilder uriBuilder = new UriBuilder(Settings.Default.ImagesPath);
uriBuilder.Path += image;
_imagePath = uriBuilder.Uri;
</code></pre>
<p>I don't want to do any ugly string manipulation to make sure the base path ends with a trailing slash, etc.</p>
| c# asp.net | [0, 9] |
1,192,577 | 1,192,578 | Android error when trying to connect to database using php | <p>Hi Guys i am trying to get city names from datbase using android php and mysql but code is not working,here is my code</p>
<p>pleas help me</p>
<p>this is the server side code</p>
<pre><code>PHP SERVER CODE
<?php
mysql_connect("HOST","USER","PASSWORD");
mysql_select_db("DATABASE");
$sql=mysql_query("select * from CITY");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
print(json_encode($output));
mysql_close();
?>
here i am trying to fetch the mysql table results
ANDROID CODE
try{
JSONArray jArray = new JSONArray(result);
JSONObject json_data=null;
for(int i=0;i<jArray.length();i++){
json_data = jArray.getJSONObject(i);
ct_id=json_data.getInt("CITY_ID");
ct_name=json_data.getString("CITY_NAME");
}
}
catch(JSONException e1){
Toast.makeText(getBaseContext(), "No City Found" ,Toast.LENGTH_LONG).show();
} catch (ParseException e1) {
e1.printStackTrace();
}
</code></pre>
| php android | [2, 4] |
3,251,779 | 3,251,780 | javascript function is not invoked at the first time onclick | <p>I have a following code:</p>
<pre><code>$this->content->text .=
'<div id="gv_block_div">
<a href="javascript:void(0)" onclick="pop('.htmlspecialchars($jsonObject).', \''.$root.'\', '.$userid.')">Click Here</a>
</div>';
return $this->content;
</code></pre>
<p>When I login and click "Click Here" the onclick event doesn't trigger. It works at the second click. However, after that (before logging out), single click works just fine.</p>
<p>What should be the potential problem? </p>
| php javascript | [2, 3] |
1,577,196 | 1,577,197 | How to load Jquery.js if not already loaded ? | <p>I need to check if I need to load JQuery OR it is already loaded by another page !? </p>
<p>How can I check this on client side ?
I want to have something like this:</p>
<pre><code><script >
if jquery-1.6.2.js isExist then
{return}
else // somehow
load (<script src="../js/jq/jquery-1.6.2.js"></script> )
</script>
</code></pre>
| javascript jquery | [3, 5] |
117,980 | 117,981 | Access method in class library | <p>I've moved a class in my project into a class Library in the same solution. I've added a reference in the web project to the class library.</p>
<p>How do I access the methods in the class library?</p>
| c# asp.net | [0, 9] |
2,506,869 | 2,506,870 | 500 internal server error in joomla ckeditor | <p>First of all thanks.</p>
<p>I have installed ckeditor in my joomla and it's working fine, except the uploading section. I got an error message
" 500 internal server errors
The request was not completed. The server met an unexpected condition.</p>
<pre><code>mydomain/plugins/editors/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&CKEditor=text&CKEditorFuncNum=1&langCode=en (port 80)
</code></pre>
<p>"
while I am trying to upload a document. Also get this error message in the image uploading section. Does any one have an idea?</p>
| php javascript | [2, 3] |
4,169,472 | 4,169,473 | javascript regex pattern with a variable string not working | <p>I am trying to create a function that will pass some parameters to a regex script:</p>
<pre><code>function classAttributes( classString, className ) {
var data;
var regex = new RegExp(className+"\[(.*?)\]");
var matches = classString.match(regex);
if ( matches ) {
//matches[1] refers to options inside [] "required, email, ..."
var spec = matches[1].split(/,\s*/);
if ( spec.length > 0 ) {
data = spec;
}
}
return data;
}
</code></pre>
<p>but for some reason it doesnt like the string variable that I pass it "new RegExp(className+"[(.*?)]");"
it doesnt throw an error but the validation doesnt work.</p>
<p>Edit:
I will take the information from the class stribute and pass it as classString</p>
<pre><code><div class="field-character-count test[asd, 123, hello]"></div>
</code></pre>
<p>and the "className" will represent "test"</p>
| javascript jquery | [3, 5] |
971,165 | 971,166 | Javascript for loop error | <p>This is what I have:</p>
<pre><code>function get_bad_changelist_authors() {
var changelistAuthorDivs = $('div.bad_changelist_author');
var changelistAuthors = [];
for (var div in changelistAuthorDivs) {
changelistAuthors.push($(changelistAuthorDivs[div]).text());
}
return changelistAuthors;
}
</code></pre>
<p>changeListAuthorDivs has n elements but for some reason it iterates n+1 times and initialized div to a string (ie. the string "length") on the last iteration. On the last iteration is where this loop has its error.</p>
| javascript jquery | [3, 5] |
1,875,039 | 1,875,040 | What is the best way to generate html code after receiving json data from an ajax request using a template library? | <p>I am doing something like this, but its a bit pain to style. Is there any other way like using templates? </p>
<pre><code> <div id="resultpanel"></div>
<script>
function parseData(jsonresults){
var results = JSON.parse(jsonresults);
jQuery("#resultpanel").empty();
for(var i=0;i<results.length;i++){
var divph = document.createElement("div");
var img = document.createElement("img");
var p = document.createElement("p");
img.src=results[i].logoname;
p.innerHTML=results[i].perigrafh;
jQuery(divph).append(img);
jQuery(divph).append(p);
jQuery("#resultpanel").append(divph);
}
}
</script>
</code></pre>
<p>Thank you </p>
| javascript jquery | [3, 5] |
4,761,839 | 4,761,840 | Android: Make list navigation callback fire on selection of the same list item | <p>I am currently using a list menu in my action bar with code as follows:</p>
<pre><code>Context context = getSupportActionBar().getThemedContext();
ArrayAdapter<CharSequence> list = ArrayAdapter.createFromResource(context, R.array.locations, R.layout.sherlock_spinner_item);
list.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
getSupportActionBar().setListNavigationCallbacks(list, this);
}
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
// When menu item is selected and is different from currently selected menu item
}
</code></pre>
<p>Right now the callback is only fired if the menu item selected is different from the currently selected item. How can I make it fire even if the newly selected menu item is the same?</p>
| java android | [1, 4] |
3,841,804 | 3,841,805 | jQuery change button attributes | <p>I have a button like this:</p>
<pre><code><input type="button" name="btn" id="btn" value="Proceed"/>
</code></pre>
<p>After all processes and get the expected result, I need to apply some changes on this button.</p>
<ol>
<li>Change the value of this button.</li>
<li>Add something to direct the current page to another one.</li>
</ol>
<p>I know I can do the first goal using the code below:</p>
<pre><code>$('#btn').attr('value','newValue');
</code></pre>
<p>But for the second one, I need something like our previous codes in JavaScript as below:</p>
<pre><code>onclick="window.location.href='newPage.htm'";
</code></pre>
<p>Help me please.</p>
| javascript jquery | [3, 5] |
2,532,401 | 2,532,402 | How can I access the lock-screen's owner-information of an Android device? | <p>I have CyanogenMod installed on my phone in one of the settings menus, it allows me to set some owner information that is displayed on the Lockscreen. Here's a screenshot:</p>
<p><img src="http://i.stack.imgur.com/5fVuP.jpg" alt="enter image description here"></p>
<p>I've seen a lot of questions regarding this but they all seem to confuse the owner information as the "Me" contact on ICS and JB devices. I'm referring to the owner-information as configured in the settings.</p>
<p>Is there a way I can access this information?</p>
<p>Thanks</p>
| java android | [1, 4] |
2,789,351 | 2,789,352 | Check if object is a jQuery object | <p>Is there a fast way of checking if an object is a jQuery object or a native javascript object?</p>
<p>example:</p>
<pre><code>var o = {};
var e = $('#element');
function doStuff(o) {
if (o.selector) {
console.log('object is jQuery');
}
}
doStuff(o);
doStuff(e);
</code></pre>
<p>obviously, the code above works but it's not safe. You could potentially add a selector key to the <code>o</code> and get the same result. Is ther a better way of making sure that the object actually is a jQuery object?</p>
<p>Something in the line of <code>(typeof obj == 'jquery')</code></p>
| javascript jquery | [3, 5] |
1,203,223 | 1,203,224 | jQuery and JavaScript | <p>Is it necessary to learn JavaScript before jQuery?</p>
| javascript jquery | [3, 5] |
935,490 | 935,491 | How exchange data between each page in ASP.NET and C# | <p>I'm new to ASP.NET and C# and I want to create simple webapp. How can I exchange data from a form between different webpage? Like for example, I'm inputing a data in a form from my page1.aspx, then I want to go to a different page, like page2.aspx, then I want to click the back link button to go to the page1.aspx but my data is still save in the form.</p>
<p>Thanks.</p>
| c# asp.net | [0, 9] |
4,847,414 | 4,847,415 | Progress Bar using JQuery | <p>I want to show a progress bar in my page using JQuery. If i hardcoded the value as 10 means, in the progressbar " 10% Completed " should be displayed. How to do this..Please guide me...</p>
| javascript jquery | [3, 5] |
1,282,336 | 1,282,337 | Execute javascript function from java | <p>I want to know if it's possible to execute a javascript function from java. Basically I have a javascript function to which I want to pass a string and then get the output from that function.</p>
<p>If it's possible, how do I accomplish it?</p>
<p>EDIT - </p>
<p>I couldn't find a solution to this, what I did was re-write all the javascript code in Java. But I am guessing, Rhino ported on Android should do the trick. If someone has tried it out, please post a solution. </p>
| java javascript android | [1, 3, 4] |
1,894,877 | 1,894,878 | Adding data from dropdown to a string | <p>I have a URL with query string <br/>
(example: <a href="http://www.example.com/?page=index&opr=sales-current&pageno=1" rel="nofollow">http://www.example.com/?page=index&opr=sales-current&pageno=1</a>)<br/></p>
<p>I need to change "opr" value from "sales-current" to "sales-[dropdown value]" using javascript or jQuery</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
514,785 | 514,786 | Has anyone implemented/imitated the new gawker/lifehacker/gizmodo Layout in Javascript | <p>I'd like to implement the same layout as Gawker sites; <a href="http://lifehacker.com/" rel="nofollow">lifehacker</a> and <a href="http://gizmodo.com/" rel="nofollow">gizmodo</a>.</p>
<p>If anyone can suggest a good starting point.</p>
<p>--I use JupiterIt JavascriptMVC extensively.</p>
| javascript jquery | [3, 5] |
1,734,643 | 1,734,644 | What are the most important optimizations in Java code on Android? | <p><br>
I am just starting out programming on Android. </p>
<p>What is the most computationally expensive Java constructs to avoid when programming an Android App? </p>
<p>Of cause every algorithm costs instructions, but what about use of Method calls, Object references, Interfaces, Collections and such? What do I need to avoid, and what is "cheap" when I'm programming for speed?</p>
| java android | [1, 4] |
198,315 | 198,316 | remove characters in string after specific occurance | <p>Hoping you guys can help me out, I have a dynamic url and I need some javascript to basically trim the string after the specific occurance of a character.</p>
<p><strong>EXAMPLE:</strong></p>
<p>I have this url</p>
<blockquote>
<p>Assessment/testdir2/TestDIR3/lecture slides 1as.pdf</p>
</blockquote>
<p>and I need to remove everything after the <code>2nd slash</code> and including the 2nd slash, </p>
<p>how would I do this?</p>
| javascript jquery | [3, 5] |
2,791,986 | 2,791,987 | $("#but0_0").attr(...) works but $(hid).attr(...) does not work when hid === "#but0_0" | <p>On Safari 4.0, I have a check that prints "????" if hid === "#but0_0"</p>
<p>Works:</p>
<pre><code>$("#but0_0").attr("onmousedown",function(){alert("Aha!");});
</code></pre>
<p>Doesn't work:</p>
<pre><code>var id = "but"+y+"_"+x;
var hid = "#"+id;
if (hid === "#but0_0") console.debug("????");
$(hid).attr("onmousedown",function(){alert("Aha!");});
</code></pre>
<p>The console shows "????" so the code is getting hit and the variable is "the same" (from === string compare point of view) as the string literal but apparently jQuery's $() operator knows the difference?</p>
<p>I have 30 divs to manipulate and I need to compute the id of the div at run time. Any ideas? It's probably something simple like pulling out a "string" from a "String" or some such <a href="http://lists.canonical.org/pipermail/kragen-tol/2005-May/000782.html" rel="nofollow">JavaScript stupidity</a>.</p>
| javascript jquery | [3, 5] |
640,346 | 640,347 | Parsing Hyperlinks from a webpage | <p>I have written following code to parse hyperlinks from a given page.</p>
<pre><code> WebClient web = new WebClient();
string html = web.DownloadString("http://www.msdn.com");
string[] separators = new string[] { "<a ", ">" };
List<string> hyperlinks= html.Split(separators, StringSplitOptions.None).Select(s =>
{
if (s.Contains("href"))
return s;
else
return null;
}).ToList();
</code></pre>
<p>Although string split still has to be tweaked to return urls perfectly. My question is there some Data Structure, something on the line of XmlReader or so, which could read HTML strings efficiently.</p>
<p>Any suggestion for improving above code would also be helpful.</p>
<p>Thanks for your time.</p>
| c# asp.net | [0, 9] |
3,961,214 | 3,961,215 | read individual img src from folder contents into HTML | <p>I am trying to write some simple code, but I am not sure what to use, javascript or PHP.
I have some structured HTML docs and I want to insert an image from a folder into each img src attribute.
So basically I would need to read in the contents and then insert each one, one by one.</p>
<pre><code><div class="slideshow">
<div class="wrapper">
<ul>
<li>
<div class="main">
<a href="product1.html"><img src="images/sample/name1-1.jpg" alt="" width="630" height="400" /></a>
</div>
<div class="second">
<img src="images/sample/name1-2.jpg" alt="" width="310" height="190" />
</div>
<div class="third">
<img src="images/sample/name1-3.jpg" alt="" width="310" height="190" />
</div>
</li>
</code></pre>
<p>Thanks to anyone who might be able to steer me in the right direction..</p>
<p>I am using the following code to get the images from the directory</p>
<pre><code><?php
Header("content-type: application/x-javascript");
function returnimages($dirname=".") {
$pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
echo 'galleryarray['.$curimage.']="'.$file .'";';
$curimage++;
}
}
closedir($handle);
}
return($files);
}
echo 'var galleryarray=new Array();';
returnimages()
?>
</code></pre>
<p>but at this point I am not sure how to insert each file name into the src attribute</p>
| php javascript | [2, 3] |
3,062,151 | 3,062,152 | javascript syntax and jQuery source | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3090284/for-the-function-function-ive-seen-it-with-the-word-jquery-in-it-why">For the function (function($){})(), I’ve seen it with the word jQuery in it, why is that?</a> </p>
</blockquote>
<p>Can someone explain the following syntax that is used in the jQuery source files? I am learning jQuery and trying to dive into writing a jquery.ui.widget.</p>
<pre><code>(function ($)
{
... code ...
} (jQuery));
</code></pre>
<p>While I am using jQuery, this is really just a JavaScript question, I guess.</p>
<p>Thanks,
Craig</p>
| javascript jquery | [3, 5] |
4,146,143 | 4,146,144 | What's the difference between "click" and "onclick" when creating an element with jQuery? | <p>What's the difference between</p>
<pre><code>$("<a>", {
"id" : "myId",
"text" : "my link",
"href" : "#",
"onclick" : function() { return false; }
);
</code></pre>
<p>and</p>
<pre><code>$("<a>", {
"id" : "myId",
"text" : "my link",
"href" : "#",
"click" : function() { return false; }
);
</code></pre>
<p>?</p>
| javascript jquery | [3, 5] |
5,917,695 | 5,917,696 | JQuery .post() not returning data | <p>I am trying to pass parameters to the <a href="http://www.tinypaste.com/" rel="nofollow">TinyPaste</a> API. I have the following JQuery script in an HTML file,</p>
<pre><code>$.post("http://tinypaste.com/api/create.json",
{
"paste": "This is test paste",
"title": "Test",
"is_code": 0,
"is_private": 1
},
function(data) {
console.log(data);
}
);
</code></pre>
<p>As seen in the Firefox's Web Console, I can see that the request is made and is successful (The content length of the response is as expected). But the callback function is not printing anything in the console window.</p>
<p>What am I doing wrong here?</p>
| javascript jquery | [3, 5] |
757,287 | 757,288 | Beginning Programmer Interested in Android - Should I Start with Java? | <p>I'm a beginner in programming. My experience so far is only in Actionscript 2 and 3. So I have a basic understanding of declaring variables, loops, arrays, if/then, do/while... I'm wanting to move to developing for Android phones so I'm wondering what suggestions people have for where to go next. Should I jump right to Android? Start with a 'beginning Java' approach? Or should I go some other route to beef up my knowledge of OOP concepts before launching into Android? I have my Dev environment set up and completed the Hello Android tutorial and I'm just wondering if I am going to be in over my head quickly?</p>
| java android | [1, 4] |
989,512 | 989,513 | Get day from date in javascript | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/495644/how-to-get-the-day-from-a-particular-date-using-javascript">how to get the day from a particular date using javascript</a> </p>
</blockquote>
<p>Is there function like date("N", strtotime($date)) but in javascript.I want to get the day from date.</p>
| javascript jquery | [3, 5] |
4,035,040 | 4,035,041 | Android DateTime Picker Application please help us | <p>Once a time has been chosen, the AM/PM setting is correct on consecutive runs, but I don't know how to set it to the proper AM/PM. in android Dialog box ie.(timepicker ).If anybody knows Please help me</p>
| java android | [1, 4] |
1,201,618 | 1,201,619 | Alternate of Class.forName("XYZClass") in JavaScript | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9462881/create-instance-of-class-using-reflection-in-javascript">Create instance of “Class” Using “Reflection” in JavaScript</a> </p>
</blockquote>
<p>Java has <code>Class.forName("XYZClass")</code> to load class at run time. Is there any alternate for <code>Class.forName("XYZClass")</code> in JavaScript?</p>
| java javascript | [1, 3] |
3,739,620 | 3,739,621 | jQuery Split where numeric number occur | <p>I have a string like </p>
<p>this-is-my-0-string.
this-is-my-new-1-string-occur.</p>
<p>i want to break string where number occurs</p>
<p>like </p>
<p>this-is-my , 0 , string </p>
<p>and this-is-my-new,1, string-occur</p>
<p>in common words i need to break my string where numbers occur. number is any from 0, 99999
is it possible to do in javascript or jquery ? How to do this </p>
<p>Thanks in advance</p>
| javascript jquery | [3, 5] |
1,026,858 | 1,026,859 | check if Special characters is Chinese or English | <p>Now my app needs to check the input. I can recognize whether the input is Chinese, English or a number, but there are also special characters in Chinese and English. How to check this?</p>
<p>there is different between Special characters in Chinese mode and English mode,like this:</p>
<pre><code>chineseMode: , 。
EnglishMode:, .
</code></pre>
<p>Thanks for your answers.</p>
| java android | [1, 4] |
3,864,598 | 3,864,599 | How to display particular message like alert message in asp.net3.5 c# | <p>i have one form after clicking save button form redirecting to another page, but before redirecting another page it should display message like "Your data has been saved successfully".
What should i do?
Asp.net c#
Thsnk you.</p>
| c# asp.net | [0, 9] |
5,814,697 | 5,814,698 | Is is possible to bind a submit() function before any existing onsubmit/submit? | <p>I have a form with an <code>onsubmit</code> attribute. I need to bind a new submit event and I need this one to be executed before any existing submit functions.</p>
<p>The following code demonstrates the problem.</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function($) {
// a plugin
$('form').submit(function() {
alert("Second");
});
// an other plugin
$('form').submit(function() {
alert("Third");
});
// this event must always be executed as first event
$('form').submit(function() {
alert("Always First");
});
});
</script>
</head>
<body>
<form onsubmit="javascript:alert('Fourth');">
<p>
<input type="submit">
</p>
</form>
</body>
</html>
</code></pre>
<p>If you execute the script, first you get "Second", then "First".</p>
<p>Is is possible to bind a new submit event and specify whether the function must be called before any existing event?</p>
<p>Constraints:</p>
<ul>
<li>Existing events must be preserved.</li>
<li>I can't remove existing events because the content of the <code>onsubmit</code> attribute contains a quite complex logic written by Rails</li>
<li>(ADDED): the event should always be executed before any existing onsubmit event and already binded events (perhaps binded by an other plugin)</li>
</ul>
<p>Any idea?</p>
| javascript jquery | [3, 5] |
631,810 | 631,811 | Is it possible to place 2 buttons in List view | <h2>ListView</h2>
<h2>[Text] [Button 1][Button 2]</h2>
<h2>[Text] [Button 1][Button 2]</h2>
<p>... (and so on) ...</p>
<p>Button 1 should be like Check Box and other button which allows to redirect on other page</p>
<p>Is above mentioned thing possible??</p>
<p>Thanks in advance..</p>
| java android | [1, 4] |
3,020,121 | 3,020,122 | how do I access this class | <pre><code>import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
public class LoadSettings
{
public static void LoadMySettings (Context ctx)
{
SharedPreferences sharedPreferences = ctx.getSharedPreferences("MY_SHARED_PREF", 0);
String strSavedMem1 = sharedPreferences.getString("gSendTo", "");
String strSavedMem2 = sharedPreferences.getString("gInsertInto", "");
String cCalId = sharedPreferences.getString("gCalID", "");
setInsertIntoStr(strSavedMem2);
setSendToStr(strSavedMem1);
}
private static String cSendToStr;
private static String cInsertIntoStr;
private int cCalId;
private Uri cCalendars;
public String getSendToStr()
{
return this.cSendToStr;
}
public static void setSendToStr(String pSendToStr)
{
cSendToStr = pSendToStr;
}
public String getInsertIntoStr()
{
return this.cInsertIntoStr;
}
public static void setInsertIntoStr(String pInsertIntoStr)
{
cInsertIntoStr = pInsertIntoStr;
}
}
</code></pre>
<p>from the calling class i have tryed lots the current is.</p>
<pre><code>LoadSettings.LoadMySettings(this);
</code></pre>
<p>but when i try to get some data for example.</p>
<pre><code>textSavedMem1.setText(LoadSettings.getSendToStr());
</code></pre>
<p>i get a Null error.</p>
| java android | [1, 4] |
5,929,884 | 5,929,885 | Select JQuery elements that have some value set by data() | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2891452/jquery-data-selector">jquery data selector</a> </p>
</blockquote>
<p>I have several elements with class 'connection_name'. Each one of these elements has a unique id bound to it using the data() JQuery function. I'm trying to query to find the element with a given id, but I can't seem to get it to work.</p>
<p>For the sake of this test, I created a page with only 1 element, and set the id of the element.</p>
<p>I can verify that the id is being set, as when I query the element in the console, it shows the id returned:</p>
<pre><code>$('.connection_name').data()
Object
id: "4fea76bd99ea080d19000002"
__proto__: Object
</code></pre>
<p>I've read on other questsions/posts that the element should be selected by $('selector[data-attribute=value]'), but that doesn't seem to work:</p>
<pre><code>$('.connection_name[data-id="4fea76bd99ea080d19000002"]')
[]
</code></pre>
<p>Worse than that, even when I try to select it without any value (just by the attribute), I still return nothing:</p>
<pre><code>$('.connection_name[data-id]')
[]
</code></pre>
<p>I'm not sure what the issue is, or how to go about doing this.</p>
| javascript jquery | [3, 5] |
1,501,305 | 1,501,306 | List.Add() thread safety | <p>I understand that in general a List is not thread safe, however is there anything wrong with simply adding items into a list if the threads never perform any other operations on the list (such as traversing it)?</p>
<p>Example:</p>
<pre><code>List<object> list = new List<object>();
Parallel.ForEach(transactions, tran =>
{
list.Add(new object());
});
</code></pre>
| c# asp.net | [0, 9] |
1,355,587 | 1,355,588 | weird behavior of JS functions in an if statement, WHY? | <p>Why the following code will return <em>“obvious”</em>, <em>“surprise!”</em> (and lastly <em>“how come?”</em>). It should return <em>"expected"</em>, isn't it?<br>
In the first <code>if</code> we used anonymous functions, in the second we used 'named' functions.</p>
<pre><code>var a = 5;
if (a == 5) {
var b = function () {
return "obvious";
};
} else {
var b = function () {
return "never";
};
}
if (a == 5) {
function c() {
return "expected";
}
} else {
function c() {
return "surprise!";
}
function d() {
return "how come?";
}
}
alert(b());
alert(c());
alert(d());
</code></pre>
<p>So this means, <code>function a(){} is NOT equal to var a = function (){}</code>.</p>
<p>So, the second question, why JS needs this peculiar behavior? What's the benefit of this ? </p>
| javascript jquery | [3, 5] |
4,841,496 | 4,841,497 | Request types on iPhone || Android? | <p>Is it possible to send GET, POST, PUT and DELETE requests from iPhone || Android applications to a third party server?</p>
<p>I want to build a web service to reuse on all 3 platforms (3rd being the web app itself).</p>
| iphone android | [8, 4] |
4,913,901 | 4,913,902 | Change a CSS selectors child on hover in jQuery | <p>With this basic jQuery code below, how would I make the on <code>mousout</code> change the item back to <code>display:none</code>? </p>
<p>Also can this be improved?</p>
<p>Any help please</p>
<pre><code>$(".image").hover(function() {
$(this).children(".image p").css({ display: 'inline' });
});
</code></pre>
<p>On the jQuery docs site I saw this: <code>$(selector).hover(handlerIn, handlerOut)</code> but I don't understand how to apply it here.</p>
| javascript jquery | [3, 5] |
1,245,644 | 1,245,645 | What does Request[" "] mean? | <p>I came accross this unusual thing, and I'm not sure what it is.</p>
<p>There is a place in the code where I found :</p>
<pre><code>if(IsPostBack == false)
{
string strInterior = Request["xmlString"];
}
</code></pre>
<p>I have one javascript page which is using xml http object ajax (The project is in <em>asp.net 1.1</em>)</p>
<p>This xmlString is a variable in javascript which contains a XML format string and passes it like this:</p>
<pre><code>var objTrim = createXMLHttpObj();
var xmlString = "<UrlXML>";
xmlString += "<ID>" + id + "</ID>";
url = url + "abc.aspx?trim=";
objTrim.open("POST", url + escape(TrimRecordsValue) , true);
objTrim.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
objTrim.send("xmlString=" + xmlString);
</code></pre>
<p>I am not sure what this <code>Request["xmlString"]</code> means .This is called in the code behind the page. Any ideas?</p>
| c# javascript asp.net | [0, 3, 9] |
4,936,350 | 4,936,351 | Python and Android | <p><a href="http://code.google.com/p/android-scripting/" rel="nofollow">This</a> link says that it is indeed possible to write code in <strong>Python</strong> and use it for app development in <strong>android</strong> platform. I would like to know what the catch is when using Python and not Java. Is there any compromise being made in speed of execution or size?</p>
| android python | [4, 7] |
4,621,724 | 4,621,725 | Which Android platform to choose when installing the Android SDK? | <p>After installing the Android SDK, I noticed that I need to choose the platform, i.e. Android 1.3 all the way upto 4.1 individually.</p>
<p>My question is, does this mean if I create an app, I have to create it on each and every platform individually?</p>
<p>I am a total noobie to Android development...</p>
| java android | [1, 4] |
1,938,785 | 1,938,786 | Py_Initialize fails - unable to load the file system codec | <p>I am attempting to put together a simple c++ test project that uses python 3.2. The project builds fine but Py_Initialize raises a fatal error:</p>
<pre><code>Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
</code></pre>
<p><strong>Minimal code:</strong></p>
<pre><code>#include <Python.h>
int main (int, char**)
{
Py_Initialize ();
Py_Finalize ();
return 0;
}
</code></pre>
<p>The OS is 32bit Vista.</p>
<p>The python version used is a python 3.2 debug build, built from sources using VC++ 10.</p>
<p>The python_d.exe file from the same build runs without any problems.</p>
<p>Could someone explain the problem and how to fix it? My own google-fu fails me.</p>
<p>[EDIT]</p>
<p>After going through the python source code I've found that, as the error says, no codec search functions have been registered. Both <code>codec_register</code> and <code>PyCodec_Register</code> are as they should be. It's just that nowhere in the code are any of these functions called.</p>
<p>I don't really know what this means as I still have no idea when and from where these functions should have been called. The code that raises the error is entirely missing from the source of my other python build (3.1.3).</p>
<p>[EDIT]</p>
<p>Answered my own question below.</p>
| c++ python | [6, 7] |
3,808,001 | 3,808,002 | Exposing OnclientClick function in user control asp.net C# | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/943171/expose-and-raise-event-of-a-child-control-in-a-usercontrol-in-c-sharp">expose and raise event of a child control in a usercontrol in c#</a> </p>
</blockquote>
<p>I have user control with one html input button.</p>
<p>On page I am consuming that user control. How can I expose onclient event of that input button inside user control so if that button client so i can call page function.</p>
<pre><code><uc2:UC_LayoutSelector ID="UC_LayoutSelector1" runat="server" OnClientLayoutSelect="UC_LayoutSelector1_MyPageFunction" />
<script type="text/javascript">
function UC_LayoutSelector1_MyPageFunction(e) {
alert(e);
}
</script>
</code></pre>
| c# asp.net | [0, 9] |
4,019,028 | 4,019,029 | calling a php from javascript as src file | <p>i have a question
when a .php file called as a javascript what dose this mean? and when this is needed to be used ?</p>
<p>ex:</p>
<pre><code><head>
<script src="dir/myphpfile.php" type="text/javascript"></script>
</head>
</code></pre>
| php javascript | [2, 3] |
3,232,336 | 3,232,337 | to draw graph with mysql data | <p>I need to draw a line graph with mysql data which has two columns. some one help me with a sample code.</p>
| java javascript | [1, 3] |
480,620 | 480,621 | Object reference not set to an instance when modifying an existing cookie in code behind | <p>In the line "Response.Cookies...", I get an object reference not set to an instance of an object. Is there a way to fix this and use a timer in my ASPX code behind?</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
object o = new object();
TimerCallback timercallback = new TimerCallback(StartCallback);
System.Threading.Timer timer = new Timer(timercallback, o, 0, 50000);
if (are.WaitOne())
{
Response.Redirect("Default.aspx");
}
}
public void StartCallback(object o)
{
//Request.Cookies["haspassed?"].Value = "";
Response.Cookies["haspassed?"].Expires = System.DateTime.Now.AddMonths(-1);
are.Set();
}
</code></pre>
<p>Thanks</p>
| c# asp.net | [0, 9] |
2,864,065 | 2,864,066 | jquery element selection | <p>I know I can select elements using the following syntax, but what other ways are available? I didn't know what to search for when trying to determine others. Also, are there ways to select elements via wildcard characters?</p>
<pre><code> //Selection by the element's ID
$('#mybutton').on('click', function (e) {
alert('mybutton clicked');
});
//Select by the element's css class
$('.mybuttonclass').on('click', function (e) {
alert('mybutton clicked');
});
//Selection of a tag with name of delete found within a table
$('table').on('click','a[name=delete]', function (e) {
alert('table link clicked');
});
</code></pre>
<p>So, I can use name, ID or class. Are there other ways? A google search term or a link would be helpful. </p>
<p>EDIT:</p>
<p>I had found the selectors page in the documentation, but didn't think this page applied. I had trouble making sense of the page, and thought that it was referring to something else. That's why I was looking for another search term, because everything was bringing up 'Selectors', and I didn't think that's what I was needing. apparently I was in the right place after all.</p>
| javascript jquery | [3, 5] |
5,439,809 | 5,439,810 | The false element in a Logical operation | <p>I wish to know if there's some way to know which is the elemnet of a logic operation is false?<br>
Example. </p>
<pre><code>if( String.IsNullOrEmpty(obj1) || (String.IsNullOrEmpty(obj2) )
throw("...............");
</code></pre>
<p>How can I kown which one of those is the empty one? </p>
| java c# | [1, 0] |
2,116,085 | 2,116,086 | Logic Problem between Main Class and Thread Class | <p>Hy!!</p>
<p>I make a new <code>Object</code> from a <code>Thread</code> Class. There is a Http-Post in the run method with a result string.</p>
<p>My Question:</p>
<p>How is it possible to notify the main class that the download finished?</p>
<p>MFG</p>
| java android | [1, 4] |
2,289,151 | 2,289,152 | How do I get the cumulative height of a series of images? | <p>I'm attempting to use JS and PHP to dictate whether or not some navigation is visible or not. First, I get the cumulative height of a series of images. Then I compare this height to the height of their container. If the height of the images is greater, the navigational divs should display.</p>
<p>This almost works, but for some reason, my JS variable 'divheight' isn't gathering the image heights. Can anyone spot my issue?</p>
<p>Note that $count is the number of images, and #th_ will amount to the ID of the final image.</p>
<pre><code><script>
$('#th_<?php echo $count; ?>').ready(function() {
var divheight = 0;
//alert('Number of images: <? echo $count; ?>');
<?php
$msg = '';
for ( $i = 1; $i <= $count; $i++ ) {
?>//alert('Cumulative height of images: 'divheight); <?
//$msg .= 'divheight += parseInt( $("#th_' . $i . '").height() );';
$msg .= 'divheight += parseInt( document.getElementById("th_' . $i . '").height );';// . "\n";
}
echo $msg;
?>
//alert( '<? echo $msg; ?>' );
alert( divheight + ':' + $('#ThumbContainer').height() );
if ( divheight < $('#ThumbContainer').height() ) {
$("#ProdDetailsHoverUp").hide();
$("#ProdDetailsHoverDown").hide();
}
});
</script>
</code></pre>
<p>Note, I've used both JQuery and the DOM method for getting the height of the images.</p>
<p>Thanks in advance for your help.</p>
| php javascript jquery | [2, 3, 5] |
2,406,194 | 2,406,195 | How to use Global Varabile in Aspx file? | <p>Say I have a global class:</p>
<pre><code> static class GlobalOfficeSetting
{
public static bool PatientRegistation_DialogOnly = true;
}
</code></pre>
<p>Or let's say if I store the global variable in below instead:</p>
<pre><code>Application("PatientRegistation_DialogOnly") = true
</code></pre>
<p>Then how will I able to call them out in aspx?
Because I want to use that as a global setting for all users to on/off display some stuff/functionality in aspx page.</p>
<p>Thanks in advance,
King</p>
| c# asp.net | [0, 9] |
4,444,008 | 4,444,009 | Simple 'if' with 'or' statement | <p>I'm having trouble figuring why this isn't working...</p>
<pre><code>if (index != 10 || index != 0) {
</code></pre>
<p>If <code>index = 0</code> the function is still allowed in, why?</p>
| javascript jquery | [3, 5] |
1,800,852 | 1,800,853 | Form validation with jQuery and php | <p>I have a form which I'm validating using jQuery and php. So basically if the php echoes "input must be filled" the jQuery should put a red border around that input, but the thing works only after submitting the form two times.<br>
I explain: if I submit with input unfilled the php file echoes "input must be filled", but only if I press again the submit button - the input goes red.</p>
<pre><code>$("form#maj_email").submit(function(){
var _data = $(this).serialize()
$.ajax({
type: 'POST',
url: 'validation_profil.php?var=maj_email',
beforeSend: function(){
$("div#ajax_icon_maj_email").css({background:"url('http://localhost/www3/images/ajax_loader.gif')"})
$("div#error_maj_email").hide()
if( $("div#error_maj_email").text()=="Email syntaxe incorrecte"){
$("form#maj_email input:[name=email]").css({border:"1px solid red"})
}
},
data:_data,
cache: false,
success: function(html){
$('div#error_maj_email').html(html)
$("div#ajax_icon_maj_email").css({background:"url('none')"})
$("div#error_maj_email").fadeIn()
}
})
})
</code></pre>
| php jquery | [2, 5] |
1,404,592 | 1,404,593 | Passing variables between functions | <p>I have two functions, one that makes an Ajax request when the user loads the page, and one that will run every 5 or so seconds to update something. Using the first function, I can output a variable that I need to use in the second function. </p>
<pre><code>function insert_last_ten() {
$.ajax({
url: 'freeshout/chatlog.php',
success: function(data) {
$("#inner-wrap").html(data);
var first_child = $("#inner-wrap :first-child").html();
var value = first_child.match(/(value)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/);
var realtime = value[2];
}
});
}
</code></pre>
<p>Basically, I need to use <code>realtime</code> to do something else in another function. For the sake of simplicity, let's pretend this is the second function:</p>
<pre><code>function update() {
alert(realtime);
}
</code></pre>
<p>How could I go about making that work?</p>
| javascript jquery | [3, 5] |
3,554,657 | 3,554,658 | How to edit values of GridView with AutoGenerateColumns="true" in C# ASP.Net? | <p>I have a simple <code>Gridview</code> with <code>AutoGeneratecolumns=true</code>, which binds data from different tables on each execution as per requirement. There are different number of columns on each table,that's why i'm not using "<code>asp:TemplateField</code>" or "<code>asp:BoundField</code>".</p>
<p>Is there any way to edit <code>GridView</code> columns?</p>
| c# asp.net | [0, 9] |
1,688,522 | 1,688,523 | Jquery .get and .push into an array gives an empty string | <p>Can anyone tell me why the below gives me an empty string?? When I console.log(contentArray) in the .get callback function it spits out the data but when I try to do it where it is in the code below it wont work.</p>
<pre><code>sectionArray = [];
contentArray = [];
$(function(){
if (index == 1){
$('menu:eq('+ (section - 1) +') li a').each(function(){
sectionArray.push($(this).attr('href'));
});
var len=sectionArray.length;
for(var i=0; i<len; i++) {
href2 = sectionArray[i];
$.get(href2, function(data){
string = data.toString();
contentArray.push(string);
});
}
content = contentArray.toString();
console.log(content);
}
</code></pre>
| javascript jquery | [3, 5] |
1,586,294 | 1,586,295 | onhashchange IE8 browsing | <p>On a page that I'm making at the moment I have anchor tags that link to #'s and on hash change of the page I want to hide one div and show the other.
This works fine on all browsers I've tested on other than IE8. Chrome, Firefox and IE9 and IE 10 all work fine.
I'm looking for the best way to achieve this. A fix would be great, but the best way of achieving this effect would be great.
Here is examples of the code involved.</p>
<pre><code><body onhashchange="HashChangeHandler();">
<a href="#example">example</a>
</body>
<script type="text/javascript">
function HashChangeHandler(){
var url = window.location.href;
var splitURL = url.split(/#(.+)?/)[1];
$('.alldivs').hide();
$(document.getElementById(splitURL)).show();
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
5,246,627 | 5,246,628 | how to get exact 3 months ago date and time from today's date and current time using C# | <p>I want to get data from database which is saved from past 3 months for that i have current date and time but how to calculate 3 months ego date and time, SO that i can pass these 2 dates in the query and get the data which was saved between these dates</p>
| c# asp.net | [0, 9] |
2,211,005 | 2,211,006 | Datediff getting the date inbetween 2 dates and bind it to a gridview | <p>I have a table with 'dateborrowed' and 'datereturned' column. What I want to do is I want to get the value in between 'datereturned' and 'dateborrowed' and bind it to another column in another table. Also how can I do it using datediff function? I'm still learning it in the meantime. Any help would be greatly appreciated. </p>
<p>Thanks in advance!! </p>
| c# asp.net | [0, 9] |
5,608,313 | 5,608,314 | Access object in main.xml | <p>I'm trying to create a widget, but I can't access the main.xml elements from the code. If I had an activity, I could use findViewById, but in this case it won't work. </p>
<p>How can I access an element in main.xml from widget?</p>
| java android | [1, 4] |
3,754,514 | 3,754,515 | stradus jquery plugin parameter links | <p>I have a question i'm using stradus jquery player to play soundcloud content from my site it has different parameters one of them is link </p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$stratus({
auto_play: true,
download: false,
links: 'http://soundcloud.com/qotsa',
random: true
});
});
</code></pre>
<p>but i wan't to get the soundoudlinks from my database with php and load them in links i tried everything but i always get a Syntax Excpected error , anybody an idea how to make the string with php?</p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$.stratus({
links: <?php echo(implode("','", $soundcloudsurl)); ?>
});
});
</script>
</code></pre>
<p>this is my code!</p>
| php jquery | [2, 5] |
4,267,070 | 4,267,071 | How to optimize my javascript? | <p>I have inherited a piece of code which has a series of functions like the following:</p>
<pre><code>$("#data[User][notify_one_day_out]").change(function () {
$("#updatenotificationsform").submit();
}
$("#data[User][notify_one_month_out]").change(function () {
$("#updatenotificationsform").submit();
}
</code></pre>
<p>and this goes on and on. How do I just write one function that does the same thing since every ID begins with data. Sorry am a JS newbie</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
4,555,380 | 4,555,381 | Android MyLocationOverlay vs LocationManager/LocationListener | <p>I am building an Android application that shows the user his/her current location (using MyLocationOverlay), and I am also using a LocationManager/LocationListener to get the user's location every 15 seconds, which is then used to query a web service and in return I plot points using an ItemizedOverlay.</p>
<p>This is all working with no problems.</p>
<p>Should I be using BOTH MyLocationOverlay as well as LocationManager/LocationListener, however? It seems redundant. What would you do? From what I can see, MyLocationOverlay uses the LocationManager in the background to constantly receive location updates, anyway. </p>
<p>Thanks!</p>
| java android | [1, 4] |
2,057,304 | 2,057,305 | ASP.net composite control with an attribute that can contain multiple values of an enum type | <p>I'm building a composite control textbox that contains the ability to run some business rule validation on the client (via generic jquery validation methods attached on render) and server side (via C# validation code). I created an enum type with the available business rules that can be validated (denoted with the [flags] attr), but I don't know how to allow the developer enter multiple enum values as an attribute. </p>
<p>For example:
given the enum:
[Flags]
public enum BusinessValidationRules {Logical=0, Theoretical=1, Physical=2, MetaPhysical=4}</p>
<p>I'd like the developer to be able to write a control like this at design time:
<code><cc1:ProofTextBox id="somevalue" validation="Logical&Physical|Theoretical" /></code>
OR, if those bitwise statements are not allowed then I could work with:
<code><cc1:ProofTextBox id="somevalue" validation="Logical,Physical,Theoretical" /></code></p>
<p>Is there a way to do this without using the validation attribute taking in a string and parsing that (i.e. I'd like to get keep it tightly bound to the enumerated type)? </p>
<p>The reason I'd like to do it this way is because I already wrote a generic jquery validator that validates based on enum values and separate code that does the same thing on the server side. I'd like to bake it into the composite control so that future developers don't have to worry about that all. </p>
| c# asp.net | [0, 9] |
4,299,907 | 4,299,908 | How to effectively use jQuery 1.8 - examples? | <p>We are using jQuery on our websites - but I dont think we are effectively using it with a lot of duplicated code, etc. Im looking for examples of websites that do it right or documentation/books to explain to right way or a better way?</p>
| javascript jquery | [3, 5] |
6,016,539 | 6,016,540 | Delete Gridview Row with Jquery | <pre><code><asp:CommandField ShowDeleteButton="True" />
</code></pre>
<p>How can I link a simple jquery method to the delete button which just asks for user confirmation and returns (true or false) if user is sure he want to delete record in gridview or not?</p>
| jquery asp.net | [5, 9] |
594,179 | 594,180 | This appears to be a class on a Javascript event. What is it? | <p>I just ran across some jQuery that looks like this:</p>
<pre><code>$('.add-row').live('click.add', function() {
// do something
}
</code></pre>
<p>This appears to be binding to the <strong>'click.add'</strong> event. I use custom events myself and think they're awesome, but doing <code>git grep</code> on our code base doesn't reveal any place where a custom event called <code>click.add</code> is triggered, and in any case, this behavior is triggered by a normal click. Nor do I see an <code>.add</code> class anywhere in the HTML.</p>
<p>I don't think you can have classes on Javascript events. Any idea what this odd bit of syntax is?</p>
| javascript jquery | [3, 5] |
2,495,504 | 2,495,505 | inserting textbox value to sql server using c# | <p>I need to add a text box value to SQL Server database table. Below is my code:</p>
<pre><code>private void button1_Click(object sender, EventArgs e)
{
string str = "Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\timetablesystem.mdf;Integrated Security=True;User Instance=True";
SqlConnection con = new SqlConnection(str);
string qry = "insert into SubjectMaster (SubjectName) values (@TxtSubjectName)";
con.Open();
SqlCommand cmd = new SqlCommand(qry, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@TxtSubjectName", TxtSubjectName.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Added Successfully!!");
con.Close();
}
</code></pre>
<p>But, data should not add in table... please help me...
thanks for ur help...</p>
| c# asp.net | [0, 9] |
1,637,858 | 1,637,859 | JQuery function to select checkboxes | <p>I need a function that accepts a parameter with its id example a div
and after that loops inside the div to look for checkboxes and if there is/are any checks if its value is checked and returns true if every checkbox is checked returns false.</p>
| asp.net javascript jquery | [9, 3, 5] |
5,116,864 | 5,116,865 | How to insert a new item in a listbox and then setfocus on the listbox new item on a button click event in C# | <p>I have a listbox which populated from using a datatable. I have a Add button in my page. On clicking the add button I want to insert a blank row in the listbox. This can be done easily by </p>
<pre><code>ListBox_Admin.Items.Add("");
</code></pre>
<p>after this is done I want to select this item as in setfocus on this item.How do I do this.</p>
| c# asp.net | [0, 9] |
4,720,848 | 4,720,849 | how to save webpage in android sdcard or in device memory | <p>How to save Web page in android?
I have create one application in which I have load web page in android web view using URL.</p>
<p>I want to save that page using menu bar option and stored in device memory in sd card. I dont have any id to do this i am new in android.</p>
<p>So please tell me code for this or else if any body have related Example kindly post it.</p>
| java android | [1, 4] |
2,271,856 | 2,271,857 | Changing image source of list of image tags and replacing it with specific list | <p>I need to replace a list of image src in a div tag.
For instance :</p>
<pre><code><!-- language-all: lang-html -->
<div id="Listofimages">
<img src="images\2page_img_3.jpg">
<img src="images\2page_img_3.jpg">
<img src="images\2page_img_3.jpg">
</div>
</code></pre>
<p>So here i want to change these 3 image source.</p>
| javascript jquery | [3, 5] |
4,974,200 | 4,974,201 | How to grab an image tag from html via jquery | <p>So I have a data set that is returning something like this in the variable entry.content:</p>
<pre><code><p style="float:right;margin:0 0 10px 15px;width:240px"> <img src="http://citysportsblog.com/wp-content/uploads/2011/09/RagnarNE.jpg" width="240"> </p><p>Have you heard of the epic adventure that is the</p>
</code></pre>
<p>How would i just grab the img src url from this via jquery?</p>
| javascript jquery | [3, 5] |
4,824,039 | 4,824,040 | what will be the value of byte b=(byte)0x8A if printed? | <p>What will b return ? </p>
<pre><code>byte b = (byte)0x8A;
System.out.println("Value"+b);
</code></pre>
<p>What will it print? And when does the value will return a negation?</p>
| java android | [1, 4] |
Subsets and Splits