From my colleague I received an email but with unknown type : winmail.datHe should send me office document.I asked him to sent it again, he forwarded the email again but I still received winmail.dat in attachment.

After googling about this I found out that winmail.dat is generated by Outlook (I using thunderbird).From About.com :

It’s Outlook’s fault, in a way. Or the recipient’s email client’s. If Outlook sends a message using the RTF format (which is not very common outside Outlook) for bold text and other text enhancements, it includes the formatting commands in the winmail.dat file. Receiving email clients that do not understand the code therein display it as a stale attachment. To make matters worse, Outlook may also pack other, regular file attachments in the winmail.dat file.

Fortunately, you can get rid of winmail.dat altogether by making sure Outlook does not even try to send mail using RTF.

And there’s also a way to disable this feature on Outlook. You can open it for more detail.I would focus on how non-Outlook user can handle this format.I know I can not ask all Outlook user who sent me attachment to turn off this feature.

So I search a program to open this content type “application/ms-tnef”.I encounter this good console program : WMdecodeYou just need to extract this. When running the program it’ll search winmail.dat in current folder and extract it.The program working great although it just console application, no GUI.

Other tool I search is add on for Thunderbird.I found : LookOutThis add on will automatically decode the winmail.datAlso working great but it won’t decode winmail.dat in emails that you received before installing the add-on.So I think it’ll only decode winmail.dat on new email received.

Often we want to make sure that only 1 instance our application running.
Because something terrible could happen when more than 1 instance running (for example the whole server would exploded and that would make you fired 😉 )

Nevertheless what the reason, one of the way to make this happen is by creating a lock file as a sign that an instance is currently running.
So you application will have this flow:

Check if the lock file exists.

Try to delete the lock file to check if there’s really a running process lock the file.

Get the file lock.

If failed to get the lock file, show error that there’s already an instance running –&amp;amp;amp;amp;amp;amp;gt; the end

If successfully get the lock then go on with your application want to do.

When application ended/closed release the lock and delete the file lock.