Changing your default branch name in the GitHub frontend

In this tutorial, I want to show you how to rename your master branch in Git, or GitHub specifically, to something other than master. I am going to show you how to do this with the GitHub website as not everyone likes using the command line. If you want to use the command line, then Scott Hanselman has a great tutorial on how to do that.

The idea of renaming the master branch in Git has come about after the recent Black Lives Matters protests in 2020. It is about removing any references to slavery with the terms master used as the default branch name. This tutorial isn’t here to argue whether you agree with this or not. If you don’t agree, then you can stop reading. If you do agree, then this tutorial will show you how to do the rename without using the command line, and it is straightforward to do.

First of all, load up your repository in GitHub, so you are on the main page for that repository. Then click on the ‘Branch: master’ dropdown box. 

Then in the text box type in the name of the new branch you want to use. In my case I called it ‘main’, but you can call it anything you want. When you have typed in a name, click the ‘Create branch: main from master’ button as shown in the screenshot.

Then on your main repository page, you will see you have two active branches (or more branches if you have created feature or release branches). At this point, you have created a new branch called ‘main’ that duplicates the master branch, so it contains the entire commit history, but ‘master’ is still the default branch. 

From your main repository screen, click on the branches tab again. Next to the ‘master’ branch, there is a button that says, ‘Change default branch’. Click this button. 

This will bring up the default branch screen as you can see above. Select the newly created main branch. 

You will receive a warning; if you are happy to proceed then click the ‘I Understand’ button. If you have a build pipeline setup to build your code and run tests automatically, this will be most likely to break at this point. 

Now ‘main’ is the default branch, but the old master branch is still around as a secondary branch, but you can delete it now if you wish. You can do this by hitting the little red trash can icon next to the master branch.

Once you have done that you will only see the new ‘main’ branch. If you don’t have any automatic builds setup with something like GitHub Actions, Travis, Azure Pipelines, or your build system of choice them your new branch is good to go. You need to reclone that branch to your work machine and carry on working. In the example repository I used for this tutorial; I had a Travis build setup.

To remedy the build process, I logged into my Travis dashboard, and I had to click on the ‘More Options’ drop-down menu for a build and select ‘Trigger Build’. 

This brings up the ‘Trigger a custom build’ window. In the branch text box, type in the name of your new branch, in this case, ‘main’, and then select that branch. Then press the ‘Trigger custom build’ button, and this will change the build trigger to look for changes on the main branch. 

And, that’s it. It is a little more convoluted than using the command line, but not everyone likes using the command line, so if that’s the case these instructions should see you through.

A Guide to Successful Remote Working and Working from Home

In a rapidly changing world, a few surprises in your daily flow are expected. Whether you are starting a new position, or your current job is changing scenarios, you might have found yourself as a new work-from-home employee. While it can seem like a dream to wear your pajamas or work from bed at first, things can become unproductive quickly if you’re not properly managing your time. 

Working remotely is more popular now than ever before. Technology has given us the opportunity to take workplaces we never thought possible. Do you want to work in your pajamas from your bed? Do you want to work on the beach while on vacation? Working remotely can make these things possible.

It seems like a dream to have opportunities like this, but in reality, it can become challenging quickly. While working from your pajamas or even on a beach seems luxurious, these are still experiences that you can’t do all the time. These beneficial scenarios can be reserved for sick days or times when you might not have much work, but for the most part, it’s best to stick to a structured schedule. 

For someone who is used to working in an office, or just someone lacking motivation in general, working from home isn’t the dream many believe it to be. 

Whether it’s barking dogs, energetic kids, or even another partner in the house working remotely that has you distracted, there are some saving graces. As a remote working newcomer, you don’t have to be afraid of your life being chaotic the entire time your home doubles as your office. 

Through the actionable advice I go over in this article, you can be not only efficient, but happy as you navigate your new “office.” Everyone is different, and what methods work for you might not for someone else. Go at your own pace and remember the most important thing is that you are getting your work done as needed. 

Dealing with Criticism

For many people, offering up criticism isn’t always pleasurable or appreciated, no matter if it’s from a family member, good friends or a work colleague. Whether it’s taken as constructive or it causes personal turmoil, criticism can be quite difficult to receive and process. The result can often be helpful if that was the intention, or it can be one of those difficult things to accept and forget.

Dealing with Criticism, written by Stephen Haunts

Being criticized at work has been known to have a significant positive or negative impact on employee morale and, in turn, productivity. Whether it’s handed out verbally, in an email, direct messaging systems or even a social media platform, more often than not, the one given the task of providing feedback, often fails to consider how it might be received, especially when it’s unfavorable. 

The goal is usually to improve results at work, without considering the connection between morale and productivity.

