Shortest iron manual

This is the shortest ironing HOWTO I've ever heard - a friend of mine told me this when I mentioned that I hadn't used my new iron yet, since I had wanted to read the manual first (it's not that I don't know how to use an iron; I just usually read manuals):
An iron had two ends - one of them is a plug and the other is hot.


Normalizing tracks when burning Audio CD's with K3b

K3b currently does not support normalizing when writing on the fly, so, if you installed normalize-audio application, and 'Normalize volume levels' option is still inactive, make sure that 'On the fly' option is unchecked.


How to install lame on Ubuntu 5.10 (Breezy Badger)

If you want to install lame encoder using Synaptic or apt-get, you should add the following two lines to /etc/apt/sources.list file:

deb http://archive.ubuntu.com/ubuntu hoary multiverse
deb-src http://archive.ubuntu.com/ubuntu hoary multiverse


Ubuntu unstable due to BIOS settings

Just a quick & dirty note this time.

These settings caused my machine to be unstable.
FSB:  166 MHz
freq: 199 MHz (DDR 398)
CAS:  3-3-3-8
Various applications (for example, Firefox, Synaptic, GNU Gadu) and both GNOME and KDE environments crashed because of segmentation faults or unknown reasons. Memtest86 detected RAM errors during moving inversions test.

With these settings everything seems to be working fine:
FSB:  166 MHz
freq: 166 MHz (DDR 332)
CAS:  2.5-3-3-7


A friend of mine has sent an e-mail to tell me that this post might be a little confusing. So to make things clear:
  • The problem described above was caused only by wrong BIOS settings and it was by no means Ubuntu's fault.
  • The above RAM timings are useful only for me; this blog is, among other things, also my notepad, so I will sometimes jot down things like this.

Ubuntu & fonts (yet again)

I've just found a nice way of installing Microsoft's TrueType core fonts on Ubuntu without using msttcorefonts package.

You can read about it in post #9 of this thread.


A basic museekd init.d script for Ubuntu

You should change the values of MUSEEKD_USER and MUSEEKD_CONFIG variables so they fit your system.
#! /bin/sh

# Written by chopeen
# Based on SeeSchloss' museek & mulog init.d scripts for Gentoo 
# <http://seeschloss.org/museek/>


case "$1" in
echo "Starting museekd as user $MUSEEKD_USER"
start-stop-daemon --start --quiet --exec $MUSEEKD_PATH/museekd \
  --chuid $MUSEEKD_USER --background --pidfile /var/run/museekd.pid \
  --make-pidfile -- -c $MUSEEKD_CONFIG
echo "Stopping museekd"
start-stop-daemon --stop --quiet --pidfile /var/run/museekd.pid

exit 0


Beware of Replace functions!

If you are using VB.NET and want to replace all occurrences of one string in a variable with another string, you can use either Replace function from Microsoft.VisualBasic namespace (which is, unfortunately, imported by default in every new VB project and you cannot even see this in the code!) or Replace function from String class (and this is a preferred method).

I was absolutely sure that the following snippets of code would give the same results:
Dim s1 As String = ""
s1 = Replace(s1, "foo", "fee")

Dim s2 As String = ""
s2 = s2.Replace("foo", "fee")
Well, they don't. While the variable s2 remains to be an empty string, s1 is set to Nothing. That's something worth remembering.

Problems with X server

After an upgrade Ubuntu 5.04 to 5.10 my machine became unstable - GNOME started to crash at random, for no apparent reason.

I looked around for a while and the I found messages like the one below written to syslog by the gdm process:

gdm_slave_xioerror_handler: Fatal X error - Restarting :0

I tried using KDE instead of GNOME, but that didn't help.

I installed kdm and set it as a default display manager. That didn't help either, but the messages changed to:

X server for display :0 terminated unexpectedly

I did some reading and came to a conclusion that a display manager is not really necessary, so I uninstalled both gde and kde. It feels like an ugly hack to me and I don't a have a graphical login screen, but the system seems to be stable.


Special Polish characters in KDE applications

If special Polish characters are not displayed correctly in KDE applications, configure them to use Verdana instead of Helvetica.

You can also change the fonts used by the system using Kcontrol, if you are using KDE.

I am not sure, if system language settings affect this. I am almost 100% sure that there is a better way to solve this problem, but this one's quick & simple.

