Showing posts tagged development

The Linux GUI Development Nightmare

For about 2 weeks I’ve been having some fun with Linux development, mainly using Ruby to build command-line applications. My decisions, to create command-line applications using Ruby instead of GUI applications, were made because of a simple factor: GUI development for Linux is a nightmare, since there isn’t at least one good GUI prototyping tool available to help you design your UI without having to do everything manually.

First I tried Glade which is just a nightmare. It’s extremely complicated to deal with and you have no clue about which control you should use or how to arrange things, and most importantly there’s not a lot of tutorials and documentation for new users to learn how to use it, and how to integrate with other languages.

Then I was told that Qt Creator was an awesome thing, so I decided to give it a try. I’ve created a new test project and selected the Qt Quick option so I could use QML, which is a lot better for a developer with Javascript background like me. One of the things that made me like this was the amount of good documentation and tutorials.

When I started playing with the Designer one of the first things that I noticed was the lack of simple controls like Buttons, this was pretty strange and I thought I haven’t installed all the things needed, but when I searched for it I got this tutorial from Qt itself, which explains how to create a button in QML (from scratch!!). QML is one of the most awesome things I ever seen to build the GUI logic, it’s simple and flexible, the problem is that there isn’t any kind of controls to create real world desktop applications with it.

After that I took a look at wxWidgets, which lacks good documentation and a decent GUI designer. Then after all this horrible nightmare I thought about creating all my UIs using HTML5 and wrapping everything around a GTK WebKit window, but I don’t think this is a good approach since my apps would look like an alien to the system.

Where are the Delphis of modern computing? I remember how easy it was to design UIs using Delphi and with a right-click on the control you could easily attach an event to it’s logic. It’s this kind of IDE that I’m expecting, one that focus on the fact that you don’t need to struggle to create a UI, but instead that you should be able to create the UI fast and easily enough, so you can focus on the most important thing that is your application logic.

Linux is a awesome OS, I’ve been using it since 2007, and it needs/deserves better tools to create awesome GUI applications, this is one of the reasons that developers aren’t porting their apps to Linux. On Mac OS X we have the awesome Xcode that includes a incredibly awesome GUI designer, and on the Windows side we have Visual Studio with a designer that is the best one in my opinion, since it’s easy, flexible, and powerful. Isn’t this the perfect time for a great Linux GUI designer?

Using bbUI’s onscreenready and ondomready to Dynamically Change Your HTML

I started playing a bit with BlackBerry development these days and since I’m not the best at Java (also hate how it’s difficult to do simple things with it) I choose their awesome framework for HTML5 native web development called WebWorks. I really loved it because it’s like PhoneGap, but a lot easier to build plugins (extensions on WebWorks) for it to make your native WebApp feel a lot more native.

Another great thing that RIM did to make the life of WebWorks developers easier and create apps that are exactly like native ones is a Javascript framework called bbUI.js, which is like jQuery Mobile, but seriously, it’s a lot more than just a UI framework. It makes it a lot easier to interact with the OS, override the back button for example, and makes your development cycle look a lot with native development by using screens. On this post I’ll teach you how to dynamically manipulate the screen’s HTML before it’s processed by the bbUI library.

One of the first things that you’ll notice after you start working with bbUI is that it’s not just a collection Javascript functions and CSS stylings, it actually reformat and customize your screen’s HTML before it’s shown to the user. As an example, this simple image-list item declaration in your screen HTML source looks like this:

After it’s processed by the library and shown to the user it will look like this:

Hopefully we can easily manipulate our screen elements and other things before and after it’s processed by bbUI. This is done with the bb.init() function (you can always read more at their documentation). This will be called when the application starts and can be used to listen to events like when a screen is loaded. The main ones are onscreenready and ondomready.

onscreenready: This event will be fired before the sources get processed by the library, so here is where you should manipulate, add or remove things from your HTML source using Javascript, so after it’s done the code will be passed to bbUI to be processed.

ondomready: This event will be fired when the screen finished loading and it has been already processed by bbUI and shown to the user. Here you can put things like alerts and other things that will be used to interact with the user, also some little editing to the screen’s source like renaming a field grabbing some information from a field and etc.

Here is a example of a bb.init() call:

The code is almost self-explanatory. The id is the name, second argument, you gave to a screen when you call it to be processed, for example bb.pushScreen(“screen/main.html”, “main”). And element is the screen source code, which is used to be manipulated before the screen is loaded.

