29. ágúst 2005

Kill everyone but me

If you think that programming is in anyway sissy, just consider this: "Programmers have to make a decision every day to create programs that perform tasks that could be considered 'Electronic genocide'". So think once, think twice.. think don't make fun of your fellow programmer! (and don't drive you car on the pavement)...

#include "KillEveryOneButMe.h"

OSStatus KillEveryone(Boolean KillFinderToo)
{
ProcessSerialNumber nextProcessToKill = {kNoProcess, kNoProcess};
ProcessSerialNumber ourPSN;
OSStatus status;
ProcessInfoRec infoRec;

Boolean processIsFinder;
Boolean processIsUs;
Boolean specialMacOSXProcessWhichWeShouldNotKill;
Boolean finderFound = false;

GetCurrentProcess(&ourPSN);

do{
status = GetNextProcess(&nextProcessToKill);

if (status == noErr){
//First check if its us
SameProcess(&ourPSN, &nextProcessToKill, &processIsUs);

if (processIsUs == false){
infoRec.processInfoLength = sizeof(ProcessInfoRec);
infoRec.processName = NULL;
infoRec.processAppSpec = NULL;

if (GetProcessInformation(&nextProcessToKill, &infoRec) == noErr){
processIsFinder = false;
if (infoRec.processSignature == 'MACS' && infoRec.processType == 'FNDR')
processIsFinder = true;

//since this is Mac OS X we need to make sure we don't quit certain applications
specialMacOSXProcessWhichWeShouldNotKill = false;
if (infoRec.processSignature == 'lgnw' && infoRec.processType == 'APPL'){
//don't want to quit loginwindow on Mac OS X or system will logout
specialMacOSXProcessWhichWeShouldNotKill = true;
}else if (infoRec.processSignature == 'dock' && infoRec.processType == 'APPL'){
//don't want to quit Dock on Mac OS X
specialMacOSXProcessWhichWeShouldNotKill = true;
}else if (infoRec.processSignature == 'syui' && infoRec.processType == 'APPL'){
//don't want to quit the SystemUI server on Mac OS X
specialMacOSXProcessWhichWeShouldNotKill = true;
}

if ( ((processIsFinder == false) || (KillFinderToo == true))
&& (specialMacOSXProcessWhichWeShouldNotKill == false))
(void)SendQuitAppleEventToApplication(nextProcessToKill);
}
}
}
}
while (status == noErr);
} // KillEveryone

18. ágúst 2005

4. ágúst 2005

Eventful past couple of days

Yup.. as you guessed I'm shamelessly lying in the title of this post. Not much happened.. not much at all.. :)

The first weekend of August, for those of you that don't know, is the weekend before the "Frídegi verslunarmanna" (the following Monday) which is the day where all the shop-girls and -boys get the day off. Somehow this day-off translated to the rest of the nation and now everybody in Iceland gets the day-off. Crazy Icelanders..

This weekend is the renowned "icelandic alcohol consumption and partying weekend" where numerous out-door festivals are held (the biggest of them all in the Westman Islands, a group of islands just of the south-cost of Iceland). Each year every youngster grabs a tent/sleeping bag/raincoat and a supply of alcoholic beverages (usually in such a volume that it would be considered a year-supply in any other civilized society) and goes to anyone of these "festivals". This behavior results in a traffic-chaos and usually cost several people their lives each year (as well as other alcohol-related accidents). So these past four years I made it my policy not to partake in this insane behavior and just stay in the city for the weekend.

So this weekend I just stayed home, invited myself to a dinner at mom's.. twice!, went to one out-door concert which was held in the Reykjavik Zoo (which is just a bunch of farmyard animals.. no giraffes or anything.. still fun though..) and just did almost nothing. It was so sweeeet :) and I didn't die or anything.

My girlfriend is only two weeks away from handing in her final paper for her undergrad diploma so I have nothing to do (but stay out of the house) so if you aren't doing anything either.. give me a call, I'm always up for a coffee/walk/talk/biking/hiking/movie.. just about anything..

YesNo
Out-door activitiesSitting indoors playing
a stupid computer game!