Like what I have to say? Subscribe to my blog via RSS or email, and you'll be notified whenever there's a new blog post!
 
Subscribe to Alvin Poh's Blog by RSS reader
Subscribe to Alvin Poh's Blog by Email

Gadgets, Technology, Public speaking and IT from an undergraduate's perspective.

How to Learn and Use Regular Expressions (Regex)

Whoever would have thought that something that looks like gibberish would actually have such powerful usages. Look at this example:

\d\d[/]\d\d[/]\d\d[ ][-][ ]

Would you believe that it’s actually an expression that matches anything of the format of “12/06/08″? Amazing.

I’ve been putting off learning about regular expressions (regex) for the longest time because it seems overly complicated — but I was forced to learn more about it after a recent application demanded of it. And boy was I glad to have finally jumped into it — it’s simply one of the best ways to search for any text pattern.

With regular expressions, you can search for any number of characters, specify whether it’s a number or letter, and even specify a range, like only accept alphabets between B and E. Or only numbers from 1-5.

So if you think about it, the sample regular expression string up there can actually be improved upon. For instance, since the date format is dd/mm/yy, we know that dd can go higher than 31, nor can it go lower than 1. And similarly, we know that for mm, it’s between 01 to 12. The tricky part is yy, because it can vary, depending on how you’re going to use this date. If your application’s more geared towards the future, then keeping the first digit to 0 or 1, and the 2nd digit from 0 to 9 should be just fine.

So as you can see, if you’re a developer, then regular expressions (regex) should be something that you are very familiar and comfortable with, because it makes your life so much easier!

Subscribe to my blog: RSS reader    Email

Does Ireland Have Postal / Zip Codes?

I was packing a parcel to be sent to Ireland when I realised that there was something missing. There wasn’t any postal code! So I thought that I had the address wrong, so I double-checked it again. But the strange thing was that it was correct!

So I went online, and did a bit of research on zip codes in Ireland. Well it turns out that there are no postal codes for most of Ireland! That’s right, Ireland has no postal/zip codes, except in Dublin. The city of Dublin is divided in postal codes 1-24.

Subscribe to my blog: RSS reader    Email

All-Ett vs The Big Skinny Review (Slim Men’s Leather Wallets Review)

Yay! My new wallet from The Big Skinny came in the mail today. I’ve been on the search for a new wallet to replace my old one for a long time because I felt that it was just too thick.

big skinny review - slim wallet

The search was made more difficult because I had a certain set of criteria that I was looking out for. Namely, the new wallet must be:

  • Super thin / slim
  • Look good and presentable with any kind of attire
  • Preferably compartmentalised
  • Have a convenient compartment for cash notes

For that reason, I decided that I had to get a leather wallet, and the wallet should have a full-sized compartment for holding cash. None of those money clips because I think a little privacy is good, and none of those half-sized pockets that require you to fold your cash, because I don’t like fumbling with cash while I’m trying to make payment or collect change.

big skinny review pictures - slim men's leather wallet

Well, so I shortlisted my choices to finally between either the All-Ett (Check out the choices available here ), or the Big Skinny (See the Big Skinny). I made my ultimate decision the Big Skinny because it released a leather version just as I was about to buy.

big skinny leather wallet review - front pocket wallet

This choice of leather turned out to be a bad idea because leather is inherent thicker, which actually goes against my first criteria (that the wallet must be super thin / slim). So the Big Skinny turned out to be just marginally slimmer than my original leather wallet.

big skinny wallet - thinnest wallet

Perhaps I should have chosen the All-Ett (Check out the choices available here ) or the original version of the Big Skinny wallet (See the Big Skinny) instead.

Subscribe to my blog: RSS reader    Email

Toastmasters Table Topic Ideas for Impromptu Speaking - Toasting

Toastmasters should be highly competent with impromptu speaking and giving on-the-spot toasts, so practice that! As the Table Topics Master, determine an appropriate setting for each speaker, then have them make an appropriate toast for the occasion. Some examples can be during a school function about a teacher, at a company Dinner & Dance about your boss, at a friend’s party about a close friend or the host.

Subscribe to my blog: RSS reader    Email

Using Google For Calculations and Conversions (Metric, Distance, ANYTHING!)

