Syntax Highlighting

clock July 29, 2008 21:31 by author Vladimir

As you might have noticed here, I am using a JavaScript syntax highlighter for showing off my code. If you were wondering what it was and how to set it up with BlogEngine.NET, this post is for you.

The basis for this is taken from this blog by Chris Blankenship, I have taken his extension and modified it a little, so it works not only with posts in BlogEngine.NET, but also with pages as you can see on this site.

Here are step by step instructions on what you need to do.

  1. Download the latest version of SyntaxHighlighter (1.5.1 as of today)
  2. Extract and upload the db.SyntaxHighlighter folder into the root of your BlogEngine.NET app (not necessarily the root of your site).
  3. Download and install Windows Live Writer (a program I heartily recommend for posting to blogs).
  4. Download and install the SyntaxHighlighter Windows Live Writer Plugin
  5. Download my modified SyntaxHighlighter BlogEngine.NET extension
  6. Extract it and upload SyntaxHighlighter.cs into ~/App_Code/Extensions
  7. When posting to the site with Windows Live Writer, just click on "Insert Code..." on the right toolbar, choose you language and paste the code in the window. This should now be nicely formatted on your blog.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Word PDF Converter

clock July 26, 2008 23:15 by author Vladimir

At my job, I sometimes have to convert a bunch of Word documents to PDF. As this is tedious to do manually, I have written a small utility that lets me automate the process. I'm now sharing it for free with the world.

This is a small utility that lets you choose a bunch of files and converts them to PDF.

Download Word PDF Converter 1.0

There are a few prerequisites to run the software:

  1. Word 2007
  2. Save as PDF plugin (free from Microsoft)
  3. .NET Framework (free from Microsoft) - at least version 2.0

 

I'm also providing the source code for the app, so you can see how it works, and use it as sample code in your own apps.

Download Word PDF Converter Source Code

Instructions on using the software:
Click on Add Files or Add Directory and choose the files that you want to convert. Add Files will let you choose any files that you want (as long as Word can open them, they should work), Add Directory will only add files with extensions of .DOC or .DOCX in the directory that you choose. Then just hit the convert button, and once it finishes you'll find the PDF files in the same directory as the original files.

I hope you find this little app handy and useful.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


TimeZones with C# on Windows Mobile

clock July 6, 2008 18:53 by author Vladimir

As I'm sure you know, the TimeZone support in the .NET Framework is abysmal to say the best. You can get the current time zone and also convert DateTime objects to UTC and that's pretty much it. Even with .NET Framework 3.5, Microsoft only fixed the problem on the desktop (by including the TimeZoneInfo class). The .NET Compact Framework still has no native TimeZone support. Here is an attempt to fix that.

I'm offering my TimeZoneInformation class free of charge for anyone that wants it.

The basis for this class is taken from here. William Stacy wrote this class for Windows. What it does is read the time zone information from the registry and then use regular (non .NET) functions to convert between them.
There is another version of this class found here. This one is written by Mike Dimmick.
I'm not sure who wrote it first, so I'm giving credit to both of them. Thanks guys!

There needed to be a bunch of changes made to that class in order for it to work on Windows Mobile.
First of all, the functions are located in a different DLL file in Windows Mobile than they do on Windows.
Also, there are no functions to convert to a generic time zone in Windows Mobile, only between local time zone and UTC. Due to this, my class has to set the local time zone to whatever time zone that you need for a split second to do the conversion. I hope that this will not cause any problems with 3rd party programs.

The biggest problem in Windows Mobile, however, is that time zone information is not stored anywhere in the registry. In fact, I have absolutely no idea where it is stored.
Because of this, I wrote a small utility that exports the time zone information from a Windows PC to an XML file. My class now takes all of the information from this XML file and not from the registry as William's class does on Windows.

Important: my classes require .NET Framework 3.5. You can get the version for Windows here and the .NET Compact Framework 3.5 here.
These also come with Visual Studio 2008. You can get the free Express edition of Visual Studio straight from Microsoft here.

Without further ado, here are the downloads. I hope you will find them useful.

Source:

Binary:

XML file:

This is an XML file that I exported using my exporter utility on Windows Vista. Download it here.

Sample program:

I have written a sample program using my class. All it does is display the current time in the local time zone, in UTC, and in any other selected time zone. This is meant to run on a Pocket PC. This was tested with the emulator running Windows Mobile 5 and my own Pocket PC running Windows Mobile 6.

  • Source code
  • Binary - make sure to copy the XML file to the root folder on your Pocket PC for it to work.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5



Recent comments

Comment RSS

Disclaimer

The opinions expressed herein are my own personal opinions. Any code is here does not come with any warraties whatsoever. Use it at your own risk.

© Copyright Vladimir Burmistrovich 2008

Month List

Calendar

<<  January 2009  >>
MoTuWeThFrSaSu
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

View posts in large calendar

Sign in