Walter Higgins

Tinkering with Software & the Web

We need Bookshops

2013/04/25 16:59

And he offered this comparison of the two ways of buying books. “Physical bookshops sell you a book that you didn’t know you wanted until you walked in. Online it’s a narrowing experience – when you walk into a shop, it’s a widening experience.”
-- Do We Philosophically, Emotionally Need Bookstores? | Publishing Perspectives

Categories

Books, Bookshops

Breaking Mad Thrones

2013/04/12 16:16

Mix and match the characters from TV Shows Game of Thrones, The Wire, Mad Men and Breaking Bad. This stuff writes itself...

Episode 1

Walter White dumps Jesse and forms an uneasy alliance with Tyrion Lannister to expand his Meth Empire into Westeros.

walter white tyrion jesse pinkman

Episode 2

The Lannisters hire Don Draper to do a brand make-over. With only crude Quill and Parchment to work with, Don walks out on the client as only he can.

don draper

Episode 3

Peggy Olson swoops in to save the day and bonds with Cersei Lannister while discussing new Lannister Sigils. Omar Little (The Wire) is appointed King's Hand and begins plotting to overthrow King's Landing from within.

peggy olson cersei lannister omar little

Episode 4

Tywin Lannister and Roger Sterling enjoy a brief philosophical interlude, trading quips about the ups and downs of being a patriarch (This scene may involve sexposition). Jesse Pinkman seeks out Omar Little with an interesting proposition.

tywin lannister roger sterling jesse pinkman omar little

Episode 5

Walter becomes increasingly impatient with Tyrion's laissez-faire attitude. Both have misgivings about the partnership. Roger Sterling's tongue-in-cheek advances toward Brienne of Tarth are rebuffed.

walter white tyrion lannister roger sterling brienne

Episode 6

Omar goes on the run after pistol-whipping Prince Joffrey. Jesse unwittingly becomes a pawn in Master-of-Coin Petyr Baelish's quest for power.

omar little joffrey jesse pinkman petyr baelish

... and so on.

Categories

Game of Thrones, Mad Men, Breaking Bad, Television

Reader

2013/03/14 13:56

It's hard to argue with this statement...

The truth is this: Google destroyed the RSS feed reader ecosystem with a subsidized product, stifling its competitors and killing innovation. It then neglected Google Reader itself for years, after it had effectively become the only player. Today it does further damage by buggering up the already beleaguered links between publishers and readers. It would have been better for the Internet if Reader had never been at all.
-- cortesi - Google, destroyer of ecosystems

I reluctantly moved to Reader only when it was apparent that BlogLines was well and truly over. My history of RSS Readers is...

  1. AmphetaDesk
  2. BlogLines
  3. Google Reader

... I'm wondering - what next? If I was to be true to the spirit of web self-sufficiency I should self-host. My first thought on hearing that Google Reader was shutting down was "How hard could it be to write your own RSS aggregrator?". Madness - I know - but ...

We’re finally likely to see substantial innovation and competition in RSS desktop apps and sync platforms for the first time in almost a decade.

It may suck in the interim before great alternatives mature and become widely supported, but in the long run, trust me: this is excellent news.
-- Google Reader shutting down July 1 – Marco.org

Categories

Google

ScriptCraft Update

2013/03/09 17:11

