Golang Datetime Cheatsheet from strftime*

When I initially started working with Go the time format it seemed a bit clunky. Maybe it’s because it’s a departure from the normal strftime, but also maybe it’s also because there’s no simple cheatsheet for the various date formatting options like you would see for example in the PHP documentation or in the Python documentation or to use the fancy language of the day, the Rust Chrono crate documentation....

25 July, 2021 · 3 min · 499 words · Alexandru Bucur

How to read metadata easily in powershell with TagLibSharp

Doing my quarterly phone image cleanup and backup on onedrive I noticed that the script I was using wasn’t quite consistent on the folder year and month generation. If you think of it it does make sense, since it’s basically doing a smart workaround on using LastWriteTime for its date source, but that isn’t always good enough. After some hours googling around (not yet on a ‘binge’ :D) I got two options that looked great....

21 March, 2021 · 4 min · 681 words · Alexandru Bucur

Simple JSON:API plugin for Nuxt.js

Hi all, So far I am keeping myself on track to work a bit every weekend on my side projects. That being said, I am a big fan on JSON:API and in my search for streamlining the consumption on the front-end I’ve finally settled on a nifty JSON:API client called Devour. It has the right amount of magic to make it worthwile and not be over the top ‘magical’. For that, I’ve made a small nuxt....

11 August, 2019 · 2 min · 370 words · Alexandru Bucur

Sideprojects Motivations and Goals

Hi Everyone, This is more of an introspective blog post regarding side-projects and finding the motivation and time to do other ‘work’ outside of the daily job. As you may or may not notice, I had a solid 6+ months pause from blogging. The main issue here was the fact that I have the tendency at times in my side projects to search for the best solution, and not focus on the task at hand....

04 August, 2019 · 3 min · 427 words · Alexandru Bucur

How to Stop requestAnimationFrame in Vuejs / Javascript

TLDR: 1 2 let id = window.requestAnimationFrame(fancyFunctionHere) window.cancelAnimationFrame(id); Now for the longer version. Technically in Vue.js you might have components/mixins that use window.requestAnimationFrame. Since the fancyFunctionHere is used as a callback, everytime you call window.requestAnimationFrame you are going to get a new id that you should use on the destroy method to stop it. Unfortunately this is not imediately clear on MDN so hopefully my documentation edit with the comment in the code example goes trough....

20 July, 2019 · 1 min · 131 words · Alexandru Bucur

Systemctl shows service file Not Found even though .service file is present

Hi All, I’m writing a step by step setup for a self hosted gitea instance (on CentOS 7) and hit the stupidest bug (if you can call it that) of systemd. After writing the gitea service file I was getting the following error: 1 2 [root@gitea ~]# systemctl start giteaselfhost Failed to start giteaselfhost.service: Unit not found. After a few hours of maddening permission checks and debugging, the problem was that I had a Requires dependency to a service file that wasn’t there....

17 June, 2019 · 1 min · 104 words · Alexandru Bucur

Setting up JWT and Identity Authorization/Authentication in ASP .NET Core

Continuing my foray into ASP .NET Core, and making sure I get outside my comfort zone, I got into the situation that I want to be able to easily access the logged in user information in my API request. There are several versions available online, some unfortunately out of date (mostly because ASP .NET Core 2.0 is relatively new and things changed significantly in Identity between 1.0 and 2.0). First version I stumbled upon recommended extending the IHttpContextAccessor....

08 February, 2019 · 3 min · 484 words · Alexandru Bucur

JSON.NET append to existing key

A quick example for appending to an existing key in a JSON.NET object, since for me at least it wasn’t clear in the documentation. 1 2 3 4 5 JObject myJson = new JObject(new JProperty("errors", new JObject())); /// we can now reference it as follows just match the type myJson["errors"].Value<JObject>().Add(new JProperty("title", title)); Small update: You can even add multiple entries to an JArray the same way 1 2 /// assuming errors is a JArray, this will automatically append new entries ErrorReponse["errors"]....

08 February, 2019 · 1 min · 84 words · Alexandru Bucur

How to get the user id after registering an user in ASP .NET Core Identity

Getting back to work on my side project I got into finishing the user registration trough the API. Following the JSON API spec, it requires returning a 201 created and the resource id when creating a database entry. For somebody used with ASP this might seem trivial but it’s not that obvious when creating a new user. Let’s take a simple example: 1 2 3 4 5 6 var user = new ApplicationUser { UserName = model....

08 February, 2019 · 1 min · 149 words · Alexandru Bucur

Dynamic Policy Claims in ASP.NET Core using JWT Tokens (and Role Claims)

Hi guys, as a developer I bet everybody is a little bit ’lazy’ and likes optimizing their workflow. My latest aha moment of laziness was when I was going trough my pet project and working on implementing Policy-based authorization and deciding that adding AddPolicy every single time I want to implement a new Role Claim in the database is counter intuitive. I want to say a big thank you to Jerrie Pelser for the initial work on this....

27 January, 2019 · 4 min · 711 words · Alexandru Bucur