tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Exploring C#’s ref return to better understand it

5 Dec 2018 .NET, .NET Core, C#, Roslyn, RyuJIT

I felt a bit fuzzy on the topic of ref returns in C#. I used it intuitively few times, but it felt I needed to fill some gaps and play with it in a little bit more structured way. This is my exploration of the topic. No particular order. No deep explanations. Just my thinking what should work and what not and trying it.

Vertikální půlkilometr na schodech

5 Nov 2018 Running

Dostali jsme s Davidem Gešvindrem takový “zajímavý” nápad. V budově Gopasu v Praze je docela dost pater a po obědě, v rámci lepšího trávení a protažení, chodíme nahoru po schodech. Ve skutečnosti jdeme většinou z -2. až do 11. patra pro extra body. 😃 No a co třeba zkusit chodit nahoru a dolů…

ICTech Day

5 Nov 2018 Multithreading/Parallelism/Asynchronous/Concurrency, Presentations & Speaking

I almost forgot to tell you about this. This week, Thursday, I’m speaking at ICTech Day in Belgium. And about the topics I’m very passionate about. First session is “Tasks and Await from the ground up” and other is “Async and Await”. If you’re in the area, maybe you can still try to make time and come (you have to be a guest of somebody from PeopleWare or Elmos).

MonkeyFest Bootcamp Prague 2018

4 Nov 2018 C#, Presentations & Speaking, Xamarin

Za necelý týden se koná akce s názvem MonkeyFest Bootcamp Prague 2018, což je podobně jako Global Azure Bootcamp akce konající se v jeden den na celém světě. MonkeyFest je zaměřen na svět Xamarinu a příbuzných technologií. No a protože Xamarin je také o C#, připravil jsem si přednášku s názvem “Co čekat od C# 7, 7.1, 7.2, 7.3 a 8.0”. Pokud vás novinky C# zajímají, nezapomeňte dorazit.

Comparing speed of ToUpper, ToUpperInvariant, ToLower and ToLowerInvariant in .NET Framework and .NET Core

23 Oct 2018 .NET, .NET Core, JIT, RyuJIT

While I was reviewing some code week or two back, I got idea to test what’s the speed difference between ToUpper, ToUpperInvariant, ToLower and ToLowerInvariant. Of course, these methods are not doing the same thing, but sometimes it doesn’t really matter and if any is sufficient then, maybe, performance wins. Or at least I thought it’s going to be interesting to see whether there’s a difference and how much.

WUG: C# 7, 7.1, 7.2, 7.3 a 8.0 (Zlín)

18 Oct 2018 C#, Presentations & Speaking

Máte rádi C#? A ztrácíte se v aktuální rychlé kadenci verzí? Mám pro vás řešení – WUG 25.10.2018 od 17:30 ve Zlíně. Všechno dáme do kupy a srovnáme si to v hlavě.

C# v poslední době velmi rychle přidává nové funkce. Malé funkce v minor verzích, ale připravuji se i velké změny do major verze (verzí). Co je tedy dostupné v C# 7, 7.1, 7.2, 7.3 a jak to začít používat. A co nás čeká dál a hlavně ve verzi 8.0?

WUG: Asynchrónne a paralelné programovanie v .NET-e (Košice)

3 Oct 2018 Presentations & Speaking

Tak to vypadá, že se podívám do Košic. Na WUGu si povíme něco o asynchronních a parallelních věcech a jak to celé do sebe zapadá a co je “pod tím”.

Naposledy jsem tam byl na maratonu v roce 2012 a poměrně dobře si pamatuju segment 30. – 35. km. “Lehce” 😃 jsem potkal “zeď”. Naštestí jsem to do cíle “dotlačil”. Tak snad WUG zvládnu lépe. 😃 Určitě přijďte.

DotNET Talks, vol.1

30 Sep 2018 Entity Framework Core, Presentations & Speaking

Už příští týden se uskuteční nová akce s názvem DotNET Talks. Moje přednáška “Unit Testing s Entity Framework Core” se podívá na to jak “unit” testovat kód, který využívá Entity Framework Core. Díky “čerstvosti” Entity Frameworku Core jsou možnosti o poznání lepší než tomu bylo u Entity Frameworku 6. Jak to vypadá, tak ještě pár míst můžete urvat, tak neváhejte…

Step into a specific call when debugging in Visual Studio

24 Sep 2018 Keyboard, Visual Studio

