What’s Old is New Again (back on WordPress for the nth time)

I seem to have a problem: I can’t seem to make up my mind if I should blog or where the blog I can’t make up my mind to maintain should live. I started on WordPress. Then I switched to Squarespace. I got tired of the limitations in Squarespace then went back to WordPress.com. Then I got tired of the limits of WordPress.com and did a self-hosted install of WordPress running on a Digital Ocean droplet. Then at some point I got tired of having to maintain that myself and gave Squarespace a spin again and was thrilled with it. It had come a long way since the last time I had tried. But inevitably I got tired of the limits of Squarespace again and now I’m back on WordPress.com.

Don’t get me wrong, Squarespace is an amazing platform to keep a personal website and the pricing is phenomenally cheap for what they give you but I had three major issues with it:

  1. Their Markdown editor sucks.
  2. They no longer have an API for external publishing tools.
  3. Their idea of image handling is ridiculous.

Markdown

It’s hard to describe just how poor of a Markdown implementation they have implemented. The editor is buggy beyond belief and it only handles bare bones Markdown. I was not the first one to request a more advanced flavor of Markdown, and I’m sure I won’t be the last, but the requests seem to have fallen on deaf ears because there has been no movement on that part of the tool in a long time. I write everything in Markdown and my preferred flavor is GFM (GitHub Help, or something similar like PHP Markdown Extra because I frequently use the extra items provided by those implementations like footnotes and tables.

Lack of API for publishing tools

I can see the reasoning behind ditching their old posting API because of the way Squarespace pages are built. Every page is usually made up of multiple blocks so that would make creating an external API pretty difficult. It wouldn’t be impossible of course…they could easily limit the API to publishing simple posts (as they seem to do with their own iOS tools) but they obviously think it isn’t worth the cost. I need the ability to post from other tools though and I want the ability to use automation tools like IFTTT with my website. That just isn’t an option with Squarespace right now and from the looks of it won’t be an option anytime soon.

Image handling

Squarespace can certainly afford to take a look at how WordPress (either self-hosted or on WordPress.com) handles a media library. Every image uploaded to WordPress is easily managed using their media library tools. Squarespace, by contrast, offers no such tools. When you attach images to a page or post they are essentially tied to that page and there is no central place to manage them. Want to get a list of every image asset on your site? Good luck with Squarespace because they don’t have a way to see that type of information.

If Squarespace fixes these things I might consider switching back again. Their pricing and feature set for most people is superior but they just have lousy support for the items that are the most important to me. I might have to dump more money into WordPress to get what I want but at least it is an open environment that has far more advanced management tools.

Using tools that inspire us

Courtesy of Dustin Lee/Unsplash.com Courtesy of Dustin Lee/Unsplash.com

I have a confession to make: I’m an iOS app addict. More specifically I’m a productivity app addict (well, photography/graphics too but that would be another post). Todo list apps, calendar apps, writing apps, “glue apps” (like Workflow) – if a productivity app gets good reviews from sources I trust I’m all over it to see how it would fit into my workflows.

Over the last several months I’ve read a lot about Ulysses, yet another writing app. Almost every day I came upon someone extolling the virtues of the new universal version of Ulysses for iOS. A fancy text editor that uses Markdown? It was hard not to hit the buy button but at $20 it isn’t exactly an impulse purchase. I then read that Federico Viticci of MacStories had started using it for his writing.1 I bought a subscription to Club MacStories just to read his impressions and after reading that article I gave in and spent the $20 dollars to buy Ulysses.

As always Federico is thorough but the one part of his article that really struck me though was this:

Drafts, too, is a solid app, and I’m happy that I got to know it better, but, inside me, I wasn’t sure about it either. I could get my writing done in the app, but I wasn’t feeling it. I don’t know if this makes sense to other writers, or if I have a problem, or if it’s a combination of both, and all of us who want to get some writing done on iOS have a bit of a problem with the App Store and abundance of choice. Maybe we are all slightly obsessive about this software thing and we just like to create problems for ourselves.

I think Federico hit on something important here: the feeling of using something. I’ve also found that “feeling it” when using a piece of software is important. I’m sure it’s not important to everyone, but I’d bet a good portion of the people who buy apps like Drafts or Ulysses want to feel engaged with the software they are using. Many crave good design in software; some applications have it, some don’t. I love journaling in Day One on the Mac and iOS. I tried using MacJournal, which is also a fine app in it’s own right, but I just never felt inspired when I sat down to write. Something about Day One inspires me and makes me feel like writing in it. I’d say the same thing about my iOS text editor of choice Editorial. It just inspires me in a way that other text apps have not.

In Federico’s example of Drafts (which I also own and use) he talks about not being inspired. That isn’t a knock against Drafts, it is a very well thought-out application with tons of functionality. It was the first text app on iOS to bring a lot of automation to the table to let it interact with other applications. It doesn’t inspire me to write either.

Look at the byline on the website: “where text starts”. Drafts is designed to take notes and small bits of text and send them on their way elsewhere using the automation features. Yes you can write as much text as you want there and it will work but it isn’t designed for long form writing. That’s where apps like Editorial and Ulysses come in.

Federico is wrong though when he says we are creating problems for ourselves. The guy is an app fanatic to be sure. He works around a lot of shortcomings in iOS using apps like Workflow to accomplish things that, in all honesty, could be done easier on a Mac. But he doesn’t feel inspired on the Mac, he feels inspired on iOS. It’s the platform that works for him and he’s done some amazing things with the scriptability of apps like Editorial or gluing apps together using Workflow and Pythonista. Is there anything wrong with that? Absolutely not. Has he spent a lot of time not writing to accomplish these things? Sure but he’s also learned, and taught, a lot as well. There is a lot of value in those things, just as much as in the writing itself.

I’ve read in the recent past that we should all just settle on a set of tools and stop tinkering with our productivity workflows and to a certain extent I believe that. But I am, and have always been, a tinkerer and I derive a lot of pleasure out of it. Maybe it’s time we stop beating ourselves up over it and just have fun. Maybe we won’t be quite as productive as we could be if we just stuck to a set of tools and got to work but it wouldn’t be as fun. There is a lot to be said about having fun.

  1. If you don’t know of Federico he’s written a fantastic amount about writing on the iPad, including an ebook about Editorial. ↩︎

Thoughts on the season 6 finale of “The Walking Dead”

Just a couple of quick thoughts here because my opinion of the episode matches many others who have already written much better synopses of the show.

  1. Why was the episode 90 minutes long? To sell more commercials? They basically drove around in an RV for 80 of them.
  2. What the hell is with the total transformation of Carol from a badass to a sniveling wuss? After so much character development this is the best the writers could do?!?
  3. Why oh why did they end with a cliffhanger? Guys this episode pissed me off enough that I’m considering not even coming back for season 7. There are many other quality shows out there to watch now. Don’t lob softball reasons at me as to why I shouldn’t watch yours anymore.

Just a terrible end to the season even if the last 10 minutes was a bit brutal. Hell, even the second half of the season itself was getting to me. I get the violence but it is starting to get a bit gratuitous. I get all the gore in the zombie death scenes but they could do so much more with this show than just making it about groups killing each other.

The A.V. Club has a great write-up. Go check it out.

2Do – Restoring Archived Lists

I recently switched from OmniFocus to 2Do for my task management needs and found one thing a bit odd – archived lists still affect the naming choices of new lists. I had a list called “Home” that I had archived. All of the tasks in that list I had tagged with the tag “home” and when I went to save a search I was not able to name the new smart list “Home”, it kept being renamed “Home 1”.

If you are running into the same issue don’t despair, there is a way to “unarchive” those lists :)

  1. Go to the app settings and select Privacy.
  2. Tap Archived Lists.
  3. Slide the switch to any list you want to reappear in Lists on the main screen.

