Posts

Showing posts from August, 2014

linux - Continuously print stdout and write to file -

i have program intermittently print stdout. want see output on screen , redirect file. i can use tee follows: foo | tee ./log.txt however, print output screen when foo has terminated not allowing me observe progress of program. is there way continuously show output of program , redirect log file? is acceptable write output file , display live ? $> foo > ./log.txt & tail -f ./log.txt

csh - No appropriate Python interpreter found Cassandra Python 3.1,3.4 -

Image
i've installed cassandra 3.9 on centos 6.7 has python 3.1.1 installed @ /usr/local/bin/python. when try start cql shell, says no appropriate python interpreter found. tried installing python 3.4 , alias it. gives same error. i have few questions on this. what compatible python versions cassandra 3.9 supports? how change python version permanently existing version mounted on read-only file system(which python) version install now?(using cshell) i echo'd pyver variable being used. says 2.7 should compatible cassandra 3.9 still gives error.

reactjs - Express API with JWT returns "Unauthorized: Invalid Algorithm error" -

i've written simple react app, following instructions of out of date tutorial meant display list of contacts in sidebar individual contact data displayed in index component if have been authenticated logging auth0 component , have json web token kept in local storage. have confirmed logged in , have token. point working fine. the problem begins when click on contact in sidebar view contact's data, comes down pretty basic api set express. i've been using postman troubleshoot since error app "401: unauthorized" when hit endpoint, suppling authorization header "bearer [jwt_value_here]" postman responds "unauthorizederror: invalid algorithm" the full output unauthorizederror: invalid algorithm    at /users/arkham/documents/web/eldrac/react-auth-server/node_modules/express-jwt/lib/index.js:102:22    at /users/arkham/documents/web/eldrac/react-auth-server/node_modules/jsonwebtoken/verify.js:27:18    

jquery - shuffle and sort using javascript -

