Posts

Showing posts from February, 2015

node.js - ReactJS: JSON file is fetched from localhost instead of project directory -

Image
i have following directory structure of project. i have following code in index.js file loading website.json file. index.js componentdidmount() { $.ajax({ url: "../website.json", type: "get", datatype: 'json', contenttype: 'application/json', success: function(data) { this.setstate({data: data}); console.log(data); }.bind(this), error: function(jqxhr) { console.log(jqxhr); }.bind(this) }) } the problem using npm start command server react app local directory of application. serves app @ http://localhost:3000/ . problem application tries load website.json file http://localhost:3000/website.json gives 404 not found error. so, question how website.json file can loaded project directory instead of localhost. note: project folder not @ localhost @ virtual host. update: asking why ajax call unable load data project folder (i us...

java - Closing an application programmaticly with custom error message? -

i want close android application method, should shown custom message (which define myself). found yet "how close application" , got more 10 ways close application haven't found way set custom message. @ moment if app crashes appears: [appname] has been stopped want this congratulations! found bug, please submit it. there way that? methods found closed activities or forced unresolveable error. i don't think need code me, if do, tell me. (language should java , javascript/jquery should avoided) you try making static stop method: public static void stop(string message) { log.d(message); system.exit(0); }

python - How does re.match and re.search with '^' differ? -

it seems re.match , re.search w/ '^' same thing, except re.search can use re.multiline flag making more flexible. string ="""u.s. stock-index futures pointed solidly higher open on monday north korea. issue overshadowed state of equity market, earnings have been strong @ time of high employment , low inflation, valuations ppear elevated many metrics, north korea""" import re re.search('^north korea\.?', string) # no match re.match('^north korea\.?', string) # no match re.search('^north korea\.?', string, flags = re.multiline ).group() #match are there benefits of using 1 on other? re.match() checks match @ beginning >>> re.match("c", "abcdef") # no match >>> re.search("c", "abcdef") # match <_sre.sre_match object @ ...> re.search() checks match anywhere in string. if want find substring, use re.search() >>> re.match(...

javascript - How to prevent d3-brush from adding "display:none" to .selection and .handle onmousedown -

i noticed after brushing area using d3-brush, if click within brush's extent outside of selection, selection becomes invisible. closer inspection revealed svg rect elements .selection and .handle given display: none property, in response mousedown event. this jsfiddle minimal example of behaviour. drag select within white area, click white area outside of selection. edit: ivan brought in comments, seems default behaviour empty selections. how can prevent it? tried adding empty mousedown event listener .overlay , doesn't work.

Python Error self.reader.next() -

