Posts

javascript - How to set relative path resolution based on 'dist' folder -

when creating npm package, quite common , convenient structure so: root / dist / src / package.json where package.json : { "main": "dist/index.js" "files": [ "dist" ] } the drawback of approach is, when consumer wants require files using relative path, needs include dist folder. e.g. const abc = require('my-package/dist/x/y/abc'); is there way tell nodejs resolve relative path based on path.dirname(main) or similar? update: clarify, related relative/deep resolution, not export hoisting in es6. controversial subject should done @ all, consumer coupled internal folder structure of package. update 2: want achieve concept of "sub-module" (similar namespacing). example, folder structure looks this: root / dist / testutil.js / index.js testutil.js contains useful functions testing. since not used in normal use, don't want export them @ top-level. i.e., instead of: // index.js export...

java - Implementing rxJava in a library with interfaces which return values -

so have android library has several interfaces callbacks various things. i'm working on extension module wrap library in rxjava. i've got of callbacks covered, ran issue in couple of spots. so there couple of interfaces used filters essentially. callback gets called, , returns value library know next. a simple example public interface myfilter { reaction oncallback(someevent event); } public void someinternalmethod() { // event happens here need let library user know reaction reaction = filter.oncallback(event); if (reaction.dothing1()) { ... } else if (reaction.dothing2() { ... } so library user implement interface tell library how proceed when "someevent" happens. library user observing someevent, library needs return value know how proceed on said event. as onnext method returns void, i'm not sure best way implement this.

php - yii2 transfering navbar widget parametres to single html parametres -

i going make yii2 popup window feedback form , followed programmers tutorial. in tutorial programmer gave these parametres navbar in main.php echo nav::widget([ 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => [ ['label' => 'home', 'url' => ['/site/index']], ['label' => 'about', 'url' => ['/site/about']], **['label' => 'contact', 'url' => '#', 'options' => ['data-toggle' => 'modal', 'data-target' => '#mymodal']]**, the programmer gave these parametres inside nav widget in contact label, 'options' => ['data-toggle' => 'modal', 'data-target' => '#mymodal'] however, must use -->['data-toggle' => 'modal', 'data-target' => '#my...

javascript - what is the proper way to create a Joomla component that can write files on click of button? -

i trying create joomla administrator component - non commercial later. component bootstrap customiser joomla theme - protostar. example - trying achieve in joomla admin component - https://getuikit.com/v2/docs/customizer.html the component will: 1) read front end page , show in iframe 2) import less files , allow modification of template's less variables 3) on click of button "recompile less", compile less , update iframe , write compiled less css files. as of now, have entry file in component, call helper compile less. files have helper.php , componentname.php , less compiler php file require. need controller? need view.xyz.html ? know mvc pattern joomla simple task, not sure how implement. thanks

python 2.7 - mongodb - querying & projecting element value from nested array -

Image
i have nested arrays below in 1 of collections, how retrieve value specific sub array & don't need of other fields in document. have tried using following query didn't me expected output, query: db.getcollection('my_collection').find({"_id":"08d4608a-e6c4-1bd8-80e6-8d1ac448c34b"},{"_id":0,"customproperties.0.1":1}) you can try db.getcollection.find({ "somearray.somenestedarray.name": "value" })

d3.js - programatically click on sankey node -

i working on sankey collapsible view. got inspiration https://bl.ocks.org/thebiro/f73a2a0625bb803179f3905fe7624e22 there functionality click on node node collapses. i have requirement node or nodes , it's children should collapsed when sankey generate. e.g collapse: pagou n_pagou and children programatically. i.e when sankey generates. , user can click on above 2 nodes , uncollapses it. following 2 nodes should collapsed when sankey first generates.

amazon web services - Unable to ssh into one EC2 instance from another in same VPC -

i trying ssh 1 ec2 instance (in-ports:22,443) db server (another ec2) in-port 3306 sg-group of first ec2 group. ec2 instance 1: security group a- inbound: port 22 & 443, source: '0.0.0.0/0' ec2 instance 2 (db server): security group b- inbound: port 3306, source: 'security group a' when try ping 2 1, connection times out. what doing wrong? are trying ssh server 1 server 2, or trying connect database on server 2 server 1? question unclear, says want ssh port 3306, makes no sense. ssh works on port 22 default. port 3306 default mysql database port. the way security groups configured, can ssh server 1, , can use mysql client on server 1 connect mysql database on server 2. if want ssh server 1 server 2, need top add rule security group b: inbound: port 22, source 'security group a'. you shouldn't worry ping. protocol ping (icmp) blocked security groups, ping isn't going useful test.