Posts

arrays - Data field shifting trough a vector of data in matlab -

i need create data field go through vector. data field constant length, , going through data vector shifting data field data field length. need mean value of field (a vector) corresponds mean value of field (b vector). example: a=[1 5 7 8 9 10 11 13 15 18 19 25 28 30 35 40 45 48 50 51]; b=[2 4 8 9 12 15 16 18 19 20 25 27 30 35 39 40 45 48 50 55]; i want next: a=[{1 5 7 8 9} 10 11 13 15 18 19 25 28 30 35 40 45 48 50 51]; b=[{2 4 8 9 12} 15 16 18 19 20 25 27 30 35 39 40 45 48 50 55]; i want take data field of 5 points , mean value. , shift whole data field data field length. a=[1 5 7 8 9 {10 11 13 15 18} 19 25 28 30 35 40 45 48 50 51]; b=[2 4 8 9 12 {15 16 18 19 20} 25 27 30 35 39 40 45 48 50 55]; i need 2 vectors, c , d mean values of method. c=[6 13.4 27.4 45.2]; d=[7 17.6 31.2 47.6]; i started with n = length(a); k = 1:n .... but nothing tried worked. thanks. reshape vector 5-row matrix , compute mean of each column: c = mean(reshape(a,5,[])...

Highcharts: How to display multiple tooltips by click in multiple series with shared true -

i search way display tooltip permanently, when tooltip shared. these points important: click on point --> tooltip cloned , displayed permanently click on same point again, clone removed multiple tooltips allowed displayed @ same time thanks. as sebastian pointed out in comment - clone tooltip. when tooltip has usehtml set false (by default does), need clone svg element. see similar topic: link when usehtml set true div element created , appended container of chart. need clone not svg frame, html's div. issue check cloned tooltips x, because tooltip shared. example: http://jsfiddle.net/7vkzv/14/ when usehtml true html overflow other svg elements - avoid style html div tooltip text , remove visible style in svg tooltip. in other words - make tooltip in pure html. example: http://jsfiddle.net/7vkzv/15/

php - Select list array - prepopulate the choice to the top of the array -

i printing simple select list out looping through associative array populated elsewhere. <select id="choice" name="choice"> <?php foreach ($this->choice $key => $value) { echo "<option name=".$value." value=".$key.">" .$value. "</option>" ; } ?> </select> this select list gives options available array. however, trying pre-populate list selected value, example if user updating user information, set choice @ top of list (ideally without choice appearing further down list). i have access data in variable have queried: $this->selected_choice //value $this->selected_id //key now have been testing solutions <select id="choice" name="choice"> <option name="<?php echo $this->selected_choice; ?>" value="<?php echo $this->selected_id;?>">"<?php echo $this->selected_choice...

handlebars.js - Is there a way to integrate handlebars-helpers with hapi? -

i use handlebars-helpers node module handlebars templates. i'm using hapi framework supports handlebars. haven't found documentation or examples shows how use handlebars-helpers hapi using handlebars view engine. is possible , if so, solution? i don't think it's possible according hapijs api docs views: http://hapijs.com/api#serverviewsoptions helperspath - directory path helpers located. helpers functions used within templates perform transformations , other data manipulations using template context or other inputs. each '.js' file in helpers directory loaded , file name used helper name. files must export single method signature function(context) , return string . sub-folders not supported , ignored. defaults no helpers support (empty path). note jade not support loading helpers way. looks though handlebars-helpers has different signature required hapi

neo4j - Traversing through all nodes and comparing each one with every other one -

i working on little project , have dataset of 60k nodes , 500k relationships between nodes. nodes of 2 types. first type are recipes , second type ingredients. recipes composed of ingredients like: (ingredient)-[:is_part_of]->(recipe) my objective find how many common ingredients 2 recipes share. have managed obtain information following query compares 1 recipe others (the first 1 others): match (recipe:recipe{ id: 1000000 }),(other) (other.id >= 1000001 , other.id <= 1057690) optional match (recipe:recipe)<-[:is_part_of]-(ingredient:ingredient)- [:is_part_of]->(other) ingredient, other return other.id, count(distinct ingredient.name) order other.id desc my first question: how can obtain number of ingredients of 2 recipes in way mutual ones counted once (union of r1 , r2 --> r1 u r2) my second question: possible write loop iterate through recipes , check common ingredients? objective compare each recipe others . thin...

python - Is Maxwell architecture supported in Numbapro? -

i want execute cuda kernel in python using numbapro api. have code: import math import numpy numbapro import jit, cuda, int32, float32 matplotlib import pyplot @cuda.jit('void(float32[:], float32[:], float32[:], float32[:], float32, float32, float32, int32)') def calculate_velocity_field(x, y, u_source, v_source, x_source, y_source, strength_source, n): start = cuda.blockidx.x * cuda.blockdim.x + cuda.threadidx.x end = n stride = cuda.griddim.x * cuda.blockdim.x in range(start, end, stride): u_source[i] = strength_source/(2*math.pi) * (x[i]-x_source)/((x[i]-x_source)**2 + (y[i]-y_source)**2) v_source[i] = strength_source/(2*math.pi) * (y[i]-x_source)/((x[i]-x_source)**2 + (y[i]-y_source)**2) def main(): n = 200 # number of points in each direction x_start, x_end = -4.0, 4.0 # boundaries in x-direction y_start, y_end = -2.0, 2.0 # boundaries in y-direction x = numpy....

listener - How to listen for a command on bash? -

i trying write webhook whenever specific command run in bash. example, when ls called, run script. more specifically, when command spark ran, want write slack channel using webhooks. put wrapper earlier in path. let's spark in /usr/bin . if users' paths have /usr/local/bin before /usr/bin , can in /usr/local/bin/spark : #!/bin/sh [ "${_spark_wrapper_done}" ] || send-to-slack-here "$@" export _spark_wrapper_done=1 exec /usr/bin/spark "$@" ...where send-to-slack-here , of course, code send message slack. you move /usr/bin/spark /usr/bin/spark.real , put wrapper in original executable's place. if control .bashrc , use shell function (though work in fewer scenarios): spark() { send-to-slack-here "$@" /usr/bin/spark "$@" }