Start business or get a degree?

Ok, I’m biased in this. I would suggest you start a business. But I would come off as fake, since I do have a university degree.

In these tough economic times, the value of a university (or college) degree is highly debated. Some people say you don’t need a degree (here and here). And there are also articles and studies saying a degree is (still) the best investment you can make (for example, here and here). [For the latter article, I would add that you be careful of the word “average” being thrown around. Because you read my blog, I would suggest that you’re more than just average.]

DISCLAIMER: The Singapore education system might be different from the system you have in your country. I can’t even tell you if the Singapore system as of writing now is the same as what I went through.

Should I buy the steel sword now or later?

In the role-playing video games I’ve played when I was younger, I would arrive in a town and I’d be immediately broke. I’d go buy the best armour and weapons money can buy. Inevitably, the game designers made it such that it’s highly unlikely you would have enough money to buy every single piece of best armour and weapons for your character(s).

Now you have a decision to make.

“I don’t have enough money. Should I buy that bronze sword now so I can continue with the adventure? Or just tough it out until I reach the next town, where I can buy the steel sword for just a little bit more money?”

That degree you’re thinking of getting is that adamantium sword. And it’s available for purchase about, oh, 8 towns later. You better tough it out…

A degree is traditionally considered the be-all-end-all. Once you have it, you’re set for life. It’ll open doors for you in the corporate world. People judge you (highly?) based on a piece of paper that you have. Job recruiters screen you based on the type of degree you have, looking for computer science degree graduates even though someone with a bachelor of science (majoring in applied mathematics and computational science) is just as qualified *cough*.

There is always another sword better than whatever you have (even adamantium). It doesn’t happen in games because they’re finite. But in real life, there’s always something better you can have. Maybe a professional certificate in something. Certifications by Microsoft, Oracle or any company/organisation that’s respected.

Don’t waste your freedom

Through my primary school, secondary school and junior college days, I had to wake up early and be at school by 7:30am. School ends sometime in the afternoon, where I might have extra curricular activities.

When I was drafted into the military, I was told when I had to wake up. I was told when and what to do in my waking hours. And I was told when to go to bed.

When I started at a job, I had to be in the office at 8:30am. I could only go for lunch between 12 noon and 2pm, and only for 1 hour. I could only go home after 6pm.

I only had freedom of time when I was in the university (and now, when I’m working for myself). When I was in university, I typically took about 20 credits per semester (about 5 classes), which was about 20+ hours of lectures and tutorial work. The class timings were still fixed, but for the first time in my educational life, I had some degree (no pun intended) of freedom. I could choose which tutorial classes I wanted to attend. I could plan my time each week and even each day.

So if you’re looking for advice, I suggest this: Go to university/college and get your degree if you can (keeping the cost of time and money in mind). But start a business while you’re there.

Don’t give me that cranberry about not having enough time. Even if you stretch it, lectures and tutorials only consume up to 30 hours per week of your time. You still have 10 hours more per week than if you’re working full time! Make use of that.

Don’t drink (alcohol). Don’t do drugs. Don’t party (too much). Don’t smoke.

I get that this period of time might be liberating to you, but it’s also the time where your self-discipline is most tested. I’m not saying you can’t have fun. But if you can’t hold yourself accountable now, your future work at a job is going to suck cannonballs.

You have a huge university debt the moment you start. Don’t wait 4 years before struggling to find a job that pays enough that you can repay that.

If the statistics are true, most small businesses fail within 5 years. You have 4 years in university. Start failing then.

You can either start your own business and have some control over your future. Or you can work at a company where the company controls your future.

If you’re reading this, I assume you’re either a mathematician, a scientist or a programmer. Start a business. Get a degree. You’ll probably do fine either way. Even better, start a business while you’re getting your degree.

Time is circular

It’s the end of the year 2009. There’s also something you should know. I’m not affected much by holidays, as in I don’t do anything special on or for them. To me, they’re like another Sunday. The days pretty much blur into each other.

Time is circular. Seasons change, things change, people change, stuff happens, but time goes on. In fact, we humans can’t comprehend how time continues to go on and on (except for the movie Titanic, but that’s another story…) that we have to break it up. Like years, and months, and days.

Time is circular. In fact, the very notion of time itself is questionable. Sure the sun rises at dawn, and sets at dusk. You think the sun cares that you designated a time called “dawn” and “dusk” for it to rise and set? The sun just happened. It just spun all 9 (sorry Pluto) 8 planets around it, while orbiting another larger source of gravity. What does time mean?

Time is circular. In fact, if you think about it, space and time are the same. If you walked from one spot to another, how far did you cover? What if I asked you how long you took? Is it the same? What if you didn’t move, and just sat there for an hour? It just meant it took you one hour to move zero metres.

Time is, perhaps, an illusion.

I started out with the goal of thanking you for reading my blog, for tolerating some of my inane writings, for finding something useful out of others. Then my mind wandered, and I wrote something philosophical, and very likely another one of those inane writings I mentioned. Let me get back on track.

It’s been about 2 and half years since I started writing. Perhaps you found a programming article useful. Perhaps you found a funny article. Perhaps you corrected me on a blatant mistake. Perhaps you’re too shy to voice your opinions (I know, I’m psychic, remember?).

I thank you.

Yes, even you, the mutant genius squirrel who’s living in some forest plotting world domination. Wait… what am I talking about…

My goals for 2010 are:

  • Create a small business selling game/RPG products at Honeybeech
  • Get better at math
  • Get better at programming
  • Get better at writing
  • Make people laugh (in a good way)
  • Tell better stories
  • World domination

