Category Archives: Ideas

My ideas and (maybe) inventions

On HTML5 and native

A few months ago I wrote on my disbelief of HTML5 being the right tool for everything. Some people took that as me saying HTML5 is useless.

That’s obviously not true and it’s certainly not what I think.

It’s my opinion there is room for HTML5 and there is room for native applications and the decision on what to use should not be taken lightly.

Here are a few questions that may help you to make a wise decision.


Target user

Is it corporate? Is it consumer?

Corporate devices are usually under control and users may not be able to install software.

Or traffic may be filtered and users cannot browse to your website to use your webapp and getting the authorization will take months, therefore they give up before they have even started using it.

Or they may be on a slow Internet connection and using that HTML5 webapp that took years to develop and add all those nice effects is hardly possible due to megabytes of JavaScript and images needing to be downloaded.

As for consumers, despite having full control of their systems, it’s not roses either: not all consumers know how to install software and/or they may be scared by UAC dialogs (hint: always sign your software with a certificate whose signature chain reaches VeriSign).


Target device

Is it a computer? Smartphone? Tablet? Web browser?

If a computer, is it a PC running Windows? Linux? Mac? All of them?Are you trying to reach as many platforms as possible?

How old of a computer are you targeting? Pentium 4? Core 2 Duo? Core i5? How much RAM? Try a fancy website with a lot of HTML5 niftiness on an old computer and you’ll probably be surprised at how slow HTML5 can be, even on modern browsers.



Deploying native applications in corporate environments is a bit of a nightmare due to different operating system versions, hardware, etc

Deploying native applications in consumer computers is only a problem if you are targetinglow-skilled users.

HTML5 is easy to deploy, provided that you can get the user to use a proper version of the browser. This is workable with consumers but often impossible with corporate, so if you go for HTML5 for a corporate application, make sure you support everything from at least down to Internet Explorer 8.

For mobile devices (smartphones and tablets), it doesn’t really matter whether it’s an HTML5 or native application: it has to be installed on the device, the device goes with the user everywhere and when the user moves to another device, re-installing all the applications is a matter of accessing the Apple Store, Android Market or equivalent and say “download it all”.

Continue reading

Plasma Active on Android?

Aaron recently posted an update about the progress of Vivaldi and the new setbacks and progresses in the project.

In case you are not familiar with Vivaldi, here’s a quick recap: the idea is to have a tablet running Linux (Mer, the continuation of Maemo and MeeGo) and Plasma Active. Apparently the easiest and cheapest way to achieve this was to get all the sources code for the software running on one of the many tablets which are sold with Android (which is, after all, a variation of Linux).

But then problems arise: those tablets run Android and vendors often provide only binary drivers, which is useless for Mer (or any other distribution of Linux). Once they finally got enough source to move Vivaldi forward, the board (electronics) changes and back to square 1 (or almost).

According to Aaron, it seems this time they have found a partner which is willing to provide the device and the source. Grea!

However, since the beginning of the Vivaldi Project (back when it was called Spark), there is one thing there is one thing I have always wondered.

Why Mer? In fact, why a Linux distribution? I know, I know, Plasma Active needs Linux to run.

But what about taking a completely different approach?

Instead of trying to get Mer and Plasma Active running on a tablet which is meant to run Android, why not taking a less radical approach?

We have Necessitas(Qt for Android).

So why not taking the opposite approach?

Instead of adapting Mer (operating system) + Plasma Active (“desktop environment”) to a tablet (the “device”) which is meant to run Android

what about this:

Port Plasma Active (desktop environment) to Android (operating system), which is already running on the tablet (the “device”).

Then create KDE’s own “CyanogenMod” that can be installed on top of many tablet devices. And sell those devices: you get to choose 7”, 9.7”, 10.1”, etc

Or maybe even sell Plasma Active and the application in the Android Market, if that’s possible (I don’t know enough about Android and the Market Terms and Conditions to know whether it’s possible technically and legally to replace the desktop).

Yes, that’s a different business and it’s probably not what MakePlayLive had in mind.

With this approach, the business is no longer about selling hardware + software but mainly only about selling software. How to make that profitable is a topic for another post.

And there are technical limitations:Bionic, the amount of linked libraries, applications may need tablet-specific details (not unexpected, even with Mer), etc

But at least it’s something that we know how to do: it’s code, not hardware, and there is no need to deal with people who will promise source code and then won’t deliver. It will work on top of Android, and we just need to create our own distribution.

It’s just one more platform for KDE: first it was Linux, then other Unices, Mac, Windows… next Android.

Am I too crazy or dumb?


A wish a day 14: Wine-based Application Virtualization

