Monthly Archives: September 2004

Someone had to do it.

Well, I’m not dead. In fact, I’ve been quite busy the past 2 days trying to implement Roberto Alsina’s simple calculator idea in C++ for speed. It was complicated by the fact that I couldn’t simply call ‘eval str’ like Roberto and Zack, but I have my first version up at my website.

It’s called kcalc2 right now, for lack of any semblance of a better name. To (drastically) reduce the download size, and keeping in mind the fact that the application as it stands has no use for the KDE build system, the application is distributed with only a Makefile. The upshot is that the source code (including the bison and flex generated files for those without bison and flex) comes to only 24K, which will really help out my poor computer when it’s trying to serve the file over my cable modem. ;-)

Hopefully it will build for you. If not, it shouldn’t be too hard to make it do so I think, as long as you have KDEDIR and QTDIR set. Next release will probably use qmake to make this kind of thing less of an issue. I’ve posted the README for the program on my website as well in case you just want to see that first, as I don’t feel like repeating it all here.

Hurricane Jeanne again

It looks like Jacksonville residents (like myself) may get lucky with Hurricane Jeanne, as the projected course keep moving more and more westward. Currently it looks like the Hurricane will take a path similar to Hurricane Frances did.

Mind you, Frances was bad enough, so you should probably expect me to be offline for a week again, but I can only think of how much worse the damage would be if we were to be hit by the eyewall as in yesterday’s predictions.

We have a saner evacuation plan cooked up this time if needed. We have friends who live a few miles inland in a nice sturdily built apartment, and we can just hang out with them if needed instead of trying to find a hotel room close by (which would be well-nigh impossible now). We might not evacuate what with the new track and all, but we’re ready this time.

Speaking of preparedness, my wife has been getting ready for our latest bout of power loss. We now have quite a bit of food which can be stored at room temperature, a whole lot of batteries, and about five different flashlights. Two are the normal 2 ‘D’ flashlights, one is a very power lantern-battery flashlight, and the other two are head-mounted LED flashlights which are actually rather bright. We have enough water to last for weeks, and now we have a portable radio. So I’m exceedingly confident that we’re ready this time.

Now I have to go finish the things I’m supposed to be doing, which is applying Rain-X to the car’s windshields. :-)

JuK random play icons

Tina Trillitzsch has been kind of enough to respond to my plea for JuK random play icons, and has submitted a few potential icons, which are much better than what we have now.

I wanted to go ahead and display them so I can get some feedback before wheels returns, so here they are:

  • Random play disabled
  • Random play enabled
  • Album random play enabled

Update

Well, the undo support in JuK seems to be progressing nicely. The feature itself works now, and includes renaming files back to their original name if necessary, and works for all of the code paths that can change a tag (although MusicBrainz can only undo the very last change made due to the way it’s been coded). I still have to finish up some problems, like the playlist items not updating after making a change, but it shouldn’t be too hard to get it finished in the next day or two.

I’ve got the Korundum KDE-Ruby bindings installed, and I must say, it’s a nice piece of work. After reading a C# book a few weeks ago I lamented the fact that the Qt# bindings were a pain to install, but these bindings more than make up for it. Richard Dale and the other kdebindings authors deserve a big round of applause. :-)

I have little time to start up a new application, but I don’t see myself choosing C++ for the next application I make if I can avoid it, as it seems we now have a good selection of script language bindings we can choose to quickly develop new applications in.

I still haven’t found a way to use braces with if in Ruby, but I think I’ll just bite the bullet and learn to love the end keyword. Oh well, Ruby is so nice in so many other respects, including its liberal adoption of nice Perl language features, that I think I can live with typing end instead of }.

For when you’ve accidentally retagged all your music with the genre of Polka…

I’ve been working a bit today on implementing undo for tagging. I thought it was going to be much harder than it has turned out to be so far. I already have a basic framework up and going that can retag files again, and track what files need to be changed and how, to reverse the operation.

What I have to do is finish up with testing the new code, and converting the various code paths that can change a file to all go through the new class I’ve made. I’m thinking that the JuK internals could use a slight refactor, and I think that wheels has been thinking the same thing based on what he told me of his work on integrating Audio CD ripping into JuK. I’ll have to discuss it with him when he gets back. :-)

Ruby and some hacking

Richard Dale has been nice enough to try and explain the use of braces in Ruby.

I think I see what he means. From what I’ve been reading, you can associate blocks of code with different functions using the brace notation, which is simply a very nifty feature. It is how Ruby handles iterators, for instance, and it is possible to code many constructs using these.

What I have yet to do, however, is find a way to get braces to work with if, while, or other flow-control type statements. For example, the program yes implemented in Ruby:

while true
    print "y\n"
end

I can’t get this program to work using a closing brace for the end, or even adding an opening brace manually and then using a closing brace. I think this is because the while statement seems to imply a begin (as does the def statement, for example). I mean, it’s not like it’d kill me to learn to type end again, it’s just that it means Ruby is fighting for mindshare in my head not with Python and C++, but with bash and high school Pascal. ;-)

Learning Ruby

