Archive for June, 2006

Grr… Mac OS X and ctags

Another day, another software problem. This time, I’m taking the advice of Zed Shaw and attempting to use gvim for my text editing. I’m currently using Textmate, but I change my editor about as often as I workout (aka every two months). Enough rambling, gvim has support for this cool thing called ctags. I haven’t investigated it enough yet, but it’s apparently used to allow you to jump to the definition of a function, class, or what-have-you very easliy. Sounds cool right?

Unfortunately, the version of ctags that ships with Mac OS X is a piece of crap. Looking at the man page it’s only version 3.0 from 1993. That’s 13 years ago for those of you not into math. Anyway, the fix is simple (that’s in bold for those of you from google). Just install Darwin Port and then enter

sudo port install ctags

That’ll get you up and good with a modern version.

P.S. – If you really want to install this by source and do not know how, let me know. I can easily do another write up on how that’s done.

Comments (3)

How to Make Pound And SSL Play Nice With OS X

Though building sites with ssl is cool and gives your users a sense of security, configuring a webserver with ssl can be a royal pain. Thankfully, there’s pound. Pound is a “is a reverse proxy, load balancer and HTTPS front-end for Web server(s).”

Pound is dead simple to setup and configure. Unfortunately, the darwin port for pound is old and does not work. So this guide will help you build pound on your own. Besides, everyone feels cooler after compiling that hot fire. Click on for the steps.

    Read the rest of this entry »

Comments (5)

CSS Tip

Well, this is basic css, but I’ll throw it up here for those of you that don’t know or have forgotten (I managed to forget the other day). If you have an element with ‘float: left’ or ‘float: right’ inside a div, the div will not be tall enough to hold the floated element. Look:

I am crazy floating text. Watch out for me because I am so crazy. I will kill any and all layouts near me. Hear me roar!

I am the cool words to the right.

I am broken! I should be below the text that is to my left.



As you can see, the code above is definitely broken. To fix this problem, we need only insert a <br style="clear:both;" /> at the bottom of the div. Look now:

I am crazy floating text. Watch out for me because I am so crazy. I will kill any and all layouts near me. Hear me roar!

I am the cool words to the right.


I am fixed! The crazy floating text plagues me no more.

Comments (1)

Use Session Sparingly (or The Benefits of Flash)

As tempting as it is to use it for everything, the rails session should be used sparingly. In reading through the code for my current project, I noticed that we are using the session for storing return urls and query strings when doing login redirects. This is bad.

Read the rest of this entry »

Comments

Ruby Reminder: Array Subtraction

Just a reminder when working with arrays of objects generated with Active Record.

[Model.find(1), Model.find(2), Model.find(3)] -
  [Model.find(1)] != [Model.find(2), Model.find(3)]

This does not behave as you would expect, because array subtraction compares elements on their object ids. Each find generates a new object, with a new id, so subtraction does not work. To get the behavior desired, do this instead:

to_be_removed = [Model.find(1)].map{|m| m.id}
[Model.find(1), Model.find(2), Model.find(3)].
  delete_if{|m| to_be_removed.include?(m.id)}

It’s not as beautiful, but it gets the job done.

Comments (1)