Posts

Showing posts from August, 2015

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.

elasticsearch - FilteredQueryBuilder deprecated -

what difference between filteredquerybuilder , queryfilterbuilder both deprecated since 2.0 , alternative java code filteredquerybuilder filteredquerybuilder filteredquerybuilder = querybuilders.filteredquery(termsquerybuilder, null); queryfilterbuilder queryfilterbuilder = filterbuilders.queryfilter(esquerybuilder); since queries , filters have been merged, constructs make no sense anymore. filteredquerybuilder used create filtered query , i.e. scored query constrained set of filters. instead of using filteredquerybuilder , should use a bool/filter created using querybuilders.boolquery().filter(...) or bool/must_not created using querybuilders.boolquery().mustnot(...) if need negate filter queryfilterbuilder used create query filter , i.e. non-scored query inside filtered context. instead of using queryfilterbuilder , should now use bool/must query created using querybuilders.boolquery().must(...) if need , queries or use bool/should create

javascript - How to enable actions on toggle selected items -

Image
i'm developing admin panel on website (python + flask) , came across issue while trying implement select toggle . the table looks following: the toggle has been implemented want make useful. upon clicking 'selected' button want able delete each , every selected item (flag) i'm not exacly sure how can pull off. each flag can individually deleted clicking on glyphicon-trash according following python/html: <button onclick="deleteselected('politician')">selected</button> {% flag in flags %} <tr> <!-- check box --> <td style="width: 60px;"><input type="checkbox" name="politician" value="bar1"></td> <!-- first name --> <td class="col-title">{{flag.flagtitle}}</td> <!-- last name --> <td class="col-description">{{flag.flagreason}}</td> <!-- details --> <td>

ios - Need guidance about NSUserDefaults -

i no errors think i'm missing something. of code done i'm missing loading on viewdidload, , if i'm saving correctly. tried doing saving 2 arrays (testarray , followedarray) not working far. custom objects difficult. don't need code guidance on i'm missing working. the point of app when tableview loads, gets json , displays in section 1, each row has button , when clicked moves row section 0 (also section 1 if clicked again). i'm trying save rows position nsuserdefaults because don't need save json info user left row. in saving rows position, app stream json info ever position in. also, have search controller in app search through items in section 1 not section 0. section 0 = clicked items (followedarray) section 1 = unclicked items (testarray) when test on device, nsuserdefaults doesn't load when app starts when click followbutton not doing anything. not loading correctly or saving or both? hopefully can guide me here, thank you. view

hash - Partition tables in MySQL -

we have mysql table (table_ha) one: name = table_ha +----------+------------------+ | hash_loc | hash_val | +----------+------------------+ | 242342 | 9606075000001005 | +----------+------------------+ | 431231 | 9606075000005208 | +----------+------------------+ | 342344 | 7645345456745536 | +----------+------------------+ | 324254 | 7656453453465788 | +----------+------------------+ | 656456 | 9788674534546766 | +----------+------------------+ | 674453 | 3458752778456834 | +----------+------------------+ | ... | ... | +----------+------------------+ | 765874 | 8796634586346785 | +----------+------------------+ | 864534 | 9834667054534588 | +----------+------------------+ we continuously execute queries following one: select * table_ha (select 1 hash_loc union select 28700 union select 28728 ... union select 28680 union select 28694) t1 on table_ha.hash_loc = t1.hash_loc' we must assume might have thousands of numbers in query

android - Interstitial Ad onBackPressed from default video player -

i making tv channel streaming app when click on channel list view goes activity , pop of player selection comes , after selecting player plays video. implementing admob interstitial ad should displayed directly onbackpressed , after closing ad goes "activity a" (first activity) , not second activity b. works flawelessly when press backbutton goes second activity blank screen , on press ad.how can show ad on backpress default selected video player. here code activty a case 1: = new intent(a.this, b.class); i.putextra("channel","http://id=hbo"); startactivity(i); break; activity b bundle bundle = getintent().getextras(); string channel = bundle.getstring("channel"); uri uri = uri.parse(channel); intent intent = new intent(intent.action_view, uri); intent.setdataandtype(uri, "video/mp4"); startactivity(intent); and onbackpresse

php - WordPress offset posts on home page -

