Monday, April 28, 2008

Coding Music

I love music as much as I love writing software, but I've found that most music is too distracting for listening while coding. Then I discovered ambient music. Like most music genres, the definition as to what constitutes ambient music is a bit fuzzy, but I would define it as music which is written to be heard, but not necessarily to be listened to. Very often, ambient is lumped into the category of new age music and indeed, some new age music is also ambient, but they aren't technically the same thing.

But I try to be practical, so if you are interested in exploring the genre, here are artists and albums I would recommend starting with:

(I've linked to the downloadable MP3 album on Amazon where possible; some albums aren't available in MP3 format, so I linked to the CD version. In some cases, these are available for download on the iTunes music store, but in keeping with my recent "no DRM" policy, I'm not linking to those...but just so you know, many of them are there.)
  • Brian Eno - Ambient 1/Music for Airports - Brian Eno is generally considered to be the father of modern ambient music and this album, released in 1977, is his first major work in the genre.
  • Brian Eno - Discreet Music - To be honest, I don't care for the B-sides on this album (variations on Pachelbel's famous Canon in D), but the 31-minute title track is worth the price.
  • Harold Budd and Brian Eno - Ambient 2/The Plateaux of Mirror - This time, Eno collaborates with another of the early ambient composers, Harold Budd (more on him later).
  • Harold Budd - The Room - Budd has a similar style to Eno, but different enough for variety. This is my favorite Harold Budd album.
  • Steve Roach - Dreamtime Return - Steve Roach is another giant of the genre, and this album would easily make most ambient fan's "top ten" list. This album has a more tribal, rhythmic sound than most of his work (or the rest of this list, for that matter), but is still beautiful. Unfortunately, Amazon doesn't seem to currently have this album in downloadable form.
  • Steve Roach - Structures from Silence - Another great album from Steve Roach. Again, this one isn't available in MP3 format, but Amazon does have the CD.
A few more that are a little less well-known, but I love nonetheless:
  • Deepspace - The Barometric Sea - This one lives a little closer to the "space music" corner of the ambient genre, but a great album.
  • Deuter - Earth Blue - Deuter usually lives in the meditative, "spiritual" area of the genre. All of their albums are good, but I have this album and like it, so I've included it.
  • Falling You - Touch - This isn't strictly an ambient album (some of the tracks actually have lyrics), but it is incredibly haunting and beautiful. One of my favorites.
  • Jon Serrie - Century Seasons - Jon Serrie specializes in space music. His work is so beautiful. This is a compilation album, but since Amazon does not carry it (the iTunes store does), I've linked to a page of his other downloadable albums.
  • Liquid Mind - I haven't linked to a specific album because, unfortunately, I think all of his stuff sounds pretty much the same. But that doesn't make it any less beautiful.
  • Michael Stearns - Encounter - This is my absolute favorite ambient album. Cold, distant, and haunting, I would describe this as an alien abduction set to music. When I was a kid living near Little Rock, I used to sit in bed at night listening to a local AM radio talk show about weird stuff like UFOs and space travel. The host used bits of this album as bumper music, so I would fall asleep with this in my head. I never knew the album title or Stearns' name until years later when I stumbled across it online and recognized the music from the title track. Amazon has the CD, but I believe iTunes has it in downloadable form if you want it right away. Great stuff, but oddly, none of Stearns' other music sounds like this.
  • Oƶphoi - Hymns to a Silent Sky - Amazon doesn't have this one at all, but iTunes does. Very strange name, but very nice music.
  • Paul Avgerinos - Sky of Grace - Another album I would put in the "not quite ambient" basket, but beautiful nonetheless.
Enjoy!

Wednesday, March 5, 2008

Where's My DataItem?

One of the most commonly-used patterns when developing with ASP.NET's data-bound controls is the idea of catching the control's RowDataBound or ItemDataBound event and customizing the display of that row/item in some way based on the data in the underlying data item:


protected void grdBallots_RowDataBound ( object sender, GridViewRowEventArgs e )

{

    
if ( e.Row.RowType == DataControlRowType.DataRow )

    {

        
DataRowView rowView = ( DataRowView ) e.Row.DataItem;



        
if ( rowView != null )

        {

            
// ...do customizations here...

        }

    }

}



One of the new server controls that is part of the recent v3.5 release of the .NET Framework is the ListView control. This control combines the templated flexibility of the older Repeater control with the power and ease of use of the GridView control. However, the first time you attempt to use the technique above to customize the way a particular item is displayed, you will notice that the ListViewItem object (obtained in the ItemDataBound event through the ListViewItemEventArgs.Item property) does not contain a reference to the DataItem. So how do you get a reference to the DataItem?

It turns out that an extra object layer has been added to the ListView control's class hierarchy:


protected void lvwFiles_ItemDataBound ( object sender, ListViewItemEventArgs e )

{

    
if ( e.Item.ItemType == ListViewItemType.DataItem )

    {

        
ListViewDataItem dataItem = ( ListViewDataItem) e.Item;

        
DataRowView fileData = ( DataRowView ) dataItem.DataItem;



        
if ( fileData != null )

        {

            
// ... do your customization here...

        }

    }

}



So there you go!