Application virtualization is an umbrella term that describes software technologies that improve portability, manageability and compatibility of applications by encapsulating them from the underlying operating system on which they are executed.

A fully virtualized application is not installed in the traditional sense, although it is still executed as if it were. The application is fooled at runtime into believing that it is directly interfacing with the original operating system and all the resources managed by it, when in reality it is not.

In this context, the term “virtualization” refers to the artifact being encapsulated (application), which is quite different to its meaning in hardware virtualization, where it refers to the artifact being abstracted (physical hardware).

So Wikipedia says.

In layman terms, application virtualization is “I want to run a third party application without it requiring installation”. Probably you know it as “portable application“.

The trivial case

If we talk about Windows applications, for simple applications, application virtualization amounts to copying the .exe and any required DLL to some folder, then running the application from that folder.

Easy, huh?

Well, no.

Registry keys

Many applications add keys to the registry and will not run without those keys. Some even require other files, which are created in AppData, CommonAppData, etc.

To solve this kind of dependencies, application virtualization software packages such as VMware ThinApp, Microsoft App-V and Citrix XenApp monitor the registry and the filesystem for changes. To do so, they require an “application virtualization preparation” procedure. It’s like you have a clean virtual machine, take a snapshot, then install the application, take another snapshot, and compare them.

You could achieve more or less the same result for free by using FileMon + RegMon + RegShot.

Of course I am simplifying more than a bit here :-)

Common files

Then there is the problem of file redirection.

The whole point of application virtualization is to be able to run the application without installation. But if this application’s setup installed files in CommonAppData (or the application creates them), how do we force the application to look for them in our “virtualized application folder”?

The technique usually involves generating a small .exe launcher that:

  • Sets a special PATH that looks where we want first
  • Uses hooking, DLL injection and some other low level tricks to force system calls to look into the places we want before (or even instead of) they look into the standard places
  • Registry emulation (in combination with hooking and DLL injection) to make sure those registry keys are taken from the registry in the sandbox instead of the actual registry
  • And more

In a way, we are cracking the application.


What I have described above are the required steps to virtualize an application if the target platform (where the application is going to be run) is the same as the host platform (where the application virtualization was performed). For instance, if we are virtualizing the application on Windows XP SP3 32-bit and the application will run on Windows XP SP3 32-bit.

Even if the steps described above look complex to you (they are), that’s the simple case of application virtualization.

If the target platform is a different version (for instance, the app virtualization takes place on Windows XP 32-bit, while the target platform is supporting also Windows 7 64-bit), then it gets more complex: probably many Windows DLLs will need to be redistributed. Maybe even ntoskrnl.exe from the original system is required.

In addition to the serious problem redistribution poses in terms of licensing to anybody but Microsoft App-V, there is the technical side: how do you run Windows XP SP3 32-bit ntoskrnl.exe on Windows 7 SP1 64-bit? You cannot, which makes some applications (very few) impossible to virtualize.

Device drivers

The more general case for “impossible to virtualize applications” (we are always talking about application virtualization here, not full virtualization or paravirtualization) is device drivers.

None of the application virtualization solutions that exist so far can cope with drivers, and for a good reason: installing a driver requires administration permissions, verifying certificates, loading at the proper moment, etc. All of that needs to be done at kernel level, which requires administration permissions, thus defeating the point of application virtualization. Then there are the technical complications (the complexity of the implementation), and the fact that drivers assume they run with administration permissions, therefore they may perform actions that require administration permissions. If that driver is also app-virtualized, it will not run with administration permissions.

One possible remedy to the “driver virtualization problem” would be to implement a “driver loader process” that requires installation and will run with administration permissions. Think of it as the “runtime requirement” of our application virtualization solution.

I know, I know, it sounds contradictory: the whole point of my app virtualization software solution is to avoid application installation, yet my app virtualization solution requires a runtime installation? We are talking about a one-time installation, which would be perfectly acceptable in a business environment.

But why all this!?

You may wonder why this braindump.

The reason is the job that pays my bills requires virtualization. Given that we need driver support, we resorted to VirtualBox but we run a lot of instances of the applications we need to virtualize, which means we need a lot of Windows licenses for those virtual machines. Worse: we cannot know how many Windows licenses we need because the client may start any number of them and should not notice they run in virtual machines! Even worse: Microsoft have a very stupid attitude in the license negotiations and keep trying to force us to use Windows XP Mode and/or Hyper-V, which are not acceptable to us due to their technical limitations.

So it turned on the “think different switch” in my brain and I came with a solution: let’s port Wine to Windows and use it to virtualize applications.

