Combining developer work with entertainment

I guess most of us working as IT staff, either it’s development or administration, find joy in our work and enjoy what we do, even off the work. What to do if we want to keep push ourselves further but out of commercial or even open source project and still have fun?
Well, I’ve been looking for a way to get myself out of too much computer gaming and finding some substitute for such form of entertainment that would make me more productive. Of course playing historically based strategies will build up our history knowledge and FPS gaming will keep our reflexes on top, it’s still a percentage of what the gaming is all about. Browsing through the web I accidentally stumbled upon an advert on Facebook from page called ‘CodinGame’ – And guess what? I just can’t get over it.

The whole idea is about something like SPOJ is. If you don’t know it, it’s algorithm solving platform for all the fans of resolving algorithmic problems. CodinGame is more or less about the same but wrapped up with minigames and miniproblems, that let you place it somewhere between gaming and developing yourself.

Games choice

We have several games to choose with along with categorizing them into different difficulties. Every game is about solving different problem with an entertaining wrap up. You can see an example below:

    Minigame choose dashboard

Inside CodinGame IDE

For solving up the problems we’re given with online IDE with possibility to choose different languages including OOP languages like C#, C, C++, VB.NET and Java, scripting languages like Bash, Perl, Python and PHP or functional programming languages like Haskell and Clojure. We’ll make our code face several tests to meet the demands of the riddle.

I won’t push any further with an insight as you’d probably feel interested already and gonna check it yourself!
Either way, please keep in mind that we’re speaking about food for the mind. Don’t forget about other things important things important for your proper rest like sport, that also will get you entertained and – what every personal, business coach will tell you – will get your head refreshed and properly stimulated for further work.

Create directories from path on FTP with Powershell

Probably many of you used FTP to store some data using different libraries of different languages. As PowerShell is based on .NET Framework, I’ll show you up how to check and if necessary, create directories from path on FTP we’re planning to send data to with a simple Powershell function.

Getting started

So we’re starting with a simple FTP path, let’s say:

To make our life a little easier, let’s split it into two parts – $ServerPath, that is a path to root of FTP server and $DirectoryPath, that is local, relative path to directory from FTP server itself. I will simplify that part given the fact that you’ll probably have ftp inputted yourself and hardcoded inside the script. If you want to make that more universal, you can edit code a little what will also parse “ftp://” part.

Hardcoded way:

Easy, universal way using System.Uri:

Let’s also prepare login data so we can actually connect to FTP with credentials we want to:

The idea

Ok, we have everything we need to connect to FTP. However, if we’ll attempt to upload a file to a directory that doesn’t exist on FTP, we’ll get prompted with error:

We need to figure it out how to go down the directory tree, to the target directory.
If you use the ‘easy universal way’, you’ll be already provided with array created from relative path splitted into directories using $FtpPath.Segments:

    System.URI Segments ToString()

If you’re about to go with hardcoded way, split the string with a standard String.Split() method with a “/” as an argument like this:

The output we’ll get will be the same as above, as both System.Uri.Segments and String.Split() will return us an array of strings.
Finally, let’s go through the whole directory tree, adding directories one by one to the path and figuring out whether we need to create directory for ourselves or not. To keep on track with current position in our process, let’s use additional variable called $Position. We’ll also be watching out for some errors with usage of try-catch block:

The reason why we’re letting function continue after catching Net.WebException is that if directory actually exists, $WebRequest will fail to make directory.

Final wrap up

Function itself:

Usage of the function:


Please note that, script is adapted to use Uri with ‘/’ at the end. If you’re intending to use Uri without ‘/’ on the end, you’ll need to make loop work one more time, that is ‘-1’ excluded:

Also, if you’re gonna use $FtpPath.Segments, delete ‘+ “/”‘ from string concatenation on the first line of try block, as it still consists “/”, so no need to add additional one:

Don’t forget to properly add scopes to your code. I’ve not used them for code simplification but you should definitely take care of it!

Thunderbird with Exchange Global Address List

Why even bother?

So you got a fancy, sharp and fluently working AD based on MS Windows Server along with MS Exchange and plenty, plenty of users using Global Address List?
But not all of them have MS Office, do they? That’s not a problem, as long as you want to bother a little with configuring Open Source alternative from Mozilla, that is Thunderbird.
Most of admins would say: if we decided they don’t need MS Office, I don’t think they need GAL.
I beg to differ. Thunderbird with Exchange Global Address List is for standard user that doesn’t use calendars a lot more closer in terms of usability inside AD structures to MS Outlook.
Of course, it’s still not a one-clicker for user inside domain to have it all like Outlook, still: Thunderbird is free and possibility to use GAL is a big plus.

Configuring Thunderbird

Let’s move straight to the settings we’ll be using. Let’s switch from main frontend of Thunderbird to Address Book.

    Address Book

Then, we’ll need to create new address book for this particular Thunderbird user.
Let’s go to File -> New -> LDAP Directory…

    File New LDAP Directory

Finally, we arrived at our target window: setting up connection with LDAP Directory, that is our Exchange Global Address List.

    LDAP Directory settings

Ok. So here comes troubles. Let’s review few things we will need for working this out:

  • Name: We can name it anyway we want. If you’re not using many address books and I guess you don’t, name it just Global Address List or something like that.
  • Hostname: It’s just the domain name that we’re gonna grab address list; for me, it will be
  • Base DN: Ok, so we’re in the domain already, let’s browse for the container. First two entrances will be our domain name, that is: "DN=localwire, DN=pl"
    Next, we need to find Organizational Unit (OU) where we’re keeping our users in. Don’t know what OU and CU is?
    Microsoft’s TechNet articles are great start for finding out: Technet – Organizational Units
    Ok. Let’s say we’re keeping our mail users inside OU called “Mailboxes”. Of course they are categorized in other OU inside our main one, but if we want them all, let’s skip to the parent one. I’m gonna set this up as "OU=Mailboxes", so my final Base DN field will look like this: "OU=Mailboxes,DN=localwire,DN=pl"
  • Port number: If you’re using standard port for either SSL or not secured connection, just leave it as it is. If it’s not default, feel free to change that.
  • Bind DN: You’d ask what’s left, right? We need to login to our domain for data we need. I’ll use my root user for that, that is:

Final settings should look like this:

    Final settings

Last final thing – let’s set Thunderbird to actually auto-lookup for contacts in our brand new LDAP Directory.
While still staying in Address Book window choose Tools->Options from menu toolbar.
Then check the box next to ‘Directory Server’ and choose Global Address List we’ve just set up.

    Final settings options

Wait a second, I’m new to Windows Server – where do I find all the settings?

The fastest way around to find this out is to go to Active Directory Users and Computers (dsa.msc) and check it out yourselves.
Whether you’re fresh Junior Admin or newcomer playing around with AD on some virtual machine, you should have access to that tool.
Let me show you all the info you need is there:

    Final settings options


Two most common issues I’ve encountered connecting Thunderbird with Global Address List:

  • Nothing happens at all after setup: You’ve probably set things up wrong as Thunderbird can’t reach your AD controller at all
  • Password pops up but Thunderbird doesn’t look up anything: Ok, Thunderbird is connecting to your AD and if no credentials error appear, you have connected. What could be wrong is that you’ve entered wrong OU where your users and contacts reside. If you’re administrating a smaller OU that’s a part of greater domain or even domain forest, consider asking global admins out if there’s anything non standard that has been implemented there.