Wednesday, 20 June, 2007

Free Online Book Sites

A “speedlinking” list today. Not only are these free for the public, but also there’s no registration or other strings attached. The first rule of the autodidact is to do it for free when you can…

O’ Reilly Open Books. O’Reilly press has long had a policy of publishing out-of-print and open-copyright books online. O’Reilly is also the top name in IT books.

Free Computer Books. Very comprehensive. Nearly every programming language you want to pick up is here.

MIT Courseware. Not really books, but full video lectures here provided for free by the Massachusetts Institute of Technology. Requires RealPlayer, but many open source players can play .rm files as well.

Google Book Search. By selecting the option “full view books” before making your search query, you can keep it to books you can read for free online. Google provides you with an on-site browser for this purpose.

Hiveminds Books. Some books along with snippets and articles.

The Directory of Open Access Journals. Journal publications from universities all over the world, arranged by subject categories for easy access.

World eBook Library Consortia. Big one! All in .pdf for download.

Primitivist resources. OK, just in case you thought this site was too tech-focused! “Primitivism” is the pursuit of ways of life running counter to the development of technology, its alienating antecedents, and the ensemble of changes wrought by both. There, now, if technology ever gets to be too much for you, you know right where to run. Don’t find it too ironic that it’s all published online!

Fullbooks. A alphabetical index of free books on all topics.

Understanding the Open Source Licenses

First, to qualify what an open source license is: It doesn’t always mean that the general public is free to contribute, modify, or distribute the code or even that the licensed software is free of charge. At the base, open source means that if you ask nicely, they’ll let you see the source code, and you can at least modify it to suit your needs. Hence the distinction between Free (as in freedom) software and Open Source.

But there’s all kinds of shades between the two. The Open Source Initiative lists something like 50 licenses approved as meeting their definition. Some entities restrict redistribution for commercial reasons, or contribution for purposes of security or quality control. The most common licenses you’ll encounter:

GPL This is the Free Software Foundation’s own General Public License. It grants the most freedom, to obtain, modify, re-distribute, and even sell the software at a profit. The sole requirement is that you do not restrict others from enjoying the same rights - so it’s “share and share alike”, down to including a copy of the license for the next user. That’s version #2, the current version used by projects like the Linux kernel and the Gimp. The new version #3 which is creating quite a stir is aimed at adding further restrictions such as preventing GPL code form being used for purposes such as DRM. The dust is far from settling on this one! Even if it goes through, there’s nothing to stop anyone from continuing using GPL2.

MPL The Mozilla Public License, which is the license of Firefox, Seamonkey, and other derivatives. Somewhat like the GPL, with some provisions for intellectual property (the Firefox trademark logo). This exception led to the recent public snit between Debian and Firefox, where Debian ended up releasing its own version of Firefox, named “IceWeasel”, to dodge the logo issue. Debian, one of the oldest surviving Linux distros, frequently finds itself in a ‘watchdog’ position on matters of what is and isn’t legal.

CDDL Common Development and Distribution License, used by Sun for Open Solaris. Slightly more restrictive that the MPL, the open development must take place under Sun’s watchful approval and control, with very few rights to redistribute. Sun is pondering switching to GPL for Solaris, as they already have for their Java language.

BSD used in some form for all of Berkely Software Distribution software (Open BSD, Free BSD, etc.). The greatest freedom you can have, generally granting free use for any purpose at all, with the sole restriction that the supplier isn’t responsible for a blessed thing at all, at all.

The examples go on forever, and distinguishing between them is a job for language lawyers. Most of them are exactly the same for the end user; generally you can do what you want on your own computer. For programmers, however, the issue becomes muddier, as questions arise to what license is compatible with what other one, what license allows what right, and so on ad infinitum. Licenses are in a constant state of flux, with new versions popping up all the time. Just be aware that I’ve glossed over a lot, and of course this site is not for legal advice. I’ve also left out enough political/idealogical debate to fill the library of congress… aren’t you glad?

More info:

The Wiki definition of Open Source

The Free Software Foundation

The Debian License Page

What is a Wiki?

The ultimate definition of a Wiki is a site where anyone can add, remove, and edit content. But the actual spirit of a Wiki is simply an ever-changing consensus on a given topic, and Wikipedia is just one example. Wikis are a step above forums and blogs, making equal content creators out of everyone, and sometimes leading to chaos, but in a fun way!

How chaotic it can get is shown by the Wikinovel experiment, started by Penguin Books and De Montfort University. When the project started, you could log in in five minute intervals and find the story was about a red lion, or a blue bear, or was a sitcom, or was a pornographic work… the upheaval continued until they had enough editors to regulate it somewhat. The reading of this work is an adventure in itself, almost coherent in places.

None less than Tim Berners-Lee, recognized “father” of the web, has pointed to Wikis as what he had in mind when he first implemented HTML. Wikis are one of those ideas which sound good on paper; the world-wide network of enlightened minds sharing all the good things they know until the zenith of collected human knowledge is achieved.

In practice… Well, judging by the long list of “bad jokes and deleted nonsense” on Wikipedia itself, global civil responsibility isn’t always benign. They’ve even had to put up a list of Things no one cares about. Just in case you were wondering.

But the Wiki is a handy tool that isn’t going away any time soon. There is a steep curve involved in charting the usefulness of a given Wiki: with only a few editors, it’s mostly worthless junk, but at a certain point it gains enough interest that it has sufficient volunteers so that it can be policed.
The global consensus method of organizing data is being applied to media, as well. Wikimedia Commons is currently at 1,518,406 media files, ranging from sound to image to video to free ebooks, that anyone can download and contribute to. The world is amassing quite a curio cabinet here, and we have room to wonder if maybe in another decade the concept of paid media creators will simply be outdated.

Why GNU/Linux?

The buzz about Linux, BSD, Open Solaris, and other free versions of Unix seems to swell every month. In case you haven’t tried one of them yet, you might be wondering, “What is all the fuss about?” Truly, you see passion about these systems that is seldom shown to their competitors. Here’s a brief list of where the Unix system triumph:

1. Security. Of course, the number-one touted feature. To this day, there exists no major exploits in the wild for Unix systems - no viruses, trojans, or worms. Software security laboratories such as Symantec have found proof-of-concept attacks, but really you almost can’t get a Linux box “PWNED” unless you try really hard. This is because Unix systems have security built in from the ground up. The system embeds the concept of file permissions. User, group, and administrator (”root”) all have different permissions to read, write, or execute each individual file. This also applies to any program you’re using - for instance, a virus which you downloaded through your email couldn’t do worse than wreck your own home directory, because your email program doesn’t have permissions to write anywhere else.

2. Licensing. The free Unix systems belong to the general public under the GNU general public license or the equivalents on BSD and so on. This means you never have to worry about per-machine licensing, or having the system refuse to update because it thinks you’re a pirate. You also have other options to fix something instead of waiting for some corporation that already has your money. If you’re a programmer, you can dive in and fix it yourself; if you aren’t, somebody else who uses the same system *is* a programmer and fixed it themselves, then posted the patch free for everybody.

3. Maturity. It bears saying that the original Unix operating system was first created on a PDP 7 at AT&T Bell Labs - many years before computers were commonly found in the average household. Just about everything that can happen on a computer has already happened on a Unix first, and in fact free Unix systems today continue to be the first to develop new features and introduce new programs. The first web browser, for instance, ran on a Unix system. Today’s versions of Unix have such outstanding legacy support, you can literally take a program written 30 years ago and run it on a modern distro, with no problems.

