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
3,288,147
3,288,148
Get system ip code not working in server
<p>This code works on my system not in server please help me to fix this error. am not sure what is error..</p> <p>This is my partial code...</p> <pre><code>private IPAddress getMyCurrentIP() { IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); if (host.AddressList.Length == 1) myCurrentIP = host.AddressList[0].ToString(); else { foreach (IPAddress address in host.AddressList) { if (address.AddressFamily == AddressFamily.InterNetwork) { if (IsLocal(address)) return address; } } } return null; } public bool IsLocal(IPAddress address) { if (address == null) throw new ArgumentNullException("address"); byte[] addr = address.GetAddressBytes(); return addr[0] == 10 || (addr[0] == 192 &amp;&amp; addr[1] == 168) || (addr[0] == 172 &amp;&amp; addr[1] &gt;= 16 &amp;&amp; addr[1] &lt;= 31); } </code></pre> <p>please help me to fix this error...</p>
c# asp.net
[0, 9]
5,352,111
5,352,112
php, jquery, load function and page address
<p>i have two files. In first (parent, address: www.myaddress.com/fun/test.php) is jQuery function:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ $(document).ready(function() { import_f = setInterval(function() { $('#file').load('fun2.php?id='+ Math.random()); }, 5000); }); }); &lt;/script&gt; </code></pre> <p>When i print in fun2.php file full page address, i get: /fun2.php?id=0.31089064538474454.</p> <p>How get paren page address. (www.myaddress.com/fun/test.php).</p> <p>Parent's address may always be another, so I need to find a function that.</p> <p>Thanks</p>
php jquery
[2, 5]
5,448,111
5,448,112
Cannot find symbol NOTIFICATION_SERVICE?
<pre><code>package com.test.app; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; public class runOnBoot extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); } } </code></pre> <p>When I try to build the package, it says</p> <pre><code>compile: [javac] Compiling 2 source files to /home/mrburns/Desktop/myapp/bin/classes [javac] /home/mrburns/Desktop/myapp/src/com/test/app/runOnBoot.java:14: cannot find symbol [javac] symbol : variable NOTIFICATION_SERVICE [javac] location: class runOnBoot [javac] NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); [javac] ^ [javac] 1 error BUILD FAILED </code></pre>
java android
[1, 4]
1,152,420
1,152,421
Is it possible to detect a visitor's browsing history using JavaScript or PHP?
<p>I want to check if my site's visitors have visited another particular site before coming to mine.</p> <p>I know how to use JS and PHP to check to see (via referrer info) if the user has just come from that site to mine, but I would like to be able to detect if they have visited this site at any time before (not just immediately before coming to my site). Can this information be detected?</p>
php javascript
[2, 3]
2,144,839
2,144,840
jQuery function when one list item has the active class, I want all other list items to automatically not have the active class ?
<p>My webpage is at <a href="http://www.sarahjanetrading.com/js/status" rel="nofollow">http://www.sarahjanetrading.com/js/status</a></p> <p>All the HTML, CSS and jQuery code + images are available there for anyone to access.</p> <p>My issue is that currently the jQuery code I have only makes the active states toggle in the list items. What I want is that one list item becomes active(active class) when clicked, all others must have the active class removed.</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,268,808
1,268,809
PHP get javascript variable value
<p>At first i have this script</p> <pre><code>&lt;head&gt; &lt;script type="text/javascript"&gt; function test(work){ document.getElementById("php_code").innerHTML="&lt;?php *$job = work;* $sql="INSERT INTO event ( id, name, job, status) VALUES ('','$_SESSION[username]','$job','not verified')"; $result = mysql_query($sql); ?&gt;"; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;button onclick='test(job1)'&gt;&amp;nbsp&amp;nbsp Add &amp;nbsp&amp;nbsp&lt;/button&gt; &lt;/body&gt; </code></pre> <p>i need to pass the work value from javascript to $job in php.</p> <p>Any ideas?</p>
php javascript
[2, 3]
5,031,928
5,031,929
Should I ever pass data back to a main activity?
<p>My theory is that my main activity will open <code>LoginActivity</code>, then that activity will pass the <code>User</code> back to the main activity, which would launch <code>DashboardActivity</code> and stop <code>LoginActivity</code>.</p> <p>Does this make sense or should I do this differently? I'm looking for best practice advice.</p>
java android
[1, 4]
469,641
469,642
Monthly Archives
<p>Say I've got a database with about 5,000 blog posts from the last 2 years, I'm trying to create 'monthly' archives so I can display the data in a much more logical way.</p> <p>For some reason I've never really had to work with date's all that much and my knowledge is lacking.</p> <p>I'm using Linq/C#; can someone point me in the right direction to learn how to do this?</p> <p>Cheers</p> <p>Matt</p>
c# asp.net
[0, 9]
2,396,461
2,396,462
News ticker with jquery and without use of plugins
<p>I have a part in a website that I need to show as a news ticker.</p> <p>It looks like this:</p> <pre><code>&lt;div class="news"&gt; &lt;span&gt;NEWS 1&lt;/span&gt; &lt;span&gt;NEWS 2&lt;/span&gt; &lt;span&gt;NEWS 3&lt;/span&gt; &lt;/div&gt; </code></pre> <p>I need a javascript code to show news repeatedly without using plugins. The idea is to show a <code>span</code> and hide the rest of <code>spans</code> and repeat with order each <code>n</code> seconds.</p> <p>How can I do that ?</p>
javascript jquery
[3, 5]
99,188
99,189
Why isn't my modified JavaScript showing up in the debugger?
<p>I have started my web application as website. I am calling JavaScript in it. Problem is in the script: the first time through, the script is working while debugging, but if I make any modification to the script and then try to debug it, control is moved to old lines and not new lines. I tried to rebuild, but still get the same result. </p> <p>What may be the reason for this?</p>
asp.net javascript
[9, 3]
774,894
774,895
Android JSON parsing pound symbol coming up as?
<p>I have a JSON file which contains a pound symbol in it. This json is pulled from a file stored on the phone temporarily. It will come from a server, but for time being I am just storing it on the phone. I convert the JSON file to an input stream and use a method to convert it to a string like this</p> <pre><code>Resources res = getResources(); String sJsonVariables = iStream_to_String(res .openRawResource(R.raw.widgvariables)); </code></pre> <p>The iStream_to_String method is this</p> <pre><code>public String iStream_to_String(InputStream is) { BufferedReader rd = new BufferedReader(new InputStreamReader(is), 4096); String line; StringBuilder sb = new StringBuilder(); try { while ((line = rd.readLine()) != null) { sb.append(line); } rd.close(); } catch (IOException e) { e.printStackTrace(); } String contentOfMyInputStream = sb.toString(); return contentOfMyInputStream; } </code></pre> <p>I have tried printing out the json using Log.v to test it is printing out okay. Everything prints out fine except for the pound symbol. I have tried several different ways of encoding it like this</p> <pre><code>byte []b = sJsonVariables.getBytes(); String s1 = new String(b, "UTF-8"); String s2 = new String(b, "ASCII"); String s3 = new String(b, "Cp1252"); String s4 = new String(b, "ISO8859_1"); </code></pre> <p>However none of them will print out the pound symbol, it either comes out as a black question mark or some other weird symbol. Does anyone know what I am doing wrong, and how I can get this symbol to print out properly?</p>
java android
[1, 4]
3,331,403
3,331,404
Giving users account access to for a certain amount of time?
<p>I am working on an website where users will have to pay a small fee to create an account, and having an account will give them access to all of the features of the website for a certain amount of time, lets say 6 months.</p> <p>Right now, I am using php to create user accounts using a mysql database to store user account info, and users can freely login/out for free, for an unlimited amount of time. </p> <p>My question is, how would I go about setting a time limit on every account created, and once expired, give users the option to re-new their memebership?</p>
php javascript
[2, 3]
3,036,188
3,036,189
Javascript event triggers based on local clock
<p>I have a scenario where one client PC will be driving multiple LCD displays, each showing a single browser window. These browser windows show different data which is on an animated cycle, using jquery.</p> <p>I need to ensure that both browsers can be synched to rotate at exactly the same time, otherwise they'll animate at different times.</p> <p>So my question is - can I trigger jquery to alternate the content based on the local PC clock?</p> <p>eg each time the clock seconds == 0, show version 1, each time clock seconds == 30, show version 2 etc?</p>
javascript jquery
[3, 5]
4,406,450
4,406,451
How to Replace the String in C#?
<p>I have the string <code>string test="http://www.test.com//web?testid=12"</code>. </p> <p>I need to replace with in the string <strong>//</strong> into <strong>/</strong>. </p> <p>Problem is if I use <code>string a=test.replace("//","/")</code> I get <strong>http:/www.test.com/web?testid=12</strong> all with single slash(/) but I need <strong>http://www.test.com/web?testid=12</strong>.</p> <p>I need only the second <strong>//</strong> nearby <strong>web</strong>, not first <strong>//</strong> near by <strong>www</strong>. </p> <p>How to do this?</p>
c# asp.net
[0, 9]
2,864,477
2,864,478
How to simulate TAB on ENTER keypress in javascript or jQuery
<p>I want to change keycode in keydown ( key press ) in all input in a page.I want to replace Enter keycode with TAB key code. How I can do this?</p> <p>thanks</p> <hr> <p>EDIT 1)</p> <p>Consider this code:</p> <pre><code>&lt;div&gt; &lt;asp:RadioButtonList ID="RadioButtonList1" runat="server"&gt; &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;4&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:TextBox ID="TextBox1" runat="server"&gt;3333&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:DropDownList ID="DropDownList1" runat="server"&gt; &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;3&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; &lt;/div&gt; </code></pre> <p>I want when user press Enter on eny of above control focus go to next control.</p> <p>thanks</p>
javascript jquery
[3, 5]
3,658,126
3,658,127
Problem in updating database table in asp.net using c#
<p>I want to update Basic table in my database but it doesn't generate any effect in table.<br> I am using following statement</p> <pre><code>sql ="UPDATE Basic SET Current_city='"+ TextBox1.Text +"',Home_Town='"+ TextBox2.Text +"'; SqlCommand cmd = new SqlCommand(sql, con); cmd.ExecuteNonQuery(); </code></pre>
c# asp.net
[0, 9]
5,061,060
5,061,061
JQuery/JavaScript plugin for highlight text
<p>I am looking for a jquery plugin for multiple highlighting text in a element. I found very popular plugin for that: <a href="http://bartaz.github.com/sandbox.js/jquery.highlight.html">http://bartaz.github.com/sandbox.js/jquery.highlight.html</a> and also many others. </p> <p>They work fine, but in the case when I want to highlight the text which overlaps on eralier highlighted text - it does not work.</p> <p>Has anyone know a jquery or javascript plugin to multiply highlight texts which correctly highlights overlaped texts?</p>
javascript jquery
[3, 5]
5,253,669
5,253,670
Detect if a String Contains A String in Jquery / Javascript when the string is delimited unusually
<p>I have a string delimited like so (it's not an array it's a straight string)</p> <p>string = " [United States] [Canada] [India] ";</p> <p>I want to do something like below.</p> <pre><code>if( string contains "Canada" ) { //Do Canada stuff here } </code></pre> <p>Thanks for any tips</p>
javascript jquery
[3, 5]
2,056,816
2,056,817
How to get value of "this"?
<p>I have this code:</p> <p>HTML:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;To Do&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="stylesheet.css"/&gt; &lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;To Do&lt;/h2&gt; &lt;form name="checkListForm"&gt; &lt;input type="text" name="checkListItem"/&gt; &lt;/form&gt; &lt;div id="button"&gt;Add!&lt;/div&gt; &lt;br/&gt; &lt;div class="list"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Javascript/Jquery:</p> <pre><code>$(document).ready(function() { $(button).click(function(){ var toAdd = $('input[name=checkListItem]').val(); $('.list').append('&lt;div class="item"&gt;' + toAdd + '&lt;/div&gt;'); }); $(document).on('click','.item', function(){ $(this).remove(); }); }); </code></pre> <p>This code grabs a user's input, adds it to a list when you click a button, and removes the input from the list when you click on it within the div class item.</p> <p>How can I make it so that I can return the value of "this"?</p> <p>For example, if I add the word "test" to the list, and click on it to remove it.... how can grab the value of test from "this"?</p> <p>Like.. document.write(this) returns [object HTMLDivElement].</p> <p>I want document.write to return "test" if I click on it in the div.</p> <p>I can't do document.write(toAdd) because toAdd doesn't exist in the second jquery ("on") function. Thanks.</p>
javascript jquery
[3, 5]
66,968
66,969
How to get the <html> tag HTML with JavaScript / jQuery?
<p>Using <code>$('html').html()</code> I can get the HTML within the <code>&lt;html&gt;</code> tag (<code>&lt;head&gt;</code>, <code>&lt;body&gt;</code>, etc.). But how can I get the actual HTML of the <code>&lt;html&gt;</code> tag (with attributes)?</p> <p>Alternatively, is it possible to get the entire HTML of the page (including doctype, <code>&lt;html&gt;</code>, etc.) with jQuery (or plain old JavaScript)?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
608,530
608,531
Create a constructor function with modular pattern
<p>I have heard lot about <code>Javascript: Module Pattern</code>. But most of those articles explain how to make static classes i.e when we don't have to deal with instances and we want to share the object created modular pattern. Can some one explain me this pattern with constructor functions say this example:</p> <pre><code>function Shape(x, y) { this.x= x; this.y= y; } Shape.prototype.toString= function() { return 'Shape at '+this.x+', '+this.y; }; function Circle(x, y, r) { Shape.call(this, x, y); // invoke the base class's constructor function to take co-ords this.r= r; } Circle.prototype= new Shape(); Circle.prototype.toString= function() { return 'Circular '+Shape.prototype.toString.call(this)+' with radius '+this.r; } </code></pre> <p>How do I convert it to modular pattern? and is there any benefit to use it in modular pattern way?</p>
javascript jquery
[3, 5]
1,112,476
1,112,477
Firing Server Side Event from jQuery - __EVENTARGUMENT Does not Exist
<p>I am trying to fire a form submit via jQuery and have a particular server side event fire.</p> <p>Client Side Code:</p> <pre><code>$("input[name=__EVENTARGUMENT]").val("SomeArg"); form = $("body form"); form.submit(); </code></pre> <p>Server Side Code:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { if (Request["__EVENTARGUMENT"] == "SomeArg") { //do some stuff } } } </code></pre> <p>The problem is, the "__EVENTARGUMENT" hidden input does not exist. I discovered that if I add an ASP.net server control dropdownlist with autopostback = true, the EVENTARGUMENT hidden input is created. Is there a cleaner way to have ASP.net create these hidden inputs, and allow me to get their values server side without adding controls I do not actually need on the page?</p>
asp.net jquery
[9, 5]
3,091,653
3,091,654
How to extract Google search keyword using Request.UrlReferrer and c#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1567695/how-to-get-keywords-used-from-a-search-engine">How to get Keywords used from a Search Engine</a> </p> </blockquote> <p>The question is clear..</p> <p>I want to extract the search keyword from the Url Reffere by google</p> <p>any help?</p>
c# asp.net
[0, 9]
1,541,884
1,541,885
JQuery datepicker with time picker?
<p>I am looking for a JQuery DatePicker with a time picker which can work with ASP.NET. I found <a href="http://milesich.com/timepicker/" rel="nofollow">http://milesich.com/timepicker/</a> which looks nice but I am getting an 'Error: $("#hourSlider").slider is not a function.. error from their timepicker.js</p> <p>Also found <a href="http://code.google.com/p/dyndatetime/" rel="nofollow">http://code.google.com/p/dyndatetime/</a> but the time picker is clunky.</p> <p>Any other recommendations?</p>
asp.net javascript jquery
[9, 3, 5]
462,140
462,141
replicate jQuery touch even binding
<p>I am trying to remove dependency on jQuery from a project. Currently I have something like this...</p> <pre><code>$("#input").ontouchstart = myFunction; </code></pre> <p>Now I want to use vanilla js like this</p> <pre><code>somehowBind('touchstart', document.getElementById('input'), myFunction) </code></pre> <p>I don't mind the syntax, just want the same functionality.</p>
javascript jquery
[3, 5]
5,004,684
5,004,685
Validation of viewstate MAC failed
<p>Running the ASP.NET webforms run the application works fine. When the application is idle for 4 to 5 minutes, it is giving this error:</p> <blockquote> <p>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.</p> </blockquote> <p>How can this be solved?</p>
c# asp.net
[0, 9]
645,937
645,938
jQuery-Galleriffic, get title of current image
<p>I use the wonderful jQuery-plugin Galleriffic to display image galeries. Now this works great, but what I want to achieve is to get the title of the image that is currently displayed. If I put the mouse cursor over the image, it shows the title. Unfortunately, I haven't managed yet to get the title via jQuery.</p> <p>Any help is very appreciated.</p> <p>Thanks,</p> <p>enne</p> <p>Edit: Here's the link to the plug-in: <a href="http://www.twospy.com/galleriffic/" rel="nofollow">http://www.twospy.com/galleriffic/</a></p> <p>Here is also some code. I'm not sure but I think the image is shown as background-image in the following container:</p> <pre><code>&lt;div id="slideshow" class="slideshow"&gt; &lt;/div&gt; </code></pre> <p>I use the following javascript code:</p> <pre><code> $('div.slideshow').hover( function () { //Get the title here }, function () { } ); </code></pre> <p>Ok, firebug shows me this code:</p> <pre><code>&lt;div id="loading" class="loader" style="display: none;"&gt;&lt;/div&gt; &lt;div id="slideshow" class="slideshow"&gt; &lt;div id="slide-container"&gt; &lt;span class="image-wrapper current" style="opacity: 1;"&gt; &lt;a class="advance-link" title="Chrysanthemum" href="#2" rel="history"&gt; &lt;img alt="Chrysanthemum" src="http://ulc.local/sites/default/files/imagecache/preset_image_gallery_diashow/sites/default/files/Chrysanthemum_3.jpg"&gt; &lt;/a&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>So here I need the "alt" attribute of the image.</p>
javascript jquery
[3, 5]
5,385,829
5,385,830
Extract text value from aspx via php
<p>Trying to get a text value either "yes" or "no" from an aspx page via my php product page.</p> <p>from here..</p> <p>after code= i need to insert the product model number $products_model</p> <p>example.. <a href="http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&amp;code=RN311014" rel="nofollow">http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&amp;code=RN311014</a></p> <p>replace RN311014 with $products_model and then echo back the text result</p> <p>hope someone can help..</p> <p>thanks scott</p> <p>i tryed this within my orginal code</p> <pre><code>&lt;?php $contents = file_get_contents("http://www.madisonb2b.co.uk/stockenquiry.aspx?id=B8FxKDnJ%2bIdaPT1Nw5wo4r87qHuHcCQIPZzeUE%2fI36LIFOM%2bayBi2RSXHzIJS5Hj97JNSyYL80Q%3d&amp;code={$products_model}", NULL, NULL, 0, 3); echo $contents; </code></pre> <blockquote> <p>Blockquote</p> </blockquote>
php asp.net
[2, 9]
1,838,079
1,838,080
local Javascript - write to local file
<p>I have some javascript code loaded from a local html file (without going through a webserver).. i.e., opened using <code>file://</code></p> <p>Is there any way the javascript in this file can be used to write to a local file?</p> <p>I know that cross-site restrictions do not allow lot of things in javascript, but this is not cross-site, so it should be allowed in theory.</p>
javascript jquery
[3, 5]
4,536,991
4,536,992
Which image file format loads the fastest
<p>I am looking at image file formats and I would like to know which one of png, gif, jpeg, bmp, and tiff is the most efficient in terms of loading and displaying the image data. I don't care so much about the file size on disk, just the amount of CPU needed to display the images on an embedded device like Android, iPhone, or a Windows Phone.</p>
iphone android
[8, 4]
3,164,569
3,164,570
How to forward data read from a socket by prepending an IP and UDP or TCP header?
<p>I want to forward data read from a socket. The consumer is not a socket. It expects an IP packet. Hence I have to write an IPv4 or IPv6 header. I also need to add a UDP or TCP header. <br>What is the best way to do this? <br>I know there are big libraries (such as Jpcap?) to do this and more. <br>Any recommendations as to where I can find a <i>small</i> piece of java code?</p>
java android
[1, 4]
323,615
323,616
jquery.post() data returned between <p></p> tags
<p>I'm creating a call to jQuery.post() which the url parameter is a .php page which all it does is <code>echo "test"</code>.</p> <p>When I view the returned "data" it says <code>&lt;p&gt;test&lt;/p&gt;</code> and my function doesnt catch it since I'm doing </p> <pre><code>function(data) { if (data=="test") { do something } </code></pre> <p>Why it is returning a string with between a paragraph open and close tags?</p>
php javascript jquery
[2, 3, 5]
973,478
973,479
jquery/javascript- calculate days on this week given week number and year number
<p>i'm looking for a simple way to calculate the calendar days when given a week and year number using jquery/javascript.</p> <p>Example: Week 18, Year 2012 would result in a list of starting with sunday</p> <pre><code>2012-04-29 2012-04-30 2012-05-01 2012-05-02 2012-05-03 2012-05-04 2012-05-05 </code></pre> <p>thanks</p>
javascript jquery
[3, 5]
3,069,844
3,069,845
javascript (jquery) script perfomance synchronous vs asynchronous
<p>I have a javascript function that filter dom elements based on a input text changes, so:</p> <pre><code>$(".input").keyup(function(e) { filter(); }); var cache = $(".dom"); var filter = function() { cache.each(function() { // if field contains some text show else hide } }; </code></pre> <p>My problem happens when there are many dom elements to filter, the whole pages gets inaccessible because of the <strong>synchronous processing (like the example above)</strong>. Im trying to come out with a solution that dont locks the entire page with synchronous processing.</p> <p><strong>The problem is NOT related to the filter logic (it's completely trivial), it's NOT related to the jquery or javascript itslef, it's related to the synchronous processing and the quantity of dom elements.</strong></p>
javascript jquery
[3, 5]
3,440,627
3,440,628
jQuery onhide event handler
<p>In jQuery, I'm hiding my elements using <code>.hide();</code>.</p> <p>Is there an evert handler that is fired when I hide something? You see, I have a bunch of elements in my code, and I'm hiding them or showing them (using jQuery) a bunch of times. To keep things in check, in an efficient way, I would love to use an event handler for <code>.hide()</code></p> <p>Could someone point me in the right direction for this?</p> <p>Many Thanks!</p>
javascript jquery
[3, 5]
2,169,615
2,169,616
Div is jumpy with fadeIn jQuery
<p>When I roll over .comptext_rollover div it should hide the initial div on the page and show the minipage div. but it does but is sometimes really jumpy and also the minipage div sometimes shows below the initialpage div. any ideas? sorry i am new to coding! Thanks in advance.</p> <pre><code>$(document).ready(function() { $('#mini_page').hide(); $('.comptext_rollover').hover(function() { $('#initial_page').hide(); $('.register_button').hide(); $('#mini_page').fadeIn(100); $('#container').css({ 'margin-top': '-217px' }); }, function() { $('#mini_page').hide(); $('#initial_page').show(); $('.register_button').show(); $('#container').css({ 'margin-top': '-150px' }); }); }); </code></pre>
javascript jquery
[3, 5]
4,710,131
4,710,132
Dynamic functionality does not work after JQuery-1.7.1.js upgrade
<p>My app has the following functionality: when you select a table name (this app allows users to create tables), a little form will appear, allowing users to enter in table data. However, after upgrading from JQuery-1.6.1.js to JQuery-1.7.1.js, that functionality is broken. Here is my JavaScript code: </p> <pre><code>function buildTableContents(e) { var elementName = $(this).val(), pageName = $(this).stepTypeField('page_name').val(), page = pageCollection.findOrCreateByName(pageName), stepType = $(this).stepType(), contentsTemplate = $('#templates .table_contents_container'); var existingColumnId = parseInt(stepType.find('table th[data-column-id]').attr('data-column-id')); page.elements(function(elements){ var columns = _(elements.tableColumns(elementName)); if (columns.isEmpty() || columns.detect(function(e){ return e.id == existingColumnId;})) return; stepType.find('table').remove(); var tableContents = contentsTemplate.clone(); headerCell = tableContents.find('tr:first th:eq(1)'), valueCell = tableContents.find('tr:eq(1) td:eq(1)'), headerPadding = tableContents.find('tr:first th:last'), valuePadding = tableContents.find('tr:eq(1) td:last'); columns.each(function(column) { headerCell.clone().find('span').html(column.name).end() .insertBefore(headerPadding); valueCell.clone().insertBefore(valuePadding) .find('input').attr('name', 'step[table_contents][][' + column.id + ']'); }); headerCell.remove(); valueCell.remove(); tableContents.appendTo(stepType).show().focus(); }); } </code></pre> <p>I read elsewhere on this site that when upgrading from 1.6 to 1.7, you should change instances of .attr to .prop, but this did not work for me. I don't believe it is necessary to share any .haml or .css code, but I will gladly do so if it'll help. Thanks!!</p>
javascript jquery
[3, 5]
3,235,757
3,235,758
Why don't work correct (parseInt) for convert string to int?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/8763362/why-does-parseint09-return-0-but-parseint07-return-7">Why does parseInt(&ldquo;09&rdquo;) return 0 but parseInt(&ldquo;07&rdquo;) return 7?</a> </p> </blockquote> <p>I have a string like (10) | (01)</p> <p>I want convert to int.</p> <p>I use this code </p> <pre><code>parseInt("10") ----&gt; 10 parseInt("07") ----&gt; 7 </code></pre> <p>but when i use this code for (08) , it is convert to (0) </p>
javascript asp.net
[3, 9]
5,161,015
5,161,016
How to display an object stored in a database using jQuery and ASP.Net
<p>I have documents (images, Word documents, PDF's, etc) stored in an SQL Server database table. On my form, I display the names of these documents and need for the user to be able to click a document title and have the contents retrieved from the database and then opened in the default viewer; Word for example for a Word document. </p> <p>I'm not sure about the best way to approach this. I tried using an $.ajax call to a web service that queries the database and then write the bytes out to the current context but this doesn't seem to work. </p> <p>Any tips would be greatly appreciated.</p>
jquery asp.net
[5, 9]
2,932,662
2,932,663
Javascript for loop new condition
<p>plz check the code below:</p> <pre><code>for(i=0; i-DIL; i++)//see the condition here i-DIL .Is this correct? { } </code></pre> <p>is the second condition above in for loop correct?if so ,what does that mean?</p> <p>actual code is:</p> <pre><code> javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function A(){for(i=0; i-DIL; i++)//see the condition here i-DIL .Is this correct? { DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px"; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"} R++ } setInterval('A()',5); void(0); </code></pre> <p>Also can anyone help me describing the reason for placing void(0) at the end of the script? And U can see that repeatedly image position is set over and over .How can i overcome that</p>
javascript jquery
[3, 5]
5,578,204
5,578,205
web deploy causing bad image exception
<p>I have an asp.net web application that uses an unmanaged 32 bit dll that I have successfully running on my development machine, but when I use web deploy to move the code to our test server, I start seeing BadImageFormat exceptions. </p> <p>I set the target in visual web developer to x86 and both machines are running 64 bit os's (windows 7 and windows server 2008 r2). I'm not sure what other differences there could be causing the problem. Thanks for any help you can provide. </p>
c# asp.net
[0, 9]
2,565,445
2,565,446
How do I add & remove values from a hidden input field?
<pre><code>&lt;input type="hidden" id="values" value="1,2,1,3" /&gt; &lt;a href="#" id="add" data-value="4"&gt;add&lt;/a&gt; &lt;a href="#" id="remove" data-value="1"&gt;remove&lt;/a&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#add').click(function() { var value = $(this).attr('data-value'); //add to $('#values') return false; }); $('#remove').click(function() { var value = $(this).attr('data-value'); //remove all values that match in $('#values'); return false; }); }); &lt;/script&gt; </code></pre> <p><strong>Examples</strong></p> <p>a) Add, output would be: 1,2,1,3,4</p> <p>b) Remove, output would be 2,3</p>
javascript jquery
[3, 5]
3,635,168
3,635,169
Iphone C# development
<p>I wanted to use monotouch, but unfortunately I don't have $400 to spend.</p> <p>So I found xmlvm <a href="http://www.xmlvm.org/" rel="nofollow">http://www.xmlvm.org/</a> and I it seems It can crosscompile .net bytecode to objective c.</p> <p>But, I'm not sure, are there any wrappers? What else would I need to start developing for the iphone using xmlvm??</p>
c# iphone
[0, 8]
597,743
597,744
read a vcs from url in javascript or php
<p>I am trying to read a vcs file like this one:</p> <p><a href="http://ziggi.bgu.co.il/[email protected]" rel="nofollow">http://ziggi.bgu.co.il/[email protected]</a> if you click on that link it will download a vcs file, then if you open it with notepad you get something like:</p> <pre><code>VERSION:2.0 PRODID:WebSched METHOD:PUBLISH BEGIN:VEVENT </code></pre> <p>...</p> <p>what I want is to be able to get thouse lines from that url(i do not hold that domain), and read them line by line. and I need it in javascript or php code.</p>
php javascript
[2, 3]
5,707,756
5,707,757
Can I use a JS file to render previews when using MarkItUp?
<p>Is there a way I can use a JS file instead of a server side file eg. PHP to render my previews when using <a href="http://markitup.jaysalvat.com/home/" rel="nofollow">MarkItUp</a>?</p>
javascript jquery
[3, 5]
5,147,514
5,147,515
How to change the target of any local link when clicked, using javascript / jquery?
<p>I need to change the href of any local link when it is clicked on. I've worked out how to select the correct links and create the new url, but not sure how to change the location. I need to be certain that any other click events have also run, so I can't just change the location immediately.</p> <pre><code>var my_host = 'example.com'; $(document).click(function(e) { if(e.target.hostname == my_host) { alert(e.target.protocol + "//" + e.target.hostname + "/#" + e.target.pathname + e.target.search); //... } }); </code></pre> <p>This is related to my <a href="http://stackoverflow.com/questions/3970649/how-to-select-all-local-links-in-jquery">earlier question</a>.</p>
javascript jquery
[3, 5]
5,863,169
5,863,170
Removing a class attribute under a div tag + jquery
<pre><code> &lt;script type="text/javascript"&gt; var product_features = ['draggable','trackable','colorable']; $(document).ready(function () { $('div#input .feature draggable').remove(); }); </code></pre> <p></p> <p> </p> <p> </p> <pre><code>&lt;h3&gt;Input&lt;/h3&gt; &lt;div id="input"&gt; &lt;div class="feature draggable"&gt;Drag 1&lt;/div&gt; &lt;div class="feature resizable"&gt;Resize&lt;/div&gt; &lt;div class="feature downloadable"&gt;Download&lt;/div&gt; &lt;div class="feature draggable"&gt;Drag 2&lt;/div&gt; &lt;div class="feature trackable"&gt;Track&lt;/div&gt; &lt;div class="feature colorable"&gt;Color&lt;/div&gt; &lt;/div&gt; &lt;h3&gt;Output&lt;/h3&gt; &lt;div id="output"&gt;&lt;/div&gt; </code></pre> <p> ​</p> <p>Not Able to remove a div class element with feature draggable</p> <pre><code> $('div#input .feature draggable').remove(); </code></pre> <p>Seems something wrong with this part of the code , can any one please point what is wrong in here ?</p> <p>JS Fiddle : <a href="http://jsfiddle.net/9CzMG/47/" rel="nofollow">http://jsfiddle.net/9CzMG/47/</a></p>
javascript jquery
[3, 5]
317,075
317,076
Unable to find meaning of }); curly bracket, round bracket in Android
<p>As a beginner in Android and having been away from programming for many years, I could not find an answer for this one on the internet. It involves the following code from a book I have been reading, but the syntax is common for Android. I couldn't work out what the }); represented. As someone who, in the past, has made an effort to make bracketing readable, I find this code amazing, surely a better way of showing this is possible?</p> <p>Here's the code:</p> <pre class="lang-java prettyprint-override"><code>CheckBox checkBox = (CheckBox)findViewById(R.id.chkAutosave); checkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if (((CheckBox)v).isChecked()) DisplayToast("CheckBox is checked"); else DisplayToast("CheckBox is unchecked"); } }); </code></pre> <p>Anyway does anyone know the meaning of the }); at the end?</p>
java android
[1, 4]
1,217,710
1,217,711
Cross Domain Call to ASP.Net method using jQuery
<p>I have a website that I don't have access to the server side code. I need a function to generate a PDF that will live on another server.</p> <p>What is the best way to make a call formclient side jQuery to and ASP.Net method/WCF service and return a value?</p>
jquery asp.net
[5, 9]
571,567
571,568
Dynamically setting screen resolution in Asp.Net(C#) .net framework 1.0
<p>Hi I have designed a page with all asp.net controls which is well alligned in 1024*1024 resolution but in other resolution it gets misalligned..please help</p> <p>if we cant change the resolution then please tell me what i have to do..</p>
c# asp.net
[0, 9]
574,193
574,194
Avoid resetting ViewStates with Response.Redirect
<p>In my web application I have two, a ViewState and a Session which hold values, the problem is that I need to reset one and leave the other as it is through a click of a button. If I use <code>Response.Redirect</code> in my button, both the ViewState and the Session are resetted. I tried using if(!IsPostBack) but I don't think this would work in a button event. I would really appreciate your suggestions and help. </p> <p>CODE:</p> <p>// There is a ViewState above this code which I have to reset</p> <pre><code> protected void Button_Click(object sender, EventArgs e) { Session["Counter"] = (int)Session["Counter"] + 1; // I do not want to reset this Session. Label1.Text = Session["Counter"].ToString(); Response.Redirect("Page1.aspx"); // If this button is pressed then Session["counter"] is resetted which I don't want to happen } </code></pre> <p>Thanks !!</p>
c# asp.net
[0, 9]
5,782,146
5,782,147
JQuery and find on the TD Element for removing BR
<p>I'm trying to figure out how to remove BR tags underneath a particular TD element with a specific ID. So far I've had no success. Here is some example code via jfiddle:</p> <p>HTML:</p> <pre><code>&lt;br&gt; &lt;table border='1'&gt; &lt;tr&gt; &lt;td id="attachmentsOnClient"&gt; &lt;span dir="ltr"&gt; &lt;input id="ontidIOFile" type="file" /&gt; &lt;br&gt; &lt;/span&gt; &lt;input id="fileupload1" type="file" /&gt; &lt;br&gt; &lt;input id="fileupload2" type="file" /&gt; &lt;br&gt; &lt;/td&gt; &lt;td&gt; Leave &lt;br&gt; This &lt;br&gt; Alone &lt;br&gt; Here &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Javascript onload:</p> <pre><code>$('#attachmentsOnClient').find('br').remove();​ </code></pre> <p>​</p> <p>Changing the HTML above so that it's no longer a table, but the "attachmentsOnClient" TD is a div, the above javascript works, however on a TD element it fails. I'm not sure if I'm selecting it correctly or not, this is only my second foray into JQuery</p> <p>An example in jfiddle can be seen <a href="http://jsfiddle.net/Z5szT/1/" rel="nofollow">Here</a>.</p> <p>EDIT: As talked about below, the newlines are due to the formatting of the input file blocks through jfiddle. The JQuery itself is indeed working.</p>
javascript jquery
[3, 5]
1,292,113
1,292,114
Add events to the DOM
<p>I have a trouble creating the DOM:</p> <pre><code>{ ... DOM = DOM + '&lt;td colspan="3" align="center"&gt;'; DOM = DOM + '&lt;div id="primero" onClick(imprimir());&gt; plz &lt;/div&gt;'; DOM = DOM + '&lt;/td&gt;'; ... $('#test').html(DOM); } function imprimir() { console.log(' ready!'); } </code></pre> <p>but that onclick doesn't work. Any ideas?</p>
javascript jquery
[3, 5]
4,181,047
4,181,048
jQuery custom menu
<p>every jQuery plugin I've found is based on <code>&lt;li&gt;</code> elements to generate the menu items.</p> <p>I have <code>&lt;div id = "menubutton"&gt;</code> element that represents the menu <em>button</em> and another, not-related (maning it is not a child) <code>&lt;div id = "menucontent"&gt;</code> that contains the menu items (mixed stuff, images etc). I want this second, hidden div to appear when I click on the button. it should hide back when i leave the button OR when i leave the content div, in case i'm selecting items or doing stuff there.</p> <p>Now, this is the code I have so far, but the clearTimeout thing doesn't seem to work. Any help? Pointing out a plugin to help my work would work as well.</p> <p>Thanks!</p> <pre><code> var timer; $('#menubutton').click(function() { $('#menucontent').show(); }); $('#menubutton').mouseout(function() { timer = setTimeout('$("#menucontent").hide()', 500); }); $('#menucontent').mouseover(function() { clearTimeout(timer); }).mouseout(function() { setTimeout('$("#menucontent").hide()', 300); }); </code></pre> <p><strong>EDIT SOLUTION</strong></p> <p>I solved the problem using <code>hover</code> insted of mouseover / mouseout</p>
javascript jquery
[3, 5]
861,211
861,212
If-statement never reaches the else part
<p>I'm trying to change the text of a button with the following code.</p> <pre><code>// hide unavailable courses $("#availability_button").click(function () { $(".availability_red").toggle(); if ($(this).val('Show Unavailable')){ $(this).html('Hide Unavailable'); } else { $(this).html('Show Unavailable'); } }); </code></pre> <p>The button text changes the first time I use it, but never again. Not sure why that is and I have pretty much hit the limits of my JS debugging knowledge. </p> <p>I put an alert into it and proved it never reaches down to the else path. </p> <p>What am i doing wrong?</p>
javascript jquery
[3, 5]
71,690
71,691
Reduce array of DOM elements to the ones with the deepest level in JavaScript
<p>Let's assume i have HTML markup like this:</p> <pre><code>&lt;body&gt; &lt;div id="content"&gt; &lt;div id="sidebar"&gt; &lt;/div&gt; &lt;div id="main"&gt; &lt;p class="foo"&gt;text&lt;/p&gt; &lt;p class="bar"&gt;more &lt;span&gt;text&lt;/span&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>Let's further assume that i selected some of them in an array of DOM elements:</p> <pre><code>var allElements = jQuery('div,p').get(); // result: [div#content, div#sidebar, div#main, p.foo, p.bar] </code></pre> <p>Now i want to efficiently remove all elements from the result set which have a child in the result. In other words, only the deepest level should remain. So, the desired result would be:</p> <pre><code>var deepestElements = doSomethingWith(allElements); // desired result: [div#sidebar, p.foo, p.bar] </code></pre> <p><strong>How can i do this?</strong></p> <p>By the way: "Deepest elements" seems to be the wrong term for what i am trying to do. Is there any better name?</p>
javascript jquery
[3, 5]
1,030,546
1,030,547
Usage of setInterval method and asking for jQuery alternate
<p><code>window.setInterval("moveUp(fire,2)","100"); </code></p> <p>in the code above fire is a object represting a div. I want to pass this object to moveUp method and call this method continuosly.</p> <p>My problem is window.setInterval does not accepts fire object like this and gives error as fire is not defined. Although i am using fire object at other places as well. Besides this i also want to know if i can do the same using jQuery.</p>
javascript jquery
[3, 5]
1,745,133
1,745,134
C# app blocks when calling method from dll
<p>I'm currently exploring DLL exported functions and P/invoke in C#. I've created very simple .dll:</p> <p>Test.h</p> <pre><code>#ifndef TEST_DLL_H #define TEST_DLL_H extern "C" __declspec(dllexport) const char * __cdecl hello (); extern "C" __declspec(dllexport) const char * __cdecl test (); #endif // TEST_DLL_H </code></pre> <p>Test.cpp</p> <pre><code>#include &lt;stdlib.h&gt; #include "test.h" #include &lt;string.h&gt; const char* hello() { char *novi = (char *)malloc(51); strcpy(novi, "Test."); return novi; } const char * test() { return "Test."; } </code></pre> <p>I've compiled it and used in C# project like this:</p> <pre><code> [DllImport("test.dll", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr hello(); [DllImport("test.dll", CallingConvention = CallingConvention.Cdecl)] public static extern string test(); private void button1_Click(object sender, EventArgs e) { MessageBox.Show(test()); IntPtr a = hello(); MessageBox.Show(Marshal.PtrToStringAnsi(a)); } </code></pre> <p>But it isn't working. <code>test()</code> gets called successfully and I get back correct string. But <code>hello()</code> just hangs up the program. If I remove malloc line from the <code>hello()</code> definition and return constant, everything works, so I guess there's a problem with malloc that I'm now aware of.</p> <p>Also, somewhere I've seen that string shouldn't be used when return type is char*. If that's true, why should we use IntPtr?</p>
c# c++
[0, 6]
5,832,802
5,832,803
Whats the difference between an abstract class and interface? When would you want to use them?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/479142/when-to-use-an-interface-instead-of-an-abstract-class-and-vice-versa">When to use an interface instead of an abstract class and vice versa?</a><br> <a href="http://stackoverflow.com/questions/4756065/difference-between-interface-abstract-class-sealed-class-static-class-and-par">Difference between Interface, abstract class, sealed class, static class and partial class in C#?</a> </p> </blockquote> <pre><code>public class Guru{ public Enemy(int x, int y, int health, int attack, ...) { ... } ... } public class UserDefinedClass extends Enemy { ... } </code></pre>
c# asp.net
[0, 9]
963,009
963,010
JQuery Dialog Scrollbar Position
<p>how can i set the scrollbar in my dialog to be set to bottom by default, so that when the dialog opens, the scrollbar is at the bottom</p> <pre><code> $( "#report-dialog" ).dialog({ modal: true, autoOpen: false, show: "blind", hide: "fold", width: 850, height: 600, buttons: { Close: function() { $( this ).dialog( "close" ); } } }); </code></pre>
javascript jquery
[3, 5]
4,590,690
4,590,691
Calling a js script from php doesn't work
<p>I'm trying to 'call' a function stored in my .js file from a .php page using this : </p> <pre><code>echo "&lt;script&gt;myFunction(arg1, arg2)&lt;/script&gt;"; </code></pre> <p>and it just doesn't go though. But it works when I use html instead :</p> <pre><code>&lt;script&gt;myFunction(arg1, arg2)&lt;/script&gt; </code></pre> <p>I'll probably feel stupid when you'll provide me with the answer but I just don't get it. Thanks!</p> <p>EDIT: sorry, more details. The function pops an alert dialog, and I'm calling it <strong>when the page just got loaded</strong></p>
php javascript
[2, 3]
1,220,546
1,220,547
How to write blinking in more elegant way
<p>The aim: to write a js (using jquery) that will perform 2 blinking of the row.</p> <p>What I currently have is</p> <pre><code>var $second_row = $('table tr:eq(1)'), target_color = 'PaleGreen', original_color = $second_row.css('background-color'); $second_row.css('background-color', target_color); scheduleOriginalColor(); function scheduleTargetColor() { setTimeout(function() { $second_row.css('background-color', target_color); scheduleOriginalColor(true); }, 500); } function scheduleOriginalColor(stop) { setTimeout(function() { $second_row.css('background-color', original_color); if (!stop) { scheduleTargetColor(); } }, 500); } ​ </code></pre> <p><a href="http://jsfiddle.net/zerkms/ecfMU/1/" rel="nofollow">http://jsfiddle.net/zerkms/ecfMU/1/</a></p> <p>But it looks ugly and I'm sure there is a better way of writing the same.</p> <p>Any proposals?</p> <p><strong>UPD</strong>: there is my second attempt, a bit more clear: <a href="http://jsfiddle.net/zerkms/ecfMU/2/" rel="nofollow">http://jsfiddle.net/zerkms/ecfMU/2/</a></p> <pre><code>var $second_row = $('table tr:eq(1)'), target_color = 'PaleGreen', original_color = $second_row.css('background-color'); setRowColor(target_color, 500); setRowColor(original_color, 1000); setRowColor(target_color, 1500); setRowColor(original_color, 2000); function setRowColor(color, timing) { setTimeout(function() { $second_row.css('background-color', color); }, timing); } ​ </code></pre>
javascript jquery
[3, 5]
4,507,441
4,507,442
expiry download links in c# and asp.net
<blockquote> <p><strong>Possible Duplicates:</strong><br> <a href="http://stackoverflow.com/questions/4323949/temporary-file-download-link-with-asp-net">Temporary file download link with ASP.NET</a><br> <a href="http://stackoverflow.com/questions/5703201/create-temporary-link-for-download">Create temporary link for download</a> </p> </blockquote> <p>I use ASP.NET I need to give user temporary link for downloading file from server. It should be a temporary link (page), which is available for a short time (12 hours for example). How can I generate this link (or temporary web page with link)?</p>
c# jquery asp.net
[0, 5, 9]
3,641,264
3,641,265
multiple inheritance using C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2256990/c-sharp-multiple-inheritance">c# multiple inheritance</a> </p> </blockquote> <p>Am just creating a simple application using Asp.net, here I have 3 classes <code>User, Staff, Student</code>. In the <code>User</code> class I've properties like <code>UserName, Password, Email and Mobile</code> and in the <code>Staff and Student</code> class <code>General details like FirstName, MiddleName, LastName as well as Email, Mobile</code>.</p> <p>Here whenever I add a new Staff or Student, I've to create a user account for them.</p> <p>so in the User class, I tried, inheriting the Staff class, so that I can access the properties in the User class from the Staff.</p> <p>after adding the staff data successfully, I need to call the <code>Add</code>(I have this already) method in the user class which ll create a user account for the staff with his datas.</p> <p>And one more thing, I know that C# doesn't support multiple inheritance, here I need to inherit both Staff and Student class. how can I do this.</p> <p>Can anyone help me here.</p>
c# asp.net
[0, 9]
3,235,952
3,235,953
How to set the value of dropdown while adding options in Javascript?
<p>I use below code to add options for dropdown </p> <pre><code> //HTML CODE select(name='folist', id='folist'). //JS Code for(var i=0;i&lt;data.foNameArray.length;i++){ var combo = document.getElementById("folist"); option = document.createElement("option"); option.text = data.foNameArray[i]; option.value =data.foIdArray[i]; try { combo.add(option, null); //Standard }catch(error) { combo.add(option); // IE only } } </code></pre> <p>It perfectly works.Now My doubt is how to select the value while adding like selected="selected".</p>
javascript jquery
[3, 5]
3,938,849
3,938,850
JQuery - loading multiple pages in one newly opened window
<p>I'm total beginner in js and JQuery and have to complete such task:</p> <p>I have to open new window with some document print preview. It is not a problem for single document, but there's a need to print more than one document. I was trying to do this like that:</p> <pre><code>var win = window.open("", "test", "width=700,height=600"); $(win.document).ready(function(){ $(win.document).contents().load("here_my_action_with_changing_id"); }) }); </code></pre> <p>but it only loads first document and I don't have any idea how to load one after another. Also, it seems not to work on IE properly.</p>
javascript jquery
[3, 5]
5,321,098
5,321,099
updating updatepanel on checkbox check ( which has client events and is in other updatepanel)
<p>I am working in asp.net application. I have a checkbox and three textboxes inside an <code>updatepanel</code>. I have another updatepanel. I am using Jquery to hide show the textboxes. I want to update the second updatepanel contents as well on first updatepanel's checkbox check/uncheck ( which already has client events) How can I do this ? </p> <p>I don't want to use <code>__doPostBack('__Page', 'MyCustomArgument');</code> because it will postback whole page.</p> <p>Please suggest.</p>
c# asp.net
[0, 9]
5,942,319
5,942,320
How to increase text inside div with its size
<p>I have added multiple dynamic divs inside a container div. Each div contains text. Its works fine. But when I added resizable functionality to a div using jquery library. I am able to resize div's but its text size is static. What I want when i increase the div size its text size should also increase and vice versa.</p> <p>Below is the code with which I have adding resizable functionality and appending to a parent.</p> <pre><code> var div = document.createElement('div'); $(div).attr("id", "dyndiv" + count); objid = "dyndiv" + count ; count++; var $ctrl = $(div).text($('#txttext').val()).addClass("draggable ui-widget-content").draggable({ containment: '#containment-wrapper', cursor: 'move', snap: '#containment-wrapper' }).resizable({ aspectRatio:true, containment: '#containment-wrapper' }); $("#containment-wrapper").append($ctrl); </code></pre>
javascript jquery
[3, 5]
3,311,247
3,311,248
Trying to call a jquery function with no event
<p>So turning and image into a link like this</p> <pre><code>var imgCell = '&lt;a href="javascript:storeInfo(&amp;quot;text&amp;quot;,&amp;quot;text&amp;quot;,&amp;quot;ActiveProjects&amp;quot;);"&gt;&lt;img src="https://cubistmediagroup.sharepoint.com/sites/canvas/PublishingImages/details_open.png"&gt;&lt;/a&gt;'; </code></pre> <p>This calls the storeInfo function which will take the "text" "text" and "activeprojects and set them to global variables so they can be used by multiple javascript functions... </p> <pre><code>function storeInfo (filePath, webAddress, projectStatus){ theFilePath = filePath; theWebAddress = webAddress; controlButton(projectStatus);} </code></pre> <p>Then within the storeInfo function I call this function...</p> <pre><code>function controlButton (projectStatus){ $('#'+projectStatus+' tbody td img').live('click', function () { var theTable = ActiveProjectsTable; var nTr = this.parentNode.parentNode.parentNode; if ( this.src.match('details_close') ) { // This row is already open - close it this.src = "https://cubistmediagroup.sharepoint.com/sites/canvas/PublishingImages/details_open.png"; theTable.fnClose( nTr ); } else { // Open this row this.src = "https://cubistmediagroup.sharepoint.com/sites/canvas/PublishingImages/details_close.png"; theTable.fnOpen( nTr, fnFormatDetails(theTable, nTr), 'details' ); } }); } </code></pre> <p>So one the first click of the img it calls the store info function which in return calls the controlButton function... Then within the control button function there is the jquery code function which requires another click... I want to know if there is a way to call the jquery function with no event so that I dont need 2 clicks.</p> <p>How can I just call the jquery function once controlButton is called? </p>
javascript jquery
[3, 5]
4,667,161
4,667,162
javascript / jquery: how do I get the inner window height?
<p>Like... the height that excludes the address bar, bookmarks, etc. just the viewing space.</p> <pre><code>$(window).innerHeight() </code></pre> <p>appears to not work.</p>
javascript jquery
[3, 5]
4,658,355
4,658,356
The effect of static properties in a web context
<p>I need to change a static property on an object in our web application. The property has a default value that is hard-coded into the object. If I change the static property in my Application_Start does that change stick:</p> <p>A) Forever (well, until the app is recycled)</p> <p>B) Until the object is GC'd then re-inialised by the next accessor</p> <p>C) Depends</p> <p>Note that the property I'd be setting is just a String</p>
c# asp.net
[0, 9]
1,697,748
1,697,749
Android Programming: Intent.getExtras() seems to be stopping execution flow in a method somehow
<p>I was messing around with the Android SDK, and noticed that in one of the examples for receiving SMS messages, the execution of onReceive never got past Intent.getExtras(). I added Logs before and after that line to be sure, and no logs after getExtras are executed. Android emulator version is 4.0.3. Can anyone point out some flaw in this code that I'm not seeing, or offer a workaround or solution to this seemingly random and frustrating issue? </p> <pre><code>public class SmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.i("smsreceiver", "Intent: " + intent.getAction()); //Shows up in LogCat normally Bundle bundle = intent.getExtras(); Log.i("smsreceiver", "after"); //this is never reached, and nothing after this is executed Object messages[] = (Object[]) bundle.get("pdus"); SmsMessage smsMessage[] = new SmsMessage[messages.length]; for (int n = 0; n &lt; messages.length; n++) { smsMessage[n] = SmsMessage.createFromPdu((byte[])messages[n]); } Log.i("smsreceiver", "Message: " + smsMessage[0].getMessageBody()); } } </code></pre>
java android
[1, 4]
900,444
900,445
Invoke two functions with the same name
<p>In short i want to overwrite a javascript function with a newer one, but in that newer function i want to be able to call the old one. So for example:</p> <pre><code>function test() { alert('original'); } // then some time later function test() { alert('new function'); } // call function test(); </code></pre> <p>In this case only the last <code>test()</code> is invoked. So the <code>new function</code> is alerted.</p> <p>But is there a way to call the first <code>test()</code> method aswell? SO both <code>test()</code> function get invoked?</p> <hr> <p>The reason i need this is because a web application generates an <code>onSave()</code> method. This function is triggered when a form is saved through Ajax.</p> <p>I want to do some additional things when the form is saved but i can't just change the original <code>onSave()</code> function. That is why i'm looking for a way to extend it.</p> <p>How can i do this?</p>
javascript jquery
[3, 5]
2,647,414
2,647,415
How do I close an iframe from an onclick event inside the iframe?
<p>I want to close an iframe by clicking a button inside that iframe and come back out to the parent page.</p> <p>I have searched but could not get appropriate code.</p> <p>Can anybody help me?</p>
php javascript
[2, 3]
1,944,306
1,944,307
File Download popup overwrites the alert popup
<p>When the user clicks on the "Export to Excel" link, the standard "File download" dialog is presented to the user. <a href="http://i.imgur.com/bsXM9.jpg" rel="nofollow">See here for an example image</a>. </p> <p>But before exporting the excel file, I want to display an alert popup. But the Save dialog is obscuring the view of the alert popup. </p> <p>How can I display the popup without it being obscured? </p> <p>Here is my code...</p> <pre><code>dsResult = clsObj.getSearchResults_BL(detObj); if (OrdDifference != null &amp;&amp; OrdDifference.Any()) { ScriptManager.RegisterClientScriptBlock(this.up, this.GetType(), "export", "alert('.....')", true); set(dsResult, strName); } else { set(dsResult, strName); } private void set(DataSet ds, string strFileName) { ExcelEngine excelEngine = new ExcelEngine(); IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2007; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet sheet = workbook.Worksheets[0]; try { sheet.Name = strFileName; sheet.ImportDataTable(ds.Tables[0], true, 1, 1, -1, -1); ... workbook.SaveAs(strFileName, ExcelSaveType.SaveAsXLS, HttpContext.Current.Response, ExcelDownloadType.PromptDialog); } catch (Exception ex) { } } </code></pre>
c# javascript asp.net
[0, 3, 9]
4,283,274
4,283,275
Unable to pass string value to my html google map
<p>From this link <a href="http://code.google.com/intl/en/apis/maps/articles/android_v3.html#why" rel="nofollow">http://code.google.com/intl/en/apis/maps/articles/android_v3.html#why</a></p> <p>i have used JavaScriptInterface .In the above link the getLatitude() and getLongitude() functions are returning double value to the map but using the same concept when i try to return a string value to my own map that takes string value to achieve some task, i am unable to receive string value there.. </p> <p>this is so weird bcz i just want to pass string value instead of double, but this is not working... her is my complete code <a href="http://stackoverflow.com/questions/4989811/javascriptinterface-is-not-working-in-android">JavaScriptInterface() is not working in android.</a> any suggestions would be very much appreciated...</p> <p>thanks,</p>
javascript android
[3, 4]
4,503,965
4,503,966
objectdatasource question
<p>For the moment, I'm binding my gridviews by calling a linq query that returns a list collection of objects MyObject. In my gridview, if I'm using a boundfield I set its Datafield property to the name of the property of MyObject and if I'm using an itemtemplate I work with Eval. In my code behind, I have</p> <pre><code>MyGridview.DataSource = MyListOfMyObject; MyGridview.DataBind(); </code></pre> <p>All seems to work fine.</p> <p>What's the purpose of adding an ObjectDataSource control in the aspx file. What does it do extra?</p> <p>Thanks.</p> <p>PS: I'm new to the .net framework and I'm still figuring things out. </p>
c# asp.net
[0, 9]
4,165,767
4,165,768
android fromhtml cannot recognize all HTML tag
<p>As far as I know, fromhtml of Android can recognize a few HTML tags like "<code>&lt;b&gt;</code>, <code>&lt;i&gt;</code>, <code>&lt;u&gt;</code>, <code>&lt;a&gt;</code>" and so on. But I cannot convince how to render following HTML code for android with fromhtml attribute.</p> <pre><code>String html = "&lt;code style='background:#f0f0f0'&gt;this is code&lt;/code&gt;&lt;pre&gt;this is pre&lt;/pre&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;this is table&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; textView.setText(Html.fromHtml(html); </code></pre> <p>It's only for <strong>TextView</strong>, not for <strong>WebView</strong>. any solution will be appreciated.</p>
java android
[1, 4]
906,680
906,681
What criteria is used to determine if the web.config has changed and needs to be reloaded?
<p>What actions trigger the reloading of the web.config setting? </p> <p>What does "changed" mean in this context? Does it just compare the modified dates? Do a binary compare? Something else?</p> <p>Would just opening and closing web.config cause it to be reloaded? </p>
c# asp.net
[0, 9]
4,362,578
4,362,579
How does jQuery use namespace to avoid conflict with other 3rd JavaScript library?
<p>I have gone through the jQuery Source Code, but I cannot find how jQuery implement the namespace functionality?</p>
javascript jquery
[3, 5]
309,167
309,168
Expired session on a website using callbacks
<p>I have an aspx.cs page that use only callback to connect to server side.</p> <p>After the website starts running, if I work on this page for several minutes, the session has been expired. I have only used callback and I haven't used any postback. I think the session has expired because it's not arising from the postback, but my web site is callback based and I never use postback.</p> <p>How can I resolve this expired session problem?</p>
c# asp.net
[0, 9]
2,309,298
2,309,299
a onlick event opens box and on box submit it links to php function which set some values to db
<p>I'm trying to create sort of alert box with a onClick event. Basic idea here is to create box which asks user to select(checkbox) some value and then submit. After user clicks box submit-button it should send form values to db.</p> <p>I think I won't be able to link php-function directly in onClick-event.</p> <p>Any tips to start to create this?</p>
php javascript
[2, 3]
5,140,556
5,140,557
How to run validator from javascript?
<p>Here is a part of my code:</p> <pre><code>&lt;asp:ListBox ID="lbRD" runat="server" DataSourceID="RDSqlDataSource" onchange="JSFillDetail();" DataTextField="Описание" DataValueField="ID" Width="188px" Height="200px"/&gt; &lt;asp:TextBox ID="txtDescription" runat="server" /&gt; &lt;asp:RequiredFieldValidator ID="txtDescriptionRequiredFieldValidator" runat="server" ErrorMessage="Описание является обязательным для заполнения" ControlToValidate="txtDescription" /&gt; </code></pre> <p>I have a listbox, a textbox and a required field validator on my page. When the user selects something from the listbox, the selected item appears in the textbox using a javascript function. When the page is submitted, the validator reports an error in case the textbox is empty. If after that the user selects something from the listbox, the error message is still displayed, even though the textbox is not empty anymore. How can I make the validator validate the textbox, or even better, to clear the error message from the javascript function that fills the textbox? Thanks, David</p>
javascript asp.net
[3, 9]
4,587,166
4,587,167
How to send, receive and store references to external Methods
<p>In a custom Class I'm trying to execute functions that are given externally via parameters.</p> <p>It is important for me not to have to store any reference to parent classes or such, only the methods/functions to be called.</p> <p>I tried sending a Method as a parameter but it isn't working.</p> <pre><code>class A // var to store reference to external method private Method myMethodReference; // (says error: never used) // the setter to store the reference to the external method public void setMethodReference(Method someMethod) { myMethodReference = someMethod; } public boolean someFunctionWithinMyClass() { // call the external method via my reference myMethodReference(); // (says error: The method myMethodReference() is undefined) } </code></pre> <hr> <p>Also, when I try to set the reference to the method from the external class, it doesn't work:</p> <pre><code>class B public void someFunction() { Log.i("la", "la" }; instanceOfClassA.setMethodReference(someFunction); // (says error: variable someFunction not found) </code></pre> <hr> <p>So even passing the reference doesn't work because Eclipse assumes someFunction is a variable that is not in the scope.</p> <p>I hope this explains it better!</p>
java android
[1, 4]
2,288,770
2,288,771
storing list item code in database
<p>i have the following structure:<br/></p> <pre><code>&lt;ul&gt; &lt;li code=12&gt;C++&lt;/li&gt; &lt;li code=5&gt;Java&lt;/li&gt; &lt;li code=17&gt;PHP&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>when the user click on save button the form will be submit to PHP function.<br/> i want to pass 12,5,17(list item codes) as array to PHP function(with $_POST array) to store it in the database.<br> what is the best way to do this?</p>
php javascript jquery
[2, 3, 5]
957,020
957,021
Turn javascript input into php-string
<p>I found this script for making a preview somewhat similar to the one used here on stackoverflow. When users have typed in the post I would like it to be converted into a php-string even before being showed in preview. This will be in order to use the mysql_real_escape_string as well as other things.</p> <p>How do I make it into a php-string before showing? And it would also be very nice to know how to make it show again after I have escaped the string.</p> <p>It contains essentially contain these two parts of code </p> <p>1</p> <pre><code>&lt;script type="text/javascript"&gt; function preview(field) { var p = document.getElementById('input_exercise'); p.innerHTML = field.value; } &lt;/script&gt; </code></pre> <p>2</p> <pre><code>&lt;textarea style="width:500px; height:150px;" onkeypress="preview(this);"&gt;&lt;/textarea&gt; &lt;p id="input_exercise"&gt;&lt;/p&gt; </code></pre> <p>Thanks</p>
php javascript
[2, 3]
1,872,069
1,872,070
Math.pow JS vs. PHP
<p>I need help to "translate" this snippet to PHP from JS.</p> <p>The original JS code is this:</p> <pre><code>result = A * ( B / 1200 ) / ( 1 - 1 / Math.pow( 1 + ( B / 1200 ), C * 12 ) ) * D; </code></pre> <p>I need this code in PHP. I try with this, but it gives me a different result:</p> <pre><code>$result = $A * ( $B / 1200) / ( 1 - 1 / pow( 1 + ( $B / 1200 ), $C * 12 ) ) * $D; </code></pre>
php javascript
[2, 3]
4,871,021
4,871,022
jQuery/javascript - Highlight for a menu when user click on it
<p>Hi<br /> Suppose I have a menu like:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="xxx"&gt;notebook&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="xxx"&gt;camera&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="xxx"&gt;phone&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When I click on a menu, the menu will be highlighted, if click on another menu, this menu will be highlighted and other menu will return to original(no highlighted). Can someone give me some idea how to do it(create a listener for <code>&lt;li&gt;</code> or anything else)?<br /> Thanks you</p>
javascript jquery
[3, 5]
5,326,431
5,326,432
How to navigate from one popup to another
<p>I have a popup which is </p> <pre><code>function validateDropDown(obj){ if(document.getElementById(obj).value=='4') { alert('Do you want to view Service Details?'); return false; } } </code></pre> <p>Now, when the popup asks "Do you want to view Service Details?" and if i give OK, then it should take me to the other page. Please help me how to incorporate this,</p> <p>Thanks.</p>
c# javascript
[0, 3]
5,696,036
5,696,037
Jquery .span refresh onclick
<p>Am I correct in thinking this should work?</p> <p>I have this jquery:</p> <pre><code>&lt;script&gt; $(function() { $(".wpsc_buy_button").click(function(evt) { $(".counter").load("index.php") evt.preventDefault(); }) }) &lt;/script&gt; </code></pre> <p>This .span:</p> <pre><code>&lt;span class="counter"&gt; &lt;?php $i = 0; while(wpsc_have_cart_items()): wpsc_the_cart_item(); ?&gt; &lt;?php $i += wpsc_cart_item_quantity(); ?&gt; &lt;?php endwhile; ?&gt; &lt;?php print $i ?&gt; &lt;/span&gt; </code></pre> <p>And this button:</p> <pre><code>&lt;input type="submit" value="Add To Cart" name="Buy" class="wpsc_buy_button" id="product_16_submit_button"/&gt; </code></pre>
javascript jquery
[3, 5]
5,008,712
5,008,713
Referring a class on a list newbie confusion
<p>I was studying livewallpaper in this <a href="http://www.vogella.com/articles/AndroidLiveWallpaper/article.html" rel="nofollow">site</a>. However something there is something that i dont understand.</p> <p>Example in the code of the tutorial there a class named MyPoint</p> <pre><code>public class MyPoint { String text; private int x; private int y; public MyPoint(String text, int x, int y) { this.text = text; this.x = x; this.y = y; } } </code></pre> <p>then after he created a MyWallpaperService class. Inside of that class there is a line of code like this</p> <pre><code> private List&lt;MyPoint&gt; circles; private Paint paint = new Paint(); private int width; int height; private boolean visible = true; private int maxNumber; private boolean touchEnabled; public MyWallpaperEngine() { SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences(MyWallpaperService.this); maxNumber = Integer .valueOf(prefs.getString("numberOfCircles", "4")); touchEnabled = prefs.getBoolean("touch", false); circles = new ArrayList&lt;MyPoint&gt;(); paint.setAntiAlias(true); paint.setColor(Color.WHITE); paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeWidth(10f); handler.post(drawRunner); } </code></pre> <p>You can see the part of code has</p> <pre><code>private List&lt;MyPoint&gt; circles; </code></pre> <p>This is the part that i dont understand? What is happening in here? What will <code>List&lt;MyPoint&gt;</code> pass in the circles? Anyone knows what to call this? is this list reffering to a class? Cause im not sure on my title. Thank you..</p>
java android
[1, 4]
4,157,864
4,157,865
How to keep a Bitmap in memory
<p>Following up on <a href="http://stackoverflow.com/questions/8814455/storing-a-bitmap-resource-in-a-static-variable">Storing a Bitmap resource in a static variable</a>, it seems that storing a static reference to an <code>android.graphics.Bitmap</code> in a <code>View</code> may leak a reference to that first <code>View</code> that instantiated it. What's the idiomatic way to solve this in Android? I do not want to call <code>BitmapFactory.decodeResource(resource, id)</code> each time an instance of this view is instantiated because this will be done (many times) in every single Activity. I want this small <code>Bitmap</code> to always remain in memory. So, what is the correct way to do the following:</p> <pre><code>public class MyView extends View { private static Bitmap star; public MyView(Context context) { synchronized(this) { if (star == null) { star = BitmapFactory.decodeResource(getResources(), R.drawable.star); } } } // ... } </code></pre>
java android
[1, 4]
5,810,799
5,810,800
Auto Load and Refresh Div every 10 Seconds with jQuery
<p>I'm working with a nice little Jquery that auto loads and refreshes a div every bla bla Seconds. Works perfectly on all browsers then I load up IE and bang what a surprise no luck! :(</p> <p>Index.html</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var auto_refresh = setInterval( function () { $('#load').load('reload.php').fadeIn("slow"); }, 10000); // refresh every 10000 milliseconds &lt;body&gt; &lt;div id="load"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/script&gt; </code></pre> <p>reload.php</p> <pre><code>&lt;? echo time(); //just a timestamp example.. ?&gt; </code></pre> <p>Any ideas guys?</p>
javascript jquery
[3, 5]
1,575,665
1,575,666
Show a loading animation while function completes
<p>I have a function inside my .aspx.cs code which takes wuite a long time to do the processing until when I want to display a cool loading animation. <br/>I looked some of the earlier posts but either these didn't work for me, or were having solution specific to Page loading scenario (not loading a while a function completes).</p> <p>I guess the right approach would be to fire a Javascript startLoader() function just before the the main function starts (which takes a long time), and then call a stopLoader() from the .aspx.cs itself to stop the loader when the function ends. Any suggestions how to implement this?</p>
c# javascript asp.net
[0, 3, 9]
1,691,360
1,691,361
Including simple PHP code into Javascript
<p>How do I make this work? I've googled and even saw some examples here on Stackoverflow which show this kind of coding, but it doesn't work for me.</p> <pre><code>&lt;script type="text/javascript"&gt; var infoClass = ""; infoClass = &lt;?php echo('test'); ?&gt;; alert(infoClass); &lt;/script&gt; </code></pre> <p>The alert box displays empty box.</p>
php javascript
[2, 3]
176,398
176,399
jQuery keydown but ignore if in text box
<p>I'm calling a function (below) that will perform an action if the user presses the delete button. It is working fine but I need to to only do it on the page and not when a user is typing (inside an input or inside a textarea).</p> <pre><code>$(window).keydown(function (evt) { if (evt.which == 46) { // delete goDoSomething(); } }); </code></pre> <p>Any ideas <code>how I can amend the above</code> to <code>not fire</code> if the user is <code>in</code> an <code>input</code> or <code>textarea</code>?</p> <p>Thanks in advance,</p> <p>Dave</p>
javascript jquery
[3, 5]
5,716,471
5,716,472
Disable Number field based on selection in dropdown via Jquery
<p>What I want to do is if a user selects "bycrypt", it should show a field to ask how many passes, and if he/she selects "sha512" to show the same field,but disabled. I was recommended to do this using Jquery,but my attempt is not working. My code is as follows:</p> <pre><code> &lt;fieldset&gt; &lt;legend&gt;Security&lt;/legend&gt; &lt;label&gt;Hash Type&lt;/label&gt; &lt;select name="hash" id="myId"&gt; &lt;option value="bcrypt"&lt;?php if($hash == 'bcrypt') { echo ' selected="selected"'; } ?&gt;&gt;Bcrypt&lt;/option&gt; &lt;option value="sha512"&lt;?php if($hash == 'sha512') { echo ' selected="selected"'; } ?&gt;&gt;SHA512&lt;/option&gt; &lt;/select&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js" /&gt;&lt;/script&gt; &lt;label&gt;Bcrypt rounds &lt;i&gt;(12 Rounds is recommended)&lt;/i&gt;&lt;/label&gt; &lt;script type="text/javascript&gt; $("#myId").change(function() { var tst = document.getElementById('myId').value; if (tst ==1) { document.getElementById('#bcrypt_rounds').disabled=true; } else { document.getElementById('#bcrypt_rounds').disabled=false; } }); &lt;/script&gt; &lt;input name="bcrypt_rounds" id="bcrypt_rounds" type="text" value="&lt;?php echo $bcrypt_rounds; ? &gt;" /&gt; </code></pre> <p>Updated above. Now cuts the page off after the "bycrpt_rounds" label. Does not get to the field for "bycrypt_rounds". </p>
php javascript jquery
[2, 3, 5]
5,483,228
5,483,229
.js file format
<p>I was wondering if there is a good reference to how best to format .js files? </p> <p>Do you treat them like you would class files or do you separate out the functionality based off the page it handles? Do you create .js functions that could be used across several pages or do you write a custom .js file for each page?</p> <p>I'm just curious if there is a formal way rather than just writing a bunch of functions that may or may not be group together for a specific page or set of pages. Right now I try to group by the functionality of the page but my .js files are very custom for that page, not sure if they are usable on a different page.</p> <p><strong>::UPDATE::</strong></p> <p>Some of the answers have the same theme and mostly about what you plan on doing with the project. Right now the project is real new to me and the requirements are slow in coming. So I'm building it page by page. There could be cross functionality or similar functionality in the future. Most of the functionality is very specific to the specific page though.</p> <p>Is it wise to group AJAX calls into a .js but then also have a custompage .js that contains all of the very custom features of the page.</p>
javascript jquery
[3, 5]
1,420,887
1,420,888
Changing color of TextView
<p>I want to change the color of a <code>TextView</code> inside my <code>Activity</code>s <code>ListView</code> by java code. <code>ListView</code> contains multiple rows which are fed by a <code>MatrixCursor</code> and an <code>ArrayAdapter</code>. The color of the <code>TextView</code> should be green or white which should be determined by an <code>if</code> clause. How can I accomplish this?</p> <pre><code> citem = NameManager.getciList(); NameManager.WriteName(citem); MatrixCursor cursor; cursor = NameManager.getnameList(); startManagingCursor(cursor); if (cursor.getString(9).equals("yes")){ //TODO set color of R.id.name color here } String[] from = { "name", "info", "status", "path", "folder", BaseColumns._ID }; int[] to = { R.id.name, R.id.info, R.id.status, R.id.path }; final SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to); setListAdapter(adapter); </code></pre>
java android
[1, 4]
382,995
382,996
Url redirect not working using ip
<p>When I use localhost the navigate url is working but when I am using the ip address of the machine the page not found is showing</p> <p>The code is following</p> <pre><code>&lt;asp:HyperLink ID="LoginLogout" runat="server"&gt;&lt;/asp:HyperLink&gt; LoginLogout.NavigateUrl = "login.aspx" LoginLogout.Text = "Login" </code></pre>
c# asp.net
[0, 9]