Recently I had some problems connecting with DataGrip to my Microsoft SQL Server 2012 instance provided as part of purchased web hosting plan.

By some reason my connection was always rejected with following error message:

The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target".

Microsoft’s documentation (available here) turned out to be very helpful. According to it, the initialization is always encrypted with JBDC and I actually should focus on encrypt and trustServerCertificate parameters, setting both to ‘true’. In this configuration client-side (my tool), was expecting SSL traffic and had disabled any checks done over the certificate itself.

Partial success, for now the error message got changed to:

The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "java.security.cert.CertificateException: Certificates do not conform to algorithm constraints".

This lead to a conclusion that the certificate is invalid in more ways. Little help from stackoverflow.com revealed it might be so old that the latest Java 8 OpenJDK had put it on blacklist due to weaknesses and vulnerabilities of used MD5 signatures. Brutal and effective patch is then restored it back and whitelist ;-)

Edit file: %ProgramFiles%\JetBrains\DataGrip 2017.1.5\jre64\lib\security\java.security

and remove MD5 and MD5withRSA

from those two variables: jdk.certpath.disabledAlgorithms and jdk.tls.disabledAlgorithms.

Now, connection succeeded and we are ready to play with the database.

You are right. At this point I should stop and let them know about the issue and ask about certificate upgrade. Thanks.


It’s been quite a while since I upgraded my machine for daily development. Till four months ago I was still using my 2011’ MacBook Pro with some additional upgrades done down the line (described them here and here). Nevertheless it was more often seen it became older and older and somehow the speed and work comfort was insufficient anymore.  

Once decision was made, for the first time in my life I wanted to buy my next laptop wisely. So I wrote requirements!:

  1. it should be small – 13’’ would be preferable, but 15’’ should go fine too
  2. it should have some brand new processor and 32GB RAM or more
  3. display should support al least FullHD on IPS matrix; 4k resolution is probably unnecessary for 13’’
  4. it should allow to plug-in 2 external monitors simultaneously
  5. must have 1Gbit Ethernet socket (as there is no WiFi inside an office due to security reasons)
  6. should support 2 SSD drives, at least one must be PCIex NVMe
  7. good secondary graphic card will be a huge advantage (as the MacBook had only the build-in Intel HD Graphics 3000 – slow as a 3-wheel kid bike)
  8. doesn’t need DVD drive
  9. should support Windows 10 Pro x64
  10. BT 4.0, TPM module, SD-card reader will be an advantage
  11. not too heavy

And then started looking around for anything matching my wishes. Unfortunately, and I cried about it a lot, Apple was out almost immediately. Since I wanted to max the spec on the day one and never care about an upgrade in the future, MacBooks turned out to be extremely expensive. 2 sometimes even 3 times more than the competition with similar components. That is insane. I like them, but I am not such a fan boy.

Also Lenovo jumped out from the competition, but mostly by my personal preferences. Few years back I had two business editions of T51 and I was using them happy until both died almost at the same time, few months after warranty period. I don’t want to say anything bad about Lenovo’s quality as they were really good hardware. It just kept worrying me at the back of my head.

My final choice became: MSI GE62VR Apache Pro i7-7700HQ/32GB/1TB GTX1060 with Samsung 512GB 960 Pro M.2 2280 NVMe as the main drive. After those four months of usage I am really satisfied with this laptop.


  • it’s fast (~9 seconds for cold boot to be logged in in Windows, including PIN typing)
  • the quality of colors of the build-in display in really impressive
  • supports 3 displays simultaneously (2 externals and the build-in), that gives lots of space for developer
  • Steelseries keyboard, which is stunning with key reprogramming (changed Pause/Break into Delete) and customizable colors
  • touchpad can be disabled with a shortcut (Fn+F3)
  • it has GTX 1060 and let play newest games with really good quality and framerate
  • is VR-ready


  • it almost can’t work without power supply (1.5h if doing only presentation with only HDMI projector attached; when Visual Studio or similar IDE is running it goes down to less than 1h)
  • the given HDD is extremely noisy, I mean it!
  • playing newest games on ultra might make the center of keyboard really hot (65C or more)
  • chassis bottom is plastic not aluminum

I hope you find it useful.


In my recent post I have shown, how to track web requests issued against remote server I don’t have a control over. Curious reader could ask at this point – but what have I broken this time? And the answer is as usual – personally did nothing wrong, I was just doing my job. I had to port some HTTP related code from using Windows Runtime-specific HttpClient (i.e. Windows.Web.Http.HttpClient) to also work outside the sandbox on a regular .NET 4.5 desktop version and start using System.Net.Http.HttpClient instead.

