Blog theme update

It has been six years since my last post. A lot has changed over the last six years. For example, we have Windows 10 now and we also have responsive design front end which allow different devices to share the same application with the device’s own optimal experience.

The blog which was setup in 2010, now feel tired in 2018, and it is unfriendly to non-desktop devices. It is time for a change.

In the old days, choosing a theme would usually focus on what myself like to see. However, this time I would like it to be more user focus. The goals are to provide reader a clean user interface and easy to read experience with accessibility as a focus.

Choosing new theme is actually quite easy nowadays. After applying the theme filter with accessibility and responsive design options. There are only a couple of free themes left to choose from. I settled with Twenty Seventeen theme and further reduce the contrast between the font and the background to make it easier to read.

Bye bye old theme!

blog_old_theme

Posting to blog with .NET – Part 2

Not too far into creating a simple proof of concept utility with XML-RPC.NET. I stumbled across this old post about AtomPub support in Windows Live Writer. Since AtomPub is relatively new compared to MetaWeblog API, I decided to use AtomPub to future proof my work.

AtomPub

A quick search found that WordPress actually also support AtomPub. With WordPress supporting AtomPub I could use the .NET built-in models in System.ServiceModel.Syndication namespace to do most of the hard work and just send the Atom feed to make a blog post.

Unable to tag with AtomPub

Very soon I discovered that tagging a post is not a concept existed in Atom. After some research on the Internet, I found a great article about representing tags in Atom. However, unlike the article suggested, WordPress at the time of writing still does not support tagging with AtomPub. The issue ticket is marked as future release. It is still hopeful that future version of WordPress would allow that, but at this stage, AtomPub is not better than MetaWeblog API when working with WordPress.

MetaWeblog API and SharePoint Blog

My journey continued with the MetaWeblog API, with the help of some great documentation of MetaWeblog API here, I made great progress. Then out of curiosity I decided to try to post to a SharePoint Blog as SharePoint support MetaWeblog API for it’s blogging feature as well.

Different authentication model

Normally, the user name and password is submitted as a parameter of the call. However, with SharePoint, it will greet you with an error message ‘The server is not configured to accept user names and passwords as parameters.‘. To resolve this, the credential need to be pass in with the actual HTTP request. With XML-RPC.NET, it can be done like this:


var credential = new NetworkCredential(userName, password, domain);
var sharePointBlogProxy = XmlRpcProxyGen.Create<ISharePointMetaWeblog>();
sharePointBlogProxy.Credentials = credential;

Then on the method call, pass in string.Empty as the user name and password.

Blog API enclosures are unsupported

Enclosures are not supported in the SharePoint MetaWeblog API. If the XML RPC call included the enclosure element in the XML. SharePoint will throw an error. To work around this, I removed the enclosure property from the data model so that XML-RPC.NET will not include the element when generating the XML request.

Now the application is able to work with both WordPress and SharePoint blogs. This is as far as I go with posting to blog with .NET at the moment. When I have opportunity to press on further with the development I would post new findings here.

Posting to blog with .NET – Part 1

As a follow up of my previous posts about posting with MetaWeblog API and AtomPub with .NET. I hope this post would be a place you can find most information you need to get started.

My quest to posting with .NET began with a requirement at work to build something to post to a WordPress blog. The first thing I found after a bit of search is the WordPress Web Service plugin. However the plugin does not help me, it is a plugin for self hosted version of WordPress available from wordpress.org. I need something more generic.

MetaWeblog and WordPress API

After a bit more research, I found that WordPress support MetaWeblog by default and has its own extension on top of it called WordPress API. MetaWeblog is base on XML-RPC, a form of XML based remote procedure call before being develop into more mature standard like SOAP. Since it is using HTTP, it is very easily to use. In fact, I used fiddler to craft the request to check if the API is working before actually start coding the application.

XML-RPC.NET

Once started coding, having to type all the XML data model myself quickly becomes a challenge. I started researching again and quickly found XML-RPC.NET which is an open source library for XML-RPC in .NET. The source code included a few popular blogging API interface, which basically mean that almost everything is done!

Wait, but where is the compiled assembly? CookComputing.XmlRpcV2.dll is missing in the zip package. If you arrive here searching for where is CookComputing.XmlRpcV2.dll, you came to the right place. The DLL is actually in the zip package. However it is zipped with the path .\bin. Tool like Windows Explorer is not able to unzip files like that. Use 7-Zip to unzip the package again and you will see the bin directory and the DLL in there.

With the library and the API ready, it is time to start coding. Of course nothing is that easy. I will talking about other challenges in next post.

Hello world from Behind Simplicity!

Welcome to Behind Simplicity. In here you will find topics about me, things I discover on the Internet and knowledge I learn.

This blog is named Behind Simplicity because I am a software developer. Software developers spend most of their time trying to solve complex problems and create simple easy to use applications to address those problems. Software, like any other things in the real world, is simple but much more complex behind the scene. This blog is about the hidden details of software development and hopefully helping others to solve problems and achieve simplicity.