Wednesday, July 24, 2013

Google's New Email Tabs

There's a lot of discussion going on around them. Eg. on Quora.

I started writing a comment on a comment where Tim Bushell asks :
why shouldn't they be "red", "green", "blue"?
ie. user-defined or neutral.

But then felt it would be better here :

Probably because Google have a database of thousands of email addresses and patterns that they've classified into these categories of "social", "promotion" etc., and with this move they're basically giving you, the customer, the benefit of that classification scheme.

They assume that if you just want to program your own categories and sort accordingly you're already doing it via filters.

What probably didn't occur to Google was that the world is full of people who WANT to be able to define their own categories and filters but never realized that GMail (like every email client in the 20+ years) already HAS this feature.

What's happening is that just by showing people tabbed email, they've suddenly woken everyone up to the fact that your email client can be programmed to filter emails. (Who knew?)
What happens now is going to be interesting.

If Google know how to listen, they'll take advantage of it, add the ability to define your own tabs, integrate it seemlessly with the existing filter architecture of GMail (maybe improve the UI of that a bit, eg. drag / dropping between tabs) and get to bask in the adoration of having "reinvented email".

If not, they'll keep the two systems separate (ie. filter-definition hidden away where most people can't find or understand it) and not only will the opportunity be squandered, but many people will continue to hate the tabs.

Monday, July 22, 2013

Modules In Time : Synthesizing GitHub and Skyrim


Thanks to Bill Seitz I picked up on a Giles Bowkett post I'd missed a couple of months ago which compares the loosely coupled asynchronous style of development that companies like GitHub both promote and live, with the intensely coupled synchronous raids that occur in online game-worlds.

Bowkett seems confused by the apparent contradictions between the two. And yet obviously impressed by the success of both. He wants to know what the correct synthesis is.

That really shouldn't be so hard to imagine. The intense coupling is what happens in pair-programming, for example. Or the hackday or sprint. Its focus is on creating a single minimum product or adding a single feature / story to it.

The right synthesis, to my way of thinking, is intense / tight / adrenalin fuelled / synchronous coupling over short periods, where certain combinations of talents (or even just two-pairs of eyes) are necessary. And loose / asynchronous coupling everywhere else. Without trying to squash everyone's work into some kind of larger structure which looks neat but doesn't actually serve a purpose.

The future of work is highly bursty!

It shouldn't surprise us, because modularity is one of the oldest ideas in software : tight-cohesion within modules of closely related activities. Loose and flexible coupling between modules. It's just that with these work-patterns we're talking about modules in time. But the principle is the same. The sprint is the module focused on a single story. The wider web of loosely asynchronous forks and merges is the coupling between modules.

GrabQuora on GitHub

A couple of tweaks to the Quora grabbing script. Makes it worth upgrading to a full GitHub project.

Quora Scraper

I love Quora. It's a great site and community. But I started getting a bit concerned how much writing I was doing there which was (potentially) disappearing inside their garden and not part of the body of thinking I'm building up on ThoughtStorms (or even my blogs).

Fortunately, I discovered Quora has an RSS feed of my answers, so I can save them to my local machine. (At some point I'll think about how to integrate them into ThoughtStorms; should I just make a page for each one?)

Anyway here's the script (powered by a lot of Python batteries.)




And this turns the files back into a handy HTML page.

Tuesday, July 16, 2013

GeekWeaver

OK ... not shouting much yet, but what with the relaunch of OPML and Fargo, there's a bit of a GeekWeaver refresh going on.

I put the code on GitHub and starting to clean it up, making it suitable for use ...

Watch this space ...

Saturday, July 06, 2013

Restraining Bolts

Today I'm being driven crazy trying to print out FiloFax pages on an HP printer.

Although I've created a PDF file of the right size, I have the right size piece of paper, and I've set up the paper-size in the print-driver, the printer is refusing to print because it detects a "paper size mismatch".

A quick look through HP's site reveals a world of pain created by this size-checking-sensor which can't be over-ridden. People are justifiably pissed off.

What's striking is that this is a problem that didn't exist previously. There are many accounts in this forum of people who, on their older printers, happily used incorrect page-size settings in the driver, with odd-sized paper, and just got their job done.

HP by trying to add "smartness" to their product have made it less usable. This is such a common anti-pattern, engineers should be taught it in school : the more smart-constraints you add to a product, the more likely you are going to disempower and piss-off the edge-cases and non-standard users.

Recently I wrote a Quora answer which I brought to ThoughtStorms : MachineGatekeepers . I worried for people who didn't know how to navigate technological problems in a world where we're encaged by technology.

But I have an even greater worry. The road to hell is paved with "helpful constraints" added by idiots. And we're all suffering as technologies which, with a pinch of know-how or intuition we could bend to our will, become iron cages. It's no good knowing how to google the FAQ or engage with tech. support when HP support is effectively non-existent.

The most disturbing thought here is that BigTech knows this, and increasingly takes away our freedom with one hand and sells it back to us on the other. If enough people complain that their HP won't print on FiloFax pages what's the most likely result? That HP release a fix to disable the page-size-sensor? Or that they'll just release a new printer model which also handles FiloFax paper but is otherwise equally restricted?

Friday, July 05, 2013

Fargo For LinkBlogging

I'm a couple of days into LinkBlogging using Fargo, (at Yelling At Strangers From The Sky) and I have to say, I'm getting into the swing and it's great.

If you keep the outline open in a tab, it's about as fast and convenient to post to Fargo as posting a link to Plus or Twitter. (Which is where traditional blogs like WordPress / Blogger often fall short). In fact, G+ is now getting bloated that it can take 10 seconds just to open the "paste a new message" box. It's a lot faster than that.

It would be nice if it could automatically include a picture or chunk of text from the original page the way FB / G+ do, that's turned out to be a compelling experience for me, but it's a nice not must-have.

A question, is there any kind of API for the outline inside the page which a bookmarklet could engage with? (Is that even possible given the browser security model?)


Thursday, July 04, 2013

Fargo and Google

Couple of quick notes :

1) I'm too dependent on Google. Unlike the case of Facebook, I can't just cancel my account. Google is too deeply entwined with my life. But I am taking steps to disengage if not 100% at least a significant chunk.

2) I'm playing around a bit more with Dave Winer's Fargo outliner. And it is shaping up to be excellent, both as an outliner and expression of Winer's philosophy. (No surprises.)

So, to combine the two, I'm documenting my Google-leaving thoughts in a public outline. Check it out.

Update : I've also been wondering about having a linkblog, somewhere I can quickly throw links rather than G+ (which is inside the Google Walled River). Maybe Fargo will help there too.

Friday, June 14, 2013

Smart Users

Dave Winer :
it would depend on my users being dumb, and as I said earlier, my users are anything but. They're the smartest people on the planet and I want to keep it that way. And I think anyone who makes software for dumb people in the end gets what they deserve. :-)

Tuesday, May 07, 2013

Gates of Dawn

A very, very short library I wrote to let me programmatically create Pure Data patches in Python.

Full story on my other blog.

On GitHub.

Thursday, May 02, 2013

Tags in RSS?

A quick question. What's the right way to add "tag" information to an RSS feed? (So that a story can have a number of tags associated with it? Eg. my last story here was tagged "wiki", "bill seitz" etc.)

Looking at the spec there's a "category" sub-element. Is it this? Does each category need to have a different "category-domain" value? Or can I have multiple categories for an item with the same domain? (This is what Blogger itself seems to do.)


Bill Seitz : Wiki Graph

Over on my main blog you may have seen that I'm musing about my online presence again. Increasingly fed up with Facebook I've now taken the plunge to remove myself entirely. (I haven't, as of writing, deleted my account only because I need to extract some more writings before I do.)

I'm also increasingly concerned about my dependence on Google for so much of my online life.

One man who has few such qualms is Bill Seitz, who has consistently stuck to his home-brewed WikiLog concept over the last 10+ years. I've criticised the idea of WikiLog before - with one of my high-falutin conceptual arguments - but actually I've had to admit that Seitz is right and I'm wrong. The virtues of combining wiki and weblog functionality in your own software (which means very easy, high-density linking between both types of entry, and consistency of managing the address, full ownership etc.) outweigh any qualms about the difference of addressing philosophies.

Now Seitz has gone back to adding functionality to his wiki : the WikiGraphBrowser adds dynamic visualisation that shows the links between pages, creating an instant "TouchGraph" style mind-map. I'm excited, partly because of the software he's producing, but partly because here's another smart person investing in wiki's future.

Tuesday, April 09, 2013

Java Hater

Someone on Quora asked me to answer a question on my personal history of using Java. It became a kind of autobiographical confession. 
I've never had a good relationship with Java.

My first OO experience was with Smalltalk. And that spoiled me for the whole C++ / Java family of strongly typed, compiled OO languages. 
Because I'd learned Smalltalk and this new fangled OO thing when it was still relatively new (in the sense of the late 80s!) I thought I had it sussed. But actually I had very little clue. I enthusiastically grabbed the first C++ compiler I could get my hands on and proceeded to spend 10 years writing dreadful programs in C++ and then Java. I had assumed that the OOness of both these languages made them as flexible as I remembered Smalltalk to be. I thought that OO was the reason for Smalltalk's elegance and that C++ and Java automatically had the same magic. 
Instead I created bloated frameworks of dozens of classes (down to ones handling tiny data fragments that would have been much better as structs or arrays). I wrote hugely brittle inheritance hierarchies. And then would spend 3 months having to rewrite half my classes, just to be able to pass another argument through a chain of proxies, or because somewhere in the depths of objects nested inside objects inside objects I found I needed a new argument to a constructor. The problem was, I was programming for scientific research and in industry but I hadn't really been taught how to do this stuff in C++ or Java. I had no knowledge of the emerging Pattern movement. Terms like "dependency injection" probably hadn't even been invented. 
I was very frustrated. And the funny thing I started to notice was that when I had to write in other languages : Perl, Javascript, Visual Basic (Classic), even C, I made progress much faster. Without trying to model everything in class hierarchies I found I just got on and got the job done. Everything flowed much faster and more smoothly.

Perl's objects looked like the ugliest kludge, and yet I used them happily on occasion. In small simulations C structs did most of what I wanted objects to do for me (and I did finally get my head around malloc, though I never really wrote big C programs). And I had no idea what the hell was going on with Javascript arrays, but I wrote some interesting, very dynamic, cross browser games in js (this is 1999) using a bunch of ideas I'd seen in Smalltalk years before (MVC, a scheduler, observer patterns etc.) and it just came out beautifully. 
It wasn't until the 2000s that I started to find and read a lot of discussions online about programming languages, their features, strength and weaknesses. And so I began my real education as a programmer. Before this, a lot of the concepts like static and dynamic typing were vague to me. I mean, I knew that some languages you had to declare variables with a type and in some you didn't. But it never really occurred to me that this actually made a big difference to what it was like to USE a language. I just thought that it was a quirk of dialect and that good programmers took these things in their stride. I assumed that OO was a kind of step-change up from mere procedural languages, but the important point was the ability to define classes and make multiple instances of them. Polymorphism was a very hazy term. I had no real intuitions about how it related to types or how to use it to keep a design flexible.

Then, in 2002 I had a play with Python. And that turned my world upside-down.
For the first time, I fell in love with a programming language. (Or maybe the first time since Smalltalk, which was more of a crush).

Python made everything explicit. Suddenly it was clear what things like static vs. dynamic typing meant. That they were deep, crucial differences. With consequences. That the paraphernalia of OO were less important than all the other stuff. That the fussy bureaucracy of Java, the one class per file, the qualified names, the boilerplate, was not an inevitable price you had to pay to write serious code, but a horribly unnecessary burden.
Most of all, Python revealed to me the contingency of Java. In the small startup where I'd been working, I had argued vehemently against rewriting our working TCL code-base in Java just because Java was OO and TCL wasn't. I thought this was a waste of our time and unnecessary extra work. I'd lost the argument, the rewrite had taken place, and I hated now having to do web-stuff with Java. Nevertheless, I still accepted the principle that Java was the official, "grown up" way to do this stuff. Of course you needed proper OO architecture to scale to larger services, to "the enterprise". Ultimately the flexibility and convenience of mere "scripting" languages would have to be sacrificed in favour of discipline. (I just didn't think we or our clients needed that kind of scaling yet.) 
What Python showed me was we weren't obliged to choose. That you could have "proper" OO, elegant, easy to read code, classes, namespaces, etc. which let you manage larger frameworks in a disciplined manner and yet have it in a language that was light-weight enough that you could write a three line program if that's what you needed. Where you didn't need an explicit compile phase. Or static typing. Or verbosity. Or qualified names. Or checked exceptions. What I realised was that Java was not the inevitable way to do things, but full of design decisions that were about disciplining rather than empowering the programmer. 
And I couldn't stomach it further. Within a few months of discovering Python I had quit my job. Every time I opened my machine and tried to look at a page of Java I felt literally nauseous. I couldn't stand the difference between the power and excitement I felt writing my personal Python projects, and the frustration and stupidity I felt trying to make progress in Java. My tolerance for all Java's irritations fell to zero. Failing to concentrate I would make hundreds of stupid errors : incompatible types, missing declarations or imports, forgetting the right arguments to send to library methods. Every time I had to recompile I would get bored and start surfing the web. My ability to move forward ground to a halt.
I was so fucking happy the day I finally stopped being a Java programmer.

