Zhu Wu's Blog

The world is a fine place and worth fighting for.

Use AspectJ to Modify Java Standard Library

This article explores the capabilities to alter Java standard library using AspectJ without recompiling source code of Java. It is highly experimental and do not apply it to production environment.

1. Weaving mode and development style

AspectJ...

Continue reading →

Debugging Ruby Methods at Runtime

Due to the dynamic nature of Ruby, it is hard to locate a method definition statically. Thus, we can only find the method definition accurately at runtime. Here are some tips.

Suppose we have an object called foo. We can use foo.methods to find...

Continue reading →

One-Time Password Generation

One-time password is deployed widely as a second factor of authentication to enhance security. As a developer, how should we implement OTP generation in the application and what should be taken care of in each implementation?

The most "naive" way...

Continue reading →

Require Files From Gem's Spec Folder

As a ruby programmer, you probably already know that the code files in gem's lib folder are automatically loaded into $LOAD_PATH when you require the gem.

Today, I encountered a scenario that I have to manually load source code files from spec...

Continue reading →

Rescue from an Invalid "sudoers" File

I was trying some feature today, and that feature required to modify /etc/sudoers. No problem, it seemed that my favorite editor vim can accomplish it. Open up a terminal, I entered sudo vim /etc/sudoers, modified and saved it. Everything was ok,...

Continue reading →