Posts

ios - How to write unit test for testing view controller? -

we trying write our custom unit tests testing every view controller separately. know there ui automation, kif, , other solutions, if take @ code above find should possible without using them. so, simplicity, suppose there's simple view controller 2 public methods "setfirststate" , "setsecondstate". need test, "setfirststate" method called when view controller instantiated , shown on screen (goes through viewdidload). here's demo view controller: @interface myviewcontroller - (void)setfirststate; - (void)setsecondstate; @end @implementation myviewcontroller - (void)viewdidload { [super viewdidload]; [self setfirststate]; } @end so, unit test testing setfirststate call (using xctest , ocmock): - (void)test_viewdidload_callsmymethod { myviewcontroller *viewcontoller = [[myviewcontroller alloc] init]; id mock = [ocmockobject partialmockforobject:viewcontoller]; [[mock expect] showlogin]; [uiapplication sha...

actionscript 3 - How to convert flash dynamic presentation to air to work in mobile -

can convert flash desktop presentation developed in flashdevelope as3 air work in mobiles(ex: android) phones. presentation containes runtime dynamic data(xmls,images,swfs) loading. possible? you can load static assets no problem, loading remote swf containing actionscript isn't allowed on ios , android have restriction. for new version of air can package code in main swf , load swf , linking code. see article more details. adobe article you can package multiple swf in application , load them. adobe article

php - Query multiple tables - display Team Name based on Team ID -

my tables structures are `tblteam` (`teamid`, `teamname`) values (1,'india'), (2,'pakistan'), (3,'brazil') (4,'poland'); `tblmatch` (`matchid`, `matchdate`, `matchstart`, `matchend`, `team1id`, `team2id`) values (1, '19-11-2014', '12:00:00', '13:00:00', 1, 2), (2, '19-11-2014', '13:10:00', '14:10:00', 4, 3), (3, '19-11-2014', '14:20:00', '15:20:00', 1, 3), (4, '19-11-2014', '15:30:00', '16:30:00', 4, 2), (5, '20-11-2014', '10:00:00', '11:00:00', 1, 4), (6, '20-11-2014', '11:10:00', '12:10:00', 3, 4); insert tblscore ( scoreid , teamid , matchid , score ) values (1, 1, 1, 5), (2, 2, 1, 6), (3, 4, 2, 15), (4, 3, 2, 26); i want display team name of ( team1id , team2id ) on 19-11-2014 there 4 matches in php output should time : between : 12:00:00 - 13:00:00 india v/s pakistan ...

javascript - The Mathematical Operators not working on window.innerWidth -

when use mathematical operators window.innerwidth returs nan. i tried add numeric 1 window.innerwidth. what's wrong code? <body> <p>click button display window's height , width (not including toolbars , scrollbars).</p> <button onclick="myfunction()">try it</button> <p id="demo"></p> <script> function myfunction() { var w = window.innerwidth; var h = window.innerheight; x = document.getelementbyid("demo"); x.innerhtml = "width: " + w-1 + " heigth: " + h; } </script> </body> view sample @ plunker change innerhtml code as x.innerhtml = "width: " + (w-1) + " heigth: " + h; modify javascript code below here modified plunker function myfunction() { var w = window.innerwidth; var h = window.innerheight; x = document.getelementbyid("demo"); x.innerhtml = "width: " +...

rest - Retrieving all(!) of the tweets of a user -

i want tweets of user using twitter api 1.1 , end point: https://api.twitter.com/1.1/statuses/user_timeline.json the documents of twitter api https://dev.twitter.com/rest/reference/get/statuses/user_timeline says there's limit 3200 (the parameter count ). if that's case, how retrieve all(!) of tweets of user, not 3200? the simple answer cannot. the longer answer there 2 ways around this. the user can request twitter archive. contain list of every tweet have sent. the new search api indexes every tweet. can, theoretically, search each tweet. however, if don't know you're searching for, it's unlikely work.

xcode6 - Store data in Swift -

i have general question on programming related swift. example when want store int value in app because use variable along whole application. have 3 options this: //first //in appdelegate var myint = 3 //and later can use when let delegate = uiapplication.sharedapplication().delegate appdelegate delegate.myint = 5 //second //i can store value in userdefaults nsuserdefaults.standarduserdefaults().setinteger(myint, forkey: "myint") nsuserdefaults.standarduserdefaults().synchronize() //and later them var anotherint = nsuserdefaults.standarduserdefaults().integerforkey("myint") //third //i can define structure data storage struct mydata { static var myint = 3 } //and later value mydata.myint = 5 so question is, 1 should use? or shouldn't 1 store global values @ all? love hear :] option 1 work fine if don't want variable persist between app launches. option 2 work fine if do want variable persist between app launches. option 3 work not...

php - I am getting Fatal error: Using $this when not in object context -

hi using code below, know works in page on site, purpose have put within standalone button runs script server side, not working , getting fatal error: using $this when not in object context (the $$postcode= $params["value1"]; result previous javascript fetches current field (postcode) add screen, works , tested, rest of code. id grateful alternatives? $postcode= $params["value1"]; //set post code variables $key = "xxxx-xxxx-xxxx-xxxx"; $searchterm = $postcode; $this->key = $key; $this->searchterm = $searchterm; //build url request $url = "http://services.postcodeanywhere.co.uk/postcodeanywhere/interactive/find/v1.10/xmla.ws?"; $url .= "&key=" . urlencode($this->key); $url .= "&searchterm=" . urlencode($this->searchterm); //make request postcode anywhere , parse xml returned $file = simplexml_load_file($url); //check error, if there 1 throw exception if ($file->columns->column->attrib...