MIX2010 Videos

Meant to post this a couple of weeks ago- just incase you havn’t already seen them the videos from various sessions at Mix2010 ; live.visitmix.com/Videos

No Comments

HTML5 & the Processing.js JavaScript library

Just reading up on html5 and the processing.js javascript library which takes advantage of the new canvas element to do some pretty cool stuff (check out their ‘exhibition’ section) – came across this site which has loads of useful stuff on it.. code.bocoup.com

No Comments

ASP.net aspx pages posting back to the wrong URL when using Server Rewrite

Had a problem today working on a new phase of one of our existing sites (a problem which I’m sure I came up against on another site and fixed a few years ago…) – we just added server rewrite with a whole new URL structure like so;

www.site.com/ group name/ series name/ book.htm

This allows the user to chop off a folder and get back to the relevant listing page- pretty standard stuff now days.  So this introduces a bunch of virtual folders.  All the sites resources were set to use absolute paths and everything was loading in and rendering fine, but the page crashed every time I click the “Add to cart” button– bit of a show stopper.

This was because dot net isn’t aware of the rewrite- so while they hit the site on a url like;

childrens-books/beast-quest/book1.htm

asp.net thought the page was at

book-details.aspx?id=9780123456789&catId=1&seriesId=2

so did a post back to that page, relative to the current folder, giving me;

childrens-books/beast-quest/book-details.aspx?id=9780123456789&catId=1&seriesId=2

trying to reference the physical file (which existed at the root level) from the context of a folder which doesn’t really exist.  The fix is easy (once you find it!) – for this site the main asp.net form tag was in the masterpage so I just added the following to the Page_Load of my master page;

form1.Action = Request.RawUrl;

Thanks to Ruslan Yakushev’s post on IIS.net

No Comments

New site launch- natashahampshire.co.uk

Juts launched a new portfolio site for my girlfriend, www.natashahampshire.co.uk – This is just the first phase with a few more features and a bunch of extra contact to be added in the coming weeks, but we needed to get it up ASAP so she can apply for a design course in London!

No Comments

Javascript & CSS Minification

Is that a real word?

Well anyway, I’m just finishing off a fairly jQuery heavy site I’m building for my girlfriend as an online portfolio site and figured I’d minify the css and jQuery to reduce loading times (as all of my javascript includes combined come to around 100k)- found a really good java app writen by Yahoo(!) called the YUI Compressor – I combined all my javascript into one combined.js file then minified it nocking 30k off the file size.  Did the same with css only making a saving of 2-3 k, but every little helps!  Very easy to use, but it means you do have to install the java runtime :(

No Comments

PHP Basics @ Smashing Magazine

I’ve not touched PHP for a couple of years now and everytime I have to come back to pimp out a wordpress theme or write something simple which can consume a dot net web service or something else quick and dirty in php, its always the basic syntactical stuff that I find I’ve forgotten (seriously.. a full stop to concatinate a string!?) – anyway; for those occasions, here is a handy article; www.smashingmagazine.com/2010/04/15/php-what-you-need-to-know-to-play-with-the-web/

No Comments

ASP.net membership log times incorrect in the database

A colleague of mine is developing an access controlled solution which prevents users logging in with the same credentials from mutliple locations, using ASP.net membership.  For this he checks session expiry times against the last activity date in the database to see if the user has left the site allowing the session to expire- but he noticed today the code had stopped working.

The clocks went forward an hour in the UK on Sunday just gone as we go into British Summer Time (BST) instead of GMT which turned out to be the problem.  ASP.net membership logs all times in the database using UTC time, matches GMT- the moment we moved into BST we came an hour out of sync!  So he had to convert the code to change our local GMT time to UTC before running any comparisons.  Sql server actually has a function to return the current UTC date/time;

GETUTCDATE()

No Comments

Missing / Corrupt *.aspx(/ascx).Designer.cs file

I had a weird error today about not being able to “connect to the designer.cs” file for one of my pages.  I easily fixed this by just deleting the offending designer file and re-generating it.  Apparently it should auto regenerate just by opening the page in the design view and changing something- but this didn’t seem to work.  I had to right click the aspx file and click “Convert to Web Application” which instantly dropped a new designer.cs file back in there.

Incidentally this is my 100th blog post on here! :)

,

2 Comments

Command line to delete every file older than 30 days

I found a new command line directive i’d never heard of today, along with a brilliant example of it’s use- once you have changed your working directory, running this will remove any files or folders older than 30 days;

FORFILES /D -30 /C "CMD /C IF @isdir==FALSE (echo Deleting File @file) & (ATTRIB -H @file) & (DEL /F /Q @file) ELSE (echo Deleting Directory @file) & (ATTRIB -H @FILE) & (RD /S /Q @FILE)"

As an example, I’ve since used this to iterate over a bunch of folders, deleting any files over 30 days;

d:
for /f "delims=|" %%f in ('dir /b D:\_SQL_Backup\') DO (
  cd \_SQL_Backup
  cd %%f
  FORFILES /D -14 /C "CMD /C IF @isdir==FALSE (echo Deleting File @file) & (ATTRIB -H @file) & (DEL /F /Q @file)"
)

No Comments

WCF 404.3 Errors

I built a WCF service recently which would run fine in the visual studio test web server, but when i tried to actually hit it from real life IIS7 also on my local box, i receievd the following error:

HTTP Error 404.3 – Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Luckily, i found the solution on David Waddleton’s blog and it was as simple as turning on a windows feature in add remove programs- on my vista box i had to go to Control Panel > Programs and features > Turn on/ off Windows features > Microsoft.NET framework 3.0 and tick the WCF activitation options!

No Comments