More permanent stuff at http://www.dusbabek.org/~garyd

14 June 2009

Simplifying the Trip

Our vacation starts soon.  We're going some place far away by way of jet. 

We've had a Sony MiniDV camcorder for almost 10 years.  It still functions perfectly, but with four children in tow, it has started to feel more like an anchor than anything else.  The bug bit last summer and I bought a smallish camcorder that recorded directly to a hard drive.  Two days later with a bit of buyers remorse and the utter realization that the camera was completely incompatible with the MacOS (even though the box claimed otherwise) I returned it.

I decided to be a bit more pragmatic about it this year.  After some reasearch I realized that I didn't want to spend good money on a small SD camcorder knowing that I would probably want a HD recorder in the next 5 years.  But I'm not ready for an HD recorder yet either (I don't have the storage capacity).

So what do I do?

It didn't take long for me to come across the Sony Webbie and the Flip Ultra HD.  These are small devices that record directly to flash in HD mpeg-4 format, priced in the $150-$200 range.  Now don't be fooled by the "HD" in the product names.  While both devices do record HD video, they do so using a codec that his highly compressed and lossy (think youtube HD quality).  They don't do well in low-light situations either.

All this got me to wondering what the video quality on my digital camera, a two year-old Sony DSC-T20, was like.  Turns out, it records 640x480 mpeg-4 at 30fps.  This falls in the range of "good enough for me" and it's technically HD like the Sony anf Flip.  After all, I'm not going to use it to record piano recitals, awards ceremonies or new babies.  I just need something good enough to capture the cute moments that I want to remember when I'm on a trip.  And let's face it--Nicole and I only ever go back and watch these videos once or twice a year anyway.  (Maybe they will become more important as we age.)

So it's settled--I'm going to use my digital camera to record video on this trip.  I did decide to spring for a larger memory stick though--8GB where there were only 2GB before, and a second battery for hot swapping.

Side question: I wonder how long before these devices converge?  Tangential jab: And will it include a cell phone and app store as well?

03 June 2009

Stupid CSS Tricks

I have recently made the committment to wrap my head around CSS.  In other words,  I'm tired of guessing.  Part of this experience will have me documenting my discoveries on this blog.

Here is what I learned today:

Pseudo-classes aren't just for anchors.

That's right.  You're supposed to be able to apply standard pseudo-classes to just about any selector you can come up with.  This means you don't to rely on a) jQuery or b) onmouseover/onmouseout to do the hover-effect work for you, so long as you can do it all in CSS.

Here is some sample code:

<html>
    <head>
        <style type="text/css">
  
        /* a class for an element */
        span.my_hover_class:hover {
            background-color:red;
            cursor:pointer;
        }

        /* attached to nested elements. */
        div > div > span > span:hover {
            background-color:green;
            cursor:pointer;
        }
 
        </style>
    </head>
    <body>
        <span class="my_hover_class">Should hover red (span.my_hover_class)</span>
  
        <div>
            Should not have hover effect.
            <div>
                <span><span>Should hover green (div>div>span>span)<span><span>
            </div>
        </div>
    </body>

</html>

I would like to show the effect here, but the Blogger editor insists on tidying up my pasted HTML.  I uploaded the file to my website.

This example was tested in Firefox and Safari on a Mac.

01 June 2009

Tagfriendly Updates, 1 Jun 2009

I've been quietly hacking away, albeit slowly, on the next iteration of my Tagfriendly project.  The back end is in a state I am happy with, so this version is all about making the front end suck less.

You can sample the work as it progresses at http://www.tagfriendly.com/tf2. This is truly alpha-quality work, lacking much in the way of CSS, but I link here because I know a few people follow this blog and are interested in it.  That, and since I'm not actively working on the current version, I feel the need to show something for my efforts.  :)  I push updated code live about once or twice a week.

I use more AJAX this time around, including fancy transitions and assembling the page in chunks.  I'm not sure if this is the right approach yet or not; I'll see how far it gets me.

In a few days I'll start work on the new player, now that I've discovered there is a published API for the Yahoo! Media Player (that is very hard to find via google).

And Now, A Completely Unrelated Gripe:

I offcially hate eBay.  I sell one or two items on eBay per year, so things are usually in a different place every time I need to sell something.  I can handle that, but two things tonight really bugged me.

1.  I could not find a way to sell my stuff without signing up for and agreeing to automatic payment of seller fees.  This needless hoop was in my face and prevented me from doing what I needed to do.

2.  I have an unopened seasons 1-5 boxed set of 7th Heaven that I want to get rid of.**  Well, in its wisdom, eBay has decided to cap shipping on DVDs at $3.  In other words, I couldn't charge more than $3 if I wanted to.  But this boxed set weighs about 5 pounds and will easily cost me $6-7 ship.  I realize what they're trying to do, which is crack down on S+H abuse, but at what cost?  They know the exact item I'm selling because they had me enter the SKU.  They should know how much it weights and what it would cost to ship through various methods.  Total fail, eBay; it's craigslist from here on out.

**I really thought Nicole liked the show and it would make an excellent Christmas gift.  It turns out she only watches the show on Myth because she can skip the commercials and watch it at 150% speed.  Total fail, Gary.

30 May 2009

I don't blog about music as much as I would like.  I used to do it a lot.

I listen to music all day, just about every day.  I subscribe to *a lot* of music blogs.  So much that I decided to create my own blog aggregator to help me keep track of things (Tagfriendly.com, for those of you who haven't been there yet.  You can create music-related RSS feeds based on your own search criteria.).

So the problem is not that I have little to say about new music, or the music scene in general, but that I have *so much* to say.  If I didn't have to make a living doing Other Things, I could write about music (not that anybody would care to read it) all day, every day.  Watching the indie scene blossom over the last five or six years with the help of the Internet has been a special thing for me.  I listen to more music now than I ever have.  And hey, record executives: I buy more music than I ever did too (my wife will attest).  Even so, I know that I am just moving slowly across one facet of a very large musical stone.  And that is a good thing--I won't be getting bored any time soon.

To that end, I have decided to carve out a few minutes each day and devote them to writing about music.  Some of it will end up on this here blog, hopefully as entries about new music, or music that is at least new to me.

Let's get started...

Some good music that you're probably not listening to

"Oh My God" by Ida Maria
I thought it was Clap Your Hands Say Yeah at first, but it wasn't.  This is an honest song sung urgently almost desperately, and right on the verge of losing it.  "oh you think I'm in control... oh you think it's all for fun".  Moving and tender ("find a cure for my life... put a price on my soul"), but dishing it out at the same time.  This is the kind of song that makes it hard to stay in my chair.  (wikipedia link)   

"In the Night" by Basia Bulat
That is the sound of an autoharp, if you're wondering.  Organic and edgy, pop-folk for the aughts (what will we call this decade?).  I've been saying for several years now that the best new music is coming out of Scotland and Canada.  Bulat represents the latter, hailing from Ontario.  I like this song because it makes me feel good.  It carries a message about rising up above struggles ("Storm and shadows fall to pieces / to my heart like a comet / carry so that I can / soar like an eagle").  And while it's still possible for struggles to keep us down ("sometimes it takes the night to fall"), it doesn't have to be that way all the time.  (wikipedia link)

"New Moon" by Sambassadeur
When it comes to twee, you can't beat Tweeden.  Er... Sweden.  Sambassadeur are utterly forgettable, but still very pleasant (think: "spring time").  Proof that good music doesn't have to captivate or mesmerize; it just has to not make me throw up in my mouth.  I really don't know much about this band.  I suppose they are few Swedish twenty-somethings who will be around for a few years before moving on to meatier projects.  (wikipedia link)

21 May 2009

Yes Virginia, there is a garden...

So many domestic projects and assignments lately leaves little time for writing about other things.  Some of those projects have me out in the yard though, so things could be worse.

During the first week in April I started making trips to the garden to assess things.  To my surprise, I discovered that my artichokes from last year survived the winter.  (Look at the picture!)

I first planted artichokes three seasons ago.  Starting from seeds I ended up with two plants that year.  Neither of them flowered though.  I knew that it would take two seasons for the plants to mature, so I bedded them down well (I thought) and let them have the winter off.

They died.

So I started the process over last year.  For some reason I ended up with a lot more plants.  Seven of them.  Every seed I planted (from the same seed pouch as the year before) germinated.  The season ended, winter came and I bedded the plants down again.  I used newspaper and tree leaves, same as I did the year before.

They made it this time.  This means that I should have a really good crop of artichokes this year.  Nicole and I are both looking forward to them.

I planted corn this year, for the first time ever.  Normally I skip corn because it is so easy to buy and, to be honest, it would block out a lot of sun other plants in my garden could be using.  To keep me interested, I opted for an heirloom popcorn with a shorter habit.  The kids are really digging the fact that we are growing popcorn in our garden this year.  I noticed the first shoots (corn is a monocot!) poking up on Monday.

Beans are in the ground, a week late, but should be sprouting any time now.  Bush beans this year--I'm tired of managing the trellis.

Peas were planted at the end of April and are about a foot tall now.

I had to buy tomato starts for the first time in four or five years.  I started my seeds in peat pellets as I normally do.  Then I transformed them to styrofoam cups filled with a starter mix, again, as I normally do.  I couldn't find my usual starter mix, so I had to use an off brand.  That was a mistake.  The transplants struggled after that, and really struggled when I began to harden them off a few weeks later.  I've all but given up on them now.

We're doing several different kinds of winter squash this year.  Giant pumpkins too.  The aim this year is to keep it low maintenance, as we're taking a looooooong vacation in the middle of the summer.  Hopefully it will take care of itself, so long as the watering system holds out.

05 May 2009

Tweets and Scrobbling

My hobby site, Tagfriendly, got with the times last weekend and started using Twitter.  It tweets new songs as they are found, at a rate of once every 5 minutes.

Kind of noisy I thought, until people started following.  TF followers are, for the most part, record labels.  But there are others who are just interested, and others who are just... well, I'm not sure.  I'm still trying to figure out how the underbelly of Twitter operates.

I also took time to get some deeper Last.fm integration put together.  If you allow it, Tagfriendly can scrobble the songs you love/ban while you are listening to them inside of the TF player.  My next step is to give the TF player some UI love so that it can pop out to be its own window and do a few other fancy things. 

I took a quick peek to see what it would take to scrobble all songs played, but it would require the user to give TF his password.  I'm not comfortable with that, so until there is another way, TF won't be scrobbling played tracks.

I'm going to focus a bit more on the player, as I think it can make the site more fun.

14 April 2009

Hacking the Yahoo! Media Player

I've been using the Yahoo! Media Player to stream Mp3s at Tagfriendly.  Minor glitches aside*, the only real complaints I have is that it isn't skinnable and there is no public API.

About a month ago I started prodding it to see what would make it squeak.  This post documents some of what I've found.

Disclaimer: I skimmed over the YMP terms of service and don't believe I'm breaking any of the rules.  You should also know that YMP is a) beta software, and b) a hosted application.  This means that any code you write or use that relies on specific methods or objects will be brittle and prone to breaking when Yahoo! releases updates.  That said, you're on your own; I didn't make you do anything.

