Monday, November 30, 2009

Low level vs high level tools

ComputerWorld posted a "debate" using high level tools (like integrated tools as Visual Studio) against basic ones (a basic text editor, command line compilers). The original article is here.

I think that many persons talk to promote the products they're working on: is natural for a shell creator to encourage all people to use "basic stuff", as a C++/CLI creator will want people to write more in C++ as this is his/hers language, and not in C# (it's closest competitor). They use arguments like "abstraction penalty" as an argument for their tools working faster, since they aren't doing indirected calls and use (more directly) components without their associated cost.

I will take one at a time:
  1. using text editor/command line compiler against using a high level IDE. The reason I would firstly use an IDE is that it organizes and simplifies most operations. Even if I will have to learn some operations that the IDE supports, like Refactorings (which are not a part of the text editors at all) which do permit you to reorganize your code, on the long run many faults such as misspellings are not done just because the IDE helps you write your code right. Exposing too much information might be tricky, but I think it's rarely shown to be as a big issue as to forgot to add a file into SVN. From this regard, in general the IDE makes me think on problem itself, not on spelling and how to put all the compiler arguments right. For example Eclipse has many perspectives, each with its own tools being shown, directed at an angle in which you want to see your problem from. If you just need to change a line, probably VIM is a much better option, but sticking to Eclipse it will fix your Java deployment into jars, will integrate with your SVN/Mercurial/etc. local changes, and you will not need to put on sticky notes all arguments that you've missed, and thus needed to recompile.
  2. Managed code also lets developers "perform above their level of competence," This is really tricky if you don't know what managed code is in detail. You can translate this statement as: a virtual machine doesn't let you express at your level of competence, since most of the constructions that you normally would create are already there. Many design decision, that a virtual machine has implemented, are to prevent anti-patterns and to force developers to stay in the VM's sandbox. To put this in a UNIX perspective, the problem is like: the limited user will not let you express yourself since you are not administrator/root. But as administrator/root you can break your system, and there is a high risk that the problems you will encounter or create will have a greater damage, for no real benefit. Yes there might be leaks inside VMs but in the most cases they aren't. So you can simply work with your preferred VM code in Java/C# and at the end of the day the quantity of your issues that you'll find will be smaller
  3. Abstraction penalty will make the trend: people will go to low level languages which do bring performance for future. The problem with JIT in particulars and their lack of speed is simple: the JITs are actually fast enough. Probably a JIT means at most to cut the speed in two compared with C++. In fact Java with Java 7 will improve once again performance of their running bytecode. This will mean a lot of applications will run just fast enough. Also, most applications are not games nor renderers. As for me, I am sure that Windows Vista/Windows 7 could be written as shell parts in .NET. The biggest proof is Paint.NET and the Linux's Mono application set. I am agreeing with the abstraction payment as long as you really depend on them (for example, please don't garbage collect while you're running my pacemaker. Thank you). But in fact being inside a VM will only mean to you that your runtime environment will be much easier to be fixed and upgraded, and your code will be much easily run on any platform that supports your VM.
The point I wanna make is just this: for many mediocre programmers, writing yet another algorithm using low level things is unlikely, and in most cases will not run as fast as the as the same C#/Java code on the long run. Even when you will write everything perfectly, a new version of your virtual machine will get the code so close to your hard optimized code that will make all the extra effort worthless. Using IDEs will simply make your working procedure simpler.

So, why use notepad when you have Eclipse?

Wednesday, November 18, 2009

Internet-Enabled Devices in Microsoft's Vision

I can't make this kind of stuff up. This is an actual opensource release from Microsoft:

"Microsoft has released part of its .NET Framework - the part for internet-connected smart devices - into the open-source community. [...] But don't get too excited. You won't be getting the full .NET Micro Framework stack, as Microsoft's open-source code donation will lack the TCP/IP stack and cryptography libraries."


So let's recap: .NET for "Internet-enabled smart devices" with no TCP/IP nor security?! Wow! I'm really impressed.

What's next, really? Because this one definitely blew my mind.

The full article is here.

Thursday, November 12, 2009

DroidCan't

I had the opportunity to see the commercials from Motorola with iDon't. While I found it cool to slander the iPhone platform (Mac vs PC anyone?) I've started receiving lately some bad reviews for my application from some droid users.

Ok, I had bad reviews even before, no biggie, but these ones were like: "it doesn't work on Droid". Thus I started tracking one guy who gave AndroidKnight one star, and here is a screenshot with what other applications he gave bad ratings:



Wow... dedicated guy.

