syntax highlighter

I just installed a syntax highlighter tool here on Rhymes With Milk and am pretty excited about it so far. What it means is that I can paste snippets of code into WordPress’ post editor essentially verbatim, and a JavaScript function translates it into a nicely formatted version for the blog.

I had seen this sort of thing on other websites before, but only just realized that I might have a use for it, too. I wasn’t quite sure how to go about finding something like that, so I asked Twitter if it had any recommendations. True to form, Twitter offered me no help, so I started doing my own research. Finding the right set of keywords to search for one of these wasn’t easy, but I eventually stumbled onto Alex Gorbatchev’s webiste. It was exactly the one I was thinking of when I set out to find one.

After a super simple install (you just have to FTP the files to your server and add the right file calls in your header) and some custom styling, it was all ready to go. I did have a few problems personalizing it though.

toolbar functionality

The program has an optional little toolbar that pops-up when you hover over the syntax highlighter div with buttons for printing, copying, displaying as plain text in a pop-up, and a small “about” pop-up. I initially thought this toolbar could be pretty handy, but that some of the buttons could probably go—namely the print one. I hardly believe anybody is ever going to see my code examples, a small fraction of them are actually going to care about what they’re looking at, fewer would actually want to use it for reference, and none of them would want it physically represented so badly that there should be just a single button for them to accomplish that. But despite digging around in the core JavaScript file for quite a while, I wasn’t able to figure out how to selectively remove buttons. It looked like for me it was all-or-nothing.

I decided that I should go with “all” at this point mostly because of the copy button. The way the lines are displayed within the div make it so that when you manually highlight-and-copy, you also get stuck copying the line numbers. This little cumbersome detail made me think that having a single copy button that only grabs the relevant code would be convenient, but there’s some sort of XML file that the function looks for but could not find. Something like that. Again, digging around in the core files didn’t help me any, and unfortunately the official website has pretty poor documentation and troubleshooting help.

line wrap

The line wrap function, unlike the ones dictating the toolbar buttons, can simply be switched on or off with an appropriately placed “true” or “false” respectively. When turned on, lines wrap nicely (although no line wrap is generally all that nice when looking at code), expanding the height of its table row, pushing the following lines and line numbers down further. When wrap is turned off a scrollbar appears at the bottom. I almost prefer this method, but it doesn’t display everything beyond the edge of the box very nicely. For some reason, the lines alternating colors end at the edge of the box, and a solid background color is displayed beyond their right ends, and depending on the CSS, this color might not ever correspond to either of the line colors. Lame.


I found this guy who has created a modified version of the original syntax highlighter. His previous documentation claims that a few of the issues I mentioned above had been fixed, and a ton of extra (and helpful) functionality had been added. I downloaded it and started testing the different functions…and it fell short of the claims. For all that I could tell, I had downloaded the same damn thing as the original. And again, explanations on how to implement said added functionality was minimal. I gave up with it much quicker than I normally do with things mostly because the test html file that comes with the download (it’s meant to test whether the program works or not) was out of date. It was the test file for the previous release, not the most current. I couldn’t even use his own test file as reference on how to implement the various features. I can think of other ways to find reference, but I stopped there because even that kind of small oversight makes me lose faith in the developer.

Therefore, I stuck with the official release (not the mod) and just turned the toolbar off, and line wrap on.

I was going to leave you with a small C++ example since that’s the language I’m currently using the most, but it’s syntax mode is actually kind of lacking. So instead, how about we try doing a PHP program (which has much better syntax support) that uses the accumulation plan.


$myArray = array(12, 102, -44, 61, 0);
$total = 0;

for($i=0; $i<count($myArray); $i++)
	$total += $myArray[$i];

echo 'The total amount in my array is ' . $total . '!';

date Jan 31st 2010
author Mike
category Geek

on drinkin alone at a bar

Until tonight, I had never sat at a bar by myself and drank. I see movies all the time that glorify it, but also enough drunks at the Cafe doing it to cancel out the cool.

