Handling dates in single-page applications

Published on Wednesday, May 2, 2018 5:00:00 AM UTC in Programming

Working with dates in a single-page application always is a bit of a hassle. Well, dates in general are one of those things that look straight-forward at first but have a lot of nasty details to master, in particular when you're dealing with localization requirements. This is not dinstinct to JavaScript or TypeScript, but to all languages, simply because handling dates is a universal problem. There's a reason we have frameworks like Noda Time in .NET. For your single page applications, there are at least three things to take care of: getting date values from and to the backend, having an internal canonical representation that you can count on, e.g. for all technical handling like binding properties to controls, and of course displaying dates correctly to the user, i.e. in a format they expect and understand.

Hunting down a power configuration bug in Windows 10

Published on Sunday, March 18, 2018 6:00:00 AM UTC in Skit & Tools & User Experience

I have a new "hobby" that I've been actively pursuing for the past weeks: hunting down what keeps waking up my computer at night. At first it simply was a matter of me not wanting to shut down the computer completely (I like my five hundred open windows be restored instantly), but I also didn't want it to just sit there and idling along, consuming power for nothing. But the more I tried to solve this issue, the worse it got, seemingly. I once turned it off in the morning, and when I left for work half an hour later, it was already running again. I swear it mocked me. Getting this under control turned into a mission, a mankind vs. machines class of battle. In the end, it turned out to be a bug in Windows 10 that seems at least two years old, and it made finding the cause for these problems a nerve-wrecking journey for me. If you also find your computer waking up spontaneously at night and already tried out all the hints, configuration switches and registry settings you could find on the internet, this one might be for you.

Type compatibility pitfalls in TypeScript

Published on Monday, February 26, 2018 6:00:00 AM UTC in Programming

When I extended good-injector with the possibility to use factory functions, I ran into a strange issue. In one of the unit tests I mistyped registerFactory for registerInstance[1][1]
Copy and paste, the root of all evil.
, but the compiler did not complain at all. It happily accepted a function of type () => T in a place that required an object of type T (T being a generic type argument), and left me a few minutes trying to figure out why my code is not working. I analyzed the problem and realized that it's a side effect of how TypeScript determines type compatibility. Let's see what that means and how to avoid it.

good-injector: Version 0.2.0

Published on Sunday, February 25, 2018 12:00:00 PM UTC in Tools & Announcements

A new version of good-injector has been pushed to NPM. I've used the container in one of my private projects and decided to move forward with it, as it's working quite well and stays unobtrusively in the background - just as I like the tools I have to work with. The current release adds the following features:

Dapper Extensions Reloaded: Version 3.1.2

Published on Sunday, February 18, 2018 8:30:00 AM UTC in Tools & Announcements

I just released a new version of Dapper Extensions Reloaded that fixes an issue with handling DBNull values in the default logger. I also started updating some of the surrounding details, like the documentation on GitHub and the included license files. As always, head over to NuGet to get the latest bits (version 3.1.2), or visit the GitHub repository for sources and more.

Dependency Injection in Vue.js with good-injector-vue

Published on Tuesday, February 13, 2018 6:00:00 AM UTC in Programming & Announcements & Tools

Creating a TypeScript IoC container was only the beginning. Until it can be integrated with other frameworks, it's only of limited use. Of course, using something like this in different contexts is always possible, but ideally it feels natural to the environment your application resides in, and not forced. As you probably already guessed, this article describes how to integrate "good-injector" with Vue.js. But it goes further: today I announce good-injector-vue, an adapter of my IoC container for Vue.js that does all the required work for you and seamlessly integrates with it.

Dependency Injection with TypeScript: good-injector

Published on Monday, February 12, 2018 6:00:00 AM UTC in Programming & Tools & Announcements

In classic languages and frameworks on the server side, like C# and ASP.NET (Core), dependency injection today feels like a natural piece of the infrastructure. With more and more complex applications being developed in the browser, developers seek similar mechanisms and features for client-side languages like TypeScript too. Not only does it reduce coupling and simplify testing; nobody wants to hand-craft deep dependency trees and manually tune these after each refactoring. In TypeScript, there are some conceptual differences to how the topic is typically approached in languages like C#. In this post I briefly talk theory and options, then proceed to create a simple IoC container for TypeScript from scratch: good-injector.

Vue.js-Plugins with TypeScript

Published on Friday, February 9, 2018 8:00:00 AM UTC in Programming

Plugins are the recommended way to augment the feature set of Vue.js with additional properties, methods, assets and more. Writing them in TypeScript with current versions of Vue.js is straight-forward, but the advice you can find on the web often refers to older versions and does not apply anymore. In fact, the contradictory recommendations you find there may be quite confusing: how do I refer to the Vue.js type in my plugin? Do I use VueConstructor? Is it Vue or typeof Vue? Well, here is a general rule of thumb that will help and never lets you google for the required syntax again.

Localization Support for my Blog

Published on Wednesday, February 7, 2018 9:45:00 AM UTC in Announcements

As you may have noticed, I've rolled out some changes to this blog recently, one of it being better localization support. In detail:

  • You can now change UI language with the switcher to the upper right
  • Dates are displayed in your language format and converted to your local time zone
  • I provide additional RSS feeds for those only interested in German or English posts
  • Some pages (details about myself and my projects etc.) have been translated to both supported languages.

Of course, all content will still only be available in whatever language it has been created in.

I hope you all enjoy these changes :). If you find any inconsistencies, let me know.

Vue.js: Environment-Aware Code in TypeScript

Published on Wednesday, February 7, 2018 6:00:00 AM UTC in Programming

Ideally, running your code in production is something that happens completely transparent to your application. Meaning: your app really shouldn't care about the environment it's currently deployed in, and deliberately be as agnostic about that as possible. Sometimes however, there are situations where you need to know this, particularly at development time. Is this legitimate? And if so, how do you get that information? I give you an example and show you how you can easily access this information with Vue.js from TypeScript.

Browse: 1 2 ... 27