1 December, 1997


Funkyvision

Mon Dec 1 09:43:05 CST 1997

I spent last night getting the code for the random color on the background of this page working happily through Apache. Caveat: SetUID execution. Augh!

Code itself is purty;

#include <stdlib.h>
#include <time.h>

main() {
	char str[8];
	int ctr;

	str[0] = '#';

	srand(time(NULL));

	for( ctr = 1; ctr < 7; ctr++ ) 
		str[ctr] = (rand()%6 + 65);

	str[7] = NULL;

	printf("%s", str);
	}

In English, that means we make an array of eight characters. The first character is a # because that's what a color value starts with - say #aaaaaa for white. characters 2 through 7, or in this case, characters 1 through 6, because arrays in C are zero-based, are then filled with random numbers between 65 and 70. That's the kinda subtle part ... rand() returns a random number ... %6 means to take a number, divide it by six, and return the remainder. So, rand()%6 returns a number from 0 to 5. Adding 65 to that ...

What am I doing just throwing numbers into the array of characters? See, characters are really just integers interpreted as characters. An integer, int in C, that might have a value of 65 could be looked at as a character - a char, with a value of 'A' ... so when we say str[1] = 65 we are saying that the second int in the array str will hold a value of 65. However, str is an array of chars, and when we print str out as a string, that second position will be displayed as A and not as the number 65.

And, since we're making a string, the last character in our array is the NULL character, which means it's the end of a string. Then we print the bugger out with printf("%s") which mean to print out a string. Note that printf("%d", str[1]) would instead print a number between 65 and 70 ... printf("%c", str[1]) would print a character between 'A' and 'F' ...

For more information, read man pages for the various functions, and for ASCII.


Present Condition

Mon Dec 1 21:34:36 CST 1997

I'm at the Undergrad, trying to relax, so I can point my mind at getting work done.

There was insomnia last night, partly from the sleep I got over the weekend. Went to bed like 0230h but didn't nod off 'til about 0400h. Rose for work shortly after 0800h without great ordeal ...

But now, have headache. Maybe had I made it to breakfast ... I had a yen for eggs overeasy on toast ... mmm ... coz Uncle had made as much for me yesterday, as well as helping me fix the bike. I suggested that perhaps for summer I might occupy the front vestibule of his place, given Grandpa no longer lives there, and that Jessy has her eyes on my room. Mainly, I like a sunny spot to sleep, it helps me wake up in the morning.

He seemed amenable. He might he taking the third floor apartment though as Laird is moving out. He is also considering moving back to the basement. Jessy, I think, would be ill-advised to hold her breath to get that room. It's not such a great spot anyways, though Uncle notes that there are windows, and they do face south ...

Myself? Well, another year of school, pretty much, possibly living in Chicago over the summer, but then I'll most likely want my own place to live, whether I'm living in Chicago or not.


Modified Women

Mon Dec 1 23:46:52 CST 1997

It's a toss up as to whether I'll do my B&TW homework for tomorrow. My head hurts. Whiney Whiney ...

i got an adapter from Pontus Fuchs of Sweden today, and after much pained digging around inside my A3000 got it in so that the A3000 can now use a PC keyboard. Yay!

and right after that Kat called. I'd kinda hoped that maybe she wanted to tell me what she'd figured out over the weekend, but there's no rush to that. Instead she wanted to show me something.

she has an eyebrow piercing!

And extra piercings in her ears.

I swear, sometimes I think she's a little bit like Jessy could have ended up like. Whatever that means.

I had taken a walk earlier, to work off some stomach unhappiness. Bummed around the Undergrad after passing through the Union ... now the tummy feels alright, but the head is still ... unhappy.

Oh, and Rachel got brown contacts. I don't like 'em coz her eyes look all cloudy. Moshen likes 'm, but then he's a freak. Katarina's own facial modification pleases me more, even if it throws her symmetry off.


22 November << 1997 >> 3 December
H O M E


This document last modified Monday, 03-Jul-2006 05:22:01 UTC <dannyman@dannyland.org>