Posts

Showing posts from August, 2012

Javascript Canvas one item flickering -

i trying make objects move towards each other in canvas, when meet , overlap 1 should disappear , other should fall down. got animation that, 1 of items flickering. <!doctype html> <html> <head> <style> canvas{border:#666 3px solid;} </style> </head> <body onload="draw(530,15); draw1(1,15);"> <canvas id="canvas" width="600" height="400"></canvas> <script> function draw(x,y){ var canvas = document.getelementbyid('canvas'); var ctx = canvas.getcontext('2d'); ctx.save(); ctx.clearrect(x, y, 600, 400); ctx.fillstyle = "rgba(0,200,0,1)"; ctx.fillrect (x, y, 70, 50); ctx.restore(); x -= 0.5; if(x==300) { return; }; var looptimer = settimeout('draw('+x+','+y+')',5); }; function draw1(w,e){ var canvas = document.getelementbyid('canvas'); var ct

ASP.NET Core System.TypeLoadException DependencyInjection.Extensions.ServiceCollectionExtensions error -

i new asp.net core. while creating simple mvc project got following error. system.typeloadexception not load type 'microsoft.extensions.dependencyinjection.extensions.servicecollectionextensions' assembly 'microsoft.extensions.dependencyinjection.abstractions, version=1.0.0.0, culture=neutral, publickeytoken=adb9793829ddae60'. @ microsoft.extensions.dependencyinjection.optionsservicecollectionextensions.addoptions(iservicecollection services) @ microsoft.extensions.dependencyinjection.mvccoreservicecollectionextensions.addmvccore(iservicecollection services, action setupaction) @ microsoft.extensions.dependencyinjection.mvcservicecollectionextensions.addmvc(iservicecollection services, action setupaction) @ poc.startup.configureservices(iservicecollection services) system.reflection.targetinvocationexception exception has been thrown target of invocation. @ system.runtimemethodhandle.invokemethod(object target, object[] argume

codeigniter 2 - I added cron from cpanel in codeignitor thats not working -

i tried add cron job cpanel below url every minutes , added command /usr/local/lib/php /home/bestofwo/public_html/index.php pilots/rouwadvertenties rouwmediaapi importtest similar below /usr/local/bin/php -f /home/{cpanel_user}/public_html/index.php controller function but cron not running...how can check cpanel ? please suggest try redirect cron output in log file , check if there error cron. /usr/bin/php -q /home/{cpanel_user}/public_html/index.php >> cron.log

php - The result of $_GET is getting corrupted -

i working on password system, email sent , have click on link go page password reset. there information in link encrypted, , supposedly de-encrypted on other side. here example http://www.somewebpage.com?p=8e428904890e31a93c563e1f18c11ff6&c=u2fsdgvkx1+ldnfkzczxragpyya9mgzahauh/wlj3t4= now use $_get['c'] encrypted data. decrypt using decrypt code. now here problem if works decrypt($key,"u2fsdgvkx1+ldnfkzczxragpyya9mgzahauh/wlj3t4="); and gives me original text. but if this. doesn't work decrypt($key,$_get['c']); it gives me mangled characters. the question why doesn't encrypt routine work when user $_get['c'] , works if put string in directly. is web url adding hidden characters or something? if can strip added. the encrypt data contain character not pass through browser correctly. when generate key try use function urlencode() echo '<a href="mycgi?foo=', urlencode($encryptdata), '&quo

c - Force minimum size of linker script section -

i have set of linker script sections interrupt vector table. sections located in ram , loaded ram code. each vector must @ absolute location, there separate section (and separate memory region) each vector. some vectors may not used application, whilst others will. ensure copy code still works need make sure that, if vector not present, equivalent space in rom (two bytes) filled. tried advancing location pointer of course affects vma , doesn't me @ all. how can ensure section takes required amount of space in rom? i.e. how can move lma on if there no data in section? any hints or tips appreciated. i have abridged current linker script below: output_arch(msp430) entry(_start) memory { rom (rx) : origin = 0x9c02, length = 0x61fe vect1 : origin = 0x5b80, length = 0x0002 vect2 : origin = 0x5b82, length = 0x0002 ... vect63 : origin = 0x5bfc, length = 0x0002 } sections { __interrupt_vector_1 : { __vectable_load__

Write a query join sum groupby in laravel -

please me write query. have 2 table: "projects" , "debts" "debts" table have id | project_id | currency_list | total 1 | 1 | 1 | 1000 2 | 1 | 2 | 500 3 | 2 | 1 | 1000 4 | 2 | 2 | 500 ... i need write query take 1000 rows projects , sum "total" group "currency_list" thanks lot :) hey tried hope working :) first should have tow models tables in project model call public function debts(){ return $this->hasmany('app\debt','project_id')->selectraw('debts.*,sum(total) sum')->groupby('currency_list'); } and call in controller $projects = project::with('debts')->get()->toarray(); check dd($projects) array edit : use in controller function $projects = db::table('projects') ->join('debts', 'projects.id', '=', &#

java - Passing parameters in MultiJob Project Jenkins -

Image
i try pass parameter maven profile in multijob project unfortunately jenkins doesn`t see , execute: 'mvn clean install $profile'. know solution? you can specify maven command clean install -dprofile=dev here "profile" parameter , "dev" value.

linux - increase max_allowed_packet size in mysql docker -

we using docker mysql, facing below error while running packet query large (12884616 > 4194304). can change value on server setting max_allowed_packet' variable.; nested exception com.mysql.jdbc.packettoobigexception: packet query large (12884616 > 4194304). can change value on server setting max_allowed_packet' variable. now need increase max_allowed_packet size in mysql configuration, can me on docker command increase max_allowed_packet . as argument container command: docker run -it -e mysql_root_password=my-secret-pw mysql:5.7 --max-allowed-packet=67108864 see "configuration without cnf file" @ https://hub.docker.com/_/mysql/ , copied here posterity: configuration without cnf file many configuration options can passed flags mysqld. give flexibility customize container without needing cnf file. example, if want change default encoding , collation tables use utf-8 (utf8mb4) run following: $ docker run --name some-mysq

linux - Ubuntu --- php composer.phar install runs slow -

memory available : 1 gb free while trying install composer takes time usual more 12 minutes. php composer.phar install any idea ? i found issue! because of mounted partition ( amazon efs ) had issue, composer install went own partition.

Building RXTX with --disable-locks -

i need build rxtx ( http://rxtx.qbang.org/wiki/index.php/main_page ) 64 bit platform --disable-locks. ( target platform ubuntu snappy platform there problem permissions , lock files). the .configure --disable-locks , make seemed run ok. got new .jar file , librxtxserial.so result. however when installed them, following error : java.lang.unsatisfiedlinkerror: gnu.io.rxtxcommdriver.nativegetversion()ljava/lang/string; thrown while loading gnu.io.rxtxcommdriver java.lang.noclassdeffounderror: not initialize class gnu.io.rxtxcommdriver thrown while loading gnu.io.rxtxcommdriver is there else need do? there other object files need copy over. thanks in advance. i solved problem myself. problem configure script not expecting java version higher 1.5 shown here in t extract : case $java_version in 1.2*|1.3*|1.4*|1.5*) #fix_parameters $jpath/jre/lib/javax.comm.properties classpath=".:\$(top):\$(top)/src:" find $jpath/ -name rxtxcomm.jar |head

python - Matplotlib global legend for lots of subplots -

Image
i have problem figuring out how force matplotlib add legend want. the figures have this: i generate 2 paged plot following script: n = 1 trn = true in diff.keys(): plt.subplot(8, 4, n) plt.xlim([0, rounds + 1]) plt.locator_params(axis='y', nbins=5) if peptide_kd[i] == 1e-2: plt.plot(x_cord, [x[0] x in diff[i]], 'ro--', label='asd') plt.plot(x_cord, [x[1] x in diff[i]], 'rv--', label='bsd') else: plt.plot(x_cord, [x[0] x in diff[i]], 'bo--', label='asd') plt.plot(x_cord, [x[1] x in diff[i]], 'bv--', label='csd') plt.title(i) n += 1 if n == 33 , trn: n = 1 trn = false plt.suptitle('ligand energies') plt.locator_params(axis='y', nbins=5) plt.subplots_adjust(hspace=0.35) plt.show() plt.legend(bbox_to_anchor=(-0.05, 1), loc=1) plt.locator_params(axis='y', nbins=5) plt.subpl

system.reactive - C# Rx - ignoring error -

i have stream of independent events, handled asynchronously reactive extension. handler may fail whatever reasons, stream continues on. however, in rx, right after error occurs, automatically unsubscribes. somehow configurable? example: async task<unit> actionasync(int i) { if (i > 1) throw new exception(); i.dump(); return unit.default; } void main() { var sb = new subject<int>(); sb.selectmany(actionasync).subscribe( _ => { }, ex => { ex.dump(); } ); sb.onnext(1); sb.onnext(2); sb.onnext(3); } i'd have following output: 1 exception 3 can achieve without try/catching in actionasync ? there contract of behaviour in rx stream can onnext*(onerror|oncompleted) . in other words 0 or more onnext , 1 of either onerror or oncompleted @ end. so, no can't configure rx. no longer rx if did. what can do, however, write query can retry

c# - OData 4 AspNet: GET by parameter not working -

i'm in process of converting web service use odata. i've created odatacontroller implementation below: public class personcontroller : odatacontroller { public personcontroller() { } public ihttpactionresult get() { return ok(new person()); } public ihttpactionresult get([fromodatauri] int key) { return ok(new person()); } protected override void dispose(bool disposing) { } } and registered model so: var builder = new odataconventionmodelbuilder(); builder.entityset<person>("person"); config.maphttpattributeroutes(); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); config.mapodataserviceroute( routename: "odata", routeprefix: "odata", model: builder.getedmmodel()); the web app deploys without problems, , first function works when call: http://localhos

node.js - Why is execSync not working in my code? -

i'm trying out various child process methods in nodejs. execute linux command, tried code, prints current working directory: var execsync = require('child_process').execsync; function commandoutput(error, stdout, stderr) { if (stderr !== null) { console.error(stderr); } if (error !== null) { console.error('execution error: ' + error); } if (stdout)console.log(stdout); console.log("done"); } var commandtoexecute = "pwd"; execsync(commandtoexecute, commandoutput); console.log("executed"); while works fine if replace execsync exec, above code, i.e, execsync gives following error: execsync(commandtoexecute, commandoutput); ^ typeerror: undefined not function @ object. (/home/user_name/fil.js:24:1) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32) @ function.module._load (module.js:312:12) @ fu

Making an html element created using javascript "required" -

var textbox = function(me) { if (me.checked == false) { var textb = document.createelement('textarea'); textb.name = "address"; textb.id = "address"; textb.required; textb.placeholder = "address"; me.parentnode.appendchild(textb); } setinterval(function() { if (me.checked == false) { me.parentnode.removechild(textb); return false; } }); }; this the java script code wrote display text area (named textb) when radio button selected. though put "textb.required" text area not made compulsory field (that if person selects radio button , not fill address error not returned) please me correct this

Setting up Python's ArgumentParser with two mutually excluding flags where one flag has optional additional flags -

i define following using python's argumentparser: --mutually_exclusive_flag_a stringparameter --mutually_exclusive_flag_b stringparameter --optional_b_flag_one --optional_b_flag_two one can use either mutually_exclusive_flag_a or mutually_exclusive_flag_b, not both. if 1 uses mutually_exclusive_flag_b, 1 can use optional_b_flag_one , optional_b_flag_two. optional_b_flag_one , optional_b_flag_two boolean flags. i see add_mutally_exclusive_group handle selecting mutually_exclusive_flag_a or mutually_exclusive_flag_b. however, not sure how declare if use mutually_exclusive_flag_b, optional_b_flag_one , optional_b_flag_two valid flags. it seems may able use subparsers feature , turn mutually_exclusive_flag_a , mutually_exclusive_flag_b commands. what best option? argparse can't handle complex of test. mutually exclusive groups can't nested, , don't handle other kinds of logic (only xor , not and , or ). i've explored such expansio

swift - Sending json array via Alamofire -

i wonder if it's possible directly send array (not wrapped in dictionary) in post request. apparently parameters parameter should map of: [string: anyobject]? want able send following example json: [ "06786984572365", "06644857247565", "06649998782227" ] you can encode json nsjsonserialization , build nsurlrequest yourself. example, in swift 2: let request = nsmutableurlrequest(url: url) request.httpmethod = "post" request.setvalue("application/json", forhttpheaderfield: "content-type") let values = ["06786984572365", "06644857247565", "06649998782227"] request.httpbody = try! nsjsonserialization.datawithjsonobject(values, options: []) alamofire.request(request) .responsejson { response in // whatever want here switch response.result { case .failure(let error): print(error) // if web service reports error,

pascal - Is TFPGMap thread safe? -

i have question tfpgmap fgl unit in pascal. thread safe? or have use critical section? var map:tfpgmap; begin map:=tfpgmap.create(); (...) cs.enter; map.find('key'); cs.leave; thank answers! :) is tfpgmap thread safe? no not. such classes never threadsafe because we're made way consumers pay price don't want pay price. need implement own synchronisation.

Multiple public directories in Meteor? -

in meteor, can have multiple client , multiple server directories, etc. (ex: /foo/client/ , /bar/client/ ) segment app behavior, example /users/* user management, subs, methods, ui, etc., or /inv/* inventory management, collections, subs, methods, ui, etc., , other parts of app. allow code organisation , separate components , methods app scale better in long term. this works quite far, need add assets each segments of app and, since /public directory content copied on /.meteor/.local/build/programs/web.browser/app , wanted know if possible have multiple public directories, files merged build target? no isn't possible have multiple public directories within single application. disallowed meteor's isobuild system. if want maintain separate /public directories related component functionality, should leveraging meteor packages . packages can have own public assets. "building large apps: tips" hackpad talks how can leverage "packages-for-everyth

New line javascript or asp.net -

i want add new line in code files can under each other. post code js , asp.net link buttons. $(qfiles).each(function (i) { var = document.createelement('a'); var issharepoint = this.issharepoint; var img =document.createelement('img') ; if (issharepoint) { a.target = "_blank"; a.href = this.filepath; img.src = apppath + '/images/pagelink_16x16.png'; } else { var filepath = this.filepath; var filename = this.filename; a.onclick = function() { downloadfile(filepath + "\\" + filename); }; img.src = apppath + '/images/downl

javascript - Cordova App - JPEG(Base64) Image Compression to Thumbnail Image Not working with windows 8.1 App? -

i trying compress jpeg(base64) thumbnail image 256x192. image showing blank after compression. below code createwindowsthumbimage = function (name, type, data_url, callback) { var img, canvas, context, result, dataurl; img = document.createelement("img"); img.src = "data:image/jpeg;base64," + data_url; canvas = document.createelement("canvas"); canvas.width = 256; canvas.height = 192; context = canvas.getcontext("2d"); // fill canvas white color avoid transperent behaviour of png images context.fillstyle = "#ffffff"; context.fillrect(0, 0, 256, 192); // draw image 256*192 dimention*/ context.drawimage(img, 0, 0, 256, 192); dataurl = canvas.todataurl(type); result = getfiledata(type, dataurl); if (type === "image/jpeg") { name = name.substr(0, name.lastindexof(".")) + ".256x192.jpg"; } else { name

android - GridView pinch zoom and infinite (wrap around) scrolling -

Image
i new android. have project in needs work gridview . shown 'n' number of images in single page. task pinch zoom in, zoom out fingers stretching, not single image total screen needs zoom , infinite (wrap around) scrolling like, whenever start scrolling page (contains n images 1 n) after reaching end of page show again 1 n images (same previous page) in next page. when scrolling down above page show images n 1 (n,n-1,n-2,...1). please me solve above conditions. have followed below link show n number of images in page till now. this link followed add view zoomview class zoomview zoomview = new zoomview(this);//this means activity zoomview.addview(view);//view-->your view setcontentview(zoomview);//use inplace setcontentview(r.layout.xxxxx); hope helpful public class zoomview extends framelayout { /** * zooming view listener interface. * * @author karooolek * */ public interface zoomviewlistener { void onzoomstarted(float zoom, floa

spring - Cannot use expression in where clause -

i want implement server-side filtering of datatable. here service method retrieving list : @override @transactional public list<user> list(int start, int length, string search, int triidx, string ordretri) { string hql = "from user "; if (!search.equals("") && search != null) { hql = hql.concat(" "); if (numberutils.isnumber(search)) hql = hql.concat(" salary "); else hql = hql.concat(" lower(username) "); hql = hql.concat(" lower('%:critere%') "); } if (ordretri.equals("asc")) { switch (triidx) { case 0: hql = hql.concat(" order username "); break; case 1: hql = hql.concat(" order email "); break; case

html - Input type number arrows bug with mozilla -

Image
i removed regular input arrows following code: input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; -moz-appearance: none; appearance: none; margin: 0; } it works in browsers newest mozilla firefox. doing wrong or why arrows wont dissapear? nevermind figured out.. here solution: input[type=number] { -moz-appearance:textfield; }

SQL Server 2016 : WHERE statement evaluation -

i have this declare @par int = null select count(distinct(t1.id)) my_table t1 left outer join some_other t2 on t1.a = t2.b @par null or t2.c = @par @par null. where clause commented out, query fast, when uncommented - slow. result same. why? can't spot first part of or statement true , not evaluate second? how best fix (make fast when @par null). sql server 2016 try this, declare @par int = null if @par null begin select count(distinct(t1.id)) my_table t1 end else begin select count(distinct(t1.id)) my_table t1 inner join some_other t2 on t1.a=t2.b t2.c = @par end if wish use left join approach try below, prevent loading join table when parameter has null value. select count(distinct(t1.id)) my_table t1 left outer join some_other t2 on t1.a=t2.b , @par not null -- prevent loading table when @par null @par null or t2.c = @par

Teamcity - build solution with missing dll in subverion -

i trying configure teamcity ci build our subversion repository. 1 of dll required build solution doesn't exists in our subversion repository big uploaded subversion. of course ci build fails cant find dll. how teamcity build work? download files svn local directory on build server , build? wondering if can manually copy large missing dll build directory (if there one) or there other solutions problem? thanks suneeth

swift - How to open app from email URL in iOS 9? -

i've tried like: in appdelegate: func application(application: uiapplication, handleopenurl url: nsurl) -> bool { var returnvalue = false let urlstring = url.absolutestring print(urlstring) if(urlstring.hasprefix("")){ returnvalue = true } return returnvalue } in info.plist <key>cfbundleurltypes</key> <array> <dict> <key>cfbundleurlname</key> <string>co.example.exampleapp</string> <key>cfbundleurlschemes</key> <array> <string>example</string> </array> </dict> </array> but doesn't work. want app opens link send via email, has idea make work? for future users, @isashok mentioned in comments, handleopenurl function is deprecated of ios 9 . for newer versions of ios need use following function ( apple docs ): optional func application(_ app: uiapplication,

android - custom font for both ios and andriod in react native -

i follow this install custom in rn. works in android not in ios. when running on ios, shows error font not found. how make work both ios , android? simply create 'assets' folder in root of project (or wherever want), drop in font files, , define in project's package.json. "rnpm": { "assets": ["assets"] }, then, run react-native link , besides linking 3rd party modules, link fonts put in there respective project files. from react native: things wish knew before starting out.

jquery - Is it possible to move and slide table row to the left? -

i have simple html table , want move animate paging action. example, each page loads 3 table rows supposed replace current onscreen table rows. i'd animate first 3 rows slide out left, , next 3 ones slide in right. i can't seem come solution using html table tag, i'd avoid styled lists or divs if possible. here's example, active class should visible on first page, when click next button, first 3 rows should slide out left, , second 3 should slide in right. https://jsfiddle.net/ba0alker/ <table> <tr class="active"> <td>one</td> </tr> <tr class="active"> <td>two</td> </tr> <tr class="active"> <td>three</td> </tr> <tr> <td>four</td> </tr> <tr> <td>five</td> </tr> <tr> <td>six</td> </tr> </table> <button id="prev">pre

php - Unable to post image and text to database. Receiving no errors -

hey guys having issues php file supposed allow user post status along picture uploaded server , path along username of user added db. db colomns: postid (a.i) username status imagepostpath timestamp (added automatically inserting new entry) extra info: have changed code 1 of working ones, when attempt test php file postman error "[]". i'm not familiar php if see mistake i'm making simple, please me understand :) here code: <?php //importing dbdetails file require_once 'dbdetails.php'; //this our upload folder $upload_path = '000002/'; //getting server ip $server_ip = gethostbyname(gethostname()); //creating upload url $upload_url = 'http://'.$server_ip.'/users/images/'.$upload_path; //response array $response = array(); if($_server['request_method']=='post'){ //checking required parameters request if(isset($_post['name']) , isset($_files['image']['n

javascript - How to forEach over a whole stream after a set interval in RxJS -

i have stream of zip codes want iterate on after set interval. i'm trying update temperature shown on page sending zip codes , getting data api. have send 1 @ time. need able distinct zip codes after interval , iterate on whole stream. want update temperature on page. // stream of zip codes const zipcodestream = rx.observable .fromevent(zipcodeinput, 'input') .map(e => e.target.value) .filter(zip => zip.length === 5); // create timer refresh data rx.observable .interval(5000) .zip(zipcodestream, ([i, zip]) => zip) .foreach((...args) => { console.log('interval foreach args', ...args); }); this sends single zip code when new zip code entered , interval has passed. want access them iterate over. since want save item emitted zipcodestream can iterate on them every 5 seconds, you'll need use replaysubject . these save items emitted, , replay them whenever observer subscribes. in contrast, current zipcodestrea

networking - Kafka Docker network_mode -

i'm trying kafka , running on mac using docker compose. this docker-compose.yml file: version: '2' services: zookeeper: image: ******** network_mode: "host" hostname: "zookeeper" environment: - "myid=1" ports: - "2181:2181" - "3888:3888" mysql: image: ******* network_mode: "host" hostname: "mysql" environment: - "mysql_root_password=password" ports: - "3306:3306" schema-registry: image: ******** network_mode: "host" hostname: "schema-registry" environment: - "zookeeper_url=127.0.0.1:2181" ports: - "8081:8081" kafka: image: ********** network_mode: "host" hostname: "kafka" environment: - "service_name=localhost" - "service_tags=syracuse-dev" - "kafka_advertised_host_name=localhost"

xcode - Clean interface builder compilation -

i want use ibdesignable , ibinspectable display custom views. worked fine until made errors. fixed them interface builder still renders old state of view. guess is using old files. there way clean or clear derived data interface builder? shift-command-k clean , option-shift-command-k clear data they under product menu dropdown if prefer mouse. source: https://developer.apple.com/library/content/documentation/ides/conceptual/xcode_help-command_shortcuts/menucommands/menucommands014.html#//apple_ref/doc/uid/tp40010560-ch2-sw16

java - Can't acces TextView defined in onCreate -

this question has answer here: how declare textview variable can use anywhere? 2 answers i still java beginner , have problem have onclick function , of course oncreate in define textview value. when want edit textview onclick can't that. know how can make textview value "global". final textview result = (textview) findviewbyid(r.id.result); you have instantiate textview after setcontentview() method : public class mainactivity extends activity { textview textview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview = (textview)findviewbyid(r.id.textview); } }

Java Fully Qualified Class name, running from Terminal -

please excuse confusion, have searched topic on stack overflow not understand answers. green. using eclipse create first java program, compiles , runs successfully. package com.java24hours; class saluton { public static void main (string[] arguments) { //my first java program goes here string greeting = "saluton mondo!"; system.out.println(greeting); } } so trying run in terminal on mac. file path have /users/admin/documents/java/java24/com/java24hours i try run in java24hours directory "java saluton.java" , return "error: not find or load main class saluton.java" it understanding has package. have researched package names not understand how qualified name works classes , packages. while compiles in ide, make compile in terminal , understand why did not compile way wanted to. thank patience. you missing several elements. one answer , comment pointed out haven't compiled source code yet

angular - import HTTP_PROVIDERS in app.component.ts -

when try import http_providers angular/http have error: error:(3, 9) ts2305: module '"projectname/node_modules/@angular/http/index"' has no exported member 'http_providers'. this file content: import { component } '@angular/core'; import {githubservice} './services/github.service'; import {http_providers} '@angular/http'; @component({ selector: 'my-app', template: '<h1>my first angular 2 app</h1><profile></profile>', providers: [ http_providers, githubservice ] }) export class appcomponent { } if use >= rc.5 add httpmodule imports in @ngmodule instead: @ngmodule({ imports: [httpmodule], ... }) class appmodule {}

networking - Assign different IPs to different Docker container -

i need run 2 containers each containing script binding on specific (public) ip (11.11.11.22 , 11.11.11.23) the docker host on 10.10.10.222. i have subnet 11.11.11.20/27, gateway 11.11.11.21 if matters server @ softlayer. docker-compose.yml version: '2' services: nginx-0: image: nginx:1.10 ports: - 11.11.11.22:80:80 networks: app_net: ipv4_address: 11.11.11.22 nginx-1: image: nginx:1.10 ports: - 11.11.11.23:80:80 networks: app_net: ipv4_address: 11.11.11.23 networks: app_net: driver: bridge ipam: driver: default config: - subnet: 11.11.11.20/27 gateway: 11.11.11.21 ip a 3: eth1: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state group default qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff inet 10.10.10.222/27 brd 10.10.10.223 scope global eth1 valid_lft forever preferred_lft forever inet 11.11.11.22/32

JavaScript closure inside loops – simple practical example -

var funcs = []; (var = 0; < 3; i++) { // let's create 3 functions funcs[i] = function() { // , store them in funcs console.log("my value: " + i); // each should log value. }; } (var j = 0; j < 3; j++) { funcs[j](); // , let's run each 1 see } it outputs this: my value: 3 value: 3 value: 3 whereas i'd output: my value: 0 value: 1 value: 2 the same problem occurs when delay in running function caused using event listeners: var buttons = document.getelementsbytagname("button"); (var = 0; < buttons.length; i++) { // let's create 3 functions buttons[i].addeventlistener("click", function() { // event listeners console.log("my value: " + i); // each should log value. }); } <button>0</button><br> <button>1</button><br> <button>2</button>

java - Text check in every page (Selenium) -

using java, trying write general check particular text on every page in web application existing tests visit. instead of having write on each , every page individually, possible in 1 place @ high level (may in base class)? public class baseclassforuitest { public baseclassforuitest() { ... } public void test() throws exception { boolean isnewpage = checkifnewpage(); if (isnewpage) // perform text check on page } } every test extends baseclassforuitest , overrides test() method. instead of having write on each , every page individually, possible in 1 place @ high level (may in base class)? yes, possible implementing webdrivereventlistener baseclassforuitest , override event handler methods handling appropriate webdriver events according need in 1 place. here every method corresponds event. accord

r - Shiny: add button label to sidebar & update buttons after click -

i'm bit rusty shiny reactivity, want 2 things when button clicked: add button label sidebar (and add more labels sidebar after more clicks) update button labels (i.e. more random integers) i'm nervous changing label before recording it, want timing right. here's skeleton of i'm working with: library(shiny) ui <- fluidpage( sidebarlayout( sidebarpanel( textoutput("clicks") ), mainpanel( uioutput("button1"), uioutput("button2") )) ) ################### server <- function(input, output, session) { output$clicks <- rendertext({ paste() }) ## reactive values inside <- reactive({ inside <- sample(1:100,2) }) ## buttons output$button1 <- renderui({ actionbutton("course1", label = inside()[1], style='padding:50px') }) output$button2 <- renderui({ actionbutton("course2", label = inside()[2], style='padding:50p

python - Fill NaN values -

i have dataframe timestamp p_act_kw periode_tarif p_souscr 2016-01-01 00:00:00 116 hc 250 2016-01-01 00:10:00 121 hc 250 2016-01-01 00:20:00 121 nan 250 to use dataframe, must fill nan values (hc or hp) based on condition: if (hour extracted timestamp in {0,1,2, 3, 4, 5, 22, 23} so replace nan hc, else hp. did function: def prep_data(data): data['periode_tarif']=np.where(data['periode_tarif']in (0, 1,2, 3, 4, 5, 22, 23),'hc','hp') return data but error: valueerror traceback (most recent call last) <ipython-input-23-c1fb7e3d7b82> in <module>() ----> 1 prep_data(df_energy2) <ipython-input-22-04bd325f91cd> in prep_data(data) 1 # nettoyage des données 2 def prep_data(data): ----> 3 data['periode_tarif']=np.where(data['periode_tarif']in (0, 1),'hc','hp') 4 return data c:\users\demonstrator\anaconda3\lib\site-pac

android - Is possible to update the sound of current notification? -

i have helper class helps me building , showing 1 notification 2 states. in constructor i'm initializing notificationcompat.builder common settings both states. in 1 method ( shownotificationcircle() ) i'm showing notification circle icon, texts , 'click' sound. in method ( shownotificationrect() ), i'm showing notification icon, texts , sound when notification appears still same sound no matter method used. this constructor: public notifhelper(context context) { clicksounduri = uri.parse("android.resource://" + context.getpackagename() + "/" + r.raw.click_sound); bulbsounduri = uri.parse("android.resource://" + context.getpackagename() + "/" + r.raw.bulb_sound); builder = new notificationcompat.builder(context); builder.setcontenttitle(context.getstring(r.string.some_text_1)) .setcolor(context.getresources().getcolor(r.color.white)) .setautocancel(false)

Can I mix Persistent FSM and at-least-once-message delivery in Akka -

akka provides a persistent actor at-least-once message deliver ( link ) a persistent fsm ( link ) can mix two? want able maintain persistent state machine, have stage changes trigger events send messages other actors at-least-once message deliver guarantee i had same question myself, , since there no answer anywhere on net - took akka user list. in short, should work not tested. moreover, there's no java api available mixin of above 2 traits. i plan test such mixin in next month or 2 , provide feedback. see following more details: akka user list topic akka ticket track issue

c# - Unity mesh triangles flipped -

Image
i'm trying make function takes in height map , creates single isometric mesh based on input. got make triangles represent top of cubes getting go down sides of cubes seem having trouble. function isnt complete , makes 2 of sides ran trouble before finishing it. basically seems happening triangles flipped , others aren't , have no idea why. can see there sides have both triangles facing same direction while others have 1 of triangles visible second on of square facing other way. it seems making square runs 1 side of mesh other leaving long lines. i'm new meshes , 3d in general , though easier has turned out be. pretty sure way map uv totally wrong come @ later time. public static meshdata generateisomesh(float [,] heightmap, int heightmax, animationcurve heightcurve) { int height = heightmap.getlength(0); int width = heightmap.getlength(1); int trianglenum = 0; int blockheight = 0 ; int nextheight = 0; int heightdif = 0; list<vec

qml - CircularGauge displayed incorectly - its size is tiny -

Image
i learning style qml's circural gauge , here code chunk: now, background property of circuralgauge basicly identical example's one : background: canvas { onpaint: { var ctx=getcontext("2d"); ctx.reset(); ctx.beginpath(); ctx.strokestyle="steelblue"; ctx.linewidth=outerradius*0.02; ctx.arc(outerradius, outerradius, outerradius-ctx.linewidth/2, degreestoradians(valuetoangle(80)-90), degreestoradians(valuetoangle(100)-90)); ctx.stroke(); } // onpaint } // background however, abnormal gauge (tiny one) can see: why/what missing? i've managed solve problem. not problem in circural gauge itself, in other component's layout settings: layout.fillheight: true . i've set false , works. here complete code item : import qtquick 2.7 import qtquick.layouts 1.3 import qtquick.controls 1.4 import q