Posts

Showing posts from August, 2010

linux - How to run docker rmi $(docker images -a -q) in Jenkins as part of ssh script -

i building jenkins jobs build docker container on aws ec2 instance , sample of jenkins script giving errors: #!/bin/bash -e # not giving ip here guess can understand host = ip address of ec2 instance in aws # current project workspace # download source code , create tar , scp in aws ec2 # code copied in aws ec2 instance ... # ssh , run script on aws ec2 instance ssh -o stricthostkeychecking=no -i mysecrets.pem ec2-user@$host \ "tar xvf pc.tar && \ cd my_project_source_code && \ docker stop $(docker ps -a -q) && \ docker rmi $(docker images -a -q) && \ sh -c 'nohup docker-compose kill > /dev/null 2>&1 &' && \ docker-compose build --no-cache && \ sh -c 'nohup docker-compose > /dev/null 2>&1 &' " when build job in jenkins, fails following error on output console : "docker stop" requires @ least 1 argument(s). see 'docker stop --

Can anyone explain use of Joblet in Talend -

can please give me brief description , uses of joblet in talend. i have tried information in google it's bit confusing. a joblet specific component replaces job component groups. joblets can reused in different jobs or several times in same job. at runtime, joblet code integrated job code itself. no separate code generated, same java class being used. unlike trunjob component, joblet code automatically included in job code @ runtime, using less resources. uses same context variables job itself, joblet easier maintain. to use group of components standalone job, can use trunjob component. unlike joblet, trunjob has own context variables. click here more usage of it

r - how to write code for a given mathematical model using lpSolve -

Image
i have following mathematical model: and following r code above model: library(utils); library(xlsx) library(lpsolve) datadea<- structure(list(dmus = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), input1cash = c(5, 6, 4, 8, 5, 8, 4.4, 2.6, 3.4, 3.6, 2, 3, 3, 2.6, 4, 5, 6, 4, 7, 6, 8, 9), input2lev = c(4, 5, 5, 5, 6, 3, 4.4, 8, 8, 4.4, 7, 7, 5.6, 5, 4, 3.2, 4, 3.5, 3, 2.5, 2, 2), output1eps = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), output2roa = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), members = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), .names = c("dmus", "input1cash", "input2lev", "output1eps", "output2roa", "members" ), row.names = c(na, 22l), class = "data.frame") effcrs<- structure(c(0.846153846153846, 0.6875, 0.838461538461538, 0.611111111111111, 0.685534591194969,

semantic versioning - semver and what should be written in UPGRADE file -

i have project @ version 1.2. i've added new feature , means need pass version 1.3. marked methods deprecated. in version 2.0 i'll remove old methods. is correct, compiling upgrade-2.0 file, add old version (method available in 1.* versions) , new? is version 1.2 right moment put in upgrade-2.0 file?

powershell - Writing multiple cmdlet xml-based help files to a single xml file -

the resources writing xml files advanced functions seems limited. i'm hoping use xml-based files, seems requires me have 1 xml file per cmdlet, huge number of xml files. each cmdlet uses .externalhelp assign xmlfile it. is there way put many cmdlets 1 file , point each cmdlet correct part of file? help links on writing powershell xml topics scripts/cmdlets/functions: guidelines on writing help creating cmdlet file (i suggest reading linked topics @ bottom of page) more on writing help

python - Deleting rows in CSV files using Pandas -

relatively new pandas apologize in advance if redundant. have sorted data in csv file, delete rows no longer need. example here, keep rows trade date , settle date same delete rows different. trade date settle date security 8/15/2017 8/15/2017 9/7/2017 9/11/2017 b 8/31/2017 9/6/2017 c i guessing need add true false booleans code used try did not seem work me. appreciated. booleans=[] length in df_new: if 'trade date'=='settle date': booleans.append(true) else: booleans.append(false) df = df[df['trade date'] == df['settle date']] df trade date settle date security 0 8/15/2017 8/15/2017

vba - Why do I get an error that the database connection is still open when I load the second userform? -

i creating couple userforms in order pull data small local microsoft access database , create dynamic invoices (and other forms) in excel. in first userform, pull information out of database in order populate comboboxes data validation (user can select available options). close of connections after using them, when click button triggers second userform, error userform_initialize() cannot run because connection still open. i'm not sure how correctly close previous connection before opening new 1 in initialization subroutine. cnn , rst set in module global variables , getbrand , getcustomer global functions return value of variables in order pass values sql queries. else should in these blocks of code. code first userform: private sub userform_initialize() dim cnn new adodb.connection dim rst new adodb.recordset cnn.cursorlocation = aduseclient cnn.connectionstring = "provider=microsoft.jet.oledb.4.0; data source=c:\users\user\desktop\test.mdb" cnn.open rst.active

Capybara, Selenium, headless Chrome, Ubuntu Net::ReadTimeout -

i saw similar question mine. works fine on os x, throws errors on ubuntu 14.04. retracing post, getting same error. original poster gave , used poltergeist / phantomjs instead. i'd make work chrome phantomjs no longer being maintained. net::readtimeout: net::readtimeout , selenium::webdriver::error::unknownerror: unknown error: chrome failed start on rails 5.1.beta system test here install steps on ubuntu: apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976eaf437d05b5 wget -q -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - cat <<eof > /etc/apt/sources.list.d/google-chrome.list deb http://dl.google.com/linux/chrome/deb/ stable main eof apt-get update apt-get install --force-yes -y google-chrome-stable cd /root/ && curl -o "http://chromedriver.storage.googleapis.com/2.32/chromedriver_linux64.zip" cd /root/ && unzip chromedriver_linux64.zip && cp chromedriver /usr/bin taking 1 step @ time, co

javascript - Execute code in django as a timed event -

i have message board application needs collect , display messages without user input or action. doing refreshing page using html meta refresh tag. realize not great solution. relevant section want run without refreshing page. {% if grams_list %} #if there exists messages user {% g in grams_list %} #for each message <h2 class="gram-display">{{ g.message }}</h2> #display message {% endfor %} {% else %} #otherwise display nice picture <h2 id="nograms" class="gram-display">no grams right now.</h2> <img id="bird" src="/static/cardinal_from_pixabay.jpg"> {% endif %} is sort of thing accomplished javascript? know possible have javascript trigger javascript function every often, possible trigger event? alternately, django have built-in function this? handled signals (i looked @ signals didn't understand them, though looked had potential useful). django signals can not this. @ jque

android - Documentation for using 3rd party intellectual property for Google Play -

i in process of submitting app google play review. app built 3rd party, published me. google play allows this, requests documentation showing have permission use ip. does have clue kind of documentation need in order approved can client? this link form submitting google: https://support.google.com/googleplay/android-developer/answer/6320428

javascript - Angular mg-select change placeholder behavior -

Image
i'm building angular app angular material. want edit behavior of placeholder. behavior of placeholder comes material.js const transformplaceholder = trigger('transformplaceholder', [ state('floating-ltr', style({ top: '-22px', left: '-2px', transform: 'scale(0.75)' })), state('floating-rtl', style({ top: '-22px', left: '2px', transform: 'scale(0.75)' })), transition('* => *', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')) ]); html: <md-select [(ngmodel)]="selectedvalue" placeholder="number of people" > <md-option *ngfor="let number of numberofpeople" [value]="number.value">{{number.viewvalue}}</md-option> </md-select> i tried find information in material documentation without luck. there way overwrite variables form template controller?

