I’ve been dealing with Daylight Savings Time issues at work. It’s a pain. I found out Hawaii and Puerto Rico don’t observe DST the hard way. It came to a surprise to me that WordPress that does not support Daylight Savings Time handling at all. I posted my last post and realized the time stamp was off by an hour. WordPressers have to manually update their blog settings to account for the hour(s) offsets from GMT whenever DST comes and goes. Luckily, there is a plugin that automates this process for us. Check it out here.
Posted in
geekery at March 30th, 2008.
4 Comments.
I was writing some code in an erb template that looked like this:
<% if @user && not @user.errors.empty? -%>
#do stuff
<% end -%>
This resulted in a syntax error. Huh? What’s wrong with this?
Turns out it’s an outstanding Core Ruby bug.
As shown in the ticket if we have a method foo
def foo(parameter)
puts parameter.to_s
end
using the ! and the not operator on various method calls show us that the ! and not operator are not interchangeable in practice.
foo(!(1 < 2)) # works fine
foo(not(1 < 2)) # generates syntax error
foo(not 1 < 2) # generates syntax error
foo((not 1 < 2)) # works fine
Changing the my code to the following fixed my issue:
<% if @user && !@user.errors.empty? -%>
#do stuff
<% end -%>
Posted in Uncategorized at March 29th, 2008.
2 Comments.
I wanted to delete some .svn folders that didn’t go away when I disconnected from a repository but couldn’t see them in Finder. So I needed to show hidden files. Here’s how to do it.
Open up Terminal
>> defaults write com.apple.finder AppleShowAllFiles TRUE
>> killall Finder
Replace TRUE with FALSE to hide them again.
Posted in
geekery at March 20th, 2008.
2 Comments.
Domain-specific languages are becoming more and more popular. I across websequencediagram.com which really illustrates the power of building DSLs to tackle very specific problems. I don’t spend my time creating many UML sequence diagrams now a days but if I ever have to, I’ll be remembering this web app.
Posted in
geekery at March 19th, 2008.
No Comments.
I’ve had my MacBook Pro for a couple of months now and I’ve officially switched over to a MBP at work as well. All this time I have been working without a delete key. That thing labeled ‘delete’ on my keyboard is really what I have known in the past as a ‘backspace’ key. Naturally, I assumed Ctrl+delete would give me back my true delete functionality, but that didn’t do it. It turns out the magic key combination is Fn+delete. My productivity should go up now! Yay!
Posted in
geekery at March 16th, 2008.
2 Comments.