Opera/IE JavaScript Strings

Apparently, Opera and Internet Explorer don’t allow for subscript notation of characters in strings. I came across this while using the following idea: if ts[0] == "c"; Whereas, to work fully cross-browser, I needed to use the much uglier: if ts.slice(0,1) == "c"; I know which I prefer. • This was what was causing comments to have the link false at the bottom of them, rather than the much nicer 69 days, 41 hours after the fact. (These aren’t real links, so don’t stress if you cannot click on them!) If you notice any other strangeness with my blog, or my scripts, please let me know, so I can fix it.

iPod Freezes with 3.1.1 Firmware

I’ve had some serious issues with my iPod after updating to the latest iPod firmware (3.1.1). Basically, it keeps freezing, either when going into sleep mode, or coming out of sleep mode. It’s not possible to determine which of these it is, as there is nothing appearing on the screen when pressing any buttons, or plugging in the headphones. The only way to get the iPod back to normal is to do the two-finger reset: hold down _MENU _and _SELECT _for about 5 or so seconds. This then resets the iPod, and it boots up as normal. However, any information (like which songs and podcasts I listened to) is lost. Meaning I then need to remember which podcasts have been listened to, and remove them manually from the list. According to some web sources, this occurs only when having just listened to a podcast, but I don’t seem to be able to replicate that right now. I know it crashed last night after listening to an Audiobook, but I can’t recall if it ever happened after just plain music. However, I do know that this problem only reared it’s ugly head after updating to the 3.1.1 firmware. I wonder if it’s possible to downgrade iPod firmware? Apparently it’s just a matter of editing a value in iPod_Control/Device/Sysinfo, namely buildID, to a value less than the firmware you want to downgrade it to is. Of course, you’ll need the updater for that firmware version, too. If I keep having issues, I may have to try this. Update: This technique doesn’t work: or at least I couldn’t get it to work. I’ve just used Restore with an older updater, so I’ll see if that was the problem. I’m now using 3.1, but I’ve got to wait until all of my music re-syncs back to the iPod, as Restore ‘cleans’ the iPod.

Australia's Brainiest Radio Star

Tonight on Channel 10 (the only commercial TV station in Australia not to yet align itself with a web portal: c.f. nineMSN, yahoo7), we saw the premiere of the intellectually stimulating Australia’s Brainiest Radio Star at 7:30pm. I only saw the last two minutes, enough to see the winner fluke the last question. What I want to know is: where were Dr Karl and Adam Spencer, of Triple J/ABC Local Radio? Surely they have to be amongst the smartest Radio personalities. And Dr Karl is hardly not a star! The first question I saw was something about a cricket ball vs. a pendulum, asking the question a cricket ball has more degrees of … freedom. The joker answering got this wrong, which I’m fairly sure both of my champions would not have. The determinant question asked What is the correct term for a group of 7 musicians? The contestant ummed and aahed, before shakily guessing (correctly) a septet.

Mr. BojanglesRobbie WilliamsSwing When You’re Winning ★★½

PostSecret

I used to work at a Swimming Pool. I can category deny ever doing the following: We used Polywaffles! Just kidding. We had to fish it out when kids shat in the pool. And then just put more chlorine in. While we are on the toilet functions theme, this one caught my eye: It’s still a bodily function week: At last, something about non-bodily functions: Damn, these pretzels are making me thirsty.

Shell Calc

Whenever I need to do any calculations, I generally drop into python and do them from there. However, I came across a neat tip over on Mac Geekery: When You Need A Calculator. I’ve modified is ever so slightly so it goes into a .profile instead of a .bashrc:

    function calc
    {
        awk "BEGIN {print $* ; }"
    }

Sweet.

Styling Asides Differently

I thought I’d already written up a post on this, since I discovered it about a month ago, but apparently not. Blogsome has a nice little function called {is_asides}. It allows for easy alternate formatting of posts within a category called Asides. So, to have these fancy little numbers, the first thing you’ll need is an Asides category, with a post in it. Then, in your Post Template, try the following code: <div class="post {is_aside}{if $is_aside=='true'}Asides{/if}" id="post-{the_ID}"> This sets up the class of the post to also be Asides if it is in that category. I’ll make a note here that this could be done with any category, and just use {the_category seperator=" "}. This would allow alternate styling for any given category, but I wanted to use the {is_asides} Smarty function. That’s all of the code you need, the rest is just pure CSS. In my stylesheet, I have the following code, that looks after all of the Aside related stuff:

    .Asides
    {
        border:#E1D6c6 1px dashed;
        padding:6px;
    }
    .Asides .post-info
    {
        display:none;
    }
    .Asides .post-footer
    {
        background:none;
        padding-top:0px;
    }
    .Asides .post-content
    {
        border-top:none;
        padding:2px;
        background: url(/images/blockquote.gif) no-repeat left top;
    }

The first stanza sets up the border and layout for the actual post. The second hides all of the post-info, such as Date, Title, etc. I later decided to move the Comments Link, else there is no way to view/add comments. The third removes the fancy symbol that appears between posts, and the last one removes the line at the top, and puts some lovely quotes into the background. I’m still going to tweak this a little: on an individual post page, the next/previous post links overlap with the bottom of the border.

Time Flies like a Banana

