Home

Previous 20

Nov. 10th, 2009

mainface

An Encounter

A Program draws near! Command?Read more... )

Kudos to those of you who will get this.

Nov. 4th, 2009

mainface

Musings on Refactoring

Code refactoring..Read more... )

Last night gave me my worst migraine in over a year. Read more... )

Celestial Seasonings tea reminds me of many years ago living in Brecksville. The remaining boxes of tea bags I have may in fact be that old - given how seldom I make tea from them and that I've never to my recollection bought them, they may have survived the move from Brecksville, through the various dorms at OSU in Columbus, then the various apartments there, then the various apartments and offices here. It would be interesting to have a survey of what things have the most move-survivability - probably not gadgets (my One True Keyboards being an exception), usually not consumables (my tea being an exception). Pillows? Lamps? Teacups?

The weather is now terribly cold here.

Aug. 23rd, 2009

mainface

Hiding the Gatekeeper

Some time back, I blogged about this - developed further.

I really like SQL, and I really like the Unix userland. Neither are perfect, but they are excellent tools. The barriers between them are too high, and I've been working on ways to lower that every so often. Read more... )

Jul. 28th, 2009

mainface

Rich APIs

I get the feeling everyone has probably written this essay already, and it doesn't really say anything original. Still, I've had an itch to glue together the arguments together for awhile, so I present:

The Best Program is a Rich API

Feel free to snicker at how amazingly unoriginal it is.

Jun. 1st, 2009

mainface

Forgetting Your Limitations

In my Firefox, I now have:

  • Ubiquity
  • Greasemonkey
  • Jetpack
All three of them are programming interfaces to extend the web, and it is possible to write useful scripts in any of them to do the same thing. This is confusing, terrifying, and yet perhaps a bit awesome.

Read more... )

Aug. 29th, 2008

mainface

Authority's Traces

Woke up feeling ok.

A few nights ago I hacked on shem a bit and got it to a state where I now use it regularly instead of what it replaces. Shem's a tool written in perl to make it easier to get information about a hostname or an ip address. It queries various sources of information, either as its told or using heuristics to try to get "enough" information (e.g. "if this fails, let's try doing that"). It'll use any readline modules it can find to do a command history if it can. Read more... )

Jun. 16th, 2008

mainface

Imaginary Ears to Imaginary Walls

I had a longish IM chat with one of my former bosses (several bosses back) who's now a friend, and it turns out that he wants me to do some part-time sysadmin work for him on a telecommuting basis for one of his (many) projects/companies. Read more... )

Apart from that part, we also talked awhile about technology developments. Something to check out - it sounds utterly ridiculous and a bit sick, but he said that Google Gears has an engine that can translate, similarly to what CFront did, Java code to Javascript. Turing-complete languages being what they are, it's of course possible, but it sounds ugly and wonderful - I'll have to snag the code (and any whitepapers I can find) to play with it. I wonder about maintaining it - Sun hasn't exactly kept the Java syntax static between versions, and if they really are going to keep the "so long as you don't use threads or swing and otherwise have the source for all the external modules you use, it will just work", they've made a big maintenance commitment (when a new Java release comes out and people start to use stuff like Autoboxing, how soon can they start supporting that?)...

I'd like to find a good academic-ish journal covering events, economics, and history covering Latin America - something similar to Middle East Journal and Far Eastern Affairs. Any recommendations?

Dec. 20th, 2007

mainface

LJEscape updated

Updated version of LJEscape here. It is much cleaner/nicer than my first shot, and retrieves tags on entries too. Reminder: It does its best to grab all information relevant to your lj account and save it to flat files on disk. Right now, this consists of all your entries and any userinfo it can scrounge up (including usericons, friends list, etc). It cannot get comments on your entries, but otherwise it's fairly comprehensive. Assumes Unix, Perl.

Dec. 15th, 2007

mainface

LJ Escape

Over the last hour or two, I whipped up a program that attempts to slurp as much information off of LiveJournal as it can, on the theory that this might be interesting/useful to those of you who don't mirror your blog to LJ from somewhere else (as I do), and are concerned about the recent sale of LJ to that previously mentioned Russian marketing firm. Details:Read more... )

