Quantcast
Channel: Damir's Corner
Browsing all 484 articles
Browse latest View live
↧

Image may be NSFW.
Clik here to view.

Changing user interface language in browsers

I like using software in my language. But when taking screenshots for blog posts or talking to an international audience, it's advisable to use the English interface. Switching languages is a quick and...

View Article


Vuex-module-decorators actions are async

The vuex-module-decorators package makes it easy to create a strongly typed Vuex store for use with TypeScript. However, there are some pitfalls in handling errors in actions. First, the rawError...

View Article


Cloning an array of objects in JavaScript

Cloning arrays in JavaScript is a topic I get asked about regularly by other team members. This post is intended as a reference that I can refer to on similar occasions in the future. Depending on the...

View Article

Passing data to view models in Xamarin.Forms

Navigation in Xamarin.Forms Shell is based on URIs. Parameters are passed between pages in the query string. I just recently learned that as an alternative to using the QueryProperty attribute, you can...

View Article

Angular testing: flush vs. flushMicrotasks

Much of the Angular code is asynchronous. The fakeAsync function is very useful when testing such code, especially when not all promises and observables are publicly accessible. You can use the flush...

View Article


Default Apollo fetch policy in Nuxt

By default, the Apollo GraphQL client caches query responses. When using SSR with data sources that change frequently, this can be a problem. Fortunately, caching can be disabled, but setting this as...

View Article

Waiting for Vuex actions in Nuxt layouts

Thanks to Vue's reactivity, it usually does not matter where and when Vuex state is initialized. State can be exposed in components as computed properties, and the page is automatically updated when...

View Article

Image may be NSFW.
Clik here to view.

This in Vuex class modules

Vuex module decorators allow Vuex module code to be written in the form of a class, rather than in a structured object that follows a specific convention. However, the abstraction is incomplete and...

View Article


Image may be NSFW.
Clik here to view.

Point-in-time restore of Azure SQL database

Automatic updates are configured by default for each Azure SQL database, allowing you to perform a point-in-time restore of the database to any point within the configured retention period. Although...

View Article


Web API testing in ASP.NET Core

ASP.NET Core provides great support for integration testing of Web APIs. You can host the server in the test process and still make requests over HTTP: this.server = new TestServer(new WebHostBuilder()...

View Article

How can a POST request become a GET?

Recently I solved a problem with a POST request that failed with a 405 error (Method Not Allowed), even though there was only a POST endpoint at the requested URL. After solving the problem, I found it...

View Article

Testing HttpClient GET requests in Angular

Angular does a lot to make testing your code easier. This includes a dedicated module for testing HttpClient code. However, the way HttpTestingController matches requests makes it unnecessarily...

View Article

Testing failing HTTP requests in Angular

I really like Angular's support for unit testing HTTP requests, even if I find the documentation a bit spotty. I struggled a bit when I first tried to test error handling. This is the general idea for...

View Article


Efficient impure pipes in Angular

Angular pipes are a useful tool for formatting values for display. However, they may not work as expected for composite objects. Let us take a look at a made-up example: export interface ValueWithUnit...

View Article

Asynchronous pipes in Angular

Angular expects pipes to be synchronous. They should return a resolved value, not a Promise or an Observable. To use a pipe that returns an unresolved value, you can use Angular's async pipe. If that's...

View Article


Testing timers with fakeAsync

Angular's fakeAsync zone is a great tool for unit testing asynchronous code. Not only does it make it easy to wait for promises and observables to resolve, but it also gives you control over the...

View Article

Image may be NSFW.
Clik here to view.

Handle missing images in Angular

When displaying images in an Angular application (or any other web application), you need to ensure that the images exist so that the placeholder for the broken image is not rendered by the browser....

View Article


Mocking current time with Jasmine

In an Angular application, I wanted to test a functionality that depends on the current time (by calling Date.now()). Jasmine has great built-in support for spying on methods, so my first approach was...

View Article

Simplify common operations with GitHub CLI

Most of my blog posts have an accompanying GitHub repository with sample source code. On average, I create one such new repository per week, and they all share most of their configuration options. I...

View Article

Interfaces in Angular dependency injection

Angular's dependency injection makes it really easy to inject services into components and other services. In most cases, that's all we need. But what if we need more than one implementation of the...

View Article
Browsing all 484 articles
Browse latest View live