4. Stability. This is the fabled “cathedral vs. bazaar” development idea in action. Even a huge corporation is unable to match its team of programmers against hundreds of voluntary developers around the world working when they want to. And so by the time a program gets out of alpha development, it is robust enough to run reliably in deployment. A Linux system may have programs running on it misbehave, but the system itself never crashes, ever.

5. Flexibility. Since a Unix system is developed by many hands for many purposes, it is easily put to use in many different ways. This answers a frequent question: “Why are there so many distros?” Because each of those are a prepackaged solution to address unique set of needs. There are Unix-based systems running on everything from mainframes to cell phones and everything in between. Software exists for everything from a web server to an office desktop.

Note that we’re missing the “free of cost” argument. This is to deliberately dispel a myth: While it is a nice bonus that most Unix systems are free of cost, the fact that it can be had for free does not contribute significantly to why users say they prefer it. The existence of commercial systems such as Red Hat, Novell, and Xandros also point to the fact that you can charge for Linux and people will still use it anyway.

Now, for the home or office user, there are some cases where Unix still isn’t a viable option.

  • Hardcore gamers. While many games are ported to Unix systems, the vast majority of commercial game titles are still made for a Microsoft system only. The market just isn’t swaying away from that direction yet.
  • The printing industry. The graphics-to-print technology has methods such as CMYK and Pantone color matching which are heavily patented, the patents are licensed only to Adobe, and Adobe isn’t porting Photoshop anywhere near a GNU system. That’s that.
  • Other proprietary software users. Many software titles still aren’t releasing for anything but a proprietary system. Some work-arounds exist, and several technology companies are starting to warm up to Unix systems, but the market isn’t swaying in the Unix direction that fast.

Note also that we’re leaving out a common misconception about the downside of Unix, which is hardware support. In fact, Unix systems support many times more hardware than proprietary systems - if you count all of the hardware that was sold before this year. Unix systems, not having a commercial motivation, do not drop legacy support for older hardware like their proprietary counterparts do.

Operating System Wars

Apple, after being beaten and almost choked to death by Microsoft, Apple has unleashed what I like to call the “Mac Attack”. The Mac Attack fueled by Ipod sales, is attempting to convert Windows users by offering ease of use, aesthetic appeal and security. Hackers have been merciless with Windows during it history, Macs on the other hand have not yet suffered from these problems. Mac claims that it does not get hacked because Mac has better code, Windows and Linux users claim that Mac doesn’t get hacked because its worldwide Market share is only 2%.

Apple having founder Steve Jobs return to the company has started propaganda warfare. Its Commercial “Get a Mac” features Justin Long as the cool young Mac and John Hodgeman as the older more businesslike or “Square” PC. Get a Mac has been very effective in the United States convincing 5% of the population to purchase.

Microsoft Windows has tried to do the best of both worlds. Keep both Window loyalist close as well as keeping people tempted by Apple. To keep old school Windows fans loyal, Microsoft has tried to keep the insides. The inside being the development tools and configurability Macs just don’t have. Microsoft has also tried to keep those tempted by Mac by offering ease of use and ascetics. The result is that Vista requires an incredibly fast machine with lots of RAM. The amount of Ram required is offset by an amazing Windows Innovation known as Readyboost. Readyboost takes your Flash Memory of 256MB up to 4 GB and makes it into basically RAM. The Readyboost RAM will not be as fast as your computers physical Ram but it will be much faster than a Swap file on the hard-drive, which is slow.

While the two companies do battle, an unpaid alternative hides in the shadows. Linux, a free operating system, is being heavily supported by China and Japan. China and Japan are countries that do not want to have to be tied to Microsoft’s expensive software. However expensive it might be to the Chinese, using Linux has its downfalls including its lack of technical support. As Linux grows, it becomes more and more of a threat as better and better code is created. Linux is always a few years behind the paid alternatives but it will force Windows and Mac to upgrade faster or will cut off their revenue.

Which operating system will dominate the future? As long as the computer market continues in the current direction, Linux by far.

Fixing Windows using a Live Linux CD

Try as we might, we sometimes get Windows in such a bind that we can’t run it. Virus attacks, trojans, and malware just go with the territory. Don’t feel bad, as even the geekiest of us sometimes get Windows hopelessly wedged, even to where we can’t boot it in safe mode.

If this happens to you often and you’re tired of re-installing Windows or can’t re-install because you don’t have the original disk, we’re going to walk you through the strategies for obtaining a live Linux CD, which you can then boot and get your machine running long enough to fix the problem.

First off, the Windows user will probably be daunted at the huge selection of Linux distros. The difference between one distro and another is actually only a matter of what other software comes installed with it. You’d have to imagine if Microsoft made a “Windows for graphics artists” distribution that came with Adobe Photoshop, Illustrator, and Maya 3D included. Or a “Gamer’s Windows” with a selection of the top popular games installed and the latest Direct Draw/sound card/graphics card drivers to ensure everything runs smoothly. Really, that’s all that’s going on with the various Linux distributions.

The top Linux live CDs to recommend for a Windows repair emergency:

  1. The Trinity Rescue Kit: a whole Linux distro specifically for our purpose of fixing Windows. Amongst it’s many abilities, it can easily reset Windows passwords, includes four different virus-scan products, has full NTFS write support, can even clone an NTFS file system over the network, has an easy script to find all local file systems, and can do recovery and undeletion of files. The only downside here is that it’s a command-line based distro - if you’re not handy with a command line (such as Windows Power Shell), you’re going to be intimidated.
  2. Knoppix and Mepis: Knoppix and Mepis are both desktop-oriented distros with all the flashy features of the latest KDE desktop, and are both full-service systems for general purposes. The KDE desktop will feel very familiar to Windows users, and both of these distros are specifically aimed at people who are used to Windows. Knoppix has much more software installed on it than Mepis, while Mepis has more focus on high-end hardware support.
  3. Linspire: Those who are least sure of their computer skills should try the Linspire live CD. Since they openly advertise “the world’s easiest desktop Linux” and recommend it as “perfect for Windows users”, it seems their goal is to come as close to copying Windows as they can without getting sued. The desktop will even give you familiar icons including the file manager named “My Computer”, a Windows-like start menu, and so on.

For our purposes for the rest of this series, any one of these four will be enough. If you want to explore further, a site like DistroWatch and LinuxQuestions will be helpful.

OK, let’s say you’ve picked your distro and downloaded it. Now you have a file ending in “.iso” on your computer, and you have a blank CD in your hand.

An .iso file is a disk image file, and it’s nothing like other files you might burn to a CD. Of course, you need a CD-RW (CD Read Write) to be able to write anything on a CD, and you want a special utility that can handle the .iso standard. Nero is a popular all-in-one utility that can handle any CD writing task, including .iso’s. It used to be shareware but it looks paid commercial now. A better solution is BurnCDCC, a freeware app which just burns .iso images and nothing more. It has about two buttons on it, and takes about one second to figure out.

Of course, you can also buy live CDs from online distributors (about two bucks apiece, most places) or get them in the back of a book (Ubuntu and Knoppix books have this), but CD burners are becoming the most popular option because everybody’s getting them these days.

When you have the CD finished, take a deep breath, reboot Windows with the CD in the drive. If all goes well, the PC will come back up as Linux. If not, be sure your BIOS is set up to check the CD drive first for a system before it checks the hard drive. Granted that you have stuck with one of the distros we recommended, you should get it up and running with no problems.

