Archive for December, 2004

Things that Suck Right Now

Thursday, December 30th, 2004
  1. I was tired at 11:45 PM, it’s now 5:46 AM, and I am still not asleep.
  2. I spent 3+ hours in bed trying to sleep. Eyes closed and everything.
  3. Yesterday night, I got approximately 5 hours of sleep in all.
  4. Tomorrow at 12 noon is my first day of unpaid “work” for the MindfulGroup online store. (This would be fine if it weren’t for the lack of sleep.)
  5. At 2 PM, I will have been awake for 24 hours.
  6. Yesterday I made plans to look at home furnishings a friend of my mother’s would be throwing away, but then I found out she lives in the Upper West Side, over 5 miles from my new apartment.
  7. I still have not done anything substantial with my web site for Maymay Media.
  8. If I do fall asleep, I’ll probably be tired all day tomorrow.
  9. I’m in a shitty mood.

Message Boards versus Blogs

Wednesday, December 29th, 2004

Okay, I think I figured it out. It’s easier to write when I’m talking to someone. When I blog, I often feel like I’m just talking to myself, and the most common situations which occur when I try to talk to myself are:

  1. I think faster than I can type (and often faster than I can think, if that makes any sense), and thus have a hard time creating a coherent written transcript of my thoughts, or
  2. I get distracted and can’t think of a way to express my thoughts.

That’s why I like message boards.

How can I make sure I reach you?

Monday, December 27th, 2004

Today I got four voicemails.

  1. Mom, at about 11 AM.
  2. Dad, some hours later.
  3. Brother, early afternoon.
  4. Mom again.
  5. Some other voicemail I already forgot about.

I usually answer my phone, but today it was off and I wasn’t aware of that. The funny thing was that I spent the whole day online. So, if you want to make sure you contact me, just email me.

Seriously, it doesn’t matter what address you send it to because I check them all like a rabid rodent on speed.

Post-Christmas Tally

Sunday, December 26th, 2004

Sleep has been very erratic once again, and its effect on my productivity has been disastrous. In the past several days, I have spent a grand total of about 30 hours awake, most of which was squandered playing play-money poker online. In short, I feel like a lazy sloth and I’m hating the feeling.

In my defense, I’ve been finding it nearly impossible to do anything productive in this apartment at all. It is simply too fucking small. It feels more like a cell than an apartment and in the 11 months I’ve been here, I haven’t opened the windows once because the gratings on the windows just make it feel even more like prison.

On the other hand, productivity is supposed to be a mental thing, so there’s that other part of me that just blames me for it. I doubt I would have been any more productive elsewhere. Of course, I’m hoping I’m mistaken on that count and that the new, much larger apartment I’m signing the lease for tomorrow will prove me wrong.

Christmas presents I got this year:

  • 1 fleece throw.
  • 2 books; Designing Web Usability and a Photoshop book I can’t quite remember the title of. I think it had “Web” in the title, though.
  • 3 apparel items.
    1. A black shirt with a patch that reads, “Damn, I’m good.”
    2. Northface items, two of them; a cap of some kind, and a sweater-vest-thingy.
  • 1 power tool. A first! Now I can call myself a man.
  • 2 pillow cases, intended to be shared with Danica.
  • I might be missing something, but the allure of Christmas gifts and gift-giving has long since lost its excitement.

Cygwin SSH X11 Forwarding Doesn’t Set Environment Properly

Monday, December 20th, 2004

I have spent the past 5 hours pouring over the Cygwin/X FAQ and countless mailing list archives but have turned up empty. In brief, I am having trouble getting my Cygwin X Server to receive forwarded X11 connections.

More specifically, when I ssh -X user@remote-host from the Cygwin XTerm, the remote-host doesn’t have a DISPLAY environment variable set. Obviously, this is bad, because it means the X11 forwarding doesn’t have a display to go to (i.e., it is b0rk)!

I’ve tried to ssh -vv -X user@remote-host to get some interesting debugging output, but the only X11-related messages I get are too cryptic for my understanding:

debug2: x11_get_proto: /usr/X11R6/bin/xauth -f /tmp/ssh-UbLPAD1860/xauthfile generate 127.0.0.1:0.0 MIT-MAGIC-COOKIE-1 untrusted timeout 1200 2>/dev/null
debug2: x11_get_proto: /usr/X11R6/bin/xauth -f /tmp/ssh-UbLPAD1860/xauthfile list 127.0.0.1:0.0 . 2>/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
debug2: channel 0: request x11-req confirm 0

The bit about “authentication spoofing” is unnerving. Could this “spoofing” simply not be working? If that’s the case, then the problem has something to do with the way xauth(1) is configured, no? (Yes, I’ve poured over the man pages as well, but to no avail. As far as I can tell the output fom xauth -v list is fine.)

