środa, 29 listopada 2017


Have you ever manualy copy C# class to TypeScript class (in example from xyzViewModel.cs to xyzViewModel.ts) ??
Now, thanks to free visual studio plugin you can make simply 'copy/paste" and whole conversion from C# class to TypeScript class will be done automaticly.

wtorek, 31 października 2017

.net developer days 2017 (conference)

It's been over a week since conference .net developers days 2017 ( link to conference page ) in which I could participate thanks to my contractor Conscia A/S The .net developer days is the biggest, official microsoft .net conference in Poland and one of the biggest conferences dedicated to .net framework in Europe. This 2017 edition was located as previous in Warsaw and took 3 days (one day workshops, and two days of conferences). I took part only in conferences. 

Here are my thoughts about this conferences. This thoughts are not representative and some aspects are omitted. They are just my own thoughts about this conferences. I don't plan to discuss every presentation that I participate. If you are looking abstract of presenations it's the wrong place. 

The good:

- Dino Esposito -> my colleagues from work had very good memories of Dino from last year and they could not wait for him. If they could not wait for him, that means me either. And I was not disappointed. Dino was one of the bright star of that conference and I remember him very warmly. He had 3 presentations:
- ethics in work / conferences. Don't work for technology buzzwords. Work for your client needs.
- new functionality of SQL Server 2016 and 2017 -> every table will now can have it's own history (second built-in table for storing changes history) 
- UI session -> user on each platform (PC / Smartphone) expects different UI

- Daniel Marbach -> great session about async/await and the task parallel library. One of the best conferences speech in this conference. Tricky topic but necessary. If I had some free time I would practice task from his presentation (available on github). I regret that I don't saw his second speech.

- Cloud -> this topic started to be discussed in various scenarios. It's time to start thinking about it (and learn something about it).

- Food -> it was delicious. Especially the dinners.

The bad:

Too long -> Thursday was too long. We came at 9 am and the last prelection ends at 7 pm.  And there were also Q&A with speakers. Whole planed to 10 pm. That was too long. I came before the end and I really don't know about they talk at the end. I also talk with few friends and they don't know either :-(

And the ugly:

- cards with colors -> Missed cards with colors to evaluate the session after departure. I like those cards because I can notice what session I missed and is it worth to watch them later in youtube.

- smog -> when the conference was held we had a little smog in Warsaw and I feel it. After some time my head ached. I don't like smog :(

piątek, 20 października 2017

Open Street Map in Xamarin Forms

I'm not fan of mobile development, but I can't live witchout my smartfone. Why I'm not fan of mobile development? Because a year or two ago I have tryied to learn java development on Android platform. I have take course on Coursera. I have passed first two courses for mobile development but I didn't liked Android architecture. For me it was another ".net web forms" development style.

But now many things have changed. Now, we have new Xmarin platform, that ofers us two types of develompent:
a) native -> for those, who like native development in Android or iPhone (not me) but written in C#
b) forms -> .net abstraction based on XAML and MVVM architecture (like in WPF).

To not have to simple task I have decided to make something more complicated than 95% web tutorials. My choise is to use some advanced functions, but not "native supported". My choice was to use "Open Street Map" in Xamarin Forms.

There is a Open Street Map library for Android. But there are only few information how to use them in Xamarin Forms. The best simple solution for start that I found was: https://development-blog.eu/an-own-map-with-mapsui-in-xamarin-forms-entwurf/

I decided to make some upgrades of this solution :D
I hope you will like it :)

First: Make some user friendly modification of existing code: 

- unload UWP project (who use windows phone nowdays anyway?? ;-)))
- set Compile using Android Version (Target framework) to Android 6.0 -> My smartphone have Android 6.0 and I like to check this app on real phone

Second: Set starting location:

This is just a few lines of codes in MainPage.xaml.cs file:

//add this using
using Mapsui.Projection;

//add this code inside public MainPage() constructor
            var centerOfWarsaw = new Point(21.107886, 52.2127475);
            // OSM uses spherical mercator coordinates. So transform the lon lat coordinates to spherical mercator
            var sphericalMercatorCoordinate = SphericalMercator.FromLonLat(centerOfWarsaw.X, centerOfWarsaw.Y);
            // Set the center of the viewport to the coordinate. The UI will refresh automatically
            // Additionally you might want to set the resolution, this could depend on your specific purpose

What is worth to mention is convertion from google maps standard of geolocalisation EPSG:4326 to Open Street Map geolocalisation standard EPSG:3857

Third: Add another shape:

