Articles

Using IBM App ID roles with Spring Security

Image
This is something I've been meaning to write for a long time. If you're already familiar with how to set up App ID in a Spring Boot application, feel free to skip to the fifth step. That's where the juicy parts are. 1. Creating a project Let's start off by creating a new Spring Boot project. This link contains a Spring Boot project with the required dependencies: Spring Security, Spring Web and OAuth2 resource server. 2. Configuring App ID Next, let's create service credentials in our App ID instance. Notice that we gave it write permissions. You'll see why soon. While we're here, let's also add the "http://localhost:8080/login" redirect URL in the authentication settings : To make things easier, let's enable the Google provider in the "Identity Providers" tab. This way we can log in with an existing Google account. If you don't want to do this, it's also possible to create an account on Cloud Directo

The challenges of localizing an Android application (with special considerations for Arabic)

Image
I don't usually blog about work-related problems I encounter, but I figured this could be useful for some people. Below is a checklist of potential issues than can crop up when trying to introduce localization to an application that initially supported a single language. Backend error messages Instead of returning error messages, it would be more suitable to return error codes, and have the Android application display their interpretation in the user's language of choice. For example, instead of returning a string that says "This username is already in use", return something like "duplicate_username". One caveat of this approach is how the context that comes with errors should be handled. In the previous example, when a username is already in use, it's customary to return similar usernames that are available. The backend and the frontend should agree on a way to pass this contextual data through the response. Alternatively, you can propagate th

Registering WinRAR on a Linux machine in 2020

Image
The recent LGR video prompted me to write about my experience on how I got an official WinRAR installation to run on Ubuntu. Back in August, I decided to treat myself to something nice to celebrate my thirtieth birthday. After a session of deep introspection, I concluded that it was time to purchase a WinRAR licence. Registering WinRAR was supposedly considered to be a rite of passage in ancient cultures, the turning point where boys became men. I felt that I had finally reached a level of maturity that would permit me to embark in this life changing journey. The process itself was relatively straightforward. I went over to the official website and placed an order, and they sent me an invoice and a link from which to download the licence key, itself compressed in a RAR archive. I couldn't help but marvel at the website, it aged like fine wine. It is reminiscent of an earlier internet, and I look back fondly to a time where websites used to be much simpler. You'll notic

Cloning an infrared remote controller

Image
Context : One of my earliest paychecks went into a cheap 22" TV. It's not fancy at all, but it was a nice upgrade from the old Sony Trinitron TV that was starting to show its age. The new TV has a brand name of "Vision", which is less glamorous than "Sony", but it has been working well so far, so I can't really complain. Just the other day, I found out that it is possible to get it to record something while it's on standby. It's a feature I never knew I needed until I discovered it. A couple of months after I got it, I ran into a problem with the remote controller. Luckily it turned out to be caused by a dead battery. Even though it was trivial to fix, this minor incident planted the seed of fear in me. Since the TV doesn't have physical buttons, I concluded that it would become useless should the remote stop working for some reason or another. Because of this, I decided to make a backup of the remote in case something happens to it. To d

Porting a Golang and Rust CLI tool to D

Image
A few days ago, in the programming subreddit, Paulo Henrique Cuchi shared his experience writing a command line tool in both Rust and Go . The tool in question is a client for his side project, Hashtrack. Hashtrack exposes a GraphQL API with which the clients can track certain twitter hashtags and get a real time list of relevant tweets. Prompted by this comment , I decided to write a D port to demonstrate how D can be used to achieve a similar goal. I'll try to keep the same structure as the one he used in his blog post. Source code on Github How did I end up using D? The main reason is that the original blog post compared statically typed languages like Go and Rust, and made honorable mentions to Nim and Crystal, but didn't mention D. D falls under this category, so I think this will make for an interesting comparison I also like D as a language and I have mentioned it in various other blog posts. Local environment The manual has a lengthy page on how to downlo

My experience with Win by Inwi

Image
In my previous post, I mentioned how I was using a data plan that amounts to 10 DH per gigabyte. Being a relatively light streamer, I can usually get by with 10 gigabytes per month. These days however, I often find myself abusing my data plan for calls and screen sharing and whatnot. This month for example, I spent 250 DH on internet alone. With a monthly spending like that, I realized that I might as well get ADSL or a cheap optical fiber subscription. So why didn't I ? Well, for one, I don't want to get tied down by a monthly subscription. Secondly, I don't want something that requires a heavy installation with all the fees and the time that it implies. And finally, I want to have the option of carrying it with me wherever I want. When I was searching for alternatives, a friend of mine suggested Win by Inwi . I looked into it and it seemed to satisfy my needs of portability and ease of use. In short, you can customize your plan as you wish , handle the paperwork onlin

Life during the COVID-19 lockdown

Image
Given the state that the world is in right now, many companies, mine included , offered their employees the option of working from home. I decided to jump on the "working from home" bandwagon and write an entry describing how I personally managed it. Hardware A few days before the state of emergency took effect, I bought an HP monitor, a Logitech keyboard and the cheapest mouse I could find. With this, I set up an impromptu workstation for the days to come. I chose this monitor because it supports both HDMI and Display Port. I use the former with my work issued laptop and the latter with my own Thinkpad. The choice of keyboard was driven by the lack of an alternative. Most of the keyboards I was shown looked like cheap knockoffs of popular brands. As for the mouse, I picked the cheapest one because I'm not a heavy mouse user, and I figured any mouse would do the trick. I regretted this decision when I found out that the mouse sometimes releases mid-click, which resul