xml

How to convert Docbook to AsciiDoc

If you ever need to convert Docbook to AsciiDoc, this Pandoc command seems to work well:

pandoc --wrap=none -f docbook -t asciidoc \
       DocbookFile.xml > AsciiDocFile.adoc

Scala 2.13.0-M4 release notes (collections changes)

Under the covers — and sometimes above the covers — Scala is changing. These notes about Scala 2.13.0-M4 describe some of the changes coming to the Scala collections classes.

A few things not shown in the image are:

  • The scala-xml library is no longer bundled with the release
  • Procedure syntax (def m() { ... }) is deprecated
  • View bound syntax (A <% B) is deprecated
  • Assorted deprecated methods and classes have been removed

See the Scala 2.13.0-M4 release notes for more details.

Amazon Echo + Akka = Akkazon Ekko

Table of Contents1 - Running Ekko2 - Running Ekko commands3 - Listing commands Ekko understands4 - Written with Akka (and Scala)5 - Next steps6 - Add actors with reflection? (plugins)7 - The source code8 - More ...

I recently started working on a project that may or may not make it into my book on Scala and functional programming. I’m currently calling it “Akkazon Ekko” — or “Ekko” — because it’s a little like the Amazon Echo, but written with Scala and Akka.

Android: How to reference a drawable image in XML (or Java)

When you need to reference a drawable image from an Android XML file, such as a layout or menu file, use this tag:

android:src="@drawable/myimage"

That assumes that you have a file named myimage.png in your res/drawable directories. As a more complete example, this shows how I reference an image named images_show.png in an Android menu item:

Scala: How to download and process XML data (such as an RSS feed)

I was looking for a good way to access XML resources (like RSS feeds) in Scala, and I currently like the idea of using ScalaJ-HTTP to access the URL and download the XML content, and then using the Scala XML library to process the XML string I download from the URL.

This example Scala program shows my current approach:

Android: How to store static Help text in an Android XML file

As a note to self, when you’re writing an Android application and you think you want to store some static text in an external file, a better approach can be to create a resource file under res/values.

For example, I’m currently adding some help text to an Android app, and to do that I created a file named strings_help.xml under the res/values directory. That file contains HTML wrapped in an XML CDATA tag, like this:

An Android GridView of text quotes (Fragment, layout, and AsyncTask source code)

Before I completely delete this code from my current Android application, I want to make a copy of it here. It was intended to show a series of quotes (text phrases) in a “Grid” (GridView), but (a) I never got it working as desired, and (b) I decided I didn’t want it in my application anyway.

Here’s the source code for the Java controller/fragment class: