Posts

How to access specific row from CSV with Jekyll? -

i using jekyll [2.5.3] build prototype , need access specific rows file in _data in layouts. in file _data/badges.csv have: name, image_url heat, http://pathtoimage.com/image-1.png water, http://pathtoimage.com/image-2.png zoning, http://pathtoimage.com/image-3.png ... in _layout/page.html trying access zoning row badges.csv passing value site.data so: {% assign badge = site.data.badges.name["zoning"] %} {{ badge.image_url }} eventually make ["zoning"] page variable load specific badges based on page. i've tried [zoning] , ['zoning'] , ["zoning"] . none of these output data , not throw error during jekyll build . how can access specific row csv? i believe csv files treated arrays instead of maps. if want find specific entry in csv this: {% badge in site.data.badges %} {% if badge.name == "zoning" %} {{ badge.image_url }} {% endif %} {% endfor %} you move _includes , pass argument reuse fu...

algorithm - How to round value UP to nearest factor of a number -

this question has answer here: c++: rounding nearest multiple of number 25 answers there several questions on here how round value known multiple. example there question shows how round value specified multiple (e.g. round 9 multiple of 5 yield 10). want round value nearest factor of given number. example lets says want round value closest factor of 48. factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48 if value 9 want round 12. way know brute force: class program { static void main(string[] args) { const int clock = 48; int value = 9; while( value < clock && (clock % value) != 0) { value++; } console.writeline(value); } } this works fine it's not clever or efficient, @ least suspect case. there better way round number factor of base number other brute force? private int ucln(...

java - JavaFX Loading in Background -

this question has answer here: javafx 2: background , platform.runlater vs task/service 1 answer how have dialog has indeterminate progressindicator in foreground while main thread loads bunch of data in background , loads on main scene . currently, when program loads, page is white, unresponsive, , looks bad. also, best way or there better way. your window frozen/unresponsive because loading data in main thread (which thread used javafx render window). what need perform loading in separate thread, run parallel main thread. when loading complete, thread notify main thread , pass loaded data render. here quick way create new thread loads data: thread mythread = new thread(new runnable() { @override public void run() { // perform loading here // once loading complete, ...

javascript - Other browser windows don't go back to user login page after Meteor.logout() -

i have written meteor application user login. after user logs out, application redirects user login page. however, when multiple tabs in browser (or multiple browser windows) application active (and user logged in), active tab or browser window goes user login page. in other window seems user still logged in. however, when user further work in other window, nothing synced db on server anymore. thought meteor.logout() reactive, how possible other browser tabs or windows don't refresh? i have folowwing in router?js file: var filters = { isloggedin : function(pause) { if(!meteor.user()){ this.render('login'); } else { this.next(); } } .... } router.onbeforeaction(filters.isloggedin); after pushing logout button following js code executed meteor.logout(); thanks help. try this: meteor.logoutotherclients meteor.logoutotherclients should log out sessions. designed situations user logged in on multiple devices , wants log out on of them...

date - AngularJS Dateformatting -

i date in format: 2015-02-19 00:00:00 now need format date to 19-02-2015 i tried: sc.documents.datestring = $filter("date")('2015-02-19 00:00:00', 'dd-mm-yyyy'); but didn't work, have idea of how this? first argument should date object, not string. yon need is: sc.documents.datestring = $filter("date")(new date('2015-02-19 00:00:00'), 'dd-mm-yyyy');

javascript - setInterval() not working as intended -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i wrote function when called returns 5, yet when console.log function inside of setinterval() returns expect. why doesn't work when called? function countdown(seconds){ var tick = 0; setinterval(function() { if (seconds > tick) { seconds--; console.log(seconds); //counts down expected. } }, 1000); return seconds; } console.log(countdown(5)); //returns undefined. also, know settimeout() preferred when swap out setinterval doesn't work @ all. , clarity issue appreciated it. //returns undefined. because seconds not defined when function returns. see function body. setinterval isn't called till function returns. function countdown(seconds){ var tick = 0; setinterval(functio...

PowerShell add-ons -

what complete steps installing and/or adding add-on profile? (ex. ise scriptinggeek) (powershell v4.0) i have tried following: downloaded , unzipped isescriptinggeek-master in c:\users\fname.lname\documents\windowspowershell\modules\ directory. added get-command -module isescriptinggeek profile. ran following command - get-command -module isescriptinggeek , restarted powershell ise. i not see add-ons dropdown. showing steps every add-on not feasible in format because every custom module can have different steps. with regards isescriptinggeek add-on , command putting in profile wrong, should be: import-module isescriptinggeek you can verify works first running command in powershell session.