Scratch Paper

September 26, 2008

Inhaling Water

Filed under: Uncategorized — Mark @ 8:05 pm

Today for the second Friday I went swimming instead of running.

Matt gave me some exercises to try so I can learn to crawl. The first one is to hold an arm out with the other arm at the waist, and just propel by kicking. This exercise helps me to learn to lean on one side, which is essential to moving forward effectively. Yet had there been any snails in the pool, they would have been angrily passing me while I blocked the lane. You put your head along your arm breathing out in the water, then roll your head to the side to breathe. Not only am I slow, but also my legs tend to sink. Feet left, head right, I’m like / in the water, when I should be like –.

The second exercise is the same as the first, except you take two strokes with the arm that would be at your waist. This way I move a bit faster. The problem is that I also inhale enough water to start drowning after about 15 meters.

At least it cannot get much worse.

September 22, 2008

Yahoo! JavaScript Media Player, part 3

Filed under: Uncategorized — Mark @ 7:26 am

Well, it seems that a few String.replaceAll() method calls to replace reserved and unsafe characters in the links fixed most of my problems. Feels like a bad hack, though, since I am sure to have missed a few.

I have tested on Mac, Solaris, Windows so far with Chrome, Firefox, IE7, Safari.

Some files seem to hang, at least in Chrome, with YMP. Not sure what’s going on there. QuickTime manages to play the files that hang in YMP.

Update: I think I have more or less fixed the first two problems from Yahoo! JavaScript Media Player, part 2. The third, regarding what to do with non .mp3 audio files, remains a real problem, however. YMP does not seem to handle .m4a or .wma files for example.

September 21, 2008

Yahoo! JavaScript Media Player, part 2

Filed under: Uncategorized — Mark @ 2:21 pm

Today I wasted some time writing a Java utility to populate my uploaded .mp3 audio collection with HTML pages letting me use Yahoo! Media Player. The songs are organized on disk as <Collection>/<Author>/<Album>/*.mp3.

If you want the code we can share. I’m still basking in the glow from SFD yesterday.

There are at least three bugs I’ve noticed in the last 5 minutes of using the results online:

  1. Songs with special characters in the names are not handled properly. For example, Mark Knopfler’s song Rüdiger does not play (or download, despite my attempt to make the links potable to a browser) in Safari at least.
  2. The links in the pages on the <Collection> and <Author> levels are not necessarily sorted.
  3. The program still adds directories for stuff not encoded as .mp3s.
The middle bug there should be easy to fix, but I need to go mow the lawn. 
Update: There’s a nice explanation from someone in Finland about how to handle the character encoding problem for HTML that seems to be causing the first bug I noticed. In a nutshell, specify UTF-8 in a meta tag.
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Further update: Uhh, well, that’s almost right. All the songs with ? in the name break… Looks like there’s still some URL encoding to do. URLEncoder does not do what I want it to, since using that class breaks all the links.
Maybe tomorrow I will find a good URL encoder in Java. Or I will find the time to write one.
I fixed the second issue, though, the one related to sorting. And refactored the code to make it less copy/pasty.

September 20, 2008

Yahoo! JavaScript Media Player

Filed under: Uncategorized — Mark @ 9:00 pm
Yahoo! Media Player screenshot

Yahoo! Media Player screenshot

Yahoo! bundled some JavaScript into a Media Player. Thanks. That was easier than creating a JavaScript thing to play mp3s myself.

The nice thing about the Yahoo! Media Player compared to the Delicious one is that it does it’s own playlist of all the songs in the page. So if you do not care that your playlist comes out in automatic sort order, you can just chuck a .cgi in the directory to build the HTML page. Here is an example that you can see in action at http://mcraig.org/lltt/:

#!/bin/bash
echo "Content-type: text/html"
echo
echo "<html>"
echo "<head>"
echo "<title>LLTT songs in progress</title>"
echo '<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script>'
echo "</head>"
echo "<body>"
echo "<h3>LLTT songs in progress</h3>"
for song in *.mp3
do
        anchor=`echo $song | sed -e "s/^/<a href=\"/" | sed -e "s/$/\">/"`
        echo $anchor $song "</a><br />"
done
echo "</body>"
echo "</html>"
echo

Not that you would actually want to listen to any of my stuff. But one might use this thing to store one’s music on the web. Behind password protection, of course, to avoid posting it to someone other than oneself.

September 9, 2008

Engineering For the Common Case

Filed under: Uncategorized — Mark @ 8:15 pm

Last week it rained heavily when I was out running up to Rochasson from work. My shoes were too soaked to dry in 2 days inside. They stank wretchedly. So I took the laces out and washed them in the machine this weekend. So far so good.

Monday noon I laced my shoes for a run. I was not in a great mood anyway, and the laces were too short (as always)! I thought, “Why skimp on shoelace length? Is ASICS so focused on their margin that they cannot afford to put full length laces in their shoes?”

But as I got up to run it slowly occurred to me that I have an unusual way of lacing my shoes. Notice in the above image that there seems to be an extra eyelet.

An athlete named Seb explained to me that runner who need as much stability as possible (most normal humans?) should run the lace first through that eyelet, then through the second-to-last eyelet, creating a loop. Then run each end of the lace through the loop on the opposite side. Finally tie the shoe.

If you do that, you really could use some extra shoelace. I can barely tie my running shoes. Yet I do not have wide feet. I don’t know what people with wide feet do.

If you run more than 20 miles per week, you will notice the difference tying your shoes the right way though. When you start tying your shoes properly you will wonder what you were doing running around before with your shoes practically untied.

ASICS and other shoe sellers engineered, however, for the common case. The common case is probably people running a few miles a week. Or even buying running shoes to loaf around in. If the laces were long enough for me, all those people would be wondering why they have to tie double knots and keep stepping on the ends of their shoelaces.

If software were running shoes, much of it would come not only with extra long laces but also with features like holes cut around the toe box to relieve pressure, odd orthopedic inserts that belong to someone else’s foot, and standard cushioning designed for people who change shoes every 4 months or 1000 miles, which ever comes first.

Powered by WordPress