Hjertnes.blog

Node is better

I don’t know how many out there remember how it was to do serious web apps before Node, but it was not great.

There are many big problems with Node, and those of us who have done a lot of Javascript because we in general like it, know it better than most.

But, before Node, we did not have a real development enivornment, like in most other languages. There was no real “test runners” or package management systems.

What you did was that you had a bunch of JavaScript files, maybe you had some git submodules for the third party stuff, and either some script or symlink thing that put it into place.

This was the same era as when RequireJS was the most advanced way to deal with depenencies. It was basically just a function you passed a list of files into, and told it to load them before running a callback that was your code.

I remember more than once getting into situations where things you really fucked up if jQuery plugin C loaded before B, because they wrote to some of the same global namespace.

Node is not perfect, but a lot better than things were before it, and it is also getting better.

Links

My storage and backup system

I have three backup systems, one in the cloud, one clone and one incremental backup.

The basics is that I use Arq to back up to Backblaze B2, and I use Time Machine to backup to an external drive, plus that I clone my system and the combined “archive” and Time Machine drive. Everything from old stuff, to time machine data and my Plex library live on that drive.

I recently changed all the drives. This is something I do every third year or so. When one of the drives starts to act up, I order new ones as fast as possible.

This time I went for two 5TB drives for the archive and as always a 500GB drive for cloning my system.

The reason I do this is that good NAS or external RAID systems are too expensive. When I compared the last time, the price of getting a future proof RAID, would basically be the same as one and half round of drives of my current system, before I started to buy drives.

The reality is that drives with built in USB interfaces have become so cheap, that I don’t see it ever making sense from a pure money perspective.

The thing that migh get me to do it however is the fact that the time it takes to clone a 5TB drive (it will probably be closer to 10TB the next time) is so long that I’m soon at a point where I kind of have to move to a raid.

How I use my Neo 2

I have a Alpha Smart Neo2, it is a digital typewriter. A pretty damn great one. It is basically just a keyboard, with a small screen and some memory in it.

It lets me write, without having a full computer. I personally think it is a hell of a lot better than an iPad, if you just want to type words.

Most of my blog posts either starts out on paper or on this little thing; and most of those that start out on paper gets transcribe into to this little bad boy before it get to my computer.

The reason I love it is because it is small, the battery lasts forever, and I can just have it in the living room. And I don’t have the option of doing anything except writing.
The way I use it is that I just write in the same file, and divide stuff up by adding a markdown style H1 header for each new thing, and once a week I connect it to my mac, open my Drafts.txt file in Emacs and transfer all my files (usually just the one) over.

A painful goodbye

I’ve posted about this earlier in the week on my Micro blog. But my mum had to let our family dog of 11 year go on Tuesday. It was not a huge surprise because of her age. But still very hard, and a lot harder for my mother. And Luna will probably be very sad and confused when she can’t find her the next time we visit.

Tom Waits didn’t want to grow up, Nemi never dit. It’s great to see a dog of 10 years old play like she was 1.

Learning to use the Emacs keybindings

I think I have written about this before, but I can’t remember. When I started to learn how to use Linux I first used nano, and then I got into VIM becuase the people that helped me used it. And obviously I became one of the people who mocked Emacs for being an OS.

Then Spacemacs hapened.

During the summer of 2018 I decided that I wanted to learn how to use the standard Emacs keybindings. I started doing it sometime in August, and now almost six months later I can say that I am somewhat competent using it. I’m not yet at the level where I can combine 25 shortscuts into someting nuts. But I’m at least advanced beginner or a beginning intermediate user.

This is how I went about doing this:

  1. I wrote down the basic commands I had to know, like saving files, opening files, quitting emacs, managing “windows” on a Index Card.
  2. I started a text file where I pasted interesting keybindings or answers to how to do something I used to do in VIM. And I used it as a FAQ while learning.
  3. Re-read Mastering Emacs.

