Keyword blogmeta

post dated 2006-11-27 22:18:16 - blogmeta
Welcome to the new blog. This is an idea I've been kicking around since the day I heard the term "web log" (we hadn't abbreviated it), but I just haven't had the time until now. You know how it is.

The idea of the blog is simple. I've been programming for a very long time now, and I like to write about it. So when I discovered that after a significant hiatus from daily programming, my Muse had reawakened, I resolved that from this point on, I would spent at least a small amount of time each day programming something. The results have been gratifying; I've completed a number of small tasks I'd been wanting to resolve for a while.

And hence this blog. This is the place where I intend to present said small tasks, on a daily basis, for your perusal and, dare I hope, your amusement. I hope you enjoy it; I know I'm going to.

Some of the things I want to cover in the near future are, in no particular order,

  • A few Word macros I've written to fix things up after TRADOS macros break them
  • My experiences getting Python to read and write TTX files (a file used by TRADOS -- I earn my money with translation nowadays, mostly, so that's why translation tools come up so often
  • This very blog, which is a freaking Rube Goldberg contraption of Perl scripts and Makefiles
  • The amazing Toon-o-Matic, which I use to spin out graphics for my Web cartoon -- remember, the Toon-o-Matic is the work of art; the strip is just a by-product, like hot dogs
  • GUI builders for wxPython, something I've been hacking around on for a while without discernable progress (but I hope that will be changing)
  • Workflow applications, of course.

That ought to keep me in posting fodder for a few months, eh?

post dated 2006-12-04 22:41:23 - appaweek - blogmeta - perl - tag-cloud - tagger
Today's fun task was the creation of a little prototype code to format the tag cloud for the drop handler project. I did it in the context of this blog, and so first I had to get my keywords functional. I already had a database column for them, but it turned out my updater wasn't writing them to the database. So that was easy.

Once I had keywords attached to my blog posts, I turned my attention to formatting them into keyword directories (the primary motivation for this was to make it possible to enable Technorati tagging, on which more later.) And then once that was done, I had all my keywords in a hash, so it occurred to me that I was most of the way towards implementing a tag cloud formatter anyway.

Here's the Perl I wrote just to do the formatting. It's actually amazingly simple (of course) and you can peruse the up-to-the-minute result of its invocation in my blog scanner on the keywords page for this blog. Perl:

sub keyword_tagger {
   my $ct = shift @_;
 
   my $weight;
   my $font;
   my $sm = 70;
   my $lg = 200;
   my $del = $lg - $sm;
   my $ret = '';
   foreach my $k (sort keys %kw_count) {
      $weight = $kw_count{$k} / $max_count;
      $font = sprintf ("%d", $sm + $del * $weight);
      $ret .= "<a href=\"/blog/kw/$k/\" style=\"font-size: $font%;\">$k</a>\n";
   }
 
   return $ret;
}

This is generally not the way to structure a function call, because it works with global hashes, but y'know, I don't follow rules too well (and curse myself often, yes). The assumptions:

  • The only argument passed is the maximum post count for all tags, determined by an earlier scan of the tags while writing their index pages.
  • $sm and $lg are effectively configuration; they determine the smallest and largest font sizes of the tag links (in percent).
  • The loop runs through the tags in alphabetical order; they are all assumed to be in the %kw_count global hash, which stores the number of posts associated with each tag (we build that while scanning the posts).
  • For every tag, we look at its post count in the %kw_count hash and split the difference in percentages between $sm and $lg -- then format the link with that font size. Obviously, this is a rather overly hardwired approach (the link should obviously be a configurable template) but as a prototype and for my own blogging management script, this works well.

For our file cloud builder, we'll want to do this very same thing, but in Python (since that's our target language). But porting is cake, now that we know what we'll be porting.

Thus concludes the sermon for today.

post dated 2007-03-01 02:03:22 - autohotkey - blogmeta - sqlite
Just so I don't forget how this blog thang works, I want to assure each and every one of you bots who reads this blog that I've been doing lots of cool programming-type stuff... Well, OK, actually, the family and I went sledding every day for a week and a half while the weather was right, and I've been scrambling to finish up a hueueueuge job that I was neglecting during that time. So ... no excuse at all.

On the translation front, I've discovered that hotstrings (e.g. Word's AutoCorrect feature) can really speed up my typing in cases where I'm doing repetitive texts. Even the time savings of typing "s" instead of "SAP" can really add up over time. But Word's AutoCorrect has a problem -- it saves different lists for each style, and in some instances it triggers without waiting for me to finish the word; if one of my hotstrings is a prefix of another word, that can truly suck. Some Googling got me to AutoHotKey -- and AutoHotKey truly and totally rocks. A lot of what I wanted to do with PyPop is already done and ready for me to use, actually. So I'm going to start bundling AHK with PyPop for Windows systems. It's that good.

Another nice discovery this week has been SQLite -- which is not just open-source, it's actually public domain. It implements pretty much all of the SQL92 standard (except the permission model) for a lightweight local database for single-user use. Websites have been built on it with impressive performance. And the key is -- you can bundle it into anything. Anything. So it's definitely going into the wftk. Man. I'd been kind of moving towards building my own SQL parser and so on -- what's the point? It's already been done! And beautifully!

So there's life in me yet, never fear.

On that note, it's back to work for me.

post dated 2007-06-27 10:21:50 - aquaponics - biofuel - blogmeta
I'm not dead! Just really busy.

So I've been wanting to put up some information about organic produce, the digestive system, bioplastics, and so on, but (as usual) don't have the time. And then today, xkcd comes up with this. Ha! Definitely one of the best toons out there.

More later. Really. In the meantime, if you want meaningless, content-free remixes of my pearls of wisdom, I refer you to the Markov version of my blog, my Ulysses in the Caribee. It's different, I'll give it that.






Copyright © 1996-2008 Vivtek. All Rights Reserved. Read the disclaimer.
Read our privacy statement, too, if you are concerned.
Problems? Try webmaster@vivtek.com or our answer page.