Moving on from Connells

I have resigned from my position as Leading Web Developer for Connells Estate Agents today for a variety of reasons. More importantly the future is now full of opportunities. I’m keeping on open mind on any permanent or contract job offers that come my way but I’m not going to be idle whilst waiting for work.

I have several website ideas that I hope to develop to fruition in the near future. Along with Paul Betteridge who was previously Head of Online Operations for Connells and prior to that Managing Director of Nethouseprices, we’re planning on starting our own agency ‘Equipotent’. We’ve got a lot of knowledge on building/running websites in the property sector and hoping to expand that to other areas.

More details soon.

Posted in Uncategorized | Leave a comment

Writing dynamic iframe content with JavaScript

I recently had the need to put a preview of some HTML in a page for a content management system. Simply inserting the HTML into the page wasn’t any good because it would then use the pages styling and so look nothing like how it would appear once live.

I could have set about making some large changes to the CSS so that the current styling only applied to content in one division, and in the preview area a totally different set of styles applied but that would have been time consuming.

The solution I came up with was to use an iframe tag which essentially is a brand new web browser window – and put the new content into ther

The first attempt was unsuccessful (code simplified):

<iframe src="javascript:void(0);">
<html>
<head><title></title><link href='/css/style.css' rel='stylesheet' type='text/css' /></head>
<body>preview content goes here</body>
</html>
</iframe>

Unfortunately that didn’t work out. As an iframe is the container for another html document you are meant to provide a location for that document via the src attribute. Content between the iframe tags is ignored if the browser supports the tag or displayed if the browser doesn’t recognise the iframe tag. The example above gives a ‘page not found’ message in a modern browser.

The way that did work in the end was using JavaScript, and it was suprisingly simple (no external libraries required).

write iframe tag (this time empty)
write a hidden form field containing the content – be sure to escape quotes " -> &#34;
run JavaScript immediately after form field is written, picking up its contents and writing these into the iframe

<input type='hidden' id='hidden1' value=\"<html><head><title></title><link href='/css/fckeditor.css' rel='stylesheet' type='text/css' /></head><body> content </body></html>
 
<script type='text/javascript'>mydoc = document.getElementById('content1').contentWindow.document; mydoc.write(document.getElementById('hidden1').value); mydoc.close();</script>

This works really well and solved my problems.

Posted in JavaScript | Leave a comment

ASP.NET TextBox MultiLine and MaxLength

ASP.NET was released in January 2002 so it is over 9 years old.

It is annoying to see that there are still some very simple issues like the one I’ve just come across. When you give a TextBox server control a property of TextMode=”MultiLine” it renders an HTML textarea tag. The compiler lets you add another property MaxLength which is supposed to limit the number of characters allowed.
If the TextMode is set to something other than MultiLine then this works fine, but when set to MultiLine it does absolutely nothing.

Of course, there is a workaround and that is to add a RegularExpressionValidator using a pattern like ^[\s\S]{0,50}$ however it would be nice if Visual Studio told you that the property did nothing at the time. There is a note on the help documentation but one only tends to reads that after the event.

Would something like this be allowed to exist for 9 years if this was open source? I think not.

Posted in ASP.NET | Leave a comment

Probate website

Probate is the process of establishing the validity of a will, authorising the executors to deal with the estate and distributing the assets to the beneficiaries.

I’ve developed a website for a business to help them promote a new service that they are trying to build, UK Probate at http://www.ukprobate.com. The USP is that they will charge a fixed price based on a percentage of the estate where many Solicitors will change by the hour (and I think it can be around £200 per hour) so if anything unusual crops up the costs can escalate. Currently they get away with it because clients are mourning and not worrying about money or so excited about receiving an inheritance that the costs seem fairly minor.

SEO is going to be an ongoing effort – interesting to see how we can get the site to rise in the rankings.

Posted in Uncategorized | Leave a comment

Is it a good idea to use a swap file on a cloud server?

ElasticHosts recommend: ‘You should configure your operating system without swap, using additional memory if necessary. This will significantly improve performance, since drives are provided over network RAID.’

I haven’t been brave enough to try this yet – but a brief bit of research showed that the following commands could be used.

#force the kernel not to use swap (default = 60)
sysctl vm.swappiness=0
#or  disable the swap file
swapoff -v /swapfile
# to confirm … show memory and swap usage
free -m

Posted in Linux | Leave a comment