This is just adding another shape:

        var feature2 = new Feature
            Geometry = new Polygon(new LinearRing(new[]
                    SphericalMercator.FromLonLat(21.074181, 52.277191),
                    SphericalMercator.FromLonLat(21.057358, 52.210131),
                    SphericalMercator.FromLonLat(20.981483, 52.238944),
                    SphericalMercator.FromLonLat(21.074181, 52.277191),
            ["Label"] = "Warsaw",
            ["Type"] = "My Feature Type"
This code is just "copy->pase" previus code. New thing is that I named Label "Warsaw" (and previus label is now kwnown as "West Germany") and points localisation is in EPSG:4326.

Finaly: Show native popup when user click's on shape

Inside mapControl.NativeMap.Info += (sender, args) =>  code block of MainPage() constructor check if featureLabel is not null: 

                if (!string.IsNullOrWhiteSpace(featureLabel))
                    ShowPopup(featureLabel, featureType);

and execute method:

    async void ShowPopup(string feature, string type)
        if (await this.DisplayAlert(
            "You have clicked " + feature,
            "Do you want to see details?",
            Debug.WriteLine("User clicked OK");
You shoud see something like this:

Final code for this app you will find on my github profile: link to code

Base project, that I have upgraded
Xamarin forms official page
http://epsg.io -> map, that you can switch many epsg formats

wtorek, 28 lutego 2017

Astronauts exists. I've just meet one

In 2001 Joel Spolsky has wrote his great blog post about Software Astronauts. I have readed it in 2006, some times heard about astronauts in conferences but never meet any one in my professional life. Up to day. 

The best describe of "typical astronaut" we can find in legendary speak of Wojciech Seliga in Confitura 2012 (java concefence) in 7.45-9.00 (minute) link to his speach

Our astronaut:
- is old 
- excessive opinion about himself
- don't like to write code
- don't understand business domain (this is real scary)
- don't understand our company culture
- don't understand product that we are making (he treats it like another CRUD but we are not making CRUD app)
- all the time talk about the abstraction
- all the time talk about breaking changes in current architecture
- try to fix problems that don't exists
- making conflicts in team

Epilogue: that developer worked in our team about 2 weeks and had been moved to other team with different team leader. That team wants him to implement functionality of some basic control. Instead of that, after a week he don't show his code but came up with L4 (sick leave). 

czwartek, 23 lutego 2017

.NET Standard Library (Portable library)

About few months ago me and my team have started new project in .net core. We wanted to use the newest technology that is on market (in .net world). After few months we discovered, that not every component in .net ecosystem is written in ".net core way". For example EntityFramework (at this moment there is version EF.core) or WCF (at this moment we still need to use .net 4.6.2).

In one project we have library (.dll) that was used by:
a) .net 4.6.2 solutions (WCF)
b) .net core solutions (our main Web App, tests, and others)

First we used .net core library, after that we have changed to .net 4.6.2 library (and git have problems with branch changes old/new library). But in situations, when we need to use some library in both, .net core and .net 4.6.2 solution there is better way. It's called .NET STANDARD LIBRARY.

.NET STANDARD LIBRARY is a new library type project (.dll) that can be used in many different project types in example: .net 4.6.2, .net core, mobile applications. It have some limitations, but in general this is a big step in good direction.

There is good blog post in MSDN -> https://blogs.msdn.microsoft.com/dotnet/2016/09/26/introducing-net-standard/

If you newer heard about .net standard library you should read about it.

poniedziałek, 24 października 2016


In last Thursday I have pleasure to take part in Warwaw .NET User Group and hear about new logging tool named "RevDeBug".

RevDeBug is a .net tool, that can be joined to any .net solution at compile time and after compiled into .net solution it collect information about call stack. It's not "error call stack" that we know from standard exception stacktrace. It collects any information, about how code was executed so we can watch how aplication works line by line like we usually do it in debuger. But this time, this code is from production/uat/whatever server.

For me it is quite interesting tool. Maybe I will use it in future in production when I find some very tricky error. 

- logs can be really huge, in example 1GB of logs can be taken in 15-20 minutes (or maybe even less)
- performance - every logging tool working live on production lowers performance of our application

https://www.revdebug.com/ -> project web site

Session about RevDeBug in English (from .net Leipzig Meetup)

niedziela, 14 sierpnia 2016

HTML 5 Local Storage vs Cookies

While I was solving Weekly Javascript Chalange Task 3 I ask my self a quite interesting question. What is a difference between Local Storage and Cookies?
Somebody already asked that question on SO:  http://stackoverflow.com/questions/3220660/local-storage-vs-cookies ,and there is a very good answer:

Cookies and local storage serve different purposes. Cookies are primarily for reading server-side, local storage can only be read client-side. So the question is, in your app, who needs this data — the client or the server?
If it's your client (your JavaScript), then by all means switch. You're wasting bandwidth by sending all the data in each HTTP header.
If it's your server, local storage isn't so useful because you'd have to forward the data along somehow (with Ajax or hidden form fields or something). This might be okay if the server only needs a small subset of the total data for each request.
You'll want to leave your session cookie as a cookie either way though.
As per the technical difference, and also my understanding:
  1. Apart from being an old way of saving data, Cookies give you a limit of 4096 bytes (4095, actually) - its per cookie. Local Storage is as big as 5MB per domain - SO Question also mentions it
  2. localStorage is an implementation of the Storage Interface. It stores data with no expiration date, and gets cleared only through JavaScript, or clearing the Browser Cache / Locally Stored Data - unlike cookie expiry.

 Why I mention about it? For two reasons:
a) I use this blog as my notepad, that I sometimes visit
b) this question have a great "interview question" potential