For the past few months, my laptop has been refusing to maintain its wireless network connection, forcing me to reconnect manually several times a day. Yesterday, I got annoyed enough to upgrade to the 4th Alpha release of Kubuntu Intrepid.
Intrepid uses KDE4.1, which is a huge improvement over 4.0. I had tried KDE4 6 months ago, and it definitely wasn't ready for day-to-day use. 4.1, on the other hand, is actually stable enough and configurable enough that I can deal with it on my primary machine. The default eye candy is actually used to improve usability rather than just being shiny (but oh, it is shiny), and I am already getting used to using the new K menu.
Happily, the upgraded kernel resolves my networking problems, and I now have a solid connection (faster, too!). But since it's an alpha release, I get to spend the next 2 months until the actual release dealing with some other bugs.
The only major bug I've encountered is keyboard-related; my arrow keys stopped working entirely in X. At first I tried setting my keyboard layout to be "Acer Laptop", but that failed. Apparently the ubuntu guys are working to abstract keyboard layouts to something called "evdev"; after reading this bug , I changed my keyboard layout to "evdev" and things work again. Yay!
Another issue is that firefox and other gtk apps look terrible by default, with extra lines everywhere. The solution to this is to install the gtk-qt-engine:
apt-get install gtk-qt-engine
Restart firefox and it now looks like it should.
chris just fowarded me this post from google on how they measure readability in C++:
While digging into ways to separate read and write queries in a mysql cluster, I came acoss some interesting notes from MediaWiki on how to deal with replication lag. They have custom monitoring in place to prevent queries from going to excessively lagged slave databases, as well as a mechanism for stopping all writes until the cluster can catch up again. They say this about the most lag-inducing queries:
To avoid excessive lag, queries which write large numbers of rows should be split up, generally to write one row at a time. Multi-row INSERT ... SELECT queries are the worst offenders should be avoided altogether. Instead do the select first and then the insert.
As far as ways to force updates, they are pragmatic:
In most cases you should just read from the slave and let the user deal with the delay.
-- From the MediaWiki Manual
As part of my efforts to contribute to ubuntu, I set up a new GPG key a few weeks ago. I set it up in kmail on my laptop, which works well, but now I need to read the same messages from mut on my server. It's not quite so simple when working without the ubuntu safety net, but it's still not all that bad.
Firstly, I copied my secret key (already generated) to the server...
on the laptop:
gpg --export-secret-key -a > secret.key
scp secret.key myserver.example.com
rm secret.key
on the server:
gpg --import secret.key
rm secret.key
The next step was to uncomment the various pgp_* lines in my .muttrc and update them to use my key id instead of the example key id.
Mutt/PGP notes
At this point I was getting an error about pgpewrap not being found, so I had to change 2 lines to use a full path:
set pgp_encrypt_only_command="/usr/lib/mutt/pgpewrap gpg --batch --quiet \
--no-verbose --output - --encrypt
--textmode --armor --always-trust \
--encrypt-to 0x6BD97E6E -- -r %r -- %f"
set pgp_encrypt_sign_command="/usr/lib/mutt/pgpewrap gpg --passphrase-fd 0 --batch --quiet \
--no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust \
--encrypt-to 0xDEADBEEF -- -r %r -- %f"
That's enough to be able to encrypt, read, and sign messages. I'm currently getting a "PGP Signature could NOT be verified" message when viewing my own messages, which I believe is because the ubuntu key I generated was self-signed. I would likely need to go to a keysigning party and get into a few webs of trust to get rid of that particular message.
Sometimes you need to add a row number to the results of a query. Oracle provides a useful ROWNUM function to do that easily, but in mysql, you have to use user variables:
SET @count=0;
SELECT name,@count:=@count+1 FROM foo;
That's alright, but then what do you do if you want to insert those numbers into a table? No problem, you can do that with a subselect:
SET @count=0;
UPDATE mytable SET ord = (SELECT @count:=@count + 1);
You can use conditions on the update as well, which is very handy if you're trying to stick together the data from 2 tables based on the row order.
I just upgraded to firefox 3 (at work and at home), and am happy in general with the additional speed and the other useful features.
I'm not 100% sold on the "awesomebar"; it seems to be including more useless information rather than making it easier to find thing. The theme I have on my home linux system also seems messed up, but I'm sure I can replace that one easily enough.
A few of my add-ons had to be replaced with equivalents for ff3, however, including:
- Adblock -> Adblock Plus
- All-in-one Gestures -> FireGestures
A few other extensions haven't yet been updated, including
- edit cookies
- firebug (though I see a link for a new version)
- Google Browser Sync

