Jane's Technical Stuff

Tuesday, May 27, 2008

Reflective Perspective


No sooner had Mike Gunderloy finished posting The Daily Grind, a daily round-up of all that was new and good in the (mostly) .NET arena but also touching on other software development related material, than Chris Alcock took over with The Morning Brew. He produced the 100th installment last week, so Well done Chris. This is one of my must read blogs, and I always find it is full of helpful, useful and informative links - including one to this blog

Labels:

// posted by Jane @ 3:32 PM   save to del.icio.us

Comments:

Wednesday, April 02, 2008

Static Code Analysis Review - our criteria


The criteria we've come up for choosing a Static Code Analysis tool are the following:
  • Integration - how well does it integrate with VS2005. Does it claim to integrate with VS2008? What about legacy VS2003 stuff?
  • Versions - can it work against a .NET 1 project? Or a .NET 3/3.5 one?
  • Ease of use - how easy is it to run an analysis? How easy is it to understand what it wants you to fix? And where the code is?
  • Ease of configuration - how easy is it to add a new rule? Or turn one off?
  • Issue detection - running it against a specific project, what does it detect? How many potential issues does it spot? How does this compare the other tools?
  • Stability - any problems noticed since installing it/using it?
  • Extra - what else is there about this tool? Any added bonuses?

Is there anything else we should be thinking about?

Note: We've excluded cost as we're interested in finding the right tool without thinking about budgetary constraints.

Labels: , , ,

// posted by Jane @ 12:02 PM   save to del.icio.us

Comments:

Thursday, March 27, 2008

Static Code Analysis


One of my colleagues and I are looking into tools for Static Code Analysis for C#. At the moment, we have the following tools on our list to investigate further:

Do any of my readers have any suggestions for other tools we should consider? If so, please leave me a comment with the name and any feedback.

Labels: , , ,

// posted by Jane @ 6:32 PM   save to del.icio.us

Comments:
I have used both FXCop and NDepend. I found FXCop is great, although you need to spend a bit of time customising it for your own requirements. Not exactly a suggestion for other tools, but at least you know one other person has used (and likes) a couple of things on your list :).
 

Tuesday, January 22, 2008

Double counting document downloads


One of the projects I'm working on counts document downloads. Yesterday I was fixing a bug relating to it double counting, but only in IE. The documents can only be pdf or docs. We have .doc, .docx and .pdf files being handled by a DocumentHandler class as set up in web.config
<httpHandlers>
<add verb="*" path="*.pdf" type="DocumentHandler"/>
<add verb="*" path="*.doc" type="DocumentHandler"/>
<add verb="*" path="*.docx" type="DocumentHandler"/>
</httpHandlers>


DocumentHandler has a ProcessRequest method. Within this method we increment our count.

When opening a .pdf by either Firefox or IE this method gets called once.
When opening a .doc or .docx with Firefox this method gets called once.
When opening a .doc or .docx with IE this method gets called twice. Firstly when the browser window is created, and then when the Open dialog is displayed.

I spent some time looking into this, especially concentrating on the differences within the context.Request object. The second time this method is hit, the UserAgent is Microsoft Office Existence Discovery. The other, more usable, difference is that Context.Request.UrlReferrer is null. This is the condition I have chosen to use to prevent the double counting. If someone stores the link to the document as a bookmark, then this won't count, but within the context of this application this is unlikely.

Labels:

// posted by Jane @ 10:33 AM   save to del.icio.us

Comments:
IE/MSOffice's behaviour here is so unfriendly. Why do you need to check the existence of the document? You just requested it! It's a good job we're not charging per-download ;p
 

Saturday, December 01, 2007

Silverlight


On Monday evening I headed down to the Eagle to attend Josh's Silverlight Night. It wasn't really a presentation so much as a set of demos, around which a lot of questions and answers went on - especially from the Flash Brighton crowd. This was the first time I'd really spent any time learning about Silverlight, and I found the session really informative. I appreciate it isn't as mature a product as flash but I also don't really think it is targeting the same audience at this time - probably being best suited to video players and kiosk style applications. I really believe that the integration with other Microsoft toolsets, like the .NET languages, Visual Studio, Expression Blend, can only be a good thing allowing developers and designers to work together with a greater amount of ease. This is long overdue in my opinion.

