The READIN Family Album
Me and a lorikeet (February 24, 2008)

READIN

Jeremy's journal

Somehow, Cleveland has survived, with her gray banner unfurled -- the banner of Archangelsk and Detroit, of Kharkov and Liverpool -- the banner of men and women who would settle the most ignominious parts of the earth, and there, with the hubris born neither of faith nor ideology but biology and longing, bring into the world their whimpering replacements.

Gary Shteyngart


(This is a page from my archives)
Front page
Most recent posts about Projects

Archives index
Subscribe to RSS

This page renders best in Firefox (or Safari, or Chrome)

Saturday, March 15th, 2008

🦋 Equipment Maintenance

For a while my A string has been fraying and in need of replacement -- tonight I put a new string on. Well a couple of things about this: it took a frustratingly long time to get it on and wound properly, a job that should take less than a minute. So I'm frustrated about not being skillful at it. But more, I don't like how long it took me to get around to doing it -- I get intimidated by stuff like this in a really not useful way.

Both of these things are also true of sharpening knives, and it drives me crazy that all the knives in my kitchen and most of the blades in my wood shop are not sharp the way they ought to be, and how intimidated I get at the thought of making them sharp. I'm not sure how to approach this.

posted evening of March 15th, 2008: Respond
➳ More posts about Fiddling

Saturday, March 8th, 2008

🦋 The Street

Listening in the car to Robyn Hitchcock's April '96 concert in Bilbao, and Sylvia says "I want to hear the one about the street." Cool -- I fast-forwarded to "De Chirico Street". Listened for a minute and then Sylvia says, "There's too much stuff happening on that street."

posted evening of March 8th, 2008: Respond
➳ More posts about Gig Notes

Friday, February 15th, 2008

🦋 Multiplexing

The fix is in -- the server is using poll instead of select, a new version has been built and delivered to the client, it can handle loads of clients. Here is the long and short of how you do it (without error-checking, which is dull*):

The Old Code

void select_files(int *fds, int nfds)
{
    int i, maxid;
    fd_set rset, wset;
    timeval tval;

    FD_ZERO (&rset);
    FD_ZERO (&wset);
    maxid = 0;
    for (i = 0; i < nfds; ++i) {
        FD_SET (fds[i], &rset);
        FD_SET (fds[i], &wset);
        if (fds[i] > maxid) maxid = fds[i];
    }
    tval.tv_sec = 5;
    tval.tv_usec = 0;

    select (maxid + 1, &rset, &wset, NULL, &tval);
    for (i = 0; i < nfds; ++i) {
        if (FD_ISSET(fds[i], &rset)) 
            read_file(fds[i]);
        if (FD_ISSET(fds[i], &wset)) 
            write_file(fds[i]);
    }
}

The New Code

void poll_files(int *fds, int nfds)
{
    int i;
    pollfd *pfds = (pollfd *) 
              malloc (nfds * sizeof (pollfd));

    for (i = 0; i < nfds; ++i) {
        pfds[i].fd = fds[i];
        pfds[i].events = POLLIN | POLLOUT;
        pfds[i].revents = 0;
    }

    poll (pfds, nfds, 5000);
    for (i = 0; i < nfds; ++i) {
        if (pfds[i].revents & POLLIN) 
            read_file(fds[i]);
        if (pfds[i].revents & POLLOUT) 
            write_file(fds[i]);
    }
}

In order to take advantage of the newly accessible file descriptors above 1024, you will need to add these lines to your /etc/security/limits.conf file:

(username)          soft    nofile          1024
(username)          hard    nofile          4096

I chose 1024 for the soft limit since most apps are not interested in the high number of files, and 4096 for the hard limit because I read on some message boards that performance will degrade above that number. Feel free to choose other values.

You then need to make the following calls from your code (or call ulimit from the script that starts your application):

    struct rlimit nofile;

    if (getrlimit (RLIMIT_NOFILE, &nofile) != 0) {
        fprintf (stderr, "Could not get NOFILE");
        exit (1);
    }
    nofile.rlim_cur = 4096;
    if (setrlimit (RLIMIT_NOFILE, &nofile) != 0) {
        fprintf (stderr, "Could not set NOFILE");
        exit (1);
    }

*If you're interested in the error-checking code, drop me a line -- I just don't feel like typing it out right now.

posted afternoon of February 15th, 2008: Respond
➳ More posts about Programming

Wednesday, February 13th, 2008

🦋 vim rules!

Here's a neat trick: let's say you forgot to close a code block somewhere in a large C source file, and you can't figure out where, and the compiler is not helping you. Try putting a } character at the very end of the file, placing the cursor on it, and presing the % key -- vim will jump to the most recent { which was not matched by a }. (Note: this will not work if you have unmatched {'s inside conditional compilation blocks, which is generally a bad habit anyway.)

posted afternoon of February 13th, 2008: Respond
➳ More posts about Programming Projects

🦋 1024

A good thing to keep in mind when you are trying to write a TCP server that will support thousands of simultaneous connections: the default ulimit for maximum number of open files on a Linux system appears to be 1024. A further thing to keep in mind once you figure out how to adjust that upwards: there is a reason the default maximum is 1024!

