Posts

Showing posts from May, 2014

rsvp.js - Ember.js: Load related multiple models -

since ember-guides explains how load mutliple models on route that export default ember.route.extend({ model() { return ember.rsvp.hash({ songs: this.get('store').findall('song'), albums: this.get('store').findall('album') }); } }); im wondering how load related model-entries second one, loading songs albums indexed in songs if assume song model containing this ... albums: hasmany('album'), ... how can that? assuming adapter , json api backend support it, can say: export default ember.route.extend({ model() { return ember.rsvp.hash({ songs: this.get('store').findall('song', { include: 'albums' }), }); } }); typically, generate get /songs?include=albums , tells json api backend include related album resources, according http://jsonapi.org/format/#fetching-includes . on ember side of things, feature documented @ http://emberjs.com/blog/2016/05/03/ember-dat...

Python/Pandas - partitioning a pandas DataFrame in 10 disjoint, equally-sized subsets -

i want partition pandas dataframe ten disjoint, equally-sized, randomly composed subsets. i know can randomly sample 1 tenth of original pandas dataframe using: partition_1 = pandas.dataframe.sample(frac=(1/10)) however, how can obtain other 9 partitions? if i'd pandas.dataframe.sample(frac=(1/10)) again, there exists possibility subsets not disjoint. thanks help! use np.random.permutations : df.loc[np.random.permutation(df.index)] it shuffle dataframe , keep column names, after split dataframe 10.

javascript - promise with ajax doesn't return any value in jquery -

