What she said

Proxy: Have you tried turning it off and on again on Mac OS X?

roy

Say you have an EC2 micro instance set up for convenient access to IP restricted services, like pandora and certain porn sites. Aren’t you tired of manually setting up the tunnel and editing proxy settings on your mac?

Here you go.

DIY-ish Bias Lighting

As the legendary Jeff Atwood puts it:

We computer geeks like it dark. Really dark. Ideally, we’d be in a cave. A cave … with an internet connection.

Social interaction

See, being in the dark room isn’t all about avoiding social interaction. It actually helps me focus. But the brightness of the screen strains my eyes even with the lowest brightness setting on my MacBook. It’s not just working, even watching a movie – I could hear my eyes screaming when the scene switches from night time to bright daytime.

So, allow me to quote Jeff Atwood again, together with what he quoted in his post about bias lighting

You don’t want total darkness, what you want is some indirect lighting – specifically bias lighting. It helps your eyes compensate and adapt to bright displays.

“[Bias lighting] works because it provides enough ambient light in the viewing area that your pupils don’t have to dilate as far. This makes for less eyestrain when a flashbang gets thrown your way or a bolt of lightning streams across the screen,” he told Ars. “Because the display is no longer the only object emitting light in the room, colors and black levels appear richer than they would in a totally black environment. Bias lighting is key in maintaining a reference quality picture and reducing eye-strain.”

Bias lighting is the happy intersection of indirect lighting and light compensation. It reduces eye strain and produces a better, more comfortable overall computing display experience.

I looked up the Antec Halo 6 LED Bias Lighting Kit he recommended. Functionally it looks usable but my biggest problem is that it’d sticks to the back my screen – it’s like getting my MacBook a permanent tattoo… that glows in the dark. So, no thank you. But it’s a great idea and dead simple by design – it’s just a strip of USB powered LEDs. Why don’t I make one myself? I can make it better by attaching elastic bands on both ends of the strip instead of the sticky. With that, it can be striped onto any laptop diagonally.

So off I went to Sim Lim Tower on a Sunday morning. Sadly there was only one shop open that sells LEDs at all. And to make it worse, the LED strips they sell require 12V, while USBs only supply 5V. I thought of getting a converter but it just seems unnecessary when there are 12V strips available online. I figured I’d just order online and wait a couple days. Hopefully by then I haven’t lost interests in building it. As I was walking out the shop, something caught my eyes:

LED lamp LED lamp

It fits my needs perfectly despite its awkward appearance. Still workable. I just need to take it apart and give it a better UI. So with SGD$10 I took it home. Here is what it looks like in action out of the box:

LED lamp in action LED lamp in action

It’s definitely bright enough but doesn’t quite stand well as you can see. So here we go:

  • Step 1: Get rid off what does not work well.

Remove things

  • Step 2: Move fast and break things.

Move fast

  • Step 3: Put it back together, with some soldering, and pretty designer tapes.

Put back

  • Step 4: Change of plan. I bought flat elastic band to attach to the light. But at this point the light has become too pretty to be attached to the black elastic band. I mean, look at it:

Leaf front Leaf back

So I ended up attaching a hook to the back. It hooks up nicely to my Air and is easily detachable:

Hook up off Hook up on Hook up front

  • Step 5: Put it in use and show off on your blog ;) Here’s before and after:

Before After

I didn’t make the bias lighting from scratch. I simply gave the USB powered LEDs a new UI that suites my needs and tastes better. All in all, it was a fun mini project =)

*Thanks Tommy and Zi for lending me some of the tools!

Family

Let’s talk about family. Why not? I am who I am largely because of my family. Here is an incomplete laundry list of what I learnt from my family growing up.

Once we were watching a movie. The girl in the movie said to the guy, I can’t live without you. My mother turned to me and said, that’s bullshit. You can live without anybody. Remember that. I thought to myself, that’s really badass. And that’s still something I live by today.

I was a quiet kid who asked few questions. It’s not because I didn’t have questions, only because I enjoy thinking about them and trying to figure them out myself. Mother knows me. She bought me lots lots of books, subscribed me to sci-fi magazines, the Chinese equivalent of reader’s digest and more, bought me the Chinese equivalent of legos, lots of them. She likes to tell me how I built amazing castles and ships with them, which I have no memories of… In my mind, my creations were more like

