diff --git a/_posts/2020-08-08-first_post.html b/_posts/2020-08-08-first_post.html index d39073b..66eaaf4 100644 --- a/_posts/2020-08-08-first_post.html +++ b/_posts/2020-08-08-first_post.html @@ -8,9 +8,9 @@ And so it begins! This is the first post of my new blog. I thought this first post could be about my goals, as well as the topics I intend to write about. Just so you know what to expect, given that you read this before I have managed write more…

-
-

Goals

-
+
+

Goals

+

I had several goals when creating this blog, but the most important one was to have a place where I could write about the things that I find interesting. As you might have guessed, this is mostly related to computers. I LOVE computers! Not just programming, but the wonders that computers can do, and the achievement of the great individuals who have made it possible.

@@ -28,9 +28,9 @@

Goals

-
-

What will I write about?

-
+
+

What will I write about?

+

I plan to mostly write about computer related topics, with a dash of math and book recommendations on top (though mostly relating to computers or math…). Some other topics may also come up from time to time.

@@ -38,9 +38,9 @@

What will I write about?

-
-

So…

-
+
+

So…

+

What will the future show? Who knows. The only answer will be in the undiscovered country, the future!

diff --git a/_posts/2020-08-27-kotlin_dsl.html b/_posts/2020-08-27-kotlin_dsl.html index 1dd9407..08a6de1 100644 --- a/_posts/2020-08-27-kotlin_dsl.html +++ b/_posts/2020-08-27-kotlin_dsl.html @@ -12,9 +12,9 @@

-
-

What are DSLs?

-
+
+

What are DSLs?

+

DSLs are languages created to solve problems within a particular domain. Popular domains include testing, website creation, database operations (JOOQ comes to mind).

@@ -38,9 +38,9 @@

What are DSLs?

-
-

Simple lambdas

-
+
+

Simple lambdas

+

One very cool feature of Kotlin is that if the last argument of a function is lambda function, then you can write it in a special syntax. Let's make a very simple function to illustrate this concept:

@@ -120,9 +120,9 @@

Simple lambdas

-
-

Functions in the scope of a class (aka Functions with receivers)

-
+
+

Functions in the scope of a class (aka Functions with receivers)

+

(I know the official term is Function with receivers, but before knowing that term, I coined it Functions in the scope of a class during one of my early talks on Kotlin. I have chosen to keep this name :) )

@@ -185,9 +185,9 @@

