Blog

  • Bake all the things!

    Bake all the things!

    So I made some cinnamon buns from scratch over the weekend, and tonight, I made some Oreo-stuffed chocolate chip cookies.

    How we don’t have diabetes yet is beyond me.

  • Kt: JavaScript Framework

    Kt: JavaScript Framework

    So you may remember that a few weeks ago I was talking about Korgi, this application I was putting together for the Raspberry Pi. As I mentioned then, I first needed to create some widget and user-input handling libraries. Well I’ve spun that effort off into it’s own project, called Kt (pronounced “Kate”.)

    Kt is a framework that allows you to develop stand-alone applications with graphical user interfaces in JavaScript. Included is a widget library, which you can call inside of JavaScript, as well as a “compiler” (a shell script really) to turn your code into an executable.

    A download link is provided at the bottom of this blog post. For Kt to work, you’ll need to have Qt installed along with the standard UNIX suite of tools (sed, grep, etc.)

    As in C/C++, the first function called by Kt is the main() function. Its parameter is always the element ID of the HTML5 canvas. Here’s what the classic “hello world” looks like:

    function main(canvasId)
    {
    	// Setup the surface for the widgets.
    	canvas = new kCanvas(canvasId);
    	mainWindow = new kWindow(canvas);
    
    	// Create the widget for hello world.
    	label = new kLabel("Hello World!", 640, 100);
    	mainWindow.addWidget(label);
    
    	// Run the event loop.
    	mainWindow.run();
    }

    Going through the code above, the first line creates a kCanvas object, which creates a frame-buffer and simplifies the process of drawing to the screen. The second line takes this object, and creates a kWindow object. This latter object manages graphical widgets and user-input.

    Then we add a label widget (a label being static text) with a width of 640 pixels and a height of 100 pixels. Finally, we run the window’s event loop, which will monitor user-input and manage the widgets in perpetuity. This process is similar to how existing widget libraries approach the matter.

    The image of the calculator that accompanies this blog post was done in Kt, and makes use of the layout manager I included. Instead of manually specifying where each item goes using X/Y coordinates, you specify how you want items laid out relative to one another. This means that when you resize the window, the items grow naturally with it, instead of remaining fixed in space.

    So far you’ve seen me refer to the label widget in the code above, and seen the button and line edit widgets with the screenshot of the calculator. I’ve also however implemented a widget to display pictures and another for check boxes. There’s certainly room for more widgets (multiple-line text edit) and complex layout management (scrolling areas), but this is a good start.

    The project is still very much in it’s infancy. Whether it goes beyond this depends on interest from outside. I’m very happy though – for the first time in a very long time, I have a project I can say is at some level of completion.

    You can download Kt here

     

  • Skyrim

    Skyrim

    I’m 82 hours into this game, and while I’ve only just completed the main story, there’s still so much more to do. The assassins have invited me over to their sanctuary, a civil war rages on, and the leader of the thieves in the town of Riften is pressing me for something. Welcome to Skyrim, one of the most fantastic games I’ve ever played.

    It’s a role-playing game, and a pretty one at that. All the images you see here I took during my virtual travels. You start off as a nameless chap ready to be executed. The town you’re in comes under attack, and before you know it, you’re making a run for it with another of the condemned. Once out of danger, the province of Skyrim becomes your oyster.

    What you choose to do from there on in is entirely up to you. You could investigate the source of the attack, which leads to an epic plot line. Or you could become a merchant, purchasing and selling wares at various towns and buying yourself a nice home. Perhaps you’d be interested in becoming a mercenary, or study magic at a reclusive college in the northern reaches of the province. It’s up to you. Along your way, you’ll encounter a wealth of colourful characters that’ll make for a truly memorable experience.

    I’ll let the pictures I’ve posted here speak for themselves. I’ll just say that if you enjoy FPS/RPG hybrids at all, do yourself a favour and pick this one up. You won’t regret it.

  • Future of Computing

    Future of Computing

    Not a season goes by where some person of influence, awed by the latest computerized wonder, announces the impending death of the desktop workstation. The latest catalyst for these views has been the market’s enthusiasm for tablets, an old concept made successful thanks to a paradigm shift in user-interface design popularized by Apple.

    I do think tablets are here to stay, at least for the next five years or so. What I’m anticipating is a growth in tablet adoption at the expense of laptop ownership. The reason for this has to do with what these computers are used for. Laptops are generally a second computer, used for web surfing, e-mail, and other light productivity.

    Tablets fulfill this mandate well. The obstacles that other technologies have had to overcome in order to penetrate mainstream consumer life have already been taken care of by the iPhone-led rise of the smart phone. By dual-purposing smart phone operating systems to tablets, as Apple and Google did, the ecosystem of applications was carried over. This remedied the issue of limited and device-specific applications. Today’s tablets also represent a paradigm shift in the form of simple, visually appealing, touch-based user-interfaces, providing a clear and positive distinction when transitioning from a laptop using a traditional operating system.

    So I am of the firm belief that tablets are not a fad and will shift things around in the portable computing world. That said, I do not believe this signals the end of the desktop computer or of the laptop for that matter. The reason has to do with purpose and how design fits into all of this.

    The current user-design paradigm for tablets and mobile phones is to present a single-purpose program with few options in a graphically-pleasing package. This is great for tablets and mobile phones, but there are times when such limited scopes won’t do.  Think Photoshop, or programming IDEs, or any other tool intended for use by an advanced user. There’s always going to be a need to do more than simple tasks, and until that need is met by other devices, the home computer and its portable analogue are here to stay.

    An interesting development, however, is to have both the simple and complex experience available in one package. The people at Canonical, the creators of the popular Ubuntu Linux distribution, have a really interesting concept. Your smart phone would run as it always had, with an environment geared for mobile use. Connect that phone to a monitor, however, and a full-fledged desktop operating system would come up (pictured on the right.)

    Microsoft meanwhile is making Windows 8 with two modes: one with a simple interface to run on tablets, and another that provides the fully-featured OS that we’ve come to know over the last two decades. KDE, GNOME and Canonical (with Unity) have all reworked their desktop environment to be friendlier to use on tablets.

    All these industry leaders are seeing not the end of the desktop in the immediacy, but of a world where desktop and tablet co-exist while serving different purposes.

    To summarize. The desktop computer isn’t dead, and won’t die for as long there lacks alternatives for what people use them for. Tablets are here to stay for at least the the next five years. Laptop sales will decline as casual users shift to tablets, but will not die off due to the large amounts that use them as desktop substitutes. The idea of a full desktop experience in your pocket, as Canonical has come up with, is damn cool but too exotic to make predictions over.

  • Korgi

    Korgi

    I’m working on Korgi, a program that will let you create your own software using a visual approach. Instead of writing lines of code to define how your application will behave, you’ll be manipulating blocks in a flow chart.

    While what I’m working on will work on Windows, Linux, and Mac, the primary target for this software is the Raspberry Pi. The latter is a $35 computer the size of a credit card intended for the educational sector. As part of a deal with Nokia, I and about four hundred other developers will be shipped one of these in exchange for writing software using Nokia’s still-in-active-development Qt 5.0 platform.

    Because of limitations with regards to what Qt 5.0 can do on the device, it came to be that I needed to write my own widget library before I could proceed. It’s kind of like of how GIMP necessitated the creation of GTK+. If you are familiar with Qt you’ll find this a rather odd statement, but the fact is that Qt 5.0 will only present an interface on the Raspberry Pi using QML or HTML via WebKit. Neither of these were intended for traditional desktop-oriented widgets or give the kind of flexibility I’d need. So I’ve been writing my own library, which runs on top of WebKit.

    I chose HTML over QML because its behaviour is well defined and is not apt to change over the next little while, removing me from the volatility of Qt 5.0 specific features. The above diagram is the abstractions I’ve implemented in order to simplify and modularize the library. From the perspective of the coder using my library, adding buttons, line inputs, and all those things is the same as any other widget library. You define a window/form, add widgets to it, then start the event loop.

    A coder can also use the lower abstractions of my library to simplify the task of directly drawing onto the canvas, or obtaining user input (mouse/keyboard events.) I’ve taken the headache out of the matter. It isn’t as good as other specific libraries, but they are better suited for my needs.

    Once the widget library is ready, I’ll use it to design the interface for my program. Logic will be implemented in JavaScript, the back-end which will handle things one cannot do in a sandbox (namely writing to the filesystem) will be done in C++ using Qt. The web front-end and back-end will communicate using WebSockets. This also opens up the opportunity for Korgi to reside online with a Python+MySQL backend, but I digress.

    I have a few external motivators to see this project through to the end. First and foremost is the Raspberry Pi project itself. Then there’s also the fact that my only other open-source project using web technologies, Solaire, would make any JavaScript programmer weep with shame. It’s not good should any prospective employer check out my past work. Korgi rectifies the matter.

    If you want to keep tabs on the project, I have a repository set up on both BitBucket and GitHub. I’ve been using Mercurial for code revisionning and Google Chrome to debug the web portion of the code.