Imagine explaining the internet to someone from the early 1900s

Tonight’s writing prompt was different. Describe/explain the internet to a person from the early 1900s. Better yet, TV or your cell/smart phone. Some pointers were that this was was a time frame where people had the early telephone, electric lights, and very simple cars. Here’s what I crafted:

***

Do you know how you can pick up the phone and use the operator to ring up someone? Imagine opening a book and ringing up your favorite book. You know you can hop in your automobile and drive to your destination of choice? Imagine opening a blank newspaper and then picking which one you want to read. You know how you can turn on lights at night, and read many more hours than your grandfather could with a simple candle? Imagine people around the world writing new newspapers, books, and articles late into the night. And you can read them as they come out. You don’t need to wate for tomorrow’s edition of the paper. The moment they publish something, it’s available in your blank book. It’s available in your blank paper. And over time, you can actually follow your favorite authors. Perhaps you started reading Jules Verne. But then Mark Twain starts writing. You don’t have to buy a new book. You can simply ask for Mark Twain’s latest novel and its available. Or perhaps Mark Twain decides to write a weekly letter.

***

I have to admit, my wife’s writing was hilarious and way better than mine. But it was fun, because we each took a turn and read a scene from our manuscripts.

Never underestimate old men on park benches

Tonight, our Writer’s Group had an exercise. Based on the statement above, write something in five minutes or less. This is what I crafted:

* * *

It surprised me. I usually have my tea. Somtimes crumpets. Then I sit in my usual spot. London Financial Times, that’s what I read.

But today was different. Somtehing was falling out of the sky. A jet? Heathrow’s noisy traffic nearby was my first thought. Nope. Not that. Several large boxes from nowhere were crashing in from high above.

My eyes widened with surprise. Not because a whole bunch of boxes landed in the park’s pond. Sure that was awkward. But the fact that the boxes opened up and several animals emerged. And they started talking!

“Where are we?” a green frog asked.

I did the only thing possible. I replied, “You are in the United Kingdom. The gem of the North Sea. The great Britannia.”

And then they were off. My wife would never believe this.

* * *

Do you have a clue what this scene depicts? If so, drop a comment.

Happy writing!

How to create your own OpenOffice backend w/ @asciidoctor /cc @kubern @ysb33r

asciidoctorMy work on creating an asciidoctor backend for Packt Publishing (i.e. OpenOffice) seems to have caught several people’s attention. Today I spotted an exchange of tweets asking about OpenOffice in general. I figured a more detailed approach to doing that would better fit in a blog posting.

Starting with the basics

For starters, this whole thing is based on creating an FODT document, not an ODT one. The “F” stands for Flat and it is basically an XML document. Your mission, should you choose to accept it, is to create an XML document with all the right parts. That’s the reason my backend is written in SLIM.

SLIM is basically XML with every bit of unnecessary stuff removed. No closing tags. No angled brackets. Nested elements are denoted by indentation, hence giving it a more YAML-like feel. Checkout the following fragment for generating different section levels.

Working backwards

My recommendation is to start from a document you know and love. I started with Packt’s template they sent me. I performed a “Save As” and picked “Flat ODT” to get it into XML format. I then wrote a sample asciidoctor document with all the things I wanted. I suggest you start small and not get into complex layouts (yet). Remember: Minimum Viable Production (MVP) is the key to short, iterative success. From there, I started running my backend against this thing and comparing it with the outcome.

Got xmllint? If not, you should. Your output will be compressed XML. xmllint is the key to viewing your FODT output. Got giant monitor? .It can help dealing with stuff scrolling off the screen as you inspect your handiwork.

A key thing to understand. Asciidoctor splits up each “element” of asciidoc into a separate fragments and looks for the corresponding stuff in your backend. Got a “section”? Look for slim/packt/section.fodt.slim.

  • slim is the template engine
  • packt is the name of the backend (hence all your fragments will be there)
  • section.fodt.slim is convention-over-configuration for generating an FODT-styled chunk of XML everytime asciidoctor hits a “section”.

The top level thing for you document is, duh, document.fodt.slim. And this is also where you’ll find the root FODT XML <office:document>.  Way at the bottom is a common pattern, “=content”. This says, continue processing further asciidoc tokens and insert results at this level.

Iteration is the key to success

To run your backend against your asciidoc input:

asciidoctor -T /path/to/your/backend-root/slim -b packt your.adoc