Functions in the scope of a class (aka Functions with receiv

-
-

Example: Spek

-
+
+

Example: Spek

+

(examples are used for illustrative purposes only!!! All rights to the code are owned by the Spek Framework contributor according to their license: Copyright (c) 2012-2016, Hadi Hariri and Contributors @@ -285,9 +285,9 @@

Example: Spek

-
-

Additional reading

-
+
+

Additional reading

+

If this was your first time reading about DSLs, then you will probably feel a little inspired. As well as checking out the languages and tools mentioned, I think you should read Martin Fowlers article on Domain Specific Languages. He also have a book about this topic, but sadly I have not yet read it.

diff --git a/_posts/2020-08-30-cool_linux_clis.html b/_posts/2020-08-30-cool_linux_clis.html index 2a37f3d..6c934c1 100644 --- a/_posts/2020-08-30-cool_linux_clis.html +++ b/_posts/2020-08-30-cool_linux_clis.html @@ -8,9 +8,9 @@

-
-

bat

-
+
+

bat

+

You have probably used cat, which can be a useful tool for viewing the content of files (but mostly for use in piping them to other programs!). Think of bat as a sort of cat, less and syntax highlighter hybrid. If that sounds awesome, it is because it is! You may wonder how it is a hybrid between cat and less? Is it like cat or is it like less?!? It can't be both, can it? Yes, it can. If the file is too big for your screen (terminal window), it will work more like less and let you navigate the contents. If it is just big enough, the content will just be printed to your terminal. Let's see some screenshots!

@@ -44,9 +44,9 @@

bat

-
-

jq and yq - JSON and YAML querying

-
+
+

jq and yq - JSON and YAML querying

+

JSON and YAML are very common dataformats these days. If you use a REST API with curl, you might want to parse the data to view the parts you are interested in. If you use something like Spring or Kubernetes, you might want to look at parts of your YAML properties. These types of problems can easily be solved by jq (JSON) and yq (yaml). Viewing in this sense can also mean processing the data to formats you want them in, so they are more than simple viewers! While they have a different set of commands, I think they are similar enough to be mentioned in the same section.

@@ -62,9 +62,9 @@

jq and yq - JSON and YAML querying

-
-

mc - Midnight Commander

-
+
+

mc - Midnight Commander

+

Do you miss file managers like Norton Commander from the DOS era? Then you might be pleased to know that Midnight Commander exists! It works exactly the same as Norton Commander used to, but with some additional features. Not my most used program, but comes in handy sometimes.

@@ -76,9 +76,9 @@

mc - Midnight Commander

-
-

lolcat

-
+
+

lolcat

+

Let's finish with a less useful, but fun command line tool. lolcat is probably not something you will have much use for, but it will spice up your terminal with rainbow colors. You can use it like you use cat, but I think the most fun use of it is to pipe some fun input to it.

diff --git a/_posts/2020-09-07-career_boosting_books.html b/_posts/2020-09-07-career_boosting_books.html index 5208956..7ea1529 100644 --- a/_posts/2020-09-07-career_boosting_books.html +++ b/_posts/2020-09-07-career_boosting_books.html @@ -30,13 +30,13 @@ Table of contents:


@@ -44,11 +44,11 @@

- +

-
-

Clean Code by Robert C. Martin (aka Uncle Bob)

-
+
+

Clean Code by Robert C. Martin (aka Uncle Bob)

+

Most of you have probably heard this book mentioned before, as it has become one of those books that everyone mentions. The author has also become quite a legend in the software development world with his books, courses and long career.

@@ -56,9 +56,9 @@

Clean Code by Robert C. Martin (aka Uncle Bob)

-
-

What is it about, and why should you read it?

-
+
+

What is it about, and why should you read it?

+

With a title like "Clean Code", you know what you are going to get! In this book, you are presented with guidelines for how to write beautiful expressive code that is easy to maintain. Ugly code is hard to understand, while clean code will be easier to understand and maintain. While the book is focused on Java, I think the tips are useful for almost any language.

@@ -70,9 +70,9 @@

What is it about, and why should you read it?

-
-

What does it help with in your career?

-
+
+

What does it help with in your career?

+

When you write code that is easier to read, it will be easier for others to read. As well as yourself the next time you revisit your older code! That way you can work more effective with other people, and we can write code faster and enjoy working with it.

@@ -86,14 +86,14 @@

What does it help with in your career?


- +

-
-

Design Patterns: Elements of Reusable Object-Oriented Software by Eric Gamma, Richard Helm, Ralph Johnson and John Vlissides

-
+
+

Design Patterns: Elements of Reusable Object-Oriented Software by Eric Gamma, Richard Helm, Ralph Johnson and John Vlissides

+

I know this book has a long name and many authors (known as the Gang of Four), but don't be scared! While some of the patterns in this book might be outdated by now, a lot of them are still useful today. Many of the patterns might not be something you write yourself from scratch, but you will find them in many libraries and code generators that you use. Notable examples include Lombok (Builder, UtilityClass for static factory method, and more), Spring Framework (Singleton, Factory, Proxy etc.) and the SDK for Android development (Adapter and more).

@@ -103,9 +103,9 @@

Design Patterns: Elements of Reusable Object-Oriented Softwa

-
-

What is it about, and why should you read it?

-
+
+

What is it about, and why should you read it?

+

A collection of many design patterns, which are repeatable solutions to commonly occurring problems, to assist you while designing new software. These come in several categories: creational (creating objects), structural (e.g, how objects are accessed and used) and behavioral (e.g, interactions between objects). While some of them are not so relevant anymore, it is still a useful to see how different problems can be solved (e.g, object creation and delegation). Many of the patterns are still found in modern software, and have clearly influenced their design (see introduction for examples). I would say skip chapter one, as it is clearly dated. If you think the entire book is dated and hard to read, I have heard that a lot of people enjoy the more modern Head First Design Patterns book (not read it myself though).

@@ -113,9 +113,9 @@

What is it about, and why should you read it?

-
-

What does it help with in your career?

-
+
+

What does it help with in your career?

+

You will recognize patterns in libraries you learn, frameworks you use and so on. More importantly you will know of some solutions to commonly occurring problems in object oriented software development, so you can use the design patterns yourself if you encounter problems that are similar in nature.

@@ -125,14 +125,14 @@

What does it help with in your career?

- +

-
-

Effective Java by Joshua Bloch

-
+
+

Effective Java by Joshua Bloch

+

Together with the next entry, Effective Java is one of the more practical books on the list. It shows you in essence how to write good Java code, and code you should avoid writing. Another selling point is that it is written by one of the original authors of the Java standard library; Joshua Bloch himself! If you need a book with code examples and practical tips, I highly recommend this one!

@@ -141,18 +141,18 @@

Effective Java by Joshua Bloch

-
-

What is it about, and why should you read it?

-
+
+

What is it about, and why should you read it?

+

Effective/recommended ways of working with the Java programming language. This includes both effective for readability and for performance. In general the book contains many tips and tricks for working with Javas library and many features. It will make you a better Java programmer, and teach you about parts of the Java Virtual Machine (JVM) that you probably did not know about.

-
-

What does it help with in your career?

-
+
+

What does it help with in your career?

+

If you don't ever use Java (or another JVM language), it won't… But if you do, it will give you value on what GOOD Java code actually is. Should you always use lambdas and streams? (NO!!!). How should serialization be used? This is probably one of the Java books I have had the most use for.

@@ -161,14 +161,14 @@

What does it help with in your career?

- +

-
-

Structure and Interpretations of Computer Programs (SICP) by Harold Ableson, Gerald Sussman and Julie Sussman

-
+
+

Structure and Interpretations of Computer Programs (SICP) by Harold Ableson, Gerald Sussman and Julie Sussman

+

Update 2022: Seems like the newest edition for sale uses JavaScript instead of Scheme. The MIT website still have the second edition that uses Scheme. Not read the newest JavaScript version (put it in my reading list for now), but the original is fantastic! Might be weird to recommend a very non-Java book on this list, but it teaches you different ways of thinking which are useful no matter what language you end up working in (probably except very low level languages).

@@ -187,9 +187,9 @@

Structure and Interpretations of Computer Programs (SICP) by

-
-

What is it about, and why should you read it?

-
+
+

What is it about, and why should you read it?

+

In essence: Thinking differently and learning a new language. In this book you will learn to think in a more functional way, learn to think in different concepts, implement various algorithms and more! One very peculiar highlight is Church Numerals (only a few exercises, but still fun!). Church Numerals is basically treating numbers as functions instead of plain numbers, so they are in a way a method of encoding numbers (and you can indeed convert them to regular numbers).

@@ -200,9 +200,9 @@

What is it about, and why should you read it?

-
-

What does it help with in your career?

-
+
+

What does it help with in your career?

+

If you use any higher level (C level or above) language, and especially those with higher-order functions (functions that return functions or take functions as arguments), then the topics in this book will prove very useful! (even better if you use functional languages like Haskell, Clojure, Elm or something else!). In Java you have streams, in which you can directly use much of what you learn in this book. The most important part is learning to think differently, so you know of different ways to solve problems.

@@ -213,14 +213,14 @@

What does it help with in your career?

- +

-
-

Release It!: Design and Deploy Production-Ready Software by Michael T. Nygard

-
+
+

Release It!: Design and Deploy Production-Ready Software by Michael T. Nygard

+

So you have written your code, and everything has gone well during testing. Now we are ready for production! Wait, are we really? Release It! is a book about what you should make sure of before doing to production, as well as common pitfalls.

@@ -229,18 +229,18 @@

Release It!: Design and Deploy Production-Ready Software by

-
-

What is it about, and why should you read it?

-
+
+

What is it about, and why should you read it?

+

The point of developing software is that is some day will be in production (if it is not a library or framework, then it will be part of other software in production). With this book you can learn some things to check for in your software, how to find errors earlier and what to do when errors happen. Topics includes timeouts, firewall issues, antipatterns for security and more. You will also be introduced to some testing strategies like chaos engineering. As well as stories from the author that are interesting and emphasize the importance of the lessons learned.

-
-

What does it help with in your career?

-
+
+

What does it help with in your career?

+

Going from writing software to getting it in production is an important step. How do you know that your software is easy to maintain? And what do you do if you get problems? I think this book has helped me handle all of these questions better. No projects will be perfect, but you can at least know of some common topics to think about for each project.

@@ -249,14 +249,14 @@

What does it help with in your career?

- +

-
-

Bonus: The Pragmatic Programmer by Dave Thomas and Andy Hunt

-
+
+

Bonus: The Pragmatic Programmer by Dave Thomas and Andy Hunt

+

I would have gotten a lot of complaints from now until eternity if I did not include this title! It is a classic within the niche of software development books, and for good reason. It contains a mix of practical skills you should learn, as well as how you should think about many different topics. It even includes some tips on what you should do to improve your skills. The older edition is called The Pragmatic Programmer: From Journeyman to Master, and the newer 20th anniversary edition is called The Pragmatic Programmer: your journey to mastery. I would probably recommend that you choose the newer edition, but I'm mentioning the older one as that is the one I have read (I have sadly not read the newest edition).

@@ -266,13 +266,13 @@

Bonus: The Pragmatic Programmer by Dave Thomas and Andy Hunt

- +

-
-

Bonus 2: Clean Architecture by Robert C. Martin (aka Uncle Bob)

-
+
+

Bonus 2: Clean Architecture by Robert C. Martin (aka Uncle Bob)

+

Clean Architecture is mainly about software architecture and structure, with the angle on making it easy to work with and maintainable. While I think the architecture presented is interesting, I think the best parts of this book is the summary of the SOLID principles and of general architecture concepts. SOLID principles (which could probably be the topic of their own article) are useful to know for structuring object oriented software, as well as understanding how different libraries and frameworks are structured.

diff --git a/_posts/2020-10-04-java_rethrow_log_exceptions.html b/_posts/2020-10-04-java_rethrow_log_exceptions.html index d721e78..db1b42b 100644 --- a/_posts/2020-10-04-java_rethrow_log_exceptions.html +++ b/_posts/2020-10-04-java_rethrow_log_exceptions.html @@ -14,9 +14,9 @@

-
-

Rethrow/wrap exceptions

-
+
+

Rethrow/wrap exceptions

+

Rethrow/wrap in this case means to throw a new exception with the original as the cause (in other words: passing it to the constructor of our new exception). To see why this is useful, let's take a look at an example. The example might seem stupid, and I somewhat agree as I usually prefer to write code in a more functional way. That being said, it was picked out because it can throw a few different exceptions. Without further ado, let's take a look at the code:

@@ -86,9 +86,9 @@

Rethrow/wrap exceptions

-
-

Logging exceptions

-
+
+

Logging exceptions

+

Sometimes you may choose to log it instead of rethrowing. I prefer that approach if I don't want to throw a new exception, but just return a default value or similar. Your preference may be different. Why log the exception in this case, you may ask? We may want to know in our logs for debugging potential issues. What if the default value is returned each time? Then we might want to investigate and see what caused our original operation to fail (external endpoint down? Issue like in the previous section? Something else?).

diff --git a/_posts/2020-10-20-browser-extension-recommendation.html b/_posts/2020-10-20-browser-extension-recommendation.html index e2bb77e..b10680a 100644 --- a/_posts/2020-10-20-browser-extension-recommendation.html +++ b/_posts/2020-10-20-browser-extension-recommendation.html @@ -18,9 +18,9 @@

-
-

What is it?

-
+
+

What is it?

+

Vimium is an extension for Chromium/Google Chrome, and has also been implemented for Firefox. The implementation is entirely JavaScript (with HTML and CSS), like (almost) all other browser extenions, and loads on browser startup. If you have many startup tabs, then Vimium may be late to start, so you may have to refresh the page to get Vimium started.

@@ -28,9 +28,9 @@

What is it?

-
-

What makes it great?

-
+
+

What makes it great?

+

I don't often say that a browser extension has changed my life, but this one has! Surfing the web with only the keyboard is really comfortable! And having it work in harmony with EXWM makes it really great to use.

@@ -66,9 +66,9 @@

What makes it great?

-
-

My setup

-
+
+

My setup

+

Surprisingly, I don't really need much special setup with this. The only thing I missed in the beginning is that some websites have their own commands (e.g, YouTube or BitBucket). Vimium picks these up by default, so one command I wanted was to be able to send the keyboard commands to the website. Usually these website commands are single characters, so all I needed was a key mapping to send the next command to the website: map e passNextKey. If I type "e" and then "f", then "f" will be sent to the website (e.g, to enable fullscreen on YouTube). That is all I need :)

@@ -89,9 +89,9 @@

My setup

-
-

Summary

-
+
+

Summary

+

So how would I summarize the key points of what makes Vimium the best keyboard-driven browsing experience (for me)? I would summarize it in these three points:

diff --git a/_posts/2021-03-23-programminglanguages2021.html b/_posts/2021-03-23-programminglanguages2021.html index d488471..71972f0 100644 --- a/_posts/2021-03-23-programminglanguages2021.html +++ b/_posts/2021-03-23-programminglanguages2021.html @@ -14,9 +14,9 @@

-
-

Kotlin - The all-rounder

-
+
+

Kotlin - The all-rounder

+

Kotlin is probably a language no one will be shocked to see on this list. The language is both used a lot in the industry these days (as well as the official language for Android development), as well as also being fun to program in! While Java is known to be very verbose and rigid in ways to do things, Kotlin is not! Kotlin doesn't force you to be object oriented, or functional (as in functional programming), you can do things the way you want (within reason). Mix and match, or code the way you are used to from Java, the choice is yours!

@@ -29,9 +29,9 @@

Kotlin - The all-rounder

-
-

Scheme - The Wizards choice

-
+
+

Scheme - The Wizards choice

+

Scheme is probably my favorite language if we just think of the syntax and feeling you get when coding in it. You have probably heard about the Lisp-family, which is one of the oldest and most iconic families of programming languages. S-expressions (aka sexps, symbolic expressions etc.) are a central concept of the syntax, which is used for both data and code. Think of it in over-simplified terms as a way to write code using polish notation (operator at the beginning like this (+ x y) instead of the classical x + y) and doing it with parenthesis in a way that make tree-structures. Let's do an example: (+ (* 2 10) (- 10 5)) which evaluates to 25.

@@ -45,9 +45,9 @@

Scheme - The Wizards choice

-
-

Prolog - the logical choice

-
+
+

Prolog - the logical choice

+

Learning to solve problems in different ways, is in my view one of the most important parts of being a good programmer. When we learn to solve a problem in a completely different ways, it improves our understanding of the problem, and possibly also related problems. This is where Prolog comes in. If you are not familiar with logic programming, the term might just sound like what we are used to. Isn't all programming logical? Prolog is in the family of logic programming, where we think of problems in a different way. Instead of describing a recipe for steps we want to do, we describe rules of how our "logical world" work, and query the rules. In other words, Prolog is declarative, we specify what we want not the steps to accomplish it.

@@ -59,9 +59,9 @@

Prolog - the logical choice

-
-

"I know all the above!!!"

-
+
+

"I know all the above!!!"

+

If you know all the languages I have listed above (or don't find them interesting), then you will have to find something else. Maybe Common Lisp will interest you? Or Haskell? Maybe scripting with Rexx is more your thing? Several of these might be topics for future blog posts. What do I want to look into in the near future? My plan as of now is to look more into Pony (ponylang), While the language has a weird name, it also have some interesting properties relating to concurrency. Features of the language includes compile-time protection against data-races (two threads/processes accessing the same data at the same time) using its type-system, the actor-model being a central concept and more. Maybe I will feel inspired to write an article about it in the future?

diff --git a/_posts/2021-07-28-summer_books_2021.html b/_posts/2021-07-28-summer_books_2021.html index 8f52e52..f383d7d 100644 --- a/_posts/2021-07-28-summer_books_2021.html +++ b/_posts/2021-07-28-summer_books_2021.html @@ -13,9 +13,9 @@

-
-

Hackers: Heroes of the computer revolution

-
+
+

Hackers: Heroes of the computer revolution

+

@@ -28,9 +28,9 @@

Hackers: Heroes of the com

-
-

Game Engine Black Book: Wolfenstein 3D

-
+
+

Game Engine Black Book: Wolfenstein 3D

+

@@ -43,9 +43,9 @@

Game Engine Black Book: Wo

-
-

Spying on Whales

-
+
+

Spying on Whales

+

@@ -64,9 +64,9 @@

Spying on Whales

-
-

Bonus..?

-
+
+

Bonus..?

+

Update 2022: Nevermoor and its sequels are amazing! Can't wait for book 4 in October! Well worth the read. The mystery of the wundersmith is unraveled more and more in unexpected ways throughout the series :) Considering including a fiction book above, but decided to postpone that to a future article :) If you still really want one from me, then this will do… I'm currently listening to the audiobook of Nevermoor: The Trials of Morrigan Crow by Jessica Townsend. It's a childrens fantasy book, but is still a fun listen! (Gemma Whelan is a great reader/performer!). It is about a cursed child called Morrigan Crow who finds herself caught up in an magical adventure! (don't want to spoil too much, this isn't a book review after all ;) ). diff --git a/_posts/2021-08-04-more_cli_tools.html b/_posts/2021-08-04-more_cli_tools.html index acae44b..dd1cc88 100644 --- a/_posts/2021-08-04-more_cli_tools.html +++ b/_posts/2021-08-04-more_cli_tools.html @@ -10,9 +10,9 @@

-
-

gh

-
+
+

gh

+

Working with github a lot? Miss doing more from the command line instead of visiting the website? (actions, issues etc.). Then gh is the tool for you! You can clone your repos, list issues, see workflows (Github Actions) and more. My favorite feature is to be able to see Actions runs directly in my terminal, which I find way more easy on the eyes than the web browser…

@@ -33,9 +33,9 @@

gh

-
-

fuck/thefuck

-
+
+

fuck/thefuck

+

Often misspell commands? You are not alone. There is actually a command line application to help you, with the fitting name fuck! Wrote a command wrong? Just type fuck, and it will be corrected and run. The first few times you run it, you will be prompted for suggestions (mostly correct the first time). This is probably just to set up rules based on your usage. There are even some default correction rules. Install it, type a command wrong (e.g, got commit), type fuck, and it will run the correctly spelled one (git commit).

@@ -48,9 +48,9 @@

fuck/thefuck

-
-

tree

-
+
+

tree

+

Some people might feel like this is mundane and boring, but here goes… tree is included in many GNU/Linux distros, but not all. I used to believe that this is a tool everybody use, but I keep getting surprised that people don't know about it. So what is tree? Simply put, it prints the directory structure (including files) to the terminal (in pure text off course). That's it! You can pipe it, use it directly or whatever you want to do with it! There are several options, including filesizes, levels down, and so on. Many directories are big, and for that I sometimes pipe the output with less like so tree | less.

diff --git a/_posts/2021-09-13-recommended_emacs_packages.html b/_posts/2021-09-13-recommended_emacs_packages.html index d18ae9f..b859062 100644 --- a/_posts/2021-09-13-recommended_emacs_packages.html +++ b/_posts/2021-09-13-recommended_emacs_packages.html @@ -14,9 +14,9 @@

-
-

helm

-
+
+

helm

+

Helm (no, not that helm, Emacs helm) improves navigation in Emacs tremendously! From navigating files better (see screenshot above, this is just C-x C-f), a better menu to navigate open buffers, better M-x execute command menus, searching and more! If you want more functionality, there are tons of extensions, with one of my personal favorites being helm-flyspell (to correct spelling mistakes). There are many others like helm-google, helm-swoop and more!

@@ -30,9 +30,9 @@

helm

-
-

magit

-
+
+

magit

+

Most people use git these days. Not only is it great for code, it is great for any work consisting of text (not binary encoded formats though…). Magit makes using git even greater! It gives nice navigatable menus inside Emacs for using git, nice keyboard shortcuts, and more! While using git with the command line is great, there is NOTHING on this planet comparable to the sheer beauty of being able to do so inside Emacs! The git status equivalent, where I can see changes by navigating with the arrow keys and using the TAB key, currently looks like this in my .emacs repo:

@@ -47,9 +47,9 @@

magit

-
-

org mode

-
+
+

org mode

+

org-mode is included in Emacs, but you can download a newer version to get more up to date features and fixes. At its core, org-mode is about editing text. Including source code, verbatim snippets and more is as easy as ever. You can even use org-mode for spreadsheets (with ELisp formulas!), making it a good Excel killer (at least in my view)! You can even use org-agenda to plan your day with meetings and other events.

@@ -67,9 +67,9 @@

org mode

-
-

undo-tree

-
+
+

undo-tree

+

Sometimes feel that the undo/redo-functionality in your editor is limited? That you sometimes want a tree instead of a straight line? undo-tree provides exactly that! This may seem abstract, and you need to try it to fully understand why you need it. You can go back and forth, continue on a trail you did earlier, find out that it was the wrong trail, navigate to a new place in your undo-history, continue from there, go back again, and so on! Might seem confusing, so I recommend trying it out for yourself. There is only so much a screenshot can tell you here. That being said, it is one of my favorite Emacs packages! :)

@@ -79,9 +79,9 @@

undo-tree

-
-

Final remarks

-
+
+

Final remarks

+

As I said in the introduction, there are many more packages out there. Do you have any favorites? Feel free to share in the comments! :)

diff --git a/_posts/2021-09-22-essential_ayn_rand.html b/_posts/2021-09-22-essential_ayn_rand.html index b504f08..65f8b65 100644 --- a/_posts/2021-09-22-essential_ayn_rand.html +++ b/_posts/2021-09-22-essential_ayn_rand.html @@ -40,9 +40,9 @@

-
-

1. Atlas Shrugged

-
+
+

1. Atlas Shrugged

+

Who is John Galt? This is the essential question in all of the book. Often mentioned in times of despair, and for questions that people think it's meaningless to ask (because they are in a way impossible to answer). The book follows several characters in a near future where government creates more and more irrational rules and regulations, all posed as acts for the common good, but lobbied through by cronies (people who use government favors to gain special privileges). Dagny Taggart is our main heroine, and we see her fighting to keep her railroad company alive while all of the productive people around her slowly disappear. "What is wrong with the world?". Why ask useless questions? How deep is the ocean? How high is the sky? Who is John Galt?

@@ -65,9 +65,9 @@

1. Atlas Shrugged

-
-

2. The Fountainhead

-
+
+

2. The Fountainhead

+

Howard Roark is a young idealistic architect who has his own vision, but is forced to choose between it or adapting to what others think is great. At first glance, you may think he sounds like a lunatic, but that is not true. Indeed, he is a visionary. No one who has innovated has ever done what everybody else is already doing. This book deals with themes such as being true to your own ideals, reason, public perception and deception (through media), romantic love, and hate for people being different. We see Roark struggling through life as he unapologetically follow through on his own vision, trying to get the buildings he want to build into reality. He enjoys doing it immensely, and with great passion. From the book we have this exchange between him and the dean of the architect school he is expelled from:

@@ -106,9 +106,9 @@

2. The Fountainhead -

3. The Virtue of Selfishness

-
+
+

3. The Virtue of Selfishness

+

The two previous books on this list were works of fiction, but this one is different. This book contains a collection of essays on Objectivist ethics. Why do I like this book so much? This book provides answer to a lot of questions relating to morality (i.e, the concept of ethical selfishness), and the introduction of capitalism as the only moral system (and why).

@@ -120,9 +120,9 @@

3. The Virtue of Selfishne

-
-

Final remarks

-
+
+

Final remarks

+

Ayn Rand is both an interesting character, as well as having written great works. If you want to learn more about her as a person (she is far from perfect, but no one is!), then I suggest reading the biography called Goddess of the Market: Ayn Rand and the American Right.

diff --git a/_posts/2021-09-26-scifi_books_to_unwind.html b/_posts/2021-09-26-scifi_books_to_unwind.html index 6d5fed1..5cf8da9 100644 --- a/_posts/2021-09-26-scifi_books_to_unwind.html +++ b/_posts/2021-09-26-scifi_books_to_unwind.html @@ -19,9 +19,9 @@

-
-

1. Rendevouz with Rama by Arthur C. Clarke

-
+
+

1. Rendevouz with Rama by Arthur C. Clarke

+

@@ -39,9 +39,9 @@

1. Rendevouz with Rama by

-
-

2. Do Androids dream of electric sheep (aka Blade Runner) by Philip K. Dick

-
+
+

2. Do Androids dream of electric sheep (aka Blade Runner) by Philip K. Dick

+

@@ -54,9 +54,9 @@

2. Do Androids dream of el

-
-

3. Starship Troopers by Robert Heinlein

-
+
+

3. Starship Troopers by Robert Heinlein

+

diff --git a/_posts/2021-10-02-no_nonsense_command_line.html b/_posts/2021-10-02-no_nonsense_command_line.html index 663c149..76802d0 100644 --- a/_posts/2021-10-02-no_nonsense_command_line.html +++ b/_posts/2021-10-02-no_nonsense_command_line.html @@ -10,9 +10,9 @@ -

-

Prerequisites

-
+
+

Prerequisites

+

The only thing you need to follow this guide is to have a terminal/command line on your system, which is in the Bash-family of command lines. That's it! This does NOT include Windows CMD or Powershell, as these are different beasts (CMD have more in common with MS DOS than Bash-based command lines). All standard terminals for Linux distributions and Mac OS X will work, as well as the previously defined options for Windows (Linux Subsystem, Cygwin, Git Bash).

@@ -35,9 +35,9 @@

Prerequisites

-
-

Why should you learn to use the command line in 2021 (or later)?

-
+
+

Why should you learn to use the command line in 2021 (or later)?

+

There are many reasons to learn the command line! Some of them include:

@@ -52,9 +52,9 @@

Why should you learn to use the command line in 2021 (or lat

-
-

Your first command!

-
+
+

Your first command!

+

So you have finally come this far? You are ready to type in your first commands and experience the wonders of the command line for the first(ish) time? Let's start by opening your command line application / terminal emulator, then typing pwd, which might look something like this (including your prompt):

@@ -97,17 +97,17 @@

Your first command!

-
-

File management and navigation

-
+
+

File management and navigation

+

pwd was probably a very uninteresting command to start with, but don't worry! Now we begin with some real commands for navigation and looking at your files, before continuing with even more interesting commands as each section progresses!

-
-

ls - list directory

-
+
+

ls - list directory

+

We are currently in a directory, but how do we see the files in it? This is where the ls comes in! You might see something like this:

@@ -153,9 +153,9 @@

ls - list directory

-
-

cd - change directory

-
+
+

cd - change directory

+

For now, we have been stuck at our starting directory. Let's change that! If we are still in our home folders, we can navigate to our Documents folder (or another folder if your folder structure is different):

@@ -185,9 +185,9 @@

cd - change directory

-
-

rm - remove/delete file

-
+
+

rm - remove/delete file

+

Want to delete a file? The rm command is at your service! Just do rm myfile.txt and myfile.txt will be removed/deleted. You can use complete paths (like Documents/Budgets/2019/myfile.txt) as well as files in the same folder here. If you want to delete multiple files, you can add them after your first. rm myfirstfile.txt myotherfile.txt yetanother.txt (or more files if you want to)

@@ -203,18 +203,18 @@

rm - remove/delete file

-
-

rmdir - remove/delete (empty) directory

-
+
+

rmdir - remove/delete (empty) directory

+

Let's say you want to delete a directory with no files in it? There is a command for that as well! rmdir Documents will delete your Documents directory if it's empty. (see the previous info-box on rm -rf for deleting non-empty directories and some dangers for beginners relating to this command).

-
-

mkdir - create a directory

-
+
+

mkdir - create a directory

+

Just like rmdir deletes an empty directory, mkdir creates one! mkdir Documents will create a directory called documents.

@@ -222,9 +222,9 @@

mkdir - create a directory

-
-

cp - copy file

-
+
+

cp - copy file

+

Want to copy a file to another destination? The command is simple; cp followed by the full path of the file you want to copy (either a filename or a path like Documents/Budgets/2019/mybudget.txt) and the destination (either just a filename or a complete new path). Example:

@@ -266,17 +266,17 @@

cp - copy file

-
-

Viewing files in your terminal/command line

-
+
+

Viewing files in your terminal/command line

+

So far we have navigated around, deleted files, copied and so on, but we have never really viewed our file contents outside a text editor. In this section we will do exactly that!

-
-

cat

-
+
+

cat

+

The simplest way to view a file is the cat command. cat simply prints the content of the file like this:

@@ -292,9 +292,9 @@

cat

-
-

less

-
+
+

less

+

A slightly more advanced way of viewing files is to use the command called less. less let's us navigate our file and view it as well. For one of my files (my default layout for this blog) it looks like this:

@@ -313,9 +313,9 @@

less

-
-

Piping

-
+
+

Piping

+

Let us quickly introduce echo to make our examples more clear. echo simply prints its input:

@@ -341,17 +341,17 @@

Piping

-
-

Searching

-
+
+

Searching

+

Sometimes you may not know where a file is, or may want to know which line of a file a given text resides.

-
-

find - finding files matching criteria

-
+
+

find - finding files matching criteria

+

find can be used for many things, including finding files matching a given name. This is the most common use-case and what we will cover the basics of here. If you are curious about more ways to use find, you can find documentation using the resources in the next section (Finding documentation).

@@ -364,9 +364,9 @@

find - finding files matching criteria

-
-

grep - search content in files and input text

-
+
+

grep - search content in files and input text

+

Let's say we want to search for contents in files instead. The simplest use case can be covered with the command grep -Rn "My Search Text" . (. for search to begin in the same directory we are in). Then you will get each occurrence listed. Each line will look like this (here I have searched for Clive Sinclair on the local files for this blog):

@@ -387,9 +387,9 @@

grep - search content in files and input text

-
-

Finding documentation

-
+
+

Finding documentation

+

So far some of the options to the programs above may seem a little bit cryptic. How do people learn about all of them? Well, you rarely need to know all of them, but there are resources to make them easier to handle.

@@ -423,9 +423,9 @@

Finding documentation

-
-

A whirlwind tour of scripting

-
+
+

A whirlwind tour of scripting

+

Covering everything about shell scripting would make this guide way to long, as the topic is worthy of an article in itself. (let me know if you would want one!). There are several good resources to get you started, like ShellScript.sh or the man-page for bash (man bash).

@@ -477,9 +477,9 @@

A whirlwind tour of scripting

-
-

What's next?

-
+
+

What's next?

+

Now you have gotten started and learned the basics of the command line, and even some shell scripting. What's next? Depending on your skill level and what you want to achieve, there are several options ahead! I can not possibly make an exhaustive list of everything you want to do, but below are some suggestions:

diff --git a/_posts/2021-10-04-macosx_software.html b/_posts/2021-10-04-macosx_software.html index c5a775e..3e8c626 100644 --- a/_posts/2021-10-04-macosx_software.html +++ b/_posts/2021-10-04-macosx_software.html @@ -19,9 +19,9 @@

-
-

Homebrew

-
+
+

Homebrew

+

If any software on Mac OS X is truly essential, then this is it! Homebrew is a package manager that has lots of software for us to install. If you are familiar with any package manager in a Linux distribution, or even the package manager to make Windows slightly livable called Chocolatey, then Homebrew will be familiar to you. It is used from the command line to install all sorts of software. Everything from Emacs (see below), wget, Firefox, to FL Studio (music creation software) and more, is available. This is my preferred way to install software, as most of the tools I need is available there (as well as a reasonable way to install software, e.g, brew install lolcat to install the lolcat package)

@@ -34,9 +34,9 @@

Homebrew

-
-

iTerm2 (with ZSH and Oh-MyZsh)

-
+
+

iTerm2 (with ZSH and Oh-MyZsh)

+

The built in command line/terminal in Mac OS X is okay, but lacking in features. iTerm2 gives us more configuration options, like more advanced theming and different profiles with their own settings. In addition, you get tabs, images (also including unicode symbols and smileys), and triggers (trigger certain actions when a certain pattern of text happens). All in all a more modern experience when using a terminal on Mac OS X!

@@ -54,9 +54,9 @@

iTerm2 (with ZSH and Oh-MyZsh)

-
-

In your face!

-
+
+

In your face!

+

Need to remember your appointments and meetings? Need notifications that are intrusive to really help you remember? Maybe because the notifications already present in your other applications gets hidden? This is exactly the kind of problems In Your Face! solves! It will pop up fullscreen so you can't miss it. You will have to click the ok-button to get rid of it, and will have already shown you which meeting, where it is and more!

@@ -64,9 +64,9 @@

In your face!

-
-

Emacs

-
+
+

Emacs

+

This should not be a shock to most people, but is probably a weird pick as it's multi-platform (which is why I put it last). To me Emacs is an essential part of any system I set up. Some people might complain that it's just a text editor for programmers, but that could not be further from the truth. While you will have an easier time if you have technical skills, Emacs can also be used for writing essays and books (as well as blogging, hello!), using org-mode and olivetti. There are packages to solve lots of problems, so why not try Emacs as an MS Excel replacement? Or a file manager? Simple music creation? Testing REST APIs? There are tons more to check out as well! Maybe you want check out the amazing website called Emacs Rocks and be inspired?

@@ -79,9 +79,9 @@

Emacs

-
-

Bonus: Amphetamine

-
+
+

Bonus: Amphetamine

+

Bothered that your Mac sleeps while you do something without touching the keyboard or mouse for a while? (maybe you read something, wait for a process to complete or something else?). One option is off course to increase the time before your Mac sleeps, but if you want to add exceptions to that rule, then Amphetamine will keep your Mac awake while that application is running! Amphetamine can be extremely useful for some kinds of processes (reading newspapers, waiting for compilations or other things etc.), but I don't use it very often (though it is very useful the times I use it). (I realize that the last sentence can seem a little weird if you take it out of context, but this happens when developers give their software fun names :) )

diff --git a/_posts/2021-10-08-emacs_packages_that_make_me_happy.html b/_posts/2021-10-08-emacs_packages_that_make_me_happy.html index 9927708..1d389a2 100644 --- a/_posts/2021-10-08-emacs_packages_that_make_me_happy.html +++ b/_posts/2021-10-08-emacs_packages_that_make_me_happy.html @@ -19,9 +19,9 @@

-
-

Emojify

-
+
+

Emojify

+

This is probably the most useless, but fun package that I use daily. What it does is simple: show emojis in code comments, text (like Org-Mode), and other places you (may) want them. To get started with Emojify you install it based upon the guides on their github repo. The first time you use it, it will download a set of emojis for you (github emojis if I remember correctly, so many flags, smileys, snake, fruits, etc.). If you are the adventurous type, you can even add your own (sadly I have not done this).

@@ -38,9 +38,9 @@

Emoji

-
-

rainbow-mode

-
+
+

rainbow-mode

+

This is probably the most useful package in this article, especially when doing web development (CSS or other stylesheets especially!). What it does is show color codes (hexadecimal, literals etc.) highlighted with the color they are describing. How does it look? It looks pretty neat! Let's take an example from the main SASS (CSS extension language) stylesheet for this blog:

@@ -71,9 +71,9 @@

rainbo

-
-

dashboard

-
+
+

dashboard

+

dashboard replaces the old boring startup screen with a personalized dashboard. This includes a banner, your latest projects (if Projectile is used), latest files worked on, and more depending on your likings. All of it can be configured as you want it. Want to only show 5 latest projects and 10 last worked on files? With a picture of your level 60 shaman as a banner? You do you! If you are nice and structured, then you can show org-agenda (todos, diary etc.) items too.

diff --git a/_posts/2021-10-11-become_a_maven_ninja.html b/_posts/2021-10-11-become_a_maven_ninja.html index a51f807..763fb2e 100644 --- a/_posts/2021-10-11-become_a_maven_ninja.html +++ b/_posts/2021-10-11-become_a_maven_ninja.html @@ -23,13 +23,13 @@ My last self-promotion before we begin… General command line skills can be very useful when working with almost any command line tool, including Maven. If you need a refresher, I recently wrote a guide to getting started with the command line (important topics: piping, searching with grep, less).

-
-

Basic usage and flags

-
+
+

Basic usage and flags

+
-
-

Check Maven version

-
+
+

Check Maven version

+

I want to show this for one reason, it's useful when checking for possible errors. Simply type mvn -v and you will get information about the Maven and Java versions currently being used:

@@ -41,9 +41,9 @@

Check Maven version

-
-

package vs install

-
+
+

package vs install

+

You may have noticed that you have a .m2-folder in your home directory. This can contain a settings.xml file (if you have specific local settings like proxies), as well as your local Maven repository (where Maven downloads and stores dependencies and artifacts locally). Why is this important? package builds your project (compiles, run tests etc.), and install does the same in addition to installing it (copying it) to your local Maven repository (.m2/repository).

@@ -54,18 +54,18 @@

package vs install

-
-

using -f option to run a specific pom file

-
+
+

using -f option to run a specific pom file

+

Just like the title says. If you do something like mvn -f mymodule/pom.xml install, Maven will build based upon the pom.xml file in the directory mymodule instead of the directory you are currently in.

-
-

using -X option to get debug information

-
+
+

using -X option to get debug information

+

mvn -X goals (replace goals with the actual Maven goals!) will show you looooots of information you can use when debugging possible issues. Just be aware that this is a lot of information! Ranging from all packages imported, what settings files are used (local for your user as well as global settings for the computer), complete configurations for things like Surefire (testing) and so on.

@@ -79,13 +79,13 @@

using -X option to get debug information

-
-

Tests

-
+
+

Tests

+
-
-

Run single test(class)

-
+
+

Run single test(class)

+

You can run only tests with mvn test, but did you know you can run just a single test class by using mvn test -Dtest=MyClassTest? If you have several test classes with that name, use the fully qualified name (including package, example: com.example.MyClassTest).

@@ -97,18 +97,18 @@

Run single test(class)

-
-

Don't trim stack trace

-
+
+

Don't trim stack trace

+

Sometimes you get unexpected nullpointers or other exceptions within the method you are testing. Some times you will se a very minimal stack trace with just your test method, and the rest cut off (aka trimmed). If you want the complete stack trace with causes, line numbers etc., then you can use the definition -DtrimStackTrace=false! (works with test, package install, other goals, etc.). Helps me a lot, especially since I prefer to use the command line instead of big bloaty IDEs.

-
-

Skipping tests

-
+
+

Skipping tests

+

Want to skip all tests when building? mvn install -DskipTests will run install like usual, but not run any tests (but they will still be compiled!).

@@ -117,22 +117,22 @@

Skipping tests

-
-

Dependency plugin

-
+
+

Dependency plugin

+
-
-

tree

-
+
+

tree

+

mvn dependency:tree is one of the most useful commands for checking the dependencies in your project, including transitive dependencies (dependencies of your dependencies and so on). This include all versions of dependencies being used. These reports can be quite long for bigger projects, so it can be useful to pipe the result to less or search it using grep (if you have a suspicion of deprecated code and similar causing weird behavior).

-
-

analyze

-
+
+

analyze

+

Have a suspicion that you use conflicting versions of packages? Or have unused dependencies in your project? mvn dependency:analyze can help you here! It will print all info like this. (also useful to browse by piping the output to less!).

@@ -143,9 +143,9 @@

analyze

-
-

display-ancestors

-
+
+

display-ancestors

+

Many enterprises (and maybe open source projects) have hierarchies of parent pom files to handle global settings, approved dependency versions and so on. Sometimes you may want to see what version of parent poms you are currently using (maybe to debug if you are using the correct one, because these things can be updated!). Then mvn dependency:display-ancestors is your friend! Running it with a new Spring Boot project will show you the version of the Spring Boot starter poms it's using:

@@ -155,9 +155,9 @@

display-ancestors

-
-

Versions

-
+
+

Versions

+

Maven have a versions plugin that can be used for several operations relating to versions. The only command here I find useful is mvn versions:set -DnewVersion=1.0.0. This will set the new versions of your project (including submodules) to 1.0.0. No need to edit the files manually! Neat!

@@ -165,9 +165,9 @@

Versions

-
-

Bonus: ZSH completion

-
+
+

Bonus: ZSH completion

+

Oh-My-ZSH has some really useful completions so you don't have to memorize any Maven commands. Just add mvn to your plugins list, open a new tab in your terminal (or new session) and you get nice completion! (you probably need Maven installed first, just to mention it…). Mine looks like this plugins=(git z gh mvn thefuck) on my personal machine (kubectl is also super useful if you use Kubernetes!).

diff --git a/_posts/2021-10-15-retro_programming_youtubers.html b/_posts/2021-10-15-retro_programming_youtubers.html index a2b6691..4f24b8d 100644 --- a/_posts/2021-10-15-retro_programming_youtubers.html +++ b/_posts/2021-10-15-retro_programming_youtubers.html @@ -9,9 +9,9 @@

-
-

Coding Secrets - Tricks from older TT games and more!

-
+
+

Coding Secrets - Tricks from older TT games and more!

+

These tricks truly show you how clever animations, interrupts and various other effects can produce quite interesting imagery!

@@ -24,9 +24,9 @@

-

Modern Vintage Gamer - Programming, gaming hardware and more!

-
+
+

Modern Vintage Gamer - Programming, gaming hardware and more!

+

MVG does a lot of new development, but is also experienced with homebrew development for the original Xbox and modern platforms like the Nintendo Switch. He also have videos about the hardware of various systems that are easy to follow! (and have fun historical tidbits as well! Making them great even when you know hardware details!)

diff --git a/_posts/2021-10-16-java_serviceloader.html b/_posts/2021-10-16-java_serviceloader.html index 12abeba..fbb9c93 100644 --- a/_posts/2021-10-16-java_serviceloader.html +++ b/_posts/2021-10-16-java_serviceloader.html @@ -9,9 +9,9 @@

-
-

Simple example: A service with a single implementation

-
+
+

Simple example: A service with a single implementation

+

Let's start with the most simple example possible to show the basic functionality. Later we will see a more useful example, but it's always useful to see the complete basics first.

@@ -75,9 +75,9 @@

Simple example: A service with a single implementation

-
-

Taking it a bit further: CurrencyProvider

-
+
+

Taking it a bit further: CurrencyProvider

+

Let's go a step further with another toy example, that may seem a little bit more useful, and show what ServiceProvider is capable of. CurrencyProvider will be an interface for services/implementations providing the default currency for the area they are in. We will create implementations for Norway, EU and the US. In the real world, this might be a little more advanced (using real ISO standard country codes consistently etc.), but let's keep it simple for the sake of the example.

@@ -228,9 +228,9 @@

Taking it a bit further: CurrencyProvider

-
-

Making it simpler: Maven plugin

-
+
+

Making it simpler: Maven plugin

+

Maybe you have a big project with many implementations to a service? Or you just hate creating the text files describing implementations. There is (shockingly not) a Maven plugin for that! With this Maven plugin you can generate the services files. Let's see how that would look for our CurrencyProvider example above:

@@ -280,9 +280,9 @@

Making it simpler: Maven plugin

-
-

Final remarks

-
+
+

Final remarks

+

Maybe you are still unsure what kind of problems to use it for? Here are a few examples:

diff --git a/_posts/2021-10-20-springboot_easy_customizations.html b/_posts/2021-10-20-springboot_easy_customizations.html index c7d11bd..894f75e 100644 --- a/_posts/2021-10-20-springboot_easy_customizations.html +++ b/_posts/2021-10-20-springboot_easy_customizations.html @@ -9,9 +9,9 @@

-
-

Custom banner

-
+
+

Custom banner

+

When you start your Spring Boot application you will see a banner like this:

@@ -57,9 +57,9 @@

Custom banner

-
-

Static web pages

-
+
+

Static web pages

+

Now time for the most known feature in this article: hosting static webpages with Spring Boot. You may or may not know that files found in src/main/resources/static are hosted as webpages when running your application? This means you can make an index.html file that is served when accessing the root path of your server in the browser. Try making one, and run mvn spring-boot:run (if you use Maven), and you can access it at localhost:8080 (unless a different URL is configured). To show you an example, here is an index.html file:

diff --git a/_posts/2021-10-26-javascript_the_good_parts.html b/_posts/2021-10-26-javascript_the_good_parts.html index 9e08c16..57f7ffb 100644 --- a/_posts/2021-10-26-javascript_the_good_parts.html +++ b/_posts/2021-10-26-javascript_the_good_parts.html @@ -21,9 +21,9 @@

-
-

JavaScript: The Good Parts by Douglas Crockford

-
+
+

JavaScript: The Good Parts by Douglas Crockford

+

@@ -47,9 +47,9 @@

JavaScript: The Good Parts -
-

Prototypes???

-
+
+

Prototypes???

+

Some of you may have programming in modern JavaScript without knowing anything about prototypes. This may lead you to think "wtf, is this even the same language I use?!?", but fear not. Here is a little teaser to show you the basics of how it works. If you are interested in learning more, I recommend picking up the above book, as prototypes can be a powerful concept! :) Prototypes, if we over-simplify a bit, is a style of object oriented programming where objects have prototypes they inherit methods from. Might seem abstract, so let's show an example.

@@ -88,9 +88,9 @@

Prototypes???

-
-

Who should read this book?

-
+
+

Who should read this book?

+

I think there are several types of people who might get some useful tips and joy out of this book:

diff --git a/_posts/2021-11-03-kotlin_in_emacs.html b/_posts/2021-11-03-kotlin_in_emacs.html index d9e7652..bb62bc3 100644 --- a/_posts/2021-11-03-kotlin_in_emacs.html +++ b/_posts/2021-11-03-kotlin_in_emacs.html @@ -15,9 +15,9 @@

-
-

Quick recap: What is LSP

-
+
+

Quick recap: What is LSP

+

LSP is an acronym for Language Server Protocol. It's a common JSON-RPC protocol used to create servers for different languages. This makes it possible to create tooling in all editors that use these servers to provide IDE functionality (i.e, not editor specific tooling). There are LSP modes to use these servers for VSCode, Vim, Emacs and more! It was developed by Microsoft, but later standardized. Great to have a standard way of making these servers, as it is now much easier to create completions in most editors with less custom code!

@@ -25,9 +25,9 @@

Quick recap: What is LSP

-
-

Kotlin Language Server

-
+
+

Kotlin Language Server

+

We have talked about LSP and what it is, so the next question you might ask is what LSP server we use for Kotlin? The answer is Kotlin Language Server. Global completions (e.g, from other files or Maven dependencies) were added this summer, so now it has the complete functionality we would need to write Kotlin code. (understandable that it took some time, as the issue was a little tricky to solve, and there are few people working on this project. Kudos to the developers, you guys are awesome! <3).

@@ -53,9 +53,9 @@

Kotlin Language Server

-
-

lsp-mode

-
+
+

lsp-mode

+

lsp-mode is my favorite LSP mode in Emacs (you also have Eglot and others), and it's continually being developed and maintained. The last few years all of the early bugs were fixed, and now it is close to perfect (might also be that newer versions of Emacs has solved some of them as well).

@@ -119,9 +119,9 @@

lsp-mode

-
-

KScript?

-
+
+

KScript?

+

Before we get started, why do I use KScript? Why not just pure Kotlin Script (that is included by default). This is because the built in version is missing some features like Maven dependencies, file inclusions and more. KScript gives us all of these. Now back on topic…

diff --git a/_posts/2021-11-10-jvm_scripting.html b/_posts/2021-11-10-jvm_scripting.html index 2ec4b18..e0e09e0 100644 --- a/_posts/2021-11-10-jvm_scripting.html +++ b/_posts/2021-11-10-jvm_scripting.html @@ -26,9 +26,9 @@

-
-

JBang

-
+
+

JBang

+

Java has always known to be very big and verbose, with the need to many project structures and more to get in dependencies in a clean way. JBang makes this way easier by making it possible to run Java code like a script. Just but the shebang on the top of the file, and it will run like any other script! Java doesn't recognize the standard one, so JBang has a comment style one that still works like any other script in a Unix-like system. Let's show a simple example on how this looks:

@@ -83,9 +83,9 @@

JBang

-
-

KScript

-
+
+

KScript

+

Kotlin already has scripting functionality built-in, so why would we need something like KScript? KScript gives us a lot of extra functionality that proves quite useful, like including Maven dependencies and additional files. Let's start with a cool little example (notice the shebang at the top):

diff --git a/_posts/2021-11-15-emacs_small_tips.html b/_posts/2021-11-15-emacs_small_tips.html index 7627e08..94c1aa3 100644 --- a/_posts/2021-11-15-emacs_small_tips.html +++ b/_posts/2021-11-15-emacs_small_tips.html @@ -10,9 +10,9 @@

-
-

emacsclient and server

-
+
+

emacsclient and server

+

I usually have my Emacs session open for days (or weeks? months?), and rarely close it unless I have to. Therefore it does not come naturally to me to close my session and open a file in it from the command line. Sometimes we may just want to open a file in our current Emacs session directly from the command line. This is where emacsclient comes in! The word client is used, so there must be a server, right? Yes. In your .emacs config (or just a scratch buffer) you can start a server using:

@@ -37,9 +37,9 @@

emacsclient and server

-
-

exec-path-from-shell

-
+
+

exec-path-from-shell

+

It can be quite tedious if your PATH variables aren't included into Emacs when running it. Using exec-path-from-shell fixes that, and can be activated like I do here with this use-package configuration:

@@ -57,9 +57,9 @@

exec-path-from-shell

-
-

un-clutter the UI and show battery percentage

-
+
+

un-clutter the UI and show battery percentage

+

By default when starting a GUI session in Emacs, there are menu bars, tool bars and scroll bars. In my opinion, these clutter the UI, and take the focus away from the contents of the buffer. When running a graphical session (i.e, not a terminal session using -nw or over SSH without an X-server), I prefer to remove those. Showing the battery status in the modeline can also be very useful. I do all of the above using the following small snippet:

@@ -80,9 +80,9 @@

un-clutter the UI and show battery percentage

-
-

show-paren-mode

-
+
+

show-paren-mode

+

show-paren-mode is one of my favorite little nuggets of built-in Emacs goodness! What it does is highlight parenthesis (including brackets/braces), namely the beginning and end tags associated with each other, based upon your text cursor position. This functionality is best illustrated with a series of screenshots, here using the previous code block (removing UI clutter):

@@ -101,9 +101,9 @@

show-paren-mode

-
-

Others?

-
+
+

Others?

+

There might be other bigger changes you may want to do, including big changes to navigation. I covered some in an article on recommended Emacs packages earlier.

diff --git a/_posts/2021-11-17-favorite_personal_finance_books.html b/_posts/2021-11-17-favorite_personal_finance_books.html index 8c8cfc7..d5f5493 100644 --- a/_posts/2021-11-17-favorite_personal_finance_books.html +++ b/_posts/2021-11-17-favorite_personal_finance_books.html @@ -48,9 +48,9 @@ -
-

Rich Dad Poor Dad by Robert Kiyosaki

-
+ -
-

The Millionaire Next Door by William Danko and Thomas Stanley

-
+
+

The Millionaire Next Door by William Danko and Thomas Stanley

+

@@ -95,9 +95,9 @@

The Millionaire Next Door

-
-

The 4 Hour Workweek by Timothy Ferriss

-
+
+

The 4 Hour Workweek by Timothy Ferriss

+

diff --git a/_posts/2021-11-20-emacs_package_highlight_try.html b/_posts/2021-11-20-emacs_package_highlight_try.html index 0d5665b..5ac19a7 100644 --- a/_posts/2021-11-20-emacs_package_highlight_try.html +++ b/_posts/2021-11-20-emacs_package_highlight_try.html @@ -29,9 +29,9 @@

-
-

Example: Try'ing a theme

-
+
+

Example: Try'ing a theme

+

Let's say you want to try a theme, maybe moe-theme? Trying it is as a simple as doing M-x try (M means the meta key, usually ALT or Escape). Then type moe-theme, and hit enter. Now you can load it with standard settings using (in a scratch buffer or Emacs lisp buffer, eval with C-x C-e):

diff --git a/_posts/2021-11-27-biographies_about_tech.html b/_posts/2021-11-27-biographies_about_tech.html index b853524..46d184a 100644 --- a/_posts/2021-11-27-biographies_about_tech.html +++ b/_posts/2021-11-27-biographies_about_tech.html @@ -24,9 +24,9 @@
-
-

Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future by Ashlee Vance

-
+
+

Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future by Ashlee Vance

+

@@ -39,9 +39,9 @@

Elon Musk: Tesla, SpaceX,

-
-

Steve Jobs by Walter Isaacson

-
+
+

Steve Jobs by Walter Isaacson

+

@@ -54,9 +54,9 @@

Steve Jobs by Walter Isaac

-
-

Idea Man: A Memoir by the Cofounder of Microsoft by Paul Allen (autobiography)

-
+
+

Idea Man: A Memoir by the Cofounder of Microsoft by Paul Allen (autobiography)

+

diff --git a/_posts/2021-11-30-emacs_fun_useless.html b/_posts/2021-11-30-emacs_fun_useless.html index 26a4ce9..c9cd2fc 100644 --- a/_posts/2021-11-30-emacs_fun_useless.html +++ b/_posts/2021-11-30-emacs_fun_useless.html @@ -20,9 +20,9 @@

-
-

Play games

-
+
+

Play games

+

This may shock some people, but you can actually play games inside Emacs! yeah, I know, mind blown. And yes, they are actually written in Emacs Lisp. If you are curious on how they look, here is Tron and Tetris side by side:

@@ -47,9 +47,9 @@

Play games

-
-

Fireplace

-
+
+

Fireplace

+

Annoyed that you have to use a television to simulate a fireplace when none is present? Yeah, me too! You can actually get a nice pixelated fireplace inside of Emacs! The github repo already contains a nice gif on how it looks, so check it out!

@@ -57,9 +57,9 @@

Fireplace

-
-

zone-nyan

-
+
+

zone-nyan

+

Some of us have probably hear of nyan-mode, which shows a Nyan cat progress bar indicating your position in the current buffer. That can actually be defended as useful, as it have some functionality (showing you visually how far you are in a buffer is actually pretty great!). Did you know that there is actually another Nyan cat package in Emacs? zone-nyan just shows Nyan cat in a new buffer, and shows how long you have Nyan'ed in the minibuffer! Looks like this:

@@ -73,9 +73,9 @@

zone-nyan

-
-

Make Emacs sound like a typewriter!

-
+
+

Make Emacs sound like a typewriter!

+

You can do exactly that with selectric-mode, and then every key you type on the keyboard will sound like a typewriter! (except commands it seems). Not really much to show here, as you have to experience the sounds yourself. Just try it! (or, you can listen to the sound in this guys Youtube video if you for some reason really don't want to try it… :( )

diff --git a/_posts/2021-12-01-coding_advent_calendars.html b/_posts/2021-12-01-coding_advent_calendars.html index f5ae3a7..b58270a 100644 --- a/_posts/2021-12-01-coding_advent_calendars.html +++ b/_posts/2021-12-01-coding_advent_calendars.html @@ -19,18 +19,18 @@

-
-

Advent of Code

-
+
+

Advent of Code

+

Advent of Code has been around for many years now. Each day you are served a story, and with it a task that is best solved by coding. This can be everything from finding the maximum number in a file, to paths in graphs. Might sound boring to some, but it makes for fun programming tasks to sometime twist your brain (and sometimes not). Being part of a small Christmas inspired story feels fun as well!

-
-

Bekk - blog calendar

-
+
+

Bekk - blog calendar

+

Bekk has had a tradition for a few years to make a blog-calendar with daily articles on various subjects. In earlier years there have been several calendars relating to both JavaScript, React, Kotlin, Machine Learning, UX and more. This year it seems like there will still be many different topics each day, but not separate calendars for each topic. I can understand that, but will probably miss the Kotlin calendar! Hope we will still see some entries on Kotlin before Christmas!

@@ -43,9 +43,9 @@

Bekk - blog calendar

-
-

KnowIt Julekalender (Norwegian)

-
+
+

KnowIt Julekalender (Norwegian)

+

This one is my favorite! Daily small coding tasks, where you give an answer as either a text or number (not unlike Project Euler in that regard). Each day is a separate task with its own text, and not relate to each other. Fun, and not hard to just jump into one even if you missed the earlier ones.

@@ -53,9 +53,9 @@

KnowIt Julekalender (Norwegian)

-
-

Others in Norwegian?

-
+
+

Others in Norwegian?

+

There are several others in Norwegian as well, and you can read more about them at Kode24 (the Norwegian web based newspaper for software development). I like to keep my blog posts open to an international audience as well, but know that I have some Norwegian readers. The Norwegian ones (like the one from PST ) are often really good! Highly recommended to my Norwegian readers!

diff --git a/_posts/2021-12-11-even_more_cli_tools_to_try.html b/_posts/2021-12-11-even_more_cli_tools_to_try.html index 1f55395..edce4e2 100644 --- a/_posts/2021-12-11-even_more_cli_tools_to_try.html +++ b/_posts/2021-12-11-even_more_cli_tools_to_try.html @@ -21,9 +21,9 @@

-
-

k9s

-
+
+

k9s

+

Do you use Kubernetes? Do you also miss a monitor directly in your terminal? (compared to the UIs often given to us by OpenShift or similar). I know I did, which is why I enjoy k9s so much! k9s is a UI that shows you most of the information you need about your Kubernetes cluster. Pods in a workspace, logs, etc. Some features include:

@@ -47,9 +47,9 @@

k9s

-
-

HTTPie

-
+
+

HTTPie

+

This tool calls a HTTP endpoint and shows you the result. Wait, isn't that just cURL? Yes, and no. HTTPie is more opinionated, and has some nice features, including:

@@ -69,9 +69,9 @@

HTTPie

-
-

chafa

-
+
+

chafa

+

Not really useful, but might be fun! Chafa shows images right in your terminal! Don't get too exited, the resolution will depend on the resolution in your terinal, and will usually be really pixelated. Let's see this blogs banner with chafa (command is just chafa imagefile).

@@ -90,9 +90,9 @@

chafa

-
-

Tools that might be worth checking out

-
+
+

Tools that might be worth checking out

+

I do not currently use these tools, and have barely experimented with them or read about them. They might prove useful or fun to you :)

diff --git a/_posts/2021-12-16-reactive_whats_the_big_deal.html b/_posts/2021-12-16-reactive_whats_the_big_deal.html index 7b5054b..c5db806 100644 --- a/_posts/2021-12-16-reactive_whats_the_big_deal.html +++ b/_posts/2021-12-16-reactive_whats_the_big_deal.html @@ -10,9 +10,9 @@ -
-

What is Reactive? - The original definition

-
+
+

What is Reactive? - The original definition

+

If we visit the ReactiveX website, we see the following definition: "ReactiveX is a combination of the best ideas from the Observer pattern, the Iterator pattern, and functional programming" @@ -36,9 +36,9 @@

What is Reactive? - The original definition

-
-

What is Reactive? - A more descriptive definition

-
+
+

What is Reactive? - A more descriptive definition

+

The original definition makes us think of streams like in Java, and the higher order functions it entails. While this is a great beginning, and a great way to understand the way we code, I don't think it makes it clear what the big whoop is about.

@@ -60,9 +60,9 @@

What is Reactive? - A more descriptive definition

-
-

Nonblocking IO

-
+
+

Nonblocking IO

+

Nonblocking IO has been a term that has gone around like a buzzword on the internet in the last years, and few really know what it means. You might have heard about it for JavaScript runtimes like NodeJS, but do you really feel you have a grasp on the advantages of such an approach? In NodeJS you often see that you give a callback to IO functions (reading files, databases etc.), which is executed once the IO action is done. That is the start of understanding nonblocking IO. The thread is not blocked until the IO action is done, but can do other things.

@@ -138,9 +138,9 @@

Nonblocking IO

-
-

Why Reactive is loved in cloud environments (AWS, Azure, GCP etc.)

-
+
+

Why Reactive is loved in cloud environments (AWS, Azure, GCP etc.)

+

Like we mentioned with nonblocking IO above, reactive code will use less resources than standard imperative code if done correctly. Less resources will equate to a lower bill. All companies, whether you are a startup or enterprise (or even just doing your own spare time project) would like to use the resources you are paying for to the max. If you can handle more request in a cheaper manner, then why not? Combined with something like serverless, you can get minimal resource usage even for many requests. Wait, what the actual f**k is serverless? Another buzzword? Serverless is quickly summarized just instances that activates to service the calls being done (i.e, not running all the time, only when needed), running only the instances needed, and doing small amounts of work. So together with reactive, it uses just the minimal amount of resources on your cloud provider. Examples include Azure Functions and AWS Lambda. Serverless might be a weird word, because we still have servers, but our applications only run on them when needed. When not used, our cloud provider uses the machines for other peoples serverless functions (at least to my understanding, would be stupid to just have them idle ;) )

