Posts

Priority with Spring cloud contract -

sc contract version : 1.1.0.build-snapshot i defining priority in groovy contracts : package contracts import org.springframework.cloud.contract.spec.contract [ contract.make { priority 1 request { name 'create' method 'post' url '/api/patates' body([ cuite: true ]) headers { contenttype(applicationjson()) } } response { status 201 body([ id: $(consumer('1'), producer(regex('[0-9]{0,9}'))), cuite: true ]) headers { contenttype(applicationjson()) } } }, contract.make { priority 2 request { name 'read' method 'get' url '/api/patates/1' headers { contenttype(applicationjson()) } } response { status 200 body([ id: 1, cuite: true ...

webpack - Angular-cli: Module not found: Error: Can't resolve 'PouchDB' -

os? linux (amazon linux ami) versions. angular-cli: 1.0.0-beta.22-1 node: 6.6.0 os: linux x64 repro steps. i installed pouchdb: npm pouchdb --save npm @types/pouchdb --save-dev i added in typings.d.ts : declare module 'pouchdb'; and import pouchdb in service: import * pouchdb 'pouchdb'; well, okey in laptop (macos sierra); ng serve , ng build without problems , pouchdb working well. but... not same thing in server (amazon linux ami)... 😐 i'm getting next error trying execute ng build : error in ./src/app/pictures.service.ts module not found: error: can't resolve 'pouchdb' in '/home/aral/project/src/app' @ ./src/app/pictures.service.ts 11:0-35 @ ./src/app/app.module.ts @ ./src/app/index.ts @ ./src/main.ts @ multi main i have same angular-cli version , node version in laptop... 😧 and compared doing tree command in laptop , server , both have same files. (except sub-dependency in node_modules ). th...

javascript - Node.js Wit.ai integration -

i learning wit.ai , going through tutorial ( https://wit.ai/docs/quickstart ). else went till step 6, asked me clone node.js client , install npm. usually, create separate node.js project npm intall whatever-the-module-is use it. i confused on how use node-wit. want create own node.js server called bot implement business logic. here few questions need with: can create basic node.js project, install node-wit , use it? if deploy node project on heroku, provide endpoint wit.ai call? tutorial not mention it. can perform business logic without using promise or code have given in node-wit tutorial? overall confused on how node-wit code working. thanks. 1) yes can. run npm install --save node-wit , check out github more infos https://github.com/wit-ai/node-wit 2) endpoints url set within module. check lib/config.js file. have specify api key communicate wit. 3) sdk uses promises, have use them too. 2 solutions here : i) master concept, guess that's it's wo...

xaml - UI-efficient filtering of WPF TreeView -

i need make searchable treeview. if item matches search text, of parents automatically match , expanded. doesn't match loses visibility. here (sample) interface , filtering code: interface itreeitem : inotifypropertychanged { ilist<itreeitem> children { get; } string header { get; } bool isexpanded { get; set; } bool isvisible { get; set; } } void filter(itreeitem item, string text) { foreach (var subitem in item.children) { filter(subitem, text); } if (item.header.indexof(text, stringcomparison.currentcultureignorecase) >= 0) item.isvisible = true; else { foreach (var subitem in item.children) { if (subitem.ismatch) { item.isvisible = true; item.isexpanded = true; return; } } item.isvisible = false; item.isexpanded = false; } } this question isn't algorithm; works fine , isn't bottlenecking far can t...

After loading React Component present modally from Native, how to dismiss modal from React Native and back to previous in ios -

in current ios project i'm loading react component contains navigation bar navigation item 'cancel' native 'viewcontroller'. when user tap on 'cancel' bar button should previous viewcontroller i.e native. it becomes blocker me. can 1 please me overcome this. native view screenshot react component screenshot below code // viewcontroller.h #import "viewcontroller.h" #import "reactnativeobjcviewcontroller.h" @interface viewcontroller () @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; } - (void)didreceivememorywarning { [super didreceivememorywarning]; } -(ibaction)movetonext:(id)sender { reactnativeobjcviewcontroller *rootviewcontroller = (reactnativeobjcviewcontroller *)[[uistoryboard storyboardwithname:@"main" bundle:null] instantiateviewcontrollerwithidentifier:@"reactnativevc"]; [[self navigationcontroller] pushviewcontroller:rootviewcontroller an...

python - Correct logging for exception in coroutine Python3 + Tornado4.3 + native logging module -

in tornado, exception encapsulated within future , caller async function must yield future unpack exception. how log message correctly print out function name , line exception happens if have long calling chain of async functions ? for example, in code below: format = '%(asctime)s - %(levelname)s - %(filename)s : %(lineno)s'\ ' - %(funcname)20s() - %(message)s\n' logging.basicconfig(format=format) ... @gen.coroutine def layer_2(): return(yield async_func()) @gen.coroutine def layer_1(): return(yield layer_2()) @gen.coroutine def main(): try: yield layer_1() except exception e: logging.warning('error: {}'.format(str(e)) if there exception raised in async_func() , log message lineno , funcname of main() , not of async_func() . is there solution short of try , catch every yield statement ? thanks! edit 1: realized answer question might have nothing tornado, i'm including here because it's cas...

oracle sqldeveloper - performance testing in sql using with clause -

i have 2 sql shown below option 1: select sum(amount)/case when sum(amount) = 0 100 else sum(amount) table_01; option 2: sample_01 ( select sum(amount) amount table_01 ) select amount/case when amount =0 100 else amount sample_01; which option practice in terms of performance perspective , why best ?. felt option 2 best because doing sum once , call again , again instead of doing sum again , again in option 2 . help.