Friday, January 07, 2005

I should become a certified juice fairy...


didn't you know...you are now the juice fairy :P

you bring me juice to keep me happy... *heh*


I guess this is what happens when you bring juice to your friends... You become a juice fairy!

Hmm, the crypto class is really starting to suck. -_- I guess I'm off to read some crypto textbook.

I had an idea today. I should start my own "How Things Work". However, my own version will have Unix theme to it. Probably, I'm going to read some source codes and start explaining how basic commands work. Maybe, this will take off!

risc-machines.org


risc-machines.org: "This site exists to offer a consolidated reference for the diverse range of RISC and Unix systems. Its primary focus is on technical computing and server systems in all their wide-ranging forms, and we do not limit the field of interest to any specific architecture or operating system, be that physical or philosophical. "


I've just checked the website. There's not much documentation for PowerPC (PPC) and others. It seems as that the website is still under development. However, RISC is an interesting architecture.

When I was taking CS 251: Computer Organization and Design at University of Waterloo, we learned MIPS architecture, and briefly touched on SPARC.

One interesting feature of SPARC was the feature called "register window switching". Normally on other architectures, registers are managed by compilers for precedure calls. However, on SPARC, a register window is shifted (hence, SPARC has abandunt number of registers) so that output of a procedure quickly becomes input of the next procedure.

From many argument I have heard about choosing RISC over CISC was that the instruction set in RISC is simpler and easier to understand. Also, the RISC instruction sets are constant in size.

This thing about RISC makes me remember that line from the movie Hackers. "RISC machines are going to change the world."

Wednesday, January 05, 2005

Another Term of School