Since time is circular, there’s no real point in setting goals just for the new year. You should be doing that all the time, and readjusting as needed anyway. But hey, I need to change my calendar, so it’s a good time as any.

What are your goals?

And this has been brought to you by the entirely self-serving advertisement of the Math Wizard, possibly the smartest RPG character you’ll ever play.

A Tale of Two Timezones

I work with date and time data a lot. I write applications that handle tens of thousands of such records a day. Not sure if I can tell you the exact nature of my work, so I’ll just briefly touch on the peripheral. Besides, if I write it here, I’ll have to hunt down the 7 people who read my blog. Excluding you of course. You’re awesome.

Big Ben
[image by track5]

So a company in United Kingdom provides a … certain service. And this service produces most of the data I work with. United Kingdom and Singapore… not quite London and Paris though…

Anyway, the data is accessed by customers all around the world, so I’ve got to align the dates and times correctly. Luckily, the customers understand the data is in UTC, so I didn’t have to explain too much in the user interface. I just have to present the date/time information correct to the second.

Internally, there’s a fork in opinions. Should the times when the backend processes are run be in UTC, or Singapore time? Purists might say, “All times should be in UTC!” and they convert accordingly. Pragmatists might say, “I’m the only who reads those logs, so it should be in local time!” The customers won’t know what went on in the backend processes, but they might be interested in when their data was last refreshed (which happens to be the process date/time).

This creates an interesting problem. You have to standardise the handling of any date/time data logic, even if it’s just to get the current date/time. Sometimes, I forget whether a particular piece of data is in UTC or local time, and I had to dig out the code that handled it to find out. Because 8 hours is a big difference.

Adding to this confusion, is that the system times of the web server and database server might be off by a few hundredths of a second. So do you use DateTime.UtcNow in C# or getutcdate() in SQL? Does it even matter? I used to work for a manager who insisted all times to be based on the database server’s system time. I admire his stand. I also have to point out the many database calls wasted just to get the current time in the applications…

On the upside, I have to wait for the data to be consolidated for the previous day, before it’s sent over to Singapore for processing. UTC midnight is 8am in Singapore, which is about the time I start work. This gives me some time to react in case of emergencies. You take whatever blessings you have, however small…

Date and time format mistakes in .NET and SQL

I’ve written about how you can manipulate dates and times in .NET before. Here, I’m going to highlight a few avoidable mistakes when manipulating them in .NET and in SQL for database queries.

Case matters

I’m not going to list down all the format strings you can use. Refer to this list instead. You might find this article by Microsoft on best practices useful. I am going to highlight these two letters, h and m.

The small “h” gives you the hour, in 12-hour notation without a leading zero (for less than 10 values). “hh” gives you the 12-hour representation with a leading zero.

The capital “H” gives you the hour in 24-hour notation (or military time) without a leading zero, and “HH” gives you the 24-hour representation with a leading zero.

It’s good user-friendly practice to include the “t” or “tt” notation if you’re using the small “h” to represent the hour (for “A” / “P” or “AM” / “PM” respectively). This way, you know if it’s in the morning or night.

The letter H isn’t so bad. At least you’re still referring to the hour. When you get to M, oh you better watch out.

The small “m” and “mm” gives you the minute (of the time) without and with a leading zero respectively.

The capital “M” and “MM” gives you the month without and with a leading zero respectively. For example, September would be 9 and 09 respectively. See, totally different thing from its small lettered counterpart. There’s the “MMM” and the “MMMM” format string, and I’ll leave it to you to experiment with it.

Now to a common mistake I see: “dd/mm/yyyy“. See any problems?

I’m going to give you a starter custom format string: “dd/MM/yyyy HH:mm:ss“. Burn that into your brain. You can swap “dd” and “MM” if you want. Use “-” instead of “/” as the separator if you want.

The TO_CHAR() function in Oracle PL/SQL

For the equivalent SQL statement to format dates and times in Oracle, here it is:

TO_CHAR(sysdate, 'DD/MM/YYYY HH24:MI:SS')

Note that the function parameter is case insensitive.

Note the difference between “MM” for month and “MI” for minute. For a 12-hour representation, use “HH” or “HH12”.

Tricky formats in Sybase and SQL Server

I don’t know why Sybase and SQL Server don’t just give the ability to easily customise date and time formats. Instead of the string formats in .NET and PL/SQL, they use number codes. Number codes! *urgh*

I actually have a table of the codes and the resulting formats printed out and placed beside my desk, somewhere buried in the chaotic mess of papers. I really just remember 3 number codes: 103, 112 and 120.

select convert(char(10), getdate(), 103)
-- gives something like 17/09/2008 in dd/MM/yyyy format
select convert(char(8), getdate(), 112)
-- gives something like 20080917 in yyyyMMdd format
select convert(char(19), getdate(), 120)
-- gives something like 2008-09-17 05:04:03 in yyyy-MM-dd HH:mm:ss format

I’m using the .NET format string notation in the comments. Note that number code 120 is only available in SQL Server. The other 2 codes are available in both Sybase and SQL Server. There are other codes (which you can explore here). I just frequently use those 3, particularly 112.

If you’re used to the American date display, then this might be useful:

select convert(char(10), getdate(), 101)
-- gives something like 09/17/2008 in MM/dd/yyyy format

Note that you can do something like

select convert(char(6), getdate(), 112)
-- gives something like 200809 in yyyyMM format

Note the char(6) part (versus char(8) originally). I do this quite often too.

Now for the mistake in T-SQL. What do you think is wrong with this?

select convert(char(10), EFF_DATE, 103) EFF_DATE
from Customers
order by EFF_DATE desc

Yes, I’m being deliberately vague. Use your powers of deduction to fill in the blanks.