my script: var testapp = (function($){ var data = [{ "layout": "getsample", "view": "conversations", "format": "json", }]; var data = 'default'; function ajaxcall(opt) { return new promise(function(resolve, reject) { jquery.ajax({ method: "post", url: localstorage.getitem("root")+"/index.php", "data": opt, error: function() { alert('error'); }, success: function(result) { console.debug(result); resolve(result); }//end success });//end ajax });//end promise } return { render: function(opt) { if(typeof opt === 'object') { var list = { data : [opt] ...

python 2.7 - Creating a set of Unique Values from Dictionary effciiently -

i new python programming. have dictionary of objects queried mongodb. document contains movie id , relevant tweets regarding movie. movie_ids repeating , wanted create set of unique movie_ids . current code wrote follows: client = mongoclient() discovermovies = client['discovermovies'] tweets = discovermovies.tweetdbs.find() unique_movie = set() tweet in tweets: unique_movie.add(tweet.get("movie_id")) movie in unique_movie: print(movie) my question , there more efficient way achieve same, i.e getting unique set dictionary dictionary contains other key value pairs well? thanks sourav given tweet dictionary, set(tweet.values()) efficient can get. a general example: print set({'a': 1, 'b': 1, 'c': 2}.values()) # {1, 2}

angularjs - Delete item from ng-repeat which has a transition animation -

i have array of items in ng-repeat . parent element has background-transition animation 1 second duration. when ever delete element using splice , takes 1 second remove ui. (based on time give transition duration) i don't want add class remove transition first, , delete. or way? <div class="mytransitionclass" ng-repeat="d in myarray"> {{d.value}} <button type="button" class="closeicon" ng-click="deleteitem($index)">delete</button> </div> .mytransitionclass { transition: background-color ease-in 1s; -webkit-transition: background-color ease-in 1s; } try https://docs.angularjs.org/api/nganimate .mytransitionclass.ng-enter { transition: background-color ease-in 1s; -webkit-transition: background-color ease-in 1s; } working jsfiddle http://jsfiddle.net/irhabi/3fgtqwgq/

ruby - Globally Access Variables for All Cucumber Steps from inside Hooks -

currently loading yaml files inside cucumber hooks before- intention ensure dont code individually loading yaml files. @all_yaml_files = dir.entries(@projectdata_path).select {|f| !file.directory? f}; @all_yaml_files.each |file_name| file_full_path = @projectdata_path + '/' + file_name instance_variable_set("@" + file_name.split('.')[0], yaml.load_file(file_full_path)) end however code inside before cucumber hook. when instance variables loaded not available next scenario. how can make them run once , available scenarios , features - ie globally. loading everytime scenario. before .... end note: doing above , can directly access yaml_filename @yaml_filename variable without writing code. thats intention. same happens excel files, json files etc etc. called inside hooks. edit: added "quick" solution quick solution you using class variables ( @var ) now; these subject cucumber magic cleaned out after each scenario, noti...

jquery - Document Ready not firing when expected -

i have site , pages loaded ajax. i load first page , using if (window.jquery) { alert('jquery loaded'); } it alerts jquery has been loaded every time. i have in page following $(document).ready(function() { alert('document ready'); } the document ready alert doesn't fire first time works second time around. what has happen document ready? i don't understand why doesn't work first time around. i use following load page: $('#load-page').load(''+base_href+''+page+'', 'show=all'+show_field_id+''+show_default_sort+''); thank you $( document ).ready(function() { console.log( "ready!" ); }); i think didn't close code right.

java - Control what DataContentHandler to use for a MimeMessage attachment? -

i creating attachment mimemessage tiff image byte array. bytearrayoutputstream out = new bytearrayoutputstream(); mimebodypart body = new mimebodypart(); body.setcontent(tiffbytearray, "image/tiff"); body.setdisposition("attachment"); body.setfilename(filename); mimemultipart multipart = new mimemultipart(); multipart.addbodypart(body); mimemessage message = new mimemessage(session.getdefaultinstance(system.getproperties())); message.setcontent(multipart); message.writeto(out); string mimecontent = out.tostring(); this works. image converted base64 string in message. however, @ point on system occurs , piece of code starts using com.sun.xml.internal.messaging.saaj.soap.imagedatacontenthandler . particular converted expects java.awt.image object opposed byte array ( relevant source ). following error: unable encode image stream imagedatacontenthandler requires image object, given object of type class [b i can see can set javax.activation.datahan...

ios - Show HTML - passing data Property Lists -

i ask tips project i'm working on. i'm xcode beginner, maybe more easy i'm thinking. so, application want create shows collection of data between 2 tableviews , shows image in view controller @ end. i've implemented property lists manage data between tableviews , viewcontroller. now, here problem, show (in last viewcontroller) html file (stored in resource folder) rather image. can me write down code that? i've been able write code image far, is: viewcontroller.h #import <uikit/uikit.h> @interface methodsviewcontroller : uiviewcontroller @property uiimage *bookcover; @property iboutlet uiimageview *bookcoverview; @end viewcontroller.m #pragma mark - #pragma mark view life cycle - (void)viewdidload { [super viewdidload]; if (self.bookcover) { [self.bookcoverview setimage:self.bookcover]; } } @end secondtableview.m prepare segue - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexp...

java - ANTLR4 JavaScript Target very slow -

i'm developing antlr4 javascript listener grammar . var _require = require; var antlr = _require('./antlr4/index'); var javalexer = _require('./generated/javalexer'); var javaparser = _require('./generated/javaparser'); var javalistener = _require('./generated/javalistener'); declare function require(name:string); class codeanalysis { input: string; constructor(input:string) { this.input = input; this.antlrstack(); } private antlrstack() { console.log(this.input); var chars = new antlr.inputstream(this.input); var lexer = new javalexer.javalexer(chars); var tokens = new antlr.commontokenstream(lexer); var parser = new javaparser.javaparser(tokens); var listener = new javalistener.javalistener(); parser.buildparsetrees = true; var tree = parser.compilationunit(); antlr.tree.parsetreewalker.default.walk(listen...

c# - ASP.NET Web API "400 Bad Request" on POST Request When Deploying to Test Server -

Image
i have single page application (spa) angularjs front-end , .net web api backend. works fine on development machine, i.e. when run visual studio (2015) under localhost. however, once published our testing server, when sending post requests web api "400 bad request" error. requests work fine. debugging fiddler , when in textview tab says "the underlying provider failed open". here screenshots fiddler: this how request , response on local machine: this response headers on the test server: and textview on test server: the data being sent through post request same both localhost , test server. also, both of them authorization header present. other values "referer" , "host", other difference noticing between them localhost running on iis/10.0 while test server on iis/8.0. the code angularjs resource calls webapi following: (function () { "use strict"; angular .module("mainapp") .factory("incidentr...

Communication between android app and pc application through USB -

i have android tablet connected windows pc machine through usb cable. don't have internet connection. i need solution establish connection , transfer files pc android app. think can use android open accessories in accessory mode. there better solution solve problem or android open accessories right solution. shortcomings of solution ? you should install drivers tablet , transfer files using usb. android tablet tablet might not recognized without drivers. should store files inside download folder visible pc.

javascript - PHP And Node.JS - Crypto PBKDF2 -

i trying node.js crypto pbkdf2 match same value php crypto pbkdf2. reason, not same. in javascript const crypto = require('crypto'); crypto.pbkdf2('secret', 'salt', 100000, 20, 'sha512', (err, key) => { console.log(key.tostring()); }); output: 7e������]�9��j]�i in php $password = "secret"; $iterations = 100000; $salt = "salt"; $hash = hash_pbkdf2("sha512", $password, $salt, $iterations, 20); echo $hash; output: 3745e482c6e0ade35da1 why js output not matching php? you can use option raw_output of hash_pbkdf2 method in php , compare base64 in php <?php $password = "secret"; $iterations = 100000; $salt = "salt"; $hash = hash_pbkdf2("sha512", $password, $salt, $iterations, 20, true); echo base64_encode($hash); ?> live example in nodejs const crypto = require('crypto'); crypto.pbkdf2('secret', 'salt', 100000, 20, 'sha51...

Pentaho PDI : Excel Input ignore all columns after an empty column. How to full import? -

Image
with empty column or empty header in excel file : excel imput ignore columns after...... it's problem. => how solve ? => there way specify column manually number/letter ? thanks we find solution. you can put null value , continue fill manually headers grid, :

python - Flask 404 Page Not Rendering Template -

i'm trying figure out why 404 page template not render correctly. able return text, not template. here error handler function doesn't work: @app.errorhandler(404) def page_not_found(error): return render_template('error.html'), 404 it works if instead: @app.errorhandler(404) def page_not_found(error): return '<h2>page not found.</h2><a href="/">click here</a> return home.', 404 i'm using blueprint route rest of urls. here more of urls.py: main = blueprint('main', __name__, url_prefix='/language/<lang_code>/') app.config.from_object(__name__) babel = babel(app) def render(template_name, data): template_data = { } template_data.update(data) return render_template(template_name, **template_data) @app.url_defaults def set_language_code(endpoint, values): if 'lang_code' in values or not session['lang_code']: return if app.url_map.is_endp...

java - Is there a way to make axis2 recognise @XmlElement annotations? -

from web service method returning object of class contains number of @xmlelement , other @xml annotations control names of items in xml. axis2 happily bundles in soap response ignores @xml annotations. there way make axis2 recognise annotations?

php - Convert an array of arrays into a string? -

array( array('foo' => '11'), array('bar' => '22'), ); given array above, without using loop, possible output following string? '11 22' here's one-liner: $subject = array( array('foo' => '11'), array('bar' => '22'), array('bar' => '33'), ); echo implode(" ", array_map("implode", $subject )); 11 22 33

log4net - sitecore logging (Sitecore.Diagnostics.Log.Error) and Log record GUID -

i have question sitecore logging: when unexpected error happen want return user unique ticket id, when user email error found logging database. i've added activity_id parameter sql appender : <param name="parameter"> <param name="parametername" value="@activity_id"/> <param name="dbtype" value="string"/> <param name="size" value="400"/> <param name="layout" type="log4net.layout.patternlayout"> <param name="conversionpattern" value="%p{activityid}"/> </param> </param> now, need add activityid . : private void application_start() { ... httpcontext.current.items.add("activityid", guid.newguid().tostring()) how can sitecore logging ? can use: sitecore.diagnostics.log.error("error happen", this); update: i've added following cod...

Shell script hangs when i switch to bash - Linux -

this question has answer here: pass commands input command (su, ssh, sh, etc) 3 answers i'm very new linux(coming windows) , trying write script can execute on multiple systems. tried use python fount hard too. here have far: cd /bin bash source compilervars.sh intel64 cd ~ exit #exit bash file= "~/a.out" if[! -f "$file"] icc code.c fi #run commands here... the script hangs in second line (bash). i'm not sure how fix or if i'm doing wrong. please advice. also, tips of how run script on multiple systems on same network? thanks lot. what believe you'd want do: #!/bin/bash source /bin/compilervars.sh intel64 file="$home/a.out" if [ ! -f "$file" ]; icc code.c fi you put in file , make executable chmod +x myscript . run ./myscript . alternatively, run bash myscript . your script makes...

python - Update value checking previous one - SQLObject -

in application deployed, using sqlobject , need update value only if previous value match value. the equivalent sql be: update jobs set status='150' id=1234 , status='100' i need because have many instances of daemon on different servers (not knowing each others) may want take jobs , update db mark job "taken". i want prevent "double updates" 2 nodes setting same value. it nice if can result number of affected rows. result of 0 permit "job taken between fetch , update"... the actual part of code doing update looks like: def __setattr__(self, name, value): """override setattr log build status changes""" [...] sqlobject.sqlobject.__setattr__(self, name, value) sqlobject has few api layers. there no way execute conditional update if use high-level api (sqlobject-inhertied classes). where -clause available in sqlbuilder's update .

How loop drop down value using Selenium JAVA -

Image
i have dropdown countries follows, i want send values us,ca,af,al,dz,as,ad array, loop , print using selenium , java. i tried following webelement elementdrop = d.findelement(by.xpath("path")); list<webelement> dropdownvalues = d.findelements(by.xpath("path")); for(webelement value:dropdownvalues) { string pcvalues=value.gettext(); system.out.println("value names" + pcvalues); } this print united states canada afghanistan albania etc. want ca af al dz ad webelement dropdown = driver.findelement(by.name("country")); list<webelement> options = dropdown.findelements(by.tagname("option")); iterator<webelement> it=options.iterator(); while(it.hasnext()) { system.out.println(it.next().getattribute("value")); } give try , let me know if works.

sed - Using grep to adjust timecode -

i'm trying change timecode found 1 format another, remove milliseconds off end of file , update it. remove milliseconds transcription timecode software , make pretty file client. input looks this: 00:50:34.00>interviewer why ............... script? 00:50:35.13>john doe because of quality. so i'm trying use grep match timecode , got working following expression. grep [0-9][0-9][:][0-9][0-9][:][0-9][0-9]\.[0-9][0-9] -p -o transcriptionfile.txt output looks this: 00:50:34.00 00:50:35.13 so i'm trying take timecode , update file updated values like: 00:50:34 00:50:35 how do that? should use pipe push on sed can update values in file? i've tried use sed following command: sed 's/[0-9][0-9][:][0-9][0-9][:][0-9][0-9]\.[0-9][0-9]/[0-9][0-9][:][0-9][0-9][:][0-9][0-9]/g' transcriptionfile.txt > outtranscriptionfile.txt i output puts in regexp in place timecode supposed be. ideas? how can trim last 3 digits off far right side of timeco...

driver - DirectShow virtual camera sample don't compile with linker errors -

i'm trying compile virtual camera sample in vs2015, have lot of linker errors: strmbasd.lib(wxlist.obj) : error lnk2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@yapaxi@z) filters.obj : error lnk2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@yapaxi@z) strmbasd.lib(wxdebug.obj) : error lnk2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@yapaxi@z) strmbasd.lib(dllentry.obj) : error lnk2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@yapaxi@z) strmbasd.lib(amfilter.obj) : error lnk2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@yapaxi@z) strmbasd.lib(amfilter.obj) : error lnk2001: unresolved external symbol "void __cdecl operator delete(void *,unsigned int)" (??3@yaxpaxi@z) strmbasd.lib(source.obj) : error lnk2001: unresolved external symbol "void...

javascript - Show "All", "Multiple" or "one" based on number of dropdown selections in Angularjs -

i have checkbox list of locations comes in pop-up allowing them select one,multiple or location. default label of dropwdown " select locations ". how handle following scenarios: display " all " in dropdown selection if user selects " select all " list. display " multiple " if user selects more one location. display " location name " if user selects only one location. here code using create dropdown , pop-up list.but displays "select location(s)" no matter user selects dropdown. <div class="dropdown cp-dropdown"> <div class="btn btn-default" data-toggle="dropdown"> <!-- {{homectrl.newactivityselectedlocation === '' ? 'select location' : homectrl.newactivityselectedlocation.name}}--> select location(s) <...

javascript - How to fail test if response from server is given? -

i working on socket.io irc , don't want users have long username. wrote following (mocha) test verify server doesn't send out response every connected socket when longer username provided: it("should not accept usernames longer 15 chars", function (done) { var username = "a".repeat(server.getmaxusernamelength() + 1); client1.emit("username change", username); client2.on("chat message", function (data) { throw error("fail, server did send response."); }); settimeout(function () { done(); }, 50); }); this work, it's far optimal. if ci platform slower or server respond after more 50 ms? what's best way fail test when response given, or should structure tests differently? thanks! p.s. question different testing asynchronous function mocha , because while problem have asynchronous testing, aware of done() method (and i'm using obviously). what you're trying ...

How can I parse a JSON file with PHP? -

i tried parse json file using php. stuck now. this content of json file: { "john": { "status":"wait" }, "jennifer": { "status":"active" }, "james": { "status":"active", "age":56, "count":10, "progress":0.0029857, "bad":0 } } and have tried far: <?php $string = file_get_contents("/home/michael/test.json"); $json_a = json_decode($string, true); echo $json_a['john'][status]; echo $json_a['jennifer'][status]; but because don't know names (like 'john' , 'jennifer' ) , available keys , values (like 'age' , 'count' ) beforehand, think need create foreach loop. i appreciate example this. to iterate on multidimensional array, can use recursivearrayiterator $jsoniterator = new recursiveiteratorite...

excel - vba splitting cells and finding underlines arrays -

Image
below code runs , pulls out words come before "how" no matter how many times appears in cell. need no pulling out words underlined , in italics. know using same method of array splitting can work i'm not sure how can implement find underlined , italicized words. in example below want "pullout" , "you" moved second sheet well. appreciated. sub te() dim c range, v string, arr, x long, e dim d range dim ws worksheet set d = worksheets("sheet2").range("b4") each c in activesheet.range("c1:c105") v = trim(c.value) if len(v) > 0 v = replace(v, vblf, " ") while instr(v, " ") > 0 v = replace(v, " ", " ") loop arr = split(v, " ") x = lbound(arr) ubound(arr) e = arr(x) ...

haxe add new key to object with variable -

i have defined object data use store various bit of data use code. want insert new room @ runtime. eg new key "r200" variable, have not been able far. static public var data = { room: { "r100": {monstersleft: 2 } } } // need add the object data : // reference like: var newroom = "r200"; ???? data[newroom ].monstersleft = 5; trace(data.r200.monstersleft) haxe's anonymous structures nothing more untyped, organised collections of data. structure immutable once set , property values can modified. array access (bracket notation) not defined on anonymous structures - instead, dot notation used. because of untyped (dynamic) nature of anonymous structures, can have negative impact on performance when compiling static targets. it recommended organise , type anonymous structures use of typedefs , typedef extensions . ensures type safety , helps compilation server pick on typing mistakes on-the-go. to on point, y...

javascript - JSON object to form a HTML table -

i need extract values below json response receiving web service response. {"ns4:searchsa_partyreturn": { "xmlns:ns1": "urn:cs-base", "xsi:type": "ns4:searchsa_partyreturn", "ns4:object": { "xmlns:ns2": "urn:co-base", "recordcount": 3, "xmlns:ns0": "urn:cs-rest", "ns3:item": [ { "ns3:sa_party": { "ns3:partyname": "akorn new jersey inc", "ns3:partystatus": "active", "ns2:rowidobject": 20011, "ns3:sac_address": { "ns3:item": { "ns3:city": "que", "ns3:state": "n", "ns2:rowidobject": ...

Android Twilio Video - get camera stream -

i developing app using twilio video api: https://www.twilio.com/video still in beta, works great part. , maybe there way solve issue. for app need switch camera , turn on light of camera. first 1 done twilio, second 1 not have camera object control camera light. there way camera object? or can create camera object myself , pass twilio? or there approach turn on light? my code camera preview. in examples use cameracapturer camera preview view: cameracapturer = cameracapturer.create(myactivity.this, cameracapturer.camerasource.camera_source_front_camera, capturererrorlistener()); startpreview(); and preview: private void startpreview() { if (cameracapturer != null) { cameracapturer.startpreview(previewframelayout); } } twilio developer evangelist here. right, , current version of sdk not allow control camera capturer if created camera object yourself. we aware of though, , working on new version able that. for time being suggest trying still c...

c++ - Is there an STL algorithm to find if an element is present in a container based on some tolerance? -

the problem trying solve following: have container of floating points (vector of double vectors): std::vector<std::vector<double>> dv { {0.0, 0.0}, {1.0, 0.0}, {0.0, 1.0}, {1.0, 1.0} }; then, assume have new point (double vector): std::vector<double> v1 {0.0001, 1.0}; i want check if point v1 present in dv container based on tollerance. distance between 2 vectors calculated euclidean distance. i have looked relevant questions , answers: how find if item present in std::vector? check if std::vector contains object? and trying use std::find_if() without success, accepts unary predicate . at moment came temporary solution. first, created generic function find euclidean distance between 2 vectors: template <typename inputit1, typename inputit2> double euclideandistance(inputit1 beg1, inputit1 end1, inputit2 beg2) { double val = 0.0; while (beg1 != end1) { double dist = (*beg1++) - (*beg2++); val += dist*dist; } return val ...

c# - Adding KeyInfo reference in SOAP request -

so i'm having similar issue post here. soap keyinfo values i wanting add reference within keyinfo can't seem find way through code. here expected output should be: <keyinfo> <wsse:securitytokenreference> <wsse:reference uri="#securitytest" valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3"/> </wsse:securitytokenreference> </keyinfo> and have above trying reference from: <wsse:binarysecuritytoken valuetype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#x509v3" encodingtype="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#base64binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:id="securitytest">base64certstuffblahblah </wsse:binarysecuritytoken> every at...

javascript - How can I switch out two divs within one div on a time interval using jQuery? -

i trying code in bandzoogle website, might causing errors this, , have tried many different ways work. have tried changing css, showing , hiding objects, way seems remotely work. issue when loaded, divs switch once or twice, when should on infinite loop. i'm out of ideas, please help. keep in mind not styles present, of styling done through themes of website. of code have done. .nextshow { color:#00000; -webkit-transition: 0.3s ease-in-out 0s; transition: 0.3s ease-in-out 0s; text-align: center; cursor: pointer; border:solid; height:150px; border-color:#747a85; box-shadow: none; padding:7px; } div.nextshow:hover { -moz-box-shadow: inset 0 0 20px #b3b3b3; -webkit-box-shadow: inset 0 0 20px #b3b3b3; box-shadow: inset 0 0 20px #b3b3b3; } .new_album { color:#00000; text-align: center; cursor: pointer; padding:1px; display:none; } .nextshow_title { color:#00000; text-align:center; padding: none; } .nextshowtext2 { font-size: ...

c# - Serving files with authorization in an Owin self hosted application -

i have self hosted application using owin , no asp.mvc of type, there no web.config in application. i have enabled cookie authentication , own authorization provider mechanism works fine. application serves static contents using the next code: appbuilder.usefileserver(new fileserveroptions() { requestpath = new pathstring("/images"), filesystem = new physicalfilesystem(@"./images"), }); but content not protected owin authentication, easiest way protect files? *ideally not having implement whole file serving myself. so far i've managed in way: var contentfileserver = new fileserveroptions() { requestpath = new pathstring("/content"), filesystem = new physicalfilesystem(@"./content"), }; contentfileserver.staticfileoptions.onprepareresponse = (context) => { if (context.owincontext.authentication.user == null) { ...

reactjs - Low performance in React Native with Redux -

i have discovered issues performance in react native app. seems caused react-redux bundle. as can see in video redux/flux/setstate comparing there significant delay between action dispatching , view rendering. on real devices looks worse. there no api calls in example. simple actions dispatching , state changes. on other hand facebook flux implementation , simple call of setstate work more faster. any ideas how improve app performance? i using react: v15.2.1, react-native: v0.29.2, react-redux: v4.4.5, view import { bindactioncreators } 'redux'; import { connect } 'react-redux'; import {map} 'immutable'; import * testactions '../reducers/test/testactions'; import {actions} 'react-native-router-flux'; const actions = [ testactions ]; function mapstatetoprops(state) { return { ...state }; } function mapdispatchtoprops(dispatch) { const creators = map() .merge(...actions) .filter(value => ...

python - Merge two data frames while using boolean indices (to filter) -

i have may simple question related syntax, can't figure out. i have 2 data frames, df1 , df2, i'd a) merge on specific columns, while b) simultaneously checking column in each data frame boolean relationship (>, <, or ==). the crucial part need both , b simultaneously because data frames large. not work merge 2 data frames in 1 step, remove rows don't pass boolean logic in second step. because merged data frame very, large , cause me 2 run out of memory. so, have: df1: col_1 col_2 test_value 0 b 1 1 b 3 2 b 2 3 b 5 4 b 2 5 b 1 and df2: col_1 col_2 test_value 0 b 1 1 b 3 2 b 2 3 b 5 4 b 2 5 b 1 (for simplicity, 2 data frames identical) and i'd merge them, so: df3 = pd.merge(df1, df2, left_on=['col_1'], right_on=['col_2']) while simultaneously...

c# file or folder notification event -

i developing application invoke file created third party application, everytime file placed in default location defined third party application, want change default file location on fly, mean need event trigger before file has been created. short answer : no, can't know without third-party provider help. you seems looking indication file will be created. must check on third party application provider if offer hook event you're looking for, lots of business rules in place. as workaround, can set filesystemwatcher object monitor default location and, if required, move created file more convenient location.

java - Spring not able to create bean -

i beginner spring , concepts. trying use @configuration , package-scan annotations scan bean provider classes under single package. when @bean annotated method of 1 of class having same name @bean annotated method of different class, bean creation both classes doesnt happen. if change @bean annotated method name different name bean not created, both beans created. not able understand behaviour. @configuration public class managementhelperprovider { @bean public managementhelper getinstance() { return new managementhelper(); } } if creating class below top bean managementhelper not created. @configuration public class managementvalidatorprovider { @bean public managementvalidator getinstance() { return new managementvalidator(); } } if creating class below top bean managementhelper created. @configuration public class managementvalidatorprovider { @bean p...

java - Rest client Templat finding list customer -

in spring 4.2.1-release use resttemplate access rest create this @bean @scope("prototype") @autowired public resttemplate resttemplate( @qualifier("httpcomponentsclienthttprequestfactory") httpcomponentsclienthttprequestfactory httpcomponentsclienthttprequestfactory, @qualifier("mappingjackson2httpmessageconverter") mappingjackson2httpmessageconverter mappingjackson2httpmessageconverter) { final resttemplate resttemplate = new resttemplate(httpcomponentsclienthttprequestfactory); list<httpmessageconverter<?>> messageconverters = new arraylist<httpmessageconverter<?>>(); messageconverters.add(new formhttpmessageconverter()); messageconverters.add(new stringhttpmessageconverter()); messageconverters.add(mappingjackson2httpmessageconverter); resttemplate.setmessageconverters(messageconverters); return resttemplate; } when use after injec in junit test httpheaders requestentity = new h...

Pointer to one row in dynamically allocated 2D array in C++ -

i have dynamically allocated 2d array volatility[r][c] r rows , c columns in c++. somehow possible create pointer ptrcolumn column c1, such can access element (r1,c1) ptrcolumn[r1]? far, tried create dynamic pointers. didn't manage it. thank you! no, that's not possible. 1 alternative have create 2d array traspose of original array useless because you'd have update array every time original array changes. perhaps there other ways array of columns don't.

ios - Choosing a random point within a circular image in a UIImageView -

i have app color wheel , i'm trying pick random color within color wheel. however, i'm having problems verifying random point falls within color wheel. here's code is: cgpoint randompoint = cgpointmake(arc4random() % (int)colorwheel.bounds.size.width, arc4random() % (int)colorwheel.bounds.size.height); uicolor *randomcolor = [self colorofpoint:randompoint]; cgpoint pointinview = [colorwheel convertpoint:randompoint fromview:colorwheel.window]; if (cgrectcontainspoint(colorwheel.bounds, pointinview)) { nslog(@"%@", randomcolor); } else { nslog(@"out of bounds"); } a couple of other methods of verifying point i've tried no luck: if (cgrectcontainspoint(colorwheel.frame, randompoint)) { nslog(@"%@", randomcolor); } if ([colorwheel pointinside:[self.view convertpoint:randompoint toview: colorwheel] withevent: nil]) { nslog(@"%@", randomcolor); } sometimes it'll output "out of bounds", , it...