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
46,484
46,485
Difference between functions in C# and Javascript?
<p>I am learning Javascript and I have read functions are first class objects and most authors mention that functions can return functions (which are objects) and pass them as parameters to other functions.</p> <p>I am sure there is a lot more to it so what are the differences between functions in C# and functions in javascript?</p> <p>In C# am I right to say functions are not objects (don't have methods, properties etc) even though with closures (with lambda expressions and delegates) they seem to behave like function objects as in javascript?</p> <p>I feel that with lambda expressions in C# the distinction becomes a bit blurry for someone just coming to the language.</p>
c# javascript
[0, 3]
5,222,272
5,222,273
Javascript: check if window.fullScreen is false then open url in new window in full screen
<p>I have written a javascript on page load that</p> <pre><code>if(!window.fullScreen) window.open(document.URL,'','fullScreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');} </code></pre> <p>but window.fullScreen always come false so it keep opening window.</p> <p>any other way to check if window is in full screen mode or not?</p> <p>Thanks</p>
javascript asp.net
[3, 9]
4,405,074
4,405,075
Android & MySQL: Get mysql_insert_id() and retrieve it in Android Activity
<p>Hi I have connected a MySQL in a server with and Android application using JSON. I have a table called products where the primary key is and id which is auto_increment. When I insert a new product I would like to get that Id in my android Activity but I don't know how to retrieve it in PHP nor Android. Here is some code: Create Product Script</p> <pre><code>if (isset($_POST['name']) &amp;&amp; isset($_POST['price']) &amp;&amp; isset($_POST['description'])) { $name = $_POST['name']; $price = $_POST['price']; $description = $_POST['description']; // include db connect class require_once __DIR__ . '/db_connect.php'; // connecting to db $db = new DB_CONNECT(); // mysql inserting a new row $result = mysql_query("INSERT INTO products(name, price, description) VALUES('$name', '$price', '$description')"); </code></pre> <p>Where should I put <code>mysql_insert_id()</code> ?</p> <p>Finally, how could I get that <code>mysql_insert_id()</code> in my android activity?</p> <p>Thanks in advance</p>
php android
[2, 4]
4,209,633
4,209,634
why javascript add 1 to setInterval id?
<pre><code>$('#interviehover').hover(function(){ IntervalId = setInterval(sec, 500) alert(IntervalId) }); $('#interviehover').mouseout(function(){ clearInterval(IntervalId) alert(IntervalId ) }); </code></pre> <p>after mouseout event fires i get IntervalId with added 1; for example on hover it alerts 12059, but on mouseout 12060?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
714,968
714,969
Do something every 5 seconds and the code to stop it. (JQuery)
<p>How can I repeat a function doSomething() every 5 seconds.</p> <p>I also need code that will make it stop doing it.</p> <p>And code to on-the-fly adjust the frequency.</p>
javascript jquery
[3, 5]
1,688,058
1,688,059
Read a URL parameter
<p>How do I read the value of ID with a url similar to the following?</p> <pre><code>http://intranet/page.aspx?id=10 </code></pre>
javascript jquery
[3, 5]
416,412
416,413
How to get the class names using jquery?
<p>Hey, I'm wondering how I can get the class names dynamically using jquery for the script below.</p> <p>The HTML output looks like this:</p> <pre><code>&lt;div id="main-info-1" class="maini"&gt; &lt;p&gt;this is a paragraph.&lt;/p&gt; &lt;/div&gt; </code></pre> <p>So, I'm trying to get the class name dynamically instead of hard coded like it is above.</p> <p>There are two parts where I need to get the class names in the jquery script:</p> <pre><code>1.) pc.children('div.maini').remove(); 2.) maini_s = $('div.maini').remove(); </code></pre> <p>As you can see the class 'maini' is hard coded and im unsure how to get the class name dynamically and put it properly in the script.</p> <p>The jQuery file:</p> <pre><code>&lt;script type="text/javascript"&gt; // make them global to access them from the console and use them // in handlePaginationClick var maini_s; var num_of_arts; var ipp; function handlePaginationClick(new_page_index, pagination_container) { var pc = $(pagination_container); pc.children('div.maini').remove(); for(var i=new_page_index*ipp; i &lt; (new_page_index+1)*ipp ;i++) { if (i &lt; num_of_arts) { pc.append(maini_s[i]); } } return false; } $(document).ready(function() { maini_s = $('div.maini').remove(); num_of_arts = maini_s.length; ipp = 3; // First Parameter: number of items // Second Parameter: options object $("#News-Pagination").pagination(6, { items_per_page:ipp, callback:handlePaginationClick }); }); &lt;/script&gt; </code></pre> <p>Any help on this would be awesome, thank you.</p>
javascript jquery
[3, 5]
365,449
365,450
Selecting text from iframe with mouse and showing selection in a div
<p>So I know how to select a text with the mouse and show that selection in a div. But how can I do the same thing when I have an iframe which shows a page on the same domain. </p> <p>Can't figure it out. I have implemented the solution found <a href="http://stackoverflow.com/questions/5448701/javascript-highlight-select-word-under-mouse-pointer">here</a>. </p> <p>Any ideas which could help me out or links to other SO questions that addressed this?</p> <p>Thanx!</p>
javascript jquery
[3, 5]
2,468,480
2,468,481
Why can't I query an element that I just added via append()?
<p>Why can't I query an element that I just added via append()?</p> <pre><code>$('body').append('&lt;div id="testing"&gt;&lt;/div&gt;'); if($("#testing").length == 0) alert("WTF! Testing div should be there!"); </code></pre> <p>Is there some kind of layout that doesn't happen until the JS finishes running or something?</p> <p>How can I get around this? Is there some other method that I could call to create dom elements to work with right away?</p>
javascript jquery
[3, 5]
3,423,007
3,423,008
Multi-value dropdownlist
<p>Currently in asp.net, we can have only one value in a ListItem in a DropDownList. However I hope I can:</p> <pre><code>&lt;MultiValueDropDownList id="ddl" runat="server" /&gt; ddl.Items.Add(new MultiValueListItem { Text="text", DBValue="db", EngineValue=1 }); var dbValue = ddl.SelectedItem.DBValue; </code></pre> <p>What I'm going to do is inherit DropDownList and ListItem. Do you guys have any better solutions?</p> <p>[Closed]</p> <p>At last I decide to choose a lazy way. Store the values in <code>ListItem.Attributes</code>. And using extension methods of DropDownList to help to get the collection of values. Thanks for your help!</p>
c# asp.net
[0, 9]
5,694,356
5,694,357
Dilemma with window.onbeforeunload and image
<p>The following is my main JS file:</p> <pre><code>window.onbeforeunload = function () { showME(); } var ShowMe = function(){ $('&lt;img src="http://cdn.sstatic.net/stackoverflow/img/sprites.png" style="position:fixed;left:0;top:0" /&gt;').appendTo('body'); } </code></pre> <p>When window.onbeforeunload gets called (i.e user navigating away from the page) ShowMe() gets executed but I do not see the image on the page.</p> <p>However if you run showMe() in your console the image will show. </p> <p>This is happening in all non-FireFox Browsers. Firefox seems to work fine. </p>
javascript jquery
[3, 5]
5,510,515
5,510,516
Select option is added or removed event
<p>How can I detect if OPTION is added or removed from SELECT?</p> <p>I know about this: <a href="http://stackoverflow.com/questions/8124919/jquery-event-for-when-options-are-added-or-removed-from-a-select">jquery event for when &lt;option&gt;s are added or removed from a &lt;select&gt;</a></p> <p>this select boxes are controled by another js that I can't put my own function call in.</p> <p>Can I detect somehow that option has been removed by another js? </p>
javascript jquery
[3, 5]
1,535,907
1,535,908
Cannot perform instanceof check against parameterized type ArrayList<Foo>
<p>The following code:</p> <pre><code>((tempVar instanceof ArrayList&lt;Foo&gt;) ? tempVar : null); </code></pre> <p>causes:<br> <code>Cannot perform instanceof check against parameterized type ArrayList&lt;Foo&gt;. Use the form ArrayList&lt;?&gt; instead since further generic type information will be erased at runtime</code></p> <p>Can someone explain me what is meant by <code>"further generic type information will be erased at runtime"</code> and how to fix this?</p>
java android
[1, 4]
3,456,910
3,456,911
.offset().top returning the wrong value
<p>I'm having a bizarre issue that I don't know how to solve and was wondering if you guys could help.</p> <p>A bit of background: I have been asked to create a system where subpages of a page in wordpress are loaded on the end of that page in an infinite scroll. This is working correctly. </p> <p>They also want the top nav links to load all content upto and including the page they clicked and then scroll to it. </p> <p>If I scroll down (loading the pages) and then click a top nav link the scroll works correctly. However if I load NO further pages before clicking one of the links, the pages will load, and the scroll will start, but will only get some of the way before stopping. This is due to an incorrect value being given by offset().top. My question is why ?</p> <pre><code>function ajaxloadnscroll(index) { //If the page has already been loaded then just scroll to it if (pages[index].loaded) { $('html, body').animate({ scrollTop: $("#" + pages[index].name).offset().top }, 2000); return; } //Loop through pages up to one clicked. for (i = 0; i &lt;= index; i++) { current = i; if (!pages[current].loaded) { $.ajax({ url: pages[i].url, async: false, context: document.body, success: function(data) { if (data) { $("#tempload").before(data); pages[current].loaded = true; if (current == index) { $('html, body').animate({ scrollTop: $("#" + pages[current].name).offset().top }, 2000); } } } }); } } //Increment current in order to load next page object on scroll. current++; return false; }​ </code></pre> <p>Any help you could give me on this issue would be really appreciated!</p>
javascript jquery
[3, 5]
4,635,790
4,635,791
getting .append values from the DOM
<p>In the function below, I'm finding the max count of an ID then adding 1. Everything works, except the new values being added to the DOM aren't seen, therefore they are not incremented upon calling the function a second time. </p> <p>Am I not adding the new values to the DOM correctly?</p> <pre><code>function addEdu(){ var currentCount = $('input.uniqueId').val(); currentCount = Math.max(currentCount); var nextCount = parseInt(currentCount) + 1; var newEdu = "&lt;input type='hidden' name='fieldId[]' value='" + nextCount + "' class='uniqueId' /&gt;&lt;p class='dual'&gt;&lt;input type='text' name='educationTitle[]' "; //Shortened for clarity $("#eduHistory").append(newEdu); $( ".datepicker" ).datepicker(); } </code></pre>
javascript jquery
[3, 5]
642,996
642,997
access other properties of a databound repeater in codebehind
<p>I have a repeater bound to a datasource, in the itemtemplate for the repeater i have a link button</p> <p>im using stuff like: <p>&lt;%# Eval("myfield") %></p> to get data for the item.</p> <p>i need a linkbutton in there that when clicked I can access all the properties relevant to that item in the onclick event handler in the backend.</p> <p>how do i access the other properties of a paticular item, when a button within the itemtemplate is clicked.</p> <p>thanks</p>
c# asp.net
[0, 9]
5,703,184
5,703,185
Taking credit card payments in app
<p>Is there any service or api that will allow me to accept credit card payments within my iphone and android apps?</p> <p>I can't find anything using an extensive google search.</p> <p>Will servies like sage or similar work at all? Will I need a webview?</p> <p>Thanks</p>
android iphone
[4, 8]
125,767
125,768
How to give image path in js/Jquery if image file exist in a different drive?
<p>My application is working in locale. I want to display one image using jquery. Image is located in one virtual drive created in my locale machine.</p> <p>This is the path I given</p> <pre><code>var str='&lt;div&gt;'; str='&lt;img src="'+virtualDriveName+':/test_folder/data/images/'+file_name+'.jpeg" height="100" width="100" &gt;'; str+='&lt;/div&gt;'; $(".ImageHolderDiv",$("#"+uniqueId)).append(str); </code></pre> <p>But its not displaying now. How to give image path if the needed image file exist in a different drive.</p> <p>Eg:- My application running from C:drive. My image files are in F: drive. How can I display those images in my application?</p>
javascript jquery
[3, 5]
5,839,092
5,839,093
Create file from Uri exception occurs
<p>While creating a file from Uri and exception Occured. The value of exception shows null.</p> <pre><code>try { File mFile = new File(new URI(mediaUri.toString())); data = readFile(mFile); } catch (Exception e) { Log.e("Error", e.getLocalizedMessage()); } </code></pre> <p>Please help</p> <p>Thanks in advance.</p>
java android
[1, 4]
2,028,952
2,028,953
How to pass values in URL in c#
<p>I am redirecting to a page changepassword, I want to pass the useremail and password in the url which I get in the current page. How can I pass it in the url. I dont want to use session or cookie. </p> <pre><code> Response.Redirect("ChangePassword.aspx"); </code></pre>
c# asp.net
[0, 9]
1,510,975
1,510,976
how to upload folder to server in asp.net c#
<p>I think the Folder upload is supported java applet. But how can i use java applets in Asp.net c# Please tell me about this, without the Flash and silverlight.</p>
c# asp.net
[0, 9]
4,877,381
4,877,382
jQuery click event problems when selecting by class and <div>
<p>When I access <code>&lt;div&gt;</code> or <code>&lt;p&gt;</code> elements by class with jQuery for a click function, it repeats the event by how many elements are in the array or stack. So, if I have 3 <code>&lt;div&gt;</code> elements on top of each other or next to each other, the one on the bottom, or the one to the right, will go through the event once and the one on the top or the left will go through the event 3 times.</p> <p>Am I doing something wrong? Or is this not meant to be done with jQuery? </p> <p>[revision] sorry if i worded this in a confusing way. here is a link... you will better understand my problem there. just add a couple new elements via the form and click on them.</p> <p><a href="http://jsfiddle.net/rNj6e/" rel="nofollow">http://jsfiddle.net/rNj6e/</a></p>
javascript jquery
[3, 5]
1,932,581
1,932,582
how do i avoid including jquery twice?
<p>i have a service i'm building, which will be included as JS on client web pages. optimally, i want to build the service using jquery.</p> <p>the case may arise, where the page already has JQ included.</p> <p>how do i avoid including JQ twice in the page? how do i make sure i still have the desired JQ functionality, even if the page has already included an older version of JQ?</p> <p>is the only solution simply abandoning JQ and going with hand-coded script?</p>
javascript jquery
[3, 5]
1,463,655
1,463,656
Budget app problems
<p>I want to create an app that where the main page will display the current balance and allow you to go to 1 of two pages. The second page will allow you to enter deposits. The third page will allow you to make withdrawals.</p> <p>I'm having a problem with the code, when I click the buttons on the main page, the page opened is blank. What am I doing wrong possibly that the page isn't showing?</p> <p>Also, how can I carry the data from deposit or withdrawal pages over the main page to show the current balance?</p>
java android
[1, 4]
5,737,813
5,737,814
Need some help converting C# method to C++
<p>I am a C# guy who is desperately trying to learn C++ and port some old code over. Been doing OK so far but the following method has me stumped. If anyone could give me some pointers (sorry for pun) I would be grateful.</p> <p>C# method: </p> <pre><code>public static string crappyEncryption(String userKey) { StringBuilder eStr = new StringBuilder(); String key1 = "somehorriblelongstring"; String key2 = "someotherhorriblelongstring"; for (int i = 0; i &lt; userKey.Length; i++) { eStr.Append(key2[key1.IndexOf(userKey[i])]); } return encodeTo64(eStr.ToString()); } </code></pre> <p><code>encodeTo64</code> is a local method which I have solved in C++. This weird method (if you were wondering) was a small encryption method I came up with that we could use mobile cross platform for non-essential string encryption.</p> <p>Thanks very much</p>
c# c++
[0, 6]
5,338,578
5,338,579
weird behavior with redirecting if the user is not logged-in
<p>I have a two <code>setInterval(myFunction,40000)</code> and <code>setInterval(myFunction2,50000)</code> where myFunction and myFunction2 are making ajax requests and if the user is not logged-in</p> <pre><code>echo '&lt;meta http-equiv="refresh" content="0;url='.$home.'" /&gt;'; echo '&lt;script type="text/javascript"&gt; self.location = "'.$home.'"; &lt;/script&gt;'; exit(); </code></pre> <p>In the ajax respons there is :</p> <pre><code>&lt;meta http-equiv="refresh" content="0;url=http://site.com/login" /&gt; &lt;script type="text/javascript"&gt; self.location = "http://site.com/login"; &lt;/script&gt; </code></pre> <p>but the page is not changing and after 6 requests is changing.</p> <p>The ajax</p> <pre><code>$.ajax({ type:"POST", url:"http://site.com/thing.php", data:submitData, dataType:"html", success:function(data){someDiv.html(data);} }); </code></pre> <p>in thing.php</p> <pre><code>&lt;?php if(is_logged()){ -- the code } else { -- the redirect code } ?&gt; </code></pre> <p>?></p> <p>And the code is working but after the 6 request </p>
php javascript
[2, 3]
1,995,212
1,995,213
Replace first character inside the label
<p>How can I change each labels first character except the last labels character $ sign to &pound; using jQuery?</p> <p>Here is the code:</p> <pre><code>&lt;p align="center" id="myradio"&gt; &lt;label&gt;$25.00 &lt;/label&gt; &lt;input checked="checked" class="hide_input" name="amount" type="radio" value="25.00" /&gt; &lt;label&gt;$50.00&lt;/label&gt; &lt;input class="hide_input" name="amount" type="radio" value="50.00" /&gt; &lt;label&gt;$100.00&lt;/label&gt; &lt;input class="hide_input" name="amount" type="radio" value="100.00" /&gt; &lt;label&gt;$250.00&lt;/label&gt; &lt;input class="hide_input" name="amount" type="radio" value="250.00" /&gt; &lt;label&gt;$500.00&lt;/label&gt; &lt;input class="hide_input" name="amount" type="radio" value="500.00" /&gt; &lt;label&gt;$1000.00&lt;/label&gt; &lt;input class="hide_input" name="amount" type="radio" value="1000.00" /&gt; &lt;label&gt;other amount&lt;/label&gt; &lt;input class="show_input" id="other" name="amount" type="radio" value="" /&gt; &lt;/p&gt; </code></pre>
javascript jquery
[3, 5]
1,961,442
1,961,443
iTune-style apps using C#
<p>I'd like to develop some wIndows apps using C# that similar to iTune. The app is similar to iTune where it updates information on the iPhone whenever the phone is connected to a windows-based PC/laptop.</p> <p>From Apple Development Center, my understanding is that I would need the "Accessories SDK" but looking for your guidance on:</p> <ul> <li>How to start</li> <li>What do I need (SDK, ...)</li> </ul> <p>I am using Visual Studio 2008 as development tool.</p> <p>Thanks in advance.</p> <p>Dat</p>
c# iphone
[0, 8]
3,271,168
3,271,169
How to make tooltip in JQuery for a textbox?
<p>Anyone knows how to make tooltip for textbox? Like the image below: </p> <p><img src="http://i.stack.imgur.com/dz8X8.png" alt="enter image description here"></p> <p>I want the tooltip be positioned at the near-right of the textbox, plus with some animation.<br> Any suggestion will be appreciated.</p>
javascript jquery
[3, 5]
1,259,657
1,259,658
creating a-z bar
<p>below is the code i am using currently but wondering is there a better way of doing what i am doing... i am creating a-z model like A B C D E ....Z</p> <p>any thoughts?</p> <pre><code>if (myEnum.MoveNext()) { MyNames t = myEnum.Current; if (t.Name.ToLower().StartsWith("a")) { if (_a == 0) { l = new Literal(); //..... _a = 1; } } if (t.Name.ToLower().StartsWith("b")) { if (_b == 0) { l = new Literal(); l.Text = "&lt;h1 id='B'&gt;&lt;span&gt;B&lt;/span&gt;&lt;/h1&gt;" + Environment.NewLine; _b = 1; } } .....c..d...e...f...g....z } </code></pre>
c# asp.net
[0, 9]
3,879,225
3,879,226
Proper use of AsyncTask
<p>I have a code like this:</p> <p>In a Button Click I wrote this Code:</p> <pre><code>new Loadiing().execute(); </code></pre> <p>It takes to the AsyncTask class That I created, My class Looks Like:</p> <pre><code>public class Loadiing extends AsyncTask&lt;Void,Void,Void&gt;{ ProgressDialog d= new ProgressDialog(Main.this); @Override protected void onPreExecute() { // TODO Auto-generated method stub ProgressDialog.show(Main.this, "", "Loading"); } @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub **A method which returns some data in a arrayadapter and sets it;** return null; } @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub d.dismiss(); } } </code></pre> <p>but it is just starting an alert dialog, nothing is done in the background and also the dialog is not being dismissed, what to do?</p>
java android
[1, 4]
5,742,648
5,742,649
Window.onload event and $(document).ready()
<p>I am learning jQuery. Could someone please explain what the difference between the <code>window.onload</code> event and <code>$(document).ready()</code> in jQuery is? </p> <p>Regards, JN</p>
javascript jquery
[3, 5]
2,348,951
2,348,952
javascript search() working problem
<p>I have an jquery autosuggest plugin in which when i type ex. <code>Korea</code> then it show 2 results i.e. <code>Korea (North)</code> &amp; <code>Korea (South)</code> but when i type <code>Korea (</code>, its not displaying any result where it had to show both <code>Korea (North)</code> &amp; <code>Korea (South)</code>.</p> <p>After searching in the code for the error then i found a <code>search()</code> function which search for the type string in the results..</p> <p>means: <code>Korea (</code> in <code>Korea (North)</code> &amp; <code>Korea (South)</code></p> <p>and i think this search function stops at bracket <code>(</code> and i don't know why???</p> <p>Please, suggest a search() function to remove this error..</p> <p>code:::</p> <pre><code>str.search(query) != -1 </code></pre> <p>where: str = one result at a time i.e. <code>Korea (North)</code> query = entered string i.e. <code>Korea (</code> </p>
php javascript jquery
[2, 3, 5]
4,612,013
4,612,014
Find available bandwidth from Python or C++
<p>I am trying to get the available bandwidth from my PC. </p> <p>Suppose I'm streaming a video at 2 Mbps and my network card is of 100 Mbps, my program should tell me that 98 Mbps is available. </p> <p>Is it easy to do in C++ or Python? And how can I find the available bandwidth using any of the suggested programming language. Any help will be appreciated.</p>
c++ python
[6, 7]
6,021,297
6,021,298
Count characters/sms using jQuery
<p>I count characters using <a href="http://tpgblog.com/noblecount/" rel="nofollow">NobleCount</a> and the following code:</p> <pre><code>$('#message').NobleCount('#messageInfo',{ max_chars: getMaxChars(), on_negative: function(t_obj, char_area, c_settings, char_rem){ } }); </code></pre> <p>I want a feature like counting SMS, if the limit is reached the next 160 chars are for the second sms and so on. I can use parameters like on_update, on_positive, on_negative and block_negative.</p> <p>I tried something using modulo but it does not work. Any ideas?</p>
javascript jquery
[3, 5]
1,552,691
1,552,692
jQuery 1.6 Browser detection
<p>With all these api changes in jquery, what is the 'latest' best practice to detect browser name and version in jQuery?</p> <p>Also, is jquery the recommended language to detect browsers or should I use server-side?</p>
javascript jquery
[3, 5]
385,649
385,650
Unable to Print the full content of Page when horizontal scroll bar appears
<p>I need to print the current page in the asp.net application for that I am using <code>javascript:window.print()</code>.</p> <p>It's working fine when the page content is within the bounds. However, if the horizontal scrollbar appears as a result of overflow, am able to print only the visible content while the overflown contents couldn't be printed. </p> <p>Is there any workaround to get this working? Is there any other alternative apart from javascript to achieve this functionality?</p>
javascript jquery asp.net
[3, 5, 9]
5,048,768
5,048,769
Using jQuery to perform .load on originating page div, from floatbox popup
<p>I have 3 pages, we'll call them Page A, B, &amp; C.</p> <p>On Page A, Page C loads into a div. Also on Page A, there's a link-click that opens Page B with Floatbox (like a popup).</p> <p>On Page B, there's an onClick function that should reload Page C into the div that is located on page A (underneath the floatbox popup).</p> <p>The function on Page B is currently trying to load the div onto Page B. I verified this by adding a copy of the div to Page B, and it loads there, as expected.</p> <p>How can I make the function on Page B target the div on Page A?</p> <p>On page B I'm using: </p> <pre><code>function functionName() { $('#divName').loadfunction functionName('pageC.php'); { } </code></pre>
javascript jquery
[3, 5]
46,066
46,067
Is it possible to check if the mouse pointer is on the certain class?
<p>Is it function in jQuery? Pseudo code:</p> <pre><code>$('.smth').bind('mouseout', function(){ if($('.certain_class').magic_function()) { $('.fading_object_class').fadeOut("fast"); } }); </code></pre> <p>If mouse pointer is not on the class <code>certain_class</code>, it would fade. </p> <p>P.S. It's for my tooltip plugin.</p>
javascript jquery
[3, 5]
3,945,872
3,945,873
Is there a way to make sure PHP is being loaded only by JS?
<p>Is there a way to make a PHP file so that it can only be loaded and executed by the Javascript code that I write? I.e can I make sure that someone can't read my JS, load up the PHP page in their browser with their own variables, and make unauthorized changes to my database? Any help much appreciated.</p>
php javascript
[2, 3]
1,944,680
1,944,681
How to start YouTube Video by clicking on its cover image (jQuery)?
<p>I have some code that works fine to show YouTube Video.</p> <p>What I want is when I click on the cover image then it should start to play video.</p> <p>How I can implement it?</p> <p>Thank you!</p> <pre><code>&lt;div id="video" style="display: none;"&gt; &lt;object width="370" height="230"&gt; &lt;param name="movie" value="http://www.youtube.com/v/QN20iMIMxvk?version=3&amp;autohide=1&amp;showinfo=0"&gt; &lt;/param&gt; &lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt; &lt;embed src="http://www.youtube.com/v/QN20iMIMxvk?version=3&amp;autohide=1&amp;showinfo=0" type="application/x-shockwave-flash" allowscriptaccess="always" width="370" height="230"&gt;&lt;/embed&gt; &lt;/object&gt; &lt;/div&gt; &lt;a href="javascript:document.getElementById('video').style.display = 'block'; javascript:document.getElementById('videopic').style.display = 'none'; void(0);"&gt; &lt;img id="videopic" src="@Url.Content("~/images/coverimage1.jpg")" style="width:370px; height:230px;" alt="Media" /&gt;&lt;/a&gt; </code></pre>
javascript jquery
[3, 5]
188,207
188,208
filling javascript object "on the fly"
<p>HI, i have an object: var myobject = new Object; and i want to dynamically fill it with properties while looping through jquery input collection in that manner:</p> <pre><code>$('.test').each(function(){ myobject.$(this).attr('name') = $(this).val(); }); </code></pre> <p>what i'm doing wrong here? thanks in advance</p>
javascript jquery
[3, 5]
3,708,606
3,708,607
Sending click event to parent anchor
<p>How do I send a click event (JS or JQuery) to a parent object that is an anchor? My basic HTML looks like:</p> <pre><code>&lt;a href="javascript:myFunc(1,2,3)"&gt; &lt;img id="btn1" src="myimg.png"&gt; &lt;/a&gt; </code></pre> <p>So I can easily reference the anchor through button via: </p> <pre><code>document.getElementById('btn1').parentNode </code></pre> <p>However, </p> <pre><code>document.getElementById('btn1').parentNode.click </code></pre> <p>while it doesn't seem to raise an error in the console on firebug, the javascript function doesn't seem to be firing either. How do I send a click to this thing. By the way, I don't have control of the HTML so I can't just ad an ID to the anchor tag.</p>
javascript jquery
[3, 5]
3,838,550
3,838,551
Input field not registering javascript event on first click/focus
<p>I am trying to trigger a datepicker() object on input textboxes. So all inputs with the .dateField class would trigger a datepicker() on click/focus. But it isnt working. It does not work the first time i click. If i click outside the box and then again click inside the box, it works. </p> <pre><code>$(".dateField").bind('click focus change', function(){ $(this).datepicker(); }) </code></pre>
javascript jquery
[3, 5]
3,915,509
3,915,510
Is there any way to clone hardcoded Element or Set of Elements using jquery in runtime?
<p>I need to know how to clone hard coded elements in runtime?</p> <p>I have a hard coded input field. In run time is it possible to read that element and make it multiple(append) by user request. Is that possible with jquery or javascript.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
511,641
511,642
Show tooltip for the selected items in CheckBoxList control
<p>I cannot show more than one checkbox item from CheckboxList control out of 70 items due to space constraints. I should facilitate the user to select multiple items from the CheckboxList control. Hence I want to show Tooltip for the user to make him understand what all items he has selected. After then only user can click on the Insert button to insert into the database. How can I do this in asp.net. Do I need to use JavaScript also? Any suggestions please...</p>
javascript asp.net
[3, 9]
2,653,519
2,653,520
Observing Applications via Heartbeat in Asp.net
<p>I have seen an article in code project regarding <a href="http://www.codeproject.com/KB/dotnet/heartbeat.aspx" rel="nofollow">Observing Applications via Heartbeat</a> i would like to implement the same for asp.net web forms how can i do this with out creating a wcf service and all. When i run the application i would like to have the same functionality as per he does can any one help me</p>
c# asp.net
[0, 9]
839,622
839,623
jQuery multiple handler registration issue
<p>I have a button on my page which adds row by row on each click. I use this code:</p> <pre><code>$('#addCnt').live('click', function () { .. }; </code></pre> <p>Problem is when I reload the part of the page together with that code, it registers the handler again, so when button is clicked after that it appends N number of rows, where N = number of total page reload.</p> <p>How can I prevent that?</p>
javascript jquery
[3, 5]
3,780,992
3,780,993
How do you make the content of a div move with a blind effect rather then being revealed by it?
<p>Right now my blind effect reveals (or uncovers) the already-in-place contents of a div. I want the content to slide in with the blind rather then already being there. </p> <p>Whats the best way to do this?</p> <p>ex. i want to be able to see something positioned at the bottom of the div the whole time not just after the effect is done.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
5,416,931
5,416,932
Passing a String from one method to another method
<p>Sorry for this newbie simple question, but I need to pass a String from one method to another method and now I'm a bit clueless</p> <p>the String values (callbackURL &amp; donationId) I wanna pass are inside this method:</p> <pre><code>public void postData() { . . . . String callbackURL = tokens.nextToken(); String donationId = tokens.nextToken(); } </code></pre> <p>and I want to pass the values to another method, let's say it's called <code>private examplePayment()</code>. How am I able to perform that? Thank you</p>
java android
[1, 4]
857,975
857,976
Preventing MicrosoftAjaxWebForms.debug.js from loading
<p>I've got an ASP.NET web application, and I'm attempting to reduce HTTP calls to the server, so I'd like to not load things like <code>MicrosoftAjaxWebForms.debug.js</code> and <code>MicrosoftAjax.debug.js</code>. </p> <p>Script manager is used to form all of my external javascript files into one, and I'm concerned that this is causing other non-related libraries to be loaded.</p>
asp.net javascript
[9, 3]
4,919,792
4,919,793
When using $(document).ready why must it be in an anonymous function?
<p>I use document ready all the time, but I'm watching some tutorial videos to really KNOW whats going on instead of just knowing from typing it so much.</p> <p>I had always put it in an anonymous function out of habit as thats how its always done, but now I see if its NOT in an anonymous function (say <code>alert();</code> for instance), it will execute NOT when the DOM is loaded but immediately when that javascript loads. It must be in an anonymous function for this to happen how its supposed to (when the whole page loads) and the event listeneter triggers that its 'ready'.</p> <p>Why is this?</p> <p>furthermore I often see something like function(i){}(i), what does this mean?</p>
javascript jquery
[3, 5]
2,952,648
2,952,649
How many sprite sheets can I load into an average iPhone/Android?
<p>I am planning to make a game using the <a href="http://www.giderosmobile.com/" rel="nofollow">gideros engine</a> and it looks like I will need about 20 sprite sheets (2048 х 2048) each.</p> <p>What do you think, would an average iPhone/Android be able to handle it?</p> <p>Thanks.</p>
android iphone
[4, 8]
1,863,028
1,863,029
Detect if java is installed on the web server from php
<p>Is it possible to detect from a php script if java is installed on the server (if I can run an exec() command with java)?</p> <p>Thanks,</p> <p>Benjamin</p>
java php
[1, 2]
1,648,145
1,648,146
colors.xml resource does not work
<p>I created a colors.xml file in my Android app under /res/values/colors.xml. The contents are...</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;color name="Green"&gt;#00ff00&lt;/color&gt; &lt;/resources&gt; </code></pre> <p>I try to update the background of my a TableRow using...</p> <pre><code> TableRow test = (TableRow)findViewById(R.id.tableRow2); test.setBackgroundColor(R.color.Green); </code></pre> <p>This does not set it as green, it is gray instead. No matter what values I add to the colors.xml file, it is always the same gray color. However this does work...</p> <pre><code> TableRow test = (TableRow)findViewById(R.id.tableRow2); test.setBackgroundColor(android.graphics.Color.GREEN); </code></pre> <p>Is something wrong with my colors.xml?</p>
java android
[1, 4]
5,563,753
5,563,754
jQuery - How to get selected text from textarea/input?
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/144810/jquery-get-textarea-text">jQuery get textarea text</a><br> <a href="http://stackoverflow.com/questions/717224/how-to-get-selected-text-in-textarea">How to get selected text in textarea?</a> </p> </blockquote> <p>So I want to get the text selected within textarea. val() returns entire text so that's no good.</p>
javascript jquery
[3, 5]
5,556,834
5,556,835
Dynamic simple home page builder in Asp.Net
<p>I need a simple home page website developed in Asp.Net with an admin login through which I can totally change the way the website looks....from header,footer to content.</p> <p>Does any simple application exist like this already? or should we start developing it?</p> <p>Thanks.</p>
c# asp.net
[0, 9]
1,938,309
1,938,310
Content disappears after user finishes entering groceries
<p>Happy new year, everyone! I'm celebrating by working on learning jquery. I added some jQuery to my code below and managed to add some content and change some css with it. The getGroceries function is working fine and is doing what it's supposed to do. When the user finishes entering the groceries, the program (printGroceries) is supposed to print the list that the user entered. That portion is also working.... HOWEVER, when that happens, the program removes the header (My grocery list) and removes all styling. </p> <p>What am I doing wrong? </p> <p>EDITED CODE: Deleted full code and added the portion that I changed (commented the old). </p> <pre><code>function printGroceries(groceryItems) { if (groceryItems.length &gt; 1) { $('grocery-list').html('&lt;ol class="items" id="list-items"&gt;'); //document.write("&lt;ol&gt;"); for(x=0; x &lt; groceryItems.length;x++){ groceryItems; $('#list-items').prepend('&lt;li&gt;' + groceryItems[x] + '&lt;/li&gt;'); //document.write("&lt;li&gt;" + groceryItems[x] + '&lt;/li&gt;'); } $('#grocery-list').append('&lt;/ol&gt;'); //document.write("&lt;/ol&gt;"); } else { $('#grocery-list').prepend('&lt;p&gt;Sorry, your list is empty.&lt;/p&gt;'); //document.write('&lt;p&gt;Sorry, your list is empty.&lt;/p&gt;'); } } </code></pre> <p>Problem: <a href="http://jsfiddle.net/arunpjohny/vbJpG/" rel="nofollow">fiddle</a></p>
javascript jquery
[3, 5]
1,430,626
1,430,627
Cannot call JavaScript function in PHP
<p>I cannot call JavaScript function in PHP. Any reference will be help me.</p> <p>Thanks. </p> <pre><code>&lt;script type="text/javascript" src="modules/HelpDeskPlus/js/stylemap.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"&gt;&lt;/script&gt; &lt;?php echo '&lt;script type="text/javascript"&gt;', 'load();', '&lt;/script&gt;'; ?&gt; </code></pre> <p>function load() in stylemap.js</p> <p>this Function need to load only Google Maps.</p>
php javascript
[2, 3]
782,117
782,118
Globalization/CultureInfo in Android
<p>It is possible to set the culture (for let's say en-Us) for the entire application? I know that in C# this is possible.</p> <p>thanks advanced.</p>
java android
[1, 4]
3,675,615
3,675,616
Javascript date/time picker with ASP.NET 3.5
<p>I finally found a date/time picker that I can use but I don't know how to make it work in my ASP.NET CODE</p> <p>I like to use the ASP textBox.</p> <p><a href="http://www.dynarch.com/projects/calendar/" rel="nofollow">http://www.dynarch.com/projects/calendar/</a></p> <p>Or, if you happen to know a better date/time picker, that would be fine also. The time part is very important.</p> <p>Thank you,</p> <p>Steve</p>
c# asp.net
[0, 9]
2,841,749
2,841,750
jQuery equivalent selectors
<p>Are the following exactly equivalent? Which idiom do you use and why?</p> <pre><code>$('#form1 .edit-field :input') $('#form1 .edit-field').find(':input') $('.edit-field :input', '#form1') $(':input', '#form1 .edit-field') </code></pre>
javascript jquery
[3, 5]
4,294,427
4,294,428
jquery image zoom
<p>Hello i am using a script to enlarge an image on hover, however it enlarges from the top-left and i need it to hover from the centre and i cannot figure out how to add the css into the jquery to add negative margin so it goes the way i want it to, here is the script.</p> <pre><code>$('#sun').width(); $('#sun').mouseover(function(){ $(this).css("cursor","pointer"); $(this).animate({width: "7%"}, 'slow'); }); $('#sun').mouseout(function(){ $(this).animate({width: "6%"}, 'slow'); }); </code></pre> <p>i just want "margin w x y z" in the css but cant get it :/ any one able to help? Thank you :)</p>
javascript jquery
[3, 5]
1,113,630
1,113,631
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 &lt; Page_Validators.length; i++) { var validator = Page_Validators[i]; var controlId = validator.controltovalidate; if ($(control).attr('id') == controlId &amp;&amp; validator.isvalid == false) { return false; } } return true; } </code></pre> <p>Anybody has any better alternatives?</p>
javascript jquery asp.net
[3, 5, 9]
4,636,563
4,636,564
How to record video using Intents?
<p>I need to unserstand how I can record video programatically. Now I use this construction:</p> <pre><code>public class AndroidLearningActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.main); Intent captureVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(captureVideoIntent, 100); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { Uri uri=data.getData(); Log.e("result", "result:"+resultCode); } } </code></pre> <p>When the application is opened then the camera will be opened too. I have record some video, but if I press "back" button on the device then the application crushes. Please, explain me, how can I do it? Thank you. </p>
java android
[1, 4]
249,277
249,278
How can I parse content of entered URL?
<p>I need to parse content type of typed URL:</p> <ol> <li>if it's an image then do something.</li> <li>if it's a web page then scan this page for images and fill array with images' SRC attributes (and order it by size).</li> </ol> <p>How can i do this using only JS? How can i do this using only ASP.NET and C#?</p>
javascript asp.net
[3, 9]
5,195,087
5,195,088
facebook app loading slow in android
<p>i took the example from </p> <p><a href="http://developers.facebook.com/docs/guides/mobile/" rel="nofollow">http://developers.facebook.com/docs/guides/mobile/</a> now whenever </p> <p>i run the app...either it takes too long time to load the face book sign-up or it never loads...it stays in whit screen with heading <img src="http://i.stack.imgur.com/bsveB.png" alt="this is the way it loads the fc app"></p> <p>now what shall i do to load in a faster way... </p> <p>`public class MyGreatActivity extends Activity {</p> <pre><code>Facebook facebook = new Facebook("20875929582353"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); facebook.authorize(this, new DialogListener() { @Override public void onComplete(Bundle values) { // TODO Auto-generated method stub } @Override public void onFacebookError(FacebookError e) { // TODO Auto-generated method stub } @Override public void onError(DialogError e) { // TODO Auto-generated method stub } @Override public void onCancel() { // TODO Auto-generated method stub } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); facebook.authorizeCallback(requestCode, resultCode, data); } </code></pre> <p>}`</p>
java android
[1, 4]
1,169,346
1,169,347
assign value to javascript variable In C# CodeBehind
<p>How can i assign value to javasctipt variable from code-behind (C#)?</p> <pre><code>&lt;script type="text/javascript"&gt; String.prototype.trim = function () { return this.replace(/^\s+|\s+$/, ''); }; function ConstantByCode(_Obj, _Div) { var pl = new SOAPClientParameters(); _Obj.value = _Obj.value.trim(); pl.add("Code", _Obj.value); pl.add("Group", _Obj.Grp); alert(_Obj.Grp); var _Value = SOAPClient.invoke("ConstantWS.asmx", "GetConstantByCode", pl, false, CallBackEvent); if (_Value == null || _Obj.value == "" || _Obj.value == null || IsNumeric(_Obj.value) == false) { _Obj.value = ""; _Div.innerHTML = ""; } else { _Div.innerHTML = _Value; } } function CallBackEvent(r) { } function IsNumeric(input) { return (input - 0) == input &amp;&amp; input.length &gt; 0; } </code></pre> <p></p> <p>BehindCode</p> <pre><code> txtCode.Attributes.Add("Grp", Me.ConstValue) txtCode.Attributes.Add("onchange", "ConstantByCode(this," &amp; DivTitle.ClientID &amp; ");") txtCode.Attributes.Add("onkeyup", "ConstantByCode(this," &amp; DivTitle.ClientID &amp; ");") </code></pre> <p>_obj.Grp has now value. alert said : undefined</p>
c# javascript asp.net
[0, 3, 9]
5,833,431
5,833,432
need clarification on Datatable
<p>I need your help on this. In my copde I am using data table ... manually creating rows/columns in DT and populating them and lastly binding it to GridView.</p> <p>I want to add a cell to each datarow in data table and the cell in turn will hold a HTML Control (HTML Anchor Tag). </p> <p>Say, my current DT has 2rows and 3 cols as below</p> <pre><code>server blah blah abc xyz 123 def vbh 345 </code></pre> <p>Now, I want to do further processing on servername (on col1) and add a extra col to DT which will hold HTML Anchor Tag. the details can be seen clicking on the HTML Anchor tag. So, ultimately the DT should look like below:</p> <pre><code>server blah blah abc xyz 123 HTML LINK def vbh 345 HTML LINK </code></pre> <p>Please tell how can I do this? i.e, add a separate cell to DT and add the HTML control to that bewly added cell.</p> <p>Thanks. Rahul</p>
c# asp.net
[0, 9]
3,006,702
3,006,703
How to get object values and properties in jquery?
<p>I am using jQuery selector to get the values of all CMS components on the page using <code>$('div.cmscomponent')</code> but how can I test this to see if am actually getting the list of compoents on the page. </p> <p>I use:</p> <pre><code>var temp = $('div.cmscomponent'); alert(temp); </code></pre> <p>and result that I get is [object OBJECT] and so how can I test this ? and how can I get values of the object and its properties.</p>
javascript jquery
[3, 5]
1,972,061
1,972,062
about location change
<p>hi i'm new to android programming, i want to ask about location API, i struggle to a problem here when i'm using a network provider to obtain location data, i view my log in logcat there is a change in my location data <code>12-19 23:22:08.556: DEBUG/NetworkLocationProvider(1974): onCellLocationChanged [9994,65172896]</code>, but i just can't seem update it in my phone, even the requestLocationUpdate listener method onLocationchanged() doesn't update,can you answer this?here is my code :</p> <pre><code>private void initLocation(){ locman = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lokasi = locman.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); locman.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,1 , 0,this); lat.setText("Latitude : 0 "); lon.setText("Longitude : 0 "); } @Override public void onLocationChanged(Location location) { lon.setText("Longitude : "+String.valueOf(lokasi.getLongitude())); lat.setText("Latitude : "+String.valueOf(lokasi.getLatitude())); Toast.makeText(this, lokasi + "",2000).show(); } </code></pre> <p>i can find anything wrong,but my location still doesn't change even when the logcat react to this thx </p>
java android
[1, 4]
4,569,259
4,569,260
How do I make sure a URL is an image using JavaScript + jQuery?
<p>In my web application, users can post text to a feed, and the text may include URL's. My code scans for URL's and replaces them which anchor tags pointed at the URL's. I want to change this so that my code can detect whether or not the URL points to an image, and if it does, render an image tag inside the anchor tag, instead of just the URL text.</p> <p>I can do this on server side code by sending a quick 'HEAD' request to the URL to see what the Content-Type is on the response, and this works reliably. However, it doesn't scale well for obvious reasons.</p> <p>What would be better is if I could push this logic onto the client's browser. I'd like to use JavaScript + jQuery to send the 'HEAD' request to the specified URL, and read the Content-Type header from the response.</p> <p>I know that cross-domain requests are an issue. Could I somehow use JSONP? What options do I have?</p> <h1>EDIT - SECURITY RISK</h1> <p>I got some good answers to my question, but I wanted to point out something in big bold letters. As Adam pointed out in the comments, this is a security risk. If you can guarantee the URL's of the images are all coming from trusted domains, you're good to go with this solution. However, in my scenario, users can enter whatever URL they want. This means they could create their own site which requires basic authentication, and then when the jQuery runs to set the src attribute on the created image, the user is presented with a username/password dialog, and that's obviously a <strong>huge</strong> risk.</p>
javascript jquery
[3, 5]
5,517,771
5,517,772
Exception Driven Programming in Java
<p>I just finished reading <a href="http://www.codinghorror.com/blog/archives/001239.html" rel="nofollow">Exception Driven Programming</a> and I'm wondering about something like <a href="http://code.google.com/p/elmah/" rel="nofollow">ELMAH</a> for Java. Did you know it?</p> <p>Interesting features:</p> <ul> <li>A web page to remotely view the entire log of recoded exceptions</li> <li>A web page to remotely view the full details of any one logged exception</li> <li>An e-mail notification of each error at the time it occurs</li> <li>An RSS feed of the last 15 errors from the log</li> <li>other interface (JSON, RESTful interface, etc)</li> <li>A number of backing storage implementations for the log, including in-memory, JDBC, JMS, etc</li> <li>open source</li> </ul> <p><strong>NOTE</strong></p> <p>log4j is for logging, it is not an integrated solution for exception handling </p>
c# java
[0, 1]
3,138,646
3,138,647
how to call a function in code behind from an external .js file
<p>i am developing a website in dotnet.</p> <pre><code>//function to close SearchSchool.aspx function CloseSchoolSearch() { //storing values window.close(); //call function in code behind } </code></pre> <p>This is a javascript function in an external .js file ,using this function i am storing some values in some hidden controls in an aspx page and closing pop window ,after that i want to execute a function in code behind.and remind one thing,i can't include this function .aspx page contaning that method i want to call.Can anyone guide me how to do this</p>
javascript asp.net
[3, 9]
754,047
754,048
Track when a download file dialog appears
<p>I have some links that when the user clicks one, it links to a php script which runs some stored procedures to generate data and then calls another script to download the data as an excel spreadsheet. This all works fine.</p> <p>What I'd like to do is have a loader gif appear beside the link that was clicked clicked and when the dialog appears to get the user to save the file, have that gif disappear again.</p> <p>Can I track this event at all to achieve this? Not had much luck so far.</p>
php javascript jquery
[2, 3, 5]
1,513,090
1,513,091
How to prevent url redirection if user types it manually to the address bar?
<p>I have an aspx page there i have a button that fix on it's click what page to redirect with the if else condition but it fixes it as expected but the prob is that when some one manually type the page URL it goes to there also, while i want to prevent this nature what should i do to stop it, please suggest me, i am using asp.net member ship but i suppose that is not much to so it with membership.</p>
c# asp.net
[0, 9]
1,052,906
1,052,907
Getting sender in jQuery
<p>I have a large list of check boxes all with unique <code>id</code> values. I'd like to get the <code>id</code> of the checkbox that executes my JavaScript function. Can I do this using <code>$(this)</code>? Can you provide an example?</p> <p>Many thanks in advance!</p>
javascript jquery
[3, 5]
5,452,469
5,452,470
Any javascript library for highlighting matched parts of text?
<p>I am looking for a library/jQuery plugin for doing things like on the picture below.</p> <p><img src="http://i.stack.imgur.com/1n0x2.png" alt="Image showing tooltip"></p>
javascript jquery
[3, 5]
4,882,968
4,882,969
Would it be useful to have method return values for null objects?
<p>Would it be useful to be able to provide method return value for null objects?</p> <p>For a List the null return values might be:</p> <pre><code>get(int) : null size() : 0 iterator() : empty iterator </code></pre> <p>That would allow the following code that has less null checks.</p> <pre><code>List items = null; if(something) { items = ... } for(int index = 0; index &lt; items.size(); index++) { Object obj = items.get(index); } </code></pre> <p>This would only be used if the class or interface defined it and a null check would still work. Sometimes you don't want to do null checks so it seems like it could be beneficial to have this as an option.</p> <p>From: <a href="http://jamesjava.blogspot.com/2007/05/method-return-values-for-null-objects.html" rel="nofollow">http://jamesjava.blogspot.com/2007/05/method-return-values-for-null-objects.html</a></p>
c# java
[0, 1]
2,692,383
2,692,384
ASP.Net Panel JQuery SlideToggle Postback
<p>I have an asp.net panel with a style which hides it and I'm using JQuery to slideToggle the panel using a hyperlink. This works fine. However, if I add a button on the page that causes a postback the panel will default back to hidden. I understand why this is happening but what is the best way to keep the panels visibility state when a postback occurs?</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type='text/javascript' src="jquery-1.4.1.min.js"&gt; &lt;/script&gt; &lt;style type="text/css"&gt; .panel { display: none; } &lt;/style&gt; &lt;script type="text/javascript"&gt; $(function() { $("#Link1").click(function(evt) { evt.preventDefault(); $('#panelText').slideToggle('slow'); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:HyperLink ID="Link1" runat="server" NavigateUrl="#"&gt;SlideToggle &lt;/asp:HyperLink&gt;&lt;br /&gt; &lt;asp:Panel ID="panelText" runat="server" CssClass="panel"&gt; Some text&lt;/asp:Panel&gt; &lt;asp:Button ID="button1" runat="server" Text="Postback" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
c# asp.net
[0, 9]
743,604
743,605
jquery.click(callmethod)
<p>$('').click(function(event) { ChangeXYZ(event); });</p> <p>Problem with above is i do not want event but i someother var.</p> <pre><code>$('&lt;a/&gt;').click(function() { ChangeXYZ(var123); }); </code></pre> <p>But problem with line is, it is getting value of var123 at runtime and as i am adding this in loop so always end up using last value of var123. Looks like it is using reference for var123. How can i make it use value of var123 when this was created instead of click time.</p>
javascript jquery
[3, 5]
1,721,462
1,721,463
raising custom events to allow web user controls to intercommunicate
<p>Hey , I have 2 web user controls, both inherit the same base class which extends UserControl. I want to raise an event on one and the other should be aware of it. both are on the same page however the 2nd control never handles the custom event i raised on the 1st one ! any ideas ? please just point to an implementation of possible (BTW, i'm googling it since morning but no luck !)</p>
c# asp.net
[0, 9]
3,011,584
3,011,585
Table data width
<p>I'm writing <a href="http://www.phillipsenn.com/Index/Project2/" rel="nofollow">an editor</a>, and would like for the input field to be the width of the column. So far, I have:</p> <pre><code>$td.html('&lt;input name="test" value="' + $td.text() + '" size="' + $td.width() + '"&gt;'); </code></pre> <p>The problem is: $td.width() is reporting numbers like 80 and 25, but the input needs to be in character widths. Even though my css says:</p> <pre><code>html { font-size:20px; } </code></pre> <p>I don't see any relation between the $td.width() and the size attribute. You would think it would be $td.width()/20.</p>
javascript jquery
[3, 5]
1,324,576
1,324,577
Compare jQuery Arrays with multiple DOM elements
<p>Consider this:</p> <pre><code>&lt;div class="test"&gt;one&lt;/div&gt; &lt;div class="test"&gt;two&lt;/div&gt; &lt;script&gt; var i1 = $('.test'); var i2 = $('.test'); console.log( i1 == i2 ); console.log( i1 === i2 ); console.log( i1.is(i2) ); &lt;/script&gt; </code></pre> <p>They all print <strong>false</strong> although they contain the same elements. One would think that <code>.is()</code> would work for comparing but it doesnt. How would you compare two jQuery objects?</p>
javascript jquery
[3, 5]
2,831,368
2,831,369
deferring JavaScript execution in document received via AJAX
<p>I'm receiving this HTML document via AJAX:</p> <pre><code> &lt;form enctype="multipart/form-data" method="POST" action="admin.php?do=media&amp;action=file-upload"&gt; &lt;div id="uploadForm"&gt; &lt;div id="fileList"&gt; &lt;/div&gt; &lt;a href="#" id="selectFile"&gt;[Select File]&lt;/a&gt; &lt;a href="#" id="uploadFile"&gt;[Start Upload]&lt;/a&gt; &lt;/div&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; // $(function(){}); not working when data loaded with ajax request var ajaxUpload = new plupload.Uploader({ runtimes: 'gears, html5, flash', url: 'upload.php', browse_button: 'selectFile', }); ajaxUpload.bind('Init',function(param){ console.log(param); console.log($('selectFile')); }); $('#uploadFile').click(function(){ alert('Something'); }); ajaxUpload.init(); &lt;/script&gt; </code></pre> <p>When I append this to the main document, the JavaScript inside it will immediately run and not be able to find the referenced DOM elements.</p> <p>It works when I add a time-out on the code, but I would like to know a better way at achieving this.</p> <p><strong>Update</strong></p> <p>Modified to reflect the true intent of the question.</p>
javascript jquery
[3, 5]
3,261,321
3,261,322
Text Message Broadcast Receiver with Other SMS Apps
<p>One of my favorite apps lately has been GO SMS. The problem is one of it and handcents features. They block any notification of a text from the stock sms app. The problem is I have an app that also needs to be able to to know when an sms is received, and whatever they do it keeping that from happening. Is there anyway or any other intents that I can use to know when an sms is received? Thank you!</p>
java android
[1, 4]
5,090,479
5,090,480
Best table / enum driven method calling system
<p>Consider I'm interfacing with an external system that will send a message (DB table, message queue, web service) in some format. In the "message header" there is the "MessageType" that is a number from 1 to 20. The MessageType defines what to do with the rest of the message. There are things like new, modified, deleted, canceled...</p> <p>My first inclination was to setup an enumeration and define all the types. Then parse the number into an enum type. With it as an enum I would setup the typical switch case system and call a particular method for each of the message types.</p> <p>One big concern is maintenance.<br /> A switch / case system is bulky and teadious but, it's really simple.<br /> Various table / configuration systems can be difficult for someone else to grok and add new messages or tweak existing messages.</p> <p>For 12 or so MessageTypes the switch/case system seems quite reasonable. What would be a reasonable cut-off point to switch to a table driven system?</p> <p>What kinds of systems are considered best for handling these types of problems?</p> <p>I'm setting a tag for both C# and Java here because it's definitly a common problem. There are many other languages with the same issue.</p>
c# java
[0, 1]
5,007,078
5,007,079
Credential Caching issue
<p>I have a static helper method that I wrap around SMTPClient to send email.</p> <p>I am storing the SMTP authentication in the web.config -> in the default location that System.Net namespace objects look for.</p> <p>I am passing the credentials to the SMTPClient, because I want to run my password decryption on the password before the SMTPClient uses this.</p> <p>The issue that I'm encountering here is - when I run this once, the password is stored somehwere as "decrypted" somehow in the cache. When I try and run this method a second time in the same session, I get an error, because it's trying to decrypt a password that was already decrypte the first time it was ran. Any ideas?</p> <pre><code> public static void SendEmail(MailMessage mailMessage) { SmtpClient smtpClient = new SmtpClient(); NetworkCredential nc = new NetworkCredential(); nc = (NetworkCredential)smtpClient.Credentials; nc.Password = Tools.Decrypt(nc.Password); smtpClient.Credentials = nc; smtpClient.Send(mailMessage); nc = null; smtpClient.Credentials = null; } </code></pre>
c# asp.net
[0, 9]
2,283,101
2,283,102
jQuery/Javascript Multiple Array Combinations
<p>I have been trying to find a solution to this with no avail. The idea of what i'm trying to achieve is to be able to find all unique combinations of multiple lists. So, let's say I have 3 lists of checkboxes (but this is an unknown number in the real-life application), Colour, Size, Pack Size. The items in the list's will be unqiue.</p> <pre><code>[0] =&gt; ['blue', 'green'] [1] =&gt; ['small', 'medium', 'large'] [2] =&gt; ['Pack Of 6', 'Pack Of 8'] </code></pre> <p>I will want to get "<strong>Blue, Small, Pack Of 6</strong>", "<strong>Blue, Medium, Pack Of 6</strong>", "<strong>Blue, Large, Pack Of 6</strong>", "<strong>Blue, Small, Pack Of 8</strong>", "<strong>Blue, Medium, Pack Of 8</strong>" etc.. The ordering isn't important, but would be nice to have it logically grouped. </p> <p>I already have the lists pulled out into an array using jQuery:</p> <pre><code> options = []; jQuery('.option-types').each(function(){ opts = []; jQuery('input:checked', this).each(function(){ opts.push(jQuery(this).next().text()); }); options.push(opts) }); </code></pre> <p>If there is a recursive functional path to answer this that would be ideal, as like i said the number of lists could be anything, aswell as the contents of the lists.</p> <p>Hope you guys and girls can help, this is doing my head in.</p> <p>Cheers - Dan</p>
javascript jquery
[3, 5]
3,043,274
3,043,275
Jquery Shortening code
<p>Ive posted a similar question before, yet again i find my self stupidly copy and pasting code.</p> <p>is there anyway i can combine the following, im sure there is.. Please help.. Im in the learning process.</p> <p>See i have the follow:</p> <pre><code>$(document).on('blur', 'input.email', function() { validate_Email_Input(this); }); $(document).on('blur', 'input.id', function() { validate_Id_Input(this); }); $(document).on('blur', 'input.pass', function() { validate_Pass_Input(this); }); $(document).on('blur', 'input.town', function() { validate_Town_Input(this); }); $(document).on('blur', 'input.relation', function() { validate_Relation_Input(this); }); $(document).on('blur', 'input.contact', function() { validate_Relation_Input(this); }); </code></pre> <p>and for all of those i have separate function, here's an example of one:</p> <pre><code>function validate_Email_Input(el) { var $this = $(el); var input_groups = $this.parent(); var isValid = true; $.each(input_groups , function(i){ var inpg = input_groups[i]; email_values = $.map($(inpg).children('input'), function(e,i){ return $(e).val(); }).join(''); isValid = isValid &amp;&amp; validate_Email(email_values, input_groups.parent().parent().parent()); }); return isValid; } </code></pre> <p>I really want to learn how to write efficient code, Any Help Greatly apreciated...</p> <p>I don't know if this helps at all. but what i'm trying to do is validate everything and have messages pop out for each specific field. This is my first really big project in jQuery and I thought i may as well show you all what im working on: <a href="http://jsfiddle.net/dawidvdh/36BLm/" rel="nofollow">http://jsfiddle.net/dawidvdh/36BLm/</a> </p> <p>sample of a valid ID: 85 0929 5266086</p>
javascript jquery
[3, 5]
1,244,946
1,244,947
Pass data from sub activity to parent activity
<p>I've seen this thread: <a href="http://stackoverflow.com/questions/3130585/android-how-to-use-data-passed-from-parent-activity-in-a-sub-activity">Android: how to use data passed from parent activity in a sub activity?</a> and ready about this method, but I'm wondering if this is outdated. Android has made a lot of strides since then and I don't want to do this the wrong way.</p> <p>Is this still the method that should be used?</p>
java android
[1, 4]
2,131,801
2,131,802
Java: What does this for-loop do?
<pre><code>for (String key : output.keySet()) { // some code } </code></pre> <p>Output is an object of hashmap and I want to iterate through the hashmap for all values. i find an example on the internet that write such for loop... But when I try to execute this, Eclipse does not allow me to do so. Please tell me an efficient way or explain this loop. So that I can iterate through the map.</p> <p>Pseudo of my function is somewhat like this</p> <pre><code>public void fuction (String key) { Set&lt;String&gt; keys = output.keySet(); // now i have to iterate through the keySet and match 'key' with the keys from keySet } </code></pre>
java android
[1, 4]
4,117,152
4,117,153
Is there a way to send a message from the server to client when an event happens?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1425048/implementing-server-push">Implementing Server Push</a> </p> </blockquote> <p>I want to send a message to the client from php to javascript when some event happens at the server side like for instance the user table is modified or something like this. When the event occurs, the server sends it to the client..How can I implement this ?</p> <p>If possible without using html5</p>
php javascript
[2, 3]
3,445,692
3,445,693
How to find a sibling element's value using jQuery upon click
<p>I'm trying to find the value of the userid and password in the below HTML using the following jQuery code, but it doesn't return any value. What am I doing wrong?</p> <pre><code>&lt;div id='mainpane'&gt; &lt;form id='login' method='post' action='#'&gt; &lt;p&gt;User Id:&lt;input id='userid' type='text' name='userid'&gt;&lt;/input&gt;&lt;/p&gt; &lt;p&gt;Password:&lt;input id='password' type='text' name='password'&gt;&lt;/input&gt;&lt;/p&gt; &lt;p&gt;&lt;input id='submit' type='submit' name='Submit' value='Submit'&gt;&lt;/input&gt;&lt;/p&gt; &lt;/form&gt; &lt;div id="message"&gt;&lt;/div&gt; &lt;p&gt;Not a member? &lt;a href="user-signup.html"&gt;Signup&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Here's the jQuery code:</p> <pre><code>$(document).ready(function() { $('#login').delegate('input#submit','click',function(){ alert('user id is: '+$(this).parent().parent().find('#userid').html()); var request = $.ajax({ type:"POST", url:"/login", data: {userid:$('#userid').text(), password:$('#password').text} }); }); </code></pre> <p>The alert comes back with an empty data. Appreciate any pointers on what am I doing wrong.</p> <p>Thanks, Kalyan.</p>
javascript jquery
[3, 5]
3,696,476
3,696,477
How do I read #2 at the end of a URL?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/298503/how-can-you-check-for-a-hash-in-a-url-using-javascript">How can you check for a #hash in a URL using JavaScript?</a> </p> </blockquote> <p>Currently I am generating Urls that look like this:</p> <p>InspectionPhotos.aspx?inspectionId=10001649#/2</p> <p>The #2 is for a photogallery plugin, and this would mean go the second photo.</p> <p>I would like to show a div only if there is a #/[anynumber] but if its just InspectionPhotos.aspx?inspectionId=10001649 then not show anything.</p> <p>How could I do this check? Either asp.net on pageload or a client side javascript would be fine.</p> <p>Thanks.</p>
javascript asp.net
[3, 9]
1,893,146
1,893,147
JavaScript global timer fired by multiple elements?
<p>I have two jQuery sliders on a page. I would like to fire an event when the user has set both of them. I define "set" as "when both sliders have been idle for 3 seconds".</p> <p>Can I do something like this, or is it bad practice to create a global variable like this / are there any other problems with the code?</p> <pre><code>var globalTimer = null; function myEvent() { alert('Both sliders are set!'); } $("#slider-1").slider({ stop: function(event, ui) { clearTimeout(globalTimer); globalTimer = setTimeout(myEvent, 3000); } }); $("#slider-2").slider({ stop: function(event, ui) { clearTimeout(globalTimer); globalTimer = setTimeout(myEvent, 3000); } }); </code></pre>
javascript jquery
[3, 5]
5,858,263
5,858,264
rewrite this code to flying with easing not fadein
<p>How to rewrite this code, so it would fly in with easing not just fade in.</p> <p>Code -</p> <pre><code>jQuery('#swiftslider-slide-'+newSlide).addClass('active').fadeIn('300'); </code></pre> <p>Could you give me a full example? I understand I must use .animate() but if I do like this -</p> <pre><code>jQuery('#swiftslider-slide-'+newSlide).addClass('active').animate({opacity: "show"}, { duration: "slow", easing: "easein" });; </code></pre> <p>it doesn't work.</p> <p>Hope you will be able to help me.</p>
javascript jquery
[3, 5]
2,149,566
2,149,567
how to append block of file to another file
<p>I have a requirement that I need to append block of a file to other file.</p> <p>let say I have 100 lines in source file and I need to append the 50 lines from the bottom to destination file.</p> <p>To navigate to the 50th line I using .readLine() of the BufferedReader.</p> <p>Once I reached to 50 th line I want to append remaining content to the destination file. I don't want to append line by line as it is consuming much time.</p> <p>Please help me how to do that..</p> <p>Please provide a code snippet if possible.</p>
java android
[1, 4]
5,817,028
5,817,029
ImageButton event does not fire if ImageButton does not have Image?
<p>Is it normal behavior for an ImageButton event to not fire if it can't find the image for it. For example, assume I have the following piece of code:</p> <pre><code>imageLink = new ImageButton(); imageLink.ImageUrl = "~/images/arrow.png"; </code></pre> <p>If the page finds arrow.png, the image click works, but if it doesn't find it, it does not work.</p> <p>These images are created dynamically and a CommandName, CommandArgument and Click Handler are assigned.</p> <pre><code>void imageLink_Click(object sender, ImageClickEventArgs e) { ImageButton button = (ImageButton)sender; Detail oDetail = new Detail(); switch(button.CommandName) { case "Band": oDetail.Band = button.CommandArgument; break; case "State": oDetail.State = button.CommandArgument; break; } Session["Page2"] = oDetail; Response.Redirect("~/Page2.aspx"); } </code></pre>
c# asp.net
[0, 9]
5,585,389
5,585,390
Asp.net XML to objects
<p>I have a XML file, with a structure like</p> <pre><code>&lt;items&gt; &lt;item&gt; &lt;someDetail&gt; A value here &lt;/someDetail&gt; &lt;/item&gt; &lt;item&gt; &lt;someDetail&gt; Another value here &lt;/someDetail&gt; &lt;/item&gt; &lt;/items&gt; </code></pre> <p>With multiple items in it.</p> <p>I want to deserialize the XML on session start ideally, to turn the XML data to objects based on a class (c# asp.net 4)</p> <p>I have tried several ways with either no success, or a solution which seems clunky and inelegant.</p> <p>What would people suggest?</p> <p>I have tried using the <code>xsd.exe</code> tool, and have tried with the xml reader class, as well as usin <code>XElement</code> class to loop through the xml and then create new someObject(props).</p> <p>These maybe the best and/or only way, but with it being so easy for database sources using the entities framework, I wondered if there was a similar way to do the same but from a xml source.</p>
c# asp.net
[0, 9]