Posts

hortonworks data platform - Ambari api POST complaining CSRF protection -

i trying set hbase property through ambari api using following command curl -u "admin:admin" -i -x post -d '{"type": "hbase-site", "tag": "version3", "properties" : {"hbase.regionserver.global.memstore.size" : "0.6"}}' https://abct.net/api/v1/clusters/xyz/configurations but keep getting following error http/1.1 400 bad request content-length: 107 content-type: text/plain expires: thu, 01 jan 1970 00:00:00 gmt server: microsoft-iis/8.5 x-ms-hdi-active: 10.8.18.29 x-frame-options: deny x-xss-protection: 1; mode=block user: admin x-powered-by: arr/3.0 set-cookie: ambarisessionid=2e8ortl32j1p7zdjatigdgvg;path=/;httponly; path=/; secure x-powered-by: asp.net date: mon, 12 sep 2016 18:19:38 gmt { "status" : 400, "message" : "csrf protection turned on. x-requested-by http header required." } what missing here ? turns out have add request header requ...

How can I annotate a Django queryset with a count in a way that's conditional to some property of each item in the queryset? -

sorry title, think pseudo-code clarify question: class image(model): user = foreignkey(user) class group(model): members = foreignkey(user) images = foreignkey(image) autosubmission = booleanfield() as can see, have group , consisting of members , images . if group autosubmission members don't submit images manually it, images belonging member automatically show in group. if group not autosubmission members need submit images manually, , end in images foreignkey . now, want have queryset that's annotated number of images the group. group.objects.all().annotate(num_images = count('images')) obviously, code above works groups not autosubmission , i.e. images in images relation. so how can annotate queryset works both groups autosubmission , groups not? thanks!

mongoose - Reducing an interface in TypeScript -

i have mongoose model interface declaring such: export interface iuserdocument extends mongoose.document { surname: string; lastname: string; } export interface iusermodel extends mongoose.model<iuserdocument> { mystaticmethodgoeshere(signature: string): void; } and corresponding mongoose schema: const userschema = new mongoose.schema({ surname: {type: string, required: true}, lastname: {type: string, required: true}, }) now have define how user structured 2 times (mongoose schema , typescript interface), isn't dry , inconvenient. unfortunately, if want use mongoose's lean method, have define yet interface: export interface ileanuserdocument { _id: mongoose.types.objectid; __v: number; surname: string; lastname: string; } this inconvenient , error prone. there way lean interface extend (i don't know verb use here) iuserdocument interface remove stuff it? extends not way of adding properties interface. believe can work typ...

cocoapods - Xcode 8 Warning: no rule to process file of type net.daringfireball.markdown for architecture x86_64 -

i above warning in xcode 8 changelog.md file in cocoapod source. how clear it? select project navigator select project select target select build phases move files (in case, changlelog.md) don't want compiler process compile sources copy bundle resources

dynamic - How to make ng-click dynamically added into table from a modal to work? AngularJS -

i received project contains angularjs in it, need someting , don´t doing wrong since i'm noob in angularjs matters. the context: this part of whole project, angular files in project configured gulp. have html page(page1.html) has button , table, html controlled ng-controller(controller.js), in html have button ng-click function. function opens $uibmodal has own controller , templateurl. templateurl in html file inside <script></script> tag. controller of modal(controller2) in same file main controller(controller1) when modal opens see 1 text input, enter text press add button, modal closes , in main html page 1 row of table added entered text in text input. the problem: the table on each row next text has 2 buttons ng-click functions, 1 delete 1 edit, when rows added beginning of compilation work fine, when rows dynamically added modal don't anything. have read questions similar problems $compile service work, not know how apply on case. any enormo...

ios - Convert NSString to NSData and keep escaped "&" -

i need convert nsstring or nsmutablestring nsdata , keep escaped character it. im escaping character "&" %26 in post field, since im using not rich-full nsmutablerequest im able set httpbody nsdata. nsmutabledata *body = [nsmutabledata new]; [body setdata:[part1 datausingencoding:nsutf8stringencoding]]; [body appenddata:[escapedstringfield ?]; [body appenddata:[part2 datausingencoding:nsutf8stringencoding]]; request works correctly fails "&", idea proper solution without implementing 3rd party library networking? update: not necessary paste here. part1 , part2 works fine. there problem value passed in ' escapedstringfield '. part1 ends "&password=" for exmaple while request being made &password=gryurrh%267444&7444 but value password equal to gryurrh%267444 at same time which corrupt request i have resolved issue myself. answer nsdata+gzip ps. 2 down votes - reasonable down-votes of course. love p...

android - Using different screen layouts -

i have app different versions screens (small, normal, largue, , extralargue xml files) each xml designed each type, found huawei phone screen 3.5" hvga 320x480. my question is, should not ui of android use small configuration screen? app when running on phone uses normal configuration if nexus4 4.7" 768x1280 change that? i tried create various types of screen (create other) multiple configurations without optimal result. assuming 3.5" measurement on diagonal, works out 165 dpi falls mdpi (or normal screen size) bucket according android's supporting multiple screens guide. dpi = sqrt(w^2 + h^2) / d w width of display in pixels h height of display in pixels d physical diagonal measurement of display in inches