Posts

xcode - Alternative iOS layouts for portrait and landscape using just one .xib file -

Image
using interface builder in xcode , 1 .xib file, how can create alternate layouts when rotating between landscape , portrait orientations? see diagram of differing layouts n.b . green view/area contain 3 items flowing horizontal in landscape , in portrait 3 items flow vertically within green view/area. a way have 3 views in .xib file. first 1 normal view of viewcontroller no subviews. then create views portrait , landscape need them. 3 have root-level views (have @ screenshot) in viewcontroller, create 2 iboutlets, 1 portrait , 1 landscape view , connect them corresponding views in interface builder: iboutlet uiview *_portraitview; iboutlet uiview *_landscapeview; uiview *_currentview; the third view, _currentview needed keep track of 1 of these views being displayed. create new function this: -(void)setupviewfororientation:(uiinterfaceorientation)orientation { [_currentview removefromsuperview]; if(uiinterfaceorientationislandscape(orientation)) ...

The semicolon inference doesn't work when an assignment statement is followed by curly braces in Scala? -

@ http://www.artima.com/pins1ed/builtin-control-structures.html#7.7 , see following code val = 1; { val = 2 println(a) } println(a) where says semicolon required here, why? from rule @ http://www.artima.com/pins1ed/classes-and-objects.html#4.2 , think semicolon should auto added since val = 1 can legal statement. the next line begins { , think can start legal statement. (since there's no compile error if add semicolon , separate first 2 lines 2 statements.) val = 1 not in parentheses or brackets. because legal call apply : implicit class richint(i: int) { def apply(thunk: => unit) = 33 } val = 1 { val = 2 println(a) } println(a) // 33 ! 1 { ... } short 1.apply {...} . apply not defined int default, implicit enrichment shows, possible. edit : semicolon inference conditions described in '§1.2 newline characters' of scala language specification . inferred semicolon called 'special token " nl "' in text. ...

git fetch vs pull (need full merge syntax) -

so i've read plenty of answers on already, saying pull = fetch + merge. i'm not totally convinced. morning instead of doing "git pull" update code everyone's changes, did "git fetch," , ran "git merge" resulted in bunch of errors. actually, "git merge" didn't work on own. i'm on origin/develop branch, did "git merge origin develop" , gave me several errors (which didn't save, unfortunately). so, exact syntax should've used? you should've used git merge @{u} . @{u} shorthand remote tracking branch (e.g., origin/master ). looks might working branch called develop , equivalent: git merge origin/develop . i can't remember if pull ask provide message actual merge--in case cannot fast-forward. so, full command might more akin git merge --no-edit @{u} .

firebase - Concurrent users and multiple observers -

i know there a thread on how number of concurrent users calculated in firebase, doesn't answer question, is: if single user has multiple observers multiple locations in single firebase application, count 1 or several concurrent users? multiple observers multiple location same firebase connection counted 1 concurrent only. every web page shares single connection given firebase, not across iframes or tabs. every node.js, ios or android process share 1 connection per firebase well.

javascript - distance jQuery UI draggable object has been moved, dragged -

i using following code allow members of .datacard class draggable left or right, revert original positions. $('.datacard').draggable({ axis: 'x', revert: true }); how can tell distance item away original position? have made across 1 axis .. drag: function (e, ui){ y2 = ui.position.top; x2 = ui.position.left; if(y2>100){alert("greater");} if(y2>100){alert("greater");} } jsfiddle demo

javascript - jQuery Adding and Removing Rows Trouble -

Image
i'm trying create new use implemented tool use here @ work, i'm sure i'm doing wrong. i can't figure out how make delete row. , more, can figure out how clone within .pt-entry, , have replicated inside of incremental .pt-entry...but without user filled in info. hopefully makes sense. you can check out pen here , here's code breakdown rest of yous: html: <table class="manage-pt" id="0"> <tr class="pt-entry"> <td class="pt-toggle-group"> <input type="button" class="pt-button togptbutton" value="?" /> <input type="button" class="pt-button addptbutton" value="+" /> <input type="button" class="pt-button delptbutton" value="-" /> </td> <td class="pt-values"> <div> <input ty...

algorithm - find the first longest ascending or descending sub-sequence in a given unsorted sequence by C++ -

i writing c++ program find , print first longest ascending or descending continuous subsequence vector of integers. example, given vector with 4, 2, 1, 2, 3, 4, 3, 5, 1, 2, 4, 6, 5 return 1,2,3,4 my code follows: but, not know how return first optimal solution. example, above sequence has 1, 2, 4, 6 4 long. but, need return 1,2,3,4. bool findlong(const vector<int> v) { if (v.size() <1) return false; if (v.size() == 1){ cout << v[0] << endl; return true; } vector::const_iterator itr_left, itr_right; itr_left = v.begin(); itr_right = v.begin()+1; bool ascending_flag ; int counter =0; if (*itr_right > *(itr_right-1)){ bool ascending_flag = true; ++ascending_counter; } else{ bool ascending_flag = false; ++descending_counter; } int longest = int_min; vector<int>::iterator longest_left = v.begin(), longest_right =v.begin(); ++itr_right; while (itr_right != v.end()) { if (a...