Real News. Real Commentary. Real Life. RSS 2.0

— Dan Tohatan
# Monday, February 15, 2010

Why C++ Sucks (Part 2)


Recap

First of all, let me clarify that I think C is a great language and excellent for the development of low-level system software. I think C++, specifically, adds an extra unnecessary layer of complexity which makes it less suitable for low-level work but in some cases it's the only option. I would readily choose C over C++ for low-level software projects (e.g. drivers).

When dealing with C code, I would aim to write as little code in C as possible and provide an interface for writing the remainder of my code in another "safer" language, such as C# or Java. By "safe" here I mean something that is detached from the OS, so that it has a lower risk of corrupting the system's memory or file system upon failure. Again, C# and Java run in virtual machines which provide an extra layer of safety should things go horribly horribly wrong. The layer of safety may not be perfect, but it's better than having no layer of safety at all.

Also, when I said C++ sucks (sort of), I meant that C++ sucks for most types of applications (e.g. GUI or web applications). There are some cases where C++ is a decent choice, but those cases are rare and limited in scope. For the most part, C++ is just plain awful, because it consumes more time and produces more lines of code than either C# or Java. It also induces programmers to produce substandard code and has the inherent property of creating very difficult-to-debug code.

There are certainly cases where using C++ is unavoidable. When such a case arises, it does not usually mean that C++ as a language is in some way superior. It just means that C++ is not completely useless. I still write C++ code occasionally, because I have to.

The Debate Goes On

Recently I came across an article that attempts to refute my claim that, in most cases, C++ sucks.

I have a couple of remarks related to that article:

"What do you do when writing cross-platform code in C and you need to make heavy use of the filesystem?"

I assume by "heavy use" here you mean low-level operations. In that case, you need to make a file system driver in C (or whatever language the OS supports for drivers) and expose APIs that can easily be called from a higher-level Java or C# client application. Again, minimize the integration between high-level application code and low-level driver code.

"On that note, nobody, and I mean nobody should be using C++ without Boost"

If that is the case, why is Boost not a feature of C++? Maybe it will make its way into C++0x? The very fact that Boost exists indicates that C++ is a deficient language. Boost is merely a patch over those deficiencies. And when I talk about C++, I'm also referring to the standard library as well as the language itself.

"I guess the author has never worked on embedded software or real time systems. Or games for that matter. Or I guess anything other than canned business software."

Actually I have built games using DirectX in the past. I can confidently say that C++ was not needed for any feature. Given the extra time that C++ adds to the development of any app, being able to use any other language (and minimize the use of C++) is quite important.
Here is a simple 3D demo I built with OpenGL and Java in 4 intensive days of coding: http://www.dacris.com/article.aspx?name=demos. I probably would not have been able to perform such a feat with C++.

"C++ has a keyword called sizeof() that lets you determine how big a pointer is."

Again, that's nice, but I'd rather not use pointers and not write sizeof() statements all over the place. The time I save by not thinking about pointers (and by not reading code that contains pointers) is enormous.

"Perhaps an even better answer is in order though. I won't use any Gui toolkit, because I won't develop GUI code in C++. Why would I use the language for something which it doesn't excel at?"

Exactly. If you're content with building console applications, use C++. No problem. But for any kind of UI, C++ just sucks.

"C++ has a very strong, flexible type system."

Flexible, yes. But the problem is it's also lacking some very useful features compared to C# or Java. For example, how do you enumerate a class's fields or properties in C++? How do you detect that class A inherits class B at runtime, or get an object's type at runtime? In C# this is called "reflection." There is nothing like it in C++. For this reason, it's very difficult to do generalized serialization in C++. In C# and Java you can literally serialize any type.

"Code generation"

I can't think of any reason why you would ever want this. Macros and templates are a symptom of bad design. Instead of using code generation to deal with repetitive code, why not build a reusable component? Generated code is hard to maintain, hard to understand, hard to verify, and hard to debug.

Write as Little Code as Possible

Let me end by saying, I'm not a "substandard programmer." I'm merely a lazy programmer. I like to write as little code as possible. I keep track of the lines of code in all my projects, to make sure that number stays low. I guess if I was paid by KLOC I'd be pretty broke.

Monday, February 15, 2010 9:41:33 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] - Trackback
.NET | Commentary | Personal | Technology
# Sunday, January 17, 2010

Windows 7 on Older PCs


I would like to take this opportunity to encourage users of old PCs (pre-2005) to take extra precautionary steps before installing Windows 7.

Otherwise, you could end up baking your hardware. Yes, baking, in the oven.

How I ended up baking my laptop:

I installed Windows 7 on an older Toshiba laptop (from 2004) with a GeForce Go 5200 graphics card. First, it was not recognized - Windows 7 actually decided to use the Standard VGA Adapter driver for the card, which forced me down to 1024x768 resolution and extremely slow rendering. Well, I decided to look for a driver. Toshiba didn't have one on their site, NVIDIA no longer supports the 5xxx series, so I ended up finding a shaky third-party (modded) driver and modded it a bit myself to get it to actually recognize my card.

So after all that, I installed the custom modded driver and it seemed to work great at first: I even had Aero Glass! But little did I know there was a major problem lurking in the shadows... A few days after installing the new driver, I start up the laptop and it starts displaying columns of random flashing characters (at the BIOS screen). Immediately I concluded that this was a video card problem - it had happened to me before, with a GeForce 4 Ti4200 card.

Great, so now I had a dead video card. I looked around the web for people who had experienced the same problem, and found one who took his laptop to a repair shop and the technicians there diagnosed it as a "BGA failure." So I looked for BGA-related problems and found what seemed to be a re-occurring theme on various forums: "bake at 375*F for 5-10 mins". Surprisingly, those who tried it said it actually worked!

But how does it work? The BGA (Ball Grid Array) is what a video chip is most often connected to. This thing is just an array of tiny balls of solder that can melt at very low temperatures (even 120*C). When the video chip gets insanely hot (like over 100*C), it can warp the BGA so much that the chip disconnects from the balls and you end up with the problem I had (random characters at the BIOS screen). The solution, apparently, is to heat up the entire PCB (in this case the motherboard) evenly at a high temperature, so that the solder melts and reattaches itself to the chip. The prescription, in my case, was to bake at 375*F for 7 minutes.

Of course, I had to remove anything that might melt or explode - like batteries. I made sure to remove even the CMOS battery and remove all attachable parts (RAM, hard drive, etc.). I only baked the actual motherboard. But at the end, it worked! The video is fixed now, thanks to BGA baking!

The problem was caused by Aero Glass overheating my card. I'm 99.9% sure of it. And I'm also 99.9% sure that's why NVIDIA doesn't have any official Vista / 7 drivers for it. So immediately when I booted up my laptop after baking, I booted straight into Safe Mode, removed the graphics driver, and rebooted into Windows 7. Then, I reinstalled the graphics driver and made sure I was on the Windows 7 Basic theme, without Aero Glass. I also disabled the DWM service, so that there is no freak occurrence where Aero Glass gets re-enabled.

Precautionary steps that would've saved my behind:

