On differentiation

The muddy parts

Let’s talk math. Specifically, calculating derivatives through differentiation. I’ve been taking a calculus course at my local university lately, and one of the things that’s come up and bit me a couple times is how a lot of the reference material we’re given for differentiation shows off differentiation in a way that isn’t entirely clear. So in this post I want to record for the future me just how differentiation works.

Implicit derivatives

When the common derivatives are listed, they’re listed for the variable x, and the fact that you’ll need to apply the chain rule ((f ∘ g)′ = (f′ ∘ g)g or (f(g(x)))′ = f′(g(x)g′(x)) when working with expressions is not really made clear. For instance, let’s look at the derivative for natural logarithms:
$$ (\ln |x|)' = \frac{1}{x} $$

This works great for a single variable x, because the derivative of x is 1. However, in cases where x is an expression (2x, x2, sin x, …), you’ll need to multiply that fraction with the derivative of the expression x. For this reason, I think it’d be much clearer if the formula sheet had it listed like this:
$$ (ln |x|)' = \frac{x'}{x} $$

Similarly, this also goes for other derivatives, like sines, cosines, powers of e, and so on:

$$(\arcsin x)' = \frac{x'}{\sqrt{1 - x^2}}$$

Add updated files only

The secret option to save you some face
The git logo with the title of the article superimposed next to it.

Keep those untracked files out!

Sometimes you’re just a hair too quick when working with git, run a little git add -A or git add ., and then let an unwanted file or two come along for the ride. Regardless of whether it’s just random scribbles or actual secrets, it’s pretty annoying. And if no-one notices before you push it to the remote (or open a merge request), it could be a good few levels worse. Today I learned a way to avoid this, and I want to share it with you, dear reader.

Now, just to be clear: I don’t actually recommend you blindly add all files in a directory or project to git. It’s usually better to be explicit about what you’re adding. Sometimes, though, it’s just easier to add everything. Claiming that I’ve never done it or that it’s never caused me grief would be disingenuous at best.

So what’s the solution you ask? It’s a simple flag you can pass to git add: -u or --update. Much like the flag name would suggest, this makes it add only updated files.

The docs say that this option will “update the index just where it already has an entry matching <pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files”. So you can point it to a directory and it will add all changed or deleted files in that directory, but no new files.

You can also use it without a path, which will just add all deleted and modified files: “If no <pathspec> is given when -u option is used, all tracked files in the entire working tree are updated”.

So next time you want to blindly add all your changes (but no new files!) to git:

Psst! Here’s a little bonus resource for ya: For more information on the behavior of git add with different options, check the answers to this stack overflow question, which is what put me on the trail of git add -u in the first place.

A mentor's thoughts

A look back at Oslo Legal Hackathon
A badge that with the Oslo Legal Hackathon logo and the name Thomas Hartmann on top of a hackathon t-shirt.

Physical artifacts

I was a mentor at Oslo Legal Hackathon this past weekend, and while I’ve been to hackathons before, this was my first time participating as a mentor. I wasn’t quite sure what to expect, but I felt ready.

And indeed, everything went pretty swimmingly. Well, mostly. There was a shortage of tech people, and I ended up co-mentoring a team consisting solely of people from the legal industry. Not ideal at an event that’s supposed to bring legal and tech together, but they made it to the final round by focusing on the things that they could do rather than what they couldn’t. But even though I think my team did a terrific job, that’s not really what I want to focus on. Rather, I want to talk about the act of mentoring and how it feels different from participating.

Stepping down

Admittedly, I like being in charge. I like overseeing what’s going on and giving my input on it. I often end up as team lead or in similar positions. Being a mentor is different.

Yes, I could still get an overview of where the team was headed, and yes, I could still give my input on it, but in the end, I knew that I had no real say in the matter.

I’m also very competitive. It’s probably one of the main reasons that I work as hard as I do. Sure, I enjoy what I do, but I also want to be the very best. Like no one ever was.

By being slightly divorced from the process and by not actually being on the team, I could take a step back, breathe, and just enjoy seeing them work and the solutions they came up with.

In fact, I think that might be the most important thing I learned about myself: I enjoy enabling a team and seeing them succeed at least as much as I enjoy being on the team. They’re two very different, yet very similar experiences.

For future reference

To close this all out, then: would I do it again? Yes. No doubt. Not only was it great fun, it was also a fantastic chance to grow my network, both within tech and within the legal industry, and to get to better know my coworkers and fellow mentors.

I’ve been trying to come up with some cons, but I haven’t really been able to; the event was well organized, the participants and organizers were all nice people, there was food and drinks, and it was just a fun event all around.

A bit tongue-in-cheek, perhaps, but it felt great being able to come in, give feedback, express some opinions, and then go away and have someone else do the dirty work for you. I think I understand why people want to be managers now.

And finally, even if I’ve only been at this for a comparatively small amount of time, I felt that I really had something to contribute to the team, that I could make a difference, that I could add value. So remember: Even if you’re not the most decorated or recognized individual, don’t sell yourself short! As long as you invest your time and are genuinely passionate about what you do, you’ll be a valuable asset to any team, no matter the role.

So don’t quit, don’t stop exploring new things, and don’t stop making yourself uncomfortable. If you’re curious, go for it!

First Prev Page 1 Next Last