Thursday, August 31, 2006

Sad

Low grades. Time to say “good bye scholarship.” Anyway, I did my best but I failed. Now I don’t know how to explain this. I really do not want to add any more heartaches to my parents. They’ve spent so much already. I really want to help them. This is really sad. Now they would think again that I’m this irresponsible, careless, and mentally inefficient lad. It’s not too late though. Sad and painful because I did my best then I will just be tagged as irresponsible, careless, you name it.

Sunday, August 27, 2006

A new air-soft rifle

So dad bought a new air-soft rifle. Weeee! Now I have two in my room. The new one can adapt a .22 caliber bullet with an improvised hammer. Its recoil kicks a little stronger than when fired with air. Now even if I will ran out of C02 gas tanks it will not stop the fun. Its far and near sights were calibrated perfectly. Unlike my 15-year old air-soft gun whose (0,0) sight lands at six o’ clock.

Saturday, August 26, 2006

Flashback

Now I can update my Gentoo box even on a daily basis. Using my 30GB USB mass storage device, I can do so even if my prepaid internet account runs zero. Here’s a short guide for those who haven’t tried this one yet.


An emerge –sync alternative would be downloading the latest snapshot on any Gentoo mirror site using a machine with a high-speed connection. You might want to salvage the /usr/portage/distfiles of your machine first before proceeding.



kee ~ # rm -r /usr/portage/
kee ~ # tar -xvjf portage-latest.tar.bz2 -C /usr/
...
kee ~ # update-eix
Reading Portage settings ..
Building database (/var/cache/eix) from scratch ..
[0] /usr/portage/ (cache: metadata)
Reading 100%
[1] /usr/local/portage (cache: none)
Reading 100%
Applying masks ..
Database contains 11268 packages in 149 categories.
kee ~ # env-update
>>> Regenerating /etc/ld.so.cache...
kee / #

Now for downloading packages for emerge.



kee ~ # emerge -fp package ... 2> somefilename.txt

The links are now stored in the text file. Download ‘em on a machine with a high-speed connection. Place all the downloaded files inside /usr/portage/distfiles of your machine then.



kee ~ # emerge package ...

I’m bored. Cheers.

Friday, August 25, 2006

Bin to hex converter in 16-bit DOS assembly

Just a quick code like putting your keyboard where your brain is. There should be another way of doing this. I hate this code.



start:
xor al, al
xor bl, bl
xor cl, cl
mov dl, 4 ; use dl as counter

input:
mov ah, 00
int 16h
cmp ah, 1ch
je exit
cmp al, '0'
jb input
cmp al, '1'
ja input

convert:
mov cl, dl
dec cl ; dl - 1
sub al, 30h ; get original value
shl al, cl ; place in the appropriate bit position
or bl, al ; save in bl
dec dl ; prepare for the next bit
jnz input ; must be 4 bits
cmp bl, 9
ja letter
jbe number

letter:
add bl, 37h ; because 'A' - 37h is 0Ah
jmp here

number:
add bl, 30h ; because '0' - 30h is 00h

here:
call display
jmp start

display:
mov ah, 02h
mov dl, bl
int 21h
ret

exit:
int 20h

Try this out, get the assembler here.

Wednesday, August 23, 2006

Moving on

So I bought my self a 2.5″ hard drive enclosure for about 750 bucks. I wish I have my own tools for constructing a device as such. Instead of going for a 2GB USB flash drive, I chose to salvage the 30GB hard drive of an incapacitated laptop. Cool isn’t it? Though relatively slower than a typical USB flash drive, the storage capacity outweighs it.


[To God]


Thanks for being there always.

Tuesday, August 22, 2006

Hetero-stress experience

I didn’t make the CS 315 (Elementary Computer Graphics w/ OpenGL) midterm examination. Sad, but I have to admit that I am mentally, emotionally and physically disturbed these days. It seems that I am carrying a magnet attracting bad luck. I have turned out restless and confused with almost eveything. From waking up to lying down, I don’t know what to do, I don’t know how to start my day. This is the dullest day of my life.


Stress, pressure. Some thrive on it, others find the spotlight and the responsibility to be too much for them. It distracts and scares them. The fear translates in to a physical stiffness. Mentally they become less focused and more self-conscious. Thus, their performance deteriorates.

Sunday, August 20, 2006

Motion for brain rejuvenation

Confusion, defined by WordWeb as a mental state characterized by a lack of clear and orderly thought and behavior, is infesting my brain. Can someone help me? Is there a cure for that? If serenity is sold in the market then I would pack my self dozens of it. Being a computer science student demands a lot of concentration. I’m on a worst-case scenario. If anyone of you out there knows how to cast a spell for brain rejuvenation, count me as one of your targets.

Thursday, August 17, 2006

Bit masking

I was thinking of the hex to bin converter in the previous post. The fun part there was the extraction of the desired bit. With the knowledge in mind, it resulted me to devise a function in C that uses a mask to print out the bit representation of an integer.



void bitprint(int a)
{
int i;
int n = sizeof(int) * CHAR_BIT;
int mask = 1 << (n - 1);

for (i = 1; i <= n; ++i) {
putchar(((a & mask) == 0) ? '0' : '1');
a <<= 1;
if (i % CHAR_BIT == 0 && i < n)
putchar(' ');
}
}

CHAR_BIT is defined in limits.h and holding a value of 8. Try it, it’s fun. I’m bored, just extending my thanks to beandog for enlisting me in Planet Larry: Gentoo Users’ Blogs.

Sunday, August 13, 2006

Hex to bin converter in 16-bit DOS assembly

You can try this out, get the assembler here. This is just a simple hexadecimal to binary converter, a CS217 exercise and not supposed to be pasted here but just for the sake of having a post. Here it is:



input:
mov ah, 00h
int 16h
cmp ah, 1ch
je exit

number:
cmp al, '0'
jb input
cmp al, '9'
ja uppercase
sub al, 30h
call process
jmp input

uppercase:
cmp al, 'A'
jb input
cmp al, 'F'
ja lowercase
sub al, 37h
call process
jmp input

lowercase:
cmp al, 'a'
jb input
cmp al, 'f'
ja input
sub al, 57h
call process
jmp input

loop input

process:
mov ch, 4
mov cl, 3
mov bl, al

convert:
mov al, bl
ror al, cl
and al, 01
add al, 30h

mov ah, 02h
mov dl, al
int 21h

dec cl
dec ch
jnz convert

mov dl, 20h
int 21h
ret

exit:
int 20h

“And my God will meet all your needs according to His glorious riches in Christ Jesus.” - Philip 4:19

Tuesday, August 01, 2006

Protected: For someone special


This post is password protected. To view it please enter your password below: