Posts

C# How do I get out of this loop? -

how out of loop? i wrote program checks see if corresponding places in numbers same total. console output should true or false. wrote that, , added top part interacts user, , stuck in loop. how out of it? using system; namespace deliverablepart1 { class deliverablepart1 { static void main(string[] args) { string gameanswer; bool repeat1 = true, repeat2 = true; while (repeat1 == true) { repeat2 = true; console.writeline("would compare 2 numbers see if corresponding place same total?"); gameanswer = console.readline(); while (repeat2 == true) { if (gameanswer == "yes" || gameanswer == "yes" || gameanswer == "yes") { console.writeline("please enter 3 digit whole number"); string firstvalue = ...

sql - Increase MySql EAV query performance -

Image
when run query, took average of 1.2421 seconds, think slow, have added indexing every single possible column in clause. anymore improvement can speed query? table contains data eav have around 111276 rows/records select sql_calc_found_rows eav.entid, ent.entname eav, ent, catatt ca eav.entid = ent.entid , ent.status = 'active' , eav.status = 'active' , eav.attid = ca.attid , ca.catid = 1 , eav.catid = 1 , ( ca.canviewby <= 6 || ( ent.addedby = 87 , canviewby <= 6 ) ) , ( ( eav.attid = 13 , ( `char` = '693fafba093bfa35118995860e340dce' ) ) or ( eav.attid = 3 , `double` = 6 ) or ( eav.attid = 45 , ( `int` = 191 ) ) ) group eav.entid having count(*) >= 3 explain output catatt table index eav table index ent table index i have sim...

heroku rails app crashing on mobile devices -

i have rails app on heroku, working quite on system crashes on mobile devices android based phone. i have checked app , looks fine out there here heroku log: 2017-08-20t01:48:46.253573+00:00 app[web.1]: started "/api/notifications.json" 64.233.173.159 @ 2017-08-20 01:48:46 +0000 2017-08-20t01:48:46.258740+00:00 app[web.1]: processing api::notificationscontroller#index json 2017-08-20t01:48:46.261854+00:00 app[web.1]: user load (1.7ms) select "users".* "users" "users"."id" = $1 order "users"."id" asc limit 1 [["id", 3]] 2017-08-20t01:48:46.270078+00:00 app[web.1]: (1.7ms) select count(*) "notifications" "notifications"."is_new" = $1 , "notifications"."recipient_id" = 3 [["is_new", "t"]] 2017-08-20t01:48:46.277519+00:00 app[web.1]: (1.6ms) select count(*) "notifications" "notifications"."rec...

reactjs - What does the at symbol (@) do in ES6 javascript? (ECMAScript 2015) -

i'm looking @ es6 code , don't understand @ symbol when placed in front of variable. closest thing find has private fields? code looking @ redux library : import react, { component } 'react'; import { bindactioncreators } 'redux'; import { connect } 'redux/react'; import counter '../components/counter'; import * counteractions '../actions/counteractions'; @connect(state => ({ counter: state.counter })) export default class counterapp extends component { render() { const { counter, dispatch } = this.props; return ( <counter counter={counter} {...bindactioncreators(counteractions, dispatch)} /> ); } } here blog post found on topic: https://github.com/zenparsing/es-private-fields in blog post examples in context of class - mean when symbol used within module? it's decorator . it's proposal added ecmascript. there multiple es6 , es5 equivalent examples on: https://g...

scapy - How can I get IP of a specific hop for traceroute in python -

addr = socket.gethostbyname('dalitstan.org') target = [addr] result, unans = traceroute(target,maxttl=32) i doing , getting below output. there way here ip of specific hop in variable. , why hop number missing in traceroute result? begin emission: finished send 32 packets. ************************* received 25 packets, got 25 answers, remaining 7 packets 185.53.178.6:tcp80 1 192.168.43.1 11 3 10.71.83.18 11 4 172.16.26.245 11 5 172.26.31.242 11 11 49.44.18.38 11 13 103.198.140.164 11 14 103.198.140.27 11 15 80.81.194.27 11 16 217.64.161.25 11 17 217.64.170.214 11 18 185.53.178.6 sa 19 185.53.178.6 sa 20 185.53.178.6 sa 21 185.53.178.6 sa 22 185.53.178.6 sa 23 185.53.178.6 sa 24 185.53.178.6 sa 25 185.53.178.6 sa 26 185.53.178.6 sa 27 185.53.178.6 sa 28 185.53.178.6 sa 29 185.53.178.6 sa 30 185.53.178.6 sa 31 185.53.178.6 sa 32 185.53.178.6 sa on trying result.get_trace(...

pandas - Column order after multi-index unstack -

output after unstacking data. unstacked using multi-columns unstack(['marketdate','class']) marketdate 2017/08/19 2017/08/18 2017/08/19 class onpeak onpeak offpeak offpeak constraint_id 634 -221.65 -165.28 -116.55 -237.97 644 0.00 2.22 0.00 0.00 1049 -702.05 -936.26 -317.45 -181.72 1281 0.00 -4.68 0.00 0.00 1607 -136.12 -84.74 -31.44 -65.91 what need see in output marketdate , below onpeak , offpeak, not marketdate onpeaks first , offpeaks later. this important further processing. any appreciated. iiuc, need sort_index axis=1 . df.sort_index(axis=1)

shell - How to remove quotes around each element in bash array created from grep capture -

in bash function, using grep capture matching pattern string (selecting files created), , storing captured in array. string assigned variable called output installing route create app/routes/foo.js create app/templates/foo.hbs updating router add route foo installing route-test create tests/unit/routes/foo-test.js after running files=($(echo "$output" | ggrep -op 'create\s\k(.+)')) i confirm capturing intend running echo ${files[*]} . output in terminal looks so app/routes/foo.js app/templates/foo.hbs tests/unit/routes/foo-test.js my goal pass these files arguments npm script ( npm run lint <list of files> ). however, when try plug in variable npm script execution, file names either print out like "app/routes/foo.js" "app/templates/foo.hbs" "tests/unit/routes/foo-test.js" or "app/routes/foo.js app/templates/foo.hbs tests/unit/routes/foo-test.js" the ultimate goal here able run npm run li...