Last week, as we were wrapping the first day of .NET Developer Days conference, I was sitting in the “Ask The Expert” area quietly by myself, reading the poems, waiting for questions with Kendra Havens chatting about Visual Studio shortcuts and enjoying the pre-party beer. As it turned out, there’s one super handy shortcut for debugging that most people – Kendra included 😉 – are not aware of (and which I wasn’t able to cover in my 60 minutes of allotted time). Thus, I must spread the word.

Exploring .NET’s – Java inspired – “synchronized” methods

13 Aug 2018 .NET, .NET Core, Java, JIT, Multithreading/Parallelism/Asynchronous/Concurrency, RyuJIT

I was recently talking about first versions of .NET, C# and the world of development technologies of that time. As I briefly touched J# (anybody remembers?) I realized there’s one Java feature that was added to C# because of inspiration by Java and I wanted to explore it. It’s not much used or even known in C#, but it’s still there. And because it’s about “threading and synchronization” I couldn’t resist and immediately jumped in. It’s synchronized methods.

.NET DeveloperDays 2018

27 Jul 2018 Presentations & Speaking

In less than two months the .NET DeveloperDays 2018 conference will happen. According to the organizers it’s “the biggest event in Central and Eastern Europe dedicated exclusively to application development on the .NET platform” and I’m excited to speak there together with other great speakers.

How is Thread.SpinWait actually implemented?

17 Jul 2018 .NET, .NET Core, JIT, Multithreading/Parallelism/Asynchronous/Concurrency, RyuJIT

I’m always drawn into disassembling stuff and learning how something works under the hood. The Thread.SpinWait is something I’m going to explore. Because .NET Core is open source I can attack this from side of both sources as well as pure disassembly.

WUG: Entity Framework Core 2.1 (Ostrava + Praha)

12 Jul 2018 Entity Framework Core, Presentations & Speaking

Ačkoli jsou prázdniny klidnější období v IT, WUG Ostrava a Praha nezahálí a frčí na vlně Entity Frameworku Core 2.1. Já tu vlnu ještě víc zvednu 19.7.2018 od 17:00 v Ostravě a 21.8.2018 od 17:30 v Praze. Takže doufám, že bude hnusně a dorazíte. 😃

Současně s novou verzí .NET Core 2.1 byla uvolněna i nová verze EF Core 2.1. Co je tedy v EF Core 2.1 nového? Proč všichni o 2.1. mluví? Da se již 2.1 reálné použít nebo jsou ještě oblasti, které pokulhávají?

ConfigureAwait(false) analyzer with improved “brain” (v2.0)

10 Jul 2018 .NET, C#, Multithreading/Parallelism/Asynchronous/Concurrency, Roslyn

The original ConfigureAwaitChecker tool I wrote was just a concept and I knew it had a lots of limitations. Luckily it idea was not completely dumb (even Jon Skeet thinks so) and hence when ideas for improvements came in, I was not skipping on these. And because these improvements become quite big, I’m releasing today version 2.0.

Introducing FirebirdDbComparer – library for comparing Firebird databases to create alter scripts

9 Jul 2018 .NET, .NET Core, Databases in general, Firebird

When I first heard the idea of writing library for comparing databases’ structures and producing alter scripts I thought it was a joke. I believed it would take months of work to get it into production quality, handling all the different cases and often also bugs or limitations in Firebird. That was 2015. It’s 2018 now and I’m here, ready to introduce it.

Penny pinching Azure Append Blobs

5 Jul 2018 Application Insights, Azure, Azure Storage

I was going through some reports in Application Insights for a small website I’m running and I saw a lot of 409 errors when writing to Append Blobs. As I was sorting this out, I also realized I can do the whole logic more “efficient” and save some pennies.

Start always the right project with this simple secret in Visual Studio

11 Jun 2018 Visual Studio

You know that feeling. You’re working in a project, hammering awesome code line after line. And then you hit F5 to see the magnificence, …, and a wrong project starts. Or you’re testing multiple applications and always clicking Set as Startup Project. Not anymore. I’ll show you a small little secret that will make this pain a history (or at least will eliminate portion of it).

WUG: Entity Framework Core 2.0/2.1 (Zlín)

5 Jun 2018 Entity Framework Core, Presentations & Speaking

Ještě před prázdninami, než začne v IT klidnější období, se můžete přijít podívat na novinky v Entity Frameworku Core 2.0 a 2.1 na WUG 12.6.2018 od 17:30 ve Zlíně. Na všechny “fičury” se detailně podíváme a zjistíme co a jak.

