Thursday, 27 December 2012

EWS Post 2 of n - Finding Folders


The EWS SDK can be found here.

I suggest using Linqpad to run these code snippets as that is where they are being written.

Just add a reference to C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll and a using statement for Microsoft.Exchange.WebServices.Data and you're good to go.


Part 2 of n in my EWS series, this time covering finding folders. This is a two liner, barely worthy of it's own blog post, but it's late and, for something so simple, there seem to be alarmingly few straight forward examples of this on the interwebs, so enjoy.


var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("myusername","mypassword");
service.Url = new Uri("https://mymailserver/ews/exchange.asmx");


var f = new FolderView(100);
var res = service.FindFolders(WellKnownFolderName.PublicFoldersRoot,f);

Being an Atheist at Christmas

Over the last few days I've read a lot of posts that slate Atheists as hypocrites for celebrating Christmas. The whole Saturnalia thing aside, I quite happily celebrate Christmas and without the slightest feeling of hypocrisy.

How do I do that?

Same as an ever increasing number of people, I do not experience Christmas as a religious holiday, for either Christianity or Paganism. It is simply a good ending to another year of hard work involving me having a few extra days off work, getting loads of presents and money, and stuffing my face with Turkey, followed by spending the next few months stuffing my face with all the chocolate I received.
 The fact that some people celebrate the birth of the result of God non-consentially impregnating Mary on this day, or that the Pagans use it to celebrate solstice is entirely inconsequential to me.

At this time of year, there is almost as much bleating from militant Atheists who are easily offended by someone wishing them a Merry Christmas or who object to a public school having a nativity scene with carols containing religious-overtones as there is from Christians criticizing Atheists for daring to celebrate THEIR holiday. This is where live-and-let-live really should win out.

We all have our own reasons for celebrating this time of year. Lets just let everyone celebrate for their own reasons and have a good time.

Saturday, 15 December 2012

Technet 12 days of Geekmas


My posting of the above image is part of the Technet 12 Days of Geekmas event.
Take part and stand a chance of winning some goodies.

Tuesday, 20 November 2012

EWS Post 1 of n - Sending an email

I've been digging in to the basics of using Exchange Web Services recently and thought it worthy of a few blog posts. These won't be the perfectly crafted literary masterpieces of the Hanselmans of the world, but rather brain farts and code dumps to play with.

The EWS SDK can be found here.

I suggest using Linqpad to run these code snippets as that is where they are being written.

Just add a reference to C:\Program Files\Microsoft\Exchange\Web Services\2.0\Microsoft.Exchange.WebServices.dll and a using statement for Microsoft.Exchange.WebServices.Data and you're good to go.

Sending an email using EWS is astonishingly simple and consists of just 8 lines of code:


var service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials("myusername","mypassword");
service.Url = new Uri("https://mymailserver/ews/exchange.asmx");

EmailMessage message = new EmailMessage(service);
message.Subject = "Interesting";
message.Body = "The proposition has been considered.";
message.ToRecipients.Add("pointhairedboss@thecompany.com");
message.SendAndSaveCopy();

Friday, 16 November 2012

PCC elections and why no one cares.

The Police Crime Commissioner elections came and went in the UK, and shockingly no one gave a shit.

Voter turn out was around 15% which is at least 5% more than I was expecting. The reasons for such low turn out are numerous and immeasurable and I'm sure everyone who can be arsed has an opinion on why no one could be bothered.

Personally, the reason I didn't bother voting is because I simply do not see the point of the whole thing and the Government have not made any effort to convince people of why they should care.

The single argument they can come out with is that the current equivalent aren't elected, whereas PCCs will be. However, they've given no reason why this means they'll do a better job. My binman isn't elected but I'm pretty sure that if someone were elected to replace him, the very fact that they were elected doesn't mean they'll do a better job.

 I don't know how the equivalents worked and how someone became one, but I would like to think that it was a role someone achieved by proving themselves through action and experience, not by being voted in by the 4 people in the county who could be bothered.

The PCCs, while they may have the best of intentions, will ultimately be looking to do what will keep them in the voters' good books and get them re-elected.

Telling people "you've got to vote because we're letting you whereas we didn't before" is not sufficient reason to vote.

And in a disturbing twist, the guy who won in my local region is the one who wants to "Give budgets to communities, involving them more in their own protection.". Ugh.

Saturday, 10 November 2012

Elections

A few people have been asking me lately why I was so interested in the American Presidential elections when I generally pay very little attention to UK politics.

Casting aside the completely different scale of theatrics and deceit that goes on in the POTUS elections as opposed to the UK elections which is just several months of the candidates taking pathetic and generally irrelevant schoolboy-like pot shots at each other, the very simple answer is that Americans actually have a choice.

Let's list the choices we had when we ended up with the ConDem coalition government.

Labour & Gordon Brown - In fairness, I think Gordon took a lot of unnecessary flack for not predicting a financial meltdown that the rest of the world didn't see coming. Having said that, Labour made a lot of mistakes and had practically scandalised themselves out of office.
Conservatives & David Cameron - Out of touch toffs I wouldn't trust as far as I can throw them.
Lib Dems & Nick Clegg - Some good policies on paper and I actually did consider voting for them before concluding that a vote for them was essentially a wasted vote, and I really didn't want the Conservatives to win.

Regardless of who you voted for, it was going to be the same shit of cuts, corruption, and false expenses claims.

American had a choice between a President who had not done everything he said he would but has generally done a good job, or Mitt Romney, a religious fundamentalist nut-job whose party if full of men with questionable views on rape and women's reproductive rights.

They had a real choice, we ended up with a tosser either way. In the end, we ended up with two tossers and the Lib Dems ensured that I will never again even consider voting for them.

UK Police Commissioner elections

Next week, everyone in the UK has the opportunity to vote for a Police Commissioner to control the priorities of their local Police force.
 Admittedly, I haven't been keeping to close of an eye on this but I had always assumed that a Police Commissioner should be an actual Police Officer who actually knows something about the Police.

Instead, it would appear that this is just another example of politicians creating jobs for themselves. Politicians who know shit all about policing having their hands even further in the day to day running of the Police force. Police forces should be run by the Police, not by politicians who are just in it for the expenses claims.
 Reading through the manifestos of my local candidates, all but one of them has no experience in the force and, where they provide actual details of what they will do rather than just talking about their hobbies, their ideas are a combination of plain common sense that anyone on the street could come out with, and the idiotic, such as putting budgets in control of local communities.
 What the hell do people in the community know about Police budgets? I would know absolutely nothing about where Police money should be spent, which is why I'm not in charge. But it appears, in this new world of making the average Joe on the street feel like he's the boss (he's not), we spend time and money consulting him/her on what they think the money should be spent on (when they probably don't have a clue) then either ignoring them (making the entire exercise pointless) or doing as they suggest (risking large amounts of public money being wasted on ideas from idiots).

The UK Police have had a fair bit of bad press over the last few years, a lot of which can be attributed to media sensationalism and some officers trying a little too hard to reach their targets. But over all, they do a tough job and get nothing but shit for it, now we put some self-serving politician in their way who's priorities are making sure they do what they need to get re-elected.

Yet another fail from the ConDem Coalition, and one which I'm sure Labour will be quick to reverse when they get back in to power.

Rant done.

Saturday, 3 November 2012

American Presidential Elections

I'm not American and I don't live in America, but I am still dreading the possibility of Mitt Romney becoming the President of the USA.
 The man has flip-flopped on vital issues more times than I've had hot meals and I doubt even he wonders where he stands on the vital issues now.

No one looks at this blog, and that's fine. But if you are viewing this blog, and you're American, and it's before the 6th November 2012, please think about who you vote for.

Romney's policies boil down to:

  • His God has more say over what every woman in the USA can do with her body than said woman. They can't have abortions (with exceptions for rape, incest, and life of the mother that he has been forced in to accepting), and at the same time he will seriously restrict the availability of contraception. These two individually aren't sensible, together it is just damn stupid. Watch out for an explosion in unplanned births if he gets his way.
  • He wants to shut down FEMA and leave the handling of disasters to individual states which won't have the same expertise as FEMA, or the private sector who have their profit margins to look after.
  • He'll reduce taxes for his rich mates and screw over the middle-class.
  • Add to that his extreme arrogance that he somehow deserves the position and believes that America will be untouchable under his leadership, and you've got a very dangerous man leading the most powerful country in the world who thinks he is merely doing God's work and can use this to absolve all moral responsibility.
Obama's not perfect either. He hasn't achieved everything he said he would in his first time, but he is far less dangerous than Mitt Romney.

So if you are going to the polls, check out http://www.factcheck.org/ who are working to expose Romney's lies, don't put the inmates in charge of the asylum.

Vote Obama.

Saturday, 27 October 2012

A question for Bible Aficionados

A thought came to mind this morning.

 If God's displeasure with homosexuality is stated through the passage "You shall not lie with a male as with a woman; it is an abomination." (Leviticus 18:22), then what's their problem with lesbians and transgenders?

 I'm pretty sure there was no passage in the Bible that went along the lines of "thou shalt not have one's cock lopped off and from here on be known as Danielle".

 Hmm...

Saturday, 24 March 2012

Speeding up Azure debugging your MVC application


When debugging an application that is intended for an Azure Web Role, you debug using the Compute and Storage emulators in order to give you a realistic Azure experience. These tools used to take a long time to initialize on Build, meaning debugging your app could take significantly longer than normal. Even though the tools have become a lot quicker, there is still an additional delay when debugging using them.

If, like me, you have just migrated a bog-standard web application to Azure and are not yet using any of the specific Azure features, essentially treating Azure as a web server and nothing else, there is something you can do to speed things up.