YMP is one of those nifty internet tools you can use by simply embedding a <script> element in your markup.  If the page you've embedded it in contains links to mp3s, or if it links to an XSPF playlist, YMP picks it up and makes those MP3s streamable.  This is powerful if you're a non-technical blogger and want to have an embedded player on your site.

My aim is to leverage all of that, but to take the Yahoo! face off and give it my own.  I use jQuery to manipulate the Tagfriendly DOM, but really, any decent JS toolkit should allow you to get the same results.

The first thing you need to do is know when YMP is finished loading so that you can tell the UI to go away.  Due to the fact that the Javascript you embed includes a bootstrap that downloads other things, you can't count on YMP to be ready when your document is.  This is easily accomplished with a JS timer that polls to check whether or not YAHOO.MediaPlayer.setPlayerViewState is defined.  When it is, call YAHOO.MediaPlayer.setPlayerViewState(YAHOO.mediaplayer.View.DisplayState.HIDDEN); to make the YMP user interface go away.

Now you are in the drivers set to start working with the MediaPlayer object.  Here are some useful methods:

YAHOO.MediaPlayer.getTrackPosition()
     Gets the position offset (in seconds) of the currently playing (or paused) track.

YAHOO.MediaPlayer.getTrackDuration()
     Gets the track duration (in seconds).  YMP appears to grab this from ID3 tags in the mp3, so you can't always count on this piece of data to be there.

