Showing posts with label work. Show all posts
Showing posts with label work. Show all posts

Friday, 5 June 2009

Installing EPiServer and VMWare ESXi

Wednesday this week our group IT manager Gordon brought us some new hardware to play with in the form of 3 HP DL308's (two G4's and one G3) which I think and hope we're going to consolidate our jumble sale of a server room onto for the most part with the use of VMWare's wonderful ESXi (version 3.5 because version 4 requires 64bit hardware and the VMWare compatibility list says the G3 and G4 are only compatible with 3.5).

I caught Matt just in time as he was about to install Windows 2003 on one of the G4's and got him to let me install ESXi on it. Which I did without hitch (except for when I couldn't get the networking to work, then I realised the Ethernet cable wasn't plugged in). Then it was a cinch to download the Infrastructure Client from the box and spin up a new VM and get Windows 2003 installed. Within an hour I'd got a new virtual development server up and running. Happy man.

Next up I downloaded and installed SQL Server 2005 Express, which didn't go quite to plan as the installer kept complaining that the SQL Native client installer package was missing. This was fixed by going into add/remove programs and uninstalling the (failed) Native Client install and starting the whole thing again.

Then came installing EPiServer CMS which was a completely painless task comprised of logging into EPiServer World and downloading the latest stable release (CMS 5 R2) and installing it, I then used the Deployment Centre utility to install the demo site for the team here to have a play with.

Job done!

Over the coming weeks I'm going to be posting a bunch more articles about my trials and tribulations with EPiServer which I'm looking forward to and hope will provide a nice chage from building brochure ware sites for purfume brands.

Wednesday, 22 April 2009

People I know and Like(?)

Quite a lot has happened in and around my little blogosphere in the last few months.

Back in February I mentioned the development blog of my friend, ex-colleague and ex-house-mate, James (Jay) Field's work for his Interactive Media MA project "Frontier".
Frontier is a massively multiplayer online game that Jay is building in Flash. The blog has gone a bit quite at the moment since he was made senior lecturer at the Hull School of Art and Design.


iheartspaceships
Nearly a year and a half ago, Ryan and Andy bought a domain name and said they were going to produce a blog. Yesterday they launched "a day early".

Ryan is a Flash Developer here at twentysix Leeds and works across many large brands on both web and AIR based Flashieness.

Andy is our UI Developer working on many of the same clients and projects but does miraculous things with JavaScript and CSS.

Hopefully they'll have some interesting thoughts soon over at iheartspaceships.com


niid.to
About a month ago James and Tom C left twentysix Leeds to persue a life of love and freedom as freelance developer and designer respectively. Amongst various freelance work that they won't tell us about they also founded niid.to, a social to do list and they have an accompanying blog over at http://niidto.blogspot.com/

26point1
Our Technical Director, Matt, used to run two blogs for the different types of nonsense he likes to spout off about. "matts 2 minute reviews" and "matts random days". Not that long ago, he merged them into one central repository of nonsense over at 26point1. Hop on over there to read about all kinds of rubbish, both technology-based and not...

Tuesday, 30 September 2008

Working from home

So this Sunday I ran in the Horsforth 10Km race and finished in 46mins, not my personal best but it was a hilly course so it was always going to be difficult achieving that, and to boot I had pulled my left knee a little bit in training the Tuesday before.

This little pull has turned into a full blown injury which sees me working from home today and tomorrow and with a physio appointment 1st thing on Thursday.

Working from home has for a long time been a nightmare of mine. Simply because I do not (or did not) possess enough self dicipline to put in a full and productive days work. Until now!

I used to work part time at a University and then, in my "spare" time work on a few freelance bits and pieces, which seemed like a chore and I would always have to work late into the night to get to a point where I had achieved enough *work* for the day.

But I'm setting the record straight today. I was up at 7am with Smithy (mainely because I had a doctors appointment to get to) and then when I got back I was straight to the laptop and into the working. Had 40 mins for lunch and then more working. It feels good, this home working lark...

Luck I've got another day of it tomorrow then!...

Saturday, 2 August 2008

Saturday Morning: Website Security Time...

Recently a couple of our sites have been subject to SQL Injection Attacks but non have suffered so hard as the one I'm currently securing.

I spent all day yesterday on it and I've been up since 9AM when the head IT guy from our client called (and woke) me.

