Everyone else is not an argument

July 26, 2018

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

July 25, 2018

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

July 24, 2018

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.


July 23, 2018

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.


July 21, 2018

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

Clojure on the Apple Runtime.

July 20, 2018

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.


July 19, 2018

A REPL or read eval print loop is what we called an interactive prompt back in the day when I learnt Python and Ruby.

It is a awesome tool when it is combined with the right language. For example, I love it with node or Clojure; but I hated it with Python. And it doesn’t make that much sense with C# or Java.

For a REPL to make sense you need to be able to test small chunks of code. Like this function or this expression; or my typical thing, “would this work” or how the fuck was that syntax again?

In other words, if your language require a lot of “foreplay” to run code, like declaring a namespace and a class etc (I’m looking at you Java and C#) it will probably not be the right thing. But if you can evaluate code without much fuss it is. Another thing that is really important is that you need to be able to just paste code into there. This is something that always drove me nuts about the Python REPL. It is so interactive that everything gets fucked up when you paste crap.

REPL’s are awesome, and can make your development really fast, if combined with the right language.

Life without Dropbox

July 18, 2018

It have gone a while since I got rid of my Dropbox account now. The majority of my Dropbox use was syncing my folder of text files between my laptops and my phone. And I almost never used it on my phone.

Then I started to look into alternatives. The obvious one is to use Git. And that’s what I did.

I have a cron job both on my MacBook and my ThinkPad that pulls, commits and pushes every minute. If there are any changes. And I use Working Copy on my iPhone; for the rare times when I actually need access to my notes when I only have my phone.

It works great, bu the iOS experience could be better. But the solution as a whole is awesome. I can work with my notes anywhere that have git and a text editor. I’m not locked in to any syncing solution or any app. If git isn’t my preferred solution anymore I could change to what the next thing is fairly fast.

Keyboard Maestro

July 17, 2018

I do not know how many times I have downloaded and done a trial of Keyboard Maestro without “getting into it”.

Keyboard Maestro is a power tool that this blog post wont fully cover. But think of it as a tool to do various stuff on a given event. That can be a keyboard trigger, you connect to wifi or that you click “run this macro”. What you do can be all different kinds of stuff, you should take a look at it to get a proper overview. But the stuff I currently use it for is when I want to override default app shortcuts by running Apple Script that does kind of the same thing, but not entirely. Or my work around for the lack of proper batch operations in Lightroom CC. The short version is that I want to “Auto tune” a large collection of images. Typically after I import something etc. The way you have to do this is to open a image, click the button, move one to the right and then repeat. I made a keyboard maestro macro that loops over it a pre defined number of times.

It still takes a long time, but it frees me to drink coffee or beer while watching my MacBook slaving away.

This is the tool you want if you want to do some really geeky shit on your Mac.

Edit for iOS

July 16, 2018

Edit is a great iOS writing app that is about as minimal is it could be.

It reminds me a lot about a app that Patrick Rhone had a role in back in the Minimal Mac / Enough days called Pop (Piece of paper).

The basic idea is that you have an app that is just a large text input area. And that’s it. No sync, no files, or anything like that. This is Edit. And it looks fantastic, has some really cool buttons to make it easy to mark everything and copy it somewhere else.

It might sound very similar to Draft. But they are two different tools for me. Edit is where I write something a little longer on my phone, that probably will require a few “sessions”. While Draft is where I take quick notes and capture stuff.

Edit is very simple and minimal. It might not be your kind of thing, but I love it.