i receiving error , don't know how fix it. error show below along program. beginner programming new me. program's goal read information based of year , location , print out corresponding information psse traceback (most recent call last): file "c:/users/roszkowskim/desktop/dictreader.py", line 75, in <module> row in reader: file "c:\python27\lib\csv.py", line 103, in next self.fieldnames file "c:\python27\lib\csv.py", line 90, in fieldnames self._fieldnames = self.reader.next() valueerror: i/o operation on closed file _ import csv load_gen_datafile = 'c:\users\roszkowskim\desktop\data_2017.csv' open(load_gen_datafile) csvfile: reader = csv.dictreader(csvfile) mydict = {} row in reader: year=row['year'] busnum=row['busnum'] area=row['area'] power=row['power'] tla=row['tla'] location=row['location'] yearlink=row['yearlink'] from=row['fr...

mysql - Failing to start my spring boot application due to 'javax.sql.DataSource' that could not be found -

i beginner in spring boot , trying write simple spring boot application. folder structure follows: -> project -> build.gradle -> settings.gradle -> src/main/java -> package -> main.java -> usercontroller.java -> userrespository.java -> dto -> user.java ->src/main/resouces -> application.properties my build.gradle follows : buildscript { repositories { jcenter() } dependencies { classpath( 'org.springframework.boot:spring-boot-gradle- plugin:1.5.6.release' ) classpath('mysql:mysql-connector-java:5.1.34') } } apply plugin: 'java' apply plugin: 'spring-boot' sourcecompatibility = 1.8 targetcompatibili...

Oracle SQL: Sampling a large number of rows from a table -

i want extract roughly 5 million row sample table contain somewhere between 10 million , 20 million rows. due large number of rows, efficiency key. such, trying avoid sorting rows possible, hence why avoiding dbms_random.value solution have seen in similar questions. i tried following: select * full_table sample (ceil(100 * 5000000 / (select count(*) full_table))); however, can't seem arithmetic in sample clause (ora-00933: sql command not ended - tried simple sample(10/2) , still same thing). is reasonable approach, and, if so, how calculate number of rows in sample clause? you use pl/sql dynamic sql this: declare cnt integer; begin select count(*) cnt full_table; dbms_output.put_line(cnt); execute immediate 'insert target_table' ||' select * full_tablesample (' || ceil(100 * 5000000/cnt) || ')'; end;

maps - Unable to generate the vector tiles form geoJson using tippecanoe -

i trying convert geojson files vector files using mapbox/tippecanoe . have build tippecanoe image mention in document. when run below command nothing happens. docker run -it --rm \ -v /tiledata:/data \ tippecanoe:latest \ tippecanoe --output=/data/output.mbtiles /data/example.geojson it shows me messages for layer 0, using name "example" /data/example.geojson: no such file or directory 0 features, 10 bytes of geometry, 4 bytes of seperate metadata, 0 bytes of string pool. did not read valid geometries in data folder there example.geojson file exists still not able find end. i running on ubuntu 14 machine. can me out this? in advance.

Better way to get rid of leading zeroes in a date - Excel formula? -

Image
i came solution display today's date without leading zeroes in month or day when it's single digit (so instead of 08/03/2017 8/3/2017, etc.): =text(month(now()),"0") & "/" & text(day(now()),"0") & "/" & text(year(now()), "0000") displays: that formula displays today's date. typically i'd whatever , move on, of cells displaying range of dates (the first of month, current day, , last day of month etc.), have in of cells long chain of formulas. is there simpler way display dates without leading zeroes (and text)? from files: text makes use of format codes display numbers in more readable format, or combine numbers text or symbols. so, text function saying =text(value want format, "format want apply") the general format date d/m/yyyy display month & day no leading 0 , 4 digit year. write =text(today(),"a") , convert todays date letter a. in case n...

java - JavaFX property change listener: null newValue -

i have cuttingoperationcombobox combobox , method changes items , value of combobox: public void changeglass(glass newglass) { observablelist<operation> list = new filteredlist<operation>(productglasscuttingui.this.operationsdb.getoperationslist(), operation -> operation.getoperationtype().tostring().equals("re") && operation.getglassthickness() == newglass.getglassthickness()); if(!list.contains(this.cuttingoperationcombobox.getvalue())) cuttingoperationcombobox.setvalue(list.get(0)); cuttingoperationcombobox.setitems(list); } i have change listener added cuttingoperationcombobox.valueproperty() . fired first time cuttingoperationcombobox.setvalue(list.get(0)); , here fine. when cuttingoperationcombobox.setitems(list); fires change listener, newvalue in null although list not empty. happens when combobox visible. tobe more precise: cuttingoperationcombobox displayed in treeview part of treecell graphics. lon...

Throw an exception in scala akka -http app when multiple required post params are not supplied -

i need throw errors indicating multiple request post paramters missing in akka-http scala app, rather current behavior throws 1 parameter missing error though not provide 2 reqd post params. for eg(current error): { "status": 400, "code": "", "errormessages": "object missing required member 'pricedate'" } should like: { "status": 400, "code": "", "errormessages": "object missing required members 'pricingdate','salesorg','xxx' " } case handlers this: //scala http code below. object customhandlers extends sprayjsonsupport defaultjsonprotocol { implicit val errorformat = jsonformat3(errorresponse) implicit def rejectionhandler = rejectionhandler.newbuilder() .handle { case missingqueryparamrejection(param) => complete(badrequest, errorresponse(badrequest.intvalue,errormessages = s"request missing required query param...

php - Fatal error: Uncaught Error: Class 'Stomp' not found -

i've downloaded library available in: https://github.com/dejanb/stomp-php and implemented following code: <?php use fusesource\stomp\stomp; (...) $data=array($data1,$data2, $data3, $data4); $json = json_encode($data, true); $user = getenv("activemq_user"); if( !$user ) $user = "admin"; $password = getenv("activemq_password"); if( !$password ) $password = "password"; $destination = '/topic/event'; $messages = 10000; $size = 256; $data = "calls"; $body = $data; for($i=0; $i< $size; $i++) { $body .= $data[ $i % 26]; } try { $url = 'tcp://localhost:61613'; $con = new stomp($url, $user, $password); for($i=0; $i< $messages; $i++) { $con->send($destination, $body); if( $i%1000 == 0 ) { echo "sent ".$i." messages\n"; } } $stomp->send($destination, "shutdown"); } catch(stompexception $e) { echo $e->getmessage(); } } and...

python - Pandas dataframe to JSON format manipulation -

i have pandas dataframe one user category rating 1 [1,2,3] [5,1,3] 2 [3,2,1] [3,1,1] 3 [1,3,1] [2,1,4] i want write endpoint takes user , returns list of categories , ratings particular user. www.endpoint.com/user/1 should return [{category: 1, rating: 5}, {category: 2, rating: 1}, {category: 3, rating: 3}] is there simple way in pandas? i use the following generic function explodes lists in columns rows : def explode(df, lst_cols, fill_value=''): # make sure `lst_cols` list if lst_cols , not isinstance(lst_cols, list): lst_cols = [lst_cols] # columns except `lst_cols` idx_cols = df.columns.difference(lst_cols) # calculate lengths of lists lens = df[lst_cols[0]].str.len() if (lens > 0).all(): # lists in cells aren't empty return pd.dataframe({ col:np.repeat(df[col].values, df[lst_cols[0]].str.len()) col in idx_cols }).assign(**{col:...

c# - Cannot Edit Cells in RadGridView Telerik WPF -

i using telerik's radgridview display data database. data want load gridview , added 3 columns users type in additional information. the problem i'm having when type in information 1 of empty cells , click out of row/column, information i've typed in disappears. i've scoured every forum relating , think have code right using gridview.items.commitedit , information i've inputted empty cells still disappears. here code creates columns: private void window_loaded(object sender, routedeventargs e) { //loads queries each of designated data tables in bsi_test var customerquery = (from customer in testentity.customers join job in testentity.jobs on customer.cid equals job.cid join claim in testentity.claims on job.jid equals claim.jid select new { customer_name = customer.cname, customer_id = customer.cid, ...

python 3.x - How do I print non-ASCII characters in a file using python3? -

here's example of code. simple you'll see. when use print file ubuntu terminal window, following error message: traceback (most recent call last): file "/ascii_cat", line 22, in <module> print_file_in_ascii(f) file "/ascii_cat", line 16, in print_file_in_ascii line in f: file "/usr/lib/python3.4/codecs.py", line 319, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) unicodedecodeerror: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte code: #!/usr/bin/python3 import sys def contains_only_ascii(a_string): try: a_char in a_string.strip(): if ord(a_char) < 32 or ord(a_char) > 126: return false except: pass return true def print_file_in_ascii(fname): open(fname, "r") f: line in f: if contains_only_ascii(line) == true: print(line, end="")...