So after I get this thing done, and then enjoy what is left of my weekend I plan on writing up my learnings and educating my co-workers. Keep an eye out for a blog post or two.

Thursday, 26 June 2008

How to move the viewstate to the bottom of your page source (C# ASP.NET 2.0, 3.0, 2.5, Visual Studio 2005, Visual Studio 2008)

Last week one of our new SEO bod, Ryan, asked Sel to move the viewstate to the bottom of the page source for the rest assured site. This helps to improve your SEOness as a lot of search engines only take so much of your source into account when spidering. So you really don't want to be feeding them 32k of base64 encoded gibberish when you could be giving them some beautifully crafted copy!

Andy did a couple of Google's and found some code which did the trick perfectly.
protected override void Render(System.Web.UI.HtmlTextWriter writer) {
System.IO.StringWriter stringWriter = new System.IO.StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);

base.Render(htmlWriter);
string html = stringWriter.ToString();

int StartPoint = html.IndexOf("<input type="hidden" name="__VIEWSTATE");

if (StartPoint >= 0) {
int EndPoint = html.IndexOf("/>", StartPoint) + 2;
string viewstateInput = html.Substring(StartPoint, EndPoint - StartPoint);
html = html.Remove(StartPoint, EndPoint - StartPoint);
int FormEndStart = html.IndexOf("</form>") - 1;
if (FormEndStart >= 0) {
html = html.Insert(FormEndStart, viewstateInput);
}
}
writer.Write(html);
}


This was ace and so today when I was asked to upload some ammends to a couple more of our clients sites I thought I would implement this for the same reasons as it only takes two seconds.

While it worked a treat on one of the sites, the other was not so good. Here's what the page should look like:

And here's what I got:


What has happened is this. The un-styled UL that you can see at the top of the page is the top half of the left hand navigation you can see in the 1st picture. This menu was implemented as a .NET user control and as such is treated like a page all of its own. The reason this happened is because the page was rendering out via our overridden method, but the control was not. So the HTML that the control generated was getting written to the output stream before the HTML of the Page ("Page" in the .NET Class sense, not the "web page" sense).

So this got me thinking, wouldn't it be nice to be able to have a single piece of code that could be applied to a site once, regardless of UserControls, MasterPages or any other intricacy, that would take care of moving the ViewState on every page of the site!?!

The answer: Yes!
The solution: an HttpModule...

An HttpModule is a piece of code that sits between your web application and IIS on the web server. What this module is going to do is intercept every response our application makes to a client and then, if the response is a HTML (read ASPX) page, look for and move the ViewState.

To do this we will filter the response stream using the Response.Filter property. I'll leave the full code until the end of the post but here are the main bits.

1) Create a new class that implements IHttpModule.
public sealed class IHttpViewstateMover : IHttpModule {

2) Add an event handler to the current request. This even then decides weather to add our filter to the response stream based on if it is outputting HTML.

public void Init (HttpApplication context) {
context.ReleaseRequestState += new EventHandler(context_ReleaseRequestState);
}

void context_ReleaseRequestState (object sender, EventArgs e) {
HttpResponse response = HttpContext.Current.Response;

if ( response.ContentType == "text/html" ) {
response.Filter = new ViewstateMover(response.Filter);
}
}

3) If the entire HTML file has been output ...

Regex eof = new Regex("</html>", RegexOptions.IgnoreCase);