See, if you use select() to multiplex your I/O (like I do), you will be passing structures of type fd_set around. These structures can only deal with file descriptors less than or equal to 1023. Try and set bit 1024, and you will break your program. But fear not! There is a solution; that solution is to use poll() instead of select(); apparently poll() is the new standard. First I ever heard of it! Switching from one to the other seems like it's not too hard, though I've just now started.

posted afternoon of February 13th, 2008: Respond

Friday, February first, 2008

🦋 In concert

The two shows I downloaded last night are indeed great music; I am tentatively liking the 1996 show better than the 2008 show, which I have however not yet listened to all of.** If anyone would like a link to the 96* show files, drop me a line.

Here is the setlist:

  1. DeChirico Street (from Moss Elixir)
  2. Lysander (from Perspex Island)
  3. Balloon Man (from Globe of Frogs)
  4. Devil's Radio (from Moss Elixir)
  5. Chinese Bones (from Globe of Frogs)
  6. My Wife & My Dead Wife (from fegMania!)
  7. Beautiful Girl (from Eye)
  8. Glass Hotel (from Eye)
  9. I Something You (from Storefront Hitchcock)
  10. You & Oblivion (from Moss Elixir)
  11. Queen Of Eyes (from Underwater Moonlight)
  12. Man With A Woman's Shadow (from Moss Elixir)
  13. Kingdom Of Love (from Underwater Moonlight)
  14. Serpent At The Gates of Wisdom (from Respect)
  15. Heliotrope (from Moss Elixir)
  16. I Am Not Me (from Moss Elixir)
  17. Only The Stones Remain (by the Soft Boys, I think only released as a single)

*Not that there are 96 of them, I mean they're from that year.
**After listening to more: Yes, the 96 gig is the better -- It actually adds something to the music over what is published on the albums, where the 2008 show is beautiful but not in a much different or superior way from I Often Dream of Trains.

posted evening of February first, 2008: Respond
➳ More posts about Writing Projects

Thursday, January 31st, 2008

🦋 A new show and an old

Haven't downloaded any Robyn concerts for a while now; but two new tapes became available today. One is of his gig the day before yesterday at Queen Elizabeth Hall in London; as soon as I read about it this morning I started fervently wishing for a tape of the show. And whaddaya know, half an hour later or so I get e-mail informing me of its availability. Quick on the heels of that message came another one, about a show from April '96 in Bilbao. Looking forward to listening to both.

Another opportunity for listening to Hitchcock: He'll be on Jools Holland's BBC show tomorrow night. Apparently I will be able to watch it on Fuse, though I'm not completely sure how that works yet.

posted evening of January 31st, 2008: Respond
➳ More posts about Robyn Hitchcock -- gig notes

Wednesday, January 23rd, 2008

🦋 watch

Cool! I found and fixed a bug today using gdb's watchpoint feature, which I have never tried before. (Not cool: the bug was a careless typo that I should never have introduced.)

posted evening of January 23rd, 2008: Respond

Thursday, January 17th, 2008

🦋 Mistranslation

This is the epigraph in front of Orhan Pamuk's The White Castle:

To imagine that a person who intrigues us has access to a way of life unknown and all the more attractive for its mystery, to believe that we will begin to live only through the love of that person -- what else is this but the birth of great passion?

Marcel Proust, from the mistranslation of Y.K. Karaosmanoğlu

This seems really intriguing to me: Pamuk is quoting a mistranslation into Turkish of a French text (and presumably a real, historical mistranslation), which has subsequently been (who knows, possibly mis-?)translated into English! (This book is translated by Victoria Holbrook, a new name to me -- it will be interesting to see how her rendering of Pamuk's work compares with that of Maureen Freely and of Erdağ Göknar.)

I'm not familiar with Proust and have no way of knowing what the correct translation of the quoted bit is -- not really something I can look up via Google. I wonder...

posted afternoon of January 17th, 2008: 1 response
➳ More posts about Translation

Thursday, January 10th, 2008

🦋 Winter Woodworking

I have 3 woodworking projects that I would like to get done this winter (and that Ellen would like me to get done this winter):

  • A decoration for the front of the walk in front of our house, in the form of a short fence or two short fences with a post at the corner. Ideally with nice carved finials at the top of the fence stakes. We want to grow some kind of vine or rosebush against this.
  • A bench for the front entry. Size is kind of tricky since the entry is mostly occupied by the swing of the front door; but there is a corner where a narrow bench would fit. Ideally this will be of the same wood and vaguely similar design to my garden bench in the front yard.
  • If I get ambitious, a similar bench for the top of the staircase.
I haven't been in my wood shop much at all in the past few years; but I have been wanting to do more with my hands. So I better seize the day.

posted afternoon of January 10th, 2008: Respond
➳ More posts about Woodworking

Previous posts about Projects
Archives

Drop me a line! or, sign my Guestbook.
    •
Check out Ellen's writing at Patch.com.

What's of interest:

(Other links of interest at my Google+ page. It's recommended!)

Where to go from here...

Texts
Programming
Woodworking
Music
South Orange
Friends and Family
Blogs
Comix