A little problem that some developers might come across while using bbUI for the first time is that when you want to append or change the HTML of the screen before it’s processed by bbUI you might write your code like if the HTML was already loaded onto the screen, but it’s not. Here is an example of a code that won’t work, used to populate a image-list and then show a button that was hidden (using jQuery):

The main problem here is that it’s using document as the source to be manipulated. Since bbUI still hasn’t appended the screen into the document it will give you an error. In order to correct this you should replace document with element, that is passed by the onscreenready event. If you have any jQuery code, just add element as a context argument as shown below in the corrected code:

That’s it! Now you know how to use the onscreenready and ondomready events to dynamically insert or modify your bbUI screen’s. Any questions or suggestions just leave a comment and I’ll reply as soon as possible.

Microsoft Finally Saw Where The Developers are Going

Today I revived my hope on Microsoft as I received the news that they released their brand new “product” for their fellow developers. The release I am talking about is the official Metro theme for jQuery Mobile. The awesome mobile framework finally got some Microsoft love.

In December of last year I got a new device to develop for, a HTC Titan, running the latest Windows Phone 7.5 Mango build. I loved the OS UI and how the applications were information-centric and not just eye-candy, but there was one problem, the same way C# is a incredible language for a lot of things, it’s parsing functions, for JSON specifically, are very difficult to learn and the articles about it were made for senior C# developers, which makes it difficult for beginners like me to understand them, at least I now can develop using the technology I love most for mobile development: Cordova (aka PhoneGap).

I always wanted to use Cordova for my WP7 projects but the Metro interface was way too complex to build from scratch and since the WP7 build of Cordova was on it’s early stages there were some features still to be implemented, for example there was no way to prevent the app from scrolling and some other things. Now there are plenty of plugins to make the app as native as possible and with the latest help from Microsoft, the Cordova development community has another great platform with almost full support of the native web app framework.

It’s great to see that Microsoft finally realized that the future of development has Javascript, HTML and CSS as the main languages. That’s why I have hopes that Boot to Gecko gets some market attraction and becomes a popular platform.

Follow my blog with Bloglovin

Dartium is a Great Idea For a New Era of WebApps and Games

As you might have heard of Google included a Dart VM on the latest Chrome Tech Preview. As they said on their blog post:

Today’s release of the Chromium + Dart VM integration is another step forward for the open source “batteries included” Dart platform. Our goal is to help you build complex, high performance apps for the modern web

Dart, just like Go, is a great mashup of Javascript and C/C++ which is great for desktop developers that are currently doing apps with C/C++ and want to move to a better and more flexible language for the web. I know that there is this new thing on Chrome called Native Client that let game (and app) developers use native code to build apps/games for the Chrome Web Store, but Dart is different since it’s cross-browser (if compiled into Javascript).

I’m sure that a lot of developers will like Google’s new language to develop games and web applications for Chrome and for other browsers too with Dart compiled into Javascript. I’ll start learning Dart for sure.

Windows Phone developer experience leaves for Amazon

This is a great thing for Amazon, they are needing more developer support for their App Store or maybe some big announcement is coming, but on the other side this is terrible/a complete failure for Microsoft.

I have a Windows Phone sitting on my desk, along side with an iPhone an iPad and some other Android phones/tablet. I love the Metro interface and the experience it gaves, you can easily get to your information without having to do much, but WP7 isn’t going very well on the phone market, mainly because of the lack of apps, which is why I always bring my iPhone with me when I want get out with my HTC Titan.

I tried to develop some apps for Windows Phone on my Mac running Windows inside a VM, which was a terrible experience because Visual Studio was slow as hell, but the first problem I had was the lack of simple tutorials to know how to integrate C# and Silverlight for beginners, things like how to retrieve and parse a RSS feed and then populate a list with the info.

Microsoft needs to get the attention of developers fast. RIM is at least trying and they maybe get a good amount of developers to develop apps for their platform too.

I’ve selected a great comment by Jordz95 at The Verge’s article:

Knowing what Steve Ballmer is like, he’ll probably just blow up and shout “That F****ng Amazon” like that time a certain employee moved to Google and went crazy at them…

Apart from that this is not good for Microsoft since they already lack having a lot of developers to back the WP7 platform (which don’t get me wrong is an amazing OS, but once again lacks having lots of Apps). So therefore Microsoft is going to have to speed up the competition before Amazon ‘snatches’ their small market-share in the Smartphone and Tablet Industry away from them.