Enabling code syntax highlighting on a SharePoint blog

by Graffen 17. November 2009 14:35

I’ve just spent an hour looking over our Sharepoint site at work and decided that I wanted to implement the same code syntax highlighting plugin as I use on here, namely the SyntaxHighlighter plugin.

To do this was actually pretty straightforward, once I figured it out. The following steps need to be performed on all three “views” that the blog has: Default, Post and Category. What you need to do is as follows:

  1. Put the page in Edit Mode by clicking Site Actions –> Edit Page in the top right corner
    image
  2. Click image  above the “Posts” Web Part
  3. Select image and press Add
  4. On the right side of the Web Part, click Edit and select Modify Shared Web Part
    image
  5. Click the image button
  6. Insert the following code snippet:
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css"/>  
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css"/>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCSharp.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushSql.js"></script>  
    <script type="text/javascript">  
        SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';  
        SyntaxHighlighter.all();  
    </script> 
  7. To add more brushes, simply add the references you want. To see the list, browse to http://alexgorbatchev.com/pub/sh/2.1.364/scripts/
  8. Next, in the tool panel on the right side of the page, expand the Layout section and select Hidden
    image
  9. Click OK

 

Now all you need to do is use the PreCode Pluginfor Windows Live Writer (or alternatively just use the <pre class=”brush: csharp”> … code … </pre> in the WYSIWYG editor (remember to click the Edit Html button)


image

Happy blogging :-)

Tags: , , ,

Blogging | Utilities and Tools

Follow up on my blade server adventures

by Graffen 24. April 2009 11:50

I promised to follow up on my adventures in using shared storage for hosting data being served by a cluster of blades. Unfortunately we don’t (yet) have a nice SAN or anything like that, so all I had access to was a simple Windows file share on a NAS (I love three letter acronyms!). I couldn’t get over the concurrence problems I faced, and servers were constantly tripping over each other giving me file locking errors and stuff like that.

So I ended up spending a day writing a small deployment application that could copy the code out to all the blade servers. What my tool does is this:

 

  1. Copy an App_Offline.htm file to the root of all web servers. The App_Offline file shows a message to users that we are upgrading and that we’ll be right back.
  2. Copy latest build from the build server to each blade
  3. Modify web.config to disable debug, fix connection strings etc
  4. Remove App_Offline from all blades.

 

All in all this ends up working really well and is easy to work with. Also, it allows me to easily hand over the deployment task to someone else, as this person only needs to install the small click-once deployment tool.

 

image

Tags:

.NET | Programming | Utilities and Tools

Found my first Google Chrome Bugs

by Jesper Hess Nielsen 3. September 2008 05:04

I've found a couple of things that aren't working as they should be while surfing around.

Both of these happen on Facebook.

 image

On your main profile page, clicking the quick links works, but the blue highlight doesn't move along with the selection you've made.

image

When viewing a friend's photos, clicking on the paging links doesn't do anything except refreshing the page. The same goes for the list of galleries. However, when you click on one of the galleries to view it, paging does work although the whole page refreshes, which isn't very Web 2.0-like. In FF and IE, only the images are refreshed and not the whole page.

The last thing I found was that Java Applets aren't working, which means I can't use homebanking. This isn't really a bug (there's just no plugin for it yet), although it's a bit irritating.

I'll update this page if I find anything else.

Tags:

The Web | Utilities and Tools

Playing around with Google Chrome

by Jesper Hess Nielsen 2. September 2008 21:04

Wow! I downloaded the new Google Chrome browser this evening and I must say I'm impressed so far. It's lightning fast, lightweight and the overall "feel" of the browser is fantastic. I'll be trying it out as my primary browser over the next few days to see if I can catch on and make the switch from Firefox :-)

image

Technorati Tags: ,,,

Tags:

The Web | Utilities and Tools

Neat remote support tool: Teamviewer

by Jesper Hess Nielsen 7. January 2008 10:17

While working at Mondosoft, we used to use ISL Light to help our customers when they had trouble installing or configuring our software. It's a really cool tool that allows a supporter to remote control a PC or server, without the hassle of having to open up firewalls etc.

I even used it for personal use when my family needed help (you have probably experienced the following conversation at some point).

Family member: "Why doesn't X work anymore? It keeps giving me an error message"
Me:"What does the error say?"
Family member: "I don't remember, I clicked OK"

Anyway, I thought of buying ISL for myself, to help out in situations like above, but it was pretty pricey. This weekend, I stumbled upon a support tool with many of the same capabilities, and even a few extras - and all for free!

teamviewer 

The tool is called TeamViewer and is available in both free and commercial versions. The free version just has a nag dialog that pops up when you end the session.

The cool thing about this software is that your "victim" doesn't need to install anything. After downloading, the installer lets you run the software without installing. It's really easy to use and the UI is pretty intuitive. The client allows you to chat, transfer files (both ways), lock your victim's PC so they can't fiddle with the mouse and keyboard while you work and a couple of other neat features.

The client also has a presentation mode, allowing you to perform remote demos and things like that.

I think it's a pretty neat tool and I'll definitely be using it a lot from now on.

Tags:

Utilities and Tools

Increase boot speed in XP

by Jesper Hess Nielsen 5. January 2008 11:28

I just thought I'd draw attention to an unsupported Microsoft tool that can help decrease boot time in Windows XP. It's called BootVis and is not available for download from the Microsoft web site (and hasn't been for quite some time).

The reason the tool is not available for download is, according to Microsoft, that the actions performed by the utility are automatically performed by Windows XP every three days. Meaning it shouldn't really have any effect.

But if XP does this automatically, why do I see such a dramatic improvement on all the systems I've tried it on? I remember using the tool a few years ago on my home workstation and was really surprised at the effect. I cut down my boot time by about 70% (I don't remember the exact numbers).

So after installing XP back on my laptop, I downloaded Bootvis again and ran it. Now, instead of booting to useable state (meaning, to my desktop) in ~70 seconds, I'm there in under a minute now.

The Bootvis UI

So, how do you use bootvis? Well... first of all, download it from here, thanks to the guys at Major Geeks.

When you run it, you want to hit the Trace menu and select Next Boot + Driver Delays. Now allow the program to reboot your machine. If you need to log in when it's back up, do so but don't touch anything else until Bootvis is back up. Now it has finished profiling your system and is ready to optimise it. This is also done on the Trace menu - select "Optimize System". Your machine will now begin the optimisation process and then reboot. Once again, allow bootvis to load completely before touching anything. When it's done, try a last reboot and see if you can feel the difference.

Tags:

Other computer stuff | Utilities and Tools

Copyright © 2009 Jesper Hess Nielsen. This work is licensed under the Creative Commons License.
Powered by BlogEngine.NET 1.5.0.7
Theme by Extensive SEO

About the author

A blog about me, R/C planes, .NET, Twitter and whatever else I feel like writing about.