Then I noticed that everything worked fine except multipart form-data submissions using POST method that were behaving unexpectedly bad (timeouting or returning an error immediately). There was nothing unusual mentioned on MSDN, so I started to compare sent requests using both implementation. It turned-out of course, the problem lied deeper in the framework in a value serialized as a *boundary* part of the Content-Type field. HttpClient from the System.Net.Http somehow was adding extra quotes around it, while the one from Windows.Web.Http didn’t. Even though server should accept both values (according to RFC2046 section 5.1.1), it actually didn’t and was waiting for correct *boundary*.

Simple fix by manually overwriting the guilty header can look like that:

var request = new HttpRequestMessage(HttpMethod.Post, url);
var boundary = "--" + Guid.NewGuid().ToString("D");
request.Content = new MultipartFormDataContent(boundary);

// fill content
// ...

// update the Content-Type header to be accepted by the server:
request.Content.Headers.TryAddWithoutValidation("Content-Type", "multipart/form-data; boundary=" + boundary);

// send request:
var result = await _client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, token);


World saved. Job done!


I am a freelancer more than 5 years now. After so much time I started having this (really stupid as turned out) idea of abandoning that state of mind. Maybe I could hire myself for a big company, wear the uniform and work only limited part of the day (instead of whole time) and generally rest for some period. So as I usually never reply to headhunter offers, I did a try. Somewhere in December last year, ~3 months ago, I received invitation from Dolby Digital of my home city Wrocław, Poland – to join their team as Windows Phone developer and port Dolby Voice to Windows Runtime etc. The project tempted me a lot, if you look on main page and compare with my skillset. After all, there is only one most important aspect of being a developer – code what you like to code and makes you keep smiling. Then we started to talk…

And each time we did talked it was worse and worse. I don’t want to personally blame anybody. Here is just my version of this story and maybe they work this way for such a long time, they think it’s normal. Believe me, it’s NOT. The way Dolby tries to hire people in Wrocław is kindly saying cheating and making fool of interviewee. I am pretty sure they would never behave like that in US or in Germany. They made me so angry I even created this post! You have been warned and you apply for any position there at your own risk.

After few calls we agreed on facts like – I am already mobile/embedded developer, I have experience with Windows/Windows Phone, I know C/C++/C#, I submitted few dummy apps through Windows Phone Marketplace, I already have a contract till mid February with an option to extend it (so I am secured!) and in general I am well motivated to join their company. We had roughly 1.5 month to agree to anything or give up. Then beginning of January I had first 2h interview with a promise that if we meet again it will be much longer interview. I remembered two things after. First – comments I need some extra training about C++. Sure I need! but I wasn’t applying for a guru position. Secondly – really strange questions about salary. I already answered, how much I would like to earn, during very first calls via phone and now we immediately turned into this dead-end road of opposite questions like: why that much, what would be the minimal amount I would work for etc. That’s not how you bargain, especially if I had never heard any counteroffer.

Then it took 3 weeks to invite me for a second interview. Amazing fast process, right. Pretty obvious they were looking for some other candidate, maybe a cheaper one, don’t know, but also means I was not so weak developer they tried to sell me before. Or maybe they wanted to just give me more time to learn C++ before another round ;). Anyway, I expected promised whole-day testing of my skills. Ended up with a 1h meeting about C++ and C++11. And again questions, why I have such a high salary expectations, what would be the minimal amount I would work for etc. But at the same time no one wanted to answer my doubts about anything, as we were in the middle of recruitment process.

There was one thing I liked during this interview – when I was asked to write some program on a paper. I don’t know why I hate this type of coding. Probably because I just can’t have IntelliSense in my pen. I do like this blog post on codinghorror.comWhy Can’t Programmers… Program? But the problem I was asked to solve was a bit more complicated than simple loop from 1 to 100. My task was to write an input processor to:

Evaluate expressions for a simple variant of Lisp, with identities: a, (a,b). Example expression: (((a,b),a),(a,b)).

I didn’t manage to produce it on paper. After few minutes, time for the whole meeting ran out and we agreed I’ll make it on a PC later at home. Good for me. Then following is my reply. I just didn’t want this code to be thrown away. Additionally, somehow I didn’t find a reason, why I should make it a C++ class and stayed with plain C.


#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <cassert>

