Posts

Showing posts from August, 2015

python - Celery: consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available -

i keep getting error, , don't know why. i'm using ubuntu on windows 10 , celery used work fine. happened , keep getting error. use celery docs learn. here task.py: from celery import celery app = celery('tasks', broker='pyamqp://guest@localhost//') @app.task def add(x, y): return x + y here error i'm getting: [2017-08-14 17:34:04,436: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 92] protocol not available. trying again in 2.00 seconds... [2017-08-14 17:34:06,453: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 92] protocol not available. trying again in 4.00 seconds... [2017-08-14 17:34:10,465: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 92] protocol not available. trying again in 6.00 seconds... [2017-08-14 17:34:16,480: error/mainprocess] consumer: cannot connect amqp://guest:**@127.0.0.1:5672//: [errno 92] protocol not

json - Manifest Issue in Chrome Store -

i've been working on chrome extension several weeks , uploaded extension chrome web store. when try install store, gives me error saying "invalid manifest" , nothing more. is there way figure out wrong manifest file chrome store doesn't like? browser installs extension fine (and works) when load in via developer mode. since can't copy code tag , preview well, i've linked manifest file below: manifest file on github i've read manifest v2 documentation , have looked on several google groups assistance. appreciated, thanks! turns out "tabs" can not go under permissions, must optional permission. , must encode manifest file utf-8 rather ansi.

vba - How can I calculate the average of 1 variable of Array of Custom Type -

this tricky 1 me explain, i'll start code have far, , later trying achieve. current code option explicit public esigtickerarr variant ' public type save array type watchlist esigticker string op double hi double lo double cl double vol double bartime variant end type public watchlistarr() watchlist ' save array of special type "watchlist" '==================================================================== sub mainr() redim watchlistarr(0) ' init array size esigtickerarr = array("part1", "part2", "part3") each esigtickerelem in esigtickerarr ' check if first member of array occupied if watchlistarr(0).esigticker <> "" ' not first time running code >> increase array size 1 redim preserve watchlistarr(ubound(watchlistarr) + 1) ' increase array size 1 end if ' ... code, working fine .... ' populate array type data

Running FTP through Jenkins on windows server 2012 -

