Posts

Game of life. C# console application

Image
Game of life is a zero-player game as we can read in Wikipedia 
It's quite amazing that basing on simple three rules there can be life simulation created. This gives imagination a jug what other rules crates life and what is a definition of life.
Yeah it's a philosophical discussion but it's also a programmatic one.

TL;DR; Most implementations that I found in west of internet are the ones based on two dimensional tables (in C# arrays). But it start me thinking, this is the simple solution but it's restricted with  some space - and it's consuming all the space. So life and it's absence consumes space. Well space is cheap. But I don't like limitations,
It was always strange for me that in computer world silence stored in computer also consumes a space. It's kinda illogical to consume space for life absence or silence.

That’s why I wanted to implement the second available way to implement the problem.
Wikipedia says:
"Alternatively, the programmer may …

Mobile view lifecycle. Fixing Xamarin.Forms Page lifecycle

Image
For mobile applications the highest priority is user. What user can see and interacts with. Application should react not only on user interacting with it but also user interacting with operating system. That's why not only application has it's own lifecycle but also "view" has it's own lifecycle.

In Android view is represented by activity, or a fragment (the right side of android diagram). In iOS view has it's own set of lifecycle methods. In both cases view has the information that application(in this case view itself)  is being suspended and reactivated. View know quite a lot about outside world and view lifecycle is very similar to application lifecycle.
Compare below first application and then view lifecycle diagrams:

In Android view is represented by activity, or a fragment (the right side of android diagram). In iOS view has it's own set of lifecycle methods. In both cases view has the information that application(in this case view itself)  is being…

Mobile application life-cycle Android vs iOS vs Xamarin.Forms

Image
Lifecycle. One of the most common recruitment questions. No matter what technology you work with this is something that should be well known and understood.
It's good to know how application behaves, what it is allowed depending on its state and when to react on specific lifecycle events.
In mobile world lifecycle is even more complicated because there is no 1 answer but 3 in this case: Android. iOS. Xamarin.Forms. I use also Xamarin.iOS event names in my diagrams, but the sequence is the same.
Lifecycle is the definition when your application have access to resources and when react on state change.

For mobile the biggest priority is what user can see and interacts with, so active application have priority in using system resources. System has limited pool of resources, so  applications running in background (not visible to user) is limited by system in how much resources can it use and also system decides when application needs to release all resources (be closed/killed/end of it…

Git clone

Moving repository between TFS servers was very challenging task. It was possible but very complicated and almost every time I've seen it done in companies it ended up in history and branching lost.
Recently I was planning moving git repository between VSTS accounts. Normal situation project starts as POC and ends up as always working solution. In git there is no problem at all to move repository with all the history and branches in 3 lines.

And that's really it. And the fun part is that it's fast because we don't pull all the code but only object definitions.

Update:
The mirror can be maintained in sync thanks to command:
git remote update and again git push --mirror https://yourNewAddress.visualstudio.com/defaultCollection/_git/newProjectName

Creating code first database delopyment - Migrate.exe and VSTS

Image
Creating database deployment.
My case is EF 6 (in core there would be also possibility to create sql script great article here)
It should be so simple. As a developer you just go to Package Management Console and run Update-Database. Everything is just happening. Well not that everything.

You have to set default project to project that should be use to find your code first migrations. You have to set startup project to one that contains config file with database connection string. And you have to have valid connection string If you don't have the startup project set right you get 'enigmatic' exception, that I will address later.
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Err…

DevOps gibberish

Image
DevOps is like a dirty word in programming world.
It supposed to be a bridge between developers world and the IT Pro's world, between creating code and building infrastructure/ deploying code and application. I think first problem here is that developers think of themselves as artists, creators in the pure beautiful way, the way they don't ever have to deploy theirs  solution anywhere.

Decompilation - async await problem hunt

Image
The story
Project that I love (because it's my baby) and work with, is written in very asynchronous manner.
It's great in most of the times - e.g. no blocking of user interface, faster background loading. But sometimes problems occurs...
We had one problem, strange things where happening. Whoever tested the case got different 'special' effects. I won't describe details but it looked like not all threads/tasks where synchronized on UI thread and refreshed data didn't appear before it was used again.

What could be the reason? Nice code and design, we are using generic method invoker to call other methods - it's a wrapper for all calls. It's of course asynchronous and calls asynchronous methods by lambda expression, something like this:
return await CallSleepyComplicatedAwaitingWithFunc(() => CallSleepyComplicated());  
Internet never dies When something is posted once on internet it is there forever (or at leas a very long time). But world around changes…