Posts

ios - Passing Data through ViewControllers - Make settings page -

so i've been having problem while , if can bring me onto right path appreciate it. making app settings button. whenever enable segmentedcontrol or uiswitch, , go back default. want have segmented control change color. have set colors info want change on view controller #1. how make settings page keep changes. heres code far. - (ibaction)colorcontroller:(id)sender { if (controller.selectedsegmentindex == 0) { //app title text color apptitle.textcolor = [uicolor colorwithred:1.00 green:1.00 blue:0.00 alpha:1.0]; //background color when selected controller.tintcolor = [uicolor colorwithred:1.00 green:1.00 blue:0.00 alpha:1.0]; //the font of selected nsdictionary *fontcolor = [nsdictionary dictionarywithobjectsandkeys: [uicolor blackcolor],nsforegroundcolorattributename, nil]; [controller settitletextattributes:fontcolor forstate:uicontrolstateselected]; } if (controller.selectedseg...

javascript - ReactJS manipulate existing DOM element -

i got task during job interview. i'm new reactjs couldn't find proper solution. i'm supposed make bootstrap's toggle box: image example the important thing here component should invoked way: <togglebox header="the title goes here"> content of toggle box </togglebox> i'm not sure think mean invoking html code attached dom , not using react.render(). however, far know, reactjs isn't structured rebuilding existing dom, there workaround accomplish task? maybe got wrong , "invoking" mean use react.render()? thanks! :-) the component need use this.props.children . can @ documentation here . here's example: var withchildren = react.createclass({ render: function() { var child = this.props.children; var header = this.props.header; return ( <div> <div>{header}</div> <div>{child}</div> </di...

ember.js - ember-data render belongsTo attribute -

ember-cli 0.2.3; ember-data 1.0.0-beta.15 i'm struggling figure out how display attributes belongsto object inside template. i've found few other similar questions here they're either out of date or don't provide solution. user model: export default ds.model.extend({ ... agency : ds.belongsto("agency"), }); agency model: var agency = ds.model.extend({ ... users: ds.hasmany("user"), }); user serializer: export default applicationserializer.extend(ds.embeddedrecordsmixin, { attrs: { agencies: { embedded: "always" } } }); applicationserializer: export default ds.restserializer.extend({}); the json (for index route) looks so: { "users": [ { "id" : "1", "name" : "...", "agency_...

jquery - Evaluating/validating all app JavaScript in a minitest unit test -

is crazy thing attempt? :) sprockets.context_class.class_eval def image_path(dummy); end def asset_path(dummy); end end sprockets.append_path(rails.root.join('app/assets/javascripts').to_s) asset = sprockets['application.js'] jquery = file.read(file.join(rails.root, "app/assets/javascripts/vendor/jquery.js")) js = execjs.exec jquery + asset.to_s my premise quite simple. want test loads , validates javascript assets in app. many js.erb need push them through asset pipeline first (or otherwise evaluate them). my thinking when load page in chrome validates js app (because it's crammed application.js ), should able unit test. absolutely doesn't work -- keep gettiing random errors, like: error (0:00:01.874) js files should using correct escaping typeerror: cannot read property 'defaultview' of undefined but i'm trying isn't special - i'm sure other apps validate js part of tests... right? missing here? to put ...

javascript - How do I set the Select All "checkbox" iMacros Without using the button "Play (Loop)" -

how set select "checkbox" imacros without using button "play (loop)" , without making tag 50 lines since our site visited no key select , need choose 50 categories. here's code use , try this version javascript imacros: var macro; macro = "code:"; macro += "tag pos={{i}} type=input:checkbox form=id:post_form attr=name:category[] content=yes" + "\n"; macro += "wait seconds=0" + "\n"; for(i=1;i<=50;i++){ iimset("i",i); iimplay(macro); } this version imacros tag pos=1 type=input:checkbox form=id:post_form attr=name:category[] content=yes tag pos=2 type=input:checkbox form=id:post_form attr=name:category[] content=yes tag pos=3 type=input:checkbox form=id:post_form attr=name:category[] content=yes tag pos=4 type=input:checkbox form=id:post_form attr=name:category[] content=yes tag pos=5 type=input:checkbox form=id:post_form attr=name:category[] content=yes tag pos=6 type=input:checkbox f...

mysql - InnoDB Corruption in Xampp -

i have backup 2 weeks ago last resort, db files seem fine , appears it's libdata1 file having issues. stated, i'm using xampp , mysql crashes right after start it. here error log: http://textuploader.com/7vfd i hadn't done out of ordinary; seemingly , stopped working. i looked innodb recovery, solutions tried required mysql functional, isn't due corruption. there way salvage presumably intact ibd files bad libdata1 file? edit: aware of using innodb_force_recovery = # , had tried it...except had tried in wrong my.ini . had use 1 in bin folder. appears fixed now. the ibdata1 file contains tablespace information , other metadata mysql database(s). you can try using innodb_force_recovery = 1 way innodb_force_recovery = 6 see if rectifies problem. try changing in my.cnf ( my.ini windows) file , attempt restart mysql server again. if able start mysql using recovery flag, database in read-only mode. should mysqldump of data, stop mysql, re-insta...

swift - Audio from MPMoviePlayerController continues playing after segue to next view controller -

after adding video file, audio video preview continues after segue next vc pressed. is there way stop audio playing after segue pressed? var objmovieplayercontroller: mpmovieplayercontroller = mpmovieplayercontroller() var urlvideo: nsurl = nsurl() @iboutlet weak var videoprofileview: uiimageview! @iboutlet weak var addvideobtn: uibutton! override func viewdidload() { super.viewdidload() var thewidth = view.frame.size.width var theheight = view.frame.size.height videoprofileview.frame = cgrectmake(0, 50, thewidth, thewidth) addvideobtn.center = cgpointmake(thewidth/2, self.videoprofileview.frame.maxy+50) } @ibaction func addvideobtn_click(sender: anyobject) { var ipcvideo = uiimagepickercontroller() ipcvideo.delegate = self ipcvideo.sourcetype = uiimagepickercontrollersourcetype.photolibrary ipcvideo.allowsediting = true ipcvideo.videomaximumduration = 15 var kuttypemovieanyobject : anyobject = kuttypemovie anyobject ipcvide...