Monday, July 2, 2007

On the beach

We spent the past weekend out on the beach. We went to Aldiana down in Hammamet--even though it was all included, room, food, all drinks, etc.--we were kicking ourselves when the bill came. A bit more than we thought. Especially when we had to drive an hour to get there when the beach on the same body of water (the Mediterranean) is a 10 minute walk away. Oh well. It was nice not to have to worry about anything at any rate. Plus if you click on the link you'll see it is in German...good for me, not so good for Stefanie. It was like little Germany all weekend. They thought I was a German guy on holiday with my Tunisian wife--they would start in German with me and in Tunisian Arabic with her. Which worked out actually since she speaks Tunisian Arabic pretty well.

Wednesday, June 27, 2007

How much do I not miss Cambodia? Let me count the ways...

“According to the PMT Air Web site, the airline also flies within Cambodia to the remote northeastern province of Rattanakiri from the capital, Phnom Penh. Its fleet includes two AN-24s.” Um, yeah, not anymore. Oh, and they confirmed that all aboard died. Tourists missing as plane crashes

Monday, June 25, 2007

If You Can't Stand the Heat....

Recently here in Tunis we have had some REALLY hot days. Yesterday it was 47C and today it was 49C. That equates to 116 F and 120 F. Yes it's a dry heat but when it's that hot who really cares :) Going outside literally felt like someone was blowing a hair dryer in my face. Wow, and to think, I can't wait for the sirocco. Since it has been so hot we haven't been having lessons at the riding club. We just take the kids right to the beach and they swim with the horses in the Mediterranean. It's a cool site to see fifteen kids and horses swimming up and over the waves. Sofia and I went on Saturday afternoon, just the two of us. Unfortunately, I don't have any photos :(

Wednesday, March 28, 2007

Computer Geek Memory Lane

Found this: an ad from 1983 for a TRS-80 that admonishes that the TV is not included--correct me if I'm wrong dad, but I think this is the first home computer we had...I'm trying to remember all the "thrilling outer space and sports games" we used to play. Ooh, and how cool is that, you could use a modem to access tomorrow's news and stocks--it was a time travel machine too! I wonder if it could get over 2400 bps for the trip... Anyway, lots of very cool stuff on this site, a trip down a computer geeks memory lane. Funny article from PC World about the worst 10 computers of all time. Lots of links to other stories about bad products as well.

Monday, March 26, 2007

Hippoclub Dar Naouar

We wanted to send out some photos of the kids riding at the club where we are members.
I can't believe I don't have more. I always seem to forget my camera but managed to snap these about a week ago.
These are of Sofia with my mare Farhouda. I was a little nervous at first letting Sofia ride her but in the end they worked well together. But we will stick to arena work for now just since Farhouda likes to get her kicks out on the beach.
Sofia's instructor wants to them to work together toward showing come fall. I prefer dressage while everyone else at the club jumps. They tease me about my horse "dancing" rather than jumping. But at least they all admit that she is beautiful :)

Here is Dylan with Caramel. She is one of the club ponies. Dylan prefers just riding the ponies on the beach with his friends. The passion Sofia has for horses is about equal to the passion Dylan has for guitars. Hopefully I will get some video of him playing and send that out soon.

Wednesday, March 21, 2007

I've caught a bug...

Called building computers. A friend here brought a Compaq computer with her to her previous country (Niger). It was one of those computer in a box deals. She took it out of the box and it wouldn't work. The IT staff looked at it for twelve hours and couldn't figure it out. Fast forward two years and she's now leaving Tunisia. She advertised this computer for sale, I asked her how much. She said, well, it doesn't work, but I'll sell it for $100 (she paid well over $1000). She also said, come over, take a look and see if you want it. Sure enough, it took me less than five minutes to diagnose and fix the (first) problem. The harddrive power connector wasn't fully seated. The IT guys in Niger should be shot for not first "checking to make sure its plugged in." As annoying as it is to get that as a first question when you call a tech support line, sometimes that is actually what's wrong. She was astounded that I got it working and said "just take it." So I did. Turns out that the harddrive was bad anyway--maybe from all the "troubleshooting" the Nigerans did. Plus there were some other things going on. So, I decided to get a new motherboard, (mudderboard--as Dylan says, and as I would have said when I was his age--mudder dear!) and some other new things to "pimp my computer." All the stuff arrived in the mail and the kids and I put it together Monday and yesterday and it works just fine. I'm trying to hook it up with wi-fi, but my stupid Tunisian ADSL modem doesn't seem to want me to be able to do it--but for under $350 I have a pretty decent new computer. It's not real high-end or anything, but with the mods I've already made (overclocked it to 115%--added a graphics card and added memory) it's as good as the machine I already had. Anyway, I'm itching to build more computers now. It was a lot of fun--in fact I priced all the pieces and found that I can build a decent machine, word processor, email, web browers, limited games, for about $320 (that includes the monitor and everything). I think that Sofia needs one with a pink case and Dylan needs one that has a bright green alien on it. :)

Wednesday, March 14, 2007

So I had a breakthrough last night...

I spend most of my free time on the computer doing homework (free time defined as not at work, not spending quality time with family).

Anyway, this will be less than interesting to you, but I got so excited I had to share. I had a breakthrough last night--I'm not going to get nominated for a Nobel prize anytime soon because of it, but I was excited since this has been vexing me for days.

I'm writing a program that simulates a barber shop. Why a barber shop? Because it demonstrates some basic computer operating system concepts (Windows, Mac OS, Linux, and all the others all have to deal with this particular issue). The problem is that there is only one barber and he can only serve one person at a time. If the barber has several people come in at roughly the same time there has to be a mechanism to control who gets to sit down in the chair.

In a computer system the barber is a shared resource, usually thought of as a piece of data that resides on the system, but could be any other system resource. The customers are programs that need to use the piece of data--the task is to write an underlying operating system (like Windows) in order to match the needs of the customers to the availability of the barber. It’s both complicated and simple at the same time.

Basically what you have to do is have the customer look to see if the barber is already busy--if he is the customer sits in the waiting room and waits until the barber is free. If he's free the customer sits down and gets a haircut. Oversimplified of course, but that's the general concept.

Where my breakthrough came in though was in the timing of it all. Forcing pauses (each haircut is supposed to take a random time between 1 and 3 seconds and customers come in at random intervals, between 1 and 3 seconds), keeping the barber busy, and making sure the waiting room doesn't get overcrowded, are all very manageable actually. But how to continuously generate customers over a two minute period? Ah, that's what has been plaguing me for days. Now that I've solved it, the solution looks obvious.

I was trying to figure out how to make my program to run for two minutes and then stop, while continuously generating new "customers" every 1 to 3 seconds. I was using a for-loop, nested inside either a do- or while-loop, but I couldn't figure out why it was ignoring the do and while loops and only exiting when the for-loop completed. It also wasn't very elegant since I had to predefine an upper limit for the for-loop.

My first solution looked like the following. One other note is that the method call to System.currentTimeMillis() gives the time since January 1, 1970 in milliseconds (a very, very huge number)--120,000 milliseconds is two minutes. So basically, it is supposed to finish when the start time equals the current time minus two minutes (clever, actually--well, I think so anyway). Anyway, here's the code I tried first:

long startTime = System.currentTimeMillis();

while (startTime >= (System.currentTimeMillis() – 120000) ) {

for (int customerID = 1; customerID < 100 ; customerID++) {

threadWait();

customerID++;

}

}

It seemed like it would work, but runtime would take over three minutes and it wouldn't stop until customerID equaled 100! I know, right? Annoying.

Finally, late last night, around 12:30 AM, I realized that there is a much easier (and like I said, obvious) solution. Junk the for-loop since I don't really want to have a limit on the number of customers in the two minutes anyway. Reality is that I wouldn't approach one hundred in two minutes, but once the JVM enters a for-loop I guess it ignores whatever other instructions there might be. And voila! It becomes a simple do-loop that increases the customerID each time it generates a new customer.

long startTime = System.currentTimeMillis();

int customerID= 1;

do {

new customer(customerID);

threadWait();

customerID++;

} while (startTime >= (System.currentTimeMillis() -120000));

Like I said, this will be less than interesting for most folks, so if you've read this far then you have my congratulations. But, if you've read this far AND you've understood everything then we need to talk because I might have some questions for you... :)