Comment Spam, Punishing Users and Bugs – Oh My!

Published: Monday 2 August 2010 @ 12:28 -07:00 UTC by gogman

spam It seems that there has been an issue with posting comments on my blog. When posting a comment people would be greeted with the message "Sorry, the following error occurred while processing your comment: There was an error in the callback."

I had received a couple of reports regarding this but could never seem to replicate it. Well, it turns out the bug only happened to users who are not signed into my blog – which would be everyone but myself. I discovered this by accident after forgetting to sign into my blog and posting a test comment after getting a message regarding the error (thanks Aunt Pat!). All I could mange to to say to myself was: Duh….

After a couple of other tests verifying the bug existed, I set about trying to resolve the cause. The first place I started was in the extensions I use in the commenting system to help prevent spammers from littering the comments with useless comments and links. I disabled the Askimet and reCaptcha extensions and lo and behold, the bug went away! My gut instinct seemed to have paid off – for the moment.

At this point I decided to leave the extensions disabled, enable comment moderation, and not pursue the issue any further. I really hate forcing users to enter a CAPTCHA to post a comment. Entering a CAPTCHA is, at least in my mind, a form of punishment inflicted on the user by spammers and overly uptight sysadmins and being it was the wee hours of the morning, I decided to grab a quick round of TF2 and then go hit the sack. All was well in Well Rounded Geek land.

Upon waking the next morning, I engaged in my usual ritual of checking my email while slurping on a Red Bull and rubbing the sleep out of my eyes. My eyes rapidly opened as I was stunned to find 33 notification emails from my blog letting me know a comment had been posted. 33 comments all while I was lost in slumber! WOOHOO! People love me! Now wide awake, I logged into my blog to find that every single comment was spam.

Bloody hell! Mo&%er fu^@*!ng spammers!

After spending 20 minutes updating the filters on my blog and deciding that enough was enough, I hit Google. I had to find out what was causing the callback errors and doing a Google search first is a lot faster than firing up a full debugging session.

Luckily for me I almost immediately came across a forum posting describing the same issue I was having. Continuing to read down the thread, lo and behold I came across the exact problem I was having. And the best part: there was a fix posted by Andrea Dottor.

I immediately backed up copies of the offending files and implemented the fix. BAM! No more callback errors with all spam filters and services enabled. VICTORY! SUCK IT SPAMMERS!

There bug? It turned out to be a rather pedestrian mistake: trying to return the wrong type of object when calling the BlogService.LoadFromDataStore function inside the ReCaptcha component. I have posted the changed source code here:

All credit goes to Andrea Dottor for finding the bug and posting the solution.

So, dear readers and commenters, I apologize for the fact that you have to input the CAPTCHAs and jump through the hoop to post here. I don’t want you to have to do it, but the bloody spammers leave me no choice…

Tags: ,

WRGprettyPhoto BlogEngine.NET Extension Update

Published: Tuesday 6 July 2010 @ 02:11 -07:00 UTC by gogman

My WRGprettyPhoto Extension has been updated to version 1.1.

If may be downloaded here.

Thanks to everyone who reported bugs.

VS2010 Ultimate Upgrade – Loving it!

Published: Wednesday 9 June 2010 @ 12:46 -07:00 UTC by gogman

VS2010 Ultimate I haven’t posted in a few days as I have moved on from Visual Studio 2008 Professional to Visual Studio 2010 Ultimate and have been neck deep in exploring the new IDE and features.

So far, I am loving it! I only had one small glitch that was strange and didn’t affect the operation: The registered owner and organization was listed as Microsoft.

How to change the Visual Studio 2010 registered owner and organization information:

Close all instances of Visual Studio 2010

Fire up RegEdit and:

On 32-bit Windows follow the below steps:

Edit the values under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Registration\UserName
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization

On a 64-bit Windows follow the below information:

Edit the values under:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Registration\UserName
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization

When that is done, start the Visual Studio 2010 Command Prompt and run: DevEnv /setup

Let that run and when it is done, close the Command Prompt and Visual Studio 2010 and you should now see the correct user information listed.

Extensions, Templates and SDKs

I am loving the new suite of extensions, templates and SDKs available for VS2010. Here are the ones I am using so far:

