Sunday, May 1, 2011

Literature: Red Light

Don't ever let people decide how you should travel in this road of life. Wrote this poem as a simple message of that:

Red light of the sun
Fading into the night
I'll shut the shutters
I'll sit and just breathe

I breathe in sorrow
The slave of your world
Every little action
Only falls onto me

To follow your words
Is to just wait there
At the crossroads of life
Stopping at your red light

But do you know?
On this journey
Only change can happen
When I change myself

Red light of the sun
Giving away to the night
I'll shut the shutters
I'll sit and just breathe

Breathe of peace
The ruler of my world
Courage of conviction
In everything I do

So I say I believe in you
Do you believe in me?

Monday, April 18, 2011

[IT] Advantages of Hexadecimal



If you work with computers on some level beyond Microsoft Office or browsing the net, at some point, you will run across hexadecimals. What are they and why do people bother using them when they seem something better left for assembly programmers?

Hexadecimal is just a base-16 number system. We humans because we grew up in a society where most of us has 10 fingers, use the decimal system for the most part. In hex, in addition to the numerals 0-9 to represent values zero through nine, we also have letters A-F to represent values ten through fifteen.

Consider the number 10995. In decimal system, we have
(1 x 10^4) + (0 x 10^3) + (9 x 10^2) + (9 x 10^1) + (5 x 10^0) = 10995

In hexadecimal system, we have 2AF3:
(2 × 16^3) + (10 × 16^2) + (15 × 16^1) + (3 × 16^0) = 2AF3

What's important is to realize that numbers are abstract counting notions which can have infinite ways of displaying in reality. Actually, base 10 really offers no advantage to us except that we humans are born with 10 fingers and toes which make it easier for us to count. We could use base-23 or base-159 for no good reason.

However, there are distinct advantages to using hexadecimal in computer science:

1. You can store more information in the same space. In a hex code with two digits you can express the numbers 0 through 255. In a decimal code with two digits you can count from 0 to 99.

2. Hexadecimal (base 16) converts easily to binary (base 2), which is used by computers at the fundamental level. A two digit hexadecimal number can range from 0 to 255, which can be expressed in eight digits of binary code.

Programmers sometimes like to throw around dorky jokes that ordinary people won't get. The following is a good test to see how dorky you are:

3x12=36
2x12=24
1x12=12
0x12=18

Programmers typically put 0x in front of a number that's in hex base. This way, people don't get confused. So here, the first three lines are interpreted as multiplication while the last is considered the hex interpretation of 12, which is (1 x 16^1) + (2 x 16^0) or 18.

Here's a better one:

Q: Let’s say only you and dead people can read hex. If you teach your buddy how to read hex also, what do you all have in common?
A: You are all deaf.

If you need an explanation, you're still not quite a dork. Work on it though! Still, for completeness, explanation: "dead" refers to a hexadecimal number DEAD (57005 base 10), as opposed to the state of not being alive. With you and your friend, that's two more to the group, so add 2 to D to get F. Hence, DEAD + 2 = DEAF.

Sunday, April 17, 2011

[IT] Short Discourse on Encoding (ASCII, UTF-8, etc.)

As Joel Spolsky, the co-founder of Frog Creek Software and the very popular blog/company Stack Overflow, says, every programmer ought to know about the basics of encoding considering how many of us don't. It's really quite sad. So this will be a brief gist of what I gleaned from reading his article.

In the old days when English still dominated the computer world, a code called ASCII was able to represent every character using a number between 32 and 127. Space was 32, the letter "A" was 65, etc. This could conveniently be stored in 7 bits. Most computers in those days were using 8-bit bytes, so not only could you store every possible ASCII character, but you had a whole bit to spare. Code below 32 were unprintable and were used for control purposes like 7 which made the computer beep.

But the codes from 128-255 were left entirely open to the geographic region's inclination. For example on some PCs the character code 130 would display as é, but on computers sold in Israel it was the Hebrew letter Gimel (ג), so when Americans would send their résumés to Israel they would arrive asrגsumגs.

The eventual adopted ANSI standard secured all agreements below 128 but left what's above 128
to your regional taste. Before the Internet this whole patch of mess worked to a degree but as soon
as the Internet came in, something had to change. Enter Unicode.

Unicode

Some people are under the misconception that Unicode is simply a 16-bit code where each character takes 16 bits and therefore there are 65,536 possible characters. This is not, actually, correct. It is the single most common myth about Unicode, so if you thought that, don't feel bad.

In fact, Unicode makes you think a different way about encoding characters. Until now, we've assumed that a letter maps to some bits which you can store on disk or in memory:

A -> 0100 0001

In Unicode, a letter maps to something called a code point which is still just a theoretical concept. How that code point is represented in memory or on disk is another story.

Every platonic letter in every alphabet is assigned a magic number by the Unicode consortium which is written like this: U+0639. This magic number is called a code point. The U+ means "Unicode" and the numbers are hexadecimal. U+0639 is the Arabic letter Ain. The English letter A would be U+0041.

Encodings

The earliest idea for Unicode encoding, which led to the myth about the two bytes, was, hey, let's just store those numbers in two bytes each. So Hello becomes

00 48 00 65 00 6C 00 6C 00 6F

Couldn't it also be:

48 00 65 00 6C 00 6C 00 6F 00 ?

the people were forced to come up with the bizarre convention of storing a FE FF at the beginning of every Unicode string; this is called a Unicode Byte Order Mark and if you are swapping your high and low bytes it will look like a FF FE.

For a while it seemed like that might be good enough, but American programmers were complaining. English rarely used code points above U+00FF and the thought of wasted bytes shocked them. Besides, who's going to convert the ASCII character sets over?

Thus was invented UTF-8. UTF-8 was another system for storing your string of Unicode code points, those magic U+ numbers, in memory using 8 bit bytes. In UTF-8, every code point from 0-127 is stored in a single byte. Only code points 128 and above are stored using 2, 3, in fact, up to 6 bytes.

This has the neat side effect that English text looks exactly the same in UTF-8 as it did in ASCII, so Americans don't even notice anything wrong. Only the rest of the world has to jump through hoops. Specifically, Hello, which was U+0048 U+0065 U+006C U+006C U+006F, will be stored as 48 65 6C 6C 6F.

There are actually loads of other encoding out there but since December 2007, the most popular encoding on the web has been UTF-8 so it'll be good to know more about it. It's important to know the encoding for messages over the web. No such thing as plain text anymore!

For an email message, you are expected to have a string in the header of the form

Content-Type: text/plain; charset="UTF-8"

For a web page, the original idea was that the web server would return a similar Content-Type http header along with the web page itself -- not in the HTML itself, but as one of the response headers that are sent before the HTML page.

It would be convenient if you could put the Content-Type of the HTML file right in the HTML file itself, using some kind of special tag. Of course this seems to be a Catch-22: "how can you read the HTML file until you know what encoding it's in?!" Luckily, almost every encoding in common use does the same thing with characters between 32 and 127, so you can always get this far on the HTML page without starting to use funny letters:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

But that meta tag really has to be the very first thing in the section because as soon as the web browser sees this tag it's going to stop parsing the page and start over after reinterpreting the whole page using the encoding you specified.

What if a poorly informed web designer doesn't put this tag though? Apparently, every browser does something different to try to guess the character set. Sometimes, they get it right. Sometimes wrong which you the web browser will have to try to figure out what encoding the web designer actually meant for you to use. Is it Chinese? Hindi? Arabic? Good luck!

Thus comes the central point that for every web document you code up, be sure to include the encoding type!

For his whole article, I heartily recommend reading it here:

Friday, April 15, 2011

Self-improvement: Efficient Management of Time


There is a difference between someone being effective and someone being efficient. The former is doing the things that get you closer to your goals. The latter is doing things regardless of their importance in the most economical manner.

For instance, a door-to-door salesperson is very efficient at selling door-to-door but he is utterly ineffective. He could just use email or direct mail.

Two things to keep in mind that might be fairly obvious but often overlooked are:

1. Doing something unimportant well does not make it important.

2. Requiring much time does not make a task important.

The key is realizing that WHAT you do is far more important than HOW you do it. Efficiency is only secondary to effectiveness.

How do you become more effective? The key is having more time by doing less. OK. what does that mean? Many people define a to-do list. But how many people also define a not-to-do list? Probably not many do.

A daily to-do list should only have one or two items. Just ask yourself this simple question: "If I can only do one (or two) thing(s) today, what will it be?" How you identify these crucial items is as simple as asking yourself "If this is the only thing I accomplish today, will I be satisfied with my day?" Make sure that you accomplish the task listed in your to-do list no matter what by the end of the day. Be realistic with your daily milestones but don't make them too easy to achieve! If you have to sacrifice a social life or a late charge on loans for it so be it.

Just setting one or two tasks a day is already cutting your workload dramatically. But you have to do some them efficiently. This can be forced through using a timer on a stopwatch or this website:

http://e.ggtimer.com/5minutes
(or 1hour or whatever after the second slash)

This is a set limit on the amount of time you have in accomplishing the task. Remember that you're still expected to finish the task by the end of the day so be generous with yourself.

