One of my pet hates is when people write code that is technically correct, but easily mis-understood.
I came across the following today that really grates me:
if (!(a <= 0 && a >= -2))
{ ...}
If you're great at boolean logic, then that's fine - but most people read it incorrectly and mis-interpret the meaning. It would be much more obvious to write it like this:
if (a < -2 || a > 0))
{ ...}
It says the same thing, but is easier to understand
Thursday, 26 May 2011
Wednesday, 25 May 2011
iPhone's
Okay, so those that know me, I've been pretty much Windows through and through for many a year; well, finally last week I gave up on Windows mobile and turned to the iPhone.
So far, so good. The battery life seems slightly better than the LG phone I had and it is certainly more stable.
Had an interesting one today though, I wasn't getting any sound out of my iPhone. headphones worked fine, just the speakers weren't working.
Quick google around and it seemed like it was a relatively common problem requiring new hardware - didn't like the thought of that really. Then I remembered that I'd had my phone connected to my laptop when changing sounds settings on the laptop. Hmm, suddenly, I'm wondering if that is the cause.
So, I get home, connect the phone to the laptop and sync through iTunes. Then turn the sound back on on the laptop and sync again - hey presto, sound is now working on the phone.
So Apple, I think you need to think about how much information you sync between iTunes and the iPhone - this is certainly one setting I didn't expect to be synchronised (and unable to change on the phone!)
So far, so good. The battery life seems slightly better than the LG phone I had and it is certainly more stable.
Had an interesting one today though, I wasn't getting any sound out of my iPhone. headphones worked fine, just the speakers weren't working.
Quick google around and it seemed like it was a relatively common problem requiring new hardware - didn't like the thought of that really. Then I remembered that I'd had my phone connected to my laptop when changing sounds settings on the laptop. Hmm, suddenly, I'm wondering if that is the cause.
So, I get home, connect the phone to the laptop and sync through iTunes. Then turn the sound back on on the laptop and sync again - hey presto, sound is now working on the phone.
So Apple, I think you need to think about how much information you sync between iTunes and the iPhone - this is certainly one setting I didn't expect to be synchronised (and unable to change on the phone!)
Friday, 20 November 2009
Hoax emails
Why do people continue to forward e-mails that claim the end of the world is nigh?
It seems to be almost a daily occurance now to receive an email asking you to forward it on to everyone you know as the worst virus ever is on its way and nobody knows how to get ride of it.
A simple Google of the headline of the story will soon tell you that it is a hoax!
It seems to be almost a daily occurance now to receive an email asking you to forward it on to everyone you know as the worst virus ever is on its way and nobody knows how to get ride of it.
A simple Google of the headline of the story will soon tell you that it is a hoax!
Wednesday, 14 October 2009
VSTO and Due Dates on Tasks
You'd think that when you create a task that can have a blank due date, it would actually be blank now wouldn't you! Well, this isn't the case!
If you create a task and don't set a due date, the due date is actually set to 1/1/4501! This seems to be a magic date as other values (like DateTime.MaxValue) are shown literally.
This becomes a little cumbersome when you want to store the fact elsewhere.
If you create a task and don't set a due date, the due date is actually set to 1/1/4501! This seems to be a magic date as other values (like DateTime.MaxValue) are shown literally.
This becomes a little cumbersome when you want to store the fact elsewhere.
Wednesday, 7 October 2009
VSTO and Contacts
I'm spending an amount of time looking at integrating our application into Outlook at the moment.
To give some background, I want to take the collection of contacts out of our database and put them into an Outlook Contact List - this is fine and easily done.
In fact there's a reasonable description of what is required here
What I then want to do is to make a note into our application when you send an email to one of these contacts; well that's pretty easy - or is it?
Attaching to the Application.ItemSend event is great, this tells us when we're about to send a message. From here, we can get the recipients of the message - that's fine.
We then need to get hold of the contact to see if it is one of our imported contacts.; well the recipient class has an AddressEntry property that has a GetContact method on it.
You'd think this would do the job for us now wouldn't you!
Well, it's like this...
If the contact is in a folder with the property set to be included in the address book, then yes, you can get at your imported contact. If the folder doesn't have this property set, then you don't!
I've spent a good few hours trying to track this down and the hint was on here as it says that it only returns the Contact in the address book.
Ho hum, it would be nice if this wasn't quite so obtuse, but there you go.
To give some background, I want to take the collection of contacts out of our database and put them into an Outlook Contact List - this is fine and easily done.
In fact there's a reasonable description of what is required here
What I then want to do is to make a note into our application when you send an email to one of these contacts; well that's pretty easy - or is it?
Attaching to the Application.ItemSend event is great, this tells us when we're about to send a message. From here, we can get the recipients of the message - that's fine.
We then need to get hold of the contact to see if it is one of our imported contacts.; well the recipient class has an AddressEntry property that has a GetContact method on it.
You'd think this would do the job for us now wouldn't you!
Well, it's like this...
If the contact is in a folder with the property set to be included in the address book, then yes, you can get at your imported contact. If the folder doesn't have this property set, then you don't!
I've spent a good few hours trying to track this down and the hint was on here as it says that it only returns the Contact in the address book.
Ho hum, it would be nice if this wasn't quite so obtuse, but there you go.
Subscribe to:
Posts (Atom)