Posts

Showing posts from April, 2015

php - Display custom attributes before WooCommerce upsells ( linked products) -

Image
i manage display custom attributes shown after linked products how can make them appear before? on left: have, right desired result thanks if woocommerce template content-single-product.php see that: /** * woocommerce_after_single_product_summary hook. * * @hooked woocommerce_output_product_data_tabs - 10 * @hooked woocommerce_upsell_display - 15 * @hooked woocommerce_output_related_products - 20 */ do_action( 'woocommerce_after_single_product_summary' ); that means in woocommerce_after_single_product_summary hook, following displayed: first (with priority of 10) product tabs, then (with priority of 15) upsells, and finish (with priority of 20) related products. so if want display custom code between product tabs , upsells, need use custom function hooked in woocommerce_after_single_product_summary action hook priority between 11 14. you can way: add_action('woocommerce_after_single_product_summary', 'custom_code_after_single

Inserting into Oracle-SQL with Squeryl with millisecond precision doesn't seem to be working. Why? -

i'm having trouble getting squeryl , oracle-sql save timestamp(6) data millisecond precision. every attempt i've made shows me results second precision, not millisecond: case class bookingevent(created: timestamp, ...) loggingdatabase.bookingevents.insert(bookingevent(new timestamp(system.currenttimemillis()), ...) but querying gives me stuff as: 14.08.17 16:40:50.000000000 , being true when query stuff directly in sql developer. i've tried manually adding in sql developer timestamps higher precision , seems work wonderfully, either has java's timestamps or jdbc or squeryl? edit: problem in writting side, if put hand in db , attempt read through squeryl seems ok. am missing obvious? thanks

java - From Class<? extends X> to X -

i working on reflexion stuff , i'm beginner @ it. i got : list<x> list; set<class<? extends x>> set; and want : for (class<? extends x> classx : set) list.add(classx); but couldn't find on how achieve it. can me? you can't achieve such behavior input data. list<x> list expected instance of class x, you're trying add object of type class<? extends x> . let's imagine type x number(for simplicity), have double, integer, character , etc, children of number. so, you're doing next thing: want add object of type class<integer> list can hold numbers(not class<integer> , class<double> , on). thing can do, it's create instance of class<integer> , class<double> way, using reflection: list<x> list = //some values; set<class<? extends x>> set = //some values; (class<? extends x> classx : set) list.add(classx.newinstance()); but that's bad idea use

image - How to create React component that can render Img or Video depending on API data it recieves -

i learning , practicing react. i trying achieve react web app allows display , scroll through nasa's picture of day based on date choose. here's api: api.nasa.gov/ the project simple but. url api returns, leads img , youtube video. example: https://apod.nasa.gov/apod/image/1708/perseidsturkey_tezel_960.jpg or https://www.youtube.com/embed/zy9jiikx62o?rel=0 i have managed display both cases using iframe. know not ideal imgs because cannot format css , looks bad scroll bars, sizing etc..but won't display video.. this react component looks (using bootstrap) detail.js import react, { component } 'react'; export default class detail extends component { render() { return ( <div classname="video-detail col-md-12"> <div classname="embed-responsive embed-responsive-16by9"> <iframe classname="embed-responsive-item" src={this.props.url}> </iframe&

osx - SAP - Mac vs Windows setup -

Image
i'm using sap gui java on mac computer. colleague sent me information on how connect: however, mac ui looks different: where can find screen add connection on windows? thank you! in experience, need use advanced settings of sap gui java on mac connect. go advanced , check expert mode. then enter connection string as: conn=/h/<saprouter>/w/<saprouter password>/h/<host>/s/<port 3270> in example i'm guessing: conn=/m/<host>/g/<group space> you may need add service number like: conn=/m/<host>/s/<service number 4201>/g/<group space>

unity3d - APPLICATION_FAULT_1007_UnityPlayer.dll!?InitializeD3DWindow -

i keep getting failure hit in windows dev portal. didn't before had added in xbox live prefabs (although specifying d3d window). can't seem happen when testing on console or on windows , haven't seen feedback of users crashing game or on side. has else started see xbox 1 s users? report specifies os build 10.0.15063, , xbox 1 s. unfortunately new tracking down issues not sure next steps should be. outside of specifying d3d on unity build settings (and not xhtml) haven't done d3d settings. for reference, using d3d because xhtml having mouse cursor , window size issues on console. using d3d build option fixed both of issues. thanks! nick edit: still getting multiple hits on 1 thing have no idea how diagnose telling me: stack trace: frame image function offset 0 unityplayer std::vector_core::basic_string_char,core::stringstoragedefault_char_ _,std::allocator_core::basic_string_char,core::stringstoragedefault_char_ _ _ _::vector_core::basic_stri

transpose - transposing rows into multiple columns in R -

i have following data frame df id year var value 1 2011 x1 1.2 1 2011 x2 2 1 2012 x1 1.5 1 2012 x2 2.3 3 2013 x1 3 3 2014 x1 4 4 2015 x1 5 5 2016 x1 6 4 2016 x1 2 i want transform data in following format id year x1 x2 1 2011 1.2 2 1 2011 2 na 1 2012 1.5 2.3 3 2013 3 na 3 2014 4 4 4 2015 5 na 4 2016 2 na 5 2016 6 na please help using tidyr library, believe looking for: df <- data.frame(stringsasfactors=false, id = c(1l, 1l, 1l, 1l, 3l, 3l, 4l, 5l, 4l), year = c(2011l, 2011l, 2012l, 2012l, 2013l, 2014l, 2015l, 2016l, 2016l), var = c("x1", "x2", "x1", "x2", "x1", "x1", "x1", "x1", "x1"), value = c(1.2, 2, 1.5, 2.3, 3, 4, 5, 6, 2) ) library(tidyr) df2 <- df %>% spread(var, value)

svn - How are the subversion hook templates generated for each repository? -

we using subversion edge 5.2 on windows. whenever create repo, hooks folder within repo pre-populated following templates: post-commit.tmpl post-lock.tmpl post-revprop-change.tmpl post-unlock.tmpl pre-commit.tmpl pre-lock.tmpl pre-revprop-change.tmpl pre-unlock.tmpl start-commit.tmpl where master copies kept? want override post-commit.tmpl whenever create new repo uses our version, saves manual step of going folder , replacing file manually. tia i think misunderstanding: these hooks examples , templates (.tmpl). not runnable if modify them, need make them executable. manual step still necessary. they defined directly in svn source code: link repos.c (search "/* start-commit hook. */") so unfortunately cannot change default hook templates(unless want patch svn sourcecode , build yourself..)

Bash script for curl -

i have following curl command: curl -i -x post -h "content-type: multipart/form-data" -f "file=@d:\!zip\products.zip" http://example.com/api/v1.0/import/decisions -h "authorization: bearer lcl9pzci6miwidxnlcl9uyw1lijoiywrtaw4ilcj1c2vybmftzvnjlywqilcj3cml0zsjdlcjlehaioje1mdi3nty4ndisimvtywlsx2nvbmzpcm1lzci" right i'm able upload d:\!zip\products.zip (i use git bash on windows 10 machine) file server. the problem d:\!zip\ folder contains hundreds of zip files should imported server. could please show bash script list of files in folder , subsequently upload them server using curl command mentioned above.

garbage collection - cost time meaning of java gc.log? -

Image
2017-08-15t00:02:07.653+0800: [gc2017-08-15t00:02:07.653+0800: [parnew: 235967k->15723k(235968k), 0.0227136 secs ] 364848k->144604k(1022400k), 0.0227920 secs] [times: user=0.08 sys=0.00, real=0.03 secs] 2017-08-15t00:02:12.540+0800: [full gc2017-08-15t00:02:12.540+0800: [cms: 128880k->87130k(786432k), 0.3387968 secs ] 162905k->87130k(1022400k), [cms perm : 70825k->70786k(524288k)], 0.3388920 secs] [times: user=0.34 sys=0.00, real=0.34 secs] what black secs mean? time gc cost? equals pause of process caused gc? mean second gc event cause process suspend 0.3387968 secs ? not process run concurrently possibly type garbage collector,e.g., cms? you might want read this article, breaks down anatomy of gc.log file. in summary, yes, highlighted portions of log file refer time taken complete each of gc events.

filter - Ansible/Jinja2 - Map nested key in list -

when map'ing attribute in list of nested variables, not able retrieve key. i want retrieve key of "tls_cert_file" following emphasized text variables: vault_config_listener: - tcp: - address: "0.0.0.0:8200" - tls_cert_file: "/etc/ssl/wildcard.crt" - tls_key_file: "/etc/ssl/private/wildcard.key" - tls_require_and_verify_client_cert: "false" - tcp: - address: "127.0.0.1:8200" - tls_disable: true the debug task: - debug: msg: "{{ (vault_config_listener | selectattr('tcp', 'defined') | map(attribute='tcp')) | selectattr('tls_cert_file','defined') | map(attribute='tls_cert_file') | join('') | dirname }}" the output: ok: [test] => { "msg": "" } i got map'ing working until "tcp", no further... wrong @ logic? to list of tls_cert_file can use vault_config_listener

scala - Mongodb spark Connector:load/join will lost some data -

environment: spark 2.2, mongodb spark connector 2.2, scala 2.11, java 1.8. i have problem mongodb spark connector. first of all, want make join operation 2 datasets. here original code (both result1 , result2 have imei_md5 column): import sc.implicits._ val textfile1 = sc.sparkcontext.textfile(inputfile1) val result1 = textfile1.map(_.split(" ")).map(i => gdt(i(0), i(1), i(2), i(3), i(4))).tods() val textfile2 = sc.sparkcontext.textfile(inputfile2) val result2 = textfile2.map(_.split("\t")) .filter(i => i.length == 2) .map(i => applist(i(0), md5.hash(i(0)), i(1))) .tods() val result3 = result1.select("imei_md5").distinct().join(result2, "imei_md5") this code can give me right join result (no data loss), when got result1 existing collection in mongodb, load , join result gives me lost result (about 1000w data loss). problematic code below: val textfile

google maps - Android send value from Fragment to an activity -

hello guys have fragment activity shows google map , want send latitude , longitude values 1 of activities. how can except putextra. can't use putextra because can't startactivity after data complete. have bottomnavigation activity shows map fragment , settings activity in fragment too. , want collect data map fragment , use in second fragment. thanks. you can use shared preference that. example: put value inside shared preference in fragment activity . sharedpreferences sharedpref = getactivity().getpreferences(context.mode_private); sharedpreferences.editor editor = sharedpref.edit(); editor.putdouble("latitude", latitude); editor.putdouble("longitude", longitude); editor.apply(); get value shared preference in second activity . sharedpreferences sharedpref = getactivity().getpreferences(context.mode_private); double latitude = sharedpref.getdouble("latitude"); double longitude = sharedpref.getdouble("longitude")

c# - csharp unsafe BitmapData Access Memory Leak -

public point pixelsearchpoint(bitmap b, color pixelcolor, int shade_variation) { color pixel_color = pixelcolor; point pixel_coords = new point(-1, -1); using (bitmap regionin_bitmap = (bitmap)b.clone()) { bitmapdata regionin_bitmapdata = regionin_bitmap.lockbits(new rectangle(0, 0, regionin_bitmap.width, regionin_bitmap.height), imagelockmode.readwrite, pixelformat.format24bpprgb); int[] formatted_color = new int[3] { pixel_color.b, pixel_color.g, pixel_color.r }; //bgr unsafe { (int y = 0; y < regionin_bitmapdata.height; y++) { byte* row = (byte*)regionin_bitmapdata.scan0 + (y * regionin_bitmapdata.stride); (int x = 0; x < regionin_bitmapdata.width; x++) { if (row[x * 3] >= (formatted_color[0] - shade_variation) & row[x * 3] <= (formatted_color[0] + shade

sql server - AWS Aurora 3x slower than MSSQL -

we have big query (big in variables) takes around 3s on mssql. can run query 100x times , of them take 3s. using aurora, first time query loads takes 9s, takes 500ms, nice, can`t wait 9s every first time run query. actually, not sure how long cache takes place, seems around couple of minutes , have wait 9s again. i cant clients "i know 9s long, wait half second". reply "i need see data once. doesn't matter me 2nd time faster. don't there." simulation: mssql 1st time: 3s 2nd time: 3s 3rd time: 3s ... 10 minutes later xth time: 3s yth time: 3s aurora 1st time: 9s 2nd time: 500ms 3rd time: 500ms ... 10 minutes later xth time: 9s yth time: 500ms is expected or doing wrong?

csv - Compare column name, then compare row data in Python -

so trying have csv file looks this: "test_name", "mean", "median", "std_dev" "data name 1", 50, 75, 10 "data name 2", 52, 80, 11 "data name 1", 53, 79, 9 "data name 2", 55, 78, 8 "data name 3", 54, 77, 7 "data name 3", 53, 71, 7 "data name 1", 51, 72, 8 so right now, have program finds if test name equal each other. because if have same data name, want compare data have. import csv csvfile = 'some.csv' data = {} open('some.csv') f: reader = csv.dictreader(f) row in reader: (k,v) in row.items(): try: data[k].append(v) except keyerror: data[k] = [v] testnames = data['test_name'] mean = data['mean'] median = data['median'] std = data['stdev'] val in testnames: val2 in testnames: if val == val2:

node.js - Access site from local network. It sends requests to localhost server, but the server is on the machine, that serves the site -

i creating app. build nodejs on server. consists of several servers. fronted sends requests servers on localhost fetch data local servers ( urls fetching data on client localhost:3000/fetch_some). when want visit site other computer of local network ( write in browser ip of computer fronted , servers, 192.168.0.4:frontend_app_port ), front side trying fetch data localhost of computer running on, , not work, because there no servers, serves data on it. how deal it? configure front send requests 192.168.0.4 /(detect computer local network ip) . or there issues it? docker right fit case? you need use server's name or address, can't reach end referring localhost front-end code.

javascript - Normalize API response in React Application -

i writing react application fetches data api. api response contains lots , lots of fields don't need in application, don't want store these fields in state of application. i've read in redux documentation paularmstrong/normalizr can used normalize json objects, seems focused flatten tree while need filter it. is there elegant , performant way filter api response? currently doing this, after fetching this.setstate= ({ headline: response.foo.bar.baz.headline, text: response.foo.bar.qux[0].text, type: response.abc.foo.bar.baz.qux.baz }); while works, it's cumbersome , hard read, searching neater way it.

javascript - Ajax send FormData and retrieve multidimensional array -

alright have form select csv file , when hit sales_importer button java call php function , returned multidimensional array later processing. when run following code alert box multidimensional array of values seems in string form. when alert(result[0][0]); [ in alert box. i have tried changing datatype in ajax call json fails still 200 response browser. suggestions of might going on/how go fixing it? js $('body').on('click', '#sales_importer', function() { $.ajax({ type: 'post', data: new formdata($('form[id="import_form"]')[0]), cache: false, contenttype: false, processdata: false, url: admin_url+'clients/import', success: function(result){ alert(result); } }); }); php public function import() { if ($this->input->is_ajax_request()) { if (isset($_files['client_file_csv']['n

Java JDBC - How to connect to Oracle using Service Name instead of SID -

i have java application uses jdbc (via jpa) connecting development database using hostname, port , oracle sid, this: jdbc:oracle:thin:@oracle.hostserver1.mydomain.ca:1521:xyz xyz oracle sid. need connect different oracle database not use sid, uses oracle "service name" instead. i tried doesn't work: jdbc:oracle:thin:@oracle.hostserver2.mydomain.ca:1522:abcd abcd service name of other database. what doing wrong? http://download.oracle.com/docs/cd/b28359_01/java.111/b31224/urls.htm#beidhcba thin-style service name syntax thin-style service names supported jdbc thin driver. syntax is: @//host_name:port_number/service_name for example: jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename so try: jdbc:oracle:thin:@//oracle.hostserver2.mydomain.ca:1522/abcd

windows - Why does %%I work in .cmd? -

i have found in multiple online forums , blogs .cmd files utilize %i (or %a, etc.) loops , batch files require 2 percent symbols (%%i). however, line of code has been working me in .cmd file: for /l %%i in (%case%, 1, %endcase%) ( aws s3 cp s3://[url]/%user%/%%i "c:\users\[directories]\accuracy_testing\datax\%user%_%%i" --recursive ) in code, using command line interface aws download files associated multiple ids. case , endcase arguments parsed file. why work, when .cmd files should using %i instead of %%i? you're confusing .cmd files cmd prompt. .cmd files batch files (with few differences people won't notice), while cmd prompt command line itself. scripts use %%i, command prompt uses %i.

Can not open Android layout files in visual studio -

Image
i have installed visual studio 2015 android development support. encountered weird error when try open .axml layout file.

php - Creating a Stripe Charge with JavaScript -

i have working piece of code below, wondering if possible make stripe charge within "successful token" of checkout process? code below working, wondering insert code creates acctuall charge. <script src="https://checkout.stripe.com/checkout.js"></script> <script src="https://js.stripe.com/v3/"</script> <button id="payment-button" type="button" class="btn btn-success">pay card</button> <script> var handler = stripecheckout.configure({ key: 'mykeyhere', image: 'https://stripe.com/img/documentation/checkout/marketplace.png', locale: 'auto', token: function(token) { // can access token id `token.id`. // token id server-side code use. document.getelementbyid("book-appointment-submit").style.display="block"; document.getelementbyid("payment-button").style

javascript - Dynamic Form with multiple dropzone.js -

i creating servlet application jsp has form "objects". each object has multiple input fields , image upload zone, picked dropzone.js job. user can add many objects wants , done dynamically javascript. when first load form there object coded within jsp page. i have managed code input boxes, image upload part giving me hard time , can't make work. javascript knowledge low , having hard time understanding how should connect dropzones servlet. what should javascript in order have dropzones working properly? another question if should every dropzone ajax in order have images uploaded when form submitted (i'm thinking because there can multiple objects multiple pictures). anyways here have far: jsp/html <div class="form-group"> <div class="dropzone" id="image-upload"> <div class="dz-default dz-message file-dropzone text-center col-sm-12"> <span class="glyphicon glyphicon-papercli

python - N-dimensional histogram containing the maximum value of the weights that fall in each bin -

i have set of m points in n-dimensions, each of has associated "weight" value (basically, array of m floats). using numpy 's histogramdd() can generate set's n-dimensional histogram. if use weights parameter in histogramdd() , back: the sum of weights belonging samples falling each bin. the code below shows hot create these arrays: import numpy np # n-dimensional m points. n_dim, m = 3, 1000 points = np.random.uniform(0., 1., size=(m, n_dim)) # weight each point weights = np.random.uniform(0., 1., m) # n-dimensional histogram. histo = np.histogramdd(points)[0] # histogram containing sum of weights in each bin. weights_histo = np.histogramdd(points, weights=weights)[0] instead of this, need create n-dimensional histogram points , value stored in each bin maximum weight value out of weights associated points fall within bin. i.e.: need only maximum weight stored in each bin, not sum of weights. how this? there several binned_stati

Why can't Git handle large files and large repos? -

dozens of questions , answers on , elsewhere emphasize git can't handle large files or large repos. handful of workarounds suggested such git-fat , git-annex , ideally git handle large files/repos natively. if limitation has been around years, there reason limitation has not yet been removed? assume there's technical or design challenge baked git makes large file , large repo support extremely difficult. lots of related questions, none seem explain why such big hurdle: git large files what file limits in git (number , size)? git - repository , file size limits versioning large text files in git how handle large git repository? managing large binary files git what practical maximum size of git repository full of text-based data? [quora] basically, comes down tradeoffs. one of questions has example linus himself: [...] cvs, ie ends being pretty oriented "one file @ time" model. which nice in can have million files, , check out

python - tkinter validation for file directory -

for program, there input username , file name. program goes shared folder , retrieves file. want error proof step returning dialog box if file directory not exist. would error exception step go before or after mainloop()? how go doing it?

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

maven - How to deploy env(dev, test, prod) specific Artifacts to Artifactory form Jenkins -

i creating 3 artifacts (war) dev, test , prod environment using profiles following: clean install -p dev cp target/abc.war output/abc-dev-${build_number}.war clean install -p test cp target/abc.war output/abc-test-${build_number}.war clean install -p prod cp target/abc.war output/abc-prod-${build_number}.war to execute jenkins using jenkins plugin "invoke top-level maven targets". once created war's, wants deploy these artifactory! i google lot didn't find regarding deploy artifacts artifactory. note: able build , deploy artifact "clean deploy -p dev", in case not able modify artifact name. (companies artifactory doesn't allow deploy without versioning enabled) any highly appreciated. thank you! you can use curl upload war files artifactory. $ curl -v --user username:password --data-binary @/local/path/to/war-file/abc-dev.war -x put "http://org.artifactory.com/artifactory/repo_name/folder_name/abc-dev-${build

vb.net - Process waiting for input, Get all standard output? - Visual Basic -

i have process ssh's unix server. trying standard output of process if given incorrect credentials. in case, program waits user input correct password (indicating 1 given argument invalid). expected result of following string: using keyboard-interactive authentication. password: i know expected because have piped standard output file, ran program in command line. however, running problem whatever reason, standard output give me first line, , hang. prints out using keyboard-interactive authentication not password: here code: dim stdoutput = new stringbuilder() public sub startprocess(processname string, id string, unixserver string, pw string) dim process process = new process() process.startinfo.filename = processname process.startinfo.arguments = "-ssh " & id & "@" & unixserver & " -pw " & pw process.startinfo.useshellexecute = false process.startinfo.createnowindow = true process.startinfo

python 3.x - How to enable FTS5 search a string with ".", "_" and "0-9"? -

i have table holding 300k records of strings using alphanumeric, digit, dot, underscore , brackets []. i use fts5 extension sqlite3 enable fast search on table. how create fts virtual table: database = sqlite3.connect("mydb.db") db_cursor = database.cursor() db_cursor.execute("create virtual table field_names using fts5 (full_path)") i adding ~300k records using below code in loop: database.execute("insert field_names(full_path) values (?)", (field_path,)) sample records: a.extbootrecord.field_db0 a.extbootrecord.field_db1 a.extbootrecord.field_db8 a.extbootrecord.field_db9 a.extbootrecord.field_db10 a.extbootrecord.field_db11 a.extbootrecord.field_db12 a.extbootrecord.field_db15 using following query: db_cursor.execute("select full_path field_names field_names = '\"%s\"'" % search_phrase) return_list = list() entries = db_cursor.fetchmany(100) while entries: return_list.exten

Compact but pretty JSON output in python? -

json written either indent=none (default) single line (unreadable human eye) or ident=n newline after each comma. what see more compact still pretty output, similar common lisp pretty-printing does. e.g., instead of { "cleanup":{ "cpu":6936.780000000001, "wall":7822.319401979446 }, "finished":"2017-08-14 18:36:23", "init":{ "cpu":1365.73, "wall":1380.7802910804749 }, "job":"timings", "run":{ "cpu":953.6700000000001, "wall":8350.496850013733 }, "started":"2017-08-14 13:28:06" } i see { "cleanup":{"cpu":6936.780000000001,"wall":7822.319401979446}, "finished":"2017-08-14 18:36:23", "init":{"cpu":1365.73,"wall":1380.7802910804749}, "job":"timings", "run":{"cpu":9

javascript - Close MSSQL connection using mssql in node.js -

i trying write script in node.js query mssql database. new javascript, new node.js, new vscode, know few things sql. have working code, connection never seems close, , cannot values out of function. so, have chunk of code, got example npm : const sql = require('mssql'); var dbconfig = { server:'theserver', database:'thedb', user:'un', password:'pw', port:1433 }; sql.connect(dbconfig).then(pool => { // query return pool.request() .query('select top 10 * the_table') }).then(result => { console.log(result); }).catch(err => { // ... error checks }) this works, , can see 10 results logged in console. however, code never stops running. how connection close , stop? i want results saved variable, changed code this: const sql = require('mssql'); var dbconfig = { server:'theserver', database:'thedb', user:'un', password:'pw',

c# - WebApi POST Method Not Allowed -

im trying call post method , 405 / method not allowed. here code: [httppost] public string postusers(string user) { return user; } how make request this.data.append('user', json.stringify(this.user)); var user= this.data; console.log(equipo); axios.post('/api/apiequipos', user).then((response) => { console.log('ok') }).catch(errors => { if(typeof errors.response.data === 'object'){ this.errors = _.flatten(_.toarray(errors.response.data)) }else{ this.errors = ['error']; } }) if call method thought postman run well webapiconfig public static class webapiconfig { public static void register(httpconfiguration config) { // web api configuration , services // web api routes config.maphttpattributeroutes();

docker : invalid reference format -

i'm following tutorial: https://medium.com/towards-data-science/number-plate-detection-with-supervisely-and-tensorflow-part-1-e84c74d4382c and use docker. when tried run docker (inside run.sh script): docker run -p 8888:8888 -v `pwd`/../src:/src -v `pwd`/../data:/data -w /src supervisely_anpr --rm -it bash i got error: docker: invalid reference format. i spent 2 hours , can't understand what's wrong. idea appreciated.

hadoop - Updating hive table with sqoop from mysql table -

i have hive table called roles. need update table info coming mysql. so, have used script think add , update new data on hive table:` sqoop import --connect jdbc:mysql://nn01.itversity.com/retail_export --username retail_dba --password itversity \ --table roles --split-by id_emp --check-column id_emp --last-value 5 --incremental append \ --target-dir /user/ingenieroandresangel/hive/roles --hive-import --hive-database poc --hive-table roles unfortunately, insert new data can't update record exits. before ask couple of statements: the table doesn't have pk if dont specify --last-value parameter duplicated records exist. how figure out without applying truncate table or recreate table using pk? exist way? thanks guys. hive not operate update queries. have drop/truncate old table , reload again.

java - Creating a pointcut for all the classes in package? -

i have create configurable pointcut. can achieving dynamic pointcut. dynamicpointcut.class public class dynamicpointcut extends dynamicmethodmatcherpointcut { @value("${custom.logging.basepackage}") string basepackage; @override public classfilter getclassfilter() { return new classfilter() { @override public boolean matches(class<?> clazz) { list<class<?>> classlist = classfinder.find(basepackage); return classlist.stream().anymatch(x -> x.equals(clazz)); } }; } @override public boolean matches(method method, class<?> targetclass, object... args) { if(args.length>0){ return true; } return false; } } configurableadvisorconfig.class @configuration public class configurableadvisorconfig { @autowired private proxyfactorybean proxyfactorybean; @autowired defaultpoin

adding fields to a redux form inside the component -

so have react component (called contract) being fed reduxform function. it's been given array of field names (the fields property shown below) part of form. export default reduxform({ form: 'contract', fields }, mapstatetoprops)(contract); but while component being created, there data (additional field names) being loaded server need appended list. data may not load in time. possible dynamically update list of fields , make them part of form after component has been created? can updated inside contract component or once component has been created list of fields set in stone? i'm assuming you're using version 5 or earlier since you've got fields config. can make fields dynamic passing fields prop form component instead of configuring them in reduxform . ( see docs ) i used stateful component in example fetch fields of course use redux-connected component. class contractcontainer extends component { state = { fields: [] }; componentd

gtk2 - Error 'libf90_gui.so.0' when running gadgetviewer -

so i'm running cosmological n-body simulations in gadget2 , trying read output data files in gadgetviewer , error: $ gadgetviewer gadgetviewer: error while loading shared libraries: libf90_gui.so.0: cannot open shared object file: no such file or directory i have googled error, libf90_gui.so.0 nothing's come up. gadgetviewer has dependency on gtk-2. wondering if has idea what's causing error google totally blank on this. thanks!

python - Split list of dictionaries into chunks -

i have python list 2 list inside(one each room - there 2 rooms), dictionaries inside. how can transform this: a = [ [{'rate': decimal('669.42000'), 'room': 2l, 'name': u'10% off'}, {'rate': decimal('669.42000'), 'room': 2l, 'name': u'10% off'}, {'rate': decimal('632.23000'), 'room': 2l, 'name': u'15% off'}, {'rate': decimal('632.23000'), 'room': 2l, 'name': u'15% off'}], [{'rate': decimal('855.36900'), 'room': 3l, 'name': u'10% off'}, {'rate': decimal('855.36900'), 'room': 3l, 'name': u'10% off'}] ] into this: a = [ [{'rate': decimal('669.42000'), 'room': 2l, 'name': u'10% off'}, {'rate': decimal('669.42000'),

RegEx javascript - Need assistance limiting search -

this question has answer here: my regex matching much. how make stop? 4 answers why regex constructors need double escaped? 4 answers i wish search/replace support escalations matrix below email signatures, regex selecting far much. the example text has 3 "support escalations" blurbs. wish remove/colorize/whatever three. regex selecting text in between, starting point in first 1 ending point in last one. (problem easiest see in regex101 demo, below.) rexex 101 demo var regex = new regexp('support escalations*[\s\s]*level iv.*', 'gi'); var txt = $('#blurb').html(); txt = txt.replace(regex, '=-=-=-=-=-=-=-=-=-=-=<br>'); $('#blurb').html(txt); //alert(txt); <script src="https://ajax.googleapis.com/ajax

c# - "RPC Server is unavailable" when exporting Outlook contacts to CSV -

i exporting outlook contacts custom form csv specific contacts folder. folder not default location. large folder 7,000 contacts. shared mailbox in office 365, can't use outlook or graph apis because of custom data. my code below works fine, except after iterating through 200-800 contacts, error: "rpc server unavailable. (exception hresult: 0x800706ba)." i tried exporting folder .pst , accessing folder on local machine. result same. update: i've been watching outlook.exe in task manager, , steadily increases memory consumption around 300mb before crashing. i've tried same code on laptop running office 2010, , "out of memory" error. i error whether outlook open or closed, closing outlook during program operation trigger error. outlook either starts (or restarts) following error. i've read number of posts , articles related error, i'm not sure what's going on. appreciated. update: code has been updated use for loops inst

javascript - Adding and removing class with js works on every element of unorderd list except last child -

i made simple javascript adding , removing class change element background color. there button add new li elements, , no matter how many of them add works time not on last child of list. var counter = 1; var newitem = document.getelementbyid('ulist'); var btninput = document.getelementbyid('clickme'); var headline = document.getelementbyid('headline'); newitem.addeventlistener('click', actitem); function actitem(e) { (var = 0; < e.target.parentnode.children.length; i++) { if (e.target.parentnode.children[i].classname === '') { e.target.classname = 'active'; } else { e.target.parentnode.children[i].classname = ''; } } } btninput.addeventlistener('click', additem); function additem() { newitem.innerhtml += '<li>new item' + ' ' + counter + '</li>'; counter++; } .active { background-color: #ffff80; } <div class

OAuth with Azure Active Directory: Azure AD returns incorrect value for the State parameter after denying admin-consent scopes -

Image
during oauth interaction azure ad, appears azure returns incorrect value state parameter after users deny grant admin-consent scopes. when constructing url requesting authorization code azure ad via azure ad v2.0 endpoint https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize , let specify state parameter a+b . url encoding state parameter value a%2bb , put in url requesting authorization code azure ad if request specifies scopes require administrator consent , have not granted in past, azure returns following page expected: i trying verify application logic handling errors returning azure. denied consent clicking return application without granting consent link. after that, azure expectedly returned error response app's redirect uri. azure populated data in http body follows: azure populated state parameter value a%252bb . not correct. expected value should a%2bb - i.e. same value specified earlier when calling azure authorization code request endpoi

jquery - Javascript - Looping through an array -

overview: i'm needing update array contains image links new image links. @ same time i'm keeping uploaded images in array. problem while doing previous image links combined. example below. how change code fix array? help. var allimages = [] var allcurrentimages = req.body.oldimages //this pulls previous image links if (allcurrentimages && allcurrentimages.length > 2){ (i=0;i<allcurrentimages.length;i++){ allimages.push(allcurrentimages[i]); } } if (filepath && filepath.length > 2){ allimages.push(filepath); } problem here's problem. if var allcurrentimages has 2 images in array combines them 1 item because i'm requesting body. looks when there 3 images: images[0] = uploads/598f4cc,uploads/53eew2w images[1] = uploads/7wusjw2w it needs this: images[0] = uploads/598f4cc images[1] = uploads/53eew2w images[2] = uploads/7wusjw2w so need somehow split req.body.oldima