Is Linux ready for me?

Filed Under Software, Linux

Is Linux ready for me?

In parallel to my efforts to completely switch to Vista in my office, I decided to
check out on the progress of Linux. I was curious can I do all my daily job under Linix, so I installed the latest Ubuntu alpha in parallel to my Vista. I planned to spend roughly half my working day in Vista and the other half in Ubuntu. For the purpose I used my company Fujitsu-Siemens T4210 tablet PC, Vista business edition and Ubuntu 7.04.

Installation

Ubuntu installation was a breeze, but I had to put in additional 2 hours of
effort (reading forums mainly) to get the tablet and tablet buttons working. The Ubuntu forums are really helpful, and it is quick and easy to find exact steps to get your hardware working. I never managed to get the built-in microphone working, though.

Wireless networking is greatly improved in the latest Ubuntu. Much more stuff works out-of-the-box. Overall no problems here.

Doing work stuff

I started doing what I do normally, and overall I was able to to most of my work
under Linux. This included:

But I also found out I had to re-boot to Vista for some tasks. What I did not manage to do under my Linux:

Doing fun stuff

The conclusion

Linux has improved greatly for the last year. If I was writing this article for Ubuntu 5.x, it would have been much, much worse. It is now almost suited for work stuff. If I had found a reasonable Project, Visio and Photoshop alternatives - I would have switched, since overall I started to like Ubuntu very much.

For the fun part - its greatest strength (the huge freedom and choice) is its biggest
curse. Until there are world-wide Linux standard HALs for hardware accelerated video
and modern 3d sound, Linux is totally not ready for the fun part. And it is my favorite
part….

Refactor-able code

Filed Under Software

I have been thinking lately what is the best way to Stop over-engineering and still not fall victim of duplicate code (or even worse - very similar code).

At first glance, the approach of Test-first programming and refactoring seems to be the perfect remedy to over-engineering. What it basically says is:

This guarantees you that the code will be right-engineered. Not over-engineered (unnecessary complexity), nor under-engineered (duplicate, similar code all over).

The problem with that approach is that it does not work. It does not work because the “at all costs” rule above is frequently overruled by non-engineering reasons. A typical example will be when you decide not to re-factor to fit in the latest feature since you are too close to a release and you don’t want to introduce new bugs or void the testing already done.

Then you fall into the “I will patch it now for the release and re-factor later” down-spiral. So if you are stubborn on the “at all costs” rule, you will not be able to make your releases, and if you are not you will end up with an under-engineered code-base.

The root of the problem is that refactoring takes time and brings instability to the system. And to me there is no reason for that. We should be able to write code that is not complex at that moment, but is refactor-able (or refactor-friendly). Such refactor-able code will be easy and clear to refactor if necessary, but without doing it in advance. We will save time from the development (as compared to over-engineering it), but we will still be able to follow the “at all costs” rule, since refactoring will be easy.

My goal is to come up with a definition and how-to for refactor-able code. I am posting this much more as a basis of discussion and ideas, rather than as something carved in stone.

Definition: refactor-able code - code that is easy and risk-free to refactor
How to do it:
There is just one simple rule - Over-engineer in your head, do it simple. What I mean is to keep in your head a vision of how would you over-engineer it if you had all the time in the world. Then write the code simple, preparing it to match the vision in your head.
Since this is a really vague how-to, I will try to list cases in which you can substitute the urge to over-engineer something with much simpler preparations for that. Following is a list of examples

If I was over-engineering I would… Instead I will…
Split this into two modules and use callbacks to communicate Keep the two modules together, but keep the would-be-callbacks as separate functions.
Make a base class for the generic part and inherit it for this special case Do one class, keeping the “generic” methods together and don’t allow a lot of special-case code to go into the generic methods

Repair dynamic disks that go foreign

Filed Under Software, Windows

How to repair dynamic disks that go foreign or will not reactivate

Sometimes when frequently switching dynamic disks among machines, moving parts of the disks of a group amongst machines, or doing something not very simple sometimes the LDM (Logical Disk Manager) will break and some or all of the disks will go foreign or missing. The LDM is the table that contains information about all disks layout - partitions, stripes, etc.

In many cases you will be able to get to your volumes using “Import foreign disks” or “Reactivate disk“. Sadly sometimes the Windows Logical Disk Manager goes berserk and fails with “Disk group has no configuration copies” or some other cryptic error.

Consider you have done everything you thought of, and you don’t have a backup of your LDM created with Tiger Technology’s Dynamic Disk Optimizer tool (which would have saved you). Then there is the last measure - re-building your dynamic disk configuration manually. The rest of this post will explain how do do it.

I assume you:

Lets use a stripe of two disks as an example. It won’t import. It looks like this in disk management:

foreign.jpg

Step 1: First we have to backup the first 4096 bytes of your NTFS. Use a hex editor (like WinHex) to find the NTFS (it should be on disk 1). Depending on weather the disk is MBR, GPT, and how you partitioned the NTFS(es) might be in different places. Look for the string NTFS with the hex editor, and when you find it - check if it matches this picture:

backup.jpg

Then from the start of the NTFS sector, write 4096 bytes to a file somewhere. This is the important info to rebuild the volume. If you don’t successfully backup that, and continue - the data is LOST. Also remember disk number and offset where you took the backups from.

You have to do this step for each volume (not disk). You should end up with as many NTFS backup files as many volumes you had. If you had partitions in the middle of the disk - it might be tricky to find all NTFS headers.
Step 2: Convert the disks to basic
convert.jpg

Step 3: Convert back to dynamic

convertdyn.jpg

Step 4: Create your volumes again as they were. EXACTLY the same. When Windows ask to format the new volume DO NOT ALLOW.

format.jpg

Step 5: Write back all the NTFS headers you backed up in Step 1 (you remembered disk offsets and numbers as I told you right? If not - search for the NTLDR signature as screen on the WinHex screen shot above - it is on the next sector as you can see from the screen shot, and it will be there).

Step 6: Try to mount/access the volume. You should see your data :)

New version of Magic Price

Filed Under Games

Abugames changed their search result layout recently, so I had to update the Magic Price software sync logic. Also, the “specials” feature is gone, since there are no more special offers at abugames.

A few notes for old users:

You can grab the new version here.