I've found it here.


Visual Studio add-ins and .NET tools

Just a few links today:


Installing VMware Workstation on Ubuntu

When installing VMware on Ubuntu (and other Linux distros too, I think) from a compressed tar archive (for example, VMware-workstation-5.5.0-18463.tar.gz), make sure to change the directory to the root of an unpacked tarball, so you can start the installation by typing ./vmware-install.pl. Otherwise, the setup process will fail.

I had a problem installing VMware 5.5.0 and I found the solution here.


Transaction isolation levels in Oracle Database

There's an interesting article about transaction isolation levels in the last issue (November/December 2005) of Oracle Magazine - On Transaction Isolation Levels by Tom Kyte.

Being a SQL Server guy who has to use NOLOCK all the time, I was surprised to learn that there is no READ UNCOMITTED isolation level in Oracle Database. And here's the explanation how it is solved:
When the query I'm executing gets to the block containing the locked row (row 342,023) at the bottom of the table, it will notice that the data in it has changed since execution began. To provide a consistent, or correct, answer, Oracle Database will create a copy of the block containing this row as it existed when the query began. That is, it will read a value of $100, which is the value that existed when the query began. Effectively, Oracle Database takes a detour around the modified data—it reads around it, reconstructing it from the undo (also known as a rollback) segment. A consistent and correct answer comes back without waiting for the transaction to commit.


Upgrading Ubuntu 5.04 to 5.10 (in, increasingly inaccurately named, 3 easy steps)

All you have to do to upgrade Ubuntu 5.04 (Hoary Hedgehog) to 5.10 (Breezy Badger) is:
  1. Start Synaptic Package Manager.
  2. Go to Settings / Repositories.
  3. Change Distribution from hoary to breezy for every Ubuntu repository (example).
  4. Close the Repositories window; the package information will be automatically reloaded.
  5. Press Mark All Upgrades button and choose Smart Update.
That's all - Synaptic Package Manager will download all the needed packages and install them.


VS 2005 Beta 2 - cannot create a new project or open an existing one

I have been using Visual Studio 2005 Beta 2005 for a few weeks and one day, completely out of the blue it failed to open my project. I tried to open another one - the same result. I also couldn't create a new project.

Unfortunately, I didn't jot down the error message, but I remember it mentioned Microsoft.Common.targets file.

I checked this file on my machine and it turned out that it was empty. I did some googling to make sure that it is not normal and then reinstalled .NET Framework 2.0 (use repair option) - it helped!


Ubuntu - smooth fonts (continued)

I wrote this yesterday.

And today I've removed Arial font from my system (you can type fonts:/// in Nautilus and delete appropriate files) and, in my opinion, Google and Gmail look now even better than yesterday, because Firefox uses sans-serif instead of Arial.


Ubuntu - smooth fonts

My OS is Ubuntu and the browser of my choice is Firefox. Some WWW developers seem to be unaware of the fact that not everyone in the world runs Windows and specify only fonts like Verdana, Tahoma, Helvetica or Arial in the CSS files. On my machine such webpages (example) were rendered with a font that looks like Times New Roman and looked really awful.

To solve this problem I installed msttcorefonts package. This solved one problem... And created another one. Google and Gmail started to look worse than they did before.

After some searching I found this thread and enabled autohinting in /etc/fonts/local.conf file. Both Google and Gmail started to look good again. And what's more all fonts on the system seem smoother and clearer.

Autohinting disabled
Autohinting enabled


I made amaroK show ID3v2 tags! Finally

I have been using amaroK during the last few months and I think it is an excellent MP3 player (on the other hand, I like foobar2000, too). However, throughout all this time I have struggled with one problem - amaroK kept trimming long song titles, band names, etc (for example, instead of Anyone Can Play Radiohead: A Tribute To Radiohead it showed only Anyone Can Play Radiohead: A T).

Today I have found this and the problem is gone. I've pasted an appropriate piece of amaroK's FAQ below:

amaroK is not using the tags I know are in my files!

If Konqueror or other apps are displaying different Title, Artist, Album or Genre information than amaroK is picking up when it creates your collection, it may be reading the older ID3v1 format tags rather than the newer ID3v2 tags. This can be due to your Encodings setting:
  • Go to Settings, Configure amaroK, and then find the Encodings section of the Settings panel. Unclick all checkboxes to "Do not decode the following as latin1".
  • Rescan your collection to pick up the ID3v2 tags.


