Blog

Comparison between Java and C#

28.03.2007 at 11:16

As i am still trying to get familiar with C# i found the following comparison between Java and C# quite usefull.

» read more » comments

MSDN - sucks use the API Documentation in CHM Format

27.03.2007 at 17:19

In my day job i am currently developing a C#/.NET Compact Framework application and one of my first experience is that the MSDN documentation -- well pretty sucks -- it's just way too slow. Fortunately the API Documentation is also available in CHM format.

Marc

» read more » comments

Isolate a buggy commit with git bisec

25.03.2007 at 13:34

A few weeks a go i made a blog post about my success in running Age of Empires II with Wine. Unfortunately the upgrade from wine-0.9.31 to 0.9.32 broke it again. The game doesn't even start anymore and just displays the following message:

Could not initialize graphics system. Make sure your video card and driver are compatible with directdraw.

See the AppDB Comments for further discussions.

So i decided to try to isolate the commit which is responsible for the breakage. The first step was to get all the required build dependencies installed. Next i did a checkout of the wine source and started regression testing as explained on the wine-wiki. By telling git bisect the last good state and a known broken one it can perform a binary search for the buggy commit.

git bisect start
git bisect good wine-0.9.31
git bisect bad wine-0.9.32

Then you can compile Wine and test whether the bug is still there.

CFLAGS=-fno-stack-protector ./configure && make clean && make depend && make

Depending on the result you run git bisect good or git bisect bad respectively. If you want to see which commits could cause the error run git bisect visualize. Recompile and repeat the above steps until you can isolate the problematic commit. In my case it was the following:

27113156d96d20296409fcb92839609c8dd7e34a is first bad commit
commit 27113156d96d20296409fcb92839609c8dd7e34a
Author: Stefan Dösinger <stefan@codeweavers.com>
Date:   Mon Feb 19 15:24:00 2007 +0100

    wined3d: Remove IWineD3DDevice::EnumDisplayModes.

So know that i have isolated the commit, filled a bug report.

Marc

» read more » comments

SQL fun: order before group with a subquery

19.02.2007 at 17:49

I have came across a problem within a sql statement. Say we have 2 tables which are in a 1:n relationship. So we want to join them together normally the sql engine will just use the first match based on the auto increment key within the table. This isn't what i needed so i searched a way to actually sort the data before the grouping happened. The solution seems to be a subquery which isn't ideal performance wise but worked for my use case. So i ended up with something like this:

SELECT * FROM (
    SELECT lastname, firstname, address_addition FROM address
    LEFT JOIN othertable ON address.somefield = othertable.somefield
    ORDER BY whatever
) as addresses GROUP BY addresses.address_id

Which brought me to the next problem, the sql standard doesn't allow duplicate column names within a subquery and mysql does actually implement this part of the standard -- surprise ;)

So i had to "retag" a few fields in the selected clause with AS. Lesson learned: always use a short table prefix.

Marc

» read more » comments

UUIDs for partitions in Ubuntu Edgy Eft 6.10

14.02.2007 at 17:04

I recently updated a Ubuntu Dapper Drake (6.06) system to Edgy Eft (6.10). Other than i had to reinstall/reconfigure my xserver everything went ok. However by the next reboot i noticed a strange root=[long alphanumeric value] kernel parameter in my grub prompt. After some investigation i found out that my /etc/fstab contained the same strange ids.

# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# /dev/hdc5 -- converted during upgrade to edgy
UUID=048b4608-5241-4dc4-8671-f8290cb55af5 / ext3 defaults,errors=remount-ro 0 1
# /dev/hdc1 -- converted during upgrade to edgy
UUID=05c63290-f5b8-4afb-97c1-fb7e15ad6ed8 /boot ext2 defaults 0 2
# /dev/hdc10 -- converted during upgrade to edgy
UUID=06ee7e3e-768b-4a51-a31f-0e70ec314e81 /data ext3 defaults 0 2
# /dev/hdc7 -- converted during upgrade to edgy
UUID=56ef33df-9f30-4577-b1de-83b540fd3519 /home ext3 defaults 0 2
# /dev/hdc11 -- converted during upgrade to edgy
UUID=9628b57a-cd57-4ffb-a0e7-6d2bc349e46b /media/hdc11 ext3 defaults 0 2
# /dev/hdc12 -- converted during upgrade to edgy
UUID=caa74b76-416b-46aa-8c0a-f6348f6afbcd /media/hdc12 ext3 defaults 0 2
# /dev/hdc13 -- converted during upgrade to edgy
UUID=fe873ec7-3176-4aad-b0b1-9164f938f213 /media/hdc13 ext3 defaults 0 2
# /dev/hdd1 -- converted during upgrade to edgy
UUID=9E745EF6745ED11F /media/hdd1 ntfs defaults,nls=utf8,umask=007,gid=46 0 1
# /dev/hdd5 -- converted during upgrade to edgy
UUID=78DB-0025 /media/hdd5 vfat defaults,utf8,umask=007,gid=46 0 1
# /dev/hdc9 -- converted during upgrade to edgy
UUID=b43c2193-3c00-48d0-8c29-c2fa7212c457 /usr ext3 defaults 0 2
# /dev/hdc8 -- converted during upgrade to edgy
UUID=7cec1fb3-c2f2-46dc-9782-7228d57b9f2b /var ext3 defaults 0 2
# /dev/hdc6 -- converted during upgrade to edgy
UUID=6996378e-a37b-49b8-8e91-65164bef7626 none swap sw 0 0
/dev/hda        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0

My first thought: what a mess! Luckily they left some commends in there.

So what is the purpose of those numbers which are not so human friendly? They should uniquely identify a given partition. Which means you could swap your disks/memorykeys/whatever and the system will still mount the correct partition on the right place. Another thing this mechanism tries to work around is, that the device names depend on module load order. With the development in recent kernels which try to scan the hardware and detect devices in parallel, to speed up boot time, it will be entirely random which devices turns up as /dev/sda.

Listing UUIDs

You may ask how can i check the mappings between UUIDs and devices? Good question -- there are a few different ways, /sbin/blkid will happily print a list of device names, filesystem labels and UUIDs for you even if you aren't root. While sudo vol_id -u <partion> will give you only the exact UUID for the requested partiton.

After i have informed myself about those UUIDs i am no longer that scared but i still think this is a suboptimal solution they are just way too human unfriendly. A solution based on diks LABELS is probably the better approach.

Marc

» read more » comments

<< 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 >>