Handling errors in React

23.01.2018 01:00

With React 16 handling errors with React became a hell of a lot easier than it used to be. The official documentation has all the code you need to get started.

The basic idea is that there is a lifeCycleMethod, and if there is an exception thrown in any component in this or somewhere “under” this component it will trigger. With all the information you need to display an error message to the user, or more important saving it somewhere.

Showing it to the users? Not that important, because most of them will not ever read them. Having a place to keep track of them? Very important, makes it so much easier to fix and deal with all the problems with your app; instead of just those you hear about.


22.01.2018 01:00

It’s micro Monday again. This week I recommend [@jack]1. A awesome follow, especially if you are into photography, analog stuff or emacs.


22.01.2018 01:00

Installing SilverFast always drives me nuts. The installation process is designed as bad as the software itself. Download a new copy (because the one included with the scanner is outdated). Make sure the scanner is connected to the computer. Then type in a long serial number, before you need to insert the original installation media for it to verify that you actually have the original CD or DVD.

It requires two USB-A to USB-C adapters plus a USB CD Drive to install the damn thing on a modern MacBook Pro.

Being left handed.

22.01.2018 01:00

As a white straight cis male working I don’t have that much experience that the system are working against me; and I don’t experience much fill-in-your-ism-of-choice-here.

But there is one area where I really can feel it. I’m left handed. There are some products more than others that seems to be designed in a way where they have made a mathematical model for the dead center for normal or the bullseye of normal. And then they have designed a product to serve them, and to only test it on people who qualify as normal.

There are a few products I always bring up when I complain about this, the Vanishing Point or the Lamy Safari; but you can also spot some of the same problems if you look at for example the nibs available for the Lamy 2000.

The problem with the Lamy Safari, and all the other “cheaper” Lamy pens is that the grip section is molded, and it doesn’t work that great when the way you hold the pen is opposite of “Normal man”. While the problem with the Vanishing Point is just that the clip becomes a little bit “in the way” if you are left handed; the difference is that, if you are right handed it will end up between your thumb and your index finger; while for us lefties it ends up between your index finger and middle finger.

Both of these problems could be solved relatively easy; you just make a “reversed” version. The problem with the Lamy 2000 nibs are that the “Oblique” nibs don’t come in a lefty version, and good luck writing with those left handed.

I’m pretty sure they don’t do this to be assholes or anything like this. I just think that they didn’t even consider testing it on left handed people before putting it out there.

I just wish that more companies did a better job to make sure their products either work for everyone or that it is a version that works for everyone.

Because you have two options, either you design stuff in way where they are fully functional no matter what hand you write with. Or you design stuff in a way where you need separate models for left handed and right handed. The key is that you either design stuff to be universal or you have models for both groups.

New blogs

22.01.2018 01:00

I started a daily JavaScript focused blog in November. Single topic blog posts, sometimes larger series of blog posts if the subject matter is big. Monday through Friday.

And I have also started to hang out over at Micro.blog. You can find me at https://micro.blog/hjertnes or Hjertnes.social or think Twitter, but driven by blogs and rss; with some nice Magic by Manton Reece to make it function more like a social network.


22.01.2018 01:00

Emacs is a very powerful editor. Much more powerful than anything I have used before.

And it is the kind of tool that begs to be extended.

If you need Emacs to do anythning, you can just write a emacs-lisp function that does that.

You have some core concepts, and a lot of lisp functions that you can use when they are needed.

What most people call the “window” is called the frame, and a window can be divided into any number of windows. Then you can open buffers(files, unsaved files or interactive buffers like shells and repls or even user interface and small applications). Then you can place any buffer in any window. This is much more powerful than the usual files and tabs metphor. It also enables you to do some interesitng stuff like having multiple windows with the same file; useful if you need to look at the top while editing the bottom.

Emacs has some very powerful keyboards shortcuts. Some of them are configuration depended; or all of them are. And some of them depends on the mode emacs is in. You can add modes for dealing with certain file types. The keyboard shortcuts might be the same or very similar for building / compiling source code, but the code behind the mode takes care of what to do.

The core of the power of emacs is Emacs Lisp. It is the programming language most of emacs is written in. And all extentions to emacs is written in. You also use to configure emacs. The idea is that when you run a keyboard shortcut, it is just running the lisp function that shortcut is mapped it. And you can also enter Emacs Command mode and just run any command available.

And it is very easy to add your own, you just have to define it in a .el file and load it in your config. If you for example want to be able to post to Twitter from a emacs buffer, you could just write or find some emacs lisp function for doing that.

What’s next

22.01.2018 01:00

The React Introduction is done as far as I’m concerned, at least for now. I’m probably going to write more about react from time to time as I come over cool new stuff. And I’m going to put together a full fledged example projects incorporating what I have written about here in a not too distant future. And I will probably also bring up some stuff I forgot to write about here.


21.01.2018 01:00

[@jack]1 your 56mm is the apd or non APD?


21.01.2018 01:00

What’s the go to WordPress client on iOS these days?


21.01.2018 01:00

[@manton]1 have you gotten a chance to take a look at my 24 hour clock feature request?