Author Archives: rp8

About rp8

Specialized in building sophisticated systems for trading & risks in commodity, exotics, commodity index & structured products. Specially interested in using open source stacks and cloud computing to build new generation of services and apps. Enjoy mountain biking & photography. github

Install LetsEncrypt for Multiple Sites in Nginx

Turn on one site at a time and install new certificate.  Once all certificates are installed you can turn on all the sites.  The installation client may be confused when more than one site are hosted on the same server … Continue reading

Posted in Ubuntu | Tagged , | Comments Off on Install LetsEncrypt for Multiple Sites in Nginx

Playing with TensorFlow

It’s a great tool!

Posted in General | Comments Off on Playing with TensorFlow

Phottix Odin for Sony

The TCU and receiver work great on HVL-F56AM, HVL-F58AM and HVL-F60M with TTL, Manual and HSS. EV adjustment in Group A, B and C work too. Tested in both a700 and a99.

Posted in General | Tagged , , | Comments Off on Phottix Odin for Sony

“Synchronous” MongoDB Calls with Fibers

Here I’m showing an example of converting MongoDB node driver into “synchronous” APIs from callback based asynchronous APIs. We define two new classes to wrap up the native Db and Cursor. Two methods are converted: Db.Open and Cursor.toArray. The “sync” … Continue reading

Posted in JavaScript, Node.js, NoSQL | Tagged , , | Comments Off on “Synchronous” MongoDB Calls with Fibers

Node-Fibers Example

With node-fibers, we can write codes in traditionally synchronous fashion and avoid deep nested callback calls without blocking the Node event loop. Below is an example to generate Fibonacci series. Each run resumes the calculation loop and returns a number … Continue reading

Posted in JavaScript, Node.js | Tagged , | Comments Off on Node-Fibers Example

Mindful of CoffeeScript Function Return Value

Here’s a gotcha if you’re not careful when writing CoffeeScript. Notice the generated js code where constructor now returns this._cursor!! #c.coffee Cursor = (cursor) ->   this._cursor = cursor 0 // c.js 1 // Generated by CoffeeScript 1.6.2 2 (function() … Continue reading

Posted in General, JavaScript | Tagged | Comments Off on Mindful of CoffeeScript Function Return Value

MongoDB Test2

Using a two-core server generating enough traffics and achived over 8000 ticks/s. mongod runs 65% CPU time.

Posted in Node.js, NoSQL, Ubuntu | Tagged | Comments Off on MongoDB Test2

MongoDB Test 1

Simple test in simulated ticks: single node process had throughput of 2394 ticks per second. mongod runs at 44% CPU usage.

Posted in Node.js, NoSQL, Ubuntu | Tagged | Comments Off on MongoDB Test 1

MongoDB Build

Spent a few hours building a simple MongoDB cluster with Digital Ocean VPS. Three nodes: Primary, Secondary and Arbiter. Primary node is located in New York and Secondary node is in San Francisco. Arbiter is also in New York leveraging … Continue reading

Posted in Node.js, NoSQL, Ubuntu | Tagged | Comments Off on MongoDB Build

Encapsulation in Coffee Script

m.coffee ——— publicMethod1 = ->   @publicMember1 = "public member 1"   @publicMember2 = "public member 2"   console.log ‘publicMethod1***’   console.log ‘*’ + @publicMember1 publicMethod2 = ->   console.log ‘publicMethod2***’   @publicMethod1()   console.log ‘*’ + @publicMember2 class Foo … Continue reading

Posted in Node.js | Tagged | Comments Off on Encapsulation in Coffee Script