The secret of change is ...

“The secret of change is to focus all of your energy, not on fighting the old, but on building the new.”

~ Socrates

How to create a Scala ArrayBuffer (syntax)

As a quick note, this is the syntax for creating a Scala ArrayBuffer:

import scala.collection.mutable.ArrayBuffer

val fruits = ArrayBuffer[String]()
val ints = ArrayBuffer[Int]()

The key thing to know is that the keyword new is not required before the ArrayBuffer. (This is because ArrayBuffer is either defined as a case class, or because it has an apply method defined. I haven’t looked at its source code to know which approach is taken.)

How to create Scala object instances without using the “new” keyword (apply)

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 6.8, “How to create object instances without using the 'new' keyword.”


You’ve seen that Scala code looks cleaner when you don’t always have to use the new keyword to create a new instance of a class, like this:

val a = Array(Person("John"), Person("Paul"))

So you want to know how to write your code to make your classes work like this.

What's new in Scala 2.10

Just a quick note that Scala 2.10.0 was released recently, and the following page, Scala 2.10.0 now available, contains a nice summary of what's new in the official Scala 2.10 release. The short list of new features includes:

Surviving the Drupal learning curve (learning cliff)

Learning Drupal: I read someone recently refer to the Drupal learning curve as the "Drupal learning cliff", which is actually very appropriate. While a content management system like Wordpress seems to come out of the box ready to go, even with Drupal 7 you need to add your own WYSIWYG HTML editor, Media plugins, page title modules, and more, just to get a basic Drupal website off the ground. Things like this leave a new Drupal user scratching their head and asking "Why?"

How some people always seem to know about new software releases

It used to really amaze me that some people always knew immediately when there were new updates to software applications -- and this goes back to the old days when many applications weren't self-updating. I always wondered how they knew about these software updates so fast. With today's RSS feeds it's pretty easy.

How do I access a MySQL database with the MySQL command line client?

I may have shown this before in other ways, but I wanted to take a moment to show how to use a MySQL database from the MySQL command line client. The basic command to work with an existing database is the use command, where you say something like this:

mysql> use my_database

For instance, if you have a database named orders, you would declare that you want to start working with it (use it) like this:

MySQL FAQ: How do I show the fields or schema of a database table?

MySQL FAQ: How do I show the schema of a MySQL database table?

Answer: Use the desc command from the MySQL command line client.

For instance, in my current application I have a database table named orders, and when I need to see the schema for that table I show it with the desc command like this:

desc orders

The MySQL output looks like this:

What's new: Apple iPhone 2.1 software update bug fixes

I was really surprised by the installation process of the Apple iPhone 2.1 software update. From my experience with Apple and Mac OS X, their installation process is usually extremely vague, essentially saying "There's an update for your software, and we recommend that you do this upgrade", and few other details are offered, even if you follow a URL they provide.