Plip's Weblog

Phil Winstanley - British .NET chap based in Lancashire. Enjoys tea and tech. Working for Microsoft.

February 2008 - Posts

How to kill an iPhone

Today my phone took on a new and interesting way of working.

The audio on it appeared to die, by this I mean quite literally die.

No iPod either through headphones or the speaker on the iPhone. No Phone, either through the headphone or speakers. Somewhat limiting the use of the handset...

iPhone Killer

The culprit? A tiny piece of paper which had managed to work it's way into the headphone jack slot!

iPhone Killer

I just fished it out with a pin (a bit fiddly but it worked).

So, if you know someone with an iPhone you don't like, this is how you can kill it ... (and it's really not obvious why it's died - use a bit of black paper and they'll never know!)

 

Technorati Tags: ,
Liverpool .NET Usergroup Launch - 11th March 2008 18:00

The guys over in Liverpool have setup their own .NET Usergroup which is great news for the Northwest.

 

http://upcoming.yahoo.com/event/443298/ 

 

 

Great news for the Scouse .NET Developers!

 

 

P.S. It's the law to take the mikey out of scousers at every available opportunity.

P.P.S I'm half Scouse

P.P.P.S Not that my Non-Scouse half will admit to it.

 

 

Phil.

 

Technorati Tags: , , ,
You can take a horse to water, you can't make it read the terms and conditions ...

This post focuses on UK and European law, the author of this post is not a lawyer, always seek professional legal advice.

Tonight's speaker at the Liverpool Geekup event was Graham Ross, an eloquent funny character with a wealth and depth of legal knowledge specialising in the technology sector.

IMG_0137

Graham Ross, is in practice both as a mediator and as a solicitor. Graham has over 20 years experience in IT and the law, is the author of legal applications software (including he original version of the QUILL solicitor's accounts and time recording package) and was the founder of LAWTEL, the popular web-based legal information update service.

Graham is a member of the United Nations  Expert Panel on Online Dispute Resolution and speaks regularly at international conferences on the impact of the law on the Internet and e-commerce and on technology in the judiciary and Alternative Dispute Resolution. Graham was host of the 5th International Conference on Online Dispute Resolution held in Liverpool, UK, in 2007 in collaboration with the United Nations Economic and Social Commission for Asia and the Pacific (UNESCAP) .

As a solicitor  Graham has considerable experience in clinical negligence and in major high profile personal injury and product liability group actions, including the successful action against the UK Government for HIV infected haemophiliacs (which he founded and led) and was a member of the steering committee that negotiated the largest ever  group settlement, being for miners made ill by coal dust inhalation).

http://v2.theclaimroom.com/images.lxp?host=25&filename=tmedrwhoarewe.html

The beginning of the session focused on Mediation and what it means in today's legal structures.

The difference between Arbitration (which is bad by the way!) and Mediation (which is good!) is summaries below, you really need to see Graham speak though to get a real understanding for what it's all about.

Arbitration Mediation
A Neutral party imposes an outcome Parties decide outcome
Restricted on outcome by law No restrictions on outcome
Focuses on the past relationship between parties Focuses on the future relationship between parties
Works "outside the head" Works "inside the head"
   

If you're looking for some quick legal advice OUT LAW is a great site which has a bunch of information, check out an extract from it's front page here: -

OUT-LAW has 8,000 pages of free legal news and guidance, mostly on IT and e-commerce issues. These issues can affect any organisation, and OUT-LAW is as much for those in a software start-up as it is for the compliance team at a bank. If and when you need further advice, we hope you'll choose Pinsent Masons, the law firm behind OUT-LAW.COM.

For legal details check out the site http://www.out-law.com/ 

One area which Graham focused on was that issue of jurisdiction. Ensure you define the jurisdiction of both the laws which will apply and in which countries courts they will be heard in. Be aware of the Brussels Regulation when trading in Europe. It means that the purchaser of goods can hold proceedings in their own country irregardless of the contracts.

Harmonised - All EU countries have adopted the law

