Great Erlang Secrets : Inheritance (1 of ?)

A little discussed capability of Erlang is module inheritance:


foo() -> ok.

The module can be subclassed by the using the attribute “-extends(atom())” as follows.

foo() -> fail.
bar() -> BASE:foo().

As a result, submod exports foo/0 and bar/0.  Moreover submod overrides function foo, the compiler follows a predictable search path from child to parent etc when binding functions.   This strategy is made even more useful by declaring a parameterized module:

  1. to get access to ancestor declared functions, subclasses must be declared as parameterized modules – even if no parameters are bound.  e.g. -module(mymodule,[]).
  2. By parameterizing the module, two hidden parameters are bound to all subclass functions declared:
    1. BASE : a reference to the base module implementation.
    2. THIS : a reference to the current module’s implementation

Here’s a few links for further reading:

Posted in Erlang | Leave a comment

Erlang Activities

Tonight I’ve been thinking about a couple of different Erlang problems.

The first was injecting a supervisor to manage session processes.  Pretty straight-forward just needed a little more reading on my part.

Second was a broader, more tricky question – how do Erlang nodes find each other and discover what role they play?

There are a few different schools of thought on discovery:

  • Broadcast announcement – use a connectionless channel like UDP
  • Announcement via well-known node – requires configuration of a well-known name, and possible single point of failure.

And a couple of different ways of enlisting nodes in behaviours:

  • Physical map of node -> role assignment
  • Automatic enlistment of nodes into a homogenous system

Currently read riak_core written by Basho.  While reading the code I became interested in net_kernel:monitor_nodes This lead me to a really great presentation by Erlang Factory on real world experiences using Erlang in live operations

More Tomorrow…

Posted in Erlang | Leave a comment

Blog Migration and Service Sunset

The recent announcement of pending possible doom for reminded me that I should move my somewhat dormant blog away from Spaces before it went boom too.

It seems so easy to assume that the digital landfill will exist for ever.  However, unless your bits are observed by – like my first recorded missives for – their lifetime may well be considerably less.

Posted in Uncategorized | 2 Comments

Installing Ubuntu from PXE / Network Boot

I decided to get an old Toshiba laptop without CD or Floppy back up and running again.  It can do USB-Floppy boot – but that is so messy.  Decided to use Tosh’s BIOS support for PXE boot instead.  On the Tosh you can press F12 or configure in BIOS to network boot.

Network boot uses a system called PXE (Preboot EXecution Environment) which is a configured combination of DHCP and TFTP servers to publish boot images on a network.  I’ve got a handful of machines running various operating systems combined with a WRT54G already running DHCP on the network. I decided use my Vista desktop on the basis of a decent keyboard and monitor to use while researching how to do it.

Ubuntu Netboot Install

While in the past it has been a PITA to create a network build for any Linux install, every Ubuntu build now has an equivalent netboot.  Get the Ubuntu Intrepid version here…

Copy this whole directory and subdirectories.

Configuring TFTP and DHCP

The shortest path to get to a working DHCP and TFTP installation for Windows is probably Philippe Jounin’s TFTPD32 program.

I left the DHCP service running on the network router – though they’d tussle a little, only one would have a TFTP resolution.

Took only a short while to setup the DHCP pool -but I ran into a wierd issue where the MAC address 46-46-3A-46-46-3A was stealing all the addresses in the pool.  DHCP Server tab showed all addresses allocated to the same MAC address, and Syslog showed that it saw the booting machine’s DHCP/PXE discovery ping, but there were no addresses to assign.  Unchecking “Ping Address before assignment” appeared to resolve that issue. 

I set the base directory to the location where I downloaded the netboot files, the rest of the settings were configured as follows:

With the allocation problem resolved the netboot process worked a charm – Ubuntu started installed. Tags: ,,,,

Posted in Uncategorized | Leave a comment

MYSQL x64 + Rails issue.

Been playing around with OS/X, Ruby on Rails and recently installed Activestate Komodo – but ran into a crazy issue where mongrel choked on the 1st request.

  dyld: lazy symbol binding failed: Symbol not found: _mysql_init 
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Expected in: dynamic lookup

  dyld: Symbol not found: _mysql_init
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Expected in: dynamic lookup

Reading around on the web, plenty of folk had encountered the error. Lots of search hits out there.

Originally found Benjamin’s Post on his steps to cure the issue. (diagnosed that the bundle was built with the wrong CPU architecture) I couldn’t get the ARCHFLAG environment variable to work with gem however.

Turned out the problem was much simpler to solve tho’.Careful examination of the error message and the comparison with the gem directory showed a duplicate version of the mysql.bundle in:


Was toying with rebuilding the whole gem from scratch when I stumbled across Leonardo’s blog post on the subject. Deleting this bundle restored status quo – thanks Leonardo!

Posted in Uncategorized | Leave a comment

Installing Windows Server 2008 on Santa Rosa Macbook Pro

Log of installing Windows Server 2008 onto my new Macbook
  • Brand new 4gb 2.6Ghz Mac Book Pro 17"
  • Ran Boot Camp Assistant – split default partition into equal halves
  • Inserted Win2k8 CD and clicked start installation, failed 1st time – the drive wasn’t ready (burned media – slow detection).  Left it a couple of seconds until the icon showed on the desktop – clicked start again, worked this time.
  • Mac rebooted and started the Windows boot sequence from CD.
  • Grabbed product key from key distribution while installer ran.
  • Installed really quick – about 20mins for Enterprise edition.
  • Rebooted – setup completed steps
  • Rebooted again.
  • Running Win2k8 – showed 4gb RAM, screen defaulted to 800×600, but right-click soon fixed that
  • Some drivers worked out of the box, but inserted disk #1 – Apple Driver Setup had a load of x64 drivers on disk.
  • Apple Boot Camp updater detected BC2.1 and downloaded it – another 200+ meg and a pending reboot
  • Bunch of hotfixes from SoftDist also installed – around 100mb of updates.
  • Another reboot.  Noticed that wireless wasn’t working.  (Tried to enable it but it stayed disabled)
  • Remembered that Wireless (and Desktop UX) features are not installed by default – Added feature from Server Manager (and a bunch of stuff like IIS)
  • More reboot
  • Configured WiFi services to autostart, suppressed a bunch of other services.
  • Installed VS2008
  • Computer ready for use – Win2k8 is really fast on this machine…

Installation was surprisingly painless.  Looking forward to trying to boot partition from VMWare Fusion

Posted in Uncategorized | 2 Comments

Ladies and Gents – Check your security…

While reading a Mac site about the recent Leopard launch I noticed an interesting comment – paraphrased "oddly Leopard turned off my firewall during upgrade"

I went and checked the state of my firewall too – equally oddly after upgrade my firewall was silently disabled too (this was definitely enabled prior to upgrade).

"Mac zealot" naysayers could leap in here and call it unnecessary – it call it defense in depth against possible exploits on public networks like WiFi nodes.

Bad job Apple…

Posted in Computers and Internet | Leave a comment