@@ -152,9 +152,9 @@

Why Reactive is loved in cloud environments (AWS, Azure, GCP

-
-

In conclusion and further reading

-
+
+

In conclusion and further reading

+

Hopefully you have now gotten the main points of what Reactive programming is about. This article only scratched the surface, and there are off course more research you could do. A great start would be looking at some of the articles linked above, or looking at some libraries and how coding with them works. Examples include RxJs, RxJava, and Quarkus (JVM framework, and way more than just Reactive). If you thought event driven architectures using something like Apache Kafka sounded interesting, that can easily be done in Quarkus using Reactive principles (or done with other tools if you just want to research event driven architectures!). Project Loom can be interesting to read about as well, as its virtual threads might improve the efficiency of mixing blocking and nonblocking code in Reactive code bases in the future (or maybe kill Reactive as some people seem to think, like Brian Goetz). Maybe you instead want to know how Reactive libraries and frameworks are coded? Then you can research the patterns often used like the Reactor pattern, or Proactor pattern (used by Quarkus).

diff --git a/_posts/2021-12-20-five_reasons_i_love_emacs.html b/_posts/2021-12-20-five_reasons_i_love_emacs.html index 2fa665c..98abd38 100644 --- a/_posts/2021-12-20-five_reasons_i_love_emacs.html +++ b/_posts/2021-12-20-five_reasons_i_love_emacs.html @@ -15,9 +15,9 @@

-
-

1. An all-purpose editor

-
+
+

1. An all-purpose editor

+

A lot of people I met use all sorts of different editors or IDEs for different tasks. IntelliJ IDEA for Java and Kotlin, Android Studio for Android programming, Visual Studio for C#, Notepad++ for scripts, Microsoft Word to create documents, and the list goes on! Each of these editors will off course have to be configured to your liking, and work in different ways. Emacs is the opposite, and can be used for anything. I use Emacs to code in all sorts of languages (C, Java, Kotlin, Emacs Lisp, Bash and more!), write these blog posts (using Org Mode), write all sorts of documents (you can even replace Excel in Org Mode, though I only have minimal experience with that), see the latest HackerNews articles (in dashboard) and more! If I need something done where text is a central component, I always see if I can use Emacs for it.

@@ -25,9 +25,9 @@

1. An all-purpose editor

-
-

2. Individualism

-
+
+

2. Individualism

+

Emacs can be configured exactly like you want (within reason). Want Nyan cat to show you the position in the current buffer as a progress bar? Do it! Want colors showing you the HTML color codes directly in the source file? Rainbow-mode got you covered! Or for Emacs to use espeak or say to welcome you as Batman when you open it? Use hooks and the shell-command function and you are all set! The point here is that you can customize Emacs to your liking. You can even override ALL of the standard keybindings if you want. All of these reasons are the reasons that Emacs users often can't even use each others setup. Because we should that be a goal? YOUR WISHES are the most important when it comes to your editor. Emacs is NOT a one-size-fits-all editor, and that is an amazing thing.

@@ -40,9 +40,9 @@

2. Individualism

-
-

3. Configured by code (Lisp!!!)

-
+
+

3. Configured by code (Lisp!!!)

+

You can easily create code to extend the behavior of Emacs. This is done in a dialect of Lisp called Emacs Lisp, and is the language all of those cool packages are written in. If you have never seen this before, here we create a new interactive function that can be invoked with M-x:

@@ -71,9 +71,9 @@

3. Configured by code (Lisp!!!)

-
-

4. Great community producing amazing packages!

-
+
+

4. Great community producing amazing packages!

+

I briefly touched on this in reason 2 with some package links. There are all sorts of packages created by amazing people out there. I have covered some of these in my other Emacs articles. Not really much to be said here, except thanks to all the amazing Emacs users out there making awesome packages! You give me a smile on my face every time I open your repos or use your packages! :)

