Tuesday, January 25, 2011

Coding in the Cloud... Linux Shell in a Web Browser

The last few weeks I've been exploring how to use an iPad, tablet or netbook to write programs in the cloud with just a Web browser connected to my Linux servers.

I've played with the recent Web based source code editors from Google (Code Mirror), Mozilla (SkyWriter), and Eclipse (Orion). They're OK, but a source code editor is just not enough for me...

I also need a browser-based Linux shell window. There's some good ones out there. I've tried Ajaxterm (a little slow and not all keys worked), Anyterm (keyboard issues as well), and finally settled for Shellinabox.

Shellinabox gets pretty close to a real xterm. I've been using it for two days for various tasks including coding (with vi). I like it a lot! and am starting to think that vi in a shell in shellinabox compares favorably to these new fancy Web based editors...

I've patched it to allow a shell to set the browser title using a VT escape sequence in an environment variable (PS1='\\033]0; [\W]\007\\w \$ ' for example), like people usually do with xterms. 

The patch is there on my Github account. I find it useful to help distinguish Shellinabox browser windows and tabs and see what directory they're in.

If I find time, I'll post the steps I'm using to configure Shellinabox, build it and connect to it through a secure HTTPD reverse proxy... later this week.

Thursday, January 20, 2011

CLang completes support for C++0x variadic templates

The CLang project has just completed support for C++0x variadic templates (see [1], [2], [3]).

Pretty good news! CLang now compares well with GCC.

The CLang and underlying LLVM projects use liberal BSD, NCSA and MIT licenses compatible with the Apache 2.0 license (see [4]). That's better than GCC, GPL licensed and usable to build an Apache project but not embeddable in the project itself.

I've been thinking about using CLang in the Apache Tuscany C++ project for a while.

I'd like to use its API to convert SCA composites (XML docs describing SCA component assemblies) into C++0x templates and compile them into machine code on the fly, instead of having to interpret all the XML gorp at run-time.

Think of it like an 'SCA assembly JIT compiler'...

Benefits: ultimate speed, CPU and space, cloud resources (and resulting monthly bill) optimizations, and less XML parsing and interpretation code to worry about.

Requirement: support for C++0x variadic templates...

Patience may pay off after all, as it is finally there.

I gotta try that stuff this weekend!

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2080.pdf
[2] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
[3] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2488.pdf
[4] http://www.apache.org/legal/3party.html

Tuesday, January 18, 2011

Coding in the Cloud... Feels good like back to the 80's

I started programming on a VT100 terminal in 1980, with:
  • a white/black screen / 24 x 80 characters
  • no disk, data on a server
  • vi
  • assembly language + C on Unix
  • a few programming books
  • some deep thinking

I loved it!

Then, after a few detours through:
  • a dozen or so programming languages
  • fancy OSes on hi-res overheating laptops
  • 'integrated' development environments
  • 'code assist' (enough said)
  • no thinking (replaced by 'IDE' and 'code assist')

Recently I've gone back to a more productive environment:
  • 24 x 80 characters
  • vi
  • a few programming books
  • Web search
  • some deep thinking

I can think again!

But still missing that part:
  • no disk, data on a server, always on, accessible from anywhere

Then something cool happened today:

The Google Project Hosting team just announced the ability to edit programs directly in the Web browser using an online editor powered by CodeMirror. With Mozilla's SkyWriter, and Eclipse's Orion, that's one more way to edit code 'in the cloud' from a connected device.

That works well for me, as most of the programs I write these days run on servers 'in the cloud' anyway (say, big servers on a network instead of my laptop).

I've also been looking at the iPad as a programmer terminal and wondering about the upcoming iPad-2.

So, here's my future programming environment:
  • White/black screen / 24 x 80 characters
    How about an iPad-2, Google CR-48 or similar netbook and a single Web browser window with big fonts?

    I haven't been lucky enough to receive a CR-48, so I'm thinking about buying an iPad-2 out and hacking a programmer-friendly keyboard app for it.

  • No disk, data on a server
    Anybody say Cloud?

  • VI-like
    CodeMirror, SkyWriter, a hosted Orion server, or I'll just hack up a vi-like editor on top of one of these projects.

  • Assembly language + C Well, I have to use Java at work, but on my spare time I like to code some C, C++, Scheme, Lisp, Python or F#. Feels better. I haven't written assembly language for a while, but now that I think about it...

  • A few good programming books
    Receiving the new TAOCP-4a book tomorrow, and will probably spend a few nights reading it.

  • Web search
    Allow for a second browser window.

  • Some deep thinking
    Still thinking...

I already love it!

Hmmm, the new iPad-2's rumored fancy screen should be enough for some 24 x 80 coding, right?

Is IPad-2 the new VT100 terminal? :)


The postings on this site are my own and don’t necessarily represent positions, strategies or opinions of my employer IBM.