hjertnes.blog

Editors I use

27.07.2018 02:00

I currently use three different text editors. My main one is Emacs. This is where I work when I write new code or spend a larger amount of time in one single file. While I use Visual Studio Code when I have to jump between files a lot. And my go to tool when I just need to go into a file fixing a few minor things is VIM.

I’m going to get rid of VS Code when I change jobs. Because 99% of what I use VS Code for is related to work stuff.

This is not a VIM vs Emacs discussion, both of them are more or less the same kind of thing when you enable a lot of third party code in them, and my Emacs setup is very much a “full featured” one, while my VIM setup is very minimal. That is on purpose to make sure that I can get in and out of VIM faster than it would take me to launch Emacs or VS Code (or VIM itself if I set it up to have the same kind of features my Emacs setup has).

Soft pencils and broad fountain pen nibs

27.07.2018 02:00

When I first got around to buying a box of Blackwings (after having it on my “stuff to get” list for two years, and I started using them it hit me how similar it was to using a broad fountain pen. They are both messy, put down a very satisfying line and you have to refill / sharpen it all the time. Or at least a lot compared to their finer / harder bothers.

Like I said, they are both high maintenance and very messy. If you use a broad nib you’ll end up with ink all over your hands, and if you use a broad pencil you’ll end up with graphite all over your hands.

I very soon realised that a little bit harder pencils are the thing for me. Because unlike fountain pens, there are much less you can do about it, except carrying a lot of pencils. If you like broad fountain pen nibs you can just get a huge piston filler and ink capacity isn’t a huge problem. Pencils on the other hand requires sharpening. And there is a limit to how many you can carry. How messy they are is also a part of it for me. A fountain pen is messy, but after a few seconds the ink is dry while graphite will smear the same if you drag your hand over for the first time after a minute or ten.

Even though I use Broad fountain pens, I have landed on #2 / HB pencils as “my thing”. Smooth enough for it to not annoy me, while at the same time hard enough to not look like a crazy person while I write.

Everyone else is not an argument

26.07.2018 02:00

I often see people doing stuff just because “everyone else” are doing it. Both in life and in software projects. You should not use React or Vue or what ever just because everyone else are doing so. Everyone else is not an argument. It might be a good idea to look into it. But it is not an argument.

Clojure: Macro vs Function

25.07.2018 02:00

I’m not going to get very deep into this, because there have been written entire books on the difference between the two. But I’m going to look into two aspects of the difference between the two.

  1. A function returns data, while a macro returns code.
  2. A function runs when the program runs, while a macro is expanded into code during compilation.

Macros are one of the more powerful aspects of programming languages in the LISP family. You can use them to extend the language. Like I said a Macro returns code, and you can control how and when they are evaluated. Parts of it may be evaluated in the macro, while other parts may be evaluated during when you the code runs. This is what I mean by it returning code. This means that it may depend on some variable that isn’t available to the macro, but is available where it is expanded into.

Other languages have similar concepts to this. But none of them are as elegant. Because at the surface there are no differences between a macro and a function. This is why they are so awesome and important.

Another important thing to remember is that because a macro is expanded into code, it may be a performance improvement over functions in certain situations because instead of being a bunch of function calls it is expanded into code.

Using the Cloudinary APIs from Clojure

24.07.2018 02:00

There are a few advantages to Clojure running on the JVM. One of the biggest is that we can use any Java library in our Clojure projects. Two other is that we can take advantage of all the awesome server infrastructure stuff that exist for Java services and that we can build a .jar file that runs everywhere with a Java Runtime installed.

Most of the time you want to use something that is packaged to be nice to use in Clojure. But you don’t always have that option, and it is really nice to just import some Java libraries when that occurs. The way you do this is that you add the dependency to lean like any other dependency. Lein will look in both Clojars and Maven for packages you add. And then you load the classes or packages you need using “(:import)” instead of “(:require)” in your code. Now you can just do something like (.methodName className) or (.methodName objectName). I’m going to write more about this in the future.

I have put together this GitHub repo, with some code showing the basics of interacting with the Cloudinary API’s from Clojure using the Java SDK.

Erasors on top or not?

23.07.2018 02:00

Some pencils come with erasers on top, while others don’t. I would personally prefer to not have them there at all, because I just pull them off and sharpen both sides of the pencil. But for those who use them: is it that difficult to make a pencil with one that actually works?

Fine I get it that you have to cut some corners if you make cheap pencils, but when we pay around $2 per pencil I think we should be able to expect the fucking thing to work.

Minimalism

23.07.2018 02:00

Minimalism is a subject I have been obsessed with since I was an avid listener of the Enough Podcast. My impression is that a lot of people have a misleading impression about what it means. You probably think about some Steve Jobs like person sitting in an empty apartment drinking tea and meditating.

The idea is not to have nothing, the idea is to have less. If you take everything you own, and you question everything, and get rid of everything that doesn’t fulfil one of two purposes: you need it; it makes your life better in a meaningful way. For example I need a few pairs of shoes, but I do not need 100 of them. I do not need a large computer screen, but it improves my life in certain situations in a meaningful way. Like for example making it easier to work at home.

#

21.07.2018 02:00

I can’t wait until Flickr and the Yahoo account crap are gone.

Clojure on the Apple Runtime.

20.07.2018 02:00

You can write iOS apps using various different programming languages. You have Swift and Objective-C; and you various ways you can do it with Javascript. There are ways where you can use C#, and of course game engines are used to make the same game for many different platforms.

But I’d love to see Apple extend this. One of the awesome things about .NET and Java(the real kind, not the Android thing) is that the virtual machine or the run time is designed in a way where you can use Java libraries in other programming languages running there, without having to implement specific packages allowing it.

I want to write native iOS and Mac apps using Clojure. Someone else might want to do so using Ruby or even PHP. I have no idea if this is possible with the current iOS or Android runtime, but I’d love it if we moved against a world where all the app development stuff wasn’t so tied two a couple of programming languages on each platform.

Top 3

20.07.2018 02:00

My top 3 favourite pencils, in order:

  1. The Blackwing 602
  2. The Field Notes Pencil
  3. The Golden Bear.

The 602 is the better pencil because of how smooth it is to write with, and how comfortable it is to hold, while the Field Notes pencil is even more comfortable to hold but not as smooth to write with. And the Golden Bear is a great pencil, but a much more crude and basic pencil. At the end of the day however, I prefer the Golden Bear because it is much less expensive and I can buy it in bulk. For the price of One and half box of 602’s I can get 144 Golden Bears.