I get to have a pleasure of having pure CS and Math term. I haven't been to all of my classes yet but cryptography course doesn't seem to be so promising. :-(

The real professor is away, so I get a pseudo-prof who has been TA'ed this course for past 4 years. I don't know if this is a good thing. I really want to take cryptography course though. It is one of only a few things that interests me deeply. Security... Such a fun subject!

So yah, I am taking four courses this term.
- Computer Graphics
- Computer Networks
- Pure Math: Group Theory
- CO: Cryptography

I'm really hoping that graphics will excite me throughout the term. I'm pretty sure networks will make me happy no matter what as I plan to write an online game someday.

Ah.... School....!

FreeBSD Commands: a minor bug in w and uptime

I think I found a minor bug in the commands w and uptime on FreeBSD. I was a little bit surprised by the fact that these two commands have identical code, but the code is executed differently depending on the executable name.

Oh well, here's my bug report.

Bug Report

Monday, January 03, 2005

My New Year Resolutions...

I think I'll leave my new year resolution to the following "program". :-) Once I settle down with the final version, I'll post syntax highlighted version of this. And a link to an html page.


/*************************************************************************
* New Year Resolutions ver 0.1
*
* Author: Brian Jung Myeng Lee (http://wildpenguin.blogspot.com)
************************************************************************/

#include <resolutions.h> /* defines general wish types, including
a general function pointer to a resolution */

#include <life.h> /* defines all the chaotic and happy events of
our lives, including your personal life */

#include <true_random.h> /* truely real-life like random library.
NOTE this is not a pseudo-random shit */

#include <world.h> /* yes, we live in the world. life cannot proceed
without this */

#define MAX_WISHES 5 /* maximum number of resolutions per year */

int main(int argc, char *argv[])
{
life_t *mylife;
unsigned int life_counter;

/* let me be born and let the world know it */
mylife = create_life();
world_register_life(mylife);

/* now that I am alive, let's make resolutions every year
* and try to make those resolutions come true
*
* NOTE that we are starting from age 0 */

for (life_counter = 0; life_counter < mylife->last_year;
life_counter++) {

wish_t *cur_resolutions[MAX_WISHES];
unsigned int num_resolutions;
unsigned int i;

/* initialize wish list */
(void) memset(cur_resolutions, 0, sizeof(wish_t) * MAX_WISHES);

/* create resolutions */
num_resolutions = true_random(MAX_WISHES);
for (i = 0; i < num_resolutions; i++) {
cur_resolutions[i] = create_resolutions();
}

/* let's live another year.
*
* NOTE this function should automagically execute for exactly
* a year! */

life_live_another_year_with_resolutions(cur_resolutions);
}

/* DEAD! good bye all */
world_unregister_life(mylife);
destroy_life(mylife);

return 0; /* this signifies d e a t h */
}

Friday, December 31, 2004

EE Times -Engineered enhancers closer than you think


Source: EE Times -Engineered enhancers closer than you think

In the next few decades, futurists say, athletes and soldiers will call on artificial muscles to lift heavier loads and run faster. Bionic eyes will let them see distant targets, while "nanobots" enhance their cognitive abilities and genetic-engineering techniques boost their performance under pressure.

"The use of anabolic steroids, in retrospect, will seem almost prehistoric -- as well as stupid," said Jerome C. Glenn, executive director of the American Council for the United Nations University (Washington) and co-author of the book 2004: State of the Future. "In the future, we'll be able to enhance ourselves in other ways that won't be so dangerous."


I don't know what to believe... If this artificial enhancements are going to be possible soon... then are we really looking at turning ourselves into "Monsters"? I hope not. I'm pretty sure there will be government regulations and what not. However, if this is to be used in military as the article states, I'd be afraid of consequences. Indeed, the technology can be used for Good Purposes (TM). But, abusive uses are not avoidable probably.

I sometimes think that human being are best left alone just as a natural product of evolution.

Mars Exploration Rover Mission - One Year Reached!



Wow, it has been a year since NASA sent two rovers, Spirit and Opportunity, to Mars. I remember reading the news about how rovers were going to go to Mars in the beginning of the year. I wish I would understand the technical details, but I do not. I used to dream of being a rocket scientist, but I think that won't happen. Although if I keep working on my Computer Science career with passion, I might one day work for NASA. (I want to study Operating Systems. :-)

Here's the main project page: Mars Exploration Rover Mission

Here's another link to Mars Rover Flashback page: One Year on Mars

It's interesting what man-kind can do now. Check out Slashdot.org for some stories on Mars. Yes, I know I should be referring to NASA's homepage, but Slashdot has lots of fun comments attached to stories!

Wednesday, December 29, 2004

GoboLinux - the alternative Linux distribution

GoboLinux - the alternative Linux distribution: "GoboLinux is a Linux distribution that breaks with the historical Unix directory hierarchy. Basically, this means that there are no directories such as /usr and /etc. The main idea of the alternative hierarchy is to store all files belonging to an application in its own separate subtree; therefore we have directories such as /Programs/GCC/2.95.3/lib."

This sounds really interesting. *nix does have some problems I think when it comes down to managing pre-existing programs installed. Looks like this project is trying to fix some things. Once I tried a similar approach though, it was all good and nice, but writing scripts to make sure that it does the Right Thing (tm) wasn't easy. The FAQ says that the distribution has been out in the wild for about 2 years. Probably, this gave them more than enough time to fix silly bugs.

Maybe, one day, when my Debian box goes bad, I might try this distribution. Although, I am also considering FreeBSD only environment.

Monday, December 27, 2004

Great Recipes Online: Amaretto Smoothie

Great Recipes Online: Amaretto Smoothie:

Amaretto Smoothie

Ingredients:
4 (1.5 fluid ounce) jiggers amaretto liqueur
4 (1.5 fluid ounce) jiggers milk
1 cup vanilla ice cream

Preparation:
1. In a blender combine amaretto, milk and ice cream. Blend until smooth. Pour over ice into 4 glasses.

Serves: 4

Another Amaretto Recipe... Hmm, this looks easy enough to make on my own. Heehee..!

AskMen.com - Amaretto Sour

AskMen.com - Amaretto Sour:

AMARETTO SOUR

INGREDIENTS:
1 1/2 oz. Amaretto
3/4 oz. Lemon Juice
2 tsp. Sugar

Instructions:
Shake well with cracked ice and strain into sour glass. Garnish with a slice of orange.

When do you drink it?
This refreshing drink is perfect for summer barbecues and pool parties.

Hmm... Think I'm going to try this tonight!

CNN.com - Bush parachutes for 80th birthday - Jun 13, 2004

CNN.com - Bush parachutes for 80th birthday - Jun 13, 2004

I sometimes don't understand these people. I came across this article accidentally. He apparently got some soldiers to help him jump. Now, it's okay to use government resources for personal pleasure? Jesus...

The Ten Commandments for C Programmers (Annotated Edition)

The Ten Commandments for C Programmers (Annotated Edition)

Yes, I somehow found this a while ago. And I do not remember why I found it. I must have been looking for some common C programming mistakes. For those who are not very Unix literate, I guess I'll add my own verison of annotation. Please note that the original link has its own annotation.

1. Thou shalt run lint frequently and study its pronouncements with care, for verily its perception and judgement oft exceed thine.

"lint" is a Unix utility to check common C programming errors. It tells you why your source code may not meet the POSIX standard requirements and what not. I never really had a chance to use lint on Linux. However, I tried lint a few times on Solaris and FreeBSD. I was amazed at how well it catches some errors.

For more information, check C FAQ here.

2. Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.

Ever noticed that NULL is actually a macro? Common macro definition is (I think)


#define NULL ((void *) 0)

3. Thou shalt cast all function arguments to the expected type if they are not of that type already, even when thou art convinced that this is unnecessary, lest they take cruel vengeance upon thee when thou least expect it.

I cannot confirm if this is neccessary any more. I have heard that these days, the ANSI standard requires C compilers to "automagically" convert pointers to right types. But this is still a valid point if you are dealing with some old compilers.

4. If thy header files fail to declare the return types of thy library functions, thou shalt declare them thyself with the most meticulous care, lest grievous harm befall thy program.

Hmm, I don't really know this one. So far, I guess I had good libraries to deal with.

5. Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

This point should be taken very seriously. Non-existent array bound checking leads to nasty exploits. Yes, try looking up how buffer overflow exploits are done.

6. If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance.

Check error codes. This is simple. Error codes are also referred to as return codes. I usually seem to skip error code checking. This isn't really nice, but I do check for common errors. *shrugs* (to my defense!)

7. Thou shalt study thy libraries and strive not to reinvent them without cause, that thy code may be short and readable and thy days pleasant and productive.

Code reuse has been big issue in software engineering circle I believe. Code reuse is nice, but I do recommend coding everything from scratch if you are learning some data structures, and low level algorithms. I would say low level algorithms are algorithms used in the basic Queues, Stacks, and others.

8. Thou shalt make thy program's purpose and structure clear to thy fellow man by using the One True Brace Style, even if thou likest it not, for thy creativity is better used in solving problems than in creating beautiful new impediments to understanding.

I personally use K&R style. If you don't know what this point is really referring to, I suggest that you take a look at The C Programming Language. It probably will change your life forever, if you are going to be a C programmer. *grin* The "K&R" style refers to the style used in the book. I'll let you guess where letters "K" and "R" come from.

9. Thy external identifiers shall be unique in the first six characters, though this harsh discipline be irksome and the years of its necessity stretch before thee seemingly without end, lest thou tear thy hair out and go mad on that fateful day when thou desirest to make thy program run on an old system.

In the old days, I believe compilers did not recognize identifiers longer than six characters. I also believe that this is not true in GCC. However, it is always safe to be careful as there are old code and compilers out there.

10. Thou shalt foreswear, renounce, and abjure the vile heresy which claimeth that ``All the world's a VAX'', and have no commerce with the benighted heathens who cling to this barbarous belief, that the days of thy program may be long even though the days of thy current machine be short.

I think VAX is still used in some industries. VAX runs VMS, and I know there is OpenVMS project supported by man big vendors. (Note, VAX is a platform, and VMS is an operating system.) I also have seen some statistics from HP's website stating that there are lots of VAX machines still used. However, I don't remember the URL.

I have studied VAX a little tiny bit in my Computer Architecture course. It seemed to be just... uhh.. yah, I think they were really desparate to get the thing running fast when the common technology today wasn't available.

----
Yes, programming in C isn't an easy adventure, but it's risky and fun. I think this is the aspect of C programming that attracts me and other(?) so much.

Wednesday, December 22, 2004

My Choice of Cocktail - White Russian

From White Russian - cocktail.com

Reciepe:
1 1/2 oz vodka
1 1/2 oz coffee liqueur (Kahlua for me)
milk or cream

Mix the shots and top up a tall glass with fresh milk.

Yes, my favourite cocktail so far is white russian. What's so special about it? I don't know... There's creamy Kahlua and milk! And vodka to add some strength to it. I enjoy it a lot when I want to relax and watch something. I wonder if there are variations on the net. Hehe... White Russian!!

Hmm, make sure that you remember that you are mixing three types of liquid. This means that a little bit of each will actually mean a lot at the end.