Reflections on installing MSDE

So you've been working with SQL Server for almost two years now?
And you've installed SQL Server a few dozens of times?
And you've passed 70-728 with more than 900 points?

Believe or not, but you still may encounter some problems while installing MSDE. Firstly, there is no wizard; you need to execute setup.exe with appropriate parameters from command-line. And secondly, if you install MSDE using only SAPWD and INSTANCENAME parameters, it will later run in Windows Authentication mode, despite the fact that you have to provide an sa password.

If I had found this article yesterday, it would have saved me a lot of headaches. I didn't, so I had to work it out all by myself. I learned a lot.


Is this job still executing?

It is easy to use Enterprise Manager to check whether a job is still executing or not.

But I needed to get this information programmatically.

This is a small stored procedure that tells whether a job is running or not.
  @job_name varchar(255),
  @is_job_running int OUTPUT
    DECLARE @job_id uniqueidentifier 
    CREATE TABLE #xp_results 
      job_id uniqueidentifier NOT NULL,
      last_run_date int NOT NULL,
      last_run_time int NOT NULL,
      next_run_date int NOT NULL,
      next_run_time int NOT NULL,
      next_run_schedule_id int NOT NULL,
      requested_to_run int NOT NULL, -- BOOL
      request_source int NOT NULL,
      request_source_id sysname COLLATE database_default NULL,
      running int NOT NULL, -- BOOL
      current_step int NOT NULL,
      current_retry_attempt int NOT NULL,
      job_state int NOT NULL
    SELECT @job_id = sj.job_id 
    FROM msdb.dbo.sysjobs sj
    WHERE sj.name = @job_name
    INSERT INTO #xp_results
    EXEC master.dbo.xp_sqlagent_enum_jobs 1, ''

    SELECT @is_job_running = running
    FROM #xp_results
    WHERE job_id = @job_id
After a few days of struggling I think this is the best way to do it.


How to insert multiline text when Form.AcceptButton is set?

I've just re-discovered it - I don't like re-discovering things. I have spent an hour trying to solve this problem and once I've figured out how to do it, I've realized that I had had exactly the same problem about a month ago and I had already worked it out back then.

Anyway, let's describe the problem first:
1. There is a form - myForm.
2. There is a TextBox (or RichTextBox) control on myForm - myText. There is also a Button - myButton - on the same form.
3. The AcceptButton property of myForm is set to myButton.
4. The myText.Multiline is set to true. However, pressing Enter key does not insert a newline, but activates myButton instead.

The solution is simple:
1. In myText.GotFocus (or myText.Enter) event set myForm.AcceptButton to Nothing (VB) or null (C#).
2. In myText.LostFocus (or myText.Leave) event set myForm.AcceptButton back to myButton.


Why can't I decrypt a string I've just encrypted?

If you are using one of .NET CryptoService providers (like DESCryptoServiceProvider or RijndaelManaged), there's a trap that you can easily fall in (I did).

To encrypt data (a string converted previously into a byte array), you create a CryptoStream that reads bytes from this array, transforms them, and then writes encrypted data to a stream.

Then you can use ToArray() method of the stream to obtain encrypted bytes.

And what do you do next?

You run something like:

And you have a problem. The encrypted string is encoded in Unicode. That's fine as long as you want to write it into a file or store in a database, but sometimes you want to be able to enter it using the keyboard.

To solve this problem use:

This way the encrypted string will be encoded with ASCII characters only.

If you want to know more, read this article.


DTS packages & jobs

I created a simple DTS package, I executed and it worked just fine.

Then I scheduled it and tried to execute the job. The job failed. It consisted only of one step which executed the package, so I was pretty speechless.

I opened job's history. It looked pretty awful (many lines of text without newline characters), but I managed to find a few occurrences of 'Access denied' phrase.

Then I remembered that there was something like 'Script file directory' textbox in 'Copy SQL Server Objects Task' window. I also realized that the domain account that I use to run SQL Server Agent service has very limited permissions.

I changed the path in 'Script file directory' textbox to one that SQL Server Agent could access and this time the job executed.