Intrested parties can grab the tarball here.

Sep. 21st, 2007

Germanish

Non-schtick Pan

I've been playing around a bit with XMPP/Jabber recently - some time back I noticed how neat it is to let LJ's notification system tell me when things I'm keeping an eye on change, and doing so through LJ's XMPP (which they call "Livejournal Chat"), which I now try to leave Pidgin logged into all the time, is pretty cool. Read more... )

Every time I hear marketing people getting excited (about things relating to marketing), I cringe a little - I don't think marketing is a respectable profession (it both encouraging waste and inspiring desire), and I think it brings mental harm to the recipient. Here's the latest thing the bastards have thought up. Sigh.

Political news:Read more... )

Today is another "migraine hiding just around the corner" type day.. bleh.

Sep. 17th, 2007

CatGrape

Zeppelinear Regression

Today was mostly spent programming - wrapped up the refactoring of my blog software and then continued real programming on it. I re-synced the development version and what's installed on blog.dachte.org as well. For the curious:Read more... )

Those few of you who have POUND installed on your servers (or who don't yet but would like to play with it), ping me for an updated tarball (which I'll eventually put up anyhow). On that note, if anyone wants to join me in programming on it, and likes perl, mod_perl, postgres, and is of a unixy sort, let me know and we'll talk. There's a lot to do and the code is in a reasonably good state right now.

Recently have thought that it might be interesting to compare the origins of the Chasidic movement in Judaism and the Charismatic movement in Roman Catholicism. Haven't done so yet..

Because I'm babysitting Emily's cat Jayne, I've been regularly taking cat photos to send to her every week. While trying for this week's third picture of Jayne, I noticed this pic-worthy scene involving Beefalo and Tortfeasor:

I didn't notice that the teddy bears from my childhood matched them until after I took the shot, but it's lucky to see Yahni and Yanni match Tortfeasor and Beefalo in general colouration and position :)

Feb. 9th, 2007

mainface

Subtle Mines

Out of curiosity, I did some statistics on my BLOG. So far I have a bit over 800 thousand lines in all my posts, with about 55000 lines. I whipped up a cute little Perl script to give me rough word frequencies. Going beyond super-common words in English, interestingly common words include:Read more... )

I would simply post the results, but the summary tool presently doesn't skip over private posts or private sections of posts, so I'd prefer to be safe.

