Spam comments were deleted

17. February 2011

I have noticed that while I was not posting new posts the blog was filled with spam comments. I have deleted most of the comments. In the future I will monitor the comments more carefully. I have also added reCaptcha and I hope it will block some of the spam comments.

Blog

New job and updated blog engine

17. February 2011

I haven’t posted anything new on this blog for over one and half years. During that time I have switched job. I am currently working in Windows organization in Windows Update team. I am working on Windows Update and other technologies and components built on top of Windows Update infrastructure.

Recently I have also updated the blog engine on this blog to BlogEngine.NET version 2.

Expect more news and some posts soon.

Blog ,

Windows Live Writer Source Code plug-in

2. April 2009

I use Windows Live Writer for authoring my blog posts. It is very user friendly application that allows you to forget about the ugly web interface your blog engine has for authoring posts. As a developer I wanted to be able to paste source code samples into my posts and be able to format them accordingly. Fortunately Alex Gorbatchev wrote a simple JavaScript application that will format source code according to parameters in the PRE element in which the code is placed. All we need to do is:

  • add support for Alex Gorbatchev’s SyntaxHighlighter to your blog (server)
  • teach Windows Live Writer to enter the right parameters whenever you insert a source code snippet in one of your posts

There are solutions for all of these but none of them suited my needs (I will try to cover the reasons for that later). Rather than complain I thought I would try to solve my problems.

Source Code Plug-in on CodePlex

I have created SourceCodePlugin project on CodePlex to include my solution to the above mentioned needs. The project has two parts: SyntaxHighligher for BlogEngine.NET and SourceCode plug-in for Windows Live Writer.

SyntaxHighligter for BlogEngine.NET

This part of the project allows you to integrate an updated SyntaxHighlighter with the BlogEngine.NET system. The highlighter is based on Alex Gorbatchev's code with a couple of updates:

 

Product: SyntaxHighlighter 
Author: Alex Gorbatchev 
Version: 2.0.296 
Link: http://alexgorbatchev.com/wiki/SyntaxHighlighter

 

Updates from Alex's code:

  • added PowerShell script
  • added FSharp script

 

Why did I have to code it myself? I had to update SyntaxHighlighter to add support for PowerShell and F# because I am used them frequently. Support for other my languages is already part of the product (C#, C++, SQL, XML, JavaScript, etc.). I found an integration into BlogEngine.NET but the extension was not compatible with the latest release of SyntaxHighlighter.

I have decided to update SyntaxHightlighter scripts library and create a new extension component for BlogEngine.NET compatible with the latest release of SyntaxHighlighter.

 

Examples

Sample F# code (this is a snippet from Tutorial.fs):

// Types: records
// ---------------------------------------------------------------

type Card = { Name  : string;
              Phone : string;
              Ok    : bool }
              
let cardA = { Name = "Alf" ; Phone = "(206) 555-8257" ; Ok = false }
let cardB = { cardA with Phone = "(206) 555-4112"; Ok = true }
let ShowCard c = 
  c.Name + " Phone: " + c.Phone + (if not c.Ok then " (unchecked)" else "")

 

Sample PowerShell code (this is a function I use for my nightly job):

#This method starts Windows service. It doesn't throw in case of an error.
function Start-ServiceNotThrowing($service, [bool]$displayWarning = $true)
{
    start-service $service -ErrorVariable errs 2>$null
    if (($errs -ne $null) -and ($displayWarning))
    {
        set-color "yellow"
        write-host "Warning: Service $service is not installed."
        set-color
    }
}

SourceCode plug-in for Windows Live Writer

This part of the project adds a SourceCode plug-in into Windows Live Writer to enable inserting code into your blog posts in a form compatible with SyntaxHighlighter.

To insert a code, click on Source code... item in Insert section (right side of the Windows Live Writer). The plug-in will use the currently selected text or (when configured accordingly) take the text from the clipboard.

 

SourceCodePlugin_MainForm

You can tweak the behavior of the plug-in by clicking Options button to update plug-in options. All values that you enter in this options dialog will be saved for future use (you don’t have to enter the same configuration over and over again).

 

 

SourceCodePlugin_Options

 

Why did I have to code it myself? I found several plug-ins for SyntaxHighlighter. One of them was not able to keep option values between invocations that led to a situation where you had to update your options every time you wanted to touch your source code. Another one saved the options but when I was editing source code that was already inserted into a post, the plug-in wouldn’t display the currently selected text. Instead I had to select the text, press Ctrl+C, open the plug-in and press Ctrl+V.

I have decided I will create a simple plug-in that behave the way I expected.

Resources

As I mentioned above the whole project is now available at CodePlex: http://sourceCodePlugin.codeplex.com. Feel free to check it out and if you find a problem, let me know or take the source code and fix it yourself.

Blog , , ,

Windows SharePoint Services

6. March 2009

Ok, it’s not even a month since my first post on this blog and things are different already. I have changed teams and now I work in SharePoint Server organization, in particular in Windows SharePoint Services Storage and Perf team. Since I am new to the team I cannot say for sure what is my primary feature but I hope I will find out soon.

I’m now also on Twitter, you can follow me. I have also added a special side bar with my latest updates from Twitter.

Blog ,

Welcome

22. January 2009

After almost two years of being idle I have decided to start blogging again. My old blog is still available at http://blogs.msdn.com/dpokluda but new posts will only appear on this new blog at http:// .

Q: So what did you do over the last two years?
A: I have changed groups. I don’t work in Microsoft Dynamics AX any more. I still enjoy working on business applications. When I heard about a new team called Office for Sales in Office organization that was supposed to be working on a first version of a platform bringing sales data from LOB into Office I was interested.

I am not sure how much I can say at this moment, so I will only link to other sources:

Q: Why the new location for the blog?
A: It’s not as much about the location but the engine. The previous blog was powered by Community Server that was administered by Microsoft so I didn’t have a chance to tweak the system as much. I was also overwhelmed by the amount of spam that I received daily and I didn’t have a way to control that. That’s why I have decided to move to a new blog engine and a new location.

Here are extra information:

Q: What will you blog about?
A: I would like to continue to blog about various things. I love building software, I love business applications, I love agile development and doing test driven development, I love using .NET framework, I love using 3rd party software/tools and I love supporting them. So the blog will mainly be about all these things.

Q: How often do you expect to post new posts?
A: That’s a tricky question. I would like to post one post a week.

This is it for now. I am still tweaking the blog theme. I hope I will be done with that in a week or two and then I will start posting actively. Stay tuned.

Blog