Posts

swift - Xcode - How to make that master and detail controller shows at the same time? -

Image
i read , found enter link description here when did got error "fatal error: array index out of range". have uisplitviewcontroller , uitabbarcontroller (it master) , several uiviewcontrollers . want show both master controller , detail controller @ same time in portrait orientation looks in horizontal orientation. please me. my interface looks i found simple solution. made class uisplitviewcontroller wrote following code within it. import uikit class split: uisplitviewcontroller, uisplitviewcontrollerdelegate { override func viewdidload() { super.viewdidload() self.delegate = self } override func didreceivememorywarning() { super.didreceivememorywarning() } func splitviewcontroller(svc: uisplitviewcontroller, shouldhideviewcontroller vc: uiviewcontroller, inorientation orientation: uiinterfaceorientation) -> bool { return false } }

Android Error when rotating phone after taking picture using Intent ACTION_IMAGE_CAPTURE -

i error on activityresult: "attempt invoke virtual method 'java.lang.string android.net.uri.getpath()' on null object reference", when take picture rotate phone or emulator confirm "save" picture. this how call camera: file file = getoutputmediafile(processid); picuri = uri.fromfile(file); intent = new intent(android.provider.mediastore.action_image_capture); i.putextra(mediastore.extra_output, picuri); startactivityforresult(i, 1); without seeing code onactivityresult() , can make experienced guess @ problem. there many different camera apps , don't behave same way. typically, when request camera image capture , provide uri image extra_output , image written uri , no uri returned in result intent. suspect in onactivityresult() , expecting result intent contain uri . has none: resultintent.getdata() null. if not provide uri image in request intent extra_output , resul...

Rails - Skipping password validation, allow_nil safe? -

i split password update functionality off user profiles users can update profiles without being hassled password. profile update page no longer using the _form partial, got own view @ profileedit.html.erb. the profile edit view did not have password fields, of course didn't stop validations preventing updates. tried number of ways skip validation, experienced frustration, drank coffee, , came upon solution here: https://quickleft.com/blog/rails-tip-validating-users-with-has_secure_password/ it works great. long using has_secure_password, 1 needs add 'allow_nil: true' end of password validation. if go password update page , save without entering anything, doesn't overwrite password blank, , validations still apply if enter something. like said, seems to work great. i'm concerned missing something. issues should aware of? the pertinent bit model: has_secure_password validates :password, presence: true, length: { minimum: 6 }, allow_nil: true

OAuth 2.0 authentication in RestSharp -

Image
i trying authenticate restful service (sabre rest api) using restsharp library not able authenticate it. using client id , secret. please tell me how authenticate using oauth 2.0 authenticator. i have tried code. ( sabre using oauth 2.0 authentication ) public actionresult index() { var client = new restclient("https://api.test.sabre.com"); client.authenticator = new httpbasicauthenticator("myclientid", "myclientsecret"); restrequest request = new restrequest("/v1/auth/token", method.post); request.addheader("authorization", "basic " + client); request.addheader("content-type", "application/x-www-form-urlencoded"); request.addparameter("grant_type", "client_credentials"); irestresponse response = client.execute(request); var content = response.content; viewbag.r = content; return view(); } i got result {"error":"invalid...

android - Why application stops for some time and button also not pushed -

this gist of program.. when pressed button telling location works fine if geocoder not throw exception, problem comes when geocoder throws exception , @ same time application stop time hangs.. because progress bar stop rotating… , stop button not pressed… after 30 seconds or 1 min print no address found… can me separate out problem… thank in advance. //this in oncreate method locationmanager = (locationmanager) getsystemservice(context.location_service); locationmanager.requestlocationupdates(locationmanager.gps_provider,1000,3, this); //seperate mehtod public void geo(double latitude,double longitude) { if(geocoder.ispresent()) { try { geocoder geocoder = new geocoder(getapplicationcontext(), locale.getdefault()); list<address> listaddresses = geocoder.getfromlocation(latitude, longitude, 1); if(null!=listaddresses&&listaddresses.size()>0) { location = listaddresses.get(0).get...

oracle11g - Oracle REST Data Services installed with Oracle APEX 5 -

i installed oracle apex 5 under oracle 11g, now, able download reports pdf, installed oracle rest data services 3.0 . apex on port 8080 , , ords on 8081 . now, seems ords created virtual new instance of apex. in both ports can use apex ( localhost:8080/apex , localhost:8081/ords/ ), in 8081 download pdf working. is right? this seems strange me. followed official oracle documentation. know if these products works way or if did mistake when installing , configuring. i'm not oracle specialist, edits improve answer welcome. it seems installation right. according documentation: by default, context root accessing oracle application express through oracle rest data services /ords . it's not clear me architecture of product but, after reading available docs, interpreted have 2 ways access apex. as pasted right below, documentation tells need turn off apex default port. if using embedded pl/sql gateway , want use oracle rest data services, n...

MySQL and Python: commits from one thread not visible to another thread, but visible from MySQL Workbench -

i have 2 python threads accessing same mysql database, each own connection , cursor object. 1 thread inserts record table. expect, mysql workbench, don't see table grow in length until writing thread commit, see change. problem is, other thread doesn't see change: sees old state of table, if commit never happened. when restart application, length of table read correctly, remains stuck there eternity, no matter how many records writing thread appends , commits. feel i'm missing obvious here. to read length of table, i've tried: select count(*) mystupidtable select count(id) mystupidtable , even: select id mystupidtable all these attempts return old state of table, though commit never happened. it sounds 2nd thread running off snapshot of database when implicitly opened transaction. (which think cursors do.) if so, committing cursor on 2nd thread should allow see new data. see https://dev.mysql.com/doc/refman/5.0/en/innodb-consistent-read.html , repea...