Rewriting my email client is going well - it's almost theoretically ready to replace the old setup, although I'll probably keep working on it for awhile after I start using it -- with a cleaner codebase there are several features I'd like to add. In writing scripts and programs like this, I'm finally reaching the point where I regret that most of my code isn't done in OO modules, and I'm inclined to convert most of it to be so -- my Unix environment depends heavily on Perl, and I'd like to more easily be able to reuse data concepts and the like. I regret that PERL5LIB feels like such a wrong solution to tell the system where libraries are -- for development purposes I'd rather pick up modules at runtime, which feels even more awkward (eval {use lib "mypath" ; use MyModule;} gets a bit old with proper error checking and repeated for every component that wants to buy into the larger structure). Dynamic component loading tends to be fragile and/or ugly in most languages though (I mostly like C(POSIX)'s dlopen() function family though).

I recently read a little bit about the various truces in World War I held by the soldiers on some holidays, sometimes including leaving trenches for some sport or partying with "the enemy", despite the best efforts of their higher-ups. Especially given the messy causes of WWI, it makes it seem all the more tragic that so much death and conflict came to people who really had no quarrel with each other. Even in WWII, where there were some legitimate issues at stake and people presumably bought more into the ideologies that were shaping the involved countries, there were a number of people that were either drafted or were in it to defend their society with little ideological involvement. I find it regretful that in WWI at least the soldiers didn't, en masse, decide to stop fighting each other and go home to depose their governments. I guess maybe that would be both difficult and perhaps unthinkable though. Militaries acting on their own sometimes have had interesting effects on world history -- compare Kemal Ataturk to the Freikorps.

I'm interested and pleased to read that Sea Shepherd is continuing its work to prevent whaling. I keep thinking that it would be an interesting way to spend a few years joining them (although if it would work out, I would really want to do so with at least one friend, ideally a significant other).

Jan. 15th, 2007

mainface

Code Healing

I just got the motivation to go touch PSMail (my perl-based mail client), started to dig into the code, and realised, that the code is quite bad, it being something I wrote when I was just learning Perl. Unlike a few quick changes I've done to it in the past, this will require me to rework a few bits, and the best way to do that is to rewrite big chunks of it. As basic email functionality is pretty easy (at least, given the set of modules Perl provides), this is will be fun.

I got into the Hitchcock class I wanted to - hopefully a friend of mine who was also on the waiting list got in too. I hope the Roguelike class will come together too..

I find it mildly creepy and mildly cool that a number of the websites I visit greet me by name (thanks to cookies) when I visit.

Nov. 7th, 2006

mainface

GNUStep Lockstep

The GNUStep project actually made something. I'm surprised to see that after all the years, they finally have something to show, and looking at the demo, it appears they managed to capture some of the stuff that was wonderful about programming for NeXTStep. I'll probably download their demo CD, and if it's well done, I might see if I can find any of my ancient code archives and/or start programming in ObjC again to see how much I like it after all these years. I am thrilled that one of their project goals is to reach full API compatibility with ObjC code under OSX - it would pave the way for neat applications from OSX to run on Linux with little more than a recompile. Their webpage says that they're working on making available OsiriX, a biometical imaging/analysis suite I love, on their implementation. I'm also interested in playing with their window manager, comparing it with WindowMaker. Alas, this must wait until tomorrow, as I am exhausted.

Sep. 11th, 2006

mainface

Sharpening one's Metaphors

I'm working on improving the LJ-POUND linkage (right now, POUND is relatively dumb and will re-post entries to LJ if I update them on my software). I have determined that while posting to LJ is easy, and blind batch manipulation of LJ entries is easy, finding a particular LJ entry programmatically isn't quite that simple. LJ does a shoddy job of indexing its posts - the best pseudoindex one can get is to ask for a particular date, get a list of entries on that date, and then plod through each of those trying to recognise the entry there. Entries do have a timefield, but LJ's concept of dates leaves a bit to be desired -- they do something funny with timezones (presumably), so your entry may be an hour off where you expect it to, programmatically (I say may be because looking at a set of entries, I see no pattern in when they're an hour off and when they're not). Oh, and LJ doesn't keep track of seconds, so you get to chop seconds off if you're doing a comparison. This up-and-down truncation means that if you want to robustly look for an entry, you might get to look in three spots, one for the date you wrote it, one for the date before (in case you posted within the 59 seconds after midnight and want to be really sure), and and one for the day after (in case it decided to add an hour to your after-23:00 post). You also get to try adding an hour and subtracting one in your comparison to deal with the random adding/subtracting hour thing, and if you should so happen to do two posts separated by exactly an hour, you simply lose if you want to deal with them without trying to recognise content. I'm going to sit on this problem for awhile to see if I can figure out more of what's going on. There *is* something called an ItemID that comes out of PostEntry() that maybe I should be using instead -- I could save these in the database whenever an entry is posted to LJ and maybe avoid this stupid mess.

Quirky, interesting things:

  • Males are still male online
  • I wouldn't mind inviting Lions to that Cafeteria
  • Greenpeace lists companies by how eco-friendly they are. Nokia and Dell get props, Motorola and Lenovo suck. This might impact where I get my next phone from, and now that Dell is becoming AMD64-friendly, my next personal computer may indeed be a Dell (although my present laptop shows only light signs of wear at this point, so no rush)
  • An Abugida is like an Abjad, but with a default vowel between consonants that can be modified by markers. This is kind of clever. I have a certain interest in writing systems, at various times inventing my own and trying to come up with novel ideas, along with attempting to make a syllabary for English that's visually close to the English alphabet.
  • I want to know if CinePaint (once known as video-gimp) is a straight-up image editor that can handle still image formats often exported/imported from videos well, or if it is a movie editor that lets me edit images out of a movie without yanking it apart and putting it back together. The second is interesting to me, the first is not. If anyone's used it, drop me a line, especially if you're up to spending half an hour or so showing me how it works.
  • The Beehive, my favourite coffeeshop (although I only go on weekends because it involves a longish bus-ride and a good amount of walking after that to get there), has a neat website. I think it's safe to say that it's my favourite Coffeeshop anywhere (I liked the old Insomnia in Columbus better, but it's long-gone)
On Wikipedia, I sometimes *shocking!* find myself disagreeing with the way the community or even Jimbo go on some issues. Mistakes and unfortunate things happen, and I find it tough to tell people that I think they were wrong on some issues -- sometimes I do, sometimes I don't. A certain amount of social capital is spent everytime one does so, and things by and large work more smoothly when one is quiet, but it's not particularly healthy when people never see other people worried by actions they do that might be questionable. One recent example involved some girl (a fairly new Wikipedian) uploading pictures of herself to illustrate some of the sex-related articles on Wikipedia -- there was some discussion on this, in particular if it was really her in the pictures, along with the dishonest maneuvering of both prudish factions (who would prefer such articles not exist and if they must, that they not be illustrated) and .. factions of people I'll call "pigs" who were cheering her on just because they like tittilation and presumably don't know about 4chan (or more realistically, like personally cheering on erotic "stars"). The argument was predictable, apart from the dishonest factions who did their best to find every technicality to keep or delete the images (a stupid, lawyerlike mentality), there was the usual debate between people who think an encyclopedia should be family-safe and careful, and those who are aiming for an encyclopedia in a more pure, audience-ignoring sense. I'm among the latter, being largely social libertine - I don't think Wikipedia should try to be safe-for-work or for children. Just as we decide it's more important to show the Danish cartoons on Mohammad in the article on the controversy, which we knew would offend many, many people, we should decide to accept pictures that help illustrate articles, even if they offend or arouse. There was, in this situation, some question on if the girl was uploading pictures that were really of herself or if she was simply taking images from a paysite and removing attribution. Alternatively, there was the concern that she was of an age sufficient to make it legal to share said images. Instead of carefully and delicately asking these questions, Jimbo decided to jump in, suggest she was trolling, and she was blocked almost immediately afterwards. I think this is unfortunate and bad judgement on Jimbo's part. The images reappeared on the horrible-but-sometimes-amusing Wikitruth site, one of the many sites devoted to criticising Wikipedia. Despite some occasional actions that I consider unfortunate on the project, by-and-large governance of Wikipedia is done well - the sites devoted to criticism tend to be run by mentally unbalanced folk with unintelligent criticism. That doesn't mean that I think that the right decisions are always made by my support of and involvement in the project.. On the other side, there's the problem that people enforcing policy to the extent it needs to be enforced (especially policies that are bound to anger when enforced, like reminding people that user pages are not personal webpages or making sure we don't run afoul of the law) tend to become unpopular, and our notion of consensus resembling, to a certain extent, voting, people doing what is necessary and good tend to harm their ability to take positions of responsibility. It's a difficulty in any electoral system when the demos don't understand or take responsibility for projects/societies. Apart from better ways to manage sufferage and/or inculturation, I don't know what the best way to manage the impact of these problems is.

I think I mentioned Malkit Singh before -- an indian pop-Bhangra musician who I saw on TV at India Garden before -- his clever music video for Jago Aaya helped me notice the song, which is an excellent song to program to. Having found more of his music, I've decided that I really like his sound - like many people who get a programmer's high, I have my own preference for music that helps me get in the zone. Almost none of the stuff has recognisable lyrics, and when it does, it's generally not stuff that grabs too much attention -- I suspect that music with lyrics tends to interfere with the word and spatial manipulations involved in weaving code. I also suspect that the music I'm listening to tends to influence my pace and style of programming (although I have no way to know for sure because my human introspection is turned off while I code). For me, Bhangra is great for coding - the constant rolling beats help keep me moving and inspired. On the occasions I need to stop to think, I typically switch to darkwave (not quite ideal because it has words, but Darkwave sans words becomes Trance, which I've never liked, either for programming or for casual listening). To my fellow readers who have programmed enough to enter Deep Hack Mode, what kinds of music help get you there? Do you vary the music for particular things, and what for?

Mar. 21st, 2006

mainface

Living in Check

Sometimes, it seems like I have managed to put myself in check in life -- I don't feel as free as I really want to be, and it feels that every move I make is either to escape something or to meet a need. My motions are nestled by necessity, and this is not entirely comfortable. I think I'm starting to understand more about why this is. Somewhat but not entirely related, there is a fascinating (and long) conversation on livejournal that I wish I could share with y'all, but it is friends protected by the original poster for the safety/comfort of all of the people involved. Sometimes people are good enough to ask, in a concise way, questions that are close to things that I've either been curious about or things that are otherwise of practical (and philosophical) interest to me. It is a wonderful gift when this happens from someone with more of an audience than my blog, and I see answers that I would probably not get if I asked myself. I don't think being in check necessarily means endgame is near, at least in life, although it may indicate that some larger changes are in store before one emerges into the clear again. Am I making them yet? I am not sure.

A coworker recently had a disk fail on them, and they did not back their data up onto the shared space I provided. After much testing, I believe the disk is largely toast. Fortunately, some of the people in Psychology computer support know of a company called Gillware that does data recovery for very attractive rates/conditions. Given that this is at least a year's worth of research for the coworker involved, it is probably worth $400-$700 to try to recover. Let this be a warning to everyone though -- back your data up. You never know when hardware is going to fail on you, and if losing it all would be incredibly painful, invest a bit of time every now and then to do backups of the important stuff.

I am increasingly convinced that named parameter lists in Perl are a good thing. They're a bit of a pain to set up, and they uglify all the code they touch, but there's no beating the convenience they offer in calling syntax, offering defaults, and as a surprise, generalisability. As an example, I do a lot of mod_perl coding that glues databases in various forms to the web, typically with a lot of additional specific functionality. In starting a new project of this type, I normally copy a lot of code out of POUND (my Wiki/BLOG software) into the project repository (I use subversion now for version/code management), tweak it, and then start customising for the application. This works well, and saves me a lot of effort. However, sometimes I find myself extending something in one version that isn't applicable to the other. It would be nice to be able to pass a "personality" flag to those functions and have them be truly shared, and to add new parameters without worrying about parameter order to old functions. Named parameters break down borders between code, and fluidise things, which is generally a good thing (if sanely done). I wish perl helped me out a little bit more with the gruntwork at the top of each header. I could use source filters, but those modules are very .. scary.

It is officially spring now, and so we really missed most of the winter unpleasantness this year in Pittsburgh. Weird.

I have a few resolutions I am going to try to meet.

  • I will try to be more pleasant to be around
  • I will try to keep my apartment cleaner
  • I will clean my home directory and my inbox, and try to keep them cleaner
  • I will try not to get behind on important things
  • I will try to go to sleep at a slightly more reasonable hour
  • I will try to write somewhat less in my BLOG and much more on my website and Wiki
  • I will try to eat even healthier, and exercise more (the latter will be easier because the weather is probably on its way to getting nice again)
  • I will play more intellectually
  • I will try to be more smooth when I am attempting to interest people in relationships
  • I will continue to stand for integrity and not follow my drives when they would lead me towards things that would make me less able to respect myself

Dec. 16th, 2005

mainface

Lifetimes between Eye Blinks

The last few days have been strange, but not in a way I can really quantify. The general feel of life seens different though -- my life is not quite shaped like this. From things I do and ways I am to events and interactions, it's different. Hmm.

Last night, for the first time in awhile, I put some more time into the POUND code, implementing BLOG entry links with a special syntax in the markup language. As usual, whenever I leave a project for a long time, I have a urge to deeply refector/rewrite it instead of actually work on it as it is. That's not hard to overcome though. It took a bit of tweaking to bring the code up on my laptop, but it's worth doing. I'm considering a major change to code style though - currently all the functions in my software are using argument lists, but named parameters are pretty, and Perl can do then with a bit of work. I need to look into the modules I've heard about that should theoretically make that concise. For those who haven't worked with this before, C-style argument lists, which I presently use in perl, work like this:

To call a function
sthtml($pagetitle, undef, undef, $customcss);
Start of that function
sub sthtml
{
my ($pagetitle, $rss, $atom, $css) = @_;
...
Those argument lists must be passed in the correct order, and as a result whenever you want to call the function, you must go look up the arglist to call it properly unless you happen to remember (you usually will remember if there are two or fewer arguments). Some programming languages, such as R, Mathematica, and ObjC, allow named parameters, where a function has a number of named parameters, usually with default values, and calling a function fills in those parameters explicitly, a la


sthtml(pagetitle => 'This is my page', customcss => $mycss);

Named parameters tend to make code much easier to understand, and it is possible to do this in Perl. The only reason I haven't been doing it all along is the function start code needed to catch that tends to be unattractively large and bulky. Again, I've heard rumours of code to concisely automate that code.

Before I go off to handle other things, two amusing political news stories for you.

Aug. 31st, 2004

mainface

Band-aid stump

Sometimes, when maintaining software, one comes across a bug that turns outto be because of a fundamental misdesign. These bugs are often hard to fix.One is given at least two paths to follow here -- one can either apply aband-aid or redesign the software to do the right thing. The first can seemquite appealing sometimes, but the time savings it promises actually don'toften materialize -- special cases often need to be propogated all throughoutthe software, and leave little marks of shame for the future maintainers of thecode. Personally, I love nice, clean, well-designed code, and I find itfrustrating when I see the band-aids. I usually rip the software apart andredo the broken parts so everything fits right. Today I did some of this, andended up fixing a number of other broken bits.

Oh, I'm playing with Mozilla Firefox. Again. It's kind of quirky, but it'sinteresting. Hmm.

Jun. 27th, 2004

mainface

String Lift

My current bathroom book, Programming Perl, has an interesting note in it --the Perl compiler doesn't hoist initializations out of loops, suggesting thatthe programmer should exercise some common sense. This is a bad inconsistancy,I think. For you non-programmers, let me demonstrate what hoisting does..

int num_processed=0;char* thisline;while(thisline = readline("Give me a name:")) { int length=0; length = strlen(thisline); if(length == 0) {break;} printf("The name was %d characters long\n", length); }

A good C compiler will effectively turn it into this (let's ignore non-hoistingoptimizations):int num_processed=0;char* thisline;int length;while(thisline = readline("Give me a name:")) { length = strlen(thisline); if(length == 0) {break;} printf("The name was %d characters long\n", length); }

There are two things to note here, first, length always gets a new value beforeit is read, so the initializing to zero is unneeded. Further, and this is themain point, there's no need to keep creating and destroying the length variableevery time the while block is run through again, so it can do it once outsidethe block instead. At least as of the writing of that Perl book, Perl will notdo this optimization for you. There are no doubt all sorts of otheroptimizations that Perl does for you, but not that, because they want people tomake obvious optimizations themselves. This is important -- it is a good thingto suggest to programmers that they make high-level optimizations, but generallythese are of the kind that a compiler cannot (or at least would be difficult to)make for you. It would be fascinating to design a programming language wherevery rich metadata were provided routinely so really intelligent compilers couldmore easily make optimizations that no compiler of current languages could dosafely.. Perl6 will be making some steps towards this with a rich attributesystem. Anyhow, the reason that this particular optimization should be madeautomatically for the user, contrary to Perl design at that time (hey, maybein Perl 5.8 or later it changed), is another philosophy in programming that Itake to a sort of extreme -- avoid globals. Why avoid globals? It's hard totell when variables change when it could be changed anywhere in the program.Frequently, the globals are not actually used through the entire program anyhow,but some lazy and bad programmers make everything global. I extend the avoidingof globals to .. well, let's call it superscoping. Under this philosophy,even within functions, we try moderately hard to keep the number-of-lines-scopeof variables small. If, for example, we're in the middle of a large, complicatedfunction, and enter an area of the code where we're trying to do somethingcomplex and need a lot of variables for it that don't belong in the rest of thecode, we'll create an unconditioned block to scope those variables. Example:

Instead ofvoid doOpenPrefsFile(...){ // First acquire the lock, then open the file, then read it // Stage 1: Acquireint lockid;int lockmgrsocket;char* fname;FILE* myfile;char errstringLINK="";

  1. define THISLINE_SIZE 80
char thislineLINK;int parseline;int in_block_parse;int in_multiline;

lockid = socket(...)....

// Stage 2: Openmyfile = fopen(fname, ...)if(myfile == NULL) { strncpy(errstring, "Failed to open file: "); strncat(errstring, my_geterror()); ... } // Stage 3: Read

while(thisline = fgets(thisline, THISLINE_SIZE, myfile)) { if(regex_match(thisline, "^\S*#")) { ... } ... parseline++; }}

A superscoping way to do that would be:void doOpenPrefsFile(...){ // First acquire the lock, then open the file, then read itchar* fname;FILE* myfile;


// Stage 1: Acquire
{

int lockid; int lockmgrsocket; lockid = socket(...) .... }


// Stage 2: Open
{

char errstringLINK=""; myfile = fopen(fname, ...) if(myfile == NULL) { strncpy(errstring, "Failed to open file: "); strncat(errstring, my_geterror()); ... }
}

// Stage 3: Read
{

  1. define THISLINE_SIZE 80
char thislineLINK; int parseline; int in_block_parse; int in_multiline; while(thisline = fgets(thisline, THISLINE_SIZE, myfile)) { if(regex_match(thisline, "^\S*#")) { ... } ... parseline++; } }}
From that, it's obvious that there's no hidden meaning to any ofthose variables outside where they're actually used, because theirscope and their use are much more tightly bound. The compiler doesn'tneed to work as hard (and can be smarter, especially in dynamic languageslike Perl where it's hard to be smart and consistant at the same time).It's tempting, of course, to simply declare that those blocks aresufficiently seperate that they should be their own functions. This issometimes the case, but depending on how much connectedness there isbetween the parts of the function, it can be a pain to pass everythingneeded to break things into functions. This approach offers a middle groundfor when it makes sense, between splitting things off and keeping them ina single function, and in fact makes it easier to break things off latershould that prove desirable. Note, however, that when it makes sense forthe compiler to hoist (most of superscoping applies to conditional blocksas well), it should do it. Dividing what actually happens in the code fromthe conceptually clean version is the point of optimization, and withsuperscoping, it should be a win-win situation, instead of, as in Perl,a lose-lose one (either your code is slower or it's harder to read andpossibly slower anyhow because it's hard to optimize, or, optionally, it'smuch uglier if you use double blocks).

May. 21st, 2004

mainface

Sea of Eyes

A yellow haze.. a lone eyeball floats in the water, a mind somehow fits inside..all it experiences is the endless bobbing and the haze.. cannot blot the sight,no eyelids. It worries that it has gone insane, as the world continues tobob and splash around it... meanwhile, the fish continue to nibble on itsoptic nerve beneath the water..

I setup my new shredder yesterday, and finally started shredding my sensitivejunkmail (how funny we live in such a world).. it's a lot of fun, enough thatI started shredding nonsensitive junkmail. There's something nice aboutseeing the thin strips of paper coming out the bottom..

I think I'm starting to enjoy getting rid of the extra energy I sometimes haveby bike rides or short runs. It's not often that I have enough energy that Iwant to do this, but it's a new phonomenon that's slowly increasing inregularity. Yesterday evening I went running for about 40 minutes, and it wasnice. The soreness will probably last me about 4 days if past experiences areany indicator, although I'll probably be ok to rock climb again by Sundayif I get back in time. I wonder if my body will eventually decide that I'mgetting enough exercise as things are now, or if I'm going to want more. I'mprobably going to want a new pair of shoes soon -- my current ones feel kindof flat.

After the run, I went to the philosophy discussion group that's forming at CMU,and we talked about disenfranchisement and capitalism. There was a Libertarianthere, and so the conversation was interesting. Having been something reallygives one good insight into how to argue effectively against it. Free-markettypes can generally be pushed to understand when government needs to step into protect non-market values, although they tend to have the form of thatintervention take place in form of a market. Developing arguments against thatdevelopment is very interesting. We also talked about ways to make the systemsuck less. I really love political philosophy... and I do find myself wonderingif I'm becoming a full-fledged socialist. Hmm...

After I got back home, a ways past midnight, it started to rain really heavily,with thunder and lightning. I was too sleepy to go out and play in the rain,although it was very tempting. Something about the rhythm and lights in athunderstorm is very appealing to me... Makes me feel very alive. I dozed offin the living room with the windows wide open, so I at least got as muchof the wonderful weather and sounds as I could given my tiredness.

This weekend is Marf's wedding. I'm going to need to get the gift ASAP to thewedding, so I'll probably get it tomorrow. Hmm.. I've been thinking about thewedding, and truth be told, I'm kinda jealous. Not of her or him specifically,but just in general that peers seem to be doing well in relationships,engaged, married, or at least in long-term mutually loving relationships. Theirlife has what I want so much.. and as I keep getting older, my chances offinding someone before I'm too old to enjoy sharing my youth with go down. Ireally want to at least know of someone for awhile before I start to date them,and I'm so picky. An old face is something that's supposed to be beautifulby accustomment, not in itself. I suspect that if I haven't met someone by 30,I'll be very unlikely to be attracted to anyone at all at a compatible age. Iwonder if I will spend most of the rest of my life alone. It might be temptingto be less picky, but I don't think I can really do that. I know the roughparameters of what I want. And, na klar, as people get older, the peoplecapable of good relationships get weeded out, and so the signal-to-noise ratio,that is, the sane, cute, really smart people who arn't unsuitable for somereason mostly end up getting married, leaving a higher proportion of theother folk.. dating is thus harder for older people. I really thought Debb wasthe one for me. I'm still stunned at how things worked out.. sad.. I think Iprobably did the right thing -- when someone can't even be civil and isn'twilling to work to fix things, what can you do? .. but .. it's still hard forme to reconcile all my emotions. And now.. to go see my first ex-gf getmarried.. and seeing all the other couples there... Oy...

New photos from IraqOblique BeggingLest anyone think that only artsy folk do Film Festivals..What a fun language

No Russian class today... I'm not sure if I'll hang out in Squirrel Hill fora bit before I head to Brecksville, or head right off... I hate driving in thedaylight, but OTOH I can visit more with people if I leave earlier. I reallythink I need to take a weekend completely off sometime, not going anywhereand not doing anything more complex than the rock climbing on Sunday. I wantto finish cleaning my apartment, rearrange my apartment a bit more, sleep a LOT,and otherwise do very little.

Finally, at work, I made a breakthrough and got matlab talking to code livingin shared objects. It turns out that the existing documentation is reallyterrible on the web -- some describe nonportable ways of doing things, othersappear to poke at functions that don't actually work on my platform, and infact look to be bugs in the packaging of my Matlab. The original, simple, butnot-very-portable interface that I originally had tried really hard to avoidactually looks like it's the best way to go -- I'll just have a single-functioninterface to matlab that calls C code that does dlopen()/dlsym()/dlclose()as needed. Because it's been awhile since I've used that interface, I createdsome new demos to make sure I get it right. In case you're interested, here'sa simple example of how to use dlopen and friends on Unix..

file 1 LINK:

  1. include <stdio.h>
void hi(int input){printf("Hello, world, you said %d\n", input);}

to compile:gcc -shared -nostdlib hi.c -o hi.so

file 2 LINK:

  1. include "stdio.h"
  2. include <dlfcn.h>
int main(void){void* libhdl;void (*myfunction)(int);libhdl = dlopen("/home/pgunn/matlabi/hi.so", RTLD_NOW);if(libhdl == NULL)
{printf("Failed to dlopen: %s\n", dlerror());return 1;}
myfunction = dlsym(libhdl, "hi");(*myfunction)(4);dlclose(libhdl);return 0;}

to compile:gcc -ldl hello.c -o hello

It's not bad, until we start messing it up with #ifdef and similar to do thesame thing on Windows, and adding another platform unfortunately means thatthis code may need to be touched. Oh well, at least I'm moving forward again --the rest of the code should fall into place pretty quickly.

Previous 20