Saturday, September 16, 2006

SFD: FOSS @ Claret College of Isabela

First of all, thank you God for giving me the gift of life and the countless blessings. Many thanks to Ma’am Yolynne Medina for choosing me as a speaker. I am so grateful. As well as RJ Ian Sevilla, thanks man! You did a great job! For the audience, muchas gracias for fighting boredom during my presentation.


Click here to view the FOSS@CCI website.


We left Zamboanga City around 0700H aboard on a fastcraft. It’s a fast craft! I did not take any anti-vertigo tabs. It’s not Rialto anyway. We took the last trip around 1730H on our way back. I will never forget this event. My first time to step on Isabela City, Basilan, will never be an ordinary day for me.

Thursday, September 14, 2006

Bubble sort in C

I’m writing this for someone special. Hope this would help. This is at the same time a review of my past lessons. Assuming i,j and tmp are defined as integers, num[] as an array of integers, and SIZE as a constant.



for (i = 0; i < SIZE - 1; ++i)
for (j = SIZE - 1; j < i; --j)
if (num[j-1] > num[j]) {
tmp = num[j-1];
num[j-1] = num[j];
num[j] = tmp;
}

Here is another way of doing it. This is a demo on how the function works on a particular array of integers. a[] is the array of integers while n is the size of the array.



void swap(int *, int *);

void bubble(int a[], int n)
{
int i, j;

for (i = 0; i < n - 1; ++i)
for (j = n - 1; j > i; --j)
if (a[j-1] > a[j])
swap(&a[j-1], &a[j]);
}

void swap(int *p, int *q)
{
int tmp;

tmp = *p;
*p = *q;
*q = tmp;
}

If you are keen enough to observe, check that we can use the swap arguments presented below.



swap(a + i, a + j);

Getting the idea? Pointer arithmetic! God bless and good day.

Wednesday, September 13, 2006

Recognizing unknown partitions in Windoze

This is the starting point if you are planning to develop an Installable File System Driver (IFSD) for Windoze. You can also use this if you want to format partitions that aren’t visible inside your Windoze box.


First thing’s first, fire up a registry editor. Use regedit or any third party editors. Search for the entry:



HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices

If you’re in the right place then, add a new string value. The name should be the drive letter you wish to associate and should be a drive letter that currently isn’t used by your box. The name along with its value should be of the form:



K:
\Device\Harddisk0\Partition1

In Windoze, hard drive numbers start at 0 and partition numbers start at 1. The above example is equivalent to /dev/hda1. You can also verify your partition table without any third party applications such as Partition Magic, GParted, etc. by running diskmgmt.msc on the command line. The drive K: can be replaced with any free drive letter.


Done! No, not yet. Forgetting the Windoze protocol? Restart your machine for it to take effect.

Friday, September 08, 2006

I am created in the image and likeness of God. I am divine. I am born of God. I am a child of God. Everything I have is God’s gift to me. I do not own anything. Everything comes from and returns to God. I am a child of God. Everyone is my brother. Everyone is my sister. I love each person the way I love myself. I am a child of God. God loves me. In Him alone, I place my faith.


This was distributed during our junior’s recollection. I have this posted in my room. I know most of you reading my blog are busied by your jobs and other concerns. I hope this would lighten up your day. Remember, someone out there is ready to back us up especially in times of troubles.

Wednesday, September 06, 2006

Random number generator in 16-bit DOS assembly

Most code for randomizing is not as short as this one. Try to incorporate this procedure in your code and see how it works!



randomize:
in al, 40h ; read micro-clock for initial seed
mov ah, al
in al, 40h
xchg al, ah
or ax, 1
mov rnum, ax
ret

Random number will be stored in rnum. Fairly straightforward isn’t it?


[Edit]


Here’s another solution by sir Eugene Kanindot. This is a 3-digit random number generator.



jmp start

xxx:
mov ah, 02ch
int 21h
and dl, 0fh
cmp dl, 9
ja xxx
add dl, 30h
mov [di], dl
ret

delay:
mov cx, 0

yyy:
mov dx, 0a00h

zzz:
xor ax, ax
dec dx
cmp dx, 0
jne zzz

loop yyy
ret

start:
lea di, numb
call xxx
inc di
call delay
call xxx
inc di
call delay
call xxx
mov ah, 09h
lea dx, numb
int 21h
int 20h

numb db 4 dup('$')

Tuesday, September 05, 2006

Coding therapy

This is what I usually do whenever I am tired and hungry.



#include <GL/glut.h>

void disp(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3d(0.43, 0.12, 1.00);

glBegin(GL_POLYGON);
glVertex3f(-0.75, -0.75, 0.0);
glVertex3f( 0.75, -0.75, 0.0);
glVertex3f( 0.75, 0.75, 0.0);
glVertex3f(-0.75, 0.75, 0.0);
glEnd();
glFlush();
}

void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
}

void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(300,300);
glutInitWindowPosition(0, 0);
glutCreateWindow(argv[0]);

init();

glutDisplayFunc(disp);
glutMainLoop();
}

Redesigned

[Thesis]


Well, it was rejected as expected. Plan B was accepted. Do you know what Plan B is? Look for another project that is.


[Redesigned]


Got nothing to do right now. I tried redesigning my blog. I was executed in The Reincarnation. I failed to defend my country. I didn’t have any time for offensive moves. Opposing guilds were a step ahead. I had 5 fortresses left and 5 attacks went in. I had no choice. I guess it’s time to quit playing. Redesigning the blog as well as the attitude for a big blow.

Friday, September 01, 2006

Protected: Again, for someone special


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