Like I was saying, with Windows 7 on older hardware it's very important to take a few extra precautionary steps:
  1. Run the Windows 7 Upgrade Advisor. Ensure that your essential hardware (the stuff you can't boot up without) is supported.
  2. Take an inventory of your hardware. For me, the easiest way to do this was to just run Dacris Benchmarks (version 8.0) and create an HTML report under the System Information tab. This makes it much easier to find drivers online when everything in Device Manager is listed as "Unknown." But, if you have perfect memory, you don't need to do this.
  3. Make sure you download any necessary network adapter drivers before you install Windows 7. Otherwise, you won't have Internet access. Usually the Windows 7 Upgrade Advisor will tell you if you need to do this, but do it even if it doesn't tell you - just in case - unless you have another PC connected to the Internet and a USB key.
  4. For hardware that is shown as not compatible in Windows 7 Upgrade Advisor, try to find official Windows Vista drivers for it. If no official Windows Vista drivers exist, and the device is essential, you may want to reconsider upgrading to Windows 7.
  5. For software that is shown as not compatible in Windows 7 Upgrade Advisor, try to find a newer version online that supports Windows Vista. If no such version exists, and the software is essential, you can still upgrade to Windows 7 but the software will probably need to be run in XP Mode. While XP mode is great, there are some things it can't do - like Direct3D. So if the software in question is a game, you may want to keep Windows XP. In that case, I would recommend dual-booting Windows 7 and Windows XP.
Now, in fairness, I couldn't have run the Windows 7 Upgrade Advisor on that Toshiba laptop I mentioned, because it had no working OS at the time (the reason I installed Windows 7 was because XP died). I should've really just reinstalled XP and then run the Windows 7 Upgrade Advisor.

A side note - hardware manufacturers (especially NVIDIA) have failed us:

While I was thinking about baking my graphics card, I had a thought: was it really the fact that Vista had such a different driver model that caused hardware manufacturers to produce unreliable drivers? Did hardware manufacturers really not have enough time to adapt to Vista? I remember Microsoft in 2005 mentioned that any PC made in 2005 or later would be able to run Windows Vista. So hardware manufacturers in fact had 2 years to produce Vista drivers. The Vista development cycle lasted 5 years. Plenty of time for IHVs to get involved, learn the Vista driver model, and develop drivers in consultation with Microsoft.

So who really failed here? Microsoft? Was NVIDIA's discontinuation of support for the GeForce 5xxx line a Microsoft decision? Who is to blame for NVIDIA's inability to produce drivers? I would say it's NVIDIA that's to blame here. I've had so many NVIDIA cards fail on me: I witnessed a friend's NVIDIA card go up in flames, literally, then my own NVIDIA card did the same thing! Then, I had an older NVIDIA GeForce 4 Ti card that died with the classic BGA failure, then I had this latest failure: another NVIDIA card. That's four NVIDIA cards, three of which were mine. So out of all the NVIDIA cards I've ever had (about 5), only two remain. Now, I've had my share of ATI cards (roughly 5) and not a single one has ever failed. Not one.

Sorry NVIDIA, but I'm afraid I must buy ATI cards from now on. Sure, NVIDIA's drivers are more polished, and sometimes NVIDIA wins in terms of performance, but the cards rarely last very long. I would urge anyone who is thinking of purchasing an NVIDIA card to think twice and consider the ATI alternative, and think of which card you'd most likely have to bake. Now, of course, if you like baking, NVIDIA is your friend. :)

Sunday, January 17, 2010 2:24:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | History | Personal | Technology
# Friday, January 15, 2010

Windows 7 Smartphone to be Revealed at Mobile World Congress


Microsoft is keeping unusually quiet about their mobile strategy these days. From the various stories I've been reading on the Internets, it looks like MSFT is set to announce a major breakthrough at the Mobile World Congress next month that has the potential to be an iPhone killer.

My prediction: The first Windows 7 smartphone will be announced at the Mobile World Congress, along with APIs for smartphone programming on Windows 7 that match the APIs provided by Apple for the iPhone.

But, we'll just have to see...

Friday, January 15, 2010 11:26:41 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | Technology
# Saturday, January 09, 2010

Technology Innovations of the Last Decade


KEY TECHNOLOGY INNOVATIONS OF THE 2000s THAT MOST OF US USE EVERY DAY:
- LCD monitors and TVs
- Solid State Drives (SSDs)
- Cloud computing
- Wireless networking (WiFi/802.11g)
- Multi-core processors
- USB flash drives
- Streaming audio / video
- Torrents
- Online game consoles
- Touch screens
- Bluetooth

KEY TECHNOLOGIES THAT DIED IN THE 2000s:
- Floppy disks
- CRT displays
- Modems
- DOS games
- VHS tapes

PREDICTED TRENDS FOR 2010s:
- Software development re-focuses on hardware limitations & performance optimization (yes, hardware is still very limited!)
- Streaming 3D - enormous worlds with terabytes of content loaded from the web in real-time on your mobile phone or gaming console
- Pen-like computers & 3D glasses - this is the next logical combination of input/output devices overtaking the old PC & monitor
- Popular novels become 3D-ified - entertainment now puts YOU in an immersive 3D world of fantasy - be on Mars battling aliens
- Enhanced vision - while you wear 3D glasses, your PC will see the real world for you in many ways: real, infrared, X-ray, and so on
- The OpenWorld3D project: a perfect online replica of the entire Earth as a 3D world (with buildings, streets, cars, weather, etc.)
- Collaborative 3D modeling online - 3D model wikis are born: allowing the online community to build 3D models collaboratively, online
- 3D will be THE buzzword of the decade, like "online" was for the last decade; expect highly immersive & realistic 3D worlds
- Flexible paperlike screens allow creation of rollable (and maybe even foldable) tablet PCs and phones - OLED will make this happen
- The data web: a computer-friendly version of the entire world wide web, allowing greater sharing of data between sites
- The Internet goes 3D: toward the end of the decade, expect more and more websites to be full-blown 3D worlds

Quick! How many times did I mention 3D?

Saturday, January 09, 2010 12:28:05 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | History | News | Technology
# Sunday, December 27, 2009

Philosophical Bull and Gnostic Brain Flatulence


Is time linear?
Does every interval of time contain the same amount of information?
What does time contain anyway?

Time is a container for change. Time contains the delta between one state of the cosmos and another. Each finite interval of time contains within it the amount of change that has occurred from the beginning of that interval to the end of that interval.

In a sense, change is novelty and novelty is change. Novelty is merely a synonym for change. So when we think about novelty theory, to refer back to the work of Terence McKenna, we're really analyzing the content of time.

We know that the content of space is matter, and energy. But what is the content of time? It's a perplexing question for those who cannot see the logical conclusion that time in fact contains information. For it is information that informs change. Information is nothing other than change, and change is information. Novelty is therefore information. We're running around in circles describing the same phenomenon with different words, each word trying to out-grandiose the others.

But the fact is simple and yet stunning: Time contains information, much like how space contains matter.

Now, we know another interesting fact from basic observation of the world around us, and that is that information is cumulative. You never lose information. This has been elaborated by Terence McKenna as well. Essentially, the fabric of time itself is cumulative. At every stage in the evolution of the universe, we have gone from a state of low complexity to a state of higher complexity. We've never "devolved" into a state of lower complexity. Complexity has always increased.

Well, what is complexity? First, it helps to understand how we obtain complexity. At the start of our universe, if we accept the big bang theory, the highest level of complexity in the universe was characterized by a primordial soup of electrons and elementary particles. From that evolved the first atom, clearly a structure with an order far more advanced than what had existed prior to its emergence out of the primordial ontos.

Now, this first atom, the hydrogen atom, contained a whole lot more information than its parts, or even the sum of its parts. Because the hydrogen atom has a logical structure far more elaborate than the logical structure which represents an electron. Indeed, it is this logical structure that we must talk about when we're talking about complexity and information. The hydrogen atom is an entity which requires far more information to describe than the electron or the proton alone. So basically, the primordial soup required a very small amount of meta-data (meta-information, or logical structure) to describe, compared to what followed (i.e. the hydrogen atom). This is where we get the notion of increasing complexity. Complexity is the measure of the quantity of information required to produce the simplest possible explanation of a particular physical phenomenon.

As the universe evolved further, we got more and more complex structures. We got other atoms, molecules, organic compounds, and then biological life, and finally social life; intelligent life. Each of these complexities builds on the previous level of complexity. Molecules build on atoms. Social life (cultural or intelligent life) builds on acultural, biological life. Microbial life builds on essential organic compounds. In essence, each new level of complexity contains within it all existing levels of complexity.

Thus, complexity is conserved. We can in fact emphatically state that complexity is never destroyed. It is strictly conserved.

So what does this all imply for the nature of time? Well, time contains within it descriptions of changes within entities of varying complexity. At the beginning of the universe, each second of time contained a only a very minute description of changes, because only a minute description was needed for the level of complexity at which the universe had arrived at that time. Basically, God only needed a handful of bits of information to describe a change in the state of the universe when the universe was still in its primordial soup state.

As the universe complexified, necessarily the amount of information contained within each second of time needed to increase, in order to completely describe the more complex universe that was emerging. Basically, each level of complexity required more information about the changes within that level of complexity.

Thus, as the universe cooled and complexified, time became more and more burdened with information, so that each moment of passing time contained within it more information than the previous moment.

This process continued to this day. With every passing moment, time "expands" to contain more information than any previous moment that has ever existed. This is a profound concept to grasp, with profound consequences for our perception of time. It means that our linear time assumption, the assumption that time is isotropic and linear - that each moment is the same as every other moment, and that each interval of time is qualitatively and quantitatively the same as every other interval - is absolutely patently false and misleading.

We have to ditch the idea that time is somehow plain, linear, and uninteresting. Time is extremely interesting, and ought to be studied by science like nothing else, because we don't have a sufficiently clear understanding of the nature of time.

But the interesting implications of this "expanding time" theory are many. This theory actually validates intuitively-derived beliefs in many cultures that time is accelerating, or that time is heading towards an ultimate end. In fact, even modern science has managed to create a theory mainly involving human culture and cultural progress which indicates that there may be a point in the not too distant future where all of our knowledge, having been preserved thanks to the law of conservation of complexity, leads to a point of infinite temporal acceleration - a point of asymptotic discovery and asymptotic change, putting an end to time itself. Indeed, this very idea has been prophesied by others, including the ancient Mayans with their apocalyptic 2012 prophecy, or the Christians, or even modern-day prophets like Terence McKenna, although I'm sure he would despise being called a "prophet."

We must challenge all of our dearly-held assumptions about time or else we will not proceed to make true scientific discoveries. Today, we carry notions about time that are akin to believing that the Earth is flat or that it sits atop the backs of four turtles. For example, we believe that causal connections can only exist from the past to the future. We have established one predetermined direction for causality. Yet, we can clearly observe retrocausal effects all around us that seem to defy the laws of physics and all too often get classed as mere coincidences or worse, paranormal phenomena. In fact, such occurrences should be observed experimentally and we should try to develop a theory for explaining such retrocausal phenomena as the appearance of 9-11 as a motif in various artifacts well in advance of the actual event which occurred on 9-11-2001. Other retrocausal phenomena include such cases as the flight of animals to safety prior to a devastating tsunami or earthquake. Anything that is often classed as premonition or prophecy ought to be investigated as a potential candidate for retrocausality - events from the future having causal links to events in the past. It's crazy to think that the future could have a causal influence on the past, as it means that the past is now just as malleable or perhaps more malleable than the future!

Anyway, I hope I've been able to shed some light on the strange nature of time and why what we humans often think is obvious is really not so.

I could probably talk further here but instead I think I need to actually summarize what I described:
  1. Time is a container for... change in information, also known as novelty. Necessarily, then, time has at least two dimensions.
  2. Complexity is conserved. Each new level of complexity builds on lower levels. Complexity is never destroyed or reduced.
  3. Time is non-linear and quite probably anisotropic.
  4. Time is expanding, with each one-second interval containing more information than any previous one-second interval. This is subjectively perceived as an acceleration.
  5. There may be an endpoint for time, consisting of an asymptotic acceleration of the rate of progress toward infinite complexity.
  6. Causality probably works both ways, even if it seems odd to us. Retrocausality seems to explain perfectly the phenomenon of prescience in some organisms.
Bend your mind, but be careful not to break it!

Sunday, December 27, 2009 4:38:11 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | History | Personal | Science | Technology
# Monday, December 21, 2009

IE 9: Will it be enough to make me switch from Firefox?


Internet Explorer 9 will be coming out soon. It is going to have hardware-accelerated rendering of web pages. In essence, it will use the video card (instead of the CPU) to render web pages. This means much faster performance, awesome effects (even 3D), and less CPU usage.

Channel 9 has posted a demo of IE 9. The video shows some of the awesomeness of this new version of IE.

So here are some highlights of what's coming:
  1. Web page rendering on the GPU (instead of CPU)
  2. Better standards support
  3. New JavaScript engine, with performance similar to Firefox
Here is a comparison of browser performance, from Ars Technica:

As you can see, IE 9 is now on par with Firefox and Chrome.

Not good news for Firefox. Or is it?

It seems the Firefox people aren't sitting idly by. They're busy implementing hardware accelerated rendering in Firefox 3.7.

So it's certainly going to be an interesting competition between IE and Firefox. It looks like the browser wars are on again.

Monday, December 21, 2009 8:22:47 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | News | Technology
# Thursday, December 17, 2009

Windows 7 Phones: Addendum


Not long after I posted my first topic outlining the idea of Windows 7 smart phones, I found this...

Razorfone: A Conceptual Windows 7 & WPF-powered Multi-Touch Phone Retail Experience

It looks like the idea of a Windows 7 phone is alive & well. While the "Razorfone" is a concept for retail environments (a kind of kiosk), it's nice to see others considering the idea of putting Windows 7 on phones.

One more piece of good news on the mobile phone front:

WIND Mobile Takes Off - National Post

WIND Mobile - www.windmobile.ca - has finally been given the green light in Canada. No longer will we be limited to the triopoly of Rogers/Bell/Telus. Hopefully, this means no more 3-year contracts and lower prices in general. Canada is the most backward country in the world when it comes to mobile phones, largely because of Rogers & Bell's huge political influence.

I urge all who are upset about Rogers or Bell to check out WIND Mobile and consider switching over. Actually, I urge all to check out WIND Mobile. From what I can see, their plans are quite cheap and straightforward.

Thursday, December 17, 2009 8:26:35 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | News | Personal | Technology
# Saturday, December 05, 2009

64-bit Windows: The Definitive Guide


1. How much memory does 32-bit Windows support?

I'll try to explain this as simply as I possibly can...

You can have as much as 64 GB of RAM with 32-bit Windows, but there will be a hole between 3 GB and 4 GB.

64 GB? Yes. How is that possible? Well, Intel processors for a long time have had a feature called PAE (Physical Address Extension) that adds another 4 bits to the 32-bit limit of Windows, making it effectively 36 bit.

But...
A few caveats:
- If you have only 4 GB of RAM, you'll see just 3 GB because of the hole between 3 GB and 4 GB.

- If your CPU doesn't have PAE, you're stuck with 3 GB as the limit. Go to My Computer - Properties (in XP) to verify you have "Physical Address Extension" listed in your system information.

Also, processes in 32-bit Windows will see 2 GB of memory. But they won't see the same 2 GB. They'll be moved around by Windows so that all of your memory gets used (it's called multitasking!). So there is no "2 GB limit" as some might have you believe. The real limit is 3 GB, or even more if you have PAE.

2. What is different in 64-bit Windows?

The first thing that's different, you can access up to 16 EB (exabytes) of RAM! That's 8 million 2-TB hard drives!

But there are a few more things you need to be aware of:
- 64-bit Windows uses up 60% more memory and disk space than 32-bit Windows due to the doubling of pointer size
- You may have trouble finding 64-bit drivers for older hardware
- 32-bit software will still run perfectly on 64-bit Windows, thanks to WoW (Windows on Windows) emulation
- 64-bit Windows allows you to access all 4 GB of memory when you have 4 GB installed (not just 3 GB like 32-bit Windows)
- There is no memory hole in 64-bit Windows
- Each process can use more than 2 GB of memory
- Some CPU-intensive operations will complete faster if they take advantage of 64 bits (up to 5 times faster!)

Overall, if you have 4 GB of RAM or more, you should install 64-bit Windows to get rid of the memory hole. If you have 3 GB or less, you should stick with 32-bit Windows, because 64-bit Windows will eat up 60% more of your precious RAM.

My Experience - Going from 2 GB to 4 GB

I'm running 64-bit Windows 7 on my machine, with 4 GB RAM. It runs much more smoothly than it did on 2 GB of RAM. I installed 64-bit Windows 7 on 2 GB of RAM. Don't do it. It caused my memory usage to go up from 50% to 80%. Now, with 4 GB, my memory usage is down to 40%.

So, if you have 3 GB or less RAM and aren't planning to upgrade it right away after installing 64-bit Windows, don't install 64-bit Windows. It will eat up too much of your RAM.

Saturday, December 05, 2009 8:20:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Personal | Technology
# Wednesday, December 02, 2009

D3: Free WPF Data Visualization


Today I just discovered a neat little WPF graphing library called D3 (DynamicDataDisplay).

It's amazingly architected so that it's fast and extensible. Although it requires .NET 3.5, I was able to downgrade it to .NET 3.0 by using LinqBridge, a free library that emulates 99% of Linq without requiring .NET 3.5.

Actually, LinqBridge deserves a topic on its own - there is literally no reason for you to require .NET 3.5 in your apps, unless you use Linq-to-SQL. Linq-to-Objects is 99% emulated by LinqBridge.

To .NET library developers: start distributing .NET 3.0 versions of your libraries using LinqBridge, so that my Vista users don't have to download .NET 3.5. Saves me a boatload of headache as an ISV.

So, back to the main topic. If you're looking for a WPF line plot library that's free or simply want an example of how to build a WPF control library the right way, just take a look at D3.

Those are my findings for today. I guess it's been an exciting day!

Wednesday, December 02, 2009 10:37:26 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Technology
# Tuesday, December 01, 2009

Windows 7 Phones: Coming Next Year!


So, it seems Moore's Law is at it again. And those who are not aware of it (by now) will be left in the dust. Read this article and you'll know what I mean.

First, I must warn you that you may be offended by reading this article. If you are an ardent fan of Google or Apple and/or a hater of Microsoft, you may not like what I'm about to tell you. That's fine. Just be prepared, if you do plan to read on.

Yesterday I installed Windows 7 on a 5-year-old laptop with 512 MB RAM and only 7 GB of free disk space. It installed (surprise!) and ran flawlessly! It even ran smoother than the XP installation I had on it before. Probably because with all the service packs, XP has actually become more bloated than Windows 7.

Now, I want you to note the specs: 512 MB RAM, 7 GB of disk space. Impressive. A high-end PC from 10 years ago would've had these specs. So literally, Windows 7 supports a decade of computers!

But what's more fascinating is the mobile arena. Currently, Apple is still dominant and yet still afraid to lose its iron grip on the iPhone. On the surface, Apple appears to be very friendly to developers, but behind the scenes they are the control freaks they've always been - I'm looking at you, Steve!

Anyway, there are quite a few frustrating things about the iPhone. First, you can only sell your app through Apple's app store and it has to be approved by Apple. Second, there is no Flash on the iPhone, and no web browser other than Safari. This ought to raise eyebrows and even get Apple into legal trouble like Microsoft got into trouble with IE and Windows, for supposedly abusing their monopoly. But it seems only Microsoft is the unlucky one.

Next we have Google's Android OS, which is a commendable OS. It has everything. It is, for mobile devices, like Windows is for PCs. It is open to developers and developers can share & sell their applications without Google's approval. The only "problem" with Android is that there are too many variants of it. I wouldn't really call this a problem. It's a natural drawback of having to support a wide variety of devices. I mean, look at Windows: Windows XP, Windows Vista, Windows 7, and do you hear Windows developers complaining about it? No. They've adapted to it. They expect it. Only Apple fanboys complain about "too many variants" of Android because they don't understand it.

Next, we have Windows Mobile. Or do we? Windows Mobile is laughably dated and limited. Microsoft seems to have lost it completely on the mobile front. But have they? Or are we all missing something that's actually staring us in the face? Are we missing the elephant in the room?

Yes.

Let me introduce you all to the elephant in the room. It's Windows 7. Yup. And it's moving to smart phones. Remember, I installed Windows 7 on a PC with 512 MB RAM and 7 GB of disk space. Why do you think Microsoft decided to actually support old devices this time, and not raise hardware requirements like before? Why do you think Microsoft developed multi-touch capabilities in Windows 7? Is it for all those giant useless tablets out there? Is it for all the giant useless netbooks out there? No! It's for MOBILE PHONES!

Suddenly it all makes sense. But wait, I hear you say, how can Windows 7 ever fit on a phone? Simple: There are smart phones today that have 512 MB of memory. There are smart phones today that are extensible (via microSD card) to as much as 32 GB of storage. Last but not least, is Intel's Atom processor. It's an x86 processor (just like the desktop ones) with speeds of nearly 2 GHz! But the best thing about Atom is, it's extremely low-power and low-heat.

So the situation is now ripe for Windows 7 to start transitioning onto smaller and smaller mobile devices. There are MIDs / UMPCs currently available with screens of 4.8" which is about as small as a PSP. They fit in your pocket. And they run Windows 7. The leap from here to mobile phones is tiny. There is no leap. It's a baby step.

In conclusion, if you thought Microsoft lost the mobile space, you are totally mistaken, and you'll be in for a shock next year. All the Android and Apple fans out there won't know what hit them. Better get on for the ride.

As for what I'm doing to prepare, I'm back developing client-side Windows applications. I use WPF and .NET. They are extremely easy and fun to work with. Microsoft has always had the best support for developers, which is what helped them gain (and maintain) a monopoly for so long. Windows has more software than any other OS, and will continue to do so for many years thanks to Windows 7.

Tuesday, December 01, 2009 7:50:03 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | History | News | Technology
# Tuesday, November 17, 2009

DoEvents really *is* evil!


Apparently some of my older blog articles were really quite popular, because today I stumbled upon something I wrote 5 years ago:
Application.DoEvents() - The call of the devil.

DoEvents messes up the normal flow of your application. If I recall correctly, DoEvents is asynchronous which means it terminates before the application has actually processed any outstanding events, so if you're using it in a procedure with many sequential statements, calling DoEvents causes a huge disturbance whenever it's called. Basically, if you find yourself needing to call DoEvents anywhere, think about starting another thread instead, or using asynchronous delegates.

Imagine this if you will: You have a button on your form that, when clicked, does some complex processing. During the complex processing it also intermittently calls DoEvents to keep the application's user interface "responsive" -- not the best method, I would have used async delegates, but we're talking about a mediocre programmer here. Anyhow, the user sees the application still responding and no indication that there's some processing going on. So the user clicks that button again WHILE the processing is going on! The button responds to the event and starts another processing thread but it isn't actually a thread here, I hope you get what I'm saying. So, like I said earlier, DoEvents screws up the flow of the application too easily.

I want to comment on this further, because I don't think I was really clear at the time.

DoEvents really is evil. Horribly, horribly evil.

In fact, the whole Windows Forms threading model is deficient. The fact that you can set a Label's Text property from any thread is a clear warning sign that something is wrong. This is only now becoming evident to me after having worked for a few months with WPF, which doesn't allow any such nonsense. It will throw an exception if you try to execute UI code on a non-UI thread.

DoEvents should have never been included in the .NET Framework, because it gives a programmer the illusion that you can get by without worker threads. You can't. If a programmer wants to keep the UI responsive while another task is executing, that programmer should use a background worker thread. To update the UI from that thread (to show changing progress), the programmer should call Invoke on the appropriate control and pass in a delegate that will be executed on that control's UI thread. Not only does this serve to keep things consistent, but it also reduces the chances of odd bugs related to threading (which are always difficult to troubleshoot).

So, in short, avoid DoEvents and do what good programmers do: use worker threads. WPF makes it easy (and dare I say fun?) to create & use worker threads, and it's perfectly safe. Windows Forms has a somewhat sketchy UI threading model, mainly because it still has to deal with Win32 API behind the scenes. This is also a reason why you should migrate to WPF and stop releasing production software built with Windows Forms. The sooner Windows Forms dies, the better.

Tuesday, November 17, 2009 8:15:46 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Personal | Technology

Call of the Devil: System.Diagnostics.Process.Start


So today will be the last time I use System.Diagnostics.Process.Start without explicitly setting UseShellExecute to true.

Why?

Oh, it started out innocently enough - I was building a simple load testing tool in C# to load-test a custom ASP.NET HTTP handler I was implementing. The tool would basically run wget many times to simulate HTTP requests. Don't know why I didn't just use System.Net.WebClient (because I certainly could've), but I guess I just had wget on my mind.

Anyway, so the tool ran fine but it slowly leaked away memory and handles. Initially I thought it was my HTTP handler. So I ran it with an invalid URL, just to test if maybe the load testing tool itself had a memory leak. Sure enough, it did!

The leak seemed to be coming from my call to System.Diagnostics.Process.Start.

So I did a quick Googling and it turns out that System.Diagnostics.Process.Start causes the child process to inherit handles from the parent process. That means, whatever process you spawn (e.g. Internet Explorer), that process gets all of the handles owned by your process! So even if you free up handles in your process, if the process you spawned is still running, your handles won't really be freed because the child process is supposedly using them. A more detailed explanation can be found here.

As it turns out, the CreateProcess call in System.Diagnostics.Process.Start has a certain parameter that is hard-coded: the bInheritHandles parameter is hard-coded to true. Well, that's a shame now isn't it?

So what can we do instead?

I would prefer any solution except calling the CreateProcess API directly, since API calls are ugly. One option is to set ProcessStartInfo.UseShellExecute to true before calling Process.Start. However, you won't be able to redirect stdio. In fact, if you want to redirect stdio you either have to accept MS's buggy implementation or roll your own with pipes, API, and all that funky stuff.

One last thing...

With the Process class, be sure to explicitly Close the process object (not just Dispose) after starting the process or after you're done using it, because otherwise the process handle may leak.

Tuesday, November 17, 2009 7:54:34 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Technology
# Thursday, November 12, 2009

Visual Studio 2010 is a .NET App


Not even two months after I wrote this article, where I described why desktop .NET is finally ready for take-off, the news is out that Visual Studio 2010 is a managed (.NET) application. Finally, Microsoft are setting an example.

What does this mean to you, the developer? It means that if you've been sitting on the sidelines regarding .NET and are still coding with *gasp* MFC, or Win32 API, it's finally time to move to .NET.

This also means that WPF is here to stay, unlike its predecessor - Windows Forms. Many early adopters of .NET were under the impression that Windows Forms would be supported and actively developed for many years. As it turned out, Windows Forms was a dead end.

The good news: WPF is now fully endorsed by Microsoft through Visual Studio 2010. This means WPF is finally mature enough for adoption. Plus, it's included in Windows 7 and Windows Vista. You don't even have to distribute the .NET Framework (provided you target version 3.0 and not 3.5 or 4.0). Visual Studio now makes it easy to target a specific version of the .NET Framework, unlike some of the early versions (VS 2003/2005).

Personally, I think we're going to start seeing an explosion of new WPF apps in the coming months. It could be like the explosion that happened with the iPhone (and I'm not talking about the screen).

These are the most exciting times for Windows developers since Windows 95.

Thursday, November 12, 2009 10:09:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Technology
# Thursday, October 08, 2009

Making Bad Ass-umptions


Let's talk a bit about assumptions and what can happen if you make wrong ones and never bother to correct them. The example in this article will, fittingly enough, be Microsoft - and specifically .NET.

.NET is supposed to be an OS-independent API. It was designed to hide most of the OS behind a convenient, consistent API that does not expose any underlying OS details. That's what I mean by "OS-independent API." But it turns out, Microsoft is still a little confused about what "OS-independent API" really means.

Starting with .NET 1.0, Microsoft has continually made the assumption that the less unmanaged code they had in their implementation of .NET, the better. This is best evidenced on this web page - called "Is .NET a Win32 Wrapper?"

In reality, an OS-independent API does not have to be entirely OS-independent. Only the API - the part that the programmer sees - is OS-independent, hence "OS-independent API". The implementation need not be OS-independent, and should not be.

The developer does not care how many unmanaged calls are happening behind the scenes. The only thing the developer cares about is the API, because the only thing the developer sees is the API. As long as the API is OS-independent, the implementation of the API does not matter.

So why is Microsoft reinventing the wheel by reimplementing basic controls like buttons in Windows Forms, and then again in WPF? Why not just create a thin wrapper around Windows API, like SWT? (SWT, by the way, is a thin Java wrapper around standard OS controls like Button, TextBox, etc.)

Right now, .NET is completely lacking a thin wrapper for Win32 API. WinForms and WPF are both thick wrappers. They only call the Windows API for extremely low-level tasks like GDI. They are more like Java Swing than SWT. The trouble is, when you build a thick wrapper, you inevitably run into performance issues and UI inconsistencies. You're also reinventing the wheel, often unnecessarily.

Another issue you run into when building a thick wrapper is size. SWT is 2 MB (small enough to fit into the L2 cache of a Core 2 processor!) because it's a thin wrapper. You also have the issue of maintainability: a thick wrapper is more complex and therefore harder to maintain than a thin wrapper.

Sure, there are advantages to thick wrappers. I'm not sure exactly what they are, but there probably are some. However, developers often prefer simple, clean, and small applications. And so do users. So, Microsoft, where is the SWT for .NET?

Thursday, October 08, 2009 7:33:58 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Technology
# Monday, September 28, 2009

Desktop .NET Finally Ready for Take-Off


It was 2002. I had just finished developing Dacris Benchmarks 4.9 using pure Win32 API. I was proud of myself. It was the first 100% Windows API application I had developed. No more Borland OWL crutches. It was a clean start. The application went on to become a phenomenal success. But something was not quite right in the land of Windows development. A major new player was just entering the arena. Its name was ".NET", previously known as NGWS, and it promised to change everything.

From the beginning it was clear that this .NET thing was not going to be popular right away. It was a gigantic change at a time when the world was still trying to recover from the collapse of the dot-com bubble. It was, furthermore, a behemoth in the days when broadband Internet was still a rare commodity. Weighing in at a hefty 23 MB, the .NET redistributable was just too much of a penalty to pay for the convenience of developing "managed" applications with a truly object-oriented language.

From the developer's perspective, .NET was amazing from day one. Sure it still had some kinks which ultimately led me to develop NetXP, but as a development paradigm it completely overshadowed the archaic Windows API. It was a dream come true - garbage collection, Windows Forms, remoting, and a whole bunch of other goodies.

.NET immediately took off on the web. Within one year, nearly every major company was developing ASP.NET web apps with .NET 1.1. The release of Windows Server 2003 only served to accelerate that trend even further. .NET web development soon reached a frenzy as the advantages of ASP.NET over other technologies (PHP, JSP) became evident.

However, something was wrong on the desktop. Three years after .NET came out, virtually no .NET desktop applications were being developed. The reason? Most ISVs, especially the small ones, saw the gigantic size of the .NET framework and the support headache associated with its deployment as a major roadblock to adoption. Even though .NET was great for developers, it was not so great for end users.

The fact that Windows XP SP2 and SP3 did not include the .NET Framework only made the situation worse. For most ISVs, it was clear that if they wanted to develop Windows apps, they would have to continue using Windows API, until something better came along.

Well, something better finally did come along in 2007. It was called .NET 3.0 (or WinFX), and it was embedded in Windows Vista. Suddenly, the deployment obstacle to .NET adoption was removed. Now, there was really no reason for ISVs not to adopt .NET. Or was there?

The reason was one word: "Vista." This word soon came to be reviled among the Windows community. Nobody wanted to touch Vista with a ten-foot pole. The truth is, Vista was plagued with problems for at least a year after its RTM. Finally, in 2008, the initial Vista problems started getting resolved and users started adopting Vista at a more rapid pace.

Today, there is a two-word reason why .NET adoption on the desktop finally makes sense: "Windows 7." Windows 7, which includes .NET 3.5 by default, is leaner and meaner than its predecessor. Every PC that can run Vista can run Windows 7 and do so with better performance. In a few months, the combined market share of Windows 7 and Windows Vista will exceed 35%. It's practically there right now.

From an ISV's perspective, however, it is not only market share that counts. It is also the value per customer within that segment of the market. For example, a Mac user typically has 4 times more value than a Windows user because Mac users tend to buy applications more readily than Windows users. Now when it comes to Windows XP versus Windows Vista/7, the Windows XP user at this point is basically stuck in the stone age. The odds of a Windows XP user purchasing a new application are much lower than the odds of a Windows Vista/7 user purchasing a new application. The Windows XP user generally runs old applications on old hardware, and is very conservative when it comes to making new purchases. The result is that the value of a Windows XP user is (sorry XP users) generally lower than the value of a Windows Vista/7 user from the point of view of an ISV.

Anyway, to make a long story short, despite a market share of "only" 35%, Windows Vista/7 users are now actually a more important market for ISVs than Windows XP users. This is only now starting to happen, after about 8 years of XP dominance.

What does this mean for ISVs and the software industry as a whole? It means that .NET will finally be adopted on the desktop. .NET makes development much easier, there is no question about that. However, for a long time there was a question about whether Microsoft would embrace or at least continue to support .NET. That question has finally been answered. .NET is here to stay and the future for Windows applications is .NET. Windows API has finally come to the end of its life. It's an exciting time to be a Windows developer.

Monday, September 28, 2009 1:46:10 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | History | News | Technology
# Monday, May 25, 2009

What .NET Should Have Been


It was 2001 when I first started developing with Win32 API. Back then, Win32 API was the only way to develop a Windows application. Sure, you could use a variety of different wrappers, including MFC and Borland's OWL. However, the Win32 API was always at the core of the application. This resulted in applications having a very consistent look & feel. Every application looked like it belonged in Windows.

In 2002, a new phenomenon started, called the .NET Framework. The .NET Framework was supposed to be Microsoft's decision to improve developer's lives by replacing C++ with managed code (written in any language). At least that's what I hoped back in 2002. However, from the very beginning it became clear that Microsoft's intent was not to replace Win32 API with .NET but in fact to carry two separate development frameworks, and ultimately to confuse and alienate Windows users and Windows developers.

Let's look at what "mistakes" MS made with .NET that have been causing ongoing pain for Windows developers.

1. Not including .NET in Windows.

Microsoft has an ongoing policy of keeping .NET & Windows separate. For some bizarre reason, Microsoft will not distribute the latest version of .NET with the latest version of Windows. Windows XP SP1 could have included .NET 1.1. It didn't. Windows XP SP2 could have included .NET 2.0. It didn't. .NET should've been a required update from the very beginning. It should've been an inextricable component of Windows, just like IE. Though it's unclear which version of .NET will ship with Windows 7, what is clear is that when a later version is released, Microsoft will make damn sure that users won't even know about it.

2. Not making the Win32 API obsolete.

With Windows Vista, Microsoft could've made all new APIs available only to .NET developers. Why do that? To discourage Win32 API development. To make it clear to developers that .NET is the future. Starting with Vista, Microsoft should've moved all of its innovation into .NET. Instead, they added new features to Win32 API! Features that they didn't add to .NET! In other words, they showed that Win32 API is still the only way to develop Windows applications.

3. Not setting an example.

Microsoft could have migrated all of its apps to .NET. Office 2007 should've been entirely written in .NET. Visual Studio .NET (first version) should've been written in .NET! Microsoft should've set an example, that .NET is the future. Instead, they keep writing apps in MFC or Win32 API. Clearly, MFC and Win32 API is still the future. I challenge you to find any major Microsoft application written in .NET.

4. Reinventing the wheel.

Rather than using native Win32 API controls in .NET WinForms applications, Microsoft instead decided to reinvent the wheel, coding an entire UI toolkit from scratch using managed code. What for? Sun already did that! It's called Java!

The inconsistencies in look & feel in .NET are hideous, but even worse are the inconsistencies in behaviour. .NET 1.1 was notorious for its non-standard controls. It's the reason I developed NetXP. It's the reason why I had to write a gigantic .NET wrapper around Win32 API. .NET itself should've been that wrapper. Here's an exercise: Try popping up a balloon tooltip (a feature of Win32 API in Windows XP) in .NET 1.1.

This is the biggest issue with .NET, and Microsoft still hasn't fixed it. Take the XAML menu for example. It's totally different from the standard WinAPI menu. Even the ClearType looks different in a XAML app! This decision by MS not to enforce OS UI conventions will lead to a wide range of UI variation on Windows, and will ultimately lead developers (and users) away from Windows, and toward Mac or even Linux.

Conclusion - My Message to Microsoft

It's painful to develop apps in Windows API (or MFC) in 2009. You (Microsoft) could've changed that. You had the opportunity, with .NET, to create a new way of programming Windows. You blew it. Until you fix the 4 issues above, I will be programming in Java. Java is everything .NET is and more. Java is cross-platform, free software, and has a wider user base. Why should I limit myself to Windows when the choice I have is between Windows API (a 25-year-old technology) and .NET (a clone of Java that runs only on Windows)?

To those out there who remember Visual Basic, .NET is another Visual Basic. VB was great for RAD (Rapid Application Development). So is .NET. But the problem with VB was that it was non-standard. It didn't wrap the Win32 API well enough. The same is true for .NET. Now, if .NET was going to be cross-platform, I'd understand. But it was never intended to be cross-platform. Microsoft totally blew it with .NET. Developing a Windows application in .NET is as ridiculous as developing a Windows application in Visual Basic.

Monday, May 25, 2009 4:27:16 PM (Eastern Standard Time, UTC-05:00)  #    Comments [1] - Trackback
.NET | Commentary | History | Technology
# Saturday, May 23, 2009

Windows 7: A Review


Windows 7: A Review

By Dan Tohatan

In 1994, Microsoft unveiled a user interface that was truly revolutionary at the time. Code-named "Cairo", it was to become the interface of the new Windows 95 operating system. When Windows 95 came along in July of 1995, the new shell (Windows Explorer) totally surpassed the old Program Manager / File Manager combination, which had been a staple of Windows since Windows 3.0. Windows 95's unparalleled multimedia capabilities became evident very quickly.

I remember how amazed I was when I first saw the Windows 95 boot-up screen, in all its 256-color beauty. Microsoft got it. The world was moving toward true color displays. No longer were UIs going to be boxed into the 16-color (or less) paradigm which had dominated displays since the 1980s. A revolution was beginning, and Windows 95 was going to lead it.

Fast-forward to the present, and a new revolution is beginning. This time, it's a move from bitmapped graphics to vector graphics. It's a move toward 3D-accelerated vector graphics. You can see it in the new Web 2.0 websites out there: smooth gradients, subtle 3D effects, animations, and heavy use of mouse-over events. You could call this the second UI revolution.

Windows Vista was supposed to bring in this new UI revolution. However, Microsoft bit off more than it could chew. Vista over-promised and under-delivered. The result was, as everyone now knows, a total disappointment. Today, almost 3 years after Vista's release, the market share held by Windows Vista is around 25%. The market share held by XP? 60%. What's even worse for Microsoft is that Mac OS X and Linux have been gaining feverishly thanks to Vista's lack of stability and incredibly slow performance.

Windows 7 is what Vista should have been. It is to Windows XP what Windows 95 was to Windows 3.1. I would encourage everyone reading this review to go out and download & install the Windows 7 Release Candidate. I have (so far) only used the OS for a day, and I am extremely impressed.

The most interesting thing about Windows 7 is that it's the first Windows OS to have lower system requirements compared to the previous version. While it has been demonstrated that Windows 7 can be installed on a system with only 512 MB RAM, it's not a realistic requirement if you want to run the latest applications. A system with 1 GB of RAM or more should be able to run Windows 7 at least as fast as it would run Windows XP. Also, while Windows 7 requires 16 GB of free disk space to install, it only ends up using about 9 GB, which is far better than Vista.

I'm going to start this review by looking under the hood - at how the OS performs. One of my biggest problems with Vista is the size of the WinSXS folder. Apparently, in order to solve "DLL hell", Microsoft decided to keep every single version of every DLL forever. Before I installed Windows 7, my Vista SP1 WinSXS folder was 7 GB, with no apps installed. This was after I ran the SP1 clean-up tool. Before that, it was over 10 GB. With Windows 7, it's only 4 GB. Seems MS was able to cut out a whole 3 GB from the WinSXS folder, which is excellent.

Another thing that MS improved with Windows 7 is the speed of shutdown. While boot-up is about the same as Windows Vista, shutdown is noticeably faster. Also, the speed of installation (if you're doing clean install) is much faster than a comparable Vista installation. I remember when I installed Vista that it seemed to take longer than an equivalent XP install. Windows 7 actually installs faster than XP.

I remember with Vista having issues with the TrustedInstaller. It would just start up randomly and my hard drive would start thrashing, and my system would slow to a crawl. Windows 7 seems much more quiet (in terms of hard disk activity) and CPU usage is actually at 0% most of the time! It's incredible how Windows 7  release candidate (not even final release) outperforms Vista so much. The final release will probably be even better.

Moving on to the UI, the first thing you notice about Windows 7 is how much cleaner it is compared to Vista. Gone are the incessant notification popups or the glaring UI inconsistencies that made Windows Vista such a pain to use. UAC is totally gone. In Vista, just about everything you did would pop up a UAC dialog. It was extremely annoying. In Windows 7, the UAC prompts, even where you would obviously expect them (e.g. Task Manager), are totally gone. It's a mystery what MS did here, but it's a really good thing. I really hope that this is permanent and that UAC doesn't come back in the final release.

The other pleasant surprise I had with Windows 7 was that MS added new accessories! This is the first time MS did something like this since (probably) Windows 95! Not only that, but the existing accessories (Wordpad, Paint) have been totally revamped. You will also notice the UI consistency in Windows 7 (versus Vista). Finally, I'm pleased to announce that MS has finally removed the "Install New Font" dialog that still had a Windows 3.0-like UI. This calls for a major celebration! This dialog existed in Windows - unchanged - since 1990! Now it's finally gone!

What I really like about Windows 7 is its new Libraries feature. A library is a special folder that is actually the aggregate of multiple folders. Libraries makes organizing files so much easier. Microsoft also implemented a fairly complete set of filters (or views) for each library. For example, you can view your music by artist or by album. The views are customized to fit each library type. For example, the Music library only has views that are relevant to music.

But it's the small things that make Windows 7 so impressive. For example, when copying files, the progress is shown in the taskbar as the background of the taskbar button, and it updates in real time. So you can just look at the taskbar to see the progress. You no longer have to Alt+Tab. Also, the extensive use of mouse-over effects really adds to the usability of the OS. For example, hovering over a taskbar button shows you a preview of the window that corresponds to that button.

Windows 7 is probably the first Windows OS for which screenshots aren't enough. This is because of the extensive use of mouse-over effects. Screenshots just don't do it justice. When I looked at various screenshots of Windows 7, I thought "what a bad UI design!" But in practice, the UI design is very usable. Not only is it usable - it's fun! This is the first time I'm having fun using Windows since Windows 95!

To conclude, you really have to use it to fully appreciate it. There are many pleasant surprises in this OS. When I switched to Ubuntu back in 2007, I never thought I'd see another version of Windows as great as Windows XP was. Well, it turns out I was wrong. Windows 7 is the new Windows 95. Windows XP was an evolutionary change. Windows 7 is a revolutionary change. Windows 7 leaves its competition in the dust. In the end, Microsoft still gets it.

Saturday, May 23, 2009 6:37:39 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | News | Technology
# Tuesday, April 14, 2009

2009 Technology Trends


APRIL 2009 --
The economic downturn leaves no company unaffected. MSFT is finished.
July, 2008 Bill Gates stepped down. The company will not release one single product
worthy of investigation this year. IE 8 has been surpassed by Mozilla and there is
absolutely nothing MS can do to resurrect IE. The major theme this year will be the
death of Microsoft.

In the open source arena, Linux continues to make advances. At some point this year,
Linux market share will rise dramatically. There may be an event which triggers
a mass migration to Linux on the desktop. My belief is that an amazing software
product comes out which only runs on Linux. People are so drawn to this product that
they are willing to ditch their Windows OS (or at least dual-boot Linux with it). The
product will be intentionally designed NOT to run on Windows.

In the hardware realm, Intel will be going the slow & steady route. AMD is finished.
The video card industry is finished. They've pushed it too far. PSUs can't handle
3 cards in SLI. It's pure madness. NVIDIA will suffer this year, and so will AMD,
because of its ownership of ATI. All graphics card manufacturers will suffer. I don't
think we will see any further advancements this year in graphics hardware.

In addition, the recession means less spending on high-end hardware. Therefore, any
high-end hardware product will drop in price dramatically. Look for deals on top-notch
video cards and super-fast memory. DDR3 will get very cheap, very fast.

I almost missed it - the biggest story this year will be Apple. Specifically, the
iPhone is taking over the world. Those who were slow in adopting blackberries or other
smart mobile devices will now swarm to the iPhone. The iPhone will replace the iPod,
cell phones, digital cameras, video cameras, and many other portable devices. The
iPhone is part of the new iLife trend which is all about unifying mobile devices into
one incredible everyday-life-enhancing device that you can take with you everywhere.

Continuing the trend with the iPhone, it will soon start to replace devices used in
industry. For example, on construction sites, the inclination of the ground will be
measured using an iPhone. In your car, instead of having a real map, an iPhone plus
Google maps will do.

The trend towards minification of laptops (i.e. netbooks & tablets) will merge with
the iPhone trend. The trend is towards a fully portable computer (i.e. a computer you
can carry in your pocket). This computer will be capable of having all sorts of devices
attached to it (as peripheral extensions). It will be a virtual sensor - an extension
of the human senses.

Touch is the biggest trend in terms of UI. Without touch, a screen is nothing. Every
screen is going multi-touch. There will be a shift toward touch-friendly UIs.

In the UI realm, there is a growing trend towards 3D-ization of everything, even the
web. I believe 3D accelerated web browsers are coming soon. Whoever makes the first
move into 3D-accelerated web browsing will become famous. All UIs will be
3D-accelerated. The exact form that this will take remains to be seen. The idea is
that a whole new concept of "3D layout" will need to be developed. Web 2.0 is a first
step in this direction, with its pervasive use of realistic 3D gradients. These will
soon be replaced with real 3D surfaces (perhaps designed with Bezier curves and
ray-traced). Yes - real-time ray tracing. It will be very exciting.

On the topic of ray tracing, I believe ray tracing is slowly going to overtake the
old polygon + projection model that we're all so familiar with. The reason? Ray
tracing lends itself to parallel processing. In particular, photon mapping will soon
be done in real-time and scenes in 3D games will be rendered with photon mapping, for
unbelievably realistic lighting. The photon map will be precomputed for static scenes
to save processing speed. Models (meshes) will be made using Bezier splines, so that
meshes will be totally smooth (no more polygons!). The result will be unbelievably
smooth surfaces. It turns out that with ray tracing, splines (curves) are much easier
to process than polygons! Bottom line - the buzzword (or phrase) these days in
graphics is "real-time ray tracing".

Because ray tracing produces such realistic graphics, I believe we're trending toward
a world where a lot of the images you see as design elements on websites and other UIs
will be ray-traced, either in real time or rendered once and saved as an image. You
can quite easily imagine a building contractor having on their website a ray-traced
image of the inside of a virtual apartment, with such perfect graphics that you would
instantly be amazed. Ray tracing will become the holy grail in graphic design.

The biggest trend rising in 2009 is the use of portable computers for entertainment.
This will grow, over many years. Rather than performance improvements, improvements in
hardware will most likely be focused more on functionality rather than performance.
You're going to start seeing a lot more innovative input & output devices in the
coming years, directed mainly towards entertainment & improving day-to-day life.

Projecting trends into 2010, Apple will dominate the mobile arena. MSFT is history.
In the server & business world, MSFT is being replaced by Linux at a rapid pace. The
ever-present need for standardization means UNIX is becoming the de-facto standard
OS, similar to how HTML became the de-facto standard web presentation language. All
new software is built for Linux or some UNIX variant (like Apple's OSes).

Graphics cards manufacturers will continue to suffer. Integrated graphics comes on
in a big way this year. Intel now manages to capture 90% of graphics performance with
its latest integrated graphics chip + integrated memory controller & DDR3 RAM. The
idea of a separate graphics chip falls by the wayside and soon graphics cards will be
a distant memory of an ancient past. Why have 1 GB of dedicated video RAM when the same
RAM, at the same speed, can be allocated from system RAM? Soon, the GPU + CPU will
merge into one unit, much like the way math co-processors disappeared back in the 1990s.

The biggest trend this year is the realworldization of the virtual world. The idea
of taking the desktop computer outdoors. Custom sensors will become an enormous market.
E.g.: Imagine checking your iPhone's UV sensor when walking out on the beach on a sunny
afternoon. Or imagine connecting your iPhone up to a telescope to align it perfectly
with the moon on a clear night. A whole new computer (the "real world computer") will
appear, for this purpose alone.

2010 is when I believe a "Microsoft" will emerge in the real-world computer realm.
Apple will have competition later this year. I'm not sure who will be that next Bill
Gates but I'm certainly a contender.

In 2010, computers will start to replace books for casual reading. Already the Amazon
Kindle is making huge headlines, but this trend will fully take off only in 2010, when
90% of newspapers go bankrupt and everyone starts reading the news on their new
real-world computer.

In 2010, the support-based software model becomes the only viable business model for
software. The idea is you pay separately for licensing and support/customization. The
idea is that by paying for support you're guaranteed that the company will provide
that support. In other words, many companies lose potential clients because those
clients are afraid that the company might go out of business or that they might release
a new version of the software tomorrow that is fully incompatible with the old version.
This is the nightmare of every IT department. Naturally, business models that make life
easier for IT departments will grow. The idea of "we guarantee that we won't go out of
business" is a very seductive one for any IT department.

The home computer will remain, but it will remain as a sort of appliance where
data can be centralized. Its sole purpose will be the centralization of data. In other
words, it will become more of a server.

What is the future in terms of hardware? By 2011, we should expect 22nm processors
with 4 to 8 cores. Clearly, the trend will be towards parallel computing and more
integration as I believe Intel will finally merge the GPU & CPU into one with its
new "Sandy Bridge" technology which comes out in 2011. This technology will be as
revolutionary for Intel as the "Pentium M" was (which then led to the Core 2).

Intel will rapidly become dominant in the area of graphics, forcing AMD to adopt a
similar strategy of integrating its ATI chips onto its CPUs. This may actually give
AMD a competitive advantage over Intel, because let's face it - Intel's graphics chips
suck compared to ATI. I believe at this point NVIDIA will be begging to be acquired,
and guess who will acquire NVIDIA? Intel!

So the biggest story in 2011 will be the rise of Intel to total domination of the
desktop computing world. On top of that, the trend towards innovative display devices
that started with touch screens will intensify by 2011. I believe we'll see the first
holographic or projective displays in 2011. The idea is the image is projected onto
any surface. Imagine a pen that projects the daily news onto an 8.5x11 piece of paper.

Another example of an innovative input device would be an exercise machine that is
designed to interact with your desktop computer (or game console). For example, a
treadmill that corresponds to a virtual car driving around a city. When you run
faster, the car goes faster. The idea is to turn physical effort into positive UI
feedback, thus producing positive reinforcement and turning people into fitness
junkies.

PC gaming will make a comeback. Game consoles have been slowly replacing PCs when it
comes to gaming. However, I think this trend may actually reverse. People will soon
discover that they can connect their PC to their TV and save the money that they
would otherwise have spent on a game console. Thus, PC-to-TV output devices will
become extremely popular. Also, on your PC you can obtain games for free (via
downloading) and you can obtain an unlimited number of games, and you can even make
your own games. Therefore, I don't believe that PC gaming is dead. In fact, I think
it will come back in a big way, mainly because of the current economic downturn
which I expect to last well into the next decade.

Tuesday, April 14, 2009 5:42:10 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | Technology
# Tuesday, February 10, 2009

Why C++ Sucks (Sort Of)


So I've met a couple of people (who shall remain nameless) over the past few weeks who insist that C++ is better than Java. I am truly impressed by the stubbornness of these people. So here goes. I'm going to argue once & for all why ...
OH NO! I'm not falling into that trap.

I'm just going to pose questions that any developer should ask before choosing either C++ or Java. NOTE: I'm not advocating just Java here. Mono has comparable features, or .NET if you don't care about cross-platform.

Before I start I'd like to mention that I was once a die-hard C++er. I started programming in C++ back when I was 11, but 5 years after that I found .NET and never looked back. So I technically have 5 years of experience with nothing but C++, and I have used it off & on and will continue using it whenever I absolutely need to.

1. Ant vs "make"

What's better? Ant or "make"? Would you rather write a Makefile (no extension) in a proprietary hard-to-read language, with a text editor like "vim", or would you rather write an XML file (build.xml) which could easily be generated by a tool (perhaps with a GUI)?

Secondly, which one has more capabilities? Ant or "make"?

2. Pointers

Do you really need pointers? Do you really need to convert integers (memory addresses) to objects? Are you willing to put up with the hassle of manually collecting garbage (using "delete" statements)? How are you going to test that you don't have memory leaks?

What if the architecture you're working on uses 48-bit memory addresses and you want to port your program to an architecture that uses 64-bit memory addresses? Have you thought about how you're going to do that? Because you know, in Java you don't need to think about any of this.

3. CPU Architecture and OS

What CPU are you programming for? What OS? Do you need little-endian or big-endian integers? Are you going to use Unicode? Which kind? UTF-8 or UTF-16? With Java, you don't need to think about it.

Suppose you are coding for multiple OSes/CPUs. Do you like having lots of preprocessor statements in your code? There is no need for preprocessor statements in Java. If you do want to check what OS or CPU you are running on, you can do so at runtime.

How are you going to know what libraries to link to on each OS? And how will you know that you have the right version? For the right architecture/OS? In Java, you have only one shared library: the JDK. In C++, you have a variable number of shared libraries.

4. JUnit

One question: Unit testing: how will you do it in C++? Or will you just rely on integration testing all the way through?

5. Graphical User Interface

Suppose you want a GUI for your application. What toolkit will you use? Gtk, Qt, Win32, MFC, .NET? Console is starting to look more attractive already, isn't it? Will you use a different toolkit for each OS? At least in Java, SWT handles all that dirty work and you can get a native GUI on just about every OS.

6. Web Applications

What are you going to do for web applications? Make/use a CGI application? Use Perl/Python/PHP? Does the ugliness of those scripting languages bother you at all? Or the fact that you'll have to learn yet another language? With Java, you can build a totally custom web server in about 300 lines of code. You also have JSP.

7. Dynamic Linking

Suppose you want to enable your application to have plugins, so that other developers can contribute parts of your application without seeing the core application's source code. How exactly are you going to do this? In Windows, you can use DLLs. What about in Linux? How are you going to distinguish between the two?

What if somebody submits a plugin built for Linux and your application is built for Windows? Maybe you want to load that plugin anyway, because it technically shouldn't have any OS calls. How will you do it? The plugin is an .so file and your application is an EXE. Feel like figuring that out?

8. Exceptions vs. Core Dumps

Think about this carefully: Would you rather receive a core dump (segmentation fault) if something goes really seriously wrong, or would you rather it be an exception?

Conclusion

This is it for now... I may add to this article if I come up with anything else.

Tuesday, February 10, 2009 1:31:23 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
.NET | Commentary | History | Personal | Technology

Linux: Still Immature


So this weekend I installed Ubuntu on my machine. Downloaded version 8.04 (x64) and burned it to a CD. Played around with it for a while, compiled a lot of source code, and guess what OS I'm in right now. Windows XP.

Now granted I'm not an open source fanatic. Never been. Probably never will be. So I'm coming to Ubuntu with a sceptical attitude. Somewhat like an atheist going to church.

I've used Ubuntu many times in the past 2 years, starting with Edgy Eft. After my various cumulative experiences with it, I have to say that Linux still has a way to go before even coming close to the two major commercial OSes out there: Windows and Mac OS. As you'll see in this review, what's "good enough" for Linux users isn't good enough for everyone else.

I'll start with Ubuntu's weak points, because the strengths are discussed too often.

1. Installation

I was lucky to have all the supported hardware. It even detected my sound card! I say "lucky" because I know from a previous experience with Ubuntu just how difficult it is to find drivers if you happen to have the kind of hardware that the open-source geek community considers uninteresting.

For instance - in a previous attempt to install Ubuntu, I had a motherboard with an NVIDIA (nForce) chipset. The integrated sound didn't work, and the RAID - forget about it!

So suppose you have hardware that isn't supported out of the box. Are you really out of luck? Well, not completely. You can google it and hope you find someone who ran into the same problem as you. That's pretty much your only recourse.

During installation, my problem was that it didn't detect my RAID array. Even though it supported it. The installer just didn't bother to load dmraid and mount my RAID volumes. I consider that pretty awful. If that happened in Windows I'd be unable to access any of my data. But since it was Linux, I was able to hack around and install dmraid and edit my fstab to mount my RAID volumes.

One more thing: installation was somewhat slow - given that it was only one 700 MB CD. It felt slower than Windows XP setup. Suggestion for Ubuntu developers: improve install speed.

Here's another idea for the Ubuntu people: why not have a Windows Update-style website, where users can go and download drivers for their hardware, install optional OS software, and stuff like that? Instead of hunting around for the right apt-get command, I'd just go to that website.

2. Software Installation

This is the part that I find most laugh-out-loud tragically outdated in Linux compared to every other OS. Suppose you want to download Mozilla Firefox. It is the same for every application, so let's just use Firefox as an example. You go to the Firefox website...

There's only the 32-bit version. How do we get the 64-bit version? It's nowhere on the Mozilla site! WTF!! They don't support 64 bits?! Oh, wait...MAYBE they expect me to COMPILE this darn thing. Oh yeah! I heard Linux people talk about compiling things all the time! It must be so easy!

So I get the Mozilla source code: I download another .tar.bz2 file from some random FTP server at the University of Oregon. I extract everything, now to a separate folder ~/firefox-source.

Wow! Extraction was surprisingly quick for 40,000 files. Now what?

Pop open a terminal and "ls". Let's see... there's a bunch of random text files. There's a "configure", another "configure", a README - oh! I'll read the README! README file points me to a web page for instructions on how to build Mozilla. Hey, I'm a developer now! Feels kinda cool... Ok. Let's see... "For the impatient!" YES! Let's read that.

OK. So I have to do a bunch of apt-gets. Not a lot. Let's do that. After getting a cryptic error I remember I have to do "sudo apt-get". (Funny thing is, the error doesn't mention "su" or "sudo" or "running as root" at ALL.)

(10 minutes & quite a bit of downloading later) Next step: there's a bunch of commands I have to run. These should work. Wait: what's this "hg" thing? Isn't this going to download the Mozilla source all over again? Whatever. Run it.

(30 minutes and LOOOOTS of downloading later) Whew. I swear I just downloaded Mozilla all over again! And now we build...

autoconf-2.13 - "not found". Huh? Fine, "autoconf". There we go... (Thinks: What if "autoconf" didn't work? Would that have been the end of my journey?)

Now "configure" and "make" run perfectly, but we've spent another 20 minutes. Now finally we can run Firefox. Where is it? "objdir-ff-release/dist/bin". Run firefox in there. No problems. We now have Firefox.

So that took what... 60 minutes? Not that bad. But thinking back on it, there was a lot of "hoping" that we had to do. We had to tweak the autoconf command and hope it doesn't screw up anything. We had to hope that we had compatible versions of all the required libraries. We had to hope there were no extraneous config files anywhere on our system messing with anything. We had to hope we had the right version of "make", the right version of "gcc" or whatever compiler it needed to use, and so many other environment-specific things. Oh - and we had to hope that no output from "autoconf" was not an error.

Now do you see why this is so laugh-out-loud tragic? Because in all these years of GUI installers, and GUI development environments, on Linux you still have to open up a terminal to compile something. There should be NO excuse why that should still be the case in this day and age.

I have some minor pieces of advice for people distributing their source code:
1. For every operation, provide consistent, meaningful feedback. Provide a progress window with a progress bar, with status text that describes the operation presently taking place. Use LOG files. Stop outputting everything to the console. Stop inputting everything from the console. Again - use files! God!
2. Error messages should tell the END USER what to do to fix the problem - NOT spew out an internal error message that at most one programmer understands.
3. Want the user to configure something? Use a DIALOG BOX! With checkboxes, radio buttons, combo boxes, and all that good stuff. Stop using command line parameters and these arcane "configure" scripts. For God's sakes we are no longer in the black & white terminal days!
4. If your build instructions involve more than one step, consider making an application that combines all build steps into one. There is no excuse for "If running Linux, do this", "If running Windows, do this" kind of instructions.

For the Ubuntu team, I suggest creating a GUI application called "Build Manager" which takes a source code package and does all the dirty compile & install work for you. You should have the choice of where to install it (after compilation) and any custom build options should be shown as checkboxes. Error messages should be logged and the log file should be shown to the user (in some graphical text editor) if there are errors. It should automatically find & use the right dependencies for each project.

3. OS and Software Configuration

Another one of those weak points. In Windows, we have something called the registry. Now, granted, most end users have no idea what the registry is. However, advanced users hack the registry on a regular basis. No matter how you put it though, the registry is a great way to keep settings organized.

On Linux, you have config files. Lots of them. In just about every place on the file system. Imagine if Windows were still using INI files today instead of the registry. It would be a nightmare to configure things. On Windows, you have user profiles (a folder where all user-specific settings are kept). You also have them on Linux, but hardly any app uses them. Whereas on Windows every application is forced to put its settings somewhere in Documents and Settings or HKEY_CURRENT_USER, on Linux anything goes.

Think of Windows like a nice garden when it comes to configuration - it's very organized and every plant (application) is in its proper place. Linux is like a jungle. There is no organization. Every developer does as he/she sees fit. Many Linux developers are comparable to savages. They have never heard of directories, GUIs, or other civilized software concepts.

Again, for Ubuntu to alleviate such headaches, it should provide very advanced configuration applets in its shell. What it provides now is fine for very simple configuration, but ultimately it should allow you to access any configuration file in any location in some kind of organized fashion.

4. The Good Things

There are a few things that Linux does better than Windows, hands down:

- Security is the primary benefit. The UNIX kernel is top notch when it comes to security. To do any real damage to a system, you need to access it as "root". Only in Vista has Microsoft tried to provide a similar level of security. But the security in Linux is at the kernel level. In Vista, it's in the shell (UI) layer. It's just not the same.

- X Windows is in every way superior to USER+GDI. You have no idea how many times X Windows saved my ass, because I was able to log into a UNIX server at school (with GUI) from home. Unlike Remote Desktop, X Windows sends vector graphics over the net, saving bandwidth dramatically. Remote Desktop sends bitmap images.

- Mounting. There's no concept of it in Windows. You have 26 drive letters and that's it. You can't mount a folder to a drive, or a drive to a folder.

- Memory Management. Without a doubt, Linux is better at memory management. You can feel it. The hard drive is less active. The system is more responsive. Fewer page faults.

- Everything is a file. You can treat any drive like a file, or any file like a drive. You can treat your sound card like a file. Write something to it and it'll output some weird sounds. It's kinda cool. In a slightly geeky way.

- Boot Loader. The "GRUB" boot loader is fantastic. It's the most configurable boot loader I've ever come across. You can dual boot anything with anything. Of course, Microsoft has no reason to provide a good boot loader. After all, they want to maintain their monopoly.

5. Conclusion

Linux is still immature. Mainly because Linux applications are immature. Linux could be a lot better if the applications written for it were written to the same standard as they are for other OSes. Linux has a lot of kernel-level features (borrowed from UNIX) that completely rival the Windows kernel. But application developers keep insisting on one formula: C++ & console. That formula worked in the 90s, but today it is just ancient. Now that it's open source, I'd like to see Java replace C++ in the Linux world much like .NET replaced Win32 API in the Windows world. There should be no more C++ developers except for those doing drivers or the OS itself. But that (why C++ sucks) is going to be another article.

Addendum:
The "immaturity" problem is not really a Linux problem. The OS is stable, secure, and very capable. The problem is with Linux software. Windows has a huge ecosystem of well-written, well-packaged applications. Linux just doesn't. It has a huge ecosystem of applications, but most of them are pure crap (to put it simply). Now, there are also some excellent Linux apps out there, ones that rival Windows apps, like "gedit" which rivals Notepad in a million ways. But those are the exceptions.

An example of such an "immature" application is aMSN. The GUI acts like it was written from scratch by a 12-year-old kid. You have to click submenus to open them! It is totally non-standard. And that's because it uses Tcl/Tk, which totally sucks. I don't see why any developer in their right mind would use that toolkit. But there you have it. A really useful Linux application that (unfortunately) totally sucks! I use it only because I have no other choice.

Tuesday, February 10, 2009 12:44:34 AM (Eastern Standard Time, UTC-05:00)  #    Comments [3] - Trackback
Commentary | Technology
# Monday, February 09, 2009

WebKit Sucks


So I'm developing a streamlined Java web browser (just a window with a browser control), and I was rather torn between Mozilla (xulrunner) or WebKit. On the one hand, Mozilla was very easy to embed (SWT Browser widget). On the other hand, Mozilla is also much slower than WebKit when it comes to JavaScript processing.

So I went through all the trouble to download & build WebKit (GTK port) only to realize that it doesn't support HTTP responses without a content type. In fact, it's extremely picky about content types. That's no good because I'm building a custom web server and I don't want to be forced to provide the content type. It would just enlarge my web server code by thousands of lines! To the WebKit team: PLEASE FIX THIS! Not every web server will hand you perfect responses on a silver platter. In fact, I don't even know how Safari can reach 90% of the websites out there.

Mozilla, on the other hand, lets me respond with no content type. Good job Mozilla! In fact, Mozilla also provides Java (JNI) bindings for all platforms. I can't imagine why WebKit doesn't. It's not rocket science guys, come on.

So these are my two biggest complaints about WebKit, and why I'm going to go with Mozilla. There is a rumour out there that the next JDK will include a WebKit-based browser control. I certainly hope they change their mind and use Mozilla instead. It's no wonder there's still no WebKit-based browser for Linux. Because WebKit sucks!

Monday, February 09, 2009 10:48:57 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | Technology
# Friday, June 20, 2008

Blast from the Past


I stumbled upon a file I wrote when I was only 12 years old when I coded a DOS game called Galawar (downloadable here!). I had an insane amount of computer knowledge back then:

This is me, sometime in 1999...
==============================================================================
-----     ***             What is protected mode?         ***     ------------
==============================================================================

     Protected mode isn't even close to a mode of security as you might think.
In fact, it is very different than that! Protected mode is a mode of your
CPU, where it can access(by using 24-bit memory addresses) a bigger amount of
memory than the usual 640 KB or less of conventional memory. Conventional
memory was the first memory to work with the 8086 and 8088 processors. Before
that, there was only 64 KB of memory or less to work with. Can you imagine?
Now, with the introduction of the 286 processor, we entered the world of
megabytes. The maximum amount of memory a 286 processor could have accessed
using protected mode was 16 MB. Protected mode was enabled and is enabled still
by the most common driver, HIMEM.SYS. It enables access to the High memory area
which can exceed the old 640 KB limit.

     Galawar uses the 386 processor which has some enhancements. It can access
memory using the virtual x86 mode, which is a mode that can simulate memory
through the hard disk using a page file(when there is not enough memory it
automatically swaps out some data to the hard disk. This is called A20 line
control and is enabled by HIMEM.SYS). Galawar uses the 32-bit enhancement
of the 386 processor to enable faster processing and, therefore, larger data
to go with the 16 MB of memory which can be accessed. 32-bit operating can't
be used on a 286 processor which wasn't a 32-bit processor. That's why, even
though Galawar uses protected mode compatible with the 286, Galawar needs a
386 processor to run.

     Protected mode is divided into two categories of memory, which can each
equal a maximum of 16 MB per block. The first and fastest kind is XMS memory,
which Galawar uses. Galawar could have used EMS memory, the second kind, but
it is a lot slower because it is divided into small handles. Each handle can't
be bigger than 16 KB. That's why, instead of using EMS memory, Galawar turned
back to the old conventional memory, which is somewhat faster than EMS memory
because it allows 64 KB handles. Also, Galawar simplified its requirements
because it would have wanted the EMM386 driver installed too, which can cause
real trouble in interaction with XMS memory. By the way, XMS memory can have
handle sizes up to 16 MB, in increments of 32 KB!

     Galawar hates Windows of any version because it uses too much processor
time(25% up to 50%) and because it uses too much memory. If you run Windows
in 386 Enhanced mode be careful because the memory might be in a page file and
Galawar could slow down a lot. Use DOS instead!(THIS DOESN'T REALLY MATTER
ON A PENTIUM OR PENTIUM II/III PROCESSOR).

     So, now I hope you know what protected mode is and why Galawar needs the
386 processor. You can impress your parents with this as well as your computer
teacher!

Friday, June 20, 2008 2:47:00 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
History | Personal | Technology
# Friday, June 13, 2008

The End of the Internet


I hate to be the bearer of bad news, but it appears we have problems bigger than just Canadian copyright laws.

In an article by Paul Joseph Watson on PrisonPlanet.com,

"

Over the past few years, a chorus of propaganda intended to demonize the Internet and further lead it down a path of strict control has spewed forth from numerous establishment organs:

  • Time magazine reported last year that researchers funded by the federal government want to shut down the internet and start over, citing the fact that at the moment there are loopholes in the system whereby users cannot be tracked and traced all the time.
  • The projects echo moves we have previously reported on to clamp down on internet neutrality and even to designate a new form of the internet known as Internet 2.

  • In a display of bi-partisanship, there have recently been calls for all out mandatory ISP snooping on all US citizens by both Democrats and Republicans alike.

  • The White House's own recently de-classified strategy for "winning the war on terror" targets Internet conspiracy theories as a recruiting ground for terrorists and threatens to "diminish" their influence.

  • The Pentagon recently announced its effort to infiltrate the Internet and propagandize for the war on terror.

  • In a speech last October, Homeland Security director Michael Chertoff identified the web as a "terror training camp," through which "disaffected people living in the United States" are developing "radical ideologies and potentially violent skills." His solution is "intelligence fusion centers," staffed by Homeland Security personnel which will go into operation next year.

  • The U.S. Government wants to force bloggers and online grassroots activists to register and regularly report their activities to Congress. Criminal charges including a possible jail term of up to one year could be the punishment for non-compliance.

  • A landmark legal case on behalf of the Recording Industry Association of America and other global trade organizations seeks to criminalize all Internet file sharing of any kind as copyright infringement, effectively shutting down the world wide web - and their argument is supported by the U.S. government.

  • A landmark legal ruling in Sydney goes further than ever before in setting the trap door for the destruction of the Internet as we know it and the end of alternative news websites and blogs by creating the precedent that simply linking to other websites is breach of copyright and piracy.
...
"

The plan is to shut down the Internet as we know it today and start up a new highly-supervised Internet known as Internet 2.0, which will resemble cable TV, with a few corporations controlling all content.

Enjoy!

(BTW, in Sydney I could be breaking copyright laws by just linking to things! Yikes!)

Friday, June 13, 2008 6:43:23 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | News | Technology
# Wednesday, June 04, 2008

Draconian Copyright Laws Coming to Canada!


URGENT MESSAGE TO ALL CANADIANS

Please read the following article:
$500 fine eyed for illegal file downloads

As a result of these new copyright laws, your car WILL be searched at the border and any iPods / laptops WILL be confiscated!

Also, if the law passes you can be sued for file sharing just like in the US!

Make your voice heard...
Send a letter to the Prime Minister

For more on this topic...

Digg - URGENT MESSAGE TO CANADIANS, Our way of life is in danger


Also, come next election, I'm voting NDP!


UPDATE: "Copyright reform bill appears to be in limbo"
Wednesday, June 04, 2008 7:55:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | News | Technology
# Sunday, March 02, 2008

Genetic Holocaust


Forget nuclear war. Forget global warming. We are on the verge of a genetic holocaust. The biotech industry is destroying all life on Earth as we speak. There is the real risk that every species on this planet will soon be extinct, including the human species. After listening to the 2/29/2008 Alex Jones show, my attitude toward the future of humanity is now one of despair. A massive extinction has begun, and nobody seems to care (except perhaps those who built the Doomsday Vault).

Please listen to the show (thanks to Gatekeeperinvasion) and I dare you not to be outraged:



                                                              Next video...

After listening, I went to Health Canada's website to see what the government has done about this. The website is incredibly dovish on the whole GM issue:

"
What are the risks of applying the techniques of genetic modification to foods?

The techniques of modern biotechnology do not introduce risks which are different from those already associated with the food supply. Many of the issues raised by foods resulting from genetic modification are equally applicable to foods produced by conventional means.
"


Did Monsanto write Health Canada's website? This is absolutely disgusting and shocking.

Please visit SeedsOfDeception.com to find out the truth.

Sunday, March 02, 2008 9:00:09 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] - Trackback
Commentary | News | Technology
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
About the author/Disclaimer

Disclaimer
The opinions expressed herein do not represent the opinions of the author or of any employer, employee, or associate of the author.

© Copyright 2010
Dan Tohatan
Sign In
Statistics
Total Posts: 157
This Year: 15
This Month: 5
This Week: 1
Comments: 34

Finance
Top Blogs
Test PC Performance with Dacris Benchmarks.
All Content © 2010, Dan Tohatan