Additionally, I’ve got doubts about whether or not it is okay that the xauth data is being written to a temp file like that with xauth ... generate .... Note that there doesn’t seem to be any problem forwarding the display of X client programs to a different server, only the other way around (forwarding other displays to my Cygwin X Server) causes problems.

Am I missing something really stupid?

After some more fiddling, I have gotten it to work if I set $DISPLAY manually through the SSH connection. That is, after I

Cygwin-Box$ ssh user@remote-host
Remote-Host% setenv DISPLAY "192.168.1.102:0.0"

then

emacs&

will work and its display will appear on Cygwin-Box. But why doesn’t ssh -X ... do this automatically?

Anyway, if anyone has any idea why SSH isn’t setting $DISPLAY for an X11 connection, I’d really appreciate some advice. Thanks in advance.

Generating Random Letters in PHP

Sunday, December 19th, 2004

Generating random numbers in PHP isn’t much a problem thanks to functions like rand() or mt_rand() and so utilizing them is a no brainer, even for programming newbies. Generating random letters, however, is sometimes a little less intuitive.

The tricky thing about it is that computers are basically glorified switches. All they do is answer the question “Is this a 0 or a 1?” for any given datum. So while this makes them pretty good at handling numeric data, doing anything interesting with something else, such as natural languages, requires a bit of creativity.

The concept of what a “letter” is or is not needs to be explicitly defined in some manner that computers (glorified switches) can understand. This is accomplished by mapping a numeric value to a specific character. This map is then known as a character encoding.

I’m not going to get into the whole thing here. For the curious, a pertinent Google search turned up this tutorial which is a good place to start. Additionally this informative article by Joel Spolsky is an entertaining and educational read.

However, back to PHP and generating random letters, we can sidestep the whole issue of encodings as long as the pool of possible letters we wish to generate is somewhat limited. Thanks to a feature of PHP that allows us to pick out a character in a string using array syntax, we can get a random letter with a random number and a string containing the possibilities we want.

function randLetter()
{
    $int = rand(0,51);
    $a_z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $rand_letter = $a_z[$int];
    return $rand_letter;
}

While this method may carry a little more overhead than a purely numeric approach, it’s certainly easier to digest.

3rd Meitar

Saturday, December 18th, 2004

Okay, a bit of ego-checking here. Matthew Mullenweg is the number 1 Matt on the ‘net. Simon Jessey is the 53rd Simon, and I’m the 3rd Meitar. I would feel better if Meitar wasn’t such an uncommon name, but hey, it’s not bad. In the past, I wasn’t even on the first page.

Update: It turns out that while I may be ranked as number 3 in a search for “Meitar,” I am number 1 in a search for “Maymay”.

Internet Sleaze

Friday, December 17th, 2004

So someone wanted to know if the Internet’s dating scene was all about sex. My response:

The Internet is a horrendous place to meet people you want to care about. The world is just too full of assholes and morons, and the chances of meeting one of those folks far outweighs the chances of meeting anyone decent, statistically speaking

Tuesday’s Bedtime Bantering

Tuesday, December 14th, 2004

RSS Reorganization

I need to rethink how I’ve organized my newsfeeds. There are some categories which I feel like I’m constantly un-bolding. Thing is, some of those items are ones I like to read, but they’re right next to the ones I don’t really want to see, despite being in the same logical category. Thus, I need to rethink how I’ve got those feeds set up.

There’s no point to even having some of them if I waste my time marking them as read and never reading them, but on the other hand I do find something of interest in those feeds every so often and isn’t that the point of RSS after all? Being able to scan widespread news sources quickly for items of interest? Perhaps I should do something like what Jeffrey Veen has done with his RSS subscriptions for the sake of my sanity.

Perhaps I Should Wikiblog

I think I’m finally understanding what Rui Carmo has said (or implied) about the nature of wikis as blogging tools, as I read his newsfeed yet again. He seems to create wiki nodes for each day he blogs, which is incredily useful for many reasons. Strongest for me, however, is the ability to continually add items to said node before the day is over. In a traditional blog, one would be forced to create an entirely new entry, thereby breaking the inherent connection between the items. Of course, some would argue that this is a non-issue thanks to search functionality, linking, database queries, etc., but there’s still something that feels intrinsincally common-sense-oriented when a wiki is used in that fasion.

Of course, wikis aren’t really meant to be blogs, and so there’s some implementation issues of that kind. Still, if he got it working, why can’t I? It’d be a hell of a lot easier to organize my thoughts that way, and it could also provide a much easier way to integrate a lot of my other stuff into this site. So there’s a ton of reasons why that could prove to be a really great idea.

