Moving Day!

This blog now has its own domain and is hosted on Microsoft Azure.  In retrospect, I should have taken notes and screenshots as I was going through the process but I got too caught up with the task at hand and now, all I have to show for it is a moved blog and a hand-wavy blog post.  But just in case I choose to do this again, at least this much will have been documented!

The first part of the process involved backing up the blog files from the old domain and restoring them on my local computer.  I then created a Visual Studio 2012 Web Site project and pointed to the folder where I’d restored the blog files.  This meant I could then use Visual Studio as a publishing tool.

Since the domain had changed, I searched through the project files and changed any hard-coded links to the new domain.  There were a fair number of those, which, as a developer, I found somewhat disappointing.

On Azure, I created a new website, configured it, and downloaded the Publish Profile.  This, I used to configure my project’s publishing functionality so Visual Studio would know where to publish my site to .

Azure

I then backed up the original WordPress MySQL database using the WordPress Database Backup plugin and sent the resulting file, which consists of a drop / create table script with insert statements for the data, to the Azure server.  Restoring it for use on Azure should have involved simply creating a MySQL database on Azure and running the script file.  The part that caused me the most grief in this whole process occurred right here.  Not only did the source code contain umpteen references to the old URL, so did a number of the database records.  So a search and replace had to be done throughout the database script before executing it in order to get the right data.  Some of the records even contained a length field so that also had to be adjusted to compensate for the new domain name’s length compared to the original one.

Once I had the database created correctly, I went back to Visual Studio.  Here, I modified the wp-config.php file to contain the new database connection string information.  Finally, I right-clicked on the project and Published it.

Publish

It took several iterations in order to get all these bits aligning correctly. Indeed, the first time I tried publishing and running the blog, I hadn’t yet realized there was a database associated with it so I got an HTML 500 error.  I used Fiddler to get more information and realized it was complaining about a connection string being incorrect.  That’s when I clued in that I had to back up a database and set it up for the new blog.

Previous to this, I knew as little about WordPress as it’s possible to know and still run a blog using it.  I had never modified .php files and had never consciously worked with MySQL.  And I certainly hadn’t done anything with Azure.  So this is all new to me.

If I’d been smart, I would have searched the web for a list of steps on how to move a WordPress blog.  I’m sure they exist.  But while my ad-hoc approach may have caused more churn than necessary, I sure learned a lot!  :)

Windows Phone 8: Where did the dropdown control go?

I recently started developing my very first Windows Phone 8 (WP8) application using C# and XAML and quickly found myself in an impasse: The Visual Studio 2012 (VS2012) toolbox did not contain anything I could identify as a dropdown or combobox control. Yet, the Calendar application on my phone uses such a control for its "How Long" selector amongst others.
CalendarApp1When the user taps on the control, it opens to reveal its values. If there are more than five values, it opens full-page. With fewer values, such as when specifying the availability state for the duration of the meeting, the list opens in-place.

CalendarApp2CalendarApp3

That was exactly the functionality I was looking for.

A bit of research sent me in the entirely wrong direction and I started investigating the LongListSelector as a possible replacement for the dropdown control. The LongListSelector is ideal for displaying organized lists of items such as a list of contacts in an address book. While the LongListSelector control supports the use of grouping such as by the first letter of a name, for example, it can also be made to display a flat, ungrouped, list. This was what I thought I was looking for but where I wanted to tap an item and have it be selected, the LongListSelector expected the tap to navigate the user somewhere else as it does when tapping a contact.

Thankfully, the article linked above mentioned that the LongListSelector had been moved from the Windows Phone Toolkit to the Windows Phone SDK. So I investigated the Toolkit and found the ListPicker control. This was exactly what I’d been looking for.

I installed the Windows Phone Toolkit using Nuget as described here but was dismayed to find that, though I could now manually add the control by typing it into the XAML file, it didn’t appear anywhere in the VS2012 toolbox.

Again, I searched for instructions for adding these new controls to the VS2012 toolbox and found these. This helped get me a bit closer but didn’t entirely solve my problem. Here are my revised steps for adding the Toolkit controls to the toolbox. Please refer to the original post for screenshots and for a much more comprehensive description of the process.

  • Go to the VS2012 Toolbox tab, right click over General and select Add Tab from the context menu.
  • Give a name to the newly created toolbox section.
  • Right-click the newly added section and select Choose Itemsà

Chooser

  • This is where my instructions are a bit different. The original poster simply selects the controls and adds them to the section. I never found the ListPicker in any of the Choose Toolbox Items tabs. In order to see it and its toolkit mates, I had to click the Browse button and navigate to the toolkit library located by default in \Documents\Visual Studio 2012\Projects\DataCollector2\packages\WPtoolkit.4.2012.10.30\lib\wp8.
  • Click OK. This adds the list of toolkit controls to the "Windows Phone Components" tab. Note that they are conveniently pre-selected.

Toolbox

  • Click OK. You now should have the controls in a new section in the toolbox so you can drag and drop to your heart’s content.

Hopefully, this can help save the next person some time!

Happy coding!