See a pattern? All of them are 3D applications, and this disgruntled user managed to give 5 stars to an application which wasn't 3D. (To be honest, I would be also filled with rage after paying more than 500 bucks to find out that no OpenGL application works).

Thus I thought "dude, that must be some mistake Motorola did, probably some weird API they've added, but I'll just download their SDK, do a trick or two, and it would be up and running in no time". Turns out I was wrong. There is no customization in the software that Motorola provided with their phone.

As Graig Wilson (from Motorola) said it in plain English:
You already have it, if you have the new Google 2.0 SDK. Droid has no "Moto customizations"; the software on the shipping device is the Android 2.0 platform, straight from Google. So the emulator that Google provides really is the emulator for the shipping device.


Well guess what: AndroidKnight (and I am willing to bet every other 3D application from that list) works under the emulator. For 2.0, of course.

It's a bit frustrating knowing that just disabling the hardware acceleration on Droid would probably "fix" it.

So this brings me to this very simple point: I don't know if it is the fault of Google or Motorola. (I've heard Galaxy from Samsung has the same issues, so I tend to believe it's Google).

To be honest I don't really care that much.

But think for a minute or two, what does it matter if you have some "cool" phone which doesn't do some basic stuff that it is supposed to do. Because the iPhone wasn't designed to have a real keyboard/run multiple apps/run widgets/etc. No one sells iPhones for that, they sell it with just one saying: "it just works".

Ok, enough ranting, what is my proposed solution?

Make google enforce a suite of tests that every phone should pass before it can be named android compatible. If they don't pass the tests, they shouldn't be allowed to run an operating system named android (enforce the trademark), but rather they should be forced to rename their operating system (so they can still use the same sources if they want).

Otherwise it will simply be DroidCan't too.

Update
Turns out that other people had issues as well and tried to figure them out. Please read that link since it might give insightful information on what you need to do next.

This read might also help.

At the moment I'm trying to change the initialization code to look more like here.

Update 2
This code works for RED = 5, GREEN = 6, BLUE = 5, ALPHA = 0, DEPTH = 16 and STENCIL = 8. Note that in my code DEPTH is the minimal DEPTH, but I will give better distances if the DEPTH is actually higher that the DEPTH value.
    private EGLConfig chooseConfig(EGL10 egl, EGLDisplay display,
            EGLConfig[] configs) {
        EGLConfig closestConfig = null;
        double closestDistance = 1000.0;
        int idx = 0;
        for(EGLConfig config : configs) {
            idx++;
            int r = findConfigAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
            int g = findConfigAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
            int b = findConfigAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
            int a = findConfigAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
            int d = findConfigAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
            int s = findConfigAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
            int configCaveat = findConfigAttrib(egl, display, config, EGL10.EGL_CONFIG_CAVEAT, EGL10.EGL_NONE);
            
            double distance = Math.sqrt( Math.abs(r - RED) )
                + Math.sqrt( Math.abs(g - GREEN) )
                + Math.sqrt( Math.abs(b - BLUE) )
                + Math.sqrt( Math.abs(a - ALPHA) )
                + Math.sqrt( Math.abs(s - STENCIL) )
                + Math.sqrt( 128 - d ); // prefer bigger depths if available

            Log.d("AndroidKnight", configToString(config) + "\n distance: " + distance);
            
            if (d < DEPTH && configCaveat != EGL10.EGL_NONE) {
                Log.d("AndroidKnight", "Ignoring config " + idx + " since config caveat is : " + configCaveat + " and depth is " + d);
                continue;
            }
            
            if (distance < closestDistance) {
                closestDistance = distance;
                closestConfig = config;
            }
        }

        Log.d("AndroidKnight", "Selected configuration: " + configToString(closestConfig));
        
        return closestConfig;
    }


