Code Optimization

Interesting things about software development and code optimization

Dropbox and Drive C - Clean disk on Windows and Windows Server

Hello friends,

You are trying to free up a few GBs on drive C? You tried to clean WinSxS folder, you have tried Disk cleanup util and even the Dism.exe but still need a few GBs of free space? ;)

You got to the right place - your problem is Dropbox.

- Go to the Program Files (x86) > Dropbox folder
- Delete all Client XX.XX folders except the latest one

You will be amaized that it will free up to 2-4 GB of space! :)

Thank you and see you ;)


Dropbox as a service (Windows Service for Windows Server)

Hello friends,

Have you searched for a Dropbox windows service so it would synchronize your files and folders on a specific time and without any logged in windows user? I guess yes and as me it seems that you have not found anything appropriate.

The question is not only about synchronization if we talk about windows server but about performance as well. As you know the Dropbox service use a lot of system resources like CPU, HDD/SSD, RAM while it is running and this is crucial for a server because of any server has to use as less resources as possible at any given time.

So that is why I implemented my own workflow to control dropbox. There are two main points:

- run non-GUI Dropbox instance on a specific time frame only

- if there is any dropbox instance outside of the specified timeframe then kill it immediately.

To run the dropbox without GUI and to start synchronizing files I use the following windows task scheduler:

And here is the windows service we will install and run indefinitely to monitor any dropbox process and kill it:

    public partial class Service1 : ServiceBase
        System.Threading.Timer timer = null;
        System.Threading.Thread tt = null;
        volatile bool stop = false;
        var perod = new Setting();

        public Service1()

        protected override void OnStart(string[] args)
            perod.StartFrom = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 25, 0);
            perod.EndTo = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 23, 25, 0).AddHours(1);
            tt = new System.Threading.Thread((Action) =>
                if (timer == null)
                    timer = new System.Threading.Timer(new System.Threading.TimerCallback(KillDropbox), this, 5 * 1000, 60 * 1000);

                while (!stop)

        void KillDropbox(object o)
                if (DateTime.Now.TimeOfDay >= perod.StartFrom.TimeOfDay && DateTime.Now.TimeOfDay <= perod.EndTo.TimeOfDay)

                int pc = 0;
                var proccs = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName.ToLowerInvariant().StartsWith("dropbox"));
                pc = proccs.Count();
                foreach (var proc in proccs)
                        goto ReScan;
                    catch (Exception eex)
            catch(Exception ex)

        protected override void OnStop()
            stop = true;

            if (timer != null)
                timer = null;
            if (tt != null)
                tt = null;

So after all we have a scheduler that runs non-GUI dropbox, dropbox synchronizes all configured files and folders and our windows service kills it outside of time frame.

Note: You should select your own time frame that will give dropbox enough time to synchronize everything.

It is also worth to mention that you will have to login to your server from time to time and update and sign into your Dropbox application in other way it will stop synchronization (something special that relates to dropbox itself).

Thank you, hope that was helpful!


SSL Time and Rating


Today I'm going to share some experience about SSL rating, time, security, performance and why it is better to turn off the RC4 protocol.

Also I did find and would like to share two useful resources that you can use to check your SSL and Website overall performance: to analyze your website from different world locations to analyze your SSL certificate

Using that two tools I did find a few main issues: my IIS server were still using RC4 that is considered non-secure, my DNS resolving time was too long from some points of world and my SSL handshake time was not very fast.

DNS resolving time - is still an issue as it require non-server and non-application actions to be taken to resolve it :(

SSL handshake is not so easy to resolve as well but what I have noticed is that resolving RC4 did speedup overall website loading performance and increase overall security rating.

So first step I would suggest is disabling the RC4 protocol. Lets take a look how to disable it on Windows Server with IIS:

- Open the RegEdit (Win + R >> regedit) and find the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Ciphers

- Right-click on Ciphers >> New >> Key and name it RC4 40/128


- Right-click on RC4 40/128 >> New >> DWORD (32-bit) Value and name the value Enabled


- Double-click the created Enabled value and make sure that there is zero (0) in Value Data field then click OK


- Repeat those steps and create two more keys with the names RC4 56/128 and RC4 128/128 in the Ciphers directory


- Close the RegEdit

In my case it was not required to reboot my server so I hope you will see the result immediately as well using the ssllabs web-tool I mentioned before.

This will give your A Rating for your SSL website security and as I noticed it speed up your website overall loading time (including SSL time) by 1.2-1.5 times.

Hope that will help you as well and let me know if you can add some useful info in comments.

Thank you and see you :)