Darren Sim's Code Focus Blog

  • World's largest startup competition and hackathon (AngelHack 2013) comes to Singapore in June 2013

    Entrepreneurship has been on the rise in sunny Singapore over the past years with more and more youths having the guts to take the bold step to be different - stepping out of the comforts of a stable 9am to 5pm desk job to realize their dreams. Although I'm still fairly un-impressed with our startup scene here (in comparison with the US, or something closer to home - China and Korea), I am happy to say that things are going better and instead of complaining, many Singaporeans are taking the step to improve things at home after returning from the valley.

    Photo Creditssgentrepreneurs.com & darrensim.com

    When talking about entrepreneurship in Singapore, we definitely cannot go without mentioning people like Wong Meng Meng and Sim Wong Hu who decided to call Singapore home despite their success overseas.

    Photo Credits: http://www.todayonline.com/business/sme/gushing-ambition

    Of course how can we not have a mention of GushCloud - one of Singapore's hottest startup properties? I first heard about GushCloud when I attended the Startup Asia Singapore conference last year; and their booth was so packed that I've to give it a miss to check out what they were up to. My real interaction with GushCloud only began while I was in a PR & Business development role that dealt with bloggers. Man, I must say that dealing with GushCloud was such a positive experience that I told Freda (from GushCloud) that if one day my blog ever has people reading it and it was good enough to be managed by a blogger management agency, I will queue overnight at their doors and beg for shelter under their wings. You would think that this is all some kind of cult; you bet I thought the same way too. But it was only when I met and chatted with GushCloud founders Vincent and Althea (thank you Sheena, without you, this would never have been possible) that I understand why. It's the drive and passion in them that generated this transfusion of positive forces that inspires and invigorates the entire company. I will not attempt to claim that I know them too well, but just a short chat with any of them and you will feel the vibes. Come June 2013, GushCloud will be hosting the world's largest Hackathon in Singapore at the Amazon HQ Singapore.

    Photo Credits: outsideinmarketing.wordpress.com

    Basically if you've not already heard about it, a hackathon is an event where like minded people come together to "hack together" something and make it work in a very short period of time. The objectives of such sessions is not to produce something that you can readily sell to people, but rather a working proof-of-concept of an idea, that allows others to visualize and actually test the idea using a working model.

    Photo Credits: visual.ly 

    People who attends such sessions includes veterans as well as newbies, who attends hackathons mainly for learning, meeting new people and hoping to do their parts to change the world.

    Read the entire post via http://www.darrensim.com/2013/05/14/worlds-largest-startup-competition-and-hackathon-angelhack-2013-comes-to-singapore-in-june-2013/

    Read more...

  • Creating an Outlook Message File with C#

    I've been working with a government agency lately, and came to notice that the software system they're using dates back to the stone ages. Many a time, the head of department is required to send an email to other head of departments within the same organization, each with a similar content, yet with attachment of nominal roll of folks under each of the departments (PS: HR Stuff).

    On every occasion that I observe, this poor balding guy has to create a template in outlook and copy it 20 times, adding the list of recipients to the individual MSG file and attaching the relevant set of excel/word document file for each of these departments.

    Of course, as a software engineer, the first thing on the mind is definitely, "AUTOMATION"!

    Microsoft Office Outlook does have an interop dll which specifically allows for this to be done, easily! Another altanative would definitely be making use of Visual Studio Tools for Office (VSTO).

    To save you the trouble of looking for this DLL, i've attached a copy to this blogpost.

    1. To begin, let's first create a C# Winforms Project in Visual Studio.

    2. Next, let's add the reference to the interop DLL (attached on this blog post). You should see something like the following.

    3. For the purpose of this tutorial, we'd create a simple windows form which takes in the mail receipient, subject, message and attachment fields. Once you're familiar with how the code (which we'd discuss later), you can work more magic around this (e.g. creating automation processes)

    Note: The Importance ComboBox should have the following values "High","Normal" and 'Low".

    4. Next step, is to wire up the code-behind for the Save Button. It's optional whether you want to register the Outlook Interop in the namespace or not. In this example, I do not so so, thus qualifying the full path in the code (below).

    // Creates a new Outlook Application Instance
    Outlook.Application objOutlook = new Outlook.Application();

    // Creating a new Outlook Message from the Outlook Application Instance
    Outlook.
    MailItem mic = (Outlook.MailItem)(objOutlook.CreateItem(Outlook.OlItemType.olMailItem));

    // Assigns the "TO", "CC" and "BCC" Fields
    mic.To = toTextBox.Text;
    mic.CC = ccTextBox.Text;
    mic.BCC = bccTextBox.Text;

    // Assigns the Subject Field
    mic.Subject = subjectTextBox.Text;

    // Switch the Importance ComboBox to identify the Mail Message Importance Level
    switch
    (importanceComboBox.SelectedItem.ToString())
    {
            case "High":
                    mic.Importance = Outlook.
    OlImportance.olImportanceHigh;
                    break;
            case "Normal":
                    mic.Importance = Outlook.
    OlImportance.olImportanceNormal;
                    break;

            case "Low":
                    mic.Importance = Outlook.
    OlImportance.olImportanceLow;
                    break;
    }

    // Define the Mail Message Body. In this example, you can add in HTML content to the mail message body
    mic.HTMLBody = messageTextBox.Text;

    // Adds Attachment to the Mail Message.
    // Note: You could add more than one attachment to the mail message.
    // All you need to do is to declare this relative to the number of attachments you have.
    mic.Attachments.Add(attachmentOneTextBox.Text,Outlook.
    OlAttachmentType.olByValue,1,"Attachment Name");

    // Save the message to C:\demo.msg. Alternatively you can create a SaveFileDialog to
    // allow users to choose where to save the file
    mic.SaveAs(
    @"C:\demo.msg", Outlook.OlSaveAsType.olMSG);

    Easy isn't it? Besides creating mail messages, you can also create other outlook items such as task, calendar objects and more. More to come in the future posts. Do let me know your comments/views on this post.

     

    Attachments:

     Tutorial in PDF Format (http://darrensim.com/files/folders/presentations/entry9679.aspx)

     Interop.Outlook (http://darrensim.com/files/folders/presentations/entry9680.aspx)

    Read more...