Installing Raindrop on Mac OS X

I’m really excited about Mozilla Raindrop; it have many cool features and technologies behind it. If you don’t know what Raindrop is, take a look at Introducing Raindrop.

This is a very short how-to showing how to install Raindrop on a machine running Mac OS X; a more complete guide can be found on Mozilla Wiki.

First, download and install CouchDBX. Then create a file called ~/.raindrop containing something like this:

[account-gmail-username]
proto=imap
kind=gmail
username=username@gmail.com
password=topsecret
ssl=True

[account-twitter-username]
proto=twitter
kind=twitter
username=username
password=topsecret

Finally, install Raindrop and it’s dependencies:

$ sudo port install mercurial
$ sudo easy_install-2.6 -U Skype4Py python-twitter feedparser paisley simplejson
$ hg clone -r 0.1 http://hg.mozilla.org/labs/raindrop
$ cd raindrop
$ ./server/python/check-raindrop.py
$ ./server/python/run-raindrop.py sync-messages --max-age=2days --folder=inbox

After the “run-raindrop.py” command finishes you can access http://127.0.0.1:5984/raindrop/inflow/index.html to see the Raindrop web interface.

Mini-Review - Erlang Programming

Erlang Programming is probably the best book I’ve ever read about a programming language, and is worth reading even if you don’t plan to use Erlang.

The exercises in this book are helping me a lot to learn more about functional programming and recursion; also, it’s been a very good experience to use processes and “pure” functions instead of threading and shared-state.

Book contents

  1. Introduction: story, high level overview and cases
  2. Basic Erlang: data types, shell and patterns matching
  3. Sequential Erlang: BIFs, conditionals, recursion, libraries and error handling
  4. Concurrent Programming: process creation and managing, message passing, benchmarks and some theory
  5. Process Design Patterns: client / server, finite state machines, event managers and handlers
  6. Process Error Handling: process linking, exit signals, monitors and supervisors
  7. Records and Macros
  8. Software Upgrade: hot code swapping
  9. More Data Types and High-Level Constructs: anonymous functions, list comprehensions, binaries and references
  10. ETS and Dets Tables
  11. Distributed Programming in Erlang: communication between erlang nodes
  12. OTP Behaviours: introduction to generic servers, supervisors and other applications
  13. Introducing Mnesia
  14. GUI Programming with wxErlang
  15. Socket Programming
  16. Interfacing Erlang with Other Programming Languages
  17. Trace BIFs, the dbg Tracer, and Match Specifications
  18. Types and Documentation
  19. EUnit and Test-Driven Development
  20. Style and Efficiency
  21. Appendix - Using Erlang: installing erlang, editors and other tools

The good

  • The book have a great structure that teaches the language, functional and concurrent / distributed programming with baby steps;
  • It’s very well written and formatted;
  • Exercises! Every programming language book should provide exercises like these - short, well defined and that sometimes challenging.

The bad

  • The EUnit chapter should be in the beginning. It’s boring to compile and test things manually in the shell. Of course, you don’t need to read it in order, but still.

Dealing with distractions

Most developers have trouble with distractions. The 5 minutes you take to check Twitter / Hacker News / Google Reader can quickly become 1 hour, and sometimes you need to force yourself to actually do something. This post lists some techniques I’ve been using to get more focused time.

Blocking websites

I’ve been using Alex Payne’s “Get-Back-To-Work Hack” with success for almost two weeks. It’s very simple and while I can easily edit /etc/hosts and un-block everything, I don’t do it. In fact, I’m spending much less time on twitter, email and feeds.

Don’t guess, measure

I use the Rescue Time daemon to track how I’m using my time. It have some pretty cool reports on the web interface and that is helping me a lot to see what distract me most.

Stop notifications

I’ve disabled Growl, changed the clock to analog and now I just keep Dropbox, wi-fi status, volume and the clock on the top bar. The digital clock distracts me more than the analog one (since I cannot see the exact time without clicking on it).

Automate what you can

I use Dropbox to automatically backup my dotfiles (/etc/apache2, .zsh*, .bash*, .ssh/config, etc), ebooks, pictures and other important files automatically - it’s really cool that you can use symlinks instead of copying / pasting.

I also schedule tasks using Things so I always remember to do repeating tasks and stuff in my calendar.

Don’t use IM

Most of the time I don’t use any IM software. I have google talk and skype accounts, but I only use it to talk to my co-workers (when I really need it). I think that a good (and short) meeting at the beginning or at the end of the day is way better then staying online all day on google talk, for example.

