Friday, December 20, 2013

Python - The One True Language

I find it interesting when people bad-mouth Python - To the point where I felt the need to write this little blog article.

First, I need to state the obvious - Python is the 'One True Language'.  :-)

I say that as someone who boot-strapped himself from Commodore BASIC (PET, not that fancy C64 thing), to MS-Basic, to Turbo C. Many an hour was logged in front of this little window..

Sexy IDE for 1987

C was clearly my first true love (well perhaps Angeline who sat in front of me in Gr. 7, but she never responded to me like an 16550 UART call in C did). Compared to the other languages at the time, it gave you incredible power, without the difficulty of ASM.

I've had the (mis?)fortune to have programmed in just about every popular language at one time of another in my 30+ year career, and I must say Python is the first language that usurped C's place in my heart.

My only regret is that I didn't try Python earlier.

A few years ago I had a choice to make between Perl and Python as my next scripting language for Unix tasks that were too complex for shells or PHP, and I made the choice to go for Perl, as evidenced by the 2006 receipt still in my O'Riley Programming Perl book on my shelf.

At the time it was a close call; Perl had more popularity, and looked to be continuing to grow. This was an important point when you want to invest time in a new language (anyone remember the D Language?).  I also think I liked the camel on the Perl book cover more than the python as well... who was into snakes? (I did not realize the Monty Python reference at the time). These things do matter when you're down to brass tacks.

So the books were purchased and well read, and a few years were spent in Perl. 

I enjoyed the C-like syntax, and relaxed feel. However, it wasn't everything that I wanted.. and I'm not sure exactly how I stumbled on Python again, nor what the light bulb moment was - I worked a lot back then, so memories are fuzzy. Something was lacking, something kept me driving forward into new languages.

Whatever made me stop and reconsider, I must say I'm very happy to be in Python now - and nearly 100% of what I write today is Python.

I need a bit of Javascript for DOM work, and a bit of C for some very heavy transactional stuff, but even some of my stress tests and message passing routines are now Python.

Why do I bring this up?

I feel a number of programmers looking at Perl/Puby/Python may fall into the same situation, even today when the Python community continues to gather strength.  No one is really out there bashing Perl or Ruby, but Python has it's haters.

Some people love to badmouth Python.. I don't really understand them - I think it must be a machismo thing. The fact that it's an interpreter, and that it doesn't thread well (you shouldn't use threads boys.. that' 1990's tech) seem to enrage some.

If you're considering investing time into Python or XYZ, then my suggestion is to take the time to try Python first. I'm not going to get into a pointed discussion on the pros and cons of the various languages - That's covered in detail across the web.

Instead I'll state: They are all good languages, but if you take the time to learn Python and really 'drink the kool-aid', I think you will be rewarded.

Python brings a joy back into programming that I haven't felt since I used to sit in front of that little Turbo C IDE back in 1988. I've hit a productivity level that is a career milestone thanks to Python.

Next: PyCharm - The Turbo C IDE for Python. :-)

PS - I predict an OS entirely in Python soon - Obviously with a special interpreter, but it will be here. 

Wednesday, December 11, 2013

FreeBSD 9.1 to 9.2 Upgrade with freebsd-update

FreeBSD 9.2 brings a very nice update to ZFS : LZ4 compression.  Upgrading from 9.1 to 9.2 is quite easy if you have a standard install (no customization of the code).

The basic process, which should work for other versions as well is this:

1) Get your system up-to-date with the latest patches for your version of FreeBSD. This isn't necessary, but I think may avoid some problems.

freebsd-update fetch
freebsd-update install

2) Upgrade the kernel

freebsd-update upgrade -r 9.2-RELEASE
freebsd-update install

3) Update userland (finishes off the 2 part install)

freebsd-update install

4) Update pkg if needed

pkg update

5) Enjoy

With my 9.1 -> 9.2 update, I didn't have any messy mergemaster conf files to pour through, nor did my packages notify me that I needed to upgrade them - One of the more painless upgrades I've made.

pkg - FreeBSD's new Package Manager is Finally Working

I was about to write a small entry about how to hook up FreeBSD's next-generation package manager (pkg) to PC-BSD's repository, as FreeBSD wasn't supplying package updates due to the security incident that occurred in Nov 2012.

However, pkg is now able to pull properly from FreeBSD sources, and it's a nice little program.

For all those still using the old pkg_* type tools, just type pkg and follow the prompts.

So far I am finding it easier to upgrade and maintain my packages with pkg, which is always a good thing.