Posts

unit testing - How to get all packages' code coverage together in Go? -

i have library consisting of several packages. when running tests, using '-cover' flag , showing coverage information each package individually.like follows: --- pass: testsampletestsuite (0.00s) pass coverage: 28.7% of statements ok github.com/path/to/package1 13.021s ? github.com/path/to/package2 [no test files] === run testabc --- pass: testabc (0.43s) pass coverage: 27.7% of statements is there way full coverage overview idea coverage on whole project? update: here go test command using go test ./... -v -short -p 1 -cover here bash script extracted https://github.com/h12w/gosweep : #!/bin/bash set -e dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); if ls $dir/*.go &> /dev/null; go test -short -covermode=count -coverprofile=$dir/profile.tmp $dir if [ -f $dir/profile.tmp ] cat $dir/profile.tmp | tail -n +2 >> profile.cov rm $dir/profile.tmp fi fi don...

javascript - Using async package inside blue bird promises -

i know if i'm using async inside promise, this: new promise(function(resolve, reject) { async.maplimit(files, 3000, function(file, callback) { // // }, function(result) { // }); }); i'm doing because need process maximum of 3000 files, if pass 9000, need process before call other function in stack. for example i'm using new promise, i'm using promisifyall in real code. "same" i have mainobject: var myobject = {} inside with, have 4 steps, , i'm using promisifyall because need wait 1 step finish before call other, this: var myobject = { stepone: function(files, callback) { }, steptwo: function(files, callback) { }, stepthree: function(files, callback) { }, stepfour: function(files, callback) { } }; promise.promisifyall(myobject); the problem is, in step (i'm dealing files here) can allow program run 3.000 asynchronous, achieve this, i'm using following: async.maplimit(files, 3000, function() { ...

python - Odoo. How to translate menu items? -

Image
i working odoo , need translate menu items. can provide example step step how can this? in advance! translate menus need follow these steps. 1. settings => translation => load translation. 2. select proper language , click load button. 3. open user preferences. 4. change language user preferences , menus language changed.

How can I configure the data present in HBase caputure to Apache Kafka -

now presently working based on hbase , kafka. my requirement is: suppose if have data present in hbase database. need capture database kafka. here hbase database acts producer , when ever have created in database/producer automatically captures kafka consumer. i have followed many links have not got exact solution. please give me suggestions , provide links based on requirement. if want information ping me. if want use database producer, might want kafka connect. it allows ingest data external sources reliably kafka. https://kafka.apache.org/documentation.html#connect http://docs.confluent.io/3.0.0/connect/index.html

Distributed tensorflow parameter server and workers -

i closely following imagenet distributed tf train example. i not able understand how distribution of data takes place when example being run on 2 different workers? in theory, different workers should see different part of data. also, part of code tells parameters pass on parameter server? in multi-gpu example, there explicit section 'cpu:0'. the different workers see different parts of data virtue of dequeuing mini batch images single queue of preprocessed images. elaborate, in distributed setup training imagenet model, input images preprocessed multiple threads , preprocessed images stored in single randomshufflequeue . can tf.randomshufflequeue in this file see how done. multiple workers organized 'inception towers' , each tower dequeues mini batch of images same queue, , different parts of input. picture here answers second part of question. slim.variables.variabledevicechooser in this file. logic there makes sure variable objects assigned evenl...

Delta encoding - strings (Programming logic - no specific language) -

can put code delta encoding strings. for example, if initial string "cat , dogs" and later string "cats , dogs" i should able difference between string versions efficiently. if can put code here big paragraphs can sent delta encoding less data. i found answer, wanted share all. var oldstring = "this sample of string test delta encoding. infact, own login.dsfdsfdsfdsfsdfsdfdsfdsfsdfsdfds dsfds fds fddsf"; var newstring = "dsfdsthissdf sample of string test x dedsfdsflta encoding sdfds decoding. infact, own sadsadsadsad" var result = ""; var changes = getchanges(oldstring, newstring); var string = getoriginal(oldstring, changes); function getchanges(os, ns) { var addedindex = false; var changes = []; var obj = []; var oi = 0, ni = 0; while (oi < oldstring.length && ni < newstring.length) { if (newstring.charat(ni) != oldstring.charat(oi)) { if (!adde...

java - JPanel with JComponents inside a JScrollPane and custom LayoutManager -

i have written subclass of jcomponent draws in paintcomponent method. in constructor set bounds setbounds. works fine. added subclass jpanel. jpanel inside jscrollpane. jpanel class subclassing jpanel , implementing mouseinputlistener , keylistener. whenever user clicks in jpanel bounds of each jcomponent check against mouse point. if matched focus set jcomponent. if focus @ jcomponent , user drags mouse jcomponent moved inside jpanel. want achive whenever position of jcomponent inside jpanel changes , gets out of viewport of jscrollpane scrollbars gets visible , jpanel gets resized user can scroll outside of viewable area. achive have written custom layoutmanager not layout jcomponents in way absolute position. whenever move jcomponent inside jpanel , outside of viewable area scrollbars not updated. how can achive this? here class subclassig jcomponent: public abstract class gate extends jcomponent { /** * */ private static final long serialversionuid = 1l; public gate() ...