Postscript : 
1) Something I realized a while after my bad experience was how important the tools are. My period in Java hell was trying to write with Emacs on a small-screen laptop without any special Java tools (except basic Java syntax colouring). I realize this is far from the ideal condition to write Java and that those who are used to Eclipse or IntelliJ have a totally different experience and understanding of the language. 
2) A few years later, I taught the OO course in the local university computer science department. All in Java. By that time, I'd read a couple of Pattern books. Read Kent Beck's eXtreme Programming. Picked up some UML. And I had a much better idea what Polymorphism really means, how to use Interfaces to keep designs flexible, and why composition is better than inheritance. I tried to get the students to do a fair amount of thinking about and practising refactoring code, doing test driven development etc. It all seemed quite civilized, but I'm still happy I'm not writing Java every day. 
3) A couple of years ago I did do quite a lot of Processing. I was very impressed how the people behind it managed to take a lot of the pain of Java away from novice programmers. I wonder how far their approach could be taken for other domains.

Wednesday, April 03, 2013

What's Like RSS?

Dave Winer asked a great question back in December. What standards are like (his ideal for) RSS?

That is, basically fixed forever by convention, large userbase and multiple suppliers?

My suggestions :
In practice, a few Unix classics : SSH, the diff / patch formats, rsync, finger. All used on a grand scale by many parties. Multiple implementations. Multiple pieces of software committed to them. No one really trying to change them.

Email protocols are pretty widely supported and fixed.
Git. It's notionally owned by Linus Torvalds, but he doesn't seem to have any commercial interest in extending or breaking it. GitHub showed you can build a great commercial site around it without trying to make proprietary extensions. And I can use the same clients to push and pull from my server running the default Git daemon, from Github, or from rival offerings (I'm pretty sure BitBucket / SourceForge / Google Code now offer Git as an option)

Possibly Jabber / XMPP


Wednesday, March 27, 2013

Winer's Back!

This is really good news.

Dave Winer finally comes out with a decent outliner in the browser.

I've been looking for one for a long time. (Thought of trying to write it too, but it's not my speciality. Now you get one from the world's biggest Outlining evangelist.)

This is also great news for Winer himself, I think. As always, he has a lot of crucial ideas for where the web should be going. But for a while it's seemed like the main thing holding him back has been a code-base that's a Windows desktop application. (Which is NOT where either users or developers want to party these days.) The few times I've thought I'd like to look into the open-sourced Frontier / OPML Editor I've been put off by that.

A new browser-based UI (and Javascript-based server?) hopefully means that he'll be able to get more people involved in his code, interacting with his services, and start to have an impact via technology as well as evangelism.

And me, I'm holding on for the OPML export / import ... ahem ... cough ...  GeekWeaver ... cough. ;-)

Wednesday, March 20, 2013

Bret Victor Showreel

Bret Victor is one of the few programmers for whom it makes sense to release a showreel.


Elm Lang

I must confess, I'm very intrigued by Elm-Lang.

For me there are four virtues :

1) FRP. All the attempts I've seen to graft FRP onto existing languages have looked clunky to me - ahem ... Trellis? - Requiring the explicit definition of special types of fields. This is the kind of thing that I think needs a new language feature, not a new library.

Elm-lang's "lift" looks a much cleaner way of going about it.

2) It's in the browser. That's where code has to run.

3) I like the way that it reunifies the document / graphics structure back into the same file. The problem is not so much that style and content shouldn't be separated. It's that there are more serious divisions of modularity to respect and forcing HTML and JS into different trees of the filing system has typically pushed highly interdependent data-structure and logic too far apart. I like the ability to bring them back together for small programs.

4) Perhaps it's a way to get familiar with and more into Haskell. Obviously it's not full Haskell. But it seems like a way to get more into that mind-set while doing some practical work.

Of course, the proof of the pudding is in the eating. I'd better go and try something ...  :-)

Saturday, March 02, 2013

SocialCalc and Javascript

Dan Bricklin gives an update on WikiCalc / SocialCalc (the browser-based spreadsheet he wrote). It seems to be having a new lease of life as a web-app embedded in native Android / iOS apps.

Nice!

Also some interesting news about javascript.

Wednesday, February 27, 2013

Mind Traffic Control

If you haven't looked at Mind Traffic Control recently (and I know YOU haven't, because I see the logs), then you may be surprised.

Just saying ... :-)

Friday, February 15, 2013

Personal Question

Question : Hey Phil, do you actually do any programming these days?

Answer : Yes. Quite a lot at the moment. Though it's a bit all over the shop.

I'm dipping a toe into Android programming. (And, hmmm ... Java .... I thought I'd got over my Java hangups by doing a lot of Processing, but it turns out that Processing just hides the crap and Android doesn't. Why hasn't Google picked up on Processing to turn it into a first-class Android art / game app. development environment?)

I'm mainly writing CoffeeScript. Some stuff related to my ongoing 3D modelling / desktop manufacturing projects. (Did I forget to mention those? I'm sure there's a half-written blogpost somewhere.) Some work towards an SdiDesk-derived network diagramming plugin for Smallest Federated Wiki (held up by silly problems). Some other bits and pieces. I've recently been playing with Jison, which rocks. And I'm about to investigate angular.js which looks pretty good.

There's a project for small stand-alone web-servers that I'll talk about more if / when it takes off.

I've been trying to compile example VST instruments  (C++) for some of my work with the Brasilia Laptop Orchestra, but it's driving me crazy. (I may go back to Pure Data which can be embedded in a VST.)

A bit of PHP, just simple small web-services.

I'm going to be teaching an Arduino course soon. So I'll be writing a bit of C and I want to try Occam-.

I'm still writing Python too. Mainly for short file transformation scripts or to prototype algorithms that later get translated into CoffeeScript.

Some of this stuff is headed for GitHub soon.



Giles Bowkett: Rails Went Off The Rails

It's fascinating to read Giles Bowkett on Rails, its bloat, its falling out of fashion.