ios - Fade in a background view during custom animation transition -

Image
i wanted add custom transition app , followed amazing answer found here . it working great, wanted take step further. want have view on first page alpha 0 or hidden @ first fades in user swipes down between 2 pages. top view have transparent background appear though coming in background color. great example of mean can seen in snapchat, when swiping between pages seen in screen shot below. the background becomes blue , when new view comes in solid blue. i understand code has go in presentation controller stated in original question answer followed, unsure how implement this. also, when setting shouldremovepresentersview false crash here func animatetransition(using transitioncontext: uiviewcontrollercontexttransitioning) { let inview = transitioncontext.containerview let toview = transitioncontext.view(forkey: .to)! let fromview = transitioncontext.view(forkey: .from)! } i similar in app show image when gesture completed. fade im...

r - Find all indices of duplicates and write them in new columns -

i have data.frame single column, vector of strings. these strings have duplicate values. want find character strings have duplicates in vector , write index of position in new column. so example consider have: dt<- data.frame(string=a,b,c,d,e,f,a,c,f,z,a) i want get: string match2 match2 match3 matchx.... 1 7 11 b 2 na na c 3 8 na d 4 na na e 5 na na f 6 9 na 1 7 11 c 3 8 na f 6 9 na z 10 na na 1 7 11 the string ways longer in example , not know amount of maximum columns need. what effective way this? know there duplicate function not sure how combine result want here. many thanks! here 1 option data.table . after grouping 'string', sequence ( seq_len(.n) ) , row index ( .i ), dcast 'wide' format , join original dataset on 'string' library(data.table) dcas...

