Fork me on GitHub

I would see ideas in dreams. My mind was bursting with ideas. I would wake up in the middle of the night. In dreams, I would have visions of code.

Once you decide on your occupation, you must immerse yourself in your work. You have to fall in love with your work. Never complain about your job.

You must dedicate your life to mastering your skill. That’s the secret of success and is the key to being regarded honorably.

I’ve seen many software developers who are self-critical, but I’ve never seen another software developer who is so hard on himself.

  • He sets the standard for self-discipline.

  • He is always looking ahead.

  • He’s never satisfied with his work.

  • He’s always trying to find ways to make the code better or to improve his skills. Even now, that’s what he thinks about every day.

A great software developer has the following five attributes:

  • First, they take their work very seriously and consistently perform on the highest level.

  • Second, they aspire to improve their skills.

  • Third is cleanliness. If the code doesn’t feel clean, the program isn’t going to perform well.

  • Fourth attribute is impatience. They are not prone to collaboration. They’re stubborn and insist on having things their own way.

What ties these attributes together is passion. That’s what makes a great software developer.

A great software developer must have all of these attributes.

A great software developer must be a perfectionist.

How to print your inbox, including subfolders and mail items

open System.Runtime.InteropServices
open Microsoft.Office.Interop.Outlook
 
let printTreeStruture l =
    l |> List.map(fun n -> 
        printf "%O" (String.replicate n " ")
        printf "%O" "|") |> ignore
    printf "%O" "- "
    ()
 
let printItems l (mi:MailItem) =
    printTreeStruture l
    printfn "%O" (mi.Subject)
 
let printFolder l (mf:MAPIFolder) =
    printTreeStruture l
    printfn "%O" (mf.Name.ToUpper())
 
let items l (f:Items) =
    for i in f do
        match i with
        | :? MailItem as mi -> printItems l mi
        | _ -> ()
 
let rec folders l (f:Folders) =
    for mf in f do
        printFolder l mf
        items (l @ [1]) mf.Items
        match mf.Folders with
        | :? MAPIFolder -> ()
        | _ -> folders (l @ [1]) mf.Folders
 
[<EntryPoint>]
let main argv = 
    let o = new Microsoft.Office.Interop.Outlook.ApplicationClass()
    let mapi = o.GetNamespace("MAPI")
    let mv = System.Reflection.Missing.Value
    let f = mapi.GetDefaultFolder(OlDefaultFolders.olFolderInbox)
    let exp = f.GetExplorer(false) 
 
    mapi.Logon(mv,mv,mv,mv)
 
    printFolder [] f
 
    folders [0] f.Folders
 
    try
        Marshal.ReleaseComObject(o) |> ignore 
    with
        | exn ->
            let innerMessage =
                match (exn.InnerException) with
                | null -> ""
                | innerExn -> innerExn.Message
            printfn "An exception occurred:\n %s\n %s" exn.Message innerMessage
    0

The only dependency is the Microsoft.Office.Interop.Outlook assembly

Assembly

The output will be like:

-INBOX
|-FOLDER1_NAME
| |-SUBFOLDER1_NAME
| | |-Email1_Subject
| | |-SUBSUBFOLDER1_NAME
| | | |-Email1_Subject
| | | |-Email2_Subject
| | | |-…

If you have the issue that not all messages are retrieved, follow this kb article: Read more at Only a subset of your Exchange mailbox items are synchronized in Outlook 2013

But the trick is to set the Mails to keep offline slider to All: All

And remember to release the COM object.

