Riaan Lehmkuhl's Blog

Subversion, Progamming, Tips & Tricks and whatever else springs to mind.
27Jul

Grass And Sky BlogEngine.NET 1.4 template

27 July 2008 15:09 by Riaan Lehmkuhl

As promised in a previous post here is the Grass And Sky template adapted for BlogEngine.NET 1.4

Grass And Sky website template 

This theme is not a 100% complete yet, but maybe you can make it work for yourself.

Download and give it a go.

Be the first to rate this post

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

Updated SyntaxHighlighter Extension for BlogEngine.NET

27 July 2008 12:52 by Riaan Lehmkuhl

Looking for ways to add syntax highlighting to my blog I came accross Scott Dougherty's article for Adding SyntaxHighlighter to BlogEngine.NET and then Chris Blankenship's SyntaxHighlighter Extension for BlogEngine.NET.

I really like his extension, but I wanted the installation path and loaded language scripts to be configurable so I've updated his extension to use the BlogEngine Extension Manager.

  1. Download SyntaxHighlighter
  2. Extract and upload the SyntaxHighlighter code to your blog (I renamed the dp.SyntaxHighlighter directory to just SyntaxHighlighter)
    eg. ~/extensions/SyntaxHighlighter
  3. Download, extract and upload the SyntaxHighlighter.cs file into the ~/App_Code/Extensions directory

    NOTE:
    If you already had the SyntaxHighlighter Extension from Chris Blankenship installed, you might have to delete the "~/App_Data/datastore/extensions/SyntaxHighlighter.xml" file before the new extension settings will be loaded.

  4. Login to your blog and go to "Extensions" under the "Control panel"
  5. Click on "Edit" next to the "SyntaxHighlighter" extension and configure as required (see preview below)

SyntaxHighlighter Extension Manager

For a list of supported languages see the syntaxhighlighter wiki

For Windows Live Writer support:

  1. Download and install Windows Live Writer and the SyntaxHighlighter for Windows Live Writer plugin (Requires .Net 3.5 framework)
  2. Update the blog style (In Live Writer under the "Weblog" menu then "Edit Weblog Settings..." and click on the "Editing" tab)

NOTE:
If you have custom ordered list item styles in your theme, you might have to make a small change to the SyntaxHighlighter CSS. In my case I've got a custom list-style-image so I had to make the following change in the "SyntaxHighlighter\Styles\SyntaxHighlighter.css" file:
in the following bit, I added list-style-image: none;:

/* clear styles */
.dp-highlighter ol,
.dp-highlighter ol li,
.dp-highlighter ol li span 
{
margin: 0;
padding: 0;
border: none;
list-style-image: none;
}
Here's the diff:
Index: /BlogEngine/BlogEngine.Web/extensions/SyntaxHighlighter/Styles/SyntaxHighlighter.css 
=================================================================== 
--- /BlogEngine/BlogEngine.Web/extensions/SyntaxHighlighter/Styles/SyntaxHighlighter.css 
+++ /BlogEngine/BlogEngine.Web/extensions/SyntaxHighlighter/Styles/SyntaxHighlighter.css 
@@ -17,6 +17,7 @@
margin: 0;
padding: 0;
border: none;
+	list-style-image: none;
}
.dp-highlighter a,

 

Be the first to rate this post

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

Firefox 3 Bug: invalid 'in' operand this._sandbox

23 July 2008 19:27 by Riaan Lehmkuhl

If you are getting the following JavaScript error in Firefox 3, here is a quick workaround:

Error: invalid 'in' operand this._sandBox Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsProxyAutoConfig.js Line: 95
Open the file mentioned in your favourite text editor (one that can handle unix line endings; if you have nothing else, use WordPad), and seach for the this line:
if (!("FindProxyForURL" in this._sandBox))
   return null;
and wrap it in a try/catch block like this:
try {
   if (!("FindProxyForURL" in this._sandBox))
      return null;
} catch (e) { return null; }
Save your changes, and restart Firefox.

Although this is probably not the correct way to solve this problem, at least it helps to keep the 'Error Console' garbage free.

 

Currently rated 2.6 by 10 people

  • Currently 2.6/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
22Jul

Moving from Blogger to BlogEngine.NET

22 July 2008 02:42 by Riaan Lehmkuhl

I just moved my blog from Blogger to BlogEngine.NET. I done this for various reasons, but mainly because I'm a control freak.

Although I could have used the "blog.importer.application" provided by BlogEngine.NET, I did the export and import manually to have full control of the process.

Normally when moving domains the best way would of course be to setup 301 redirects, So my new blog to keep rankings etc. but Blogger has made that impossible.

I searched for ways for just forwarding all the requests to the Blogger blog to my new blog and found many posts on moving from Blogger to Wordpress. So this post just includes the specifics for BlogEngine.NET.

