Sunday, December 23, 2007

Ubuntu 7.10 on Mac OS Lepord with Parallels

This is how I got Ubuntu 7.10 installed on my MacBook Pro running Parallels build 5582.

Start with the Ubuntu Alternate disc. NOT the Ubuntu Desktop or Server Disc!!

Setup a new virtual machine and make sure you pick 512 M for the amount of RAM. (There seems to be an issue when allocating larger amounts of memory, which will cause the VM will freeze on boot.)

Boot of the disc, and run through the installer. It will be the console based installer, not the fancy GUI installer, but it works just the same.

Towards the end of the installation you will be prompted to setup your xserver. Simply enter in the screen resolutions that you would like to have available.

I went into the System Preferences -> Display panel and just marked all of the resolutions that were listed there.

After the installer finishes, reboot, and you should be all set.

If you want, you can install the Parallels Tools. They will make the integration with the Mac OS a little nicer. I ran the provided installer, rebooted again, and everything worked fine.

Good Luck!

Tuesday, October 09, 2007

Asterisk "too may open files"

Another quick Asterisk pointer.

If you are running a large amount of traffic on your Asterisk box you are likely to come across this message.

"unable to create from pipe: too many open files"

What this means is that Asterisk has exceeded the per-process limit on open files.

You can get the per-process limit for you system by opening a shell and typing 'ulimit -n'. My system, Ubuntu 7.04 is set at 1024.

I find that the easiest way to set this is by opening the /usr/sbin/safe_asterisk script and finding the existing line 'ulimit -c unlimited', and adding a line below that of 'ulimit -n 65536'.

The safe_asterisk script is a script commonly used to launch Asterisk because it will also monitor and restart Asterisk if it crashes. So when you use it to launch Asterisk, the line we added will be executed and will increase the limit for Asterisk.

Please note that you should only need to do this on Asterisk 1.2 systems. On Asterisk 1.4, the safe_asterisk script has been modified to do this out of the box.


Friday, August 24, 2007

Python File Backup Script

I wrote this backup script in Python to do backups on some of the servers I maintain.

- simple & quick to configure & install
- full & incremental backups
- configurable backup directories
- configurable full backup dates
- backups in tar format, no special software for restores
- email notification of problems
- backup files to any valid path (nfs, smb, usb drive, etc...)

- python
- system supporting the tar command (linux, unix, cygwin, etc...)

For installation instructions or more information about the scripts check out the included README file. Scripts are released under the LGPL.

You can download them from here.


** UPDATE **

I've updated the link to a newer version (1.0.1). The original version was written to write backups to an external drive, so it assumed that the drive needed to be mounted first. If the drive was already mounted it would remount it. So I've added an option where you can now specify if the script should mount the drive first.

Sunday, July 22, 2007

Asterisk Ubuntu Feisty Fix

Starting Asterisk PBX: /usr/sbin/safe_asterisk: 108: Syntax error: Bad fd number

I ran into this issue while running Asterisk 1.2.22 on Ubuntu Feisty 7.04. It appears that the 'safe_asterisk' start-up script has an issue with it. In Ubuntu Feisty, the default shell (/bin/sh) is no longer bash, it is dash. The 'safe_asterisk' script needs to reference bash. So changing the first line from '#!/bin/sh' to '#!/bin/bash' fixes the issue.

Hope this helps someone.

Friday, March 09, 2007

FizzBuzz Problem

This has been on digg recently and there was some talk about it recently at work.

If you are interviewing someone and need a programming question to ask, this is a good one. Any competent programmer should be able to give you a solution.
This puzzle is typically given to all levels of programming candidates (newbie to senior) during their interview. According to numerous people, only about 10% of the programmers can pass it (even the seniors). Can you? (hint… its actually not that hard if you figure out the key).


Write a (substitute language here) program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
The problem is actually simple and has a simple strait forward solution, which is what makes it such a good question to ask.

A simple solution would be to setup a loop from 1 through 100, checking for numbers that are divisible by 3, 5, or both and printing the correct output.

Since taking the simple solution is boring, here's a python solution that I came up with that is only one line long.

print "\n".join([((num % 3 == 0) and (num % 5 == 0)) and 'FizzBuzz' or (num % 3 == 0) and 'Fizz' or (num % 5 == 0) and 'Buzz' or str(num) for num in range(1, 101)])

Anyway, if you think you have a cool solution post it here.


Friday, January 19, 2007

CodeMash 2007 Follow Up

Here's my wrap up on CodeMash 2007.

First, let me just say, props to the individuals (organizers, event staff, and presenters) who took part in the event. Also thanks to the sponsors who paid the bulk of the money that made the event happen. I had a blast and learned a ton.

In case you couldn't go, I was able to record the presentations that I went to. The quality isn't great, but you can hear what is being said without too much difficulty.

Here are the links.

Day 1

  1. Keynote - Domain-Specific Languages and Their Roles in the Evolution of the Programming Paradigm presented by Neal Ford.

  2. Maximum Velocity with MySQL presented by Jay Pipes

  3. The End of Tier-Based Architecture presented by Owen Taylor

  4. KeyNote - The World is Dynamic presented by Bruce Eckel

Day 2

  1. SOA: Next Wave of Enterprise Development or Return of the Son of CORBA? presented by Neal Ford

  2. Selenium Radically Simplified Testing Websites presented by Eric Pugh

  3. The Productive Programmer presented by Neal Ford

  4. Improve Your Testing with Open Source Testing Tools presented by Jim Holmes.

I would highly recommend listening to "The Productive Programmer", I found it very informative.

Also, If anyone has or knows where to get recordings of the other presentations, please let me know. There were too many good presentations to attend all of them.

Lastly, I'm posting the recording on my own, and am assuming that the presenters will not mind. If you, the presenter, do not want them posted here please contact me and I will remove them.



Monday, January 08, 2007


CodeMash – I'll be there!

CodeMash is on January 18-19, 2007 at the Kalahari resort in Sandusky, Ohio. I would encourage anyone who can, to attend the event. There will be a wealth of programming knowledge available on topics including SOA, Java, EJB3, .NET, Python, PHP, and Ruby on Rails, and many other things. In addition, the Kalahari resort is an incredibly fun place to stay.

I'm planning to attend these sessions. Perhaps I will see you there.

Day 1

- Maximum Velocity with MySQL
- End of Tier-Based Architecture
- Building Enterprise Smart Clients using a Services Oriented Architecture
- Simplified Data Access With Spring

Day 2

- SOA: Son of CORBA
- Selenium radically simplifies testing Websites!
- The Productive Programmer
- Improve your testing with Open Source Testing Tools