EPiServer Language Selector

by Brad 28. May 2008 12:55
Today I needed to create a UserControl to allow a user to select to view the current page from a list of enabled languages. To begin with I thought it would be a fairly easy task, by simply calling GetLanguageBranches() in the DataFactory class. However this ONLY returns the versions of the page that have been translated, which didn't suit me as our requirement was that ALL (enabled) languages should be displayed in the language selector, and if a language version doesn't exist for the specific page then the fallback language be used. So next I tried looping through the results from EPiServe... [More]

Tags:

ASP.NET | C# | EPiServer

Using Toolbox to store snippets of Code

by James Crowe 28. May 2008 10:51
I recently discovered a really useful tip when using Visual Studio .NET. The Toolbox can be used to store snippets of your code, ready to be re-used. Simply select the code you want to store and drag it onto the Toolbox. To paste the snippet into your code, place the cursor in the correct position and double click the toolbox icon. Alternatively Ctrl + Shift + V will cycle through the last 20ish items added to the clipboard

Tags:

BizTalk: Type 'System.Xml.XmlDocument' in Assembly 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.

by matt 27. May 2008 10:44
I ran in to this problem recently while developing a solution for a client.  For me it took a little while to figure out what was happening and the error was reported to be coming from a send shape that sent a message of type System.Xml.XmlDocument. While this is the correct place for the error to be raised, it was not strictly related to them message that I was trying to send. The actual cause of the problem is that I have a class that is used to return information back from a series of helper methods in a library that I have built.  The class has 3 public properties: Result: An inum... [More]

Tags:

.Net Framework | BizTalk Server

.NET: Using Namespaces with XPath in .NET