I was reading a book about Learning Ruby during my copious spare time in class today. So far I like the language (especially the super keyword, which I’ve only ever used in Turbo Pascal 7.0 where it was called inherited). However, there is a big thing that annoys me: The begin and end keywords. Call me stubborn, but I am so used to { and } for forming blocks of code that I don’t even want to go back to anything else. Python neatly sidesteps the problem by not having keywords for this sort of thing. Although I’m not fond of using indentation for creating blocks, that at least works with my programming style.

Other than that, I think the language is very nice so far, although I haven’t had a chance to check out any of the standard libraries.

In a different class today, we had three teams (including mine) presented on simple projects that we were going to develop over the course of the semester. One group is doing a project where they will post audio clips of lectures to an online website for authenticated students to browse later. Ignoring the fact that this shouldn’t take 5 people more than two weeks to implement, one of the slides on their presentation made a big deal about how Internet Explorer would be required. Required for playing a sound clip (I suppose it would be streamed, but that hardly adds difficulty to anything).

During the Q & A section I pointed out that Internet Explorer was rapidly losing market share, not to mention all of the Macintosh computers in the University computer lab that would be poorly supported. Not to mention the fact that the Department of Homeland Security (you know, the gub’mint) has recommened abandoning Internet Explorer.

After all that, their response was, “Well, IE is the majority. It should degrade nicely though.” *sigh* That’s why I hate IS classes. The Computer Science program at the University is actually part of a CIS (Computer & Information Sciences) college. The IS (Information Science) half of the program is for the so-called application programmers, who are essentially the people who go on to get jobs programming simple inventory managers using VB or something equally lame.

I wonder what would happen to a programmer in a company if he told his manager that he had locked out even 10 to 15% of their company’s potential market because he refused to spend the hour required in this case to make sure that the application was cross-browser compatible.

My opinion on Kopete’s Send keyboard shortcut change

I think it was a good change. Having Ctrl-Enter be the keyboard shortcut has bugged the ever-lovin’ bejeesus out of me ever since I first used Kopete. I don’t use Ctrl-Enter to send in any other program I’ve ever used, and besides that, I think it’s pretty clear that users want to send much more often than they want to add a newline to their message. I’ve always thought that things you do often should have easier shortcuts than those actions you perform rarely.

I don’t agree that the widget is just a “wrapped single line edit” however. There are situations where you need to add newlines to a message you’re going to send. For example, a group I’m in for school needed to turn in a paper, so we were discussing parts of it over IM. Newlines were very useful for this.

But I don’t think it’s fair to say that users expect Ctrl-Enter to send just because the widget takes more vertical height than a normal line edit. kedit has a multiline edit, what does Ctrl-Enter do there? I wouldn’t even have a clue, but it makes sense to have Enter == newline for kedit because you need to do this often for text. What you do often in Kopete is chat with people, so it makes sense to have Enter == send in this case. I must say I don’t see anything inconsistent with this change, but ask again when Kopete becomes a text editor. :P

On a totally unrelated note, it looks like my cat may not have to undergo surgery after all, as she’s recently started eating and generally acting normal again. I’m going to have an ultrasound done just to be sure though.

Lexar’s “Secure” Jump Drive Has Been Cracked

And trivially so, to boot. You can see the story on
Slashdot
. To paraphrase, Lexar’s Secure Jump Drive includes an XORed
version of the password within the drive itself. Or, you can simply attach a
debugger to the Lexar-provided management software and sniff the password
in plain text. Of course, once you have the password, decrypting the
contents of the drive isn’t hard.

Now I’ll take this opportunity to share a story of a budding young
programmer, working in his spare time on his dad’s Windows 98 machine, with a
Trial copy of Borland C++ 5.02 that he got from a How To Program book that
he looked at for one day, and which to this day sits in a book completely
ignored.

This young budding programmer was still quite new to the whole idea of
making programs. The fact that he was learning programming using the Win 32 C
API wasn’t helping his skills along either. But he made progress, and made a
not-so-sophisticated fractal drawing program, which even supported plugins for
the hell of it.

This programmer then read a book on cryptography, and thought that it would
be neat to integrate crypto into an application. Thinking briefly, he decided
to make a simple application to keep track of birthdays and anniversaries and
such.

This program ended up working, although it was nothing special. But even
though the programmer was still very inexperienced at the art of programming,
he knew enough from reading the book to know that you couldn’t store any kind
of encoded form of the password in the file you were supposed to protect.
Instead, you had to store a hash, which you would check against the user’s
proposed password later. And so that’s what the application did.

This young programmer was myself, about 5 or 6 years ago. And although I
didn’t take such preventive steps as locking the memory page that was holding
the password (although I did clear it out when I was done with the password
IIRC), I knew enough about the basics to make a program that (I hope) was
relatively secure in its approach. I even think that I found a SHA-1
implementation on the Internet somewhere to use as my hashing function. And I
know I used Rijndael (now AES) for the actual encryption.

There’s no reason for crypto to be hard, as many people much smarter than
we are have thought about, and solved, problems that we still don’t even need
solving. This problem has also been solved, and once again a company has been
hoist on its own petard because their programmers (or managers) thought that
they were smarter than some of the brightest minds in history.

EDIT: I saw this link in the Slashdot comments. You must be this
intelligent to use the Internet
. I must save this link somewhere for
future use. =D