Blogs

Scala tuple examples and syntax

Scala FAQ: Can you share some examples of using tuples in Scala?

A Scala tuple is a class that can contain a miscellaneous collection of elements. I like to think of them as a little bag or container you can use to hold things and pass them around.

You create a tuple with the following syntax, enclosing its elements in parentheses. Here's a tuple that contains an Int and a String:

How to create Mac ICNS files

Mac OS X programming FAQ: How can I create a Mac ICNS file for my Mac application?

Lately I've been creating a series of small Mac applications, and as part of that I needed to learn how to make Mac ICNS files from standard image files (PNG, JPG, other). Today I offer a quick tip of my hat to the makers of a Mac application named FastIcns that lets you do just this.

Free Mac OS X batch image resizing

Mac batch image resizing FAQ: How can I "batch resize" images (photos) on Mac OS X (for free, preferably)?

A long time ago I wrote about how to batch resize images on Mac OS X from the command line in my How to batch resize images on Mac OS X using ImageMagick. That approach is fine for techies who don't mind cracking open the Mac Terminal application, using the Unix command line to navigate to their folder, and then process their images. But what about regular Mac users, those who don't want to ever see a Mac Terminal window?

A terrific Model View Controller (MVC) diagram

Every once in a while when something hits you, you really remember it; it stands out in your mind as an "Aha" moment. One of those moments for me was when I saw a particular "Model/View/Controller" (MVC) diagram, and the light bulb went on. This diagram made the MVC pattern very simple, and I've never forgotten it.

New front page design

Just a quick note today that I'm slowly building a new front page design for this website. My goal is to create more of a "Tumblr" design, where I can list everything that's new on the front page, including blog posts, bookmarks, short text blurbs, source code snippets, and photos. At the moment, all that shows up on the front page are blog posts, so if you only see the front page, you're only getting a very small idea of "What's new" here.

Ophelia, by Natalie Merchant

As I turn this website from devdaily.com into the more personal alvinalexander.com, I'm sharing more personal information here as well. This includes my interests in music.

Lately I've been listening almost exclusively to the album Ophelia, by Natalie Merchant. Here are a few of my favorite tunes from that album:

Ophelia:

Kind and Generous:

Thinking about creating a mobile version of this website

After looking at my website (alvinalexander.com) yesterday on my iPad, I thought maybe I should create a custom version of the website for mobile devices. However, after looking at the stats, it appears that there's a 10:1 ratio of stationary devices to mobile devices, which you can see in this graphic, courtesy of Google Analytics:

A 'Ping Pong' Scala Akka actors example

Akka actors FAQ: Can you share an "Akka Actors 101" example (a simple "Introduction to Akka Actors" example)?

Sure. If you're looking for a really simple tutorial, check out my Akka Actors "Hello, world" tutorial. If that one is overly simplified and you want something more, continue on here.

Who's using Scala? (March, 2013)

Who's using Scala? With the recent blog post by LinkedIn (LinkedIn is using the Play Framework), showing that they're using the Play Framework, I thought I'd take a quick look at who we know is using Scala these days.

According to the Scala in the Enterprise page (and general knowledge), the following companies are using Scala:

Scala - Using tuples in an anonymous function

I just ran across this post about using tuples in an anonymous function, and thought it was good enough to reproduce here, with only the solution part.

In essence, the question is, if I have a Map like this, which is actually composed of tuples:

scala> val x = Map(1 -> "foo", 2 -> "bar")
x: scala.collection.immutable.Map[Int,String] = Map(1 -> foo, 2 -> bar)

how do I use each value in the tuples in an anonymous function?

Syndicate content