Heh. Other than performing searches, Google’s actually great for calculations and conversions. For instance, try typing:

23oz to ml

to convert ounces to millilitres. I haven’t found anything that Google couldn’t convert — I’ve tried converting distances (km, m, cm, inches), volume (l, ml, oz, gm, m, kg) and even currency, like so:

USD10 to SGD10

Google also works as a math calculator, so you can even type our calculations like:

2 * 6

and Google with give you the answer. It works with more advanced functions too, such as:

(23^2) mod 2

which is essentially 23 to the power of 2, then perform a modulos 2 operation. Cool stuff! The only problem with this is that you’ll need an Internet connection, so if you’re offline, all these functions are unavailable to you.

Subscribe to my blog: RSS reader    Email

Toastmasters Table Topic Ideas for Impromptu Speaking - Art Critics

If you have children, a good Table Topics idea is to collect several unique-looking pictures that your children have drawn, and ask your Table Topics speakers to discuss the significance and meaning of those pictures.

Subscribe to my blog: RSS reader    Email

Tim Ferris 4 Hour Work Week Review

When I first heard this joke some time ago, I thought it was just like any other joke. But I saw it again recently (in Tim Ferris’ book, The 4-Hour Workweek), it suddenly dawned upon me about how strong the underlying message is.

An American investment banker was at the pier of a small coastal Mexican village when a small boat with just one fisherman docked. Inside the small boat were several large yellow-finned tuna. The banker complimented the Mexican on the quality of his fish and asked how long it took to catch them.

The Mexican replied, “Only a little while.”

The banker then asked why he didn’t stay out longer and catch more fish. The Mexican said he had enough to support his family’s immediate needs.

The banker was puzzled and then asked, “But what do you do with the rest of your time?”

The Mexican fisherman said, “I sleep late, swim a little, play with my children, take a siesta with my wife Maria, stroll into the village each evening where I sip wine and play guitar with my amigos. I have a full and busy life, Senor.”

The banker scoffed, “I am a Harvard MBA and could help you. You should spend more time fishing and with the proceeds buy a bigger boat. With the proceeds from the bigger boat you could buy several boats. Eventually you’ll have a fleet of fishing boats. Instead of selling your catch to a middle man, you would sell directly to the processor, eventually opening your own cannery. You would control the product, processing and distribution. You would need to leave this small coastal fishing village and move to Mexico City, then Los Angeles, and eventually to New York City where you will run your expanding enterprise.”

The Mexican fisherman asked, “But, Senor, how long will this all take?”

To which the banker replied, “Five to ten years.”

“But what then, Senor?”

The banker laughed and said, “That’s the best part. When the time is right, you would announce an IPO and sell your company’s stock to the public and become very rich. You would be worth millions!”

“Millions, Senor? Then what?”

The banker said, “Then you would retire, move to a small coastal fishing village, take siesta with your wife, play with your kids, stroll to the village in the evenings where you would sip wine and play your guitar with your amigos.”

Yes, then, after wasting your years in the pursuit of money you might finally realize those very dreams that could have been yours without it!

It makes you think about what you really want out of life:

  • Working to get a fast car? And then what?
  • Working so that you can get a relaxing retirement? When you’re in your final years and barely able to enjoy yourself?

Perhaps the point is — why are you working your ass off for? Would you choose money or something that gives you real meaning to your life? Maybe we’re missing the point of life. The 4-Hour Workweek gave me a tonne of insight. If anything, it made me remember about my goals, and made me realise how much I was getting “lost”, as though conformity was a requirement for success. And that “success” was something defined by the people around you, and not yourself. It’s a thoroughly good read that’s entertaining at the same time. It’s been a while since I had a book that I couldn’t put down like this.

In summary, I think that the irony of life is that we give up health and the best years of our life in our youth for the sake of wealth, just for what? To try to recapture our health in our old age with our wealth? Don’t get me wrong — have adequate cash flow is important, but you should be considering a good work-life balance to get the most out of your life. If you’re saving up for retirement and not experiencing life to the fullest in your youth — have you asked yourself why?

I think it’s really important to have a sense of purpose and truly know what you’re living life for. Reading Tim’s book only refreshed, reinforced, and reminded me what I’m really working for.

Subscribe to my blog: RSS reader    Email