Blog of Alexander Mamchenkov … mammoth cave …


Gnome3 Fallback Mode

06.15.2011 · Posted in General, Personal, Technology

After working for a while on Xfce, I found out about Gnome 3 fallback mode. That is almost exactly what I needed – old style Gnome. Obviously not completely like Gnome 2.x, but very very close to it.

Will work in Gnome 3 under this mode for a while to see. At least I have all my menus, applets, proper system tray and whatever else I am so used to in their correct places :)

SQL GROUP BY with max in subgroups

06.07.2011 · Posted in General, Personal, Technology

It’s been few times I needed to select a set of records from SQL table grouped by one column, but sorted by another within a group. For example selecting a list of log entries with the last entry per user or something like that. It is pretty simple when one needs a maximum value of a particular column per key, but what if I need all cells of a record with the biggest/smallest/whatever value of one column, and all those grouped per another column.

Finally the solution was found here and the point there is to do sorting in subquery for group select. In simple it would look like (taking example above):

SELECT * FROM (SELECT * FROM logs WHERE level=’critical’ ORDER BY created DESC) tmp_table GROUP BY user_id;

This will give me the last entry from the log with level=’critical’ per user. It is also possible to all kinds of joins and whatever in subquery. The things is that first we gather all data needed and sorted properly, and then the outed select groups it accordingly.

One additional note which has nothing to do with a query itself, but I found it out during my works related to this task. While running the above-type query on a pretty large table, I got an error from MySQL

ERROR 126 (HY000): Incorrect key file for table ‘/tmp/#sql_NNNN_x.MYI’; try to repair it

By looking around I realized that the hosting company which provided the server set up the /tmp directory of a system as a separate partition of a pretty small size and while MySQL was trying to do the requested task, it was running a bit out of space, causing a corruption of a temporary table. Specifying tmp=/var/tmp (or any other directory with some more space) in /etc/my.cnf (depending on your setup though), setting up correct permissions and restarting MySQL fixed the problem.

Visual Basic and Visual Studio

05.31.2011 · Posted in General, Technology

It’s been quite a while since last time I touched Visual Basic along with it’s default IDE – Visual Studio. Yesterday I had a quick chance to see it again, since I needed to help on the project which is under development in this environment.

What I can say – things are still as ugly as they used to be (IMHO). So few notes about things that pissed me off:

Auto indent in visual studio is more harmful rather than helpful. Auto completion is very annoying (it tries to complete everything I type instantly and with things different from what I want). All the time I was fighting with these two. I guess there are options to disable/enable features like that or configure different behavior, but in default configuration it sucks. Syntax highlighting is very poor (only highlights few reserved words with one different color).

Now with regards to Visual Basic: it is very interesting to see a language with uses “_” (underscore) to indicate that the line will continue after newline (VB does not use semicolons to indicate the end of statement, instead all statements are one per line), and uses ” ‘ ” (single parenthesis) to start comments. I know languages which are dependent on new lines, but more classical sign to show a continuation of line would be “\” (backslash), while for comment, either “#” (hash) or // (double slash) or /* */ (combination of slashes with starts for long comments) is used.

I had some other thoughts on function names and other, but I will leave this one out :)
Don’t trying to blame anything here, just my view of things as I touched them by accident after using Vim for coding PHP/Perl/C for a while.

HP Laptop BIOS upgrade from Linux

05.30.2011 · Posted in Personal, Technology

While in search of a solution for my laptop suspend problem I found out that the BIOS, which was initially supplied is very buggy and there is an update. My version was F11, while the latest one is F16. The only problem is the way HP supplies updates for this thingy: only for windows in form of executables.

Thanks to this article, I managed to create work around and flashed my BIOS for HP 6730b. If you run same laptop with version of BIOS earlier than F16, I strongly suggest updating.

The update didn’t fix my problem with suspend, but it did fix few glitches with video stuff.

Fedora 15, hibernate, NetworkManger update

05.28.2011 · Posted in Personal, Technology

Ok, it’s been few days now as I am using Fedora 15. More comments…

Hibernate

As I mentioned in my previous post, hibernate was not working on my laptop. Apparently, the problem is that I am using swapfile instead of a swap partition. Since kernel saves the state of the system into swap while going to hibernate, it needs to know from where to get the state on power on. To do so we need to know 2 things: the UUID of the partition, on which swap is sitting (in my case it is a / partition) and an offset of the swapfile. The first one can be found out from /etc/fstab or from /etc/grub.conf (the root=UUID=XXXXX) or by any other means that I won’t cover here. The second one is can be found by running filefrag -v <path to swapfile> and taking the values of the physical column of the first data row of output (In my case 129024).

Now, when we know on which partition and at which particular offset our swap is, modify the /etc/grub.conf file for kernel boot flags and add restore=UUID=<UUID if the partition found above) restore_offset=<swap file offset found above> and reboot the system. After that hibernate works as it should.

Note that this does not fix my problem with suspend yet. That I will try to fix later as I am going through different solutions now.

P.S.: Initially found the hint on hibernation fix from syslog line “PM: Swap headers not found” and then googling around to this Ubuntu forum post, which I just adjusted to my self (thanks guys).

NetworkManager (0.8.999-3)

Today I received an update of NetworkManager which failed to startup after boot. Running NetworkManager –no-daemon was giving errors while trying to parse /etc/sysconfig/network-scripts/ifcfg-<whatever> files. Deleting those files fixed the problem (but I lost the configurations of wifi spots I had before, which is though not a huge problem for me anyway).

KDE4

For a couple of days I decided to use KDE4, since it’s been a while I touched it and I thought it is unfair not to try it again. I managed to configure everything more or less in a way I wanted. The only thing which forced me to go back to Xfce4 today was that because of NetworkManager failure, the network manager plugin of KDE was not starting as well and the whole desktop was not loading, which looked very strange to me. I don’t wanna desktop environment which fails to start only because of the network failure (which kinda unrelated from DE anyway).

Will see how I go about it later as well.