Streams

I’ve started to write code again. Since January I’ve been in one of my non-programming moods. Last December my wife and I had one of the best times together in our marriage, but it quickly devolved into our worst. I was feeling depressed and lost interest in most everything.

But recently I started watching the WWDC videos. I got the urge to rewrite my Blocks program. With Blocks I wanted to experiment with the manipulation data as expressed as named blocks. After working on it for a while I hit the stumbling block of not begining with an abstraction deep enough.

With Streams, I started over. I am starting with digital signal processing (another interest of mine). In the screen shot below you’ll see an example on converting audio data into bytes the way the Color Computer does when reading a tape file.

Streams Screen Shot from August 10, 2011

Coordinated CoCo Conference #3

It is time again for the Coordinated CoCo Conference!

I’d really like to thank Aaron Wolfe who donates the bandwidth to run the conference: Thank-you!

Any our special guest was Marty Goodman, we interview him for the whole hour. Here is a link to the mp3.

Coordinated CoCo Conference #2

Me and about 10 of my closest friends conducted Coordinated CoCo Conference #2 on December 1st. We had a good talk about Steve Bjork’s floppy disk controller he is working on. Plus many other topics. Here is a link to the mp3.
I’d like to thank Aaron Wolfe for hosting the Skype call and helping organize the event.

Coordinated CoCo Conference #1

In late October of 2010 Aaron Wolfe, Todd Wallace and I decided to try to hold a monthly Color Computer Conference in the internet. We tested TalkShoe and Mumble as platforms to use, but decided to use Skype for the first conference.
We announced the first call would help held Tuesday, November 2, 2010.
I am very pleased with how the first conference turned out. I am posting the audio as an attachment to this post. Please enjoy: Coordinated CoCo Conference #1.mp3.
The next conference will be held early in December.

Dating

15 Year Old Daughter: “What’s wrong with me dating an 18 year old?”

Me: “Remember when I was teaching you how to drive? Before you pressed the break for the first time, I said, ‘Now press the break pedal gently.’ And the car immediately came to a jarring halt. And you asked, ‘How come you didn’t warn me that would happen?’ And I said, ‘There is no way I could have warned you what kind of pressure was needed to properly stop a car going 10 miles per hour. It’s something you have to experience yourself.’

15 Year Old Daughter: “Yeah.”

Me: “That’s what it is going to feel like years from now when you look back at dating an 18 year old”.

Mac OS X core utility Find and Extended Attributes

I’ve been writing backup scripts recently. I really like rsync and have been using it with Mac OS X’s smbfs quite successfully (under 10.5). But the other day I found some files that were created on the receiving file system but contained no data.

I really wanted to know how pervasive this was so I asked find to list the files that are zero bytes long. Needless to say I got a lot of false positives. It is not uncommon for the files I use to have zero bytes in the data fork. Usually these files will have some data in their resource fork. The find command only looks for data in the data fork. Files with zero bytes in both forks are rare and those are the files I needed to find.

I needed to change the behavior of find. Finding and compiling the source code for find was easy. My first thought was to add up all of the extended attributes each file has and use that as the total file size:

75a76

> #include <sys/xattr.h>

1428c1429,1453

< off_t size;

---

> off_t size, calc_size;

>    ssize_t list_size;

>    

>    calc_size = entry->fts_statp->st_size;

>    

>    /* get list of extended attribute names */

>    list_size = listxattr(entry->fts_path, NULL, 0, XATTR_NOFOLLOW);

>    

>    if( list_size > 0 )

>    {

>       char *namebuf, *current_name;

>       namebuf = malloc( list_size );

>       listxattr(entry->fts_path, namebuf, list_size, XATTR_NOFOLLOW);

>       current_name = namebuf;

>       

>       /* iterate over list of extended attribute names */

>       

>       while( current_name < namebuf+list_size )

>       {

>          calc_size += getxattr(entry->fts_path, current_name, NULL, 0, 0, XATTR_NOFOLLOW);

>          current_name += strlen(current_name) + 1;

>       }

>      

>       free( namebuf );

>    }

1430,1431c1455

< size = divsize ? (entry->fts_statp->st_size + FIND_SIZE - 1) /

<     FIND_SIZE : entry->fts_statp->st_size;

---

> size = divsize ? (calc_size + FIND_SIZE - 1) / FIND_SIZE : calc_size;

This worked well enough for my needs. Although it has some problems. The biggest one is that it doesn’t produce files sizes that match the Finder’s get info dialog box. It seems the Finder only adds the data fork with the resource fork. Where as the code above adds every available extended attribute. Common additional extended attributes include “com.apple.quarantine” and “com.apple.FinderInfo”.