Posts

Showing posts from February, 2011

unable to store variable in Matlab Gui -

i know several variants of issue have been discussed elsewhere, still unable solve problem. please help. i have created function part of larger gui, unable store 3 data variables (avex, avey, avez) later use guidata(hobject, handles). doing wrong? here function: %call checkbox values = 1:30 checkboxes=get(handles.(sprintf('checkboxav%d',i)),'value') checkboxes(i,1)=checkboxes(1,1); end plotdata=handles.plotdata; [row,col] = find(checkboxes==1) num=length(plotdata{1,1}(:,1)); datay = zeros(num,length(row));%zero matrix %average y data k=1:length(row) datay(:,k)=plotdata{row(k,1),col(k,1)}(:,4); end [m,n] = size(datay) if (n==1) avey=datay' elseif (n>1) avey=mean(datay'); end avey=avey'; %average x data kk=1:length(row) datax(:,kk)=plotdata{row(kk,1),col(kk,1)}(:,1); end test=datax(:,1); comp=any(bsxfun(@minus,datax,test),1) s = sum(comp) if (s > 0) h=msgbox(['note! wavelength index selected samp

build.gradle - How to share sub-projects with many other projects on Gradle? -

i new gradle, , running issues while trying share sub-projects among many other projects. project structure looks follows: project | |--------------project b |--------------project c |--------------project d project e | |--------------project c |--------------project d where: project d | |---------------project c project c , project d used in other projects frequently, act libraries data classes , database utilities. project a settings.gradle file: rootproject.name = 'projecta' include ":projectb" project(":projectb").projectdir = file("/home/myfolder/netbeansproject/projectb") include ":projectc" project(":projectc").projectdir = file("/home/myfolder/netbeansproject/projectc") include ":projectd" project(":projectd").projectdir = file("/home/myfolder/netbeansproject/projectd") project a build.gradle file: apply plugin: 'java' apply plugin: 'applicat

CMake check_function_exists only called one time in macro -

i have cmake macro calls check_function_exists() detect several math functions. by output below, seems check_function_exists() called first time; macro(nco_check_funcs func def) message(${argv0}) check_function_exists(${argv0} have_result) message(${have_result}) if (not have_result) message("-- using nco defined version of ${argv0}") add_definitions(-d${argv1}) endif() endmacro(nco_check_funcs) nco_check_funcs(atan2 need_atan2) nco_check_funcs(acosf need_acosf) nco_check_funcs(asinf need_asinf) in example below macro called 3 times, output of check_function_exists() shows 1 time atan2 -- looking atan2 -- looking atan2 - found 1 acosf 1 asinf 1 those results of check_function_exists() cached. check <function> provided libraries on system , store result in <variable> . <variable> created as internal cache variable . add following begin of macro: unset(have_result cache) or if want keep functionality of searching ones f

python - Pandas - DateTime within X amount of minutes from row -

i not entirely positive best way ask or phrase question highlight problem, dataset, thoughts on method , end goal , clear end. my problem: my company dispatches workers , load dispatches single employee if on current dispatch. due limitation in software use. if employee receives 2 dispatches within 30 minutes, call double dispatch. we analyzing our dispatching efficiency , running bit of head scratcher. need run through our 100k row database , add additional column read dummy variable 1 double 0 normal. have multiple people dispatch , b our records not start ordered dispatch, need determine how dispatch occurs same person within 30 minutes. dataset: the dataset incredibly massive due poor organization in our data warehouse terms of items need these columns need calc. tech name | dispatch time (pst) john smith | 1/1/2017 12:34 jane smith | 1/1/2017 12:46 john smith | 1/1/2017 18:32 john smith | 1/1/2017 18:50 my thoughts:

pyspark - How to convert spark streaming nested json coming on kafka to flat dataframe? -