Unharmonised - Individual member states choose how and when to adopt the law

Many companies are being setup in Luxemburg in Europe as a tax haven, but it has implications for consumers too. Delaware in the USA is used for the same reasons.

Another area Graham focused on were the distance selling laws and how to minimise their impact, there's a big distinction between consumers and business buyers, and a large number of the laws only apply to consumers. So one tip Graham had was get buyers to agree that they are business users when buying things from you, that way they waive a number of protections put in place when they are consumers, perhaps even offer business users a discount to encourage this even more. Whatever you do, at the very least get customers to confirm if they're a consumer or a business buying from you. Consumers have seven days to return things if it's stated correctly, and if not, they have THREE MONTHS !

On the majority of web sites bad wording (or positioning) of terms and conditions means they aren't binding.  The Date of which a contract is entered into is vitally important

Beware the Information Commissioner and Setup privacy policies as well as ensuring Data Protection compliance - delete old data if you have to.

Finally, when something which is a copyright infringement or litigious, the first step by the offended party will be a cease and desist letter - act on it! Remove any defamatory content immediately, it's not worth the hassle!

IMG_0135

Cheers,

Phil.

 

Technorati Tags: , ,
Manchester UK - SQL Server 2008, Windows Server 2008 and VS.NET 2008 Launch Event

 

http://manchester.vbug.net/EventDetails.aspx?id=9

 

27 March 2008 17:30

The HEROES Happen {Here} Manchester launch of the latest set of Microsoft products - Visual Studio 2008, SQL Server 2008 and Windows Server 2008 will be an absolute blast.

We'll be exploring all three products with the help of some Community Super Heroes who will be giving you the information you need to head back to work and be a Hero yourself (cape not provided).

Along the way we'll be giving away a huge range of prizes; someone will walk away with thousands of pounds worth of software and goodies, will it be you? Can you afford to risk not showing up?

This new release offers new web tools, virtualisation technologies, and security enhancements. Powering the next generation of networks, applications, and web services is even easier with new functionality and powerful operating system improvements.

Designed to aid software developers face complex challenges and create innovative solutions, this suite of development tools will help you create connected applications with compelling user experiences for Windows Vista, the 2007 Microsoft Office system, mobile devices, and the web.

A trusted, productive and intelligent data platform that enables you to run your most demanding mission-critical applications. Reduce costs, streamline development, and drive business intelligence through your business under a scalable solution with support for data warehousing, server consolidation, and online transaction processing.

You might want to check out the official UK HEROES happen {here} site for more details on the products.

 

Time
Description

17:30 - 18:00
Event Registration

18:00 - 18:45
Windows Server 2008

18:45 - 19:00
Break & Networking

19:00 - 19:45
SQL Server 2008

19:45 - 20:00
Break & Networking

20:00 - 20:45
Visual Studio .NET 2008

20:45 - 21:00
Prize Draw & Close

21:00 Onwards
Pub (and a well earned pint)

 

 

http://manchester.vbug.net/EventDetails.aspx?id=9

 

New desktop machine ...

Well, it's time had come, my old Mac Mini died.

Roll on Mac v2!

I now have a shiny new iMac sitting on my desk DWARFING everything else :D

 

Desk

 

Next step is to see if I can get VS.NET running on Vista in VMWare to live and work on my OSX Desktop :D

 

Phil.

 

 

Technorati Tags: ,
DDD Ireland

 

The drums are beating ...

 

http://www.dddireland.com

 

 

Technorati Tags:
Developer productivity problems solved!

Productivity Phil

 

I think it's the only solution.

Pimp my ASP.NET web application - Part One

Over the coming posts in this series we will explore some of the ways in which I've learnt to "Pimp up my ASP.NET applications". This won't be a technical journey though, rather, it'll be much more about the method of my madness and will explain why I do things the way I do. In this post, we'll focus on performance.

 

Part One - Performance

In the past I've worked with people who took performance very seriously. So seriously, that they would consider memory allocation when choosing variable types and the way in which reference and value types behave differently. I have only one way to describe those developers, they are clearly clinically insane.

"There is more to life than increasing its speed"
-- Mahatma Gandhi (1869 - 1948)

Application performance can make or break a user's opinion, it's vital to get it right, but there is a fine balance; and like drugs, alcohol and sex, knowing when to stop is of vital importance.

 

Measure & Benchmark

Whilst it's very tempting to just jump into fixing an application with performance issues, a little patience and work now will make the effort later on much more rewarding. 

"Measure not the work until the day's out and the labor done."
-- Elizabeth Barrett Browning (1806 - 1861)

Until you've taken the time to measure your current performance you can't qualify if the changes you make to attempt to increase performance are making any real difference. 

Let's take the page rendered at the URL http://weblogs.asp.net/ as an example. Here's it's load time for me (after having previously visited it): -

Once you have some numbers, you can actively begin to reduce them. I suppose, what I'm trying to say is, that there's no point doing performance work if you can't prove that it's made a difference. 

Rob Howard wrote a fantastic piece for MSDN on the Application Center Test tool "Tools of the Trade: Application Center Test". It's stuffed full of useful information.

 

It's faster that way ... 

As a rule of thumb, I try not to optimise an application until it's finished. Granted, I know the patterns to follow which will make the code run in a timely fashion usually, but I don't build performance in. There's a good reason for this; performance is only one aspect you must face when building your applications, maintainability and security are of equal importance and often as soon as code is optimised for performance it's maintenance becomes much more difficult.

Let's have a quick look at the following example of some C# which was optimised by the developer whilst writing it instead of afterwards which was rather unwise: -

while (reader.Read())
{
    User U = new User();

    U.Id = reader.GetGuid(0);
    U.LocalTime = DateTime.Now.AddHours(reader.GetInt32(10));
    U.Referral = reader.GetString(1);
    U.IP = reader.GetString(2);
    U.AccessSpeed = reader.GetInt32(3);


    Users.Add(U);

}

Yes, it is marginally faster to access columns in a reader by their Indexes, rather than the string representations of columns. It is however, a great deal more difficult to read not to mention the consequences should someone change the order of the columns coming out of the query. (Combine this with a SELECT * and you're really in trouble!).

An argument I see a lot from developers, especially in startups is "it won't scale!". Sometimes, it's better to write the code and have it not scale easily forcing a rewrite later on when it's more financially viable than to build it in from the beginning. It may make us feel a bit dirty, but it is the reality of the situation.

So my message on this is clear, don't optimise your code until you need to; understand the return on investment of your time and the associated business requirements. Use your time wisely.

 

Compression

HTML as I'm sure you are more than aware, can be a tad on the wordy side at times. A simple way of increasing the performance of your applications is simply by reducing the amount of the HTML, this can be something simple like changing the name of your CSS Classes so that they're much shorter or more complex such as transmitting your HTML zipped up to clients. 

"MacDonald has the gift of compressing the largest amount of words into the smallest amount of thoughts."
-- Sir Winston Churchill (1874 - 1965) 

Compression might sound to you like a bit of a lame duck, however I can assure you it is most certainly not. A little bit of compression can turn your family saloon into a sports car.

  

Some argue that compression only benefits those of your users who are on slow connections (or happen to be downloading 20 torrents at the time), but I'd argue there are other fantastic benefits to using compression with your applications. The cost of bandwidth is still high comparatively speaking with the cost of other services, every byte you save by compression is a byte you don't have to pay for.

Products I've been exposed to from a company called Port80 Software including httpZip and ZipEnable are extremely effective at reducing your payload overhead (amount your web server is sending to users) without a significant loss in performance.

Incidentally, whilst we're talking about compression, when you deploy your ASP.NET Applications be sure to flick the compilation mode to release, ASP.NET behaves differently and compresses certain things automatically when in release mode (as well as being faster anyway!).

 

HTML, JavaScript and CSS Optimisation

Inspecting the payload your server is issuing out can be quite tricky, luckily for the likes of you and I the boffin's at Microsoft created Fiddler and Simtec created HttpWatch (which I use every single day - probably the best developer tool I've got in my arsenal, it's also coincidentally the tool you'll see screen shots from throughout this article). 

