Write Once, Publish Anywhere

This article was also published on the Canadian Developer Connection blog under the title Write Once, Publish Anywhere.

Developers love to write code and a great many also like to write blog posts. However, it can be hard to find time to publish blog articles and to keep your site updated. I want to use this space to share an idea that I have been trying recently to motivate myself to put out more content.

I have often said that every developer needs a developer’s blog. As Scott Hanselman eloquently states, Your Blog is The Engine of Community. The benefits of having your own site can be immense:

  • It is a place where you can share your opinions on technology.
  • You can showcase your skills and display your side projects.
  • Demonstrates that you can learn on your own time and that you are abreast of current technologies.
  • That you care about the developer community and you want to give back.
  • All of your posts are searchable and your work is easily accessible to future employers.
  • It shows that you can communicate your thoughts in a professional manner.
  • Serves as a portal to all your social media profiles.

I have been blogging more lately and I have recently adopted the theory of “write once, publish anywhere”. Based on the developer’s axiom of “write once, run anywhere”, it is the idea of producing one item but being able to use it at least two times. Another analogy that I can relate it to is simulcasting in TV. The television episode is created once and then it is distributed to multiple TV stations.

My blogging activities are trying to replicate this philosophy as I want to reuse my articles in several places. First I look for third-party sites that I can submit to initially. Once it appears on the site I then take the same piece and re-blog it to my own site several days later. This way I create content for two sites. I get the benefit of my work being listed on another’s site, RSS feeds, Twitter announcements, etc. and they get fresh material for their pages. As well, I am still providing new content to my own blog.

The nice thing is as .NET developers and Microsoft technologists there are a lot of places where you can contribute articles. The following links are sites you can use to post content to:

In addition, if you search for the term “Write for us” (in quotes) combined with the topic you wish to talk about you will generally find a blog or magazine looking for submissions. Granted, you do not want to author for just anyone so vet the site first. Read a few excerpts and see if the items are of value.

If none of the links above appeal to you then reach out to your favourite website or blogger and ask if they accept guest pieces. They just might surprise you and say yes. Then, once you have found the one you want — go for it! Work with the editors to get it just right for their audience. Even if your content is rejected in the end you will still have a post you can use on your own site.

Do you know of other sites that accept Microsoft-based articles? If so, feel free to add them in the comments!

Advertisements

Open Guelph Hackathon 2015

Open Data Guelph Logo Two weeks ago I participated in the Open Guelph Hackathon 2015. This was the second year in a row that the City of Guelph sponsored a hackathon in conjunction with Open Data Day. However, this year, instead of doing a 24 hour session they did a seven day online hack which was open to all Canadians.

Details

For this year’s hackathon there were four themes – or data sets – that could be used. For my project I chose the Solid Waste Sorting Tool dataset.

Since I was working by myself I focused on building something using the Lean Startup approach. That is, get something working and then iterating on it. So, I used Visual Studio 2013, ASP.NET, C# 4.5, SQL Server 2014 Express, and Bootstrap to create a functional app in the time that I had. For this theme it was also requested that anyone who searched for items in the waste stream that were not listed, that those searches be tracked so the items could be listed in future.

After the projects were submitted, all the participants were invited to appear before the judges either by Skype or in person at Guelph City Hall. I presented my app to Mayor Cam Guthrie and various other stakeholders from the departments who would benefit from the software.