need on first attempt parse json coming on kafka spark structured streaming. i struggling convert incoming json , covert flat dataframe further processing. my input json [ { "siteid": "30:47:47:be:16:8f", "sitedata": [ { "dataseries": "trend-255", "values": [ {"ts": 1502715600, "value": 35.74 }, {"ts": 1502715660, "value": 35.65 }, {"ts": 1502715720, "value": 35.58 }, {"ts": 1502715780, "value": 35.55 } ] }, { "dataseries": "trend-256", "values": [ {"ts": 1502715840, "value": 18.45 }, {"ts": 1502715900, "value": 18.35 }, {"ts"

pandas - I am getting an ImportError when using package sklearn and scipy -

traceback (most recent call last): file "c:/users/mohit/onedrive/scorpion/neuralnetanalysis.py", line 9, in <module> sklearn import preprocessing file "c:\users\mohit\appdata\local\programs\python\python36\lib\site-packages\sklearn\__init__.py", line 134, in <module> .base import clone file "c:\users\mohit\appdata\local\programs\python\python36\lib\site-packages\sklearn\base.py", line 12, in <module> .utils.fixes import signature file "c:\users\mohit\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\__init__.py", line 11, in <module> .validation import (as_float_array, file "c:\users\mohit\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\validation.py", line 18, in <module> ..utils.fixes import signature file "c:\users\mohit\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\fixes.py", line 144, in &

javascript - VueJS Element vue-data-tables Search box filter with range -

i using vuejs 2.0 along http://element.eleme.io , https://njleonzhang.github.io/vue-data-tables . been trying figure out how can ranged search (x y) https://njleonzhang.github.io/vue-data-tables/#/searchboxfilter unable figure out , not find examples. feel can done filterfunction, unsure. or maybe add more text inputs can take 2 numbers, , pass values filterfunction? not sure if has example on how done, extremely appreciate it. below have far, removed tried, not confuse anyone. <template> <data-tables ref="multipletable" :data="tabledata" :pagination-def="paginationdef" :search-def="searchdef" @filtered-data="handlefiltereddata" @selection-change="handleselectionchange"> <el-row slot="custom-tool-bar" style="margin-bottom: 10px"> <el-col> <el-button @click="hidefiltereddata()" type="primary">delete filtered</el-button>

javascript - Calculating input fields with data attribute -

i have input fields data attribute.i want when click on button in field total sum of total of fields. found total sum every field, how sum of them. <input type="text" id="total"> <div class="field"> <input type="number" min="1" max="255" data-price="2" class="wert"> </div> <div class="field"> <input type="number" min="1" max="255" data-price="2" class="wert"> </div> <button id="calc-butt">sum</button> <script> jquery('#calc-butt').click(function() { jquery('.field').each(function(){ var price = jquery(this).find('.wert').attr("data-price"); var cubic = jquery(this).find('.wert').val(); var total = price * cubic; }); }); </script> scope of total inside each callback, intialize 0 before

android viewpager - React-Navite nested IndicatorViewPager not working -

i'm using react-native-viewpager , create nested pagers. parent view pager working fine, each nested view rendering right way, in 1 of them have view pager , 1 doesn't render childrens. <view style={{flex:1}}> <indicatorviewpager ref='viewpager' style={{flex:1, backgroundcolor:'black'}} initialpage={0} <view style={{flex:1, backgroundcolor:'pink'}}> <text>page 1</text> </view> <view style={{flex:1, backgroundcolor:'blue'}}> <text>page 2</text> </view> </indicatorviewpager> </view> i have tried workarounds of viewpageran

How to create and use Pipelines via Java API in ElasticSearch -

i'm trying create timestamp attach documents indexed. know possible in query dsl via below set of commands. cannot find out how through java api. have of done before? thanks! delete anindex put _ingest/pipeline/timestamp { "description" : "describe pipeline", "processors" : [{ "set" : { "field": "timestamp", "value": "{{_ingest.timestamp}}" } }] } put anindex { "mappings": { "jeff": { } } } put anindex/jeff/id10?pipeline=timestamp { "hi": "jeff" } anindex/jeff/id10 as far know, elasticsearch doesn't have java api defining ingest pipeline. work around, can following define ingest pipeline java using httpurlconnection:

jquery - How to use a javascript function inside class attribute of an element -

i want create dynamic 'li' elements , want assign classes 'li' element javascript function based on parameters in load of page mean want function run on 'li' elements assign function to. something : in design <li class="nav-item somefunction("param1","param2")"> </li> and 'somefunction' javascript function returns classes string to make 'li' element follows in end : after rendering <li class="nav-item cssclass1 cssclass2 cssclass3 cssclass4"> </li> not how asked it, here how jquery: codepen: https://codepen.io/anon/pen/xejkvl <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <style> .red{ color:red; font-size:25px; } </style> <script> window.onload = function() { $( "#example" ).addclass("red"); } </script> <li id="example&qu

rest - How to use Zapier with my Java RESTful API -

i've been asked use zapier send sms , add subscriber mailchimp once addnewcontact endpoint called. i've never worked zapier i'm having trouble understanding how proceed; in zapier 1 can create app or zap . same ? my task use zapier pursposes mentioned above, if clarification/guidelines start , how proceed appreciated. we use jax-rs/jersey 2.1 main idea have call rest api belongs zapier can make request send sms , add newly created contact subscriber in mailchimp. we created zap triggered sms once contact endpoint called done specific client, isn't solution we're looking since authentication keys, clients , contact information dynamic. my problem in zapier documentation can't find related requirements, find ui solutions directly working in zapier. thanks in advance. a zap main interface in zapier construct integration between available apps setting trigger source capture data, , subsequent actions receive data. an app typically bran

javascript - alert on back button click in a php project -

i working on online quiz system php , mysql displays 1 question @ time , question submitted displays second 1 , on. want prevent student student leaving exam page clicking button or close tab. tried following code: window.onbeforeunload = function (e) { var message = "your confirmation message goes here.", e = e || window.event; // ie , firefox if (e) { e.returnvalue = message; } }; it alerts student when clicks button or close page gives alert when student submitting first question display second one. have idea how solve problem??? if (e) { e.returnvalue = message; } you have validate event. have id submit/next button , try validate event. suppose have id called "submit" submit button if (e.target.id !== 'submit') { e.returnvalue = message; }

Is it possible to define directory path in visual studio -

i'm using visual studio create game using sdl library. i've created own static library game relies on. (it's basic engine sets sdl, maps, ect.). when include 1 of files custom library, have type this: #include <sdl_game_engine/files/whatever.h> obviously can bit tedious in typing that. i'm wondering if there's way in properties allow me type #include <engine/whatever.h> (basically take whole path file , make shortcut it). i know it's long shot awesome if there way. don't have include directory include files directory way know file i'm using in sdl_game_engine library. possible (with luck there's no way lol) suggestions awesome. guys! ps. using visual studio 2015 not sure sdl library but..perhaps can place things in app.config , assign variables path; string filepath = configurationmanager.appsettings["yourfilepathkeyinappconfig"]; use in code: somegamevarfile = filepath; //psuedo code

python - Invalid syntax error returned for %matplotlib -

i'm experiencing trouble importing below libraries displayed within below markdown, required python sentiment analysis via twitter: # general: import tweepy # consume twitter's api import pandas pd # handle data import numpy np # number computing # plotting , visualization: ipython.display import display import matplotlib.pyplot plt import seaborn sns %matplotlib although new python3/pip, rubyist/elephpant, i'm no stranger homebrew- after commenting-out %matplotlib file apparently imports libraries listed except %matplotlib , appears the jupyter invocation - how correctly load import %matplotlib in standard python (3.6.2) in order avoid below error? there alternative approach? file "toolbox.py", line 10 %matplotlib ^ syntaxerror: invalid syntax thank you! as documentation explains : starting ipython 5.0 , matplotlib 2.0 can avoid use of ipython’s specific magic , use matplotlib.pyplot.ion() / matplotlib.pyp

c++ - "Error C2661 no overloaded function takes 5 arguments" When constructor clearly passes 6 arguments, which are required -

i have function named menubutton constructor as: (where dosomething defined typedef void*(dosomething)(); ) inline menubutton(float x, float y, float w, float h, int tid, dosomething* onclick) { this->x = x; this->y = y; this->w = w; this->h = h; this->tid = tid; this->onclick = onclick; } and using constructor here: menubutton* play = new menubutton(100, 100, 300, 50, this->gettex("play_button")->tid, &this->startload); and getting following error? 'menubutton::menubutton': no overloaded function takes 5 arguments

pentaho - Remove duplicated row from 2 tables in different database -

Image
i have 2 users table in different databases , unique rows 1 tables. on following example, need list of emails have no duplicate name. i using pentaho di kettle. table users database 1 id | name | email --- | ----------- | ------------- 1 | jonh snow | jonhs@got.com --- | ----------- | ------------- 2 | sansa stark | sansas@got.com --- | ----------- | ------------- 3 | ayra stark | ayras@got.com table users database 2 id | name | email --- | ----------- | ------------- 1 | jonh stott | jonhs@example.com --- | ----------- | ------------- 2 | jonh jonh | jonhj@example.com --- | ----------- | ------------- 3 | ayra stark | ayras@got.com desired result id | name | email --- | ----------- | ------------- 1 | jonh snow | jonhs@got.com --- | ----------- | ------------- 2 | sansa stark | sansas@got.com as far understand question, need keep emails not duplicates in db1 union db2? well, follow logic: dat

angularjs - Accessing ui-router state params from an attribute-type directive (NOT a component) -

we're upgrading old version of ui router v1.0.5, , i'm having issue trying replace our deprecated $stateparams uses. use simplified example, have unique-name attribute-type directive use on form field validation check make sure text in field unique name. idea we're either adding new doohickey or changing name of existing doohickey, , want ensure no other doohickey has same name. in our old code, doohickeyid value $stateparams this: function uniquename(doohickeysearchservice, $stateparams, $q) { return { restrict: 'a', require: 'ngmodel', link: function (scope, elm, attrs, ctrl) { ctrl.$asyncvalidators.uniquename = function (modelvalue) { // use doohickeysearchservice founddoohickey name // then... return founddoohickey.id !== $stateparams.doohickeyid; }; } }; } probably way over-simplifie

ubuntu - How should I debug an lftp task? -

i have lftp command ran in bash script: lftp -u ${ftpuser},${ftppass} ${ftphost} -e "mirror --reverse --delete --verbose /local/path/to/folder /remote/folder; quit" it's running against 30+gb folder 22k+ files. , each time run it , end finding 5128 new files transfer... is, of course, wrong (believe me, don't create file in minute between 2 test run!). verbose doesn't me so... options here?

simulation - Simulating multiple android devices -

i'm in process of creating android application allows host device take on 1 of many roles in gathers, shares, or processes information. given nature of application, necessary not test roles independently, simulate interaction among components. there exist platform allows simulation of multiple android devices in network? i've had trouble finding meaningful search results, majority of results seem geared toward testing multiple types of devices, not simulating multiple, communicating devices concurrently. as suggested here , possible run multiple instances of android studio emulator communicate through sockets, not seem suitable strategy simulating large numbers of devices. my advisor has requested find platform allows simulation of thousands of devices, happy find suitable hundreds if have budget in tens of thousands of dollars, buy bunch of android devices , network them. if have budget in thousands of dollars, buy bunch of computers , run handful o

git - Check in the active Xcode target -

which file/s track active scheme? have project multiple repo's each repo corresponds target, , these different schemes build target. when switch repo's targeta_repo targetb_repo , xcode's "active scheme" (in top left near play/stop buttons) doesn't change. i'd check both repos establishes 'default scheme' such checking out targeta_repo , , hitting play sufficient confidently build targeta scheme builds targeta.

twitter - How to get last user's tweet which is not reply nor retweet -

seems simple user's timeline tweets , exclude replies , retweets, or without count&page params in user_timeline.json looks impossible first (non reply, non retweet) tweet of user tweet not in first place in api response. for example @gmail has last tweet 30.8.2017, first 7 pages each having max 200 results full of replies , retweets, need filtered out. when using paging params, not, doc says - these unwanted records filtered after applying paging params: "using exclude_replies count parameter mean receive up-to count tweets — because count parameter retrieves many tweets before filtering out retweets , replies." so there other way (besides stream api, , search limited 7 days given @gmail tweet won't returned wel) iterating through result pages until first (non reply, non retweet) tweet met?

sql - Does multi-row multi update vs many updates statement works exactly the same? [PosgreSQL] -

i can't seem find resources addressing this, update "my-table" t set "val"=v."val", "msg"=v."msg" ( values(1,123,'hello'), (2,456,'world!') ) v("id","val","msg") v.id = t.id vs update "my-table" set val = 123, msg = 'hello' id = 1; update "my-table" set val = 456, msg = 'world' id = 2; what interested in whether concurrency control between each case same read committed isolation level? after reading feel quite safe how handles update concurrently https://www.postgresql.org/docs/current/static/transaction-iso.html#xact-read-committed begin; update accounts set balance = balance + 100.00 acctnum = 12345; update accounts set balance = balance - 100.00 acctnum = 7534; commit; but there no mentioning multi value update , how behaves?

java - isReachable() returns false in android -

well, have situation when phone working hotspot , need detect devices wich connected phone , find mac addresses. wrote this: public void getlistofconnecteddevice() { thread thread = new thread(new runnable() { @override public void run() { bufferedreader br = null; boolean isfirstline = true; try { br = new bufferedreader(new filereader("/proc/net/arp")); string line; while ((line = br.readline()) != null) { if (isfirstline) { isfirstline = false; continue; } string[] splitted = line.split(" +"); if (splitted != null && splitted.length >= 4) { string ipaddress = splitted[0]; string macaddress = splitted[3]; boolean isreachable = inetaddress.getb

ruby on rails - Does a Sidekiq worker know what time it was posted? -

assuming sidekiq worker wasn't posted @ same time started (i.e. via perform_at or perform_in ), post time stored anywhere in worker object? in other words, can sidekiq worker know time posted? pass value perform_at i'd rather not if it's there. the created_at , enqueued_at times stored in job payload not available worker instance. accessible middleware.

css - SCSS importing file without import -

so ran weird.. i'm using 7-1 pattern css needs. unfamiliar can read here: https://sass-guidelin.es/ i have _variables.scss file have css variables declared. question can access these variables in other .scss files without using import statement in particular file. can explain why? edit: guess have main.scss file scss watching importing other files. time css attempting transpiled variables available in other files? i'm gonna assume you've got 1 master import file, like: @import 'variables' @import 'base' @import 'some_component' @import 'some_other_component' the reason variables available other stylesheets imports cascade. so, import variables , imported after in same scope variables (as they've been imported). this can blessing , curse, variables define outside of block scope in of other stylesheets become globally available stylesheets imported after one. because of this, it's considered best practice impo

Two way to address an excel worksheet but index numbers are different -

i'm using excel 2016 vba worksheet entitled sheet40 (testrandomteams). both following 2 lines of code point same worksheet, don't understand why? application.goto activeworkbook.worksheets(45).cells(6, 5) worksheets(40).activate there 1 workbook open.

EF Data First with ASP.NET Identity and MVC 5 -

i've created asp.net mvc 5 application using individual user accounts authentication , sql server 2012 express. the template seems have worked. can create accounts, manage user account, etc. use ef create additional tables app use, i'm doing wrong since conflicting classes (like applicationdbcontext{}) being created. basically, have default aspnet database table , want see in ef designer. there fields add aspnetusers table. the way doing "add item" , choose "ef designer database". what method including default aspnet* tables in ef designer without generating conflicting classes created initial asp.net template? i'm using vs 2015 community. since using identity not use "add item" option make changes database. to add new properties applicationuser model locate file identitymodels.cs . should see similar below. public class applicationuser: identityuser { // add new properties here public datetime dateofbirth { g

android - How long does redux state persist in memory in react native -

i trying understand how manage redux state in react-native app. in particular, trying work out happens when app minimized or device turned off. with knowledge can work out best how persist state, , prepare illegal states may arise redux state being reset. is fair assumption make if redux state reset, entire app restart (and therefore initialization of redux store called again?). is fair assumption make if redux state reset, entire app restart this assumption not true, inverse is. redux state can reset during runtime if there code via reset action or otherwise. however if app shut down, , code re-runs loaded default redux state. asyncstorage (in native) / localstorage web, used in conjunction redux in order persist state across app crashes / browser sessions. you can set asyncstorage strategy redux-persist middleware (or write own)

python - what does `yield from asyncio.sleep(delay)` do? -

the following example python in nutshell sets x 23 after delay of second , half: @asyncio.coroutine def delayed_result(delay, result): yield asyncio.sleep(delay) return result loop = asyncio.get_event_loop() x = loop.run_until_complete(delayed_result(1.5, 23)) i feel difficult understand yield asyncio.sleep(delay) does. from https://docs.python.org/3/library/asyncio-task.html#asyncio.sleep coroutine asyncio.sleep(delay, result=none, *, loop=none) create coroutine completes after given time (in seconds). if result provided, produced caller when coroutine completes. so asyncio.sleep(delay) returns coroutine object. what coroutine object "completes" mean? what values yield asyncio.sleep(delay) provide main program? thanks. yield from python3.4 syntax 3.5 await make more sense. "completes" means task coroutine has finished. in case want use async sleep can computer other tasks while sleep-task running, makes

c++ - Opengl 3D cube won't render correctly on Windows -

Image
i following tutorial on udemy - modern opengl 3.0. have managed basic tutorial part 5 "projections , coordinate systems". works on mac, same code, can't work on windows. restarted tutorial make sure didn't miss , previous tutorials worked, same result. won't render correctly. did on visual studio 2015 on windows. on mac got work using vim , makefile... think easier ide compiles you, apparently not. this displayed on screen, flashes fast , moves lot, instead of rotating cube should getting. here code: shader.h: #ifndef shader_h #define shader_h #include <string> #include <fstream> #include <sstream> #include <iostream> #include <gl/glew.h> class shader { public: gluint program; // constructor generates shader on fly shader(const glchar *vertexpath, const glchar *fragmentpath) { // 1. retrieve vertex/fragment source code filepath std::string vertexcode; std::string fragmentcode;

c++11 - c++ - Must all static class methods be defined, even when not used? -

so, i've got issue, , i'm not sure if it's language issue, or compiler/gcc issue. tl;dr - required define static methods within class, if static methods never called application (i.e. legitimately dropped linker anyway)? i have library class implements device driver uart in microcontroller. because don't want multiple uart objects pointing same resource, each uart object singleton, retrieved using 1 of several getinstance() methods, 1 each uart instance in device (uart0, uart1, etc). each uart instance needs have 2 fifos (tx , rx) storage. each fifo needs explicitly sized application , allocated @ time uart object instantiated (ideally). have several static getstorage() methods, again, once each uart. i've created stripped down code proof of concept. here's static_instance.h: #ifndef static_instance_h_ #define static_instance_h_ #ifdef __cplusplus #include <vector> namespace foo { class uart { public: /* retrieve singleton instan

awk - Using matching entries (shell scripting) -

i have 2 .csv files of same structure enstgug00000000001,c2cd2l enstgug00000000002,dpagt1 enstgug00000000003,egr1 enstgug00000000004,reep2 enstgug00000000005, enstgug00000000006,pias2 enstgug00000000007,kdm3b enstgug00000000008, enstgug00000000010,hmbs enstgug00000000011, and enstgug00000000001, enstgug00000000002,dpagt1 enstgug00000000003,egr1 enstgug00000000004,reep2 enstgug00000000005, enstgug00000000006,pias2 enstgug00000000007,kdm3b enstgug00000000008,loc100218573 enstgug00000000010,hmbs enstgug00000000011, i want find elements in 1st column of 1st file 2nd column empty, , search corresponding in 2nd column of 2nd file. so output be enstgug00000000001,c2cd2l enstgug00000000002,dpagt1 enstgug00000000003,egr1 enstgug00000000004,reep2 enstgug00000000005, enstgug00000000006,pias2 enstgug00000000007,kdm3b enstgug00000000008,loc100218573 enstgug00000000010,hmbs enstgug00000000011, this way can have 1st file complete possible. assuming files line line line: a

ffmpeg - How to stream rawvideo x11grab desktop with zero latency -

i stream linux desktop ffmpeg rawvideo use command on server: sudo ffmpeg -f x11grab -s 1280x720 -i :0.0 -vcodec rawvideo -pix_fmt bgr0 -threads 1 -f mpegts udp://localhost:1234 its take 900mb/s bandwidth on lan dont wanna use codecs cause create big latency playing games. but cant use ffplay recognize stream ffplay 'udp://localhost:1234?fifo_size=999000&overrun_nonfatal=1' i got error: failed open file 'udp://localhost:1234?fifo_size=875000&overrun_nonfatal=1' or configure filtergraph when save file after second have large file can open vlc cant open udp stream edit2: sudo ffplay -f rawvideo -pixel_format bgr0 -video_size 1280x720 udp://localhost:1234?fifo_size=999000&overrun_nonfatal=1 working have green artifacts everywhere

Retrieve superficial data of a big Firebase Database -

i have big database in firebase. in opinion it's wrong structured. trying snapshot of reference, takes time processing results. however, don't need retrieve data. don't need deepers items don't know how can superficials. so structure this: clients { 1234 { name: 'paul', last_name: 'mcartney', city: 'liverpool', account_movements: { item1: { ... } } } 1234 { ... } 1236 { ... } } let's supose need clientes data except account_movements . because talking big database suggest restructure database little bit. frank says, when trying read node, entire node. means every time add listener specific reference, downloading entire information of object. note, there no way in can download subset of properties of each node , that's why need denormalize database. because important rule in firebase have database flatten possible, suggest account_movement

javascript - Aren't promises just callbacks? -

i've been developing javascript few years , don't understand fuss promises @ all. it seems change: api(function(result){ api2(function(result2){ api3(function(result3){ // work }); }); }); which use library async anyway, like: api().then(function(result){ api2().then(function(result2){ api3().then(function(result3){ // work }); }); }); which more code , less readable. didn't gain here, it's not magically 'flat' either. not mention having convert things promises. so, what's big fuss promises here? promises not callbacks. promise represents future result of asynchronous operation . of course, writing them way do, little benefit. if write them way meant used, can write asynchronous code in way resembles synchronous code , more easy follow: api().then(function(result){ return api2(); }).then(function(result2){ return api3(); }).then(function(resu

amazon ec2 - Jmeter master slave in AWS on demand -

i hoping help/suggestions regarding jmeter master/slave test set up. here scenario: need load testing using jmeter master slave set up. planning launch master , slave nodes on aws (window boxes, dependency on 1 of tool launch via jmeter). want launch these master-slave set in aws on demand can tell how many slave nodes want. looked around lot of blogs around using jmeter aws , everywhere assume these nodes launched manually , needs further configuration master , slave nodes talk each other. tests might have 5 or 10 slave nodes fine tests want launch 50 instances(again tool use jmeter has limitation forces me use each jmeter slave node 1 user, instead of using 1 slave node act multiple users) , manually updating each of slave nodes cumbersome. wondering if else ran issue , have suggestions. in mean time looking other solutions me use same slave node mimic multiple users, me reduce need launch these many slave nodes. regards, vikas have seen jmeter ec2 script ? seems you&

javascript - Socket.io which is in my Angularjs controller, is duplicated every time I access to the controller -

i have app node.js, angularjs , socket.io, have controller maps.html receives events other clients socket.io that: app.controller('mapctrl', function ($scope, $http, socket) { vm = this; //.... socket.on('finalizarruta', function(data) { //other function controller vm.funciones.almacenarhistorialfinalruta(); }); }); all work but, when im going other page, , later return maps.html, reactive controller , socket.io functions activated 2 or more times (depends number of returns controller). i have see answer said have put socket.io functions out controller, in service but, functions executes other functions same controller. is there way prevent socket.io functions running more once, without having remove them controller? more code: app.factory('socket', ['$rootscope', function($rootscope) { var socket = io.connect(); return { on: function (eventname, callback) { socket.on(eventname, function (

dataframe - Give an (x,y) pair, how to choose which (x,y)_i pair is the closest - R -

i have data frame (called coors) contains vector of x coordinates , vector of y coordinates. i have data frame (called pickedpoint) contains specified (x,y) pairs of interest. the goal associate each coors point nearest pickedpoint. want use euclidean norm (l-2) . if @ possible please tidyverse methods. coor = data.frame(row = rep(1:96, each = 72), col = rep(1:72, times = 96)) pickedpoint = data.frame(pprow = sample(96,10), ppcol = sample(72,10)) there thread similar posted in python: how find closest (x, y) position (x,y) position in list? i have included benchmark answers far: microbenchmark(cpak(), latemail(),jul(), times=10l) unit: milliseconds expr min lq mean median uq max neval cpak() 37.83691 38.60585 43.66030 39.86094 44.9592 62.784 10 latemail() 4275.10 4536.783 4674.966 4712.938 4855.860 5045.069 10 jul() 37.38809 39.87625

system verilog - Systemverilog Mailbox and Queue -

i not able understand, why prefer mailbox on queue inter process communication (eg: communication between driver , scoreboard)? a mailbox built-in class around queue uses semaphores control access ends of queue. mailbox has fifo element ordering whereas can access head, tail, or middle elements of queue. you typically use mailbox when there multiple threads reading , writing data , need atomic test-and-set operation of semaphore know when mailbox full or empty. if have 1 process reading , writing queue, there no need use mailbox. if there more 1 thread, mailbox convenient class use. in uvm, use tlm fifo wrapper around mailbox. tlm connections provide isolating interface don't have know on other side of port. see https://verificationacademy.com/sessions/how-tlm-works

How to print a List of Arrays (with elements) using Java 8 Streams? -

this question has answer here: what's simplest way print java array? 23 answers public static void main(string[] args) { list<integer> numbers1 = arrays.aslist(1,2,3); list<integer> numbers2 = arrays.aslist(3,4); list<int[]> intpairs = numbers1.stream() .flatmap(i -> numbers2.stream() .filter(j -> (i+j)%3 == 0) .map(j -> new int[]{i,j})) .collect(collectors.tolist()); intpairs.stream().foreach(system.out::println); } for above code, getting output as: [i@214c265e [i@448139f0 but expectation [(2, 4), (3, 3)] . could please guide me achieve this? you can change mapping part list instead of using int[] : .... .map(j -> arrays.aslist(i,j))) .... and output following: [2, 4] [3, 3] here complete example: public static voi

c - How to loop through a users input using getchar() and check to see if the characters are an alphabet or a digit -

im totally new programming, picked c manual learn on own. dont want use array im trying practice getchar(). want able output error message if user enters other digit or alphabet. trying practice c library function isalpha() , isdigit(). wrote far, output not quite right. input 1 : "hello" expected output : "valid output" input 2 : "hello5" expected output : "valid output" input 3 : "hello!" expected output : "invalid output" but program returns "valid input" 3 inputs above please newbie try learn. appreciate it. #include <stdio.h> #include <ctype.h> int main () { char ch; int len; int valid; printf("enter word: "); for(length = 0; (ch = getchar()) != '\n'; len++) { if(isalpha(ch) || isdigit(ch)) { valid = 1; } else { valid = 0; } } printf("

sql server - C# - EDM/EF - Selected tables only or whole database? Best practices -

i still puzzled basic question not yet find answer: if create in c# edm (using database first approach) - there best practices in number of tables choose? select whole db/all tables - flexible possible later? i.e. you'd work off 1 "complete model" in application. or try restrict/limit tables absolutely need in model? or generate multiple models different tables? are there (serious) performance worries, if have tables in model, later not actively addressing? thank input in advance. it depends on specific situation, consider problem, whether need data or not?? working in web environment or using local application? if connect on web better grab data once, if tables heavy , not need of them, why should that?? load need,

routing - In linux how do two NICs on the same machine communicate with other -

all, have question on networking between 2 nics on same machine under linux. suppose both nics different ip addresses , can communicate outsides. when sending data ip address of nic 1 of nic 2, data sent outside network , forwarded nic2, or sent receiver directly inside kernel, without going outsides. opinion if 2 ip addresses belong different subnets, data sent router first. if 2 ips off same subnet? bother send data first to, example, switch, , looped nic2, or kernel recognize destination on same node , transfers receiver without going through physical wire? thank much! i don't think it's case 2 nics on same subnet can "see" each other @ all, unless routing table set can. i have 2 network adapters in test box, addresses in same subnet. if try use "ping -i {interface}" ip number, no response if 1 interface other. is, fails if specify 1 interface, , ip number other interface. way can packets 1 interface other use ips take traf

Trying to capture or group txt from a string into a list box C# -

i have .txt file containing many lines. trying capture lines start d. here trick: capture 2 proceeding lines (when d lines start) can capture site , program came from. here looking for desired result: ![text desired][1] also, d lines can appear multiple times in text varying length, instead of 3 lines of "d" there 1000 or 10 or it.. how go writing this, can done? anel system name: bauer node 02 program name: abu.deh1lr.pgm panel system name: bauer node 02 program name: abu.rt1lr.pgm panel system name: bauer node 02 program name: abu.rt2lr.pgm panel system name: bauer node 02 program name: abu.rt3lr.pgm panel system name: bauer node 03 program name: aba.lighting.pgm panel system name: bauer node 03 program name: aba.rt1lr.pgm panel system name: bauer node 03 program name: aba.rt2lr.pgm d 5205 loop(128 %x%sat %x%vrt %x%sas 1000 15 0 1 0 0 100 0)