Posts

ios - Enable UIAlertAction of UIAlertController only after input -

i using uialertcontroller present dialog uitextfield , 1 uialertaction button labeled "ok". how disable button until number of characters (say 5 characters) input uitextfield ? add following property in header file @property(nonatomic, strong)uialertaction *okaction; then copy following code in viewdidload method of viewcontroller self.okaction = [uialertaction actionwithtitle:@"ok" style:uialertactionstyledefault handler:nil]; self.okaction.enabled = no; uialertcontroller *controller = [uialertcontroller alertcontrollerwithtitle:nil message:@"enter text" preferredstyle:uialertcontrollerstylealert]; [controller addtextfieldwithconfigurationhandler:^(uitextfield *textfield) { textfield.delegate = self; }]; [controller ...

javascript - What are the advantages of using arguments in functions? -

when define function why might want use argument / parameter? benefits of using arguments? how useful? explain? thanks. var playlist = [ 'i did way', 'respect', 'imagine', 'born run', 'louie louie', 'maybellene' ]; function print(message) { document.write(message); } function printlist (list) { var listhtml = '<ol>'; (var = 0; < list.length; += 1) { listhtml += '<li>' + list[i] + '</li>'; } listhtml += '</ol>'; print(listhtml); } printlist(playlist); why have arguments been used in example above? arguments let apply same logic different data, meaning can re-use code. if don't use arguments there limitation on re-usability of functions or methods, can produce same output repeatedly, same how asking question on , on again no new information give same answer. in example, printlist function written such that, if wanted, generate mu...

vb.net - While I'm debugging and clicked a button then "InvalidCastException was unhandled" is going to popup -

Image
my code doesn't have error, when try click button happens. can guys guess what's error? look @ photo you should swap second , third argument call msgbox. error occurs second argument should msgboxstyle , you're providing string ('ilist'). take @ documention on msdn more information.

laravel - update parent timestamps when updating child model in polymorphic relationship -

in laravel 5.1 have 2 models.a city model , photo model. there polymorphic relation between city , photo. while updating city's photo with $city->photos()->updateorcreate($attributes,$values) the child time stamps updates. parent model's timestamp , city in case, not update accordingly , should manually call $city->touch() how can update parent model's timestamp when touching child model in laravel? for polymorphic relations class photo extends eloquent { protected $touches = ['city']; public function city() { return $this->morphto() // add function if not done } } class city extends eloquent { public function photos() { return $this->morphmany(app\photo::class, 'city'); } } in case, when photo updated, touches parent (city in situation). hope helps.

Build Java ver error on Android Studio -

i hoping shed light on following build error when trying launch project in android studio imported form eclipse: error:execution failed task ':diveapp:dexdebug'. com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command '/library/java/javavirtualmachines/jdk1.7.0_11.jdk/contents/home/bin/java'' finished non-zero exit value 2 i running on os x yosemite 10.10 , running java 8.0 update 60 (build 1.8.8_60-b27). url above seems reference jdk1.7.0_11jdk, not sure if issue or how check. cheers look @ gradle console log, see exact error. most of time because added same package few times - library different modules or in different places. if not - try clean - rebuild project. p.s. can change jdk project in file -> project structure also, there answers question error:execution failed task ':app:dexdebug'. com.android.ide.common.process.processexception

html - How do I link an external css to overwrite bootstrap css for centering elements? -

i'm having hard time making websites responsive downloaded basic template , navigation sample bootstrap, i'm wondering how edit navigation bar? because multiple css folders. tried creating new css file , editing through there can't seem make work. i'm trying making text centre in container/wrapper (i'm not sure called, each word in box , centre word in box html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags --> <title>example</title> <!-- bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="navbar.css" rel=...

ios - Saving AnyObject to NSUserdefaults -

this question has answer here: attempt set non-property-list object nsuserdefaults 7 answers i'm working on swift application interacts shopify api through mobile buy sdk . i'm having issues saving cart device. else works fine, when use following code save cart device: func savecart() { nsuserdefaults.standarduserdefaults().setobject(cart, forkey: "cart") println("cart saved") } i receive following error: terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'attempt insert non-property list object <buycart: 0x7fb5e30512f0> key cart' from nsuserdefaults class reference: the nsuserdefaults class provides convenience methods accessing common types such floats, doubles, integers, booleans, , urls. default object must property list, is, instance of (or collections c...