Posts

Showing posts from February, 2014

windows - how to build mongodb-cxx-driver in win -

i followed instruction on https://mongodb.github.io/mongo-cxx-driver/mongocxx-v3/installation/ , blocked @ step4 , says: cmake error @ cmakelists.txt:135 (generate_export_header): unknown cmake command "generate_export_header". i found command exists long time. tried cmake3.7rc1 , rc3, error time. how can build bsoncxx ? just go cmakelists.txt line 134 , add new line following code include(generateexportheader) maybe included dependency in older versions

python - Caching CSV-read data with pandas for multiple runs -

i'm trying apply machine learning (python scikit-learn) large data stored in csv file 2.2 gigabytes. as partially empirical process need run script numerous times results in pandas.read_csv() function being called on , on again , takes lot of time. obviously, time consuming guess there must way make process of reading data faster - storing in different format or caching in way. code example in solution great! i store parsed dfs in 1 of following formats: hdf5 (fast, supports conditional reading / querying , supports various compression methods, supported by different tools/languages ) feather ( extremely fast - makes sense use on ssd drives) pickle (fast) all of them fast ps it's important know kind of data (what dtypes) going store, because might affect speed dramatically

Call the Generic parameterized method in java -

what error mesaage meant , how call generic parameterized method class: following error message: the method add(int, integer) in type binaryminheap<integer> not applicable arguments (int, vertex<integer>) calling snippet: for(vertex<integer> vertex : graph.getallvertex()){ minheap.add(integer.max_value, vertex); } method being called is: public void add(int weight,t key) { node node = new node(); node.weight = weight; node.key = key; allnodes.add(node); int size = allnodes.size(); int current = size - 1; int parentindex = (current - 1) / 2; nodeposition.put(node.key, current); while (parentindex >= 0) { node parentnode = allnodes.get(parentindex); node currentnode = allnodes.get(current); if (parentnode.weight > currentnode.weight) { swap(paren

optimization - MySQL - INSERT queries taking long time -

i have table 10.000 rows. structure of table is: create table if not exists `demands` ( `cycle_id` int(11) not null, `subject_id` varchar(45) collate utf8_unicode_ci not null, `market_id` int(11) not null, `price` int(11) not null, `currency_id` varchar(45) collate utf8_unicode_ci default null, `amount` bigint(20) default null ) engine=innodb default charset=utf8 collate=utf8_unicode_ci; keys: primary (cycle_id, subject_id, market_id, price) fk1 (market_id) fk2 (subject_id) fk3 (currency_id) query offen takes long time (about 1s): insert poptavky values (4, 'user', 17, 110, 'pound', 110) , (4, 'user', 17, 90, 'pound', 120) , (4, 'user', 17, 70, 'pound', 130) ; where problem? thanks it sounds not on high end server , problems compounded having far many indexes. this index on it's own rather massive one: primary (cycle_id, subject_id, market_id, price) it spans 4 columns , 2 of t

angular - How to change the material2 md input placeholder font size and colour? -

how change material2 md input placeholder font size , colour? check image link note: /deep/ deprecated, use :host ::ng-deep in place. bear in mind ::ng-deep technically deprecated , replaced combinator, should used time being the issue running viewencapsulation. it's annoyance, i've been able gather working intended. you have ability though few characters change style liking. have use special selector: /deep/ for instance if wanted change colour of placeholder text described in question create style this: /deep/ .mat-input-placeholder { color: #fff; font-size: 2em; } this won't change underline style. if wanted change add style like: /deep/ .mat-input-ripple.mat-focused { background-color: #fff; } if still want style material component within specific component can use :host selector : :host /deep/ .mat-input-placeholder { font-size: 2em; }

android - onActivityResult in RecyclerView.Adapter<MyAdapter.MyViewHolder> -

i tried open gallery adapter. emp_photo_edit.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent = new intent(intent.action_pick,android.provider.mediastore.images.media.external_content_uri); ((employeeactivity)context).startactivityforresult(i, 2017); } }); then want show choosen image imageview in recycycleview , how that? because cant add onactivityresult on adapter . in advance edit my full code public static class myviewholder extends recyclerview.viewholder { .... public myviewholder(view v) { super(v); .... } public void bind(final employee item, final onitemclicklistener listener, final context context) { .... generatedialog(item,dialog_employee); .... } ... ... void generatedialog(employee item, view v){ //dialog child //photo emp_photo_edit.

java - Osgi Property Placeholder -

i can use string binding here, enablerequestvalidation should string, put in bean want use boolean, how can achieve using property-placeholder bindings? <property-placeholder persistent-id="jsonvalidator" update-strategy="reload" placeholder-prefix="$[" placeholder-suffix="]"> <default-properties> <property name="enablerequestvalidation" value="false"></property> </default-properties> </property-placeholder> <bean id="jsonschemaregistration" class="rest.service.impl.jsonschema.jsonschemadynamicfeatureimpl"> <property name="enablerequestvalidation" value="$[enabledrequestvalidation]"></property> </bean> addition exception below 2016-11-08 11:25:34,944 | error | thread-74 | blueprintcontainerimpl | 15 - org.apache.aries.blueprint.core - 1.4.4 | unable start blueprint cont

Delete duplicate elements from Array in Javascript -

this question has answer here: how distinct values array of objects in javascript? 23 answers unique values in array 50 answers i have array obejcts email , id want delete duplicate elements have similar id's. example: var newarray=[ { email:"test1@gmail.com", id:"a" }, { email:"test2@gmail.com", id:"b" }, { email:"test3@gmail.com", id:"a" }, { email:"test4@gmail.com", id:"c" }, { email:"test4@gmail.com", id:"c" } ]; now need delete duplicate elements have id's common.in sence expecting final array is var finalarray=[ { email:"te

c++ - How to fix error :url_decode, base64_encode are not a member of ‘pion::http::types’? -

i building application pion 5.0.6. libraries. file contains pion-net 2.2.12 functions url_decode , url_encode, base64_encode.these functions not defined in new version pion 5.0.6. can replace in place of these function calls. error getting: error: ‘url_decode’ not member of ‘pion::http::types’ return pion::http::types::url_decode(crs);

python - How does the key argument to sorted work? -

code 1: >>> sorted("this test string andrew".split(), key=str.lower) ['a', 'andrew', 'from', 'is', 'string', 'test', 'this'] code 2: >>> student_tuples = [ ... ('john', 'a', 15), ... ('jane', 'b', 12), ... ('dave', 'b', 10), ... ] >>> operator import itemgetter, attrgetter >>> >>> sorted(student_tuples, key=itemgetter(2)) [('dave', 'b', 10), ('jane', 'b', 12), ('john', 'a', 15)] why in code 1, () omitted in key=str.lower , , reports error if parentheses included, in code 2 in key=itemgetter(2) , parentheses kept? the key argument sorted expects function, sorted applies each item of thing sorted. results of key(item) compared each other, instead of each original item , during sorting process. you can imagine working bit this: def sorte

reactjs - iceconnectionstate failed in webrtc -

i using webrtc module in react native app. while running application not getting remote video though it's showing 1 peer connected in console showing following: oniceconnectionstatechange:"failed"

shell - How to sort alphanumeric column in unix with alphabet first and then numeric -

suppose have text file: 08174 c6517298 08184 p0785411 08184 k0255564 01234 56789012 09098 a9877756 i sort second column alphabet first , numeric the expected outcome should be: 09098 a9877756 08174 c6517298 08184 k0255564 08184 p0785411 01234 56789012 i tried sort -gk2,2 , sort -k2,2 , both not give me correct result. please help. replace -gk2,2 -k2g (you meant -k option, right?) , add -k2 sort -k2g -k2 file the key definition syntax f[.c][opts][,f[.c][opts]] , f field number ( 2 , in particular); opts 1 or more single-letter ordering options [bdfgimhnrrv] . note, don't need ,2 , means stop sorting @ second column, , second column last. the key option priorities applied in order passed them in command, i.e. -k2g applied first, -k2 .

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

java - How to split a 2D array in different sized pieces for a crossword? -

i experimenting generator crossword puzzle getting stuck when time split different pieces. have 2d array store crossword this: int size = 10; //this can higher bigger crosswords character[][] crossword = new character[size][size]; i add few words crossword , example end following array (. = empty square): .......... .......... ..c...h... ..a...o... ..tiger... ......s... ...dove... .......... .......... .......... how split 2d array end pieces contains @ least 2 letters not whole word. letters must next each other horizontally or vertically not diagonally. example end following pieces: c tig h er dov o s e the following piece not valid because letters not horizontally or vertically next eachother. o ge s my first atempt split doing following: int chunksize = 2; //this should vary depending on how big pieces should list<character[][]> subarrays = new arraylist<>(); for(int = 0; < size; += chunksize){

Android nested scrollview anchored to AppBArLayout -

Image
so, have situation, need create this: where white background view nested view, , image elements in appbar. now, managed create without nestedscrollview being on appbarlayout , how can achieve that, how can put nestedscrollview above appbarlayout without loosing functionality? in oreder make work, need following: <android.support.v4.widget.nestedscrollview android:layout_width="match_parent" android:layout_height="match_parent" app:behavior_overlaptop="64dp" app:layout_behavior="@string/appbar_scrolling_view_behavior"> where overlaptop how overlap , layout_behavior thing need here. hope helps.

angularjs - Text inside angular-material switch thumb -

Image
iam unable place text inside angular-switch using angular-material iam using following tag , want insert text inside switch thumb. <md-switch class="md-primary" md-no-ink aria-label="switch no ink" ng-model="data.cb5"><p>hi</p> </md-switch> in below image, i need output this. appreciated. try might solve issue <md-switch class="inline-label" md-no-ink aria-label="switch no ink" ng-model="data.cb5"><p>hi</p> </md-switch> css md-switch.inline-label .md-bar::before { position: absolute; font-size: 9px; line-height: 13px; content: "off"; right: 0; padding-right: 3px; } md-switch.inline-label.md-checked .md-bar::before { content: "on"; left: 0; padding-left: 3px; }

logstash - URIPATHPARAM in case of word input fails in grok filter -

i writing grok filter following input: npl9alw06.ieil.net||master1.c1.99.jsb9.net||556353702712154941||/main/builder.git/git-upload-pack||/load/imagegallery/ajaxloadphotonslider|| select * property.picture prop_id = 'u27754475' , sno='2'||0.00036811828613281||2016-11-03 09:00:04||y what wrote is: %{data:webserver}\|\|%{data:dbserver}\|\|%{number:sessionid default null_ses}\|\|%{uripathparam:referrerurl default null_ref}\|\|%{uripathparam:currenturl default null_cur}\|\|%{data:sqlquery}\|\|%{number:sqltimetaken}\|\|%{timestamp_iso8601:logcapturetime}\|\|%{word:executed or not default y or n} it working fine. in cases, referrerurl equal null_ref . in case, failing. how can add conditional check here?

javascript - How to properly use the same AngularJS 1.5 component multiple times in a view? -

i'm creating set of widgets angularjs 1.5's new components. problem is, when using same widget multiple times, somehow share controller or scope. thought 1 of things components scope isolated? my main html template hold widgets: <widget-list title="books" class="col-xs-12 col-md-4"> </widget-list> <widget-list title="movies" class="col-xs-12 col-md-4"> </widget-list> <widget-list title="albums" class="col-xs-12 col-md-4"> </widget-list> my widget template: <div class="widget widget-list"> <div class="panel b-a"> <div class="panel-heading b-b b-light"> <h5>{{$widget.title}}</h5> <div class="pull-right"> <button type="button" class="btn btn-default btn-sm" ng-click="$widget.dosomething()"

python - Scrapy: Error 1241 and 1064 while sending datas to MySQL -

i want send datas i've scrapped mysql database. here pipelines.py : class myimagespipeline(imagespipeline): def get_media_requests(self, item, info): image_url in item['image_urls']: yield scrapy.request(image_url) def item_completed(self, results, item, info): image_paths = [x['path'] ok, x in results if ok] item['image_paths'] = image_paths return item class mysqlpipeline(object): def __init__(self): self.conn = mysqldb.connect(user='testuser', passwd='megablock:333', db='crawl', host='localhost', charset="utf8", use_unicode=true) self.cursor = self.conn.cursor() def process_item(self, item, spider): guid = self._get_guid(item) = datetime.utcnow().replace(microsecond=0).isoformat(' ') try: self.cursor.execute("""insert produits (guid, now, product, link, price, d

java - How to get User by id and disconnect User -

this code. user = null how user id , disconnect user? zone zone = (zone)event.getparameter(sfseventparam.zone); user user = zone.getuserbyid(1); this.getapi().disconnectuser(user,clientdisconnectionreason.idle); you getting user id = 1 , id may not valid , id sfs gives every user may vary , it's not array starts 0 , may change every time 1 connect or disconnect , when player connect sfs , takes id , when disconnect , 1 else may take , can user id : collection<user> users = getparentextension().getparentzone().getuserlist(); while (users.iterator().hasnext()) { int id = users.iterator().next().getid(); } and use disconnect function disconnect him or user user collection disconnect him.

html - Black Screen in fire fox with RTSP source stream -

Image
i trying display rtsp stream camera ,url of stream thing this rtsp://dl:dd@12.0.0.23:88/videomain by referencing post http://stackoverflow.com/questions/2245040/how-can-i-display-an-rtsp-video-stream-in-a-web-page i trying display video shown below <!doctype html public "-//w3c//dtd html 4.01 frameset//en" "http://www.w3.org/tr/html4/frameset.dtd"> <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0"> <div id="cctv-container"> <object classid="clsid:9be31822-fdad-461b-ad51-be1d1c159921" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" id="vlc" events="true" width="640" height="480"> <param name="src" value="rtsp://riteshranjan:ranjan007@12.0.0.33:88/videomain"/> <param name="showdisplay" value=&quo

c# - Return view with ViewModel after ajax call -

i call action ajax function, viewmodel in , try open new view other viewmodel redirecttoaction , return view aren't working. other answers saw got opening other view without sending viewmodel it ajax call $("#delete").click(function () { var model = $("#forma").serialize(); console.log("delete", model); $.ajax({ url: '@url.action("deletedevices", "package")', contenttype: 'application/json; charset=utf-8', datatype: "json", data: model, success: function (result) { } }); return false; }); and contorller nothing public actionresult deletedevices(packagedevicesviewmodel viewmodel) { //model processing here return view(newmodel); } change data: model, to

java - Capedwarf: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[3,1] -

i'm trying run application in debug mode described in debuggin application in wildfly eclipse and jboss tools - debugging externally launched wildfly but, when execute ./standalone.sh --debug --server-config=standalone.xml command, error: user@user:~/wildfly-8.1.0.cr1/bin$ ./standalone.sh --debug --server-config=standalone-capedwaf-modules.xml ========================================================================= jboss bootstrap environment jboss_home: /home/giacomo/wildfly-8.1.0.cr1 java: java java_opts: -server -xms64m -xmx512m -xx:maxpermsize=256m -djava.net.preferipv4stack=true -djboss.modules.system.pkgs=org.jboss.byteman -djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n ========================================================================= listening transport dt_socket @ address: 8787 11:11:47,210 info [org.jboss.modules] (main) jboss modules version 1.3.3.final 11:11:47,415 info [o

c# - Write double value to cell independent of culture -

Image
i set value of cell in spreadsheet using excel com interop: public void setvalue(double value, string sheetname, int cellrow, int cellcolumn) { var cell = getcell(sheetname, cellrow, cellcolumn); cell.value2 = value; } getcell() method returning range object. depending on system culture settings, method doesn't work properly: these values: are written follows, if culture of excel german: my questions: why doesn't excel handle formatting properly? isn't value2 "typesafe"? how can set double value correctly independent of system culture?

java - Initializing Context class in an Android application (for OSMdroid) -

how initialize "context context" correctly in case. android studio tells me should initialized, dont know how. if set null, app crashes @ start. this @ top of class: mylocationnewoverlay mlocationoverlay; this on over create method: context context = null; this.mlocationoverlay = new mylocationnewoverlay(new gpsmylocationprovider(context),map); this.mlocationoverlay.enablemylocation(); map.getoverlays().add(this.mlocationoverlay); }

c# - VS2005 website scriptmanager and updatepanel throw exception while run in VS2015 -

Image
i have website built in visual studio 2005 in vb.net. when run website on visual studio 2015 throws run time exception given below. website works fine in vs2005. i don't know do... there many possibilities mentioned in answers here: sys undefined also note error on line 127 (the closing script tag incomplete).

java - Two-way SSL communication with Tomcat -

a provider our system works has given certificate named mm_base64.cer . our keystore mitkeystore . using our keystore this: <connector port="8443" protocol="org.apache.coyote.http11.http11nioprotocol" maxthreads="150" sslenabled="true" scheme="https" secure="true" clientauth="false" sslprotocol="tls" keystorefile="path\mitkeystore" keystorepass="ourpass" /> we imported key our jdk , jvm this: keytool -import -file "path\mm_base64.cer" -keystore "c:\program files\java\jre7\lib\security\cacerts" still, handshake problem occurs. i looking @ this question . looks complicated. our issue complicated theirs? there easy way our system work provider's system? i might wrong on one, think have import provider's certificate trust store. see here description of keystore vs trustore . have point tomcat trust store

linux - Screen message "Must be connected to a terminal" when using option -D -R SessionName -

hi have script in bash check mp4 file , if find more 1 start playing them 1 one. script working command line when log in ssh. but when reboot rpi, not start autostart in rc.local saying "must connected terminal" this part of script if [ "$count_dir_video" -gt "1" ] ;then 53 54 # make background black hide wallpaper between videos 55 display=:0 screen -dms "black_background" feh -fxyqz /opt/scripts/black_background.jpg 56 echo "przed sleep" 57 #screen -dms "$1" sleep 5 58 echo "po sleep" 59 60 while : 61 62 entry in $root_dir_video 63 64 65 # multiple files 66 echo "przed omx" 67 screen -d

r - ggplot: how to choose the "proper" colors relating on a column -

Image
suppose have simple dataframe plot, in have color points related measure contained in column. so, if have: dataframe # x1 x2 pop # 1 -0.11092652 -1.955598e-09 448053 # 2 -0.09999865 -2.310067e-10 418231 # 3 -0.05944755 -3.475013e-09 448473 # 4 0.51378848 1.631781e-09 119548 # 5 0.09438223 -9.606475e-10 323288 # 6 0.19349045 6.074025e-10 203153 # 7 0.06685609 3.210156e-10 208339 # 8 -0.10915456 -1.407190e-09 429178 # 9 -0.10348100 -1.401948e-09 1218038 # 10 -0.08607617 -7.356602e-10 383018 # 11 1.00343465 -2.423237e-08 209550 # 12 -0.05839148 1.503955e-09 287042 # 13 -0.09960163 2.167945e-10 973129 # 14 -0.05793417 2.510107e-09 187249 # 15 0.02191610 2.479708e-09 915225 # 16 0.48877872 1.338346e-08 462999 # 17 -0.10289556 1.472368e-09 1108776 # 18 -0.10316414 2.933469e-10 402422 # 19 -0.09545279 -2.926035e-10 274035 # 20 -0.06111044 3.464014e-09 230749 and use ggplot in following way: ggplot(dataframe) + ggtitle(&qu

java - Using child method of an Object + ListView + Adapter + Android -

in customized adapter, made heterogeneos arraylist 2 types: playlist , musica. when show them in listview, want show differently. if playlist want show string name of playlist , hifen before name. if musica want show string name. know if item of list playlist or musica, made list save position of playlist items. see code: private static final int type_playlist = 1; private static final int type_musica = 2; private list<int> posicoesplaylists = new arraylist<>(); private final list<object> items = new arraylist<>(); @override public int getitemviewtype(int position) { return posicoesplaylists.contains(position) ? type_playlist : type_musica; } public void setitems(list<playlist> novalista) { items.clear(); list<musica> musicas; (playlist playlist: novalista) { items.add(playlist); posicoesplaylists.add(items.size() - 1); musicas = playlist.getmusicas(); (musica musica: musicas) { it

php 7 - Add PHP to apache on mac os? -

i tried upgrade php 5.6 php 7, caused there error trying of method: https://coolestguidesontheplanet.com/upgrade-php-on-osx/ uninstalled , tried install php 7 on brew , works still not added apache, in browser see still pure php code. i tried add line httpd.conf no changes: loadmodule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so the path correct, knows how can solve this? you may need add following declaration httpd.conf apache parse php files via php7_module: addtype application/x-httpd-php .php restarting of apache may required new settings take effect.

php - htaccess folder rewrite and show index from folder -

i want rewrite url: http://domain.com/administration domain.com/admin but index.html of subdirectory not available when use http://domain.com/admin/ how can fix that? this htaccess: rewriteengine on rewriterule ^([^\.]+)$ $1.php [nc,l] rewriterule ^admin/(.*) administration/$1.php try these. need external admin work expect. # fix missing trailing / on admin rewriterule ^admin$ /admin/ [ns,l,r=301] # change admin dir rewriterule ^admin/(.*) administration/$1 [ns,dpi] # load that's not directory php rewriterule ^(?>[^.]+)(?<!/)$ $0.php [ns,l]

What does the jargon "Model" mean in "MVC"? -

i know so-called "model" used database interaction , acts data holder going used in view. but don't understand why model called "model", instead of calling "thing" or "object" or whatever term makes easier understand... according dictionary, model be: a three-dimensional representation of person or thing or of proposed structure, typically on smaller scale original a thing used example follow or imitate a simplified description, mathematical one, of system or process, assist calculations , predictions. a person employed display clothes wearing them. a particular design or version of product. none of these definitions fit in context of "mvc". what origin of word "model" in "mvc", , why it's called "model"? i think i'm still misunderstanding model i'm using because don't know why "model" called "model". me...

javascript - edgee:slingshot error [Invalid directive] -

so have been trying add edgee:slingshot meteor + react project reason keep getting same error: "error: directive myfileuploads not seem exist [invalid directive]" i have followed tutorial implement information can't seem figure out what's wrong code. any highly appreciated. my upload-rules file: slingshot.filerestrictions("myfileuploads", { allowedfiletypes: ["image/png", "image/jpeg", "image/gif"], maxsize: 10 * 1024 * 1024 // 10 mb (use null unlimited) }); slingshot.createdirective("myfileuploads", slingshot.s3storage, { bucket: "ec2016", region: "eu-central-1", acl: "public-read", authorize: function () { //deny uploads if user not logged in. if (!this.userid) { var message = "please login before posting files"; throw new meteor.error("login required", me

geolocation - Getting User's Location Without Permission -

this website finds location reasonable presicion. if use mobilephone website finds exact location. if possible without asking permission why of them asks me before getting location? isn't makes personal security vulnerabilities? from same page gave us: webkay uses google geolocation api locate you . educated guess , never accurate gps location. accuracy depends on location , on connection type . if on mobile network expect error of 50km . example tries demonstrate how accurate website can guess location without asking permission access gps. a site needs permission, if wants enable device's gps. also, without permission, guessed location heavily dependent on mobile carrier signal , ip address. if in location lot of mobile towers, location (obviously) more precise. a site can use information near mobile towers around triangulate position , guess are. think of mesh. for example: using computer write , location easy ~100km off, because has ip

report - Jmeter: Random number of labels everyday -

Image
i executing same test plan 2 consecutive days: first day no of label (column a) more 1400 second day no of label 968 only first day: second day: i see first day has samples 12, throughput 0 , kb/sec 0.1 second has better performance. please me understand: what difference between label/samples/requests? do number of labels depends on throughput , kb/sec i.e. column k , l? label name of thread group in case. request name hitting jmeter. samples number of times particular request executed. e.g. if have request called login , number of samples login 5 means login request executed 5 times during test. number of samples vary based on test settings number of users, iterations or duration of test specified. the number of labels = number of samples , throughput related each other. throughput = number of requests per second or minute , kb/second = (throughput* average bytes) / 1024 so 2 correlated. hope helps.

PHP How To Find the Keys of A Value In Multidimensional Array -

i have been working on problem, have had no result current functions of php. i have multidimensional array, like: array ( [3] => array ( [16] => 0 [17] => 1 [18] => 2 ) [4] => array ( [22] => 3 [23] => 4 ) [5] => array ( [1] => 5 ) ) if first keys of array static, have been easy fix, keys dynamical data. (3, 4, 5 etc...). have function finds keys of value. myfunction($myarray, 3) // 3 = value. if there value "3", want function give me keys of it. (4, 22). array on top. thanks in advance. suppose want array of keys index of array contains searched value (3), , index of 3 value in array, should works: $matched = []; foreach($object $extindex => $array){ foreach($array $intindex => $value){ if($value == 3){ $matched[] = [$extindex, $intindex]; } } } v

Does XML::LibXML::Node replaceNode() replace Perl instances of the replaced node -

... after replace a b , previous references a point b ? #!/usr/bin/perl use warnings; use strict; use xml::libxml; $dom = 'xml::libxml'->load_xml(string => '<r><p><c/></p></r>'); ($n1) = $dom->findnodes('/r/p/c'); ($n2) = $dom->findnodes('/r/p/c'); $n1->replacenode('xml::libxml::element'->new('n')); print $dom; print $n1, $n2; output: <?xml version="1.0"?> <r><p><n/></p></r> <c/><c/>

How can I apply a status (condition) check direct to a model in laravel? -

i have added status column product table. want when use product::all() product status active. soft delete. want model ignores products passive until activated again. there way this? ps: used model (product::class) in tons of places. looking direct way affects methods made already. otherwise have apply solution methods 1 one. if you're looking same functionality soft deletes, can use global scopes . softdeletes trait uses global scope . so, if you'll apply global scope product model product::all() return results status = 1 .

java - Determine the row and column with the largest sum -

i have finished of code. problem last part have determine row , column largest sum. managed , print largest sum of row , column, however, wanted print number of row , column largest sum is. instead of printing value of largest sum, want print row , column of largest sum. i hope of understand. here code public static void main(string[] args) { // todo auto-generated method stub int[][] arr = new int[10][10]; int [] sumrow = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int [] sumcol = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int sumall = 0; int largestrow=0; int largestcol=0; for(int i=0; i<arr.length; i++) { for(int r=0;r<arr.length; r++){ for(int c=0; c<arr.length; c++){ arr[i][i] = (int)(math.random()*10 + 1); } system.out.print(arr[i][i]+" "); sumrow[i]= sumrow[i]+ arr[i][i]; sumall = sumall+

angular - Handle errors in a Resolve service -

say have valuescomponent displays array of value in html table. // in value.ts export class value { ... } // in values.component.ts @component(...) export class valuescomponent { ... } being programmer , all, i've created different class responsible providing values. let's call valuesservice . // in values.service.ts @injectable() export class valuesservice { public getvalues(): observable<value[]> { ... } } suppose service gets values web service: /api/values now instead of injecting service directly component, want let angular router pre-fetch values before navigating component. for that, created resolve service class , plugged router module. // in values-resolver.service.ts export class valuesresolverservice implements resolve<value[]> { constructor(private backend: valuesservice) { } public resolve(route: activatedroutesnapshot, state: routerstatesnapshot): observable<value[]> { return this.bac

java - Get HTTP status code in asynchronous way -

i http status code before end of dopost method in java. example in python there self.send_response(200) , sends status in asynchronous way? /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse * response) * */ @suppresswarnings("unchecked") @override protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { //final result object //i want send http status code 200 before task running mythreadpool = executors.newfixedthreadpool(2); future taskone = mythreadpool.submit(new runnable() { @override public void run() { try { try { // first task } catch (servletexception e) { // todo auto-generated catch block e.printstacktrace(); } } catch (ioexception e) { // todo auto-generated catch block

javascript - Automatically resize d3.js chart y scale based on brush selection -

i'm using d3.js v4. is there more convenient way find minimum , maximum values of brush selection. meant resize y axis when select period in brush area below. here method (everything inside function called when brush used) : i find extent limits of selection extent = d3.event.selection.map(chartcomponent.x2().invert)) then have redo array containing selected points: go on each point , compare extent[0] or extent[1] see if in limits. store beginning , end point indices , use data.slice(begin, end) on original data new array. then apply d3.min , d3.max on new array find min , max level. then set y axis use theses limits. chart.y().domain([chartcomponent.ymin, chartcomponent.ymax]); chart.yaxisgraph.call(chartcomponent.yaxis(true)); do have better idea ?

authorization - Find out user rights on repositories in Sonatype Nexus -

i'm using nexus repository manager oss 2.13. i want know on repositories user has rights. unfortunately can't find such view in gui. is there way find out grants have on repository? this hard figure out, given intersection of many different features such repo routing, repo targets, etc... i suggest opening issue on @ our jira in regards: https://issues.sonatype.org/browse/nexus

android - How to access Storage from SD card connected via OTG -

i try read , change textfile on external storage sd card. make example more easy inserted content uri file chooser. i run app on nexus 5x android 7 (sdk 24). minsdkversion set 19 , targetsdkversion 23. package de.cowabuja.androiduriaccess; import android.content.intent; import android.net.uri; import android.support.v7.app.appcompatactivity; import android.os.bundle; public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); string uristring = "content://com.android.externalstorage.documents/document/primary%3adcim%2fany%2dir%2fthefile.txt"; uri uri = uri.parse(uristring); getapplicationcontext().granturipermission(getpackagename(), uri, intent.flag_grant_read_uri_permission); } } here log: ... e/androidruntime: fatal exception: main process: de.cowabuja.andr

numpy - Initialize Parameters Gaussian Mixture in Python with sklearn -

i'm trying hard gaussian mixture sklearn think i'm missing because definitively doesn't work. my original datas this: genotype logratio strength ab 0.392805 10.625016 aa 1.922468 10.765716 ab 0.22074 10.405445 bb -0.059783 10.625016 i want gaussian mixture 3 components = 3 genotypes (aa|ab|bb). know weight of each genotype, mean of log ratio each genotype , mean of strength each genotype. wgts = [0.8,0.19,0.01] # weight of aa,ab,bb means = [[-0.5,9],[0.5,9],[1.5,9]] # mean(logratio), mean(strenght) aa,ab,bb i keep columns logratio , strength , create numpy array. datas = [[ 0.392805 10.625016] [ 1.922468 10.765716] [ 0.22074 10.405445] [ -0.059783 9.798655]] then tested function gaussianmixture mixture sklearn v0.18 , tried function gaussianmixturemodel sklearn v0.17 (i still don't see difference , don't know 1 use). gmm = mixture.gmm(n_components=3) or gmm = mixture.gaussianmixt

date - Make python work with month 13 -

i using following code format date in python 2.7: month = 13 # right, i'm working 13 month. year = 2012 return datetime.strptime('{}/{}'.format(m, y), '%m/%y').strftime('%m/%y') now changed python 2.5, , code needs changes because .format doesn't exist in particular version. so, i'm trying this: return (datetime.strptime(('%d/%d' % (month, year)), '%m/%y') ) and returning: valueerror: time data did not match format: data=13/2012 fmt=%m/%y which ok, because i'm using month = '13', need use... possible make work? thanks! how this, month = 13 year = 2012 dt = datetime.datetime(year+month//12, month%12, 1) print(dt) # 2013-01-01 00:00:00

php 7 - Wordpress issue with php 7 -

Image
i'm trying install wordpress on host php version 7 wordpress style , scripts seems not work , wp themes ruined ( in wp installation steps ) . works fine on php 5.6 here's server information : php : 7.1.0 apache : 2.2.29 mysql version : 5.5.52-cll wordpress 4.6 isn't compatible php 7.1 wordpress 4.7 be. https://core.trac.wordpress.org/ticket/37772

c# - Devart dotConnect Express for Oracle Connection with service name -

i have version 9.1.131.0 . i want connect oracle 12 db service name. have login, pw, server, seems can't add service name or port oracleconnectionstringbuilder. how connect db service name? i can make happen oracle.manageddataaccess due performance issues want test if devart driver working better. kind regards try sid instead of service name . found one: using direct mode sid** system identifier (global database name) ** service name connection string parameter can used instead of sid, in direct mode can connect 1 database instance (rac isn't supported). for me works: var str = new dbconnectionstringbuilder(false); str.add("data source", db); str.add("user id", user); str.add("password", pw); var con = new devart.data.oracle.oracleconnection(str.connectionstring); con.open(); you can put full connection string data source instead of retrieving alias tnsnames.ora file, e.g. string db = "(description=(a