December 21, 2011

[Mac] Delete backups from Time Macine

I got disk full message from Time Machine with 2TB external HDD.  I found this helpful video showing how to remove (old) backups from Time Machine disk.


December 19, 2011

Book: Programming Erlang: Software for a Concurrent World



I actually read this book a few years ago -- I was searching for a better way for concurrent programming and found Erlang.  Coincidently, Erlang was starting to get some attention little after.  I believe this was the only Erlang book  at that time.  The book clearly shows and explains how to program in Erlang.  Reading this book was like a wake-up call for me, whose background is mostly OOP and procedural languages.

Book: Clojure in Action


There are many books on Clojure, and after reading/skimming through most of them, I found this book is the best one to start with.  I enjoyed reading this book very much, and I strongly recommend to anyone who wants to know Clojure.  After this book, you might want to read Joy of Clojure, which delves into Clojure deeper.

December 2, 2011

Common Lisp, Web framework, VPS, OSX issues

Goal: 
Develop web apps using common lisp with a web framework in Linux environment.

Environment:
Development environment is OSX 10.6 Snow leopard.  Target environment is Ubuntu 10.10 server running on OpenVZ with very small configuration, provided by VPS hosting service.

Issues:
Two widely used common lisp web frameworks: (1) weblocks, (2) hunchentoot.  (Use quicklisp to install them.)  They both require multithreading support.

1. Development side:

OSX's CLISP binary doesn't support multithreading.  I don't want to spend too much time compiling it from scratch just for that.  Tried SBCL, and its binary (macport) does support multithreading.  Good.

2. Target environment side:

Ubuntu's CLISP package supports multithreading.  However, I couldn't install SBCL using apt-get, reporting there's a problem with memory (don't remember the specific message).  It turns out that SBCL requires 8GB memory for its GC.  However, the VPS has only 512MB memory, and no swap.  no SWAP?!  That's right -- openVZ does not give swap.  I could find a VPS hosting service using XEN, but this hosting service's price is very low, and XEN based VPS hosting service companies are charging almost twice of the company I'm getting service from.

So, in development environment, I have to use SBCL, but on the target machine, CLISP must be used.  (Gotta use the same environment!) Some suggested that LISPBOX has Clozure Common LISP and the binary supports multithreading on OSX, therefore use that (lispbox's clozure).  However, on the Ubuntu in my VPS, installing LISPBOX is a bit of hassle -- compiling many things. (It's because the LISPBOX binary available on the web is a bit old, and does not install on my headless Ubuntu 11.04 VPS.)  Also, I selected Ubuntu to minimize any package compilation, and this defeats the purpose.

I do not have to use common lisp and don't want to waste time on setting up environment -- already wasted good amount of time finding all this -- so decided to go with Clojure instead for frontend, and use clisp for the backend, probably.

Conclusion
I hope my findings help other folks and save their time -- clisp issue on OSX, SBCL on virtual machine based using OpenVZ, etc.  And try Clojure.  It's cooler than Scala, IMHO.

Apache, Glassfish and JAX-WS

Install

Environment: Apache, Glassfish 3.1.1 (or here) on Ubuntu server 11.04, behind FW with VIP.  Here is the good tutorial on installing Glasfish on Ubuntu.


Start/Stop commands for Glassfish:

glassfish/bin/asadmin stop-domain domain1
glassfish/bin/asadmin start-domain domain1


- For virtual hosting, this page might be a good help.
- For SSL, see this page.

Apache + Glassfish

Usual Reverse Proxy configuration will work fine:

ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/


JAX-WS (Web Service) "soap:address location" Issue

My apache server is behind a firewall, and has a VIP, then using apache reverse proxy to Glassfish.  May be this set up is the cause of my problem, but I was getting the IP in ProxyPass/ProxyPassReverse in the JAX-WS's WSDL page for soap-address:location:
<soap:address location="http://127.0.0.1/myapp/mywebservice"/>

This is a problem for client to generate WS client codes using the WSDL.  I spent good amount of time Googling for the solution and found a few things:
1. it's been reported as a bug and is supposed to be fixed before 3.1.1.  May be my problem is caused by my environment: FW and VIP.
2. someone actually wrote servlet filtering to intercept the output, and regex the host name to change it to a correct one.
3. another solution was to grab the generated WSDL, save it locally, hand edit it, then upload.

#2 and #3 are all hacks and I applaud for the developers effort, but I did not like those solution because I am too lazy to do any workaround coding for some environmental issue, and do hand edit things each time WSDL is updated.  So did more digging and reading, found a simpler solution.  In the Apache config for the reverse proxy, just add one more line and it would look like this:

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/



I hope this little finding saves other developers' time.

Rooting Nook Tablet

http://reviewhorizon.com/2011/11/how-to-root-jailbreak-enable-side-load-apk-on-nook-tablet-install-android-market-amazon-app-store/

It'd be nice if I can do some programming on the device directly (and compile too).

Nook SDK: https://nookdeveloper.barnesandnoble.com/tools-services/nook-tablet-sdk.html

Nook Color vs. Nook Tablet vs. Kindle Fire: http://www.barnesandnoble.com/u/compare-nook-tablet-vs-kindle-fire/379003173/

So far, Nook Tablet looks like it is the best low-end/cost tablet.

Amazon's Kindle source code

They're available for download at:
http://www.amazon.com/gp/help/customer/display.html?nodeId=200203720

...source codes for Kindle 2nd gen, 3rd gen, 3G, DX, 6" wifi, Touch, and the latest Kindle Fire.