Other People’s Code – Open Source

I think that open source software (with license agreements that let me use it in commercial applications even if it means contributing my changes back) is great. We use it extensively in my work and have contributed back our changes as required in one component. Another component we use has proven to be a constant thorn in my side that I’m almost at the point that I’m going to scrap the code and write it myself; however, it does stuff that I don’t know how to do. I’ve had to fix this particular bunch of code twice in the last week. On a positive note, it keeps me employed.

Bluetooth Vodoo

I think that the concept of Bluetooth is great; allow devices to connect without wires. While there are standards on what to do, in my experience it just doesn’t work right all the time. With my cell phone, I still can’t get a headset to function properly. In dealing with software, I spent the last several days tracking down an issue customers were having with our software. As far as I can tell, it was Apple’s implementation of Bluetooth that got messed up on some people’s machines which caused our stuff to stop working. Of course, people blame us. Some day maybe I won’t have to fight technology to use it.

WirelessModem up for sale

After a lot of thought, I’ve decided to put my WirelessModem program up for sale. I’ve neglected the software for too long due to my own lack of interest (I haven’t used the software since I got rid of my Treo 300 a few years back). If anyone is interested in purchasing the source code to both the Macintosh side and the Palm OS side, please contact me. Serious offers only.

Voicemail notification

Whenever we get voicemail at home, MCI sends an email to whatever address I specify. This is great, but I don’t recognize most phone numbers. So, today I got the great idea to write a script that takes the inbound number, looks it up in an SQL database, and then sends the name to my cell phone. This is extremely cool; then I was able to import the names from my address book into the database. I learned out php, sed, and SQL in this particular exercise.I’m glad that I have the knowledge to learn whatever I need to in order to make technology work for me.

I used 2 scripts, the first is called from /etc/mail/aliases as in:

vm_notify:              "|/usr/local/bin/vmnotify_stage1",

Where vmnotify_stage1 is:

#!/bin/sh
sed '
{
        /You have received/!d
        h
        s/You have received a Voicemail message from //
        h
        s/.//

}' | /usr/local/bin/vmnotify_stage2

and

vmnotify_stage2 is:

#!/usr/bin/php -q 
<?php
$server = "localhost";  // server to connect to.
$database = "contacts";       // the name of the database.
$db_user = "username";        // mysql username to access the database with.
$db_pass = "password";   // mysql password to access the database with.
$table = "callerid";       // database table

$phone_number = trim(fgets(STDIN)); // reads one line from STDIN
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());

$result = mysql_query("SELECT * FROM $table WHERE `phone_number` like "%$phone_number%" ORDER BY `phone_number`", $link)
or die ("Could not read data because ".mysql_error());

$text = "";
$num_rows = mysql_num_rows($result);
if ($num_rows > 0)
{
        while ($qry = mysql_fetch_array($result))
        {
                $text = $text . "$qry[name] ($qry[phone_number])n";
        }
}
else
{
        $text = $phone_number;
}

mail("example@example.com","Voicemail from:", $text);

mysql_close();

?>

This may not be the most efficient way, but it appears to work.

Crashes, crashes, crashes

One thing I really hate about releasing software is that no matter how much testing you do, it is bound to crash on users. Now the problem is, how can I reproduce the crashes and fix the issues? Users swear they can reproduce the issues, but I usually can’t no matter how much I stand on my head and type with my feet. There must be a better way to extract data from customers and troubleshoot issues.

Cocoa printing – On the surface it is easy

I had to add printing to an application I’m working on so that users can print out web pages for the built in web browser. Turns out that this only took about 20 minutes to implement. Cocoa is nice that way, but then today I needed to change the title of the printout (used in Preview, in the Job list for the printer and the default name when saving) as the name it picked up was the window name which didn’t make a lot of sense. So, after much searching and realizing that I’d need to subclass some need WebKit object which was unfeasible, I took a look at categories. For the most part, I understand categories, but in this case, I added a category to NSView called printJobTitle, shoved in what I wanted if it was a WebHTMLView class, otherwise use the window’s title and amazingly this worked. I’m not exactly sure how as I’ve found at least one other category for NSView that also has printJobTitle in it. I won’t look a gift horse in the mouth; it works.

Note to Apple, please let me specify a print job title in the NSPrintInfo and override what is taken from the NSView. I’m sure I’m not the only person who has had to do this.

User Interface

Yesterday I had the privilege (or was it?) of having Missing Sync for Palm OS reviewed by a user interface guru at Apple. He had some good ideas on how we can improve the user interface that I think will be quite beneficial to the product. It is quite intimidating having the product I’ve been working on for more than a year and a half critiqued and ripped apart. After thinking about some of the things said, I have to respectfully disagree with some of the comments made as there isn’t one type of user interface for all applications and even Apple’s own applications seem to contradict many of the things the guru said.

I really appreciated the time that was spent reviewing the app; however, it was only slightly more enjoyable than going to the dentist.