i have installed jenkins in our server successfully, , can run configure , run jobs. i want run windows batch command on jenkins job, should download files through ftp. had issues ftp able connect server, couldn't download files or list them, ftp unable establish data channel because of server's firewall configuration. i able fix issue, opening ports ftp executable, , able download files command line. now want make same operation i'm running on command line, in jenkins job. the problem once try make wget or ls, job stalls , nothing happens. this behavior similar experienced in command line before opening ports , can't tell if same issue jenkins not giving feedback (on command line see line "150 file status okay; open data connection.", jenkin's console displaying commands sent ftp, not ftp response). i have tried applying same firewall configuration 1 applied ftp executable, jenkins executable , service. no go. i changed user launches jenki

c# - How do I keep ASP.net connection string passwords secure on a git repository? -

up until have been using gitignore ignore web.congfig , web.release.config files connections strings (including passwords) not stored in git repository. this has been fine changes web.config being passed around on encrypted removable media. but have started @ using continuous integration , storing code on visual studio team services. work (unless can suggest fix) must have web.config included part of project. i hosting application on windows server (in-house) mssql db , connection oracle db on different server. i'm not advanced developer holding own far. support welcomed. you can achieve moving connection string details external configuration file. move connection string connections.config file <connectionstrings> <add name="name" providername="system.data.providername" connectionstring="valid connection string;" /> </connectionstrings> now in web config can reference file connection string

Java PrintWriter File Overwrite -

i want write file using utf-16 use printwriter(file,"utf-16"), deletes in file, use filewriter(file,true), wouldn't in utf-16, , there apparently isn't constructor printwriter printwriter(writer,charset,boolean append); what should do? the javadoc filewriter says: the constructors of class assume default character encoding , default byte-buffer size acceptable. specify these values yourself, construct outputstreamwriter on fileoutputstream . so can do: writer writer = new printwriter( new outputstreamwriter( new fileoutputstream(filename, true), standardcharsets.utf16)); you might want include bufferedoutputstream in there maximum efficiency.

osx - Get the path of a closed folder with Applescript -

i'm looking solution applescript path of folder closed user. aim call scripts path in argument. i tried to this, seem not work (my folder actions correctly set): on closing folder window theattachedfolder tell application "finder" set thepath posix path of theattachedfolder display dialog thepath end tell end on closing folder window you need change end on closing folder window for end closing folder window for , because block starts word on , ends word end . in both cases, next must write name of action, in case: closing folder window . additionaly, can move display dialog out of tell block, because it's not necessary target finder application. display dialog part of standard additions. code: on closing folder window theattachedfolder tell application "finder" set thepath posix path of theattachedfolder end tell display dialog thepath end closing folder window

Creating a list of values from json in python -

i have following code in python : def myprint(d): date_list = "" k, v in d.iteritems(): if isinstance(v, dict): myprint(v) else: if (k == "date"): date_list = date_list + " " + v print date_list firebase = firebase.firebaseapplication('https://my-firebase-db-958b1.firebaseio.com/', none) result = firebase.get('/dublin-ireland', none) myprint(result) i'm reading through multi-level json , extracting value key called "date". i'm trying collect dates in json , store them in variable called date_list. when execute code above, date_list variable contains 1 date instance, overwrites in every loop. doing wrong? you recursing myprint function, date_list variable reassigned empty string. need supply variable input param in function, , need return list instead of printing it. something this... def myprint(d, date_list=none): if not date

c++ - Type trait to match signatures of member functions of different classes -

what elegant way (possibly c++17-way) check if signatures of 2 methods defined in 2 different classes same? for example: template< typename ...ts > struct { void f(ts...); }; template< typename ...ts > struct b { void g(ts...); }; static_assert(has_same_signatures< decltype(&a<>::f), decltype(&b<>::g) >{}); static_assert(!has_same_signatures< decltype(&a< int >::f), decltype(&b< char >::g) >{}); //static_assert(has_same_signatures< decltype(&a< void >::f), decltype(&b<>::g) >{}); // don't know feasible w/o complexity it great, if types of non-member functions on either side allowed too. maybe result type should entangled too. the task origins common problem of matching signal/slot signatures in qt framework. you like: // static member functions / free functions same // if types same template <class t, class u> struct has_same_signature : std::is_same&l

wpf - Caliburn.Micro - why uses UserControl instead of Window -

my question in title. i'm starting caliburn.micro mvvm approach (which new me) , in every tutorial first step remove default mainwindow.xaml file , create new usercontrol file. why that? usercontrol not accept title. isn't possible build application using normal windows? tried that, every launch error "cannot find view viewmodel", although both mainview.xaml , mainviewmodel.cs present. when created pair of usercontrol , viewmodel it, started work expected. again, why windows don't work? wouldn't problem, i'm thinking additions modern ui themes wpf might not work without window. i'm not sure of that. probably 1 solution display defined usercontrol view inside of window, it's workaround. you create own custom shell window creating custom windowmanager : public class customwindowmanager : windowmanager { protected override window createwindow(object rootmodel, bool isdialog, object context, idictionary<string, object> settin

javascript - how do I display a list in a custom sort order with angular? -

i'm trying display list of objects on screen custom order [m,r,d,v,o]. i've tried using sort() function works first , last items middle comes through randomly. should using sort() function situation? if doing wrong? in ui i'm using *ngfor loop through array. <div *ngfor="let stuff of sortedstuff; let = index;"> <div>want display in custom sort order here</div> <ul><li> {{ stuff.someproperty }} <li></ul> </div> code builds array: var sortedstuff = stuff.splice(0); sortedstuff.sort((obj1) => { if (obj1.propertyx === 'm') { return -1; } if (obj1.propertyx!= 'm' && obj1.propertyx!= 'd' && obj1.producttype != 'v' && obj1.propertyx!= 'o' && obj1.propertyx=== 'r'){ return 1; } if (obj1.propertyx!= 'm' && obj1.propertyx!= 'r' && obj1.propertyx!= '

Python wriring data from Excel File -

i'm attempting loop through lines of excel file , write data in web application. i'm using mixture of openpyxl excel data , pyautogui click , type in web application. however, when point enter data: c=sheet.cell(row=i,column=7).value pyautogui.typewrite(c) i error "for c in message: typeerror: 'int' object not iterable". there way can around this? sounds pyautogui can type exact strings, not read variables? import openpyxl import pyautogui import time wb = openpyxl.load_workbook('h:\\python transfer.xlsx') type (wb) wb.get_sheet_names() sheet = wb.get_sheet_by_name('sheet1') lastrow = sheet.max_row in range(2,lastrow + 1): #print(sheet.cell(row=i,column=7).value) pyautogui.click(1356,134) time.sleep(5) c=sheet.cell(row=i,column=7).value pyautogui.typewrite(c) time.sleep(2) pyautogui.click(1528,135) thank you!! typewrite() takes string, convert c string: pyautogui.typewrite(str(c)) se

python - Modify matrix df format -

having df as: 14 15 16 14 10.1166 18.2331 65.0185 15 18.2331 6.664 57.5195 16 65.3499 57.851 20.9907 what different more efficient way modify df as b c 0 14 14 10.1166 1 14 15 18.2331 2 14 16 65.0185 3 15 14 18.2331 4 15 15 6.664 etc. i wrote code, dont fact need use loop it. for row in tt.index: row_vals = tt[tt.index==row] col_vals = row_vals.t col_vals['from_zone'] = row col_vals['to_zone'] = tt.index col_vals['travel_time'] = col_vals[row].astype('int') col_vals = col_vals.drop(row, axis=1) travel_data = pd.concat([travel_data,col_vals]) in [58]: df.stack().reset_index().rename(columns={'level_0':'a','level_1':'b',0:'c'}) out[58]: b c 0 14 14 10.1166 1 14 15 18.2331 2 14 16 65.0185 3 15 14 18.2331 4 15 15 6.6640 5 15 16 57.5195 6 16 14 65.3499 7 16 15 57.8510 8 16

android - Get wifi networks added by my app -

in app i've piece of code adds dynamically 1 or more wifi networks "saved networks" list. from system's settings view can see these networks "added myapp". so how can programmatically list of networks added myapp manage them ?

typeerror - "UnboundLocalError: local variable 'reward_n' referenced before assingment" In OpenAI Python Scripts -

i stuck on error after following tutorial online explaining concepts of writing openai scripts in python. complete error is: typeerror: local variable 'reward_n' referenced before assignment this current code: import gym import random #reinforcement learning step def determine_turn(turn, observation_n, j, total_sum, prev_total_sum, reward_n): #for every 15 iterations, sum total observations, , take average #if lower 0, change direction #if go 15+ iterations , reward each step, we're doing right #thats when turn if(j >= 15): if(total_sum/ j ) == 0: turn = true else: turn = false #reset vars total_sum = 0 j = 0 prev_total_sum = total_sum total_sum = 0 else: turn = false if(observation_n != none): #increment counter , reward sum j+=1 total_sum += reward_n return(turn, j, total_sum, prev_total_sum) def main(): #ini

php - .htaccess http to https redirecting too many times -

my domain www.supergenscript.com. hosted on www.easycloud.us , dns has been configured using cloudflare. have following code in .htaccess file. rewriteengine on rewritecond %{server_port} ^80$ rewriterule ^(.*)$ https://%{server_name}%{request_uri} [l,r=301] nothing except there in .htaccess file. complete code .htaccess has right now. using code purpose redirect http https automatically. changing http https index page not loading. instead, browser keeps on loading , after spending amount of time gives error. here error received on google chrome browser this page isn’t working www.supergenscript.com redirected many times. try clearing cookies. err_too_many_redirects please me find solution problem. getting frustrated. check one rewriteengine on rewritecond %{https} off rewriterule ^(.*)$ https://%{http_host}%{request_uri} [l,r=301] or one rewriteengine on rewritecond %{https} off [or] rewritecond %{http_host} !^www\. rewriterule ^ https://www.supergenscrip

java - Why is JDBC driver not necessary for H2 -

i have simple java getting started app using h2 in-memory db: string db_url = "jdbc:h2:./test"; try(connection conn = drivermanager.getconnection(db_url,user,pass); statement stmnt = conn.createstatement() ){ // executing sqls, getting result set, etc. ... } // catching & handling exceptions the app works, however, wonder why don't have call class.forname(jdbc_driver); anywhere in code? in h2 quick starts, load class manually. you don't need jdbc driver not many years old. drivers auto-discovered service provider mechanism of java, as documented : the drivermanager methods getconnection , getdrivers have been enhanced support java standard edition service provider mechanism. jdbc 4.0 drivers must include file meta-inf/services/java.sql.driver. file contains name of jdbc drivers implementation of java.sql.driver. example, load my.sql.driver class, meta-inf/services/java.sql.driver file contain entry: my.sql.driver

python - How to find all occurrences of tag using lxml -

i have file multiple doc tags. each doc tag has docid tag inside it. need inside doc tag if docid tag matches. using htmlparser parse file. need is: 1. recursively iterate on doc tag. 2. each doc tag if docid tag inside matches under doc tag. 3. repeat 2nd step doc tags. def get_docs(self, filepaths): parser = etree.htmlparser() file in filepaths: tree = etree.parse(file, parser) # tree = etree.parse(file) doc = tree.findall('.//doc') elem in doc: print etree.tostring(elem) i trying content inside each doc tag text_content() failing. getting below error while doing attributeerror: 'lxml.etree._element' object has no attribute 'text_content'

asp.net - Modify exisiting datagrid layout? -

<asp:boundcolumn datafield="status" visible="false"></asp:boundcolumn> i've added .aspx file. there 15 columns excluding 1 being filled via datagrid object (which being filled dataset sql table in it). overall purpose of adding new column use new column that's in dataset (sql table). however, datagrid still counts 15 columns. how go filling new column sql data need, assuming i'm calling: grid.datasource = sqltable grid.databind() would need physically add empty column datagrid prior this? or should new .aspx boundcolumn work fine , there's else going on.

office js - Microsoft Word Add-in Parse mktcmpid Not Working -

i have posted question on msdn "publishing apps office store" forum here , unfortunately haven't received response thought i'd try stackoverflow see if else has had similar issues. i've developed add-in word , have followed instructions on page track performance of advertising campaigns drive people add-in on office store. specifically section under "track campaign performance , customize add-in targeted audiences" header, specifies how developer should able access mktcmpid settings object through office.js. if attempt add mktcmpid parameter office store url add-in, , attempt parse value within add-in's code below, null value. if (office.context.document.settings) { return office.context.document.settings.get("microsoft.office.campaignid"); } additionally, value office.context.document.settings.get("microsoft.office.campaignid"); null . feature (being able pass in arbitrary mktcmpid via office store url

javascript - Get text of span without ID -

i'm trying piece of text span line has not id. using xcode , swift 3. here's line: <span class="name">peter red</span> i tried not work: var name = webview.evaluatejavascript("document.queryselector('.name').innerhtml") print("name \(name)") i tried using .innertext , .textcontent , outertext console prints name () the evaluatejavascript(_:completionhandler:) instance method expects 2 parameters. func evaluatejavascript(_ javascriptstring: string, completionhandler: ((any?, error?) -> void)? = nil) you missing completionhandler , run once script evaluation completes or fails. try following: webview.evaluatejavascript("document.queryselector('.name').innerhtml") { (name, error) in if error == nil { print("name \(name)") } }

android - Proper way configuration keys in gradle properties -

im trying upload apk playstore direct android studio. using ribot boilerplate can see putting keys in gradle.properties this: ribotappkeystorereleaselocation = keystore/release.keystore ribotappreleasekeyalias = undefined ribotappreleasestorepassword = undefined ribotappreleasekeypassword = undefined and in build gradle: // must set environment var before release signing // run: export ribot_app_key={password} release { storefile file("${ribotappkeystorereleaselocation}") keyalias "${ribotappreleasekeyalias}" storepassword "${ribotappreleasestorepassword}" keypassword "${ribotappreleasekeypassword}" } if write keys in gradle.properties like: ribotappreleasestorepassword = thisismykey im going have problem uploading git, cause team see keys. so, can set system enviroment variable here? or should do? see full boilerplate can set variables in local file sure: apply

r - Aggregate values for all combinations of factor levels including missing ones -

i'm trying find minimum value of dataframe based on multiple columns. i'm able using aggregate function below. however, result not contain combinations of factors there no data in input data frame. what i've got: # possibilities of fruits, cities, , vegetables: fruits<-c('apple','banana','grape') cities<-c('new york','chicago','los angeles') vegetables<-c('cucumber','mushroom') #my input (ie, sample test: inputdf<-data.frame(fruit=c('apple','apple','apple','banana','banana','banana','grape','grape','grape'),city=c('new york','new york','new york','new york','chicago','los angeles','chicago','chicago','chicago'),vegetable=c('cucumber','cucumber','mushroom','cucumber','mushroom','mushroom','cucumber

python - Pygame: strange behaviour of a drawn rectangle -

i'm trying make lifebar class game in pygame. i've done this: class lifebar(): def __init__(self, x, y, max_health): self.x = x self.y = y self.health = max_health self.max_health = max_health def update(self, surface, add_health): if self.health > 0: self.health += add_health pygame.draw.rect(surface, (0, 255, 0), (self.x, self.y, 30 - 30 * (self.max_health - self.health) / self.max_health, 10)) print(30 - 30 * (self.max_health - self.health) / self.max_health) it works, when tried down health zero, rectangle surpasses left limit bit. why happen? here have code try on own (just run if explanation of problem wasn't clear): import pygame pygame.locals import * import sys width = 640 height = 480 class lifebar(): def __init__(self, x, y, max_health): self.x = x self.y = y self.health = max_health self.max_health = max_health def update(self,

cmd - How to unzip a file to the exact path using 7z.exe? -

i running following command line, 7z.exe e "d:/file.zip" it unzip file in same path. but, requirement , need set path need extract file. for example, i need extract d:/file.zip in c:/folder/ i tried running command, 7z.exe e "d:/file.zip" "c:/folder/" it fails, so, pls me guys. of in advance. run 7z.exe -? see available parameters. use -o specify folder zip file should extracted: 7z.exe x c:\temp\temp.zip -oc:\temp\myfolder

.net - JSON.NET date with space in timezone offset -

i have odd issue vb.net program (vs2012 / .net framework 4) uses json.net (newtonsoft) v4.0.8 serialise objects. there dates amongst properties of class i'm serialising, , date serialised include timezone offset of +0000 or +0100 expect. however, on customer's computer plus being serialised space, , on being deserialised later (having been in database, in same vb.net program using same json.net dll), deserialise method throws exception saying string isn't in correct format (and can see it's when it's trying parse number @ heart of json.net dll). an example of date see on computer , on customers' computers is: "/date(1455017231091+0000)/" whereas 1 customer (and possibly others, judging number of times i've seen resultant exception) comes out this: "/date(1455017231091 0000)/" i'm not sure how can reliably deal (probably regex looks appropriate number of digits followed space , 4 digits) first of want find out if

javascript - async function declaration expects ';' in Internet Explorer -

Image
i have async function declaration works on chrome , firefox, gives following error in internet explorer. script1004: expected ';' file: javascriptfile.js, line: 5, column 7 this simplified version these 2 function @ top of file, , still fails on internet explorer. function sleep (ms) { return new promise(function (resolve) { settimeout(resolve, ms) }) } async function begging (help) { await sleep(1000) console.log('please') } i can not seem find not being able declare async functions in internet explorer. appreciate @ all, i'm not sure next in order figure out. internet explorer not support async functions, , never natively will. main drawback of using new javascript features lack of support.

c# - Erase by point in an InkCanvas [UWP] -

i'm trying let user erase 1 point of stroke in inkcanvas, problem property enables apparently doesn't work in uwp apps, there code or doing wrong? this code tried use: inkcanvas.editingmode = inkcanvaseditingmode.erasebypoint;

performance - High Javascript CPU use for webapp -

i've reached point i'm fishing , hoping catch something. the chrome performance tool shows whole cpu (so far tool detects, @ least) taken timeupdate events, nothing else firing. event isn't referenced anywhere in code or in dependencies (via github search). i reached point ran $("body").empty().off() , $(window).off() remove events , elements doing anything, , inserted debugging code loop through functions , redefine them undefined . i ran logging on setinterval , settimeout clear of those. i worked through chrome inspector's "event listener" tab , manually removed events. i run cleanup helper nukes else think of: window.cleanupelements = -> $("*").off() $("style").remove() $("link").remove() $("script").remove() false this white page no body content, functions, timers, intervals, or events still sitting pretty @ 50%+ cpu use. ideas?

android - 'App is scanning too frequently' with ScanSettings.SCAN_MODE_OPPORTUNISTIC -

we found issue on samsung s8, android 7.0 (upd. happens on android 7.0: samsung s7, nexus 5x), tells, after couple of tests, app scanning frequently: 08-14 12:44:20.693 25329-25329/com.my.app d/bluetoothadapter: startlescan(): null 08-14 12:44:20.695 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.696 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.698 25329-25329/com.my.app d/bluetoothlescanner: start scan 08-14 12:44:20.699 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.700 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.700 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.701 25329-25329/com.my.app d/bluetoothadapter: state_on 08-14 12:44:20.703 4079-4093/? d/btgatt.gattservice: registerclient() - uuid=dbaafee1-caf1-4482-9025-b712f000eeab 08-14 12:44:20.807 4079-4204/? d/btgatt.gattservice: onclientregistered() - uuid=dbaafee1-caf1-4482-9025-b712f000eeab, clientif=5, status=0 08-14 1

docker - How to initialize mysql container when created on Kubernetes? -

i want set initial data on mysql of container. in docker-compose.yml, such code can create initial data when running container. volumes: - db:/var/lib/mysql - "./docker/mysql/conf.d:/etc/mysql/conf.d" - "./docker/mysql/init.d:/docker-entrypoint-initdb.d" however, how can create initial data on kubernetes when running? according mysql docker image readme , part relevant data initialization on container start-up ensure initialization files mount container's /docker-entrypoint-initdb.d folder. you can define initial data in configmap , , mount corresponding volume in pod this: apiversion: extensions/v1beta1 kind: pod metadata: name: mysql spec: containers: - name: mysql image: mysql ports: - containerport: 3306 volumemounts: - name: mysql-initdb mountpath: /docker-entrypoint-initdb.d volumes: - name: mysql-initdb configmap: name: mysql-initdb-config --- apiversion: v1 kind

r - transposing a dataframe with repeats -

i have data frame has 2 columns, 1 gene symbols, , functional pathways. pathways column has repeated values there number of genes belong each pathway. reorder dataset each column single pathway , each row in columns gene belongs in pathway. starting dataframe: data.frame(pathway = c("p1", "p1", "p1", "p1", "p2", "p2", "p2"), gene.symbol = c("g1", "g2", "g3", "g4", "g33", "g43", "g10")) desired dataframe: data.frame(p1 = c("g1", "g2", "g3", "g4"), p2 = c("g33", "g43", "g10", "")) i know not columns same length, , having blank values preferable nas. here option. split list using pathway splitting element get max length of each group, , set other groups same length turn data frame here code. mydf <- data.frame(pathway = c("p1"

sql - How can I combine 2 joins in an update? -

the code below (currently error) update rows in table, i'm aiming code should update p.hour of per_id in clause , not rows. it's important value set column form table worker , 1 table department update worker set p_hour = p_hour + a.hour exists (select p.per_id, p.p_hour worker p, department p.per_id = a.per_id , p.per_id = '1234') this current error: error @ line 2: ora-00904: "a.hour": invalid identifier the canonical way in oracle is: update worker w set p_hour = (p_hour + (select d.hour department d w.per_id = d.per_id ) ) w.per_id = '1234' , exists (select 1 department d w.per_id = d.per_id ); you can use merge .

c# - ERROR: Cannot find column 10 -

i trying import csv file database. file has 10 columns. testing purposes first imported firs 4 columns , worked fine when try import columns error saying cannot find column 10. this code ` datatable dt = new datatable(); dt.columns.addrange(new datacolumn[10] { new datacolumn("invoice", typeof(string)), new datacolumn("p.o.number", typeof(string)), new datacolumn("line", typeof(int)), new datacolumn("invoice_date",typeof(datetime)), new datacolumn("gross", typeof(string)), new datacolumn("disc", typeof(string)), new datacolumn("net", typeof(string)), new datacolumn("date_pd", typeof(string)), new datacolumn("check#_doc#", typeof(string)), new datacolumn("additional_info", typeof(string))}); string csvdata = file.readalltext(csvpath); foreach (string row in csvdata.split(

r - Best practice for handling different datasets with same type of data but different column names -

for example, suppose want build package analyzing customer transactions. in nice world, every transactions dataset like transactionid customerid transactiondate 1: 1 1 2017-01-01 2: 2 2 2017-01-15 3: 3 1 2017-05-20 4: 4 3 2017-06-11 then make nice functions like num_customers <- function(transactions){ length(unique(transactions$customerid)) } in reality, column names people use vary. (e.g. "customerid", "customerid", , "cust_id" might used different companies). my question is, best way me deal this? plan on relying heavily on data.table, instinct make users provide mapping column names ones use attribute of table like mytransactions <- data.table( transaction_id = c(1l, 2l, 3l, 4l), customer_id = c(1l, 2l, 1l, 3l), transaction_date = as.date(c("2017-01-01", "2017-01-15", "2017-05-20", &quo

Acumatica API and custom properties -

i’m having issues setting custom properties web service. have several string field properties on soline. when send request of them getting set. post code there lot of stuff. i have checked web service payload , customization. appears correct else should at? additional info i’m extending 6.0 web api. calling acumatica postman. so ended working me series of restarting application , entering in the properties again in web service. go 1 property @ time. add restart application via system -> management -> apply updates -> restart application

sql - Add column with filled days between start_date and end_date -

i have input table structure: acct_id pvt_data_id pvt_pref_ind start_dttm end_dttm load_dttm pr_load_time 4174878 26 y 20101126144142 99991231235959 20170527000000 2017052700 4174878 26 y 20101126144142 99991231235959 20170528000000 2017052800 4174878 26 y 20101126144142 99991231235959 20170530000000 2017053000 3212472 26 x 20131016144142 99991231235959 20170531000000 2017053100 4174878 26 y 20101126144142 99991231235959 20170601000000 2017060100 3212472 26 x 20091201142148 99991231235959 20170602000000 2017060200 im supposed take table , create new 1 additional column pr_day , have integer value of 1 day (e.g 20170814 ) in range between start_dttm , end_dttm , there 1 row each day within range. started following query range each group (consisting of first 3 columns) select acct_id, pvt_data_id, pvt_pref_ind, cast(min(substr(cast(start_dttm string),1,8)) bigint), max(case when end_dttm=99991231235959 cast(from_unixtime(unix_timestamp(no

wordpress - How to create a border including a conditional logic element with css -

i rookie when comes css , currenty using custom css plugin in wordpress gravity forms submission form. included in form conditional logic element attached selection field. "external links" shows when select yes. hoping create border around both selection ("does project use links") , conditional element "external links". using code currently #field_4_19, #field_4_21 { border: 1px solid #d8ab4c;} and result 2 seperate borders allocated 2 different elements has suggestion how can alter code both elements wrapped in 1 border? thank in advance. o without providing html structure difficult give answer, easier way accomplish you're talking here wrap both elements in div , apply border around that. you're structure if there 1 element: <div class="mywrapper"> <input id="field_4_19"> </div> and if there two <div class="mywrapper"> <input id="field_4_19">

javascript - jquery datatables populate search data -

on document.ready, datatable loads accordingly. what need build feature reloads datatable if user conducts search. so datatable loads this: $(document).ready(function() { $('#searchsubmit').on('click', function() // used searching { var searchbooking = $('#searchbooking').val(); var searchquote = $('#searchquote').val(); var searchtli = $('#searchtli').val(); if(searchbooking == "" && searchquote == "" && searchtli == "") { $('.message').text('you did not enter search criteria.'); return false; // making sure enter } else { $.post('api/searchall.php', {searchbooking:searchbooking, searchquote:searchquote, searchtli:searchtli}, function(data) { // do here??? // how return results load }); } }); // if user not enter search parameters, load $('#example1').datatable({

java - Error when connect Android with ontology -

i want connect android owl file using code below, line model = modelfactory.createontologymodel(ontmodelspec.owl_mem_trans_inf) throws exception. public class ontoquery { private model model; public ontoquery(string inputfilename) { model = modelfactory.createontologymodel(ontmodelspec.owl_mem_trans_inf); inputstream in = filemanager.get().open(inputfilename); if(in == null) { throw new illegalargumentexception("file: " + inputfilename + " not found"); } else { model.read(in, "rdf/xml"); } } public string executequery(string querystring) throws unsupportedencodingexception { query query = queryfactory.create(querystring); queryexecution qe = queryexecutionfactory.create(query, this.model); throwable var5 = null; string fieldvalue; try { resultset results = qe.execselect(); bytearrayoutputstream go = ne

excel - column to matrix VBA -

i need reformat single column (range) of 100+ thousand integers user defined matrix of rows , columns. online searches have been disappointing in they're complicated or not need. index , offsets won't due because matrix dimensions (300+ cols, 300+ rows) prohibitive copying on , down. function sufficient includes range index, num_cols, num_rows. thanks in advance. so assuming understand question (and if not withdraw answer, let me know), following entered array formula in spot want answer land should work. inputcol data sit. not checking sizes , such. may soup that. if indeed want, can make little better copying row (using application.worksheetfunction.transpose) @ time (though suspect gets offset , less readability). function sotest(byref inputcol range, numrows long, numcols long) variant dim newmatrix() variant dim i, j, k long redim newmatrix(1 numrows, 1 numcols) k = 1 = 1 numrows j = 1 numcols newmatrix(i, j) = inputcol(k,

android - Firebase Database: add rule to find a particular value out of all childs -

Image
i want setup security rules database , want users , admins read particular group, rules don't work. the work when set specific index. don't know how can check indexes. possible in way? database: rules: { "rules": { "groups": { "$groupid": { ".write": "!data.exists()", ".read": "data.child('users').child('$index').val() == auth.uid || data.child('admins').child('$index').val() == auth.uid" } }, "users": { "$uid": { ".read": "auth != null", ".write": "$uid === auth.uid" } } } } i suggest change database structure this. put user's id child key of users , admins { "groups": { <groupid1>: { "admins": { <uid1>: true, <uid2>:

how to compile cuda newton template meta-programming sample program -

how compile sample cuda newton metaprogramming program in evaluating expressions consisting of elementwise matrix operations in thrust for reference, newton here: https://github.com/jaredhoberock/newton here start of output: nvcc -i. -i/local/cuda/include test_newton.cu nvcc warning : 'compute_20', 'sm_20', , 'sm_21' architectures deprecated, , may removed in future release (use -wno-deprecated-gpu-targets suppress warning). ./newton/detail/range/range_traits.hpp(171): error: expected ">" ./newton/detail/range/range_traits.hpp(177): warning: parsing restarts here after previous syntax error ./newton/detail/range/range_traits.hpp(171): error: mismatched delimiters in default argument expression ./newton/detail/range/range_traits.hpp(177): error: expected "," or ">" ./newton/detail/range/range_traits.hpp(177): error: expected "," or ">" ./newton/detail/range/range_traits.hpp(177): error:

php - Illegal string offset 'qty' Wordpress -

i have problem illegal string offset 'qty' using wordpress , don't know how fix it. illegal string offset 'qty' public_html/wp-content/themes/freelancersvalley/includes/aecore/payments.php on line 70 code: function ae_user_package_info($user_id) { if (!$user_id) return; global $ae_post_factory; $ae_pack = $ae_post_factory->get('pack'); $packs = $ae_pack->fetch(); $orders = ae_payment::get_current_order($user_id); $package_data = ae_package::get_package_data($user_id); foreach ($packs $package) { $sku = $package->sku; if (isset($package_data[$sku]) && $package_data[$sku]['qty'] > 0) { if( $package->post_type == 'pack'){ $order = get_post($orders[$sku]); if (!$order || is_wp_error($order) || !in_array($order->post_status, array('publish', 'pending'))) continue; /**

javascript - Ruby on rails split index.js to separate files -

i have huge index.js file, 7000 lines, , want split separate files, dont care if assembled rails 1 file, need separate them easier editing. i have application.js manifest file includes index.js , many more javascript files, index.js became big since i'm not ruby on rails guy, can please give me useful advise on it? index.js is: "use strict"; (function($) { //some setup string vars , arrays //some object definition //some object definition //some object definition //some object definition //some conditions init objects })(jquery) so //some object definition i want move separated files. in application.js file can call following load individual files //= require customjsfile1 //= require customjsfile2 ... if want call them in erb instead <%= javascript_include_tag "customjsfile1", "data-turbolinks-track" => true %>

node red - Javascript Nested Loop Pushing to Array -

i relatively new programming , having issues project working on. msg.newcg2 = []; for(i=0;i<msg.newcg.length;i++){ for(j=0;j<msg.campaigngroup.length;i++){ if(msg.campaigngroup[j].col10 === msg.newcg[j]){ msg.grouptotals = msg.grouptotals + msg.campaigngroup[j].col11; } msg.newcg2.push(msg.newcg[i], msg.grouptotals) } } basically, each 1 of "ids" (integers) in msg.newcg, want each id in msg.campaigngroup , sum totals listings same id, msg.campaigngroup.col11 - push id , totals new array - msg.newcg2. when run code, first item sent through processes, grinds halt because of memory. assume because of error in code. where did code go wrong? sure there better ways whole, curious went wrong. there typo in second loop , push needs happen inside outer loop. msg.newcg2 = []; for(i=0;i<msg.newcg.length;i++){ for(j=0;j<msg.campaigngroup.length;j++){ if(msg.campaigngroup[j].col10 === msg.newcg[i]){

reporting services - SSRS 2016 report or shared dataset has user profile dependencies and cannot be run unattended -

i building ssrs report designed flexible don't have create several copies of report based on role in company. using user!userid built in parameter drive 1 of report parameters (this filters top parameter based on role in our hr system). part working great. however, need able schedule report using data driven subscription, since using user!userid parameter, giving me error cannot set data driven subscription if there user profile dependency. there way around this? know can create standard subscription , works fine, size of our organization, data driven ideal. any ideas?

Java webserver to respond with JSON -

i trying create simple java web-app responds request /test json string. my environment java, intellij , tomcat 8.5.4. so far have 3 classes already: csv - csv json conversion cleanup - class convert data servlet - class responds request my servlet class: import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import java.io.ioexception; @webservlet(name = "servlet") public class servlet extends httpservlet { protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { system.out.println("get request received"); cleanup cleanup = new cleanup(); cleanup.cleanupdata(); // logic needed here send data

javascript - Footer is not positioned properly on the bottom of the page for different screens -

when switch between different resolution screens, footer gets positioned either upper bottom line or lower causing scrollbar appear. how fix issue css? i've tried following several posts, i'm not sure i'm doing wrong. react code: return ( <div> <div classname="container"> <div id="logo"> <img src={require('../../images/vidn_logo.png')} /> </div> {heading} <form classname="form-signin" onsubmit={this.formsubmit}> <input onchange={this.setemail} type="email" classname="login-form-control" autocomplete="email" placeholder="email" required></input> <input onchange={this.setpass} type="password" classname="login-form-control&

PHP - How to combine two arrays with different number of elements? -

i have 2 arrays: one: array(4) { [0]=> array(2) { [0]=> string(19) "ford" [1]=> string(1) "1" } [1]=> array(2) { [0]=> string(15) "chevrolet" [1]=> string(1) "1" } [2]=> array(2) { [0]=> string(7) "vw" [1]=> string(1) "1" } [3]=> array(2) { [0]=> string(4) "fiat" [1]=> string(1) "3" } } two: array(6) { [0]=> string(7) "#581845" [1]=> string(7) "#900c3f" [2]=> string(7) "#c70039" [3]=> string(7) "#ff5733" [4]=> string(7) "#ffc300" [5]=> string(7) "#daf7a6" } now, need first array combining second, excluding elements of second array not used first. @ end, want receive array like: [0]=> { [0]=> "ford", [1]=> "1", [2]=>"#581845

python 3.x - Accessing variable from one class to another -

i new python , need code. want access "usser" variable in "login" class mainmenu class. appreciated. thank in advance , have great day. class login (tk.frame): def __init__(self, parent, controller): tk.frame.__init__(self, parent) self.controller = controller username = ttk.label(self, text="username: ") password = ttk.label(self, text="password: ") username.grid(row=0, column=0, sticky='nsew') password.grid(row=1, column=0, sticky='nsew') usernamee = ttk.entry(self) passworde = ttk.entry(self, show='*') usernamee.grid(row=0, column=1, sticky='nsew') passworde.grid(row=1, column=1, sticky='nsew') backbutton = ttk.button(self, text="sign up", command=lambda:controller.show_frame(newhere)) backbutton.grid(row=4, column=0, sticky='nsew') loginbutton = ttk.button(self, text="log in") loginbutton.grid(row=4, column=1, stic

intershop - CountrySelect form field, pre-populate with a country -

how can default populating select drop down list value, in case country u.s.. we've removed other countries list users still required select 1 option. in addition default value, dependent fields need populated. in intershop, selecting country populates state field. default u.s. , have state field populated on initial request, sans ajax calls. you have modify pipelines this. the webform loads based in country code. intershop gets countrycode addressbo or parameter. see viewuseraccount-changeaddress : pipeline used in ajax request load webform when u select country. use same logic load u.s webform (us) when address has not been filled in yet.

python - Remove peak lines -

i have data file in save datetime, ph, , temperature. once in while, temperature misses 1 digit shown below: 12-08-2017_14:52:21 temp: 28.9 ph: 7.670 12-08-2017_14:52:42 temp: 28.9 ph: 7.672 12-08-2017_14:53:03 temp: 28.9 ph: 7.672 12-08-2017_14:53:24 temp: 8.91 ph: 7.667 12-08-2017_14:53:45 temp: 28.9 ph: 7.667 12-08-2017_14:54:06 temp: 28.9 ph: 7.669 12-08-2017_14:54:27 temp: 28.9 ph: 7.671 i'd remove whole line error. i've found solutions this , don't understand how implement in python. there specific way should it, either in python or bash? it depends lot on behavior desire , complexity of solution required. data posted, can try computing difference last measurement , rejecting measurements have difference on threshold degrees previous one. quick , dirty example of this: threshold = 10 lasttemp = none while true: line = raw_input().split() temp = float(line[2]) if not lasttemp: lasttemp = temp if abs(temp - lasttemp) > t

css - Is it possible to render border-image-outset value of 0.5 in Safari? -

i want render 1px border in between sibling nodes. have constructed solution using svg border-image works in modern browsers this: .svg-border { border-style: solid; border-width: 1px; border-image-source: url("data:image/svg+xml..."); border-image-slice: 1 1; border-image-outset: .5; } however, i'm stuck on safari: doesn't appear accept .5 value border-image-offset , borders appear 2px width between adjacent siblings. does know workaround or other method getting work? see codepen demo here

RxJS in AngularJS Services -

i'm learning rxjs , trying implement in 1 of existing applications. first thing trying remove rootscope.broadcast/emit methods , replace them behaviorsubjects. has worked fine if events subscribed inside controller. however, if try subscribe events in service, never fire. can move exact same subscription component/controller/etc , works fine. is there reason or should able , doing wrong? update 1 i have event service maintains events run @ top of application so: (function () { "use strict"; angular.module("app.common").service("eventservice", eventservice); function eventservice($window) { "nginject"; var defaultbehaviorsubjectvalue = null; var service = { activate: activate, onlogin: new rx.behaviorsubject(defaultbehaviorsubjectvalue), //onnext authservice.login onlogout: new rx.behaviorsubject(defaultbehaviorsubjectvalue), //onnext authservice.logout isonline: new rx.beh