Monday, June 18, 2012

Time zones in Rails

Don't use Date.today or Date.yesterday if you set config.time_zone / you do things similar to this post or this time zones railscast.

These two functions of Date don't mix well with Rails' time zone setting features.

Instead, use Time.now.in_time_zone to get the time in the right time zone you specified or Time.now.in_time_zone.to_date for the date.

Time.now just gets the time of the place where the server is running.

Basically, get a time object and convert as appropriate.

Saturday, June 16, 2012

Portal

Just finished Portal, one of the games I've heard of for the longest time. It's nice to finally set aside time to play it. 

The story has lots of meaning: It makes us question the morality of what we do in the name of science. Creating weapons for those still alive. Is it okay to kill others to improve our knowledge of science?

The crude humor is intriguing too... stories.

Amazing how music can capture a moment.


This reminds me of the post I had about the stigma of video games when they can be very meaningful and engaging stories just like books.

Tuesday, June 12, 2012

"Difference is the Differences" by George Watsky

Catchy song that got stuck in my head recently...


His lyrics incorporate so many allusions - I find it really impressive. And his meaning is remarkably cool too - I feel that I'll never be able to dig up all the meaning from his works.

The difference is the differences I've got? I think that makes sense. There's a point when all the small differences you possess create you, someone who, as a whole, is just so different from everyone else. There's a point when miniscule distinctions lead to qualitative differences that engender individuality. Uniqueness.

Monday, June 11, 2012

A level of art not understood

I encountered an interesting pianist during a TEDx event I attended back during my first year of college.

He began his story saying that the tones of the piano - the sounds he heard - weren't enough for him after decades of mastery. He wanted more from between the notes, from between the C and C#, the A and Ab.

So he manipulated the piano.

The piano I saw was so strange - contraptions inside, padding here and there - it seemed like a violation of the strings of the piano. The strings were altered such that he got what he wanted - a variety of new sounds. A new world of art to explore.

It was stimulating hearing about his feelings toward the piano, toward music, but I felt bothered when he played his own songs on his modified piano. What he called music sounded like noise to me.

I realized later that he reached a level of art that he alone grasped and that stimulated him but not others. Most others could not understand or appreciate his music. I've played piano for over a decade, and I couldn't find any sense of awe or wonder in his music. It was just noise to me.

I write because I wonder about this level of art - and its implications. To reach something as this man did must have felt fulfilling for him, but it led him down a path of intrinsic value, where few others could appreciate what he was doing. Some might call it insanity. Situations like this create this divide between practical enjoyment and aesthetic value... his work became a pursuit for him, but not to the benefit of many others. His work became a pursuit that only someone who was truly dedicated to the art could follow. A pioneer in his field, I guess - one that might not be appreciated immediately.

It reminds me of a quote... "To be great is to be misunderstood." -Ralph Waldo Emerson

...

Tuesday, June 5, 2012

Images in public/ for error pages on Rails 3.1-3.2

For error pages found in public/ for a Rails 3.1 or 3.2 app, you might want to put a quick, simple image and reference it with the normal html img tag instead of any of Rails' fancy image_tag such and such.

Easy way that works:
1. Put images in public/images
2. Reference images like
<img src="/images/my-pic.jpg" />