Digital Stronghold

January 23, 2006

Unix half-duplex pipes

Filed under: Progressive Studies

The pipe ‘|’ is a type of inter-process communication. Its facilities provide a method for multiple processes to communicate with one another.

Simply putting a pipe in between is a method of connecting the standard output of one process to the standard input of another.

joset@kee$ ls -l | grep -i foo

In the example above, the output of ls is written to the input of grep. Obviously, the output of grep is written to the standard output of the shell, the screen.

Here is how a pipe works.

#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
	
int main(void)
{
	int	fd[2], n_bytes;
	pid_t	child;
	char	string[] = "Hello, world!\n";
	char	readbuf[80];
	
	pipe(fd);
	
	if ((child = fork()) == -1){
		perror("fork");
		exit(1);
	}
	
	if ((child == 0)){
		/* child process closes up input side of pipe */
		close(fd[0]);
	
		/* send "string" through the output side of pipe */
		write(fd[1], string, strlen(string));
		exit(0);
	}
	
	else{
		/* parent process closes up output side of pipe */
		close(fd[1]);
	
		/* read in a string from the pipe */
		n_bytes = read(fd[0], readbuf, sizeof(readbuf));
		printf("Received string: %s", readbuf);
	}
	return 0;
}

January 22, 2006

GNU recursive naming convention

Filed under: Progressive Studies

Eradicus Redefines All Deprecated Informations Creatively Upon Scanning (ERADICUS).

A legal alien?

Yesterday, I was triggered by my ego to attend a session of WMSU’s review for the incoming ICT proficiency exam. Each student spent a total of Php 460.00 for the review and test fee. It started last week. Passers of the said exam are guaranteed to be certified ICT professionals as noted by NCC. I was curious about how the review was being held. I was able to set myself in the classroom without catching much of the professor’s attention. It was my first attempt. I was somehow excited at first, but as the review went on, the professor did not talk that much and started filling up the chalkboard. The topic was about data structures. I was surprised with what I have found out. I bet you have the idea.

January 9, 2006

A sticky lesson

Filed under: Progressive Studies

With a dial-up connection reaching 14kbps at max, an ‘emerge-delta-webrsync’ consuming only 5 minutes of your uptime, a free access from 0000H - 0800H, and a script that does nasty things like disconnect after ‘emerge -f foo’ and switch to ‘init 0′, You will not be able to resist the clamor for an up-to-date box.

The lesson began here:

root@kee# emerge =sys-devel/gcc-3.4.4

This does not mean dirty!

joset@kee$ eix -e gcc
	
* sys-devel/gcc
     ...
     Installed:  3.3.6 3.4.4-r1
     Homepage:   http://www.gnu.org/software/gcc/gcc.html
     ...
	
Found 1 matches
joset@kee$

Not realizing that having multiple GCCs installed is normal, and without following the upgrading-gcc-guide, a stupid action followed.

root@kee# emerge -C =sys-devel/gcc-3.3.6

Bang! libstdc++.so.5.0.6, where the hell are you? All programs linked dynamically to this library were paralized! My intention was to clean up gcc-3.3.6 since I have emerged gcc-3.4.4 recently.

After abusing /dev/ppp0’s abnormal upstream and downstream rates, I have finally learned my lessons.

Luckily, my box was revived!
The solution found in http://gentoo-wiki.org proved its worth.

January 1, 2006

Love is an essential inspiration

Filed under: Of Love and Romance

Unrequited love, is, something that you should not take away from the person offering you. It is willing to stay to you forever. It will grow on every assault. The longer it takes, the stronger it gets. Unrequited love finds justice if not being deprived of it having expressed.

Theme designed by Joset Anthony Zamora