{{ ty's engineering log }}
  ~ non-optimized bits & pieces of my techincal side

>> Index

Automating M1 FBB Login

Out with singtel’s adsl, in with m1’s cable broadband … even though my original plan is to go for fibre broadband, unfortunately opennet told me my home’s fibre termination point won’t be ready until 6mths later, i have no choice but to temporarily settle for a 6mths contract with m1’s cable broadband service.

~ October 28, 2010

Doing It Right ~ Getting Expanded File Path

This is dead simple, yet i never know it, till i saw the *.gemspec generated using ‘bundle gem’:

~ October 20, 2010

How to Test IRB Specific Support (2) ?

This is a quick follow-up of the original How to Test IRB Specific Support ?. If u don’t mind shelling out stuff:

~ September 25, 2010

How to Test IRB Specific Support ?

Yippie, Sourcify is going to support Proc#to_source even in IRB !! Yup, many thanks to @alexch & Florian GroƟ’s RubyQuiz SerializableProc solution. BUT, how the hell am i supposed to test this IRB-specific support ?

~ September 22, 2010

Getting Headless w Headless Gem

Out of the box, capybara runs firefox for selenium-webdriver. It may be fun to see firefox popping up, and automating all user interaction with the browser. I would say that it is a very impressive demonstration of automated testing to non-technical people (eg. my ex-boss). BUT, it is really getting quite irritating for me, most of the time.

~ September 20, 2010

Getting a 1.9.*-ish Proc#source_location

Ruby 1.9.* comes with Proc#source_location, which according to the documentation, returns the ruby source filename and line number containing this proc, or nil if this proc was not defined in ruby (i.e. native):

~ September 20, 2010

My Latest PS1

I really like my latest PS1, it shows my current:

~ September 20, 2010

Enabling JRuby's ObjectSpace

In testing how well sourcify can handle codes in the wild, i need a way to collect all procs from the ObjectSpace, and check if Proc#to_source works as expected. Yet, JRuby’s ObjectSpace is turned off by default to avoid unnecessary creating of extra objects.

~ September 9, 2010

Building a Serializable Proc

Hey, let’s build a serializable proc today !! But before we do that, let’s 1st define what is a serializable proc. A serializable proc differs from a vanilla proc in 2 ways:

~ August 20, 2010

Back to Basics

Enough is enough, i seriously don’t think i’m built to use any online blogging engines. Simply because i’m built to prefer typing in my terminal, using vim, and prefer playing with terminal-interfaced stuff, instead of so called idiot-proof online tools … i guess i’m probably more idiot than idiots.

~ August 19, 2010

Benchmarking any Rake Task

While writing serializable_proc, i wanted to find out how the RubyParser-based implementation fair against ParseTree-based one, here’s a rake task i’ve written to support the following use cases:

~ August 13, 2010

Reliably Getting a Formatted Time String in Ur Desired Lang

Today, i’m spent quite abit of time playing with the very simple Time#strftime:

~ August 6, 2010

Bitten by Array#*

Have u tried Array#* ? Its a pretty cool way to return an array, built by concatenating the original array by n times:

~ August 4, 2010

Lazy evaluating with Enumerable#Any

Most of us know this:

~ July 28, 2010

Everyone Should Start Writing Macros

Did some cleaning & catching up of specs for railsbestpractices.com yesterday, added quite a number of spec macros to dry up stuff, as well as cutting down the complexity within the spec files. Personally, i really really & really like macros, because it is fun to write & easy to write, it has many beneficial side effects:

~ July 22, 2010

Stubbing Only the Nth Instance's Method, Should or Shouldn't ?

A few days back, cross-stub version 0.2.0 has been released, with this release, cross process instance method stubbing is now possible. While doing review of zan’s work, we’ve discussed the possibility of having more control on which exact instance the stub should be applied to, as illustrated below:

~ July 21, 2010

Relatively Unknown Object#instance_exec

Do u happen to know Object#instance_eval’s brother, Object#instance_exec ?? Here’s an uninteresting way of coding wo Object#instance_exec:

~ July 21, 2010

Tidying Up Specs Suite with Otaku

In the specs suite of cross-stub, i’ve built a custom echo server using this approach to support testing of stubbing in another process. Nothing wrong with it, except that it is not so fun & clean. Anyway, over the weekend, i’ve extracted out the echo server code, and put it inside a new & fun project otaku.

~ July 18, 2010

Marshal/Unmarshal Problem with JRuby

While working on cross-stub today, ran into a marshal/unmarshal problem with jruby, caused by binary string encoding issue. Anyway, let’s start by taking a look at some code:

~ July 15, 2010

Building a Simple Server/Client with Eventmachine

In writing cross-stub, i need to write specs to ensure cross process stubbing indeed work as expected. This is achieved by building a simple server/client using eventmachine, here’s how echo_server.rb looks like:

~ July 15, 2010