The case for a Wine-based Application Virtualization solution

Crazy? I don’t think so. In fact, there would be a number of advantages:

  • No need for Windows licenses
  • No need for VirtualBox licenses
  • Wine already sandboxes everything into WINEPREFIX, and you can have as many of them as you want
  • You can tell wine to behave like Windows 2000 SP3, Windows XP, Windows XP SP3, Windows 7, etc. A simple configuration setting and you can run your application the environment it has been certified for. Compare that to configuring and deploying a full virtual machine (and thankfully this has been improved a lot in VBox 4; we used to have our own import/export in VBox 3)
  • No need to redistribute or depend on Microsoft non-freely-redistributable libraries or executables: Wine implements them
  • Wine has some limited support for drivers. Namely, it already supports USB drivers, which is all we need at this moment.

Some details with importance…

There are of course problems too:

  • Wine only compiles partially on Windows (as a curiosity, this is Wine 1.3.27 compiled for Windows using MinGW + MSYS)
  • The most important parts of wine are not available for Windows so far: wineserver, kernel, etc
  • Some very important parts of wine itself, no matter what platform it runs, are still missing or need improvement: MSI, support for installing the .NET framework (Mono is not enough, it does not support C++/CLI), more and more complete Windows “core” DLLs, LdrInitializeThunk and others in NTDLL, etc
  • Given that Windows and the Linux kernel are very different, some important architectural changes are required to get wine running on Windows

Is it possible to get this done?

I’d say a team of 3-4 people could get something working in 1 year. This could be sold as a product that would directly compete with ThinApp, XenApp, App-V, etc.

We even flirted with the idea of developing this ourselves, but we are under too much pressure on the project which needs this solution, we cannot commit 3-4 developers during 1-2 years to something that is not the main focus of development.

Pau, I’m scared!

Yes, this is probably the most challenging “A wish a day” so far. Just take a look at the answer to “Am I qualified?” in Codeweavers’ internships page:

Am I Qualified?

Probably not. Wine’s probably too hard for you. That’s no insult; it’s too hard for about 99% of C programmers out there. It is, frankly, the hardest programming gig on the planet, bar none. But if you think you’re up for a real challenge, read on…

Let’s say, just for the sake of argument, that you’re foolish enough that you think you might like to take a shot at hacking Wine. [...]

A wish a day

Today I am starting a new section I have called “a wish a day”. I will be doing exactly that: writing about something I would do myself if I had enough spare time.

Some are Qt and KDE -related, others are not. Some are very simple, others would require a lot of development time (not necessarily because of the complexity), deep knowledge of something, or both of them. In some cases, I have started and/or even made relevant progress but I did not have the time to finish because I have a real life and a job that pays the bills.

So if you have some spare time and want to develop software but you do not have ideas or find anything appealing, check “A wish a day” the coming weeks. I already have 20 wish-drafts.

Wish 1: libQtGit
Wish 2: Calligra document versioning
Wish 3: Document translation in Calligra
Wish 4: KDE demo
Wish 5: KDE UI testing
Wish 6: AppStore-like installer for KDE on Windows
Wish 7: Make emerge a generic package manager for Windows
Wish 8: Wt Creator
Wish 9: QML WPF
Wish 10: KDE Dolphin “Previous versions” support
Wish 11: Perl Compatible Regular Expressions in CMake
(Not a wish): "A wish a day" did very well in GSoC proposals
Wish 12: Should KDE become the Apache Software Foundation of the Qt world?
Wish 13: KDE-based Digital Whiteboard
Wish 14: Wine-based Application Virtualization
Wish 15: MSVC compiler in KDevelop
Wish 16: libdbusfat

Luggage and RyanAir

FOSDEM ended yesterday and here I am sitting at Charleroi Airport (also known as “Brussels South”, quite a misleading name given that it’s 80 Km from Brussels).

I have already passed all controls, check-in and everything. While I wait for boarding, I am watching the shameful spectacle of airport personnel (let me reiterate that: airport personnel, not Ryanair’s) enforcing RyanAir’s 10 Kg cabin baggage limit. According to RyanAir, they want to minimize the weight the plane carries to use less fuel. So far, so good.

Here is what I have seen: people who do not carry any baggage (very few, they have probably checked it in because it exceeded size or weight), people who are below the 10 Kg limit and people who are way over it (and have been told to check luggage in). I am OK with those cases.

There is still a fourth case: people who are slightly over 10 Kg.

I’ve seen a woman whose bag was 10.15 Kg to be told to pay 20 EUR to check her bag, or go back to the RyanAir desk to check-in the bag. She opened her bag, took a scarf, put it on and now the bag matched the weight limit.

