Archive for April, 2004

Entropy gathering

Tuesday, April 27th, 2004

My lab partner just scrapped the counter, and is rebuilding it from scratch, so I have some time to indulge myself. I was just relating to him how I have two PGP keys, one of which I lost the pass phrase for, so I can’t void, and the most recent one which I signed up for last week. So he can look me up on a keyserver, like pgp.mit.edu and get my public key, or he can download it from here. Which got us into a discussion about entropy, because I remembered when you use the Windows version of PGP type software, you have to bang on the keys to generate entropy to be used in generating a random key– the longer you want your key to be, the longer you have bang on the keys for. In Unix, there is an entropy daemon (isn’t that neat– a play on Maxwell’s demon?), which runs in the background gathering up entropy– if the Internet can be trusted– I saw a man page for it on the net. Sounds like a nice idea.

Previously, when I first ran across the idea of an entropy gathering daemon, I was in a creative mood, and I got the idea of a world in which entropy has become the greatest commodity, because technology has advanced to the point where shoddy encryption can be broken relatively easily. In this world, weird things are done routinely, all in an effort to collect valuable entropy; as one example out of countless others, cars are scanned before being sold, and if they get into a wreck, they are scanned again, and the random displacements in the surface of the car is used a source of entropy.

I wonder, is the quantity I’m talking about truly entropy? Well, maybe a better question would be, is there any quantity currently known as entropy in any sense (mathematical, physical, etc.) which coincides with the idea of entropy I’m using. It seems that I’m thinking about randomness. What is the relationship between randomness and entropy? I’ve been told that (physical) entropy is constantly increasing, but I don’t see how that necessarily corresponds to an increase in randomness. That would be like saying randomness is a thermodynamic quantity, which is a pretty weird statement.

The futility that is DLD

Tuesday, April 27th, 2004

I’ve spent all day (since 12) working on DLD (Digital Logic and Design) stuff; it is now 7:27pm, and I don’t anticipate leaving the lab until 9. Of course, the first hour was only class, but after that, I’ve been working on the last two labs, which are due on Monday: design and simulate (lab 1) then implement (lab 2), a traffic light controller. The circuit is only designed to control six lights (the lights on an intersection of two one way streets), but it is proving to be a real pain. We finished the computer simulations and design portion an hour ago, but we can’t seem to implement the counter in hardware. And this counter is about as hard as our lab final will be. I have no problem with staying here late to do a lab, that’s the name of the game after all, but I am not liking the idea that it’s taking us this long to work out all the kninks in our hardware implementation– during the final, we will have only one hour to design, implement in hardware, and debug our counter circuits. Anyhow, back to work now.

Anti spam-commenting ideas

Friday, April 23rd, 2004

Via http://cheerleader.yoz.com/archives/000849.html; I like tip 6 the best, because it’s a copy-and-paste job, and I don’t have high volume commenting going on:

Tip 6: Include a “Delete this post” link in notification mail

The reasoning: All the previous tips have been “Club” solutions - this one’s a “Lojack”, and particularly useful when most of your comment spam seems to come from people doing manual entry rather than robots. One of the reasons that comment spam is such a pain is that it takes several clicks through MT’s interface to get rid of a single post. If you could kill a spam easily as soon as it appeared, their effectiveness would be reduced dramatically, with the hopeful aim of deterring spammers entirely.

The fix: This is another Perl insert, this time into the file lib/MT/App/Comments.pm (about line 150):

$Text::Wrap::cols = 72;
$body = Text::Wrap::wrap('', '', $body) . "\n$link_url\n\n" .
   $app->translate('IP Address:') . ' ' . $comment->ip . "\n" .
   $app->translate('Name:') . ' ' . $comment->author . "\n" .
   $app->translate('Email Address:') . ' ' . $comment->email . "\n" .
   $app->translate('URL:') . ' ' . $comment->url . "\n\n" .
   $app->translate('Comments:') . "\n\n" . $comment->text . "\n";
$body .= "\nTo delete this comment, click this link:\n".
   $app->{cfg}->CGIPath . "mt.cgi?__mode=delete_confirm&" .
   "_type=comment&id=".$comment->id ."&blog_id=" . $blog->id ."\n";
MT::Mail->send(\%head, $body);

It inserts a link into the mail that, when followed, jumps straight to the “Delete comment? [Yes/No]” page in MT (though, irritatingly, this page will close the browser window after you’ve hit the button, so you’ll want to ensure the page appears in a spare/new window when you click on the link)

Elegant, plus it gives an idea of how powerful messing around with MT’s internals can be, if it hasn’t already been made blindingly obvious. Off I go to implement this.

Domain name hassles

Friday, April 23rd, 2004

Finally! The site is back up. I don’t even know how long it’s been down, because I don’t usually visit it unless I’m updating it somehow, or in a nostalgic mood, or need to look something up in the archives. So I first noticed that something was wrong when I got a “comment posted” email, saw that the comment was actually spam, came to delete it, and saw that my domain name wasn’t resolving. BTW, I can’t believe we pay so much money just to have a name resolved– we’re basically paying for an entry to be made in a database, after all. Anyhow, turns out my one year subscription had expired. I contacted the tech support people at Imhosted, who told me to contact my registrar. Well, after some whois digging, I determined they are my registrar, and for the first time, used their user center, or whatever they call it. There I saw that I had signed up for a two year renewal plan– so I’m thinking, what the hell? I emailed them asking about it, and two days later, today, I now see my site is back on its feet. Yeah!

Now I can post those NSCS pics that I’ve been sitting on for so long. I feel horrid about the way I’ve been handling my NSCS responsibilities. I’m not able to make it to any of the meetings, except the officer meetings, which are at 8am! And I haven’t been to a single activity this semester– with the exception of the upcoming end-of-year banquet. And the website has been updated less than a handful of times this semester. And I lost my login to the national site, so I can’t help accrue chapter points by reporting what I’ve done as an officer. Today, I was going to assist in the March to College Day program, after the EM group seminar, but then I decided it would be too much of a hassle to try and track them down, and get a job assigned. Plus I have a lot of other stuff to do for school, so I figured I would just do that. Then, as Oscar and I were walking out for lunch, I passed one of the tour groups, and saw two other officers. Well, they probably will think I just blew them off; not far from the truth, I guess, when I’m being honest. Here’s the dilemma: I would love to do my job as the NSCS webmaster, but I don’t like gathering the information to update the website, or rescheduling my activities to fit their schedule. That’s something that I’ll have to work on next semester, as well as train my eventual replacement. At least, this semester, I’ve starting using a planner, so I’m getting better at keeping up with the dates for events, even if they do have a bad habit of changing everytime I check my email.

I was just surfing with a purpose: looking for freeware CAD programs. Surely I jest? I wish. I saw a book on AutoCAD 2004 today, and checked it out, because I need to relearn AutoCAD, at least to make a scale drawing for my Electromechanical Energy Conversions project. But of course, I don’t have AutoCAD on any of my home computers, so I was looking for something equivalent, but free. I thought I had hit the jackpot with QCad, but then I went to download it, and saw that it isn’t as free as I thought (the source code is released under GPL, but you need Qt developers edition to compile it; the executables are all time limited demos). I saw a couple of promising projects on SF, and even saw a nice looking schematics capture proggie (TinyCAD), which I would loved to have seen back when I was actively looking for one. But of course, promising means will be ready for use in a couple of years, if ever. So I basically found squat.

Which brings me to yet another project proposal. Specifically, the implementation of a CAD system in Jython. Why Jython? Because it would be cross-platform, which seems to be a big issue with all these CAD programs (deservedly, I think), and as with all Jython programs, would have the full power of the Java toolkits behind it. In this case, access to the Java 2D API and toolset seems like it would be very useful. So I’ll add that to my internal buffer of projects I will never have the time to work on, or even to learn enough background on to be able to implement (forget the issue of my not knowing anything about CAD, I know nothing about Jython, or GUI development, or the Java 2D API, ad naseum).

Sometimes I feel like I’ll never amount to anything. Mostly after a trip to the library, or a surf on the net– seeing all those books I’ll never read, or all those programs I’ll never be able to roll my own equivalent of.

Cryptoclast

Thursday, April 8th, 2004

Today I was going to spend two hours reading a novel, but I got distracted by cryptoclast.org, reading the author’s articles on homosexuality, and his correspondence with visitors to his site. It really opened my eyes on those particular issues, and how to reason clearly in any case. Even though I can’t say I would like the author if I met him– he seems a little self-righteous, and prudish.

Conundrum

Tuesday, April 6th, 2004

When I got up, it was nice and dry outside; so nice in fact, that I had no inkling that it was going to rain. In retrospect, the only cautionary piece of evidence was that it was unseasonably cool. Now I’m trapped in the engineering quad, unable to leave without getting soaked. Which would ordinarily not be an issue, since I basically live here. However, in under an hour, I have a meeting with my faculty advisor to discuss what courses I’ll be taking next semester. Therefore, I need to go get a course catalog, and hash that out before then— which requires my going to the campus bookstore, which is far away, relative to the intensity of the rain.

I have a vague idea of how my next semester will be. I have abandoned the idealistic plan that I clung to until as late as the beginning of this semester, to attempt to follow the engineering course guide strickly, and graduate in the 8 semester outlined therein. It seems an unsavory choice now, because I’ve realized just how wedded to my personal interests I am. That is, I’m incapable of taking a full load of classes for no other reason than that I need to take them to graduate; I end up feeling surly, which translates into low motivation to work assignments, and results in my doing everything last minute. This procrastination, and the resulting headaches and fatigue lead to frustration and even more surliness. A vicious cycle!

So for the next semester at least, I plan to return to the even more idealistic plan I had as a freshman, fresh out of high school: to chart my courses according to what interests me most. Of course, I will be taking a few engineering courses, but I will definitely not be taking nothing but engineering courses! Instead, I intend to take at least one math course, if I see one worth taking, and a physics course. I’m particularly interested in the physics course that I’m going to take, because I’ve always been intrigued by the Lagrangian and Hamiltonian approaches to mechanics, but I’ve never been able to find the time to do any self-study. Plus, the course also (necessarily, I guess) covers the rudiments of the calculus of variations.

The rest of this post is merely a test of the CodeBeautifier module on some throw-away code:

; Alex Gittens
; March 12, 2004

; Code to determine quantities associated with a non-uniform linear array antenna, and plot its array factor

(define (enumerate-interval a b)
(cond
((= a b) (list b))
(else (cons a (enumerate-interval (+ a 1) b)))))

(define pi (* 4 (atan 1)))

(define (make-antenna-array d beta amplitudes distances)
(let*
((element-amplitudes (list->vector amplitudes))
(element-distances (list->vector distances))
(num-elements (vector-length element-amplitudes)))

(define (array-factor theta)
(magnitude
(accumulate + 0
(map (lambda (n)
(* (vector-ref element-amplitudes n)
(exp (* 0+i (vector-ref distances n) (+ (* 2 pi d (cos theta)) beta)))))
(enumerate-interval 0 (- num-elements 1))))))

(define (dispatch msg . args)
(cond
((eq? ‘array-factor msg) (array-factor (car args)))))

dispatch))

(define (uniform-linear-array n beta d)
(apply make-antenna-array
d beta
(list (map (lambda (n) 1)
(enumerate-interval 0 (- n 1))))
(list (map (lambda (n) 1)
(enumerate-interval 0 (- n 1))))))

Spamtastic

Saturday, April 3rd, 2004

A while ago, I heard about spammers using MT blog’s comment engines to propagate their message. I didn’t think I’d be a victim, but it turns out I was too hopeful. I just deleted two comments that were obviously spam. I hope I don’t have to do so again. On the good side, the spammers caused the site to rebuild itself, voiding the front page, thereby forcing me to make a post.

This weekend I’m very busy, among other things, trying to complete a special problem assignment for my Antennas course. The options available for this assignment were nearly all programming assignments, with a bias toward crossplatform GUI building. This caused me to research Python, because I had somehow gotten the impression that Python had strong crossplatform GUI support. I found out to my chagrin that it doesn’t: it ties into Tk, which although it has a new updated, almost native feel to it under WinXP, still turns me off, and also to a wxWindow based package called wxPython. The appearance of wxPython is fine, but who can write a program that requires both the presence of Python and two other auxiliary packages (wxWindow, wxPython) and consider it to be crossplatform? That requires too much effort on the part of the casual user, almost voiding the usefulness of the platform independence thereby gained.

Then I discovered Jython by a happy accident, and saw how it can solve my problems by tieing in seamlessly with any Java library, including Swing. And I do mean seamlessly. I ordered a book on Jython, “Jython Essentials”, through the UH library, and received it yesterday. Of course, that is too late to do me any good– I doubt I could learn a language in the time I have available, considering the other things I have to do– but I’ll keep on hand, so in the future, I’ll be able to blow my prof out of the water with a professional GUI.

On the personal side, this morning it hit me that Jython also provides a nice alternative to implementing a CAS in scheme, because it would render the problem of graphical tools a nonissue– all the Java toolkits would be readily available. Plus the CAS would be nicely crossplatform, and easily distributable. What I would like to see is a Scheme implementation in Jython (I believe that if one existed for Python, it should work under Jython also); then maybe the hypothetical CAS wouldn’t have to sacrifice the elegance of implementation that comes from being written in Scheme, and still have easy access to Java toolkits. It’s worth a thought; although, one would have to deal with the issue of how to expose an interface to Java/Jython capabilities to the Scheme interpreter without resorting to ugly, bloated or counter-intuitive hacks.

Of course, since Jython hooks in so well with Java based toolkits, the currently available Scheme implementation in Java ( I forget its name), might be just the thing I’m looking for. All of this is worth pondering…

All I’m sure is, Jython is the coolest idea I’ve come across in a long time.