Person.new :name => "Brighid"

7:23 PM EDT Sunday, July 20 2008

You probably won't be seeing to many technical rants about Ruby or Lisp on my blog for a few weeks. To find out why, visit http://brighidbarry.blogspot.com.

Posted in  | Tags Brighid | 4 Comments

iPhone Photos

3:31 PM EDT Thursday, May 29 2008

I've had a chance to play around with iPhone over the past few days. I took a couple of shots with the camera, just to see how the quality is. It's much better than the quality of photos you get with a typical phone. See for yourself:

Inner Harbor 5/29/08

The other cool thing is that it stores the exact location that you were at when you took the photo. Google can read this info, so if you look at the map view, you can zoom in on the exact location.

Posted in ,  | Tags Photos, iPhone, Baltimore | 2 Comments

Pride

5:41 PM EDT Thursday, May 8 2008

"I think you have to have pride in what you do. There's only so many hours in the day and if you are doing stuff that you're not proud of, then, you know, that kind of sucks." -- Dave Thomas

Posted in ,  | Tags Pride | 2 Comments

View Source for Ruby Code

10:15 AM EDT Tuesday, May 6 2008

One thing that all web developers do at some is view the HTML source of the page your application has generated. The reason why is because what your web application does is dynamically generate HTML and you want to see what HTML it generated. You can think of Ruby, as a metaprogramming language, as a language that dynamically generates code. If you are doing Rails, you see this all of the time with association methods like has_and_belongs_to_many. What has_and_belongs_to_many does is generate methods on your class. For example, if you have an Product class that has_and_belongs_to_many categories, it will add a category_ids= method to your class. This all happens at runtime, so you can't see the method, but if you use Ruby2Ruby, you can. sudo gem install ruby2ruby and then run script/console at the root of your Rails app. Then just run these simple commands:

>> require 'ruby2ruby'
>> puts Ruby2Ruby.translate(Article)

The output will be the ruby code that your class now has. Somewhere in that code you will see:

def category_ids=(new_value)
  ids = (new_value or []).reject { |nid| nid.blank? }
  send("#{reflection.name}=", reflection.class_name.constantize.find(ids))
end

Which is the category_ids= method that was generated by has_and_belongs_to_many.

Posted in  | Tags Ruby2Ruby, Rails, Ruby | 0 Comments

If you wanna hang out you've got to take her out...Caffeine

8:58 PM EDT Sunday, September 9 2007

In the industry I work in, which is formally known as Information Systems, and informally known as Computer Nerdery, consuming Caffeine is prevalent. That's not to say that it isn't prevalent among the general public, but I have a feeling, based on no research what so ever, that it is even higher among Computer Nerds. So with that, I make this public service announcement, in hopes to inspire myself as well as others to better health.

I've been addicted to Caffeine via soft drinks like Pepsi, Coke and Mountain Dew, pretty much all my life. I've quit drinking soda a few times, but it only lasts a few months. I'm convinced, again based on very little research, that Caffeine, at least within soda, is evil and leads to serious health side effects. The story goes like this. Caffeine is an addictive drug, which you get by drinking soda, which also has in it High Fructose Corn Syrup. High Fructose Corn Syrup (HFCS) is the most unhealthy, unnatural substance on the planet, and leads to a generally unhealthy diet. When consuming HFCS on a regulary basis, for whatever reason, I am naturally attracted to eating unhealthy foods like Pizza, Cheeseburgers, etc., and equally uninterested in eating unhealthy foods like fruits and vegetables. It's not a coincidence that every fast food restaurant serves large, larger and largest size soft drinks. I'm sure there's good studies out there that prove my oversimplification of this, but I'm not even going to bother seeking it out.

I feel my addiction to Caffeine is very strong. I wonder if it is physical or psychological. As I said, I've been drinking soda for as long as I can remember. I can remember as a young boy in the 80s watching a Pepsi ad with Michael Jackson in it. My Dad pointed out that Michael Jackson doesn't even drink soda, in fact he won't even actually touch it in the commercial. I have no idea if that is in fact true, but the point is that at the time I thought to myself, "Is he nuts? How can he not like Pepsi?". Every time I quit drinking soda, I eventually rationalize to myself that it's not that bad and end up drinking it again. This has actually also made me sympathetic to people who are addicted to more serious things like drugs and alcohol. Long after the physical addiction has worn off, the psychologically addicted part of your mind talks the rational part of your mind back into the self-destructive behavior.

So from this moment on, if you see me drinking Caffeine in an form, it's pretty much the equivalent to running into Pete Rose in a casino. After the next few grueling days of Caffeine withdrawal, I'll be on my way to Caffeine-free, healthier life.

Posted in  | Tags Caffeine | 1 Comments

   Next Page >>