Ruby on Rails + Gmail SMTP (TLS)

Code — Tags: , , — Mark @ 7:55 pm

This took way too long to figure out the answer to without using a custom plugin. I hope this helps others! I was setting up Redmine with Gmail as an SMTP server utilizing config/email.yml. Behold!

email.yml with no other related changes in environment.yml using Rails 2.2.2

production:

delivery_method: :smtp
smtp_settings:
enable_starttls_auto: :true
address: smtp.gmail.com
port: 587
domain: GMAILDOMAIN.com
authentication: :plain
tls: :true
user_name: "EMAIL@YOURGMAILDOMAIN.com"
password: "YOURPASS"

If you are setting up Redmine, there is a nice feature under Administration > Settings > Email Notifications > and in the very bottom right corner of the page, a “Send a Test Email” link.

The beautiful phrase “Man, I am an idiot…”

Code — Tags: — Mark @ 9:49 pm

How often do you have “Man, I am an idiot” moments? Forgetting to pay a bill on time, saying something stupid and regretting it immediately after, or chopping the tip of your finger off cutting red peppers? Yeah, gross… Well if I did either of those things I dont think I would be too happy but in the programming world ”Man, I am an idiot” is one of the things I like to hear most…

Today my team and I were plugging away, coding up a storm. We have some upcoming deadlines so we are all in crunch mode. The problem is that if I have done a ton of work that is all on a  related task, I begin to make stupid errors. I dont know if that is normal but I need to mix up my tasks. A little of programming, a little of building gui forms, database work or whatever else needs to be done.

Anyways, what got me thinking about this is that today I had to give a hand to two friends that were having problems that they couldn’t figure out in their code. It never hurts to have someone else take a glace at your simple mistakes, the same two friends helped me figure out a problem in 5 minutes that stumped me for an hour. So for each friend, I go over, looking over their shoulder as we step through the program. I offer some advice or suggestions where I think the bug may be hiding and leave them to get it. Lo and behold, after 5-10 minutes after I left each of them I hear one of my favourite programming phrases: “Man, I am an idiot.” 

I am not saying I found their problem but sometimes when we explain our code to other we read parts of it that you think are 100% fine and wouldnt think to check it yourself. I myself have yelled many a “Man, I am an idiot” to whoever is in earshot when I have a eureka moment. I love the feeling of overcoming a seemingly insurmountable error in ones software that turns out to be something a new programmer could spot. So today was a good day, alot was accomplished and issues were resolved. I hope to have more “Man, I am an idiot” moments soon as there are still alot of bugs :)

What is your best ”Man, I am an idiot” moment?

P.S. The errors in the software I believe were that a regular expression wasnt being matched properly because of a missing escape character and the other had a simple SubSonic/SQL query problem.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2012 Mark Stahler – Blog | powered by WordPress with Barecity