The alternatives are not placid servitude on the one hand and revolt against servitude on the other. There is a third way, chosen by thousands and millions of people every day. It is the way of quietism, of willed obscurity, of inner emigration.
This page renders best in Firefox (or Safari, or Chrome)
READIN
READIN started out as a place for me
to keep track of what I am reading, and to learn (slowly, slowly)
how to design a web site.
There has been some mission drift
here and there, but in general that's still what it is. Some of
the main things I write about here are
reading books,
listening to (and playing) music, and
watching the movies. Also I write about the
work I do with my hands and with my head; and of course about bringing up Sylvia.
The site is a bit of a work in progress. New features will come on-line now and then; and you will occasionally get error messages in place of the blog, for the forseeable future. Cut me some slack, I'm just doing it for fun! And if you see an error message you think I should know about, please drop me a line. READIN source code is PHP and CSS, and available on request, in case you want to see how it works.
See my reading list for what I'm interested in this year.
READIN has been visited approximately 236,737 times since October, 2007.
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
Saramago's Seeing is a terrific (or depending on how you feel about black humor, "horrible") book to be reading during the election year. I'm pretty sure, based just on the first chapter, that I would recommend it to Americans in 2008 before Blindness -- which I would certainly recommend, it's just not timely in the same way. It doesn't seem (so far) like knowledge of the previous book is vital to understanding this one.
posted morning of February 15th, 2008: Respond ➳ More posts about Seeing
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.)
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 ➳ More posts about Projects
It's the first real snow of the season! (I think -- I am remembering now that I wrote a similar post back in December or something, but that the storm blew over.) Sylvia and I had a snowball fight! Speaking of snow, look at these pictures, from Switzerland -- pretty!
posted evening of February 12th, 2008: Respond ➳ More posts about Sylvia
One thing I spent a lot of time wondering about while I was reading Blindness was, how is Saramago going to end this story? It seemed like it would be really difficult to pull off without being either corny or dull, or both. Saramago came through, I'm glad to say, and managed to make what could easily have been a rote, formulaic ending vital. The doctor's wife's moment of doubt and fear in the final paragraph will blow your mind -- it is the whole book contained in a few sentences.
Saramago has a later book called Seeing, which I bought in December when I bought Blindness, intrigued by the similar titles -- it turns out the first few pages of that are printed in the end of this edition of Blindness -- it is another story featuring some of the same characters, and with reference to this one. How exciting! That will be my next read, assuming I can figure out where I put it down, which was predictably not "on the bookcase".
The final pages of Blindness are very strong, I think everything that has been rough and disorganized in the novel is crystallizing here, coming into focus. (I have not gotten quite to the ending, though I think I will finish it tonight.) I opened the book to get some pull-quotes and realized that really everything starting from where I stopped yesterday shines with such clarity as to be difficult to exerpt. The scene in which they bury the neighbor of the girl with dark glasses; the wedding proposal of the one-eyed man; the church with the defaced artwork... Here: I have not yet quoted any passages featuring the dog of tears.
...It won't be long before we have outbreaks of epidemics, said the doctor again, nobody will escape, we have no defenses left, If it's not raining, it's blowing gales, said the woman, Not even that, the rain would at least quench our thirst, and the wind would blow away some of this stench. The dog of tears sniffs around restlessly, stops to investigate a particular heap of rubbish, perhaps there is a rare delicacy hidden underneath which it can no longer find, if it were alone it would not move an inch from this spot, but the woman who wept has already walked on, and it is his duty to follow her, one never knows when one might have to dry more tears.
Well ok, and also the church -- this really seems to me like a little masterpiece, a visual impression worthy of Buñuel:
She raised her head to the slender pillars, to the high vaults, to confirm the security and stability of her blood circulation, then she said, I am feeling fine, but at that very moment she thought she had gone mad or that the lifting of the vertigo had given her hallucinations, it could not be true what her eyes revealed, that man nailed to the cross with a white bandage covering his eyes, and next to him a woman, her heart pierced by seven swords and her eyes also covered with a white bandage, and it was not only that man and that woman who were in that condition, all the images in the church had their eyes covered, statues with a white cloth tied around the head, paintings with a thick brushstroke of white paint, and there was a woman teaching her daughter how to read and both had their eyes covered, and a man with an open book on which a little child was sitting, and both had their eyes covered, and another man, his body spiked with arrows, and he had his eyes covered, and a woman with a lit lamp, and she had her eyes covered, and a man with wounds on his hands and feet and his chest, and he had his eyes covered, and another man with a lion, and both had their eyes covered, and another man with an eagle, and both had their eyes covered, and another man with a spear standing over a fallen man with horns and cloven feet, and both had their eyes covered, and another man carrying a set of scales, and he had his eyes covered, and an old bald man holding a white lily, and he had his eyes covered, and another old man leaning on an unsheathed sword, and he had his eyes covered, and a woman with a dove, and both had their eyes covered, and a man with two ravens, and all three had their eyes covered, there was only one woman who did not have her eyes covered, because she carried her gouged-out eyes on a silver tray.
Update: the woman carrying her gouged-out eyes on a silver tray is Saint Lucy, the patron saint of the blind.
posted evening of February 11th, 2008: Respond ➳ More posts about Blindness
The Yes We Can video is great, it has to be said, granted I had a couple of criticisms -- It's pretty sweet. Even better, the McCain camp's response:
(Yeah yeah, I know it's not from the McCain camp -- I just like to pretend. Dig the tall guy looking down at his music to make sure he's got it right.)
Further to the point below about my cheap viola being as satisfying to play as the more expensive ones I have tried out -- It seems to be easier to get volume out of it than out of the expensive ones. I reckon the trade-off is that the sound is a little coarser, though my ear is not well-enough trained to distinguish that yet. For the music I play, which is by and large not classical, this is totally acceptable. (Also it could be that if I went one step more expensive, tried playing the $1000 instruments, I would find them to have all the volume of my fiddle plus the smoother sound that I'm postulating the $500 instruments have. This is just guesswork though.)
posted afternoon of February 11th, 2008: Respond ➳ More posts about Fiddling
I put Blindness aside a few weeks ago to read The White Castle -- I was getting frustrated by a stretch of plot which seemed monotonous and deadening. Picked it up again the other night and my strategy of backing off and doing something else has paid off well: the book is fresh and surprising again. The scene in which the doctor's wife and the other two women are washing themselves and their clothing in the rain was especially gripping, even climactic.
Perhaps in the building opposite , behind those closed windows some blind people, men, women, roused by the noise of the constant beating of the rain, with their head pressed against the cold window-panes covering with their breath on the glass the dullness of the night, remember the time when, like now, they last saw rain falling from the sky. They cannot imagine that there are moreover three naked women out there, as naked as when they came into the world, they seem to be mad, they must be mad, people in their right mind do not start washing on a balcony exposed to the view of the neighbourhood, even less looking like that, what does it matter that we are all blind, these are things one must not do, my God, how the rain is pouring down on them, how it trickles between their breasts, how it lingers and disappears into the darkness of the pubis, how it finally drenches and flows over the thighs, perhaps we have judged them wrongly or perhaps we are unable to see this the most beautiful and glorious thing that has happened in the history of the city, a sheet of foam flows from the floor of the balcony, if only I could go with it, falling interminably, clean, purified, naked. Only God sees us, said the wife of the first blind man, who, despite disappointments and setbacks, clings to the belief that God is not blind, to which the doctor's wife replied, Not even he, the sky is clouded over...
I also really liked this conversation between the doctor's wife and the writer who is squatting in the apartment of the first blind man and his wife:
...How have you managed since the outbreak of the epidemic, We came out of internment only three days ago, Ah, you were in quarantine, Yes, Was it hard, Worse than that, How horrible, You are a writer, you have, as you said a moment ago, an obligation to know words, therefore you know that adjectives are of no use to us, if a person kills another, for example, it would be better to state this fact openly, directly, and to trust that the horror of the act, in itself, is so shocking that there is no need for us to say it was horrible, Do you mean that we have more words than we need, I mean that we have too few feelings, Or that we have them but have ceased to use the words they express, And so we lose them,...
Saramago's practice of referring to his characters by their role in the story rather than by name (I express some skepticism here) pays off big time when he is able to name the stray dog the group adopts (whose first appearance in the story was on the street, licking the tears from the face of the doctor's wife) "The dog of tears" -- this is a beautiful handle for him.
posted evening of February 10th, 2008: Respond ➳ More posts about Readings
Microgravity experiments: here's video from the International Space Station. I especially like the Symphony of Spheres but they're all good. In space, you can drink your tea with chopsticks!