This “rule” have at least two good exceptions: Skype (for pair-programming) and IRC. IRC it’s nice because you don’t get windows jumping on your face and you can give attention to it when you want; also reading the logs is easier than on Skype.

I’m working on a project with a friend and usually we don’t work at the same time, so IM don’t work well. We’re using the Co-op app, a twitter-like application with cool additions like a solo / group agenda to communicate about the project.

Take breaks

When you simply can’t work on something, try taking a break away from keyboard. Sometimes I feel my concentration going away because I’m too tired, so I take a break, drink some water (or tea, caffeine FTW) and just rest for some minutes. Sometimes a “power nap” is a good idea too, if you don’t overdo it.

Installing Erlang, Yaws and Erlyweb on Mac OS X

This is a short how-to showing how to install Erlang, Yaws and Erlyweb on Mac OS X via MacPorts.

First we need to install Erlang and Yaws and link Yaws under erlang/lib:

$ sudo port install erlang yaws
$ sudo ln -sf /opt/local/lib/yaws /opt/local/lib/erlang/lib/yaws

Then we append erlang/bin to the PATH env variable (you can put this on your ~/.bashrc file):

$ export PATH=/opt/local/lib/erlang/bin:$PATH

And finally we install Erlyweb:

$ git clone git://github.com/dirceu/erlyweb.git
$ cd erlyweb ; make ; sudo make install
$ cd .. ; rm -rf erlyweb

My fork of Erlyweb contains some changes I did today:

  • "make install" creates a create_erlyweb_app.sh under erlang/bin. It's just a link to erlyweb/scripts/create_app.sh and takes two arguments: AppName and AppDir;
  • erlyweb_util:create_app/2 now creates a "log" directory (for Yaws log files) and a ready-to-run yaws.conf file.

With this changes you can create and run a simple application using:

$ mkdir -p ~/apps/myapp
$ create_erlyweb_app.sh myapp ~/apps
$ cd ~/apps/myapp
$ yaws --conf yaws.conf

I'm a Mac (again)

Almost three years ago my boss sent me an iBook G4 to work with. It was an absolutely awesome machine: fast, great battery life, beautiful hardware, beautiful OS. I loved it, but after 1,5 years using it some problems arise.

First, the battery just died - it just worked when connected to the charger. Second, I work(ed) with Zope and Plone on a daily basis, and things like running the entire gocept.zeoraid test suite took about 40 minutes. Even PloneTestCase with some functional tests was painfully slow. A Macbook was too expensive for me at that time, but I needed a new laptop.

Linux

Before using that iBook I used Linux for almost 4 years, so I brought an inexpensive laptop to run Linux. The laptop has an Intel Core 2 Duo 1.66GHz, 2 GB of RAM and 120 GB of disk space - a reasonably good machine, except for the video and the wireless card. It took me almost 6 hours to install Ubuntu on that laptop (which came with Satux Linux installed by default) and much, much more time to get everything right.

I was reasonably happy with that setup, but every now and then I needed to fix something in the OS. One day I decided to buy a second monitor, and so I did it. Big mistake.

Windows

It seems that the SiS Mirage 3 video card is a Windows fanboy and I couldn’t get the new monitor to work with Linux. It worked out of the box with an Asus eeePC running eeeBuntu, but not on my laptop. Damn it. After that and some other minor annoyances I decided to give Windows Vista a try, following some advice from Sidnei.

Windows Vista surprised me. It’s a good OS, every piece of hardware on my machine worked without “serious” configuration. As I can’t live without a Unix I installed andLinux, but it was not enough: using Linux to manipulate a NTFS filesystem is a PITA.

Mac OS X - Again

After so much trouble I realized I was losing time with all these annoyances; then I saved money, did some freelance work on my spare time and voila: last week I brought a white Macbook.

I can’t tell you how much I’m happy with it. It took me less than 1 hour to download and install every application that I need - well, almost all of them, since XCode is really big and the download took almost 2 hours itself.

One good surprise is XCode / iPhone Simulator. XCode is a very good IDE and it’s been a lot of fun to learn Objective-C and how to develop iPhone applications.

If you need to buy some tool (be it hardware or software), buy the best tool your money can buy. Some programmers hesitate to spend some money on a good chair, on a good editor or on a good computer (like me, before all this) but damn, we spend 8-12 hours a day using these things! Every single thing that can save you time or give you more comfort is worth it.

I have a profile on iUseThis that shows the apps that I have on my Mac. If you have any recomendations please leave a comment!