My current work involves a lot of local time dependent operations. This means answering a lot annoying questions like “Find the maximum value during workdays between 7-21.”, “Highest value during daytime in February (in Country X)”, “Find the average value average value for today” or “Highest value during December”.
I use many browsers and many profiles in one browser. I would like to open Project 1 related in browser A, other work to B, memes to C etc. But
TL;DR: Don’t use snap if you want to use Org Capture (or xdg-open with any custom schemes).
Now that I’m well passed the magical 40yo mark I’ve noticed my fingers aren’t as invincible as they used to be. I get random RSI strain in mu fingers and especially in my thumbs. Likely a lot from phone usage though, but I’ve noticed my keyboard habits also have a big impact. I’m not convinced that “ergonomic” keyboards that remove weird angles are a permanent solution - a permanent solution would be to not use keyboards. While I do have an ergonomic keyboard - many in fact - and they do help, it’s more helpful to rotate them just to remove the repetition. My current setup is rotation Ultimate Hacking Keyboard v2, Logitech K860 and a Topre Realforce (TKL).
(No spoiers about Catch 22)
This episode discussed the eternal struggle on how to be creative. One of the main points is that many successful creators say that they “follow the characters with they pen” and “just writing” instead of waiting for inspiration. Exploring by creating something and stumbling upon the ideas. That discovery of novel ideas is very hard or impossible to control. Stephen King comes to mind who talks a lot about writing his books this way.
Just to prove the power of one thing idea - I had no memory of this until I read my notes…
WARNING might contain spoilers
A.J. Jacobs in Econtalk notes that we remember nothing from most stuff we read or otherwise consume some time later. I certainly experience this as much as anyone - even books I enjoyed quite a bit I can’t recall anything. I thought I’d attempt to write down at least one thing from at least the books I read. Or rather listen to mostly. But anything and everything goes on this series.
I fiddle with my org mode captures templates a lot. This usually involves customizing (or setting) org-capture-templates. I found it hard to visualize the end result the traditional customize-view, so I wrote a small package that allows you to create an org file that contains all the templates. capture-org-template. Allows you to do the following:
As an active user of vterm, I’ve compiled my own version of Emacs for a while to have the required submodules support. That said, I’ve also been on the bleeding edge native compiled GccEmacs branch of Emacs just to see it’s performance promises. While not 100% functional compared to its more stable counterparts, it still has been an worthwhile experiment. It promises natively compiled elisp, which in turn should result in faster Emacs. Once it reaches feature parity, I suppose it’s a direction Emacs will take.
My git tool of choice is of course Magit. It has an extension called Forge that can interact with tools like GitHub or Gitlab. While this support is incomplete (most notably reading and responding to PR comments), it’s still very convenient to list,, view and checkout pull requests.
Ok starting with vanilla Emacs out of the box on Ubuntu, what does it take to setup to have a decent development experience?
Time for some probably too good for your own good magic. The Azure Key Vault is Azures solution to deliver cryptographic secrets in a cloud environment. You can use this to e.g. store passwords and certificates in a centralized yet secure location in a cloud enviroment.
Application Insights is a tool to monitor your application running in Azure cloud.
Custom queries to Application Insights logs are written in Kusto. You can run these queries in Azure Portal, but for this Stack Overflow question I wrote a solution how to execute these locally.
You need the Application Insights extension to az:
Then you can run queries like this:
I wrote a script to run kusto scripts from a file and get the result as a Powershell object:
Search-AppInsights.psi:
For example if we use the demo instance data we could count the 3 hour request counts for each URI:
For the Emacs users out there, I also wrote a kusto-mode for syntax highlighting.
Say you have multiple configuration files you want to use to when starting the application. One with some general settings shared by multiple instances and one with specific to this instance:
general.yaml:
app.yaml:
With @ConfigurationProperties you can automatically bind this configuration to a POJO:
Starting the app with these two configuration files is simply a matter of adding them to the spring.config.location
list:
Done and done! Off to the races.
Let’s say you would like to have something like this:
general.yaml:
Then you have another file that that contains the passwords, perhaps generated from a key vault or something:
secrets.yaml:
Depending on the order/priority, either the name or the password will be null. Dang. Sadly this doesn’t work (as per doc):
When a List is specified in multiple profiles, the one with the highest priority (and only that one)
So what now? Well you can rethink your design decisions do this some other way.
You still want to do this? Well one way would be to disable @ConfigurationProperties, merge the multiple configuration sources into a single PropertySource and feed that to the Binder manually.
Ok let’s first create a method that does the binding and merging for a generic prefix:
So now we can use this in a @Bean definition:
Now just remove @Configuration and @ConfigurationProperties annotations from your configuration class so the bean is used to create the Config object.
Beyond Compare is a classic comparing tool for folders and files. But when you follow the instructions and set up bc4 as your compare/merge tool, it opens all diffs in a separate window and one by one. This is slow and tedious, so it’s better to set it up so that it opens a single window and all the changed files in tabs.
Here is the basic setup as per instructions (Windows):
git config --global diff.tool bc
git config --global difftool.bc.path "c:/Program Files/Beyond Compare 4/bcomp.exe"
git config --global difftool.prompt false
I’ll also switch the tab order to make the changed file more visible in the tabs:
git config --global difftool.bc.cmd '\"c:/Program Files/Beyond Compare 4/bcomp.exe\" \"$REMOTE\" \"$LOCAL\"'
The same for Linux:
git config --global difftool.bc3.cmd '"bcompare" "$REMOTE" "$LOCAL"'
Then well add a new git command diffall
. So open your git installation directory and go to cmd dir: e.g. C:\Program
Files\Git\cmd\
.
Create a new file called git-diffall
(no extension):
#!/bin/sh
git diff --name-status "$@" | grep "^M" | awk '{ print $2; }' | while read filename; do
git difftool "$@" --no-prompt "$filename" &
done
On Linux this file can be e.g. /usr/local/bin/git-diffall
You may need Administrator privileges to create that file.
Now you can use diffall to open a single session of bc4
The SSH Agent allows you to remember the password for a password protected SSH private key during your session. While Linux usually is able to handle this rather elegantly using it’s key stores like the gnome-keyring (for KDE I think it’s still disappointingly complicated), in Windows it’s still a bit of a second class citizen.
All experienced programmers have probably felt the flow: being completely immersed in the code. You have some feature completely laid out in your brain and you let the code just flow through you into the computer. No distractions and everything works like a breeze. Hours past without realizing it.
It’s highly addictive and at the same time elusive. Many athletes hunt it more than anything. To feel that oneness with the environment, be it running at the 20km mark or that magical game of tennis where all you know is the ball.
When enough time passes without feeling it I start to feel bad. Programming sucks. Computers suck. Everything sucks. So how do I get a sip of that sweet code flow nectar?
When it comes to programming, I’ve found one way: Program something very familiar. The more familiar the better. Here is the plan:
You just might get things done at breakneck speed and get into the flow in an instant. Spending most of the time making the features instead of trying to figure out why that security foobar header isn’t passed on that new shiny acmeJS that was released yesterday is pure brain candy for me.
To me the current stack for web applications is probably Spring Boot for the back end, and Angular for the front. On mobile it is Kotlin on Android. Even on these I need to constrain myself to use older versions and not use the latest and greatest.
Happy Coding!
Do you have some kind of streaming source of data in your application? Notifications? Tweets? Messages? What happens if that source starts to produce data faster than your application can handle?
You don’t have to be a software engineer for long until you hit into performance issues. The database loads too slow. Calculating the route takes forever. Remote calls hang. What to do?
Everyone loves to lambaste the endless drudgery of the typical workday. Meetings, coworkers interrupting, inadequate equipment, Reddit.. It feels like the time goes to everything but the task at hand.
Time for some code obscura. I own a Samsung Gear S2 watch, which at this point is getting 3 years old. The newer models still use the same Tizen SDK, so anything laid out here should work with those devices as well.