I've been steadily plugging away at ScriptCraft these past few weeks. Fixing bugs, adding new functions, improving the documentation. I've just uploaded a new version which you can go grab at ScriptCraftJS.org. What I'm most proud of in this release is that AutoCompletion (Tab Completion) has gone from it-kinda-works to it-actually-works. AutoCompletion is one of those IDE features most Java programmers can't live without. Getting it to work for a live javascript environment is fun. To see it in action try the following....

  1. Fire up your CraftBukkit/Minecraft Server and connect to it from a minecraft client.
  2. At the in-game prompt type /js arr then press the TAB key.
  3. The command will change to /js arrows
  4. Now at the caret position type . (that's a full stop) and press the TAB key again.
  5. The command will change to /js arrows.explosive()
  6. You can cycle through all of the possible arrows methods by repeatedly pressing TAB.

... Pretty cool. No? (Side-note: If you're curious about what all of these arrows methods actually do, just execute one of them and equip yourself with a Bow and shoot an arrow to find out). Auto-completion is just one of those features that makes exploratory programming that much easier. For ScriptCraft, the Auto-Complete feature became a must-have when my two kids began arguing over what the arrows functions were called. AutoComplete isn't just for professional Java programmers equipped with powerful IDEs. Eager young minds, keen to learn programming should have as much help as possible from the computer.

Categories

ScriptCraft, Programming

Pearls

2013/02/21 16:08

"Pretty girls do not need a lot of education to marry into a rich and powerful family. But girls with an average or ugly appearance will find it difficult," reads an excerpt from an article titled, Leftover Women Do Not Deserve Our Sympathy, posted on the website of the All-China Federation of Women in March 2011.

It continues: "These girls hope to further their education in order to increase their competitiveness. The tragedy is, they don't realise that as women age, they are worth less and less. So by the time they get their MA or PhD, they are already old - like yellowed pearls."

Ouch.
-- BBC News - China's 'leftover women', unmarried at 27

Categories

China

Bipolar

2013/02/21 15:39

Now in contrast, the C/C++ approach is quite different.  It's so damn hard to do anything with tweezers and glue that anything significant you do will be a real achievement.  You want to document it.  Also you're liable to need help in any C project of significant size; so you're liable to be social and work with others.   You need to, just to get somewhere.

And all that, from the point of view of an employer, is attractive. Ten people who communicate, document things properly and work together are preferable to one BBM hacking Lisp who can only be replaced by another BBM (if you can find one) in the not unlikely event that he will, at some time, go down without being rebootable.
-- The Bipolar Lisp Programmer

Categories

Lisp, Programming

Desensitize

2013/02/21 08:29

What we need to remember is that people are often learning things from within the model of different video games that may in fact be preparing them for work in the 21st century.  This includes becoming desensitized.  Desensitization is not only a broad term, but also one which gets a bad rap in our society.  But the truth of the matter is that many occupations require a level of desensitivity, which allows us to effectively perform a task in the face of difficult feelings evoked by it.
-- Joan Ganz Cooney Center - Improving Our Aim: A Psychotherapist’s Take On Video Games & Violence

Categories

Gaming

ScriptCraftJS.org - A new website for all things ScriptCraft.

2013/02/12 21:13

ScriptCraft now has its very own website. ScriptCraft.org nor ScriptCraft.net weren't available so I went with ScriptCraftJS.org. The name 'ScriptCraft' needs some disambiguation - it turns out there's an existing plugin for World of WarCraft with the same name. Whatever.

Maybe I'm getting old or just rusty but the process of setting up a new site seemed trickier. I haven't been able to bed down Apache on my new laptop yet and setting up and configuring Apache on Ubuntu is harder than I remember. Another sure sign I'm getting older, I began writing the index.html page in plain old HTML but quickly grew cranky having to write all of those opening and closing tags. Nowadays, writing for the web in anything other than Markdown seems pointless.

Anyway - I may put some ads on that website yet. It's important that there's a portal for all things ScriptCraft related.

Categories

ScriptCraft

Just enough Java to load JavaScript

2013/02/08 17:26

This is just enough Java to load and run Javascript...

import javax.script.*;
public class jscript
{
    public static void main(String[] args) throws Exception
    {
        ScriptEngineManager factory = new ScriptEngineManager();
        ScriptEngine engine = factory.getEngineByName("JavaScript");
        java.io.File file = new java.io.File(args[0]);
        engine.put("engine",engine);
        engine.put("args",args);
        engine.eval(new java.io.FileReader(file));
    }
}

... JavaScript to Java: "That'll do Java - I'll take it from here."

Categories

Java, JavaScript

Follow-up

2013/02/08 16:47

What’s notable is that he also invested the follow-up effort to ensure the software was engineered well-enough to work on other computers and on multiple operating systems, could be understood and maintained by others, was adequately documented, licensed to be useful, and so on. All those apparently secondary activities typically  take orders of magnitude more time than the original coding at the heart of a successful program.
-- Fabrice Bellard: Portrait of a Super-Productive Programmer

I have a lot of things on my to-do list for ScriptCraft. Top of that list is documenting the existing API. It's a lot of fun using ScriptCraft myself but I really need to document it better - both the API and the Young Person's Programming Guide.

Categories

Programming

Testing

2013/02/06 13:16

As someone who has worked as both a Tester and a Developer (though never both at the same time), I can whole-heartedly agree with this...

Testing is not for the meek. It's not for the unimaginative. It's a skill and a professional arena that needs to be just as important as the programmers, product people, UX designers and others.
-- The Codist

Categories

Testing

Rainbows and Giant Glittering Disco Balls in Minecraft

2013/02/03 12:13

Completely Heterosexual Minecraft Screenshot

I've spent a bit of time reworking the ScriptCraft Drone code to make it more versatile when it comes to anything with curves (Spheres, Cylinders, Arcs). There's a new rainbow() function which takes a single optional radius parameter. You can see the result of a /js rainbow(200) in the above screenshot - along with the result of a /js sphere0(42,120) - yes that's a 120 block radius perfect hollow sphere in minecraft - expect it to take a while to build and don't be surprised if you get disconnected from the server while that death star is constructed. I really like that screenshot even though - yes that Death Star does look kind of like a disco ball and everyone knows Disco music and Rainbows are... - wait a minute!

Next steps: Documenting all of this stuff using JSDoc. Meanwhile you should definitely check out what Chris has been doing with ScriptCraft - a WolfBot! Very cool.

The very latest ScriptCraft source and binary.

Categories

ScriptCraft, Minecraft, Javascript

Minecraft Mini-games using ScriptCraft

2013/01/27 14:56

Behold! The first minecraft mini-game written in Javascript. The mechanics of starting the game are a little crude I admit but the game has become a bit of a hit with the small sample of players who've played it so far. The game is called Snowball Fight (imaginative - I know) and it involves teams firing snowballs at each other. The aim of the game is to hit as many opposing team members as possible before the clock runs out. You gain points for hitting opposing team members and lose points if you hit one of your own.

The code behind this is tiny - at the time of writing - less than 100 lines of javascript. The aim here is to inspire kids (both young and old) to create their own mini-games so I wanted to start with something that's small and simple but still a lot of fun. I already have plenty of ideas for how this game could be improved and have another game in mind (pig-pong - teams must herd pigs into a pen using carrots).

Playing games can be fun but programming games that your friends will enjoy playing? - that's a whole different level of fun.

Categories

ScriptCraft, Minecraft, Javascript

Anatomy of a ScriptCraft Plugin

2013/01/23 00:58

So this christmas project... it's grown legs. I've been working on ScriptCraft late most nights and haven't really had a chance to talk about what I've done so here goes....

ScriptCraft has evolved a little from it's early MCP-only incarnation where you could only use it for building stuff in minecraft, into something much more. I've switched from MCP (Minecraft Coder Pack) to Bukkit because bukkit has a sane API and the bukkit guys have been hired by Mojang to work on the upcoming official plugin API so chances are there won't be too much breakage for existing bukkit plugins. The remit of ScriptCraft has expanded so that you can do more than just build - you can do anything you like - Custom Event handling, mini-games, interactive/dynamic signs, easy signage (text written using minecraft blocks), - anything you can do using a java-based plugin, you can do it faster and easier in Javascript with the ScriptCraft plugin. To demonstrate this, I've recreated a commonly-used mod (homes) in javascript. The homes javascript plugin lets players set their current location as home and return to that location using in-game commands. They can also visit other players' homes. It's a simple plugin that demonstrates a couple of new features in ScriptCraft ...

... First persistence. Persistence is the ability to retain state after the server has shutdown and started up again. Persistence is something you get for free if you create your javsacript plugin using the new plugin() function provided with ScriptCraft - just keep any data you want to save in a property called store and that data will be written and read at shutdown and startup. The data is persisted in JSON form so it's even somewhat human-readable. Declaring a new plugin is easy, you give your plugin a name, specify an interface/object and whether the plugin should be persistent. For this I'm going to create a new plugin called "chat" that will let players change the default color of their messages in the in-game chat window...

plugin("chat", { 
    setColor: function(player,chatColor) { 
        this.store.players[player.name] = chatColor;
    }
}, true);
// initialize the store 
chat.store.players = chat.store.players || {};

The above code doesn't do a whole lot other than let operators set a player's color choice ( /js chat.setColor(__self, "green") ). A little bit more code has to be added so that the player's text color will change when chatting with other players, but the above code will ensure the player's color setting is at least saved. The following code just ensures that when a player chats , the text will be displayed in their chosen color...

ready(function()
{
    var colors = ["black", "blue", "darkgreen", "darkaqua", "darkred",
                  "purple", "gold", "gray", "darkgray", "indigo",
                  "brightgreen", "aqua", "red", "pink",
                  "yellow", "white"];
    var colorCodes = {};
    for (var i =0;i < colors.length;i++) colorCodes[colors[i]] = i.toString(16);

    events.on("player.AsyncPlayerChatEvent",function(l,e){
        var player = e.player;
        var playerChatColor = chat.store.players[player.name];
        if (playerChatColor){
            e.message = "&sect;" + colorCodes[playerChatColor] + e.message;
        }
    });
});

The ready() function takes a callback and ensures that the function supplied will not be invoked until all of the javascript functions have loaded. It declares a lookup table of colors / names and adds an event handler which intercepts and inserts color codes into player's text messages. The events.on() function comes courtesy of the events plugin so that's why event handlers for a plugin should usually only be loaded inside a ready() callback.

The other new addition to ScriptCraft is the /jsp command - this lets operators expose plugins for use by regular players. To be clear, /jsp does not do any javascript evaluation, it just accepts parameters which are then passed on to the appropriate javascript plugin. So far in this example plugin we haven't provided any way for regular players to - you know - actually set their text color of choice - only operators can do this for a player using the js chat.setColor(...) javascript statement. Let's be clear - giving your players access to the whole API via javascript isn't a good idea. So how do you safely let players choose their text color? If you've written a javascript function and want players to be able to use that function, you expose it using the new command() function like so...

command("chat_color",function(params){
    var color = params[0];
    if (colorCodes[color]){
        chat.setColor(__self,color);
    }else{
        __self.sendMessage(color + " is not a valid color");
        __self.sendMessage("valid colors: " + colors.join(", "));
    }
},colors);

... The above code adds a new subcommand to the /jsp command and also specifies autocomplete options (the last parameter - colors) for that command when the player presses the TAB key. Now the player themselves can change their chosen chat color like so...

/jsp chat_color yellow

... What I've done here is create a new plugin which lets players choose a chat color and saves that preference when the server shuts down and starts up. I've also added a new jsp sub-command - chat_color that players use to change their chat color setting. The full plugin source code is just a couple of lines of code but is a fully working plugin...

// declare a new javascript plugin
plugin("chat", {
    setColor: function(player, color){
        this.store.players[player.name] = color;
    }
},true);
// initialize store
chat.store.players = chat.store.players || {};
// when the 'events' module is ready ...
ready(function()
{
    var colors = ["black", "blue", "darkgreen", "darkaqua", "darkred",
                  "purple", "gold", "gray", "darkgray", "indigo",
                  "brightgreen", "aqua", "red", "pink",
                  "yellow", "white"];
    var colorCodes = {};
    for (var i =0;i < colors.length;i++) colorCodes[colors[i]] = i.toString(16);

    events.on("player.AsyncPlayerChatEvent",function(l,e){
        var player = e.player;
        var playerChatColor = chat.store.players[player.name];
        if (playerChatColor){
            e.message = "&sect;" + colorCodes[playerChatColor] + e.message;
        }
    });
    command("chat_color",function(params){
        var color = params[0];
        if (colorCodes[color]){
            chat.setColor(__self,color);
        }else{
            __self.sendMessage(color + " is not a valid color");
            __self.sendMessage(colors.join(","));
        }
    },colors);
});

Chat Color plugin

... this is what I would call a minimum viable plugin and it demonstrates some of the new features of ScriptCraft - persistence (automatic) , event handling, and exposing new functionality to players using the /jsp command. I hope this will give potential MineCraft modders a feel for just how easy it can be to change the game to suit their needs. I have a lot of things I want to do with and using ScriptCraft, but I also want to circle back to the educational side and spend some more time working on the Young Person's Guide to programming in Minecraft. If you've read this far, I hope you've found it helpful. You can download the ScriptCraft Plugin here.

Categories

ScriptCraft, Minecraft

Programming front and center

2013/01/18 13:35

Programming tools are easily available from the desktop and Upton wants future OS images to boot the board straight into a programming environment.

Putting these tools front and centre is designed to inspire tinkering. The Pi is there to encourage a similar taste for experimenting with computers that was inspired by the blinking Basic programming prompt of the Acorn BBC Micro in the 1980s... "I looked at our founding documents and nowhere in there does it say 'We'll make a small computer'. What it says is 'We want to get kids programming'," he said.

-- 'We thought we'd sell 1,000': The inside story of the Raspberry Pi | ZDNet

Categories

Programming, Raspberry Pi

Saturday ScriptCraft Miscellany

2013/01/12 17:43

ScriptCraft might be a tough sell to younger programmers if it's perceived as just a class-room / educational tool so I made this short video to demonstrate some of ScriptCraft's destructive power. It really does let you change the game any way you like with a minimum of code.

A reprogrammable system is incredibly powerful. Abusing the power is always possible and it's a point of principle in a reprogrammable system that people must be able to abuse it.
-- Nic Ferrier

Categories

ScriptCraft, Minecraft, Javascript

Internal Reprogrammability

2013/01/11 09:22

Martin Fowler on the software I've been using almost every day for the past 12 years...

Emacs is an elderly piece of software, dating back to the mid 70's. Its philosophy of allowing people to easily extend it by modifying the live environment is something shared with a few other elderly-but-groundbreaking systems, such as lisp machines and Smalltalk.

That philosophy seems rarer now. Certainly there are plenty of extensible systems, you can install plugins for browsers like Firefox and editing suites like Eclipse. The whole free/open source movement is about giving you access to the code that runs your machines so you can (in theory) tweak it to your heart's content. But there's a palpable difference between extensions in most of these environments and the kind of reprogramming you do in emacs or Smalltalk. Something about how it's easy to quickly do small modifications, such as the new command I added above. It's also about doing it without leaving the environment - I don't fire up some separate toolchain to add an emacs function, I work within emacs itself.
-- InternalReprogrammability

... Anyone who's had a taste of Internal Reprogrammability wonders why all software isn't internally reprogrammable. That - in part - was the impetus behind ScriptCraft, to make Minecraft internally reprogrammable. With Bukkit and ScriptCraft, changing game behaviour on the fly is simple - edit your script, save it, then type /js reload() at the in-game console. No need to recompile , package in a jar file, restart servers, restart consoles and all of the other overhead that makes java development such a pain. Bukkit does a great job of removing most of that pain and ScriptCraft eliminates the need to recompile and repackage.

If internal reprogrammability is rare for tools aimed at programmers, it's even rarer for tools aimed at non-programmers. I've often wondered if that ought to change. What would come from making more tools exhibit this quality? Would this encourage more people to learn about programming, the better to control the environment that they spend so much time in? This was certainly part of Alan Kay's vision of the dynabook. He saw children not as passive consumers of media, but actively programming their environment.

That's what I hope ScriptCraft will encourage in young people playing Minecraft, that the next time they think "Wouldn't it be cool if you could do X in Minecraft", they don't go googling for a mod, they write the mod themselves.

Here's a prediction: In the future, Applications which are Internally Reprogrammable will use Javascript as the language for internal programming. Java will eventually be relegated to being just a Loader for Javascript. Imagine a conversation between Javascript and Java in the near future - it will go something like this...

Javascript: There's a good boy Java, I'll take it from here.

Categories

Emacs, ScriptCraft, Javascript

Cheese Controlled Cars

2013/01/11 08:53

My mate Conor featured in Wired magazine...

While this project might seem like a cross between a Rube Goldberg contraption and a Wallace and Gromit invention, the project incorporates professional-grade applications. "The whole idea of 'tinkering' is incredibly important," says O'Neill. "The code I posted last night for controlling the i-racer is multi-threaded. That's the first time I have ever done multi-threaded code in Python. Last year I learned the basics of Node.js whilst scratching a similar itch on a Twitter project. Whilst I'm not a full-time programmer (I used to be), I manage programmers and make all the major technical decisions in our company. These little side projects can be a fun and effective way for me to check out interesting technologies for potential use in the company.
-- Raspberry Pi RC Race Car Is Controlled With Cheese | Wired Design | Wired.com

... Conor and I worked together in EMC many years ago. Despite both living in Cork we don't get to chat face-to-face often enough. There's a bunch of great tech people around Cork. Must try to get another Barcamp Cork underway.

Categories

Hacking

Teleporting Arrows in Minecraft

2013/01/10 19:04

Just a quick video and code demonstrating how to add teleporting arrows to Minecraft. The code is quite small and easy to add to any CraftBukkit Server which has the ScriptCraft mod installed.

load(__folder + "bukkit/events.js");

importPackage(org.bukkit.entity);
importPackage(org.bukkit.event.player);

bukkit.on("entity.ProjectileHitEvent", function(listener, event){
    var projectile = event.entity;
    var world = projectile.world;
    if (projectile instanceof Arrow && projectile.shooter instanceof Player){
        projectile.remove();
        projectile.shooter.teleport(projectile.location,
                                    PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
    }
});

Categories

ScriptCraft, Minecraft, Javascript

Exploding Arrows in Minecraft in < 10 lines of code.

2013/01/09 23:57

So anyone who's watched the Minecraft Documentary has seen @notch demonstrating how easy it is for him to add exploding arrows to Minecraft while he's running it in Debug mode. It's a compelling illustration of just how deep in the codebase he is and just how flexible Minecraft is. It's just a couple of seconds in the film - you see him tapping away at some java code, then switching back to the game to shoot some arrows which explode with the force of TNT when they hit their target.

I was impressed. So I thought - what better demonstration of the power of ScriptCraft than to show how just a few lines of javascript code can add the same feature.

importPackage(org.bukkit.entity);
bukkit.on("entity.ProjectileHitEvent", function(listener, event){
    var projectile = event.entity;
    var world = projectile.world;
    if (projectile instanceof Arrow && projectile.shooter instanceof Player){
        projectile.remove();
        world.createExplosion(projectile.location,2.5);
    }
});

Look on my works, ye mighty, and despair.

Categories

Minecraft, ScriptCraft, Javascript