To generate a not-to-do list is almost as easy as generating a to-do list and there will actually be more items. Ah, don't you feel good being lazy? Haha. Simply ask yourself what are the top three activities that I use to fill time to feel as though I've been doing something important. These are aka crutch activities, things that you do to avoid having to do things you really have to do but still have a little value so you don't feel completely bad. You might put things like watching the Discovery channel on TV, reading online news or blogs, and reading random books at a bookstore.

Another thing to note is managing interruptions. You might have the best plan in the world to execute your well-defined goal of the day but then you get that phone call from someone and you end up talking for over close to 2 hours. Then an urgent meeting that you just have to attend. Then some emails to send off. By the time you have lunch and get back, the day is about half over and you haven't even started on your daily goal.

What to do? Actually, it's tips that should go into a general not-to-list:

1. No phone calls while you're working unless it's urgent. Let people know this beforehand by setting a voicemail which tells people when not to bother you. Eventually people will get it.

2. Make business phone calls exactly that. Business phone calls. Do not go off on tangents or letting other people go on tangents by talking about the weather and such. Know beforehand what you're going to talk about.

3. No emails except 2-3 times daily at set times that you check. Recommended is 12PM, 4PM, or 8PM. Do not wake up and check your email immediately. If you do it in the morning, you can get trapped in this email hole which'll take up a good portion of your morning. Also do not check it at night. That will just give you insomnia.

4. No social networking sites, online chatting, watching TV, or any other time wasters except after you've finished your task for the day.

5. No meetings unless absolutely necessary. Meetings for the most part wastes a lot of time. Agree to no meeting where there's no clear agenda and end time. Otherwise, make excuses if you have to for why you bailed a meeting early or why you couldn't make it at all. Of course, always ask someone to email what was talked about at the meeting. Reading the email will take up a fraction of the time of going to the actual meeting. Repeat this enough times and people will get used to your permanent absence. Of course, you have to do actual work. Just make sure you do more work outside of meetings than in them. Let people know what you've done through more efficient means of communications--like talking to them when you actually have a problem or emailing status updates.

There you go. Just follow your to-do-list and not-to-do list (including the general ones listed above) and you should be on your way of using your time much more effectively. With these tips, you'll find that you have more time to do things that are not work. Remember that being overwhelmed is as bad as doing nothing. Having these lists daily will help make sure you fall into neither category.

Thursday, April 14, 2011

[Sociology] Dating Social Progression?



Probably at a used book store somewhere sometime, I picked up a 1950s guide on dating called Facts of Life and Love for Teenagers by Evelyn Millis Duvall. I really like reading retro books and its subject matter was too curious for me to avoid. Since then, it has comfortably reclined on my book shelf gathering dust until now....

As I'm reading this, I'm wondering just how many of the things Dr. Duvall discussed still applies today. I'll list out five that I think no longer holds true in modern American society. Quoted verbatim from the book:

1. In a poll of high-school boys, more than two-thirds said that they do not like to have girls call them on the telephone. They feel that this is a boy's privilege, and that a girl seems forward when she phones a boy.

2. When in doubt about what to give a girl, flowers are usually safe.

3. Boys find that girls do not like the indirect approach that starts, "What are you doing next Friday night?" That puts the girl "in a spot." Boys should not act as though they expect to be refused, as Amos does when he says, "I don't suppose you'd like to go on a date with me, would you?" This backhanded kind of invitation is apt to make the girl feel uncomfortable and is a mark of the boy's feeling of insecurity, too.

4. A girl must be extremely tactful; boldly buying her own ticket or handing him the cash in public may be embarrassing for him.

And this line is quite hilarious. Ah, if only teenagers followed her advice then but too late for America now:
5. ... They are usually the more immature, impulsive boys and girls who have not yet learned that there is a place for everything in life, and that even a kiss is better when it is reserved for the times, the places, and the persons that give it most meaning. With experience a man is able to tell a woman he loves her with his eyes; a woman can express her adoration in a hundred little gestures that only he can understand. It is only during the calf-love stage that love-making is open to the herd.

There are some advance that very well still holds water though:

1. A good conversationalist is not necessarily the one who talks all the time. More often he or she is the sensitive person who listens well and is not afraid of the silences that come along from time to time.

2. You overcome a bad reputation by gaining a good one...This times time and perseverance, but it is the only sure way.

3. Your hospitality is one of the nicest things that you can offer to those you like.

4. You are fortunate if you and your parents have worked out your dating questions by now, for dating is much more satisfactory when it has their approval.

5. The first person you loved was yourself. Little babies are capable of loving no one else at first. They have not had enough experience even to be aware that there are other persons to love.

I'll probably pick up this book again and give my thoughts on it in greater detail but I leave you these few points to ponder upon.