YAHOO.MediaPlayer.play()
     Tells the player to play the currently queued song.

YAHOO.MediaPlayer.pause()
     Tells the player to pause the currently playing song.

YAHOO.MediaPlayer.previous()
     Go back to the previous song.

YAHOO.MediaPlayer.controller.EventManager.onNextRequest.fire()
     I found it odd that there was no YAHOO.MediaPlayer.next() method.  This method does what you expect the non-existent next() would.  There are corresponding fire() objects for play, pause and previous as well.

YAHOO.MediaPlayer.getMetaData()   
     Returns an object that describes the currently queued song.  Useful properties there, gathered from ID3 and the XSPF, include 'title' and 'artistName'.  There're more if you care to look.

That's basically it--all you need to subvert the YMP UI and handle things your own way.  This really is a guerrila API hack, as I don't think the YMP designers intended a public API.  You can see the results  on the front page of Tagfriendly.  I went as far as providing a progress bar that gets updated as the song plays.  The Javascript source is freely available too.

In the future I plan on displaying cover art and linking the songs to their Tagfriendly description pages as well as to music stores.



* I suppose not so minor because it really bothers me:  YMP breaks down when you try to use a locally hosted XSPF file or the machine it is hosted on is stuck behind NAT.  Firebug reports that YMP executes a GET with the URI to the XSPF.  The backend of that GET does some data-munging of the XSPF contents.  The results contain a basic JSONified playlist.  The only problem is that if the [development] server that hosts the XSPF is behind NAT, that backend can't fetch anything.