Posts

javascript - d3 Line Chart animations from left to right -

Image
i interested create line chart -- draws left right -- connecting dots in x-axis. http://bl.ocks.org/markmarkoh/8700606 http://bl.ocks.org/duopixel/4063326 this jsfiddle i've made start creating chart. http://jsfiddle.net/nyeax/1512/ //__invoke line $('[data-role="line"]').each(function(index) { createline(this); }); function createline(el){ var w = $(el).data("width"); var h = $(el).data("height"); var svg = d3.select($(el)[0]) .append("svg") .attr("width", w) .attr("height", h); var data = d3.range(11).map(function(){return math.random()*10}) var x = d3.scale.linear().domain([0, 10]).range([0, 700]); var y = d3.scale.linear().domain([0, 10]).range([10, 290]); var line = d3.svg.line() .interpolate("cardinal") .x(function(d,i) {return x(i);}) .y(function(d) {return y(d);}) var path = svg.append("path") ...

Php array error with sendgrid -

this script sending newsletter users. code below has limit 5 testing. i'm having error: catchable fatal error: argument 1 passed sendgrid\email::settos() must of type array, string given, called in /var/www/web/web/sengrid.php on line 44 , defined in /var/www/web/web/sendgrid-php/lib/sendgrid/email.php on line 90** <?php ini_set("display_errors", "1"); error_reporting(e_all); require_once ('inc/db.php'); require("sendgrid-php/sendgrid-php.php"); $sendgrid = new sendgrid('myapikey'); $email = new sendgrid\email(); $resultado = mysqli_query($dbc,"select email, hash newsletter enviado = '0' , newsletter = '1' limit 5"); $totalrows = mysqli_num_rows($resultado); if ($totalrows == 0){ echo "<p>no results</p>"; } $rss = ""; if(!$xml = simplexml_load_file('http://www.test.com.ar/rss.php') ) { echo 'unable load xml file'; } else { for...

java - How to Iteratre over Future<List> Object? -

the return value of call() method list<person> . mycallable class looks this: public class mycallable implements callable <list<person>>{ public list<person> call() throws exception { ... return list } public mycallable(list<account> accountlist) { super(); } } below code im writing in callablefuture class executorservice executor = executors.newfixedthreadpool(nthreds); list<future<list<person>>> list = new arraylist<future<list<person>>>(); (int = 0; < 20; i++) { callable<list<person>> worker = new mycallable(accountlist); future<list<person>> submit = executor.submit(worker); for(future<list<person>> :list){ //list.add(submit); } } i don't k...

r - Using geom_abline() and ggplot -

Image
i beginner in ggplot2 --it's been 4 days since have started experimenting it. so, apologize if question sounds basic. i'd appreciate guidance--i've been struggling issue hour. i experimenting using geom_abline() below: p <- ggplot(mpg, aes(cty, hwy)) + geom_point() p + geom_abline() + facet_wrap(~cyl) this works in can see reference line in 4 faceted graphs below: later, using related dataset mtcars see happens geom_abline() p <- ggplot(mtcars, aes(wt, mpg)) + geom_point() p + geom_abline() + facet_wrap(~cyl) however, when ran command, couldn't see geom_abline(). quite surprisingly, found similar version of above command in file, , says " geom_abline() out of range " while know "out of range" means, how know whether in particular dataset, abline() out of range? can override forcing use specific slope , intercept, i'd consider bit of hacking--i.e. modifying code after seeing output. there way can know happen...

javascript - Bootstrap radio select through Jquery not working -

i have created jquery quiz. answer choices radio buttons. whenever answer choice clicked, code determines whether right or wrong , sends message dom. however, clicking right answer sends message wrong. think must due bootstrap or way set code. pls help. (var = 0; < choices.length; i++) { $(document.createelement('label')).addclass( 'c-input c-radio').appendto('#choice-block') .attr('id', i); $(document.createelement('input')).appendto('#' + i) .attr('type', 'radio').attr('id', * 100); $(document.createelement('span')).addclass( 'c-indicator').appendto('#' + i); $(document.createelement('span')).appendto('#' + i) .text(choices[i]); $(document.createelement('hr')).appendto( ...

syntax highlighting - In emacs, how to colorize a row in a CSV based on value in a column? -

i have created major-mode emacs use data analysis. mode works great me it's drab , don't take advantage of color way should. data being analyzed in csv format , i'd colorize rows within based on values in columns. let's have following file in csv format: one,1,2,3 two,4,5,6 three,7,8,9 the rows in csv should colored red based on value in 4th column , intensity of red should increase same value. in case last column should intense red , first should least red. i've read on search based fontification , i'm bit confused how write (matcher . facespec) sets facespec properly. facespec expression evaluates to (face face prop1 val1 prop2 val2…) but how make depend on values in fourth column of csv? guess value in fourth column gets matched how tie face used magnitude of value matched? suppose need generate face on fly based on value matched not sure how so. any ideas? simple example best.

python 2.7 - Dynamic filter on Django query -

i want search in field given user. i have far: def search_engine(model, given_field, text): # stuff result = model.objects.filter(given_field__icontains=text) return result the "given_field" inside filter parameter given in function, variable. create dict dynamic key generated given_field , unpack using ** generate keywords arguments. def search_engine(model, given_field, text): # stuff filters = { given_field+'__icontains': text } result = model.objects.filter(**filters) return result