[tweet https://twitter.com/OpenGuelph/status/573562508805599233 ]

Winners

After several anxious days I was notified I did not win. However, I was glad that I participated and was able to demo my app to the judges. To find out who did win, see this article in The Guelph Mercury.

So, a big thanks goes out to the City of Guelph for hosting this event and to Blair Labelle (@Blair_Labelle), GM of Technology and Innovation for the city, for spearheading the open data initiative in Guelph. I encourage everyone to follow Open Guelph (@OpenGuelph) on Twitter and to participate in next year’s event!

Export an ODBC Data Source from the registry

I recently found myself needing to do some Crystal Reports testing on a virtual machine. The tests were successful on my laptop but we use a  virtual machine running Windows Server 2008 R2 and IIS7 as a clean environment for testing. With these tests we were using both ODBC and SQL OLE DB connections to our database. The OLE DB connections were easy enough to replicate but we wanted to make sure our ODBC settings matched my laptop environment. To do this we used the Export feature in the system registry of my Windows 7 laptop.

Before I demonstrate this though I should explain what ODBC is. Open Database Connectivity (ODBC)  is a standard way for connecting to databases. ODBC and the associated driver can connect to a database regardless of the database manufacturer or the operating system on which it runs.

I will demonstrate the steps below on how to run the export.

1. First we need to see which ODBC connections we want to move. To view the existing ODBC connections we can open the ODBC Data Source Administrator. To do this click the Start button and type “ODBC” into “Search programs and files” on the Start Menu. Click “Data Sources (ODBC)” to run the program. It can also be launched from Administrative Tools | Data Sources (ODBC) if it is enabled on your machine. A tabbed dialog box will appear. Most of your ODBC connections should be housed under the User DSN tab.

2. To begin the export process we need to start the Registry Editor. To do this we can search “regedit” from the Start Menu and click Regedit.exe to begin. Another way is to launch the Run Command, enter “regedit” into the dialog and hit OK.

3. You  should now be within the Registry Editor. ODBC Data Sources are stored as keys within the Windows registry. Fortunately they are easy to retrieve. Your DSNs will be housed in two separate spots on Windows 7. (Other operating systems tend to place these in different files so you may need to hunt around.)

    User DSNs: Computer\HKEY_CURRENT_USER\Software\ODBC\ODBC.INI

System DSNs: Computer\HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI

Registry Editor

4. Once you have found the correct folder you can now export the desired connection(s). Right click the ODBC.INI folder and select Export to copy every ODBC key in the folder. You can also choose a more granular level of exporting by selecting one DSN within the folder at a time. Unfortunately  the CTRL key cannot be used to select multiple files for one export.

Registry Export

A dialog window will appear. You can choose to export it in multiple file types (although .reg is the standard) and where to save the exported file. You can also select what you want included in the file through the Export Range. The option defaults to “Selected branch” which means you only get the DSN properties listed in the key. You can also select “All” and this will export every registry key in your system. A caveat though – when exporting using All within the Export Range it exported a file containing 3, 907, 557 rows of data. (I ran it twice to be sure this was correct). If you do not have many DSNs to move you might be better off to export each DSN individually.

Registry Export Dialog

Once the Export is saved to disk it will create a .reg file. This file can be opened and examined with a text editor like Notepad. Within the file you will see the various properties of a DSN like server and database names, as well as the selected database driver.

Exported Registry File

With the .reg file open you will now need to modify the file. As you have seen above when you export the ODBC Data Source you only get the DSN properties. However, when you insert this code into the registry on the target machine the DSN will be inserted into the registry but will unavailable elsewhere. To ensure you will have access to the DSN within your Crystal Report file, the ODBC Data Source Administrator and other places you are using ODBC Data Sources you will need to prepend the following code to the file:

[HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources]
"DSN name"="SQL Server"

Modify the “DSN name” to match the name of the ODBC Data Source folder you exported.

Modified Exported Registry File

5. You can now copy the .reg file to the destination computer for installation. Before you install though you might want to open the file and compare the DSN properties. It might be possible the target computer contains different settings than the export file. You can edit the .reg file to match before deploying the file.

6. To insert the values on the target computer open the ODBC Data Source Administrator and select File | Import… to browse to the file. Click Open to run the process. You can also simply double-click the .reg file and it will install the values into the correct locales.

Registry Import

7. The last step is to verify the install. Open the Registry Editor on the destination computer and navigate to the correct DSN folder path. Confirm that your ODBC Data Source is listed in the folder. Close the ODBC Data Source Administrator and re-open it to confirm they are accessible there as well. You can then tweak the DSN further by using the Configure button if need be.

ODBC Data Source Administrator

That is it in a nutshell. In this tutorial we have exported ODBC Data Source connections between two computers running different Microsoft operating systems. We saved ourselves time and headaches by ensuring our connections are identical between the two machines.

My CTTDNUG presentation slides and source files

I have published my slides and source files on An Introduction to Configuring and Extending Umbraco CMS from my presentation to Canada’s Technology Triangle .NET User Group (CTTDNUG). The slides are also available on SlideShare.

Please contact me if you have any follow up questions.

My CTTDNUG presentation on Configuring and Extending Umbraco CMS

My presentation, An Introduction to Configuring and Extending Umbraco CMS, to Canada’s Technology Triangle .NET User Group (CTTDNUG) is just five short days away on Wednesday January 25, 2012.

The presentation will be at the Manulife Financial building in Kitchener, Ontario from 6:30 to 8:30 pm. At the end of the talk there will be raffle draws for Umbraco items as well as additional products from our group sponsors.

Umbraco is a free, open source content management system (CMS) that was launched in 2004. Since then it has grown into one of the premier CMS solutions available to ASP.NET developers. Umbraco is primarily written in C#, stores data in a number of relational databases (commonly Microsoft SQL Server) and works on Microsoft IIS.

This session will provide an overview of how easy it is to get up and running using Umbraco. Through an IIS web deploy, a developer can create a basic site in minutes. Demos in this session will extend the usability of the basic site by integrating existing ASP.NET functionality like User Controls to develop reusable components that can be used in future projects. A discussion of document types, data types, templates, XSLT Files, and stylesheets will round out what you need to get you started with Umbraco.

Please register for this event through the following link.

Note that you need to log into the CTTDNUG site to register. If you aren’t a registered member, click the Register link in the top right corner and follow the steps. Registration is FREE!

Feel free to contact me if you need additional information.