osx - How to install Octave 3.8 with Java on Mac OS? -

i have octave 4.2 java (installed view homebrew) on mac (os 10.12.6). how can downgrade octave 3.8? i tried generic instructions in thread, did not help: homebrew install specific version of formula? there's 1 octave , no versions. i not wedded using homebrew this. i'll explore way of getting octave 3.8.

google cloud datastore partitioning strategy -

trying use google cloud datastore store streaming data iot devices. getting data 10,000 devices @ rate of 2 rows (entities) in 1 minute per device. data entities never updated purged @ regular interval. backend code in php. do need partition data better performance @ present in mysql table. using table partitions based on key. if yes, should used use namespaces 1 namespace 1 device or should create 1 kind 1 device such "device_data_1", "device_data_2" thanks no, not need partitioning, datastore performance not impacted number or entities being written or read (as long they're not in same entity group, has overall write rate of 1/sec). see these somehow related answers: does google datastore have provisioned capacity system dynamodb?

SQL Server: Compare two columns in two tables -

Image
i have 2 tables (from 2 different systems) track employees' hours. in both tables, employees enter date , hours. need create audit report shows discrepancy. report needs show columns , display null/no match if there mismatch. 1 table might have more/less entries other table or duplicate entries , need catch (two entries on same day same amount of hours in 1 table). both tables have userid can joined on. if there match based on date , hours, show values. if there mismatch based on hours, show null or no match when there mismatch. if there duplicate entry, image below, match first entry , report second 1 null or no match. i tried joining tables based userid, date, , hours not able tell mismatch came from. table a: table b: left join on userid, date, , hours set nocount on; declare @table1 table ( userid int, entry_date date, [hours] varchar(10) ) declare @table2 table ( userid int, entry_date datetime, [hours] varchar(10) ) inse...

pandas - How to add random weights to list in Python? -

this question has answer here: generating list of random numbers, summing 1 8 answers let's have list of countries investing in: angola croatia denmark germany ... how can randomize weights these countries add 100%, - looking run optimization test on investments: angola croatia denmark germany ... 1.3% 3.8% 4.6% 7.5% ... (sum equals 100%) the logic behind randomization quite simple, wondering if there easy way it? current logic being, assign random number of them, take sum of randoms, take number assigned divided total. how calculate these weights , add new row these weights using pandas dataframe? how set for-all statement? it's possible achieve without using numpy or pandas . can generate n random numbers using random package , normalize them (divide each number sum of generated numbers). generate list of numbers in ...

Rename Dataframe Column Names in R using Previous Column Name and Regex Pattern -

i working in r first time , have been having difficulty renaming column names in dataframe (grade.data). have dataset imported csv file has column names this: student.id grade interactive.exercises.1..health interactive.exercises.2..fitness quizzes.1..week.1.quiz quizzes.2..week.2.quiz case.studies.1..case.study1 case.studies.2..case.study2 i able change variable names more simple, i.e. interactive.exercises.1.health interactive.exercises.1 or quizzes.1.week.1.quiz quizzes.1 so far, have tried this: grep(".*[0-9]", names(grade.data)) but returned: [1] 3 4 5 6 7 8 9 11 12 13 14 15 16 17 19 20 21 22 23 24 25 can me figure out going on, , write better regex expression? thank much. it seems truncate column names after first chunk of digits. you may use following sub solution: names(grade.data) <- sub("^(.*?\\d+).*$", "\\1", names(grade.data)) see regex demo details ^ - start of string (.*?\\d+) ...

web - Methods for pushing data from webserver to browser -

i find myself in need update clients browser latest information of server. typically perform periodic xhr through ajax. not responsive relies heavily on interval. wondering if there 'better' or more modern options. let's take example of instant messaging. if @ websites such facebook, messages virtually passed client. don't see periodic xhr when checking browser tools. wondering kind of technology big webapplications using? how can responsive? there real 'push' mechanism? i aware of technologies push api , web notifications . these seem used built-in browser notifications. i hope question not broad. have tried searching articles nothing find technical enough. i chances facebook using irc. & go far of big web apps using form of irc communication. you should able find php irc resources out there work hell of alot better periodic xhr through ajax. xhr intended 1 clump of info. continually blasting several people every minute or less imag...

html - CSS: Flex equal height columns and vertical center content -

i'm struggling content in left , right columns vertically middle aligned https://jsfiddle.net/klm7j7zq/ <div class="equalizer"> <div class="block1"> <div class="inner"><p> block 1 </p></div> </div> <div class="content">lorem ipsum dolor sit amet, consectetur adipisicing elit. labore, vel, quia. non nostrum, consectetur ipsum doloribus enim maiores laudantium, odio vel blanditiis id ea dolorum expedita fugit incidunt commodi.lorem ipsum dolor sit amet, consectetur adipisicing elit. labore, vel, quia. non nostrum, consectetur ipsum doloribus enim maiores laudantium, odio vel blanditiis id ea dolorum expedita fugit incidunt commodi.lorem ipsum dolor sit amet, consectetur adipisicing elit. labore, vel, quia. non nostrum, consectetur ipsum doloribus enim maiores laudantium, odio vel blanditiis id ea dolorum expedita fugit incidunt commodi.</div> <div class="b...

python - multiple key (composite index) search in dict -

i have database table composite index this: create table table1 ( key1 int, key2 int, value1 int, value2 char(10), primary key(key1 , key2) ) i have create dict table (using pyodbc, selection not issue). question is: how define multikey dict , after search data in it. i achieve sql syntax in dictionary search: select * table1 key1 = 10 , key2 = 20 a pseudo code search be: myvalue = ['a', 'b'] if myvalue in mydict[key1, key2]: print ('ok') but wrong. idea? a dict must have immutable type key. simplest such structure tuple of 2 database key fields. can use: mydict[(key1, key2)] and should work.

java - External Sort GC Overhead -

i writing external sort sort large 2 gig file on disk i first split file chunks fit memory , sort each 1 individually, , rewrite them disk. however, during process getting gc memory overhead exception in string.split method in function gemodel. below code. private static list<model> getmodel(string file, long linecount, final long readsize) { list<model> modellist = new arraylist<model>(); long read = 0l; try (bufferedreader br = new bufferedreader(new filereader(file))) { //skip linecount lines; (long = 0; < linecount; i++) br.readline(); string line = ""; while ((line = br.readline()) != null) { read += line.length(); if (read > readsize) break; string[] split = line.split("\t"); string curvature = (split.length >= 7) ? split[6] : ""; string heading = (split.length >= 8) ? split[7] : ...

selenium webdriver - How to handle dynamically changing ID's on refresh? -

how handle dynamically changing id's on refresh? it's common question answer question. if id's dynamic can go other locator techniques ever suitable in case of app. e.g. name , classname. mostly use of advance css or xpath should work in case. need find unique set of properties / attribute values locate. keep in mind - ignore on part changing...focus on part not changing , try use in locator choose.

Read asp.net textbox text using variable for name in VB.Net code behind -

situation: i have aspx content page has asp table. in table there 20 rows 1 column. each cell has asp textbox in it. i have code, vb.net, adds text text box when user clicks button. works fine. now need do, , can't seem find fits situation exactly, when second button clicked need "loop" through textboxes. i have hidden label has count of how many text boxes used can set for/next loop. cannot seem figure out how contents of textbox assigned vb variable. i have code: for x integer = 1 fcount tname = "textbox" & x dim cfilename string = ctype(controls(tname), textbox).tostring() blah blah blah other code next it errors out on line trys assign textbox text variable name tname. latest code have tried. have tried many others can't seem right. my text boxes named textbox1, textbox2, etc. way textbox20. hidden file counter allows me try , retrieve ones have been used. any thanked!! here code tried on computer. structur...

fileinfo - Python program to traverse directories and read file information -

i'm getting started python have found more productive bash shell scripting. i'm trying write python script traverse every directory branches directory launch script in, , each file encounters, load instance of class: class fileinfo: def __init__(self, filename, filepath): self.filename = filename self.filepath = filepath the filepath attribute full absolute path root (/). here's pseudocode mockup i'd main program do: from (current directory): each file in directory, create instance of fileinfo , load file name , path switch nested directory, or if there none, out of directory i've been reading os.walk() , ok.path.walk(), i'd advice straightforward way implement in python be. in advance. i'd use os.walk doing following: def getinfos(currentdir): infos = [] root, dirs, files in os.walk(currentdir): # walk directory tree f in files: infos.append(fileinfo(f,root)) retu...

c# - Controlling NUnit output in Resharper 'Unit Test Sessions' window -

Image
i'm attempting polish unit tests, , i'm noticing nunit's output behaves in undesirable way; i'm wondering if have ability control it. consider following onetimesetup imports nunit.framework public class simpleinconclusive <onetimesetup> public sub onetimesetup() assert.inconclusive("why print twice?") end sub end class if inherit class in test fixture, output not behave desired. consider simple sample [testfixture] class class1 : simpleinconclusive { [test] public void mysimpletest() { // no-op } } rather frustrating, clutters window meant provide easily-actionable messages. can correct behave intuitively, output window shows me output test/fixture highlighted, rather 1 aggregate message repeating same message multiple times?

jspdf autotable - Something happened and PDFs no longer open in new browser tab -

i running pdf-autotable v2.3.2 alongside jspdf v1.3.3 in reactjs app. have changed no code, pdfs used show in new chrome tab (and beautiful, btw) no longer display. the tab opens title untitled, url data:application/pdf;base64,jvberi0xljmkmyawig9iago8pc9uexblic9...(thousands of characters)...ci9caxrzugvyq29tcg9uzw50idgkl0zpbhrlciavrenurgvjb2rlci9mzw5ndgggndaymj4+cnn0cmvhbqr/2p/habhfeglmaabjssoacaaaaaaaaaaaaaaa/+waeur1y2t5aaeabaaaadwaap/hazfodhrwoi8vbnmuywrvymuuy29tl3hhcc8xljavadw/ehbhy2tldcbizwdpbj0i77u/iibpzd%e2%80%a6%e2%80%a6 , empty web page. my pdf/autotable code is: printgrid() { let doc = new jspdf('landscape'); const totalpagesexp = "{total_pages_count_string}"; let pagecontent = function (data) { // header doc.setfontsize(20); doc.settextcolor(40); doc.setfontstyle('normal'); doc.addimage(getbase64imgglobal(), 'jpeg', data.settings.margin.left, 15, 10, 10); doc.text(fullr...

Can't find textview in toolbar include layout android -

i have toolbar has custom textview inside: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:background="@drawable/headerbg" android:theme="@style/customtoolbartheme" android:layout_height="48dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="toolbar title" android:textcolor="@color/white" android:textsize="18sp" android:fontfamily="sans-serif-light" android:layout_gravity="left" android:id="@+id/tvtoolbartitle" /> </android.support.v7.widget.toolbar> i use include in layout: <include android:id=...

osgi - How to configure jmx port for karaf in docker container? -

i use visualvm check threads running in karaf in docker container. what did: expose 44444 , 1099 docker in org.apache.karaf.management.cfg, tried setting rmiregistryhost , rmiserverhost several times different combination of docker container ip , docker inner ip doesn't work. tried change extra_java_opts="-djava.rmi.server.hostname=${docker-container-ip} -dcom.sun.management.jmxremote.local.only=false" need help. the problem rmi protocol, not handle scenario host offering rmi endpoint (the docker host) not the host of rmi server (the vm inside docker container). the way got work export extra_java_opts=="-dcom.sun.management.jmxremote.ssl=false -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.rmi.port=$jmx_rmi_port -dcom.sun.management.jmxremote.port=$jmx_remote_port -djava.rmi.server.hostname=$host_hostname" i set environment docker-compose, can replace environment variables fixed values long run 1 con...

r - Further aggregation by specific groups -

i'm in process of taking data have , splitting smaller groups use in heat map. code have below, have read file, , make 8 different subsets. these subsets have aggregated them hour. data ranges beginning of may end, there 24(number of hourly intervals) * 31 = 744 rows. however, want further group these rows each subset. want final product 24(number of hourly intervals) * 7(number of days in week) = 168 rows. this, example, if there multiple groups interval 12pm - 1 on mondays, want average them together. then, want same rest. have idea how can this? appreciated. #open file maydata <- read.csv("lengthbindata.csv", header=true) names(maydata) <- c("station", "lane", "bin", "count", "time") #setting packages #install.packages("tseries") #install.packages("xts") #install.packages("quantmod") #install.packages("timedate") #install.packages("gridextra") #install.packa...

jquery - Rails AJAX Missing Template Error with link_to Delete -

i trying ajax-ify type app , finished dealing problem create method (see [here][1]). delete method acting up, can't use previous solution (moving remote: true submit form_for line) because deletion done via link_to . here's tasks#index action: def index @create_task = task.new @tasks = task.all @one_time = task.where(frequency: "onetime", completed: false, user_id: current_user.id) @one_time_done = task.where(frequency: "onetime", completed: true, user_id: current_user.id) @daily = task.where(frequency: "daily", completed: false, user_id: current_user.id) @daily_done = task.where(frequency: "daily", completed: true, user_id: current_user.id) @weekly = task.where(frequency: "weekly", completed: false, user_id: current_user.id) @weekly_done = task.where(frequency: "weekly", completed: true, user_id: current_user.id) @monthly = task.where(frequency: "monthly", ...

jquery - How to clear an effect to apply another and then use an if/else if no draggable option is selected? -

i'm beginner in js/jquery. goal change text of $("#feelingstext") depending on plan dragged dropped box. have figured out how change text each of plans picked, can't figure out how change text if no plan dragged & dropped. should call in dragged function or use replace method? i'm trying figure out how clear previous effect. if "greatplan" chosen $("#feelingstext") should blind, if "badplan" chosen, text should shake, , if no plan chosen, text should bounce. thank in advance help. html: <div id="leftwrapper"> <div id="greatplan" class="ui-widget-content, draggable"> <p id="center">great plan!</p> </div> <br> <div id="badplan" class="ui-widget-content, draggable"> <p id="center">bad plan!</p> </div> </div> <div id="droppable" class="ui...

parsing - Grab an IdentityFile from an ssh config based on a variable hostname via shell script -

i'm writing shell script need obtain identityfile ssh config file. ssh config file looks this: ​host aaaa user aaaa identityfile /home/aaaa/.ssh/aaaafile identitiesonly yes pubkeyauthentication=yes preferredauthentications=publickey ​host bbbb user bbbb identityfile /home/aaaa/.ssh/bbbbfile identitiesonly yes pubkeyauthentication=yes preferredauthentications=publickey ​host cccc user cccc identityfile /home/aaaa/.ssh/ccccfile identitiesonly yes pubkeyauthentication=yes preferredauthentications=publickey i want obtain string following identityfile based on given hostname , put in variable. hostname provided shell variable called ${hostname} . i able use answer @ bash extract user particular host ssh config file read config file , grep single specific identityfile based on single specific hostname , can't hang of passing variable awk. so far i've tried ssh_config="/home/aaaa/.ssh/config" ...

Refresh fragment in Android -

i have 2 tabs , each has 1 fragment. each fragment has recycler views. have action bar , have search property in (i'm using materialsearchview). want search data in each fragment when app loading, search working first fragment, if swipe next fragment , come first fragment search not working because methods related first fragment not getting called. how call them when user in first fragment. public class tab1fragment extends fragment { private static final string tag = "tab1fragment"; context c; string user_name,password; materialsearchview materialsearchview; string url = null; recyclerview rv1; tablelayout tablayout; @nullable @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) { setuservisiblehint(false); view view = inflater.inflate(r.layout.tab1_fragment,container,false); ...

c++ - How to send OpenCV Mat throught socket -

i trying send opencv mat throught tcp using c++ raspberry windows pc. code working , sending , getting frames, images on gray scale , bad quality. client side (windows): #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <fstream> #include <string.h> #include <sys/types.h> #include <winsock2.h> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include "ws2tcpip.h" #define bzero(b,len) (memset((b),'\0',(len)),(void)0) #define bcopy(b1,b2,len) (memmove((b2),(b1),(len)),(void) 0) using namespace std; int main() { int sockfd, newsockfd, portno; socklen_t clilen; struct sockaddr_in serv_addr, cli_addr; int n; // important wsadata data; wsastartup(makeword(2, 2), &data); //////////// sockfd = socket(af_inet, sock_stream, 0); if (sockfd < 0) { cout << "error while opening so...

node.js - Store file with Mongoose/GridFS with FeathersJs -

building rest api feathersjs need able upload picture (post), record if gridfs , able later. i start set gridfs mongoose: const mongoose = require('mongoose'); const grid = require('gridfs-stream'); grid.mongo = mongoose.mongo; module.exports = function () { const app = this; mongoose.connect(app.get('mongodb')); const cnx = mongoose.connection; mongoose.promise = global.promise; cnx.once('open', () => { const gfs = grid(cnx.db); app.set('gfs', gfs); }) app.set('mongooseclient', mongoose); }; then add in /pub service : pub.service.js const multipartmiddleware = require('multer')(); [...] app.use('/pub', multipartmiddleware.single('uri'), function(req, res, next){ req.feathers.file = req.file; next(); }, createservice(options) ); pub.hook.js create: [ hook => { const gfs = hook.app.get('gfs')...

web services - What setting should be used to send 200 request per second in Soapui? -

Image
i load test web service. want generate test run comprising of 200 tests per second. confused options provided soapui. can please let me know should put values desired results? for running 200 requests per second, need run 200 threads requests per second. makes thread count 200, how many times want run depends on you, instance 200 have put. i.e considering there no delay, each second 200 request. total request come out 200*200=40000 requests. i unsure start , end thread, can figure out happening there. assumption put start thread 1 , end 200 case. another option use fixed rate strategy instead of thread. more details can found here