Pages

Monday, May 2, 2016

SVN pristine copies

Hi! Probably all of us use some sort of the version control system nowadays. At my workplace we are using SVN (and Tortoise SVN as a nice user interface).

Interesting thing about the SVN is that is it using an internal folder (.svn) for its client-side operations. And one of those operations is to store pristine (unedited) copies of the working copy files. Overtime, this gets really big and can really take some space from your SSD drive – especially if you have multiple checkout folders pointing to different branches. It could fill your SSD really quick.

Sometimes there might be really old or big files stored. But you should not edit that folder directly. But you can do it using TSVN! Here is an example result:

And in order to achieve this you should use "vacuum pristine copies" during the cleanup along the deletion of unversioned and ignored files:

Tuesday, March 1, 2016

Developers and UX bugs

I work in a team of 6 developers, most of us are senior-level developers but we have 2 juniors too. And usually we could just happily develop our code and throw up some interface as we seen fit. But recently things changed and I wasn't that happy about it in a beginning.

My software manager approached us and told us that there were introduced heaps of bugs with the latest deployment. And those "bugs" were not the bugs in the codebase - instead they were UI and UX bugs - things were not loading extremely fast or were too hard to reach (for example if the button you have to click is too small). So after that we had to hold up our next deployment for 2 weeks and even start doing hallway testing! He is the boss, but initially that request was greeted with a lot of salt. After all we are simple developers - we want to write code and not to move buttons around the form. And we all know how the design will look like if developers do their best :) Another disturbing thing is that request came out from from blue. (Maybe because our manager was busy checking other projects he has not payed enough attention or just read some UX book...)

Anyway, we were not pleased and even now we can joke about that a lot - like "have you seen that show-stopper bug with wrong font size in that label?". But after some extra thoughts that request seems like something reasonable. After all we develop our application for users, to solve their problems and if they cant use it because the functionality is buried under those layers of crappy interface it is not working. It is almost the same - if the app is not working because of code bugs or if noone can understand how to use it. More than that - after the initial introduction to the systems users might just ignore the feature you have created because it is unusable; it can be really hard to turn them back to the feature later.

So what I am trying to say is that if your team doesn't have a separate designer/UX expert - every software developer should read at least few articles on most common UX/UI mistakes and try to improve the look and feel of your application. Those bugs can be even more dangerous then the regular ones. You can catch the bug in your code with unit test/integration test, but as you developed the feature - you cant really test the UI! You just know it from inside and wont notice the obvious defects. Hallway testing is the solution :)

Good luck and happy coding!

Wednesday, February 17, 2016

How to post the array of guids to the intranet

I thought that sending a bunch of guid to the server should be a trivial task. And from the client side it really is. Slightly harder if you want to build a small helper utility for that...

So the conditions of the problem. We have a Asp.Net web-application, running on the IIS server somewhere in the local network. All the methods are required a domain user authentication. It has a method that accepts posts like:

[HttpPost]
public void ReceiveContactIds(Guid[] contactIds) { ... }

There are a lot of possible solutions, after a quick googling I came got that stackoverflow answer.
Lets use the HttpClient solution! Yep... Unfortunately, it didn't helped as it is. First of all - how to send an array to the method and secondly it has no mention of the authentication process.

But those problems can be solved! That answer was not that helpful, but that one is much better. And we can use DefaultCredentials for current user. As for arrays - I just reused my experience with JavaScript and decided to send a StringContent with JSON. Here is my solution:

    private static void SendContactIds(IEnumerable<Guid> contactIds)
    {
        var credentials = CredentialCache.DefaultCredentials;
        var handler = new HttpClientHandler { Credentials = credentials };

        using (var client = new HttpClient(handler))
        {
            var content = new StringContent(
                     JsonConvert.SerializeObject(new { contactIds }),
                     UnicodeEncoding.UTF8,
                     "application/json");

            var action = "http://intranet.local/ReceiveContactIds";

            var result = client.PostAsync(action, content).Result;
            result.EnsureSuccessStatusCode();
        }
    }