There are loads of jobs that we need to do on our code base. One of those is probably to introduce a caching layer, the question is when do you schedule the work to design and implement a caching strategy when using an agile, user story based process. We don't want to do premature optimisation but at the same time shoe horning a caching layer in at the 11th hour to fix a performance issue sounds like a total nightmare.
For now I think we'll wait and include it in our permissions stories, I think it can fairly safely cache all the users permissions on login and clear the cache when the session expires. It won't need to worry about invalidating cache entries, if permissions change then the user will have to log out and log back in again and at least that'll give us a base to build object caching and perhaps output caching on top of.
This interesting caching article got me started on thinking about this article, hopefully it'll still be up when I come to need it. http://openmymind.net/Caching-Your-Worst-Best-Friend/
This one is interesting too. http://37signals.com/svn/posts/3112-how-basecamp-next-got-to-be-so-damn-fast-without-using-much-client-side-ui
Monday 4 November 2013
Thursday 24 October 2013
Don't Block the UI Thread with Task.WaitAll use TaskFactory.ContinueWhenAll
The WPF MVVM application I've been working on recently had a view model which loaded data from a couple of different sources. Like all good developers I didn't want to block the UI thread and have an unresponsive app so I did this.
Task[] tasks = new[]
{
_resourcesService.LoadSomething(result => { /* Handle callback for this method*/ }),
_otherService.GetSomethingElse(result => { /* Handle callback for this method*/ })
};
Task.Factory.ContinueWhenAll(tasks, t =>
{
// Check for faulted tasks.
// Do tasks that can only be handled when everything is loaded
});
Sunday 11 August 2013
A Golfing Revelation
So here's my first golf post since starting this blog and since taking up golf.
I started golfing at a driving range on a camping holiday in France. While the kids were in kids club my girlfriend and I thought we'd give it a go, and I caught the bug.
When we got back to the UK I picked up a cheap set of clubs on EBay and hit the range. I'd practice two or three times a week and devoured instructional videos from the likes of Mark Crossfield on YouTube.
I think I managed to craft a half decent swing (for a complete beginner), I was going round my local municipal course in about 105-110 on average, but I was struggling with a wicked slice with my driver.
I had 3 or 4 half hour lessons but they weren't really bringing my scores down, I shaved about 5 strokes off my average score, so I posted a few practice swings on YouTube and shared the link on reddit and got a little feedback.
Well, what a result. I knocked 22 shots off my score. My goal was to break 100 convincingly and after a on track front nine of 48 I was reasonably happy at the turn. I proceeded to play the best back nine of my life. 5 pars, 3 bogies and one blow up triple bogie.
I smashed my goal and finished on 85! All I need to do now is get back out there and do it again. I can't wait
Here's the practice swings if you want to take a look. I'm obviously over swinging, I spotted that, but I was also swaying my hips forwards which was causing me to hold the face open at impact.
I started golfing at a driving range on a camping holiday in France. While the kids were in kids club my girlfriend and I thought we'd give it a go, and I caught the bug.
When we got back to the UK I picked up a cheap set of clubs on EBay and hit the range. I'd practice two or three times a week and devoured instructional videos from the likes of Mark Crossfield on YouTube.
I think I managed to craft a half decent swing (for a complete beginner), I was going round my local municipal course in about 105-110 on average, but I was struggling with a wicked slice with my driver.
I had 3 or 4 half hour lessons but they weren't really bringing my scores down, I shaved about 5 strokes off my average score, so I posted a few practice swings on YouTube and shared the link on reddit and got a little feedback.
Well, what a result. I knocked 22 shots off my score. My goal was to break 100 convincingly and after a on track front nine of 48 I was reasonably happy at the turn. I proceeded to play the best back nine of my life. 5 pars, 3 bogies and one blow up triple bogie.
I smashed my goal and finished on 85! All I need to do now is get back out there and do it again. I can't wait
Here's the practice swings if you want to take a look. I'm obviously over swinging, I spotted that, but I was also swaying my hips forwards which was causing me to hold the face open at impact.
Wednesday 24 April 2013
Beware Ping.Send and the BSOD
The application I'm working on is a partially connected client-server application, it uses a mesh network and/or 3G to synchronise databases.
To test if the client and server could communicate the Ping.Send method seemed like a good place to start (although it's not ideal, an actual WCF service has to be available too). However, if you interrupt Ping.Send mid flight... BSOD. This is only really a problem in development, if the ping is returning in a reasonable amount of time then the chances of interrupting it are slim, but if the server is unavailable, and the ping time-out is too high, and I'm stopping and restarting the application frequently this leads to 4 or 5 blue screens a day.
Disclaimer, it's something at the OS/driver level that actually causes the BSOD, I've not diagnosed exactly what and I probably wont bother, it might be something specific to my network card or could be something in Windows itself but there are plenty of other people seeing the same thing, for example...
http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/1f847268-e38d-4ac3-a1ea-f41069604fd0/
http://connect.microsoft.com/VisualStudio/feedback/details/721557/bluescreen-process-has-locked-pages-netframework-ping-send
http://connect.microsoft.com/VisualStudio/feedback/details/691615/stopping-debugging-session-while-waiting-for-pingreply-causes-bsod
This final link suggests and excellent workaround...
To test if the client and server could communicate the Ping.Send method seemed like a good place to start (although it's not ideal, an actual WCF service has to be available too). However, if you interrupt Ping.Send mid flight... BSOD. This is only really a problem in development, if the ping is returning in a reasonable amount of time then the chances of interrupting it are slim, but if the server is unavailable, and the ping time-out is too high, and I'm stopping and restarting the application frequently this leads to 4 or 5 blue screens a day.
Disclaimer, it's something at the OS/driver level that actually causes the BSOD, I've not diagnosed exactly what and I probably wont bother, it might be something specific to my network card or could be something in Windows itself but there are plenty of other people seeing the same thing, for example...
http://social.technet.microsoft.com/Forums/en-US/w7itpronetworking/thread/1f847268-e38d-4ac3-a1ea-f41069604fd0/
http://connect.microsoft.com/VisualStudio/feedback/details/721557/bluescreen-process-has-locked-pages-netframework-ping-send
http://connect.microsoft.com/VisualStudio/feedback/details/691615/stopping-debugging-session-while-waiting-for-pingreply-causes-bsod
This final link suggests and excellent workaround...
The bug seems to appear only on .NET Framework 4.0. I do not know if the bug is in .NET 3.5 as well. I have checked, that the .NET Framework 2.0 does not show this bug. Therefore, to avoid this bug, switch back to that framework version....or maybe not.
Sunday 14 April 2013
New Blog
This is probably the 14th blog I've started but hopefully I'll keep this one up.
I want to blog for a few reasons, I want to play around with HTML5, CSS3 and Responsive Design, also I've recently started working for a small company and want to "discuss" software design issues. There might have been other reasons but I can't remember them now.
This isn't really the place to play with HTML and what not but this is just the start of bigger things. One day I'm sure I'll get myself a witty domain and some hosting and create my own WordPress theme.
I'll mostly be discussing .NET, C#, WPF, Prism, and maybe a little golf. Maybe a lot of golf, it's my new thing but I'm fairly terrible at it at the moment so
I want to blog for a few reasons, I want to play around with HTML5, CSS3 and Responsive Design, also I've recently started working for a small company and want to "discuss" software design issues. There might have been other reasons but I can't remember them now.
This isn't really the place to play with HTML and what not but this is just the start of bigger things. One day I'm sure I'll get myself a witty domain and some hosting and create my own WordPress theme.
I'll mostly be discussing .NET, C#, WPF, Prism, and maybe a little golf. Maybe a lot of golf, it's my new thing but I'm fairly terrible at it at the moment so
Subscribe to:
Posts (Atom)