While watching one of the Microsoft Build 2021 sessions, I ran into the following error message while trying to clone a project from Github using the git clone command line on my Mac. The entire error message is below:
Thankfully, the fix for this is pretty straightforward, install the Xcode toolkit! I had done this before, but for some reason, I had to do it again, and only after doing this, my git commands started to work while executing them in the terminal.
To install the Xcode toolkit, use the following command in your Mac OS terminal:
If that doesn’t work, try the following:
sudo xcode-select --install
And if that also doesn’t work, you can try the following next:
You need to update one or more columns in a table with millions of records with data from another table, what’s a good way of going this with low risk and in an optimized way? One of my favorite ways of dealing with millions of records in a table is processing inserts, deletes, or updates in batches.
Updating data in batches of 10,000 records at a time and using a transaction is a simple and efficient way of performing updates on millions of records. The key is to batch out your data to allow you to process a smaller number of records at a time.
DECLARE @batchId INT
DECLARE @batchSize INT
DECLARE @results INT
SET @results = 1
SET @batchSize = 10000
SET @batchId = 0
-- when 0 rows returned, exit the loop
WHILE (@results > 0)
UPDATE Table1 SET columnA = Table2.columnA
INNER JOIN Table1 ON Table2.Id = Table1.Id
WHERE Table1.columnA is null
AND (Table2.Id > @batchId
AND Table2.Id <= @batchId + @batchSize)
SET @results = @@ROWCOUNT
-- next batch
SET @batchId = @batchId + @batchSize
-- the sql below is just to measure the performance of this update, it is not needed to update your data.
DECLARE @startTime DATETIME
SELECT @startTime = GETDATE()
SET STATISTICS PROFILE ON
FROM Table1 first OPTION (RECOMPILE)
SET STATISTICS PROFILE OFF
SELECT 'It took ' + CONVERT(VARCHAR(8), DATEDIFF(ms, @startTime, GETDATE())) + ' ms'
In the query above we declare the following variables to do the batching:
@results – this variable will hold the number of records updated; when zero, the query will stop. This is to avoid an infinite loop.
@batchId – this is set to zero initially, and it is used to compare the table id against it, and after each update, it is set to the id plus the batch size. This allows splitting the millions of records into batches.
@batchSize – the number of records to update at a time.
It is important to know that the above algorithm will only work when your table’s primary keys are of type int. If your table’s primary keys are guids, the above will not work.
The section at the end of the query is only used to review the performance of your updates, it is not necessary to update the data and it is a nice way to see how the query performs overall.
I hope the information in this post is helpful, and it helps you learn a simple way to update millions of records in batches, making it easier and lower risk than attempting to do it all at once.
Software development is hard, and it isn’t always the programming language or the framework you use, it’s the people who work on it.
People are an essential part of a team; everything can be easily changed and fixed, but to achieve effective communication and a great culture, you need to make sure people work well together. In my software development career of over 20 years, the critical difference between successful software projects and failed ones has been the way engineering teams are created and how they are allowed to function overtime.
excellent tool for writing software, and when you install the right extensions, it can be very powerful. However, if these extensions and VS Code isn’t set up correctly, many of its features or extensions might not work the way you expect them to work.
Below is a list of settings that I use as my base when setting up VS Code for any type of web development. You can also get them from the gist located here:
The way to get to the setting in VS Code is by typing Ctrl-Shift P and then type “settings”. A settings.json file will open and this is where you can remove all existing settings and paste the settings below.
Below are my must-have extensions for anyone doing web development. There are many more magnificent extensions, but I feel like the following are not only useful but required to augment your web development experience with VS Code.
Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.
To ensure that this extension is used over other extensions you may have installed, be sure to set it as the default formatter in your VS Code settings. This setting can be set for all languages or by a specific language.
A Visual Studio Code extension that provides CSS class name completion for the HTML class attribute based on the definitions found in your workspace or external files referenced through the link element.
That’s all, folks! I invite you to try other extensions, but make sure not to clutter your VS Code experience by installing extensions you might not need or use.
Also, remember to adjust your VS Code settings to make sure you get the most productivity and the best experience when using VS Code and these extensions.
If you know of any other VS Code extensions for web development, please feel free to share them in the comments below. Cheers.