Firefox class name and space idiosyncrasy
Friday, February 23, 2007 6:20:17 AM (GMT Standard Time, UTC+00:00)
We’re currently reworking www.florame.co.uk to improve it’s search engine ranking from virtually non-existent to (hopefully) first page for various inflections of organic aromatherapy, organic essential oils and all sorts of other aromatherapy products.
Despite the on-going debate on whether search engine crawlers prefer pretty XHTML or not, I still believe strongly that having your site’s content as the dominant code on every page MUST be better than having a plethora of tags (aka tag soup) but that’s for another post. So, with my feelings on XHTML (or at least neat HTML) in mind one of our recommendations was to re-work the site’s code –most importantly with the removal of the JavaScript menu at the top which is seriously impeding the site’s ranking. I decided we should opt for a form of CSS menu and those in the know, know there are only a few available options, for reference we used Suckerfish drop down menu.
The Suckerfish CSS drop down menu has been fairly heavily tested but I think I’ve found an issue with Firefox, basically the JavaScript marks up the LI with a hover class (sfhover) which then ensures it works as expected (this isn’t needed in IE7 or FF btw). The catch I’ve found however is that in FF1.5 (will test in 2.0) with scripts enabled, the menus are staying shown.
After a little head scratching the issue was narrowed down to this line of JavaScript:
this.className = this.className.replace(new RegExp(" sfhover\\b"), ""); Thanks to Firebug I was able to step through the code and check out the properties at every stage, in this instance I found that Firefox trims the leading and trailing space from the className so instead of it reading class="sfhover" as it is written, it had class="sfhover" which may be correct in some ways but obviously cocked up the regEx.
The solution is really rather simple, just change the space so it’s optional:
this.className = this.className.replace(new RegExp("\\s?sfhover\\b"), ""); It’s not an ideal fix but in the case of Florame organic aromatherapy it sorted the issue :) I’m going let Mozilla know about this as in some ways I think this is a glitch (though I can see their thinking that the developer didn’t mean to add the leading space) to see what they say. It wouldn't surprise me though if it was something I had done wrong!
For reference, the entire menu script now reads:
<script
type="text/javascript"><!--//--><
sfHover
= function() {...}
sfHover
= function() {
var sfEls
= document.getElementById
("nav").getElementsByTagName
("LI");
for (var i
=0; i
<sfEls
.length; i
++) {...}
for (var i=
0; i
<sfEls
.length; i
++) {

sfEls
[i
].onmouseover=function() {...}
sfEls[i
].onmouseover=function() {
this.className += " sfhover"; 
}

sfEls
[i
].onmouseout=function() {...}
sfEls[i
].onmouseout=function() {
this.className = this.className.replace(new RegExp("\\s?sfhover\\b"), ""); 
}

}

}
if (window.attachEvent
) window.attachEvent
("onload", sfHover
);
//--><!]]></script>
Update 7th May 2007: Darren over at Forma3 has come up with a new an improved version of the SuckerFish menu which includes a number of nice improvements and is well worth checking out: CSS drop down menus with persistent top level menu styling
Business start up advice downloadable PDF
Friday, February 16, 2007 6:54:35 AM (GMT Standard Time, UTC+00:00)
I’m still somewhat shocked at how well the series on business start up advice was received, I was expecting one or two hits on it but so far I’ve had over 1,000 visits to the article which is pretty shocking as this blog in its entirety was only getting that a year(ish)! I’ve also had some fantastic feedback which is very touching so those of you who have got in touch thanks!
Ok, following the posting of my recent business start up advice mini series I was asked by a number of people to post it as a PDF which I’ve finally managed to do. It’s rather long I’m afraid weighing in at around 26 pages so it should keep you busy giving me time to write the additional articles!
Download the PDF version of the complete business start up advice article here (27 printed pages including a 1 page feedback form - 189KB).
WowWee FlyTech DragonFly -awesome!
Friday, February 16, 2007 6:49:41 AM (GMT Standard Time, UTC+00:00)
I was planning on writing about this new gizmo that a friend of mine from the states Doug Setzer has got his hands on but then he asked me to and I didn’t really feel like it after that ;)

Just kidding, Doug’s bought a WowWee FlyTech DragonFly and I have to say it looks great fun. He’s written a review about the WowWee FlyTech DragonFly at www.mydragonfly.info which is worth checking out. As usual he’s pimped the site out with Google AdSense so before you start clicking on his adverts make sure you have a click on mine!!
Now I’ve got to plan a trip over to the states so I can have a play with his WowWee FlyTech DragonFly...
My first heads up (I think)
Wednesday, February 14, 2007 6:28:29 AM (GMT Standard Time, UTC+00:00)
Awesome, I had my first non-friend/family cross-blog comment the other day (very exciting stuff!) so I decided to check out the referring site and there, in all it's glory was a link to by blog! Seeing as one of the primary aims of this blog was to help others -even if it was just with simple information that other's may consider trivial- I'm over the moon! (Yep, it's the simple things in life that please me!)
So thanks to -=DeathToSpam=- whoever you are that made my day :)
If you don't believe me, check out the "Noteworthy Dev-Blogs" list at http://aspnyc.blogspot.com/ personally I don't feel I'm worthy enough to be listed next to Phil Winstanley and Scott Guthrie but it's certainly an honour!
If you've linked to my blog I'd love to hear from you and see what you're saying.
Importing/Referencing DLLs in Visual Studio
Tuesday, February 13, 2007 8:03:03 PM (GMT Standard Time, UTC+00:00)
A couple of people have got stuck on various lists/forums I’m on moving from ASP to ASP.Net and the differences there are, the one first major sticking point I had was referencing DLLs –so don’t worry you’re not the only one! So this is a really simple look at what you need to look at and how you reference DLLs –if you’ve ever added a DLL before you’ll probably find that this is too simplistic for you but read on anyway!
Firstly, referencing a DLL is basically a way of including someone else’s code within your project (or a common codebase that you re-use), this also includes controls, useful/common functions or just additional functionality such as Crystal reports.
Before you can use someone else’s code (i.e. Phil Whinstanley’s error reporting class) within your code you have to include a reference to the relevant DLL. The first thing I would do is create a folder somewhere that’s easily accessible to all machines that may need to reference the DLL i.e. “c:\Useful DLLs\”. Then, within this folder, I would create the following sub folders:
- c:\Useful DLLs\.Net 1.1
- c:\Useful DLLs\.Net 2.0
- c:\Useful DLLs\.Net 3.0
- c:\Useful DLLs\ASP.Net 1.1
- c:\Useful DLLs\ASP.Net 2.0
- c:\Useful DLLs\ASP.Net 3.0
This is something that I’ve only recently started doing after having multiple releases for the same DLL. For each DLL place a copy within the relevant folder.
Next, load your project within Visual Studio, right click the solution (this is the very top of the tree) and select “Add Reference":
A window will then popup that looks something like this:
Depending on what sort of reference this is, the majority of the time I would expect you’ll be needing to use the “Browse” tab –this allows you to navigate the FSO and find the DLL to reference (which should be somewhere in c:\useful dlls\). Once you’ve found it select the DLL and click Add.
Your DLL is now referenced and you should be able to start using it straight away. Depending on what you need to do with it you’ll also need to add Page and/or Codebehind imports. To check that it has imported correctly, in Visual Studio 2003 you should be able to see it in the references folder or in Visual Studio 2005 you will need to click into the "Class View" tab of the Solution explorer:
How do I identify the namespace?
I had someone ask me a while ago why the his code was throwing a compilation error, it turned out that although he had named the DLL MyDLL, the namespaces within the DLL he wanted to reference was MyNamesapce so how can you identify the namespace?
The easiest way to do this is to use something called the Object Explorer, this should list all the referenced DLLs for a given project and allow you to navigate the namespaces, classes and objects within the class. To open the Object Explorer click on the View menu and then “Object Explorer” within the “Windows” menu. Navigating the DLL is easy, you can either search through it using the search box at the top or alternatively navigate using the object tree.
The best way to work out what declaration you need to add is to locate the object, method or control you plan on using either using the tree navigation or searching, then selecting it. Once selected you will notice the bottom pane of the Object Explorer will change and the namespace will be listed, this is what you need to add as your reference. If you need to enter the assembly name, you can identify this easily as it’s the name given to the top node of the tree –this should have a little grey icon next to it.
If the DLL is adding a control to the page
You’ll need to reference the namespace at the top of the page like this:
<%@ Register TagPrefix="TSD" Namespace="TheSiteDoctor.WebControls" Assembly="TheSiteDoctor" %> You can use whatever prefix you like for the control, I tend to keep it between 2 and 4 characters in length for ease i.e. “TSD” but that’s up-to-you. Adding the control is done in the same way you add the standard controls:
<TSD:SuggestionTypeRadioButtonList runat="server" ID="radCategories" CssClass="inputRadio" ValidationGroup="suggestion" /> You’re all set :)
If however this is a control set that you plan on re-using throughout the application I would opt to add a reference within the web.config, this means you don’t need to repeatidly add the reference for each page. To do this you’ll need to add the following to your web.config file:
<system.web>
<pages validateRequest="false">
<controls>
<add tagPrefix="TSD" namespace="TheSiteDoctor.WebControls" assembly="TheSiteDoctor" />
</controls>
</pages>
</system.web> If the DLL is adding functionality to the codebehind or you want to use the control within the codebehind
If you want to use the control or add the control to the page dynamically you will need to include a reference to the namespace within the codebehind –in the same way you do the System namespaces. This is really simple, at the top of the page you should see a few “using” statements or in VB “Imports”, you’ll just need to add the referenced DLLs namespace below (or above –or- in the middle!) of these others, as long as it’s with the other statements you’ll be fine. You can then reference the various methods and properties of the control.
using TheSiteDoctor.WebControls;