I really like WordPress, however, so something that could integrate a wiki right into WordPress would be ideal at this point in time. And while Googling I found that I’m not the only one who thinks so, so this may actually happen! (Perhaps I should see if I can help them out in some way.) For now, there are also plugins that can emulate wiki-like behavior, such as WpWiki, but for some reason this still feels like a blog plugin to me—not a real wiki. Perhaps someone with some familiarity can convince me why I’d like it.

Right now, I’m not confident enough to believe that I can easily make this change so I’m going to stick with a traditional blog for now, but the moment I get my hands on a computer and a Linux distro in my bigger apartment I’m going to experiment with PhpWiki and others to see what I can do.

Rubik’s Cubes and Meetups

My Rubik’s Cube got me a free pint of mudslide ice cream at Ben & Jerry’s the other day. It has also gotten me a free scoop of ice cream at Cones, and various other freebies around the city. Perhaps I should write a “New York City Rubik’s Cuber’s Freeloading Guide.”

Yesterday I was cubing on the subway and spoke to a group of three teenagers briefly. That night, while walking in the village they saw me again and yelled out bravos and encouragements. I think they were drunk, but it was still pretty neat. Danica thought it was pretty cool, too.

So the cube was definitely something great to learn. I’ve started a New York City Rubik’s Cube Meetup for anyone interested, though so far it’s just me and my lonesome. Hopefully more folks will join in the future. In case it helps, I hold the Meetups at Saint’s Alp Teahouse in the village. The Boggle Meetup meets there as well.

Tonight was also the first time I made it out to the New York City Bipolar Disorder Meetup. Danica came with me, for which I was very happy. It’s the first time in months that we’ve done something I planned. (Usually she cancels on me.) We had a good time, I was glad to be out, and Danica exchanged numbers with the organizer and will potentially have a movie buddy. Good stuff. I plan to attend next month as well, and Danica has said she’d come with me.

All right, it’s bed time. I have a meeting with someone I met from the Entrepneur Meetup I’m in. Not sure what it’s about really, but it’s businessy and might be interesting. ‘Night.

Fun with Apache Redirects

Monday, December 13th, 2004

I absolutely love Apache. A while ago I ranted about the annoying prevalence of uneccessary redirects some sites make you click through. This topic comes up pretty often even today, although the issue of annoying HTTP “404 Not Found” errors has been mitigated somewhat by people wising up and creating helpful error pages. (Which I’ve been meaning to revise and improve on this site.)

Usually, the existene of broken links and the like is brushed off by saying something like, “We are undergoing a re-organization period,” usually followed by a request to “please bear with us” for the duration of said period.

Well, I know a thing or two about organization. In fact, I probably know more than most because I re-organize my my desk, my computer, my Web site, and even my refridgerator fairly frequently. As Danica will no doubt tell you, I like to make sure I am keeping things as effecient as possible.

In terms of serving up web pages to visitors, it means that I can reorganize and restructure my site as much as I’d like and you wouldn’t even know that I did it. The main tools I use for this are Apache’s Redirect directive (implemented via mod_alias) and the various, insanely powerful features offered by mod_rewrite (documentation). I’ve used these tools several times while working on this site but none of these examples even scratch the surface of what is possible.

  • While moving the site from Blogger to WordPress, I also decided to change the blog’s address so that I had a shorter URL, devoid of any hint of the old site. Naturally, since I didn’t want to break incoming links, I used a Redirect to bounce visitors to the right address. Additionally, I tagged the redirect with the keyword permanent which emits a “301 Moved Permanently” HTTP response header so that decent clients will no longer request the old resource’s address. The full line in my .htaccess file looks like this

    Redirect permanent /bpd/blog/ http://www.maymay.net/blog/

    although I could have written it with the status code instead of the keyword like this:

    Redirect 301 /bpd/blog/ http://www.maymay.net/blog/
  • At the same time, I also decided to give some common aliases to the /bpd subdirectory, so I started redirecting requests for things like /bipolardisorder to /bpd as well.

  • I wanted to make a few “static pages” such as the About Meitar page, but I wanted a cruft-free URL for them as well. The simple solution was to start Apache’s mod_rewrite and map a nice-looking URL to the file I wanted to serve.

    # turn mod_rewrite on
    RewriteEngine on
    # restrict the following rule to /bpd/
    RewriteBase /bpd/
    # set /meitar or /meitar/ to meitar.php (or similar)
    RewriteRule ^/meitar/?$ meitar.php
    

Most recently, I was asked if there is some way Apache could automatically “redirect HTTP to HTTPS” transparently. Sure enough, this is a piece of cake:

RewriteEngine on
# is request not on HTTPS?
RewriteCond %{HTTPS} !=on
# if so, redirect it (the [R] flag) and stop processing (the [L] flag)
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]