Wednesday, May 27, 2009

Stupid BASH Trick 01

I have to look this up all the time, if you are BASH scripting and you want to do something with each file in the current directory try something like this:
#!/bin/bash
for i in $( ls ); do
echo item: $i
done

Or the one liner
for i in $( ls ); do echo item: $i; done
There, maybe next time I will not have to look as hard. :-P

Vbulletin Can go to Hell

Just so that I don't forget to say "HELLLL NO!" next time someone asks me to work on a vbulletin site. I'm going to post my reasoning here:
  1. The community sucks! Whenever I want to learn how to do something "outside the box" with Vbulletin I start with a google search, this invariable leads me to a "forum post" that generally says "go to vbulletin.org" no link to a relevant help article or piece of doccumentation, just vbulleting.org. That would be fine if vbulletin.org was useful. But it's not, its just a vbulletin forum that you can only read the helpful info if your are a registered user.
  2. Apparently the people at vbulletin have never heard of an API the closest thing they have is a user contributed hack from two years ago which doesn't fully work with the latest version of vbulletin.
  3. Its community supported pay-ware. WTF!?! So the interactive support comes in the form of a forum powered by users, and I have to pay for access? That's bullshit!
In summary vbulletin is a steaming pile. Also, there are plenty of other forum solutions out there that are free as in beer as well as open source. I bet they don't make you pay for access to their community supported documention/support. Grrr.

Wednesday, May 20, 2009

Atheism Rocks

The Out Campaign: Scarlet Letter of Atheism
s a matter of fact, atheism is the position supported by science, logic, and rational free though. Yet somehow conservative religious fundamentalists have convinced the general populous that we atheists are 'sinful' and 'evil'.

I for one, am tired of being persecuted for my lack of faith and desire for evidence. The god hypothesis just doesn't make any sense. Richard Dawkins does an excellent job at showing just how unlikely a god of any kind is in his book The God Delusion. Dawkins is much more eloquent than I, so don't take my word for it, read a real "good book" and think about it.

If you are already an atheist. I challenge you to be open and honest about it, and spread the word. Closet atheists do the rest of us no favors. People need to know that atheists make up a significant portion of the worlds population. Atheists are mothers, and brothers, friends, and colleagues, and above all people.

If you have a blog or website of your own, out yourself!

Tuesday, May 19, 2009

Custom Titles in Rails

One thing I've learned while building rails sites is that changing things in the header on a view-by-view basis can be tricky. This starts becoming important when you start optimizing your page for Google. One thing Google likes is descriptive and non-repetitive title tags. To get view by view customized title tags try this.
  1. Add `<%= yield(:title) || "Default Title" %>` to your layout inside your title tag.
  2. Add `<% content_for(:title, "Custom Title") %> to your view file.
You can replace "Custom Title" with code such as `@object.name` or anything else that returns a string for even more dynamic titles. I've had to look this technique up more than once now so I'm blogging it in an effort to better remember it. I hope it is useful to you as well. You can use this technique to put other things in the header as well just use `yield` and `content_for` judiciously.