Posts

ios - editActionsForRowAtIndexPath was called but not showing EDIT and DELETE -

i have tableview in uiviewcontroller class. have implement swipeable when swipe should show edit delete, 2 action. problem is, it's going inside method when swipe, did not show 2 actions. func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { } func tableview(tableview: uitableview, editactionsforrowatindexpath indexpath: nsindexpath) -> [uitableviewrowaction]? { let editaction = uitableviewrowaction(style: .default, title: "edit") { action, index in print("edit"); } editaction.backgroundcolor = uicolor.bluecolor() let deleteaction = uitableviewrowaction(style: .default, title: "delete") { (rowaction:uitableviewrowaction, indexpath:nsindexpath) -> void in print("delete"); // self.confirmdelete(); } deleteaction.backgroundcolor = uicolor.redcolor() return [editaction,deleteaction] } ...

r - Markdown for Reproducible Research in Python -

i know whether there equivalent r-markdown in python can me reproducible research. please note: i'm not interested in ipython notebooks answer . i want have syntactic joy of r-markdown code in python. know 1 can supply engine="python" in r-markdown , going problem comes when want include plots produced using matplotlib in reproducible doc writing plt.show() plt alias matplotlib.pyplot . do know such modules / tools in python can me achieve this? want use such tools spyder / intellij. i option similar echo=false present in such tool. if no such project exists, guys know / organization working on such thing.

android - Overwrite HOST header in okhttp request -

i using okhttp send http request android apk. due server-side proxy requirement, url endpoint like: " https://api.example.com ", in http request, overwrite host header "host: proxy.example.com". tried use like: httpurl url = new httpurl.builder() .scheme("https") .host("api.example.com") .build(); okhttprequest = new com.squareup.okhttp.request.builder() .url(url) .method("get", requestbody) .header("host", "proxy.example.com") .build(); response = mokhttpclient.newcall(okhttprequest).execute(); however, when looked http request in network packages, host header still "api.example.com". wonder, advice can overwrite host header? lot! by default okhttp won’t let set host header that’s different url’s host. can hack using network interceptor sets host header.

excel - saving a file to dynamic path which is a value in excell cell -

i have vba code in powerpoint saves file automatically name of excel file active . powerpointapp.activepresentation.saveas "z:\05_project\tanverdi\" & replace(thisworkbook.name, "xlsm", "ppt"), 1 different people going use macro , have different folders save it, want path of folder dynamic too. best getting path name active excell cell, can write path name in excel cell , can use cell value path. but how do ? let's path in sheet1/cell a1, replace hard coded path with: powerpointapp.activepresentation.saveas thisworkbook.sheets(1).range("a1").value & replace(thisworkbook.name, "xlsm", "ppt"), 1

ios - Can we allow different "indexes" of a NSMutableArray to be manipulated simultaneously from two threads -

nsmutablearray not thread-safe, don't see why can't designed thread-safe long different indices being manipulated simultaneously. e.g. index 1 points instance of class x , index 2 instance. isn't efficient allow these 2 objects manipulated @ same time? allowed when use gcd or need use dispatch barrier when changing objects pointed different indices? think of this. your array contains pointers objects. pointers signposts, pointing objects located in memory. now when mutate object, don't touch pointers object. object's location in memory unaffected. therefore, array's point of view, nothing happens when mutate objects in it, pointers remain unaffected. this means mutating different objects in array different threads safe. therefore, correct when it's more efficient download data in parallel different objects in array. so long you're not mutating array itself (adding or removing objects) or mutating same object concurrently, you...

ios - Why can't I make an array of type NSLayoutConstraint? -

this question has answer here: instance member cannot used on type 4 answers basically, trying reset nsconstraints when user taps button. my constraint outlets: @iboutlet weak var firstbuttonheight: nslayoutconstraint! @iboutlet weak var secondbuttonheight: nslayoutconstraint! @iboutlet weak var thirdbuttonheight: nslayoutconstraint! example action: @ibaction func firstbuttonheight(sender: uibutton) { firstbuttonheight.constant = 100 } thought put them array (below) , iterate through them before running firstbuttonheight.constant = 100 : var constraints: [nslayoutconstraint] = [firstbuttonheight, secondbuttonheight, thirdbuttonheight] constraint in constraints { constraint.constant = 50 //original constraint value } however, error instance member 'firstbuttonheight' cannot used on type 'viewcontroller' . when did firstbuttonhei...

sql server - Returning different tables based on parameter? -

for example, have function returns table columns follows: returns table (a character varying, b boolean, c numeric) then based on parameter result_mode default 'summary' , want return different table follows: returns table (a timestamptz, b boolean, c character varying, d numeric) originally have stored procedure in ms sql return results 'summary', 'customer item summary', 'item summary' etc. in postgresql, different think. i might need create multiple functions if can't fit them 1 single function. so, possible sort of have if-statement or case statement returns table based on parameter input?