My backend doesn’t cover every possible element of asciidoc because I didn’t need them. With asciidoctor, you can start with just document.fodt.slim & helpers.rb and when it hits an unknown token, it will tell in simple terms. Go and code <foo>.fodt.slim, and run again. Eventually, you can piece out your entire document. And in the process, you’ll become quite fluent with both FODT and asciidoctor.

Don’t give up!

You will undoubtedly hit some bumps. I sure did. One was getting my code fragments to apply a different style to the last line of any block of code. I probably invested two weeks of effort in this entire backend while writing Learning Spring Boot, but the payoff was enormous. If you are trying to convert a giant slew of documents, try to avoid after the fact edits. And if possible, get the core stuff working, like sections, paragraphs, bold/italics, bullets and admonitions. That stuff really motivated me to push forward.

Oh yeah…

Last time I checked, asciidoctor has special processing rules for double underscrores (__). Several of my style names from Packt had them, and it caused havoc. Once I tracked it down, I simply did a global replace, reducing them to single underscores. DON’T USE DOUBLE UNDERSCORES FOR ANYTHING!

Good luck!

Checking out editors

idea_sublime_atomIf there is something software developers do, it’s get real picky about tools for editing software. That’s why there are strong, almost religious debates about vi vs. emacs. I recently got fed up with TextMate for various reasons, so I decided to investigate more than my usage of vi.

I’ve included a screenshot of all three, side-by-side on my 39″ monitor. You guess which is which.

Sublime Text 3

This one I have found to be pretty neat. It’s fast, snappy, and opening up a project is a single command from my shell: subl /path/to/project

I quickly got moving when I learned there were only two key commands: Cmd-P and Cmd-Shift-P. The first is used to find files. You start typing fragments of a filename, and it quickly narrows your selection. Pick it, and it’s open in no time flat. That nicely matches Java’s one-class-per-file convention. Cmd-Shift-P is the Command Palette, which lists every available command. You then start typing fragments, and your list of commands shrinks. Then you can arrow-down and pick it, or hit the hotkey. Having a single way to find any command or file saves me from going to my trackpad and using the menus.

In the JavaDocs, HTML tags are nicely highlighted. Sometimes the color choices of Java syntax seem a tad awkward. But I rarely alter settings because I always fear either losing them, or going to someone else’s machine and not having them. Perhaps I might be able to stash them in Dropbox and soft link them in?

Another killer feature is the right-hand miniaturized layout of the entire file. Hover over it, and you quickly see where you are.

I’m still pretty new, so I haven’t learned how to open multiple tabs on the same file yet. Nonetheless, this tool is already productive for me!

Atom

After spending almost a whole day adding new asciidoctor content, my colleague Roy Clarkson hinted that I should check out Atom. I downloaded it last night and took a peek.

Nicely, Atom has the same keystroke to pull up the Command Palette. This feature sure must be popular. Right off the bat, I noticed the font size was a bit big. While it appealed to fuzzy vision, it was too impractical for the ground I needed to cover. Felt like I was peeking through a tube to see the code. So I pulled up the Command Palette and shrink the font size about five times so it approached the size of Sublime.

Opening the same file in the same project, I noticed that the color palette of syntax highlighting was a bit easier on my eyes. The contrast between bits of code didn’t seem wide enough, while Sublime’s contrast was a bit much.

I read an article pointing out how Atom is built on top of Chrome, JS, and Node, and conveniently comes with the JS toolset. Another article heavily criticized Atom’s shaky foundations which can start to magnify performance issues as you get into bigger projects. I’ve already seen a bit of this when trying to find files. Sublime just seems snappier.

IDEA

To compare things in full, I switched IDEA to it’s Darkula theme and opened the same file in the same project. A third syntax highlight color palette. Great. This dark-theme on IDEA is softer on the eyes, but some of the color clashes kind of turn me off. I’ve tweeted before that I don’t get it. Yet, at the same time, I use green-on-black for Terminal and totally dig the white/color-on-black of the other editors. Perhaps if I commit to a couple days, I might get into this?

What does IDEA have that the others don’t? IDEA is a full fledged IDE. Pick a function, then find everywhere that it’s used. Editors aren’t designed to do that.

This Command Palette from the editors has encouraged me to learn how to do that in IDEA. Apparently, Shift-Shift is the way to pull “Search Everywhere”. I am trying to do more of this. I have already learned how to find files and classes as well as pull up refactoring toolbars. These are all handy features. But to speed up the action, I need to jump to the command palette. From there, you can see commands as well as learn their hotkeys. More time on the keyboard is the ticket to efficient coding.