Fascinating mainly because it so clearly highlights that no-one is immune from this life-cycle that goes :

  • new, simpler and easier than anything else
  • hot-new thing that everyone loves
  • adding more fluff to deal with more edge-cases
  • build-up of technical debt
  • re-writes to try to make more general, more principled, but requiring more configuration
  • old and bloated.
Certainly Python isn't immune. We've been through this cycle with Zope, Plone ... feels like Django has too. Java went through it several times. The node/js/coffeescript frameworks will go through it too. 

DOS/Windows did it. I guess the Macintosh OS has, though Apple have been more willing to kill and reboot its operating systems with the moves to OSX (BSD) and then iOS.





Thursday, February 14, 2013

VB.NET

I'm amazed that Microsoft didn't get the VB.NET domain name.

Tuesday, February 12, 2013

Why Pascal is Not My Favorite Programming Language

This is a great essay on what's wrong with Pascal. But really, it's a great essay on what are some of the nice touches of C that makes it such a good language.

Monday, February 04, 2013

Universal Programming Literacy

My answer to a Quora question : What would happen in a world where almost everyone is programming literate?
How might such a world (of universal programming literacy) come about? 
Most likely from a continuing trend to automate the way a lot of work gets done, and then people would learn programming as a way of engaging with that world. 
For example, instead of spending half an hour in the supermarket or even 10 minutes browsing a supermarket site on the web, you might be able to compose an augmented shopping list on your phone. 
6 Apples
4 bread rolls 
Could become : 
"Apples".
   prefer("Pink Lady" or "Fuji").
     take(6).
   otherwise.take(4)

"Bread rolls".
   only("Wholemeal").
     take(4).
     prefer("Top=Poppy Seed")

Deliver("Wednesday")
Order_from( 
   priorities("Waitrose","Asda","Sainsbury","Tesco")

)

Similar little languages can be developed for most activities. So I'd guess that we'll all be writing little scripts for robots or large automated services. There's an assumption that people must prefer navigating rather laborious graphical interfaces to get stuff done. But if they were more programming literate they may learn to use and love such small scripts instead.

Wednesday, December 26, 2012

Adobe Brackets

Adobe's Bespin-like editor, written in javascript / html.

Sweet

Social Media 2012

My comment on Alex's blog :


Well, you already know but I still think wiki has a future, as pointed to by Smallest Federated Wiki. There are some flaws / issues with SFW, mainly I think because not enough people are working on it, but it’s still the signpost for how wiki could evolve. 
Would still love to see you and other UseMod / OddMuse people look at ways to engage, even if you don’t switch over. 
2012 is the year when it just became more and more clear that we need our own space and shouldn’t be dependent on Fb / Tw / G+ etc. 
Fb / Tw / G+ offer two compelling things : 1) an aggregate river of stuff from people we care about, 2) really easy transclusion from various rich media sites. 
We could have a distributed river architecture if we took RSS and some kind of pubsub architecture (eg. RssCloud) seriously. SFW has made transclusion protocols central to its philosophy. If we pick up on both, figure out how to get the most important things we get from the mainstream working smoothly, we can create a compelling alternative on our terms. And one of the interesting, overlooked, facts about G+ is that it showed that significant numbers of people are still willing to experiment with alternatives. As long as you can get a critical mass of around 20 people you care about to use it, G+ is as valuable as anything else. You don’t need 1 billion users. You aren’t trying to take over the world at this point, just to have a syndication / discussion architecture which isn’t owned by THEM.

Saturday, November 24, 2012

Vi Hart on Making Her Videos

How To Make A Video About How To Make A Video About How To Make A Video About How To Make a Video... 

There's something about Vi Hart's recursive video about how she makes her videos which reminds me strongly of the Lispish ideal of having the Lisp interpreter available at write-time, compile-time and run-time.

Saturday, October 27, 2012

Do The Simplest Thing

Congratulations to Bill Seitz on launching his Personal Finance startup / project.

Tuesday, October 16, 2012

Dog : A Social Language

Dog seems to be a little language for writing social software.

Initial thoughts :

Big question is what it compiles to. It's about time we had a programming language that compiles a single program down to parts that run on both server and clients, in a really easy and transparent way.

Building in knowledge of protocols like http and json and making services like twitter at least members of the standard library is a good idea.

Like most programmers, I'm sceptical of the  "easy English-like" nature of it. We've had plenty of time to learn that what's hard in programming is the logical thinking not the strange syntax. (Update : See my Quora answer)

But if Dog can become a little-language which makes it easy to configure and administrate social software back-ends then it will be very useful. Particularly if there are ways of compiling the same program down to multiple back-ends (Django, Rails, Chicago Boss etc.)

Tuesday, October 02, 2012

Project Schema

This is awesome : Project Schema combines mind-mapping with management of parts of a CAD model. 

Sunday, September 30, 2012

Command Line In Web Apps

Excellent!

Mozilla is releasing a command line library for use in web-apps. 

Initializr

O'Reilly Early Release

I didn't know about the O'Reilly Early Release program. Basically, it seems you can buy a book as it's still being written, and give feedback while receiving updates and rewrites.

Nice idea. I'm tempted to buy some of these.

Saturday, September 29, 2012

Programming With A Mind Map

Using a MindMap to store documentation.

Actually it sounds like Freemind is much like an outliner, in that you can drive it with the keyboard and collapse / expand etc.

I wonder how using this compares to LEO.

(Hat-tip Other Michael)

Friday, September 14, 2012

JSON / RSS

Dave Winer is considering an official(?) JSON flavour of RSS.

I just want to say here that I like RSS, for what it is, and what it does, and I like JSON to actually work with, because parsing XML is still a faff. So it gets my vote.


Tuesday, August 14, 2012

Tuesday, August 07, 2012

Planet Building

As I mentioned in my previous post, I'm rather taken with Planet Planet, the old-skool Python based RSS aggregator that outputs flat HTML.

I used it to build my wonderful Future Manufacturing river. And I want to use it for more things. So I've created a small script to make installing Planet ultra-easy on a linux server.


Four steps and you're rolling :

# clone it
git clone https://github.com/interstar/PlanetBuilder.git  planets

# make the planet
cd planets
./planets.sh MYPLANET

# add feeds
emacs MYPLANET/fancy/config.ini
# defaults have been set-up, just change and add the feed URLs and names at the bottom of the config.ini file and set your name and contact details (earlier in the file)


# edit the crontab
crontab -e
# and add the following line or suitable variant.
53 * * * * /PATH/planets/MYPLANET/refresh.sh
# note that the line with the correct value of PATH will have been given to you when you ran the create script


Your automatically generated aggregate will start being available at MYPLANET/index.html




Monday, August 06, 2012

Walled River

