lost night

The LOST premier last night blew me away. Maybe I just do a poor job of holding in my emotions, but I couldn’t help but smile through the whole thing.  I do have to admit, though, that it was partially due to the company.

MarkGordonAlly and I got together for (almost?) every LOST last season and made something of a tradition out of it.  Each week a different person would have to cook the whole group dinner.  I somehow got branded as the motherly one, cooking (baking mostly) things like potpie and lasagna, you know, the kind with ricotta and spinach.

We all got together last night (plus Annabelle) for the first time in 8 months to keep our traditional LOST nights alive through the final season.  With Mark living in Denver and Gordon living in…unemployment? things are a bit different this year, so coordinating it happened all at the last minute. To make it easy on everybody else while we get back into the rhythm, I volunteered to cook for the premier.

I then realized only 20 hours before dinner was supposed to be served that I was going to spend 7 of those hours sleeping, 10 of them at work and school, 1 of them in transit, and the other 2 getting ready for bed/getting out of bed.  Nowhere in there would I have time to find a recipe, go shopping, or cook. So Ally stepped up and took the responsibility off of my shoulders even though she had NO time to herself either since she had class AND and had to get ready to leave the state the next morning…er, this morning.

But she took it like the champ she is and threw together a simple but lovely salad, and cooked (baked! Haha, maybe I won’t be the matron this time around!) a few pizzas, one with veggies and the other with pepperoni.

Oh, I forgot to mention the other big difference between this season and last.  Last year, 3 out of the 4 of us were vegetarian with me being the token omnivore (one that coincidentally hardly ever ate meat, not out of principle or taste, but out of lack-of-opportunity).  All of our dinners were vegetarian, and each week’s appointed chef came up with a damn good meal.  It’s going to be strange this season now that only one of our clan has stuck with vegetarianism.  It’s hard to say whether Ally’s dual pizzas set a precedent of making meals that cater to all parties, or if we’re going to end up cooking strictly vegetarian meals out of respect for Mark (and laziness to not have to prepare two versions).  I guess we’ll find out…

No Comments »
date Feb 3rd 2010
author Mike
category Geek, Life
tags
 

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.

solution?

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.

<?php

$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 . '!';

?>
2 Comments »
date Jan 31st 2010
author Mike
category Geek
tags
  2 Comments

Music

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.

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

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.

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, , ,