I'm sure they'll get there soon enough, hopefully by Download Day !
update: As it turns out, the Awesomebar is using some machine learning to associate what you actually typed with the item you ended up clicking on, which will end up bringing the item you wanted to the top of the list after 4 or 5 tries. I can see why they call it awesome , now that I understand what it does. But will most people bother to find out?
Just came across an awesome (sarcasm to full power!) bug in ie7 where a single <hr> tag can pin the viewer's CPU at 100% and mess up the vertical scroll bar. Apparently IE7 treats horizontal rules as inline elements instead of block elements, and there's very few attributes that you can actually set on them.
Here's a nice test page showing off the problem.
The best fix so far is to add a <br;> tag after the hr to force things to render half-decently.
I keep running into limitations in T-SQL as used in MS SQL Server. Apparently part of MySQL's popularity is that the have added useful extensions to the language that actually solve common problems.
One lovely example is zero-padding a string. In MySQL, you would use the LPAD function:
select lpad(5, 3, 0);
In T-SQL, you have to jump through one of several hoops. The way I ended up writing it for this application:
SELECT RIGHT('000000' + CAST(5 AS varchar), 3)
There are probably other workarounds, you could probably do something with the stuff() function. All of them are workarounds however, and none of them are immediately readable. Bah!
To get proper debugging working in KDevelop with gdb as a backend, you have to recompile your project with gdb information (duh, I know). The trick is figuring out where/how to do this, especially in an automake-based project.
Go to:
Project -> Project Options -> Configure Options
- Set "C/C++ Preprocessor flags" to be "-g"
- Set "Linker flags" to be "-g"
You then have to re-run automake and friends, then re-run configure, then re-make everything. Very much a pain to recompile all of kdegames yet again, but at least now both kdevelop and gdb let me use breakpoints!
Of course, remember to remove the -g option before building the final version.
I've decided to get back into C++ and desktop apps, with the goal of making a KDE game of some sort. While I have lots of experience with C++, GUIs, and general programming, it's been a while since I tried to put them all together.
Getting started, there are a huge number of packages that seemingly need to be installed. KDevelop will be my IDE of choice, and it appears that kdbg is a useful GUI wrapper around the venerable gdb. qt3-designer is also necessary (or in the least very useful), though the executable appears to be called just "designer" (boo). KDE apps also require automake and autoconf, ensure they are both installed. For man pages for common C/C++ functions, try manpages-dev.
Terminology: Widgets are graphical elements, layouts are a weird sort of view/template with obscure rules regarding where things go. Signals are otherwise knows as events, and slots are event handlers.
Kdevelop3 is far faster than I remember it being, probably due to having a hugely more powerful laptop. Their UI seems to have things quite happily tucked away by default, will have to customise it somewhat by my next project.
Creating the project via Project -> New -> C++ -> KDE -> Simple KDE Application. Ah, and selecting ~/local/src as the location for the project prompts me to save that as the default. Excellent. Too bad kdevelop crashes every once in a while, but again, that's not as frequent as I remember it being.
Bah, it doesn't have bzr support by default. Maybe a bazaar plugin can be another project on my todo list. Well, I can use bzr to source control the project from outside of kdevelop, for now. Sigh.
I appear to have to run automake and friends twice, possibly because I didn't start with autoconf installed. Despite some rather nasty looking warnings in the log window, it does appear to have built and executed my hello world program. Hooray. Oh goodie, and apparently I have to run "automake & friends" every time I add/remove files. Mental note: add files in batch. Adding a .ui file, qt-designer is crammed into my workspace and it cluttered and confusing. How do C++ people put up with this crap? They also seem to have something against useful ids for widgets; is commBox really that much better than commentBox? Maybe there's a retarded length limit somewhere that I don't know about.
Oh, and I'm going to have to get it to use vim as the editor, or at least vi keybindings.
As far as layouts, I just wasted far too much time manaully making the form "look nice", when as it turns out I have to go in and add "layout" to each set of items. "Layout" appears to just be grouping elements into further invisible groups (think floating divs) with a very rigid rule about how to lay out the elements within that group. I bet there are the equivalents of nested-tables kicking around in various desktop apps.
The QT-Designer UI for signals/slots is very confusing or doesn't work as I would expect (or maybe automake is just screwing with me?). Their drag/drop theory doesn't seem to take, I have had more luck with right clicking on the button and choosing "connections" and setting things up that way.
Oh, as it turns out, automake wasn't building my .ui file into a .cpp/whatever files, so things weren't being correctly inherited. I had to make my target "active" in the automake manager, then build the specific target. This seems necessary to get the signals/slots to actually fire, though I'm not clear yet on why. Building from the command line may or may not suffer this same problem.
And finally, setting an entire form/widget to resize when the window is resized makes no sense at all. Adding layouts and spacers to elements requires you to multi-select the elements involved; all good and logical. The problem comes when you want to add a layout to the entire form -- it would make sense to me to select all of my layouts and add them to a layout. Instead, you have to select no elements or layouts and then click on a layout type. Confusing, but doable.
And finally, to use gdb or another debugger, you need to set the path to the executable via Project -> Project Options -> Debugger -> Debugger Executable. Set it ti /usr/bin/gdb, for example.
References:
* KDevelop3 Tutorial
* QT Signals and Slots
* Resizing entire QT layout