snowflakes

My grandma has always been my role model. She’s retired now but she had a successful career as a civil engineer. And we are talking about 1960s in China, a college graduate with a degree in civil engineering => my grandma. Then, there weren’t many people who went to college to start with. She was the youngest and and graduated as one of the only three female students in her class. There are more to my grandma’s story. It’s a post by itself. The idea is, she’s pure awesome.

Grandma taught me patience. She’s the one I turned to whenever I messed up yarn/thread that I played with. It never failed to surprise me how she ALWAYS managed to untie all the knots doesn’t matter how badly knotted they are.

Father is my favorite in the family (Sorry Mom). He’s a serious surgeon at work and a prudent man in general. But to me father means fun and adventures in my childhood. We had our stupid games that my mother disapproves of. She said it was childish for my age. But we just laughed and kept on playing until I left home for university.

I learnt earnest from my father. He loves his job. He’s always accountable and dependable. He does what he thinks is right regardless of the peer pressure.

He also told me that life is like a sine wave: there are ups and downs. When it seems bad and you are sad, you should know that things are about to get better; and when you are on top of the world you should be aware of the downward slope ahead of you. Thinking about the sine wave got me through countless hard times. Thanks dad.

sine

There are things that parents force their kids to do. It was like hell for the kids at the time, but as the kids grow up they turned out to be thankful for what they were forced to do. A classic example is learning instruments. It’s hard work. There are hardly any kids who can’t wait to go to piano lessons at the age of 5. But later they realize that growing up means taking a one-way busy train – you no longer have time for learning piano and even if you manage to get to it you’ll never be as good as those who started young.

My parents didn’t force me to learn any instruments, I can’t blame them for that. But I can thank my father for forcing me to take up the leadership role since primary school. It was hard for me as I was a quiet and shy kid. But if not for my father I would not be where I am today. I’ve met so many people who are smarter than me but too shy to lead. It’s one thing to do your job well, other to excel as a leader. I have yet to excel but being able to step up opens doors. Daring to be ambitious is the first step to putting a dent in the universe.

Appendix: Small things about my father

There’s that. I enjoy doing things that make my family proud just because =)

Back Scratching

Just to be clear, I’m not at all against the idea of online advertising. I believe that it is the very reason why a large portion of the internet is free.

Advertising, both online and offline, is an excellent business model that benefits business(advertisers), content creators and content consumers: business gets to promote the sales of their service or product; content creators get to distribute their content at lower and even no cost; and content consumers get to consume at lower or no cost. End of the day, we have advertising to thank for the survival of the news, magazine, radio and TV industries.

Back on the grid, think about Google. I don’t know about you but I can’t imagine a life without Google search, Gmail, Google maps and YouTube. The free and excellent services Google provides would not be possible without money. Last year, 95% of Google’s revenue comes from online advertising. Thank you online advertising.

back scratching

It’s all about scratching each other’s back. Google helps me find the relevant information I’m searching for, for free. And they get paid by the advertisers for displaying ads to me. Fair and square. I don’t mind the “sponsored links” showing up first in my search results, as long as they are 1) clearly labelled so I don’t mistake them for vanilla search results 2) always relevant to my search – I might even click on them sometimes.

All that being said, I have a confession to make: today is the day I installed a chrome extension to skip YouTube in-video ads.

remove youtube ad

Do I feel bad? Not really. Inserting an ad in front a video I want to watch disrupts my workflow. It’s broken user experience right there. How relevant normally is the ad in front of my video? Do I feel like buying a car when clicking on a cat video? No, thanks.

grumpy cat

So yes, when it feels like that YouTube stops scratching my back, I stop scratching theirs. They probably won’t be charging the advertisers since the ads aren’t displayed.

The point is, I’m willing to scratch your back up to a certain point. A disrupted workflow is beyond that point.

Conditionally Switching off Transactional Fixtures

Rspec gives us the ability to use transactional fixtures:

1
config.use_transactional_fixtures = true

We like it because it makes the test fast by opening a database transaction at the beginning of a test and rolling it back at the end of it. Nothing gets written into database. But, this does not work with Capybara javascript tests (Such a long name, I’m going to call it selenium specs from now on just for simplicity sake and legacy reasons. And no, I don’t prefer selenium as a driver over Capybara-webkit. Quite the opposite.) because they use a separate server thread, which means the transaction is not visible to the client. So intuitively we wonder, is there a way to turn off transactional fixtures only for selenium specs? A quick googling suggests that one should simply turn off transactional fixtures and use database cleaner for all the tests. I go

no

I’d use database cleaner to truncate my tables after/before each selenium specs but definitely not for every non-selenium specs like model and controller spec. What about using database cleaner’s transaction strategy for those? I could… And more on that later. But hey if rspec can talk to active record to enable transactional fixtures directly why have someone else do it? So here it goes:

To use it, you need to put the js tag on feature(alias of describe) instead of the scenario(alias of it), because it is simply too late once you are in the space of a scenario. For the same reason, you can’t turn it off in a conditional before(:each) hook in spec helper.

*Credit: the above gist was derived from code written by Mike Mazur and I as a pair.

So I was pretty pleased with the above solution and I went ahead made the gist for my future self. But, then I asked myself again: what about database cleaner’s transaction strategy? How does it work differently from active record’s use_transactional_fixtures which rspec essentially use? After a bit of code reading, I realized the answer is… it isn’t any different. Here is how active record does it. Here is how database cleaner does it. Here is me trying to make sure I’m not crazy after reading what I read.

It’s a nice thing to figure out how to turn off transactional fixtures conditionally. But end of the day, it is not necessary. So yea, Interwebz is right – just turn off transactional fixtures all together and use database cleaner. Here is to my future self and anyone who ever wonders how to turn off transactional fixtures for selenium specs only:

The Peace of Mind Project

Peace of mind is always underrated in my opinion. Believing it hasn’t stopped me from underrating it though. It’s just not enough. “…this life will hit you hard in the face, wait for you to get back up just so it can kick you in the stomach. But getting the wind knocked out of you is the only way to remind your lungs how much they like the taste of air.”

How? Different story and not the point.

Why peace of mind?

Waking up monday morning, realizing I was almost unfit for work. The doctor suggested me to take 2 days off. So I reluctantly did so. It might as well be the worthiest sick leaves I’ve ever taken. Looking back at the past two and half months, I have been busy trying hard to be happy – going to dance classes at least 3 days a week; said yes to all possible social opportunities; the rest of my non-working hours are almost all used for catching up with old friends. Happy finally? I asked myself. I couldn’t say yes with a straight face. It felt… fast. And I’m exhausted. The 2-day leave was my only real break for 2+ months. Just like that, I decided that not taking myself too seriously isn’t enough; doing things that (I think) makes myself happy isn’t enough; I want my peace of mind.

What makes me feel calm and in peace?

  • On my way home at 1am after submitting a pull request
  • Reading a book
  • Scrolling through my twitter feeds, with Ke, talking to mum and dad on phone, playing Alejandro on my ukulele
  • Standing around with wine in hand after hash run
  • Lying on bed after a productive working day
  • Taking care of myself(simple things like getting a new pair of earrings, applying face masks and painting my toe nails pink)
  • Listening to this American life
  • Watching phillyd show
  • Writing a blog entry

new twitter earrings

What makes me happy?

  • Dancing
  • Hash runs
  • Attending fancy events
  • Road trips
  • Knowing that my proposal to speak on Taiwan RubyConf is accepted
  • Hanging out with friends.

237th US Navy Ball, Singapore

What’s the plan?

Take some time from doing things that make me happy to spend on things that bring me peace.

  • As I am typing this post, Derrick’s email regarding mailcheck arrived in my inbox. I’m going to do my homework after putting this post up. If things pan out, more time on coding.
  • Among all my projects, I’d like to pick up wiki near me after I finish up mosaic’s google calendar (*shameface* that really should have been done long time ago).
  • Friday hash run is fun but is also very time consuming – it takes away 1 work hour + all after hours of Friday. Not to mention it is also physically demanding. So try to be selective and skip the on-on. (Seems like the criteria are jungle runs + less preferable choice of the on-on restaurant).
  • Daily, 2 hours of reading books 1 hour for the tubes. Those are lower bounds, which means hanging/going out and dancing has a cap of ~2 hours on a regular weekday that I choose not to code after work.
  • Eat more vegetables and fruits, drink less. Treat your body.