Entity Framework Core 2.0 a 2.1 byl představen nedávno společně s .NET Core 2.0 a 2.1. Co nového přináší? Jaké jsou změny oproti verzi 1.0/1.1? Má smysl verzi 2.1 používat? Jaké jsou pokročilejší features, jaká jsou omezení… A co například použití s jinými databázemi než jen MS SQL Server?

Easier GetHashCode implementation in .NET Core 2.1

5 Jun 2018 .NET, .NET Core, .NET Standard, C#

Writing correct GetHashCode implementation is difficult. I know you’ve written it before and simple xor-ing looks fine. But trust me, it’s more than that. Especially if you want your implementation to be solid and useful for hash-tables etc. And .NET was not helping in any way. Until now.

How I fixed and improved connection pooling by not working on connection resiliency.

24 May 2018 .NET, .NET Standard, ADO.NET, C#, Network

For a long time, I had a ticket with “Connection resiliency” title in the issue tracker. My idea was to provide a functionality to be able to recover from a broken connection. Why? Because when I reimplemented (and fixed) connection pool sometime around 4.x version I removed one questionable (to put it lightly) feature. That, and also because I introduced a small bug, surfaced a problem people had/have in the code.

Entity Framework Core 2.0 provider second beta (and FirebirdClient 6.0)

24 May 2018 .NET, .NET Standard, C#, Databases in general, Entity Framework Core, Firebird, LINQ, SQL, Visual Studio

It has been a while since I posted new version/beta of FirebirdClient 6.0 and the Entity Framework Core 2.0 (and newer) support. Although I’d like to spend more time on all the providers, my free time is limited (although occasionally somebody sponsors some feature or bux fix), thus the progress is what it is.

Update Days: Legacy aplikace

21 May 2018 C#, Presentations & Speaking

Zanedlouho, konkrétně 28.5.-29.5., se uskuteční zajímavá konference nazvaná ”Update Days: Legacy aplikace“. Proč zajímavá? Protože často se na konferencích řeší novinky, fičurky atp., ale ne na každém projektu je čas a prostředky na implementaci posledních výstřelků (které ještě případně po dvou letech upadnou v zapomnění) a tato konference není o novinkách; je o tom co dělat s existující aplikací, jak ji posunout dál, co funguje a má smysl.

Gopas TechEd 2018

30 Apr 2018 Presentations & Speaking

Web hlásí vyprodáno, takže budu asi lákat především ty, kteří si vstup už urvali. Na letošní TechEd jsem připravil dvě přednášky:

  • IDisposable – implementace a mýty
  • Co je nového v Entity Frameworku Core 2.0 a 2.1

Getting the state of load management switch on budget

26 Apr 2018 Domoticz, IoT, Z-Wave

My house has a load management switch (we call it HDO here), which means the company managing the electricity grid can turn on and off some devices, like water heater, when the demand is low or high. And in exchange I get cheaper electricity (when switched on). And although the schedule is known in advance, I was interested whether the switching happens also at unscheduled times (aka to get a little peek into what’s happening in the grid) and maybe also switch automatically other devices I have when the electricity is cheap. I could ask an electrician to install another contactor on my fuse board and connect “something” to it, but I was not into doing anything permanent and expensive, in case I’d change my mind about all of this in the future etc. I also wanted to get this information into my home automation system (Domoticz). Here’s my cheap solution I hacked together.

WUG: C# 7, 7.1, 7.2 a 7.3/8.0 (Olomouc)

25 Apr 2018 C#, Presentations & Speaking

Máte rádi C#? A ztrácíte se v aktuální rychlé kadenci verzí? Mám pro vás řešení – WUG 2.5.2018 od 17:00 v Olomouci. Všechno dáme do kupy a srovnáme si to v hlavě.

C# v poslední době velmi rychle přidává nové funkce. Malé funkce v minor verzích, ale připravuji se i velké změny do major verze (verzí). Co je tedy dostupné v C# 7, 7.1, 7.2 a jak to začít používat. A co nás ceká v 7.3 a hlavně ve verzi 8.0?

Simple caching interceptor (aspect) for Castle Windsor

23 Apr 2018 .NET, Aspect Oriented Programming (AOP), Caching, Castle Windsor, Inversion of Control (IoC)