public partial
class SuggestionsPage : System.Web.UI.
Page
{...} 
{
protected void btnAddEntry_Click(
object sender,
EventArgs e)
{...} 
}
I hope that helps you getting started with this new way of importing common code, it’s fairly intuitive once you’ve done it once or twice, but those first few “Could not find xyz –Are you missing an Assembly or Reference” messages do drive you nuts ;)
Automatically delete old IIS log files
Saturday, February 10, 2007 4:23:10 PM (GMT Standard Time, UTC+00:00)
This is a really useful little VBS script that I’ve been meaning to post for a while now (along with a couple of other little applications I’ve written for log file analysis). I don’t think I wrote this script but at the same time can’t recall where it came from.
It basically traverses the FSO finding files with the designated extension and assuming the match the standard IIS date format, checks whether they’re older than x days, if they are deletes them. Running it is simple, place somewhere obvious on the server and just double click it. Alternatively if you want to read the output, run it from CMD. For safety’s sake, the first time you run it I would leave it just printing out the files that will be deleted.
Personally I don’t schedule this script as although automation is great, I’ll probably have it delete the logs before I’ve had a chance to download them so what I tend to do is download the logs and then after that (or the next time I’m on RDC) I run it, I find that way I ensure I get all the log files i.e. if I go on holiday.
I’ve got two other applications that I’ll post shortly, one outputs the location of the log files for each domain name within IIS and the other combines the log files into one for analysis –it also takes the exported file/folder locations and names the combined log files with the domain’s name –saves a ton of time!
Download the VBS script as a ZIP file
Option Explicit
Dim intDaysOld
, strObjTopFolderPath
, strLogFIleSuffix
, ObjFS
, ObjTopFolder
Dim ObjDomainFolder
, ObjW3SvcFolder
, ObjSubFolder
, ObjLogFile
, ObjFile


intDaysOld
= 5 'Number of days to retain on the server
strObjTopFolderPath
= "" 'The location of your log files
strLogFIleSuffix
= ".log" 'The suffix of your log files
Set ObjFS
= CreateObject("Scripting.FileSystemObject")
Set ObjTopFolder
= ObjFS
.GetFolder(strObjTopFolderPath
)
For Each ObjDomainFolder in ObjTopFolder
.SubFolders

WScript
.Echo("Folder: " & ObjDomainFolder
.name
)
For Each ObjW3SvcFolder in ObjDomainFolder
.SubFolders

WScript
.Echo(" Folder: " & ObjW3SvcFolder
.name
)
Set ObjSubFolder
= ObjFS
.GetFolder(ObjW3SvcFolder
)
For each ObjLogFile in ObjSubFolder
.files
Set ObjFile
= ObjFS
.GetFile(ObjLogFile
)
If datediff
("d",ObjFile
.DateLastModified,Date()) > intDaysOld and lcase
(right
(ObjLogFile
,4))=strLogFIleSuffix then
'*****************************************************
'DON'T UNCOMMENT THIS UNTIL YOU KNOW IT WORKS PROPERLY!!!
WScript
.Echo(" Will delete " & ObjSubFolder
.name &
"\" & ObjFile
.name
)
'WScript.Echo(" Deleted " & ObjSubFolder.name & "\" & ObjFile.name)
'ObjFile.Delete
'*****************************************************
End If
Set ObjFile
= nothing
Next
Set ObjSubFolder
= nothing
Next
Next
Set ObjTopFolder
= nothing
Set ObjFS
= nothing
Some great software I use
Friday, February 09, 2007 4:44:44 PM (GMT Standard Time, UTC+00:00)
I was recently on the search for a new firewall after having so many people complain about it (and having a few issues myself). I asked a forum that was very happy to criticise ZoneAlarms what they recommended to use as people were quick to flame and not explain.
Sadly, despite making very clear I wasn't interested in flaming, the majority of the responses I got back were still flames about ZoneAlarms but there were a couple of nice people who responded with useful suggestions. I thought as there seems to be very little advice about suitable firewall replacements to ZoneAlarms I would post what I've got installed as well as a couple of other useful programs in the process.
Firstly let me explain why I feel the comment "If you've got a hardware firewall you don't need a software firewall" is a ridiculous statement. My reasoning dates back to Greek times -notably the Trojan war when seeking entrance to Troy, Odysseus had a large wooden horse (the sacred animal of Poseidon) made as a gift. As I'm sure everyone is aware, the horse was hollow and filled with a load of soldiers which popped out after the Trojans were done celebrating the end of the siege and let the rest of the army in through the front gates to slaughter all the drunk Trojans. Anyway, back to my point, yes you may have a hardware firewall that will stop nasty attackers getting in but what happens if you unwittingly invite one in? The likelihood is it'll invite a load more in after it which will end up crippling your computer. So for that reason I have a software firewall to monitor the traffic in and out on my machine.
The software
The first thing to note here is that all this software (at time of posting) is free -what can I say? I'm a cheapskate ;) The links are to the file download page so please let me know if they've broken since posting.
The Behemoth has arrived
Thursday, February 08, 2007 6:14:19 PM (GMT Standard Time, UTC+00:00)
Quite why I’m posting about my new mug I don’t know but hey why not –it’s all good for a laugh!
Basically Stacey got me a new mug for Christmas and it’s put my last ones (largest “old” mug was ½ liter) to shame so much that I just had to write about it! This mug is awesome, I can make a cup of tea in the morning before I go into the office and it’ll keep me going until at least mid-morning.
The stats
- Height
- 14cm
- Diameter
- 12.5cm
- Circumference
- 39cm
- Capacity
- 1.2 Liters
- Teabags per brew
- 2
- Time to drink
- 15mins+
As usual, this post is more just about fun than anything else ;)
WebDD -I was there, were you?
Tuesday, February 06, 2007 12:00:26 PM (GMT Standard Time, UTC+00:00)
What an awesome event, I was originally in two minds about going to the latest conference installment from Phil Winstanley, Dave Sussman (and all the other dedicated people involved with the other DDD events) but boy am I glad I went.
This time I decided to take it to the next level and rather than driving down and back on the day I’d drive down the night before with Stacey and stay over in a local hotel. This worked really well, not only did it mean I was awake for all of the seminars but I could get some work down the next day too ;)
Anyhow, back to the day, for once I had the foresight to choose the seminars I was going to attend before I arrived and decided not to attend all of Scott Guthrie’s talks mainly because of the following I knew he’d have but also because of the great alternatives available so here’s my breakdown of who I went to see and what I thought of their talk:
Microformats - HTML to API (Glenn Jones)
Read Glenn Jones' blog post about the day
GlenN Jones (not Glen Jones as was listed in the schedule ;)) presented a very interesting talk on microformats, it’s not quite what I first thought it was (for some reason I thought it was some form of HTML applets but lets not go there!). Microformats are certainly something I’m going to look into in the future but as Julian Voelcker has pointed out quite how practical they are to use in a CMS situation I’m not sure.
I think from an SEO point of view and also from an information sharing POV they’re very interesting and I’ll certainly be integrating them into various sites for testing purposes sooner rather than later (in fact if you check out my about me page they’ll be there with the new update coming soon … now I just need to re-work my tag output* using IISMods' URLRewrite).
*Glenn pointed out that when using the rel=”tag” attribute the last “word” in the associated URL should be the tag itself -something I didn’t know but will be sorted as atm it’s along the lines of “CategoryView,category,Business,Business%20Start-up%20Advice.aspx” etc which isn’t very useful.
I think in principle microformats are a good idea for something like a blog or a semi-static site where the developer (or someone with knowledge of microformats) has control over the content but how you could role them out in a client managed site is a little more complicated and something that will need some more thought -do you offer buttons to insert the code markup for them? Can you offer nested content easily etc.
The other thing about them I’m not too sure about is (miss)use of the abbr tag -again that was only something I picked up in the talk so may have missed the point, I’ll need to look into it further.
Either way it was an interesting insight into a new concept that I’m going to support if I can :). Check out the main microformats site at: www.microformats.org
Glenn Jones is also the developer behind the back network site that was used to link all the delegates together, it’s an interesting concept that once again promotes a social network on the internet which is all the rage at the moment but also allows you to interact with other delegates before the event -this is something I’d have done had I had more time before the event!
Download the slides to the Microformats - HTML to API talk by Glenn Jones
Web Accessibility: What, Why, How, and Who Cares? (Bruce Lawson)
Read Bruce Lawson's blog post about the day
Making web sites accessible is something I’ve been interested in pretty much since I got involved with ASP.Net 1.1 and I get endlessly tired of hearing fellow ASP.Net developers complain that you can’t make web sites accessible using the ASP.Net platform -balls can’t you, ok it’s not something that comes out of the box and at times is a little awkward but a lot of it is just common sense and consideration.
Bruce Lawson’s talk was a breath of fresh air, it was great to see someone having the courage that I’m yet to muster (well, more the time but hey) to convince my fellow developers to make their sites accessible.
Why the hell shouldn’t your site be accessible to all? It’s not all about money, in my mind it’s just about being fair to others -following (as ever) Google’s moto of don’t be evil. I liked Bruce’s method of presentation as it was far more personal than the usual “you should care because it’s the law” or “you should care because you’re missing out on a ton of money”, when asking the question “who cares?” -using his words not mine- he said “rather than quoting facts and figures at you trying to convince you, -my mate Theresa does”. I think this in itself was a different method of engaging the audience and I certainly felt it worked.
The talk wasn’t particularly in depth (which baring in mind the audience I expected) but I felt it was enough to plant the seed of interest with those that weren’t otherwise that aware or interested about accessibility. I hope that they’ll now actively encourage fellow developers to take action -not necessarily by redeveloping their past sites as many clients can’t afford this, but by giving some consideration to accessibility in future designs -i.e. DON’T use buttons for menu systems!
I can’t hand on heart say all our sites are overly accessible but I’m learning and I feel each new site we’re involved in is that little bit more accessible. Bruce did share a very useful site called “Blind Webbers” where you can get in contact with screen reader users -I’ll certainly be checking that out with the new design for The Site Doctor, for others interested Bruce sent me the link: http://www.webaim.org/discussion/mail_message.php?id=9019. I’m thinking I’ll see what they think of Miss Mays adult store -could be a good introduction!!
The point that made me laugh the most was his demonstration of using “Click Here” as link text, his demo was simple but effective -you can check it out on his site: http://www.brucelawson.co.uk/index.php/2007/webdd-conference-slides-and-questions
One thing I do need to think about is the order of elements on the page, i.e. at present this blog layout has the menu appearing before the content -mainly because that was the quickest way I could get the layout sorted, but I think I need to re-order it so the menu comes last -that said I do have a “Skip to content” link at the top -how effective it is I’ll let you know. Another thing I also want to pass by Bruce is image replacement techniques as I’ve tried a few now and I’d be interested to see how they perform on screen readers and the like.
Download the slides for the Web Accessibility: What, Why, How, and Who Cares? talk by Bruce Lawson
Quick and dirty Usability tests - one week, no budget, and no usability facility (Zhivko Dimitrov)
Read Zhivko Dimitrov's blog post about the day
Again, interested in making my sites as user friendly as possible I thought that this would be an interesting talk but it wasn’t quite as it was portrayed -instead he went into how they perform remote usability tests with a budget. None the less it was a fairly interesting talk.
Zhivko is from Telerik and clearly has a fair amount of experience in usability testing, I was hoping he’d have some good ideas on how to offer usability testing on no budget but sadly he didn’t. There were a couple of interesting points raised however that I don’t think I would have thought of -firstly the re-use of testers, if you use a tester more than twice within a year they’ll start to know what you want them to say rather than what’s there. The other point raised was if you’re using remote testing, you loose the non-vocal indicators of frustration such as a furrowed brow or someone scratching their head.
Zhivko’s opening demo however was a recording of a guy trying to find a grid component on their competitors site, despite the fact they spent a fair amount of time laughing at the guy in the background I thought this was a great example of a poorly designed site and how important it is to highlight your site’s calls-to-action which is something that I’ll have to remember while optimizing our newest SEO client for online poker The Rivercard -one of the issues we have already highlighted is that many of their download links are below the fold of the screen which reduces the chance the user will click the link.
Download the slides from the Quick and dirty Usability tests - one week, no budget, and no usability facility talk by Zhivko Dimitrov
Connecting Design to Real Business Value (Brandon Schauer)
Visit Brandon Schauer's blog
As with Zhivko’s talk, this was another talk that wasn’t quite as it was portrayed by the title, but I was pleasantly surprised by the content. Brandon Schauer’s talk was more about business modeling and how analyzing the current business method can be improved with a little thinking (and design) -ok that’s obvious ;) but his methods were nice.
I found the talk incredibly interesting -especially following my mini-series on business start-up advice, I thought this was a really well timed and interesting talk. Some of the ideas he offered were simple and to the point so you can apply them to any business, the issue I have with it though is whether I can apply it to any of my clients -I’d love to take the time to go through Miss Mays adult store and help them improve some of their business processes but they don’t have the money to invest and sadly neither do I.
I do however think that I can apply some of the concepts he was talking about to an example business which in turn could then be a starting point to discuss business improvement with clients. This however will take a little time and I think Stacey will need to be involved as this is what she’s primarily trained in. Although I love developing and I don’t think I’ll ever get away from it (certainly not in the foreseeable future anyways) I am getting more and more interested in business analysis, it’s not something that I’ve really got any experience in yet (having only been in business for a few years) but perhaps one day it’s an alternative career path I can choose…
Either way, Brandon’s talk was well worth seeing and if he’s ever at a future conference I attend I’ll certainly make the effort to see him talk.
Download the slids from the Connecting Design to Real Business Value talk by Brandon Schauer
Visit Scott Guthrie's blog
For the final talk I decided to watch Scott Guthrie’s talk about WPF/E and boy what a talk it was! I almost didn’t get in as we were hearded in like cows (which was most amusing I have to be honest), the woman stopped me right on the entrance -I think much to Julian Voelcker’s delight as he’d managed to get a seat. Luckily though the women on the doors (yes women -not burly bouncers!) took pity on us poor, desperate geeks in admiration of some Yank they didn’t know and let us line the sides of the auditorium -which meant I ended up getting a front row (floor) seat.
The talk was one of those “look at what’s coming” type talks but with a twist, it was something that I can see being of real use -and more than that gave you the urge to try it out.