Books I'm reading

So, the peace of mind project starts today. I’m going to experiment it until the end of November, during which I will be on holidays in Australia from 11/8 - 11/17. Will report back around 12/1 ⩲2 days.

Peace

Keep calm and carry on

Seriously, Stop Being So Serious

So here I am, admitting my failures. I guess this is when things will be taking a turn. My biggest problem: being treating myself way way way too seriously. That complicates things, and worst of all, makes myself feel hurt and sad. It’s not that I didn’t know one shouldn’t treat oneself too seriously. I learnt that while I was in the bay area 2 years ago. I remember how I was mocking those who were serious when I just came back to Singapore. I just forgot. I guess I underestimated the power of peer pressure. Anyways, I’m sooooo glad that this crucial motto is rediscovered, thanks to Jitterbug Perfume, thanks to Tom Robbins the author.

Jitterbug Perfume

I finished the book this morning. It was no doubt an amazing book, easily my top 3 together with About a Boy and the Help. (Given I haven’t read that many books whatsoever) I was sad and all and couldn’t sleep last night until 3am. So after I finished the Jitterbug Perfume this morning and threw my laundry in the washing machine, I made my way to my favorite Starbucks in the neighborhood and start reading The Well-Grounded Rubyist. Somehow a quote from the Jitterbug Perfume keeps on bugging me. Something about bad habits. So I pull out my phone and looked it up. I ended up with not just the quote I was looking for, but also many more amazingly witty quotes from Tom Robbins. Here:

“People used to die from germs. Now they died from bad habits. That was what Dr. Dannyboy said. Heart disease was caused by bad personal habits, cancer was caused by bad industrial habits, war was caused by bad political habits. Dannyboy believed that even old age was a habit. And habits could be broken.” ― Tom Robbins, Jitterbug Perfume

“People tend the take everything too seriously. Especially themselves. Yep. And that’s probably what makes ‘em scared and hurt so much of the time. Life is too serious to take that seriously.” ― Tom Robbins

“When we’re incomplete, we’re always searching for somebody to complete us. When, after a few years or a few months of a relationship, we find that we’re still unfulfilled, we blame our partners and take up with somebody more promising. This can go on and on–series polygamy–until we admit that while a partner can add sweet dimensions to our lives, we, each of us, are responsible for our own fulfillment. Nobody else can provide it for us, and to believe otherwise is to delude ourselves dangerously and to program for eventual failure every relationship we enter.” ― Tom Robbins

“Our lives are not as limited as we think they are; the world is a wonderfully weird place; consensual reality is significantly flawed; no institution can be trusted, but love does work; all things are possible; and we all could be happy and fulfilled if we only had the guts to be truly free and the wisdom to shrink our egos and quit taking ourselves so damn seriously.” ― Tom Robbins

“We are our own dragons as well as our own heroes, and we have to rescue ourselves from ourselves.” ― Tom Robbins, Still Life with Woodpecker

“There is no such thing as a weird human being, It’s just that some people require more understanding than others.” ― Tom Robbins

“The unhappy person resents it when you try to cheer him up, because that means he has to stop dwelling on himself and start paying attention to the universe. Unhappiness is the ultimate form of self-indulgence. When you’re unhappy, you get to pay a lot of attention to yourself. You get to take yourself oh so very seriously.” ― Tom Robbins, Jitterbug Perfume

“It’s never too late to have a happy childhood.” ― Tom Robbins, Still Life with Woodpecker

“Curiosity, especially intellectual inquisitiveness, is what separates the truly alive from those who are merely going through the motions.” ― Tom Robbins

“You’ve heard of people calling in sick. You may have called in sick a few times yourself. But have you ever thought about calling in well?

It’d go like this: You’d get the boss on the line and say, “Listen, I’ve been sick ever since I started working here, but today I’m well and I won’t be in anymore.” Call in well.” ― Tom Robbins