I sit here alone mobile blogging from the bar at City O’ City on 13th and Sherman in Denver. I have a candle, a cup of water, and a glass of Wild Turkey in front of me, in order from left to right.

A super cute late-20-something hipster couple sits to my right reading their own books that they just bought from a used book store, neither of them more than ten pages in, looking up only every few minutes to have small but meaningful conversations with one another.

I have little to do here other than sip and be observant. But I’m happy doing just that.

I watch the bartenders do their work and shoot the shit with the usuals. They occasionally notice me watching, and we just smile at eachother. One bartender, the one that gave me the heavy pour, a girl, tells me that my smile is inviting, and says that every time she sees it she feels compelled to ask if I’m ready for another round or some food. I take it as I look lonely and need someone to be nice to me, but she says it’s a good thing. I believe her because her smile is reassuring.

No Comments »
date Jan 23rd 2010
author Mike
category Life
  No Comments »

a word on homelessness, then more bike stuff, but only a little of each

A drunken homeless man fell asleep in the women’s bathroom at my office today.  A little girl in the middle of her piano lesson down the hall found him.  Turns out he wasn’t in too deep of a sleep though, because as soon as the sweet-old-lady-teacher went to investigate, he popped up from his place of slumber and bolted.  Those homeless guys can be fast when they want to be.  They’re kinda like crocodiles in that way, I guess.

I have no idea if what I just said comparing hobos to crocs is true.  Or offensive.  I didn’t intend on either.

Sooooo today was Boulder’s official 2010 Winter Bike to Work Day.  Seeing as how I bike to work most days, today was just like any other except that I got a free bagel at Moe’s.  Thanks, Moe.

Btw, check out Moe’s favicon.  That’s how you know the site was built using Joomla, just like (guess who has two thumbs and did all of the content entry aaaannnnnddddd “designed” the facebook link on that bad boy. This guy!).

A very awkward girl talked to me this evening on my ride home from work.  Because of the way the streetlights are timed, I always end up getting stuck at the NE corner of Arapaho and 28th.  Normally I wait on the small pedestrian island there alone, but tonight there was a girl standing there about 8 feet to my right.  I was not within her direct line of sight, nor she in mine, but for some reason I could feel her eyes burning a hole in the side of my head.  I refused to look back, but it was becoming unbearably awkward.  After the longest ten seconds of my life, I hear an oddly matter-of-fact “Hi,” almost like she had been expecting me to say it first or something.  I could practically hear how red and frizzy her bangs were just by the way she said “hi.”

“Hello,” I said back.  “How’re you?”

“I’m okay.” Super awkward pause where she just looks at me with half of a smirk playing across her mouth.  She then turned around, awkwardly looked at the moon, then mumbled something about it being a nice night.

“Yeah, it’s not too chilly for a bike ride, so that’s a good thing,” I said, trying to stave away the awkwardness.

“Haha!  Chilly is nothing for winter.  Chilly is nothing compared to frost!”


“I’m from Crested Butte.”

And thank god the light changed just then.  I quickly said “Have a great night!” and rode off, never to see her again, yet still surrounded by a cloud of awkward.

No Comments »
date Jan 20th 2010
author Mike
category Life
tags, , ,
  No Comments »

lots of bike stuff

Want to know what I did today?  I took pictures of a $900 bicycle stem.  You see this guy?  Imagine an $885 better version.

I don’t know how many people know this, but I work for an online retailer of high performance specialty bicycle components.  One of the owners of the company I actually work for started it as a side project about a year ago, and though it’s not a huge operation, it’s a decent second source of income for him and it can sometimes take up a significant amount of our work time.  Though I do little more than product input into our e-commerce website and ship orders, I’ve learned a hell of a lot about bikes.  In fact, I’ve somehow become something of a snob about it.  I guess that comes with the territory of selling $150 skewers (the long pegs you put through your wheels to clamp them onto the bike).  If I see a bike and it doesn’t have a carbon fiber stem top cap that weighs 5g or less, I scoff.

Then I get onto my road bike, with stock components all around, and can’t believe how good it feels to ride it.  It glides like it’s on butter.  When I’m riding it, instead of wishing I had 18-spoke carbon tubular rims on it, I scoff at the people that would spend the two grand on a set of those.  My cheep-by-comparison aluminum clincher rims with their unaerodynamically shallow depth ride better than I could ever ask for.

Granted, if I ever actually rode one of those baller $10,000 all-carbon bikes, I’m sure I’d be singing a different song.  Maybe I’ll just avoid riding one of those for my entire life so that I’ll always appreciate what I have.

Anyway, despite my ravings about it’s awesomeness, my road bike sucks in weather.  I’d never take it out in any kind of precipitation, and it’s tires are slippery (as if they were riding on butter?) so any moisture/ice on the ground is liable to kill me while I’m cornering.  Anytime it snows, I have to stay off of it for a minimum of a week until some of the ice has melted, and the paths and sidewalks aren’t so wet.  Typically during that time I ride my 10-year-old mountain bike which is durable enough to take all the beating and weather I can put it through, and crappy enough that I don’t care if it literally explodes while I’m riding it (idk why it’d do that…).

Unfortunately, though, it’s been going through a tough time these last few months.  The shifters were starting to crack, which is unsurprising since they’re entirely plastic and they often take heavy abuse.  The cable tension started making them slip out of place, allowing the derailer to shift the chain from cog-to-cog, making smooth riding very difficult.  I’d have sore hands after any length ride because I’d have to hold the shifters so tightly to keep them from slipping out of position.

So the natural solution: tear the shifters off the bike.  This caused a chain reaction that resulted in me deciding that the bike should be a single speed.  Without shifters, the derailer isn’t going anywhere, so the chain is always going to stay on the same ring (hence single speed).  This makes the entire cassette (except for the single ring the chain ends up on) just dead-weight (and since I’ve become a weight weenie by association, I won’t allow a single unnecessary gram to be on my bike).  Might as well lop the derailer off while we’re at it.  Then in the front, the middle chain ring has a bent tooth that causes the chain to slip off, so we’ll get rid of that one.  The small chain ring on a mountain bike is so damn small it’s useless unless you’re climbing 45° inclines, so that’s gone.  Front derailer: gone.  All associated cables: gone.

Unfortunately, half way through working towards this, I realized that bikes were made with very specialized tools, and therefore need very specialized tools to take them back apart.  All the tools that I need would end up costing me more than all of the materials I had to buy to make the conversion.  Eff that noise, bra.  So now my bike is laying in pieces (but not the pieces I want it to be in) and all of the parts I took off of it are too destroyed to put back on.  So now it’s single speed or bust.

Since I work with some actual bike enthusiasts (not just posers like me), naturally they have all of the necessary tools and should bring them in for me in the next few days.

Um… that’s all.

There’s no moral to this story.  Any of it.

No Comments »

Australian dreams

I just woke up from another dream about living in Australia. I occassionally have these dreams, but they’re never the same. In fact, few of them are even of the Australia I’m familiar with. There’s always a certain feeling I get during these dreams that immediately tell me I’m in Australia again, though.

Despite their differences in content and “location” each time, they always make me feel so free. Drinking scotch with the owner of a local pub, watching the streets flood with people after a Waratahs game, jogging to downtown, emailing my boss to let her know that I’m not sure when I’m coming back.

Then I wake up and realize I have to be at the office in less than two hours. It was only a dream.

No Comments »
date Jan 11th 2010
author Mike
category Life
  No Comments »

this is not the post it was supposed to be

I was about to write a post that I’ve been thinking about for a while now. Prompted by Avatar (then subsequently watching an Esurance commercial) I was going to come up with a list of cartoon females that are inexplicably attractive, then make some sort of commentary about how they’re actually very disproportionate and otherwise strange looking.

As I was doing research I unearthed a whole community of perverts that fantasize in cartoon. Deviant Art alone is full of half-nude insanely sexualized versions of some of these characters. There are no less than a dozen forums I stumbled upon that collectively had hundreds of posts just about that one time Aaron Diaz may or may not have drawn that one nude image of Kimiko Ross or if that was just fan art.