The thing to remember with a live CD is that it will do nothing permanent to your computer until you tell it to. Everything on your hard drive is still right where you left it; in fact, you can bring up a live CD even if you remove the hard drive altogether. In most cases, the live systems we’ve recommended will automatically mount the hard drive, which just means it’s found the Windows partition and is ready for action.

Check with the website for each distro to find out the specifics. Before you try the CD, look at the website’s documentation, and ask questions in the forum for it so that you know what to do. But generally, you’ll be working in either the KDE Konqueror file manager or roughing it from the command line.

An example, in command line terms, is /dev/hda1 mounted to /mnt/hda1/ The “dev” stands for “device”, “hda1″ is the first partition of the first drive found, and “mnt” is the “mounted” systems. When this is enacted, what you previously called “C:\” is now “/mnt/hda1/”. Try finding it in the file manager interface for the desktop systems (or ‘cd /mnt/hda1/’ from the command line) and there you are in your C:\ drive. Browse around.

One thing to keep in mind is that Linux doesn’t heed the Windows convention of hidden, system, and archive files like Windows Explorer does. Everything is a plain old file to Linux. This is a good thing, since lots of malware and trojans exploit these features to keep you from finding and deleting them! Also, Linux programs will happily allow you to open any text file (that includes .DOS, .BAT, .INI, .SYS, etc.) edit it, and change it without worrying that you broke something. Since viruses and malware frequently write entries for themselves in these text configuration files, that also comes in handy.

Now to the actual usage of a Linux CD!

The Trinity Rescue Kit has a very complete manual, both too in-depth to repeat here, and too comprehensive to leave out. That’s here. Note that it’s a printing version, but you can also click ‘cancel’ when the dialog pops up and just read it online. The TRK docs are geared at getting you up to speed with the Linux command line and using the CD to perform virus scans and so on. For a DOS/Windows user’s-eye view of Linux commands, see the “From DOS/Windows to Linux HOWTO

If you picked an easier system to comprehend, these Knoppix instructions cover how to use Knoppix to mount your Windows hard drive, install the f-prot virus checker, and get your system clean. It takes a while, but it is much easier to use a familiar mouse/windows interface. Similar methods will work from Xandross and Mepis.

Now, ‘mounting a Windows system’ is a pretty generic term. Windows NT and its descendants Windows 2000, Windows XP, Windows Server 2003, and currently Vista all use NTFS. Previous versions of Windows used FAT (in various forms of FAT12, FAT16, and FAT32). And a new WinFS file system is planned for either the future of Vista or the next Windows release. Currently, the distros I’ve listed previously should have no problems supporting the newer systems, but support might be scattered for something like Win95!

But beyond using the tools described in the links above, what about simply looking at your Windows file system to determine what the heck is going on in there, and possibly fixing it? Virus and malware removal is never a clean task. So for extra support, on either the KDE desktop or the KDE menu, look for a little picture of a house. That will open Konqueror to your home folder. Look for the icon for mounted file systems (media) or the ‘root’ folder and go from there to ‘mnt’; one of the folders within the /mnt directory will contain your Windows C:\ drive. Click that to open it, browse around. Konqueror is neatly integrated with the office tools, so any text file that you click on in Konqueror will automatically open a text editor.

You can now edit your configuration files (IF YOU KNOW what you’re doing!) to remove unwanted entries in the registry. Similar methods can be used for repairing AUTOEXEC.BAT, etc. But again, you should not save any changes unless you’re sure that that’s the right thing to do.

You can safely browse through the rest of your Windows directories. Investigate any new folders with names you don’t recognize. One warning sign that you might be looking at malware you didn’t ask to have installed, is if it has no documentation included nor an uninstall program. If it’s in the programs directory, is unrecognizable, and seems very secretive, Google the folder and file names to see if anybody out there has caught it misbehaving. You can delete anything in Konqueror merely by the standard right-click-delete form the menu action, just like in Windows.

A lot of this is stuff you should take very slowly indeed. When in doubt, just stick with the standard anti-virus measures detailed in the documents I linked you to above and hope for the best.

So far, we’re trying to move you through the steps to repair your system when damage has already occurred. But the best way to maintain a Windows system with Linux is to perform system audits, because you will track changes from one audit to the next and it will be much easier to track what’s going on.

A system audit isn’t any kind of professional measure. Simply, we’re going to make a record of how your system looks today. Save that record and check back in another week, and make a new record. Compare record A with record B. Is something different? If so, is it something you, personally, installed or changed? You get the idea.

A system audit can be performed from the command line. If you’re on the desktop, hit Control-Alt-F2 to get a console (you can also just open a terminal on the desktop, which is the same thing.). Start by typing,


to see what’s already mounted. If your Windows system is mounted, it will usually show up as being /mnt/hda1 . If it isn’t, type

mount /dev/hda1 /mnt/hda1

Next type

ls -R /mnt/hda1 > WinSystem

To break that down: ‘ls’ is the ‘list’ command similar to ‘dir’ in DOS. -R is the option meaning ‘recursively list all sub-directories under that directory’ The ‘>’ is a re-direction operator; normally ls prints to the screen. The WinSystem is the name of the file you’re going to dump the result to. You can call it whatever you want (even WINFILES.TXT). You might want to append the date to the file name like so: WinSystem_3_16_07 . Depending on how big your Windows install is and how many files you have, this could take a while to finish - possibly hours for a 100-Gig drive!

While that’s happening, you can always hit Alt-F3 to go to another console (you can even hit Alt-F7 to pop back to the desktop and open a terminal. Or just stay on the desktop and open another terminal.) Now just type

ls /mnt/hda1/

to see all files in the C:\ drive of Windows. Anything there that applies as AUTOEXEC.BAT, CONFIG.SYS, IO.SYS, and so on, copy it over to your home directory with

cp /mnt/hda1/NAMEOFFILE ./

‘./’ is always your current directory. In fact, a lot of this will seem familiar to a DOS user, except that the \ and / are backwards from each other.

Once you have all the copies of configuration files plus the textfile with your directory listing, pick a way to save them. Either to floppy or a folder on Windows or to a usb drive. Mount a floppy with

mount /dev/fd0 /mnt/floppy

and a USB thumb drive with

mount /dev/sda1 /mnt/sda1

and to move all files from your current directory to storage media, type