Yes, RyanAir is charging 20 EUR/Kg for hand baggage from 10 Kg on. What a rip-off.

A couple of East-European girls were about 1 Kg in excess each. They put a couple of extra jumpers on and now baggage was under 10 Kg.

Many people were about 1 Kg in excess. When they were told their suitcase better got lighter or pay 20 to 40 EUR. Most of them just took something (camera, food, slippers, whatever) and put in the pockets of their coats. Fortunately, RyanAir is not charging for body and clothes weight (yet?).

In all those cases the plane will end up transporting the same weight and RyanAir won’t get one more dime, so why RyanAir? Why are you such a shameful company? Why are you enforcing ludicrous and pointless policies? Don’t you know after passing the control everybody just put everything back into the suitcase? Of course you do.

So after watching this ridiculous spectacle go on for a while, I had a devious idea: let’s organize a fat people conference and fly them all over to and from using RyanAir. Further, all of them should carry exactly 10 Kg hand baggage.

Domain squatters

Yesterday I spent the morning trying to find an easy to remember, short and nice domain for an idea of mine. Nothing really new, but it’d be useful for me to put a few programming skills I’m forgetting in practice again. After more than 4 hours, I was so frustrated I gave up: domain squatters have registered essentially any potential domain I could come with.

A lot of those domains have been registered for ten years or more, and never have been used for anything.

Many domains are registered by domain-speculator organizations like Sedo, which sell some “great domains” and then use the money to pay for all the other domains they have in the pocket.

Worst of all is the other squatted domains, the ones not owned by Sedo or the likes but by individuals. How can Joe Smith keep paying for a hundred of domains he never uses year after year? Because Google and others seem to be fine with squatters showing Google ads in squatted domains.

So here comes my message to Google: maybe you don’t do evil, but you are supporting the ones who do evil. Please enforce your already-existing AdWords policy to make ads in squatted domains a breach of policy.

Even better: I’d love if NICs started “rescuing” squatted domains.

Conferences are useful: the WtDesktop case

You probably know I love Wt, the Qt-like C++ library for developing webapplications. I gave up on Ruby on Rails and PHP when I started using Wt about three years ago.

Koen and Wim, the authors of Wt, happen to be from Belgium and they attended aKademy 2008. I “arranged” a metting between Koen, Wim, Richard Dale (the KDEbindings man) and me. We talked about how great Wt is, how much the API ressembles Qt and how nice bindings to other languages would be. Guess what? A few months later, Richard had adapted SMOKE to Wt and had developed Wt::Ruby bindings. Impressive.

I attended last year’s FOSDEM and there we go again: over dinner we came with a new idea. Google Gears makes it possible to run webapplications like they were desktop applications. But it’s Python, it requires a Python interpreter an a load of libraries. Can’t we do the same thing with Wt and generate a single executable by statically linking everything? Can’t we? Of course we can! In theory, it would be very easy: start Wt with its own embedded server (wthttp) in a QThread, then load that in a QtWebKit-powered browser. Koen put that in writing as a “>GSoC idea but EmWeb (the company Koen and Wim founded to support Wt) was not accepted as a mentor in GSoC 2009.

It took me a long time to get started with WtDesktop because I was busy with other stuff but two weeks ago I finally started to cut the meat. And it turned out to be surprisingly easy! Yes, WtDesktop works! It’s not in Wt, it’s not finished yet, but I hope I will be able to work on it and have something very nice in a few weeks time (get WtDesktop Technology Preview 2 here; TP3 is in the works, clone this repository)

What will WtDesktop have in the future?

  • Port autodiscovery (for now it’s hardcoded to run on port 9000, I’m having some trouble mixing Qt and Boost signals and slots to make it choose a new port automatically). This is almost done in TP3, which will be available soon.
  • Call-outs: let the webapp go out of the web and add menus, toolbars, etc to the application when it’s linked against Yes, you read it correctly: if you link against you get a webapp with its own embedded webserver, if you link against you get a FastCGI module you can serve from Apache, IIS or whatever, and if you link against you get a desktop appliation. No changes to your code at all! I’d like to have some declarative language like QML for this but that’ll take some time.
  • Printing support. There is basic printing support (i. e. printing the whole page) already but I’d like to be able to connect buttons, frames, etc in the webapp to be able to print only some parts. This would require the above call-outs.
  • Session-sharing and session-stealing. Wt has all the DOM tree for each session in memory, therefore it is able to send the same HTML, CSS, DOM tree, etc to some other address. Session-sharing would be like Remote Assistance on Windows: you can see what the other client is doing but you cannot touch. Session-stealing would be like Remote Desktop: you can click, type, etc and the other client would see a “this application is being used by XXX (IP address: X.Y.Z.T)”.

So yes, attending conferences is definitely fruitful. By the way, I’m attending FOSDEM 2010. Let’s see if I come with some other great idea!

UPDATE: Added git repository

How to save the World Economy in two easy steps

So it seems we are in the middle of the worst financial crisis we have ever faced, which was also led to an economic crisis. In addition to that, nobody knows for sure what to do to fix our Economy. Great.

Here is my proposal: require cheap-labor countries (China, Guatemala, Indonesia, etc) to give their workers the same rights and benefits they do have in our countries (European Union, USA, Canada, etc). If they don’t, heavily tax importations from those countries.

Why is that measure the solution? Read on.

This single change will for sure:

  1. Increase the production costs in cheap-labor countries
  2. Increase inflation in Occident, which now faces deflation
  3. Create jobs in Occident, as cheap-labor countries will be not-so-cheap now
  4. Create jobs in cheap-labor countries, as it will put an end to 12-hour and 14-hour workdays and require an average of 1.5 to 2 workers to perform the same work they do today
  5. Create a middle class in cheap-labor countries, thus creating “good” jobs in those countries (i. e. not just manufacturing jobs)

Not only that: this change is 100% ethical and just. Let us no longer exploit Third World countries in our benefit.

Is this protectionism? No, it is not. It is justice.

Will this destroy jobs in cheap-labor countries? No, it will not. In fact, as we would have cut shifts in half, it will create lots of new jobs in factories. Furthermore: by creating a middle-class in those countries, we will be creating a whole new kind of jobs: the same ones we have now in Occident.

Why heavily tax those importation from those countries unless they abide by this rule? Because it’s the only way to force them to abide

Won’t this make Occident’s situation even worse? Won’t this create inflation? Yes, it will create inflation. Which is exactly what Occident needs now, because Occident is facing deflation and that is really bad.

When this measure is finally adopted by every country, currently-cheap-labor countries will not be so competitive, thus creating jobs locally (i. e. in Occident). Until they do, tax them!

Will this ever be implemented? I don’t think so. A decision like this must be taken in the World Trade Organization context. It may take ten years to reach an agreement. Problem is, Occident will not be able to contain the hemorrhage for more than a year. Either the WTO fast-tracks this decision, or Occident is doomed for the next 10 years.

In response to “What Sun Should Do”: make selling Sun easy

This is a response to What Sun Should Do by Tim Bray

What Sun should do is making sell Sun products easy. Maybe in the US it’s easy to buy Sun through the reseller/VAR channel but it’s not in other countries.

For instance, in Spain none of the major wholesalers (Ingram Micro, Techdata and Esprinet) sell Sun products (they are not even in their product catalog!)

When we the VARs want to sell a Sun product to a client, we have to go through very particular wholesalers (it used to be General Electric Access Distribution, now it’s AVNet), with a very very poor service: you need to phone them and ask for a quote, and they may take as long as ONE SOLID MONTH to answer you. This is unacceptable and it’s the reason I have not sold any Sun product in the last 5 years, even though many times they were the best option: they took too long to answer and many times they configuration I was quoted was not the one I asked for. In addition to that, when GEAD was merged into AVNet, we were not contacted at all.

Sorry but with those extremely poor sales tactics, I’m not surprised Sun is doing so bad.

Of course buying directly from Sun works but that’s a very small market here in Spain: 90% of our business are SMBs and

  1. They don’t have qualify for a Sun Sales person, and/or
  2. They won’t phone Sun because they don’t want to deal with the intrincacies of IT: they rely on VARs and IT resellers

So Sun, here is my advice: help us the VARs and resellers sell your stuff and your sales will soar. Start an aggressive (and I mean REALLY aggresive) campaign among wholesalers, VARs and resellers, and clients will start buying Sun hardware, software and support contracts. Help us help you. We really want.

In addition to that, if you supported KDE4 as the default desktop instead of CDE or Gnome, I’m sure you’d sell more workstations among design and graphics departments: a designer who sees a KDE 4.2 desktop with all fancy effects and graphics, is a designer who truly believes that workstation is capable of doing Maya.

Suggestion for search engines

When I search for a particular software application (Wt, CMake, etc), please show me, in the results page, the latest version and a link to the download page (or even to the file, if there is only one file to be downloaded) so that I do not need to enter the website, check if there is a newer version and, if there is, go to the download page. Here you have a mockup:

Mockup of Google showing the latest version of CMake in the results page

Mockup of Google showing the latest version of CMake in the results page