i new javascript, trying draw number grid having values 1-9. 2 buttons shuffle , sort them on click . the grid looking for i able shuffle numbers, not able assign them divs. appreciated. also need on passing hex color values (shown in img) each div. $(".btn_shuffle").click(function () { var cardnumbers = []; $('.card').each(function () { cardnumbers.push(this.innerhtml); }); var thelength = cardnumbers.length-1; var toswap ; var temp; console.log(cardnumbers); for(i=thelength; i>0; i--){ toswap = math.floor(math.random()*i); temp = cardnumbers[i]; cardnumbers[i] = cardnumbers[toswap]; cardnumbers[toswap]=temp; } console.log(cardnumbers); }); the fiddle tried $(".btn_shuffle").click(function () { var cardnumbers = []; $('.card').each(function () { car

javascript - Error: No images were returned from Instagram -

hi integrating instagram photos on website.i have getting images uploaded me using instafeed.js have take access public_content of instagram.i have generating access token also. when have used tagged images time getting error. "error: no images returned instagram" working code user uploaded images <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> <script src="http://garand.me/assets/script/instagram.js"></script> </head> <body> <div id="instafeed"></div> <script type="text/javascript"> $(document).ready(function () { var userfeed = new instafeed({ get: 'user', userid: xxx, clientid: 'xxxxxx', accesstoken: 'xxxx', template: '

deployment - Jenkins deploy with Ranorex -

i in environment in not , not have ci environment while. looking tools can following: 1. detect new preexisting build on network share , deploy build on networked vm. 2. after build deploy complete, need our automation tool (ranorex) kicked off , run against vm build. i know jenkins more , should integrated ci environment, now, need these things. can jenkins this? if how set pipeline these actions?

java - Properly removing an Integer from a List<Integer> -

here's nice pitfall encountered. consider list of integers: list<integer> list = new arraylist<integer>(); list.add(5); list.add(6); list.add(7); list.add(1); any educated guess on happens when execute list.remove(1) ? list.remove(new integer(1)) ? can cause nasty bugs. what proper way differentiate between remove(int index) , removes element given index , remove(object o) , removes element reference, when dealing lists of integers? the main point consider here 1 @nikita mentioned - exact parameter matching takes precedence on auto-boxing. java calls method best suits argument. auto boxing , implicit upcasting performed if there's no method can called without casting / auto boxing. the list interface specifies 2 remove methods (please note naming of arguments): remove(object o) remove(int index) that means list.remove(1) removes object @ position 1 , remove(new integer(1)) removes first occurrence of specified element list.

selenium show empty logs -

please give me tip. idea check chain of redirects , control final page. redirects urls selenium's performance logs. idea works, try page url http://aiasmbapps.tk/dload/app/a767459c8a3adb46bd099ca8425f625c/mixapp.apk (this final url, before 3-4 redirects). empty logs code options=new chromeoptions(); options.setbinary("/usr/bin/chromium-browser"); options.addarguments(standardoptions); options.addarguments("--safebrowsing-disable-download-protection"); options.addarguments("--user-agent=mozilla/5.0 (linux; android 5.1; m2 note build/lmy47d) applewebkit/537.36 (khtml, gecko) chrome/58.0.3029.83 mobile safari/537.36"); capabilities=desiredcapabilities.chrome(); capabilities.setplatform(platform.android); string downloadfilepath = "/tmp"; prefs.put("profile.default_content_settings.popups", 0); prefs.put("download.default_directory", downloadfilepath); prefs.put("safebrowsing.enabled", "false"); o

mdt - Microsoft Deployment Toolkit setting SystemAutoLogon registry key when deploying upgraded OS -

i'm trying deploy images via mdt have been upgraded via mdt "standard client upgrade" task sequence. images started win10 v1607 images , updated v1703 , captured. when go deploy captured images, i'll popup on first login c:\ltibootstrap.vbs can't found. digging, discovered after os installed , pc restarts, mdt task sequence continues running the system account . bizarre typically runs built-in administrator account. for reason, though unattend.xml file contains usual autoadminlogon entries, registry key at hklm\software\microsoft\windows nt\currentversion\winlogon\systemautologon is being created , set 1 during deployment. (i discovered comparing registries @ end of deployment.) key not present in captured image. this key not created if deploy image manually updated v1703 (via windows update instead of mdt). any ideas on why unattend.xml ignored or cause systemautologon created , set? i figured out going on. the mdt upgrade task sequence

r - How can I create new column in data frame by aggregating rows? -

i have large (~200k rows) dataframe structured this: df <- data.frame(c(1,1,1,1,1), c('blue','blue','blue','blue','blue'), c('m','m','m','m','m'), c(2016,2016,2016,2016,2016),c(3,4,5,6,7), c(10,20,30,40,50)) colnames(df) <- c('id', 'color', 'size', 'year', 'week','revenue') let's week 7, , want compare trailing 4 week average of revenue current week's revenue. create new column average when of identifiers match. df_new <- data.frame(1, 'blue', 'm', 2016,7,50, 25 ) colnames(df_new) <- c('id', 'color', 'size', 'year', 'week','revenue', 't4ave') how can accomplish efficiently? thank help good question. loops pretty inefficient, since have check conditions of prior entries, solution can think of (mind you, i'm intermediate @ r): for (i in 1:nr

javascript - Format an object parsed from JSON -

i need create array external json file looks this { "cases":[ { "case_no":1, "case_input":[ { "input1":6, "input2":[1,2,3,4,10,11] }], "case_output":31 }, { "case_no":2, "case_input":[ { "input1":5, "input2":[5,5,5,5,14,17] }], "case_output":51 } ] } i need create array needs this ["6↵1 2 3 4 10 11","5↵5 5 5 5 14 17"] how can javascript your input json object not valid has duplicate object keys siblings (input). unless rename them distinct there no way can expected result. assuming, have distinct keys; here jsfiddle // code goes here 'use strict'; let jsobj = { "cases":[ { "case_no":1, "case_input":[ { "

c# - How do i set up a default for ActiveAuthenticationSchemes? -

in asp.net core 2 project, have custom authenticationhandler middleware want plug in. public class basicauthenticationmiddleware : authenticationhandler<authenticationschemeoptions> { public basicauthenticationmiddleware(ioptionsmonitor<authenticationschemeoptions> options, iloggerfactory logger, urlencoder encoder, isystemclock clock) : base(options, logger, encoder, clock) { } protected override task<authenticateresult> handleauthenticateasync() { var principal = new genericprincipal(new genericidentity("user"), null); var ticket = new authenticationticket(principal, new authenticationproperties(), "basicauth"); return task.fromresult(authenticateresult.success(ticket)); } } in startup have following: public void configureservices(iservicecollection services) { services.addmvc(); services.addauthentication(options => { options.defaultauthenticatesch

r - Creating a sentence based on the values in a data frame -

i want create sentence based on values in data frame. have following data.frame: canada <- c(50, 50, 50) korea <- c(70, 70, 70) brazil <- c(100, 100, 100) fruit <- rbind(canada, korea, brazil) colnames(fruit) <- c("apple", "orange", "banana") fruit > apple orange banana > canada 50 50 50 > korea 70 70 70 > brazil 100 100 100 when type canada , want output this: canada canada consumes average number of apples, average number of oranges, , average number of bananas. so, tried following: average <- 'average number of ' if(fruit$'apple' > 90) { cat("canada", average, fruit$'apple', average, fruit$'orange', "and ", average, fruit$'banana' ) } of course, doesn't work, , stuck here. can guide me right path? put in work learn! here's attempt, assuming may have c

numpy - How to compute gradient of a function with respect to parameters of two separate neural networks -

usually, given neural network, example, in tensorflow, following case, self.theta = tf.contrib.layers.fully_connected( inputs=tf.expand_dims(self.state, 0), num_outputs=1, activation_fn=none, weights_initializer=tf.zeros_initializer) if have function g(self.theta) , want gradient of g(self.theta) w.r.t parameters, may use self.network_params = tf.trainable_variables() , gradient_theta = tf.gradients(g(self.theta), self.network_params) compute it. i want how similar things in case: in addition self.theta if define self.sigma in same class following, self.sigma = tf.contrib.layers.fully_connected( inputs=tf.expand_dims(self.state, 0), num_outputs=1, activation_fn=none, weights_initializer=tf.zeros_initializer) and have function f(self.theta, self.sigma) , how compute gradient of f(self.theta, self.sigma) w.r.t self.theta , self.sigma ? note self.sigma , self.theta both defined in class, think using self.network_params = tf.trai

Recieve Twilio SMS .NET Core WEB API -

i trying setup .netcore 1.0 server recieve sms messages (web api) sent twilio number. have searched , google example , point mvc 5 cannot bring project. has done before? twilio developer evangelist here. i recommend take read through blog post colleague marcos, wrote checking prices of magic gathering cards using sms, twilio , .net core . hope helps!

ios - Is it possible to add delimiters on UISlider? -

Image
is possible add on uislider such kind of circles-delimiters? maybe give me hint how add them. i'm searching in google nothing. in advance! you can draw 4 points, real-time monitoring uislider control, when value, point of color , uislider color same. think?

java - InfluxDB Query issue when measurement name have hyphen in it -

i using java , querying influxdb shown below, queryresult1 = influxdb.query(new query("select last(timestamp) vale" , eachdatabase)); this statement working fine, when name have of special character e.g. if measurement name "vale-ab" instead of vale, won't work. error getting is: java.lang.runtimeexception: {"error":"error parsing query: found -, expected ; @ line 1, char 34"} any idea how can escape measurement name inside queries. you need wrap measurement double quotes " . bad: select * a-b err: error parsing query: found -, expected ; @ line 1, char 16 good: select * "a-b" name: a-b time tag1 value ---- ---- ----- 1434089562000000000 10i 5 i don't have java installed on machine code below should solve problem. queryresult1 = influxdb.query(new query("select last(timestamp) \"vale-vale\"" , eachdatabase));

In Excel web add-in how can I handle Oauth from non-Microsoft providers -

i'm developing add-in javascript integrates https://data.world . started i'm pointing add-in existing web app https://dw_experiments_dev.hardworkingcoder.com added site , data.world appdomains. in regular browser can login via ouath. excel through auth process , see homepage logged out users. app using sessionstorage.

Redis - Sort ID's based on Names in another Set -

i using multiple redis sets, hashes , sorted sets use-case. suppose having hash set stores id , corresponding object. (project id , content) have sets contain list of id's (list of projectids) have sorted sets sortby datetime fields , other integer scores. (sort deadline, created etc , project name). created sorted set use-case needs sort name (say project name). created project name sorted set (projectname:id value , 0 score). requirement need sort set (which contain id's) based on project name in desc or asc. how achieve this?? read documentation sort - should sort nameofzset nosort nameofhash->* . better, learn how write lua scripts , execute them eval .

wordpress - Undefined Offset / PHP error -

i'm using wordpress plugin contains function, plugin developers not being particularly quick respond. it supposed video id youtube url, instead i'm getting "undefined offset: 1" error. there coding error i'm missing? here function: function youtube_id_from_url($url) { $pattern = '%^# match youtube url (?:https?://)? # optional scheme. either http or https (?:www\.)? # optional www subdomain (?: # group host alternatives youtu\.be/ # either youtu.be, | youtube\.com # or youtube.com (?: # group path alternatives /embed/ # either /embed/ | /v/ # or /v/ | /watch\?v= # or /watch\?v= ) # end path alternatives. ) # end host alternatives. ([\w-]{10,12}) # allow 10-12 11 char youtube id. $%x' ; $result = preg_match($pattern, $url, $matches);

html - Fatal error: Can't use function return value in write context in views/stock/form.php on line 29 -

my code working fine in localhost , when upload server, show error on spesific line. error line of code. <input type="text" required="required" name="i_name" class="form-control" placeholder="masukkan nama item..." <?php if(!empty(trim($row->item_name))){ ?> value="<?= $row->item_name ?>"<?php } ?> /> that's because using empty() on trim() function. try trim() before passing data empty() function, this: <?php $item_name=trim($row->item_name); ?> <input type="text" required="required" name="i_name" class="form-control" placeholder="masukkan nama item..." <?php if (!empty($item_name)) { echo 'value="' . $row->item_name . '"'; } ?> /> also, if me, recommend using cleaner code: <?php $item_name=trim($row->item_name); $value=''; if(!empty($item_name)){

java - Implemetation for getParentLogger() in CommonDataSource -

i've faced issues while taking build in java 1.8 method using commondatasource. checked new method added commondatasource interface, need add getparentlogger() method. should implementation getparentlogger(), should not impact previous implemenation? public logger getparentlogger() throws sqlfeaturenotsupportedexception { // should return not affect previous functionality } i'm using log4j log purpose. method returns java.util.logging.logger.

node.js - single login sign in in ubuntu? -

http://anvil.io/ i trying install anvil connect in ubuntu. while using command line $npm install -g anvil-connect showing error message shown in below screen shot. http://prntscr.com/g9xmy7 error screen shot:- https://prnt.sc/g9xm02 error: npm known not run on node.js v0.6.12 you'll need upgrade newer version in order use version of npm. can find latest version @ https://nodejs.org/ please guide me how install it.

objective c - Sow Multiple Images Selected From ELCImagePicker In a Collection view in IOS -

i have view controller in had added collection view, when pass array of static images shows fine have pass images through gallery selection or camera have used elcimagepicker in project select multiple images, when select multiple images gallery using elcimagepicker select images , when hit done button on top right of firstly not go view controller show images , no images seen in collection view. code is, - (ibaction)select:(id)sender { elcimagepickercontroller *elcpicker = [[elcimagepickercontroller alloc] initimagepicker]; elcpicker.maximumimagescount = 4; //set maximum number of images select, defaults 4 elcpicker.returnsoriginalimage = no; //only return fullscreenimage, not fullresolutionimage elcpicker.returnsimage = yes; //return uiimage if yes. if no, return asset location information elcpicker.onorder = yes; //for multiple image selection, display , return selected order of images elcpicker.imagepickerdelegate = self; //present

javascript - HTTP 404 error in angularjs with spring mvc -

actually want integrate spring angularjs , beginner in angularjs. when use $http post method return post 404 .here code myapp.js var myapp = angular.module('myapp', ['ngroute']); useridcontroller.js myapp.controller('useridcontroller', [ '$scope', 'useridservice', function($scope, useridservice) { $scope.saveuser = function() { useridservice.saveuser($scope.user).then( function success(response) { console.log("user added"); }, function error(response) { console.log("user not added") }); } } ]); useridservice.js myapp.service('useridservice', [ '$http', function($http) { this.saveuser = function saveuser(user) { console.log("enter in service angular") return $http.post('/usersid', { username : user.firstname }) }; }]) i error request url

c# - Process exists with ExitCode 255 -

[iis 7.5 / windows 7 / visual studio 2012] i trying have mvc app run external command line tool located on same machine. i gave execute permissions iis_usrs whole folder contains tool. i invoke with: processstartinfo startinfo = new processstartinfo(); startinfo.windowstyle = processwindowstyle.normal; startinfo.filename = mypath; startinfo.arguments = myarguments; partialrunprocess = process.start(startinfo); no exceptions (path right), process exists rightaway exitcode 255 i can execute process manually. what cause ? exit code 255 sounds .net exception within tool (target application) you're running. you'll not able catch exception in code. i register debugger target application see exception throws: go hkey_local_machine\software\microsoft\windows nt\currentversion\image file execution options create key name of executable you're starting create string called debugger give value, e.g. vsjitdebugger.exe if it's .net appli

python - How to downgrade tensorflow, multiple versions possible? -

i have tensorflow 1.2.1 installed, , need downgrade version 1.1 run specific tutorial. safe way it? using windows 10, python 3.5. tensorflow installed pip3, "pip3 show tensorflow" returns blank. is possible have multiple version of tensorflow on same os? is possible have multiple version of tensorflow on same os? yes, can use python virtual environments this. docs : a virtual environment tool keep dependencies required different projects in separate places, creating virtual python environments them. solves “project x depends on version 1.x but, project y needs 4.x” dilemma, , keeps global site-packages directory clean , manageable. after have install virtualenv (see docs ), can create virtual environment tutorial , install tensorflow version need in it: path_to_python=/usr/bin/python3.5 virtualenv -p $path_to_python my_tutorial_env source my_tutorial_env/bin/activate # activates new environment pip install tensorflow==1.1 path_to_python shou

oracle11g - how to create table with unicode values in oracle 11g -

i using oracle sql developer 11g. i trying create database , table name in arabic language showing error 'invalid character'. also,trying insert arabic characters in oracle 11g, data being inserted question marks. searched around , seems have change character encoding... not working. please me recording issue. create database لافف; thanks,

android - Do images with AsyncTask download parallel or sequentially? -

i made asynctask load images recyclerview. has method downloadimage() call every time @ viewholder. each image should create new asynctask? can't figure out if download parallel or sequentially. (i can't use libraries, must custom) private static class downloadimage extends asynctask<string, void, bitmap> { private imageview mbitmapimage; downloadimage(imageview imageview) { mbitmapimage = imageview; } @override protected bitmap doinbackground(string... strings) { string url = strings[0]; bitmap bitmapimage = null; inputstream in = null; try { in = new url(url).openstream(); bitmapimage = bitmapfactory.decodestream(in); in.close(); } catch (ioexception e) { e.printstacktrace(); } { if (in != null) { try { in.close(); } catch (ioexception e) { e.printstacktra

Android Studio gradle bintray upload failed: Could not sign version -

Image
after running ./gradlew bintrayupload i getting following error. :my-library:bintrayupload failed failure: build failed exception. what went wrong: execution failed task ':my-library:bintrayupload'. could not sign version '0.8.1': http/1.1 400 bad request [message:private key required, please supply using json body or alternatively can stored in bintray profile] try: run --stacktrace option stack trace. run --info or --debug option more log output. build failed it had been working when installed gpg authentication described in this tutorial . however, when tried update version (as described here ) stopped working. i able solve issue deleting gpg key in bintray , regenerating keys .

swift - FBSimulatorControl : Convert CVPixelBufferRef data to jpeg data for streaming -

i developing cli in swift , using fbsimulatorcontrol in it. want stream data obtained consumedata: delegate method. per data obtained in method data obtained cvpixelbufferref i logged issue in github repo of fbsimulatorcontrol. i tried regenerate cvpixelbuffer data , tried obtain ciimage , convert jpeg data. not seem work. can me this? adding below code i've tried var pixelbuffer:cvpixelbuffer? = nil let result = cvpixelbuffercreate(kcfallocatordefault, 750, 1334, kcvpixelformattype_32bgra, nil, &pixelbuffer) if result != kcvreturnsuccess { print("pixel buffer create success") return } cvpixelbufferlockbaseaddress(pixelbuffer!, .init(rawvalue: 0)) let ydestplane:unsafemutablerawpointer? = cvpixelbuffergetbaseaddressofplane(pixelbuffer!, 0) if ydestplane == nil { print("failed create ydestplane") return } let nsdata = data nsdata let rawptr = nsdata.bytes memcpy(ydestplane!, rawptr, 750*1334*4) cvpixelbufferunlockbaseaddress(pi

acumatica - How to Calculate Grams Manually -

rules validation settings changed , it's need recalculate grams. application side goes timeout because of large amount of records (3 million). how possible calculate lead/contact calculation gram on large amount of records, did had such kind of problem?

angular - How to filter elements of array based on id in Ionic2? -

i developing mobile app using ionic2. intent dynamically insert people in homepage. whenever click person, list of dynamically added items correlated person (with id) should show up. not able filter items each person, how can filter items specific person id? this home add new people entries: public people:{personname:string, personid:string}[] = []; //will load people in array ionviewwillenter(){ //addpersons constructed addpersonsservice this.people = this.addpersons.getpeople(); } //from html, parse personid array //it redirect list of items specific person viewdebts(personid:string){ this.navctrl.push(debtslistpage, personid); } this addpersonsservice public people: {personname:string, personid:string}[] = []; //this called upon click html addperson(person:{personname:string, personid:string} ){ this.people.push(person); } getpeople(){ return this.people.slice(); } generateid(id:string){ return id; } in here display

javascript - Syncfusion controls not loading on iOS native UIWebView -

i have web application built asp.net mvc , used syncfusion controls in it. also, building ios , android application using native webview. the problem facing syncfusion controls not working @ ios native uiwebview works fine @ android webview , other web browsers. [error] typeerror: null not object (evaluating 't[1]') getbrowserdetails (ej.web.all.min.js:10:2620892) setwidthtocolumns (ej.web.all.min.js:10:2713042) _completeaction (ej.web.all.min.js:10:2705521) senddatarenderingrequest (ej.web.all.min.js:10:2703872) _rendergridcontent (ej.web.all.min.js:10:2684094) render (ej.web.all.min.js:10:2674498) _initgridrender (ej.web.all.min.js:10:2664775) _checkdatabinding (ej.web.all.min.js:10:2631224) _init (ej.web.all.min.js:10:2626321) (anonymous function) (ej.web.all.min.js:10:19759) (anonymous function) (ej.web.all.min.js:10:20802) (anonymous function) (actelion-test.pulselinks.com:995) above error thrown page has syncfusion control. becuase of error

How to get IsPersistent flag from ASP.NET Core Authentication -

when sign in user following: httpcontext.authentication.signinasync("name", claimsprincipal, authenticationproperties); where authenticationproperties variable authenticationproperties object parameter ispersistent set either true or false . i need later inside 1 of controllers information if signinasync done ispersistent parameter set true or false . how can access parameter? thank help!

php includes that correctly links href from wherever -

i'm trying include block of html hrefs. want able maintain 1 include file. current code is: <?php include __dir__ . "/../../../includes/footer.php"; ?> this links fine except hrefs in footer.php file must prefaced ../../../ due location. means have create multiple footer files different hrefs. to display folder structure(*indicates includes of same php file needed): root ¦ +---includes ¦ ¦ ¦ +---footer.php ¦ ¦ +---main ¦ ¦ ¦ +---maps ¦ ¦ ¦ +---uk ¦ ¦ ¦ +---map.php* ¦ +---gallery.php* ¦ +---assets ¦ +---icons + ¦ +---facebook_1.png finally worked out. mamp confusing things , had include php in link. under mamp>conf>apache>httpd.conf changed documentroot "/applications/mamp/htdocs/radventures.co.uk" pointed root of site. changeable document_root mamp configuration: <?php if ($_server['document_root'] == '/applications/mamp/htdocs/ra

templates - How do I generalize calling a list of functions in C++? -

i have following code allows me instantiate , call list of void() functions. (i using https://github.com/philsquared/catch unit testing if wish compile , run code). #include "catch.hpp" #include <functional> #include <vector> class chainofresponsibility : public std::vector<std::function<void()> >, public std::function<void()> { public: void operator()() const { for(std::vector<std::function<void()> >::const_iterator = begin(); != end(); ++it) { (*it)(); } } }; test_case("chainofresponsibility calls members when invoked") { bool test_function_called = false; std::function<void()> test_function = [&]() { test_function_called = true; }; chainofresponsibility object_under_test; object_under_test.push_back(test_function); object_under_test(); require(test_function_called); } my question how template chainofresponsibility

bash - How to run a script hourly that requires password? -

i want call script every hour doing using following commands: step 1. connect cloud desktop using ssh. step 2. run these commands: % screen % while true; ./parsescript.sh; sleep 3600; done step 3. close window running command. step 4. (same step 1) connect cloud desktop using ssh. step 5. run command: screen -r. session left in step 3. now problem in script have 1 command has executed using sudo hence ask password every time, there anyway run script every hour except manually? you can configure sudo not require password combination of user , command. for instance, if username needs run command keshav , command @ /sbin/somecommand : first create copy of sudoers file, in case sudo cp /etc/sudoers /etc/sudoers.backup then edit /etc/sudoers sudo visudo that command open /etc/sudoers file in default editor. use editor add line keshav = nopasswd: /sbin/somecommand save file , exit editor. if followed steps correctly user keshav should able run sudo /sbin

asp.net mvc - How to handle repetitive HTML code such as headers and footers in Angular 4? -

in angular web project use different 2 or 3 types of header in many pages in angular 4 project. there way code html header code , footer code once , have included or injected in 1 or more of pages. give clue need alternative @section in asp.net mvc razor witch in each page can add code (i know server side thing, need in angular client side). there official/recommended way this? you should create components that. like: @component({ selector: 'myheader', templateurl: './header.component.html', styleurls: ['./header.component.scss'] }) export class headercomponent implements oninit { ... and add template of other pages want use (or app.component.html if want everywhere). like: <myheader></myheader> if need different data on header depending on component at, create headerservice, , pass data header component through it.

oracle - How to get sql table output using select statement etc -

in oracle sql want output below. column divided row put x , otherwise put blank .. example::- 1/100 put x if not put blank can using select statement query in sql. if 100 not division 3 put blank.. xyz 1 2 3 4 5 ... --- -- -- -- -- -- 100 × × × × 200 × × × × 300 × × × × × 400 × × × × its upto n column in database table. upto n column in database table. its upto n column in database table. you can using mod(), so: with sample_data (select 100 xyz dual union select 200 xyz dual union select 300 xyz dual union select 400 xyz dual) select xyz, 'x' "1", -- every number divisible 1 case when mod(xyz, 2) = 0 'x' end "2", case when mod(xyz, 3) = 0 'x' end "2", case when mod(xyz, 4) = 0 'x' end "2", case when mod(xyz, 5) = 0 'x' end "2" sample_data;

c# - ExtJs Javascript: Reload panel, not only tab -

i reloading active tab in javascript : parent.parent.bodypanel.activetab.reload(); but want reload whole panel. reason want achieve there lock button, when clicked should lock whole panel without refreshing each tab manually

javascript - Extjs - Dock Button to bottom of the Panel -

Image
i want align credentials button bottom of panel in extjs , there specific property buttons inside panel. no toolbar involvement here: fiddle link : https://jsfiddle.net/arya9/rmad2cpb/ hope below code per requirement. ext.create('ext.window',{ width:200, height:400, layout:'vbox', items:[{ xtype:'button', text:'first' },{ xtype:'panel', flex:1 },{ xtype:'button', text:'second' }] }).show(); you can check here in sencha fiddle working https://fiddle.sencha.com/#view/editor&fiddle/25a9

vue.js - How do you import components having same name on Vue Router -

i'm working on vuejs project , structuring router records. i've realized having different components having same name. how import them , use them in route records? how make names unique when configuring router? import vue 'vue' import router 'vue-router' import allusers '../components/sales/allusers' import allusers '../components/finance/allusers' ... export default new router({ routes: [ { path: '/', name: 'home', component: home }, { path: '/sales/users', name: 'sales-users', component: allusers }, { path: '/finance/users', name: 'finance-users', component: allusers } i have used hypothetical example here (since call components salesusers , financeusers ) agree there times when components have same name. how handle that, given need specify component each route record? ps: new vuejs, advice on improvements , best practices welcome. since exports default can choose

symfony - Save many to one in Sylius -

i trying save many 1 data in form sylius , return null in referencedcolumnname screenshot here code here

Android- The Single Responsibility Principle (SRP) implementation in Retrofit library? -

how should use retrofit library in android project follow srp principles ( the single responsibility principle in solid principles)? edit 1 i find out article introduces solid principles in android applications: android development: solid principles so, link describes, there considerations implementing solid principles in android application. edit 2: limited question more specific in srp principles.

javascript - AmCharts split lines -

Image
i have stacked bar chart negative values if possible split each line category? horizontally! code exemple tnx you can add dimension data, , create graph object within graphs array defining , how should display. using open property, along valuefield allows create new bar within stacked collection own open/close values. assuming mean "splitting" line horizontally. in dataprovider array, can add these new open/close values individual objects, , use field names instruct graph object on how display them. // individual dataprovider object { "age": "0-4", "male": -5.0, "female": 4.8, "other_low": -2, "other_high": 2 } // accompanying graph object { "fillalphas": 1, "linealpha": 0.2, "type": "column", "openfield": "other_low", "valuefield": "other_high", "title&quo

node.js - createJson is not a function -

i'm trying create bot function enable store plan id along current job, years of experience , number of jobs of user. "createjson not function" appears. declared function. , list ain't stopping there log session stops on problem, please need lot of one. thanks... const functions = require('firebase-functions'); const admin = require('firebase-admin'); admin.initializeapp(functions.config().firebase); var fs = require('fs'); var moment = require('moment'); exports.hellohttp = functions.https.onrequest((req, res) => { if (req.body.result && (req.body.result.parameters || req.body.result.action || req.body.result.contexts)) { var userquery = req.body.result.resolvedquery || {}; var action = req.body.result.action || {}; var parameters = req.body.result.parameters || {}; var plan_id = req.body.result.parameters.plan_id || {}; createjson(); var data = json.stringify(cj

How to install git specific version(2.7.*) on Ubuntu -

when run dotfiles shown error task [root : make sure git version 2.7.x] fatal: [localhost]: failed! => {"changed": false, "failed": true, "msg": "make sure git version 2.7.x"} currently use git latest version(2.14.1) want fix downgrade git version 2.7.6 purge git , use sudo apt-get install <package-name>=<package-version-number> or sudo apt-get -t=<target release> install <package-name>

html - unterminated string literal “onclick” event in anchor -

i have implement onclick in anchor tag seo purpose,but can't track this. please suggest how track ? <a onclick="ga('send', 'event', 'cloudstore', 'click', 'cloud here - banner’);" href="about.php" class="red-text block">read more</a>

pymysql - TypeError: not all arguments converted during string formatting with sql execute in Python -

the code below varlist =[] key, value in json_obj.iteritems(): print key, value varlist = varlist + ["string"] print varlist params = ['?' item in varlist] query_string = 'insert test_table values (%s);' % ','.join(params) print query_string cursor.execute(query_string, varlist) produces following ['string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string'] insert test_table values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?); traceback (

single onclick function for buttons with a similar id pattern - JavaScript -

i want reduce code. function one() { console.log("hai"); } document.getelementbyid('dealsbutton_1').onclick = one; document.getelementbyid('dealsbutton_2').onclick = one; //i want above 2 lines of code reduced one. a single function on click on 'dealsbutton_*' patterned id elements. how can this. the elements dynamically loaded . you can use queryselectorall , selector [id^=dealsbutton_] add event listener in single line - see demo below: function one() { console.log("hai"); } array.prototype.foreach.call( document.queryselectorall('[id^=dealsbutton_]'), function(e) { e.addeventlistener('click', one); }); <div id="dealsbutton_1">one</div> <div id="dealsbutton_2">two</div> if markup dynamically loaded can base on static element this: function one() { console.log("hai"); } document.addeventlistener('cli

test yaml-cpp 0.5.3 issue -

i tried know yaml rules. , init.yaml file this: name: ryan braun position: lf main code: int main() { yaml::node node = yaml::loadfile("init.yaml"); cout << node.type() << endl; return 0; } this simple example, want see node's type. should map described in how emit yaml . output 0, means undefined . makes me confused. maybe misunderstand. suggestions thankful.

android - How to call jobFinished from IntentService -

Image
i trigger inside jobservice intentservice encapsulate simple tasks. how should call jobfinished( param, false ) after intentservice has finished , tell jobservice done? should bind jobservice , call directly or exist better solution? in many cases, have interface , pass along object implements it. dialogs example have onclicklistener. just random example: // callback interface interface mycallback { void callbackcall(); } // class takes callback class worker { mycallback callback; void onevent() { callback.callbackcall(); } } // option 1: class callback implements mycallback { void callbackcall() { // callback code goes here } } worker.callback = new callback(); // option 2: worker.callback = new mycallback() { void callbackcall() { // callback code goes here } }; just image better understanding

swift - UserDefaults checking for nil value not working -

Image
any idea why if statement gives else answer? noticed print object stored "optional()", maybe optional state different nil? class viewcontroller: uiviewcontroller { @iboutlet weak var phonelabel: uitextfield! @iboutlet weak var phonedisplaylabel: uilabel! @ibaction func storebutton(_ sender: any) { userdefaults.standard.removeobject(forkey: "nb") userdefaults.standard.set("\(phonelabel.text!)", forkey: "nb") print(userdefaults.standard.object(forkey: "nb") any) } @ibaction func retrievebutton(_ sender: any) { let phonenb = userdefaults.standard.value(forkey: "nb") if let phonenbdisplay = phonenb as? string { if userdefaults.standard.object(forkey: "nb") != nil { phonedisplaylabel.text = "your nb \(phonenbdisplay)" } else { phonedisplaylabel.text = "enter number first&q

ng build command is not working via jenkins build execute shell -

Image
in jenkins build execute area put these command: cd /var/lib/jenkins/workspace/test/ ng serve here screenshot: i getting error this: cd /var/lib/jenkins/workspace/test/ ng serve environment variable term not defined! build step 'execute shell' marked build failure finished: failure node v6.10.0 @angular/cli: 1.0.6 please me resolve issue.

angular - Change button color on click inside ngFor -

i generating segment buttons conditionally, how can change button color clicked: <ion-segment *ngif="menu" [(ngmodel)]="apps"> <ion-segment-button *ngfor="let item of menu; let = index" value="{{item .key}}" [ngclass]="{active: === activeindex}" (click)="changetab(item.key); setactiveindex(i)" style="display:block;" > {{item?.name}} </ion-segment-button> </ion-segment> if apply [ngstyle]="{'background-color': this.buttoncolor}" on ion-segment-button reflect on button, want change color of clicked one

ios - Nested Object Update issue in Realm -

please check following model class of team , member . in team, there members can hold list of member . json object used create , update teams in service methods. member can updated individually. in member object, there property lastseenat updated according member's activity. class team: object { dynamic var channelid: string? = nil dynamic var title: string? = nil let members = list<member>() override class func primarykey() -> string? { return "channelid" } } class member: object { dynamic var _id: string? dynamic var lastseenat: date? override class func primarykey() -> string? { return "_id" } } service methods updating teams , members func createandupdateteams(_ teams: [[string:any]]?) { dispatchqueue(label: "queuenametocreate", attributes: []).async { let realm = try! realm() try! realm.write({ () in team in teams! { realm.create(team.self, value: tea

data compression - What is the difference between shannon fano and huffman algorithm? -

it likes similar me except top down , bottom-up parsing . can explain ? that indeed fundamental difference. in huffman encoding, codes built bottom repeatedly combining 2 least common entries in list of populations until 2 left. in shannon-fano, population list sorted pop count , repeatedly (recursively) split in 2 - half population in each half, or close 1 can - until 2 entries left in sub-section. huffman has been proven produce (an) optimal prefix encoding whereas shannon-fano (can be) less efficient. shannon-fano, on other hand, arguably bit simpler implement.

reactjs - Using React-Moment, (moment.js) How do I get date format: Mon Apr 19 1976 09:59:00 from format 2017-08-07 08:42:08? -

i'm trying convert date format 2017-08-07 08:42:08 format mon apr 19 1976 0:59:00 using react-moment library. i went through docs @ [https://www.npmjs.com/package/react-moment][1] , tried similar examples, nothing fits need exactly. i can do: <moment fromnow>{datetime}</moment> yields format: in 10 days but <moment unix>{datetime}</moment> yields invalid date <moment parse="yyyy-mm-dd hh:mm:ss"> {datetime} </moment> yields: mon aug 07 2017 08:47:47 gmt+0545 . don't without timezone value @ end. what's correct parameter date format input? as per documentation in npm default format want. because default format of js, mentioned in w3schools <moment format="here desire format">{datetime}</moment> *optional: please try install moment-timezone mentioned in link.

java - How to override some classes in a jar in WEB-INF/lib with another jar in JBoss EAP? -

if class override called com.example.fooservlet , class inside jar web-inf/lib/foo.jar , how override class called com.example.fooservlet in jar, bar.jar ? or there way make sure 1 in bar.jar loaded first? making bar.jar module no-go because fooservlet imports tons of classes many jars in web-inf/lib . as stated above, tried contain bar.jar in module, got class not found or no class def error (can't remember clearly) fooservlet extends/implements classes/interfaces in 3rd party jars in web-inf/lib. i'm not allowed touch foo.jar or of jars existing in web-inf/lib . you said cannot touch existing jars, , seem imply can add jar of yours web-inf/lib . according this : there no specified order of precedence jars under web-inf/lib/*.jar . if add bar.jar in there, don't know if loaded before or after foo.jar . the servlet spec says classes under web-inf/classes must loaded before under web-inf/lib/*.jar assuming can add jar under web-in

oracle10g - How do I get the number of inserts/updates occuring in an Oracle database? -

how total number of inserts/updates have occurred in oracle database on period of time? assuming you've configured awr retain data sql statements (the default retain top 30 cpu, elapsed time, etc. if statistics_level 'typical' , top 100 if statistics_level 'all') via like begin dbms_workload_repository.modify_snapshot_settings ( topnsql => 'maximum' ); end; and assuming sql statements don't age out of cache before snapshot captures them, can use awr tables of this. you can gather number of times insert statement executed , number of times update statement executed select sum( stat.executions_delta ) insert_executions dba_hist_sqlstat stat join dba_hist_sqltext txt on (stat.sql_id = txt.sql_id ) join dba_hist_snapshot snap on (stat.snap_id = snap.snap_id) snap.begin_interval_time between <<start time>> , <<end time>> , txt.command_type = 2; select sum( stat.executions_delta )

javascript - State management concept vs other solutions -

i start learn redux , state management approach, after reading lot of articles confused between implementation , concept. so understand that: redux implementation of flux architecture. - source flux implementation , architecture. i want keep search , learn self, question: 1) flux architecture vs ....? other solutions/architecture. 2) "state management" concept part of flux architecture or concept can implement other architecture? 3) "state management"? other solutions/concepts. thanks all! i think have think more in terms of mvc vs cba(component based architecture) rather redux vs mvc. redux helps synchronize state between components , shines when got complex component trees share state. i point excellent presentation may understand benefits of using redux in component based architecture. managing state in angular 2 - st louis angular lunch - kyle cordes https://youtu.be/ebltz8qrg4q

how to create a csv in a R server? -

i running r code in server. data frame: npifinal <- data.frame( npi = npi$npi, id = npi$id, first_name = npi$first, last_name = npi$last, email_id = npi$email, primary_speciality = npi$psnew, other_speciality = npi$othersplname ) and tried write csv using: write.csv(npifinal,"npi data.csv") but getting error : error in file(file, ifelse(append, "a", "w")) : cannot open connection.. can me code?