If I have ever made any valuable discoveries, it has been owing more to patient attention, than to any other talent.
-- Isaac Newton
If I have ever made any valuable discoveries, it has been owing more to patient attention, than to any other talent.
-- Isaac Newton
A CEO throwing a party takes his executives on a tour of his opulent mansion. In the back of the property, the CEO has the largest swimming pool any of them has ever seen. The huge pool, however, is filled with hungry alligators.
The CEO says to his executives "I think an executive should be measured by courage. Courage is what made me CEO. So this is my challenge to each of you: if anyone has enough courage to dive into the pool, swim through those alligators, and make it to the other side, I will give that person anything they desire. My job, my money, my house, anything!"
Everyone laughs at the outrageous offer and proceeds to follow the CEO on the tour of the estate.
Suddenly, they hear a loud splash. Everyone turns around and sees the CFO (Chief Financial Officer) in the pool, swimming for his life. He dodges the alligators left and right and makes it to the edge of the pool with seconds to spare. He pulls himself out just as a huge alligator snaps at his shoes.
The flabbergasted CEO approaches the CFO and says, "You are amazing. I've never seen anything like it in my life. You are brave beyond measure and anything I own is yours. Tell me what I can do for you."
The CFO, panting for breath, looks up and says, "You can tell me who the hell pushed me in the pool!!"
(from jokes4all.net)
Microsoft offers a free online test drive of its upcoming Microsoft Office 2007 (but seems you can only use Internet Explorer).
OpenOffice.org offers similar test drive. It's not only a test drive, as if you enjoy the test drive, you can keep the car. And without any other extra cost.
Online test drive is of course not a new idea. You can try - at no charge - online test drive of KOffice. You can also, when you don't have fast Internet connection, try it offline. No installation is necessary, really no hassle. No harm will be done to your computer. And no ActiveX. You can even test drive it as long as you want, as if it is yours.
Decrypting Bezier curve in WordPerfect Graphics (WPG), for the libwpg project, turned out to be not so easy. First of all, the documentation is rather very brief. The curve is specified in some triplets, where each triplet consist of initial control point, anchor point and terminal control point. This hardly tells anything useful at all. In fact, first I thought this is about quadratic Bezier curve, which was of course wrong, as it is cubic Bezier instead.
The trick was finally quite simple, I should have though about it before. I just need to match each of those three points with the actual nodes and control points, this I got from within Corel Presentation by checking the cursor position when hovering over the corresponding points.
After knowing the meaning of the triplet points, it is quite easy to adjust the WPG-to-SVG conversion tool. As the proof, shown here the screenshot of two wonderful landscape drawings. On the left side is the WPGs inside WordPerfect Office, on the right side is the converted SVGs shown in Karbon. Quite a perfect conversion so far.
My hacking portfolio so far involves developing over a half dozen conversion filters for KOffice. It's quite obvious that filter coding is not always fun. Sometimes the file format documentation does not exists at all, often it is also wrong. To certain point, it would bring you to reverse-engineering and trial-and-error steps.
The easiest way is of course to have an application that creates the document natively. If you have any doubt, you can always use it to create or modify the file in question. The problem is most of time these wonderful applications run only under non-Unix OS. Here where emulator solves the problem.
What I used nowadays is QEMU. I'm sure you can as well use VMWare, especially since they now have the free VMWare Player, but when I started some time ago the Player did not surface yet. Pre-QEMU, I had to go through the difficulties of using Wine.
My latest endeavor is libwpg, a library which reads WPG (WordPerfect Graphics). It's a vector graphics format (think SVG). WPG files can be created natively using Corel WordPerfect Office (more precisely, with its Presentation application). Here are the steps that I do, assuming I have QEMU installed and ready to use.
First, create a disk image to be use as the "virtual disk". Something like this:
qemu-img create -f qcow vdisk.qcow 500M
and I'd have a half GB of virtual disk. Do not worry that it would consume all the precious disk space. Using the qcow format, the disk grows automatically when necessary. In fact, right after creating it, the size is only 2 KB. Later on when something is installed there, then it will grow itself.
Now since WordPerfect Office needs a Microsoft Windows, we need to install it on that fresh disk. The trick here is to choose an older version of WordPerfect Office (because WPG format is fairly backward and forward compatible) and an ancient version of Microsoft Windows. Both cost quite cheap on ebay. For example, I settled with Windows NT 4.0 SP6 and WordPerfect Office 10 as the guest operating-system and guest application. Bonus, that half GB will be more enough for these two.
So inserts the install CD and run:
qemu -hda vdisk.qcow -cdrom /dev/cdrom -boot d
that will boot our virtual machine from the CD-ROM, thus allowing the installation of the guest operating system. When finished, continue with the guest application. Even without the accelerator module kqemu, everything should run pretty fast on a quite modern machine.
So now that I have WordPerfect Office running on that poor little virtual machine, the next step is to create, open and modify WPG files. The big problem is of course that I have to be able to access it also from my libwpg environment. QEMU's virtual FAT feature nicely solves that. For example, by running it like this:
qemu -hda vdisk.qcow -fda fat:floppy:rw:/home/ariya/vfloppy
then inside the virtualized machine, I'd have access to directory /home/ariya/vfloppy (on the host machine) as if it is a floppy disk (of the guest machine). Beautiful, isn't it?
In old version of QEMU, I have to use the network by either setting up SMB or some file server. This often did not work smoothly. But the above virtual FAT is both painless and flawless.
The obligatory screenshot below - as usual, click to enlarge - shows a simple WPG file opened in Corel WordPerfect Office (its native application) running inside QEMU'ed machine and an SVG file converted from that WPG file opened in Karbon:
Now back to coding.