Posts

jquery - How do I get FormIt with ModX Revolution to redirect to a web page id (ie. www.myurl.com/index.php#contact)? -

okay, issue created 1 page html website multiple sections represent pages. problem having formit contact form works, cant redirect right id. once submit form, takes me top of page. ideas? check out below formit call: [[!formit? &hooks=`email` &emailfrom=`info@brickhousetitle.com` &emailtpl=`emailchunk` &emailto=`[[+email]]` &redirectto=`http://myurl/index.php#contact` &emailsubject=`bht website inquiry` &validate=`name:required, email:email:required, comment:required:striptags` &successmessage=` <div class="alert alert-success margintop25"> <button type="button" class="close" data-dismiss="alert">&times;</button> <h4>thank you! inquiry has been submitted successfully.</h4> </div> ` &validationerrormessage=` <div class="alert alert-error"> <button type="but...

r - If else operator -

could please tell me switch in r returns second argument if true , third if false? i have searched switch , if else function , have looked through documentation when using ubiquitous terms if , else seems hard identify solution. i looking like: f(true,1,2); f(false,1,2) [1] 1 [1] 2 i working on reading through documentation of julia has made me aware of of gaps in knowledge in r. in julia there operator available. (true ? 1 : 2) 1 (false ? 1 : 2) 2 simply ifelse ifelse(true,1,2) ## [1] 1 ifelse(false,1,2) ## [1] 2

Android : Unfortunately, app has stopped -

i beginner android, trying run first application. there's error in log file , application terminated message "unfortunately, app has stopped"! here java file: public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); button mclick=(button)findviewbyid(r.id.button1); mclick.setonclicklistener(new view.onclicklistener() { //@override @suppresslint("showtoast") public void onclick(view v) { // todo auto-generated method stub toast t = toast.maketext(mainactivity.this, r.string.hi, 3000).show(); } }); } } and log has these errors: 04-19 18:50:02.200: e/androidruntime(792): fatal exception: main 04-19 18:50:02.200: e/androidruntime(792): process: com.example.test, pid: 792 04-19 18:50:02.200: e/androidruntime(792): java.lang.runtimeexception: unabl...

javascript - How to change a function from onblur, to onclick with submit button? -

here piece of code i'm trying make work submit button. works fine onblur, when try use onclick submit button doesn't work. how can that? here html name <br> <input size="16" placeholder="first name" id="firstname" name="firstname" type="text"> <br> <br>last name <br> <input placeholder="last name" name="lastname" id="lastname" type="text"> <br> <br> <button type="submit" id="submitbtn" name="submit">submit</button> here pure javascript window.onload = function () { document.getelementbyid("firstname").onblur = mandatoryfield; document.getelementbyid("lastname").onblur = mandatoryfield; }; // clear potential alert function clearalert() { var redalert = document.getelementbyid("redalert"); if (redalert) { document.body.removechild(re...

objective c - Sending HTTP GET Requests with NSURLConnection -

i'm new site , decided ask question has been bugging me while. working on app requires calendar gets events posted on website that's going going along it. i'm new using xcode , objective c i've been using ios 7 programming cookbook me questions might have. however, problem having requests, titles says, , can't seem find dealing exact problem. appdelegate.m - (bool) application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions{ nsstring *urlasstring = <# place url of web server here #>; //this area problem urlasstring = [urlasstring stringbyappendingstring:@"?param1=first"]; //along urlasstring = [urlasstring stringbyappendingstring:@"&param2=second"]; //and nsurl *url = [nsurl urlwithstring:urlasstring]; nsmutableurlrequest *urlrequest = [nsmutableurlrequest requestwithurl:url]; [urlrequest settimeoutinterval:30.0f]; [urlre...

php - remove double quotes from json encoded array -

$sql = "select column_type information_schema.columns table_name = 'mst_sim_data' , column_name = 'status'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $enumlist = explode(",", str_replace("'", '', substr($row['column_type'], 5, (strlen($row['column_type'])-6)))); foreach ($enumlist $key => $value) { $list["'$value'"] = $value; } return json_encode($list); this returns following json string. object {'instock': "instock", 'issued': "issued", 'soldout': "soldout"} but need replace single quotes on double quotes , should this, 'instock': 'instock', 'issued': 'issued', 'soldout': 'soldout'} how can this? is goal break json output? json strings , properties must use " quote. i believ...

python - Do I need custom random-number generator for Perlin noise? -

Image
perlin explained in pseudo-code: http://freespace.virgin.net/hugo.elias/models/m_perlin.htm the tutorial gives me random number generator function writen in pseudo-code. returns floating number in range of (-1, 1). function intnoise(32-bit integer: x) x = (x<<13) ^ x; return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end intnoise function so if function returns number in range (-1, 1), can't use random.uniform(-1, 1) ? meet problem: function noise(x) . . end function function smoothnoise_1d(x) return noise(x)/2 + noise(x-1)/4 + noise(x+1)/4 end function i guess noise(x) function generates random numbers 1d noise. i can't seem understand x parameter is. seed? and, can't use random.uniform(-1, 1) the noise function used in perlin noise seeded random number generator. is, must return same value every time called same value parameter, x . can think of x position in ...