Apple join the war against RSS.

We need to defend the principle of a platform independent / open feed of news items from all the companies like Facebook, Twitter, Google and Apple who have seen the future as feeds insided their own proprietory walled "gardens".

Not sure if a garden is the right metaphor for a feed routing system, maybe "walled river"?

Something like this? :-(
 
 
Hat-tip Scribe.

Open rivers of news are wonderful things. Recently I've started using the venerable Planet feed agregator to make some public planets (rivers) such as this mind-boggling "Future Manufacturing" one. Glance at that and see exactly how awesome open RSS is. And how it can be way more compelling than the constrained Twitter or your riddiculously cramped Facebook wall. Look at a torrent of exciting information that can actually "breath", where text can be as long as it needs and where pictures are wide-screen rather than crammed into a cage designed to make you look at adverts.


Saturday, July 21, 2012

World Outline Screencast

Nice screencast from Dave Winer showing where the World Outliner (the successor to the OPML Editor) is at.

Reminds me of GeekWeaver of course, though obviously slicker (and more specialised).

Friday, June 29, 2012

Mentoring In The Large

Dave Winer has a great aspiration for programmers to engage with long-projects that involve a teaching role.

Wednesday, June 27, 2012

Command 'n' Cursor

I've been travelling with my trusty (but ageing) eeepc netbook this last week. There's much to love about it but it's starting to feel slow in comparison with my other machine.

Increasingly when I use the netbook I try to get away with doing things in a ctrl-alt-f1 shell without logging in to the GUI at all. I'm starting to wish more software could be used in this environment so I began to look at Curses, the standard library for text-window UIs. There's a convenient Python wrapper of course. And there's another nice library in Python : Cmd, for creating a command-line driven apps. That is, not programs that literally run as small tools on the shell with command-line arguments, but programs which have their own internal "repl" style loop which you drive by typing in commands. Cmd handily hides the details from you, letting you declare a subclass of the Cmd class which simply defines handlers for specific commands. It's not a million miles away from something I ended up writing to handle the commands in SdiDesk.

For some of my projects it would be useful to combine the two modes : to have Cmd style input driving a 2D textual output using Curses. Unfortunately Cmd and Curses don't obviously play well together.  Both of them want to take over the input, with Curses thinking in terms of keystrokes while Cmd still expects full lines.

Nevertheless, after a bit of exploration, and learning about Curses's textpads and Cmd's supplementary methods, I'm starting to get the two to co-operate. As this gist shows :



It doesn't do anything yet. Just handles a "greet NAME" command that prints "hello NAME". And a "quit" command that exits the program. But it has combined Cmd inputs with Curses output.

Sunday, June 10, 2012

Show Your RSS

Dave Winer reminds us to help people find our RSS feeds, as it seems that browser-makers are increasingly trying to obscure them from us.[1].

My approach is non-standard, but hopefully conveys the message :-)



[1] Rather like Steve Jobs trying to hide the file-system, some people love to take away anything that it might actually empower you to learn about.

Iterative, Test-Driven Development

My Quora answer :
Iterative, "test driven", development.
Break your idea down into a number of simple "stories", each of which describes a single chunk of activity which goes all the way through from the beginning to the end of a user's experience with the software. Importantly a story is not a traditional "component" ... but represents a complete, working but minimal slice through the functionality.

For example, a story could be "the user goes to our site at a URL and sees a page describing our idea" or, for a drawing program, "the user can create and save a jpg file" (even though that jpg file is just a blank canvas).

Once you have some stories, order them by importance. If you could only get one story working, what would be the most valuable? If you could only get two stories, which would those be?

Start on the most important story. As any particular story shouldn't be too complicated, you can probably figure out fairly intuitively the components you need in order to make it happen. (If you can't, you're trying to fit too much into a single story.) Those components might be functions, they might be objects which have several methods (if so, ONLY worry about the methods of the object which satisfy the current story, ignore any others), they might be HTML forms or templates.

Now write AUTOMATED TESTS for the components you need for this story. Unit tests for the functions and objects. Ideally something like Selenium for the web forms.

Write code to pass the tests in a test-driven style ... ie. write test, write code to pass test, refactor your code to eliminate redundancy, write next test etc. When one story is finished, start figuring out how to do the next most important and work on that.

Somewhere down your list of stories you have your minimum viable product: that is, the minimal thing which is worth releasing to your customers in order for them to give you feedback on whether this is useful to them. That is not necessarily just one story, it might be after the first three. Or the first ten. Whatever it is, once you hit it, release your product to the customers and start getting their reaction.

From now on you are in maintenance / iterative growth mode. You'll be taking the feedback from the customer to rewrite and reorder the stories. While continuing to implement them according to your best, most up-to-date, sense of priorities. You'll want to release new development to the customer as fast as reasonably possible so you can collect the feedback on your improvements too.

Don't assume that one story has to equal one release, because you'll be tempted to inflate your individual story to contain more than it should. But try to keep releases down to as few stories as possible so they can happen frequently : which maximizes both your information, and the customer's sense of progress.

Saturday, May 26, 2012

Ward Cunningham Interview

The job was really to take C++, which was a fairly static language, and show people how to write dynamic programs in a static language. That's what most of the patterns in that book were about. And in the process, patterns extended the life of C++ by a decade, which is not what I thought would happen. What I thought would happen is people, when they learned these patterns, would look at them and say, "Wow, these patterns are hard in C++ and they're easy in Smalltalk. So if I want to think in terms of these patterns, I might as well use a language where they're easily expressed." And extend the life of Smalltalk by a decade. But the opposite happened.
I always suspected that the patterns everyone got so excited about were basically a way of overcoming static typing. Ward confirms it :-)

Friday, May 25, 2012

System Modeller

Wolfram Research present "System Modeller".

I've always been interested in this kind of software, so I need to check this out.

Wednesday, May 23, 2012

1337

Anyone else noticed that in terms of Unix Time we're in a 1337 era?


Tuesday, May 22, 2012

Wiki Renaissance

I believe we're in a wiki renaissance. The Smallest Federated Wiki signals a new era of wiki, slick enough for the age of HTML5, mobile devices and the "internet of things".

So here's a quick manifesto (in progress) that I'm writing about what's at stake in the new era, how it's the same as and different from the previous one. 

Friday, May 11, 2012

Meteor

Just looking at the quickstart demo of Meteor, the hot new web framework people seem to be getting excited about.

First thought. Seems to me that far more important than using the same language for the client and server is being able to write the client and server code in the same file.

That is something I've been waiting for for a long time.

Thursday, May 10, 2012

