30/11/2024

Using Codestral in VS Code - Part 1

This is a part of the series of article where I explain how I learning AI code assistance in VS Code.

You can read the first article here. It explains how you connect Codestral to VS Code.

Ok, now we have connected Codestral to VS Code, lets see how we can use it to assist my coding. In this part I'm going to ask Codestral to write a whole program for me and probably small edit. To simplicity I'm going to use .Net Core console application and ask Codestral to create a snake game in C#.

Get project created

First let's get project created for our game in VS Code. Open a folder and create a new folder called "SnakeGageCodestral" (or any preferred name).

Then open the terminal in VS Code and create console project by running following command:

dotnet new console

That will create the basic structure with Program.cs file in it.


Open the Program.cs and clear any code in it.


Get AI Assistance

Open "Continue" extension. Select your AI modal (in this case we are using Codestral) and ask the question from AI.

You can use a prompt like this: Can you create a snake game in .Net Core console project in C sharp?



Codestral will be more helpful than you think and will also include steps to create project also, but we are intrested in code section. Choose that section (step 4 in below example) and apply it.


This will get updated in Program.cs file.
Check for any obvious compile time errors and if there are you can get assistance from AI by just putting the error message in chat box.

Mine was ok and next step is to run it. Use following command on VS Code terminal.

dotnet run

Mine worked ok.



Editing using AI

Though it worked first time. Snake was running too fast. I wanted to slow it down. So I asked AI assistance to make a edit. It has suggested the line that I should edit as per screen shot below.


That's it. We will have look at more features later.

17/11/2024

Installing PowerShell on Windows

PowerShell is powerful command line interface for windows PCs and servers, it does get installed by default when you install windows on a PC or server. However, if you want the most up to date version of PowerShell, it is up to you to install it manually. 

Following article is based on Windows 10 PC so some version numbers might be different on different version of Windows.

The PowerShell version you get when you install Windows is called "Desktop Edition". You can see this by running $PSVersionTable command on PowerShell:

As you can see version of this edition of PowerShell is 5.1.xxx.

But there is another Edition written on .Net Core and it is currently on 7.4.xx.


This version is much more sophisticated and have ability to integrate with more modern development environments. There fore if you are a software developer or person who manage modern tools/software, I recommend using this edition of PowerShell.

So let's see how we can install this edition.

Microsoft has comprehensive article on how to install PowerShell in here. Following is simplified version of it.

There are few ways to install PowerShell.

  1. Using Winget
  2. Using MSI package
  3. Using .NET Global Tool
  4. Using Microsoft Store

Using Winget

If you not already aware, winget is the Windows Package Manager. You can run following command on command line (or even default edition of PowerShell) to install via winget:

winget install --id Microsoft.PowerShell --source winget


Using MSI package

This is more traditional way of installing. You will have to manually download it and install it.

Following is the link to the current version of the MSI package -> MSI

This will download the MSI package from GitHub and you will need to save it and run it (note above is x64 version, if you need different version please search for it).

MSI package does give more control over the installation. You can specify various options while installing it. For more information please refer to the original Microsoft article mentioned above.


Using .NET Global Tool

If you have .NET Core SDK already installed on your computer, you can install PowerShell as .NET Global Tool (can invoke from any directory).

Just run following command on command line:

dotnet tool install --global PowerShell


Using Microsoft Store

Like any other application on Microsoft store, PowerShell can be installed from Microsoft Store.









Introduction to SQL Server Statistics - Tutorial

Wishing you all, my loving readers, Happy New Year 2025! This is the first blog for the year 2025. As a new initiative, I'm going to (tr...