Cleaning XHTML & jarring gems

May 11, 2009 at 9:30 pm (Java, Limelight, Ruby, Week 8) (, , , , )

Back to my beloved XHTML 1.0 Strict and CSS today. I took some code that came from a client as a quick MS Word-generated web page, grabbed the important things, and deleted. And deleted. And deleted. Always a great feeling to get rid of redundancy. Code like this:

<tr>
<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;</td>
<td bgcolor="#FFFFFF">Some Text</td>
<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;</td>
<td bgcolor="#FFFFFF">Some More Text</td>
<td bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;</td>
</tr>

makes me want to laugh and cry at the same time. Maybe it should start its own Broadway musical. At any rate, it’s a bad laughing and a bad crying, so it had to be fixed.

I got to check out Sinatra a little bit in the process, which was pretty cool. It took me a little bit to figure how to get Sinatra serving up images and stylesheets, but it’s very clear once you know!

set :public, File.dirname(__FILE__) + "/views"
set :views, File.dirname(__FILE__) + "/views"

Public and Views here have similarly-named analogues in Rails. They’re basically what you’d expect.

Micah, Doug, and I worked some more on jarring up gems, and despite some current limitations, we now have a great start on an idea for distribution. If you’re looking for answers on how to do it, check out Nick Sieger’s blog, the best source we’ve found on the topic. Be sure you know what commands and options you’re using, and how they relate to gem directory structure. I had a lot of trouble understanding how gem directories are laid out, and how that related to the jar directory structure, but now I have a good basic idea.

On an unrelated note, if you walk outside real quick to pet the cute new puppy next door, it’s great that you remembered to take your jacket, but it would be best to bring at least one of the following, since you locked the door on the way out: (1) keys, (2) phone, or (3) wallet with ID and spare key. This will avoid embarrassing encounters with neighbors you hadn’t met (although this is one good way to meet people). Not that it happened to me… just sayin’.

Advertisements

Permalink Leave a Comment