Why is my stored proc slow in .Net?

I was writing a stored procedure the other day and trying to make it run faster. The problem was that it ran in under a second in SQL Server Management Studio, but then took over thirty seconds when running from .Net. What on earth was going on?

After checking with Profiler, I found something quite significant.

It turns out that .Net’s SQL Server client does this first of all:


Which doesn’t sound particularly heinous, does it? I mean, just turning off the flag so it won’t bail out when it hits a divide by zero, that can’t be such a bad thing, can it? Continue reading

Posted in Development | Tagged , | Leave a comment

What does “&amp” mean?

Sometimes, when you’re using Twitter or Facebook, you’ll see something like this:

Had a great lunch today with Alice &amp Bob to discuss the new project

And at first that reads fine. But halfway through there’s “&amp”, which doesn’t make much sense. It looks like a glitch. And that’s actually what it is.

The reason this occurs is that HTML (which stands for Hypertext Markup Language) is the way in which any web pages are delivered to people’s browsers. But because HTML has to work everywhere – on web sites, inside emails, and even in text messages (think iMessage on Apple iPhones, or the chat messages sent in WhatsApp), it’s important that HTML can be encoded in everything.

So HTML was designed so that even if an HTML page is delivered in plain ASCII (what’s called the “invariant” character set), there’s a way to introduce special characters, and even Unicode. That’s how you get emojis, such as smiley faces, unicorns and even smiling pieces of poo, into your emails, tweets and web pages. Continue reading

Posted in WWW | Tagged , , , | Leave a comment

Top 5 free word processors

Microsoft Word is the world’s most popular word processing package. And while it’s mature, robust and capable, these days it costs an annual subscription to use it. So what happens if you don’t have the money? Or maybe your computer runs Linux? Well, there are plenty of alternatives, some of them free, that you can use, and while nothing is 100% compatible with specific versions of Word – and sometimes, that includes Word itself – all of these options support opening, and saving, Word documents.

  1. Libre Office
    Libre Office, started when some developers felt that there wasn’t enough progress being made with developing OpenOffice after Oracle acquired Sun Microsystems. They formed the not-for-profit organisation The Document Foundation, and started development on a fork of the software. But as the name suggests, Libre Office isn’t just a clone of Word, but also includes a full-featured spreadsheet, database application, presentation application, vector and flowchart drawing program and mathematical formula editor.

    Robust and fast, LibreOffice is the go-to choice for word processing outside of Microsoft Office these days.

    Website: https://www.libreoffice.org/
    Runs on: Windows, Mac, Linux, Android and iPhone.

  2. AbiWord
  3. AbiWord is a very small, lightweight word processor that works on a large number of systems. Unlike Libre Office, it is just a word processor, which makes it useful for older machines with slower processors or less memory, but despite its small size, it still includes spelling and grammar checkers. It’s especially useful for older Macs or PCs, as the currently available versions will run on OS X 10.2 or later, and Windows 2000.

    If you have an older computer that needs a new lease of life, or you just need a single-use application that’s light on system resources, AbiWord is a great choice.

    Website: https://www.abisource.com/
    Runs on: Windows, Mac, Linux, Solaris, AIX, HP/UX, OSF/1 and Tru64.

  4. Softmaker FreeOffice
  5. German company Softmaker make a premium level office suite that competes directly with Microsoft Office. However, they also make the previous version free to download as “Softmaker FreeOffice”. In order to download, you need to enter your email address to get onto their mailing list, and they will email you a free product key. Like the other office suites in our list, this includes a word processor, spreadsheet and presentation program. There’s also a free version for Android. One key feature of FreeOffice is that it allows you to create eBook versions of your files directly from within the suite – a useful bonus if you intend to self-publish your magnum opus…

    Website: http://www.freeoffice.com/
    Runs on: Windows, Linux and Android

  6. Jarte
  7. The smallest application on this list – and the only one that is Windows only – Jarte wrappers WordPad inside a more user friendly application. Not only is it small – at time of writing, the download is a mere 4MB – and there are additional features that you can purchase if you want to upgrade to “Jarte Plus”. It’s also portable, which means that it can run from a flash drive, which can be useful if you need to do that.

    Website: http://www.jarte.com/
    Runs on: Windows

  8. OpenOffice
  9. OpenOffice originally came about when Sun Microsystems bought StarOffice. They open sourced it, to create a community around the suite, and drive its development. However when Oracle bought Sun, they passed OpenOffice over to the Apache Software Foundation (you may not have heard of them, but they write the world’s most widely-used web server program). Like Libre Office, it’s a full-featured suite including word processing, spreadsheets, presentations, mathematics, database and drawing functions, and again, like Libre Office, it’s a big download.

    While there are criticisms over the way that OpenOffice was handled in the past, these are largely behind the project, and it remains a solid choice.

    Website: http://www.openoffice.org/
    Runs on: Windows, Mac and Linux

Posted in Applications | Leave a comment

What is an .ipa file?

An .ipa file is an application for installation on an Apple iOS device, such as an iPhone, iPad, or iPod Touch.

Underneath, an ipa file is actually a ZIP file, so if you want to see what is inside it, you can rename it to .zip and open it with any archiver, such as the excellent 7-Zip.

Just opening an ipa file with the iPhone’s built in browser isn’t enough to install it – the developer must have specified “over the air” installation when building the file (if you’re trying to get this working as a developer, you have to have an enterprise developer account – see more at Stack Overflow).

iTunes used to copy all the ipa files from your device when synchronising, but as of November 2017, Apple announced that’s no longer the case. So in future, when you upgrade your Apple devices, while you can still backup and restore your phone with iTunes to copy all your photos, music and other settings across, you will still need wifi to re-download all the applications. (You can still copy some other things with iTunes, however.)

Posted in File formats | Tagged , | Leave a comment

How to convert a test project to a normal class library

Sometimes you make mistakes. One of the ones I make most often while using Visual Studio is creating a new project of the wrong type. Usually, creating using just the same one I usually created.

And just now, I added a unit test project to a project I was working on. Great, so that’s one job done. Now I needed to add the class library it was going to test – and added another unit test library. Doh!

Turns out this is fixable – simply edit the project file (the “Productivity Power Tools” extension provides a shortcut to this, if you don’t have it already) and remove the line:
then save and reload the project – which turns out to be easier than I thought.

Can’t claim I invented this trick – I found it the other way round on Adam Prescott‘s blog. But I’m putting it here because I know I’ll forget it, next time I need it.

Posted in Development | Tagged , | Leave a comment