mv ./* /mnt/media

where ‘media’ is either floppy or USB or your Windows folder where you want to send the files. You might also want to make a folder with the date in the name and keep the whole sheebang in there.

Now you have a record of how things were the last you checked. Now, when checking the record next time, keep in mind that Windows scribbles stuff in some places all the time. Your Internet Explorer updates it’s cookie file, you IE cache changes from day to day and so on. Not everything is a sign of intrusion. But you have the basic workings of a system to keep tabs on what programs are doing what behind your back.

Laws of Web 2.0

Well, web 2.0 has been around long enough that I’ve begun to notice some patterns. Maybe it’s just me, but I’ve developed a list of little rules that I notice the modern Internet just tends to follow.

The Law of Reincarnated Content There are certain stories that, when you see the headline pop up in the RSS feed from site A, you know it will soon hop over to the RSS feeds for sites B, C, D, and then it will lie low for a month and then pop up again. TYou’ll know if you’ve ever found yourself saying “I’ve seen that headline on Digg and Reddit, but if it gets to Slashdot, then I’ll know it’s important enough to check out.”

The Law of Career Trolls There are some trolls so dedicated, they join groups and watch the feed just so they can pounce on every story and heckle the commenters. You’ve seen this on Digg a million times: there’s about six career trolls that tackle every thread about Apple stories, for instance.

The Law of Homogenized Logos Every logo now has to be at least one of: (a) mirrored top-to-bottom (b) have the word “beta” in it, (c) be in soft candy colors, (d) rendered with glassy high-lights, (e) Make “1337Sp34k” usage of clever misspellings and numbers. Eventually, they’ll all merge into one big glob.

The Law of Expanding Features Every web site now tries to be it’s own portal. Hey, don’t leave! Here’s a calandar, here’s a bookmark list, here’s a calculator, here’s a forum, and you have search boxes right here!

The Law of Multiple Implementations No matter how arcane your idea is, there are six other sites that do the exact same thing.

The Law of Page Bloat Have you noticed that since all three major platforms of Mac, Linux, and Windows has supported tabbed browsing, the load times for page have gotten to where you almost have to load each link in a new tab while you read the old tab for fifteen minutes longer? Especially with AJAX. A Digg story takes like ten minutes sometimes on broadband, and it’s nothing but text!

Five PC Operating Systems You’ve Never Heard Of

Well, maybe you’ve heard of one or two… after all, you’re reading this site!

But largely in the computing world, there are the Big Three, with Microsoft leading the pack, Apple making a strong second, and Linux coming up from the rear. On the server side, Solaris and BSD have some light numbers (though they’re adapting to the desktop presently). But when you want to establish yourself as UBER-leet, check out one of these arcane systems and you will forever have bragging rights as one who ventured far off the beaten path.

Plan 9 From Bell Labs - What a tangled history it has! Created by the same visionaries who made Unix, this was an experimental venture to try to re-define the multi-tasking system. Bell Labs orphaned the project and then sold the lab out to Lucent technologies, which killed it completely. If it hadn’t been released as open source, it would be dead today, but instead it has a very tiny cultish following. Arcane in the extreme, it doesn’t see much use today beyond a hobbyist system, some server use, and the parent to Lucent’s own Inferno embedded system project. You can get the live CD free for download from the site.

Minix - While Linux, of Linus Torvalds making, has gone on to acclaim, the professor grading Linus’ papers didn’t think Linux was good enough. Much debate ensued, and professor Tannenbaum released his own idea, dubbed Minix. It is actually very close to Unix-like systems, and has some active development. You can get the live CD free for download from the site.

ReactOS - It’s ironic how many Windows users seeking an alternative to Microsoft never hear of this. ReactOS is being built from the ground up as a free Windows-like system. The project is still in alpha stages, while the team struggles with a code audit amidst accusations that they’re copying Windows too closely. The system does run and does look and feel just like Windows, but getting third party software to run on it is still mostly a gamble at this point. You can get the live CD free for download from the site.

YouOS - Two projects are at the forefront of bringing the concept of an operating system into the web browser application, and one of them is YouOS. YouOS is like an AJAX application that took over. The environment boasts an easy-to-use interface and a tight little following, with a modest suite of applications. There is even a system to install new programs (in Javascript). Free to join.

EyeOS - The other prominent web-based operating system. EyeOS is taking the idea of an operating system a bit more seriously. EyeOS boasts a slick interface that looks sharp, and a full suite of system software. Some innovative tricks are being used to give the whole system more of the feeling of a full system. Free to join.

Has Microsoft Gone Linux-Crazy?

First, Microsoft launched the famous “Get the Facts” advertising campaign. Back in 2004, Microsoft was sweating over Linux’s surprising domination of the server market, so they decided to try to paint their Windows Server System as the more prudent choice. That campaign is still running.

Next in November of 2006 came the absolutely shattering news that Microsoft was enterring into a partnership with Novell, makers of the commercial Suse Linux distribution which they had acquired in 2003. The Linux community is still reeling in shock from that one, and the Windows community was even a little surprised. Amongst other things, this move prompted a re-write of the Linux license to GPL version 3, which amounts to saying “No more Linux-Microsoft partnerships”. The feathers are still flying over that one.

Microsoft has continued to make noises to the effect that Linux violates a bunch of Microsoft’s patents. But are they going to sue? No… they’re just pointing out that they could sue if they really wanted to, but Linux distributions selling out to them could help them to decide they don’t want to. The response to this has been mostly unanimous, with various Linux spokespeople saying “Put up or shut up!”

But no, not everyone is unafraid of the Big Bad Redmond Wolf: Xandros was the next one to run up and buy some protection action. The reaction has been as hot for Xandros as it was for Suse: Linux forums cried “Traitor!” and “Judas!” and said they’d never run Suse or Xandros again. Let it never be said that loyalty comes easy in the Linux world.

So a week doesn’t even pass, and Microsoft hires a new “Director of Linux Interoperability”. And the head they hunted is Tom Hanrahan, director of engineering at none other than the Linux Foundation. Hopefully I get this blogged before the next development.

This is all happening too fast and without enough explanation. It is becoming obvious that either Microsoft is saying “We can’t beat them, so we’ll join them.”, or else they figure that all they have to do is keep buying Linux until there isn’t any Linux left, then shut it all down for good at once.

The love-hate relationship that Microsoft has been showing Linux is kind of starting to remind people of that one psychotic girlfriend/boyfriend that everybody has to go through before they get enough experience to pick a winner. Microsoft blows hot one week and cold the next. Could it be that they simply have no idea how to deal with their chief competitor, so they are just acting at random?

Before anybody says “Maybe Microsoft wants to go into the Unix business themselves.” - remember, they already tried that. Xenix was the Microsoft Unix, leveraged through them to eventually become SCO Unix. And we all know how that turned out, don’t we?

Why Web Development Still Sucks

Amongst information technology careers, web development continues to be one of the least popular career choices. That used to be partly due to the office Dilbert atmosphere that goes with any office cubicle job. But web development is now very nearly dominated by freelancers. You can work out of your home and consult and bid contracts on a case-by-case basis, free of a pointy-haired boss breathing down your back. And yet web development still elicits a cringe from the tech-savvy.

The state of tech books doesn’t help. For those of you not in a coding career, you should know that tech books are a significant business expense. They cost just as much as textbooks in college do, they have to release new editions every year because technology changes so fast, and they weigh about ten pounds each. You never hear somebody in a geek home say “Toss me that book over there!” But web development books have the added problem of being ten years out of date when published. You can only tell this after you get them home and read them.

There’s the author, serenely cruising along in 1995. He lives in a world where the only web browsers are still Netscape Navigator and Internet Explorer, the only Internet services are Compuserve and AOL, and every page, though it contains but three elements, must be formatted with a table. He has heard of CSS, but has decided that it’s a wild rumor of a passing fad. He is aware that the “blink” tag is out of fashion, but covers it anyway. PHP, Ruby, AJAX, Firefox, blogs - no news of these has reached his hairy ear.

The languages of the web leave a lot to be desired as well. Why is it that we only have to use one language (like C++) to build a web browser in, and yet to make the page that browser will display, we have to combine XHTML, CSS, Javascript, XML, DHTML, Java, Flash, and script it all from the server with yet another language just to make one web page? Everywhere else, we have languages that can do it all, but get onto a server and the language is divided up into tiny little Balkan domains that handle about five functions each.

Ah, but the customers! That’s the icing on the mud! The customers who cannot understand that they don’t need dancing smurfs, pop-up boxes, tinny MIDI music, 15-minute Flash intros, or to have all the navigation buttons shaped like little hamburgers. The customer who will never comprehend that scrolling red text in Comic Sans on a purple background is hard to read in the first place and makes anybody with a shred of aesthetic taste want to rip out their eyes with a cherry picker in any case. The customer who doesn’t know that web visitors want that page to be as simple to use and navigate as possible.

Bah, and this is only the beginning! there’s so any annoyances to web design, that they’re going to overflow this blog post and spill into the comments, provided by visitors venting their frustration. In 3, 2, 1…

AJAX vs. Flash vs. Java

Every few years, the Internet lights up with a buzz about some new technology. A decade ago, that was Java. A year ago, it was AJAX. Now, smarmier sites like ‘The Register’ and ‘Good Morning, Silicon Valley’ have correctly echoed the assertion that AJAX stands for “We finally got Javascript to work!” AJAX is actually “Asynchronous Javascript and XML”. But really, is it better than Flash?

Between Java, Flash, and AJAX, we have three ways to make a web page less like a document and more like a program. But before we take a step further in deciding whether AJAX or Flash is worthy of competing with Java, maybe we’d better consider that we can have both!

Meet AFLAX. AFLAX, it says right here on the tin, is the way to combine AJAX and Flash and have them work together. If the demos are anything to go by, you’re going to see this catch on. The movie player is smooth, the flaming text is the best yet, and you will not see a transparent refracting glass object slide around with such ease and accuracy. Oh, and the developer has cooked up some kind of interaction with Google Gears. Buzz about the other stuff all you want; I’m keeping an eye on AFLAX!

Google Gears, by the way, is yet another innovation from Google based on Javascript/AJAX. If big corporations are anything to go by, AJAX is a big winner based on Google’s faith in it, while Flash will always be the fair-haired child of Adobe, and Java… Sun killed Java, and even open-sourcing it hasn’t raised it from the dead. Look, Java can do anything Flash can do, plus it can do desktop applications like Flash can’t. Yet a year after Sun open-sourced Java, under the same GPL as free Unix systems, and not one new Linux distro has bothered to glance at it. Free Unixes already reverse-engineered their own Java implementations, or moved on to AJAX.

Flash may stay in the running, but it is getting to where it needs to break out of the web browser window if it hopes to stay ahead. So far, Flash has been about games and cartoons - some web sites try to build their whole site out of Flash and have mostly gotten rejected for it, except for flashy portfolio sites. Artists are supposed to be showy, after all. The rest of the world wants something that is practical.

AJAX and AFLAX are practical, with AFLAX adding the chrome from Flash. And if Google picks up AFLAX, that will be the final shutout for Java, and Flash will only be along for the second-stringer ride. What about you, audience? What other web-based technologies give these three a run for the money?


Sniglets are of course words that should be in the dictionary, but aren’t. See that link and the Wikipedia article, and pay some respect to Rich Hall - he’s a good, funny writer who deserves it.

Anyway, it occurred to me that there’s a few sniglets that are specific to geeks which haven’t been brought up before. See if any of these creep into your vocabulary:

Stupid++ The language you begin to code in at 2 AM when you’re too tired to code anymore. But you want to finish this file, so you keep pushing yourself, and just when you think you’re finished, you discover a huge bug. Then you have to stay up later to fix it, but you’re so tired that you mess up something else even worse. And so on. Trust me, just go to bed. You will remember what to do to fix it in the morning!

Bloggeronni The pasta-like mess you make out of your blog when you try to change all the categories.

Meatloafer This was kind of out there already, but it deserves to be amplified. Meatloaf is equivalent to spam, but it’s from that one friend you have who sends you emails all the time with links to stuff they find funny, so you go to click on it and it’s some lame joke you first saw in 1997. Yes, thank you, we’ve seen Badger Badger Mushroom. And the World According to America. And all the LOLCATS pictures. Even the ones that haven’t been drawn yet.

Googlecheck Typing a word into Google to see if you’re spelling it right.

Riddler-Mail When you get email (usually spam) in a foreign character set that your system doesn’t understand, so the subject line shows up as a line of question marks: ?????????? I’m always tempted to turn on the Bat-signal when I get one of these.

Beer-Blog A post to your blog made while sitting in a bar, in the raw hopes that this will be the one that was good enough to earn some beer - while you’re conveniently right there!

OS-Lag Brief period of disorientation experienced when you switch computers. Especially when you go from your Windows XP at work to your Mac at home, or your Windows Vista to your girlfriend’s Ubuntu, and start trying to look for things in the menu that aren’t there, type commands for DOS in Bash, Bash commands in DOS, and so on.

PhiloSEOphy The philosophy of Search Engine Optimization. We know 90% of the conventional wisdom is bunk, the rest is questionable, but get two webmasters together and we still can’t help but babble theories about meta-tags and keyword counts. What it is, is astrology for geeks.

FiredFox When the Firefox browser suddenly freezes solid and you have to kill it manually, hence “firing” it.

10 Things You Can Learn About Blogging From Monty Python

1. Spam, spam, spam, spam, wonderful spam! Wonderful spam… Comment spam is now a more common occurrence than email spam. Where you might see only a few spams hit your email per day if you’re careful with your address and filter it, you might see dozens of shots at a blog in the same day. Not just comments per se, but trackback and referrer links, where the same site generates a dozen fake referrer hits in a row.

2. No one expects the Spanish Inquisition! Blogs being such hip and trendy Web 2.0 devices, the feedback nature of the interactive web means you never know when you’re going to get caught making an incorrect statement, and get corrected by commenters. And our gracious thanks to those stalwart guardians of truth who comment to clue us in! Without you, we’d never learn where we mess up!

3. Is this the right room for an argument? Blogwars are becoming a fun spectator sport. It’s the most fun when you’re not involved. But of course, you get to impartially critique both sides.

4. Your mother was a hamster, and your father smelt of elderberries! Flames happen. It’s a big Internet, and you can’t have everybody love you.

5. He’s not the Messiah, he’s a very naughty boy! The rising culture of blogging is sometimes put into a harsh spotlight. Governments aren’t quite sure how to treat you - are you a journalist? A home-page publisher? A biographer? A historian? When bloggers get jailed in some countries for what they say, when one blogger can bust an industry scandal wide open, when a single post can bring a government lie to the surface, or when a grassroots effort to overcome oppression trumps all forms of censorship, blogging is taken a little more seriously than perhaps it deserves. We’re happy to go on doing our little part to make the world a better place, but just remember, folks, that we are mere mortals, OK?

6. Have you in fact got any cheese at all? You have to be careful with the headlines. Your blog gets aggregated all over the web, and people click the headline only to find an article entirely unlike what they expected.

7. How not to be seen. Some of us are lucky enough to not have our blog interfere with our jobs, or even our personal lives. For the rest of us, keeping a low profile is the only way to avoid having negative consequences down the line from something you blogged years ago. The reports of employers screening job candidates by searching the web for everything they’ve written are growing.

8. Come and see the violence inherent in the system! Help, help, I’m being repressed! Every week, we see another country try to censor the blog world. There is a political struggle going on out there between Internet freedom and Big Brother Government, and it gets uglier every week.

9. Nudge, nudge, wink, wink, say no more! Sleaze still gets the hits. All you have to do is put the words ‘Naked, nude, college girl, sex, boobs, Paris Hilton’ in your title, and here come the Diggers.

10. Get… the comfy chair! Sometimes you’re too lazy to blog; that’s when you have to put up a frivolous top ten list.

The World according to America

Tuesday, 19 June, 2007

Cons of C#


  • Problem:
    No anonymous inner classes. Anonymous inner classes are the OO equivalent of lambda abstractions and can be very powerful.
    C# features type-safe function pointers called delegates but has NO concept of anonymous inner delegates. This makes Java's event handling with anonymous inner classes much more convenient than C#'s named delegates.

    Add support for inner and anonymous inner classes (J# supports them! Jesus!) as well as anonymous methods.

    The syntax for anonymous methods could look like this:

    public MyForm()
    this.Click += new EventHandler(object sender, EventArgs eventArgs)

    The code without anonymous methods would look like this:

    public MyForm()
    this.Click += new EventHandler(MyClickHandler);

    private void MyClickHandler(object sender, EventArgs eventArgs)

    It may not look impressive but trust me, many event handlers are only one line long and writing a member function for each handler isn't pretty. Making event handler methods part of the class often makes no sense because the event handling code often has no context outside of the method that adds the handler. Classes are often less cohesive when they contain event handlers as top level methods. Anonymous methods increase encapsulation and localises the method to the area where it is used.

    [Update: 18 November 2002: Microsoft have announced that a future version of C# will include support for anonymous methods.]

    It will probably be a cold day in hell before Microsoft adds support for anonymous inner classes. The reason is simple, Java has them and "newbie" Java developers love to complain about how confusing they are. Microsoft will not add the feature in an attempt to gain respect from the developers who are confused by the language feature in Java.
    Anonymous inner classes (like anonymous methods) increases encapsulation and cohesion and would make a good addition to C#.

  • Problem:
    The syntax for using structs and classes look the same but, semantically, they can mean very different things.

    e.g. The following code will behave differently depending on whether or not Point is a class or struct.

    Point point1 = new Point(10, 10);
    Point point2 = point1;

    point2.X = 20;


    If Point is a struct, changing point2.X won't have an effect on point1.X. This IMO is the most fundamental flaw in C#.


    One solution would be to require the use of the struct keyword when referring to value types. Intrinsic value types (int, short, long, etc) can ignore this requirement.

    public static void Foo(struct Point p)
    // I can see that p is a struct so I know I have a copy and not a reference.

    p.x = 20;

    public static void Main()
    // I know p is stack allocated because I'm using 'new struct' instead of 'new'.

    struct Point p = new struct Point(10, 10);

    // I can see that p is a struct so I know I'm passing Foo() a copy of p.


    Using the struct keyword also conveniently eliminates the confusion that C++ programmers have over the use of the new keyword to construct value types [In C++ new is used to allocate objects on the heap -- never the stack]. This solution is so obvious (especially when you consider C#'s C++ ancestry), elegant and unobtrusive that it's amazing that Microsoft missed or dismissed it.


  • The Environment class contains the static property CurrentDirectory. Setting this property changes the current directory of the process. This is a very poor design decision. Changing the current directory for the entire process has major consequences for multi-threaded and multi-appdoman applications. Ignoring the issue of how sensible (or not) it is to allow the current directory to change, there is another problem: the use of a property setter to change global state. Microsoft's own documentation states that a set method should be used in place of a property setter if setting the property will do something major.

    Sun, being thoughtful engineers, have not added the ability to change the current directory in Java. This means that in the future, applications can all run under one VM without the random chaotic state changes that .NET applications will have to endure.


    Make the CurrentDirectory property a read only property. Add a new method called SetCurrentDirectory. Document the method as potentially dangerous in multi-threaded applications.
  • FileSystemInfo.Refresh throws an ArgumentException if the underlying file doesn't exist. This makes no sense because FileInfo.Refresh takes no arguments.


    FileSystemInfo.Refresh should adapt ArgumentExceptions into FileNotFoundExceptions before throwing them.


  • Problem:
    The standard controls such as the TreeView, ListBox and Combo box don't separate the UI from the data. The controls store the data they display themselves rather than requesting the data from a model as required. This way of doing things encourages developers to use the UI controls as a way to store their data (something no self-respecting OO programmer would even begin to consider).

    Solution 1:

    Use the Model-View-Controller architecture to separate the concerns of data display and data storage. This has the benefit of eliminating the need to store data in two locations (the UI and the storage classes) and releases the developer from having to manually populate and update the UI control.

    Solution 2:

    Use DataBinding to seperate the UI from the data. This method won't work with TreeViews.

    Example of why M-V-C is superior and Windows Forms sucks:

    Say we need to use a ListBox control to display the contents of an ArrayList. The problem we're immediately faced with is how to communicate to the ListBox the contents of the ArrayList. The Microsoft way would be to manually walk through the ArrayList and for every item in the ArrayList add it to the ListBox. This means that the ListBox, internally, contains a a copy of every item in our ArrayList. The ListBox contains data and this breaks one of the first rules of UI design. Containing data means that the ListBox is slower and takes twice as much memory. If our ArrayList contained 10000 items, the ListBox would also need to use memory to store those 10000 items. If we also wanted to display the items in the ArrayList in a ComboBox and ListView at the same time it would use three times as much memory. Additionally, there is a huge problem with data synchronization. If you remove an item from the ArrayList you have to remember to update the ListBox (this includes having to write the code to find the item in the list box and update it).

    The OO solution is simple and elegant. So simple in fact that it would make Windows Forms much easier to implement (for Microsoft) and use (for developers). ListBoxes no longer need to store and maintain an internal list of items they need to display. You just need to define the following interface:

    public interface IListModel
    ListModelEventHandler event Added(ListModelEventArgs e);
    ListModelEventHandler event Removed(ListModelEventArgs e);
    ListModelEventHandler event Changed(ListModelEventArgs e);

    int Count

    object GetAt(int index);

    The ListBox control would no longer store the data it displays. The ListBox would simply be passed an instance of IListModel. Every time the ListBox needs to render an item in the list, it would consult the IListModel instance and ask it for the item to draw.

    This means that the ListBox never stores any data (potentially saving a lot of memory). It also means you don't have to write complex algorithms to keep your data and the UI control (the ListBox) in sync. You simply have to fire an event from the model every time you think your data may have changed. This is much simpler than having to search the ListBox and modify the appropriate items. The other cool thing about using MVC is that your data doesn't even have to exist in memory at all. You can write a model that returns calculated values. For example, you can write a model that returns "0" as the item at index 0 and "1" as the item at index "1" etc. This allows you to make a ListBox that displays and looks like it contains 2^32 numbers without every needing to store all those numbers. If you tried to do that using Windows Forms your program would most likely lock up and run out of memory.

    Example of using MVC based ListBox, ListView and ComboBox to display all integers:

    class IntegerModel
    : AbstractListModel
    public override int Count
    return int.Max;

    public override GetAt(int index)
    return index;

    IListModel model = new IntegerModel();

    ListBox listbox = new ListBox(model);
    ListView listview = new ListView(model);
    ComboBox combobox = new ComboBox(model);

    Example of using Microsoft's ListBox, ListView and ComboBox to display all integers:

    ListBox listbox = new ListBox();

    for (int i = 0; i < int.Max; i++)

    ListView listview = new ListView();

    for (int i = 0; i < int.Max; i++)

    ComboBox combobox = new ComboBox();

    for (int i = 0; i < int.Max; i++)

    The code using the MVC/OO listbox is clearer, declarative and allows us to easily and dynamically change the values displayed. We only have to declare that we want to display all the integers once (not three times). Doing it the Microsoft way would result in repetitive code, lots of memory use, hard disk thrashing and eventually an OutOfMemoryException and even if it did work, it would be a pain to maintain.

  • Problem:
    The Panel control is intended to be used as a container for other controls yet it derives from ScrollableControl rather than ContainerControl (ContainerControls are ScrollableControls but ScrollableControls aren't ContainerControls). Who does Microsoft hire to design this crap?

    Control -> ScrollableControl -> ContainerControl
    -> Panel

    The design makes it look like Panel isn't a container control when it reality that's the Panel control's primary purpose -- being a general purpose container for other controls.


    Make Panel derive from ContainerControl.

    Control -> ScrollableControl -> ContainerControl -> Panel
  • Problem:
    The AnchorStyles and DockingStyle enumerations are inconsistently named. The enumerations are so closely related you have to wonder how the hell anyone could make a mistake like this.
    (Yes I do realise that AnchorStyles is a [Flags] enumeration)

    Rename AnchorStyles to AnchorStyle.
  • Problem:
    Layout management support is poor. Every control has a DockStyle and AnchorStyle property. This is bad cause it means that each control *knows* about where it will sit. This should be left up to a different class (the LayoutManager).


    Use the strategy design pattern. Every ContainerControl should have a LayoutManager property which set/gets the class responsible for laying out child controls.
    A default layout manager that supports the classic Anchor-Dock style can be provided to support VB programmers.
    This solution replaces enumerations (which are fixed) with an extensible way of adding support for new layout algorithms.
  • Problem:
    Most controls only have the default parameter-less constructor. For example, Button doesn't have constructors that takes the button text. This was probably overlooked cause the form designer doesn't need it.
    Some of us like to program GUIs manually with code rather than by dragging and dropping though.

    Add useful constructors to the standard controls.
  • Problem:
    There is no easy way for a control to capture the keyevents from its child controls (and their child controls etc). In Java/Swing, this is a simple flag you set when you register the action listener.
    Forms have the KeyPreview property which lets you do this for top level windows but not controls. KeyPreview is also pretty lame compared to what Swing lets you do.

    Add support for this by adding more advanced key event registration.
    (BTW You can hack around this using IMessageFilter).
  • Problem:
    ImageLists are used everywhere but they shouldn't be. Although image lists can improve performance (if you're still using a 386), they are much harder to work with than simply setting an "Image" property for each component. Good design should come first and optimisation can come later. There is no reason to drag the old Windows "ImageList" technology into the .NET era.
  • Solution:
    Don't use ImageLists. Everything that has an Image should have an Image property. Performance can be regained by internally caching Images.
  • Problem:
    Control borders aren't implemented using the strategy design pattern. This means it is up to the control writer to add support for borders themselves. This leads to more work for control writers and less features and flexibility for control users.

  • Use the strategy design pattern instead using &*$%@# hardwired enumerations.


  • Problem:
    System.Collections sucks. There has been an attempt design decent collection classes but the "engineer" gave up too soon.
    There is IList and IDictionary but there is no IQueue or ISet and too many classes in the .NET framework rely on concrete implementations of IList and IDictionary (such as ArrayList and Hashtable) rather than just use the abstract concepts of just IList and IDictionary. Any first year computer science student knows the importance of abstracting abstract data types (list, dictionary, stack) from their implementation (arraylist, hashtable, arraystack). One wonders where the guy who designed System.Collections "earned" his computer science degree...

  • Solution:
    Refer to first year text books (or Java2 documentation) and write decent collection classes.

  • Problem:
    CollectionBase is evil. It exposes its implementation to deriving classes through the
    InnerList : ArrayList property. The only time the names of ANY concrete collection class (ArrayList, LinkedList, Queue etc) should be used is on the right hand side of the new operator.

    Solution 1:
    Make CollectionBase take an IList in its constructor. InnerList should be exposed as an IList (not ArrayList) and should be assigned the value of the IList given in the constructor. This means CollectionBase can internally use any kind of IList for storage. [Microsoft probably overlooked this because they only supply ONE list implementation -
    ArrayList. Lame].

    Solution 2:
    Don't use
    CollectionBase. Make a generic ListWrapper class that decorates/wraps ANY IList implementing object. Then write a ListWithEvents object that extends ListWrapper. The ListWithEvents object will fire events for every action that IList supports (Add/Remove etc). Then use ListWithEvents where-ever you would normally use your CollectionBase derived class. This eliminates the need to create a new type just to intercept actions that occur on the List. You can use event handling instead. You can listen to IList actions of ANY list implementation (ArrayList, LinkedList etc).

  • Problem:
    IList doesn't have methods such as Sort or Search but ArrayList does. The operations Sort and Search are generic list operations and should not be made specific to a given implementation (such as ArrayList). If you have an IList implementation that isn't an ArrayList then there would be no way to perform a sort or Sort on it. Microsoft's solution is one of the most inelegant I've ever seen. To sort a LinkedList you would have to call ArrayList.Adapter to adapt the LinkedList into an ArrayList. Then you can call the Sort or BinarySearch method on the adapter. This is absolutely horrifying design. Both LinkedList and ArrayList are *lists* which by definition can be searched and sorted using a generic algorithm. There should be no need to adapt a LinkedList into an ArrayList to sort the list.

    Here's a simple illustration of the problem:

    abstract class Animal
    public abstract void Eat();

    class Cat
    public override void Walk() {...}
    public override void Purr() {...}

    public override void Bark() {...}

    Cat cat = new Cat();

    Dog dog = new Dog();
    dog.Walk(); // Can't do this!

    All animals can eat but only cats can walk. Later on in the design phase we realise that all animals can walk. What do we do? The natural solution would be to add Walk() to the Animal class.

    abstract class Animal
    public abstract void Eat();
    public abstract void Walk();

    class Cat
    public override void Walk() {...}
    public override void Purr() {...}

    public override void Walk() {...}
    public override void Bark() {...}

    Animal cat = new Cat();

    Animal dog = new Dog();
    dog.Walk(); // Yah!

    Based on their work with the .NET collection classes, Microsoft's solution would have been to provide a method that would allow you to adapt any animal into a cat. You would essentially have to turn a dog into a cat in order to make it walk.

    abstract class Animal
    public abstract void Eat();

    class Cat
    public override void Walk() {...}
    public override void Purr() {...}

    public static Cat Adapter(Animal a)
    // Turn animals into a cats here.


    public override void Bark() {...}

    Cat catdog;
    dog = new Dog();

    catdog = Cat.Adapter(dog); // Disturbing

    Shocking isn't it?

    Solution 1:
    Add Sort and SortedSearch to the IList interface and provide a default implementations for IList implementers. Sort would sort the list and SortedSearch would do an "optimized" search based on the assumption that the list is already sorted.

    This solution would allow lists to provide customized sorting and searching algorithms. Doing a BinarySearch on a LinkedList makes no sense since lookups have O(N) performance therefore LinkedLists could implement SortedSearch using a linear search algorithm where best performance would be O(1), worst performance would be O(N), average performance would be O(N/2).

    ArrayList.Sort -> Uses Quicksort O(N log N)
    LinkedList.Sort -> Uses Mergesort
    O(N log N))
    ArrayList.SortedSearch -> Uses binary search O(lg N)
    LinkedList.SortedSearch -> Uses linear search O(N)

    Solution 2:
    Make a new class called
    ListAlgorithms which contains static methods for performing algorithms such as SortedSearch and Sort on lists.

    This solution would allow application developers to choose the algorithms they want to use but this means that they need to know the concrete implementation of the list so Solution 1 would be better.

  • Problem:
    All arrays in .NET implement System.Collections.IList. The indexer (IList.Item) is documented to throw ArgumentOutOfRangeExceptions if the index given is out of range. The indexer on arrays throws IndexOutOfRangeExceptions instead of ArgumentOutOfRangeExceptions therefore breaking the contract with IList. This is dangerous because code working against ILists may randomly break when given array instances. This is a good example of why C# should have checked exceptions (aka throws clauses) which prevents this kind of abstraction destroying, contract breaking error.

    Make IList.Item implementers throw IndexOutOfRangeExceptions instead of ArgumentOutOfRangeExceptions (or vice versa).


Like everything else in .NET, the drawing namespace has a distinct lack of the application of even basic OO principles.

  • Saving image objects (System.Drawing.Image) isn't performed utilizing the strategy design pattern. The Image.Save method should take a strategy class that will automatically save the Image any any desired format. For instance, there could be a JpegSaveStrategy that would know how to take pixels produced by the Image (or some class like ImagePixelProducer) and and convert them to a JPEG stream.

    What Microsoft did was make the lame ass Image.Save method take an ImageFormat. The ImageFormat class is sealed, fixed and neutered and is pretty much just an enum. It is the Image class and not the ImageFormat class that does the saving. This means it is impossible to support saving images to formats that aren't supported by Microsoft. It also means that Microsoft can't add support for new ImageFormats without having to modify both the Image and the ImageFormat classes. The Image, ImageFormat and Graphics classes are very tightly coupled (which is very bad).

Java's Drawing2D and imaging APIs are outstandingly designed. Support for new Image formats (etc) can easily be added without having to modify a single class in the core API. This is .NOT the case with .NET.

Microsoft's insistence on not making their classes thin, hacked wrappers around their native APIs is going to kill them. This will become starkly apparent as incompatibilities between different versions of .NET appear. Come on Microsoft, GDI+ was designed for C++ NOT C#. WAKE UP.

It is clear from looking at the System.Drawing and System.Windows.Forms namespaces that .NET is NOT and was never intended to be a cross platform platform; it is is a cross platform framework. C# will be like C in that it will supply some basic features and leave the rest of the services (UI, Drawing etc) up to the native operating system (which will vary from OS to OS). Java on the other hand is very much a meta operating system/platform. Java supplies the same APIs on all platforms.

Friday, 15 June, 2007

Albert Einstein


Albert EinsteinAlbert Einstein was born at Ulm, in Württemberg, Germany, on March 14, 1879. Six weeks later the family moved to Munich and he began his schooling there at the Luitpold Gymnasium. Later, they moved to Italy and Albert continued his education at Aarau, Switzerland and in 1896 he entered the Swiss Federal Polytechnic School in Zurich to be trained as a teacher in physics and mathematics. In 1901, the year he gained his diploma, he acquired Swiss citizenship and, as he was unable to find a teaching post, he accepted a position as technical assistant in the Swiss Patent Office. In 1905 he obtained his doctor's degree.

During his stay at the Patent Office, and in his spare time, he produced much of his remarkable work and in 1908 he was appointed Privatdozent in Berne. In 1909 he became Professor Extraordinary at Zurich, in 1911 Professor of Theoretical Physics at Prague, returning to Zurich in the following year to fill a similar post. In 1914 he was appointed Director of the Kaiser Wilhelm Physical Institute and Professor in the University of Berlin. He became a German citizen in 1914 and remained in Berlin until 1933 when he renounced his citizenship for political reasons and emigrated to America to take the position of Professor of Theoretical Physics at Princeton*. He became a United States citizen in 1940 and retired from his post in 1945.

After World War II, Einstein was a leading figure in the World Government Movement, he was offered the Presidency of the State of Israel, which he declined, and he collaborated with Dr. Chaim Weizmann in establishing the Hebrew University of Jerusalem.

Einstein always appeared to have a clear view of the problems of physics and the determination to solve them. He had a strategy of his own and was able to visualize the main stages on the way to his goal. He regarded his major achievements as mere stepping-stones for the next advance.

At the start of his scientific work, Einstein realized the inadequacies of Newtonian mechanics and his special theory of relativity stemmed from an attempt to reconcile the laws of mechanics with the laws of the electromagnetic field. He dealt with classical problems of statistical mechanics and problems in which they were merged with quantum theory: this led to an explanation of the Brownian movement of molecules. He investigated the thermal properties of light with a low radiation density and his observations laid the foundation of the photon theory of light.

In his early days in Berlin, Einstein postulated that the correct interpretation of the special theory of relativity must also furnish a theory of gravitation and in 1916 he published his paper on the general theory of relativity. During this time he also contributed to the problems of the theory of radiation and statistical mechanics.

In the 1920's, Einstein embarked on the construction of unified field theories, although he continued to work on the probabilistic interpretation of quantum theory, and he persevered with this work in America. He contributed to statistical mechanics by his development of the quantum theory of a monatomic gas and he has also accomplished valuable work in connection with atomic transition probabilities and relativistic cosmology.

After his retirement he continued to work towards the unification of the basic concepts of physics, taking the opposite approach, geometrisation, to the majority of physicists.

Einstein's researches are, of course, well chronicled and his more important works include Special Theory of Relativity (1905), Relativity (English translations, 1920 and 1950), General Theory of Relativity (1916), Investigations on Theory of Brownian Movement (1926), and The Evolution of Physics (1938). Among his non-scientific works, About Zionism (1930), Why War? (1933), My Philosophy (1934), and Out of My Later Years (1950) are perhaps the most important.

Albert Einstein received honorary doctorate degrees in science, medicine and philosophy from many European and American universities. During the 1920's he lectured in Europe, America and the Far East and he was awarded Fellowships or Memberships of all the leading scientific academies throughout the world. He gained numerous awards in recognition of his work, including the Copley Medal of the Royal Society of London in 1925, and the Franklin Medal of the Franklin Institute in 1935.

Einstein's gifts inevitably resulted in his dwelling much in intellectual solitude and, for relaxation, music played an important part in his life। He married Mileva Maric in 1903 and they had a daughter and two sons; their marriage was dissolved in 1919 and in the same year he married his cousin, Elsa Löwenthal, who died in 1936. He died on April 18, 1955 at Princeton, New Jersey.

One of only three existing manuscripts (two of them are housed at the Albert Einstein Archives) which contain Einstein's famous formula, E=mc². Einstein's formula, which describes the relationship between energy (E), mass (m) and the speed of light (c), derives from Einstein's special theory of relativity. This theory postulates that time and space are relative - how we measure time and space depends on our state of motion relative to other observers. The formula E=mc² first appeared in an article by Einstein in 1905, using a different notation, and in 1907 he fully generalized the concept to the equivalence of mass and energy. The implication of the formula thus became that a small amount of matter could, in principle, be converted into a vast amount of energy. The realization of this principle in practice became a possibility in the 1930's with the discovery of nuclear fission, which led ultimately to the development of nuclear weapons. After the Second World War, Einstein's formula became synonymous with the nuclear age. The popular science magazine, Science Illustrated, asked Einstein to write this article. In his choice of the title, "The Most Urgent Problem of Our Time", Einstein alluded to his support for the nuclear disarmament movement.