static bool InternalExpressionValidator(TCHAR *expression, size_t length, size_t &i)
    assert(i < length);

    // single-char variables are the only one supported:
    if (_istalpha(expression[i]))
        return true;

    if (expression[i] == '(')

        // is the left variable defined?
        bool leftVar = InternalExpressionValidator(expression, length, i);
        if (!leftVar)
            return false;

        // is the separator in place?
        if (expression[i] != _T(','))
            return false;

        // is the right variable defined?
        bool rightVar = InternalExpressionValidator(expression, length, i);
        if (!rightVar)
            return false;

        if (expression[i] != _T(')'))
            return false;

        return true;

    // incorrect symbol!
    return false;

bool CheckExpression(TCHAR *expression)
    if (expression == nullptr)
        return false;

    size_t i = 0;
    size_t length = _tcslen(expression);

    if (length == 0)
        return false;

    bool result = InternalExpressionValidator(expression, length, i);

    // check if validation of the whole text was done:
    return result && length == i;

And some way to actually test, if it works at all:

 * Execute expression validation and print the result.
static void Validate(TCHAR *expression, bool expectedResult)
    static CodeTitans::ExpValidator validator;
    bool result = validator.CheckExpression(expression);

    std::wcout << _T("Validating: \"") << (expression != nullptr ? expression : _T("")) << _T("\": ");

    if (result == expectedResult)
        std::wcout << _T(" [OK]") << std::endl;
        std::wcout << _T(" [FAILED], expected: \"") << (expectedResult ? "true" : "false")
                   << _T("\", but was \"") << (result ? "true" : "false") << _T("\"") << std::endl;

        // just for testing

int _tmain(int argc, _TCHAR* argv[])
    // verify some common examples:
    Validate(nullptr, false);
    Validate(_T("a"), true);
    Validate(_T("(a,b)"), true);
    Validate(_T("(a"), false);
    Validate(_T("(a,(a,b))"), true);
    Validate(_T("((c,(d,e)),(f,g))"), true);
    Validate(_T("(((a,b),a),(a,b))"), true);
    Validate(_T(")"), false);
    Validate(_T("a,b"), false);
    Validate(_T("(a,b"), false);
    Validate(_T("(a,b)c"), false);
    Validate(_T("d(a,b)"), false);

    return 0;

Even this nice code didn’t help me much. I hope it helped anybody at Dolby to implement another great feature and that their software will be better somewhere at the end of the day ;)

However my sad story continued. I had to wait yet another 2 weeks to receive any response about my progress and if we are closer to hiring or not. Instead of any assessments or results I was invited for final test, this time about C# and summary with some manager. That would be fine even despite the fact it was supposed to be executed on 18th February. It is 4 days after I kindly asked at the very beginning to finish the whole process. After 1.5 month I had no vision, where we are going and when it will end. What will happen, if after this test they ask me to postpone it yet another 2-3 weeks? I really like that corpo-lazy style and hiding behind processes. Pity no one tried to wear my shoes. Imagine I work for myself, I have my own customers and if I don’t work, I don’t have a salary and I am starting to become seen as unstable and irresponsible contractor. Can I afford to do that? No, I don’t. I hate, when someone breaks the promise and doesn’t care about me and my time. There wasn’t even single proposal from Dolby till that time nor any sign, if they are interested or not. Somehow my whole enthusiasm, I had at the beginning, disappeared. That’s why my assumption was, this is the final interview.

Then suddenly Dolby made all the decisions crystal clear somehow. The meeting was scheduled for 10:00 AM, so they called me at 3:00 PM a day before. Time I was picking up my daughter from a dancing lesson. They again were totally not interested in my experience, skills etc. The most important subject was the minimal amount of salary I would like to work for them. The hiring process was still not finished, so they couldn’t offer me anything, even a good word and I was again supposed to guess, what amount would fit them. So I said, since tomorrow I will meet with the division manager I will revisit my proposal and we will eventually agree on something. But no, tomorrow was too late, I was supposed to tell the amount now, really, REALLY? This is, how you make business?

One hour later I got an email, saying I was rejected as a candidate. Couldn’t afford a call even ;)


Post Scriptum.

1.5 month hiring process that didn’t explain anything. I didn’t hear conclusions, no single proposal. They are giving the job, so only they can demand and the rest doesn’t care. OK I got the initial theory that I need to learn more. But this is actually what I do each day! I just wish people at Dolby did the same. Let this post be a reminder of their lesson. Have fun and good luck.

Just checked their website. Wrocław – suddenly 4 opened internship positions for students to write applications for Windows Phone and port Dolby Voice framework. Sounds familiar. Only 4, instead of a single pro? Nice deal. Probably someone will receive a bonus.