@@ -81,9 +81,9 @@

4. Great community producing amazing packages!

-
-

5. You can read the source code! (and contribute)

-
+
+

5. You can read the source code! (and contribute)

+

GNU Emacs is free software, and many amazing people contribute. Thanks to all of you! You make our lives better with the new features, bug fixes etc.

diff --git a/_posts/2022-01-16-kotlin_often_forgotten_features.html b/_posts/2022-01-16-kotlin_often_forgotten_features.html index 5417c84..b5adeac 100644 --- a/_posts/2022-01-16-kotlin_often_forgotten_features.html +++ b/_posts/2022-01-16-kotlin_often_forgotten_features.html @@ -9,9 +9,9 @@

-
-

Inline objects

-
+
+

Inline objects

+

The most known usage of inline/anonymous objects in Kotlin is in places where we need to send in an object (in the Java sense of the word) that implements an interface, the particular object is only needed once in your code, and a lambda won't suffice (because the interface is not functional, i.e, it has several methods). That was probably a bit confusing if you haven't seen it before. It's hard finding good examples of this, as it doesn't happen that often (probably happens more often on Android with its click handlers and more). Let us just use Runnable as a quick example, even though you could easily have used a lambda:

@@ -68,9 +68,9 @@

Inline objects

-
-

tailrec

-
+
+

tailrec

+

Let's start with the simplest recursive implementation of factorial:

@@ -117,9 +117,9 @@

tailrec

-
-

Extension functions to lambdas

-
+
+

Extension functions to lambdas

+

Lambdas are instances of classes behind the scenes, which means that you can create extension functions on them! If you never thought about it, this may seem confusing. What would the class name look like? Let's create one type of lambda (taking in two integers, and returning a new integer), and then later creating an extension function for it. First a simple add function:

@@ -171,13 +171,13 @@

Extension functions to lambdas

-
-

Delegation of properties/variables

-
+
+

Delegation of properties/variables

+
-
-

Recap of delegation in classes

-
+
+

Recap of delegation in classes

+

Most people know of the class-level delegation, but in case you don't, let's do a very quick recap. When extending a class or implementing an interface, the relationship is of type "is a" (e.g, a Toyota is a Car, a Siberian Husky is a Dog etc.). Composition, storing the relationship in a variable, is of the type "has a" (e.g, Manager manages/has a programmer do work for them, Cat has a human which gives them food etc.). Delegation is a special case of composition where we delegate work to another class. You probably don't want your Cat to implement the Human interface just to be able to get Food…? You want to delegate the work to the cats servant/owner. How do this look in Kotlin?

@@ -212,9 +212,9 @@

Recap of delegation in classes

-
-

properties/variables

-
+
+

properties/variables

+

The delegation example above was probably familiar to you, as it is presented clearly in many Kotlin texts. Did you know that you can use delegates on properties/variables as well? This is a simple way of adding some extra functionality around the given type. Let's say you want a variable with a number, but it can only be even. Or a string that can only be lower case. Let's see how a stupid example like that can be implemented:

@@ -292,13 +292,13 @@

properties/variables

-
-

Honorable mention

-
+
+

Honorable mention

+
-
-

Referential equality using ===

-
+
+

Referential equality using ===

+

Let's say you have implemented the equals method, and it checks for structural equality (e.g, the fields are equal to each other). What if you want to check that they are the same object, do we need to remove the equals-method? NO! You can use === instead, and you check if the objects are the same objects in memory (i.e, same reference).

diff --git a/_posts/2022-01-17-data_intensive_applications_review.html b/_posts/2022-01-17-data_intensive_applications_review.html index 553cf87..ccd0dfc 100644 --- a/_posts/2022-01-17-data_intensive_applications_review.html +++ b/_posts/2022-01-17-data_intensive_applications_review.html @@ -14,9 +14,9 @@

-
-

What is it about?

-
+
+

What is it about?

+

@@ -63,9 +63,9 @@

What is it about?

-
-

Should you read it?

-
+
+

Should you read it?

+

I think a lot of people can get some joy out of reading this book, but how you should read it depend a lot on who you are. The software engineers wanting to learn about different ways of handling data, getting an overview of how databases work etc. might get the most out of reading it this way:

diff --git a/_posts/2022-02-12-more_scifi_books.html b/_posts/2022-02-12-more_scifi_books.html index f0058d9..cdddac5 100644 --- a/_posts/2022-02-12-more_scifi_books.html +++ b/_posts/2022-02-12-more_scifi_books.html @@ -23,9 +23,9 @@
-
-

Project Hail Mary by Andy Weir

-
+ -
-

Children of Time by Adrian Tchaikovsky

-
+
+

Children of Time by Adrian Tchaikovsky

+

@@ -68,9 +68,9 @@

Children of Time by Adrian

-
-

Darth Bane trilogy (Star Wars)

-
+
+

Darth Bane trilogy (Star Wars)

+

NOTE! It should be noted that this book is in the Legends continuity, and is not a part of the main Star Wars canon. It was written before Disney bought the rights to Star Wars. diff --git a/_posts/2022-02-14-bit_tricks_absolute_value_no_branching.html b/_posts/2022-02-14-bit_tricks_absolute_value_no_branching.html index 418cef6..8aa1bc5 100644 --- a/_posts/2022-02-14-bit_tricks_absolute_value_no_branching.html +++ b/_posts/2022-02-14-bit_tricks_absolute_value_no_branching.html @@ -27,9 +27,9 @@ \end{equation} -

-

Naive implementation with branching

-
+
+

Naive implementation with branching

+

We can implement the mathematical formula above directly:

@@ -56,9 +56,9 @@

Naive implementation with branching

-
-

The bit trick

-
+
+

The bit trick

+

For integers, the trick can be described like this:

@@ -115,9 +115,9 @@

The bit trick

-
-

(Bit) Negation if negative number

-
+
+

(Bit) Negation if negative number

+

All bits in the mask will either be 0 or 1, so let's take a look at a XOR table for a single mask bit:

@@ -172,9 +172,9 @@

(Bit) Negation if negative number

-
-

Two complement

-
+
+

Two complement

+

We can easily see that for a positive number, we get the same number back (positive number XOR 0 - 0 is still the same number). What happens for negative ones? The number is first negated, then we subtract negative one. Wait a minute… This is the same as negating and then adding one! Which is how we negate a number in the two complement system. This is how negative numbers are represented. That's the magic of this trick :)

@@ -183,9 +183,9 @@

Two complement

-
-

Where can this be useful?

-
+
+

Where can this be useful?

+

While not super useful for modern high powered hardware, it might be useful in other contexts. Some of these are low power microcontrollers, retro computers and retro console programming. Some processors in these sort of devices are low powered, and sometimes we might need some clever tricks. The absolute value trick might prove useful where we simply want to avoid the extra cycles the jump call and conditional require, even though it shines the brightest in cases of pipelined processors.

diff --git a/_posts/2022-03-01-github_actions_intro.html b/_posts/2022-03-01-github_actions_intro.html index 94f6f76..b1de978 100644 --- a/_posts/2022-03-01-github_actions_intro.html +++ b/_posts/2022-03-01-github_actions_intro.html @@ -14,9 +14,9 @@

-
-

Why automate?

-
+
+

Why automate?

+

Are you still doing releases and other manual tasks manually? Think that a lot of automation is something just big organizations gets benefits from? Think again, everyone can reap the benefits of automating tasks. Startups, lone wolf coders etc. Automation pipelines (of tasks) saves a lot of time compared to doing things manually. Even when each task only takes you a couple of minutes, it will eventually stack up to longer periods of time. If you don't have to do it manually, you might also do it more often (we are lazy and want to avoid manual work). This empowers you to do releases, builds etc. even more often, and it becomes less scary to do so (humans makes mistakes more often than you might like, and if we have to do it manually, the probability of doing something wrong increases).

@@ -44,9 +44,9 @@

Why automate?

-
-

Why Github Actions?

-
+
+

Why Github Actions?

+

You may ask: Why Github Actions? Why not Jenkins, Travis, CircleCI etc.? There are several reasons, each depending on the tool. For Jenkins primarily, one of the main reasons is the loss of control you sometimes get. Administrators have to install plugins, and in some organizations, the users don't have access to install them or play around with new ones. Github Actions on the other hand, makes it easy to try new things. Some of these things have improved by using Docker containers, but you will then have to do more yourself. Using a ready-made action (e.g, setup Java, setting up Kubernetes etc.) makes creating automation pipelines quicker and simpler. The added bonus is the readability by using reusable chunks (actions).

@@ -64,9 +64,9 @@

Why Github Actions?

-
-

Basics of Github Actions

-
+
+

Basics of Github Actions

+

Github Actions uses a simple YAML syntax. To not bore you with minor details, let's just look at a very simple pipeline that can be copy-pasted and used (put into the .github/workflows directory). The following workflow/action builds your Maven project, as well as setting up the necessary configuration (checking out code and having JDK and Maven available).

@@ -113,9 +113,9 @@

Basics of Github Actions

-
-

Available actions and further reading

-
+
+

Available actions and further reading

+

So where can I find available Actions? Github makes this easy with its Marketplace (don't be fooled by the name, almost all are free! Consider sponsoring the developers if you really love their work though!). Some useful ones include:

diff --git a/_posts/2022-03-10-intro_to_ansible.html b/_posts/2022-03-10-intro_to_ansible.html index f19e5c6..06fcbb3 100644 --- a/_posts/2022-03-10-intro_to_ansible.html +++ b/_posts/2022-03-10-intro_to_ansible.html @@ -35,9 +35,9 @@

-
-

What can Ansible be used for?

-
+
+

What can Ansible be used for?

+

We mentioned configuration management and deployments, so it can obviously be used to manage your machines (physical, virtual etc.). You might just brush this off, but think of some possible use cases first (some are not obvious):

@@ -59,9 +59,9 @@

What can Ansible be used for?

-
-

Basics of Ansible

-
+
+

Basics of Ansible

+

We have already introduced Ansible as a configuration management system, but what more do we need to know before we start using it for something? The most important file we need is something called an inventory file. An inventory file describes the machines we will connect to, as well as information on them like user names, SSH key to use (on your local filesystem) and more depending on your needs. (there are also more ways to configuring Ansible that you can look into, but for now we will keep it simple). The machines are divided into groups, which can contain one or more machines. Groups are what we are working with in Ansible, when describing where to run our commands.

@@ -101,9 +101,9 @@

Basics of Ansible

-
-

Ad-hoc tasks execution

-
+
+

Ad-hoc tasks execution

+

We have an inventory file, we so we can finally start using Ansible for something! Using it for ad-hoc task execution can be a very handy way of running commands on multiple machines. Let us look at some examples.

@@ -148,9 +148,9 @@

Ad-hoc tasks execution

-
-

Configuration management - Playbooks

-
+
+

Configuration management - Playbooks

+

While running commands on the server ad-hoc is great, the main strength of Ansible is its playbooks. Why? When we run commands on various servers, we can quickly make unicorn servers. A unicorn server is a server we can't reproduce quickly if something goes wrong (trust me, you will quickly forget a step or two you did manually). Automating the setup, and maintenance of servers, will avoid this problems and make them easier for you to handle.

@@ -199,9 +199,9 @@

Configuration management - Playbooks

-
-

Example: Installing Emacs and setting up my configuration

-
+
+

Example: Installing Emacs and setting up my configuration

+

For our first example, let's do the most important initial setup I do on new computers: installing and configuring Emacs! To make it as simple as possible, let's just assume that package caches are updated and ready for use.

@@ -247,9 +247,9 @@

Example: Installing Emacs and setting up my configuration -
-

Example: FTP server

-
+
+

Example: FTP server

+

Next, let's make it a bit more advanced to introduce more concepts. We'll make a simple FTP server. Let's update package caches if we use a Debian based system (because apt requires that we have updated package archives to install a program).

@@ -327,9 +327,9 @@

Example: FTP server

-
-

Example: Setting up user accounts and Emacs for each, variable amount of users

-
+
+

Example: Setting up user accounts and Emacs for each, variable amount of users

+

So far we've seen a several features, and got them explained briefly. In this section, we will look at a loop construct, specifically with_items. In my own playbooks I usually use with_items or with_indexed_items, but loop does the same in a more modern way.

@@ -373,9 +373,9 @@

Example: Setting up user accounts and Emacs for each, variab

-
-

Modules and extra tools to make playbooks

-
+
+

Modules and extra tools to make playbooks

+

There are many Ansible modules you can use, and if you don't find what you need you will probably find it in a collection (see below). Some useful highlights include:

@@ -402,9 +402,9 @@

Modules and extra tools to make playbooks

-
-

Inventory plugins

-
+
+

Inventory plugins

+

Maybe you manage a lot of computers, create new ones quickly, and find it tedious to update your inventory file? It grows big too! Do I really need to write all my IPs/hostnames in a file? No! There are actually plugins that can help you dynamically fetch the inventory based on certain parameters. Also, AWS EC2 plugin, Azure plugin, and many more exists, even if you sometimes have to use ansible-galaxy to install them. Maybe you have tagged your virtual machine or something similar to identify them? Then use those specific tags to put them into host groups, and you are all set!

@@ -416,9 +416,9 @@

Inventory plugins

-
-

Testing playbooks?

-
+
+

Testing playbooks?

+

There are indeed tools you can use to test your playbooks, and to work in a more test driven approach. My approach so far has been the following:

@@ -434,9 +434,9 @@

Testing playbooks?

-
-

Roles and collections

-
+
+

Roles and collections

+

Both roles and collection can be installed and handled with the ansible-galaxy tool.

@@ -465,9 +465,9 @@

Roles and collections

-
-

Further reading and resources

-
+
+

Further reading and resources

+

Hopefully you now know the basics of Ansible, and have some links for gaining more knowledge. To learn Ansible, I think the best resource is Jeff Geerling's book Ansible for Devops. If you prefer videos, he has also done a Ansible 101 video series. These resources covers almost everything you would like to know. To really learn Ansible you have to play around with it as well off course.

diff --git a/_posts/2022-03-17-creating_container_images_with_ansible.html b/_posts/2022-03-17-creating_container_images_with_ansible.html index 1524631..a5ce7dd 100644 --- a/_posts/2022-03-17-creating_container_images_with_ansible.html +++ b/_posts/2022-03-17-creating_container_images_with_ansible.html @@ -52,9 +52,9 @@ -
-

Using ansible-bender

-
+
+

Using ansible-bender

+

So you have installed ansible-bender, either directly or by using an image like mine above. What's next? If you have installed Buildah and Podman as well, you can actually start using the tool directly! If you want a playbook with ansible-bender specific variables inserted for you, you can use the ansible-bender init command, and a playbook.yml file is created for you. In essence, that is what an ansible-bender playbook really is; a normal Ansible playbook with some special variables. Those special variables are covered in depth in the documentation.

@@ -71,9 +71,9 @@

Using ansible-bender

-
-

Example: Containerized Emacs setup

-
+
+

Example: Containerized Emacs setup

+

Continuing the trend from the last article! Let's set up an image with my Emacs setup ready to be used.

@@ -149,9 +149,9 @@

Example: Containerized Emacs setup

-
-

Example: Simple Spring Boot application image

-
+
+

Example: Simple Spring Boot application image

+

Let's do something slightly different by demonstrating the usage of volumes and Ansible roles during build. It's not unusual to want to package an application into a container, and for simplicity we put it into the same directory as the playbook itself (so we can use the playbook_dir variable). To not make this example too advanced, we simply use a Spring Boot application made from Spring Initializr without any changes (if you prefer a terminal UI, there is one for that too). We'll use geerlingguys java role to setup Java to not boggle down the example with Java setup.

@@ -213,9 +213,9 @@

Example: Simple Spring Boot application image

-
-

Useful commands

-
+
+

Useful commands

+

ansible-bender has quite a few useful commands beyond just building images. If you want to fetch earlier build logs, that can be done. Inspecting images is simple. But to me, the most useful is probably pushing images. Not necessarily to a central repository or something, but to Docker. I have to admit, I still use Docker. Let's say we have built the myemacs image as in the first example, and want to push it to our docker daemon with the tag 0.1. Then we simply run:

@@ -229,9 +229,9 @@

Useful commands

-
-

Summary

-
+
+

Summary

+

In summary, ansible-bender seems like a promising tool that definitely have some fun and useful use cases. Making images with Ansible seems like a very readable way to make images, especially for bigger ones. Dockerfiles quickly gets messy, and Ansible might be an antidote for that issue.

diff --git a/_posts/2022-05-09-debugging_gba_in_emacs.html b/_posts/2022-05-09-debugging_gba_in_emacs.html index 5846f80..65f5d50 100644 --- a/_posts/2022-05-09-debugging_gba_in_emacs.html +++ b/_posts/2022-05-09-debugging_gba_in_emacs.html @@ -21,9 +21,9 @@

-
-

Basic GBA debug workflow (editor independent)

-
+
+

Basic GBA debug workflow (editor independent)

+

No matter which editor you debug in, the workflow is about the same. You will need DevkitPro gba-dev and an emulator like mGBA. If you want to familiarize yourself with some C code for GBA, as well as Makefiles with CFlags and other build options, there is an example repo you can check out :)

@@ -51,9 +51,9 @@

Basic GBA debug workflow (editor independent)

-
-

Adapting it to Emacs with dap-mode

-
+
+

Adapting it to Emacs with dap-mode

+

We will use dap-mode with the dap-gdb-lldb option here. Under the hood, it uses the debug adapter from the Native Debug VSCode extension. Configuring it is described on the dap-mode webpages. After we have configured dap-mode, we could in theory reuse the launch.json configurations from the VSCode related articles above. That will require that you also use lsp-mode, as dap-launch depends on the lsp-workspace-root function and will not resolve when lsp-mode is not used. I don't use lsp-mode with C (company-clang and company-c-headers provide what I need), so the next logical solution would be to create a debug template ourselves:

@@ -87,9 +87,9 @@

Adapting it to Emacs with dap-mode

-
-

Simplifying with gba-debug.el

-
+
+

Simplifying with gba-debug.el

+

The solutions above entails some manual work, and that lead me to automate it. Wouldn't it be nice to just run one simple command, and then everything compiles and your debug process just automatically begin? That's exactly what I was thinking, so I created a simple Emacs extension. If you use a Makefile to build, and configure the path to mGBA and DevkitARMs gdb, you can debug a GBA program directly with M-x gba-debug-program. No need to compile manually, run mGBA manually or anything else!

diff --git a/_posts/2022-06-29-summer_learning_tips.html b/_posts/2022-06-29-summer_learning_tips.html index aa88687..14c257e 100644 --- a/_posts/2022-06-29-summer_learning_tips.html +++ b/_posts/2022-06-29-summer_learning_tips.html @@ -22,9 +22,9 @@
-
-

Programming: Rust

-
+
+

Programming: Rust

+

@@ -50,9 +50,9 @@

Programming: Rust

-
-

DevOps: Improve your command line expertise

-
+
+

DevOps: Improve your command line expertise

+

Learning the command line (unix shell aka bash) better can be a very useful skill, not just for using your machine more effectively, but for many tasks we relate to the DevOps label as well. These include creating containers, debugging containers, various Kubernetes operations, handling cloud infrastructure (e.g, Azure CLI) and more! Even if you just train yourself to read commands and shell scripts better, you will be able to understand more of what is written online relating to the aforementioned topics.

@@ -80,9 +80,9 @@

DevOps: Improve your command line expertise

-
-

Retro computing: Wolfenstein 3D engine

-
+
+

Retro computing: Wolfenstein 3D engine

+

diff --git a/_posts/2022-08-05-small_emacs_lisp_debugging_tips.html b/_posts/2022-08-05-small_emacs_lisp_debugging_tips.html index bc42b5d..eae44cc 100644 --- a/_posts/2022-08-05-small_emacs_lisp_debugging_tips.html +++ b/_posts/2022-08-05-small_emacs_lisp_debugging_tips.html @@ -10,9 +10,9 @@ -

-

Show stack traces

-
+
+

Show stack traces

+

You have probably gotten one of those weird "wrong type argument" errors, or similar errors just printed in the minibuffer before. You have probably also navigated to the *Messages*-buffer to check if there is any additional information. Did you know you can see a stack trace instead? Then you can see the functions being called leading up to the error!

@@ -88,9 +88,9 @@

Show stack traces

-
-

Tracing function invocations

-
+
+

Tracing function invocations

+

Another useful troubleshooting tips to know is tracing function invocations/calls. Sometimes we just want to see what arguments a specific function is called with, and be notified about it each time it is run. This is done with the trace-function command (M-x trace-function, followed by the name of the function you want to trace).

diff --git a/_posts/2022-09-04-things_i_wish_i_did_earlier.html b/_posts/2022-09-04-things_i_wish_i_did_earlier.html index 3e01e8a..4620db6 100644 --- a/_posts/2022-09-04-things_i_wish_i_did_earlier.html +++ b/_posts/2022-09-04-things_i_wish_i_did_earlier.html @@ -9,9 +9,9 @@

-
-

Share (some of) my work online

-
+
+

Share (some of) my work online

+

Some of you might not know this, but I started to experiment with software development in my early teens. Looking back, I don't really have much to show for it, except some knowledge tucked away in my brain. These days I see a lot of people just starting to learn coding, both young and older, and they share their work almost from day one. From simple Wordpress pages to phone apps. Some end up getting programming jobs just from showing their work, and various opportunities arise. Nothing is guaranteed, but if you are invisible, then no one will know that you exist. At least you open yourself up to opportunities that may not have happened otherwise. One cool example to me is the story behind how Modern Vintage Gamer got started working with the Shantae re-releases.

@@ -34,9 +34,9 @@

Share (some of) my work online

-
-

Don't let mistakes/failures tear you down!

-
+
+

Don't let mistakes/failures tear you down!

+

I have to admit; I've let some of mistakes in life tear me down. To be honest, I think this is common for many of us introverted people who overthinks to the extreme. When we do mistakes, we never stop thinking about them. Whether it's saying something wrong, or failing at something that meant a lot to us. I'm not going to say that it is easy getting rid of the overthinking habit, as I still do it. I will say that knowing that most people will forget about your mistake in a short amount of time helps. Most of us don't have time to judge others based on their mistakes, and we forget they even happened. Now that we have gotten that out of the way, we can talk about the main point here: mistakes/failures can make you learn a lot!!!

@@ -65,9 +65,9 @@

Don't let mistakes/failures tear you down!

-
-

Invest your money as soon as possible

-
+
+

Invest your money as soon as possible

+

By looking at social media, movies etc. you can get the impression that investing means picking a winner stock and getting rich, or by day trading. That is a very rare occurrence, and most people actually lose money on day trading. Investing is not just for the rich and mighty, but can serve everyone well. With inflation going rampant, and bank accounts giving you almost no interest, it can pay off to find out how to get higher interest on your money. Contrary to popular belief, everyone can make money in the market by just being in it for a longer period of time. Just think for a moment; how will my money grow over time when I get interest on the interest I made last year? This is what is known as compound interest, or "interest on your interest". It doesn't have to be hard either. Just putting money away in something like an index fund every month (probably) makes for good returns in the long run. There are also many stocks and funds that pay dividends (i.e, distributions of money to you as a shareholder), so if you try to find the perfect time to start you would have missed these payouts.

diff --git a/_posts/2022-09-24-kotlin_in_emacs_redux.html b/_posts/2022-09-24-kotlin_in_emacs_redux.html index 0b732ea..14b1eb7 100644 --- a/_posts/2022-09-24-kotlin_in_emacs_redux.html +++ b/_posts/2022-09-24-kotlin_in_emacs_redux.html @@ -33,9 +33,9 @@

-
-

Recommended packages for working with Kotlin

-
+
+

Recommended packages for working with Kotlin

+

These are based upon my personal experience, so some of you may have different preferences (e.g, eglot instead of lsp-mode).

@@ -80,9 +80,9 @@

Recommended packages for working with Kotlin

-
-

Basic config (relating to Kotlin)

-
+
+

Basic config (relating to Kotlin)

+

The config here is truncated a bit to show the most important parts. Some parts of my config are based upon my personal preferences, and not very relevant for an article like this. If you want to take a look at the entire config, you can check out the Github repo (it has a table of contents for easy navigation). There are also links for some ommited packages in the previous section :)

@@ -152,9 +152,9 @@

Basic config (relating to Kotlin)

-
-

IDE functionality with the help of kotlin-language-server and kotlin-debug-adapter

-
+
+

IDE functionality with the help of kotlin-language-server and kotlin-debug-adapter

+

lsp-mode gives you IDE functionality (completions, code actions etc.) for Kotlin using kotlin-language-server, while debugging is provided by dap-mode using kotlin-debug-adapter.

@@ -175,9 +175,9 @@

IDE functionality with the help of kotlin-language-server an

-
-

Code actions

-
+
+

Code actions

+

kotlin-language-server provides the following code actions:

@@ -217,9 +217,9 @@

Code actions

-
-

Override members

-
+
+

Override members

+

You might have a project where you have interfaces with default implementations that you want to override (especially true if you use some Java libraries!). Those are not supported by the code action above as they are not missing an implementation. Do you have to do those manually by reading API docs? No! Thanks to a custom operation (i.e, protocol extension) in the langauge server and lsp-mode, you can simply have your cursor at the class name of your class and run lsp-kotlin-implement-member! You will now be prompted by the open methods and variables not implemented in the class in your file. If you are using Helm, you can select multiple of them with C-SPACE. That looks like this (in a stupid small project :

@@ -239,9 +239,9 @@

Override members

-
-

Code lenses (run/debug program)

-
+
+

Code lenses (run/debug program)

+

These are not on by default, mostly because not everyone will want to run or debug their programs inside of Eamcs. Some are stubborn and prefer to run it in the terminal etc. (I have to admit that I do that most of the time for tests). You can activate the run/debug code lenses using lsp-kotlin-lens-mode (pro-tip: Put it in a hook in your configuration if you use it often)

@@ -268,9 +268,9 @@

Code lenses (run/debug program)

-
-

More clear overview with lsp-treemacs

-
+
+

More clear overview with lsp-treemacs

+

lsp-treemacs gives you some handy tools, like seeing a list of errors (like many IDEs have) using lsp-treemacs-errors-list:

@@ -287,9 +287,9 @@

More clear overview with lsp-treemacs

-
-

Basics of debugging with dap-mode using kotlin-debug-adapter

-
+
+

Basics of debugging with dap-mode using kotlin-debug-adapter

+

The debugging support is very bare-bones at the moment. You can only debug using Maven or Gradle projects for the JVM, and there is an open issue for debugging standalone JVM applications. If you are not using the code lenses above, you can specify settings yourself in a dap template, or make a VSCode launch.json file with the debug specification with the type kotlin. If you want to attach to an already running debug process, you can use the built in dap template called "Kotlin Attach" (just run dap-debug after setting up dap-mode like in the config above!). Attaching is currently the only way to debug tests. In Gradle, you can create a debug test process like this:

@@ -320,9 +320,9 @@

Basics of debugging with dap-mode using kotlin-debug-adapter -
-

Debugging issues with kotlin-language-server and kotlin-debug-adapter

-
+
+

Debugging issues with kotlin-language-server and kotlin-debug-adapter

+

Something isn't working? Code actions aren't showing up? No completions? Then it's time to look into the *lsp-log*-buffer! If you want to see more info, like the JSON requests and responses from and to the language server, enable lsp-print-io.

@@ -350,9 +350,9 @@

Debugging issues with kotlin-language-server and kotlin-debu

-
-

General tips

-
+
+

General tips

+

Sometimes you may encounter weird behavior. Sadly this can happen as kotlin-language-server and kotlin-debug-adapter are projects maintained and contributed to out of love in our spare time. Some possible workarounds:

diff --git a/_posts/2022-10-03-emacs_lisp_better.html b/_posts/2022-10-03-emacs_lisp_better.html index 6e61795..2be74ee 100644 --- a/_posts/2022-10-03-emacs_lisp_better.html +++ b/_posts/2022-10-03-emacs_lisp_better.html @@ -15,9 +15,9 @@

-
-

s.el

-
+
+

s.el

+

s.el has a simple mission: to provide more pleasant string handling, and it touts itself as "The long lost Emacs string manipulation library". If you have worked with strings in Emacs Lisp without s.el, it can be a bit tedious. Some functions work like you expect with string inputs, while others expect a list of strings (e.g, string-join). Others have completely different prefixes (e.g, concat).

@@ -57,9 +57,9 @@

s.el

-
-

f.el

-
+
+

f.el

+

Yes, you read that right: f.el! f.el provides many functions for handling files and directories, including paths and content. While it is certainly possible to do some of these operations directly in standard Emacs Lisp, it takes quite a lot more instructions than the simple ones provided by f. f makes it way more readable, and makes the intent more clear.

@@ -92,9 +92,9 @@

f.el

-
-

dash.el

-
+
+

dash.el

+

If you have ever read source code for any of the Emacs packages you use, you may have noticed operations like -let, -map, -lambda, ->, and similar ones all starting with a dash. These are from dash.el, and provides quite a lot of nice syntax! Ranging from improved usage and pattern matching (if let expressions like in Rust is available!), to Lisp constructs often found in other languages (like the threading operator ->). Clojure is probably the biggest inspiration, and this package makes list operations as pleasant as they are in Clojure! (LISP stands for LISt Processing after all!). If you have coded in Emacs Lisp for a while, you may have used †he various cl-functions (e.g, cl-map), but with dash you get more clear and pleasant APIs to do the same and more.

@@ -135,9 +135,9 @@

dash.el

-
-

ht.el

-
+
+

ht.el

+

ht.el is a library for managing hash tables. While this can be done with the standard library, ht.el makes the intent more clear. They have also written a bit about the why in their readme. Like they mention, more consistent naming, common prefixes and more, makes coding in Emacs Lisp more pleasant. It's easy to sometimes forget the name of a function, and a common prefix makes it easier to find when using auto completion.

diff --git a/_posts/2022-10-04-emacs_web_mode_mixed.html b/_posts/2022-10-04-emacs_web_mode_mixed.html index 7a8d975..a07e389 100644 --- a/_posts/2022-10-04-emacs_web_mode_mixed.html +++ b/_posts/2022-10-04-emacs_web_mode_mixed.html @@ -14,9 +14,9 @@

-
-

Some alternatives to consider

-
+
+

Some alternatives to consider

+

Before we go into my approach, let's look at some other alternatives and why I don't use them:

@@ -40,13 +40,13 @@

Some alternatives to consider

-
-

My approach

-
+
+

My approach

+
-
-

Package summary

-
+
+

Package summary

+

The following packages are used:

@@ -64,9 +64,9 @@

Package summary

-
-

Setup with code

-
+
+

Setup with code

+

Here is the setup I use in this article. Non-relevant parts are ommited, as is the configuration of

@@ -127,9 +127,9 @@

Setup with code

-
-

Basic usage

-
+
+

Basic usage

+

Based on what we see in the config above, we can simply open an HTML file and be ready for action! You may notice a message:

@@ -173,9 +173,9 @@

Basic usage

-
-

Drawbacks

-
+
+

Drawbacks

+

Sadly there are a few drawbacks I still haven't found good solutions to.

diff --git a/_posts/2022-10-06-rust_awesome_pattern_matching.html b/_posts/2022-10-06-rust_awesome_pattern_matching.html index bab98cd..9301121 100644 --- a/_posts/2022-10-06-rust_awesome_pattern_matching.html +++ b/_posts/2022-10-06-rust_awesome_pattern_matching.html @@ -10,13 +10,13 @@ -
-

Basics of patterns

-
+
+

Basics of patterns

+
-
-

Refutable vs irrefutable

-
+
+

Refutable vs irrefutable

+

Patterns in Rust come in two types; refutable and irrefutable. Patterns that match conditionally are called refutable, while patterns that match any possible value are called irrefutable. Which one you can use will depend on the context. For example, a let-statement will need a irrefutable pattern, because what would happen if a variable in a let-statement doesn't get a value?

@@ -55,17 +55,17 @@

Refutable vs irrefutable

-
-

Destructuring

-
+
+

Destructuring

+

Many patterns are patterns that destructure various types, and they can also be mixed and match together. Let's look at some of them.

-
-

Tuples

-
+
+

Tuples

+

We already saw example of tuple destructuring in the last section, but let's take another look:

@@ -134,9 +134,9 @@

Tuples

-
-

Structs

-
+
+

Structs

+

Structs are not that much different, and an example might show it clearly:

@@ -173,9 +173,9 @@

Structs

-
-

Enums

-
+
+

Enums

+

The simplest case for an enum is simply to match one with no data:

@@ -222,9 +222,9 @@

Enums

-
-

Combined

-
+
+

Combined

+

You can also combine all of the above into your own patterns! Structs inside enums, enums inside tuples etc. The list goes on!

@@ -266,9 +266,9 @@

Combined

-
-

Other patterns

-
+
+

Other patterns

+

There are other types of patterns as well, and these are mostly used with match which you will see more of below. The first one is the or-matcher:

@@ -332,9 +332,9 @@

Other patterns

-
-

Caveats

-
+
+

Caveats

+

One minor caveat I have found is that Rust is finicky about floating points in patterns. Not about the capturing part, but if you try to use them in ranges and so on. It warns you that it is not supported. We all know how floating points behave, and that they are very sensitive to different scales and that they are rarely (if ever) exact. That probably explains why they are not recommended to use with more advanced Rust patterns.

@@ -343,17 +343,17 @@

Caveats

-
-

Where to use pattern matching? (example time!)

-
+
+

Where to use pattern matching? (example time!)

+

We have already seen some basic examples above, but let's dive a bit deeper and see how and where to use pattern matching. We have already seen lots of let and if-let statements, so let's look at match and patterns in function signatures!

-
-

match

-
+
+

match

+

This is in my view the switch/case statement you are used to in other languages, but on steroids! match lets you write crazy powerful matchers. We have already looked at all the different patterns above, so let us have some quick examples:

@@ -408,9 +408,9 @@

match

-
-

functions

-
+
+

functions

+

You can use patterns in function definitions! That is really cool, right? You do have to remember that the patterns have to be irrefutable like for let. Don't be sad yet! It still means you can use a lot of destructuring operations we have seen above! Let's look at some examples:

diff --git a/_posts/2022-10-11-learning_kotlin_resources.html b/_posts/2022-10-11-learning_kotlin_resources.html index d51e962..3cfec7b 100644 --- a/_posts/2022-10-11-learning_kotlin_resources.html +++ b/_posts/2022-10-11-learning_kotlin_resources.html @@ -14,9 +14,9 @@

-
-

Learning the basics

-
+
+

Learning the basics

+

No matter your skill level, you will at some point refer to the official language documentation. For many of you, this will probably be the best place to start as well. All the examples can be run directly on the website, but you want to try your own code snippets interactively you can do it on play.kotlinlang.org. If you already know Java, they have an interactive track called Koans that teach you the basics of Kotlin. This program help you get familiar with the syntax and workings of the language.

@@ -37,9 +37,9 @@

Learning the basics

-
-

Next steps

-
+
+

Next steps

+

So you know the basics now, and want to keep on learning new concepts. The play.kotlinlang.org site have lots of hands-on labs you can try, even though most of them probably are meant a bit for intermediates. If you want to learn a specific concept, like Native, Multiplatform, Spring Boot etc., then they might be worth a try. To stay up to date with Kotlin, Jetbrains has an excellent YouTube channel with talks, news about new features and more. There are several videos on their channel, ranging from basic concepts to more advanced topics:

diff --git a/_posts/2022-10-15-sed_more_than_replacements.html b/_posts/2022-10-15-sed_more_than_replacements.html index 103394d..704e4e7 100644 --- a/_posts/2022-10-15-sed_more_than_replacements.html +++ b/_posts/2022-10-15-sed_more_than_replacements.html @@ -28,9 +28,9 @@

-
-

Basics of sed

-
+
+

Basics of sed

+

sed is an acronym and stands for Stream EDitor. If you have seen the line editor ed in action, you will recognize many of the commands. (read up on teletypes and computers before the featureful editors we have today if you are curious!). In many ways, I like to think of sed as an automated version of ed. The main difference is that it prints the file to standard output instead of editing the file directly. You give sed commands on how it should edit a given text, and it does exactly that! It can do some more as well, as we will see, like getting only parts of the text back. At its core, sed takes in an address (might be empty for entire input) and a command. Some examples of addresses:

@@ -252,9 +252,9 @@

Basics of sed

-
-

Simple replacements

-
+
+

Simple replacements

+

The most common usage of sed is to do replacements. Replacements are done using the command s/pattern to replace/replacement text/, using regular expressions. Refer to the description of commands and regular expressions above if something is unclear. To have some data to test with, we will use an extract of the song Eternal Flame by Bob Kanefsky and Julia Ecklar saved in a file called godwroteinlisp.txt:

@@ -347,9 +347,9 @@

Simple replacements

-
-

Editing files by combining lines, deleting etc.

-
+
+

Editing files by combining lines, deleting etc.

+

We can combine multiple lines together by using the N command and replace the newline character with an empty string:

@@ -389,9 +389,9 @@

Editing files by combining lines, deleting etc.

-
-

Transliteration

-
+
+

Transliteration

+

Our next topic may be a little bit obscure, but I've met people who didn't know sed could do it! I'm talking about transliteration. In a linguistic context, transliteration can be useful for example to transform greek characters into our Latin variant (I guess that is what it is called, I'm not very much into linguistics). One other use I've found for this is obfuscation. Let's do a quick example with replacing every "f" with "l", every "s" with "o", and every "o" with "l":

@@ -419,9 +419,9 @@

Transliteration

-
-

Selecting/cutting content from files

-
+
+

Selecting/cutting content from files

+

You might have noticed the addressing type /regex1/,/regex 2/ above, and wondered why you would want to fetch matches between two regular expression matches? Nifty feature, but where is it useful? My number one place for this is undoubtedly log files! To look into this, let us create a sample log file based upon a z/OS example log file from IBM that we will call log.txt:

@@ -501,9 +501,9 @@

Selecting/cutting content from files

-
-

Example: Simple grep replacement

-
+
+

Example: Simple grep replacement

+

In the introduction, I mentioned that we could make a very simple grep replacement with sed. By now you will probably realize that the -n option and the p commands are part of the solution. By knowing this we can make a function that takes some text as input, and uses sed to print only the lines matching this text: @@ -535,9 +535,9 @@

Example: Simple grep replacement

-
-

In summary

-
+
+

In summary

+

So as you can see, sed provides many editing utilities that goes beyond "just replacements" :)

diff --git a/_posts/2022-10-18-small_command_line_tricks.html b/_posts/2022-10-18-small_command_line_tricks.html index 16dbed4..49aeb9a 100644 --- a/_posts/2022-10-18-small_command_line_tricks.html +++ b/_posts/2022-10-18-small_command_line_tricks.html @@ -15,9 +15,9 @@

-
-

Creating aliases

-
+
+

Creating aliases

+

Tired of often writing the same long command? Or maybe you are spelling it wrong very often? Did you know that you can make aliases? Define mci to mean mvn clean install, exot to mean exit and similar? How would that look like?

@@ -49,9 +49,9 @@

Creating aliases

-
-

Chaining - run multiple commands (no dependencies between them)

-
+
+

Chaining - run multiple commands (no dependencies between them)

+

Want to run more than one command? And not have to wait for one to finish and then type the next? With chaining using ; you can! No matter if the first command was successful or not, the next one will run. This makes it perfect for sequences of commands that doesn't depend on each other.

@@ -68,13 +68,13 @@

Chaining - run multiple commands (no dependencies between th

-
-

Chaining using && and ||

-
+
+

Chaining using && and ||

+
-
-

&&

-
+
+

&&

+

The last section showed you how to run commands no matter the exit code (or status if you will) of the previous command. What if they have a dependency? You only want to run the next one if the previous one succeeded? That is what && does; running the right hand side if the left hand side has a successful exit code (0).

@@ -100,9 +100,9 @@

&&

-
-

||

-
+
+

||

+

What if you want to run a command if the previous one failed? Now we are looking at ||, which does exactly that. If the left hand side returns a unsuccessful exit code (i.e, not 0), then the right hand side runs. If not, it doesn't run the right hand side.

@@ -125,9 +125,9 @@

||

-
-

Searching for previously run commands

-
+
+

Searching for previously run commands

+

Sometimes we have typed commands that we want to run again. Then you can use CTRL-r (control followed by the r key). You will see a text saying something like "bck-i-search:" followed by a prompt. Type your search query, and you will see matches as you go. Press enter if you want to run one. If you want to see the next match, just use CTRL-r again. Want to go forward to the match you just went past, then use CTRL-s. Want to quit the searching? CTRL-g is your friend.

diff --git a/_posts/2022-10-22-bit_tricks_count_bits_kernighan.html b/_posts/2022-10-22-bit_tricks_count_bits_kernighan.html index f03ad31..524500b 100644 --- a/_posts/2022-10-22-bit_tricks_count_bits_kernighan.html +++ b/_posts/2022-10-22-bit_tricks_count_bits_kernighan.html @@ -20,13 +20,13 @@

-
-

The algorithm

-
+
+

The algorithm

+
-
-

Pseudo code and basics

-
+
+

Pseudo code and basics

+

How do we count the number of 1 bits in a binary string? One possible solution is to clear the lowest 1 bit in each step, and then count the number of steps needed for the input to become 0. This is the algorithm we will look at today. We will work on unsigned ints here, but it could easily have been chars, unsigned longs or something else. Unsigned because we want to count the number of bits, even for negative numbers, so we would have to cast signed variants to unsigned types. I find it easier to work on numbers where the lowest possible value is 0 in this case. The basic algorithm looks like this in a while-loop variant:

@@ -64,9 +64,9 @@

Pseudo code and basics

-
-

Explaining the base step

-
+
+

Explaining the base step

+

We know from the previous section that x & (x - 1) removes the lowest 1 bit in each step. The first time you see it, it can be a bit confusing. I think it is best explained by looking at a few examples to gain some intuition. First of all, remember that the AND-operation (&) only returns 1 if both bits are one. AND has the following truth-table (a and b are the input bits, result is the result of the operation):

@@ -126,9 +126,9 @@

Explaining the base step

-
-

Example input: 4

-
+
+

Example input: 4

+

Let us first look at the number 4 (00000100). What is the result of doing the operation above:

@@ -145,9 +145,9 @@

Example input: 4

-
-

Example input: 7

-
+
+

Example input: 7

+
x:           00000111
 x - 1:       00000110
@@ -157,9 +157,9 @@ 

Example input: 7

-
-

Example input: 25

-
+
+

Example input: 25

+
x:           00011001
 x - 1:       00011000
@@ -169,9 +169,9 @@ 

Example input: 25

-
-

Example input: 24

-
+
+

Example input: 24

+
x:           00011000
 x - 1:       00010111
@@ -187,9 +187,9 @@ 

Example input: 24

-
-

Where can this be useful?

-
+
+

Where can this be useful?

+

The most obvious place I can think of this as being useful is when you have encoded data into bits. One example include saving the on-off state of something like Conway's game of life into bits (each bit is an on-off cell in the grid). Then you can simply mask the data, and then count the number of bits to find adjacent neighbors. Choosing an algorithm for that case depends on if you are optimizing for speed of program size.

diff --git a/_posts/2022-10-31-what_i_love_about_rust.html b/_posts/2022-10-31-what_i_love_about_rust.html index c17221a..44aa3ac 100644 --- a/_posts/2022-10-31-what_i_love_about_rust.html +++ b/_posts/2022-10-31-what_i_love_about_rust.html @@ -9,46 +9,46 @@

-
-

Topics in this article

-
+ -
-

Easy installation - rustup

-
+
+

Easy installation - rustup

+

Installing the basic tools (compiler, build system etc.) is very easy by using rustup. rustup is also used to update the tools, install other components (formatter, language server etc.), install unstable/nightly versions of the tools, install other Rust versions and so on. It is also used to set the default compiler/tool versions etc. This means that an official language tool handles quite a lot for us out of the box, and that we don't need to find other tools to do these tasks. If you have used other ecosystems like Node.JS, Java etc., you will know that you will often need several different (often unofficial) tools to handle multiple versions (e.g, nvm for Node.JS), installing official tooling etc. This simplicity in the Rust ecosystem makes it really easy to get started, and also doing lots of common tasks in a standard way. In other ecosystems you will probably do more research to do these things than you would have to do with Rust.

- +

-
-

Build system - Cargo

-
+
+

Build system - Cargo

+

Rust comes with a powerful build system for your projects, which is also used to install programs directly from source (e.g, git or crates.io). This build system handles building/compiling, fetching dependencies, running tests (including having a built in test runner!), and more! The way it handles dependencies is very modern, with each project having a Cargo.toml file specifying dependencies and their versions. If you have used older build systems like CMake, automake etc., you will be pleased that you don't need to handle dependencies yourself and that you can have multiple versions of them on the same system. If you are coding in the Java ecosystem, you will probably be happy that there is a great build system out of the box, instead of having to research which one to use (for JVM languages you have Maven, Gradle, Ant etc., no standard one). Printing a dependency graph, which requires a plugin on the JVM with Maven, can be done out of the box with cargo tree.

@@ -75,39 +75,39 @@

Build system - Cargo

- +

-
-

Compiles to almost any platform!

-
+
+

Compiles to almost any platform!

+

Rust compiles to many different computers, micro controllers, game consoles and more. This is all thanks to the compiler utilizing LLVM for generating machine code. LLVM supports generating machine code for many different computer architectures, and thanks to it we can describe Rust targets. The targets describe the architecture, operating system and so on an executable runs on. Many are built into Rust, and we can also create our own. This has lead to support for many different architectures, which off course includes many micro controllers and computers. Some interesting ones include Linux on Motorola 68k processors (hopefully we can hack together AmigaOS classic and 4.1 variants in the future!), GameBoy Advance, and older 32 bit Windows versions (including Windows 95!).

- +

-
-

Compiler guides you! - Useful compiler messages

-
+
+

Compiler guides you! - Useful compiler messages

+

The Rust compiler have, in my view, really useful compiler messages! I often feel like they guide you to the solution you might want (within reason off course). I could construct an example here, but I feel like the Rust book have a great early tutorial that shows you this in action!

- +

-
-

Better enums

-
+
+

Better enums

+

You are probably used to enums to do simple enumerations in many languages. In Java, Kotlin and many similar languages they can also contain some data, though this data can not vary for the same enum value (the definition of an enum value has to call the constructor directly). Rust enums are way more powerful, and in my view operate more in a way as a sort of category. Let us see some code with comments:

@@ -142,13 +142,13 @@

Better enums

- +

-
-

Awesome pattern matching

-
+
+

Awesome pattern matching

+

We can destructure, check for matches etc.:

@@ -170,13 +170,13 @@

Awesome pattern matching

- +

-
-

Error handling that makes sense

-
+
+

Error handling that makes sense

+

One thing I think is really great in Rust is that we don't have big bloaty exceptions. Rust have two types of error scenarios: recoverable and non-recoverable. Non-recoverable errors are done by stopping the program (i.e, panic), and possibly giving a stack trace (depending on settings). This type of error is well documented, and as it is non-recoverable we can't handle it that much. Recoverable errors on the other hand we can handle!

@@ -200,13 +200,13 @@

Error handling that makes sense

- +

-
-

Closures and functional programming features

-
+
+

Closures and functional programming features

+

Like many other modern languages, Rust provides functional programming features. Closures, similar to lambdas in other languages, act as anonymous functions. You can use higher order constructs (i.e, functions that take functions as input and/or return functions) to iterate, like map, filter, reduce etc. In Rust, this concept is called iterators. It looks something like this:

@@ -222,26 +222,26 @@

Closures and functional programming features

- +

-
-

The ownership model

-
+
+

The ownership model

+

Rust have a simple, but effective way to manage memory. Each value has only one owner, and assigning the content to a new variable moves it to that new variable. Other places can borrow it, but two places cannot own the same value (there are ways to work around this with reference counters though). Having these "restriction" makes it possible for the compiler to handle the memory more or less for us (you don't really do manual allocation and deallocation yourself like you would in C). Owner going out of scope, means that the value will be dropped. This system of ownership is probably one of Rusts most unique features, and you can read more about it in the Rust book.

- +

-
-

Simplified "object orientation" - No heavy OOP like in Java or C++

-
+
+

Simplified "object orientation" - No heavy OOP like in Java or C++

+

I have to admit, I'm not a big fan of the heavy object orientation constructs in Java and similar languages. Interfaces, abstract classes etc. are okay concepts, but not necessarily all the design patterns and solutions built around them. They solve specific problems, and can work if they are used to share common languages between developers… but they seem so far away from how computers really work. In some code bases, especially enterprise ones, they are often overused (some people seem to have a competition on who can cram the most object oriented design patterns into a code base). Look at the satirical FizzBuzz Enterprise Edition for an example of what I'm talking about.

@@ -269,26 +269,26 @@

Simplified "object orientation" - No heavy OOP like in Java

- +

-
-

NOT focused on selling a specific editor/IDE - language server implemented as an official core component

-
+
+

NOT focused on selling a specific editor/IDE - language server implemented as an official core component

+

rust-analyzer, the language server for Rust, is an official Rust project. The people behind Rust does NOT do favoritism with any IDE, or try to sell you one (looking at you Kotlin!!!). This means that you can use any editor you like. For some languages, like Kotlin, most people end up using the official IDE, and the language servers end up having limited interest and contributions. Rust is different, and therefore everything works great in Emacs! Though I would recommend using rustic instead of rust-mode (the latter is linked to on the official rust-lang website), as it builds on top of rust-mode and provides more features (e.g, automatic LSP configuration, some Cargo popups etc.).

- +

-
-

Want to learn Rust now? - Recommended resources

-
+
+

Want to learn Rust now? - Recommended resources

+

NOTE! The book links are Amazon Affiliate links where I make a commission on qualified purchases.

diff --git a/_posts/2022-11-19-qemu_user_static.html b/_posts/2022-11-19-qemu_user_static.html index 2dfa9a8..6e38dc7 100644 --- a/_posts/2022-11-19-qemu_user_static.html +++ b/_posts/2022-11-19-qemu_user_static.html @@ -21,9 +21,9 @@

-
-

What can it be used for?

-
+
+

What can it be used for?

+

To some people it might not be clear what a tool like this can be used for. It can replace use cases where you usually had to start up a full virtual machine or similar, including:

@@ -40,9 +40,9 @@

What can it be used for?

-
-

How to use

-
+
+

How to use

+

The setup is very simple. Install the QEMU user space emulator, and activate the relevant architectures (might also sometimes be done automatically, depending on the system you use). On most linux distributions, this package is called qemu-user-static. In Debian based systems you can activate the desired architecture with update-binfmts --enable qemu-ppc , where you replace qemu-ppc with the desired qemu-target. You can display the ones you have available with update-binfmts --display, or check the qemu applications in /usr/bin/. There might be additional steps needed depending on your use case. For Debian, several of these are described in the QEMU User Emulation documentation. Other distributions may have their docs, but I haven't found any as in depth as the Debian documentation. QEMU also have a brief documentation of their own that might be useful.

diff --git a/_posts/2022-12-19-gamecube_linux_sd_boot.html b/_posts/2022-12-19-gamecube_linux_sd_boot.html index 22215d2..0a8e3fb 100644 --- a/_posts/2022-12-19-gamecube_linux_sd_boot.html +++ b/_posts/2022-12-19-gamecube_linux_sd_boot.html @@ -32,9 +32,9 @@ -
-

Prerequisites

-
+
+

Prerequisites

+

To run Linux on the GameCube, you need two things:

@@ -54,7 +54,7 @@

Prerequisites

@@ -63,13 +63,13 @@

Prerequisites

-
-

Compiling GameCube Linux

-
+
+

Compiling GameCube Linux

+
-
-

Basic compilation

-
+
+

Basic compilation

+

While the official page provides much information, it can be a bit fragmented and outdated at times. To get the most "up to date" kernels with community patches (e.g, xorg color fixes, SD card support for GameCube etc.), I suggest looking at DeltaRosero' github repo instead. These are the most up to date ones, and provides the most ease of use thanks to including a cross compilation toolchain (you can build your own cross compilation toolchain if you prefer). Many of the newer kernels focus on Wii, but most should also work on GameCube. I mainly use 2.6.32 stable kernel, as it compiles and works without issues on my GameCube. Full branch in DeltaRosero's repo: GC-Wii-Linux-Kernel-2.6.32.y-STABLE

@@ -94,7 +94,7 @@

Basic compilation

- + Compiling as is easy as these 3 steps (the script does these automatically):

    @@ -161,23 +161,23 @@

    Basic compilation

-
-

Configuration

-
+
+

Configuration

+

You will probably want to configure your install. Based upon what you want to use the installation for, there are several options that can affect your experience. If you take a look at modern software like systemd (just an example of a well put wiki-page, not any bigger praises, down with the pithforks now!), you will see that the documentation describes kernel flags and init-arguments.

- +

-
-

Build arguments

-
+
+

Build arguments

+

-If you have built a linux kernel before, you know it is based upon config in a .config-file. We have some ready-made config files in our repo, so our first step is often just to use one as a base. When we discussed building earlier, our first operation was simply stating that we want to use the gamecubedefconfig configuration. You find this file in arch/powerpc/configs/gamecubedefconfig. +If you have built a linux kernel before, you know it is based upon config in a .config-file. We have some ready-made config files in our repo, so our first step is often just to use one as a base. When we discussed building earlier, our first operation was simply stating that we want to use the gamecubedefconfig configuration. You find this file in arch/powerpc/configs/gamecubedefconfig.

@@ -209,9 +209,9 @@

Build arguments

-
-

Kernel boot arguments

-
+
+

Kernel boot arguments

+

One of the most important steps to configure during compilation is the kernel boot arguments. You might have to tweak these a bit as a you go, depending on your use case. Where to boot from etc. In arch/powerpc/boot/dts/gamecube.dts you find something along the lines of this (line 23 in my file):

@@ -241,9 +241,9 @@

Kernel boot arguments

-
-

Creating a root file system - Debootstrap

-
+
+

Creating a root file system - Debootstrap

+

We now have a kernel we can boot into, but it got nothing to do. As all other Linux-based systems, we need a file system to run in. This file system includes our applications (e.g, bash, emacs etc.) and other things the various distributions include. There are many ways to create Linux root file systems, some of them being:

@@ -341,7 +341,7 @@

Creating a root file system - Debootstrap

-These are just some of the things you could do! There are many things you could do based upon your needs. You might also want to set up device nodes during this stage, see later in this article for a small reference. +These are just some of the things you could do! There are many things you could do based upon your needs. You might also want to set up device nodes during this stage, see later in this article for a small reference.

@@ -356,17 +356,17 @@

Creating a root file system - Debootstrap

- +

-
-

Booting and using

-
+
+

Booting and using

+
-
-

Preparing SD card

-
+
+

Preparing SD card

+

I use SD Media Launcher, so I run everything from an SD card. My SD card has two partitions:

@@ -395,9 +395,9 @@

Preparing SD card

-
-

Interacting with the system

-
+
+

Interacting with the system

+

So now we have a Debian based system using SysVInit:

@@ -405,9 +405,9 @@

Interacting with the system

-
-

Keyboard controller

-
+
+

Keyboard controller

+

Note! I have only tested the ASCII Keyboard Controller ASC-1901PO, but I guess it will work the same for the Action Replay keyboard.

@@ -440,9 +440,9 @@

Keyboard controller

-
-

Broadband adapter

-
+
+

Broadband adapter

+

The broadband adapter works pretty much out of the box. Just boot your system, and things will connect during initialization thanks to the ip=on boot argument. On boot the GameCube will also print its ip address, which is super convenient if you want to log into it. In Debian you can simply install openssh-server, and you can connect right away.

@@ -475,11 +475,11 @@

Broadband adapter

-
-

USB Gecko

-
+
+

USB Gecko

+

-In the section about compiling above, I activated the USBGECKO serial option. This makes it possible for us to the the USB Gecko device for serial communication. To actually use it, we have to do two things: +In the section about compiling above, I activated the USBGECKO serial option. This makes it possible for us to the the USB Gecko device for serial communication. To actually use it, we have to do two things:

  • @@ -518,13 +518,13 @@

    USB Gecko

    - +

-
-

Summarizing important device nodes

-
+
+

Summarizing important device nodes

+

Like we saw above with USB Gecko, there are a few device nodes that can be useful to make (unless it happens automatically). Some can be useful for mounting file systems, while others are useful for logging in (like: USB Gecko). You can either make these as root on a running system, or during your debootstrap setup.

@@ -587,9 +587,9 @@

Summarizing important device nodes

-
-

Other

-
+
+

Other

+

Sound seems to work out of the box, but requires some setup. The device gcn-ai seems to be detected just fine by Alsa when installed and running. Like all other linux distros set up from scratch, you will probably have some sound issues :)

@@ -599,9 +599,9 @@

Other

-
-

Troubleshooting

-
+
+

Troubleshooting

+
  • Many programs getting killed due to memory issues? Remember that GameCube is a game console from 2002 with 24 Mb RAM, so it might not handle all the newest software that well.
  • Issues during boot? "attempt to access beyond end of device" (ext2 and ext3) or "block count yyy exceeds size if device xxxx"? Then the GameCube does not seem to recognize the full size of your SD card. The only way I have found so far is to limit the size of my homebrew and ext4 linux partition. Seems like just the way the SD card is seen by the hardware. There was a GC Forever forum thread with the same issue a while back, and I guess a lot of people have ended up here without any clear hint of what the issue may be.
  • diff --git a/_posts/2023-01-13-gamecube_debugging.html b/_posts/2023-01-13-gamecube_debugging.html index 72bfe85..23eb76e 100644 --- a/_posts/2023-01-13-gamecube_debugging.html +++ b/_posts/2023-01-13-gamecube_debugging.html @@ -41,18 +41,18 @@ -
    -

    GDB stub snippets

    -
    +
    +

    GDB stub snippets

    +

    Depending on what way you want to debug, there are a few differences on the GDB code stub you put in your code. No matter what method you use, you should link your program with the db library (-ldb), and include debug.h in your program.

    -
    -

    Option 1: USB Gecko

    -
    +
    +

    Option 1: USB Gecko

    +

    To use USB Gecko, we only need to a single line for initialization:

    @@ -69,9 +69,9 @@

    Option 1: USB Gecko

    -
    -

    Option 2: Network debug (broadband)

    -
    +
    +

    Option 2: Network debug (broadband)

    +

    If you want to debug over the network using a broadband adapter, the stub itself is fairly simple:

    @@ -103,9 +103,9 @@

    Option 2: Network debug (broadband)

    -
    -

    Common step: break

    -
    +
    +

    Common step: break

    +

    When you have chosen your way of debugging and inserted the GDB stub initialization code, you need one final thing: a break statement. This can be a bit confusing when you first see it. The initialization snippets only seem to initialize the hardware, and a separate instruction to wait for a GDB session to attach is necessary. Simply put this in your code where you want it to wait for your GDB connection:

    @@ -127,9 +127,9 @@

    Common step: break

    -
    -

    Debugging using GDB directly

    -
    +
    +

    Debugging using GDB directly

    +

    When you have done the above, debugging using

    @@ -170,9 +170,9 @@

    Debugging using GDB directly

    -
    -

    Using Debug Adapter Protocol to get visuals like we are used to

    -
    +
    +

    Using Debug Adapter Protocol to get visuals like we are used to

    +

    Thanks to VSCode, we have the Debug Adapter Protocol. This standard provides a common way for editors to talk to debuggers, and is implemented in many editors including VSCode, Vim and Emacs. While GDB doesn't provide a way for us to connect using this protocol, there are middleware that do. WebFreak001 provides a VSCode extension that connects to GDB and visualizes the breakpoints, variables etc. like we are used to. The debug adapter part can be used by almost any editor, and we will use it from Emacs in the next section. Using this extension we can easily create launch configurations:

    @@ -202,9 +202,9 @@

    Using Debug Adapter Protocol to get visuals like we are used

    -
    -

    Adapting the process to Emacs

    -
    +
    +

    Adapting the process to Emacs

    +

    While Emacs has a built-in GDB command we could use, we would still need to write GDB commands the old fashioned way. To make our debugging more comfortable, we can use dap-mode. dap-mode makes it simple to use the debugger part of the extension mentioned above, as you only need to run a interactive command in Emacs after requiring dap-gdb-lldb. After that is done, we can create a debug template:

    @@ -235,13 +235,13 @@

    Adapting the process to Emacs

    -
    -

    Possible issues

    -
    +
    +

    Possible issues

    +
    -
    -

    "Reading symbols from /path/to/my.elf…Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or 4) [in module /path/to/my.elf]"

    -
    +
    +

    "Reading symbols from /path/to/my.elf…Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or 4) [in module /path/to/my.elf]"

    +

    This is caused by the newest versions of powerpc-eabi-gcc (version 12.1.0 from 2022 on my machine) defaulting to Dwarf-5 debug format, while powerpc-eabi-gdb (version 7.6.2 from 2013 on my machine) is not supporting it due to being an older version. Dwarf is a standard for debugging information, and is used by many different compilers today.

    diff --git a/_posts/2023-02-22-essential_rust_books.html b/_posts/2023-02-22-essential_rust_books.html index 423e0bd..b4eb7aa 100644 --- a/_posts/2023-02-22-essential_rust_books.html +++ b/_posts/2023-02-22-essential_rust_books.html @@ -27,9 +27,9 @@ -
    -

    The Rust Programming Language by Steve Klabnik and Carol Nichols

    -
    +
    +

    The Rust Programming Language by Steve Klabnik and Carol Nichols

    +
    @@ -60,9 +60,9 @@

    The Rust Programming Langu

    -
    -

    Rust Brain Teasers by Herbert Wolverson

    -
    +
    +

    Rust Brain Teasers by Herbert Wolverson

    +
    @@ -86,9 +86,9 @@

    Rust Brain Teasers by

    -
    -

    Rust for Rustaceans by Jon Gjengset

    -
    +
    +

    Rust for Rustaceans by Jon Gjengset

    +

    diff --git a/_posts/2023-02-25-important_computer_related_innovations.html b/_posts/2023-02-25-important_computer_related_innovations.html index d3b6d00..c7de7cb 100644 --- a/_posts/2023-02-25-important_computer_related_innovations.html +++ b/_posts/2023-02-25-important_computer_related_innovations.html @@ -15,9 +15,9 @@ -

    -

    Highly programmable GPUs - massively parallel floating point operations for the masses

    -
    +
    +

    Highly programmable GPUs - massively parallel floating point operations for the masses

    +

    Graphics Processing Units (GPUs) started their life as fixed function state machines. You sent it fixed commands, and it obeyed. With their parallel nature, it wasn't too long until someone decided to make them more programmable. What if we could run custom programs on GPUs? That is how shaders came to be. With shaders, developers could program custom logic for how their vertices (points) and pixels were calculated. This still went through a pipeline of operations, but parts of them became programmable. (This pipeline included calculating which 3D points were visible, removing non visible ones, etc.). If you want to learn more about how graphics processing pipelines work, I suggest reading this article (it is older, but still valid). The programmability increased through the years, which lead to using GPUs for general purpose applications (i.e, not just graphics). This is called General Purpose GPU (GPGPU). More simulations and massively parallel computations were not possible for more people at home. This lead to innovations in simulation algorithms (e.g, fluid simulations using Smoothed Particle Hydrodynamics), graphics algorithms (e.g, screen space ray tracing, and volume rendering), and more. It also empowers AI (which we discuss later), and has made it faster to train neural networks and do massive calculations. (much of AI and machine learning are calculations, not conditional logic).

    @@ -32,9 +32,9 @@

    Highly programmable GPUs - massively parallel floating point -
    -

    Container technology - Process separation to utilize computing resources more effectively

    -
    +
    +

    Container technology - Process separation to utilize computing resources more effectively

    +

    While Virtual Machines (VMs) have been around for a while, they had one serious drawback; you had to emulate or virtualize several operating systems on the same machine. This provided a separation of processes on a machine, and therefore let us run a lot of different programs on a single computer. Having to run multiple operating systems wasted a lot of resources though. Containers on the other hand share the operating system kernel itself, but have their own file system and process isolation (each container only being able to see its own processes). In Linux this is done through mechanisms like CGroups and namespaces. In essence, a container is just a process with extra steps making it more isolated. This is very lightweight, and has made it super easy to avoid the classical "works on my machine" issues. You pack all your dependencies, like a Debian filesystem and/or OpenSSL, into the container, and the recipient runs exactly the same versions like you. That enabled you to set up completely working servers, database setups and similar, and others can download the complete setup. These days containers come in two main flavors: Linux containers (the original and most popular), and Windows containers (if that is your poison).

    @@ -52,9 +52,9 @@

    Container technology - Process separation to utilize computi

    -
    -

    Affordable computing devices and micro controllers

    -
    +
    +

    Affordable computing devices and micro controllers

    +

    I want to begin with a quote from the former boss of Commodore, Jack Tramiel. His goal with the computers they made was to make them affordable so every home could have them. It is possible to make money, and have socially good causes at the same time! (just in case you doubted it for a second)

    @@ -73,9 +73,9 @@

    Affordable computing devices and micro controllers

    -
    -

    3D printers - Everyone can make products at home (given some basic computer skills)

    -
    +
    +

    3D printers - Everyone can make products at home (given some basic computer skills)

    +

    This is probably the section I have to explain the least! Being able to make your own 3D models (CAD) or download them, and then printing them yourself is a huge innovation. This makes it possible to a whole new degree for individuals to produce their own products, and therefore being able to complete in the market place in a whole new way (both from selling digital products and physical ones). You will notice that in everything from home decor, and cases for computers like Raspberry Pi, to guns. Maybe we will also print food in the future, who knows? While 3D printer prices are still a barrier to entry, the prices are slowly declining. More competition in the free(ish) market is amazing like that! Speaking for myself, I would love to own one! Hopefully I will have room for one in the near future.

    @@ -83,9 +83,9 @@

    3D printers - Everyone can make products at home (given some

    -
    -

    Artificial Intelligence (AI) as a service - For those of us who don't have petabytes of data to train our own datasets

    -
    +
    +

    Artificial Intelligence (AI) as a service - For those of us who don't have petabytes of data to train our own datasets

    +

    Artificial Intelligence (AI) is not a new field, and has been with us in one shape or form since the 50s. In my view, it is thanks to the growing computing power and related innovations (see GPU section above) that we have been able to do more research faster. This has caused a surge of new algorithms, use cases and more. What I consider the biggest innovation though, is making it available for everyone. Sure, you can program and train your own models, but you probably don't have the amount of data that a company like OpenAI, Google or Microsoft has. These companies providing their trained models as APIs have made it possible for more people to utilize advanced AI (neural networks, machine learning etc.) technology in their applications. You may not have noticed it that much until recently, but many of these APIs have been used in various web and mobile apps for years.

    @@ -95,9 +95,9 @@

    Artificial Intelligence (AI) as a service - For those of us -
    -

    Honorable mention: Digital distribution and better accessibility

    -
    +
    +

    Honorable mention: Digital distribution and better accessibility

    +

    You may wonder: what is so special about digital distribution? It has after all been done since the 90s for various media like games and software. Thanks to increasing internet speeds, you can now do all of it way faster. That has in itself enabled platforms like Steam (for games), Netflix (for movies), and more. Still, that is not what I want to highlight here. Digital distribution has also made it easier than ever to access audio books, books, courses etc. The accessibility here is two-fold; actually getting hold of the material, and also making it possible to use for people who may not have had the options earlier. One example is text/subtitles in movies and courses, where you can now increase the font size in most services. Same for audio books becoming popular, and that you are now able to set the speed if you need to (some may want to slow down, or you need to set it up to 2x speed to not get bored). Or for dyslexic people who may not have had the chance to enjoy the book as much otherwise! Having material in digital format has also enabled us to have screen readers to make everything from code to web pages accessible for blind people. To me, accessibility issues like these are probably the most important innovations that have come from digital distribution. My hope for the future is that we can continue to make our media (both entertainment and educational) available to a higher number of people.

    diff --git a/_posts/2023-03-04-kotlin_collections_stdlib.html b/_posts/2023-03-04-kotlin_collections_stdlib.html index 7b8e3a6..2781e75 100644 --- a/_posts/2023-03-04-kotlin_collections_stdlib.html +++ b/_posts/2023-03-04-kotlin_collections_stdlib.html @@ -21,9 +21,9 @@

    -
    -

    Recap: List basics

    -
    +
    +

    Recap: List basics

    +

    If you are already familiar with the basics of lists, feel free to skip this part.

    @@ -125,9 +125,9 @@

    Recap: List basics

    -
    -

    Sequences

    -
    +
    +

    Sequences

    +

    The operations above all returns new lists in each operations. You may remember that streams in Java have lazy evaluation. Why don't the lists in Kotlin provide the same? Well, we have to consider that streams are not pure lists. Kotlin have its own stream type called Sequence. These will not return a list right away, and will support lazy evaluation and other things you are used to in Java streams (e.g, only being executed once a terminal operation like toList() is done). So when should you use sequences? If you chain multiple operations on a list of many elements, it might be beneficial to consider to use sequences. This article was not meant to cover the basics, so you should read the official documentation if you are still confused. For now, you should know that most (if not all) operations we cover here will work with sequences as well.

    @@ -137,9 +137,9 @@

    Sequences

    -
    -

    Effective searching for single elements

    -
    +
    +

    Effective searching for single elements

    +

    Sometimes we want to get an index of an element in a list. This can simply be done by use of the indexOf extension function:

    @@ -195,9 +195,9 @@

    Effective searching for single elements

    -
    -

    Indexed higher order functions

    -
    +
    +

    Indexed higher order functions

    +

    We have already briefly discussed higher order functions like map, filter, and reduce, in the recap-section above. In some cases you might want the indices of the elements as well.

    @@ -229,9 +229,9 @@

    Indexed higher order functions

    -
    -

    Combining lists

    -
    +
    +

    Combining lists

    +

    Sometimes you may want to concatenate list structures. Thanks to Kotlins operator overloading, we can use the + operator to do this:

    @@ -277,9 +277,9 @@

    Combining lists

    -
    -

    zipping lists

    -
    +
    +

    zipping lists

    +

    Some of you may wonder: what does zipping mean? If you think of a zipper on a jacket or similar, it puts two-and-two elements together. In Kotlin you can think of each strip of your zipper as a list. It combines the list into pairs of the same index of each list:

    @@ -343,9 +343,9 @@

    zipping lists

    -
    -

    Partitioning lists (split in two)

    -
    +
    +

    Partitioning lists (split in two)

    +

    There are cases where you may sometimes want to split a list in two, based upon some given criteria. One famous example includes the quicksort algorithm. You will find a method for partitioning list called partition in the standard library. It takes in a predicate (i.e, function returning true or false), and returns all elements satisfying the predicate into the first element of a pair, and those who do not into the second element.

    @@ -364,9 +364,9 @@

    Partitioning lists (split in two)

    -
    -

    Chunking

    -
    +
    +

    Chunking

    +

    Sometimes you may want to split a list into chunks. For those of you who have worked with batch processing, you may be familiar with this concept. The idea is to split a number of elements into groups of fixed length. Let us use an example of tasks we want done. We decide to split them into days, and do a number of tasks every day.

    @@ -399,9 +399,9 @@

    Chunking

    -
    -

    Random permutation of elements

    -
    +
    +

    Random permutation of elements

    +

    Have you ever wanted to give the elements of your list a new random ordering? In other words; a different permutation of the list elements. If yes, the standard library has just the function for you called shuffled:

    diff --git a/_posts/2023-03-06-kotlin_strings_stdlib.html b/_posts/2023-03-06-kotlin_strings_stdlib.html index 190c3cb..dfe5f34 100644 --- a/_posts/2023-03-06-kotlin_strings_stdlib.html +++ b/_posts/2023-03-06-kotlin_strings_stdlib.html @@ -16,9 +16,9 @@

    -
    -

    Recap: String basics

    -
    +
    +

    Recap: String basics

    +

    If you are already familiar with the basics of Strings in Kotlin, feel free to skim through this part.

    @@ -127,9 +127,9 @@

    Recap: String basics

    -
    -

    Checking blank or empty strings

    -
    +
    +

    Checking blank or empty strings

    +

    The standard library provides several functions for checking if strings are empty or blank:

    @@ -202,9 +202,9 @@

    Checking blank or empty strings

    -
    -

    Remove parts of strings

    -
    +
    +

    Remove parts of strings

    +

    We briefly looked at substring above, but did you know that the opposite is also possible? Yes, getting a new string without the substring!

    @@ -246,9 +246,9 @@

    Remove parts of strings

    -
    -

    Prefixes and suffixes

    -
    +
    +

    Prefixes and suffixes

    +

    Sometimes we might want to get common prefixes or common suffixes between two strings.

    diff --git a/_posts/2023-06-06-emacs_package_highlight_vterm.html b/_posts/2023-06-06-emacs_package_highlight_vterm.html index fb71af3..7684ed4 100644 --- a/_posts/2023-06-06-emacs_package_highlight_vterm.html +++ b/_posts/2023-06-06-emacs_package_highlight_vterm.html @@ -38,9 +38,9 @@ -
    -

    Dependencies needed

    -
    +
    +

    Dependencies needed

    +

    As mentioned before, vterm uses an external C library to do most of the heavy lifting. It may then not come as a shock that compiling this library is needed. To do this, CMake and libtool is used. Installing these should be super simple on most systems. Homebrew on Mac OS X have both:

    @@ -66,9 +66,9 @@

    Dependencies needed

    -
    -

    Configuration and usage

    -
    +
    +

    Configuration and usage

    +

    vterm can be installed directly from source or through Melpa. I use use-package to install and configure it, which looks like this:

    @@ -124,9 +124,9 @@

    Configuration and usage

    -
    -

    Closing remarks

    -
    +
    +

    Closing remarks

    +

    You may ask: With this awesome terminal inside Emacs, surely you don't need any other terminal programs? I still use other ones, and don't call me Shirley. (sorry, I had to). The main reason here is that old habits die hard. On my setups I usually have a lot of terminals open at the same time. That should be possible with vterm by using the multi-vterm, though I have not tried that one yet. Who knows, maybe I will replace my many iterm2 tabs with vterm buffers in the future?

    diff --git a/_posts/2023-07-29-three_things_love_hate_mac.html b/_posts/2023-07-29-three_things_love_hate_mac.html index 6f96abd..53ff4f9 100644 --- a/_posts/2023-07-29-three_things_love_hate_mac.html +++ b/_posts/2023-07-29-three_things_love_hate_mac.html @@ -19,13 +19,13 @@ -
    -

    What I really enjoy in Mac OS X

    -
    +
    +

    What I really enjoy in Mac OS X

    +
    -
    -

    Unix backbone

    -
    +
    +

    Unix backbone

    +

    Probably one of the most important things for me is the Unix kernel (Darwin). Why does it matter? A Unix system has a file system that actually makes sense, which makes for logical places to find what you are looking for (e.g, devices, home directory etc.). As it is a Unix system, you will also find the standard tools included (e.g, grep, sed etc.) though often in their BSD variants. A lot of settings can also be done by editing text files, compared to convoluted settings GUIs. That being said, there are still some settings that I have not found a way to do outside the settings GUI…

    @@ -43,9 +43,9 @@

    Unix backbone

    -
    -

    "It just works" - ease of use for the boring parts

    -
    +
    +

    "It just works" - ease of use for the boring parts

    +

    Everything just sticks together and works! No need to configure boring stuff like PulseAudio, fiddle with drivers for devices I don't give two shits about (e.g, network cards) etc. This means I can use more time to configure more interesting programs, like Emacs. All of Apples devices works great together if you join the Apple cult. You can copy paste from your iPhone to your Mac, from one Mac to another, unlock your locked device with your Apple Watch and more! If you have multiple Macs, you can even use the Mouse on one to control all of them at the same time. All without any boring setup I normally would not take the time to do. Being able to run iPad apps on my M1 Mac is also a great plus!

    @@ -53,9 +53,9 @@

    "It just works" - ease of use for the boring parts

    -
    -

    Touch pads are amazing! (all other ones suck)

    -
    +
    +

    Touch pads are amazing! (all other ones suck)

    +

    Let's just say it right away: I have never enjoyed using other touch pads than those on Macs. The other ones always feel awful to use, and I always end up doing intended things (e.g, clicking wrong places, using weird default settings, getting used to unintuitive touch gestures etc.). The ones on my Macbooks always works in logical ways, is comfortable to use and feels exclusive (fitting in nicely with the rest of the build quality). This is probably the one point on my list that you got to experience to actually understand! Maybe you now consider buying the external touch pads that Apple sells, which I have to admit that I'm currently contemplating.

    @@ -63,9 +63,9 @@

    Touch pads are amazing! (all other ones suck)

    -
    -

    Honorable mention: Actually trying to (finally) throw Intel x86 in the trash

    -
    +
    +

    Honorable mention: Actually trying to (finally) throw Intel x86 in the trash

    +

    "You may or may not know that both Intel and IBM have pumped a hell of a lot of money into the new Escom stores. I have a feeling that they have objected to having Amigas in the stores (primarily because it proves that Intel processors are kludged 70s crap, and IBM have blatantly tried (and failed) to copy AmigaDOS/Workbench)." – Andrew Elia, former Escom employee, from the book "From Vultures to Vampires - volume one 1995-2004" @@ -87,18 +87,18 @@

    Honorable mention: Actually trying to (finally) throw Intel -
    -

    Dislikes

    -
    +
    +

    Dislikes

    +

    Even with all of the dislikes, it still feels like heaven compared to bloatware like Microsoft Windows 10…

    -
    -

    The security system when downloading programs from the internet feels like a straitjacket

    -
    +
    +

    The security system when downloading programs from the internet feels like a straitjacket

    +

    Usually I download programs with Homebrew (or rarely using a dmg file or similar), and then it usually opens at first try. Sometimes I get the "Are you sure you want to open"-dialog menu. That is okay though, but downloading programs from the internet is sometimes a completely different nightmare… Let us say we want to download the procs (ps replacement written in Rust) program, so we go to the latest release in Github. We unpack the zip file, and try to open procs in our terminal like we are used to. From Mac OS X, we are then greeted with this message:

    @@ -120,9 +120,9 @@

    The security system when downloading programs from the inter

    -
    -

    System programs taking up an unreasonable amount of space

    -
    +
    +

    System programs taking up an unreasonable amount of space

    +

    The operating system and system files (including applications) takes up a lot of space. By default these just stay there, taking up more and more of your hard drive. My Macbook Air M1 has a 500GB SSD where over 100GB is used for these files! Not really intuitive how these can be deleted either, as Mac OS X simply tell you that they are used by the system. Here is a screenshot from the Storage view (in Settings) on my Mac:

    @@ -137,9 +137,9 @@

    System programs taking up an unreasonable amount of space -
    -

    Annoying system popups

    -
    +
    +

    Annoying system popups

    +

    I have to set my settings to "don't disturb"-mode to get the level of notifications and popups I want - exactly zero! These takes focus and are annoying, so I have "don't disturb"-mode on all the time. Probably awful when someone tries to call me, but if you cannot say it with text (e.g, SMS or chat messages) it is usually not worth mentioning… Clicking on the clock-widget to show them is okay though. Just don't plop those in my face while I write or do something! Sometimes they also steals the keyboards focus for whatever reason…

    @@ -147,9 +147,9 @@

    Annoying system popups

    -
    -

    Why don't I miss Linux more?

    -
    +
    +

    Why don't I miss Linux more?

    +

    To be honest, there are times I miss my older Linux setups. Sometimes due to customizability, the points mentioned above, applications not being available or something else. Fortunately we have containers in 2000-current-year. Getting a Linux box, either ARM or x86, is super easy thanks to Docker. At the moment it solves most of what I miss in a GNU/Linux setup, except being able to use my own window manager obviously. (We all know that the best one is Emacs Window Manager after all).

    diff --git a/_posts/2023-08-18-backend_dev_job_howto.html b/_posts/2023-08-18-backend_dev_job_howto.html index 2a328a6..c45a1e1 100644 --- a/_posts/2023-08-18-backend_dev_job_howto.html +++ b/_posts/2023-08-18-backend_dev_job_howto.html @@ -29,9 +29,9 @@ -
    -

    Target audience

    -
    +
    +

    Target audience

    +

    My target audience is people who want to work professionally as a backend developer. This can include both beginners as well as people transitioning from a different area of expertise. I expect you to now be completely new to computers however, so if you are very new, you may find parts of this article confusing. Take it one step at a time, and I'm sure you will figure it out :) Start with learning a programming language and general programming concepts in that case.

    @@ -40,9 +40,9 @@

    Target audience

    -
    -

    How this article is structured

    -
    +
    +

    How this article is structured

    +

    This article contains information about what to search for and learn, and will not have in-depth explanations. An article covering everything would be too much, and would probably fit better as a book. My hope is that you at least get some guidance on where to start, terms to look up, and other research topics to help you become a backend developer. (or if you are already, become even better at it!).

    @@ -70,9 +70,9 @@

    How this article is structured

    -
    -

    General tips

    -
    +
    +

    General tips

    +

    There are some general tips that apply no matter your skill level. Even if you are experienced, you can find great joy in following some of these tips if you are not already.

    @@ -87,13 +87,13 @@

    General tips

    -
    -

    Learning list

    -
    +
    +

    Learning list

    +
    -
    -

    1. Complete basics

    -
    +
    +

    1. Complete basics

    +
    • Know you a programming language at a decent level: You should be decently familiar with your programming language of choice. This includes basic problem solving, constructs unique to the language etc. You don't need to know everything. You don't have to know every little nook and cranny of the language, or be a master programmer. All of those things come with experience. Some popular languages (in enterprises) include Java, Kotlin, JavaScript, and Golang. If you specifically want to learn Kotlin, I have written a small guide to good learning resources.
    • git: git is a version control system that is mostly used for source code. If you want to learn the complete basics, I've heard that Kevin Stratverts introduction video is good. Other people might want to jump straight to the documentation.
    • @@ -103,9 +103,9 @@

      1. Complete basics

    -
    -

    2. Next steps - The bread and butter

    -
    +
    +

    2. Next steps - The bread and butter

    +

    The following are some of the concepts a backend developer should know, and that will help you in becoming one. It is not necessary to know everything before starting a job though. Knowing as much about these as possible, and how it relates to your job, might help your chances on getting a job if there is competition. Don't be scared if you don't know everything! It is okay to learn some of it on the job as well.

    @@ -140,9 +140,9 @@

    2. Next steps - The bread and butter

    -
    -

    3. Going a bit above and beyond

    -
    +
    +

    3. Going a bit above and beyond

    +

    I'm in no way saying these are super advanced topics, though they might seem that way if you are a beginner. What I'm saying is that a lot of people applying for a job don't a lot about these, especially those with less experience. Knowing a few will help you, as you will probably work with these topics (especially in a decently modern software company).

    diff --git a/_posts/2024-01-02-the_academically_hostile_professor.html b/_posts/2024-01-02-the_academically_hostile_professor.html index 33eccef..c47e2fc 100644 --- a/_posts/2024-01-02-the_academically_hostile_professor.html +++ b/_posts/2024-01-02-the_academically_hostile_professor.html @@ -15,9 +15,9 @@

    -
    -

    Some background on the story and concepts

    -
    +
    +

    Some background on the story and concepts

    +

    Let's start with some background. Many years ago I was taking a university course on numerical solving of partial differential equations (PDEs), as I LOVE when mathematics and computers intersect like in simulations of natural phenomena. If you are not familiar with PDEs, they are mathematical equations describing various phenomena. What makes them more complicated than equations you may have seen before is that PDEs include partial derivatives (i.e, functions derived with relation to specific variables). If we have a function f, then its partial derivative with respect to x would look like:

    @@ -33,9 +33,9 @@

    Some background on the story and concepts

    -
    -

    "And now the conclusion…" (aka the main story if you didn't take the Star Trek The Next Generation reference)

    -
    +
    +

    "And now the conclusion…" (aka the main story if you didn't take the Star Trek The Next Generation reference)

    +

    The course I took was amazing, but the professor was ABSOLUTELY F**KING NOT. He was arrogant, and had an attitude that could repel even the most eager student of mathematics. At the time, I was very curious on fluid motion, and wanted to grok it and understand the basics of the Navier Stokes equations to simulate fluids (fluids = gasses, water, liquids etc.). The resources I had found were convoluted, and I had trouble understanding them. Who better to ask for advice than the professor of a course on PDEs? Seemingly anyone else on the entire planet. As this story is many years old, I will paraphrase below.

    @@ -72,9 +72,9 @@

    "And now the conclusion…" (aka the main story if you

    -
    -

    Afterthoughts

    -
    +
    +

    Afterthoughts

    +

    What if you want to look into the Navier Stokes equations? I'm in no way an expert, and have only basic understanding here. When you start reading about them, they might seem VERY complicated (as they were for me). You should start by looking into the equations for incompressible fluids (i.e, constant volume, and not being stretched or compressed).

    diff --git a/_posts/2024-01-04-emacs_centaur_tabs.html b/_posts/2024-01-04-emacs_centaur_tabs.html index cd60a5f..e5d9413 100644 --- a/_posts/2024-01-04-emacs_centaur_tabs.html +++ b/_posts/2024-01-04-emacs_centaur_tabs.html @@ -28,9 +28,9 @@

    -
    -

    What I expect from tab packages

    -
    +
    +

    What I expect from tab packages

    +

    Many years ago I tried other tab packages in Emacs, and didn't really enjoy them that much. As I experiment with them many years ago, I do not remember the specific package names. I remember the reasons for not enjoying them though:

    @@ -49,9 +49,9 @@

    What I expect from tab packages

    -
    -

    Introducing centaur-tabs

    -
    +
    +

    Introducing centaur-tabs

    +

    Let us first see what the top tab bar looks like with centaur-tabs in my setup. Yours might look a bit more plain at first, but I will share some configuration options shortly (so don't worry!). Currently I'm editing this blog-post, while also having another post open as well as a terminal:

    @@ -73,9 +73,9 @@

    Introducing -

    Configuration options

    -
    +
    +

    Configuration options

    +

    Activating centaur-tabs is as easy as running a function:

    @@ -135,9 +135,9 @@

    Configuration options

    -
    -

    Making tab-grouping work the way I want

    -
    +
    +

    Making tab-grouping work the way I want

    +

    While the projectile integration is okay, it has the limits as described above. Buffers like the ones from VTerm (feel free to read my article on vterm and why it is the best terminal solution inside Emacs), Cargo Rustic runs etc. are shown in a separate group instead of the project they are part of. Projectile exposes some a function called projectile-project-root as well as a variable called projectile-known-projects. We can use this to ask projectile directly for the corresponding project root, and to create a fallback (some buffers were weird and stubborn, might not be needed in all cases):

    @@ -182,9 +182,9 @@

    Making tab-grouping work the way I want

    -
    -

    My complete configuration

    -
    +
    +

    My complete configuration

    +

    I use use-package to configure my Emacs packages. If you are unfamiliar with it, I suggest taking a quick look at it before reading my configuration below.

    diff --git a/_posts/2024-01-10-the_many_ways_to_help_open_source.html b/_posts/2024-01-10-the_many_ways_to_help_open_source.html index f9b6261..d88388d 100644 --- a/_posts/2024-01-10-the_many_ways_to_help_open_source.html +++ b/_posts/2024-01-10-the_many_ways_to_help_open_source.html @@ -31,9 +31,9 @@

-
-

Donating money to projects or developers

-
+
+

Donating money to projects or developers

+

Donations is probably the simplest ways of helping projects and creators out there. Sometimes you might want to help individual developers or creators? Or maybe you want to help a bigger project have funds to manage the costs of their website? No matter what, a donation can help a lot in covering costs and motivate people. It costs money to live after all…

@@ -54,9 +54,9 @@

Donating money to projects or developers

-
-

Issues - Help out by reporting bugs or suggesting features

-
+
+

Issues - Help out by reporting bugs or suggesting features

+

Most projects have an issue tracker where you can report issues. This might not be exclusive to open source software, as some commercial proprietary software also allows you to report bugs. In some issue trackers, you are also allowed to suggest features or improvements as well. Posting issues is not that hard, but you should remember that you want to help the project and the developers. If you just say something along the line of "Your system doesn't work", or "The code in file X is super ugly", or "you are stupid", does not help anyone… I should not have to tell you this, but some people do write comments like the ones mentioned. Remember that a lot of the time, you are getting something for free! Even with errors, someone did work in their spare time (unless they were paid by a company, which is rare for more niche and cool projects).

@@ -88,9 +88,9 @@

Issues - Help out by reporting bugs or suggesting features -
-

Translation/Localization

-
+
+

Translation/Localization

+

This one probably don't need a lot of explanation? You translate from one language to another, either by adding new languages or improving the existing translations. Many projects needs this kind of work, as they have a goal of being available in multiple languages. Some examples include:

@@ -115,9 +115,9 @@

Translation/Localization

-
-

Helping by coding bugfixes, features or something else

-
+
+

Helping by coding bugfixes, features or something else

+

Probably the most obvious one.. This is what people usually think about when talking about open source contributions. There is not much to say here; you contribute by writing code. How do you find the work to do? There are two main ways:

diff --git a/_posts/2024-01-20-command_line_web_browsing.html b/_posts/2024-01-20-command_line_web_browsing.html index 461095a..9a792d6 100644 --- a/_posts/2024-01-20-command_line_web_browsing.html +++ b/_posts/2024-01-20-command_line_web_browsing.html @@ -28,9 +28,9 @@

-
-

Installation

-
+
+

Installation

+

Most package managers already have Lynx available, so simply install with your package manager of choice (e.g, Homebrew, Apt, Dnf, etc.). It is also available for MS DOS and older versions of Windows! Just take a look at the official site to find download links. If you dabble in modern Windows (my condolences), I think the best bet would be to use Windows Subsystem for Linux. That being said; why are you using Windows?!?!

@@ -44,9 +44,9 @@

Installation

-
-

Basic usage

-
+
+

Basic usage

+

To start Lynx, you simply type the lynx command. If you know the page you want to browse, you can include it in the command like this:

@@ -86,9 +86,9 @@

Basic usage

-
-

Wait… Why would I even use this if I'm not a weird nerd like TheMKat…?

-
+
+

Wait… Why would I even use this if I'm not a weird nerd like TheMKat…?

+

Lynx is obviously an older application, and was most popular when many people used text based user interfaces like MS DOS or Linux without an X server. Most people will probably also think of it as a relic from that time. Some of this shows, as it does not support modern features like video, styling, or JavaScript (the last one being a good thing in a lot of cases). Old and lacking of modern features has never stopped me, as I use what I love no matter what others may want. That being said, there are a few reasons to use it:

diff --git a/_posts/2024-01-27-reasons_i_hate_modern_windows.html b/_posts/2024-01-27-reasons_i_hate_modern_windows.html index 826d88b..9bc9f29 100644 --- a/_posts/2024-01-27-reasons_i_hate_modern_windows.html +++ b/_posts/2024-01-27-reasons_i_hate_modern_windows.html @@ -24,9 +24,9 @@

-
-

The file system doesn't make any sense!

-
+
+

The file system doesn't make any sense!

+

NOTE: When talking about file systems here, I'm not referring to NTFS, EXT4, ZFS and other types of ways the data is stored. What I'm talking about here is the organization of directories/folders and how these behave during the runtime of your computer.

@@ -65,9 +65,9 @@

The file system doesn't make any sense!

-
-

Changing most system settings needs some sort of graphical program…?

-
+
+

Changing most system settings needs some sort of graphical program…?

+

Probably ties a bit into the previous point. When everything is not a file or directory that is supposed to be queried directly, it leads to settings being stored in proprietary binary formats only meant to be read by certain programs.

@@ -85,9 +85,9 @@

Changing most system settings needs some sort of graphical p

-
-

Bloatware built-in

-
+
+

Bloatware built-in

+

This one probably don't need much explanation; Modern Windows comes pre-installed with lots of things:

@@ -101,9 +101,9 @@

Bloatware built-in

-
-

Installing programs is tedious

-
+
+

Installing programs is tedious

+

What is the standard way of downloading programs on a Windows system? Downloading executables off random websites… Why? Yes, I know Windows Store is a thing, but most useful programs are not there last time I looked (e.g, Git). I can understand that you download some programs directly from various websites, but that being the standard way…? I mostly do that with weird very small open source programs that I build from source in most cases. The Windows way of always having to find executables on websites sounds like a good way to get tons of malware installed, at least to me…

@@ -126,9 +126,9 @@

Installing programs is tedious

-
-

File locks

-
+
+

File locks

+

Saved one of the most annoying things for last. I know file locks exist in some form in other operating systems as well, but I have never experienced the level of annoyance as I have in Windows. The short explanation is that you sometimes can't even read a file due to it being open in another program, which leads to the "Cannot read file as it is open in another program" style of errors. This is really tedious!

diff --git a/_posts/2024-02-12-amiga_checkmate_build.html b/_posts/2024-02-12-amiga_checkmate_build.html index 8efe334..fc3e192 100644 --- a/_posts/2024-02-12-amiga_checkmate_build.html +++ b/_posts/2024-02-12-amiga_checkmate_build.html @@ -9,9 +9,9 @@

-
-

What is the Checkmate 1500 Plus?

-
+
+

What is the Checkmate 1500 Plus?

+

The Checkmate 1500 Plus is a case/cabinet for computer builds, most famously various Amigas. It is made by Steve Jones and a team of people. They have other products as well, like the smaller Checkmate 1500 Mini and the upcoming Checkmate Displays. No affiliation, just admire their work. What I find interesting is that Steve Jones actually made a similar case in the 80s for the Amiga 500! The Checkmate 1500. It made it possible to build the motherboard of the Amiga 500 into a new case, which had rooms for expansions. Remember that the big box Amigas in the 80s was expensive, so it was often way cheaper for people to buy this setup. The great upgradability was a huge plus. Commodore noticed the effort, and launched their own Amiga 1500. If you find this story interesting, you can hear parts of it in Steven's own words in RMC The Cave's video about it:

@@ -21,9 +21,9 @@

What is the Checkmate 1500 Plus?

-
-

Why did I want this?

-
+
+

Why did I want this?

+

For the people who only thinks of Amiga machines as gaming machines or similar, it can be hard to understand why anyone would do this. They often just think of Amigas as games consoles, and aren't really invested in online Amiga communities. To me, Amiga is a cool computer platform, and I use it for all sorts of things:

@@ -55,9 +55,9 @@

Why did I want this?

-
-

Pre-build configuration

-
+
+

Pre-build configuration

+

My Amiga 1200 is fairly standard, but with some improvements and expansions:

@@ -82,9 +82,9 @@

Pre-build configuration

-
-

The build(!)

-
+
+

The build(!)

+

The build is probably best experienced with some images:

@@ -155,9 +155,9 @@

The build(!)

-
-

Future improvements

-
+
+

Future improvements

+

I have some future improvements I want to do as well. If you prefer, view the image gallery:

diff --git a/_posts/2024-02-24-command_line_tricks_globbing.html b/_posts/2024-02-24-command_line_tricks_globbing.html index d4cffd6..a39bf3c 100644 --- a/_posts/2024-02-24-command_line_tricks_globbing.html +++ b/_posts/2024-02-24-command_line_tricks_globbing.html @@ -15,9 +15,9 @@ -
-

Glob patterns

-
+
+

Glob patterns

+

There are a lot of different patterns we could cover, and many of them would be very esoteric. Instead, the basic and most useful patterns will be covered here. If you are curious on different ones from the ones covered, you can skip to the further reading section for a suggested place to read more.

@@ -37,9 +37,9 @@

Glob patterns

If you are new to globbing, you might wonder how the matches are executed? All programs can't posibly handle them themselves, so they are done by the shell, right? Yes! Before executing the programs in your scripts or command line, bash (or other shell variant) will match the glob patterns. To make it more clear, let us look at a quick example. To make things simple, we will use this blogs code in the example.

- Let's say we have the command "
cat *.html
" (to print contents of all html files directly to the command line). + Let's say we have the command
cat *.html
(to print contents of all html files directly to the command line).
- That is exactly the same as running "
cat 404.html about.html index.html privacypolicy.html
" directly. Before cat is being run, bash will replace the glob pattern with those exact file matches. + That is exactly the same as running
cat 404.html about.html index.html privacypolicy.html
directly. Before cat is being run, bash will replace the glob pattern with those exact file matches.

(don't worry if the pattern seem a bit weird! It will be explained and have more examples shortly.) @@ -48,18 +48,18 @@

Glob patterns

-
-

Matching anything with *

-
+
+

Matching anything with *

+

If you read the info-box above, you will probably have noticed the * matching. What does it mean? It simply matches anything! 0 or more characters. If you are used to regex (regular expressions), you might have seen it there. While globs and regular expressions have commonalities, there are also many differences. So have that in mind if you are familiar with regex.

-
-

Listing information on all html files in directory

-
+
+

Listing information on all html files in directory

+

Let us use the above glob pattern for something useful, and list file information on all html files in the root directory:

@@ -83,9 +83,9 @@

Listing information on all html files in directory

-
-

Listing all files that has an "l" in their extension, and contains a "g" in their name

-
+
+

Listing all files that has an "l" in their extension, and contains a "g" in their name

+

What do we want here? We want a filename where g appears somewhere, with an extension where l appears somewhere. Take a deep breath and remember that * matches 0 or more characters. This means we can use *g* and *l* for our patterns:

@@ -105,18 +105,18 @@

Listing all files that has an "l" in their extension, and co

-
-

Match a single character with ?

-
+
+

Match a single character with ?

+

The previous pattern matched zero or more characters, but sometimes it can be useful to match only one character. This is possible with ?.

-
-

Mixing ? and *: Getting all blog posts from the last 3 months of 2021

-
+
+

Mixing ? and *: Getting all blog posts from the last 3 months of 2021

+

If you take a look at the html files on this blog, you will notice that they follow a pattern: year-month-day-title.html. We can use that to our advantage. The last 3 months of the year start with a 1 (i.e, 10, 11 and 12), so the pattern for those is simply 1?. After the month, we simply have a dash, our day, title and file extension. We don't really care what comes after the dash, so that is a good candidate for *. That leads us to the following pattern, and result:

@@ -148,9 +148,9 @@

Mixing ? and *: Getting all blog

-
-

Creating e-book with pandoc

-
+
+

Creating e-book with pandoc

+

To give you some context: I usually prefer reading longer texts on my Kindle, but there are a lot of "books" you read directly in your browser out there. A lot of those come in markdown or html format, so they need to be converted if used on my Kindle. Fortunately, there is a tool that solves this issue called Pandoc! Some tweaking is sometimes needed, so we will use a fairly simple example here. Sheepolution has created a really awesome book for learning the Love2D Lua game framework, and has made the source files available on Github. We can use those Markdown files to create a really awesome epub file that can later be converted for use on our Kindle!

@@ -261,9 +261,9 @@

Creating e-book with pandoc

-
-

Ranges and groups with []

-
+
+

Ranges and groups with []

+

The group syntax, [group], where group is a group pattern, is a useful way to match ranges and limit possible matches. One such group matches one character at a time. Some notable patterns include:

@@ -288,9 +288,9 @@

Ranges and groups with []

-
-

Files starting with a, b, c, d, e or f in blog source root

-
+
+

Files starting with a, b, c, d, e or f in blog source root

+

Let us for simplicity only match files that have an extension. That way we can use ls to list the files in a simple manner. (Remember that ls lists the content of the directory it gets as an argument, when the argument is a directory). This can be done fairly simply by combining groups and the match anything pattern. We can specify a, b, c, d, e and f with a direct group:

@@ -324,9 +324,9 @@

Files starting with a, b, c, d, e or f in blog source root -
-

Improving our "Blog posts from the last 3 months of 2021" example

-
+
+

Improving our "Blog posts from the last 3 months of 2021" example

+

In the previous version of this matcher, we matched every possible character after 1. Hopefully, you know that the only valid month numbers that start with 1 are 10, 11 and 12. That means that our previous version would have matched invalid patterns if we had made such files. Let us limit it a bit using groups. Instead of matching anything, we only want to match 0, 1 and 2. This can easily be done with a range [0-2]:

@@ -358,9 +358,9 @@

Improving our "Blog posts from the last 3 months of 2021" ex

-
-

Blog posts NOT from 2022, 2023 or 2024

-
+
+

Blog posts NOT from 2022, 2023 or 2024

+

If we assumed that all blog posts are from the 2020 decade, then this one is simply a match for the last digit not to be 2, 3 or 4. That leads us to 202[!234]. We want a more flexible solution for a longer living blog than mine. Maybe it is not even a blog, but a journal of sorts that matches far back (1900s?). For simplicity, we assume 4 digits with a maximum year of 9999. This means that future people using Unix on their space station could also use this pattern! (if every system is not Unix-inspired in the future, then all is lost). We need 2 different groups here: one for the numbers 0-9, and one for the numbers to avoid. One possible solution is

@@ -447,17 +447,17 @@

Blog posts NOT from 2022, 2023 or 2024

-
-

Multiple possible match types with {% raw %} {} {% endraw %}

-
+
+

Multiple possible match types with {% raw %} {} {% endraw %}

+

Sometimes we have multiple possible patterns we want to match. bash has us covered here, and we can cover our options with curly brackets delimited by commas. This is probably best explained with some examples.

-
-

Matching files ending with either html, sh or el

-
+
+

Matching files ending with either html, sh or el

+

We want to match anything ending with either html, sh or el. Using the anything matcher in combination with the multiple matcher then looks like the following:

@@ -509,9 +509,9 @@

Matching files ending with either html, sh or el

-
-

Blog posts from March or July, in 2021 or 2023

-
+
+

Blog posts from March or July, in 2021 or 2023

+

We could easily mix and match using the group pattern here, but for the sake of example we will only use the multiple matcher. We either want to match month 03 or 07, and year 2021 or 2023.

@@ -539,9 +539,9 @@

Blog posts from March or July, in 2021 or 2023

-
-

What happens if I use the above characters in file names (and want to match them)?

-
+
+

What happens if I use the above characters in file names (and want to match them)?

+

If we are stupid and use the matching characters in file names, then how do we match them? Fortunately, bash let's us escape these characters when matching! Let us use the anything matcher here as an example. We want to match a file like myfile*.txt. For this purpose, we could off course use the anything matcher, but it would match other files as well.

@@ -577,9 +577,9 @@

What happens if I use the above characters in file names (an

-
-

No way to match a x number of characters?

-
+
+

No way to match a x number of characters?

+

Sadly no, at least not to my knowledge. If you for example want to match 3 numbers in succession, the easiest way is probably [0-9][0-9][0-9]. You don't have the number of times specifier like you have in regular expressions.

@@ -587,9 +587,9 @@

No way to match a x number of characters?

-
-

Further reading

-
+
+

Further reading

+

What we have covered should be enough for most people, I know it is for me. If you want to go deeper into the rabbit hole of globs, there is several articles you can read. One is a wiki article on wooledge. It also covers some useful group matching patterns you might find useful.

diff --git a/about.html b/about.html index f088ef8..a28f5e8 100644 --- a/about.html +++ b/about.html @@ -4,9 +4,9 @@ title: About me --- -
-

Who am I?

-
+
+

Who am I?

+

My name is Marie, and I'm obsessed with computers and have been ever since I was very young. It's not necessarily just software development that interests me, but computers in general. How they work, what we can do with them, the possibilities they bring and so on. Mathematics also fascinate me, as I think the applications of it makes for many interesting programming problems. To me, it feel even more fun if it is done on a retro platform like the Commodore Amiga or Nintendo GameBoy Advance. While my main topics of interest are computers and math, I like to dabble in other topics like finance and philosophy as well.

@@ -19,9 +19,9 @@

Who am I?

-
-

What is my point with this blog?

-
+
+

What is my point with this blog?

+

The meaning behind making this blog was to have a space where I could share my writings on various topics (math, computers, other topics, my own thoughts on things etc.). Getting better at writing was also a goal. I think that having to present something forces you to know the topic better than if you didn't (whether it is physical presentation, writing, videos etc.).

@@ -29,9 +29,9 @@

What is my point with this blog?

-
-

Want to support me?

-
+
+

Want to support me?

+

Want to support this blog? Now you can! With ko-fi you can donate to help with costs like domain name and comment service, or just show your support in general.