Posts

Showing posts from July, 2014

OPENCART search by model in featured module -

in opencart when edit featured module, , add new product, search name, , not model... it possible search product model?? , not name this happens in modules need add product you don't need more edit below file only: \opt\lampp\htdocs\opencart\admin\view\template\module\featured.tpl on line no.121 url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_name=' + encodeuricomponent(request.term), you need url: 'index.php?route=catalog/product/autocomplete&token=<?php echo $token; ?>&filter_model=' + encodeuricomponent(request.term), you need filter_model parameter type

java - Is there any differences between send and dsend in SimGrid? -

is there differences between send , dsend in simgrid, except except blocking/ non-blocking function? dsend non-blocking detached send. if non-blocking send, that's isend . difference absolutely have msg_comm_wait() or msg_comm_test() finish communication started isend (the data transfer not occur unless so), cannot interact communication started dsend . the concept of detached communications inspired detached threads, may read on internet.

mysql - SQL update a calculated column -

i have column in table need update. column computed this: select case when timestampdiff(year, geburtstag, now()) <= 27 ((w_staerke/100*70) + (w_technik/100*30)) when timestampdiff(year, geburtstag, now()) <= 31 ((w_staerke/100*70) + (w_technik/100*30)) end marktwert _spieler; i want update column on records table. can use like update _spieler set marktwert = case when timestampdiff(year, geburtstag, now()) <= 27 ((w_staerke/100*70) + (w_technik/100*30)) when timestampdiff(year, geburtstag, now()) <= 31 ((w_staerke/100*70) + (w_technik/100*30)) end; the query seems correct, sets value in "marktwert" 0 every row. create table `_spieler` ( `id` int(10) not null, `vorname` varchar(30) default null, `nachname` varchar(30) default null, `geburtstag` date not null, `w_staerke` tinyint(3) not null, `w_technik` tinyint(3) not null, `marktwert` int(10) not null default '0', `age` tinyint(...

Recieving Illegal start of expression error in Java -

just hoping bit of guidance on code. first bit (see below), trying make instance method pretty add given values. issue keep getting illegal start of expression error. wondering if able explain why, since looks fine me? keep in mind posted portion of code receiving error message. edit wanted open question second since whatever reason recieving odd error. able code completed receiving error message when test stating illegalargumentexception: letter chosen invalid. must t, d, or e. given data 84 ignored. i'm wondering why error message appearing since choosing on of letters , i'm not using 84 number @ all. public int addnewvalue ( char amttype, int amount) { scanner keyboard= new scanner (system.in); system.out.println("please enter amount in dollars"); amount=keyboard.nextint(); system.out.println("please select amount type: t-ticket sales," + " d-donations, e-expenses"); amttype=keyboard.next().charat(0)...

Android keyboard for bank account entry [0-9-xX] -

i need edittext input type allows me increase experience of user when he/she entering bank account or bank branch. numbers should follow rules: account: \d{1,5}-\d{1,2}|x --> 1 5 numeric digits, dash, 1 or 2 numeric digits or 1 x character branch: \d{1,5}(-\d{1,2}|-x)? --> 1 5 numeric digits, dash, zero, 1 or 2 numeric digits or 1 x character as entry have more numeric digits want keyboard offer numbers primarily, , if user have x digit he/she can swap input type. want keyboard symbolic layout displayed first. update: i tried changing input type in edit text xml: <edittext style="@style/subhead.form" android:inputtype="text" android:maxlength="7" app:hint="@{@string/profile_hint_bankbranch}" app:bindto="@{viewmodel.branch.input}" tools:text="1234-5"/> but presents text layout first, expected, tried several other options think none want. in ios i'm using "numbers ...

php - DOMXPath var_dump: "(object value omitted)" -

this question has answer here: how parse , process html/xml in php? 27 answers $store = curl_exec($ch); // returns page of html $doc = new domdocument(); $doc->loadhtml($store); $xpath = new domxpath($doc); vardump $xpath : object(domxpath)#2 (1) { ["document"] => string(22) "(object value omitted)" } what wrong here? i'm trying use xpath on html code extract info. object(domdocument)#1 (34) { ["doctype"] => string(22) "(object value omitted)" ["implementation"] => string(22) "(object value omitted)" ["documentelement"] => string(22) "(object value omitted)" ["actualencoding"] => string(6) "gb2312" ["encoding"] => string(6) "gb2312" ["xmlencoding"] =...

mongodb - How to create sessions in node.js -

in node.js / mongodb want create easy session , give page can know if user logged in or not. want know if can access page or not, how this? how set session , how value check if have redirect user. thanks lot! use express session . it's worth taking @ passport makes implementing authentication in node.js easy. express session example: var express = require('express'); var session = require('express-session'); var app = express(); // make sure defined before of routes // make use of session. app.use(session({ secret: 'keyboard cat', cookie: { maxage: 60000 }, resave: false, saveuninitialized: false })); // access session req.session app.get('/login', function(req, res) { req.session.user = 1; res.end('user 1 logged in, please go /discussion page.'); }); app.get('/discussion', function(req, res) { var sess = req.session; if (typeof sess.user === 'undefined') { res.redirect('/logi...

.net - Compression in IIS 8.5 not successful, stating ALREADY_CONTENT_ENCODING -

Image
i trying debug issue of why pages not being gzip'ed or deflated according yslow. ended enabling failed request logs on server , able see failed reason of why not compressing, thinks compressed. dynamic_compression_not_success reason="already_content_encoding" i have enabled dynamic , static compression in iis, have changed web.config file include following. <httpcompression directory="%systemdrive%\inetpub\temp\iis temporary compressed files"> <scheme name="gzip" dll="%windir%\system32\inetsrv\gzip.dll" staticcompressionlevel="9" /> <dynamictypes> <add mimetype="text/*" enabled="true" /> <add mimetype="message/*" enabled="true" /> <add mimetype="application/x-javascript" enabled="true" /> <add mimetype="application/json" enabled="true" /> <add mimetype="*/*" enabled=...

android - Caused by: java.lang.IllegalArgumentException: value may not be null. when putting data in ParseObject -

i following course on udemy , i'm on section created anonymous user , after activity, tried set anonusername put method in parseobject. above error in title when use: put("riderusername", parseobject.getcurrentuser().getusername()); but "com.parse.parseuser...." when use: put("riderusername", parseobject.getcurrentuser()); this code when press button send parse: public void togglesearch(view view){ parseobject request = new parseobject("requests"); request.put("requestusername", parseuser.getcurrentuser().tostring()); parseacl acl = new parseacl(); acl.setpublicwriteaccess(true); acl.setpublicreadaccess(true); request.setacl(acl); request.saveinbackground(new savecallback() { @override public void done(parseexception e) { if(e == null){ driverstatus.settext("searching drivers..."); } else { driverstatus.set...

php - Get email with facebook SDK 4.0 -

this code have. i'm trying user email can't. yesterday i've getting email correctly i've deleted file mistake. i'm missing now? in login_fb.php i'm calling email this: echo $_session['email']; session_start(); //added in v4.0.0 require_once 'autoload.php'; use facebook\facebooksession; use facebook\facebookredirectloginhelper; use facebook\facebookrequest; use facebook\facebookresponse; use facebook\facebooksdkexception; use facebook\facebookrequestexception; use facebook\facebookauthorizationexception; use facebook\graphobject; use facebook\entities\accesstoken; use facebook\httpclients\facebookcurlhttpclient; use facebook\httpclients\facebookhttpable; //init app app id , secret facebooksession::setdefaultapplication( '','' ); //login helper redirect_uri $helper = new facebookredirectloginhelper('http://www.myurl/facebook/fbconfig.php' ); try { $session = $helper->getsessionfromredirect(); } catch( facebo...

html - I can't seem to be aligning these images properly -

Image
this basic html problem, want create small website wanted have header in middle of 2 images, problem goes cannot both images align properly. the result want in blue letters , result have has black letters , i'm sure kinda unneeded decided include anyway. i'm sure, considering i'm newbie @ html/css i'm doing wrong on here have: html file: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>conversor de coordenadas</title> <script src="conversor.js"></script> <link rel="stylesheet" href="conversor.css"> </head> <body><center> <br> <div class="box"> <img id="globe1" src="globe.gif"/> <h1> conversor de coordenadas </h1> <img id="globe2" src...

angularjs - When the URL changes and the controller is the same, don't reload the view -

i have list of videos, , when user clicks 1 of them, don't want view open. instead want selected video open in overlay on other videos. when overlay video closed, list of videos under reveal again, without need load or request once more. the overlay done simply, such: <div class="overlay" ng-show="watching"> where watching variable video selected playing. in order stop watching video, set watching variable null close overlay. the problem cannot solve here, when click watch video, url has change, because want users able share it. doing so, view reloaded, , animation animated view plays again. bad. i expecting reloadonsearch parameter solve problem, doesn't seem change in regard. declaration of both videos list url, , watch url in config, hoping solve making watch url optional: .when("/videos/:action?/:videoid?", { controller: "videoscontroller", templateurl: "tpl/partials/videos.html", reload...

Unable to detect if the command has ended in a batch file -

i trying create batch file automate process of sass compilation css , further split created css using bless using sass gem of ruby , bless repository of nodejs. approach: i have created 3 batch files, to compile sass css to split created css using bless a master file run both 1 after other. problem: the batch file 1 (sass css) never ends. when execution of sass command on batch process not ends. tried using exit command after sass command still no luck. code batch file 1 -- sass css d: cd d:\webapp\scss_modules sass app.scss ..\styles\themes\app.css exit batch file 2 -- split css using bless d: cd d:\styles\themes blessc app.css -f exit batch file 3 -- master file run above 2 files start /w batch1.bat start /w batch2.bat

php - Twig if/else not working -

i'm not sure why code isn't executing. know should working way happens doesn't else portion. in debugging know descriptions not null , descriptions show have it. {% if descriptions not null %} {{ dump(descriptions) }} {% description in descriptions %} <td>{{ description.productdesciption }}</td> {% endfor %} {% else %} <td> <a href = "{{ path('description') }}">create description product</a> </td> {% endif %} you can simplify using the else clause of statement: {% description in descriptions %} <td> {{ description.productdesciption }} </td> {% else %} <td> <a href = "{{ path('description') }}">create description product</a> </td> {% endfor %} hope help

sql - returning id in order from query -

say have following query select * foo p_key in (5,7,2,6); when enter query, p_key values return rows in order of 2,5,6,7. how can make returns rows in order entered in in clause this p_key 5 7 2 6 not this p_key 2 5 6 7 you can't directly order order of items in in clause. you'll have create temporary table or in-line sub-query add order values: select foo.* foo inner join ( select 5 [key], 1 [order] union select 7 [key], 2 [order] union select 2 [key], 3 [order] union select 6 [key], 4 [order] ) j on p_key = j.key order j.[order]

Move some changes from a Git commit into a separate commit -

i'm on feature branch single commit (as result of interactive rebase squashed of commits). i've decided, prior pushing origin , creating pull request i'd take subset of changes (at file level) in commit , make second commit out of them since they're logically separate issues. how can this? the change i'd break out never in it's own commit, got bundled first commit did part of work on feature branch. move changes git commit separate commit in nutshell: reset last commit , make 2 new commits if understand correctly, want keep of changes in original commit, , put smaller subset of changes in second commit. if case, first want soft reset last commit (thanks @hvd tip): git reset --soft head^ this remove last commit, not changes, if commit never happened, , changes staged. @ point, want unstage files don't want in first commit. can unstage file file or directory directory, this: git reset -- path/to/file-or-dir now can commit major...

c++ - debug error, abort has been called when assigning a value to an Eigen matrix element -

i'm writing finite element program, , need library matrix alocation , manipulation. eigen seemed fine. but got weird bug where: double numero = get_coordenada(elemento.no1, 'x', vector_de_nos); m_coord_nos(1, 1) = numero; works fine. but this: m_coord_nos(1, 1) = get_coordenada(elemento.no1, 'x', vector_de_nos); or this: m_coord_nos(1,1) = vector_nos[elemento.no1].x; gives me debug error, abort() has been called. vector_nos vector of struct_no, made 3 double values, x, y , z. get_coordenada function returns double value. i'm stumped. why getting error?

c# - How to remotely deploy actor with dynamic name in Akka.NET -

when @ samples of akka.net actor remote deployment, done via actor system configuration this: actor { provider = ""akka.remote.remoteactorrefprovider, akka.remote"" deployment { /myactor { remote = ""akka.tcp://myactors@127.0.0.1:8091"" } } } the string "myactor" above actual actor name. not clear me how deploy actor have dynamic name (e.g. "myactor:{uid}") or deploy unknown number of actors remotely? there way dynamically configure deployment options via code? seems bit tedious , limited specify remotely deployable actor names in configuration. you can set deployment options using actor's props like: props.create(() => new myactor).withdeploy(new deploy(new remotescope("akka.tcp://remote-system-name@ip:port/"))) .

javascript - Error: Can't set headers after they are sent. node.js -

i'm tring coed application lets users execute commands on url error message: _http_outgoing.js:346 throw new error('can\'t set headers after sent.'); ^error: can't set headers after sent. @ serverresponse.outgoingmessage.setheader (_http_outgoing.js:346:11) @ serverresponse.header (c:\users\jarvis\node_modules\express\lib\response.js:718:10) @ serverresponse.json (c:\users\jarvis\node_modules\express\lib\response.js:246:10) @ c:\users\jarvis\desktop\sys.js:9:6 @ childprocess.exithandler (child_process.js:193:7) @ emittwo (events.js:100:13) @ childprocess.emit (events.js:185:7) @ maybeclose (internal/child_process.js:850:16) @ process.childprocess._handle.onexit (internal/child_process.js:215:5) this code: var express = require('express'); var app = express(); var sys = require('sys'); var exec = require('child_process').exec; var child; app.get("/:cmd", function(req, res) { child = exec(req.params.cmd, function (error, std...

osx - How to access webserver running on localhost from a docker container on a network? -

i have following system configuration: docker container running on user defined network docker-machine (with virtualbox on os:x forwarding port 9000 9000) local webserver running on http://localhost:9000 i not know how make basic http request against webserver, within docker container. to test using: docker exec testcontainer curl --data "foobaz=foo" http://{hostname}:9000/ where have tried, hostnames: 'localhost' '127.0.0.1' '192.168.99.100' (docker-machine ip) each time receive errors or timeouts. when run curl command locally (not in docker , on host os:x machine) able post http request. i cannot disconnect docker container user-defined network. cannot add webserver to network, not running in container. also, know trivial connect other way (curl webserver running in docker container) not use case. how can route http request docker container part of user defined network localhost webserver? you can actual ip a...

c# - How to access a certain element and retrieve the data XML -

my xml looks this. can contain n numbers of modules , n number of assignments. assignments nested in modules contains: <?xml version="1.0"?> <course name="engineering"> <level4> <module name="electric" creditval="22"> <assignment name="wer" score="22" weight="50"> </assignment> <assignment name="asd" score="50" weight="50"> </assignment> </module> <module name="materials" creditval="22"> <assignment name="ghj" score="22" weight="75> </assignment> <assignment name="kl" score="80" weight="15"> </assignment> </module> </level4> </course> i accessing modules , assignments following: xpathdocument xpd = new xpathdocument("xml...

Google Sheets (Excel): How Do I Iterate a Multiplier, Based on A Supplied Value -

Image
i'm need know how achieve following scenario using google sheets / excel. apologize if subject wasn't accurate, challenging put words. :) (where "x" variable supplied user; "y" multiplier applied forumla).... if x < 10,000 y = 1; if 20,000 > x >= 10,000 y = 2; if 30,000 > x >= 20,000 y = 3; etc... how create formula without having hard-code every possible if statement in order increment "y"? thanks in advance everyone. appreciate amount of you're able offer. if steps incremental, example formula simple: y=int(x/10000)+1 if not simple example using table vlookup easier , allow changes made without rewriting nasty nested if(): on 1 sheet put table of thresholds , multiplier: then simple vlookup() find correct multiplier: =vlookup(d2,$a$1:$b$8,2)

TCP receiving and sending buffersizes in node.js -

i have been working node.js last 4 month , wants increase tcp receving , sending buffersize. my purpose speed application , expermantation buffersizes may increase preformance. i have searched on google haven't found useful except can change default socket buffersizes on linux example on website: http://www.cyberciti.biz/faq/linux-tcp-tuning/ is there way change/set tcp sending , receiving buffersizes node.js io? stream_wrap has allocation callback passed libuv passed suggested_size of allocated memory use in receiving data. right passes 64kb suggested size, , there's no way change afaik. is along line of question?

javascript - Append variable at end of href? -

i trying generate twitter stream widget based on users search. using api, easy make 1 if search term known, such "corgi". here code: i want able delete "corgi" obviously, , replace whatever search for. edit: after research online, believe solution bit more complicated appending variable href. using this: $(document).ready(function() { // upon form submission $("#formy").submit( function(e) { // stop <form> refreshing e.preventdefault(); // store user's input var id = $('#searchbar').val(); //make rest call twitter api $.ajax({ url: '/search', type: 'post', data: {id:id}, datatype: 'text', success: function(data) { // redirect reults page window.location.href = '/test'; data = json.parse(data); //console.log(data); // store data rest call in local storage ...

WSO2 Identity Server Disable Rule (PDP) not Reflecting in Java Client (PEP) -

after adding new policy , disabling outdated policy @ pdp console, action displays correctly @ pdp policy view, connected pdp process using java client did not reflect logic added new policy, still acting according older, disabled rules. tried run "clear decision cache" and" clear attribute cache" widgets @ pdp extension screen, , pep still showing same issue. a graceful restart of wso2 did solve error. server running wso2 5.1 release. operational standpoint, restart command rather disruptive action , should avoided. are further configuration, or command options available @ wso2 package drop cache , dynamically refresh active policy without causing disruption of ongoing services? this tested , working scenario in 5.1.0. understood, wanted edit policy , should reflect changes after publish new policy without doing other operation, right ? yes, when publish same policy again new changes, replace new policy in db , cache in cluster well. sh...

c# - How can i get ap rocess window handle intptr and save the process window to image file? -

i have method drawtobitmap how handle of process window ? example notepad.exe what want when start program if process(for example notepad.exe) not running yet start once it's running it's window handle , save window image file. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; using elgato.baseclasses.ui; using elgato; using elgato.baseclasses.streaming; using system.diagnostics; using system.runtime.interopservices; namespace windowsformsapplication1 { public partial class form1 : form { [dllimport("user32.dll")] private static extern bool printwindow(handleref hwnd, intptr hdcblt, int nflags); [dllimport("user32.dll", setlasterror = true)] [return: marshalas(unmanagedtype.bool)] private static extern bool getwindowrect(intptr hwnd, ref...

javascript - slicknav not being displayed -

i have question slicknav script slicknav.com i used slick nav script hamburger effect @ breakpoint 640px. http://graph-art.matc.edu/harrisd5/vicom126/a2/index.html now if worked flawlessly in these 4pages of website: the home page, aboutus, faq2(frequently asked question), , index page. happen know why script isn't working on portofolio page: http://graph-art.matc.edu/harrisd5/vicom126/a2/portofolio.html what i'm doing wrong cause script not function? i'm not sure meant wasn't working inspecting code noticed .slicknav_menu { display:none; } with above in css slicknav not display. replacing none else inline i've done below. .slicknav_menu { display:inline; } now left work on position , links pages want

performance - How to speed up Pandas multilevel dataframe shift by group? -

i trying shift pandas dataframe column data group of first index. here demo code: in [8]: df = mul_df(5,4,3) in [9]: df out[9]: col000 col001 col002 stk_id rpt_date a0000 b000 -0.5505 0.7445 -0.3645 b001 0.9129 -1.0473 -0.5478 b002 0.8016 0.0292 0.9002 b003 2.0744 -0.2942 -0.7117 a0001 b000 0.7064 0.9636 0.2805 b001 0.4763 0.2741 -1.2437 b002 1.1563 0.0525 -0.7603 b003 -0.4334 0.2510 -0.0105 a0002 b000 -0.6443 0.1723 0.2657 b001 1.0719 0.0538 -0.0641 b002 0.6787 -0.3386 0.6757 b003 -0.3940 -1.2927 0.3892 a0003 b000 -0.5862 -0.6320 0.6196 b001 -0.1129 -0.9774 0.7112 b002 0.6303 -1.2849 -0.4777 b003 0.5046 -0.4717 -0.2133 a0004 b000 1.6420 -0.9441 1.7167 b001 0.1487 0.1239 0.6848 b002 0.6139 -1.9085 -1.9508 b003 0.3408 -1.3891 0.6739 in [10]...

objective c - How to test class methods using OCMock -

i wonder if there way using ocmock can invoke class method twice separately if app runs 2 times, in fact, once. i want test class method. due static variables inside method, method keep behavior time once it's called. can't test different behaviors @ 1 time. and of course, can't add else class if purpose testing. there not way alter statically declared variables ocmock without exposing them via objective-c methods. "of course" can't add class testing purpose, not universally accepted. there entire school of thought believes code should designed tested. - (nsinteger)somestatic { static nsinteger _somestatic = 42; return _somestatic; } if used pattern that (for example, there may better ones) mock static. while add method call anywhere static used, may find more important have comprehensive testing.

c++ - const reference syntax difference between visual studio and gcc -

#include <iostream> void swap(float& const a, float& const b) {} int main() { std::cout << "hello, world!\n"; } this simple code compiles in visual studio (vs2013) not in gcc. have tried c++ 10 , c++11. gcc gives error saying error: 'const' qualifiers cannot applied 'float&' but if change function definition void swap(float const &a, float const &b) it compiles in gcc , visual studio. my question is, both these syntaxes mean same thing? also, why compiles visual studio , not gcc float& const a invalid. reference cannot const . can refer const object cannot const (it meaningless since it's not reseatable). c++14 §8.3.2/1: ” cv-qualified references ill-formed except when cv-qualifiers introduced through use of typedef-name (7.1.3, 14.1) or decltype-specifier (7.1.6.2), in case cv-qualifiers ignored. a decltype-specifier use of decltype keyword. visual c++ 2015 war...

ios - Swift #selector in subclass -

after updated xcode , can build code ios 9.3 now, have lot of warnings updating syntax conform upcoming swift version 3 . many warnings selector , i'm using this: class foo { func registerpan() { let recognizer = uipangesturerecognizer(target: self, action: selector("handlepan:")) //do recognizer } func handlepan(recognizer:uipangesturerecognizer) { //handle pan gesture } } class bar: foo { override func handlepan(recognizer:uipangesturerecognizer) { //overriding handle pan gesture } } so instances of foo , bar have own ways handle pan gesture. xcode suggests me change method use selectors, use #selector expression . automatic suggested change editor is: #selector(foo.handlepan(_:)) here comes question. in previous version, specific implementation called base class , subclass. now, looks function of foo called instance of bar class ( bar inherits registerpan function foo ). correct? probab...

reference - PHP: variable value mysteriously set to 0 -

thanks in advance help! have situation i'm trying debug variable mysteriously set 0. i know xdebug (using phpstorm) happens @ specific line: // breakpoint here: $id_key 'my_entity_id_key' $e_entity_ids = my_module_fetch_col_keyed($query, $id_key, $created_column); // breakpoint here: $id_key 0 it's weird, because $id_key not reference, nor function take reference parameter. also, after value has changed 0 , $id_key blue in variables pane of debugger. i've tried making copy of variable , using pass function instead: $id_key2 = $id_key; $e_entity_ids = my_module_fetch_col_keyed($query, $id_key2, $created_column); // breakpoint here: $id_key 0, , $id_key2 i'm wondering: how value of $id_key mysteriously changing 0? how can create copy of $id_key it's not changed when pass copy my_module_fetch_col_keyed() ? what mean when variable name blue in variables pane in phpstorm? when step my_module_fetch_col_keyed() , there's line after $...

wix3.5 - Stop setup error inside Custom Action With WIX installer -

Image
can able stop setup if error display inside customaction. can able display error message inside custom action , it's dispaly error message click on ok button next ui sequence form appearing.how force user finish button? adding source code: <binary id="bin_customaction" sourcefile="customaction.ca.dll" /> <customaction id="ca_checklist" binarykey="bin_customaction" dllentry="ca_checklist" execute="immediate" impersonate="yes" return="ignore" /> <ui id="mywixui_mondo"> <uiref id="wixui_mondo" /> <uiref id="wixui_errorprogresstext" /> <dialogref id="userregistrationdlg" /> <dialog id="userregistrationdlg" width="370" height="270" title="[productname] setup" nominimize="yes"> <control id...

osx - How to install a .pkg from Java Runtime? -

i automating installation of .pkg file in mac os x using java , have command bash console: echo 'control123' | sudo -s installer -pkg /users/george/downloads/mypackage.pkg -target / i executing command java runtime: runtime.getruntime().exec("echo 'control123' | sudo -s installer -pkg /users/george/downloads/mypackage.pkg -target /"); but package not installed, if execute command in bash console. works normally. you shouldn't assume user has root privileges, , it's better idea launch installer user can authorize , update application there. if makes sense, it's possible launch .pkg way, sudo not required: string userhome = system.getproperty( "user.home" ); string cmdstring = ("open " + userhome + "/downloads/mypackage.pkg"); i'm not sure why need echo 'control123', might need echo separately.

How change all dates in array into date without time - laravel -

i have collection of model in $object . then, purpose of delivering data charts.js dates: var labels = {!! $object->pluck('created_at') !!}; the content looks this: ["2014-06-21 13:22:14","2014-06-28 07:42:26","2016-02-17 17:39:21"] how transform array taht contains dates in format("y-m-d") format? ["2014-06-21","2014-06-28","2016-02-17"] for convenience: http://nnnick.github.io/chart.js/docs-v2 in model class mymodel extends model { /** * created_at in date format ==> 1975-12-25 * * @param string $value * @return string */ public function getcreatedatdateattribute($value) { return $this->created_at->todatestring(); } } then var labels = {!! $object->pluck('created_at_date') !!};

php - How can I add a Drupal Commerce Fee programmatically? -

Image
i know how add line item programmatically, can't seem find way add custom commerce fee in php. commerce fees seem register in 2 locations in order array: once under commerce_line_items, , once under commerce_order_total (see attached image). different regular line item in don't show products, rather in order totals box @ end of order. fee shown in attachment 1 has been entered using edit form in admin section. need add 1 in code. ideas?

objective c - iOS - Adding gradient as background to all view controllers -

i set background view controllers gradient. currently, running in viewdidload(): cagradientlayer *gradient = [cagradientlayer layer]; gradient.frame = self.view.bounds; gradient.colors = [nsarray arraywithobjects:(id)[uicolorfromrgb(0x10425e) cgcolor], (id) [uicolorfromrgb(0x487f9d) cgcolor], nil]; [self.view.layer insertsublayer:gradient atindex:0]; how can view controllers without having put in every view controller's viewdidload()? make uiviewcontroller subclass code, use base class view controllers.

How to change the color of operators and methods in vim? -

Image
recently i've been trying create own color scheme vim. i've been writing in-file, referencing vivify hi syntax calls , site rgb color codes. after changing of color scheme, , creating i'm happy with, noticed can't change color of operators (i.e. +, -, =, || etc.) or color of methods (e.g. object.method() ), both of these fall under keyword normal. being java programmer, , having used netbeans ide point, it's kind of tough not have differentiation between objects , methods. such hoping know of work-around, or way color such forms of syntax not changeable via pre-reserved keywords. here's relevant color scheme: create file $home/.vim/after/syntax/java.vim with: " highlight operators syntax match _operator "[-+&|<>=!\/~.,;:*%&^?()\[\]{}]" " highlight methods syntax match _paren "?=(" contains=cparen,ccppparen syntax match _memberfunc "\.\s*\w\+\s*(\@=" contains=_operator,_paren " color...

mkdir: No such file or directory error -

i trying mount file system using read only, getting error. # cd downloads # ls .localized # mkdir /mnt/temp mkdir: /mnt/temp: file exists # mount -o ro,loop -t ext3 system1 /mnt/temp mount: exec /library/filesystems/ext3.fs/contents/resources/mount_ext3 /mnt/temp: no such file or directory` why isn't /mnt/temp showing up? in sudo

Reading an Rank 2 array in FORTRAN 95 -

i want read array text file looks this 1 88 90 94 102 111 122 134 2 75 77 80 86 94 103 113 3 80 83 85 94 100 111 121 4 68 71 76 85 96 110 125 5 77 84 91 98 105 112 119 6 81 85 90 96 102 109 120 (above data 6 8 matrix, evenly spaced, might not show correctly my code program cool implicit none integer:: ok(6,8),k,i open(unit = 1, file = "a.txt") read(1,*) ok write(*,*) ok print*,ok_1(4,3) end program cool the issue having ok(4,3) not correspond 71 ( 4th row down ,3rd column) i have tried read file such read(unit =1,10) ok 10 format ( 8(i4)) ! have tried variants of this what ever way try, calling ok(i,j) not correspond value need i need find row averages , column averages out column 1 included. simple loops long can correct values, can not edit:: have tried hard code array in program ok = reshape((/1,88,90,94,102,111,122,134,& 2,75,77,80,86 ,94 ,103,113,& 3,80,83,85,94 ,100,111,121,& 4,68,71,76,85...

php - FOS UserBundle wrong Output -

i have problem use of fos userbundle. when call register action form named this. form.username form.email form.password form.password_confirmation if want send confirmation email message this registration.email.message another question be, how can add more information user manual? may enter in registration name, birthday, place of residence or like. i think it's wrong translation, right? can u tell me, going wrong? in user class can add property want , extend user information needed. need extend registration , profile form types , tell fosuserbundle exact classes. on, extended forms used in registration , co. the documentation on overriding default fosuserbundle forms starting point.

javascript - Anchor tag behavior on <tr> element in React -

i'm creating react application component looks this: class tablerow extends react.component { constructor(props) { super(props) } render() { const handleclick = () => window.location.href = "some-url"; return ( <tr> <td>something 1</td> <td>something 2</td> <td>something 3</td> <td>something 4</td> </tr> ); } } i want < tr > tag behave < a > tag, can: click on , have go "some-url" command+click on , have go "some-url" in new tab scenario 1 simple since can add onclick property onto < tr >, when try command+clicking on it, doesn't open in new tab. i don't want wrap entire component within < a > tag since react throws warning saying < tbody > tag shouldn't have < a > tags children. don't ...

c# - How to connect localhost ASP.net WCF service with android mobile? -

i tried different ip address , port number unable establish connection mobile pc network. i disabled firewall also. want see web service running in pc should view in mobile. http://10.0.2.2:63114/restserviceimpl.svc/jsont/k1234

Where do I have to place the code returned by Google oAuth after I grant access to an installed application, using PHP? -

this has been nightmare right past few days. first struggling redirect_uri_mismatch errors, or bad requests, thought nailed it, i'm getting message google after clicking "allow" button in consent screen : please copy code, switch application , paste there where need paste code? i'm using php in web server, went "other" application type when creating credentials, because read preferred if didn't want users keep getting auth link. i can't seem find concrete example of how this, got working far grabbing bits here , there, 1 can't figure out. https://gist.github.com/andruxnet/0f7fe237730c13846a690da12935a708 i'm using file client_secret.json downloaded google's oauth credentials screen, looks this: {"installed":{"client_id":"xxxxxxxxxxxxxxx.apps.googleusercontent.com","project_id":"my-project-id","auth_uri":"https://accounts.google.com/o/oauth2/auth","t...

android - Alarm manager and broadcaster receiver not working -

my alarm manager class public class psmscheduler { public static void setschedule(context context) { setschedule(context,0,0,5); setschedule(context, 18, 30, 0); } private static void setschedule(context context, int hour, int min, int sec) { // request code distinguish different stress meter schedule instances int requestcode = hour * 10000 + min * 100 + sec; intent intent = new intent(context, emaalarmreceiver.class); pendingintent pi = pendingintent.getbroadcast(context, requestcode, intent, pendingintent.flag_cancel_current); //set pending intent call emaalarmreceiver. calendar calendar = calendar.getinstance(); calendar.settimeinmillis(system.currenttimemillis()); calendar.set(calendar.hour_of_day, hour); calendar.set(calendar.minute, min); calendar.set(calendar.second, sec); if(calendar.gettimeinmillis() < system.currenttimemillis()) { calendar.add(calendar.date, 1); } //set repeating ala...

c# - The resource cannot be found. after adding new page? -

i have created new mvc4 web application, , adding new view in views called login.aspx. when try access way accessing about.aspx ( generated automatically new project ) - receiving "the resource cannot found." type of error. what cause issue ? sole view not enough in asp.net mvc add new page application. have to: create controller corresponding action, or add new action 1 of existing controllers. implement action return necessary view (login in case). make sure action covered 1 of existing routes. if not - add new route. for details can review this tutorial on msdn.

php - Cant get Beautymail to work for Laravel 5.2 -

Image
i'm trying use beautymail project send receipt after customer ordered something. problem i'm using beautymail in function not in route documentation states. this how im using in function: class ordercontroller extends controller { public function postorder(request $request) { // more stuff here, shortned question purposes // instance of authenticated user $user = auth::user(); // send email conformation user bought product or products. $beautymail = app()->make(snowfire\beautymail\beautymail::class); $beautymail->send('emails.welcome', [], function($message) { $message ->from('example@admin.com') ->to($user->email, $user->username) ->subject('your receipt'); }); // return redirect success message flash()->success('success', 'your order processed successfully. receipt...

matlab - Set breakpoint within a different function using dbstop -

my main.m goes clear dbstop in a.m if a1>3 x=1; y=2; a(x,y) the a.m goes function [a1, a2] = a(x,y) a1=x+y a2=x-y while a1<5 a1=a1+1 end end but when run main.m, face following error. breakpoint expression 'a1>3' resulted in error. error undefined function or variable 'a1' why case? i tried main.m looks like clear x=1; y=2; a(x,y) dbstop in a.m @ 5 if a1>3 but results in same error message. as have noted, can use dbstop set breakpoint in file given specific condition. trick condition has able able evaluated @ every in relevant file a.m if not specify particular line number breakpoint. if @ function a , you'll see a1 not defined on first line (i.e. it's not input argument , doesn't defined until next line) results in error. i recommend setting breakpoint @ specific line. in case, i'm assuming want catch @ point within while loop maybe set conditional breakpoint @ line 5. dbstop in a....

multithreading - Converting from Timeline to Thread -

i trying create program runs off of thread instead of timeline. here modified program down below. not sure why not work. tips appreciated. thread uses task in order start animation. help. import javafx.animation.keyframe; import javafx.animation.timeline; import javafx.application.application; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.borderpane; import javafx.scene.layout.hbox; import javafx.scene.layout.pane; import javafx.scene.paint.color; import javafx.scene.shape.arc; import javafx.scene.shape.arctype; import javafx.scene.shape.circle; import javafx.stage.stage; import javafx.util.duration; public class ch30 extends application { @override // override start method in application class public void start(stage primarystage) { fanpane fan = new fanpane(); hbox hbox = new hbox(5); button btpause = new button("pause"); button btresume = new button("resume...

javascript - Activate radiobutton when text box is selected -

i trying setup javascript form validation on form working on. have of validation working, 1 thing have been tasked doing can't seem figure out , can't find many articles online it. the challenge have if user wants type in "other" field on text box want "other" radio button automatically checked. here's code had in there isn't working me. if (f.othertextvalue.value !== '') { document.getelementbyid("othertextradio").checked = true; return false; } so think trying this: if othertextvalue (my text box) not blank go id of radio button , make checked/selected. i still new in world of javascript, trying learn. thank help. bind event handler text element, , set state of checkbox according whether there value or not: $('#othertextvalue').on('keyup', function() { $('#othertextradio').prop('checked', !!this.value.length); }); you may want use additional events, triggers ...

timer - Running time for python -

hi trying estimate run time fft code form numpy. different input length n. following code. import cmath import math random import uniform numpy.fft import fft import time in range(3,10): n = 2**i x = [uniform(-32768,32767) in range(n)] t0 = time.clock() x = fft(x) t1 = time.clock() print t1-t0 this result got, first line input length n=3 should fastest one, no matter how many times run, first 1 largest one. guess problem timer, don't know exact reason it. can explain me? output: 4.8e-05 3e-05 1.7e-05 6e-05 3.1e-05 5.4e-05 9.6e-05 the time interval small accurately measured time.clock(), there latency jitter in os call. instead, enough work (loop each fft few thousand or million times) until work measured takes few seconds. repeat each measurement several times , take average, there may other system overheads (cache flushes, process switches, etc.) can vary performance.

Java Manually convert Array to Node list -

so have following class , trying make method array converted node list. tried loop can't through mind trying set next each value. public class node { public node(int value, node link) { data = value; next = link; } public void setdata(int n) { data = n; } public void setnext(node link) { next = link; } public int getdata() { return data; } public node getnext() { return next; } private int data; private node next; public node arraytolist(int[] a) { (int = 0; < a.length-1; i++) { node n = new node(a[i], //a[i+1] must node, how loop next node); } } } just iterate array in reverse order. take care save succ between iterations, , keep n ready final return. public node arraytolist(int[] a) { node succ = null; node n; (int = a.length-1; >= 0; i--) { n = new node(a[i], succ ); succ = n; } return n; }

php - How to get Chosen Multiselect selected values under the For Loop -

this view file code <?php for($i=0; $i<4; $i++) { ?> <div class="box22"> <div class="mcm"> <input type="text" placeholder="myself" id="coworkers" name="coworkers[]" /> <span class="bar"></span> </div> <div class="select2"> <select id="category_<?php echo $i; ?>" name="category[]" class="chosen-select ref-sel1" multiple > <?php foreach($genre $gen){ echo '<option value='.$gen->genre_id.'>'.$gen->genre_name.'</option>'; } ?> </select> </div> </div> <?php } ?> my script : when chose 1 or more option, not comes script. how multiple values under loop $(document).ready(function() { $('form#shortfil...

How to convert this SQL to LINQ in C#? -

i have query in sql query below: with pagedetail ( select c.componentrefid, l.name, c.startdate, row_number() over(partition c.componentrefid order c.startdate desc) rownumber fm_componenttransaction c inner join fm_lk_statusinfo l on c.statusinforefid = l.refid inner join fm_scriptinfo s on s.refid = c.scriptrefid s.customerinforefid = '85629125-7072-4efe-9201-97e088e126c6' ) select pd.* pagedetail pd pd.rownumber = 1 i can output of this. questions how implement query using entity framework? i know not direct answer question, 1 approach create stored procedure in sql, , call stored procedure in entity framework. code first: how call stored procedure in entity framework 6 (code-first)? database first: https://msdn.microsoft.com/en-us/data/gg699321.aspx

content type - How to add new collection criteria in Plone 5? -

i add new choice field named course dexterity content type file in new created instance. in order use field "course" criteria in /++add++collection, follow this guide , add these file registry.xml in plone/buildout-cache/eggs/plone.app.querystring-1.3.14-py2.7.egg/plone/app/querystring/profiles/default/registry.xml: <records interface="plone.app.querystring.interfaces.iqueryfield" prefix="plone.app.querystring.field.course"> <value key="title">course</value> <value key="description">a custom course index</value> <value key="enabled">true</value> <value key="sortable">false</value> <value key="operations"> <element>plone.app.querystring.operation.string.is</element> </value> <value key="group">metadata</value> </records> but can not find "course" in criteria list. what can...