Categories
Writing

Bombast transcripts

Recovered from the Wayback Machine.

I was going to have a contest for describing what the new iMac looks like, but I really MUST focus on work and corporation filings this week or my editors and/or the IRS will came and take me away.

To self: Take your hands off the keyboard, and back away slowly from your weblog...

Besides I want the prize, The Bombast Transcripts, for myself. And none of you could beat my entry:

    • The new iMac looks like a big pimple waving a white flag.

I give up! I give up!
And next time, I would suggest that Apple save the really big hype for really big news; for instance, that the company is going to support a port of OS X to the Intel architecture.

You’re just going to have to buy your own copy of Chris Locke’s new book, The Bombast Transcripts.

Categories
Writing

Word for the day

At least there’s some gold in the weblogging dross — Sharon I bet that word for the day today is hearken, but you kind of gave us that one. And holler if you need help with your comments.

Dross: My word for the day.

Categories
Writing

The night before Christmas

Recovered from the Wayback Machine.

with first person singular annotation, updated to the new Millennium

T’was the night before Christmas, and all through the house,
Not a creature was stirring, not even a mouse;

    • (Well, there was a mouse once. Name of George, married to a nice little brown field mouse named Alice. Last Christmas, George and Alice went caroling at the neighbor’s. There they were, singing Jingle Bells in these squeaky little voices:

 

Jingle bells. Jingle bells. Jingle all the way. Oh what fun we’ll have…

    • At that point Zoe, the house cat as well as resident music critic ate George and Alice.)

The stockings were hung by the chimney with care,
in hopes that St. Nicholas would soon be there;

    • (Damn right the stockings were hung with care – four Christmases ago, suckers fell into the fireplace, caught on fire, generated a ton of smoke, and set off the fire alarm. The brand new fire system kicked in, spraying the entire living room with fire suppressant foam. Let it snow, let it snow, let it snow.)

The children were nestled all snug in their beds,
While visions of sugar-plums danced in their heads;

    • (I let the kids eat way too much sugar. After they bounced off of every wall in the house, juggled the bulbs on the tree, played Frisbee with Aunty Jane’s fruitcase, and terrified the dog and Zoe the house cat, the kids finally fell into a sugar-induced coma. Whereby I put the little cherubs to bed and went down and had a stiff drink.)

And mamma in her ‘kerchief, and I in my cap,
Had just settled down for a long winter’s nap.

    • (Mamma had a headache. Again.)

When out on the lawn there arose such a clatter,
I sprang from the bed to see what was the matter.

    • (Grabbing my gun, first.)

Away to the window I flew like a flash,
Tore open the shutters and threw up the sash.

    • (Shutters? Sash? What the hell kind of English is this?)

The moon of the breast of the new-fallen snow
Gave luster of mid-day to objects below.

    • (Street lights helped some, too.)

When what to my wondering eyes should appear,
But a miniature sleigh, and eight tiny reindeer.

    • (Shit! I knew I shouldn’t have dropped that acid in college!)

With a little old driver, so lively and quick,
I knew in a moment it must be St. Nick.

    • (It was on the news – John St. Nicholas, wanted felon and bank robber. Personally, I would have picked something faster than a sleigh for a getaway. Wonder where he stole the reindeer?

More rapid than eagles his courses they came,
And he whistled, and shouted, and called them by name;

Now, Dasher! Now, Dancer! Now Prancer and Vixen!
On, Comment! On Cupid! On Donder and Blitzen!
To the top of the porch! To the top of the wall!
Now dash away! Dash away! Dash away all!

    • (Ah oh – I think we just entered into “One Flew over the Cuckoo’s nest”. Where’s the Chief?)

As dry leaves that before the wild hurricane fly,
When they meet with an obstacle, mount to the sky.
So up to the house-top the courses they flew,
With the sleigh full of toys, and St. Nicholas, too.

    • (Damn that stuff I took in college must have been good shit!)

And then, in a twinkling, I heard on the roof
The prancing and pawing of each little hoof.
As I drew in my hand, and was turning around,
Down the chimney St. Nicholas came with a bound

    • (Hey, we think something crawled in there and died a few weeks ago. Can you grab it on your way in?)

He was dressed all in fur, from his head to his foot,
And his clothes were all tarnished with ashes and soot;

    • (Man, fur is just so yesterday. No one wears fur any more.)

A bundle of toys he had flung on his back,
And he looked like a peddler just opening his pack

    • (Damn telemarketers will stop at nothing to make a sale.)

His eyes — how they twinkled! His dimples how merry!
His cheeks were like roses, his nose like a cherry!
His droll little mouth was drawn up like a bow,
And the beard of his chin was as white as the snow;

    • (And he was the scariest son of a bitch I’ve ever seen.)

The stump of a pipe he held tight in his teeth,
And the smoke it encircled his head like a wreath;

    • (Having a little hashish, eh man? Okay, okay. I can dig it.)

He had a broad face and a little round belly,
That shook, when he laughed like a bowlful of jelly.

    • (One word, bud: treadmill. Big time.)

He was chubby and plump, a right jolly old elf,
And I laughed when I saw him, in spite of myself;

    • (Hysteria will do that to a person.)

A wink of his eye and a twist of his head,
Soon gave me to know I had nothing to dread;

    • (Because I’m packing. A fully loaded 45 semi-automatic. One wrong move, chubby man, and you’re toast. And your little reindeer, too.)

He spoke not a word, but went straight to his work,
And filled all the stockings; then turned with a jerk,
And laying his finger aside of his nose,
And giving a nod, up the chimney he rose;

    • (First acid. Then hash. Now the fat man’s snorting blow. Hell, I’d fly too.)

He sprang to his sleigh, to his team gave a whistle,
And away they all flew like the down of a thistle.
But I heard him exclaim, ere he drove out of sight,
“Happy Christmas to all, and to all a good-night!”

    • (And at that point I woke up and realized that I must have been dreaming. Yeah, it was all a dream. Except next morning when I went to get the paper there were these big piles of shit all over the lawn…)

Oh, yeah – Merry Christmas. And Happy New Year.

Categories
Technology Writing

Practical RDF Tech Reviews

I sent a request for technical reviewers of my book “Practical RDF” to the Semantic Web, RDF Interest, and Jena Interest groups . My hope is that I’ll get volunteers that reflect the book’s targeted audience, and so far I’m getting a terrific response from an incredibly interesting mix of people. In fact, I’m extremely pleased at the response.

This really is becoming the best book I’ve ever worked on. The subject’s interesting, the technology’s great, the diversity of people using the technology is fantastic. I’m very excited about the book.

Scratch that: I’m very, VERY excited about the book.

That’s not all — the Unix Power Tools Third Edition book is starting to move along nicely now. I think the new material reflecting Linux and Darwin will be a great addition to the book.

O’Reilly, I owe ya.

Categories
Technology Writing

Creating C# Applications: Chapter 4

One of the most innovative features of C# is the concept of managed and unmanaged code. It is this that truly differentiates this language from its more commonly used cousins, C++ and Java.

What is unmanaged code? Well, put simply, unmanaged code is any C# code that uses pointers. Conversely, managed code could be considered to be any use of C# that doesn’t include the use of pointers. However, the concept goes beyond these simple statements.

In C++ if you want to work with a block of data, such as a large text string (anything that isn’t a simple scalar value), you must allocate the resources for the string, initialize and use the resource, and then free or deallocate it manually when you’re finished. To pass a reference to the string in a function you wouldn’t need to pass the entire string, but only a pointer to the string’s location in memory, its address. Using pointers is efficient, but one of the problems with manual allocation of resources and the use of pointers is that the developer may forget to free the resource, causing a loss of the resource commonly referred to as a memory leak. After many iterations of the code, the application’s performance can degrade, and may even stop performing.

Java eliminated this problem by eliminating the need to manually allocate and deallocate resources. The Java Virtual Machine (VM) provides the resources necessary to support the application and also provides garbage collection (defined in more detail in the next section) to clean up and free the resources after the application is finished. This approach prevents problems of lost resources but also prevents the use of pointers as the support for garbage collection and pointers are mutually exclusive.

C# eliminates the problem of having to choose between the use of pointers and the associated problems of resource loss, and automatic garbage collection but without support for pointers. The language does this by providing support for both garbage collection and pointers — if you follow rules carefully defined within the language that allows both of these seemingly incompatible capabilities.

In addition to the support for managed and unmanaged code, C# also has other unique concepts available to it based on the runtime language support provided by the Common Language Runtime (CLR), such as the WeakReference wrapper class, useful with larger objects and collections.

First, though, let’s take a closer look in the next section at why the use of pointers and garbage collection are so contradictory. If you already know this, you can skip to the section titled “Managed and Unmanaged code,” following.

Garbage Collection and Pointers

As stated earlier, in a programming language that doesn’t provide automatic management of resources, you must allocate and initialize the resource and then deallocate it when finished. However, when garbage collection is supported, you don’t have to manage the resources as the garbage collection mechanism does this for you.

Within the CLR environment, storage space for a new object is pulled from a managed heap. As a new object is created, it’s allocated space within the heap and an address is assigned to the object that references the starting address of its location in the heap. The object’s given the next available space within the heap that can contain it completely.

The amount of space in the heap assigned to the object depends on the structure of the object. A pointer is used to traverse the heap until a contiguous block of space large enough to fit the object is found.

Garbage collection is used to find objects that are no longer being used and to free up the heap space the object is occupying. In the Common Language Infrastructure (CLI) architecture, the garbage collection mechanism is triggered when the pointer used to search for an available heap location travels past the boundaries of the heap.

During the garbage collection process, the collection mechanism visits each address on the heap, checks to see if the object is still being referenced (can be reached and is therefore accessible by existing process) and then freeing up the space if the object is no longer within the scope of the existing process or application scope. The mechanism also optimizes the heap by shifting the addresses (the pointers) of existing objects to provide contiguous blocks of free space for new objects as they are allocated.

This last statement actually explains why manual creation of pointers and garbage collection are not compatible within the same development environment. You can’t create an object and reference it via a pointer to an address that could then be modified by an automatic garbage collection mechanism, thereby making your reference — the pointer — meaningless.

In addition, in this process the garbage collection mechanism must know how much space an object takes up — its structure — in order to manage it efficiently. In C++, it isn’t unusual to cast a pointer from one object/structure type to another, making garbage collection virtually impossible as the mechanism wouldn’t be able to determine the exact structure of the object, and therefore how much space is needed or occupied.

The problem of using pointers and garbage collection in one language is solved through the use of managed and unmanaged code, discussed next.