Hung Truong: The Blog!

  • June 06, 2009

    Shuffling and Randomizing Algorithms for Music Playlists

    picture-4

    I’ve been messing around with iTunes and the DJ functionality. It seems like all it does is pick random songs out of the library and shows them in the order they’ll be played (unlike shuffle, which just randomly jumps around). Typically, I like to put my iTunes library on random when I’m listening. This allows me to hear a bunch of different music in my library. If I don’t like a certain song, I’ll skip it, unless I’m not really paying attention.

    I find that the most important piece of metadata in my iTunes library is probably “play count.” This is a pretty good indicator of how much I like a song. It’s a bit off sometimes though, since I might really like a new song with a lower play count because I haven’t had a chance to listen to it 80 times. I use a smart playlist that sorts on “play count” to determine which songs to stick into my iPhone on sync since the phone can’t hold my entire music library. Generally it works well. Perhaps there could be another measure like “normalized play count” that takes into account how long the song has existed in my library.

    The iTunes DJ is pretty lacking in terms of how you can weigh what will randomly show up next. You can basically click a box that says “play higher rated songs more often.” I don’t rate my songs (the metadata gets thrown away pretty quickly as I move from computer to computer or Mac to PC, etc), so this feature doesn’t do a lot for me. I prefer the implicit rating (play count) versus the explicit rating (star rating) because the implicit way to do it is natural and doesn’t require me to do anything extra.

    I’d like there to be a “play songs with a higher play count more often” feature. This could be bad, though, because it’d lead to a sort of rich get richer deal. So weighting would be important. I’d say it’d be a good heuristic to give each song a probability of “(playcount + 1)/(total number of library plays + # of songs)” to be played. That way the more popular songs (the ones I like more) are played more often, but other songs still have a chance to be played as well (and skipped). There might be other better algorithms for weighing songs based on play count that don’t lead to an unnatural skew (which would mess up the point of having the feature in the first place).

    Another thing I could do is prune all of the songs I skip most out of my library. I’m too much of a digital packrat to do that, though, so I guess a smarter algorithm will have to suffice.

  • June 01, 2009

    Microsoft Bing

    bing

    So today, Microsoft unleashed its new search engine, Bing. Apparently it was gonna be called “Kumo” before that (which I liked more). Live.com just redirects to Bing now. First thought: Thanks for wasting the four letter URL namespace, Microsoft!

    Second thought: Bing.com basically looks like a re-named Live Search. People were talking about the mouse-over video search results starting automagically. I thought I saw that feature at the Microsoft booth at SXSW a few months ago. While I’m not totally familiar with the original features of Live Search, it really seems like this is just an incremental update, if not just a renaming.

    Giving the search engine a fair chance, I guess it’s okay. The search results for my name are good! First one is my blog and the second one is my portfolio. Microsoft also recognizes my Facebook profile as the real Hung Truong instead of that other car Hung Truong that Google links to. Another thing that’s kind of nice is that Bing actually links to the website directly in the search results. Try right click copying a search result link in Google and you get something like this:

    http://www.google.com/url?sa=t&source=web&ct=res&cd=2&url=http%3A%2F%2Fwww.hung-truong.com%2F&ei=1ZMkSv3gDonUNNfQvYYF&rct=j&q=hung+truong&usg=AFQjCNGifmoNxXdlqaiytpE2QMgHxLkl6A&sig2=Uj7WesESTLWJEXHkfqK2Fw

    The same thing in Bing is just:

    http://hung-truong.com/

    One more funny thing is that Bing is soooooo biased towards Microsoft, and you can tell already. Type the letter ‘w’ into Bing and the 7th auto-suggestion is “Windows Vista.” Google comes up with nothing MS related. The now famous example is that if you type “linux” you’ll get

    • linux windows
    • linux microsoft
    • linux vista

    WTF!? Despite the wonkiness, I hope Bing does well. Because someone’s gotta kick Google’s ass for the sake of competition. While I’d rather see it from an independent player, someone’s really gotta step up search and make it better. Actually, Yahoo is doing some neat stuff with semantic web thingies. Maybe MS and Yahoo can double-team Google or something.

  • June 01, 2009

    Funny Google Adsense Typo

    customer search

    I saw this on my Adsense page just now. I thought “Customer Search” was some kind of new feature where I could do a search for potential customers (advertisers) or maybe create a special search for customers.

    After clicking on it, it just takes me to the custom search page. So I think they meant “Custom Search” but someone typed “Customer Search” instead. This is funny (probably only to me) because it makes me think there might be three levels: Custom Search, Customer Search and Customest Search. Maybe there’s also a Customestest Search available after that.

  • May 25, 2009

    Prison Card Fight and Punishment!

    cards-as-weapons

    I had a dream that I was in prison for some reason. I guess the reason is irrelevant. I imagine I was innocent and was unfairly accused of committing some crime. Anyway, since weapons are not allowed in prison I decided I would carry a pack of playing cards around and I’d the use cards as some kind of shiv if I got into a tussle.

    I think the idea originates from when I read about a book (I think this was in some kind of magician’s manual) that explained it was possible to get so proficient at throwing cards that one could, if thrown with enough velocity, lodge a playing card into a watermelon. I’m not sure if this is even really possible. I should look it up or ask it as a reference question to a librarian.

    Okay, after a brief digression, I found the book: Cards as Weapons. But apparently it’s just a hoax/parody. Oh well.

    Anyway, back to the dream. As expected (think about Chekhov’s gun), I eventually got into a major prison fight using cards (my opponent also used cards to fight back). We actually fought with two cards in each hand, sort of knife style or something. The prison guard broke up the fight and had to punish us. This is where the story gets interesting. He used the face value of our cards to determine how severely to punish us! I have to hand it to my dream guard, he sure knows how to make things interesting. Is that just me complementing my own subconscious? I don’t know.

    The guard was gonna add up the value of the cards we used as weapons and probably put us in “the box” for a duration of time appropriate to the value of the hand. Or something. In the middle of the guard figuring out the value, I woke up. Good timing, I think.

  • May 23, 2009

    Mindset: The New Psychology of Success

    mindset-the-new-psychology-of-success

    A while back I wrote a post about rejection and how I dealt with it. I also mentioned a book that I had on hold at the library that seemed kinda related. I got the book and read about half of it. Then I got really busy and had to return the book. After putting it on hold again and getting it back I finished it. So here’s my thoughts (I’m totally a completist so I really have to read the ENTIRE book before I count it as finished).

    Mindset: The New Psychology of Success, has a really simple message behind it. Depending on your perspective, or “mindset” on life, you can really affect your own learning and personal growth. Basically, people with a “fixed” mindset believe that a person’s qualities are predetermined and set in stone. So people who are good at math won’t fail and those who are bad at math will never be good at it. Conversely, people with a “growth” mindset will understand that with practice and reflection, people can improve in just about any measurable quality. They see failure as a challenge and thrive on improving themselves rather than proving their superiority. (quick anime example: Rock Lee is totally growth and Sasuke is totally fixed)

    I suppose I’ve been trying hard to adapt to the growth mindset, even before reading this book (see this post for more on that). Previously I think I probably did have a sort of fixed mindset in that I felt I was pretty smart and got through all of high school fairly easily. In college I stumbled a little bit because Computer Science forced me to think in ways I wasn’t used to thinking. I came into an intro course that had hundreds of students of which, by the end, only a fraction remained. I made friends with a guy who had programmed all his life. Another one of my friends had never programmed before. The experienced guy did well on talent, my other friend dropped saying it was too hard and I had to work really hard to keep up. Though at the time I felt a bit inferior to everyone else because I actually had to study hard and struggle, looking back I’m really proud of what I accomplished. Computer Science courses basically taught me that with hard work, I could understand really complicated problems and work out solutions.

    As for the book itself, It’s very easy to read. In fact, I think it might be a little too easy to read. I think I spent too much time in the past two years reading nothing but academic papers. While I appreciate the colloquial language of the book, it feels sometimes like I’m being written down to. Also, some of the examples and suggestions seem really cheesy, for lack of a better word. Example: If your child displays a fixed mindset, turn dinner into a conversation on how each family member learned something. Soon the kid will be policing you and making sure you show a growth mindset! Sounds like a scene from Family Circus (not the Nietzsche version).

    I’d also have to say that the first few chapters really contain the meat of the book. They explain the two mindsets, give examples of each in action and spell out how each one affects a person’s outlook on learning and growth. After the third chapter or so, the book just goes into examples of the mindsets in different contexts: sports, business, relationships, parenting. A good deal of these chapters feels really redundant and a little boring, honestly. I guess they’re useful in reinforcing the ideas, but not completely necessary if you actually read the first three chapters. The last chapter is a workshop of sorts for changing your own mindset. I’d say it’s worth a read as well.

    Overall, I think the book is an interesting read and the concepts it introduces have a lot of potential. I wouldn’t label the book as self-help; it’s more of a psychology book that you can actually apply in your own life (sort of like Stumbling on Happiness). At the very least, it’s made me more perceptive of how I react to situations as well as how others around me react.