Posts

Showing posts from March, 2014

powershell - How to compare and restart same many Services on many Computers with simple interface -

Image
i need compare status of many services , each dependancy on many remote computer restart if needed. but output of get-service poor in cli you can pipe get-service out-gridview, get-service accept list of computername. get-service -computername pc1,pc2 | out-gridview -outputmode multiple | restart-service -force -passthru the function out-gridview provide user interface. function restartrmservice { param ( [parameter(mandatory=$true,position=0)] [alias("cn")] [string[]]$computername, [parameter(mandatory=$false)] [alias("cn")] [string[]]$servicename ) $restart = @() if ($servicename) { $restart = get-service -computername ($computername | select-object -unique) -name $servicename | select * } else { $restart = get-service -computername ($computername | select-object -unique) | select machinename, servicename, status, displayna...

asp.net - How Change in CodeBehind HeaderImage in GridView -

how dynamically change image in header? the idea when grid created in "itemdatabound" event this grid <asp:datagrid id="dgmain" runat="server" gridlines="horizontal" autogeneratecolumns="false" allowpaging="false"> <columns> <asp:boundcolumn datafield="pid" visible="false" /> <asp:templatecolumn headerstyle-width="80px" headerimageurl="ico_estadistica_despacho.png"> <itemtemplate> <asp:imagebutton id="btnest" runat="server" borderwidth="0" imageurl="punto.png" commandname="estdesp"/> </itemtemplate> </asp:templatecolumn> <asp:boundcolumn datafield="cotid" visible="false" /> </columns> </asp:datagrid> i tried something, did not work out. if e.item.itemtype = listitemtype.header dgmain2.col...

python - ImportError SciKit-learn -

i trying started machine learning, have installed packages: numpy, scikit-learn, matplotlib, scipy . have installed directly pip with: python -m pip install "package name" and , others have downloaded binary files , installed pip . shows no errors when import matplotlib, numpy , sklearn , when write: from sklearn import svm it gives me error: importerror: cannot import name 'svm' i on python 3.5.1 , on windows 10. have solutions? import sklearn.svm svm model = svm.svc() .... http://scikit-learn.org/stable/modules/classes.html#module-sklearn.svm

css - Adding Borders to HTML Table of SQL Query Results -

trying add borders , column headings table of results sql query. results display fine there no headings or borders on table, looks jumble of results. </div> <div id="section"> <h2>upcoming events</h2> <?php $connection = mysqli_connect('localhost', 'c3437691', 'chelsea27', 'c3437691'); ?> <?php $query = "select * event"; $result=mysqli_query($connection, $query); echo "<table>"; while ($row=mysqli_fetch_assoc($result)){ ?> <tr> <td><?php echo $row['event_name']?></td> <td><?php echo $row['event_location']?></td> <td><?php echo $row['event_date']?></td> <td><?php echo $row['ticket_price']?></td> <td><?php echo $row['ticket_stock']?></td> </tr> <?php } ?> </div> you need explicitly output table headers -- iterati...

bash - Redhat linux .bash_profile: line 12: syntax error: unexpected end of file -

i use redhat linux , problem: .bash_profile: line 12: syntax error: unexpected end of file .bashrc # .bashrc # user specific aliases , functions export java_home=/usr/lib/jvm/jdk1.6.0_45 export jre_home=/usr/lib/jvm/jdk1.6.0_45/jre export path=$path:/usr/lib/jvm/jdk1.6.0_45/bin:/usr/lib/jvm/jdk1.6.0_45/jre/bin alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # source global definitions if [ -f /etc/bashrc ]; . /etc/bashrc fi and bash_profile # .bash_profile # aliases , functions if [ -f ~/.bashrc ]; . ~/.bashrc fi # user specific environment , startup programs path=$path:$home/bin export path could tell me how fix problem? thanks

jquery - Counting classes up with each -

i trying give each .scan new class increasing count what have tried using each function jquery , using $(this) $(this) allways contain class name every .scan changed. $( ".scan" ).each(function() { = 0; $(this).addclass( "count"+i ); i++; }); the result <div class="scan count0"></div> <div class="scan count0"></div> but want <div class="scan count0"></div> <div class="scan count1"></div> here fiddle current state. every tipp/help appreciated. i.e. because defined inside each method.you need set value outside each method: var = 0; $( ".scan" ).each(function() { $(this).addclass( "count"+i ); i++; }); however can use default argument parameter index of each function give incremenetal class suffix: $(".scan").each(function(i){ $(this).addclass("count" + i); }); working demo .each or us...

angularjs - ngroute : research not working for second time -

i'm having issue using ngroute, everything works second time nothing shows. app : var biapp = angular.module('biapp',['ngroute','nganimate','ngsanitize', 'massautocomplete','ngdialog','ngcookies']) .config(['$routeprovider', function($routeprovider){ $routeprovider. when('/home', { templateurl : 'views/home.html', controller : 'mainctrl' }). when('/results', { templateurl : 'views/results.html', controller : 'resultctrl' }). otherwise({ redirectto : '/home' }); }]); i have index filters (search bars search data , display @ views/results.html) : <div ng-include="'views/filters.html'"></div> added view : <div ng-views></div> results.html show result searched in index, , have same filters.html included search results again . when type data se...

sql - MySQL query index & performance improvements -

i have created application track progress in league of legends me , friends. purpose, collect information current rank several times day mysql database. fetch results , show them in graph, use following query / queries: select lol_summoner.name name, grid.series + ? timestamp, avg(nullif(lol.points, 0)) points series_tmp grid join lol on lol.timestamp >= grid.series , lol.timestamp < grid.series + ? join lol_summoner on lol.summoner = lol_summoner.id group lol_summoner.name, grid.series order name, timestamp asc select lol_summoner.name name, grid.series + ? timestamp, avg(nullif(lol.points, 0)) points series_tmp grid join lol on lol.timestamp >= grid.series , lol.timestamp < grid.series + ? join lol_summoner on lol.summoner = lol_summoner.id lol_summoner.name in (". str_repeat('?, ', count($names) - 1) ."?) group lol_summoner.name, grid.series order name, timestamp asc the fi...

spring - Unit test on java code -

i have problems few lines of code remains reach 100 percent. if (object== null) { errors.reject("some error"); } project uses spring framework , class org.springframework.validation.errors how can make unit test on fragment. the second fragment can not test this. for (int = 0; < model.getname().length(); i++) { int x = (int) model.getname().charat(i); if (x < 33 || x > 126) { errors.rejectvalue("name", "some error"); break; } } i hope 1 :) edit: public void validate() { if (object== null) { errors.reject("some error"); } if (model.getname().equals("")) { errors.rejectvalue("name", "some error"); } else if (model.getname().length() < 6) { errors.rejectvalue("name", "some error"); ...

java - Hibernate Join Tables -

i have 2 tables: person id | name | email_id (foreign key of email.id) email id | email_address i need pull data following entity unsure how join person.email_id email.id using annotations @entity @table(name = "person") public class personentity { @column(name = "id") private string id; @column(name = "name") private string name; // how do 1 one join here? private string emailaddress; } how can use annotations emailaddress field maps email.email_address column? your person entity should join email entity , not emailaddress property directly. @entity @table(name = "person") public class personentity { @column(name = "id") private string id; @column(name = "name") private string name; @onetoone(fetch = fetchtype.lazy, mappedby = "person", cascade = cascadetype.all) private email email; } but strange have entity emails. ensure emai...

wxpython - Read a command prompt output in a separate window in python -

i have python script builds solution file using msbuild on windows system.i want show command prompt output when build process running.my code looks below def build(self,projpath): if not os.path.isfile(self.msbuild): raise exception('msbuild.exe not found. path=' + self.msbuild) arg1 = '/t:rebuild' arg2 = '/p:configuration=release' p = subprocess.call([self.msbuild,projpath,arg1,arg2]) print p if p==1: return false return true i able build file, need show build status in separate gui(status window).i tried lot redirect command prompt output file , read file but, not make it. tried below command, subprocess.check_output('subprocess.call([self.msbuild,projpath,arg1,arg2])', shell=false) > 'c:\tmp\file.txt' can let me know how can show outputs command prompt in status window(a gui using wxpython) when run script? i did when wanted capture traceroute , ping commands wxpython. wrote...

javascript - Error with selecting objects within an array -

i writing code board game app. have written simple piece of code determine player's position mathrandom. outcome of mathrandom tells array select 1 of 4 objects (the players) , add outcome position. added piece of code @ start of function move in array , select next player each time click "roll dice" button player gets more value position. the problem after i've gone through entire array , arrive @ [0] position runs code twice first player gets function twice , other players once. this code: var players = [ {name: "player 1", positie: 0}, {name: "player 2", positie: 0}, {name: "player 3", positie: 0}, {name: "player 4", positie: 0} ]; var position = 0; var currentplayer = players[position]; function rolclick(){ currentplayer = players[position++]; if (position > players.length){ position = 0; currentplayer = players[position]; } var rollen = math.floor(math.random() * 6) + 1; if (rollen === 1){ currentp...

javascript - Jquery autotab-previous functionality is not working in Android Firefox -

in android firefox only in form have 10 number of number input fields of maxlength = 1 . let have entered numbers . place cursor before number in of input field --> enter space -> number after current field(where cursor placed) deleted. if try delete number ,after deleting focus not going previous input field . focus should not change when pressing 'backspace', when using 'tab'. see correct behaviour.

c# - Pass Parameter into ViewModel constructor dependent on navigation region? -

i have wpf application try move prism step step. current step regionmanager , navigationservice / composite ui. i did implement own regionmanager , navigationservice deal details, try replace own implementation prism regionmanager (because contains functionality nice) here problem try solve: i have tabcontrol able display multiple contents not have each other (like browser). tabcontrol has template set creates new region each content display (so have navigationservice , journey each tabitem) <userinterface:tabcontrolhelper.template> <datatemplate datatype="{x:type viewmodels:contentviewmodel}"> <contentcontrol x:name="datacontextproxy"> <contentcontrol prism:regionmanager.regionname="{binding elementname=datacontextproxy, path=datacontext.(viewmodels:contentviewmodel.id)}" prism:regionmanager.regionmanager="{binding relativesource={relativesource ancestortype=views:cont...

sphinx - sphinxQl getting query log -

using sphinxql , while executing query , getting following error select fieldname indexname height >= 165.25 , height <= 175.25 or age >=51; error 1064 (42000): sphinxql: syntax error, unexpected or, expecting $end near 'or age >=51' select fieldname indexname (height >= 165.25 , height <= 175.25) or age >=51; error 1064 (42000): sphinxql: >=, <=, , between floating-point filter types supported in version near '(height >= 165.25 , height <= 175.25) or age >=51' advance , please suggest try like select fieldname, if( (height >= 165.25 , height <= 175.25) or age >=51, 1, 0) myfilter indexname myfilter = 1 sphinx can 'or', can't physically in clause itself.

php - Why isn't the textbox accepting any value? -

i keeping value(inserted user) of text box in variable $no. not showing when write echostatement. don't understand why?? i believe not inserting value properly. help. thank you. <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>attendence form</title> <link type = "text/css" rel = "stylesheet" href = "style.css"> </head> <body> <form action = "<?php $_server['php_self']; ?>" method = "post"> <table> <tr> <th>department</th> <th>year</th> <th>course</th> <th>lec...

jquery - Access Datatables recordsFiltered field? -

i have such jquery request: jquery(function() { jquery('#numberlist').datatable({ "processing": true, "serverside": true, "ajax": "${baseurl}voip/provisioning/ajax/dtsearch/" + addtype, "columns": [ { "data": "number" }, { "data": "type" }, { "data": "targetdisplay" }, { "data": "lastchanged" }, { "data": "triple9data" }, { "data": "portingin" }, { "data": "edit" } ...

css - Absolutely positioned element inside container with overflow: auto -

Image
we have modal position: fixed , overflow-y: auto . this works when have lots of components overflow since scroll bar shown. however when have custom calendar field inside modal opens popup/dropdown calendar , element outside 1 of sides of container, it's not shown. is there way make popup/dropdown shown while keeping overflow-y: auto of modal? so: codepen elaborate: http://codepen.io/anon/pen/jwmnma .modal { position: fixed; background-color: pink; height: 200px; width: 200px; left: 30%; /* comment out show dropdown*/ overflow: auto; } .dropdown { background-color: lime; height: 80px; width: 80px; position: absolute; left: -50px; } html: <div class="modal"> <div class="dropdown"> content in dropdown. </div> long long overflowing text... </div> in case, it's not possible absolutely positioned child element appear outside of parent .modal element when has overflow: a...

c# - Multithreading with events in WPF -

update: mentioned in comments section problem solved, not understand why way of implementation wrong. i have situation: i have device can triggered event in wpf project. event pulls data device @ polling rate of 1ms. want process data in different threads. my approach was, start backgroundworker registers device event (i read events run on thread called from). in device event data saved object, declared in form. after labels in wpf form refreshed invoke method. this happens until presses cancel on button in form, unregisters device event , stops thread. here code use: declaration in main window: public partial class mainwindow : window { private backgroundworker worker = new backgroundworker(); private measureobject mobject = new measureobject(); ... } this initialization: public mainwindow() { initializecomponent(); this.worker.workersupportscancellation = true; this.worker.dowork += worker_dow...

EnterTransitionCoordinator causes NPE in Android 5.0 -

after adding exit , enter activity transitions app, getting crash reports following: fatal exception: java.lang.nullpointerexception: attempt invoke virtual method 'android.view.viewparent android.view.view.getparent()' on null object reference @ android.view.viewoverlay$overlayviewgroup.add(viewoverlay.java:164) @ android.view.viewgroupoverlay.add(viewgroupoverlay.java:63) @ android.app.entertransitioncoordinator.startrejectedanimations(entertransitioncoordinator.java:598) @ android.app.entertransitioncoordinator.startsharedelementtransition(entertransitioncoordinator.java:325) @ android.app.entertransitioncoordinator.access$200(entertransitioncoordinator.java:42) @ android.app.entertransitioncoordinator$5$1.run(entertransitioncoordinator.java:389) @ android.app.activitytransitioncoordinator.starttransition(activitytransitioncoordinator.java:698) @ android.app.entertransitioncoordinator$5.onpr...

Linq Query with multiple joins and multiple conditions -

i using telerik data access perform or mapping. i trying use linq performing join query not sure how proceed correctly. the original sql query given by: 'select o.ops_leg_id, o.atd_date, o.dep_airport_act, o.arr_airport_act, o.ata_date, '+ 'o.fl_log_atd_date, o.fl_log_ata_date, o.fl_log_dep_airport, o.fl_log_arr_airport, '+ 'o.fl_nb, o.designator, o.fl_log_id, o.fl_log_status '+ 'from crew_rot_role cr, ops_leg o, crew_roles r, crew_pairing_cmp cp '+ 'where cr.role_cde = r.role_cde '+ 'and cr.crew_rotation_id = cp.crew_rotation_id '+ 'and cp.ops_leg_id = o.ops_leg_id '+ 'and cr.crew_cde = :crew_cde '+ 'and o.atd_date >= :d_from '+ 'and o.atd_date <= :d_to...

java - ActiveJDBC: save() generates insert only for auto-generated primary key? -

i started using activejdbc. have following table (postgresql) create table users ( id uuid primary key, email text unique not null, password text, <some more nullable columns> created_at timestamp time zone not null default (now() @ time zone 'utc'), updated_at timestamp time zone ); as can see, primary key of type uuid , has no auto-generate value of kind. this user class models table : public class user extends model { public user() { setid(uuid.randomuuid()); // sets value primary key } ... } this attempt create new row , insert : user u = new user(); system.out.println(u.saveit()); actually, expected insert fail, since did not set value mandatory email column. however, got false return value. when turned on logging, saw framework generated update sql instead of insert: [main] info org.javalite.activejdbc.db - query: "update users...

jquery - JQueryUI Submit button found in dialog box only works after second time opening the dialog -

Image
i have dialog box opens when double click on draggable element. it's purpose append ip address underneath image: it works fine after close dialog box , open again click on submit button. here's codes: html <div id="configbox" title="ipv6 configuration" style="font-size:15px;"> <form> <b>dhcp</b> <input type="radio" name="option" value="dhcp"/> &nbsp; <b>auto config</b> <input type="radio" name="option" value="auto"/> &nbsp; <b>static</b> <input type="radio" name="option" value="static"/> &nbsp; <br/><br/> <table> <tr> <td> <b>ipv6 address:</b> </td> <td> <input type="text...

Python Email script trouble -

Image
i have script running nightly. want send me email when fails complete. wrote short test script learn how send email python. in ide runs without error messages no email. i'm running 1 of our servers (not email server) doesn't have email restrictions. i tried in python shell can read messages: i tried sending gmail account , error: smtprecipientsrefused: {'blahblahblah@gmail.com': (550, '5.7.1 unable relay')} any ideas?? more info: i modified code found here work our email. def send_email(user, recipient, subject, body): import smtplib = user = recipient if type(recipient) list else [recipient] subject = subject text = body # prepare actual message message = """\from: %s\nto: %s\nsubject: %s\n\n%s """ % (from, ", ".join(to), subject, text) try: server = smtplib.smtp("workemailserver.com") server.sendmail(from, to, message) serv...

python - AppEngine NDB property validations -

i wonder best approach validating ndb entity properties likes: a date must in future a grade (integer property) must between 1 , 10 a reference entity must have property values (e.g. book.category.active must true) i'm using wtforms validate submitted requests, want enforce validations on lower level datastore entities itself. so i'm looking call validate on datastore entity see if it's valid or not. in case it's valid can put entity datastore, if it's not valid want retrieve invalid properties including applies validator did not validate successfully. another reason wtforms might not sufficient i'm experiencing new cloud endpoints. in model i'm receiving actial entity , not http request. how other appengine users solving this? not is best solution, roll own. pre-define bunch of properties reg-exs/mins , maxs etc. seems properties straight forward enough wouldn't difficult.

android - Dispatch touch events to ViewPager's unfocused fragments -

i've implemented dave smith's elegant solution displaying multiple views inside viewpager here , having trouble dispatching touch events fragments not "focused" one. in pagercontainer solution, there functionality handle touch events outside of viewpager's focused area (see below), that's enable scrolling. need touch events interact views on fragments themselves. does have experience this? @override public boolean ontouchevent(motionevent ev) { //we capture touches not handled viewpager // implement scrolling touch outside pager bounds. switch (ev.getaction()) { case motionevent.action_down: minitialtouch.x = (int)ev.getx(); minitialtouch.y = (int)ev.gety(); default: ev.offsetlocation(mcenter.x - minitialtouch.x, mcenter.y - minitialtouch.y); break; } return mpager.dispatchtouchevent(ev); } how touch events pagercontainer propagated appropriate fragment? y...

f# - Why can't I Seq.take more than 5 values? -

whilst trying understand seq.unfold, have been playing following f# produces sequence of triangle numbers... let tri_seq = 1.0 |> seq.unfold (fun x -> (0.5 * x * (x + 1.0), x + 1.0)) |> seq.map (fun n -> int n) this seems work fine, in can following... tri_seq |> seq.nth 10 ...and shows right number, whatever value pass it. now, i'm trying print out first (say) ten values in sequence, rather above code gets nth. tried following... tri_seq |> seq.take 10 |> seq.map (fun n -> printfn "%d" n) ...but prints first 5 values. whatever use value passed seq.take, ever maximum of 5 results, though when using seq.nth, can go far like. anyone able explain me? why can't past fifth value? the problem you're using seq.map print values. sequences lazy , resulting sequence never evaluated - see 5 values because f# interactive prints first 5 elements of sequence. you can use seq.iter iterates on whole sequence: tri...

inheritance - Customize Employee Form in OpenERP 7.0 -

i want add field "employee file number" employee form in openerp 7.0. have reviewed official documentation, search on google not find simple example. new openerp if can provide step step example nice. thanks add below code in module. py file: class hr_employee(osv.osv): _inhetit= 'hr.employee' _columns = { 'emp_file':fields.char('employee file number', size='128'), } hr_employee() xml file: <record id="view_hr_employee_inherited" model="ir.ui.view"> <field name="name">view.hr.employee.inherited</field> <field name="model">hr.employee</field> <field name="inherit_id" ref="hr_employee.view_employee_form" /> <field name="arch" type="xml"> <field name="name" position="after"> <field name="emp_file" /> ...

time - Java: calendar.setTimeInMillis() returns wrong HOUR_OF_DAY value -

i trying convert time in minutes hh:mm. example 418minutes = 6:58. using following code: long milli = priemcas*60000; calendar calendar1 = calendar.getinstance(); calendar1.settimeinmillis(milli); int hours3 = calendar1.get(calendar.hour_of_day); int minutes3 = calendar1.get(calendar.minute); system.out.println(hours3+":"+minutes3); i 7:58 when variable priemcas = 418 instead of 6:58. wrong here? thank much. create calendar correct time zone: calendar calendar1 = calendar.getinstance(timezone.gettimezone("utc"));

What does TCPSocket#each iterate over in ruby? -

i'm not familiar ruby, wasn't able find documentation method. when calling each on tcpsocket object, this require "socket" srv = tcpserver.new("localhost", 7887) skt = srv.accept skt.each {|arg| p arg} does block called once per tcp packet, once per line (after each '\n' char), once per string (after after each nul/eof), or different entirely? tl;dr tcpsocket.each iterate each newline delimited \n string receives. more details: a tcpsocket basicsocket powder sugar on top. , basicsocket child of io class. io class stream of data; thus, iterable. , that where can find how each defined tcpsocket . fire irb console , enter line of code $stdin socket see how each behaves. both inherit io . here example of happens: irb(main):011:0> $stdin.each {|arg| p arg + "."} hello "hello\n." but directly answer question, block called once per \n character. if client sending data 1 character @ time block...

precision - are computations with large floats less accurate then with small floats -

is statement correct? : computations large numbers less accurate due logarithmic distribution of floating point numbers on computer. so means computing values around 1 more accurate (because of rounding errors) same computations each number has been scaled 1e20 example? short answer: yes statement correct, larger floating point numbers less precise smaller ones. details: floating point numbers have fixed number of bits assigned mantissa . if number being represented requires more bits in mantissa rounded. smaller number can represented more precisely. to make more concrete wrote following program adds progressively smaller values large floating point number , small one. show difference included double precision floating point not have rounding. double experience same problem if mantissa larger. #include <stdio.h> int main() { float large_float, small_float, epsilon; double large_double, small_double; large_float = 1 << 20; small_...

django - Getting data from select elements without post -

i have section of html given me 3 <select> elements corresponding cities, universities , skills populated back-end. <form action="" method="post"> <div class="language-main1"> <div class="language1"> <select> <option>by university</option> {% uni in universities %} <option>{{uni}}</option> {% endfor %} </select> </div> </div> <div class="language-main1"> <div class="language1"> <select> ...

Filtering results in SQL -

say have table follows: right | group_id | score 1 1 5.6 0 1 3.1 0 1 -1.5 0 1 7 1 2 4.3 0 2 55.8 0 1 -6 how sort group (so group 1's together, 2's etc..) sort score. (something order group_id, score). want filter out top 3 results each group. i.e resulting table be: right | group_id | score 0 1 7 1 1 5.6 0 1 3.1 0 1 7 1 2 55.8 0 2 4.3 thanks! using ansi sql, can do: select right, group_id, score (select t.*, dense_rank() on (partition groupid order score desc) seqnum t ) t seqnum <= 3 order groupid;

python - Multiple initialisation with given input parameter -

i trying make class executed given number of times according passed parameter. class converts dictionary desired data. let me show quick example of mean exactly: first class a offers common methods derivative classes. class a(object): @staticmethod def do_magic(obj): # ... print(''.obj) class b , e (skipped in example) initialise objects , provide b_stuff , e_stuff . class b(a): def __init__(self, mydict): # self.b_stuff = [...] now class c comes play. transforms given dictionary mydict has key-value pair describing number of iterations 'iters': 'val' class c(b, e): def __init__(self, mydict): b.__init__(self, mydict) # access b_stuff e.__init__(self, mydict) # access e_stuff self.iters = int(self.mydict['iters']) # desired nb of initialisations/executions self.c_stuff = [b_stuff, e_stuff, other] def do_magic(self): a.do_magic(self.c_stu...

akka - Overriding balancing pool router supervisor strategy doesn't work -

my worker code: def receive = { case msg => throw new exception("test exception escalation") } my controller (parent) code: val strategy = oneforonestrategy() { case _: exception => escalate case _ => escalate } val router: actorref = context.actorof(props[worker].withrouter(fromconfig().withsupervisorstrategy(strategy)), name = "router") def receive = { case ex: exception => log.info(ex.tostring) } however, whenever send message worker, restarts instead of escalating parent. seems overriding not working. any idea please? thanks! escalating failure not mean exception sent message parent actor the parent actors supervision strategy used determine do. your controller/parent actor not override supervisionstrategy , therefore has default strategy restart on exception.

python - Numpy Matrix inverse with float128 type -

i got matrix 'x' of float128 values , getting next error when: > q = (inv(xt * x) * xt) * n > array type float128 unsupported in linalg where xt transposed x , n other float128 matrix. other operations matrix handled correctly transposing or matrix product. yes need float128 case, otherwise results differing ones closer real values taking reference. there no float128 data type in numpy. supported numpy data types can found here: http://docs.scipy.org/doc/numpy-1.10.1/user/basics.types.html if need work around try use npy_longdouble numpy c api http://docs.scipy.org/doc/numpy-1.10.0/reference/c-api.dtype.html

javascript - How do I test a nodejs POST web service with file upload using request js and jasmine? -

i created web service nodejs (express) takes json file, reads , stores content document in mongodb. the post route works fine. code looks this var multipart = require('connect-multiparty'); var fs = require('fs'); router.post('/', multipartmiddleware, function(req, res) { fs.readfile(req.files.swagger.path, 'utf8', function(err, data) { req.body.swagger = json.parse(data); . . }); }); basically, it's picking data json file in req.files , putting inside req.body object. i need same thing done on jasmine spec file. i'm able physically test web service using postman need test through spec file using jasmine. now, i'd check if web-service throws 200 ok status, it's throwing 500 so far, jasmine-node test suite looks this describe("post /", function() { it("returns status code 200", function(done) { var req = request.post(base_url, function(error, response, body) { expect(respon...

Django EmailMessage Attachments attribute -

i try send in 1 email more 1 attachments in pdf code for pdf_files in glob.glob(path+str(customer)+'*.*'): get_filename = os.path.basename(pdf_files) list_files = [get_filename] attachment = open(path+get_filename, 'rb') email = emailmessage('report for'+' '+customer, 'report date'+' '+cust+', '+cust, to=['asd@asd.com']) email.attachments(filename=list_files, content=attachment.read(), mimetype='application/pdf') email.send() here django documentation says attachments attribute. attachments: list of attachments put on message. these can either email.mimebase.mimebase instances, or (filename, content, mimetype) triples. when try run code using attachments error typeerror: 'list' object not callable maybe i'm misunderstanding passin...

datastax enterprise - Querying Solr Config API returns Internal Server Error -

i'm attempting update solr config via solr config api. attempting first query config following endpoint: http://localhost:8983/solr/ /config the response 500 internal server error , noticed in logs deployed solr following exception: internal server error (500) - no restmanager found! @ org.apache.solr.rest.restmanager.getrestmanager(restmanager.java:245) @ org.apache.solr.rest.solrconfigrestapi.createinboundroot(solrconfigrestapi.java:67) @ org.restlet.application.getinboundroot(application.java:270) @ org.restlet.engine.application.applicationhelper.start(applicationhelper.java:127) @ org.restlet.application.start(application.java:582) the core created using following post: curl "http://localhost:8983/solr/admin/cores?action=create&name=<keyspace.table>&generateresources=true&reindex=true" this action successful config api fails. the url should be: http://localhost:8983/solr/#/[ks.cf]/config still there convenience/recommended...

How to achieve the following layout on Android -

i'm trying build following layout on android without success. i want text displayed on screen. can take whole width, must centered horizontally. on same line, on right side of screen want display small layout. shouldn't impact horizontal centering of main text , main text shouldn't visible behind layout displayed on right. i cannot use hard color layout background it's displayed on transparent background on bitmap... any idea on how achieve ? i can either use relativelayout in case main text isn't centered based on middle of screen (it takes right layout width account) or text displayed behind right layout... edit: here 1 of test <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:orientation="horizontal" > <textview android:...

javascript - Getting response body for AJAX requests with SlimerJS -

i'm writing test using slimerjs website , need check response body coming server. i'm using following piece of code response: page.onresourcereceived = function (response) { console.log(json.stringify(response)); }; i receive response since default prevent too memory usage slimerjs keeps response body empty receive empty body, unless tell not keep body empty formats using this: webpage.capturecontent = [ /css/, /image\/.*/ ] i understand works files extensions css,jpg , avi, ajax response coming server. response in json format , response body left empty. by looking @ response header can tell response type in text/html using following code can body. page.capturecontent = [/text/, /html/]

ruby - How do you open a zip file using watir-webdriver? -

my test suite has cucumber front end ruby backend, running latest version of watir-webdriver , dependencies atop latest version of osx. cucumber environment setup execute in firefox. the export feature of our app creates zip file test import feature, need contents of zip file. my actual test needs unpack zip file , select individual files in use in testing import feature of our web application. can point me reference can me figure out how write that? based off experience, download file same way normal user might. first off, click download button or whatever , can access file wherever , check out contents. assuming downloads go downloads folder default, there simple code can use select downloaded item: fn = dir.glob("~/downloads/*.zip").max { |a,b| file.ctime(a) <=> file.ctime(b)} then use unzip shell command unzip file. no reason add gem mix when can use generic shell commands. `unzip #{fn}` then, you'd use dir.glob again filenames of ...

How to write a variable value in a text file with php -

i have problem php code. it's simple web page hosted on computer 2 buttons , text box. when click + or - button number in text box increase or decrease. works suppose to, except when want write textbox.value text file using php code. result "value = textbox.value" when should "value = 0". thank you. code below: <!doctype html> <html> <body> <input id="increasenumber" type="button" value="+" style="font-size:24pt; width: 50px; height: 50px;"><br> <input id="textbox" type="text" value="0" style="font-size:24pt; width: 40px; height: 40px;"> <label style="font-size:24pt;">&#8451;</label><br> <input id="decreasenumber" type="button" value="-" style="font-size:24pt; width: 50px; height: 50px;"><br> <script> decreasenumber.onclick = function() { textbox.v...

AppleScript : get all the values of a specified key in a plist file -

Image
i'm looking way values specified key in plist file. indeed, want go through plist file , every time read specified key, put value in array example. thanks lot :) you can try access values sed. assuming: set keyvalues paragraphs of (do shell script "sed -en '/cfbundleiconfile/ { n s/.*>([^<]+).*/\\1/ p }' < " & quoted form of "/users/john/desktop/info.plist")

size - How to get the width of the paper canvas of the Raphael javascript library, which is defined with relative values? -

i playing raphael svg library , defined element holding raphael canvas <div id="canvas_container"></div> and placed raphael canvas/paper inside : paper = new raphael(document.getelementbyid('canvas_container'), '100%', '100%'); now absolute width/height of canvas. figured out how access canvas paper.canvas if try paper.canvas.width svganimatedlength element , not width. i noticed when using chrome dev-tools , selecting paper.canvas in console mouse, proper absolute size appears in window selected element (the blue selection appearing in page when element selected in chrome dev console). how in code ? you can use offsetwidth , offsetheight values of canvas object in order determine true dimensions of raphael canvas. example: http://jsfiddle.net/g54pr/1/

perl6 - how do I create a stand-alone executable with perl 6? -

the old perl 6 faq said: "rakudo, perl 6 compiler based on parrot, allows compilation bytecode, , small wrapper exists can pack bytecode file , parrot single executable." so, possible create stand-alone executable, can not find any docs explaining how go this, or if it's still possible. so, turn you. appropriate set of incantations required convert perl 6 code stand-alone executable work on system not have perl 6 installed. this not possible current rakudo on moarvm. there's still dust needs settle regarding module loading , automatic compilation, once has happened, see no reason why ability couldn't reintroduced if there sufficient demand.

XML via FTP and Memcache slowing my PHP site down all of a sudden....starting today -

i have below php on site. $xml = $my_memcache->load('the_xml'); if(empty($xml)){ $username = 'username'; $password = 'password'; $host = 'ftp.thirdpartysite.co.uk'; $file = 'file.xml'; $xml = file_get_contents("ftp://$username:$password@$host/$file"); $my_memcache->save( $xml, 'the_xml' , array(), '1800' ); } $php_array = $this->parsexml($xml); $html = $this->gatherhtml($php_array); return $html; it looks memcache key/value. if doesnt find key ftp contents , save memcache 5 minutes. want 1 user having users every 5 mins. lastly parses xml php array using 'parsexml()' function, turns php array html using 'gatherhtml()' , returns this. it has been working long time has started making site slow. have not changed code long while. have load balanced on 2 servers , outgoing bandwidth on internal switch has shot up. have checked load , lo...