Archive for January, 2012

CodeMash Nuggets

codemash2010

This year I was fortunate enough to attend CodeMash in Ohio. Just like last time, it was an amazing experience. The speakers, the venue, the food, the folks in attendance. All of it made for a great experience. I learned, I laughed, I left exhausted.

General Observations

I went to mostly mobile-oriented talks, and over a two day period every single speaker I watched used a Mac. On top of that, all the presentations were very minimalist. I don’t know if that’s the tools on the platform or folks finally rejecting the glitz of PowerPoint and focusing on content. I hope it’s the latter. Sales folks take note.

Mobile developers are actively rejecting the BlackBerry platform. One even pointed out how his company just stopped accepting work for that platform. Another who was building a mobile product pointed out that the expense of supporting the BlackBerry platform across three different active versions was too much. Has any technology died so publicly?

In the Java-oriented talks I saw, there was very little Eclipse. Mostly I saw IntelliJ Idea. This was interesting for me, because I love ReSharper for .Net work, and have been using WebStorm for HTML5/JavaScript coding.

Notable Quotes

As always, there were a number of notable quotes that summed up so many aspects of what was being conveyed.

Ted Neward, Keynote Address

“Reject the Goal of Reuse”

I’ve been seeing this message more and more lately. Reuse happens so rarely unless you are actually building a library, that otherwise you are probably wasting effort and introducing bugs by striving for reuse in code that was not necessarily intended for reuse.

“Best practices are merely average”  “Best practices == avoid thinking”

The bigger the company, the more they care about best practices. So there will be fewer risks, fewer rewards, and overall mediocre results. Seen it, sadly still living it.

“Reject the temptation of the familiar”

I’ve been working on this one for almost the last year. I’m learning the mobile paradigm, learning Java, writing services in something other than .Net. I am very surprised how much I had blinders on when I was immersed in Microsoft-only development.

Bill Pugh, Effective Use of FindBugs in Large Software Development Efforts

“The challenge for FindBugs is to find the intersection of stupid and important.”

I have long been a fan of automated tools for helping me tighten up code. His quote sums up the intent perfectly, finding the stupid mistakes you may have made that could result in important problems in your code.

Ted Neward, Android: Where You Can Stick Data

Answering questions about SQLite on Android: “It’s not Oracle, and if you treat it like it is you’re doing it wrong.”

Understand your platform and user paradigm. Enough said.

Bruce Eckel, Polyglot Programming: The Power of Hybridization

“You don’t know where the difficult parts will be”

So don’t plan to optimize anywhere, you won’t be right ahead of time. I have seen this myself more than once. The real trouble isn’t visible at the beginning. See any article on estimating for another aspect of this issue.

“Typing is noise”

Bruce favors languages with minimalist syntax, believing those languages express your solutions clearly for those who come after to read your code. This has inspired me to start learning Python.

“Go will replace C++ as the low-level language used in high performance applications”

I’m recording this for posterity. Bruce says he’s remarkably good at predicting these things, even though no one listens. I’ve read some of his work and have faith, so you read it here first.

Bruce Eckel, Reinventing Business

“The best people would be leaving companies all around you to come work for you if you were hiring the best

There is a metric for your recruiting staff.

Geeks Are Funny

After dinner on Thursday, there was a Pecha Kucha competition which was great entertainment, hosted by the inimitable Scott Hanselman, with a geek celebrity panel of judges consisting of Ted Neward, Julie Lerman, and Keith Elder. The winner was Leon Gersing, the heartfelt and real @rubybudda. Here are a couple cell phone videos of the event:

Jon Skeet Coding in the Style of Glee

Mel Grubb Urinal Rules

Leon Gersing On Love  Tiebreaker (Talking to a set of slides he’s never seen before)

Just as good as the talks was the Twitter stream on the big screen behind the presenters. You see a brief glimpse of it at the beginning of Jon’s talk. Geeks are funny.

Migrating from DasBlog to WordPress

Due to many circumstances, I have a need to upgrade my shared hosting from .Net 3.5 to .Net 4.0. Normally this is no big deal, but I was running my blog on DasBlog, which hasn’t been officially updated since 2009, and it won’t just recompile and run under .Net 4. While there are some branches of their code re-compiled for .Net 4.0, I decided that un-tested code was not for me. I then decided on WordPress for a platform, mostly to continue expanding my horizons outside of Microsoft technology, and also because my hosting provider supports it, and I have more MySQL instances available for database use than SQL Server. I found an excellent post on migrating from DasBlog to WordPress, and used it mostly for a template on what I did, but since I did do some things differently, I decided to document my process. So below are the steps and technologies I utilized to migrate my blog.

Create a Test Environment

For my purposes, the first thing I did was create a Windows 7 virtual machine to do the migration testing. My production site is using shared hosting, so I can’t run a .exe on the server to get the content, which one of the tools I wanted to use required. I installed IIS, PHP, MySQL, and WordPress. I also made a new instance of WordPress in a virtual directory that matched the name of the virtual directory on my production WordPress install.

Set Up DasBlog Locally

