Posts

Showing posts from June, 2020

Renaming tags on GitHub

Image
Our build system had produced a set of tags which we'd like renamed. I first tried to Edit  the tag from the tags page in GitHub, but upon saving, it responded with a server error. This might be temporary and you can stop reading right now... or it might not be. Second off, I tried to follow this advice from Stack Overflow , but that didn't work out either. What I wound up doing was: Get tag names (I used the GitHub tags listing referenced above) Get commit id from git show tag name Delete old tag with git tag -d tag name Apply the new tag with git tag tag name commit id Delete old tags from origin with git push origin --delete tag name Upload to GitHub with git push --tags Oh, don't forget to let your colleagues know, so they can update their local copy of the repo with git pull --prune --tags

Renaming your git master branch to main

If you've gotten a certain urge to rename your git master branch to something else, here's how to rename it to main : Select branch git checkout master Rename it git branch -m master main Get latest from your repository  git fetch Remove upstream information git branch --unset-upstream Set a new upstream git branch -u origin/main Let HEAD point to your new branch git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main Hope this helps

Let's just ... build something!

Image
A couple of months back, I had a stroke of inspiration and produced a little video on YouTube to guide someone curious about - but new to - development to build and publish an app just to prove to themselves that they could. The basic premise was that  development doesn’t have to be hard and that we need more developers . It might seem hard to get started and here’s where I enter the scene! I’m here to help you build SOMETHING. Then, it’s up to you to play with that something - dig deeper into topics that interest you and propel yourself in the direction you want to go. I recorded the video in one go and then spent hours cutting out the biggest bloopers. In retrospect, listening to some of the comments I've gotten and also judging from my own video consumption, I should've split the video up into bite-sized segments, rather than having my viewers spend a consecutive 50 minutes with me. Looking at the statistics shows me, in fact, that interest seems to wane after less than th

On creativity, coding and reviews

Code reviews are important, however, the beauty of the code produced is skewed - it's more beautiful to the author of the pull request than the reviewer, leaving the creator in a potentially vulnerable state. As an author, to help you reduce any anxiety you might feel about the process, here are some thought experiments you can try: 1)  Perform the code review as a hand over, with the intention of the reviewer to make the code theirs. You've produced something that you want to give to the larger team. 2) You've produced something for some reason. You are now to present that reason and your solution so that - in the end two people have intricate knowledge of the code, instead of just yourself. As a reviewer, remember to be courteous and thanking your team member for their effort, before you ask for improvements. I've also found it useful to ask questions with regards to desired changes - "is it possible to ... "; "how come you've done ... considering .

It's not about Creation, it's about Mutation

When building systems, we've for decades now tried to lump properties together into cohesive bundles. We've created Customer objects, Order objects; arguing that "well - a system must support Customers, right?" Well, yes - and it's easy to get started that way. The issues with the Customer object, to make a concrete point, is that one model cannot possibly encompass all aspects of a real person or a company - a Customer - that we are trying to model. Furthermore, we often want to track people - potential  customers - before they've bought something (which is arguably the definition: once you buy something from someone or enter a contract that promises that you will, you're not really a customer, are you?). This is all to say, that whereas it's easy to create a Customer class early on in a greenfield project to encompass customers, your professional life will be must better spent if you focus on Mutation rather than Creation: Things that Change together

Test database operations with PowerShell

Microsoft SQL Server  comes pre-installed with with the SQLPS PowerShell module. Among its many CmdLets, you will find Invoke-SqlCmd . Using said CmdLet, you can both run queries and invoke scripts against new and existing databases. Let's pretend that you want to set up a database - BananaRama on your local machine. Just  Invoke-SqlCmd -ServerInstance "localhost" -Query "create database BananaRama" Now, ponder that you have a base script that sets up a schema and a table for a given database. What you will find, is that Invoke-SqlCmd supports Variables that can be injected in your script! Invoke-SqlCmd -ServerInstance "localhost" -Database "BananaRama" -InputFile "MyFancyScript.sql" -Variable "SchemaName=Customer1" In your SQL script you use placeholders inside $(DollarParentheses), e.g. $(SchemaName) : CREATE   SCHEMA  [$(SchemaName)] GO SET   ANSI_NULLS   ON GO SET   QUOTED_IDENTIFIER   ON GO CREATE   TABLE  [$(Schema

How to undo a whole range of commits ... and then fix that problem

1) Find the last commit that worked git log --oneline 2) Revert all commits between the one that worked and wherever you've managed to end up now git revert b32b3fe2e~HEAD --no-commit The no-commit parameter allows you to fix your stuff before ...  3) git add your new changes 4) git commit -m "OK, *this* time I'm *pretty* sure it works!" 5) git push