When you want to deliver a file to a user with SpringMVC you can use the built in FileCopyUtils to put the file into the OutputStream of the response. This is an example of the method in your controller class. @RequestMapping(value = "/yourURLHere") public void handleFileDownload(HttpServletResponse response) { File file = myFileService.getFile();   response.setContentType("application/xls"); //in [...]

Why you should profile

So I’m a bit behind on my blog reading and I came across this post by Keyvan Nayyeri via The Morning Brew. In it, he goes on to compare the performance of DateTime.Now versus DateTime.UtcNow. Now, to be fair, I did not know that DateTime.Now was that much more expensive then Date.UtcNow. I mean, hey, [...]

So this was a fun little project at work that I started to help with my learning the ins and outs of Python. Theoretically, if your job titles and direct reports are kept up to date in Active Directory, you should be able to generate an organizational chart for any level of people. However, it’s [...]

Mocking Membership provider

So as usual with so many of .NET 1.0 to .NET 2.0 era classes, Microsoft have made it near impossible to mock out MembershipProvider. The MembershipProvidersCollection class is read-only so you can’t just add your own provider at runtime. No matter! After some time with Reflector and some twiddling with reflection I came up with [...]

Okay, this took me far too long to figure this out. Mainly due to my own misunderstanding of Python terminology regarding modules (For the record, a ‘module’ is a file not a directory of python files) and mainly because I couldn’t find a specific example for what I wanted to achieve. My goal was this: [...]

« Previous Entries  Next Page »