Archive for October, 2012

October 18, 2012

Lightweight http daemons for Windows and Mac

As a Dropbox user, I often need to start a web server from a non-standard root folder location. Under Windows, I have been using Mongoose and loves it. Mongoose is a single .exe file that can be put into the root folder of a web project.

For Mac and Linux with Python, life is even better. A light weight server is already installed. I just need to run the command
sudo python -mSimpleHTTPServer 80
and the web contents can be accessed through the URL

October 3, 2012

Similar functions in R and Matlab

Although R and Matlab have many similarities, switching between the two languages is not always easy. Below is a lookup table that hopefully will make the process easier.

Matlab R Note
size dim
find which
( [
s(offset:(offset+len-1)) substr(s, offset, len)
@x lambda(x) function(x) { lambda(x) } Anonymous function in Matlab cannot contain more than one statements.
num2str as.character
ischar is.character
class class
unique unique
& (|) & (|) element-wise logic operators
~ !
sum sum vector function
length length vector function
dec2hex as.hexmode
strcat paste