So far I think Microsoft has done a great job with this version of Visual Studio.

Good job guys!

Categories: Development

Introducing the WRGprettyPhoto BlogEngine.NET Extension

Published: Wednesday 26 May 2010 @ 07:27 -07:00 UTC by gogman

UPDATED 6 July 2010: WRGprettyPhoto 1.1 - contains minor bug fixes and reliability improvements - Download WRGprettyPhoto.1.1.zip – 3.72kb.

When I decided to adopt BlogEngine.NET as my primary website publishing platform, I knew there might be a few issues with the scripts I had been using on my old site. As I began testing, I discovered, much to my chagrin, that one of my favorite scripts – Lightbox 2 – did not work with BlogEngine.NET.

After a little research, I discovered that the incompatibility came down to a much used function in the JavaScript library for the blog sharing the same name as a function in the Scriptalicious library: function $(id) in the blog library and function $(element) in the Scriptalicious library.

I looked through both sets of code and decided that rewriting the code to use a different function name was just too much work and would complicate upgrading either set of scripts.

Deciding to find an alternative to Lighbox 2, I went to the extensions page on the BlogEngine.NET website and saw an extension named prettyPhoto. After visiting the author’s page and checking out the prettyPhoto javascript library website, I installed the extension and support libraries.

For some reason, the extension failed to work for me. I am not sure why it did not work, but it just did not. By this point I was set on using prettyPhoto so I manually set it up and got it working. It was at this point that I sadly realized I would no longer be able to use Live Writer’s built in Lightbox 2 editing support due to the different tag names used by prettyPhoto and the lack of the reference to the Lightbox 2 library on the site.

This got me thinking, why not write a prettyPhoto extension that not only “tricks” Live Writer into enabling support for Lightbox 2 but also works with that support in a smart way to enable prettyPhoto to use it. And while at at it, why not make it smart enough to only load the prettyPhoto library and the jQuery library only when needed?

After reading the BlogEngine.NET extension developer documentation, I jumped right in and after a few hours of learning, coding, and testing, I had my new extension completed: WRGprettyPhoto 1.0.

Download WRGprettyPhoto.1.1.zip – 3.72kb

 

Features:

  • Enables and works with Lightbox 2 support in Windows Live Writer.
  • Saves bandwidth by only referencing the prettyPhoto script when needed.
  • Optionally saves bandwidth by only referencing the jQuery script library when needed.
  • Complete control over the appearance of prettyPhoto from within the extension settings without ever needing to write code.

Setup:

  1. Download prettyPhoto (minimized version recommended) and extract the prettyPhoto folder in the archive into the root folder of your website.
  2. Download the WRGprettyPhoto archive and copy the WRGprettyPhoto.cs file from the WRGprettyPhoto archive into the App_Code\Extensions folder.
  3. Optional: If you use Windows Live Writer and want to use the built in support for LightBox2 with prettyPhoto, copy the file file lightbox.js from the WRGprettyPhoto  archive into the prettyPhoto\js\ folder.
  4. Optional: If you already have the jQuery library script referenced in you site you may skip this step. If you do not and would like WRGprettyPhoto to dynamically load and unload jQuery as needed then download the jQuery Library (minimized version recommended)  and place it in a folder on your site. I place mine in a folder off the root folder named Scripts.

Configuration Notes:

If you enable Live Writer Lightbox 2 editing support for use with prettyPhoto you MUST complete setup step #3 and refresh your blog settings in Windows Live Writer. Once you do this you should see the following when you click the options button after inserting an image into your post:LiveWriter_LightBox_Support All you have to enter here is the gallery name for the photos you wish to display in prettyPhoto.

If you wish the have WRGprettyPhoto mange the loading of jQuery only when needed, you MUST complete setup step #4. The URL you enter must be a relative URL (eg: Scripts/jQuery.js) to the location where you have placed the jQuery library. A leading slash is not required.

The other options on the extensions page are pretty self explanatory.

Support and Licensing:

Please send me any bugs or feature requests you may have ASAP. You may either use the contact form or the comments on this post.

This extension is not licensed in any way and is given away free for you to do with what you will. All I ask is please keep the comment header in the extension source code intact and link back here if you improve upon or use WRGprettyPhoto as a base for your own custom extension.

Happy blogging!