The 2Do developer has made some…um…interesting design choices but thankfully over time is correcting those (erroneous) choices. Hopefully at some point there will be true archiving of lists.

Posting Markdown to WordPress from Editorial

Since switching to Squarespace from WordPress I have not had much of a chance to use my posting script for the Editorial text editor for iOS. I received an email today though from Frank van Exter asking for assistance in using the workflow. Frank was very gracious and it was a nice opportunity to help someone use something I created.

Unfortunately my posting to the Editorial workflow site didn’t quite explain things clearly enough. Here are the two most important things to configure when using this workflow:

  1. Make sure the user that you are plugging in to the workflow has posting access to the blog you’re configuring.
  2. Enter your username and URL into the section of the workflow labeled “Get Connection Details”, not the variables at the beginning of the workflow.

A couple of things to note:

  1. The URL needs to have “/xmlrpc.php” appended to it.
  2. If you are using 2-factor authentication you need to generate a password for the workflow to use in the WordPress admin site.

Also, if you have to reset your password that is done by doing the following:

  1. In “Get Connection Details” slide the Reset Password switch to on.
  2. Run the workflow to reset the password.
  3. Run the workflow again to enter a new password.
  4. Go back into “Get Connection Details” and turn off the Reset Password switch.

Enabling Query Builder and boolean searching in Microsoft Outlook

