Posts

ios - How to lock orientation just for one view controller? -

can set portrait orientation , lock orientation in 1 controller? i did try: override func supportedinterfaceorientations() -> int { return int(uiinterfaceorientationmask.portrait.rawvalue) } override func shouldautorotate() -> bool{ return false } but doesn't me. must add else? this code should work: override func supportedinterfaceorientations() -> int { return int(uiinterfaceorientationmask.portrait.rawvalue) } override func shouldautorotate() -> bool{ return false } override func preferredinterfaceorientationforpresentation() -> uiinterfaceorientation { return uiinterfaceorientation.portrait } if working you, suppose controller in controller( uinavigationcontroller , uitabbarcontroller , uisplitviewcontroller ). in case need use code in parent controller. if navigation controller contain more 1 view controller, , need disable orientation of them, need inherit uinavigationcontroller...

python - Check if user is asked for a password during ssh -

i want know if there's way in python can detect if user asked password when connecting sftp using ssh, able ignore connecting? thanks. i not aware such thing possible python; anyway wouldn't recommend involving checking password interactive prompts if try filter subprocess pipes (in case calling sftp popen). if goal prevent password authentication may call sftp passwordauthentication=no , preferredauthentications=publickey this: sftp -o passwordauthentication=no -o preferredauthentications=publickey host in way should fail if password required.

C# Interface, Unity, and Optional Parameter -

hopefully can shed light on one. have interface optional parameter. use unity. if try change optional parameter in method implementation, works directly, unity object uses interface's default - not implemented method's default. setup: public interface itestoptional { string happymethod(string input, bool amhappy = false); } public class testingoptional : itestoptional { public string happymethod(string input, bool amhappy = true) { if (amhappy) return input + " happy!"; return input + " not happy!"; } } add unity: container.registertype<itestoptional, testingoptional>(); and test: //direct call var testdirect = new testingoptional(); string happydirect = testdirect.happymethod("cow", true); //expecting happy - happy string saddirect = testdirect.happymethod("cow", false); //expecting not happy - not happy string defaultdirect = testdirect.happymethod("cow...

json - PHP array to an Array of Objects -

how convert array array of objects php ? input [1, 2, 3] output [ {id:1}, {id:2}, {id:3} ] if defined object before, guess i'd loop class previouslydefinedobject{ public $id; } $myarray = array(1,2,3); $newarray = array(); foreach($myarray $id){ $obj = new previouslydefinedobject(); $obj->id = $id; array_push($newarray, $obj); } print_r($newarray); that way, $newarray contains every object in array

ESB Mediation by Example -

i'm trying understand esb mediation is, (concrete examples), , hitting mental wall. according wikipedia, data mediation redirects data transformation article, mention of mediation vague , mysterious: when data mapping indirect via mediating data model, process called data mediation . so ask: mediation (in context of esbs) , concrete examples of mediation in action? to me, term mediation used in general sense in case , refers functions of esb enable mediate between multiple ( often heterogenous ) systems , exposed services. esb middleware, technical backbone helps integration , used when building soa enterprise. if @ functions column, next mediation in table, give context. says - adapters, protocol transformation, service mapping . i'll bit each of terms in table , hope understand context. adapters in heterogeneous environment you'll have great diversity of systems, built , bought in different eras, maintained separate teams, owned different ...

javascript - Do DOM tree elements with ids become global variables? -

working on idea simple htmlelement wrapper stumbled upon following internet explorer , chrome : for given htmlelement id in dom tree, possible retrieve div using id variable name. div like <div id="example">some text</div> in internet explorer 8 , chrome can do: alert(example.innerhtml); //=> 'some text' or alert(window['example'].innerhtml); //=> 'some text' so, mean every element in dom tree converted variable in global namespace? , mean 1 can use replacement getelementbyid method in these browsers? what supposed happen ‘named elements’ added apparent properties of document object. bad idea, allows element names clash real properties of document . ie made situation worse adding named elements properties of window object. doubly bad in have avoid naming elements after member of either document or window object (or other library code in project) might want use. it means these elements visible glob...

jquery - Nestable tree does not work in a modal ui- bootstrap using the < script> < / script> -

i try display tree in modal nestable ui- bootstrap , select - + not pop , not work when injected between ui modal -bootstrap ( jquery.nestable.js ) how can solve problem ! <script type="text/ng-template" id="mymodalcontent.html"> <div class="dd" id="nestable"> <ol class="dd-list"> <li class="dd-item" class="dd-item" data-id="1"> <div class="dd-handle">entretien</div> <ol class="dd-list"> <li class="dd-item" data-id="1"> <div class="dd-handle" ng-click="setselectedsegment(valsegment)">lessives</div> </li> <li class="dd-item" data-id="1"> <div class="dd-handle" ng-click=...