LightTable

Interesting this new surge of dynamic IDEs. First there was Brett Victor's awesome demo. Now there's LightTable (promoted on KickStarter, discussed on Quora)

Sporadic thoughts.

Is this implemented in the browser? (Bespin? CodeMirror)? Perhaps we're seeing this explosion of innovation as IDE authors move to the cloud.

A Kickstarter project? That's cool. But motivated by early investors getting licenses? Does it also mean that this next wave of software innovation will be abandoning Open Source as a model?

Elements of Jonathan Edwards's Subtext in the tree of updates. Of course, he's paying attention.

Tuesday, May 01, 2012

Quick SFW Generator

Smart Disorganized Individual philosophy is about doing things piecemeal; engaging in small opportunistic actions as and when the inspiration strikes. Today was just such a quick burst with the Smallest Federated Wiki.

I love SFW a lot, but it's a bit of a pain to bring a page or large chunk of writing from elsewhere into it. Adding one paragraph at a time is a nuisance.

So here's a quick tool to create an SFW page from an arbitrary large, multi-paragraph chunk of text. Just paste your text into the box, add a title and choose whether you want ordinary paragraphs (of the kind that most SFW installations use) or whether you want "wikish" (the UseMod derived format which is somewhat compatible with UseMod / SdiDesk markup). Hit the submit button, and it will deliver a json file suitable for dropping into the pages directory of your SFW installation.

Update : the source-code for this is part of Project ThoughtStorms on GitHub.  (Note: I may have broken other import scripts in the refactoring to make this import script work. Please log an issue if you find this.)

Sunday, April 22, 2012

SmallTalk Unix

A quick thought I had a week or so ago on the "failure" of SmallTalk. What if SmallTalk hadn't abandoned the file system? What if it had become the official graphical shell of Unix?

Here : http://thoughtstorms.info/view/smalltalkunix

Saturday, March 24, 2012

Project ThoughtStorms Goes Live

ThoughtStorms has been ported across to the Smallest Federated Wiki.

Of course, there are plenty of failures, missing pages, bits of markup that aren't handled correctly etc. But this is wiki, right? It's never perfect. It's always living and dying and composting. The problems will get flushed out, or worked-around, or become charming ruins over time.

That doesn't mean Project ThoughtStorms is over. It's barely even got started. There are more wikis to port. There's an SdiDesk converter to write. There's plenty of gardening that I am committing to doing.

And then there's the really exciting stuff ... ;-)

Thursday, March 22, 2012

Project ThoughtStorms

As mentioned previously, I've been looking into Ward Cunningham's "Smallest Federated Wiki" concept. And I'm increasingly impressed.

So much so, that I've re-oriented a lot of my projects around it.

What do I mean? A decent follow-up to SdiDesk has been promised for an embarrassingly long time. Over the years I've struggled with exactly what it should be and how it should be implemented. Largely whether it should be a desktop application or something you access via the browser. The browser has always been the logical answer but, until recently, the network diagramming aspect of SdiDesk was not really an option in mainstream browsers. OTOH, desktop GUIs open a can of worms. Which OS? Which GUI framework? How do I write installers and distribute? (And, frankly, what is my, as a non-Mac owner / developer, attitude towards the iPad?)

In 2012 though, HTML5 and CoffeeScript have become extremely plausible options for the client. And the server can become a simple wrapper around a basic PageStore. That's an architecture I've been meaning to get down to write. But it's the architecture that already exists for the SFW.

So, great! By hooking onto that project, I get my basic server / PageStore / client architecture free.

Furthermore it's extensible via plugins. So I can embed special types of paragraph data and special renderers. That's exactly what I wanted to do with the new SdiDesk - instead of having *pages* that were network diagrams or grids, have these as individual components of pages. This is perfect. I can concentrate on what interests me - the special plugin types - and Ward's team can do the infrastructure. :-)

Not to mention, Ward and co. are doing amazing plugin wizardry already : hooking data-feeds from Arduinos, graphing it, bytebeats, calculators. It already has a lot of what looked nice about QEDWiki.

The multi-panel view surprised me initially, but it's really useful for refactoring. And that's going to help me considerably with wiki-composting.

Finally, the "federated" part of the Simplest Federated Wiki is the answer to a bunch of problems I didn't even know I had. Or, at least, didn't conceptualise well. How do I have a private wiki (like a local SdiDesk, where I like to draft things before they go public) AND a public wiki (like ThoughtStorms) and make it easy to move newly public stuff from one to the other? How do I balance the desire to have special project focused wikis (like the OPTIMAES one) with wanting to refer to that stuff from the main wiki? How do I balance contributing to my own wiki and contributing to other communities' wikis?

So, I'm sold. As Dave Winer likes to say, it's the second mover who makes the standard. And that's what I want to help with. There's enough overlap between the SFW and the things I've been wanting to do over the last few years that it makes sense for me to implement my ideas as plugins for the SFW, to port my wikis over to to it and to go around shouting about how wonderful it is. Because, actually, it is pretty damned wonderful.

So, Project ThoughtStorms is where I'm putting the code: so far, converters from the ThoughtStorms UseMod and the SdiDesk formatted pages, and plugins to render the markup. I'll be porting ThoughtStorms over to a SFW server soon. Then I'll be doing some serious refactoring and cleaning up the actual writing. Trashing a lot of the ephemeral junk and dead-links. TS has become a bit of a museum, which it shouldn't be. It should be a living, learning, and forgetting thing.

After that, I'll be sitting down to do some of the other things I've wanted to do in a wiki context but not had the platform to do justice to.  Now I think I have one.

Thursday, March 15, 2012

Unicode

OK. I'm an idiot.

So here's today's BIG Unicode lesson; understand this and, maybe, half your troubles will evaporate.

Unicode is NOT a "code".

No. Unicode is a kind of platonic ideal of which everything else is an "encoding".

ASCII is an encoding. UTF-8 is an encoding. That weird character set you got with Portuguese accented letters is an encoding.

Hence the verb "encode" means to turn a Unicode string into a byte string.

And "decode" means to turn a byte string (say one imported from another application) back into the pure Unicode. 

I repeat. You DO NOT encode byte-strings into Unicode-strings. You decode them into Unicode. And then you re-encode them when you want to export them (as, say, XML or JSON).

read --> decode --> do stuff in your app --> encode --> write

Thanks ... that's all.


Sunday, March 11, 2012

Updating node.js on Ubuntu

Node.js in the main Ubuntu repo is fairly out of date. Here's a useful page on installing the latest.

Thanks Yodi Aditya.