JavaScript is the most used programing language on GitHub (21% of all the projects, https://github.com/languages/). All of us that have worked with this programing language, know that it’s very difficult to find errors while writing the code, as it is with all other dynamics typed languages. This is where FunScript enters the picture, by giving the possiblity to write in F#, a strongly typed programing language, and then by compiling it to JavaScript. But haven’t we heard this before? Write in a strongly-typed language and then compile to JavaScript (CoffeScript, Haxe, Cappuccino, Dart, TypeScript, …). Yes, but the main difference between FunScript and other frameworks, is that it doesn’t rely on a FFI (Foreign Function Interface) but on TypeProviders which makes the Framework very easy to extend.

FunScript supports REST + TypeScript, among others as TypeProviders. This way you can rely on other to write them (d3.d.ts, google.maps.d.ts, jquery.d.ts, jquerymobile.d.ts, jqueryui.d.ts, node.d.ts, …) and if you need a special library you can create your own TypeScript declaration file and contribute to expand the FunScript community.

Link to slides: Slides

And for more information (and video soon): Open Source Days 2013

PST File Format SDK

Why did I tried out this framework PST File Format SDK? I recently changed jobs so I wanted to make an automated application that would retrieve some e-mails from a special folder from inside my .PST file and convert the single e-mails + attachments to blog posts.

I found out that this library is pretty much broken so I stopped working with it but if somebody else wants to build it on their Mac OS X, here is a small description on how to do it:

Error when compiling on Max OS X 10.8.2

[ mon@mba-2 pstsdk_0_3_0 ] CC=gcc-mp-4.4 CXX=g++-mp-4.4 cmake .
[ mon@mba-2 pstsdk_0_3_0 ] make 
Linking CXX executable pstsdk_test
Undefined symbols for architecture x86_64:
  "_libiconv", referenced from:
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in highlevel.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in highlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in pstlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in utiltest.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in utiltest.cpp.o
  "_libiconv_close", referenced from:
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in highlevel.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in highlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in pstlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in utiltest.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in utiltest.cpp.o
  "_libiconv_open", referenced from:
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in highlevel.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in highlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in pstlevel.cpp.o
      pstsdk::bytes_to_wstring(std::vector<unsigned char, std::allocator<unsigned char> > const&) in utiltest.cpp.o
      pstsdk::wstring_to_bytes(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) in utiltest.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [test/pstsdk_test] Error 1
make[1]: *** [test/CMakeFiles/pstsdk_test.dir/all] Error 2
make: *** [all] Error 2
[ mon@mba-2 pstsdk_0_3_0 ] 

How to solve error

You need to ensure that the correct iconv is used, /opt/local/lib/libiconv.dylib and not /usr/lib/libiconv.dylib. This can be done by adding a hint path to the find_library function in CMakeLists.txt:

# Use iconv if we have it.  This is required on non-Win32 platforms,
# because we don't necessarily know the encoding of wchar_t.
find_library(ICONV_LIBRARY
  NAMES iconv
  HINTS "/opt/local/lib/")

Once you have cleared out all the CMake files you can run once again:

[ mon@mba-2 pstsdk_0_3_0 ] CC=gcc-mp-4.4 CXX=g++-mp-4.4 cmake .
[ mon@mba-2 pstsdk_0_3_0 ] make
Scanning dependencies of target pstsdk_test
[ 14%] Building CXX object test/CMakeFiles/pstsdk_test.dir/btreetest.cpp.o
[ 28%] Building CXX object test/CMakeFiles/pstsdk_test.dir/databasetest.cpp.o
[ 42%] Building CXX object test/CMakeFiles/pstsdk_test.dir/disktest.cpp.o
[ 57%] Building CXX object test/CMakeFiles/pstsdk_test.dir/highlevel.cpp.o
[ 71%] Building CXX object test/CMakeFiles/pstsdk_test.dir/main.cpp.o
[ 85%] Building CXX object test/CMakeFiles/pstsdk_test.dir/pstlevel.cpp.o
[100%] Building CXX object test/CMakeFiles/pstsdk_test.dir/utiltest.cpp.o
Linking CXX executable pstsdk_test
[100%] Built target pstsdk_test
[ mon@mba-2 pstsdk_0_3_0 ] 

Alternative: pstsdk.net: .NET port of PST File Format SDK

It looks like the author is also working on a .NET port of his MC++ version:

pstsdk.net: .NET port of PST File Format SDK

Remark: This version requires that the MC++ PST SDK is built on your local computer so …