Welcome to 2010 – Where power outages are becoming the norm

Although I’m not sure how great it is, yet. So far we’ve gotten off to a fairly rocky start on the home front.

We’ve had so many power failures, it’s just not funny any more. Our local municipality (Ekurhuleni) seems to be completely unable to prevent these ‘faults’ from occurring. Yeah, ‘fault’s. These ‘faults’ always considerately occur right on the top of the hour. Quite amazing that.

Apart from the occasional Saturday power outage, which usually went off around 9am to come back around 3pm, we have now progressed to large outages. Yesterday, we lost power at 7am. Power returned at 6pm.  Today, the power went off at 6am. Only returned after 5pm.  Going on that schedule, I’m guessing we will be cut at 5am.

It pisses me off that these morons just cut power when they feel like it. It’s worse when I’m sleeping because of my cpap. Nothing worse than waking up because you can’t take a breath anymore.

Jackasses Abound

It’s lunch time, and I walked into a spicy fast food joint in the mall across the way from where I work. It’s fairly early for lunch, being 11h30-ish, but I like it since there’s no crowds, and no queues.

A guy is standing quite far back from the counter with a bewildered expression on his face, apparently looking at the animated menus on the screens above the counter. It looks to me like he’s already ordered, he’s probably just waiting for his food, as I see he’s holding a 1 litre coke bottle in his hands. So I mosey on past him, and move right up to the counter.  The young girl asks me if I want to order.  Next thing, the bewildered guy verbally lays into the girl. I don’t know exactly what was said as I don’t speak the language, but I picked up a few words here and there.  Apparently he was lambasting her for not asking him for his order as he was there first.  She told him that she did ask him, but he ignored her.

He was standing miles away from the counter, staring in to space. What the hell? If you want to order, move up to the counter. Jackass.

Sent Items Management – Outlook VBA

I hate Outlook, but unfortunately one has to use it for work purposes, and since I’m partially responsible for supporting exchange, I tend to get users that whine about how Outlook works out-of-the-box.

By default, when using ‘Send As’ permissions to send email from an attached account, Outlook will save the sent item to your own personal mailbox. This is not desired by a lot of people. Sure, Outlook allows you to change where you want the Sent Item to be stored, but it does not work if you select another mailbox’s Sent Items folder. How annoying.

Fortunately, VBA comes to the rescue.

After a lot of googling, I managed to find some code that would do what I wanted, however it only worked for one additional mailbox, and you had to hardcode the mailbox name and “From” information inside the code. Unfortunately most of the users that work here regularly utilise more than one shared mailbox, so I set about to change the code so it would work dynamically. I’ve never coded in VBA before, and have barely touched VB before this (hello login vbscripts), so there are probably much better ways to achieve this.

To install the script, copy it into the clipboard, run Outlook, press ALT+F11 to open the macro editor, expand Project1, expand ‘Microsoft Office Outlook Objects’, and double click ‘ThisOutlookSession’.

Paste the code into the window on the right hand side. Save the macro, then restart Outlook.

You don’t need to change anything in the code, it just works.


' 03 November 2009
' Sent Items go to the correct mailbox when using Send-As permissions
' Run Outlook, press ALT+F11, go to ThisOutlookSession, and paste the code in.
' Restart Outlook
'
Private WithEvents objSentItems As Items
Private MailItem As Outlook.MailItem
Private lo_Folder As Outlook.Folder
Private ar_FolderNames() As String
Private RunSentItemsEvent As Boolean
Private ar_SentStoreID() As String
Private ar_SentEntryID() As String
Private intFolderUBound As Integer

Public Sub Application_Startup()
Dim sfCount As Integer
 If FindAdditionalStores = True Then
 'Code only executes IF there are additional mailboxes attached.
   Set objSentItems = Application.Session.GetDefaultFolder(olFolderSentMail).Items
   'For speed, causes the SentItems_Add event to fire only if there are mailboxes attached. No point otherwise.
   RunSentItemsEvent = True
   'Set this to reduce calls to UBound(ar_FolderNames)
   intFolderUBound = UBound(ar_FolderNames)
   'Initialize the array
   ReDim ar_SentStoreID(0 To intFolderUBound)
   ReDim ar_SentEntryID(0 To intFolderUBound)
   'Retrieve ID for accessing non-default sent folder
   For sfCount = 0 To intFolderUBound
       getStoreFolderID ar_FolderNames(sfCount), sfCount
   Next
 End If
End Sub

