Wednesday, July 16, 2008

Setting Type of Paper in Docbook

Some months ago I was setting up Fop on my computer and found that Docbook XSL converts files from Docbook to Fop format with setting paper to USLetter while I need A4 paper. I didn't knew how to set type of paper for XSL, spent much time exploring Docbook XSL and as a result changed something in them and get paper format A4. I don't remember what I have done but it worked. However I needed to format disk of that computer so lost this settings.

After some digging I found that setting type of paper is very simple: to XSL transformator send parameter paper.type with value of you paper type. If you use Fop and runs it with docbook file and XSL transformation in commandline arguments specify: -param paper.type A4.

Monday, July 14, 2008

Firefox 3 Instant Crashes

I use Mozilla Firefox as my browser. I started from version 2, when I migrated from Opera because it wasn't supported by some Google web applications. Version 2 frustrated me with periodical freezes - they lasted for about 30 seconds and then FF came back to live. Now I'm using FF 3. There was a lot of buzz about it. I found that it has some new valuable features that still keep me from downgrading to FF 2. But FF 3 on my computer crashes several time per day. At first it was happening at notebook with Vista. So I had some suggestions that this are the problems with OS. But I found that these crashes happen on desktop computer with XP. Moreover recently I reinstalled OS on notebook and firefox crashes on almost "clean" OS also.

I don't use any *not very popular* extensions. Even more - I disabled them all, but FF 3 continue to crash. May be I should disable some plugins? I don't know. And I didn't heard any significant buzz about "FF crashes on my PC every hour!" so I come to conclusion that these are problems with my environment (Russia, ISP, some software on PC, anything else). But Opera works finely. So I have three ways:
  1. With great patience continue to use FF 3
  2. Downgrade to FF 2 (remember the buzz "downgrade to XP from Vista")
  3. Use another browser: Opera, Maxthon, IE, Safari.
But... I've been waiting for FF 3 and wanted to use it. And now I found it to be a big piece of crashes for me.

Simple (and funny in some way) recursy in C#

While recent work with reflections in .NET I found a funny way for recursion:

using System;

namespace ConsoleApplication1 {

class Program {

static void Main(string[] args) {
Program p =
new Program();
Console.WriteLine(p.Property);
}

public String Property {
get {
Console.WriteLine(
"Getting property, counter {0}.", counter++);
return (String)this.GetType().
GetProperty(
"Property").GetValue(this, null);
}
}
int counter = 0;
}

}
Getter of property gets PropertyInfo of itself and calls GetValue method.