Tuesday, March 06, 2012

Smallest Federated Wiki

I can't believe I haven't looked more carefully at Ward Cunningham's Smallest Federated Wiki. I did glance at it before, but am now making my way through the videos. Lot's of absolutely perfectly pitched ideas working together.

Friday, March 02, 2012

HUD

Personally, I'm looking forward to the new Ubuntu interface : HUD. Looks to me a lot like Humanised Enso (which I was a big fan of when I used Windows regularly)

Monday, February 27, 2012

Three.js

Bloody hell! Three.js is cool. And CSG.

What can't you do in the browser these days?

Friday, February 24, 2012

Rails Off The Rails

Seems like the same thing has happened with Ruby on Rails as happened with, say, Zope.

Giles does a pretty good analysis. The key point is that as frameworks mature they start supporting legacy users and applications who, in turn, have different requirements and values from those looking for a quick way to build new applications.


Permutations with Python Generators

Here's something neat.

I wanted to experiment creating different permutations of a collection of items. (In fact I'm working on some code for laying out shapes on a surface.)

Prototyping in Python to get my ideas straight I came up with this neat generator solution.

Wednesday, February 08, 2012

SpimeScript

These days, I'm thinking a lot about 3D printers, desktop manufacturing and software to create physical things.

Last year I did some art pieces using software to generate drawings for laser cutters and 3D printers, and I'm continuing along the same line. I want to move this stuff into the browser, and the combination of CoffeeScript and Raphael.js is turning out to be pretty good for this. (Did I mention I really, really like CoffeeScript?)

I also dabbled a bit with Prolog, wondering whether it can be used as a high-level description language for machines or other complex objects. The really interesting question is if you can use the built-in inference engine of Prolog to help with the design. (Aside, here's a silicon layout engine in Prolog) I haven't got very far with that yet, but I'm now considering how Prolog can be combined with or made to output OpenScad (or PyScad) code.

A couple of days ago Simon Wardley posted on his blog that he was searching for a SpimeScript :

So, I want to return to ... the formation of Spime Script. We're entering a phase where hardware will become increasingly as malleable as software which leads to a problem of choice - if I want to change the function of something, do I do this in software or hardware? The tendency today is obviously towards software because its more malleable but the future is never the past. However this creates a problem of skill - will I need to become proficient in both software and CAD / electronic design?

In reality both CAD and whatever software language you use, compile down to instruction sets and the function of the device is the interaction of these instruction sets - one which is substantiated physically and the other which is substantiated digitally.

Turning this on its head then why not write the function of what you want, the function of the device? Compilers can therefore undertake the complex decision trees (which is what they're good at) required to determine what element of that function is encoded as physical and what element is digital.

A future language is needed, something whereby the output is both physical and digital and I describe merely the function of what I'm after.

That's a really exciting vision.

Now, here's what I think is really important for a SpimeScript.

It should learn from HTML / CSS.

While HTML / CSS is a pain in many ways, there's a very interesting insight in it about design. That design comes in layers. It's partly about the separation of logical structure and visual style. It's partly about the cumulative effect of the Cascade in Cascading Style Sheets. It's partly about the fact that the browser has reasonable defaults for the geometric properties of logical structure. (Today, those defaults look rather out-of-date but there would be little to stop a browser manufacturer making their defaults look more like Readability or Twitter Bootstrap.)

So here's the main feature request for a SpimeScript. It should be possible to define the logical structure of, say, a machine and have some layout-engine give it plausible default geometric properties. But it should also be possible for designers to layer optional design hints on top of that layout in the form of extra constraints and have the engine deal with fitting them together.

As with the silicon design case, there must be some prior art here, but I'm not quite sure where it is. Electronic Design Automation maybe.

Sunday, January 29, 2012

SqueekNOS

SqueekNOS is a project to create an operating-systemless Smalltalk. Ie. one where the Smalltalk machine replaces most of the operating system (apart from a small kernel I guess).

The nice thing about this : everything is inspectable / hackable. All the way down.

Thursday, January 26, 2012

CoffeeScript

Just a note. I am really, really liking CoffeeScript now.

It's reminding me both of freedom that Python gave me when I first turned to it after Java. And bit of my experience with Erlang. ( If only it had Erlang's Actor model and pattern matching arguments ... )

The other good effect of this, CoffeeScript is making me more comfortable with investing my time writing serious logic on the browser-side. Which is where it should be, given the requirements of modern applications and that the browser is becoming the default GUI. 

Programming in Go

Very interesting video about how to program with Go language.

Saturday, January 07, 2012

Tuesday, January 03, 2012

WaveFlavours

So, slight Christmas / New Year's diversion from my main projects - I've been writing a wave-table synth in the last few days. Code (C++ using Maximilian) is here.

The main thing I'm doing is to have two wave-tables for a voice, and then slowly swap sample points between them to get a long-term evolution of the sound. I want to get a rich and ever changing timbre cheaply ie. without having to use filters or expensive FFT.




Tuesday, December 13, 2011

UI Stencils

Clever idea. Stencils for UI designers.

Guess you can make your own with a laser-cutter.

Monday, December 05, 2011

Defending Lean Startups

Got into a long comment on Nick Pelling's blog. He's sceptical about Eric Ries. I'm fairly neutral, but here's my response to Nick.

Surely all practical knowledge is anecdotal and, therefore, an unwarranted step from the particular to the universal. All advice in this “genre” (Tom Peters, Charles Handy, Seth Godin etc. etc. etc. ) comes with an implicit health warning. And anyone with any experience of the world will apply salt as a matter of course. 
Should we hold that against Ries in particular? 
So his models come from the software industry. OK. But someone else’s advice will come from banking, or food retail or oil or the military. Each with some parallels to your business but each with its own idiosyncrasies as well. 
One thing you can say in favour of Ries’s bias is that more and more things are getting automated and so more and more of our world “is made of software”. Software processes are replacing other kinds of process that were embodied in administrative or managerial practices or hardwired into physical machines. In this world, improvements in software are often more effective than improvements in other areas. 
You’re a coder yourself. You probably know your Mythical Man Month etc. You know perfectly well that software doesn’t benefit from heavy bureaucratic management. But that exciting and effective software usually does come from small, enthusiastic, “agile” teams. 
So, if software is becoming an increasingly important factor in business. And software thrives under agile conditions, it would follow that business in general will probably benefit from agile. 
Disclosure : I’m a software guy myself, so I’m totally down with the land-grab programme.

Monday, November 28, 2011

HackerType

Possibly one of the more hilariously idiotic things I ever saw online. Impress your friends with fake coding skills. WTF?????

Sunday, November 13, 2011

Mind Traffic Control Bug

A recent change in Mind Traffic Control introduced a bug preventing those who weren't already logged in from logging in. This is now fixed.


Wednesday, November 02, 2011

CoffeeScript and Raphael.js

I've been working on a project based on some of my recent artistic works. I thought I'd do it using a Processing sketch embedded in a web-page. It's not that I was particularly happy with Java applets (in 2011!) but I figured I'd make use of the Processing code I already had.

After a whole lot of faffing around trying to get the applet talking to my server, I'm realising that this is really NOT going to fly for a whole bunch of reasons. I wasn't really seeing Java as my long-term future anyway, but I've realised that it isn't even going to be the quick, dirty but workable prototype that I'd hoped. So, if I have to make a break, I might as well do it now and quickly. And look to the future rather than the past. So I've made a decision to rewrite with CoffeeScript and Raphael.js. (I'm generating SVG designs anyway, so Raphael is ideal.)

After a spending a couple of hours today, that's feeling like good decision. There's still the hassle of having to convert a lot of code, and it's a bit of a fiddle going backwards and forwards between the editor, the command-line compiler and the browser. But CoffeeScript feels like a good language. Obviously meaningful whitespace indentation is comfortable for a Pythonista like me, and I'm getting used to the Rubyisms without too much pain.

Not much in the way of debugging information, which hasn't bitten me yet, but might. Still, I'm positive.

Friday, October 21, 2011

Linux Commands For The Web

Can't remember if I saw this before, or if I posted it, but it's beautiful.
One of my favorite business model suggestions for entrepreneurs is, find an old UNIX command that hasn't yet been implemented on the web, and fix that. talk and finger became ICQ, LISTSERV became Yahoo! Groups, ls became (the original) Yahoo!, find and grep became Google, rn became Bloglines, pine became Gmail, mount is becoming S3, and bash is becoming Yahoo! Pipes. I didn't get until tonight that Twitter is wall for the web. I love that.
Marc Hedlund via Coding Horror

Friday, October 14, 2011

The Future of Arduino and Android

Very interesting talk by the creator of Arduino about their plans for integrating with Android.

Verpa's Gmail lib

Playing with this library to access my Gmail account via IMAP. Seems pretty simple and convenient, though fairly basic.

Monday, October 10, 2011

BEACHhtml on GitHub

It's kind of trivial, but I put the html generating code that I mentioned in this post into GitHub. Mainly because I wanted to be able to share it between a couple of different projects and it made sense to use a Git submodule.

So here it is.

Google's Dart

So Google's Javascript replacement language, Dart goes public.

Looks awfully like Java with a smattering of CoffeeScript. I like the empty compact constructor and the one-liner functions. But I'm not sure what those colon ones are doing.

Presumably some jQuery-like action with the document.query().

Looks a little bit messy, but then Javascript has got kind of messy. Shame they didn't try to go for the CoffeeScript cleanness.

In a sense, it may be rather similar to writing Processing if they produced a decent IDE.

On the whole, I think I can live with it.

Some interesting evaluation at Lambda the Ultimate.

Monday, September 26, 2011

Shhhh ...

I have a confession ...

I re-installed the Google App. Engine dev, environment on my machine. I popped open the Mind Traffic Control codebase and looked into it. I was a bit overwhelmed at the clunkiness of some of the code (I've become a more concise Python programmer since then) but I realised I could still make sense of it.

I tweaked a couple of minor appearance bugs and refreshed the server.

It worked!

It's been a long time since I actually had a working MTC development environment.

I wonder what this means ...

Sunday, September 25, 2011

Google's "Future of Javascript"

So Google blame Javascript's weaknesses for Apple's success with iOS and its app ecosystem, and want to replace JS with their own alternative.

Obviously I think this is the most wrong-headed thing I've heard in a while, and a worrying sign of idiocy within Google.

I'm not particularly concerned about the future of Javascript which I'm sure will be around  long after Google's alternative is abandoned.

Tuesday, September 20, 2011

Wednesday, July 13, 2011

Tuesday, July 12, 2011

Been browsing some interesting discussion over at Quora on how they built their site.

It's basically Python and Pylons. But this is cool. They don't use a templating language.

Here's developer Charlie Cheever :

What "templating" means to most people is a way of having the developer write out HTML basically the way that you would send it to the browser and then having a way to include a few things -- typically variable substitution by using special tags lik <% ... %> or similar.

In our case, no one writes any code that looks like HTML/XML literals, so there's nothing in our codebase that really matches what most people think of as templates. We do have view code but that interleaves calls into the model and application logic along with a Python code description of what the HTML for that component should be, which is different from templates which are usually based around the ideas of separating logic and data fetching from this.


This sounds like an approach I've been favouring for a while. I did it in Mind Traffic Control, some other unreleased SdiDesk in Python experiments, and I do it in some Javascript I've written. People think that you should separate HTML from code because HTML is the domain of designers and code is for programmers. But I think HTML is the realm of data-structure (designers should stick to CSS) and part of the programmers' remit.

The way a programmer (or at least, this programmer) wants to express complex data structures is with function composition. So here's an example of my html.py file.


# HTML library
# basic level

def tag(name,x,*argv) :
if x is None :
return u"<"+name+u"/>"
if argv != (None,) :
inside = u''.join(argv)
else :
inside = u''
if isinstance(x,dict) :
# we're passing a dictionary of attributes for the tag
s = u"<%s " % name
s = s + ' '.join(['%s="%s"'%(k,v) for (k,v) in x.iteritems()])
s = s + u">"+inside+u"</"+name+u">"
return s

# or there are no attributes, just inner
return u"<"+name+u">"+x+inside+u"</"+name+u">"


# Now we'll actually make some tags
tags = ['html','head','body','script','p','div','table',
'tr','th','td','ul','ol','li','dt','dd','h1','h2',
'h3','h4','h5','h6', 'style','pre']

loc = locals()
def setit(loc,t) :
loc[t] = lambda x=None,*argv : tag(t,x,*argv)

for t in tags :
setit(loc,t)


# Use like this
html(
head(),
body(
h2("Header"),
p('para1'),
p('para2')
)
)




But I did start to wonder, given the prevalence of templating languages and some of my recent experiences as a Django developer, whether this wasn't just me being wilfully perverse / crazy. I admit I'm kind of relieved to read that Quora are doing something similar. Maybe I wasn't so mad after all.

Bonus link : Decomposition by language is probably a modularity mistake. (Written back when I was more confident.)

Thursday, June 02, 2011