A track just came onto my iTunes via Party Shuffle. It’s one I haven’t heard for a while, but reminded me of the time we went to see this band live. Especially notable, as it was at the Speigeltent, during the Adelaide Fringe Festival some years back, and it’s that time of the year again. It was, I believe, just before Derek left Adelaide for the big smoke of Sydney. Well, Wollongong, anyway. He did work in Sydney… Anyway, we went to see this band, on my birthday, and were the only customers there. That’s right, the whole venue was empty, and because of us, they had to perform. And there were good! I enjoyed them, and bought a CD. It’s about the only time I’ve ever bought a CD right after going to a gig. Maybe I felt a little sorry for them, maybe I didn’t. So, I just switched over to iTunes to see when the CD was released: 1999. That means it was probably 2000 when we went to see them. Six years ago. Has it been that long since Derek left? This is one of my favourite of the tracks on the album:

WishHoneyHoney ★★★★

More than anything, I wish that you were here; To laugh at all my fears; To hold me in your arms, and laugh at all my shame; And to love me still. But you’re gone and I hold my head down, And I wonder where you are; And I see you when I’m sleeping, babe; I Wish I’d Loved You, I Wish I’d Loved You, I Wish I’d Loved You More.

Here are some random links I found on Google about them: DM3, Honey @ Mojo’s Bar, September 25, 1999 Honey, Self-title album Review (This one I had to scroll back up a bit from the anchor point to read it, the link seems a bit broken.) I wonder if they are still together/performing/recording.

iTunes Discards Half Star Ratings

iTunes displays half-star ratings, and stores all ratings from 0-100, not just the full star value. However, if you Get Info on a file, and go into the Options tab, you will lose any non full-star rating information that is stored for this track.

Game Show HostLo-TelPlanet Of The Stereos ★★★

Better iTunes Data Insert

I’ve updated my Insert iTunes Data (HTML) script for generating a block of text that describes the current playing iTunes track. This version links to the iTunes Music Store, rather than Google. It is relatively smart, in that the track name link also has the artist name, and the album name does too, as long as the album isn’t a compilation. The only (slight) bug is that the track name seems to need to be just the way iTMS displays it, so having (Live) might stuff up a link. This might be only if there isn’t a Live version in the iTMS.

I Can’t Tell You Why (Live)EaglesHell Freezes Over ★★★★★

Code after the jump.

    -- Insert some data about the currently playing iTunes track into browser.
    
    property star : «data utxt2605» as Unicode text
    property half : «data utxt00BD» as Unicode text
    property quarter : «data utxt00BC» as Unicode text
    property threeq : «data utxt00BE» as Unicode text
    property browser : "Firefox"
    property URLprefix : "itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?"
    
    on run {}
    	
    	tell application "System Events"
    		try
    			get process "iTunes"
    		on error
    			return "No Track"
    		end try
    	end tell
    	
    	tell application "iTunes"
    		set theTrack to current track
    		set theArtist to artist of theTrack
    		set theAlbum to album of theTrack
    		set theRating to rating of theTrack
    		set theComp to compilation of theTrack
    		set theTrack to name of theTrack
    		--set trackInfo to {theTrack, theArtist, theAlbum, theRating}
    	end tell
    	
    	set trackLink to "<a href='" & URLprefix & "songTerm=" & HTMLify(theTrack) & "&amp;artistTerm=" & HTMLify(theArtist) & "'>" & theTrack & "</a>"
    	set artistLink to "<a href='" & URLprefix & "artistTerm=" & HTMLify(theArtist) & "'>" & theArtist & "</a>"
    	if theComp is true then
    		set theArtist to "" -- No Artist if album is compilation!
    	end if
    	set albumLink to "<a href='" & URLprefix & "albumTerm=" & HTMLify(theAlbum) & "&amp;artistTerm=" & HTMLify(theArtist) & "'>" & theAlbum & "</a>"
    	
    	set theString to "<p class='itunes'> " & trackLink & " • " & artistLink & " • " & albumLink & " " & myRating(theRating) & "</p>"
    	
    	set the clipboard to theString
    	
    	tell application browser
    		activate
    		tell application "System Events" to keystroke "v" using {command down}
    	end tell
    end run
    
    on HTMLify(someText)
    	set someText to replace(someText, "&", "&amp;")
    	set someText to replace(someText, "\"", "&quot;")
    	set someText to replace(someText, "<", "&lt;")
    	set someText to replace(someText, ">", "&gt;")
    	set someText to replace(someText, " ", "+")
    	set someText to replace(someText, "'", "&apos;")
    	return someText
    end HTMLify
    
    on replace(theText, find, replace)
    	-- Nice replace function
    	set OldDelims to AppleScript's text item delimiters
    	set AppleScript's text item delimiters to find
    	set newText to text items of theText
    	set AppleScript's text item delimiters to replace
    	set theResult to newText as text
    	set AppleScript's text item delimiters to OldDelims
    	return theResult
    end replace
    
    on myRating(theRating)
    	set theResult to ""
    	repeat 5 times
    		if theRating  20 then
    			set theResult to theResult & star
    		else if theRating  10 then
    			set theResult to theResult & half
    		end if
    		set theRating to theRating - 20
    	end repeat
    	return theResult
    end myRating

One More TimeDaft PunkTriple J Hottest 100 - Volume 9 ★★★

Searching Zen

I googled for HTMLify Applescript, wanting to find out some simple code for how to escape the text in an AppleScript string, so I can pass it as arguments to a URL. My site came up with the top link. I was hoping for a better solution to the one I had come up with!