Why aren’t searches with advanced boolean logic available by default in Outlook?

I hate to say this but it almost appears that Microsoft has abandoned Outlook. Oh sure there are updates every Office cycle but it would seem those are mostly look-and-feel changes.

How about easily being able to create mailing lists by dragging names to a list? Nope.

How about easy tagging? Nope. Sure we’ve got categories but those are cumbersome to use and require a special user interface to set up.

How about stuff like saving searches? Oops. Nope can’t do that either. You can do advanced boolean searches via the search box but you can’t save them.

Want to create a boolean search via the Search Folders feature? Sorry. That is another thing that isn’t doable. Well, not doable out of the box anyhow. In 2016 you can get this feature, but you’ve got to modify the registry. Really Microsoft?

Here is how to do it.

Using closures in Swift 2 ways

Learning Swift – Using Closures

I’m starting to learn Swift for iOS development and have been experimenting with closures which are using heavily within the various iOS libraries (if you want to learn more on how closures work in Swift I recommend reading the Swift book section on closures as a starting point. As always there is more than one way to skin a cat so here are two ways to use closures:

Passing as a function argument

The usual way is to pass the closure as a regular function argument. Here is a sample function definition:

func authorizeHealthKit(completion: ((success:Bool, error:NSError?) -> Void))

You could either assign a closure to variable or just include the closure inline as part of the function call:

// define the variable
let completion:(authorized:Bool, error:NSError?) -> Void = { (authorized:Bool, error:NSError?) -> Void

    in

        if authorized {
            debugPrint("HealthKit authorization received.")
        }
        else
        {
            debugPrint("HealthKit authorization denied!")
            debugPrint("(error)")
        }
    }

// now lets pass the completion to the function
healthKitManager.authorizeHealthKit(completion)

Here it seemed better to assign the closure to a variable because of the length of the closure body. There is nothing wrong with this but there is a better way.

As a trailing closure

Swift has a nice syntactic option for when you’re going to include a long closure as a parameter to a function. It has to be the last (or only) parameter.

Here is the same call to authorizeHealthKit that we used above but with a trailing closure:

healthKitManager.authorizeHealthKit() { (authorized,  error) -> Void in
        if authorized {
            debugPrint("HealthKit authorization received.")
        }
        else
        {
            debugPrint("HealthKit authorization denied!")
            debugPrint("(error)")

        }
    }

In the case that the closure is the only parameter to the function you can even leave off the parentheses:

// no parens!
healthKitManager.authorizeHealthKit { (authorized,  error) -> Void in
        if authorized {
            debugPrint("HealthKit authorization received.")
        }
        else
        {
            debugPrint("HealthKit authorization denied!")
            debugPrint("(error)")

        }
    }

Lets take a look at another example that takes multiple parameters:

func requestAuthorizationToShareTypes(_ typesToShare: Set<HKSampleType>?,readTypes typesToRead: Set<HKObjectType>?,completion completion: (Bool,NSError?) -> Void)

This comes straight from the HealthKit API and is a method in the HKHealthStore class.

We could call this by assigning the closure (“completion”) to a variable as we did up above but we can also call it by using the trailing closure feature since the closure is the last parameter to the function:

healthKitStore.requestAuthorizationToShareTypes(nil, readTypes: healthKitTypesToRead) { (success, error) -> Void in

        completion(success:success,error:error)
    }

Here the first parameter is a Set of types we want to be able to write to the Health database. In this case we don’t want to write any values. The second parameter is a Set of types we want to read from the Health database. (something along the lines of):

let healthKitTypesToRead: Set<HKObjectType>? = [HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeartRate)!]

The third parameter is our closure and here we are using the trailing closure option.