i offset homepage posts 5. have widget @ top shows first 5 already. i use in functions.php offset. , works. problem widget doesn't print out posts beginning anymore. code below add_action('pre_get_posts', 'myprefix_query_offset', 1); function myprefix_query_offset(&$query) { //before else, make sure right query... if (!$query->is_home()) { return; } //first, define desired offset... $offset = 5; //next, determine how many posts per page want (we'll use wordpress's settings) $ppp = get_option('posts_per_page'); //next, detect , handle pagination... if ($query->is_paged) { //manually determine page query offset (offset + current page (minus one) x posts per page) $page_offset = $offset + ( ($query->query_vars['paged'] - 1) * $ppp ); //apply adjust page offset $query->set('offset', $page_offset); } else { //this firs

bash - How to answer command line prompts in script in docker -

i'm running dockerfile looks this: from alexhermstad/arch-pypi2pkgbuild-kolibri maintainer alex hermstad user kol workdir /home/kol/pypi2pkgbuild cmd ["python", "./pypi2pkgbuild.py", "--pre", "kolibri"] within pypi2pkgbuild.py, there's prompt comes up, says: :: proceed installation? [y/n] is there anyway can use docker automatically press 'n' skip installation? searched bit , not find solution using dockerfile. you try send directly script cmd ["start.sh"] #start.sh echo "n" | python ./pypi2pkgbuild.py --pre kolibri if no option, there tool called "expect" handle interactive prompts. expect

java - Use pattern in getAttribute in NiFi -

how can use pattern in getattribute of flowfile? i going write processor receives flowfiles listentcp , listenudp processors. listentcp has property tcp.sender , listenudp hash property udp.sender . how sender property of flowfile. current solution is: string sender = flowfile.getattribute("tcp.sender"); if(sender!=null && !sender.isempty()) { // } else { sender = flowfile.getattribute("udp.sender"); if(sender!=null && !sender.isempty()) { //do } } how can avoid using if . need this: string sender = flowfile.getattribute("*.sender"); there isn't way attribute based on pattern. if there was, return list of multiple attribute values, , still have go through list , find 1 interested in. you make custom processor require attribute "network.sender" , after listentcp , listenudp, have updateattribute processor each of them renames "tcp.sender" "network.sender" ,

How Django processes a request when matched regular expression returned no named groups? -

i have read documentation of django, http/url. have found information how django processes request here , says: if matched regular expression returned no named groups, matches regular expression provided positional arguments. i can't understand happens when regular expression returns no named groups (like "").

javascript - JQuery form submission not working with API -

i trying retrieve date form submission use in smartystreet api request. it's not outputting response api. html: <div class="form-style-5"> <form id="myform"> <fieldset> <legend><span class="number">1</span> input address</legend> <input type="text" id="street" name="street" placeholder="street"> <input type="text" id="city" name="city" placeholder="city"> <input type="text" id="state" name="state" placeholder="state"> <input type="submit" value="submit" /> </fieldset> </form> <fieldset> <legend><span class="number">2</span> results</legend>

c# - Unable to load apps to iPhone from Xamarin Studio -

Image
currently having problems loading iphone testing xamarin studio. when testing in simulator there no errors, although seen in picture above, if switch testing on physical device, errors relating mtouch. furthermore, after plugging phone computer, phone not appear in dropdown. appears @ bottom 'device'. cant find online relates directly issue. running latest stable version of xamarin , xcode. any body know of fix, or experiencing sam problem? this indicates bug in aot compiler. please file bug http://bugzilla.xamarin.com/newbug project can used reproduce error. sometimes it's possible work around disabling incremental builds in project's ios build option

javascript - d3 get element or object under current mousepointer? -

how can object (for example node, edge, path or whatever) under mouse in d3? i want pass mouse on part of svg , console.log element. d3 doesn't have native method this. however, can combine d3.mouse() document.elementfrompoint() in mousemove event: var svg = d3.select("svg"); svg.on("mousemove", function() { var mouse = d3.mouse(this); var elem = document.elementfrompoint(mouse[0], mouse[1]); console.log(elem.tagname) }) <script src="https://d3js.org/d3.v4.min.js"></script> <svg height="150" width="500"> <rect x="50" y="20" width="150" height="100" style="fill:blue;stroke:pink;stroke-width:5;fill-opacity:0.1;stroke-opacity:0.9"/> <ellipse cx="240" cy="50" rx="220" ry="30" style="fill:yellow"/> <ellipse cx="220" cy="50" rx="1

Github, file too large already deleted. -

i had file tried add repo on github limit. unfortunately deleted when push still tried add it. rm dist/img/work.zip fatal: pathspec 'dist/img/work.zip' did not match files how out repo? use git filter-branch . use command git filter-branch --force --index-filter \ 'git rm -r --cached --ignore-unmatch dist/img/work.zip' \ --prune-empty --tag-name-filter cat -- --all after filter branch complete, verify no unintended file lost. now add .gitignore rule echo dist/img/work.zip >> .gitignore git add .gitignore && git commit -m "ignore rule files" now push git push -f origin branch adapted from: git rm - fatal: pathspec did not match files

How to get user name by array values--wordpress php -

i want username instead of userid here code $assignedto = $_post['ticket_id']; //displays ticket id $assignee =$wpdb->get_var("select assigned_to {$wpdb->prefix}wpsp_ticket id ='$assignedto' ");//outputs 183,246,239 $exp_array =explode(',', $assignee);//converts array list var_dump($exp_array);//output { [0]=> string(3) "183" [1]=> string(3) "246" [2]=> string(3) "239" } my output should be 183 = amar 246 = akbar 239 = anthony expected result=amar,akbar, anthony can 1 me on this.

c# - Why doesn't Entity Framework round a 2 decimal place decimal when storing -

this question has answer here: entity framework code first truncating decimals 1 answer is able please explain why ef doesn't round decimal default when value been stored has more decimal places max decimal places in db field. it common sense sort of application round decimal when store-able decimals (decimals configured in db field) shorter calculated value needed stored. at moment me seems though ef treating decimal string , truncating value when storing database table. edit/answer: struggling on looking easy fix: i looking disables truncating. public unitofwork(string connectionstring) { datacontext = new dbcontext(connectionstring); sqlproviderservices.truncatedecimalstoscale = false; } the answer question here expected: entity framework code first truncating decimals because truncating normal behaviour. http:

apache camel - why CAMEL_MESSAGEPROCESSED created in SQL server db -

i want run camel built application stanalone. using maven create standalone jar , execute route.when run mainapp.java main method eclipse or run using camel run code runs expected. when run using java -jar 3 tables camel_messageprocessed, camel_messagetraced,hibernate_sequence created db. not want these tables created. please me find doing wrong. camel, camel-jpa version 2.19.1 hibernate-entitymanager version 5.2.7.final camel-context.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:prop="http://camel.apache.org/schema/placeholder" xmlns:camel="http://camel.apache.org/schema/spring" xsi:schemalocation="http://www.springframework.org/schema/beans classpath:org/springframework/beans/factory/xml/spring-beans-4.3.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.x

Libreoffice Calc - generate list as combination of multiple columns or cell ranges -

Image
i know if there function in libreoffice calc generate list multiple columns or cell ranges. assume have following unique data +------+------+------+ | col1 | col2 | col3 | +------+------+------+ | 1 | | + | | 2 | b | - | | 3 | c | * | | 4 | d | / | | 5 | e | | | | f | | | | g | | +------+------+------+ and want create list of unique rows on sheet, like +-----+---+---+ | 1 | | + | | 1 | | - | | 1 | | * | | 1 | | / | | 1 | b | + | | 1 | b | - | | ... | | | +-----+---+---+ so said, take every unique value col3 , combine col2 , col1. if finished, take unique value col2, run through every col3 values , create rows. after that, take next col1 unique value , repeat on again. as result gain 5*7*4 = 140 unique rows in example. what if need more columns, more unique properties, etc.. thank you! there may pure lo calc solution, easy lo base. create table named col1 1 integer fiel

Ansible & Jinja2 - Set other host in jinja2 -

there master/slave setup. goal: set {{ other_host_of_play }} in jinja2 template. example; the content of node1 should contain node2 tried {{ play_hosts[0] }} , sets first host of play, instead of 'other host'. not sure if allowed this. answer in post @konstantinsuvorov provided. {{ play_hosts | difference([inventory_hostname]) }} how remove or exclude item in ansible template list?

python - Autoprefixer Filter Not Working in Flask_Assets -

i have tried autoprefixer filter work flask_assets following instructions in flask_assets documentation , not appear apply filter. here code: # construct flask app object flask import flask, render_template_string flask_args = { 'import_name': __name__ } flask_app = flask(**flask_args) flask_assets import environment, bundle assets = environment(flask_app) assets.config['autoprefixer_bin'] = 'postcss' assets.config['autoprefixer_browsers'] = [ '> 1%' ] css_min = bundle('../styles/mycss.css', filters='autoprefixer', output='styles/test.css') assets.register('css_assets', css_min) @flask_app.route('/') def landing_page(): html = '<!doctype html public "-//w3c//dtd html 3.2 final//en">\ <head>{% assets "css_assets" %}\ <link rel="stylesheet" href="{{ asset_url }}" type="text/css">\ {% enda

vb.net - .NET .vbproj vs .sln -

what difference between .vbproj , .sln file? a vbproj project file single project. solution file can contain many projects in it, vb or otherwise, have other references things solution files. you can open either in text editor. here solution file, you'll see contains csharp , vb project files. contains various configurations builds seen in configuration manager, such debug or release, , target platforms builds. microsoft visual studio solution file, format version 12.00 # visual studio 15 visualstudioversion = 15.0.26430.6 minimumvisualstudioversion = 10.0.40219.1 project("{fae04ec0-301f-11d3-bf4b-00c04f79efbc}") = "cert", "cert\cert.csproj", "{bf281f9f-13b5-4f4c-bb18-96e07b3c6f8d}" endproject project("{f184b08f-c81c-45f6-a57f-5abd9991f28f}") = "certvb", "certvb\certvb.vbproj", "{439c487e-5da6-4998-93b5-b482a2a8c40a}" endproject project("{f184b08f-c81c-45f6-a57f-5abd9991f28f}&q

sql server - How to terminate SQL script before creating procedure or function -

i have following script in sql server 2014 creating scalar function named getfiscalperiod . script must check existence of function name before creating it . use [databasename] go set ansi_nulls on go set quoted_identifier on go if exists (select * dbo.sysobjects id = object_id(n'[dbo].[getfiscalperiod]') , objectproperty(id, n'isscalarfunction') = 1) --want terminate whole batch return --doesn't work way want --seems terminate if batch go create function [dbo].[getfiscalperiod] () returns int begin return (select max(id) dbo.__fiscalperiod__); end i want terminate whole thing reaches inside if body. ( return ) the problem no matter how change code, either jumps create function giving error: there object named 'getfiscalperiod' in database. or giving syntax error (when try put create function in if clause): 'create function' must first statement in query batch. question is: is there anyway tell sql igno

java - How to set Audio Focus ChangeListener in Android API O? -

since requestaudiofocus(audiomanager.onaudiofocuschangelistener l, int streamtype, int durationhint) deprecated in api o , how set audio focus change listener using audiofocusrequest try use setonaudiofocuschangelistener()

vbscript - VBS automation support error -

i created vbscript add signature active directory user , few user error: line: 216 char: 1 error: class doesn't support automation code: 800a01ae i tried register msscript.ocx , dispex.dll , vbscript.dll , scrrun.dll , , urlmon.dll , still have same error. code part: dim objword, objemailoptions, objsignatureobject set objword = createobject("word.application") set objemailoptions = objword.emailoptions set objsignatureobject = objemailoptions.emailsignature objsignatureobject.newmessagesignature = "lietuviskas signature" objsignatureobject.replymessagesignature = "lietuviskas reply" 216 line is: objsignatureobject.newmessagesignature = "lietuviskas signature" i dont see problem in code. think windows.

tensorflow - How to add all variables under a scope into a certain collection -

in tensorflow python apis, tf.get_variable has parameter collections add created var specified collections. tf.variable_scope not. what's suggested way add variables under variable scope collection? i don't believe there way directly. file feature request on tensorflow's github issues tracker. i can suggest 2 workarounds might try though: iterate on result of tf.all_variables() , , extract variables names ".../scope_name/..." . scope names encoded in variable name, separated / characters. write wrappers around tf.variablescope , tf.get_variable() store variables created inside scope in data structure. i hope helps!

Cannot start oracle database: multiple errors -

i have 3 oracle dbs installed on server separate user. 3 working until server reboot. after wasn't able start database , not able execute other command. $ sqlplus / sysdba sql*plus: release 11.2.0.1.0 production on wed oct 26 04:53:30 2016 copyright (c) 1982, 2009, oracle. rights reserved. connected idle instance. sql> shutdown abort oracle instance shut down. sql> startup mount ora-03113: end-of-file on communication channel sql> shutdown abort ora-24324: service handle not initialized ora-01041: internal error. hostdef extension doesn't exist sql> startup ora-24324: service handle not initialized ora-01041: internal error. hostdef extension doesn't exist sql querires give: error: ora-03114: not connected oracle and connecting sqldeveloper gives an error encountered performing requested operation: ora-01034: oracle not available ora-27101: shared memory realm not exist linux-x86_64 error: 2: no such file or directory 01034. 00000 - "or