Posts

Showing posts from March, 2011

java - Sending the same but modifed object over ObjectOutputStream -

i have following code shows either bug or misunderstanding on part. i sent same list, modified on objectoutputstream. once [0] , other [1]. when read it, [0] twice. think caused fact sending on same object , objectoutputstream must caching them somehow. is work should, or should file bug? import java.io.*; import java.net.*; import java.util.*; public class oos { public static void main(string[] args) throws exception { thread t1 = new thread(new runnable() { public void run() { try { serversocket ss = new serversocket(12344); socket s= ss.accept(); objectoutputstream oos = new objectoutputstream(s.getoutputstream()); list same = new arraylist(); same.add(0); oos.writeobject(same); same.clear(); same.add(1); oos.writeobject(same); } cat...

file upload - how to add and import multipart library in android studio -

i want add multipart entity library in project please show me way how can download library , add, import android studio 1.2.2.0 thank you. i'm answering late maybe, faced problem today , didn't find responses. maybe might still help. first answer in so. so use multipart library in android studio, can download httpcomponents-client-4.x apache site , put httpcore-4.x.jar , httpmime-4.x.jar in libs folder of project directory. , update build.gradle file - android { .... packagingoptions { exclude 'meta-inf/dependencies' exclude 'meta-inf/notice' exclude 'meta-inf/license' exclude 'meta-inf/license.txt' exclude 'meta-inf/notice.txt' } .... } and in dependencies add- dependencies { compile filetree(include: ['*.jar'], dir: 'libs') ... compile files('libs/httpcore-4.x.jar') compile files('libs/httpmime-4.x.jar') ...

java - GSON Expected BEGIN_ARRAY but was BEGIN_OBJECT? -

i start learn gson. see lot of topic error, don't find or answer corresponding of problem. i'm trying parse json string one: { "codeanalytique": "xxxx", "domaine": "xxxx", "habilitationad": [ { "key": "xxxx", "value": [ { "applicatif": "xxxx", "cle": "e", "role": "red", "valeur": "xxxx" }, { "applicatif": "xxxx", "cle": "e", "role": "red", "valeur": "xxxx" } //lot of other value ] } ], "habilitationinterprete": [ { "key": "xx", "value": [ { "applicatif": "xxxx", "cle": ...

c# - Instantiate interface when null -

i working interfaces first time create loosely coupled code. in 1 of classes have following constructor: public exceptionhandler(string loglocation = null, icanlocalize localizer = null) the localizer in constructor optional , null default (since not wants localize class). right have class localizer implements interface. class has constructor parameters full functionality , constructor without parameters basic null checking. mean both constructors set bool indicates if class initialized. in case it's not (empty constructor) default values returned without localizing them. so in code can have _localizer.getstring("key", "optional fallback value"); in case it's initialized return 'key' in english or 'sleutel' in dutch. if not initialized, 'optional fallback value' returned (or key if no fallback value set). in order achieve behavior following in constructor of exceptionhandler : _localizer = localizer ?? new localizer(...

sql - Why does Oracle 12c query require double quotes around table -

this question has answer here: ora-00942: table or view not exist - oracle 1 answer the database i'm querying oracle 12c. detailed info database version follows: oracle database 12c enterprise edition release 12.1.0.2.0 - 64bit production pl/sql release 12.1.0.2.0 - production i'm trying eliminate need have double quotes around every view or table in sql query. following works (from oracle sql developer gui) select m."metadata" "evmetadata" m following gives error (from oracle sql developer gui) select m.metadata evmetadata m error is ora-00942: table or view not exist 00942. 00000 - "table or view not exist" *cause: *action: error @ line: 2 column: 6 i generated ddl, looks this create table "evp"."evmetadata" ("evmetadataid" number(10,0) generated identity minvalu...

java - How to instantiate a HashMap<K, V>? -

first of all, i'm not expert of generics, attempted create class persist type of object specified path using following approach. public class persistentobject<t> { /** * persisted object class. */ private class<t> clazz; /** * persisted object. */ private t object; /** * path of file object persisted */ private string path; public persistentobject(string path, class<t> clazz) { this.clazz = clazz; this.path = path; load(); //load file or instantiate new object } } it works fine, i'm not able use t class implement interface map<k, v> , because of clazz constructor parameter. here i'm trying achieve: persistentobject<string> test = new persistentobject<string>("path", string.class); persistentobject<hashmap<string, integer>> test2 = new persistentobject<hashmap<string, integer>>("path", hashmap<string, integer>.clas...

foreach - Parallel processing MODIS images in R -

i have downloaded vegetation data modis africa , trying yo create mosaics images , save them geo tif. have no problem doing until try run in parallels on macpro 6cores, 12 threads. code runs uses 1% of cores availability , takes ever complete processes. i need help, have more 70gb of modis granules need convert mosaic , if don't use computer power got in lab take ever. here code part of parallel processing: there 2 parts run in parallel, 1. select ndvi; 2. create mosaics, project them , save them .tif. # register cluster 10 cores registerdoparallel(cores=11) micluster<-makecluster(11) registerdoparallel(micluster) library(domc) registerdomc(11) # 1. # select ndvi each africa granule , put in sdslist sdslist <- foreach(k = 1:length(dategranules), .packages=c("raster", "gdalutils","foreach"))%dopar%{ for(j in 1:1:length(dategranules)){ return(sapply(x=dategranules[[j]], fun=function(x){get_subdatasets(x)[1]})) } } 2. # genera...

javascript - Move icon down on hover with jQuery -

i have icon on page , i'd animate it's position down page little jquery. happen on hover. move down 40px. when off hover, move was. <i class="fa fa-chevron-circle-down"></i> demo: http://jsfiddle.net/5uamyea1 why not css? https://jsfiddle.net/5uamyea1/ .fa{position:relative;transition:top 0.5s;top:0} .fa:hover{top:20px}

javascript - Unable to get property '1' of undefined or null reference for Highcharts in IE8 -

i'm trying use highchart in ie8 error: unable property '1' of undefined or null reference according website, highcharts works down ie6, should work fine in ie8... works fine in other browsers i've tested on. any ideas problem is? i've set fiddle here errors when tested in ie8: http://jsfiddle.net/w1ebp44w/ (probably best test full result in ie: http://jsfiddle.net/w1ebp44w/embedded/result/ ) the code follows: highcharts.theme = { colors: [ '#5e2750', '#eb9700', '#007c92', '#a8b400' ] }; var highchartsoptions = highcharts.setoptions(highcharts.theme); // radialize colors highcharts.getoptions().colors = $.map(highcharts.getoptions().colors, function(color) { return { radialgradient: { cx: 0.5, cy: 0.3, r: 0.7 }, stops: [ [0, color], //[1, highcharts.color(color).brighten(-0.1).get('rgb')] // darken ] }; }); // ...

javascript - Chrome Extension to Redirect to URL with Parameter -

i'm attempting create chrome extension add parameter end of url if url matches given pattern ( *://*.mydomain.com/s/* ). below manifest file , background script have, cannot working. doing wrong? manifest.json: { "manifest_version": 2, "name": "search grid view", "version": "0.1", "description": "changes mydomain.com search grid view default", "background": { "scripts": ["background.js"] }, "permissions": [ "tabs", "webrequest", "*://*.mydomain.com/s/*", "webrequestblocking" ] } background.js: chrome.webrequest.onbeforerequest.addlistener( function(details) { var currenturl = tabs[0].url; var newurl = currenturl + "&style=gridview" return { redirecturl: newurl}; }, { urls: [ '*://*.mydomain.com/s/*' ], types: ['ma...

Moving postgresql 9.4 data directory in fedora 22 -

i know how move postgresql database directory in fedora 22 installation. in ubuntu, straightforward using pg_dropcluster , sudo pg_createcluster -d /the/new/location/ 9.4 main , fedora not appear have of sort. i copied directory /var/lib/pgsql/data new location and, did following: su - postgres service postgresql stop export pgdata="/the/new/location/" echo $pgdata # gives correct /the/new/location/ service postgresql start psql show data_directory; which still results in default /var/lib/pgsql/data ... could please either provide link relevant , up-to-date tutorial or explain how complete move? note: aware question has been answered other distributions , older versions of fedora , psql, seems lot of files have been moved , none of approaches seem work me. so turns out method out of date. correct way add file nano /etc/systemd/system/postgresql.service : .include /lib/systemd/system/postgresql.service [service] environment=pgdata=/the/new/location/ ...

android - WhatsApp background running system -

i interested know how whatsapp runs in android background system after cleaning ram cleaner. made android app in started service , broadcast receiver when cleaned using ram cleaner, both got stopped. push notifications not received when app not running in background. so, wanted know how whatsapp manages this. giving example whatsapp because found system amusing. if return start_sticky onstartcommand() , system automatically restart service once determines not resource strained. means restart if have killed using app killer. @override public int onstartcommand(intent intent, int flags, int startid) { return start_sticky; } http://developer.android.com/reference/android/app/service.html#start_sticky

SQL query exception -

the following query excludes accounts amt balance 0. although trying make exception accounts l1_org_seg_id = 101, 102 , 105 if it's value equal 0. can point me right direction? thanks! select 'table' cola ,o.l1_org_seg_id colb ,a.l1_acct_seg_id colc ,a.l2_acct_seg_id cold ,a.l3_acct_seg_id cole ,' ' colf ,a.acct_name colg ,'usd' colh ,sum(g.amt) coli ,' ' colj ,' ' colk ,' ' coll ,' ' colm ,'4' coln ,'2015' colo ,'4/24/15' colp ,' ' colq ,' ' colr ,' ' cols ,' ' colt ,' ' colu ,' ' colv gl_post_sum g inner join acct on a.acct_id = g.acct_id inner join org o on o.org_id = g.org_id g.fy_cd = '2015' , g.pd_no < 5 , a.s_acct_type_cd in ( 'l' ,'a' ) , g.org_id not 'j%' , a.active_fl = 'y...

android - read file from external storage -

i cannot find how 1 specified file external storage. know getexternalstoragepublicdirectory(), external storage directory can't further. need kind of method have give name of file , returns file. thanx better using file.separator this, standard java: final file file = new file(environment.getexternalstoragedirectory() .getabsolutepath(), filename);

coordinates - JAVA proper lat/long coords for google street view URL -

i working on getting coordinates application , being able lookup/display street view of location. doing getting lat long of point in application, building url parameters shown here: https://developers.google.com/maps/documentation/streetview/intro issues know coordinates on street due nature of application, google maps url saids "sorry have no imagery here" when attempting visit url display picture. code below: igeometry shape = closeststationorspanfw.getifeature().getshapecopy(); ipoint point = null; if (shape instanceof ipoint) { point = (ipoint) shape; } double xcoord = point.getx(); double ycoord = point.gety(); system.out.println("original x coordinate: " + xcoord); system.out.println("original y coordinate: " + ycoord); geometryutil.projectlatlong(point); system.out.println("new coords: " + point.getx() + " " + point.gety()); i think there may issue spatial reference us...

sql - MySQL Working out number of orders by customer in the previous year -

wondering how done in mysql - need number of orders in previous year order, if made 3 orders (1.1.13, 1.7.13 , 1.1.15 first , last orders 0 there no bookings in previous year middle 1 1 there booking 6 months before). something gets first three, not sure how total? select order_no, email, order_date table.orders order_no email order_date prev_yr_orders 143254 example@example.com 25/07/2013 1 646743 example@example.com 24/09/2013 2 757743 example@example.com 16/02/2014 3 993253 example@example.com 23/02/2014 4 535325 example@example.com 31/03/2015 1 you can using correlated subquery: select o.*, (select count(*) orders o2 o2.email = o.email , o2.order_date < o.order_date , o2.order_date >= o.order_date - interval 1 year ) numordersprevyear orders o;

php - POST with curl not working. But can be done with form -

want post request site: https://api.telegram.org/mytoken/sendphoto created form that: <!doctype html> <html> <body> <form action="http://api.telegram.org/mytoken/sendphoto" method="post" enctype="multipart/form-data"> select image upload: <input type="file" name="photo" id="photo"> <input type="hidden" value="108432389" name="chat_id"> <input type="submit" value="upload image" name="submit"> </form> </body> </html> it works good. following headers sent: -----------------------------25522111424583 content-disposition: form-data; name="photo"; filename="untitled.png" content-type: image/png png i write following script curl: <?php $ch = curl_init('https://api.telegram.org/token/sendphoto'); $cfile = new curlfile('ur.png','image/png...

Iterate over all possible combinations of list elements and use as indices in Python -

i have following list: indices = [125,144,192] i want generate such structure want use combination of 3 of these numbers indices 3d list: mylist[i][j][k] = somevar where i , j , , k loop on of combinations shown below: i,j,k = 0,0,0 i,j,k = 0,0,192 i,j,k = 0,144,0 i,j,k = 125,0,0 i,j,k = 0,144,192 i,j,k = 125,0,192 i,j,k = 125,144,0 i,j,k = 125,144,192 in other words, i'd simplify following: for in [0,125]: j in [0,144]: k in [0,192]: mylist[i][j][k] = somevar what pythonic way this? you can use itertools.product : >>> list(product([0,125],[0,144],[0,192])) [(0, 0, 0), (0, 0, 192), (0, 144, 0), (0, 144, 192), (125, 0, 0), (125, 0, 192), (125, 144, 0), (125, 144, 192)] or more general solution can use izip (in python 3 zip efficient ) , repeat create desire pairs , pass them product : >>> indices = [125,144,192] >>> itertools import product,izip,repeat >>> list(produc...

Single HTML Form to Multiple PHP Scripts -

i new php programming , have question best way handle input same form can go 2 different php pages. for example have database of projects , parameters, users can select relevant options submit form either preview script, displays of data on new page, or download option allows users download selected data in csv format. <input type="submit" value="download" name ="download"/> <input type="submit" value="preview" name="preview"/> currently input sent single php script uses if statement determine best course of action if($_post['download']){ ... }else if($_post['preview']){ ... } but seems messy way go handling situation. there easy way and/or best practice for creating handler php script passes relevant information more specific php file, in example split download , preview download.php , preview.php or reuse entries form 1 php script another, example user presses preview but...

c# - Autofac injects objects with the same reference -

i keep getting reference same object. can see in constructor there 2 objects same type. expect 2 different instances whenever set property of _player1, _player2 being set accordingly same value. doing wrong? thanks ioc container public static void configurecontainer() { var builder = new containerbuilder(); builder.registercontrollers(typeof(mvcapplication).assembly); builder.registerinstance<iplayer>(new player()); var container = builder.build(); dependencyresolver.setresolver(new autofacdependencyresolver(container)); } controller constructor public flaggamecontroller(iplayer player1, iplayer player2) { _player1 = player1; _player2 = player2; _currentplayer = player1; } when builder.registerinstance you setting return same instance. if want return different instance every time, use builder.registertype<player>().as<iplayer>().instanceperdependency(); ref - http://docs.autofac.org/en/latest/lifetime/...

Google Analytics - using properties -

i have client has site (website a), people go off buy tickets on website b. i want track full experience using google analytics, can see how people arrived, how many people converted etc. now, think best keep 2 analytics profiles separate, ticket pageviews have no impact on main site. can achieve using google analytics properties under 1 account. recommend best way or should tracking them under same tracking id or other? there can arguments using 1 property or using 2 properties. should give more details on functions. however prefer use single property both sites based on description allow treat user's journey across both sites in more unified way, example goals , funnels defined across both sites , have data both in single dashboard or report. can set 2 views see each site separately. going other way not possible. finally - if use google tag manager can change setup 1 other in minutes.

java - How to use sftp in the mule flow after writing a file? -

i have orchestration flow calls subflow write file , next flow (via flow ref) sftp it. writesubflow <file:outbound-endpoint path="${outputdir}" outputpattern="${filename}" responsetimeout="10000" doc:name="write file"/> <logger message="file ${filename} written ${outputdir}" level="info" doc:name="end"/> then call flow (via ref) kicks off sftp process. <flow name="sftp"> <file:inbound-endpoint path="${outputdir}" connector-ref="file" responsetimeout="10000" doc:name="file"> <file:filename-regex-filter pattern="${filename}" casesensitive="true"/> </file:inbound-endpoint> <sftp:outbound-endpoint exchange-pattern="one-way" connector-ref="sftp" responsetimeout="10000" ref="endpoint" doc:name="sftp" /> </flow> the pro...

node.js - Error: cmd: Command failed with exit code 1 -

i got error when try run "d:\myapp\app>ionic build android" command.upto processes work .can 1 tell me proper solution that.thanks in advance. d:\myapp\app>ionic build android running command: "c:\program files (x86)\nodejs\node.exe" d:\myapp\app\hooks\aft er_prepare\010_add_platform_class.js d:\myapp\app add body class: platform-android running command: cmd "/s /c "d:\myapp\app\platforms\android\cordova\build.bat"" android_home=c:\users\rajitha\appdata\local\android\android-sdk java_home=c:\program files\java\jdk1.7.0_79 running: d:\myapp\app\platforms\android\gradlew cdvbuilddebug -b d:\myapp\app\pl atforms\android\build.gradle -dorg.gradle.daemon=true failure: build failed exception. i can not understand telling me.because set environment variables ex-java,android * went wrong: problem occurred configuring root project 'android'. > not resolve dependencies configuration ':classpath'. > not reso...

osx - Install node.js on OS X 10.11 -

i have updated el captain. trying install node.js homebrew , have error: ==> ./configure --prefix=/usr/local/cellar/node/0.12.7 --without-npm --without-ssl2 --without-ssl3 ==> make install ld: library not found -lgcc_s.10.5 clang: error: linker command failed exit code 1 (use -v see invocation) i have set of questions: is problem specific el captain? is problem related different versions of system libraries? will problem disappeared after time, when formula update? can fix formula myself install node.js right now? installing xcode 7 beta solved problem.

Java Hibernate Criteria Many-To-One -

i trying use hibernate many-to-one relationship, shown below: i have service table , each service, have programid. public class service { ... @manytoone @joincolumn(name="program_lv_id", referencedcolumnname = "id") private program program; } in bd, have records: service table id = 1, programid = 2 id = 2, programid = 2 id = 3, programid = 3 program table id = 2, name = "program2" id = 3, name = "program3" i trying like: public list<service> getservicesforprogram(long id) { criteria criteria = getsession().createcriteria(service.class, "s"); criteria.createalias("s.program", "p"); criteria.add(restrictions.eq("p.id", id)); return (list<service>)criteria.list(); } when pass 2 method, 4 records instead of 2. somehow results duplicated , services ids 1 , 2 twice. can me why duplication happening? all appreciated. thanks. ...

html - Set width of element to "0" (not absolute positioned) with CSS -

Image
this question has answer here: how remove space between inline-block elements? 31 answers i have element , if define "max-width=0" has width of 4px, see image: when position element absolute gone due css transition (logo slides in on scroll down > 250px) can not position absolute. this css: #page-wrap.oben ul#menu li.menutext { padding: 0; line-height: normal; overflow: hidden; } #page-wrap.oben li.menutext { font-size: 24px; max-width: 0; opacity: 0; vertical-align: middle; -webkit-transition: .6s; -moz-transition: .6s; -ms-transition: .6s; -o-transition: .6s; transition: .6s; } and html: <li class="menutext biggerfont"> <a href="#"> schooool! </a> </li> its because have space between </li><li> elements. if ...

right to left - Where should my brackets be in relation to the text for Arabic languages? -

our application automatically modifies layout of arabic text when followed bracket , wondering whether correct behaviour or not? the application shows items in following format: [id of structure](version) so version 1.5 of english structure "stackoverflow" displayed as: stackoverflow(1.5) note: brackets need displayed. there no space between id , first bracket. brackets encompass version. brackets have been character it's far late switch different character now! this works fine left right languages, arabic languages structures appear in form: ستاكوفيرفلوو(1.0) i not arabic speaker , need know if correct. arabic format equivalent of english format or has gone horribly wrong? the text in arabic should shown like: ستاكوفيرفلوو(1.0) ‏ i added html entity of rlm / right-to-left mark &rlm; in order fix text. should if application doesn't support bidi native-ly. can add rlm these ways: html entity (decimal) &#8207; html entity (...

javascript - Angular application doesn't work on iPhone/Safari 5.1.7 -

currently developing big project in angularjs(version 1.3x), bootstrap(3.3.1), animate.css , few other libraries. test application on different devices via google chrome developers mode , on few browsers google chrome, mozilla firefox , safari(for windows7). i have possibility perform tests on android device , iphone. strange reason application seems work on every device except iphone 5 safari 5.1.7(when using same safari on windows7 work). has before stumbled uppon similar problem? @edit sorry, forgot mention happening. when try press button that's supposed toggle (using jquery, know should done via ui-routing, that's how boss wants it) portion of view (panel) not work. buttons not perform actions. there no reaction.

perl - "ArrayRefOfHashrefs" subtype not working in Moose -

so have little sketch, trying hang of subtypes: #!/usr/bin/perl # use strict; use warnings; package foo; use moose; use moose::util::typeconstraints; use data::dumper; subtype 'arrayrefofhashrefs' => 'arrayref[hashref]'; has 'thingy' => ( 'is' => 'ro', 'isa' => 'arrayrefofhashrefs' ); package main; $foo = foo->new('thingy' => [{ 'id' => 12 }]); # above produces: use data::dumper; print dumper $foo->thingy; and when try run it, get: attribute (thingy) not pass type constraint because: validation failed 'arrayrefofhashrefs' value array(0x7fda83028e08) @ /[path]/site_perl/5.18.4/darwin2level/moose/object.pm line 24 moose::object::new('foo', 'thingy', 'array(0x7fda83028e08)') called @ ../sketches/arrayrefofhashrefs.pl line 17 what doing wrong? you have typo. hashref called hashref capital r . rest fine.

post - Rails 4: TypeError no implicit conversion of Symbol into String -

i relatively new rails , encountered seems common problem after reading through responses, cannot seem make work situation. i have app keeps track of loans , users, , trying add payment feature. when try reach payment page encounter typeerror: no implicit conversion of symbol string . have tried bunch of things nothing seems work. i'm not sure if how trying access loan_id or else. the error encountered in paymentscontroller#create here view: show.html.erb <p id="notice"><%= notice %></p> <div class="row"> <div class="col-md-2"> <ul> <li><strong>lender</strong>: <%= @loan.lender.username %></li> <li><strong>borrower</strong>: <%= @loan.borrower.username %></li> <li><strong>amount remaining</strong>: <%= @loan.amount %></li> <li><%= link_to "new payment", loan_pay...

jsf - How to implement a composite event after p:calendar value is set? -

i've composite component calendar inside. i need catch event when calendar changed in mainbean (not composite bean) so, i've got 4 files: mainbean.java, main.xhtml , coposite: mycalendar.xhtml calcomp.java. i want call 'changed' event in mainbean.java , have no idea how achive that. here code : composite: <composite:interface componenttype="mycomponent"> <composite:attribute name="value" required="true"/> <composite:attribute name="mylistener" method-signature="void listener()" /> </composite:interface> <composite:implementation> <h:panelgroup id="container"> <p:calendar value="#{cc.attrs.value}" valuechangelistener="#{cc.valuechanged}" <p:ajax event="dateselect" update="@this,:buttonpanel" listener="#{cc.attrs.mylistener}"/...

sql - how to place a decimal point just before last two digit of a number -

i have query below select sum(total) sales it give result 123456789 because in end data stored out decimal point. need format 1234567.89 i tried select convert(decimal(10,2),sum(total)) sales but give output 123456789.00 how make 1234567.89 divide 100.0: select convert(decimal(10,2), sum(total) / 100.0) sales

c# - Does any EF extension exist which supports filtered partial updates? -

to update entity either need query , change properties or attach modified or change after attachment. but need like: context.myentities.updatewhere( entity => { entity.isdeleted = true; entity.deleteddate = today}, entity => entitiestodelete.contains(entity.id) && !entity.isdeleted)); i expect similar (parameterized) sql emitted: update myentitiestable set isdeleted = 1, deleteddate = @today id in (...ids list...) , isdeleted = 0; entityframework.extended has batch update , delete feature. github example syntax question along lines of: context.myentities.where(entity => entitiestodelete.contains(entity.id) && !entity.isdeleted) .update(t => new myentity { entity.isdeleted = true, entity.deleteddate = today });

javascript - setInterval causing a memory overflow? -

for record, using node api lot of programming. anyway, when run code memory leak error, saying there 11 emitters open. if case, how prevent program opening several instances of getdata? if cannot prevent that, there crude way delete instances don't want emitted? trying run function every 50 ms. here code: setinterval(getdata, 100); function getdata() { "use strict"; //when serialport opens: serialport.on("open", function() { serialport.on("data", function(data) { //takes current string value, turns integer, stores in ncurrentvalue rundata( parseint(data.tostring()) ); }); }); } getdata(); function rundata(value) { "use strict"; socket.emit('newdata',value); console.log(value); } you extracting event triggers outside of getdata. far understand nodejs, event driven, should attach onopen / ondata once, , connections come on function calls. i guess need...

javascript - Identify protractor test failed assertions -

when protractor test fails, how can find test failed? for example, displays is: 1 test, 1 assertion, 1 failure if had multiple assertions , failures, not know 1 failed. i looked in documentation , in live selenium webdriver trace, did not see how know assertion or test failed. edit: looks there whole time , didn't read failures: 1) angularjs homepage todo list should add todo message: expected false true. stacktrace: error: failed expectation @ [object object]. (/users/jacques.fu/projects/protractor/todo-spec.js:11:75) by default, protractor should give stacktrace on line expectation failed or error happened. but, find useful terminalreporter jasmine reporter jasmine-reporters . add onprepare() make work: jasmine.getenv().addreporter(new jasminereporters.terminalreporter({ verbosity: 3, color: true, showstack: true }));

visual studio - Integrating WinJS with a ASP.NET MVC6 -

Image
i'm trying integrate winjs asp.net mvc6 application created recent visual studio 2015 , display tooltip link. not work. the output should like: here how different parts of app like: bower.json: { "name": "asp.net", "private": true, "dependencies": { "bootstrap": "3.0.0", "bootstrap-touch-carousel": "0.8.0", "hammer.js": "2.0.4", "jquery": "2.1.4", "jquery-validation": "1.11.1", "jquery-validation-unobtrusive": "3.2.2", "winjs": "4.1.0" } } there no change in gulpfile.js . added these _layout.cshtml : <link rel="stylesheet" href="~/lib/winjs/css/ui-light.css" /> <script src="~/lib/winjs/js/base.js"></script> <script src="~/lib/winjs/js/ui.js"></script> my html code is: <div ...

asp.net - SiteMapPath not working with route attribute in nodes -

i have xml sitemap: <?xml version="1.0" encoding="utf-8" ?> <mvcsitemap xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://mvcsitemap.codeplex.com/schemas/mvcsitemap-file-4.0" xsi:schemalocation="http://mvcsitemap.codeplex.com/schemas/mvcsitemap-file-4.0 mvcsitemapschema.xsd"> <mvcsitemapnode title="home" controller="home" action="index" key="home"> <mvcsitemapnode title="access control" route="accesscontrol_default" controller="home" action="index" key="access-control"> <mvcsitemapnode title="my dashboard" route="accesscontrol_default" controller="dashboard" action="index" key="dashboard"/> <mvcsitemapnode title="personnel" route="accesscontrol_default" clickable="false" key="personnel...

Travis not accumulating build exit codes -

i have following .travis.yml : sudo: required language: node_js branches: only: - master before_install: - curl https://install.meteor.com | /bin/sh - npm install standard -g script: - standard - sh run_tests.sh - '[ "${travis_pull_request}" != "false" ] && bash check_for_new_version_number.bash' - '[ "${travis_pull_request}" = "false" ] && printf $li | meteor login && meteor publish || exit 0' if of build commands fail (exit code != 0) build still marked success, last command exists 0. if change last command exit 1, build fail. according http://docs.travis-ci.com/user/customizing-the-build/#customizing-the-build-step , exit codes should accumulate , build should fail if fail. missing? thanks!

java - Oracle JDK 8 on Heroku with a Gradle Build -

does know can find gradle-compatible buildback heroku includes oracle java jdk 1.8? i'm deploying reasonably complex spring application , have feeling strange errors caused differences between openjdk , oraclejdk. alternatively, perhaps can guide me forking existing buildpack , creating own. edit : wasn't jdk issue after all first of all, unlikely solve problem. said... you can customize jdk setting jdk_url_1_8 config var so: $ heroku config:set jdk_url_1_8=http://...tar.gz for oracle jdk: must strip jdk1.8.0_51 dir tarball. can running: $ tar -xvf jdk-8u51-linux-x64.gz $ cd jdk1.8.0_51 $ tar -cv -f jdk-8u51-linux-x64.gz . you should manually download oraclejdk, edit per above, , put in personal s3 bucket (or other storage). use url config var. be aware oracle jdk larger openjdk (by 100mb). affect slug size. (the size due junk don't need gui stuff , docs).

java - WildFly9.0 - adding web service access -

i migrating restful web application glassfish4.1 wildfly9.0 first time. initially, suffered deployment issues due jersey dependencies. overcome problem, replaced said project dependencies resteasy equivalents inside of pom.xml file. in doing so, application became deployable -- , according (wildfly_base)/standalone/log , , applications -- working expected. additionally, added jboss-web.xml configuration file web-inf folder: <?xml version="1.0" encoding="utf-8"?> <!doctype jboss-web public "http://www.jboss.org/j2ee/dtd" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd"> <jboss-web> <context-root>myprojectstart</context-root> </jboss-web> the hello-world page can reached @ http://ipaddress:8080/myprojectstart . ... however, cannot view web services @ http://ipaddress:8080/myprojectstart/getdata , when using glassfish-4.1. so; missing? note: use @annotations like: @applicationpath(...

x86 - How do I enable SSE for my freestanding bootable code? -

(this question cvtsi2sd instruction , fact thought didn't work on pentium m cpu, in fact it's because i'm using custom os , need manually enable sse.) i have pentium m cpu , custom os far used no sse instructions, need use them. trying execute sse instruction results in interruption 6, illegal opcode (which in linux cause sigill , isn't linux), referred in intel architectures software developer's manual (which refer on iasdm) #ud - invalid opcode (undefined opcode) . edit : peter cordes identified right cause, , pointed me solution, resume below: if you're running ancient os doesn't support saving xmm regs on context switches, sse-enabling bit in 1 of machine control registers won't set. indeed, iasdm mentions this: if operating system did not provide adequate system level support sse, executing sse or sse2 instructions can generate #ud. peter cordes pointed me sse osdev wiki , describes how enable sse writing both cr0 , cr4 ...

javascript - jQuery show/hide div dont works in Chrome -

i'm novice in jquery. have a.acessaponto if click it, add/remove class a.acessaponto.selected , show/hide div.acessapontoatendimento . have code that. works in firefox , ie doesn't work in chrome. $( document ).ready(function() { $('.acessaponto').click(function() { $(this).toggleclass('selected'); if ($(this).hasclass('selected')) $('.acessapontoatendimento').css("display", "inline-block"); else $('.acessapontoatendimento').css('display', 'none'); }); }); .acessaponto{ background-color:blue; } .acessaponto.selected{ background-color:red; } .acessapontoatendimento{ display:none; background-color: red; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js"></script> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title...

java - Just update/insert into DB when there are no errors (@Transactional(propagation = Propagation.REQUIRED)) -

i have business class calls 6 services. depending dto treated every moment, different service called. theoretically every time business class called call these 6 services. i want if there no errors in these 6 services updates done meanwhile commited database. in case there errors no commit must done database. theoretically have planned in applying business class calls 6 services , 6 services called: @transactional(propagation = propagation.required) is ok?would in different way? thank you this sounds want do. assuming each of 6 services throws exception if goes wrong. you can test putting breakpoints 6 services, check in debugger's stacktrace transaction advice , check 6 services use same transaction object (they should). if trigger exception in 1 of services, transaction should marked rollback.

Not able to read XML using perl -

i trying read xml file using perl. i tried xml::simple , use xml::libxml , in both cases facing problems. for xml::simple says "keys on reference experimental using hash reference deprecated" when use following foreach $k ({keys %$ref->{version}}) # output conf { print stderr dumper($k); } and xml::libxml , getting "can't locate xml/libxml/error.pm in @inc (you may need install xml::libxml::error module)" . when tried install libxml using activeperl ppm ui , didn't find package there. downloaded libxml other source , copied required files in "c:\perl64\lib" , "c:\perl64\site\lib" . i using perl 5, version 20. how can make work ? your xml::simple problem misunderstanding of syntax. looks realise need use % dereference hash reference, don't realise need put expression returns hash reference in small { ... } block. so have: %$ref->{version} you want: %{$ref->{version}} oh, , it...

python - Redis Cluster mode slower than Standalone -

i've redis cluster of 3 master nodes version 3.0.3 hosted on 3 ec2 t2.medium instances. when sit on 4th instance measure set, performance using redis-benchmark , have $ redis-benchmark -h redis-com-01 -p 6379 -t set,get -n 1000000 ====== set ====== ... 33550.29 requests per second ====== ====== ... 32353.04 requests per second $ redis-benchmark -h redis-com-02 -p 6379 -t set,get -n 1000000 ====== set ====== ... 36329.29 requests per second ====== ====== ... 37199.61 requests per second $ redis-benchmark -h redis-com-03 -p 6379 -t set,get -n 1000000 ====== set ====== ... 32338.39 requests per second ====== ====== ... 32169.86 requests per second but, when use benchmark tool simple.py https://github.com/grokzen/redis-py-cluster measure set, performance of whole cluster, i'm quite surprise result $ python simple.py --host redis-com-03 --port 6379 --timeit 10k set/get operations took: 4.3375210762 seconds... 2305.46430192 operations per second 20k set/get operation...

xslt 1.0 - How to pass dynamic separator in key XSLT1.0 -

how pass dynamic separator in , here passed '|' static , when declare variable in xsl , used place gives error. <xsl:variable name="separator" select="'|'"/> <xsl:key name="key-before" match="result" use="substring-before(store, $separator)"/> input xml <?xml version="1.0" encoding="iso-8859-1"?> <results> <result> <store>0180|1</store> </result> <result> <store>0180|2</store> </result> <result> <store>0181</store> </result> <result> <store>0183</store> </result> <result> <store>abc</store> </result> <result> <store>def</store> </result> <result> <store>0181|2</store> </result> <resu...

ssl - Docker-machine : ca.pem not found -

here creating test machine(dev) using docker machine. $ docker-machine create -d virtualbox dev creating ca: c:\users\xxx\.docker\machine\certs\ca.pem creating client certificate: c:\users\xxx\.docker\machine\certs\cert.pem creating virtualbox vm... creating ssh key... starting virtualbox vm... starting vm... the vm gets created , runs out flaws. , here error when run following command: $ docker-machine env dev open c:\users\xxx\.docker\machine\machines\dev\ca.pem: system cannot fin d file specified. i have no idea how deal problem. tried restarting boot2docker. you should try using docker-machine regenerate-certs dev . problem think somehow .pem file got deleted or not created. had same issue , regenerating certs fixed problem (reboot did not btw).

osx - CMake warnings under OS X: MACOSX_RPATH is not specified for the following targets -

i try build cmake-based software under os x (yosemite) can built under fedora 21. uses bunch of libraries. both, big open ones boost , self-written ones lying in /installation_folder/lib. use cmake version 3.3.0. after executing mkdir build cd build cmake .. -dcmake_c_compiler=/usr/local/cellar/gcc/5.2.0/bin/gcc-5 -dcmake_cxx_compiler=/usr/local/cellar/gcc/5.2.0/bin/g++-5 -dcmake_module_path=${pwd}/../external/install/share/llvm/cmake i following warnings: cmake warning (dev): policy cmp0042 not set: macosx_rpath enabled default. run "cmake --help-policy cmp0042" policy details. use cmake_policy command set policy , suppress warning. macosx_rpath not specified following targets: clangwrapper structure wcetxml warning project developers. use -wno-dev suppress it. the cmakelists.txt contains following lines regarding rpath: set(cmake_skip_build_rpath false) set(cmake_install_rpath "${cmake_install_prefix}/lib") set(cmake_install_rpath_use_link_...

css - Failed to load resource "font" -

i got error on site: failed load resource: server responded status of 500 (internal server error) while trying load font. this thing got code. don't know else should in order load font. @font-face { font-family: 'aharoni'; src: url("aharoni.ttf") format('truetype'); } link: http://ondiversion.net/vialighting/ this error500 concerns loading.gif , favicon.ico not fonts. depending on hosting, there few different cases cause issue. the common concerns .htaccess rights . bet on in case. you should have on " why-am-i-getting-a-500-internal-server-error-message ". good luck'

php - Select query to field retrieve information - Wordpress -

i have wordpress table wp_options , field named option_value in option_value fields there lot of records following a: 767: { i: 0;a: 8: { s: 7: "user_id";s: 1: "1";s: 10: "media_name";s: 17: "550504eb10347.jpg";s: 18: "media_display_name";s: 19: "about_play_img1.jpg";s: 10: "media_type";s: 5: "photo";s: 9: "media_url";s: 95: "example.com/wp-content/uploads/userpro/1/media/550504eb10347.jpg";s: 10: "media_path";s: 111: "/home/content/30/7469030/html/1hotdesign/theplayexperience/wp-content/uploads/userpro/1/media/550504eb10347.jpg";s: 14: "thumbnail_path";s: 105: "example.com/wp-content/uploads/userpro/1/media/thumbnail/550504eb10347.jpg";s: 8: "media_id";i: 0; }i: 1;a: 8: { s: 7: "user_id";s: 1: "1";s: 10: "media_name";s: 17: "55052a098c146.jpg";s: 18: "media_dis...