In your solution, simply change the start up project from the Azure Web Role to the actual MVC project that is going to be deployed in the Azure Web Role. This way you can debug in the normal way and then deploy to Azure when ready.

Note however, that if you start using any of the Azure features such as Blob, Table or Queue storage, then you just need to change the Start Up Project back to the Azure Web Role project

Saturday, 3 March 2012

Server 8, Win 8 and VS 11 - first impressions

It's been a busy week for Microsoft, releasing the first Beta of Windows Server 8, the Consumer Preview of Windows 8, and the beta of Visual Studio 11. But have the changes they've made been positive ones? These are my first impressions.

Server 8
After experiencing a hiccup with Virtualbox involving only having one CPU assigned to the VM, the install of the Core configuration took less than 15 minutes which I was very impressed by.
The performance is surprisingly good, far exceeding previous experiences with Server 2008 VMs, even Server Core installations. Running a fresh installation running as a domain controller with only 2Gb of RAM results in boot times of less than 15 seconds and really responsive performance from the minimal UI.
I have only one minor gripe from my initial few hours of testing. Despite Microsoft's big push to get admins using Powershell for all their server tasks, therefore eliminating the need for a UI and increasing the server's efficiency, the default shell for server core is still a standard command prompt. I was fully expecting a Powershell Window here. Also, would it kill to make it full screen so I can make full use of my monitor? I know the emphasis is on remoting, but would it kill to support someone logging onto the machine and wanting a full screen command line?

Windows 8
As much as I hate to say it, I expect Windows 8 to be a flop on the desktop, much as Vista was. The reason for this is that it has a serious split personality disorder. As a tablet OS, I like Metro and am even considering a WinPho for my next upgrade. As a desktop OS, I'm pissed about the disappearance of the Start button but think the changes they have made to Windows Explorer are long overdue and a definite improvement.
The problem here is that Microsoft have tried to make an OS that works on the Tablet AND the desktop, and I think that is a massive mistake. As long as you only need to use either Metro or Classic, it will be a fine OS. If you need to transition between the two, the cracks between Windows 8's dual personalities start to show and things start to look awfully shoddy.
I can only hope that Microsoft resolve this before release or we could see the same story of enterprise holding on to Windows 7 far beyond it's life in exactly the same way as they did with XP.

Visual Studio 11.
It seems as if the Visual Studio team have spent a great deal of time since 2010 was released fiddling with icons and trying to make VS11 as retro as possible. The key differences between 2010 and 11 are simple, toolbar headers filled with colons that look straight out of the early 90s. I'm sure I saw them in an old OS but just can't put my finger on which one! There is also the case of the ALL CAPS WINDOW TITLES WHICH ARE REALLY ANNOYING AND EXTREMELY DISTRACTING. Other than this and changing the icon set, I haven't seen any real differences as yet. I can only hope that VS11 grows on me as I use it more.
Friendly warning, if you are using the built in Windows Setup projects, do not install VS11. My boss hasn't been able to build an installer since he installed this, not even after uninstalling it and uninstalling/reinstalling VS2010 and multiple other components.

Verdicts
Bit of a mixed bag from Microsoft here. Hopefully the issues with Win8 and VS11 will be resolved by RTM, and Server 8 is looking like a very promising release. Now they just need to make them all play a little nicer with Virtual Machines!

Wednesday, 8 February 2012

A future Asus hit surely

Two posts in one day, yep, I'm bored and flash Pool can only eat up so much time.

This has apparently been rumoured for a while but has thus far managed to escape my attention. Asus will be releasing a phone that is also a tablet. Add on the keyboard from their Transformer Tablet cum laptop and you've got a phone, a tablet, and a small laptop.

It's called the Padfone, not the most original product name of all time, and is basically a phone that slots in to the back of a screen+battery chassis. You can also dock it with the aforementioned keyboard from the Transformer and you've got yourself a laptop. The Tablet chassis will also charge your phone battery while they're connected.

Scheduled to be released in the first half of this year, if it comes out for a decent price I will certainly be seeking an upgrade when my phone contract expires later in the year.

Android - Unable to update apps on SD Card

I've had my HTC Desire for over a year now and, among the many bugs and annoyances that seem to be sneaking their way in to my daily phone-using experience, the most annoying is the recent inability to update any apps I have on my SD Card. Due to the diminutive size of the Desire's internal storage, ALL of my apps are on the SD Card, making this quite a large problem.

My solution up until now has been to move the offending apps back to the phone, update them, and then move them back to the SD Card.

Fortunately, Nick Damoulakis has a better idea.

Summarised below just in case the original becomes unavailable in the future.


  • Connect your phone to your PC

  • When the connection is detected by the phone, it may ask you if you wish to switch to USB storage. Say yes.

  • From your PC, go to the phone's drive (that should have just appeared in Explorer) and navigate to /sdcard/.android_secure/.

  • Find the file called smdl2tmp1.asec and delete it

  • Disconnect the phone

  • Done!!



Thanks a lot Nick, this has saved me a massive amount of time and hair.