python 3.x - Elasticsearch-py bulk helper equivalent of curl with file -

i looking replicate following command using elasticsearch python client (and without using subprocess ): curl -s -xpost "localhost:9200/index_name/_bulk" --data-binary @file i have attempted use bulk helper without luck: es = elasticsearch() open("file") fp: bulk( client=es, index="index_name", actions=fp ) this results in type missing errors. the file, processed fine when using curl , looks bit this: {"index":{"_type":"sometype","_id":"123"}} {"field1":"data","field2":"data",...} {"index":{"_type":"sometype","_id":"456"}} {"field1":"data","field2":"data",...} ... please note, i'd rather not change contents of file since have around 21000 same format. the actions parameter must take iterable (not file handle) itera

r - Arguments not being passed to a function within a function -

i having trouble passing arguments function within function. values of arguments not being passed instead "n" , "x[i]" are. a <- function(n){ x=rep(0:n) for(i in x){ x[i]=cgcd(n,x[i]) } return (sum(x)/(n+1)) } cgcd <- function(n,m){ if((m==n) || (m==0)){ return (1) }else{ r = n %% m return (1 + cgcd(m,r)) } } my error: a(10) error in if ((m == n) || (m == 0)) { : missing value true/false needed your problem not values not being passed properly. can check adding print statements: a <- function(n){ x=rep(0:n) for(i in x){ x[i]=cgcd(n,x[i]) } return (sum(x)/(n+1)) } cgcd <- function(n,m){ print(n) # added debugging print(m) # added debugging if((m==n) || (m==0)){ return (1) }else{ r = n %% m return (1 + cgcd(m,r)) } } this gives following output: a(10) [1] 10 integer(0) error in if ((m == n) || (m == 0)) { : missing value true/false needed no,

php - Save multiple checkbox - Laravel 5.4 -

i need save multiple checkbox single field in database. <div class="checkbox"> <label> <input type="checkbox" name="expresion_vegetal_id[]" value="1">raíz </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="expresion_vegetal_id[]" value="3">tronco </label> </div> <div class="checkbox"> <label> <input type="checkbox" name="expresion_vegetal_id[]" value="4">corteza </label> </div> controller: $ficha_tecnica = new ficha_tecnica(); $options = $request->get('expresion_vegetal_id'); $ficha_tecnica->expresion_veget

r - Avoid (as)data.frame change data to factors when converting from zoo object -

if have data.frame numeric columns conversion without problems, explained here . dtf=data.frame(matrix(rep(5,10),ncol=2)) #str(dtf) dtfz <- zoo(dtf) class(dtfz) #[1] "zoo" str(as.data.frame(dtfz)) #'data.frame': 5 obs. of 2 variables: # $ x1: num 5 5 5 5 5 # $ x2: num 5 5 5 5 5 but if have data.frame text columns converted factors, when setting stringsasfactors = false dtf=data.frame(matrix(rep("d",10),ncol=2),stringsasfactors = false) #str(dtf) dtfz <- zoo(dtf) #class(dtfz) #dtfz all following convert strings factors: str(as.data.frame(dtfz)) str(as.data.frame(dtfz,stringsasfactors = false)) str(data.frame(dtfz)) str(data.frame(dtfz,stringsasfactors = false)) str(as.data.frame(dtfz, check.names=false, row.names=null,stringsasfactors = false)) #'data.frame': 5 obs. of 2 variables: # $ x1: factor w/ 1 level "d": 1 1 1 1 1 # $ x2: factor w/ 1 level "d": 1 1 1 1 1 how avoid behaviour when data.frame has

javascript - How to get a value from Firebase Database and assign it to a value in Firebase Cloud Functions? -

so i'm using firebase backend demo app, , stack quite bit, i'm hung on 1 issue, can't figure out how retrieve values database (i've got keys fine). put, i'm sending information 1 device contains "friendly-name" of device trying reach firebase function. function code looks this: exports.connectme = functions.https.onrequest((req, res) => { cors(req, res, () => { admin.database().ref('calls/' + req.body.id + '/').set({ target: req.body.target, caller: req.body.caller, time: req.body.time }); const target = req.body.target; console.log(`target: ${target}`); const targetcall = admin.database().ref(`tokens/${target}/token`); console.log(targetcall); // const targetvalue = targetcall.val(); res.status(200).send("thanks call!"); }); }); the variable, targetcall correctly pointed @ db entry want reach, cannot extract value life of me. token located @ admin

python - How to deal with Pandas groupby choosing a different index type based on the data? -

i've written pandas code want when there data. when there no data, code errors out. turns out groupby() creating different index type based on data. here code: >>> import pandas pd >>> cols = ['a', 'b', 'c'] >>> >>> = pd.dataframe(data=[[1,2,3]], columns=cols) >>> b = pd.dataframe(data=[], columns=cols) >>> >>> a.groupby(['a','b'])['c'].sum().index multiindex(levels=[[1], [2]], labels=[[0], [0]], names=['a', 'b']) >>> a.groupby(['a','b'])['c'].sum().index.get_level_values('a') int64index([1], dtype='int64', name='a') >>> >>> b.groupby(['a','b'])['c'].sum().index index([], dtype='object') >>> b.groupby(['a','b'])['c'].sum().index.get_level_values('a') traceback (most recent call las

python - Return mini batch of items from generator -

i'm trying create class wraps generator function, can obtain items generator in batches of predefined size. i.e. if had list of 10 random numbers , specified mini batch size of 2 i'd 5 tuples of 2 numbers. i wrote following wrapper class generator function hoping job: import random class multiple_lottery_draws(object): def __init__(self, num_draws): self.num_draws = num_draws print("initialized % draws"%self.num_draws) def my_lottery(self): # returns 9 numbers between 1 , 100 in range(10): yield random.randint(1, 100) # returns 10th number between 1000 , 2000 yield random.randint(1000,2000) def __iter__(self): data = [] in range(self.num_draws): data.append(next(iter(self.my_lottery()))) yield data two_draws = multiple_lottery_draws(2) however, although generator works fine, for in two_draws.my_lottery(): print # prints: 52,12,61,67,30,78,84,9

Dataflow DynamicDestinations unable to serialize org.apache.beam.sdk.io.gcp.bigquery.PrepareWrite -

i trying use dynamicdestinations write partitioned table in bigquery partition name mytable$ yyyymmdd . if bypass dynamicdestinations , supply hardcoded table name in .to() , works; however, dynamicdestinations following exception: java.lang.illegalargumentexception: unable serialize org.apache.beam.sdk.io.gcp.bigquery.preparewrite$1@6fff253c @ org.apache.beam.sdk.util.serializableutils.serializetobytearray(serializableutils.java:53) @ org.apache.beam.sdk.util.serializableutils.clone(serializableutils.java:90) @ org.apache.beam.sdk.transforms.pardo$singleoutput.<init>(pardo.java:591) @ org.apache.beam.sdk.transforms.pardo.of(pardo.java:435) @ org.apache.beam.sdk.io.gcp.bigquery.preparewrite.expand(preparewrite.java:51) @ org.apache.beam.sdk.io.gcp.bigquery.preparewrite.expand(preparewrite.java:36) @ org.apache.beam.sdk.pipeline.applyinternal(pipeline.java:514) @ org.apache.beam.sdk.pipeline.applytransform(pipeline.java:473) @ org.apache.beam.sdk.values.pcollection.apply(pc

django - It didn't want to install in my virtualenv -

(goat) ┌─╼ [~/projects/personal_projects/goat_tdd_project/superlists] └╼ pip3 install django-extensions collecting django-extensions using cached django_extensions-1.9.0-py2.py3-none-any.whl requirement satisfied: six>=1.2 in /home/jeremie/.local/lib/python3.5/site-packages (from django-extensions) installing collected packages: django-extensions exception: traceback (most recent call last): file "/home/jeremie/.local/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) file "/home/jeremie/.local/lib/python3.5/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, file "/home/jeremie/.local/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install **kwargs file "/home/jeremie/.local/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) file

c++ - How to specialize a template constructor templated? -

how make specialization on template constructor? purpose of better understandings, bring example of code: template<typename t> class stack { private: int nelem; int size; vector<t> stack; public: ~stack(); stack<t>(int t); void push(t data); t pop(); t top(); int getpostop(){return (nelem--);}; void cleanstack(){nelem = 0;}; bool stackempty(){ return (nelem == 0);}; bool stackfull(){ return (nelem == size);}; }; template <typename t> // constructor definition here stack<t>::stack<t>(int t){ size = t; nelem = 0; }; int main(){ return 0; } it came lots of errors. then, read on post, suggestion , replacing template <typename t> stack<t>::stack<t>(int t){ to template <typename t> template <typename t> stack<t>::stack<t> (int t){ which not sufficient. what missing? and, thinking behind it? you want know how special

java ee MVC pattern, does model and view communicate directly with each other -

Image
i'm learning java ee following book "java ee 7 big picture". in book, author had picture illustrate mvc pattern in java ee. as can see, in figure, model , view directly communicating each other. but understand of mvc (i first learned mvc pattern ios development) model , view should never communicate directly each other. communication between model , view should done through controller (i.e. controller act interpreter between model , view). so diagram flawed? or correct, , need re-adjust understanding of mvc pattern java ee way? thanks! the diagram doesn't seem helpful. in javaee controller accept form filled out user, doing validation, hand off data service layer update, redirect controller fetches new updated object (the model) , adds request request attribute, forwarding template generates html. view sort of template knows model in request attributes. model doesn't know tell view anything, typically far view concerned model data containe

how can two arrays be compared to return a match with python? -

i have dataset1 in format ['tyuri:12345', 'hsksfd:58380', 'shskfks:49539'] and dataset2 in format ['12345', '442342', '8053308'] i want compare dataset1 dataset2 , have return tyuri:12345 i know using set().intersection() compare 2 arrays , return exact match. how implement comparing these 2 arrays produce desired output? you can try this: a = ['tyuri:12345', 'hsksfd:58380', 'shskfks:49539'] b = ['12345', '442342', '8053308'] new_a = [i in if any(i.endswith(c) c in b)] output: ['tyuri:12345'] in new_a , list comprehension used find elements have trailing digit exists in b . find values, any() function used determine if 1 or more trailing values, found endswith() method, contained in b .

java - SonarQube Stopped with Error -

this question has answer here: sonarqube :: current version old. please upgrade long term support version firstly 1 answer i new sonarqube. installed analyze code on jenkins. when edited properties file , run start command, process stopped shortly after started it. went web.log file , got message: [o.s.s.p.platform] web server startup failed: current version old. please upgrade long term support version firstly. i have java-8, mysql 14.14 , sonarqube 6.5. what complaining? old? the issue older version of sonarqube had connected database. somehow database registered older version. delete , recreate database , problem solved.

vb.net - Calculate the working hour -

i find difficult actual working hour , minute based on pay amount , pay rate per hour . example : working duration = (wages / pay per hour) the following code. please help. stractduration = cstr(math.round((dblactual / dblpayamount), 1)) dim parts string() = stractduration.split("."c) dim strhour integer = 0 dim strminutes integer = 0 if parts.length = 1 strhour = integer.parse(parts(0)) strminutes = 0 elseif parts.length = 2 strhour = integer.parse(parts(0)) strminutes = integer.parse(parts(1)) 'strroundminutes = cint(math.round(strminutes, 3)) 'strroundminutes = cint(math.truncate(strminutes / 10))

c# - How to anchor UI elements to the bottom of a Relative Layout and expand upward in Xamarin Forms? -

Image
i have pretty picture of sunrise. want relatively position elements under it. i've been doing ok computing more or less height top sunrise ends , beginning text there. now, i'd different way. want put stacklayout, anchor stacklayout @ bottom , expand upwards. this code i've started with, doesn't accomplish it. i found other post similar didn't have luck doing (you can see end in code below. suspect relatively positioned image sitting behind problem. <contentpage.content> <stacklayout orientation="vertical"> <relativelayout padding="0,0"> <image source="{ext:imageresource myapp.sunrise.png}" aspect="aspectfill" relativelayout.widthconstraint="{constraintexpression type=relativetoparent, property=width}" heightrequest="250" /> <stacklayout relativelayout.widthconstraint="{constraintexpression type=relativetoparent, property=widt

optimization - tensorflow custom operation optimize -

i implemented lcnn : https://arxiv.org/abs/1611.06473 which uses sparse convolutional filter matrix speed up. here github repo : https://github.com/ildoonet/tf-lcnn below codes of custom operation. for (int batch_idx = 0; batch_idx < input.shape().dim_size(0); batch_idx ++) { (int sparse_idx = 0; sparse_idx < weight_indices.shape().dim_size(0); sparse_idx ++) { int sparse_oc = index_tensor(sparse_idx, 0); int sparse_p = index_tensor(sparse_idx, 1); int sparse_ic = sparse_p / (dense_shape_[1] * dense_shape_[2]); int sparse_ix = (sparse_p % (dense_shape_[1] * dense_shape_[2])) / dense_shape_[1]; int sparse_iy = (sparse_p % (dense_shape_[1] * dense_shape_[2])) % dense_shape_[1]; int sparse_v = values_tensor(sparse_idx); (int row = 0; row < input.shape().dim_size(0); row += strides_[0]) { int out_row = row / strides_[0]; (int col = 0; col < i

Python runs program once but won't run again -

so i'm new here i've been searching around internet few days , can't find figure out. have basic program (code @ bottom) , if it's first time in 10+ hrs, it'll run fine , it's supposed (basically nothing @ point). if exit window , try run again, it'll give "python has stopped working" error message. python 3.6.1 , kivy 1.10.0 (but program doesn from kivy.app import app kivy.uix.button import button class testapp(app): def build(self): return button(text='hello world') testapp().run() any advice or appreciated. what output of code? from kivy.app import app kivy.uix.button import button def exit(self): app.get_running_app().stop() btn1 = button(text='hello world 1') btn1.bind(on_press= exit) class testapp(app): def build(self): return btn1 if __name__ == '__main__': testapp().run() this how can exit app button. you should find programm in taskmanager called "py

Using postman raw testing spring-boot controller failed -

Image
here controller: here postman: via form-data, can caseid in controller. but raw header, can't. i don't know why... there wrong controller ? please help, thanks. edit 1: yeah. add more we know, springmvc bind data us, when use post request , put data in body via raw , content-type:application/json , spring still bind data? request.getinputstream() call once. edit 2: i found way raw. get json string. ps. why post code image? these codes simple , needn't run. it's looks good. here example of how retrieve data using postman , bind springmvc @requestmapping(value = "/user/", method = requestmethod.get) public responseentity<list<user>> listallusers() { list<user> users = userservice.findallusers(); if (users.isempty()) { return new responseentity(httpstatus.no_content); // many decide return httpstatus.not_found } return new re

iis 8 - Error 404 in long urls Angular 4 -

hi have application in angular 4 backend in asp net core web api. i'm having problem when calling long url. url: http://www.condominio-mais.com/usuario/resetar/4995ffba-6e78-486e-8653-0fb8f4e6996e/cfdj8kvzvifag49bieuucqkchc0wr%2fqnynjutoscaoj6v5vtjhn0phbiub4zwt2wwx3rkbk3iwrktvizeuuz5byoqyfmgsn2cftkkx%2b7acn0uw7kcppwkhu2fgdamusszmxwqnnoepscvdziqjlq4nvbayhsjk4i9g1wjzotumsit5vddkebfvjild8rvoftxycsobpvpfgmxt3cdld5h%2fot3l5h3qkysbfbg%2bxce1vtxjb5saxqywtnndbjb4abwh5zzg%3d%3d this url has 2 id , token parameters. if decrease token works perfectly, if use above error 404. the application hosted on azure. did configuration web.config, worked screen refresh cases, long urls not work. do have idea is? the resource looking has been removed, had name changed, or temporarily unavailable. failed load resource: server responded status of 404 (not found) cfdj8kvzvifag49bieuucqkchc0wr%2fqnynjutoscaoj6v5vtjhn0phbiub4zwt2wwx3rkbk3iwrktvizeuuz5byoqyfmgsn2cftkkx%2b7acn0uw7kcppwkhu2fgdamu

linux - Trying to update twitter using twidge in python -

i trying tweet python using twidge. script looks import subprocess subprocess.call(["sudo", "twidge", "update", "trying tweeting linux python - twidge."]) getting error twidge: user error (no config file found @ /root/.twidgerc run twidge setup configure twidge use.) , have configured twidge , works in bash. sorry if unspecific please ask if have questions.

C++ : what is :: for? -

if go accepted answer of post could please elaborate on why uses: double temp = ::atof(num.c_str()); and not simply double temp = atof(num.c_str()); also, considered practice use syntax when use "pure" global functions? it says use global version, not 1 declared in local scope. if someone's declared atof in class, this'll sure use global one. have @ wikipedia on subject : #include <iostream> using namespace std; int n = 12; // global variable int main() { int n = 13; // local variable cout << ::n << endl; // print global variable: 12 cout << n << endl; // print local variable: 13 }

python - How to use Anaconda on mac? -

Image
i trying learn bit deep neural nets project. anyways trying set , having problems getting environment start in anaconda. i click open terminal shown below in anaconda. opens terminal following commands: /users/m/.anaconda/navigator/a.tool ; exit; ╭─  ~     19:17 ╰─ /users/m/.anaconda/navigator/a.tool ; exit; /users/m/.anaconda/navigator/a.tool: line 1: syntax error near unexpected token `(' /users/m/.anaconda/navigator/a.tool: line 1: `bash --init-file <(echo "source activate /users/m/anaconda/envs/fastai;")' [process completed] inspecting a.tool, contains this: bash --init-file <(echo "source activate /users/m/anaconda/envs/fastai;") i thought might related zsh or bash, no shell run it. has come across before? don't necessary need able start gui, appears cli environment activation not working. need able activate environment somehow, preferably in zsh. ─  ~ 

php - how to create prepared mysqli statements and add password_hash -

i tried migrating way errors came out went crazy instant. https://ideone.com/mih7ip how can create mysqli prepared statements , add password_hash create secure access system. to system have added show captcha first failed attempt registered in database. this not enough improve safety. my code: <?php session_start(); $message=""; $captcha = true; $con = @new mysqli('localhost', 'root', '', 'system'); if(count($_post)>0 && isset($_post["vcode"]) && $_post["vcode"]!=$_session["vcode"]) { $captcha = false; $message = "written characters not match verification word. try again."; } $ip = $_server['remote_addr']; //we block ip 1 day $result = mysqli_query($con,"select * failed_login ip='$ip' , date between date_sub( now() , interval 1 day ) , now()"); $row = mysqli_fetch_assoc($result); //we data buy attempts , re

python - Fast sequential lists for tensorflow? -

i have array a of matrices (or 3-dim tensor) , want following: denote each matrix number, a [1,2,3,4,...,] , , let's have window of length 3, want pass input tensorflow graph 4-dim array [[1,2,3],[2,3,4],[3,4,5],....] . what's efficient way of doing this? (it's bit convolution constant kernel, without summing on resulting matrices). at moment i'm doing: input_nn = [data[t, t + window] t in range(my_range)] and pass tf placeholder. shall think of better way of doing in numpy , pass result placeholder or there fast way of doing in tensorflow passing a directly?

javascript - Vuetify Data Tables creating custom filters -

how use custom-filter prop , add new filter within? using data find "unemployed chickens" , remove special characters , spaces: data () { return { headers: [ { text: 'name', value: 'name' }, { text: 'animal', value: 'animal' }, { text: 'job', value: 'job' }, { text: 'age', value: 'age' }, ], items: [ { name: 'frozen yogurt', animal: 'chicken', job: 'electrician', age: 24 }, { name: 'eclair', animal: 'cow', job: 'it consultant', age:45 }, { name: 'cupcake', animal: 'cow', job: 'unemployed', age:26 }, { name: 'gingerbread', animal: 'chicken', job: 'unemployed', age:38 }, { name: 'jelly bean', animal: 'cow&#

javascript - two ways binding from multiple text boxes to single text area in jquery -

i bit of situation needed update data text box (multiple) text area. i have 5 textboxes in entering names , 1 text area updating automatically according name change in text boxes. textbox 1 = "i",textbox 2 = "am",textbox3 = "trying ",textbox4 = "to ",textbox5 = "concatenate" then, text area should show. - trying concatenate. now if update in text area changed "trying" "tried" , after changed in textbox1 "i" "we" in text area should not replace "tried" word again. i trying using jquery. there solution this, please let me know. thanks you can try this: <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".inputtext").keyup(function(){ $('#result')[0].innerhtml=$('#one').val()+$

networking - Unable to login to a website on wifi -

Image
there's website https://dev.purinamills.com/admin works fine on wifi , 3g/4g. when enter credentials on wifi, receive below error: but when enter credentials on mobile using 3g data, works fine. any appreciated. in advance. try login wifi homepage , try reset security setup. or check firewall settings blocked domains

iOS How to add text and pictures to the surface of the sphere (OpenGL) -

Image
i want achieve effect similar top of gif(application name: star chart) i convert sphere coordinates vertex data , render texture i use method glkmatrix4makeperspective inside parameters fovyradians achieve effect of zoom i add text , pictures location on surface of panorama, not know corresponding vertex position. there way use opengl achieve effect ? thanks in advance!

html - CSS transitioning child when parent is in hover state -

i trying move each letter in h1 heading specific new position whenever h1 element in 'hover' state. point reveal anagram 'chaser' 'search' currently when mouse hovers on heading, of letters move correct place, without kind of transition. h1 { text-align:left; font-family:'ubuntu mono', monospace; font-size: 8vw; font-weight:400; margin:3vw 0; } .mover span { position:relative; -webkit-transition: .5s right ease; transition: .5s right ease; } .mover:hover #c { left:16vw; } .mover:hover #h { left:16vw; } .mover:hover #s { right:12vw; } .mover:hover #e { right:12vw; } .mover:hover #r{ right:8vw; } <h1 class="mover"> <span id="c">c</span> <span id="h">h</span> <span id="a">a</span> <span id="s">s</span> <span id="e">e</span> <span id=

curl - How to upload file using PHP on Synology NAS / FTP Server? -

i want make file , upload on synology nas using php. our nas, it's support ftp tried use ftp_put() here , tried use curl() here . still cannot upload file nas. both of code running , doesn't show message error. here's destination path on our synology nas : /dms/upload-file/ and here's simple code using ftp_put(): $ftp_path = '/dms/upload-file/'.$_files["uploadedfile"]["name"]; $conn_id = ftp_ssl_connect($host,$port); $login_result = ftp_login ( $conn_id , $username , $password ); $upload = ftp_put($conn_id, $ftp_path, $_files["uploadedfile"]["tmp_name"], ftp_ascii); print (!$upload) ? $bgalert.'there problem while uploading '.$ftp_path.'</p>' : $bgalert.'upload complete</p>'; ftp_close($conn_id); the result always there problem while uploading /dms/upload-file/filename.jpg can me how fix our problem ? need help. thank you. can check folder permission /dm

jquery - How to allow only one JavaScript 'click' method to be clicked at a time while animation is executing? -

when element clicked, div slides off screen center. when element clicked, other div in center slides off screen , div slides in. the issue occurs when element clicked before initial div has time slide center of screen. $('#about').click(function(){ /* makes visible div slide out , slides in 'about' div */ }); $('#contact').click(function(){ /* makes visible div slide out , slides in 'contact' div */ }); in other words, when click about , right away click contact both slide in inconsistently. i tried "attrremove", "unbind", "off"... , although work disable clicks, cannot enable them again. one way approach through use of variable indicates if action in effect. if want queue event (so don't entirely disregard click (as example below doing), code modified add queue of sort. var slideinprogress = false; $('#about').click(function(){ if (!slideinprogress) { slideinprogr

java - WS Soap Handler class never invoked -

i developing jax ws , want add soap handler use ws authentication. added handler chain xml , soap handler class code never call soap handler's method.i use jdk 8 , tomcat 7. can problem? handler chain xml below: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <!doctype javaee:handler-chains> <javaee:handler-chains xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <javaee:handler-chain> <javaee:handler> <javaee:handler-class>com.vw.authhandler </javaee:handler-class> </javaee:handler> </javaee:handler-chain> </javaee:handler-chains> my soap handler class below: import java.io.printstream; import java.io.stringreader; import java.util.collections; import java.util.set; import javax.xml.bind.jaxbcontext; import javax.xml.bind.jaxbexception; import javax.xml.

javascript - How to return an Observable in angular 4? -

i have method inside authprovider provider class: getuser() { return this.afauth.authstate.subscribe(user => { return user; }); } i subscribe in different class, like: this.authprovider.getuser().subscribe(user => console.log(user)); any ideas how return observable inside getuser() method? your authstate observable. return authstate , subscribe within function. in function other work can use rxjs#map function. getuser() : observable { return this.afauth.authstate.map(...); } .... login() { getuser().subscribe(user => { return user; }); }

javascript - Typescript import/as vs import/require? -

this question has answer here: new es6 syntax importing commonjs / amd modules i.e. `import foo = require('foo')` 3 answers i using typescript express / node.js . for consuming modules, typescript handbook shows following syntax: import express = require('express'); but typescript.d.ts file shows: import * express "express"; i searched msdn blog not find anything. which 1 more correct of 2016? differences between two, if any? where best source find information on latest syntax use can find information in future? these equivalent, import * has restrictions import ... = require doesn't. import * as creates identifier module object , emphasis on object . according es6 spec, object never callable or new able - has properties. if you're trying import function or class, should use import express = require(

python - Why is modulo resulting in floating point numbers? -

i wrote code takes 10 base number , converts different base number. first iteration of while loop produces integer. subsequent iterations produce floating point numbers. why? producing correct answer, floating point. idea why? num = 128 abase = 2 tlist = [] while num > 0: tcr = num%abase tlist.append(tcr) num -= tcr num = num / abase print(tlist) tlist = tlist[::-1] temp = 0 item in tlist: temp *= 10 temp += item temp = str(temp) print(temp) x // y (floored) quotient of x , y it because of num = num / abase division operator. change to: num = num // abase updated code: def test(): num = 128 abase = 2 tlist = [] while num > 0: tcr = num%abase tlist.append(tcr) num -= tcr num = num // abase print(tlist) tlist = tlist[::-1] temp = 0 item in tlist: temp *= 10 temp += item temp = str(temp) print(temp) test() output:

javascript - Ajax Post request formation while calling the api -

i configuring ajax post request hit api. below curl command (its dummy): curl -x post \ --header 'content-type: application/json' \ --header 'accept: application/json' \ --header 'authorization: token' \ --header 'timestamp: test' \ --header 'sourcesystemid: test' \ --header 'sourcesystemuserid: test' \ --header 'sourceserverid: test' \ --header 'trackingid: test' \ -d '{"accountid": "123456789","modeofbusiness": "audio"}' \ 'https://services-services.c1.com:443/api/customer/v1/services/querysummary' need reform hit using ajax request. ajax code this? how pass --header , -d tag in this? api returning response in json format. below ajax code. var accntno = document.getelementbyid('accntnotext').value; var token = document.getelementbyid('tokentext').value; //event.preventdefault(); var queryapi = "https://services-services.c1.com:443/

ios - How do I make two UIButtons perform like radio buttons in Swift? -

i have 2 uibutton s want use set a/b value variable before save data database. want button become selected when tapped, , deselected when other button tapped, , vice versa. solution accomplishing programmatically or in interface builder? in order set "a/b value" mention, easiest option use uiswitch or -in general case of possibly more 2 options- uisegmentedcontrol (as @rmaddy suggested in question's comments) . these controls have built-in "choose 1 out of many" functionality looking for. the drawbacks of switch are: it has either on or off (does not support selection state of "neither nor b") you can't have separate title labels each state. if still want 2 separate uibutton instances, can: have refeences both buttons in view controller ( @iboutlet s wired using interface builder), e.g.: @iboutlet weak var leftbutton: uibutton! @iboutlet weak var rightbutton: uibutton! implement action method both buttons in such

How to merge two list into one list in scala -

i have 2 type of list contain follow. list(50, 50, 50, 50, 50, 51, 51, 51) and list(176482, 176481, 176485, 176479, 176478, 176477, 176483, 176480) by using these 2 list want create new list should contain follow list(50176482, 50176481, 50176485, 50176479, 50176478, 51176477, 51176483, 51176480) can 1 on this? scala> (list(50, 50, 50, 50, 50, 51, 51, 51) zip list(176482, 176481, 176485, 176479, 176478, 176477, 176483, 176480)).map(x => (x._1.tostring + x._2.tostring).toint) res0: list[int] = list(50176482, 50176481, 50176485, 50176479, 50176478, 51176477, 51176483, 51176480)

python - What would be the best approach for generating stats for each stage in a project? -

i have project send csv file , data relating each of rows through api. data preprocessed , actual analysis done. i need generate statistics each stage of project. first phase of development in terms of maintenance , development how should go this? i implementing separate stats reporter class statistics should write logic stats there itself? make easier add or edit changes logic if needed in 1 place. or should write logic in each phase , aggregate them in reporter class? or there better approach haven't thought of? thanks help

c# - Role based Authentication using action name -

Image
i working on c# mvc project entity framework. trying role based authentication. i have 3 tables roles , permissionfunction , permission . roles : roleid | rolename ------------------- 1 | admin 2 | super admin 3 | user permission function pfid | functionname ------------------------- 1 | usercreate 2 | useredit 3 | userdelete 4 | userview 5 | productcreate 6 | productedit 7 | productdelete 8 | productview permision permisionid | roleid| pfid ------------------------- 1 | 1 | 1 2 | 1 | 2 3 | 1 | 3 4 | 1 | 4 5 | 3 | 5 6 | 3 | 6 these sample datas. i need check role of user when logins , according give access permissible pages. i have view admin can change permission details. the functionname in permission function table string, , need use give or stop access correspondin

mediawiki 500 internal error when visit the home page -

mediawiki came 500 internal error fatal error: uncaught error: call member function getcode() on null in /var/www/wiki/includes/user/user.php:1578 stack trace: #0 /var/www/wiki/includes/user/user.php(5243): user::getdefaultoptions() #1 /var/www/wiki/includes/user/user.php(2859): user->loadoptions() #2 /var/www/wiki/includes/context/requestcontext.php(364): user->getoption('language') #3 /var/www/wiki/includes/message.php(380): requestcontext->getlanguage() #4 /var/www/wiki/includes/message.php(1257): message->getlanguage() #5 /var/www/wiki/includes/message.php(842): message->fetchmessage() #6 /var/www/wiki/includes/message.php(934): message->tostring('text') #7 /var/www/wiki/includes/exception/mwexceptionrenderer.php(254): message->text() #8 /var/www/wiki/includes/exception/mwexceptionrenderer.php(358): mwexceptionrenderer::msg('dberr-again', 'try waiting f...') #9 /var/www/wiki/includes/exception/mwexceptionrenderer.php(52):