Posts

javascript - Do I need to enable CSRF protection? -

if none of post endpoints in api server consume application/x-www-form-urlencoded or multipart/form-data , need concerned csrf? understanding, csrf can executed through form-backed post requests. other kind of request requires use of xmlhttprequest , won't go through because of same origin policy. sure, can send json forms in modern browsers. applies application/x-www-form-encoded applies equally other form data encoding types. moreoever - there no guarantee support more types won't added in future there's that.

javascript - Angularjs Multidimensional array and two relative select boxes -

i have multidimensional array holds product names , versions. want create interface lets user select product select box, , version number in second select box. second select box should show versions numbers of product user selected in first select box. this mutidimensional array: [object]0: name: "product 1" versions: [array]0: number: "1.0" number: "1.5.2" 1: name: "product 2" versions: [array]0: number: "0.0" number: "0.5" the user has option choose multiple products, created array hold users selection. my controller setup this: app.controller('maincontroller', function ($scope) { $scope.products = [{id: 1, name: '', versions: []}]; $scope.packages = []; $scope.packages[0] = { id: 1, name: 'product 1', versions: [{number: 1.0}...

java - Spring Integration: send object in json to jms -

i'm bit confused , need clarification: i'm trying transform object in json , send using jms each second. here context.xml: <bean id="connectionfactory" class="org.springframework.jms.connection.cachingconnectionfactory"> <property name="targetconnectionfactory"> <bean class="org.apache.activemq.activemqconnectionfactory"> <property name="brokerurl" value="tcp://localhost:61616" /> </bean> </property> <property name="sessioncachesize" value="10" /> </bean> <bean id="requesttopic" class="org.apache.activemq.command.activemqtopic"> <constructor-arg value="testconf" /> </bean> <bean id="confbean" class="demo.deviceconfiguration"> <property name="id" value="thermo_001" /> <property name=...

ios - selector is not called for navigationitem barbutton -

after set right bar navigation button custom view, selector never called when button pressed. here code: uiimageview *navview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"notification_alert.png"]]; navview.frame = cgrectmake(0, 0, 40, 40); self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:navview]; [self.navigationitem.rightbarbuttonitem settarget:self]; [self.navigationitem.rightbarbuttonitem setaction:@selector(btnclick:)]; the button appears correctly selector never called. appreciated! -(ibaction)btnclick:(id)sender { nslog(@"nav button clicked"); } from documentation init(customview:) : the bar button item created method not call action method of target in response user interactions. instead, bar button item expects specified custom view handle user interactions , provide appropriate response. see uibarbuttonitem class reference more information. a workaround use uibutton cus...

ios - rounded navigation bar image iphone sdk -

Image
i trying set navigation bar's titleview rounded image. similar profile images see in messaging applications. i believe should able create rounded scaled down image doing following: uiimageview* profileimageview = [[uiimageview alloc] initwithimage:logoimage]; [profileimageview setframe:cgrectmake(0, 0, 30, 30)]; //profileimageview.contentmode = uiviewcontentmodescaleaspectfit; // xxx contentmode commented out because enabling causes rounded corners have no effect? profileimageview.layer.cornerradius = 15; profileimageview.layer.maskstobounds = yes; profileimageview.clipstobounds = yes; self.navigationitem.titleview = profileimageview; this appears create image desire split second when load emulator, image appears in top left corner of screen , snaps center of navigation bar. once @ center of navigation bar rescales take entire space of navigation bar instead of remaining small circle. missing? seems must need disable ever mechanism causing image scale fill entire naviga...

sqlite3 - SQLite porting to STM32 having issue with memory allocation -

i trying port sqlite ucos rtos running in stm324xg_eval board. using micrium file system making ram based file system used sqlite. have tried different build configurations , used sqlite3_config api define different memory regions heap, scratch , page memory. able initialize (sqlite3_initialize) , open(sqlite3_open) db. when trying create tables(sqlite3_exec), getting errors "journal file not found", "out of memory". may issue thanks, shijo thomas

Mongoose / MongoDB replica set using secondary for reads -

i changed server setup include replica set. secondary dbs located in multiple regions around world decrease latency. problem think of reads being done master , not secondary servers. i'm seeing 500ms+ latency in newrelic on servers far away master db, staging server, in same region master ~20ms. how can check if secondary read or nearest working, or have setting missing / wrong? (i have tried both secondary_preferred, , nearest) url: mongodb://1.1.1.1:27017,1.1.1.2:27017,1.1.1.3:27017,1.1.1.4:27017,1.1.1.5:27017/mydatabase my options this: "replset": { "rs_name": "myrepset" "readpreference": "readpreference.secondary_preferred", "read_preference": "readpreference.secondary_preferred", "slaveok": true } mongoose version: 3.8.x as per project issues on github there issue read preference not seem working when upgrading newest version (mongoose@3.8.1 & mongodb@1.3.23...