Posts

composer - command not found while installed in my project -

i have installed composer in project , i'm trying install packages e.g. swifmailer... , says "command not found"? have tried both via composer.json , via composer require swiftmailer/swiftmailer how can make work?? thanks

java - Not able to build a JSON object correctly using JSONObject -

i have following program building json object. not sure how build array of arrays using following program. pom.xml <dependency> <groupid>com.googlecode.json-simple</groupid> <artifactid>json-simple</artifactid> <version>1.1.1</version> </dependency> jsonobjectconverter.java public class jsonobjectconverter { private static final string store_id = "tmsus"; public static void main(string[] args) { system.out.println(print1()); } private static string print1() { jsonobject body = new jsonobject(); jsonarray events1 = new jsonarray(); events1.add(100l); events1.add(200l); jsonarray events2 = new jsonarray(); events2.add(300l); events2.add(400l); jsonarray eventlogs = new jsonarray(); eventlogs.add(events1); eventlogs.add(events2); body.put("storeid", store_id); body.put(...

node.js - NodeJS Global, JSdom, Unit test -

this simple question: when use create dom jsdom: const dom = (html = '<!doctype html><body></body></html>') => { const domobject = new jsdom(html); const { window } = domobject; const { document } = (domobject).window; global.window = window; global.document = document; global.navigator = { useragent: 'jsdom', language: 'en' }; } module.exports = dom; and use on test such: import test 'tape'; import dom 'dom'; // create global dom dom(); and yet when test have document, window , navigator undefined in tests. it's strange, missing something? or making assumption on it's behavior. should approach differently? if how? thanks! and how it's done! http://airbnb.io/enzyme/docs/guides/jsdom.html worked beautifully, curious.

python - Converting a pyearth model -

i've create model pyearth , , i'd convert object format can translated other representations (for example c++ function). one approach parse str output of model.summary() : $ print(model.summary()) earth model ------------------------------------- basis function pruned coefficient ------------------------------------- (intercept) no 1.78778 h(x0-0.245279) no 1.73016 h(0.245279-x0) no -2.6705 h(x0-1.22149) no 0.31407 h(1.22149-x0) yes none ------------------------------------- mse: 12.2425, gcv: 12.2427, rsq: 0.3090, grsq: 0.3090 but lead float precision loss, , seems it'd fragile piece of logic. is there better way? looks there function pyearth.export.export_sympy() converts model sympy expression.

How do I convert an array of arrays into a multi-dimensional array in Python? -

i have numpy array (of length x) of arrays, of of same length (y), has type "object" , has dimension (x,). "convert" array of dimension (x, y) type of elements of member arrays ("float"). the way can see "manually" like [x x in my_array] is there better idiom accomplishing "conversion"? for example have like: array([array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]), array([ 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.]), array([ 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.]), ..., array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]), array([ 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.]), array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.])], dtype=object) which has shape (x,) rather (x, 10). you can concatenate arrays on new axis. example: in [1]: a=np.array([1,2,3],dtype=object) ...: b=np.array([4,5,6],dtype=object) to make array of array...

c# - System.Web.Caching.Cache Behavior -

my web application caching list of objects avoid having fetch them database on , over. on 1 page, list fetched cache , additional objects added list , displayed in data bound control. these additional objects not meant cached, still somehow. when use cache.get() method, supposed return object reference or copy of object? system.web.caching.cache in-memory cache. means the object references returned cache.get() call. when modify reference after modifing same object still in cache. you need manually clone operation not modify original object.

amazon web services - AWS IAM Policy - allow from IP Addresses AND allow Firehose -

i'm trying set es instance allows access couple of ip addresses, in addition allowing kinesis firehose iam role deliver data instance. i'm having trouble combining 2 policies though. each 1 works on own. ip address policy in place, can view es kibana, can't deliver data firehose. likewise firehose policy, can deliver data not query es. can me see error in constructing access policy? here's policy on es instance: "statement": [ { "effect": "allow", "principal": { "aws": "arn:aws:iam::iiiiiiiiiiii:role/firehose_delivery_role" }, "action": "es:*", "resource": "arn:aws:es:us-west-2:iiiiiiiiiiii:domain/es-test/*" }, { "sid": "1", "effect": "allow", "principal": { "aws": "*" }, "action": "es:*...