Results?

So far, IDEA isn’t going anywhere. I need this type of stuff. I just have to keep improving my efficiency at using it. As for an editor, Sublime is ahead of Atom right now. But like my bio says, I’m always looking for the right tool.

Mustering up the courage to watch “Doctor Strange” from 1978

Doctor_Strange_Vol_2_56You might not know this, but as a kid I collected comic books. My favorite was “Doctor Strange”. It makes it kind of neat because there aren’t a whole lot of books that he stars in. Suffice it to say, I probably own the bulk of those! True Big Bang Theory nerd showing through, ehh?

Well I have become excited since discovering that this rising era of super hero movies now has a movie coming next year starring the famous Stephen Strange. Doing some googling, I was shocked and surprised that CBS crafted a movie/pilot back in 1978 (with intentions to create a TV show). Shocked that someone went out on a limb for this back in 1978. And surprised that in all my collecting years, I had never heard of it.

Discovering that the entire movie is available is available for download from YouTube, I sought it out, loaded it up on my IPad, and watched it last night.

It took QUITE a bit of courage to sit through a movie that was only 90 minutes long, and yet, the first two-thirds have little magic or action. It was quite interesting to see Jessica Walter carry the bulk of acting talent in this show. She portrayed Morgan Le’Fay, Arthur’s half sister. In the comic books, she is somehow banished to the astral plane for eternity. In the movie, she is sent to crash the party.

I found it quite awkward that the reputed Ancient One, Earth’s previous Sorcerer Supreme, was portrayed by an Englishman who doesn’t show a lot of magic. I kept checking the cast on Wikipedia, only to discover that wizard was NOT the Ancient One, but some other dude they invented! It turns out, the Ancient One makes a vocal appearance right at the end.

Speaking of the end, this movie could cut out half of the opening, and STILL be sloooooowwwww. All the real action happens in the last ten minutes apart from Stephen rescuing Clea from “the higher planes”. Hearing the voice of “Kang” from Buck Rogers (Peter Ansara) and seeing the chick from “Twiki is Missing”, it seems like the cast of Buck Rogers in the 25th Century was making an appearance.

undergroundersAs a big fan of Doctor Strange, this comic book has served as one of my many sources of inspiration for Darklight, I’m glad that I unearthed this vintage creation. I would say it had a bigger budget than Doctor Who ever did (they had a horse in the movie, while K9 was a hunk of cardobard), and yet, couldn’t pull off the immortal power of that BBC-powered show. Yet, to know the entire genre of Doctor Strange, I felt it my duty to watch this snoozer.

To properly cleanse myself, I will have to turn back to the OTHER Doctor Strange movie I carry on my iPad: Doctor Strange (2007). That is all.

Doctor_Strange_video_cover

Announcing the winner of our #LearningSpringBoot contest…. /cc @PacktPub

Over the past month, we have had several entries. We have rallied together an international set of both contestants and judges. And here are the results!

The contestants

First of all, let’s list the applications that were submitted (in alphabetical order).

1. Mercury

This app is used for piping various types of traffic over different systems. It leverages Spring Boot’s conditional settings, allowing the user to customize as needed. It also has a hypermedia-based RESTful API.

2. Polaromatic

This application shows cute eye candy. It ingests files and manipulates them to look like “Polaroid” snaphots and dynamically displays them on the screen. It has a Spring Boot CLI script to fetch pictures from Flickr. It is Groovy all the way (all the way to the web templates). It uses websockets, Spring Integration, has nice Spock test cases, and

3. VotesApp

This application is a bot that listens in on chat sessions to count votes for/against spontaneous activities. That way, they can quickly get a tally of who all is going/not going on the fly. It has a pluggable architecture, comes with a video demo on an Android smartphone, uses Project Reactor, and leverages Spring’s profile support.

The results

Each of these apps was top notch. The contestants showed real skill. As judges, it was very hard because each team went in a different direction. Spring Boot offers a lot of concise and flexible power, and each of the entries used it well, just differently.

The winner **drum roll**

And the winner is…..Polaromatic! If you want to see, the winner has a running copy here. Visit it and simply wait a few seconds to see the outcome. The team behind Polaromatic has won a free copy of Learning Spring Boot.

Thanks for all who entered!