I downloaded both the app files and the content from my hosting provider, then placed them in a virtual directory under IIS in my test environment, inside a virtual directory named to match the directory from production. I changed the site name in the DasBlog site.config file to reference the new location so the app would work.

Extract the DasBlog Content

I used DasBlogML to extract the data from DasBlog on the local instance of DasBlog, which outputs a blogML XML file. Some articles imply you need to remove any non-breaking spaces (   ) from the resulting XML, but I didn’t and had no issues.

Import the Data

I added the BlogML Importer plug-in to both my local install of WordPress and my production instance. I used that plug-in from the test instance to import the data and examine the results. For me it worked without issues, bringing over all the posts, comments, and categories. I had about 160 posts to migrate.

Create A WordPress theme

I am still enamored with the current look and feel of my blog which I built for myself as a DasBlog theme. I decided to migrate that HTML layout into a new WordPress theme, instead of using one of the myriad of available themes. I started with the HTLM5 Reset WordPress theme as a base and added the HTML structure and CSS from my DasBlog theme. I ended up modifying quite a few files in the theme in order to get it to work, and getting accustomed to PHP along the way.

Migrate Data and new theme to Production

I zipped up the WordPress theme directory on my test machine, and uploaded it as a theme in my production WordPress instance. Then I migrated the data using the BlogML Importer plug-in. I also had to configure the widgets in the navigation area and manually migrate some data into them.

Redirection

This is where the real work for the migration begins. Since my blog has existed since 2003, I wanted to maintain my links in search engines as much as possible. I already lost this once when DotNetJunkies (where I began to blog originally) got closed down by Dr. Dobbs, and it killed my comment traffic going forward. The post by Andreas that I was following advocated writing your own Http Module in .Net to handle all the redirects. I initially thought that was the way to go, but I found out that my hosting provider has the URL Rewriting feature installed for IIS7, so I could use the config file route. I figured that would perform better than any code I would write and is likely less buggy, even though over time the code should be used less and less. It also let me handle some of the one-off pages I added on the site that looked like part of DasBlog but really were just static HTML files, as well as some other media content.

There are a number of type of pages that DasBlog uses that need redirect templates:

  • Permalink
  • Permalink by Guid
  • Categories
  • Dates
  • CommentView

DasBlogML also generated a CSV file matching up the DasBlog permalinks with the WordPress permalinks. I used that as a starting point, and also queried the blogML XML file for the guids and dates of each post, and then matched them up with the CSV file in Excel.  I then used simple formulas in Excel to generate the XML needed for a static re-write file. Because the number of rewrites is so numerous, I decided to store the mappings in an external file called “maps.config” and reference that from web.config. The basic structure (one example per type) of maps.config is:

  1. <rewriteMaps>
  2.   <rewriteMap name="StaticRedirect">
  3.     
  4.     <!– Permalink –>
  5.     <add key="/blog/2011/12/16/AndroidAVDProblem.aspx" value="/2011/12/16/android-avd-problem/"/>
  6.     <!– Category –>
  7.     <add key="/blog/CategoryView,category,Mobile.aspx" value="/category/mobile/"/>
  8.     <!– Permalink by guid –>
  9.     <add key="/blog/PermaLink,guid,d280262b-e81e-496b-abde-453b6381574f.aspx" value="/2011/12/16/android-avd-problem/"/>
  10.     <!– Comment View –>
  11.     <add key="/blog/CommentView,guid,d280262b-e81e-496b-abde-453b6381574f.aspx" value="/2011/12/16/android-avd-problem/"/>
  12.     <!– Track back –>
  13.     <add key="/blog/Trackback.aspx?guid=d280262b-e81e-496b-abde-453b6381574f" value="/2011/12/16/android-avd-problem/trackback/"/>
  14.     <!– Date –>
  15.     <add key= "/blog/default,data,2010-01-04.aspx " value= "/2011/12/"/>
  16.     
  17.   </rewriteMap>
  18. </rewriteMaps>

And in web.config of the DasBlog virtual directory I added the following section:

  1. <system.webServer>
  2.     <rewrite>
  3.       <rewriteMaps configSource="maps.config"/>
  4.            <rules>
  5.           <rule name="RedirectRule" stopProcessing="True">
  6.               <match url=".*" />
  7.               <conditions>
  8.                     <add input="{StaticRedirect:{URL}}" pattern="(.+)" />
  9.               </conditions>
  10.               <action type="Redirect" url="http://localhost/wp{C:1}" redirectType="Permanent" />
  11.           </rule>
  12.       </rules>
  13.     </rewrite>
  14. </system.webServer>

To get it to take effect I had to recycle the app pool of the DasBlog app. The important part of the rule is the action. By setting the redirectType to Permanent, it causes IIS to issue a 301 response for the redirect, which tells the caller this is a permanent change. So any search engine should re-write the link in their database and not start you all over again in search engine results. And any other links outside of your site will just redirect automatically.

At this point it seems the new blog is running fine and the redirects are all working. I left the DasBlog instance running, at least for a while. I’m keeping my eye on Google Analytics to see if any other hits show up on the old blog. I am not an expert as DasBlog, so if any other page types show up I’ll find out about it and fix it in the redirect file.

