Archive for the ‘Open Source’ Category
Last time out, I started a simple Cordova project. Having got the default project, it’s time to start making some changes. I should probably note that for some not very exciting reasons to do with where I am today and the dev machine to hand, I have used Visual Studio 2013 with Update 4 for this post.
I thought I’d start with something simple. so I added an <h1> tag and put “Starting the Cordova project” inside it. Next thing is to see if it works. That means running the project. With this being a cross platform app, there are several options. The first thing to choose is the platform you want to run the project on:
If, like me, you found that you cannot see the box on the right hand side, you can add the Solution Platforms drop down selector from the Add Or Remove Buttons menu. There are all the familiar Windows Phone Emulators as well as a selection of Android emulators – the simplest being the Ripple emulators that use Chrome to emulate Android. And remember there is a Visual Studio Android emulator that you an install and use, too.
I started with the Ripple emulator, then used the Android emulator, then used a Windows Phone emulator and the app runs on all of them. Here it is on a Windows Phone emulator:
That’s a working – albeit not especially useful or impressive – app running on multiple platforms. Next time I will look at adding some functionality.
That section has a template for creating a Cordova app:
You can do the same thing in TypeScript if you prefer. When the project is created, Visual Studio shows a helpful Getting Started page. If, like me, you need to find that page again, have a look in the project folder: the file is called Project_Readme.html.
The brand new project contains a number of folders:
I figure I don’t need to understand what they all do know, but it’s good to know they’ve been created in the right structure.
The thing I am interested in is index.html, which is the starting page of the app. Without any changes, it looks like this:
That looks like something I can understand. Next time out I’ll see if I can make some simple modifications to it.
A slightly bigger gap between the first and second posts than I had planned, so having to go back to basics a bit.
A good place to start is this article, which gives a good introduction to Cordova. I’m interested because if you’re building apps, you’re likely to be facing the challenge of writing code to run across a variety of platforms. If you have web development skills, Cordova provides a way to address that challenge.
A couple of other links that look useful are:
And if you have started to look at Cordova, why not provide some feedback?
My next step is to start a simple app.
There’s a binary release of IronRuby, which includes the standard Ruby libraries.
An ironruby-contrib project has been established – another way to get involved in the IronRuby community.
A set of changes to RubySpec have been submitted.
The full blog post on the IronRuby announcements is here. Well worth reading in full.
The next task I had set myself in my Ruby learning journey was to write a GUI for the Twitter client I have created. A quick squiz around the internet reveals a number of potential frameworks. In no particular order, here’s some I found:
FXRuby – "a library for developing powerful and sophisticated cross-platform graphical user interfaces." I was toying with the idea of writing a weak and crude GUI, but this may still be the right choice.
Konundrum – "Very complete bindings to both the KDE API and the Qt APIs." Very complete is clearly a good thing – none of your bog standard completeness here. Now, what’s Qt? It’s a "cross-platform application framework for desktop and embedded development" according to its authors, Trolltech, with "an intuitive API and a rich C++ class library."
Ruby/Tk – there seems to be Ruby bindings for the Tk toolkit. Tk is a "Tcl extension, written in C, designed to give the user a relatively high level interface to his or her windowing environment." Tcl, in turn, is a "a powerfully simple, open source-licensed programming language." Hmm. Does all this sound a little obtuse and slightly recursive to you, too?
Ruby-GNOME2 – "a set of Ruby language bindings for the GNOME 2.0 development environment." GNOME "offers an easy to understand desktop for your GNU/Linux or UNIX computer." And lots of CAPITALS. *nix only is a dealbreaker for me – although the documentation includes mention of Ruby/Gtk2, which uses Gtk+, which runs on Windows. Could be clearer, but if you’re a fan of the esoteric this could be a good choice.
Of course, with IronRuby I could also use Silverlight. I haven’t covered IronRuby yet, so I’ll leave Silverlight for another Ruby Tuesday. For those of you who can’t wait, I’d suggest a little peek here.
Is all this choice a good thing? Or does it distract me from building a GUI by leading me to have to find out some more about each framework / toolkit? As good a concept as choice is, I’m not sure what the choice here really is. I can choose between a bunch of frameworks that do more or less the same thing. So unless anyone has a better idea, I’m going to plump for Shoes on the basis that it has the best, albeit extremely silly, name.
Last week, I installed Ruby on a PC and on a Mac. I installed what is often called MatzRuby or MRI (Matz’s Ruby Interpreter) – but there are other implementations of Ruby. I was already aware of IronRuby and JRuby. Via this post on RubyInside, I found this post by Charles Nutter that covers the implementations that are available. I’m mostly interested in MatzRuby and IronRuby, but it’s good to know what else is available, what stage they are at and so forth.
Having installed Ruby, the next thing that many of us would look for is an IDE. You don’t need an IDE for Ruby, a text editor (preferably with syntax highlighting) will suffice. Being new to Ruby, I don’t know whether I’ll plump for a Ruby IDE in the longer term. There’s an interesting question here about programming habits – which come from your experience and preference and which come from the language you are trying to learn. There are a number of IDEs for those interested – Sapphire in Steel puts Ruby into Visual Studio, and there’s a ruby specific version of NetBeans. There is, no doubt, some way of editing Ruby in Eclipse, but I haven’t looked yet (I’ve used Eclipse before and it feels a little unwieldy to me, so the idea of Eclipse for Ruby seems somehow wrong to me.) For now, I’m going to be using a combination of text editors and IDEs to see what fits.
The first thing to do is to install Ruby. Along the way, I’m going to use a PC and a Mac. Let’s start with the Mac. Open a terminal and type:
On the Mac I used, which is running Tiger, I got the following response:
ruby 1.8.2 (2004-12-25) [universal-darwin8.0]
OK, so Ruby is already installed on the Mac. But it’s not the latest version, which, at the time of writing, is 1.8.6. Fortunately, there’s a download here on the Apple site that installs 1.8.6 – along with some other bits and bobs including RubyGems. Once installed, open a fresh terminal window and type:
I now see:
ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0]
So, we now have Ruby 1.8.6 installed on the Mac. Clearly, a Hello World is called for. Type:
That launches the interactive ruby shell and type:
puts "Hello World"
Great. Let’s move onto the PC. On the machine I used, running Vista, Ruby wasn’t already installed. There’s a one-click installer for Windows – you can find it here. You can pick the version you want to install, I picked “1.8.6-26 Final Release”. It installs:
the Ruby language itself, dozens of popular extensions and packages, a syntax-highlighting editor, an execution environment, and a help file that contains the full text of the book, Programming Ruby: The Pragmatic Programmer’s Guide.
Test the installation with the now familiar:
Here’s the output I got:
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
Finally, run the same steps for Hello World via the interactive shell. I got the same result as I got on the Mac, which is nice.
Along the way I found a couple of links that might be useful to anyone else starting Ruby:
So that’s Ruby installed. Now there’s just the small matter of learning the language…