The process was really slow and painful in the beginning. But after a few weeks, and getting stuff into my fingers it sped up. And today I actually prefer it to other keybindings.

The main reason I started learning it was because regular emacs with evil is kind of slow, and what I think when I’m at the other end of it is that Emacs makes a hell of a lot more sense after learning this.

Microsoft Sculpt Ergonomic Mouse

So, I use Windows at work. It is not horrible, but I still hate it. I was looking for a mouse to have at home, just in case I had to work from home or something.

As I was looking I I realized that most of the options either was the same cheap Logitec thing I had at work, or something fancy with a million buttons or one of the two or three options that was good for my hand.

I decided to either get the cheapest possible or something that was good for my hands.

I decided to get this one from Microsoft because the other ergonomic one was from Logitec (you know the huge mouse with the big ball on it) almost three times as expensive.

This mouse is like a big flat ball. It is so large that you can rest your entire hand on top of it, instead of having to use moucles to hold up your hand. It is really comfortable to use, and I like it a lot.

I like it so much that I took the one I got to work and ordered a second one.

Surviving with two USB-C ports

I started out with the idea that everything should be USB-C, when I first got my MacBook escape. But that is not working as long as you can’t get any C hubs.

What I have ended up with is a USB-C monitor, some chargers, a USB-C to A hub with four ports, some adapters and some very few USB-C versions of what I have for USB-A.

Having just two ports works, but I think it is far from ideal. And the minimum going forward should be 3 or 4; ideally way more.

The problem with USB-C is that you have USB-C and you have thunderbolt 3 both of them use the same plug but are very different.

The number of thunderbolt plugs you can have are a limit on the motherboard or logic board. And the number of USB ports are more or less without limits. But the latter have less features.

I think Apple should find some way to tell what is what and just have a lot of them on their Pro laptops. But it isn’t ideal.

Link dump

Clojure and JDBC

I love SQL, I know it well, and how to use it to make fast efficient operations that reflect what I want to do. It is not beautiful, but it works really well.

After starting with raw SQL, moving over to ORM’s of various types, mainly the Django one and Entity Framework, and a few abstractions that are kind of in the middle. Like for example Korma SQL, I’m back at regular SQL.

When I work in Clojure I use the JDBC bindings, and I use a very small section of it, because I don’t like most of the abstractions JDBC have added on top of SQL. I use the query and the execute! functions. The way you use JDBC(if you want to use it efficient) is that you use the with-db-connection macro to make sure that you don’t set up a new connection to the database for each operation.

Then you have the two methods, execute! is what you use when your query does not return any data, and query is what you use when it does. There are settings to control how the data are returned, if you want need that, everything from lists of lists to lists of maps, to functions etc (if you want it to be lazy)

JDBC is the option I prefer, it may not be the easiest option, but you don’t need to do all kinds of weird crap that you often need to when your abstraction of choice was not mad with your SQL command of choice in mind.

Emacs: defer or not?

If you start with plain emacs it will start very fast. More or less fast enough for you to not notice it. And for every plugin you add it will become a little bit slower. Some plugins contribute more to it than others. There are basically two ways to deal with this. Either to just let it load everything when you start Emacs or do defer it.

When you defer you either tell it to wait to do it after Emacs have started, or do this at a certain event.

I have tried many different combinations over the last year, and I have landed on not doing anything at all. The same kind of CPU time have to be spent no matter what you do. And I’d rather take another couple of sips of coffee while waiting for Emacs to load than to having to wait in the middle of something for something to load.

Another one on use-package

I have written about use-package before, but I’m going to try again because I don’t think I got my point across.

Use-package is a emacs package that cotnains a macro called use-package, it makes it easy to deal with packages in a clean manner. n

If you take my typical emacs setup before emacs I had this long list of packages, that I looped over and checked if they were installed, if not I installed them. Then all of it was loaded and configured in a very speicifc manner to make sure it all worked. Use-package solves all of this.

