Latest posts from the Blog

x y z, lambda!

“x, y, z” is often used as variable names in lambda expressions, and if the expression is long and nested and you run out of “x, y, z”, then “x2, y2, z2” is used.

The x,y,z Way

In my opinion this is not very readable or easy to follow. Especially if you’re new to the code.

cars.Where(x => x.Engine.Model == "superfast" && x.Engine.Sparkplugs.All(y => y.Model == "superspark")).GroupBy(x => x.Engine.Model);

The long Way

Why does car become x and spark plugs y? It’s a car with an engine and spark plugs :) But maybe you don’t want to use long variable names because the code becomes cluttered.

cars.Where(car => car.Engine.Model == "superfast" && car.Engine.Sparkplugs.All(sparkplug => sparkplug.Model == "superspark")).GroupBy(car => car.Engine.Model);

The compromise

But you could use the first letter of the entity name or a short name like the two or three first letters if the entity name is long or used multiple times in the same expression.

cars.Where(c => c.Engine.Model == "superfast" && c.Engine.Sparkplugs.All(s => s.Model == "superspark")).GroupBy(c => c.Engine.Model);

Less css for growing projects

When almost all projects are built on top of one or more framework, it’s easy to start thinking of your implementation as a “theme”, rather than something specific to your solution. Before you know it, you have thousands of rows of object-oriented-ish css that in theory could be applied to any codebase and result in a your particular corporate identity “out of the box”. In my experience, this is rarely a good idea, and you will probably end up with tons of unused rules, and little to no traceability.
Continue reading

Still writing that old clunky CSS?

CSS can be a bit tricky to wrap your head around, especially in larger projects. So let me share some of my experience that I have gathered through the years. There are a few basic starting rules, or rather thoughts that you can take with you in your work. These are as follows:

  1. Do not style ID’s
  2. Avoid nesting.
  3. Use proper naming conventions

Easy enough right? Let’s take a look at these thoughts.

Continue reading

SSL Cipher suites and protocols in IIS

Let’s say your website gets a security revision, let’s also say that this revision was not particularly positive about your IIS being able to use SSL 3.0 or other deprecated protocols.

While Microsoft recommends changing or adding various registry settings you soon realise that this revision wasn’t a smooth start of the day.

disable-ssl2-in-iis

Continue reading

Web Essentials 2015

I installed Web Essentials for Visual Studio 2015 and I noticed that the SASS files didn’t compile as it did in previous versions and I noticed that some functionality has been split up into 4 seperate extensions:

  • Bundler & Minifier – for bundling and minifying JS, CSS and HTML files
  • Web Compiler – for compiling LESS, Sass, Scss, (Iced)CoffeeScript and JSX files
  • Image Optimizer – for lossless optimization of PNG, JPG and GIFs
  • Web Analyzer – for static code analysis (linting) of JS, TS, CSS and JSX files

In previous versions, Web Essentials used a WebEssentials-Settings.json file to set up all the different settings required to use these functions, but now they’re split up into their own .json settings files in the Root directory of your project and has had a few changes.

Continue reading

Stop calling me!

Every now and then a visitor will complain that their phone parses any sequence of numbers on a site as a phone number. This functionality is added by the client and when it works as intended it can be very helpful. Let’s not break it, or employ elaborate hacks to circumvent it, just because someone insists on operating their touch screen with the entire palm and tries to call the span of World War 2 as a result.
Continue reading