Wednesday, April 21, 2010

My Life as a Rōnin

Toshiro Mifune as an old school rōnin
"A rōnin (浪人?) [1] was a samurai with no lord or master during the feudal period (1185–1868) of Japan. A samurai became masterless from the death or fall of his master, or after the loss of his master's favor or privilege."
Source: wikipedia

So Theresa, who is someone that I saw once, but never really met, has a problem. She has a pierced tongue, which freaks me out, but that's my problem. She's the girlfriend of Phil, who is someone that I have met but I don't see a lot. Phil and I hang around  sometimes while holdings things like beer and fishing rods. He has a really cool dog named Austin, who seems problem free. Theresa's problem is an HP netbook running Windows XP. The problem is the computer just ain't right. It's a really cute little machine -- much nicer that my eeePC 900. It has a nice big keyboard and a slightly larger screen. I want one, but, as they say,  it's not in the budget. She gave the netbook to Brian to fix and he worked on it a bit. He cleaned up some, but not all, of the ugly mess. He managed to blow out the passwords that her ex-boyfriend had helpfully added to the machine, and got rid of a few hundred items that a virus scanner flagged as malware.  The system was still borken: it would not connect to the Internet and it was doing really strange things, and it was doing them very slowly. Brian asked me for help. It seems that since none of us is working, the budget for this job is zero. Fool that I am, I agree to take a look at it. It feels like work, which I like, but pays nil, which I don't like. Aw, snap! I have to quit giving it away.

It's so beautiful! I want to put Crunchbang Linux on it!

Mind you, I am not really an IT person. I'm an electronics technician who went to night school to get a degree in electrical engineering. I was a UNIX system administrator for an engineering group, a CAD librarian, a printed circuit board designer, a sort of general-purpose electronics technician. I used to wire TV sets with about a hundred thermocouples so we could see how hot the components would get. (Pretty hot, sometimes.) I run Linux for my desktop, I use Vi and Emacs, GIMP and moc. I can write crap-ass software in C, C++ and Python. In short, I am just another jack-of-all-trades, master of none, who is currently unemployed. Life stinks, sometimes. These skills gives me some ability to beat computers into submission. I try to pick up a few bucks sorting out computer problems for people. These are usually not difficult problems involving hardware repair. These are usually simple things related to system configuration and using software, things that someone could and should handle themselves. Finding a solution usually involves asking Google, thinking logically and maybe learning a thing or two.

I get few takers for my services. People do not want to pay. I hear complaints about the lack of service technicians, closely followed by complaints about what service technicians charge. Service technicians tend to want a living wage. Clients seem to like "free", closely followed by "really cheap". At times it's hard to find a middle ground, so I get few jobs, while they keep doing whatever they do.

My pal Brian once charged a guy $50 to sort out a computer. The guy paid him $12, because it only took an hour. I guess computer techs are only worth $12/hour, with no benefits or secure employment. Brian took the $12, and then formatted the guy's hard drive for him, giving him a minty fresh computer. Brian is a natural born BOFH. The client was not happy. Brian kept the $12. Life stinks, sometimes.

Be afraid.

My aunt's brother is having phone problems. He will not call AT&T to come out and check things out. He says that they charge $80/hour, and he doesn't want to pay that. He thinks that a huge bill will be run up, and that they are out to screw him. AT&T will check the phone line up to the house for free, but he will not even ask for that. He would rather complain about things. Kvetching sure is more fun. He did go out and spend $80 for a new DSL modem, as if that would fix his problem. It didn't. I took a look at things. He has two phone lines, and one is borken. That's as far as I went. I was not about to chase the line through the house from the second floor, especially since he refused to call AT&T to have the phone line checked to the house. I was not going to call AT&T for for him; he should know how do do that. As far as I know, it's still borken. Life stinks, sometimes.

So I fixed Teresa's netbook for free. Why not? A loss leader, and maybe I now have another fine friend that I will hear from only when they need me. It took 3.5 hours, mostly because that's how long it takes. He's what I did:
  • Wifi was not working, but Brian's Cricket modem worked, so I did not have to fix the wifi now or take the little beast home to my router to get Internet access. You can't do jack without an Internet connection.
  • I updated Malwarebytes, which Brian had installed. I like this program; it has done good things for me in the past.
  • I ran yet another full virus scan in "limited driver mode" using Malwarebytes, which removed yet more malware. 
  • I ran Microsoft update. They were 9 updates. 7 or 8 of them were security updates. Why didn't she run Windows update regularly?
  • I then tried to turn Microsoft Security Essentials back on. (Brian had turned it off.) It would not turn on. (Insert joke here.)  OK. Microsoft's anti-virus program did not work on Microsoft's operating system. It also would not reinstall, and gave an error message with the long hex error code 0x8004ff07. (It should have said guru meditation 0x-long-hex-number, but it didn't. Amigas were so much cooler, even when they screwed up. I miss my Amiga.) Following the hex error number to a Microsoft forum, some guy gave this fix:

    1.       Uninstalling MSE
    2.       Reboot.
    3.       Reinstall MSE.
    4.       Cancel the update and scan.
    5.       Reboot.
    6.       Launch MSE and trigger upgrade via Help, Upgrade.
    7.       Download and install completed successfully.

    Someone from Microsoft urged the parties involved to file bug reports with Microsoft. He gave helpful web links. At times it's hard to find a middle ground.  I want Microsoft to run more tests on their code before they release it to the wild. They want me to write bug reports. Neither of these things are going to happen. 
  • I started on the Microsoft Security Esentials fix. After the first step (remove MSE), I made a command decision: I was not going to reinstall it. MSE blows. Microsoft blows. MSE gets good reviews for malware detection, but I have been having problems with it doing simple tasks, things like updating virus definitions and turning on. So I uninstalled it and replaced it with the free version of AVG. The AVG install told me that I should remove MSE. Since I had already removed MSE, I installed AVG anyway. (Déjà vu: I have seen this before.) AVG works OK, despite the bogus warning.
  • I update AVG. I run a configuration scan. I run yet another virus scan using AVG. It finds nothing bad.
  • I turn the Windows firewall back on. (Brian had turned it off.) (Insert yet another turn-on joke here.)
  • If fixed the wifi. Someone or something mucked around with the tcp/ip settings. Once they were set correctly, wifi worked.
Maybe I should have turned on system restore, but I stuck a fork in it because I was done and Starbucks wanted to close. 
     After, 3.5 hours the netbook was now working fine. While it did not demand my complete attention the whole time, I had to be there to shepherd the process. For zero dollars. Brian has another job, which is supposed to pay actual US dollars. Some doofus wants us to install OS X on his HP netbook, and is willing to pay us something for it. Since Apple really doesn't want you to do this, it's kind of tricky. This should be fun.

    Saturday, March 20, 2010

    Cooking With Dog

    I am not an entrée!

    I found another cooking show on You Tube that I really enjoy. It's called Cooking With Dog. Yep, only on You Tube can you find such quality cooking shows. Fortunately, the dog is a narrator, not an ingredient. Maybe the title isn't so ambiguous in Japanese. The dog should get his own TV show, because he's talented. He seems to speak English, albeit with a Japanese accent. He narrates the whole show. He's pretty awsome for an such sissy looking dog. I wonder if he speaks Japanese, too. The lady's usually cooking something tasty. She's pretty skilled in the kitchen. She's also a bit of a fuss budget, but the results look really great.  I bet they taste great, too. I'm not so sure I can cook like her, but I'm going to try.



    The only bad thing is now I want to eat tonkatsu, even though I just finished eating lunch. Maybe later. I need to go to the store and get a few things.

    Monday, March 15, 2010

    CA Updates

    Although I haven't been blogging, work on the cellular automaton program has continued.  It now has an on screen display of some interesting parameters. I also have been learning how to use FLTK 1.1 (Fast Light Tool Kit, pronounced "full tick", although I keep wanting to say "foot lick".) Somehow I have figured out how to write a GUI control program to control the whole ca shebang. I was going to call it lcp, "Life Control Program", but the name seems to imply mind control cult membership and it also seems to be already used in Ubuntu Linux.
    mikey@hatshepsut:~/workspace/ca$ lcp
    The program 'lcp' is currently not installed.  You can install it and be assimilated by typing:
    sudo apt-get install lsh-client
    lcp: command not found
    mikey@hatshepsut:~/workspace/ca$
    So I decided on cacp, "Cellular Automata Control Program".  Now available on Launchpad. Thanks to Greg Ercolano's FLTK cheat sheet and videos, which were very helpful.


    I want to create a war game similar to the old Avalon Hill war games of my youth, something like Afrika Korps or possibly like SSI's Allied General. I'm not sure how to do this, so I'm going to have to put my thinking cap on for a while. While I'm figuring that out, I'll be working on the cellular automatons. I have a few more ideas for improvements.




    Last night's International Mystery was Tatorte ("Crime Scene"), which is one of my faves. The bier drinking, currywurst eating detectives Max Ballauf and Freddy Schenk were on the job again, chasing yet another killer. I like these guys -- they once even arrested an elderly SS murderer for crimes committed back in the 1930's. They sure are natural born po-lice, as they used to say on The Wire. Alas, L'ispettore  Coliandro will return next week. He's definitely la natural born doofus who somehow manages to make time with a hot chick, solve a little crime and order mass quantities of yoghurt. C'est la vie.

    Saturday, February 27, 2010

    CA project status

    The cellular automata project continues.  It is currently working in a bare-bones, command line manner. You can load start files in plaintext (.cells) format, start in single step mode, toggle on/off single step mode while the program is running and select fixed plane or toroid modes on startup. It's now actually usable.

    The toroidal surface took longer than expected, which seems to be the norm for me. (I had changed the code for countNeighbors() in the C++ version and  I had some incorrect code to handle cells on the edges. It took me a while to sort it out.) The code is up on launchpad.

    Features to work on:
    • Save a snapshot of the current state to a plaintext (.cells) file.
    • Input rulesets from the command line.
    • Set the global constants from a configuration file.

    Wednesday, February 24, 2010

    The Third Time's the Charm

     L'ispettore Coliandro on Wikipedia

    I caught the rebroadcast of Inspector Coliandro on MHz Worldview's International Mystery last night. This time the broadcast engineers rediscovered how to vertically center the video on the screen. This is a good thing, because that's where the English subtitles are located. The subtitles make it much easier for me to follow the story, because I sure don't understand much Italian.

    Even with subtitles, Inspector Coliandro is still a doofus who needs to stand closer to a razor. Much closer. Despite his scruffy appearance, he somehow got transferred back to the flying squad, even after ordering a multi-lifetime supply of yoghurt cups for the police. (Sadly, the flying squad has no airplanes. They just cruise around in unmarked police cars, just like the Chicago PD.) He did solve some crime: he rescued his partner from a frame-up, got the goods on a bent copper and put the whammy on a purse snatcher. Even better, he made kissy face with a hot chick from a family of petty criminals. (They were sort of like an Italian version of the Timson clan from Rumpole of the Bailey.) Still, I'm not sure if Coliandro is a keeper, even if he does get lucky with a different hottie in each episode. (I do bet ya that he never even gets near to first base with the smoking hot prosecutor, Dottoressa Longhi.)

    I guess time will tell. They seem to have more episodes of Inspector Coliandro in the pipeline, and they're going to run them no matter what I think.

    Tuesday, February 23, 2010

    Hey, it works!


    Earlier, I determined that I would need to implement just a few more functions in C++ to get a bare-bones version of my cellular automaton (CA) program working. Here's a list of the necessary functions:
    • countNeighbors
    • cellNextgen
    • updateCAMatrix
    • a 2D vector to hold the ruleset information
     I wrote out the functions using pencil and paper. True to my past performance, none of them ran as written on paper. One of these days, I'll get it right from the get-go. Whatever. At least I was correct in that these were the functions required get the job done. At the end of a small hack-a-thon, I was left with a working, bare-bones version of Conway's Game of life. I decided not to fill the blog up with too much source code. If you're interested, the source code is available here on launchpad. I'll only add code snippets as necessary, or when I just feel like it.

    Next on the agenda is implementing:
    • Toroidal surface version.
    • Single step mode.
    • Start pattern file input.
    The nice thing about C++ is that it is faster than Python. In this case, the C++ version of the CA program is much, much faster than the Python version. It's so much faster that I want to take another look at my Python code to see if there's something amiss. I think C++  is my new language of choice for sound and graphics.

    The downside is that C++ is more painful for me to code in. Part of it is my ignorance, and part of it is just the nature of C++. I studied things like "pass by reference", "pass by value" and "dynamic memory allocation" in school, and I quickly left them behind because I was an electrical engineering student, studying other topics. Now that I've started writing more code, and I'm beginning to use C++, I have to start paying attention to these things.

    Python is free and easy language. Python has automatic memory management (garbage collection), while in C++ the programmer must take out the trash. C++ has static typing; Python has dynamic typing. C++ is compiled; Python is interpreted. These differences make Python much easier to use, which means it is much faster to write code in. C++ is more painful to code in, but it sure runs fast. The C++ CA program runs so fast compared to Python version that I think it's worth the trouble of climbing the C++ learning curve. And what a steep curve it is! This is going to take a while.

    One problem that I notice when asking Google how to do things with C++ is the widespread use of C idioms and libraries to solve problems in C++. While C++ was developed from C, and can run almost everything just like C, it also has a number of distinctly C++ ways of handling tasks. It seems that so many C coders segued into C++ they carried many of their C solutions into C++ code. For example, I wanted to convert some text into an integer. Google shows that many people would use a C method:
    ...
    #include <stdlib.h>
    ...
    ...
    int myint;
    char *mystring;
    ...
    myint = atoi(mystring)
    ...
    which works just fine in C++. It's just that C++ has another way, a native C++ way to do the same thing.
            ...
            #include <string>
            #include <sstream>

            using namespace std;
            ...
            ...
            int myint;
            string mystring;
            stringtream ss;
            stringstream ss;
            ...
            ...
            ss << mystring;
            ss >> myint;

    I don't have a big problem with using C idioms in C++; it's just that while studying Python I found it best to write Python code in Python, not translated Scheme or C. I suspect that this will hold true in C++ as well.  While it's true for this example the C code is nice and concise, the C++ version is pretty flexible and can do some interesting things. For example, it could parse a long string of whitespace separated items, and deposit each item into a separate variable. The variables could have varying types, if desired. The infrastructure is already there. I'm just learning this C++ stuff, but it seems to me that you might not always want to immediately just grab a tool from C to tackle a problem in C++.

    Another problem is C++ has changed over the years. If in searching for C++ wisdom you see something like #include in sample code, go somewhere else. That does not work anymore, and hasn't for a while.

    I've been working through Lazy Foo's Beginning Game Programming tutorials. These tutorials are using Simple Directmedia Layer  so they are of great interest to me. I highly recommend them. I got a copy of Programming Linux Games:  Building Multimedia Applications with SDL, OpenAL(tm), and Other APIs by Loki Software, Inc. with John R. Hall. These days I don't buy too many computer books because they are expensive, often quickly obsolete and just do not give you a lot of bang for your buck. I mean, Google is pretty good at answering questions about computing, and my local library has beau coup books on the subject, as well as a subscription to Safari Books Online. I made an exception for this book, because it's from the people who developed SDL, and the excerpts looked pretty good. Now that I have it in my hands, I glad I spent the money. It's a little old (I think some things have changed with SDL since the book was written), but it's still pretty solid.

    Sadly, the author, John R. Hall, is now blessed memory. He died way too young. My condolences to his family and friends.

    Monday, February 22, 2010

    Regular TV

    I'm a terrible couch potato. It's a not-so-secret sin, a guilty pleasure. These days, I watch most of my video entertainment on my computer, rather than on my television. Given a fast enough connection to the Internet, you can get free video on demand. I just love it. I think when I get working again I am going to build a MythTV box and go nuts.

    I don't have cable or satellite. (They cost money, which is currently in short supply.) I just have plain old Chicago-area broadcast TV, which is free.  I don't watch a lot of regular TV these days, except for Sundays. Sundays I can get my fix of foreign detective shows on MHz Worldview's International Mystery. What a great show! It's not available online. WYCC Chicago carries it on channel 20.3. I get to watch Henning Mankell's Kurt Wallander in subtitled Swedish, George Simenon's Inspector Maigret in subtitled French, Andrea Camilleri's Salvo Montalbano in subtitled Italian... you get the picture. Every week, you get detectives in a foreign land chasing the bad guys. I just love it.

    How cool is this: French police get to drink on the job. I love when Inspector Maigret (played by Bruno Cremer) orders une bière or cognac while working. This is normal for him, as normal as eating cassoulet. In the USA, cops aren't supposed to drink on the job.

    My absolute fave is Tatort ("Crime Scene"), which is in German. The episodes currently being shown are with the detectives Max Ballauf and Freddy Schenk, who are in the kripo ("kriminal polizei") in Cologne, Germany. They chase murderers. As the characters in The Wire used to say, they are natural born po-lice. They even arrest an elderly fugitive nazi murderer in one show, which gives them bonus points in my book. I am jealous of them because they have easy access to currywurst and unpasteurized beer, even while on the job.

    I don't like all of the shows. There's a show with some Italians running around in it (OK, it's titled La Omicidi) where the only cool thing is the bad guy, who wrote Dante's La Divina Commedia on the walls of his cell in prison, and is smarter than everyone else in the whole world. Then there's the current guy, Inspector Coliandro, who seems to be a doofus who bulk orders more yoghurt than even the guy on Burn Notice could eat. I'm not the only one who is less than thrilled with Inspector Coliandro. MHz Worldview sent me this in a email:


    Inspector Coliandro: Second Time's the Charm?
    Many of our viewers had mixed feelings about the premiere of Inspector Coliandro last month. The tone of this series is different than some of our other offerings, but give it another chance. You may like the second episode better. Inspector Coliandro: Into A Trap, Sunday, February 21 and Tuesday, February 23 at 9PM ET/PT

    OK, let's give the show another chance. So, it's Sunday, time for the show. I sit and watch some of the news from Germany, which is on before International Mystery. The video is just fine. The opening for International Mystery comes on. The video is just fine. Inspector Coliandro comes on. The video is now "borken". Whiskey Tango Foxtrot. The video is shifted down from the top of the screen, which cuts of the bottom of the video frame, while leaving an empty black bar at the top. The subtitles are conveniently invisible because they are in the cut off portion of the frame. Aw, snap! Can't these idiots center the video on the screen?

    To be fair, if I could find the remote for my wonderful set top converter box I may have been able to fix the problem. Maybe. The first episode, which sucked by the way, had flawless video. The second required knowledge of Italian. Maybe the third time's a charm. We'll see.