by Stephen Horsfield 23. May 2008 07:38
A colleague has been asking how to do this and I've found a great post written years ago.  I've linked it here: XPath & Namespaces (Wayne Allen's Blog)  Versions Microsoft .NET Framework 2.0 Metadata Categories: Software Development, .NET, XPath Additional keywords: namespace manager Technorati Tags: .NET, software development, XML, default namespace, XML namespace, XPath

Tags:

Software Development

Blogging: Technorati tags list published

by Stephen Horsfield 22. May 2008 16:28
I've compiled a list of the Technorati tags that I use on this site: http://blogs.interakting.co.uk/steve/archive/2008/05/22/Blogging-Technorati-tags.aspx  Hope someone finds it useful. Metadata Categories: blogging, tags Technorati tags: blogging

Tags:

.NET: JSON support in WCF

by Stephen Horsfield 22. May 2008 15:05
This is just a quick addendum to a colleague's post about using JSON in .NET. Original post See Dan's post here: Google Translate and .NET (Dan Matthews) Complete example code This example translates the phrase "a piece of pie" into French using Google Translate.  I do not use any processing on the JSON output except to convert it into an XML document that can be processed in .NET: using System; using System.Net; using System.Web; using System.IO; using System.Xml; using System.Runtime.Serialization.Json; namespace JSON_Example { class Program { static void M... [More]

Tags:

Software Development

.NET: Changing the default namespace of an XmlDocument

by Stephen Horsfield 22. May 2008 10:25
Have you ever wanted to change the default namespace of an XmlDocument in .NET.  It's not as easy as it might be. The problem Sometimes, particularly in middleware systems, you need to pass a source document to a target system.  The document may not need any changes, but one system will apply namespace declarations in the document and the other won't work with them, or one won't add them and the other will require them. There are a few main approaches you can take: XSL Transforms Regular expression replacements (or other string manipulations) XmlNode traversal methods (DO... [More]

Tags:

Software Development

Business: Enterprise Architecture and Business Strategy (recommended reading)

by Stephen Horsfield 21. May 2008 14:59
I'm currently reading "Enterprise Architecture as Strategy" by Jeanne W. Ross, et al., published by Harvard Business School Press.  I recommend that you obtain a copy and read it if you are interested or involved in enterprise architecture or business IT strategy. Read more online You can find out more about the book and the ideas it contains here: http://architectureasstrategy.com/book/eas/. Reference Enterprise Architecture as Strategy Creating a Foundation for Business Execution Ross, Weill, Robertson, Harvard Business School Press, 2006 ... [More]

Tags:

Business | IT Management

C#: Getting round the "Indexed Pixel Format Issue" in GDI+

by Brad 21. May 2008 09:49
If you've ever tried to manipulate images in C# using GDI+ you'll almost certainly have come across the following error at some point: a graphics object cannot be created from an image that has an indexed pixel format I know I have, and it took a fair bit of effort to find the solution so I thought I'd share it. Here's a quick background on Pixel Formats... In 'Non Indexed' images, each pixel represents ONE colour. So a pixel might have a value &h0000FF (Red). In 'Indexed' images each pixel value is an index to a so-called 'palette' or 'colour table'. So a pixel might have a va... [More]

Tags:

C#

Google Translate and .NET

by Dan Matthews 20. May 2008 15:20
Google have released a lovely little API for their Google Translate service. It uses a RESTful interface and returns a JSON object in the HTTP Response. The usual way to use this would be AJAX-style in client side JavaScript. This might not always be what you want to do though. For example, if you have a server resource in English and you want to show it in the page as Spanish you wouldn't want to render it in English and then have some page load event client side to translate it. You really want to do it server side and render it on the page as Spanish straight away. Of course, Google know t... [More]

Tags:

.NET/C# | EPiServer

.NET: Generics and the Badger Example in C#

by Stephen Horsfield 20. May 2008 14:08
Today I've been talking to some of our developers about generics in C#.  As part of it, we worked through an example, the Badger Example, which I've reproduced here for those intrigued! Overview This document demonstrates the creation of a generic class called Badger. Its purpose is entirely educational and introduces the use of type parameter constraints. The Initial Badger Class class Badger<TBadgerCharacter> { TBadgerCharacter _character; public Badger(TBadgerCharacter character) { // TODO: Use the new operator _character = character; }... [More]

Tags:

Software Development

SharePoint: 'Theme already exists on server' Error

by Brad 20. May 2008 13:39
I've just been (struggling) to create a new theme for SharePoint but kept getting the following error: A theme with the name "MY-THEME-HERE 1011" and version already exists on the server It turns out that my ThemeID (and the name of the folder) were too long - how the error message above gives any indication of that is beyond be! Anyway all you need to do is make sure the ThemeID is a maximum of 8 characters. Once I shortened it everything worked fine. I'm new to SharePoint so ignore me if this 'common knowledge' - I thought I'd share for any other newbies out there...

Tags:

Microsoft SharePoint

.NET: Encapsulation, hiding and member binding in C#

by Stephen Horsfield 20. May 2008 09:30
I've been looking at the C# specification for the new keyword when used on a class member declaration and thought I'd share my findings.  If you are a die-hard C# coder then you won't find anything new here, but of course that doesn't mean that you already know it!  Maybe it would be better to check... The basics Encapsulation Encapsulation is a term used in object-oriented design.  It describes the idea of wrapping some functionality in an outer shell.  The outer shell may contain significant functionality or it may just adapt the behaviour of the contained code. Further, encapsulation pr... [More]

Tags:

Software Development

URL Rewriting: ASP.NET HyperLink ImageUrl Bug

by Brad 20. May 2008 08:12
I've been experimenting with writing my own C# URL Rewriter using a HttpModule. It's surprisingly simple as .NET kindly has the following (where newURL is the path to the actual file) : HttpContext.RewritePath(string newURL) So this allows a URL such as: /my-friendly-url to actually point to: /pages/content.aspx?id=5   Problem: All was going well, but some pages were giving the following error for no apparent reason: Cannot use a leading '..' to exit above the top directory. After some investigation I tracked the problem down to any asp.net Hyper... [More]

Tags:

ASP.NET | C#

.NET: Hacking events and manipulating delegates

by Stephen Horsfield 19. May 2008 15:28
Have you ever wanted to remove a handler from an event, but haven't had a reference to the object receiving the event, or perhaps you don't even know what type the object has!  .NET hides the details of events but with a bit of help from the Reflection classes, you can edit the handlers for your own purposes. Cautionary note In general, this is a really, really, really bad thing to do! I'm writing about it partly because it is educational, and partly because it was an interesting problem to solve. Behind the scenes of .NET events I'm going to be using C# throughout this post, but the comme... [More]

Tags:

Software Development

How to access Session in custom HttpHandler

by Brad 19. May 2008 08:38
Creating a custom HttpHandler is fairly simple, all you need to do is implement the IHttpHandler interface. public class MyHttpHandler : IHttpHandler I recently needed to access the Session object from within my HttpHandler to check if a value existed, however the HttpContext.Session object was always null! After several minutes of pulling my hair out I discovered I simply needed to implement an additional 'marker' Interface. As I only needed Read Only access to the session object I used IReadOnlySessionState as follows: public class MyHttpHandler : IHttpHandler, ... [More]

Tags:

C#

.NET: Literals and expressions in the C# Language

by Stephen Horsfield 17. May 2008 10:28
Overview I was recently asked why some expressions didn't seem to be doing what the developer intended.  Typically, this was due to the use of the short or byte data types.  This post is a brief discussion on the related parts of the C# Language Specification (version 3.0). Reference You can find the C# Language Specification here: Download it here: C# Language Specification 3.0 (MSDN) Note that page references in this post may vary slightly from your view of the document due to printable page size differences on your computer. Introducing literals (pages 40-45 of the specific... [More]

Tags:

Software Development

Better IIS Logging

by Brad 16. May 2008 10:36
I was recently trying to check if IIS's SMTP sever was working correctly. To help I turned on the logging, leaving the default "W3C Extended Log Format" selected. I sent the test email and checked the log - to say it was unhelpful is an understatement! I was wrongly assuming that "extended" format meant it would have more information than the other logging formats which didn't have "extended" in their name! Enter Steve who suggested I change the format to Microsoft IIS Log File Format (shown in the image below). I did, and the log file was suddenly completely what I was expecting and I could ... [More]

Tags:

Misc

BizTalk: &quot;Message has not been initialized in construct statement&quot;

by matt 15. May 2008 12:31
Overview The above message can be quite frustrating if you don't know why you are getting it.  Microsoft's take on this particular error message when you try to compile you BizTalk Server project is pretty much detailed in the article: You may receive a "Message has not been initialized in construct statement" error message when you build a BizTalk Server 2004 solution in Visual Studio One of the times I have come across this problem is when I want to create a message in an orchestration that is not the result of a transform.  At first I was confused by this error, but it does sort... [More]

Tags:

BizTalk Server

ASP.Net: Performance and Scaling Tips from MSDN

by matt 15. May 2008 12:20
I found these two great articles on MSDN about performance and scaling of ASP.Net applications.  They're well worth a read in my opinion. 10 Tips for Writing High-Performance Web Applications Scaling Strategies for ASP.NET Applications

Tags:

.Net Framework | ASP.NET | SQL Server

Powered by BlogEngine.NET 1.5.0.7
Theme by Interakting

Interakting

A full service digital agency offering online strategy, design and usability, systems integration and online marketing services that deliver real business benefits and ensure your online objectives are met.

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar