Posts

jquery - If input field is empty, disable submit button -

i'm trying disable submit button if user hasn't provided text. at first sight looks works fine, if user types text, deletes it, submit button becomes enabled. here code: $(document).ready(function(){ $('.sendbutton').attr('disabled',true); $('#message').keyup(function(){ if($(this).val.length !=0){ $('.sendbutton').attr('disabled', false); } }) }); you disabling on document.ready , happens once when dom ready need disable in keyup event when textbox gets empty. change $(this).val.length $(this).val().length $(document).ready(function(){ $('.sendbutton').attr('disabled',true); $('#message').keyup(function(){ if($(this).val().length !=0) $('.sendbutton').attr('disabled', false); else $('.sendbutton').attr('disabled',true); }) }); or can use conditional oper...

c# - If Best Fit Straight Line the best method for prediction -

i need make prediction next point, based on given set of point samples on 2-d coordinate system. i using best-fit straight line method such prediction. please let me know if there method better best-fit straight line? my code below: public class lineequation { public double m; //slope public double c; //constant in y=mx+c } public class point { public double x; public double y; } public class bestfitline { public point[] points = new point[7]; public void inputpoints(point[] points) { (int = 0; < points.length; i++) { points[i] = new point(); } points[0].x = 12; points[0].y = 13; points[1].x = 22; points[1].y = 23; points[2].x = 32; points[2].y = 33; points[3].x = 42; points[0].y = 23; points[4].x = 52; points[4].y = 33; points[5].x = 62; points[5].y = 63; points[6].x = 72; points[...

asp.net - I am using UrlRewritingNet.UrlRewrite dll, how to redirect to Error page when bad request get fired? -

Image
currently using urlrewritingnet.urlrewrite dll url rewriting in asp.net #3.5. without using special character works fine ex. url1. after giving special characters in url throws bad request error ex. url2 url1: http://www.example.com/search/0253 url2: http://www.example.com/search/0253:0253 to handle error, want redirect other error page, how can this? on iis 7+ can define error pages statuses, 400 bad request : <httperrors> <error statuscode="400" path="/bad-request.aspx" prefixlanguagefilepath="" responsemode="executeurl"/> </httperrors> or trough iis console go error pages , add custom error page status code 400 :

debugging - XCode 4.6 crash report stacktrace only -

a customer send me crash log, contains stack trace. stack trace generated custom developed exception handler. exception message: nsinvalidargumentexception exception reason: *** setobjectforkey: object cannot nil (key: pop_year) stacktrace: ( 0 corefoundation 0x3a9dc3ff <redacted> + 186 1 libobjc.a.dylib 0x39a35963 objc_exception_throw + 30 2 corefoundation 0x3a93e5ef <redacted> + 142 3 simplystats 0x0004640b simplystats + 103435 4 simplystats 0x000458e1 simplystats + 100577 5 simplystats 0x00034b83 simplystats + 31619 6 libdispatch.dylib 0x337c4793 <redacted> + 10 7 libdispatch.dylib 0x337c7b3b <redacted> + 142 8 libdispatch.dylib 0x337c567d <redacted> + 44 9 libdispatch.dylib 0x337c8613 <redacted> + 210 10 libdispatc...

javascript - Show/Display the checked checkbox value using PHP or JS -

i thought if possible done php or javascript: let's have 2 checkboxes: <li><input type="checkbox" checked="checked" name="tuesday" value="111"/> tueday</li> <li><input type="checkbox" name="wednesday" value="112"/> wednesday</li> i want see value of checked="checked" 111 after page loaded. how can achieve this? if possible in php , javascript, have both methods. thank you! window.addeventlistener('load', function(){ var ch = document.getelementsbyname('tuesday')[0]; if(ch.checked) // use ch.value }); or if want display checked values: window.addeventlistener('load', function(){ var checkedvalues= []; var chs = document.getelementsbytagname('input'); for(var = 0; < chs.length; i++) if(chs[i].type.tolowercase() === 'checkbox' && chs[i].checked) ...

html - Show background image on hover -

i'm trying show background image text inside when im hoovering navigation link, reason image wont show up. here of title css .navigation h1 { position: absolute; right: 22px; top: -7px; display: none; padding: 4px 20px 4px 7px; color: #fff; white-space: nowrap; background: transparent url('http://i.imgur.com/dbncnpk.png') 100% 50% no-repeat; } html <div class="navigation"> <ul> <li> <h1>one</h1> <a href="#hem" class="active">one</a> </li> <li> <h1>two</h1> <a href="#two">two</a></li> <li> <h1>three</h1> <a href="#three">three</a></li> </ul> </div> and fiddle jsfiddle http://jsfiddle.net/vbsdp/1/ check out fiddle. you didn...

c# - How to detect that an XPATH expression is correct? -

is there way (regex or similar, c# preferred) detect if xpath expression correct before using it? i have been googling time , nothing seems appear. thanks in advance! carlos. try , if there thrown xpathexception, mean xpath syntactically wrong. xmldocument doc = new xmldocument(); xpathnavigator nav = doc.createnavigator(); try { var res = nav.compile(xpath); // ... } catch (xpathexception e) { // handle exception }