Spend time to ensure your start page loads fast. First impressions do count. 

CSS Optimisation seems like a very easy and sensible thing to do. Here's a tool which is online and looks pretty interesting. Here are the results I received when placing one of my CSS files into the CSS Optimizer.

   

A tool I've not used, but I know others swear by is JSMin, which strips out white space and performs other optimisation in JavaScript. Would be reasonably easy to hook up a little MsBuild task that was run on your output folder for your web application after a deployment with a Visual Studio Web Deployment Project. (That would be rather cool don't you think?).

 

Caching

Why bother writing it properly when you can just cache the data? I think it's a very valuable philosophy, obviously, this can not be followed 100% of the time, however, as a general rule, I think it's a very effective way of getting round the daily constraints we have placed upon us by deadlines and other artificial barriers.   

"Caching can be a good way to get "good enough" performance without requiring a lot of time and analysis. Again, memory is cheap, so if you can get the performance you need by caching the output for 30 seconds instead of spending a day or a week trying to optimize your code or database, do the caching solution (assuming 30-second old data is ok) and move on."

-- http://msdn2.microsoft.com/en-us/library/aa478965.aspx

ASP.NET has an absolutely fantastic caching system which can be used to cache not only in memory representations of data but also the resultant HTML. With Dependencies and fragment caching you can very quickly make a slow application look rapid.

Also, be clear, caching isn't just about System.Web.HttpContext.Current.Cache, it's also about the way in which browsers treat the HTML and assets of your web applications.

On the first load of the page, the result type for all the items is 200, which means it's been received from the web server (successfully as it happens).

On any consecutive load, should the files be cached in the local browser cache then that's where they're loaded from as indicated here by a status code of 304. Note the main page is still loading from the web server, that's because it's dynamic content and should always be loaded from the web server.

  

 

Database Optimisation

I'm not a database administrator nor do I want to be (open toed sandals just aren't me), so I'll leave the SQL Server Optimisation to those who know and instead leave you with a rather fun cartoon from http://xkcd.com.

 

 

</article>

 

What do you think? I'd love to know how you approach optimisation and performance issues.

Also, I'd love some brownie points for not using the word "Performant" in this piece...

Cheers,

Phil.

 

 

 

Technorati Tags: , ,
I need one of these

Every ASP.NET developer should get one from Microsoft!

 

DataPortability

There's a new kid on the block, another potential standard that's trying to unify the web ... the problem is clear: -

"As users, our identity, photos, videos and other forms of personal data should be discoverable by, and shared between our chosen (and trusted) tools or vendors. We need a DHCP for Identity. A distributed File System for data. The technologies already exist, we simply need a complete reference design to put the pieces together."

The solution, less clear: -

"DataPortability is not inventing any new standards. In fact many of the participants in DataPortability project are very active in the existing standard communities (in some cases helping to start them!). DataPortability simply puts the standards in context of each other so that consumers, vendors and developers can more easily understand and implement then as an end-to-end data portability solution. Please visit the Supporting Standards Page for more information."

There's already an large list of names involved: -

  • Google
  • Plaxo
  • Facebook
  • LinkedIn
  • Twitter
  • Flickr
  • Six Apart
  • Microsoft
  • Digg
  • MySpace

The team over at DataPortability.org have uploaded an impressive FAQ which describes all the issues and potential solutions.

I have to say, when I read the name of companies involved it instantly reminded me of a Yes Minister episode: -

 

I wonder, which of the list above are in it to win it, and which are in it to stop it?

The power of many of the social networks is derived from the data which they hold, if they open up too much, their data becomes less valuable.

 

 

It will be interesting to watch the project.

 

Technorati Tags: , , , ,
More Posts Next page »