Implicit frameworks

These are some thoughts based on “Using a Framework will harm the maintenance of your software” and the discussions from the related Hacker News thread. One of the top responses included the following quote which summarizes an important point neatly. Every sufficiently complex framework-free application contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of a framework. That even when a framework has been explicitly avoided, or a minimalistic framework used, an implicit framework will eventually develop based on the culture around the codebase.
Read more →

Unicode BOM and Excel

If you have tried generating CSV files that include non-ascii characters you will have noticed that these show up as weird and double letters such as Ã¥ ä, and ö for the Swedish letters Å, Ä, and Ö respectively. When this happens in web pages there is a mismatch between the declared and actual encoding of the page. This could for example happen if you create a page encoded in Unicode but not sent as such.
Read more →

If you are using “and” you are writing bad code

Mostly everyone would agree that blindly writing SOLID code just for the sake of it does more harm than good. Just look at any example of the “enterprise editions” for FizzBuzz or Hello World. This is not to say that SOLID, KISS, DRY and so on are not useful guidelines for improving code quality and general practice. The practice that best aligns with the project goals is pretty much always the best option.
Read more →

Solving the median of two sorted arrays in O (n log (m + n))

I have been doing a bit of HackerRank and LeetCode challenges to practice and avoid skill rot since I do not do as much low level programming as I used to. While going over the discussions for one of these challenges [1] I noticed a lot of people bragging about their simple solutions while also missing the entire point of the excercise. The problem is described like this: Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
Read more →

Work faster with a simple to-do process

How I manage my work to not lose focus and stay on track. Wether I am working on a large project or am just starting out on something small and new I eventually end up with too many ideas for new features or improvements. Like pulling on a thread a small bug reveals something else that needs fixing or while implementing a new feature there is something else that would be really cool.
Read more →

How to rely on third-party CDNs in a secure way

Instead of using dependency managers and packaging tools like Webpack or Bower (or even NPM) for web resources it is tempting to instead just link directly to the resources you need. But except for avoiding complexity and having to learn something new like dependency management or semantical versioning schemes this also opens up some attack vectors. For example, if the third-party you are loading your resources from is compromised an attacker might replace your Bootstrap plugin with a key listener to steal your users passwords.
Read more →

Consolidating images with perceptual hashing

I have a lot of photos spread out over multiple devices and platforms from over the years. These are pictures from Facebook, old camera photos, Google Photos and so on. And most of these are duplicates, copied from one device to several different platforms and backups, all with very subtle differences depending on what platform they have been processed by. Most of these have some matter of export functions for photos.
Read more →

Resolutions for 2019

A couple of years ago I wrote a post with a short summary of my resolutions for the upcoming year. Things that I wanted to achieve or improve. I never followed up on it or even considered how it went or if anything should change for the next year. In terms of goal planning it was a catastrophic failure. What I should have done was to (1) made sure that my resolutions were measurable and (2) actually followed up on the progress of my goals to make sure I was on track.
Read more →

My blog setup

I am trying to get back into blogging. Mostly as a way of documenting my side-projects which I am otherwise awful at. Previously this has been a writing exercise for me (and still is) but I hope to switch focus to more code and small projects. The blog is powered by Hugo, a static site generator which basically converts text files to this site. Those text files could be hosted on GitHub as it was before were it was set up according to the official Hugo guide.
Read more →

An efficient work environment in Gnome Shell

At work or at home I mainly use a Ubuntu + Gnome Shell setup for getting work done. While Gnome Shell has its limitations it can be dramatically improved with the right extensions. At least for now I don’t know any better option. With my current setup I have support for multiple desktops which is useful for switching contexts between e.g. communication and development. The multiple desktops are also a benefit for laptop work as I am otherwise limited to a single screen for workspace.
Read more →