if ( !eof.IsMatch(strBuffer) ) {
// code to follow...

re-position the viewstate and output the altered HTML to the stream.

    string finalHtml = _output_buffer.ToString();

int StartPoint = finalHtml.IndexOf("<input type="hidden" name="__VIEWSTATE");
if ( StartPoint >= 0 ) {
int EndPoint = finalHtml.IndexOf("/>", StartPoint) + 2;
string viewstateInput = finalHtml.Substring(StartPoint, EndPoint - StartPoint);
finalHtml = finalHtml.Remove(StartPoint, EndPoint - StartPoint);
int FormEndStart = finalHtml.IndexOf("</form>") - 1;
if ( FormEndStart >= 0 ) {
finalHtml = finalHtml.Insert(FormEndStart, viewstateInput);
}
}


byte[] data = UTF8Encoding.UTF8.GetBytes(finalHtml);

_output_stream.Write(data, 0, data.Length);
Simple as!

Now all you need to do us take the full code listing (below) and paste it into a C# file. Then add the following to your web.config inside the element:





So here's the code.
// Source code for IHttpViewstateMover.cs
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;

/// <summary>
/// IHttpViewstateMover is a HttpModule that moves the viewstate
/// to the bottom of the HTML source to help with SEO
/// </summary>
public sealed class IHttpViewstateMover : IHttpModule {
// the class is sealed so it cannot be inherited

public void Dispose () {
// nothing to dispose
}

public void Init (HttpApplication context) {
context.ReleaseRequestState += new EventHandler(context_ReleaseRequestState);
}

void context_ReleaseRequestState (object sender, EventArgs e) {
HttpResponse response = HttpContext.Current.Response;

// Uncomment the following line if you only want to recieve a single call to ViewstateMover.Write
// context.Response.Buffer = true;

if ( response.ContentType == "text/html" ) {
response.Filter = new ViewstateMover(response.Filter);
}
}


/// <summary>
/// ViewstateMover is the workhorse of the IHttpViewstateMover
/// </summary>
private class ViewstateMover : Stream {
// this class is private as it serves no real purpose outside this implementation

private Stream _output_stream;
private long _position;
private StringBuilder _output_buffer;

/// <summary>
/// Creates a new instance of the ViewstateMover class
/// </summary>
/// <param name="input_stream">The HttpResponse.Filter to work with</param>
public ViewstateMover (Stream input_stream) {
_output_stream = input_stream;
_output_buffer = new StringBuilder();
}

#region Stream Members

public override bool CanRead {
get { return true; }
}

public override bool CanSeek {
get { return true; }
}

public override bool CanWrite {
get { return true; }
}

public override void Close () {
_output_stream.Close();
}

public override void Flush () {
_output_stream.Flush();
}

public override long Length {
get { return 0; }
}

public override long Position {
get { return _position; }
set { _position = value; }
}

public override long Seek (long offset, SeekOrigin origin) {
return _output_stream.Seek(offset, origin);
}

public override void SetLength (long length) {
_output_stream.SetLength(length);
}

public override int Read (byte[] buffer, int offset, int count) {
return _output_stream.Read(buffer, offset, count);
}
#endregion

public override void Write (byte[] buffer, int offset, int count) {
string strBuffer = UTF8Encoding.UTF8.GetString(buffer, offset, count);

// check for the closing HTML tag
Regex eof = new Regex("</html>", RegexOptions.IgnoreCase);

if ( !eof.IsMatch(strBuffer) ) {
_output_buffer.Append(strBuffer);
} else {
_output_buffer.Append(strBuffer);
string finalHtml = _output_buffer.ToString();

// original code from http://www.hanselman.com/blog/MovingViewStateToTheBottomOfThePage.aspx
int StartPoint = finalHtml.IndexOf("<input type="hidden" name="__VIEWSTATE");
if ( StartPoint >= 0 ) {
int EndPoint = finalHtml.IndexOf("/>", StartPoint) + 2;
string viewstateInput = finalHtml.Substring(StartPoint, EndPoint - StartPoint);
finalHtml = finalHtml.Remove(StartPoint, EndPoint - StartPoint);
int FormEndStart = finalHtml.IndexOf("</form>") - 1;
if ( FormEndStart >= 0 ) {
finalHtml = finalHtml.Insert(FormEndStart, viewstateInput);
}
}


byte[] data = UTF8Encoding.UTF8.GetBytes(finalHtml);
// write the page countents out to the user
_output_stream.Write(data, 0, data.Length);
}
}
}
}

As ever, the code is provided as is, with no kind of waranty so please test thoroughly before you place in a production environment. You use this code at your own risk.

Saturday, 14 June 2008

On Aire

I started thinking about On Aire ages ago as a project that would enable me and my work mates to do things we don't get chance to look at and explore in our 9-to-5 but to date all that has come from it is a blog post and a domain registration...

Now that summer has (almost) got a hold of the UK I find that Gina and myself are asking more and more where we could go out for food or a relaxed drink in comfortable yet stylish (poncy twat?) sorroundings.

And so this has started me thinking again about the idea behind On Aire, to provide a personalized guide to *evening entertainments* (tm) in the area of the river Aire (which is about 90% of Leeds depending on how liberal you are).

So hopefully my ever expanding network of half started projetcs will be growing once again with the addition of a social network stylée food/drink bar/resturante recomendation thing.

I'm going to try and get Brain and the Flash guys on board with a nice AIR app (half of the projects name sake, trying to be all web 2.ohhhhhhhhhhhhhhhhhhh or something) that will make suggestions where you might eat or drink that day or evening.

In theory this could be expanded to any and all kind of events and other fandangled features but I think I want to get some feature, no matter how small, online soon so that it might start getting used and so spur me and the (possible) team on to expan the thing.

So hopefully I and some of the other guys at work will start posting over on the On Aire blog and might even get something on the site. I've got some ideas for the design of the site and features of the app so I'm gonna try and pitch them to the lads and see if I can get something rolling.

Watch this (or that) space for more...

Tuesday, 1 April 2008

Recruitment consultants are a special breed of idiot

Following up on Matt's article about recruitment consultants I want to rant about them myself!

Ten minutes ago I recieved an email from someone at Senitor offering me an excelent Desktop Support candidate.

Now, having nothing to do with desktop support as all our IT is provided by our parent group I wrote said recruitment consultant a polite but concise email stating that I am a web developer, I am only concirned with web development and that I wish to be removed from any mailing lists for IT Support staff, but that it was fine for them to keep emailing me about Flash or Web Development candidates they might have.

So two mins later I recieve my read-receipt and all is well. THEN, five minutes after that I get a phone call from some other chap at senitor saying he's just recieved word from this other chap (who I just emailed) saying that I'm looking for a freelancer and can he be of any help.

So I spent five minutes explaining what I had previously wrote in my email and then informed him that we are acutally looking for a Permanent Senior Flash Developer and that he could rind Matt about that.

He mumbled that one of collegues deals with permanent developers and said he would get him to ring through. The conversation ended.

Wonder if I'll get any more IT support emails from them, or maybe a freelance chef or a mechanic?

Good work recruitment consultants!

Wednesday, 26 March 2008

Adobe AIR comes to the UK

On April the 9th me and Brian (I wish he would start to update his twitter again) will be attending the Adobe AIR tour in London.

I'm going to try and think up a little AIR app to celebrate this but I'm going to wait untill the top secret project has finished before I get stuck into that.

I'm also going to try and get Brian to help me out with the ideas and production.

Tuesday, 25 March 2008

How many developers does it take to figure out some stats


Matt, Andy and Rich stress over some numbers

Help wanted

Apply within,

As you may or may not have read, recently I have been revisiting places long forgotten in im persona and filling some boots as a hardcore Flash developer. During this time it has become apparent that we need a Senior Flash Developer!

So it gives me great pleasure to announce that the company I work for, twentysix Leeds are recruiting a new Senior Flash Developer.

The role requires years and years of expert experiance of Adobe Flash, ActionScript 2 and ActionScript 3. Knowlage of Object Oriented techniques and all the other usual stuff is a must! Knowlage of other web technologies are a bonus so don't forget to tell us about them when you email Matt with your application (matt.pallatt@twentysixleeds.com ).

If you think you might be interested then why not head over to our portfolio and see what kind of work we do for fantastic clients such as HUGO BOSS Fragrances, Lacoste and Silent Night Beds amongst others.

Friday, 29 February 2008

The western front...

All is quiete around here and has been for a while.

This is mainly due to me having to learn ActionScript (again) to pull a project out of the gutter so I will be spending most of the weekend (and any other *spare* time I might have) living and breathing AS2 classes and wishing I was a lot better versed in the drawing API and the old EventDispatcher. Although I'm not doing bad having not done any serious ActionScript in the last 18 is months.

The project is top secret so I can't say much more but maybe I'll have some lovely little learnings to write about if and when I get the time.

Friday, 15 February 2008

More...

More mindless drivel and ramblings now available free over at twentysix Opinions.

Wednesday, 9 January 2008

back to work

I'm back in work today after a long weekend (Friday to Tuesday) in the lakes with Gina and I'm feeling a little bit uninspired.

We had a team meating before lunch where a few of the guys recounted some notes on industry events they have attended recently and it made me realise that not so long ago I was interested and messed around with far mor than I do at the moment. Right now I just seem to be building .NET shopping cart after .NET shopping cart and I'm a bit bored with it so I've decided to start getting back into things, exploring bits and pieces around the web and making bits and pieces that are fun.

I think I'm going to start by (re-)designing this blog with a nice stylesheet and naybe a JPEG or two.

Lets see how it goes from there...