Link dump

March 01, 2019

Clojure and JDBC

February 24, 2019

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

February 23, 2019

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

February 23, 2019

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

February 23, 2019

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

February 22, 2019

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

February 22, 2019

Analog photography processes

February 20, 2019

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

February 19, 2019

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

February 17, 2019

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.