Some research has shown that criticism of any kind actually closes down the same brain centers that are otherwise activated when talking about positive things. So, it’s simple to understand how being criticized by a manager or colleague might evoke negative thoughts, embarrassment and humiliation. When a group of employees are put on the defensive and feeling dejected from negative performance reviews, it can be devastating to a company’s bottom line.

Receiving criticism at work, whether it’s called “feedback”, “performance reviews” or “advice”, likely won’t go away. As a cornerstone of corporate culture, more often than not, its how companies get things done. So, if your chances of avoiding criticism at work are slim, it’s in your best interest, as both giver and receiver, to understand what it is and how best to harness its capacity for productive output and positive people.

Practical Techniques to Improve Your Self-Motivation

Lack of motivation is something most everyone has experienced at some time in their lives. We can often jump into action if we are prompted by someone else, but when it comes to self-motivation, we must be both the motivator and the motivatee. 

Practical techniques to improve your self-motivation by Stephen Haunts

This isn’t always easy, as we can be prone to procrastination and, let’s face it, laziness. True, we can be too lazy to do something we need to do. It’s so much easier to ask someone else or convince ourselves that it’s not worth the effort to perform a specific task or go to a particular place. 

I should write a book, but I doubt anyone would read it. 

I’d love to become an teacher, but going back to college… no way. 

The boss wants me to represent him at the award ceremony tonight, but I’d probably say or do something stupid.

I’m too tired to go to the gym today. Maybe tomorrow. 

Demotivators are continually looking for an excuse to avoid doing what they need to do to succeed, to reach their goals, or to simply do something or go somewhere. As shown in the above examples, there can be varying reasons for a lack of motivation. Whether it’s a headache or other physical ailment, a lack of self-confidence, or a lack of desire, you’ve probably been guilty of at least one instance of demotivation. 

We all have. And that’s why this article was written. We’ll explore some tips and techniques that will help you to get up and go, do the unthinkable, and conquer the world. 

Okay, so maybe you won’t conquer the world, but you can conquer your world. So, let’s get started!

Detecting Profanity in Users Input

Since writing this post, I have had many great feature suggestions for the Profanity Detector. I have implemented all the suggestions I have received and written another blog post about it. You can read the 2nd post here.

On several projects that I have worked on, we have had a requirement to detect profanity in users input. This includes things like general swear words, sexual acts, racial slurs, and sexist slurs, etc. Over the years, I have built a pretty comprehensive list of these profanities used for the detection process. The list has been built from combining lists I found on the internet. The lists are allegedly used by a lot of the large social networks in their profanity detection; although I can’t verify that.

Profanity detector on GitHub by Stephen Haunts

My profanity detector is on GitHub, and released under an MIT license, so it is free for anyone to use and modify. The main list of profanities can be found in the ProfanityList.cs file. If you are easily offended and a bit sensitive to language then I recommend you DO NOT open that file. It contains some pretty gross language, but to detect the language, you need to be able to define it.

Self-Motivation and the Locus of Control

Motivation is not an easy topic for most people. In this day and age, procrastination runs rampant on the streets of society. We are raised to believe that the most natural path is the one that we should take and that we should use whatever means necessary to get the job done the quickest. However, what happened to the right way of doing things? What happened to our self-motivation? 

It is all too easy to get caught up in the fast-paced lifestyle that we live in today, and we often forget to ask ourselves the most straightforward questions. Why are we here? What are we doing with our lives? Are we enjoying the path that we are currently on?

I want to help guide you toward those answers, but to do so I need you to tap into what is known as your “Locus of Control.” Your locus of control is merely defined as 

“the capacity to which you believe you have complete control and power over what happens to you in your life.”

In layman’s terms, do you think that you have much, if any, effect on what happens in your life?

Julian Rotter is the psychologist who first came up with the term as he believed that a person’s locus of control varied by the individual. As Rotter hypothesized in his theory, the locus of control could occur on either an external spectrum or an internal one, and each person fell somewhere on that spectrum. Depending on where you find yourself on this spectrum of locus of control, your behaviors to your external environment will differ.

Applied Cryptography in .NET and Azure Key Vault from Apress Now Available.

After a year of writing, reviewing and editing, I am pleased to announce that my first book for a traditional publisher, Applied Cryptography in .NET and Azure Key Vault has now been released. It has been an exciting journey writing for APress, and the experience was excellent. You sometimes hear bad stories of working with traditional publishers, but I am glad to say this wasn’t the case for me.

Applied Cryptography in .NET and Azure KeyVault

The journey for me started at NDC Oslo in 2017 where I was introduced an acquisition editor for APress. We got talking, and I suggested an idea for a book which I then formally pitched. After the pitch was accepted, I then signed the contract and agreed on a schedule for the first three chapters. To get a good start on the book, I decided to take a little writing holiday to Whitby where I could lock myself away near beautiful surroundings and make a start on drafting the first three chapters. I have always liked the idea of going on a short holiday to write, so this was helping to realize a small dream. I locked myself away for four days and managed to write the first draft for these chapters, and I was then joined by my wife and kids to spend a long weekend in Whitby. I submitted the three chapters to APress and waiting for them to be approved. Thankfully they were, and we agreed on a schedule to write the rest of the book.