I should have seen all of this coming. How could I have been so naive as to assume the internet could be mature about a subject like this?  As I have come to figure out, the internet is anything but mature (don’t worry, it’s SFW).

Anyway, this all really turned me off from doing the post I originally set out to do, mostly because it could possibly but not-too-wrongfully associate me with those sad, sad men in a way I would not be okay with.  No thank you.

BTW, I was totally unsure which of the blog’s three main categories to put this post into. When I first came up with that list of categories, I assumed those three would pretty sufficiently define any thought I might ever want to put on here. I guess I never assumed I was going to be blogging about sad internet cartoon porn. Again with the naivety thing…

1 Comment »
date Jan 10th 2010
author Mike
category Life
  1 Comment »

Socks, women’s in particular

There are a few things in my life that I’ve had to come to terms with recently:

  1. My thighs are much too big to ever fit into skinny jeans.
  2. My head is much too big to fit into any sort of hat, even those worn by the Pittsburgh Pirates in the ’80s.
  3. My feet are done growing, and will therefore never fit into the size 12s Andrew Childress wore in 4th grade.

Depending on your sources, I wear what is approximately the average shoe size for American males.  It baffles me when I buy socks that are supposed to fit shoe sizes 6-12 (mine are definitely in that range) and they’re about three inches longer than my foot from heal-to-toe.  I guess they “fit” my feet, but they sure as hell don’t fit properly. My best friend when I was 4 years old wore his knee-high tube socks with the last 4 inches drooping off his foot as if he didn’t tug quite hard enough when he put them on that morning.  The image still haunts me.  I can’t deal with baggy, slouchy, loose socks.

This is why I exclusively wear women’s socks. Even with small feet, these socks are so tight you think that you might not be able to get your foot all the way in the first time you try.  Then there’s a moment when your heal overcomes the crux and your foot virtually pops into place.  It goes home, safe, sound, and snug.  It breaths a sigh of relief.  It jizzes in its pants.

date Jan 7th 2010
author Mike
category Life


The Blow – Hey Boy

I now have audio!

This is actually a plugin (the WordPress Audio Player, which only a few days ago came out with what I hear was a much-needed update), which is something WordPress does really well (plugins, that is). Finding, installing, and activating plugins is never more than a few convenient clicks away.  But of course, as has been my luck with this theme so far, it wasn’t as easy as that for me.

After installing and activating, I uploaded the above mp3 via FTP* and created a new post with the suggested insertion format. I got a big fat error saying:

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

Flash is up-to-date and JS is enabled, so that wasn’t the problem.  Being that this is a fairly common error message to get with this plugin, I was able to find a lot of support in the WP forums. Many people suggested adding <?php wp_head(); ?> to the head section of the blog. This somehow triggers the plugin or something, and it fixed the problem for most people.  After adding it, a bunch of new code appeared in the head section of my source code, so I was hopeful that this solved it.

It didn’t.  Same error kept coming up.

And since it fixed the problem for most people, there was little support beyond that in the forums.  I downloaded another audio player that simply loads the WP Audio Player when you click on a link, and it had no problems.  Obviously it wasn’t a problem with my browser, Flash, or even my blog.  There was a problem with how the plugin was communicating with the theme (it actually worked just fine when I switched to the WordPress default theme).  Though most complicated PHP is over my head, I was forced to dive into the plugin’s main file ([PLUGIN DIR]/audio-player/audio-player.php) to see if I could spot where the error was being triggered.

Miraculously, I was able to decipher enough to figure out that the plugin was trying to add a small snippet of code to the page’s footer.  A light bulb went off when I saw that.  While doing research on what the wp_head() function does, I noticed somewhere that there was an equivalent wp_footer() function.  I put that into my footer.php file right before the </body> tag, and what do you know? I now have audio.

Slowly but surely this blog is coming together.

