Sunday, June 26, 2011

Idiosyncrasies of Python

  1. If say thread A does a thread join on thread B, thread A will block (and be uninterruptible by signals) until thread B completes. (more info here)
  2. The Global Interpreter Lock in CPython. JPython and IronPython have no GIL. To get around GIL, consider using the multiprocessing module, i.e. processes instead of threads.

(More to come!)

Nginx on Ubuntu

$ sudo apt-get install nginx
$ sudo /etc/init.d/nginx start
$ sudo /etc/init.d/nginx stop

Hit 127.0.0.1:80/ and you should see "Welcome to nginx!"

Config path: /etc/ningx/
Default virtual hosts config path: /etc/nginx/sites-enabled/
Default doc root: /usr/share/nginx/www

Docs: nginx primer for folks who come from apache

Monday, June 20, 2011

Build Engineering

One interesting aspect of software development that I have been exposed to lately is build engineering.

Particularly, I have been reading up on:

Terminology 101

This list is likely to be continuously updated.
  • Serialization is often known as pickling (mainly used in python) and marshalling (more for binary data).
  • Cache priming is also known as cache warming (e.g. by populating the cache with data)
  • Mainline/baseline (aka "vanilla" for Linux Kernel Dev) is similar to the master branch of the code repository.
  • Continuous build != nightly builds, since bugs can lie dormant for 24 hrs for nightly builds.
  • XP = Extreme Programming
  • Coroutines are "computer program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations"
  • Log rotation is "the regular (nightly or weekly, typically) moving of an existing log file to some other file name and starting fresh with an empty log file".

Sunday, June 12, 2011

Servers on Mac

Personal tips for setting up MAMP (Mac, Apache, MySQL, PHP):

The main reason why you have apache on mac is because of sharing (system preferences -> sharing -> web sharing). And by default, apache is configured to listen on port 80 and include a bunch of config files in /private/etc/apache2/[users,other]
Virtual hosts are not setup by default.

Things I do for running a development server:
- changed port to listen on another port (say 8000, 8080)
- set up http auth for security reasons

Stuff I put in my .zshrc:


alias couch_start="sudoge launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist"
alias couch_stop="sudo launcctl unload /Library/LaunchDaeons/org.apache.couchdb.plist"
alias couch_restart="sudo launchctl stop org.apache.couchdb"

alias apache_start="sudo apachectl start"
alias apache_stop="sudo apachectl stop"
alias apache_restart="sudo apachectl restart"

alias mysql_start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql_stop="sudo /usr/local/mysql/support-files/mysql.server stop"
alias mysql_restart="sudo /usr/local/mysql/support-files/mysql.server restart"

alias mysql="/usr/local/mysql/bin/mysql"

Nginx

Nginx is a high performance http server + reverse proxy + pop3/imap server. This is a good article on using Nginx as a reverse proxy.

More juicy stuff:
Apache is a process-based server, while nginx is an event-based web server

See Apache vs Nginx

Monday, June 06, 2011

Database Sharding

I have been reading a bit on database sharding.

Note: More update his post when I have a better understanding.

Sunday, June 05, 2011

Thursday, June 02, 2011

nomodeset

Here is an explanation of what nomodeset does. (recommended: read the whole thread)

Update: it seems the recommended way is:

Older Intel devices: i915.modeset=1 or i915.modeset=0
Nvidia: nomodeset
Generic: xforcevesa or nouveau.modeset=0
Radeon: radeon.modeset=0

From my observations, setting *.modeset=0 seems to have similar effects with nomodeset.