I needed to cache value from method. Simple. I know there’s at least dozen of ready-made solutions, but I eventually decided to write my own interceptor, because the whole project is already using Castle Windsor and it seemed like a fun stuff to explore. There isn’t really anything special about this code and I originally didn’t want to blog about it, but people on Twitter changed my mind.

Fun with C#’s local functions – part 2

19 Apr 2018 C#

I was speaking about new features in C# 7.x and 8 some days ago and as the questions came in, some were really good small brainstorming, basically trying where C# compiler limits are. And that’s always interesting to me.

From this brainstorming I have two interesting pieces. This is the other one and the first one is here.

Fun with C#’s local functions – part 1

19 Apr 2018 C#

I was speaking about new features in C# 7.x and 8 some days ago and as the questions came in, some were really good small brainstorming, basically trying where C# compiler limits are. And that’s always interesting to me.

From this brainstorming I have two interesting pieces. This is the first one and the other one is here.

Global Azure Bootcamp 2018

11 Apr 2018 Azure, CDN, Presentations & Speaking

Global Azure Bootcamp 2018. Jeden den, Azure po celém světě. A taky v Čechách, v Praze. I já přispěju svojí troškou do mlýna a povím vám něco o Azure CDN v přednášce “Azure CDN a jak ji začít rozumně používat”.

Glowing filament of halogen bulb

4 Apr 2018 Electronics

I was testing dimmer during the weekend and I used halogen lamp in my garage. The dimmer worked great, but that’s not what I want to talk about now. When I played with the dimming I realized I can dim the 8000-9000 lumens halogen bulb down to one percent and see the glowing filament with my own eyes. So I did.

WUG Days 2018

30 Mar 2018 C#, Entity Framework Core, Presentations & Speaking, Programming in general

Víkend 7.-8.4. se v Brně koná nabitá konference WUG Days 2018. Celkem je připraveno 48 přednášek. Na dva dny masakr.

Hlasováním byly vybrány 3 moje přednášky. A sice:

WUG: C# 7, 7.1, 7.2 a 7.3/8.0 (Praha)

29 Mar 2018 C#, Presentations & Speaking

Máte rádi C#? A ztrácíte se v aktuální rychlé kadenci verzí? Mám pro vás řešení – WUG 5.4.2018 od 18:00 v Praze. Všechno dáme do kupy a srovnáme si to v hlavě.

C# v poslední době velmi rychle přidává nové funkce. Malé funkce v minor verzích, ale připravuji se i velké změny do major verze (verzí). Co je tedy dostupné v C# 7, 7.1, 7.2 a jak to začít používat. A co nás ceká v 7.3 a hlavně ve verzi 8.0?

Video

Using value converter for custom encryption of field on Entity Framework Core 2.1

20 Mar 2018 Encryption, Entity Framework Core, Security

In February I wrote Custom encryption of field with Entity Framework Core post, which in turn was building on idea for Entity Framework 6. Both are easy, but not absolutely straightforward. And another problem is that the encrypted value needs to fit into the datatype of unencrypted value. Finally, the querying is inconvenient. Luckily Entity Framework Core 2.1 (currently in preview) has a solution.

True and false operators in C#

15 Mar 2018 C#

Few days ago, I learned new thing about C#. Apparently, there are “true” and “false” operators and you can overload these. But I also wanted to know what are these good for, given I’ve never heard about these.

Named locks (using Monitor) in .NET: Implementation

19 Feb 2018 .NET, Multithreading/Parallelism/Asynchronous/Concurrency

The Monitor class in .NET might be the most often used “locking” mechanism in C#, mostly because the lock keyword is making it so easy. One thing you might face is unknown number of locks you’re going to need and how to solve this. This is often called named locks or named Monitors, because the lock is bound to some name (or similar value).

How I got my machine back, patiently, after overloading it

7 Feb 2018 Disaster recovery, Lessons learned, Life, Operating systems, Windows

At the moment, one of my explorations is how the system (Windows) handles more-than-number-of-CPUs threads (all ready to run) under full load (from these threads). And because I’m out of office, I access my workstation remotely (using TeamViewer, in case you’re wondering).

Custom encryption of field with Entity Framework Core

5 Feb 2018 Encryption, Entity Framework Core, Security

Almost exactly 5 years ago (yes, that’s 2013) I wrote about Custom encryption of field with Entity Framework. At that time, it was using few tricks to make it work and although it might have looked like magic first time you saw it, it was actually very easy. With Entity Framework Core nowadays we have far more options how the entity can look like and hence how the whole solution can be plugged together. Let’s revisit the topic.