Posts

three.js - How to select a root Object3D using Raycaster -

three.js - How to select a root Object3D using Raycaster - i have parent object3d has kid meshes. how can utilize raycaster select root parent object? my example if have parent object3d has multiple kid meshes, , want select parent raycasting, can following: add parent object array of objects: var objects = []; ... objects.push( root_parent_object ); add each kid object pointer root parent object: child.userdata.parent = root_parent_object; pass in recursive flag intersectobjects() . var intersects = raycaster.intersectobjects( objects, true ); now when raycaster intersects kid object, can obtain root object. three.js r.68 three.js

javascript - High order functions explanation when passing a function to another function -

javascript - High order functions explanation when passing a function to another function - i need help breaking downwards line line happens in illustration (an excerpt eloquent javascript): we have foreach function logs every item in array. understand how works. function foreach(array, action) { (var = 0; < array.length; i++) action(array[i]); } so have array called 'numbers' , variable called 'sum' set 0. lost when 'function(number)' gets passed the action parameter. , how work? don't see it's value is. can break down? var numbers = [1, 2, 3, 4, 5], sum = 0; foreach(numbers, function(number) { sum += number; }); console.log(sum); // → 15 i think you're not grasping syntactic construction of call. 1 as write var numbers = [1, 2, 3, 4, 5]; var sum = 0; function addtosum(number) { sum += number; } foreach(numbers, addtosum); i hope clear happening in here. have function addtosum , , pass function foreach ...

google app engine - GAE Guestbook Java tutorial. force authentication of /sign servlet causes 405 on redirect -

google app engine - GAE Guestbook Java tutorial. force authentication of /sign servlet causes 405 on redirect - i've gone throught guestbook tutorial , i've been trying forcefulness authentication /sign servlet. here's i've set in web.xml <servlet> <servlet-name>sign</servlet-name> <servlet-class>com.google.appengine.demos.guestbook.signguestbookservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>sign</servlet-name> <url-pattern>/sign</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <web-resource-name>sign</web-resource-name> <url-pattern>/sign/*</url-pattern> <http-method>post</http-method> </web-resource-collection> <auth-constraint> <role-name>*</role-name> </auth-constraint> </security-constraint...

node.js through FastCGI/PHP: Error: Cannot find module 'less' -

node.js through FastCGI/PHP: Error: Cannot find module 'less' - i installed node.js sources ( ./configure && create && create install ) under /usr/local/bin/node . afterwards installed less compiler globally npm -g install less under /usr/local/lib/node_modules/less/ . node , less located under default paths. i using kriswallsmith/assetic compile less files through php, hence adjusted path /usr/local/bin/node . everytime run script error error: cannot find module 'less' , had same behavior through command line. found solution ( ln -s /usr/local/lib/node_modules/ ~/.node_libraries ) prepare problem , after worked out on command line. through php problem still persists - php running through fastcgi same user used on command line. how can prepare problem through fastcgi/php too? constructor of assetic's lessfilter accepts array of nodepaths. adding /usr/local/lib/node_modules/ nodepath solves problem. php node.js assetic

python - How can I get my returned class of specific strings of a txt file added to a list? -

python - How can I get my returned class of specific strings of a txt file added to a list? - def gettopnames(state, gender, startyear, endyear): """ top names. :param state (str): state, e.g. 'ny' :param gender (str): gender, e.g. 'f' :param startyear (int): starting year, e.g. 1969 :param endyear (int): ending year, e.g. 2010 :return: list of top name objects :rtype: list """ filename = 'data/' + state + '.txt' = startyear file = open(filename) lst = list() open(filename) f: line in f: fields = line.strip().split(",") print(fields) if fields[1] == gender , fields[2] == i: lst.append(createname( fields[3], fields[1], int(fields[2]), fields[0], int(fields[4]))) = +1 if == endyear: break if line == "": br...

type families - OCaml functors (parametrized modules) emulation in Haskell -

type families - OCaml functors (parametrized modules) emulation in Haskell - is there recommended way utilize typeclasses emulate ocaml-like parametrized modules? for instance, need module implements complex generic computation, may parmetrized different misc. types, functions, etc. more specific, allow kmeans implementation parametrized different types of values, vector types (list, unboxed vector, vector, tuple, etc), , distance calculation strategy. for convenience, avoid crazy amount of intermediate types, want have computation polymorphic dataset class, contains required interfaces. tried utilize typefamilies avoid lot of typeclass parameters (that cause problems well): {-# language multiparamtypeclasses , typefamilies , flexiblecontexts , flexibleinstances , emptydatadecls , functionaldependencies #-} module main import qualified data.list l import qualified data.vector v import qualified data.ve...

mysql - Learning PyMySQL, Python - Tuple Error -

mysql - Learning PyMySQL, Python - Tuple Error - i'm learning sql , trying build script update db basic company information. below query i've got , i'm getting query: query = "update companies set url = '{}', industry = '{}', address = '{}', city = '{}', state = '{}', country = '{}', type = '{}', year_founded = {} name = '{}') values (\'{}\',{},\'{}\',\'{}\',\'{}\',\'{}\',\'{}\',{},\'{}\')".format(url,industry,address,city,state,country,type,year_founded,company_name) error: indexerror: tuple index out of range indices: insert1(company,url,data[1],data[3],data[4],data[5],data[7],data[0],data[9]) questions: is there more elegant way build query? is possible set query onto multiple lines? what's best way that? i know that index goes 11 values should in range, because of values ''? ie ['google',...