Archive for July, 2004

A Big “Screw You” to the Enlightenment Crew

July 29, 2004 in Rants | Comments (0)

Was having too much trouble with KDE getting botched up on one of my Debian machines, so I finally switched back to Enlightenment for my window manager. My menus were coming up empty, so I went to run the e16menuedit command. Here’s the message I got:

hmm. looks like you have some "issues" as you don't have a /home/user/.enlightenment/file.menu file. Sucks to be you

Thanks a lot, you bunch of dicks. I love Linux, but this is the sort of crap that will keep it playing second-fiddle to Windows until kingdom come.

Found this in an informative forum post somewhere on the web:

The easiest way to create these files is to delete the .initialized file from the /.enlightenment directory and go to "regenerate menus" with middle-click!

Funniest thing is that this is a Mac OS forum, not a Linux forum. How hard would it be for Enlightenment to display something helpful like this in their error message instead of “sucks to be you?”

I guess I’ll start looking at other window managers. I like Enlightenment, but if this is the way they treat their users, then I don’t really care to be one of them.


A VIM Script to Insert the Current Line Number

July 28, 2004 in General | Comments (0)

Sometimes scripting stuff really aggravates me. You can do so much with a scriptable tool, but sometimes the effort required to figure out how to simplify some mundane task is almost too great for the benefit derived. Coercing VIM into inserting the current line number into a file turned out to be that kind of headache. In fact, I’m publishing it here slightly unfinished because I just can’t take the time to dig for the rest, and it works “good enough” for right now.

All I wanted to be able to do was insert the current line number into the text of my script as I typed. This is because I am using Flash ActionScript, and Flash is so incredibly braindead and hard to debug that I have to resort to print statements to find out what’s going on in my program (see my previous rants about Flash and their form components before you post any instructions on using their useless debugger). It’s easier to figure out exactly where a message came from if you stick a number in there, so I figured a line number would get me pretty close to something unique. I realize that they become inaccurate over time, but for this rough sort of debugging beggars can’t be choosers.

To cut to the chase, here is the script:

imap ;; ^[:call InsertLineNumber()<CR>
function! InsertLineNumber()
let linenumber = line(".")
execute "normal a \<BS>".linenumber
endfunction

The first line maps a function named InsertLineNumber to the key combination ;;. The following lines declare that function. Drop this into your .vimrc file, then when you type ;;, VIM will insert the current line number into your buffer.

The only problem is that it doesn’t put you back into insert mode after it puts the number in, so you need to type a to keep going, but that’s not too big a hassle. One of these days I’ll figure out how to add that to the end.

I just posted it here because I couldn’t find crap about how to do this by searching on the web, at least nothing that was particularly straightforward.

Part of the problem is the unfortunate execute command. This is a very cumbersome way to insert text into the buffer. While they have functions for replacing lines and such, you would think that a nice printf derivative wouldn’t have been too hard, something to just insert text at the current cursor position, but there’s no such animal. Again, though, this is close enough, and it meets my needs for the moment. If you know a better way to write it, I’m all ears.

Note that the construct ^[ is created by typing ctr-V, then Esc in VIM. You can also use \<ESC> if you prefer (like the backspace key in the example).


Tripping on SQL Grant Syntax Differences

July 16, 2004 in Transact-SQL | Comments (0)

This is the sort of thing that happens when you use different dialects of SQL. I’m blogging it here in hopes that it will cement it in my mind so that next time I can avoid tripping over it.

With Microsoft SQL Server, granting privileges to all of the objects in a database is pretty straightforward:

grant all on databasename to username

This should grant all rights to all objects in the database for this particular user, assuming that you have the rights to grant these privileges from your currently logged in account.

I spend a lot of time in Microsoft SQL Server these days, so sometimes when I go back and use MySQL I fall a little short on the jump. If you need to grant rights on all objects in a database, it’s similar, but just different enough to really hurt. Here’s the MySQL version:

grant all on mydatabase.* to username;
flush privileges;

Here are the distinctions:

  • If you leave the * off of the database name, MySQL will not grant permissions to the individual tables. I’m not sure what it does grant privileges to, besides access to the database itself, but it doesn’t tell you that you should have been more specific. This is how you can get stuck, thinking you granted the privileges when really nothing at all has happened.
  • You have to issue the flush privileges command or the new rights won’t be published. I usually remember to do this one, but if you’re trying various sets of rights, you might forget once in a while.

If you want to grant permissions to specific tables or columns, I’d recommend reading the docs. I’m not going to write about that here.


ISO Recorder

July 15, 2004 in General | Comments (0)

This is one of my favorite little Windows utilities. Install it and then right click over an .ISO file (that’s a CD disk image) that you would like to burn to CD. Your context menu will now have the option Copy Image to CD. Just click that, double check the settings in the dialog box, and go.

For some reason, at least on my laptop, whenever I need to use this program it has disappeared from my context menu, even though it is still installed, so I usually have to rerun the installer. For this reason, I would suggest keeping a copy of the installer around. Since it’s probably not a tool that you will use every day it can be a time saver, keeping you from having to dig it up online again if your menu loses its mind like mine does.

Please note that the author, Alex Feinman, has noticed a problem with it working on Windows XP SP2, so proceed with caution if you are running that operating system.

You might also want to check out his other great CD recording utility, CreateCD.


KDE Hell

in General | Comments (0)

I’ve really learned to like KDE ever since I went to a Knoppix-based install for my Debian machines (used to run Enlightenment), but it seems like every week or two it breaks in some new and unpleasant way.

With KDE 3.2 I began having trouble getting it started after an apt-get dist-upgrade (I know, running unstable I’m just asking for trouble). Ran from another machine so I could see messages and here’s what I got:

kdecore (KIconLoader): WARNING: Icon directory /usr/share/icons/hicolor/ group 16x16/stock/chart not valid.

Actually, got a whole lot of those for several different directories.

Searching around on the web uncovered this fix:

do this as root:
cd /usr/share/icons/hicolor/
cp index.theme index.desktop

In my case, I had to do the same thing in /usr/share/icons/gnome and in /usr/share/icons/Default.