“You risked your life, but what else have you ever risked? Have you risked disapproval? Have you ever risked economic security? Have you ever risked a belief? I see nothing particularly courageous about risking one’s life. So you lose it, you go to your hero’s heaven and everything is milk and honey ‘til the end of time. Right? You get your reward and suffer no earthly consequences. That’s not courage. Real courage is risking something that might force you to rethink your thoughts and suffer change and stretch consciousness. Real courage is risking one’s clichés.” ― Tom Robbins, Another Roadside Attraction

The super ultra point is, I should quit taking myself too seriously and Tom Robbins is pretty damn awesome. I should read more books of his =) Peace!

*Quotes references: goodreads, secretshelflife

Just Loop on

I can’t be the only one who listens to a song on loop. White waiting for Tommy and Zi to wrap up work, here is something embarrassingly simple that does the looping, if you uses an audio tag and happen to have Zepto/jQuery like I do that is.

1 2 3 4
$('audio').on('ended', function(){
  this.currentTime = 0;
  this.play();
})

Hurricane Katrina

This is a story about the song Hurricane Katrina by Nadeah. The bottom line is that I love the song, but I didn’t buy the song and I’m not proud of it.

First I heard the song on Triple J How did I learn about such an awesome Australian radio station? That’s another story goes back to Rails Camp@Springbrook and a nice gentlemen who goes by @MarkRatjens on Twitter =)

The song instantly got to me. My first reaction was to go on youtube trying to search for it. There was a couple live versions. I was of course dissatisfied. So next up vimeo.com yet no studio version. But the silver lining is that I found another cute and apparently more famous song of Nadeah’s : Odile

So after playing Odile for a couple times I decided the album “Venus Gets Even” which both songs are from is what I want.

ME WANTZ:

So being a responsible good citizen as I am, I went to iTunes Store. Searched and got: Your search had no results. Hmmm fine. Googled and got to Nadeah’s official site. Sweet, I can ‘buy online’ or ‘by on iTunes’. Let’s try iTunes again, since it would not require shipping of any sort. There I was, iTunes Store France… Never mind, I still know where the buy button is. So I clicked and got: This Apple ID is only valid for purchases in the U.S. iTunes Store. You will be switched to that Store. Try your purchase again. And redirected to iTunes Store home page I was. Back to square one. Fine I’ll have it shipped. So I filled in my shipping details, was redirected to paypal, logged in and bam! something like The merchant does not ship to your country. And redirected I was back on Nadeah’s homepage. Why does nobody want to take my money?!

That’s it, torrent time. There we go: 0 seed and 0 leech. You know how it works - the more you can’t have it, the more you desire it. So the only decent version I have is from streaming from Triple J. If only I could record it…

Googling mac audio recorder gives me Audacity. Following the tutorial I had my audio output redirect to soundflower and simply by playing the time range of the streaming on Triple J the song was recorded. With a bit of cleaning up like some cropping and fading out the last bit. Here is what I got:

Enjoy. I guess that’s what they call a guilty pleasure.

*disclaimer: I do not own the song. The song is not for distribution. It’s only for sharing because it is beautiful.

Gmail’s Little Big Detail

Gone are the days when you thought you’ve sent out an important piece of document to someone and only discovered an hour later that you forgot to attache the file. *facepalm* Now gmail searches for word like “is attached” in your email content, and alerts you when you hit the send button if there’s no attachment to the email. That’s a nice little big detail there. Thanks gmail =)

A baker named Baker in the Memory Palace watching Venus walking by

It started with this talk by Joshua Foer on how one can use techniques like the memory palace to cultivate his/her memory to prepare speeches, remember random numbers and in his case, won a memory competition. I like his final remark about how the convenience provided by technology trained us to be too lazy to remember. But life is short and we are the sum of our memories. We need to be the kind of person who remembers to remember.

It’s a great talk. Having a cultivated memory is not only important but also pretty handy. As sad and visually unpleasant the original memory palace story is, the technique actually sounded pretty fun. So I was reading about the transit of Venus. Here is a little application:

In forever 21, a 5-year-old boy is holding a full mark paper(100/100), while his young beautiful mother (who’s wearing a pair of very big glasses) reluctantly walks away from a big big round mirror to the fitting room.

That translate to:

Transits of Venus occur in a pattern that repeats every 243 years, with pairs of transits eight years apart separated by long gaps of 121.5 years and 105.5 years.