The main two sources I used was:

I wanted my old blog to stay up with posts intact so that people that has bookmarked it or any posts can still find what they are looking for and because read this post: why-you-should-never-delete-your-blogger-blogs.

The Walkthrough:

(Remember to replace "YOUR_NEW_BLOG_DOMAIN_HERE" with your blog's address.)

  • Setup the auto redirect:
    Log into your Blogger account, navigate to the "Layout" tab and click on "Edit HTML". In the template editor put the following in the <head>...</head>:
    <meta content='5;url=http://YOUR_NEW_BLOG_DOMAIN_HERE/' http-equiv='refresh'/>
    This will handle the front page redirection of the blog.
  • To let the users know that your blog has moved, and that they will be redirected, add a message to the page:
    <div style='position: absolute; top: 30px; left: 30px; border: solid 2px #333; color: #000; background-color: yellow; padding: 5px; width: 400px; z-index: 5; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: large;opacity: .4;filter: alpha(opacity=40);'>
    <p><strong>My blog has moved!</strong></p>
    <p>You should be automatically redirected in 5 seconds. If not, visit<br/> <a href='http://YOUR_NEW_BLOG_DOMAIN_HERE/'> <strong>YOUR_NEW_BLOG_DOMAIN_HERE</strong></a> <br/> and update your bookmarks.</p>
    </div>
    Place this right after the opening <body> tag.
    redirect
  • Because your new blog will contain all the posts from the old Blogger blog you need to avoid being penalised for duplicate content, add this to the "head" section as in point one...
    <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW"/>
    <META NAME="GOOGLEBOT" CONTENT="NOINDEX, FOLLOW"/>
    NOINDEX FOLLOW tells the crawler not to index the Blogger page but to FOLLOW the redirect. NOINDEX will also instruct the crawler to drop any already indexed version of page.
  • To make the individual posts forward to their new counterparts a few things need to be done:
    1. On the Blogger control panel in “Settings -> Formatting”, change the Timestamps on posts to the MM/DD/YYYY format.
    2. Look for this code in the Blogger Template
    <b:section class='main' id='main' showaddelement='no'>
    and enter the following widget code under it (combine the three bits):
    <b:widget id='Redirector' locked='true' title='Blog Posts' type='Blog' >
    <b:includable id='main' >
    <b:if cond='data:blog.pageType == "item"' >
    <b:loop values='data:posts' var='post' >
    <div id='redirectorTitle' style='visibility:hidden' > <data:post.title/ > </div >
    <script type='text/javascript' >
    var new_domain = 'http://www.lehmkuhl.za.net/blog/post'
    function utf8_uri_encode( str ) {
       var high_code = new RegExp(/[\u0080-\uffff]+/);;
       new_str = str;;
       while( m = high_code.exec( new_str ) ) {
          new_str = new_str.replace(m,encodeURIComponent(m));;
       }
       return new_str;;
    }
    var title = document.getElementById('redirectorTitle').innerHTML;;
    // [INCOMPLETE] Keep percent signs that aren't part of an octet?
    title = title.replace(/<[^>]*?>/g,'');; // remove tags
    title = title.replace(/&.+?;/g,'');; // remove entities
    title = utf8_uri_encode(title);; // handle UTF-8 characters
    title = title.toLowerCase();;
    title = title.replace(/[^%a-z0-9 _-]/g,'');; // remove punctuation
    title = title.replace(/\s+/g,'-');; // turn spaces into hyphens
    title = title.replace(/-+/g, '-');; // collapse runs of hyphens
    title = title.replace(/^-+/g,'');; // remove prefixed hyphens
    title = title.replace(/-+$/g,'');; // remove suffixed hyphens
    var timestamp = ' <data:post.timestamp/ >';
    timestamp = timestamp.split('/');
    timestamp = timestamp[2]+'/'+timestamp[0]+'/'+timestamp[1];
    var new_page = new_domain + '/' + timestamp + '/' + title + '.aspx';;
    document.location.href = new_page;
    </script >
    </b:loop >
    </b:if >
    </b:includable >
    </b:widget >

    This will redirect the blogger post...
    http://someblog.blogspot.com/2008/06/some-blog-post.html
    ...to...
    http://YOUR_NEW_BLOG_DOMAIN_HERE/post/2008/06/28/some-blog-post.aspx

To see a working example visit my old blog at http://somethingsubversion.blogspot.com/.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
13Jul

Add Google Talk Online Presence to Web Pages

13 July 2008 00:08 by Riaan Lehmkuhl
If you use Google Talk instant messenger and would like to stay connected with visitors on your website, the Google Talk chatback badge is a cool way to display to them when you are online and available to chat / IM with them.

Just point your browser to http://www.google.com/talk/service/badge/New, and follow the easy instructions.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
11Jul

Unable to run Proclarity Web Professional

11 July 2008 00:05 by Riaan Lehmkuhl

A while after installing and configuring Proclarity 6.3 the users started receiving a blank page when accessing Proclarity Web Professional:

Click to see larger image 

After some searching I found this post: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2901084&SiteID=17. There is a bug in Proclarity, for which MS has released a hotfix: http://support.microsoft.com/kb/946719.

Downloaded an installed the hotfix just to find a brand new error:

Unable to run Proclarity Professional. Either the required components are not installed or you don't have permission to download them.

 

Click to see larger image 

The user is a member of the Administrator so permissions shouldn't be an issue. The search continues…

I found a new hotfix rollup package released after the one I had installed: http://support.microsoft.com/kb/953604. But after installing it, the problem was still there!

Back to Google…

I tried everything suggested in this post about the subject: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=2396186&SiteID=17

  • Give users professional access in the ProClarity Administration Tool (Analytics Server Administration Tool).
  • Select the components folder in the admin tool, right click the web professional and choose properties. Make sure the box "required component" is selected.
  • Made sure no pop-up blockers are enabled.

Oops! Still the same error.

To my surprise, it worked when I ran Web Professional from the server. This meant that Proclarity is working but that there has to be a problem with the user access.

Time to fool around... In the Analytics Server Administration Tool, I added a new user Role, ProclarityWebUsers, and added the required users to it. Then on the Publishing tab of the role properties I clicked on Allow All.

Click to see larger image 

And the same on the Access Rights tab.

Click to see larger image 

Returned to Proclarity Web Professional and another big surprise… It worked!

 Click to see larger image

If you are experiencing the same issues, I hope this helps. I'm not a Proclarity guru and have no idea which of these steps are the actual ones to solve the problem.

Happy analytics!

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
10Jul

Grass And Sky Free website template

10 July 2008 23:58 by Riaan Lehmkuhl

The Grass And Sky theme is loosely based on the Dirtylicious website template by Viktor Persson which which I originally ported to a BlogEngine.NET 1.3 theme and then back into a standard website template.

I will publish the BlogEngine.NET version as soon as I have finished tuning it for the 1.4 release.

Grass And Sky website template 

Go ahead, download and try it. Please tell me what you think.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
07Jul

svn:externals with a space in the directory name [2]

07 July 2008 23:52 by Riaan Lehmkuhl
As promised I've published the code and instructions to my previous post...
Go and have a look on CodeProject:

Workaround: svn:externals with a space in the directory name:
TSVN Post-Update hook utility for using svn:externals with a space in the directory name
http://www.codeproject.com/KB/files/Percent20toSpace.aspx

Please let me know what you think.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
06Jul

svn:externals with a space in the directory name

06 July 2008 23:47 by Riaan Lehmkuhl
While setting up my development environment for various BlogEngine.NET sites, I ran into the problem that when setting svn:externals: One cannot have spaces in the directory name or the external url with TortoiseSVN.
For example: User controls svn://host/User controls
According to a message in the TSVN mailing list, the trick is to replace the space with "%20", like this: User%20controls svn://host/User%20controls Now being able to add the external, there is a new problem:
When I put the "%20" in the name, I get a directory with the characters "%20" in the name. I could have just used an underscore, but the there are references to the "User controls" directory in the project and for future compatibility I didn't want to deviate from the original structure.

To overcome this I've created a tiny console application to rename the directory when the TSVN Post-Update Hook is fired. I will post the source in the next edition of this saga.

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
27Jun

Create CheckBox Option groups

27 June 2008 23:45 by Riaan Lehmkuhl
CheckBoxOptionGroups  
I was recently given a website to make changes on. The HTML was already done and signed off by the client, and could thus not be changed.
Then I came across a bunch of options that needed to be saved to the db and instead of using RadioButtonList controls, there was a table containing a lot of CheckBox controls.
To simulate the RadioButtonList behaviour for the CheckBox groups, one could use AutoPostBack and a bunch of if statements. Also don't forget all the db access code that has to be written to save the selections to the database.
This would lead to a horrible UI, and difficult to maintain back end.

I've posted my solution to CodeProject:
http://www.codeproject.com/KB/aspnet/CheckBoxOptionGroups.aspx

Currently rated 3.0 by 5 people

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

Riaan Lehmkuhl


Me, a disorder of the brain that results in a disruption in a person's thinking, mood, and ability to relate to others.

Recent comments

Comment RSS

Thingies

Calendar And Month List

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Disclaimer & Privacy

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Privacy:
We use third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

Most comments

Cool Quote

I know that you believe that you understood what you think I said, but I am not sure you realize that what you heard is not what I meant. - Robert McCloskey