Posted on:
Posted in IIS, Strange Problems, Tools | Comments Off on Migrating from DasBlog to WordPress

Ubiquitous Tech Predictions – Mobile Edition

Every year there are a bunch of articles this time of year predicting what will happen in 2012. So I’ll join the fray and reference a few with my own thoughts, mostly about mobility.

Mark W. Smith from the Detroit Free Press

  • BlackBerry users continue their exodus
    This is low-hanging fruit. I’ve been on this bandwagon for a while. I’ll amend his prediction to say RIM abandons the North American market for the third world, where they are currently making their money. They will focus on the BES in the North American marketplace. If they were smart they would focus on enterprise customers instead of consumers, but there is no evidence of good decision making at RIM. RIM should be bought by Google for the BES business alone in order to help Google get a foot hold in the enterprise back-end space. If not Google, the next most likely buyer is Microsoft, followed by Amazon.
  • Apple Releases the iPad3
    I think the iPad3 will be incremental, like the iPhone 4S, but will continue to dominate the consumer space. With no real competition at this point, there is little incentive for Apple to introduce innovative features that may be hit-or-miss. The real prediction in the tablet space will be Windows 8. Business are craving an enterprise-oriented tablet, and the inclusion of Microsoft Office will make Windows 8 tablets sell like crazy to business customers. Business users want Excel and PowerPoint on their tablets in meetings. The lack of Office on a Windows 8 tablet or late delivery will kill the platform.

Galen Gruman at InfoWorld

  • NFC gets real traction – but not for payments
    There are not enough phones with NFC support today.  Until NFC is common in phones, there is no incentive for businesses to adopt it on the other side. Users have two year contracts, and very few normal folks change phones during the contract time frame (unless you are an iPhone addict, and still no iPhones have NFC). So even if a bunch of phones get NFC in 2012, there will not be enough users to cause a change. Currently there is no widespread NFC infrastructure on the non-phone side because of that, so it will be 2013 before the common user gets NFC.
  • Make that two mobile shakeouts
    Mobile device management (MDM) will be huge in 2012. 2011 saw the proliferation of bring your own device to businesses. The enterprise will have to figure out how to do this securely, and I think MDM is the key. I agree this will cause buyouts and consolidation.
  • Google finally gets its Android act together
    I think Google side-steps the fragmentation by buying RIM/BES to get an MDM solution, and adapting it to hook into Android as a core feature that still allows the hardware makers to customize Android in crazy ways and still be secure for business. The good news for Google is that users largely blame the hardware maker and not the OS for issues with their phones. Google is selling to the hardware vendors, not the consumers directly, so they have a large incentive to please those vendors.

Buzz Out Loud from CNET

  • Amazon buys Netflix
    No way. Netflix is the biggest user of the Amazon cloud, and probably a huge source of revenue for that business, which is really important to Amazon’s future plans. Why buy your biggest customer? Unless Netflix is going to go out of business, there is no point for Amazon to acquire them, it will hurt their cloud business.
  • Video Conferencing on Phones
    Video conferencing has not caught on and still won’t in 2012. Why? No one really wants everyone to see you while on the phone for lots of reasons. PJs, bathrooms, hair, and many more.
  • Users lose confidence in Android, WP7 gains because of this
    Again, I don’t think users blame Android as the problem, but the hardware vendor, whose name is prominent on the front of the device. Look at bad reviews for apps in the MarketPlace. The disgruntled users often list their device. The fragmentation is squarely on the hardware vendors’ shoulders, and they will pay for bad implementations. There is no alternative OS for the hardware vendors. (Bada? MeeGo? Can I get Angry Birds on that?) Users are not smart enough to understand the problem and move to a platform consistent across hardware vendors like WP7. It would be great if Google would stand up to vendors and reduce the crapware and customization, although Microsoft never has for Windows and still dominates. Android is open-source after all, and fragmentation is one of the often discussed possible outcomes of an open source project.
Posted on:
Posted in Mobile, Reviews | Comments Off on Ubiquitous Tech Predictions – Mobile Edition

Looking Back and Forward

What Happened in 2011

  • I spent too much time with SharePoint (as the Cloud lead developer) so
  • I changed jobs which means
  • I moved into mobile development
  • And therefore I learned to write code for BlackBerry and Android which means
  • I learned Java
  • I got to deploy my first apps in the cloud for mobile back-ends, using both Azure and Google
  • Spent a fair amount of time with Mobile Web

Goals for 2012

Today I found a great post by Michael Crump about goals for the coming year. I guess I’m doing OK because I am already doing most of the things he advocates, and I agree with all of them. I’m going to incorporate some of those with modifications for myself.

My own goals for 2012:

  • Continue becoming a polyglot developer
    • Learn a new programming language (Objective-C)
    • Learn and use a new design pattern (TBD)
  • Read and Contribute to Stack Overflow more often
  • Get an app in two app stores
  • Consistently generate blog and Twitter content
Posted on:
Posted in Programming | Comments Off on Looking Back and Forward