Explanations:
  • I'm using sqrt, so changes in color bits will have a bigger impact. For example if no configuration matched and simply summing absolute of differences, a target configuration like R:5,G:6,B:5,A:0,S:0,D:16 would yield the same distances for these configurations R:5,G:6,B:5,A:0,S:8,D:16 vs R:8,G:8,B:8,A:0,S:0,D:16 if I would just sum up values. The idea is that I would rather have the bytes per pixels right, than the stencil buffer right from these configurations; especially since it seems its a bpp issue in the first place.

  • I don't care about the depth as long it is at least the depth required. I actually prefer bigger depths if available.

  • I don't want any configuration that is not conforming or slow, etc. This is why there is a flag checking. I didn't even knew about it before my saga.

  • The reason why stencil is set to 8 (even if I'm not using it) is because it fails to initialize if it is 0 - I might have done something wrong.


Feel free to use this code as you like.

Friday, October 23, 2009

I give you the newest Windows7 (KDE 4)

ZDNet Australia installed in a shop KDE 4, and told people that this is the new Windows7. They presented applications such as amarok, dolhpin, and openoffice.

See what happened next at this link.

It is priceless. I don't want to be mean, but din't I told you so? Watch the people's reactions and how they describe it and relate to Vista.

It is simply unbelievable.

KDE really made a great product.

Monday, October 19, 2009

Windows 7 vs. Mac Snow Leopard: The Great Debate (translated)

The following content is a parody. It is made after this interview so it would make sense to read that one first. By any means this is not what Brian Coll nor Jay Paulus would have said, but what I in my artistic rambling invented as answers to the questions put by Lance Ulanoff of pcmag.com.

This is for entertainment only and I am not claiming to be factually accurate.



Lance Ulanoff (Question):
Let's start with 64-bit. For perhaps the first time in operating system history, average consumers are aware of the 64-bit choice and thinking about whether or not they need or want to use it. What does Apple and Microsoft bring to the table here?


Brian Coll (Apple): Well, we have this cool kernel that we taken from BSD, and we are based on a cross-platform UNIX. Not to mention our hardware pool it is quite small, and also we have our own packaging system. To migrate to 64 bit was quite painless. We did a great job about it, so we decided in the end to disable it by default.

Jay Paulus (Microsoft): We have two versions. D**n these years of compatibility to keep, they really choke us. And unlike Macs we give our customers options: The option, of reinstalling your Windows and all your other applications whenever you want to switch to 32bit to 64bit and back, is always on the table. We want people to have the chance to install Windows as many times as they want. This is what we call customer choice.

Lance Ulanoff (Question):
Modern computers now feature multicore CPUs. However, consumers aren't always sure if their operating systems or apps are taking full—or any—advantage of all those cores. What are you guys doing in the multicore space?


Brian Coll (Apple): You had to ask this, didn't you? To answer your question though, we provided an API so that the kernel can do threads instead of the developer. It's fantastic, I've heard about it yesterday from Steve, he was realy enthusiastic also. We suport one platform since we all know that cool people use one platform (namely Mac + iTunes).

Jay Paulus (Microsoft): Thank you for the question. Here we feel we've outdone ourselves: Not only that we have this very cool and technologically advanced hybrid-kernel that works on several platforms, including 64 bit, but we've traded a bit of security over here, a bit of performance and resource usage over there and in the end we got Vista which is perfect on the upgrade path to a much needed new PC and new hardware. And you can still get viruses.

Lance Ulanoff (Question):
Okay, let's step out from under the hood and talk about what consumers see on their desktops, specifically, the UI?


Brian Coll (Apple): Well, our customers are licking their screens since 2002. I think that said it right there. But still, if you want me to continue, dock is simply cool, we have cool effects that actually help you, we have Cover Flow to search for stuff and Time Machine which is integrated with your desktop seamlessly. And we know cool people use iTunes. You can even see the contents of the documents in the finder even if you can't possibly do anything with that file since you don't have an application installed to process it. Isn't that amazing? And we didn't yet found a way to convince game developers to consider our platform.

Jay Paulus (Microsoft): I think no company had the pressure that Microsoft had. We've tried to copy Apple since day one. Bill was telling me that the first day he listened to Steve Jobs, he has figured out on his own that the GUI is the future - without any Apple inspiration. So as I've said, we've tried to copy Apple but they are moving so d**n fast. They've added attachments, we copied attachments, by the time we finished they had multitasking, we copied multitasking, they had at that point skinable interfaces, we copied that, they came up with the finder, we finally done that and they have the time machine and the cover thingie? When is this going to end? This is getting ridiculous. We still have dlls, defragmentation and registries to fix, give us a break. As I've said, the pressure is fantastic.

Lance Ulanoff (Question):
Okay, let's talk about backup—something everybody needs, but no one really does. Windows Backup has been around for a long time, but isn't widely used. Apple's Time Machine arrived with Leopard and deep integration with the hardware. Where are we now with OS-based backup?


Brian Coll (Apple): Well thank you, thank you, thank you. Finally some justice! We have this really cool backup system. Is freakin amazing. You can literally destroy your Mac with a hammer after a backup, and then restore your backup on your brand new expensive Mac. Your data is there, your applications are there, you can do only partial backups, this is just cool. Neither me nor Steve don't know how is this done, but it is really cool.

Jay Paulus (Microsoft): Ok.... so.... Let me think a few seconds. (5 minutes later) Anyway, we have this program which is really awkward to use but we use it for marketing; it is named Previous Versions. You can still loose all your data, if your hard drive crashes, so yeah, it's pretty pointless but have no fear, you can allways use one of your 32bit or 64bit media that comes with the package to reinstall Windows and all your applications. You don't need to pay anything more, just reactivate Windows again after installation. This is what we call easy and painless. Or you can backup everything and in a matter of a few hours you can have your data stored in an external hard drive.

Lance Ulanoff (Question):
Perhaps one of the most stressful things users face is the act of upgrading their OS. With Windows 7 coming out, people will be making choices and possibly upgrading their OS. Mr. Croll, what's Apple's perspective on what's happening with Windows 7?


Brian Coll (Apple): Microsoft wants to milk their users of some serious cash. They've been drying for a few years now.

Lance Ulanoff (Question):
Jay?


Jay Paulus (Microsoft): Well, it took us eight years to come up with this stuff and tadaa... people don't want to buy it. This... this, is unacceptable man.

Lance Ulanoff (Question):
After years of integrating utilities and even full-blown apps from competing products in the operating system, or as part of the OS package, Microsoft made an about face this year and is letting end users decide whether or not they want to download Mail, Messenger, Movie Maker and other apps. Why?


Jay Paulus (Microsoft): This is the reason I don't travel to Europe. Ever. EU keeps freakin sueing us, saying we're a monopoly and this and that. How would you feel paying 1.4 billion dollars to EU? I thought so. We neither. It's already hard keeping up with Apple, Linux and all the stuff that they do, but multiple competitors? Come on, this is simply unfair. And Vista didn't really sold.

Lance Ulanoff (Question):
Brian how do you view the debundling of applications?


Brian Coll (Apple): Thank God EU is not on us on this one. We already have a lot of heat on the iPod-iTunes thinge. And I can say without a doubt that what Vista's approach of debundling applications is plain stupid. I don't get why they don't keep paying 2 million euros per day like they did before.

Lance Ulanoff (Question):
In the race to build the best operating system, where do each of you think you stand? What sets you apart?


Brian Coll (Apple): Well a thing I can say for sure that we really don't have games. One or two titles, but that's pretty much it. On the other hand we don't have Registry, DLLs, activation, defragmentation, viruses, etc. Another thing is that we tried and failed several times to enter the server market.

Jay Paulus (Microsoft): So what? We have registries, we have DLLs, and so what? We know they suck, but do you really had to bring them up? And let's not forget we also have this Previous Versions software where you can backup your DLLs, so it's not DLL Hell (TM) anymore; we improved this by a factor of ten so we name it DLL Hell XP (TM). XP is from eXPerience since we have over 15 years of DLLs and registries experience. And let's not forget, we don't talk about it. Very important. Plus we all know Apple is way too expensive. If I want a toaster I buy a toaster not a Ferarri that can also toast bread.

Lance Ulanoff (Question):
What about Mr. Croll's activation and technology comments?


Jay Paulus (Microsoft): Ups, it seems I've skipped this one, heh heh... We use the activation mechanism to be sure you don't have a pirated copy of Windows, or you upgrade your computer or components from it, without buying a new Windows license.

Lance Ulanoff (Question):
Let's talk about pricing. There are free operating systems out there, like Linux, but, as we can see from market share, free does not necessarily translate into mass-market adoption. How do the two of you see price and the OS?


Brian Coll (Apple): Well we believe in charging the user as much as we can. A new keyboard? 50 euros, an upgrade? 25 euros. I really think we've nailed down quite well.

Jay Paulus (Microsoft): In contrast to Apple, we believe in charging the user as much as we can. You will pay 200 bucks for your bare windows, and then you need to buy an antivirus, a video editor and so on. You can either buy our software or buy directly a computer from the "mini" series with XP installed on it in the same price range.

Lance Ulanoff (Question):
Okay, here's your opportunity to make your case for your OS. Mr. Paulus, why Windows?


Jay Paulus (Microsoft): Well we're changing the game since XP has launched. Every seven years or so we release a game changer version that offers our latest additions to keep up with Macs. And since Macs are simple, Windows 7 was also designed to be simple. So if it would be for me to sum it up in only one word, that would be it: Game Changer.

Lance Ulanoff (Question):
Brian?


Brian Coll (Apple): We've bundled more applications, and we've tied it with the iPhone since we want the industry to move forward. We've decided to do tiny upgrades and rebrand them with flashy names and tax them with flashy prices. If you look at what version we had ten years behind you will see real improvements and the thousand dollars price tags worth it.

Lance Ulanoff:
Thanks for your time guys, and have fun in the future.


Why in The End All Software Will Be Opensource, and Eventually GPL.

On 16th of March, 1953 a man was born that was going to change the software industry as we know it: his name was Richard Stallman and he is the creator of the GNU operating system. He envisioned that software should not be necessarily free of charge, but free to change, and distribute the changes, while enforcing these rules downstream so no one could block the availability of sources and the possibility of changing them.

What few people know is that opensource existed long before - long in computer time - by the time Stallman decided in 1983 to start building his own operating system, Berkeley University has built and was distributing its own operating system called BSD since 1977.

Stallman believed that the approach BSD was taking was a faulty one, since it allowed other vendors to simply change and repackage BSD, without giving the rights to change it further down the line.

Fast forward through time, in 1990s the Free Software Foundation (FSF, the foundation that Stallman created in order to achieve the goal of a free operating system) was pretty much stuck in trying to develop a very advanced from an architectural point of view kernel. Here is where Linus Torvalds jumped in and developed his own kernel, less advanced at that point, but it worked.

Fast forward even more, the GNU operating system with the Linux kernel (GNU/Linux) became widely used for servers since it was way cheaper than its UNIXes counterparts. Even more forwarding, and Linux enters also the desktop market, and while initially looking horrible, managed to compete and even bypass other graphical user interfaces (GUI).

Current State of Software
Several companies learned from the momentum that GPL has created. Among them RedHat, SuSE (later bought by Novell), and later Ubuntu, and more important IBM and Google.

But their motives are not similar at all as the ones of Stallman. Truth be told, no money making company believes in being altruistic at all, everything is measured in a cost/benefit analisys - this is why Microsoft until recent years had no connection with the opensource world at all, and even now they have a double personality (also known as schizophrenia) when it comes to free/opensource software. Yes, they don't believe in being altruistic even if they say so.

Most companies know that the biggest expenses come not from writing the software - writing the software is actually cheap, but from testing it, and patching it. Thus it is cheaper for them to release the software opensource, even if some of the people will use it for free, since these guys will also test their product and do bug fixes for them.

GPL/opensource has these major advantages over the closed source software:
  • As a last resort, if the company that developed your software dies you can use the source (Luke).

  • You can create an ecosystem around your software platform that will drive to you customers, and it will be used as means of promoting your product.

  • You can start challenge the big ones - examples here abound: RedHat with their server families, Ubuntu with their desktop platform, Google with Android phones, the now defunct MySQL with their database, IBM with Eclipse, etc. etc.

  • You can cut down the costs by using software for free (as in also gratis) - full software stacks being available LAMP (Linux, Apache, MySQL, PHP), many JEE solutions, file servers, desktops, etc.


This changed the game of software development quite a bit. The competition went through the roof, and pushed technological advancements in areas where the closed source was the only established answer.

One last notable example is the example of Microsoft for which it took 7 years (some might say even more since Vista it's quite crappy) to release an upgrade from their XP line of desktops to Vista. Even Microsoft is slowly moving to opensource by creating its own license which is actually OSI approved.

Canonical with their Ubuntu promise made an interesting call by deciding to respect all the freedoms of the users. Their surge in adoption I think it reflects exactly that, since this is what I call being Customer Centered - (customer centered it's a fancy term that major corporations use in order to show that they care mostly about their clients).

Conclusion
Of course, you can disagree with me, and of course I'm biased. In this article I just tried to show a quick history on how GPL and GNU changed the face of software. And I'm going to leave you with these screenshots over time of various operating systems to let you decide who do you think innovated most and was most consistent in improving their software over time:

A Little Bit of History

1992-1993


Linux

No desktop version available (except maybe some very ugly ones).



Windows 3.1


NeXT (Apple)


1995-1996


Linux (KDE 1.0)


Windows (Windows 95)


Apple

Nothing new.

2001-2002


Linux (KDE 2.0)


Windows (XP)


Apple (Leopard is out: Roarrr)


2005


Linux (KDE 3.0)


Windows

Nothing new for the next few years.



Apple

Nothing new.

2009 (today)


Linux (KDE 4.0)


Windows (Vista)


Apple (Snow Leopard)


Tuesday, October 6, 2009

Windows is HOT.

Who said that windows is lame?

Windows can be really hot:


Of course, this is KDE 4.3 with some plasmoids running on top of a Windows XP.

All that it remains is for Windows to fully change its shell and taskbar with the KDE one, so at least it might look like a decent operating system - for now we'll ignore what's under the hood.

KDE 4.3 team, you've outdone yourself. Great job!