*WordPress also has a really simple media-upload tool built in which I would have used, but naturally I ran into roadblocks with it as well.  My server allows max upload sizes of 2MB by default, and after some research I was told to edit my php.ini file.  Using HostMonster’s PHP Config tool, I created a new default php.ini file and edited it accordingly.  It didn’t work.  I don’t know if I just have to wait for the changes to take effect or if it just didn’t work.  I guess I’ll try this if I still can’t upload bigger files by tomorrow.

UPDATE: I just uploaded a 6MB song, so apparently editing the php.ini file worked.

No Comments »
date Jan 4th 2010
author Mike
category Geek
tags, , ,
  No Comments »


Welcome to the new year, the new decade, and the new Rhymes With Milk.

This last week has been full of reminiscing over the past ten years: the tragedies (9/11), the mistakes (Bush), the triumphs (Jon & Kate are off the air). Everybody has been very negative about it because they’re so fixated on all of the things that have gone wrong, so I’m done listening. I’m going to start looking forward, because this is bound to be a big next decade for me. I’m going to be my mid-thirties by the end of it. I’m probably going to be married, and have children and a mortgage. Who knows if this blog will still exist, but I sure hope it does.

In that vein, I’d like to layout some goals here. Not for the decade per se, a little more short-term than that, but still for the sake of posterity. Maybe on Jan 1, 2020 I’ll look back at this post and make myself feel sad about loosing my youth or something. Whatever.

Beyond posterity, I’m doing this for a few other reasons. I’ve set a lot of personal goals for myself over the last few years, and many have fallen horribly by the wayside for one reason or another. I’m hoping that publicly declaring them makes me more likely to pursue them. It might work, or it might not, but it’s worth a shot. Also, having a job has understandably distracted me from my personal life. I have fallen into a routine that essentially erases my weekdays, and makes me too tired on the weekends to do anything. For example, I have been “working” on this revised version of Rhymes With Milk since around August, and most of it got finished before I got my job and during my 4 day Thanksgiving weekend. It shouldn’t take me that long to do a relatively simple* website design, especially when it has been the top priority of my to-do list for that whole time. If I plan to get anything done ever again, I need to force myself to find the time to do it.

Anyway, here go the big ones:

  1. I want to ride my bike. A lot. I am declaring it now, I am definitely going to ride all 120 miles of the Triple Bypass on July 10th. I’d also like to do the 100 mile Centurian the following week, but their website has too little info so far for me to be sure of that just yet.
  2. I want to blog. When I stopped back in April 2009, I hated blogging. I stopped the Daily Picture Project, then I haphazardly put together an ugly and difficult to manage photoblog here on rwm which just drove me away from it altogether. These last few months, though, I’ve had a lot to say and nowhere to say it. Not that I have grand ideas that I think the world needs to hear. I just didn’t have a medium for exploring and processing subjects that I was interested in, or a place to record memories. This comes back to that posterity thing I was talking about earlier. I’d like to remember this decade, so starting today, January 1, 2010, I would like to start blogging, regardless of the fact that this site isn’t complete yet (just do me a favor and don’t go to the About or Contact pages. Or the permalink to this post. Or the archives. Well, actually go to the archives because they’re pretty cool looking, but ignore the fact that they don’t flow well with the rest of the site. And ignore the link colors in the archive, which I messed up somehow. I’ll have to fix that. If only I had the time…)

    UPDATE: I just made a small adjustment to the archives and now they’re all outta whack. Don’t bother going there for a while…

*I’m just going to say right now that this website was actually a bitch to make, I learned a lot, and it really stretched my abilities, particularly in the realm of WordPress PHP programming. I didn’t add anything too particularly complicated compared to “real” WordPress themes, but I went into it knowing hardly anything about the WordPress back end and coded everything from scratch.  There was a lot head scratching and “What the hell is this stupid loop everybody is obsessed with?” talk for the first month or two. Oh how naïve I was.

No Comments »
date Jan 1st 2010
author Mike
category Life
tags, , ,
  No Comments »