The way it works is that it have a lot of different keywords that you can usem and the result is that you can avoid all kinds of nesting and weird issues, and just write the config in a way it makes sense to you. The reason I got started with it was because of the :ensure keyword, because that enabled me to install and load in one step.

Here is the documentation: https://jwiegley.github.io/use-package/keywords/. The way I have gone deeper and deeper into it is by starting simple and using new stuff as I see a place for it.

Rober Carro: On Power

I’m a huge fan of Rober Carro’s books, it all started with his amazing book about Robert Moses, and then continued as I read an listened through all of his books about LBJ. They are amazing, and my all time favourite biographies because of how well you get to know both the good and bad sides to them.

They are great, but long, and kind of intimidating. On power on the other hand is a short audiobook on Audible; it is one of their original production thingies. It is a fantastic place to start. It gives you a entry point to his writing, and if what you hear there is interesting you can just jump into either the Power Broker or the LBJ books.

Tramp Mode

Tramp mode in Emacs are awesome. It is a way you can use emages to naviagate into other contexts. Like over SSH to your sever, or into a Docker container or to access files as root.

This is one of those killer features of emacs, that are awesome. Some IDE’s have something similar, but tramp is way more flexible. And if Emacs doesn’t support it out of the box, youll probably find a plugin for it.

Link dump

Analog photography processes

One of the two cameras that I have and use is my Nikon FM. It is a manual 35mm film camera from the late 70s. It is fully manual, but it has a built in light meter.

Starting to shoot with it was probably the thing after the initial DSLR phase where I learnt the most about photography. You have to do all the work yourself, and you really get it into your fingers how the different settings work together.

I have this and a X-Pro 2. The way I deal with my analog process is that I shoot some rolls, and then I hand them in five at a time. And get them back a few days later, and then I scan them. By that time it is usually some dust and other things on the scans. And they are never in order. The next step after I have scanned them all is to add them to lightroom and process them.

The result is that I get far from perfect images, I have no idea when I took them etc. I get really annoyed about that for a minute, but then I think: the X-Pro digital photography is for that.

Analog photography is more like some random snapshots from an event where I chose to take analog pictures instead. They are messay and awesome, and I always get at least a handful of images I really love from each roll.

It is expensive, but shooting in full manual always feels like back to basics.

You can of course get the same clean images from analog, but it requires a lot of work, and that is not what I am doing with it.

The future of .NET and Visual Studio

This was written as a draft back in August of 2018, but I never got around to posting it.

The future of .NET is .NET Core, because of the corner Microsoft have painted themselves in with regards to having to support all kinds of different API’s, workflows etc, the coming 4.8 version of framework will probably be the last one. And all new stuff will happen in Core.

I also think that the future of Visual Studio will be based on Code. Where the main thing is Visual Studio Code, with all the features from Visual Studio missing as plugins in some shape or form.

The reason I think the future of Visual Studio is Code, is because the current version of Visual Studio is slow, buggy and in general horrible, while Code on the other hand is freaking great, and some plugins could replace most of it.

The Visual Studio Code Git Client

I have been using Git on the command line most of the time, for as long as I can remember. There have been periods where I have used apps like Tower. Some of them are okay. Tower is a great one, but way too expensive for me, and Fork is another great option.

Git clients in IDE’s and editors on the other hand have always been really confusing to me. I can never understand how the hell to use them. The exception being the one in Visual Studio Code and Magit. What I really like about the one in VS Code is that the visual UI is just about about committing changes. You have some other UI like showing the current branch, and some nice wrappers for running git commands through the command interface and other places. But the main UI thing is committing.

I really like it, because it makes it all really intutive and easy to understand for anyone.

Link dump

Stardew Valley

This was one of the first games I downloaded for my Switch. I think it was the first day when I got it and I downloaded a few games.

It is a great game, and I do enjoy it a lot, but I don’t love it. This is the perfect game when you just want to kill some time. I have played a lot of it on the train from and to work.

I think this is one of the games everyone with a Switch should get, because it is not expensive, and you get a lot of entertainment out of it.