As a new Swift developer I’m still a bit torn on which way to use but I’m pretty much leaning toward doing trailing closures where possible. I assume this is the “right way” to do it in Swift these days.

Drafts 4 to Day One

Create an Action in Drafts to send a journal entry to Day One.

Here is a tutorial on how to make a workflow to move text from Drafts 4 to a journal entry in Day One verison 2. The Drafts action itself is quite simple but I am providing step by step screenshots for anyone new to this.

For anyone who just wants the Drafts action you can download it here. Just make sure to visit on the device that is running Drafts!

(Optional): Create a new Action Group

To make it easier to keep your own actions separate from the ones that come with Drafts you may want to create a group for them. This is done by swiping left on the group names until you see the pencil icon. Tap that and then the + icon to create a new group. Here I have created one called demo.

(Optional: Create a new action group)
(Optional: Create a new action group)

Step 1: Create a new Action

Pretty simple. Select the Action Group you want the action to appear in (or All if you don’t want it in a group) and tap the + icon.

Step 1 – Create a new Action

Step 2: Name the Action

Here is the main Action screen. This is where the steps that make up the Action are added and configured. Name it whatever you like then we’ll add our steps. Note that if you tap the small icon to the left of the Action name you can change the main icon for the Action.

Step 2 – Main Action screen
Step 2 – Action icons

Step 3: Action Steps – Add a journal name prompt

Here is the main screen which lists the steps for the Action being edited. Tap the + icon to add the journal name prompt.

Step 3 – Main Action steps screen

We are going to add a Prompt which will let us enter a journal name that will be used when creating the entry. The Prompt can have a title, multiple buttons, a cancel button, and a text field.

The Key field will hold the value the user is going to type into the text input field that will be included. The name that will be used in the URL will be [[key_text]]. You must include the “_text” when referencing it in the URL later.

Make sure to enter something descriptive in the Title field.

Also make sure to enable the switch labeled Include text field. This will let a journal name be entered. A default value can also be entered here if you find that you are typically using one journal more than others.

It is a good idea to include a cancel button as shown here. This lets you get out of sending the draft to Day One if you forgot something or made a mistake.

Step 3 – Prompt options
Step 3 – Prompt options

After creating the Prompt the Action Steps screen will look like this:

Step 3 – Prompt created

Step 4: Add a URL

Now we’re going to create the URL that is used to call Day One and pass in the name of the journal we’re adding an entry to as well as the text of the entry itself.

The URL we will be using is:

dayone://post?journal=[[journal_text]]&entry=[[draft]]

As you can see here we are referencing journal_text which we set in the step above. That is the text that came from the text field in the Prompt that was used in the previous step.

The rest should be self-explanatory. For reference here is information on the Day One URL scheme as well as the Drafts tags that can be used when creating a URL:

Step 4 – URL options

Here is the Action Steps screen after we add the URL. We are now done creating Action Steps.

Step 4 – URL created”

Step 5: Finish the Action setup

There is one more thing to consider when creating Actions and that is what will happen to the draft after the Action has completed running. Those options are shown in the screenshot. Default is whatever you have selected in the main app settings for Drafts.

Step 5 – Select an After Success option

Step 6: Test it!

The final step is to test our new Action. Create a new draft, enter some text, tap the box icon in the upper right corner, and select the Action you just created.

Step 6 – Testing the Action – create a draft

Enter your journal name and tap OK. The Action will run and you will be brought to the correct journal in Day One with a new entry created with the text of the draft.

Step 6 – Testing the Action – enter a journal name

 

Integrating ActiveMQ 5.13.1 with WebSphere Application Server 8.5

I found it a challenge to integrate ActiveMQ 5.13 and WebSphere 8.5 because the amount of information out there was either old or incomplete.  Here is a full queue to code sample of integrating ActiveMQ and WebSphere AS along with a sample of code to configure a Spring JmsTemplate and use it to send a message.

I’ve spent the last several days trying to get ActiveMQ integrated with WebSphere AS 8.5 to have a local environment available for testing some JMS code. It was pretty difficult to find recent information out there so I thought I’d share how I was able to get something to work.

I was able to cobble together directions I found on various sites but as always those sites left out bits of information that I found very handy to know so here I’ll try to do a step by step example. Please let me know if I missed something because I know how aggravating that can be.


ActiveMQ

I set up ActiveMQ with the default settings, the most important being the port it listens on which is 61616. If you use a different port just make sure to use that port number in this example.