Sub getStoreFolderID(StoreName As String, Idx As Integer)
'Retrieves the StoreID of the "Sent Items" folder for the specified mailbox
  Dim Store As Object
  Dim StoreFolder As Object
  Dim i As Integer
  Set Store = Application.GetNamespace("MAPI").Folders
  For Each StoreFolder In Store
    If StoreFolder.Name = StoreName Then
      For i = 1 To StoreFolder.Folders.Count
        If StoreFolder.Folders(i).Name = "Sent Items" Then
           ar_SentEntryID(Idx) = StoreFolder.Folders(i).EntryID
           ar_SentStoreID(Idx) = StoreFolder.Folders(i).StoreID
           Exit For
        End If
      Next
    Exit For
    End If
  Next
  Set Store = Nothing
  Set StoreFolder = Nothing
End Sub

Function FindAdditionalStores() As Boolean
'Retrieves the additional attached mailboxes
 Dim mCount As Integer
  mCount = 0
 For Each lo_Folder In Application.Session.Folders
    If InStr(lo_Folder.Name, "Mailbox") <> 0 Then
'Ignore the default mailbox.
    If lo_Folder.Name <> Application.Session.DefaultStore Then
      'Populate and resize the array
         ReDim Preserve ar_FolderNames(0 To mCount)
         ar_FolderNames(mCount) = lo_Folder.Name
         mCount = mCount + 1
      End If
    End If
 Next
 FindAdditionalStores = IsArrayAllocated(ar_FolderNames)
End Function

Private Function IsArrayAllocated(Arr As Variant) As Boolean
' Thanks to http://www.cpearson.com/excel/isarrayallocated.aspx
' for this code
  On Error Resume Next
  IsArrayAllocated = IsArray(Arr) And _
    Not IsError(LBound(Arr, 1)) And _
    LBound(Arr, 1) < = UBound(Arr, 1)
End Function

Private Sub objSentItems_ItemAdd(ByVal Item As Object)
'Fires when a mail hits the default "Sent Items" folder.
Dim fCount As Integer
fCount = 0
  'Safety Check. No point in running the code if there are no additional mailboxes.
  If RunSentItemsEvent = True Then
    If TypeOf Item Is Outlook.MailItem Then
      With Item
        Set MailItem = Application.GetNamespace("MAPI").GetItemFromID(.EntryID, .Parent.StoreID)
      End With
      For fCount = 0 To intFolderUBound
        'Don't know if this code will work outside of this environment. Essentially it just strips the text "Mailbox - " from the folder name
        If MailItem.SentOnBehalfOfName = Right(ar_FolderNames(fCount), Len(ar_FolderNames(fCount)) - 10) Then
            Set DestinationFolder = Application.Session.GetFolderFromID(ar_SentEntryID(fCount), ar_SentStoreID(fCount))
            MailItem.Move (DestinationFolder)
        End If
      Next
    End If
    Set MailItem = Nothing
  End If
End Sub

I hate traffic!

This week has been a trial with regards to getting to work and getting home from work.  The traffic and problems on the road have reached nightmare levels.

On a good day, it takes me about 40 minutes to get to work in the morning. The same for getting home. On average it’s about 50 minutes to an hour.

On Tuesday on my way home, there was supposedly a breakdown at a particular spot on my route, not far from work. No problem, it’s happened before and there hasn’t been major issues.  30 minutes later, having travelled exactly 3km from the office, I decided to turn around and try another route out. Queue was just as long, took another 10 minutes to travel a kilometre, to discover that a dead traffic light was causing that particular issue. It took an hour and a half to get home, a whole 36-odd kilometres.

Yesterday morning, there was an accident on the highway.  Since there is major construction going on, there are barriers everywhere, so there’s no real way to easily get around the accident. Took an hour and a half to get to work. Yay.

This morning, another accident on the highway – a bit further along than the previous one, however traffic moved along a lot faster. As I get into the area near my office, I notice that the traffic on one particular road I use is bumper to bumper. Something that is fairly unusual, so I decide to take an alternate route. Big mistake.  A dead robot there delayed me by a further half an hour.

And to add insult to injury, a large stone took a huge chip out of my car’s new windscreen. Colour me not-impressed.

Squeaky Clean

I’ve removed all the twitter rubbish. I don’t really see the need to have this linked to that. I don’t know how long the twitter fad will last with me, quite honestly.

Twatters

Damn. My blog has become a mirror for twitter. I really should switch off that stupid plugin and do something useful here. Like blog. Except that implies that this blog is useful. It ain’t.

I aten’t dead!

This blog isn’t dead! It’s just lying fallow.

So there.

moo