It's great to get more Microsoft speakers down to Brighton - following on from Daniel Moth's attendance at VBUG a few weeks previously - and having spoken with Pete during the event I'm hopeful that he can help get more evenings like this arranged.

A few days after the presentation, I received an email from Microsoft informing me that the Mix:UK 07 videos were available. I'd heard great things about the conference and so followed the link and discovered that they'd all been encoded using Silverlight - so I guess I'll be installing it pretty soon. Amongst the sessions are a couple of interest re Silverlight - "Designing immersive experiences with Expression Blend, WPF and Silverlight" and "Building Silverlight Applications using .NET (Parts 1 and 2)" which I'm hoping to find time to follow up on in the next month or so.

Labels: , , , ,

// posted by Jane @ 7:21 PM   save to del.icio.us

Comments:

Wednesday, September 05, 2007

VBUG: An evening with LINQ


Last night me, and some others from Madgex, headed off to a VBUG evening at the Clarendon Centre. Last nights speaker was Ian Cooper and he spoke about LINQ within C# 3.0. A subject I've heard about, but not seen much about. Ian presented highlights of 2 talks he has previously presented, one about LINQ in general and one about LINQ to SQL.

LINQ looks really interesting, and like it might be a really good addition to the toolkit to allow for quicker development of certain projects. It is a shame that LINQ to SQL currently only has SQL Server interfaces available, but hopefully other providers will come along before too long. I really like the idea of having the ability to change the physical database provider without having to write new database access code. I am, however, a database kind of girl, and enjoy writing SQL, so I'll still fight to have some SQL intervention sometimes - Ian said that LINQ won't always be performant, so some intervention will be needed at these points - maybe that is where I'll be able to make use of my SQL skills.

I've never been to any of the VBUG events before, but if the caliber of last nights is anything to go by I'll be heading along again soon. Especially if the pizza, beer and free book are usual.

Labels: , , ,

// posted by Jane @ 9:21 PM   save to del.icio.us

Comments:

Monday, July 30, 2007

VS2008 - Remove usings


Just catching up on some of The Moth's posts, and glad to see his post about Organising usings in VS2008 - its one of the things that I try to do but often slips off the bottom of the todo list so it'll be great to just do it from the IDE.

Labels: ,

// posted by Jane @ 11:51 AM   save to del.icio.us

Comments:

Tuesday, July 03, 2007

.NET and Cookies


My project involves several front end sites, all looking at one database and using one admin system and code base. If you login to one of the sites, you don't automatically get logged in to the others. So, I'm using a cookie name with a prefix based on the site name. One of my sites has an & in its name - something like A&BSite. When I attempt to login to this site, I get no errors but neither do I get logged in. The code works happily for all the other sites, so I can only assume that either .NET, or the browsers (tried on IE7 and firefox) don't appreciate my use of an &. I've just updated the code to SiteName.Replace("&","") and all is happy and jolly once more. Weird!

A quick straw poll around the office revealed that only one of the developers had come across this before.

Labels: , ,

// posted by Jane @ 4:52 PM   save to del.icio.us

Comments:

Thursday, February 01, 2007

.NET and SQL Server - retrieving blobs


The database for my current project stores pdf documents as images within the database. I needed to write a quick rough and ready program to retrieve all pdfs which meet a certain set of criteria.

The main key is remembering that a binary, or image comes back as an array of bytes. This enables us to make use of System.IO.File.WriteAllBytes which takes in a string parameter filePath representing the path to the file, and a byte[] parameter representing the file.

I set up a data set, and defined a TableAdapter MyQueryTableAdapter to have a parameterised query as MyQuery to extract the relevant fields, and then used:

MyProjectTableAdapters.MyQueryTableAdapter tableAdapter = new MyProject.MyProjectTableAdapters.MyQueryTableAdapter();
MyProject.MyQueryDataTable table;


to define table and tableAdapter variables.
These were then used to populate the table with data based upon myParameter.

table = tableAdapter.GetData(myParameter);

All I did then was loop through the table.Rows in the table and populate a byte[] myPdfDocument variable for each row. This myPdfDocument was then written using the above code.

Job done.

Labels: , ,

// posted by Jane @ 3:33 PM   save to del.icio.us

Comments:

Brighton Bloggers   This page is powered by Blogger. Isn't yours?   rss Sussex Digital - focusing on the Sussex digital community