Step 1: Add a queue in ActiveMQ

This isn’t strictly required. The default behavior with ActiveMQ is to create queues dynamically if the queue named in the call isn’t found. For this example though add a queue named “testqueue” as this will be the name used in the rest of the example.

Set up 'testqueue' in ActiveMQ
Set up “testqueue” in ActiveMQ

WebSphere

Step 2: Configure WebSphere – The JMS Provider

The first step in WebSphere is to create a JMS Provider for ActiveMQ. This is done via the WebSphere administrator console under the Resources menu on the left side of the page.

  1. Expand Resources
  2. Expand JMS
  3. Click on JMS Providers

Note: I tried to get this to work by specifying the ActiveMQ libraries in the Class path box but that didn’t seem to work for me. I ended up putting the libraries in <WAS_ROOT>/lib/ext. The list of libraries for this version of ActiveMQ is:

  1. activemq-client-5.13.1.jar
  2. hawtbuf-1.11.jar
  3. slf4j-api-1.7.13.jar

You may want to try specifying these (with the full path) in Class path and see if it works for you.

Note: I tried to get this to work by specifying the ActiveMQ libraries in the Class path box but that didn’t seem to work for me. I ended up putting the libraries in WAS_ROOT/lib/ext. The list of libraries for this version of ActiveMQ is:

1. activemq-client-5.13.1.jar
2. hawtbuf-1.11.jar
3. slf4j-api-1.7.13.jar

You may want to try specifying these (with the full path) in Class path and see if it works for you.

Set up the rest of the fields per the screenshot below. I used org.apache.activemq.jndi.ActiveMQWASInitialContextFactory because the older examples I found when putting this how-to together used it. I did find one example that used the regular ActiveMQInitialContextFactory but I haven’t tried it. The difference in the classes is how custom properties (set up below) are passed to the factory.

JMS Provider configuration
JMS Provider Information

The next thing that needs to be done is set up some custom properties for the provider. This needs to be done because the ActiveMQ context factory normally does this thru a properties file that is read at startup (jndi.properites as seen here). As noted in that document every connection factory and queue/topic needs to be listed here.

Note the naming of the queue entry. It follows the JNDI name using periods instead of slashes. If my queue name were jms/testqueue the property would be called java.naming.queue.jms.testqueue.

Also, if you’re using a topic instead of a queue use java.naming.topic instead.

JMS Provider Custom Properties
JMS Provider Custom Properties

Step 3: Configure WebSphere – The Queue Connection Factory

The next step is to set up the Queue Connection Factory. This is also done via the WebSphere administrator console under the Resources menu on the left side of the page.

  1. Expand Resources
  2. Expand JMS
  3. Click on Queue connection factories
Queue Connection Factory configuration
Queue Connection Factory configuration

Step 4: Configure WebSphere – Set up the Queue

The next step is to set up the Queue. This is also done via the WebSphere administrator console under the Resources menu on the left side of the page.

  1. Expand Resources
  2. Expand JMS
  3. Click on Queues

The most important thing to note here is that External JNDI Name must match the value of the queue you provided in the custom properties of the provider in Step 2.

Queue configuration
Queue configuration

Java

Step 5: The Java code

Here is some sample Java code using Spring that shows how to hook up a JmsTemplate and use it to send a simple test message.

<jee:jndi-lookupid="jmsConnectionFactory"jndi-name="jms/QCF"/>

<beanid="jmsTemplate"class="org.springframework.jms.core.JmsTemplate">
<propertyname="connectionFactory">
<refbean="jmsConnectionFactory"/>
</property>
<propertyname="destinationResolver">
<refbean="jmsDestResolver"/>
</property>
</bean>

<beanid="jmsDestResolver"
class="org.springframework.jms.support.destination.JndiDestinationResolver"/>

Here the most important point to note is that the JNDI name for the queue is used here when sending the message via the JmsTemplate, it is not the name of the queue as set up in ActiveMQ.

jmsTemplate.send("jms/testqueue",newMessageCreator(){
    publicMessagecreateMessage(Sessionsession)throwsJMSException{
        return session.createTextMessage("helloqueueworld");
    }
});

Conclusion

I hope you find this useful. I wanted to provide a full queue to code example which is something I wasn’t able to find when trying to set this up myself.

Resources