I spent the majority of 2018 drafting the rest of the book and finished the first draft towards the end of October. If I was to work on the book full time, I really could have written it in two to three months, but because I have no idea how well the book will sell, or how much I can make from it, I decided to spread the work out while continuing to write courses for Pluralsight.

Once the first draft had been completed, the book was peer-reviewed; which involved an independent developer reading the book and checking it was accurate, made sense and the examples work. As each chapter was reviewed, I had to address any comments or concerns. I thought this part of the process would be difficult, but luckily I didn’t have to change much. Once peer review had finished the book went to be copy edited. At this point, I asked my friend Troy Hunt to write the foreward where he discusses data breaches. The book was officially finished at the end of January where it was then typeset and sent for printing.

Although I have self-published a lot of books, it has always been a dream to write a book for a traditional publisher, and now that dream has been realized. I have been asked several times if I will write another book like this. At the moment, I am not sure. I enjoyed the process, but I need to see how this book performs first. If it does well, then hopefully I can extend the book into a second edition. As for a new book, I have a few ideas, but I will wait until later in the year to decide.

The book is available from most online book retailers as well as traditional bookshops.

Apress.com

Amazon.com

Amazon.co.uk

Barnes and Nobel

Waterstones

Foyles

Ultra Small Mobile Writing Rig

For my job, I tend to travel a lot to conferences. When I am away I like to get as much work done as I can, but sometimes it isn’t really appropriate to get my laptop out, for example on a smaller airplane, train or in a restaurant; but in those times I like to get some work done like answering emails or drafting blog posts. To make these times more efficient, I have developed my little wiring rig that uses my phone, a copy of the Ulysses Writing App and the excellent Microsoft Universal Folding Keyboard which allows me to be productive, yet more discreet or in smaller spaces when traveling.

Mobile Writing Rig using the Ulysses Writing App and the Microsoft Universal Folding Keyboard.

The keyboard itself is very thin, even when folded which means it takes up hardly any space when packed in my laptop bag. It’s not the best typing experience as it takes a little getting used too, but it is indeed very workable. You can pair the keyboard with Windows, Android and Apple IOS devices which gives you a lot of flexibility. I pair it with an iPhone and an iPad. I don’t usually take the Apple Keyboard with me for the iPad when I travel as it makes the device quite thick in my bag, so I think this is a better solution for occasional typing; this setup has helped me remain productive when using a laptop isn’t easy to do.

April 2018 Update Video

I admit I have been a little lazy in producing videos since the new year, but I am back producing them. Here is a quick update on what I have been doing over the last few months. This includes my new course, Blockchain – Principles and Practices and 2 new books, A Gentle Introduction to Agile and Lean Software Development and A Gentle Introduction to Beating Procrastination and Getting Focused.

New Pluralsight Course : Blockchain – Principles and Practices

My latest Pluralsight course, Blockchain – Principles and Practices is available now.

The introduction of blockchain based technologies has been one of the most significant developments in computing in recent years. We now have access to public blockchains and cryptocurrencies with systems like Blockchain and Ethereum, and also private blockchains that can be used by more regulated consortiums of companies. As with any technology, it is important for developers and architects to have a good grasp of the underlying principles of these technologies, even if they are going to use a 3rd party toolset.

Blockchain - Principles and Practices by Stephen Haunts at Pluralsight
Blockchain – Principles and Practices by Stephen Haunts at Pluralsight

In my latest Pluralsight source, Blockchain – Principles and Practices, I take you under the covers of this fascinating technology and show you how it works at a data structure and algorithm level. As well as explaining the principles I also build up a working blockchain sample written in C# and .NET Core to help illustrate the principles in something that you can play with and debug. If you want to understand how this technology works, then this is the course for you.

Here is the course description:

Blockchains are probably one of the most highly talked about technologies at the moment as they provide a way to attain digital trust on the Internet. There is so much emphasis on the technology that companies are very keen to learn about Blockchains and adopt them. Venture capitalists are currently diverting a lot of investments into funding Blockchain-based companies.

In this course, Blockchain – Principles and Practices, you will explore the fundamental data structures and algorithms used to build a typical Blockchain and build up a working example over the course. First, you will learn how to store single transactions in a block. Second, you will discover how to store multiple transactions in a block using Merkle trees. Next, you will be taught how to make the Blockchain tamper-proof using mining and proof-of-work. Finally, you will learn how nodes on a Blockchain maintain consensus.

By the end of this course, you will have the knowledge and tools necessary to build your own Blockchain.

 

%d bloggers like this: