13 August, 2010

vectors in C

I found the XDR library for C which allows us to do this:

{
  xdrstdio_create ( &xdrs, file_pointer, XDR_ENCODE );

  seed = 123456789;

  for ( i = 1; i <= 10; i++ )
  {
    xdr_i = i4_uniform ( 0, 100000, &seed );
    xdr_int ( &xdrs, &xdr_i );
  }

  xdr_destroy ( &xdrs );

  fclose ( file_pointer );
}
But then I run into this:
typedef int v4si __attribute__ (( vector_size(4*sizeof(int)) ));

// which lets us do 

int foo[4] = {1,5,7,9};
int bar[4] = {2,3,4,5};
for(unsigned int i=0 ; i<4 ; i++)
{
     bar[i] += foo[i];
}

// and this, which i like a LOT

typedef int v4si __attribute__ ((vector_size (4*sizeof(int))));
v4si foo = {1,5,7,9};
v4si bar = {2,3,4,5};
bar += foo;


So this v4si stuff seems to be an extension of the gcc compiler suite, and i don't have a manpage for it on my mac (gcc? you've got xcode, man!) and i'm not sure if my mac supports it or how really to use it. The XDR stuff is more for moving things from one platform to another. I might as well create my own vector type based on an array at that point. Arrays of pointers to arrays as it were. It's not built for performance, it's built to be robust. What I need is performance. Halp!

12 August, 2010

The dicks are watching!

So I get a phone call and email from this guy, Greg Brantley who informs me that he's after me and he's a collection agent and private investigator threw [sic] the state of Texas. He also wanted to let me know he had read this weblog. I can't decide which is funnier, that a private dick thinks a weblog will help him find assets he is looking for or that he wasted the time doing it. I mean, a rant on wikipedia, talk of absinthe, various writing complaints, and pictures of my pet snake. I hope he was reallly, really, bored.


vote from the rooftops.

Bookus interruptus

I was reading River of Gods, and the author made a reference to Shakespeare's Lear, which I had not read. So my wife handed me her old iPhone (minus sim card, lest I get a phone call, eek...) and I read Lear. And then for my own edification, I read Hamlet. Wow, was Hamlet good. Totally blew me away. But it was also very long. And after Lear, I had spent I think ten days away from River of Gods, and I'm really grinding the gears getting back into it. I shouldn't have waited so long. I really like River of Gods, and I'm going to have to really work to get back into it.

In the meantime, my brain is taunting me with story arcs of fantasy, historical fiction, and wrapping stories into a threaded novel (which was my purpose at the time, but I was nowhere near as talented or ambitious a writer then as I am now). Historical fiction? seriously, wtf.

10 August, 2010

Tasting the forbidden... for education.

So for a story I'm working on (which I am getting to like more and more, and my editor already likes a lot), I needed to know the properties of specific liqueurs and spirits. Where to go but the liquor store? It's educational, I reason, no reason to get my knickers in a twist over that.

The problem is, the main liqueur I'd come to have a look at was crême de menthe. As it turns out, the distilled spirits of mint are in fact clear, and some distributors deign to leave it clear (notably, none of them were at the liquor store, but there are a few online–don't bother looking; it's a real pain in the ass because nobody is selling it to you, it's through their inventory that you find it, so you have to use some third-dan google-fu to find it), while the rest just add green dye to it. Really, would a grasshopper be such a lovely drink if it was a mottled brown and white color, even if it tasted the same as a green one?

As we looked around, we were very disappointed. I was looking for an opalescent green liquid, and because of the sentence structure and the mood being set by the sentence, I really wanted it to be a consumable, wanted it even more to be a liquor to add a little misbehavior to it, and Bailey's with Mint was not going to cut it. Liqueurs that can curdle under the influence of other liqueurs are not real high in my book (cement mixer: look it up).

As it happened, my wife pointed out that there was in fact absinthe for sale. Two thoughts ran through my head at the same time: Danger! and Perfect! The good news is the proper brand (the other didn't have wormwood [thujone] in it) came in a roughly 10 fluid oz bottle. A sort of try-it-if-you-dare size.

I dared.

So I mustered up what I knew about absinthe, and about all I could recall was Kevin Fry's spectacular vehicular hijinks after drinking near the LD50, and that Johnny Depp movie. So I read some on the web and begrudgingly came to the iKipedia because, well, most differences of opinion are put down by riot police there, and I figured it would be a lot easier to work with one opinion.

The old bastard left his ties and a suit, a brown box, mothballs and bowling shoes, and his opinions so you'd never have to choose ... You get smaller while the world gets big; the more you know, the more you know you don't know shit.

Ben Folds, Bastard (or, Ode to Wikipedia)
Turns out, when you only have one opinion or expert to consult with, things get easy, and I had this absinthe thing down pat real quick. I'll go over my own experience, and annotate as necessary. It is worth mentioning I lacked the appropriate hardware.

I started here. The absinthe is on the left in its little-jar-of-horrors size. I had 145ml of cold water ready for the sugar cube after I poured the absinthe into the glass.

 This file has been manipulated a little, but I think it reflects very accurately the color of the absinthe. All I did was dial up the exposure a bit (thank god for RAW photos... I'd have had to re-shoot everything once I'd figured out I needed more exposure).

And here lies our absinthe, in its glass (a whisky glass, as stand-in for a proper absinthe glass , and a loose-leaf tea filter standing in for a proper absinthe spoon.) With the sugar cube (who would have guessed there are official absinthe sugar cubes?) sitting above the absinthe in its filter, all that remained was to pour the water into the glass, dissolving the sugar cube in the process. For our experiment, we had 45ml of absinthe (again, with thujone) at 55% ABV and 145ml of cold water.


I believe the clickthrough on this image is pretty enormous. I wanted to show all the detail of the properly louched drink with the bits of sugar cube and so on.

I think this image is smaller than the previous image. It hasn't been altered.

So is this what I wanted? A cloudy green-yellow drink that looked rather like lemonade and reeked of anise? Not really. But for a reader who is trying to imagine a color and they hear "sugar-louched absinthe," they're going to go along with it, recalling something they've seen in movies or imagined, but have (probably in most cases) not actually tried.

If you've just read the story in particular, and I took some of the magic out of it, I apologize. Take as consolation what I did, as a writer, for you, the reader. I carefully purchased, prepared, and drank absinthe. For you.

And for the curious, I'm a not-small dude, about 235lbs, but I don't drink very much either. I will tell you that the first sip of this drink had a buzz on me. By the time I had half-finished it, I had a serious buzz, and I slowed down not to relish the drink so much but because I needed to, lest my mind wander or I fall asleep. It is powerful business. When the wife asked about it, and I told her about the buzz, I said, boy I'm sure not going to make a habit of that! But by the time the buzz had worn off, I was thinking of how simple it would be to make another. I should probably not have a bottle of the stuff in the house. And, really, I don't recommend anyone try it unless they're on a crusade to try every spirit out there. But even then, friend, use caution. It was a favorite of Hemingway's, but look where it got him.