Posts

javascript - Redux transition to after action execution -

i have action export function loginsuccess(response){ return (dispatch, getstate) => { dispatch({ response, type: types.login }); router.transitionto("/profile") }; } here after successful execution of action redirect /profile . here getting router not defined . you have pass router redux thunk action creator (you pice of code not action wrote action creator). example looks like: export function loginsuccess(router, response){ return (dispatch, getstate) => { dispatch({ response, type: types.login }); router.transitionto("/profile") }; } do have access router in place invoke action creator ? available there? if yes have there (i don't know response ): this.props.dispatch(loginsuccess(response)); and have change to: this.props.dispatch(loginsuccess(this.context.router, response)); i assume have access router context. because don't show how invoke action i'm guessing. hope instruction you. ...

javascript - Use multi-tier dropdown (that uses jquery) to filter data and display d3 bar chart -

i have bar chart want user able create using series of dropdown selections. i have first part done-- select type of produce, produce itself, , bar chart appears. the problem second filter isn't working. want second filter take data that's been filtered produce type , filter again, year. any thoughts or input helpful. plunker: https://plnkr.co/edit/xllk6di5y4pvfgzj3nku?p=preview code below: <!doctype html> <meta charset="utf-8"> <style> body { font: 12px arial;} .bar { fill: #0078a5; } .bar:hover { fill: #18b7f2; } #tooltip { position: absolute; width: auto; height: auto; padding: 4px 6px; background-color: #fff; border:1px solid #eee; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; pointer-events: none; } #tooltip.hidden { display: none; } #pop{ backgr...

amazon web services - Installing AWS key to use S3 -

i did aws configure , inputted key , secret key. have checked account exists when ran: aws iam list-account-aliases , alias appeared. however, when try upload file aws, recieving error: /users/kchen/campaiyn-web/node_modules/skipper-s3/node_modules/knox/lib/client.js:197 if (!options.key) throw new error('aws "key" required'); ^ error: aws "key" required @ new client (/users/kchen/campaiyn-web/node_modules/skipper-s3/node_modules/knox/lib/client.js:197:27) @ function.exports.createclient (/users/kchen/campaiyn-web/node_modules/skipper-s3/node_modules/knox/lib/client.js:925:10) @ writable.onfile (/users/kchen/campaiyn-web/node_modules/skipper-s3/index.js:248:22) @ dowrite (_stream_writable.js:292:12) @ writeorbuffer (_stream_writable.js:278:5) @ writable.write (_stream_writable.js:207:11) @ transform.ondata (_stream_readable.js:528:20) @ emitone (events.js:77:13) @ transform.emit (events.js:...

javascript - Onload bootstrap tab trigger -

the active class isn't working , i've tried body on-load click trigger , show tab using id , many other ways, nothing seems working. have hashed url enable tabs linked individually in search. appreciated. js: hash url , jump tab // jump tab if exists if (location.hash) { $('a[href=' + location.hash + ']').tab('show'); } // add tab hash url persist state $(document.body).on("shown.bs.tab", function(e){ location.hash = e.target.hash; }); }); js: go tab home (not working) $("document").ready(function(){ $("#home").trigger("click"); }); html: <div class="col-xs-5 col-md-2 nopadding"> <nav class="nav-sidebar"> <ul class="nav tabs"> <li class="lead3"><a href="#home" class="active" data-toggle="tab">home </a></li> <li class="lead3"><a href="#ta...

html - List in columns layout depending on viewport width -

how can make several columns 1 list css ? number of columns must change depending on screen width media queries shown here : lage screen: row1 row6 row11 row2 row7 row12 row3 row8 row13 row4 row9 row14 row5 row10 middle screen: row1 row8 row2 row9 row3 row10 row4 row11 row5 row12 row6 row13 row7 row14 small screen: row1 row2 row3 row4 row5 row6 row7 row8 row9 row10 row11 row12 row13 row14 here html code : <ul> <li>row1</li> <li>row2</li> <li>row3</li> <li>row4</li> <li>row5</li> <li>row6</li> <li>row7</li> <li>row8</li> <li>row9</li> <li>row10</li> <li>row11</li> <li>row12</li> <li>row13</li> <li>row14</li> </ul> you can css multi-column layout . add support isn't best. or if can set fixed height on ul use flexbox , flex-direction: colum...

A function which identifies how many times a string is included in another one in lisp -

i block program lisp function mark how many times string included in another i tried function sends me error: *** - +: "abc" not number (defun string-contain (string1 string2) (cond ((not (length string1)) nil) ; string1 est vide (pas besoin de le tester à chaque fois) ((> (length string1) (length string2)) nil) ; string1 est plus longue que chaine2 ((string= string1 (subseq string2 0 (length string1))) string1) (t (+ 1(string-include string1 (subseq string2 1)))))) thank in general, when you're doing string processing, should try avoid calling subseq , since creates new string, , don't want doing string allocation. many of sequence processing functions in common lisp take start , end parameters, can specify parts of sequence you're looking for. function search looks occurrence of sequence within sequences , returns index of first occurrence. can call search repeatedly new :start2 values search farther , farther within ...

javascript - RegExp - needs to check there are letters and numbers present plus optional special chars? -

Image
this question has answer here: password validation regex 2 answers using javascript have test value ensure alphanumeric, can have selection of optional special chars - have: [a-za-z0-9\/_\+£&@"\?!'\.,\(\)] but fails optional aspect of test. e.g. these should valid: alpha1234 alpha1234! 1234alpha !1234alpha 1234!qwer but these should fail: alpha 1234 hopefully can either point me in right direction or has answer handy :) or if need know more, let me know. thanks in advance. first, ensure input contains @ least 1 digit: (?=.*[0-9]) . then, ensure input contains @ least 1 alpha: (?=.*[a-z]) . finally, ensure input contains allowed chars: [a-z0-9\/_+£&@"?!'.,()]* . all together: ^(?=.*[0-9])(?=.*[a-z])[a-z0-9\/_+£&@"?!'.,()]*$ visualization debuggex demo regex101