Cake – A Political Nightmare.

Cake

At my place of work, pretty much like other places of work I imagine, it is customary to take cakes into work for everyone on your birthday. I do not, however. And i’d like to take a little time to explain why.

Many moons ago, while I was working for the same company (but a different department), I used to adhere to the cake tradition. And all was well. One year however, I did not. Now I can’t remember the reason why, whether I was skint, or I forgot, or I just didn’t pass the cake shop on the way into work that day. It doesn’t matter – the upshot was that there was no cake from me on that particular day in September. And nothing was said. Well, not much anyway. There might have been a couple of questions about the missing cakes but certainly not enough for me to remember. So the day passed without incident.

A few weeks later, there was another birthday. This time too, the birthday boy did not supply cakes. This time however, I did hear the complaints. Boy, did I hear the complaints. My fellow co-workers whinged and whined about the lack of cakes for a full day, but never to his face. A full fucking day. Like they had been denied the cure for cancer. Or that he had broken the (hitherto unknown) 11th commandment. Or that he had murdered a small puppy. With a cake.  Or that they had some god given right to eat cake on someone else’s birthday.

Cake

It got me thinking: Did this happen when I didn’t take the cakes into work? I imagine so. I’m not so conceited to think that I would be immune to the bitching and backbiting when I dared to defy the almighty law that states ‘You must take cakes into work on your birthday’. So I imagine that I got a lot of stick (behind my back) and got slagged off rotten (behind my back). It got me thinking, what would happen if I forgot to take cakes in again? Or what if I was ill on that day, or skint? Or what if I just exercised my own free will and chose not to take cakes in on that particular birthday? Would I lose friends? Be ostracised? Would I wake up to find a horses head on the pillow? I am joking for effect of course, but I still consider this to be an important issue. I’m sure that there are evolutionary reasons for the reaction I got (or didn’t get, as it wasn’t within my hearshot) to do with the human desire to be part of a group, or ritualistic reasons, but it still fucking annoys me.

So I took myself out of the birthday cake game. And for this reason I also do not eat cakes that other people have supplied on their birthday, out of principle. It was such a mountain out of a molehill that I resolved to no longer be part of it. I know a few people think that I don’t partake because i’m tight (and now that I have a family to bring up, that’s a little more accurate than it was), but it’s not. And I know people still whinge about my lack of cake supply, but I don’t care. Honestly – you should see ‘cake day’. It’s like some people have never seen a fucking cake before.

If I ever decide to buy a cake again, it would be this one.

http://en.wikipedia.org/wiki/Birthday_cake

Powershell Script for emailing PPCoin price on Vircurex

I have recently found myself checking the price of PPCoin on a daily basis. Obviously this sort of thing can be automated with a script, so here it is. Powershell was brought into service for this one: I haven’t got much experience with Powershell so had to google my way around, and learnt something in the process.

The Powershell Script

$url = "https://vircurex.com/api/get_info_for_currency.xml"
$xml = [xml](new-object system.net.webclient).downloadstring($url)
$from = "***@***.com"
$to = "***@***.com"
$subject = "PPC"
$server = "servername"
$smtp=new-object Net.Mail.SmtpClient($server)
$smtp.Send($from, $to, $subject,$xml.hash.PPC.BTC."highest-bid".get_InnerXml())

Obviously you’ll need to set the from and to addresses, and the servername correctly for your environment. Also, as I am using this on a domain joined PC, it uses the default credentials so I didn’t need to set any on the SmtpClient. I’m sure the above script could be improved so that you pass the to address in via an argument, but this is a quick and dirty hack so it doesn’t really matter. However, it definitely would benefit from some exception handling…

Scheduling the Script

I then saved this script and scheduled in Windows using the Task Scheduler. I had to use the full path of the 32-bit Powershell executable (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe on my Windows 7 box), and used -Command “D:\PPC.ps1”  for the arguments (where D:\PPC.ps1 is the full path of the script):

Powershell Scheduled Task

And there you go! Powershell to the rescue.

As a sidenote, I have had issues sending emails when using the SmtpClient in .NET and a domain-joined PC & user. If you’re getting a ‘Client does not have permissions to send as this sender‘ exception, then you need to ensure that the user ‘NT AUTHORITY\SELF’ has ‘Send-as’ permissions on the user in question. The following link helped me out with this issue:

http://social.technet.microsoft.com/Forums/exchange/en-US/e763de97-88a1-494d-9841-4f3a466b5604/exchange-550-571-client-does-not-have-permissions-to-send-as-this-sender