Categories
Uncategorized

Why you should blog as a software developer

Reason #1: For the money

There are many websites available with answers to various questions, Stackoverflow is a great example of that. However, you will be amazed to see how much traffic and how helpful a detailed blog post can be.

This blog with only 4000 views per month makes around 20 EUR per month. Not much but it more than pays for the hosting.

Reason #2: Helps to better learn a topic

When you write down a technical blog post, the act of thinking about every little detail and having to write it down forces you to be accurate. By doing this you will be able to discover your blind spots and reinforce your knowledge about the topic that you are writing. This is a tool that is useful if you are a manager too. If you want to make sure an employee has really mastered a specific topic, you can ask him to draft documentation around that topic.

Reason #3: Note taking

I would argue it is better than note taking. There are many note application nowadays which come inbuilt with every operating system and many apps. Personally I switch between PC and Mac, and having a central knowledge base helps me to keep information about technical hurdles that I have previously conquered but have now forgotten. For example I keep coming to my How To: Python Sort Custom Comparator every time I have to write code to compare a custom object.

Reason #4: It is a way to express yourself

It is a way to express and can be done privately if you want to. Privately does not mean without any views. You can still submit your website to Google or Bing and have them index your blog. You will be astonished at the queries search for.

Reason #5: It is catharthic

Blogging can provide psychological relief. You will find that sometimes writing about your painful experiences can be relaxing. It has other psychological benefits as well, it can better help you understand your emotions too, just like software.

Reason #6: For your resume

When you blog, you have something to show recruiters or potential customers. You can show that you have a good understand of a particular subject or if you are looking for a technical writer position then this would serve as a portfolio

Reason #7: To get customers for your product

If you have a product then you should definitely have a blog page. VEED.io recently in a talk showed that they got the majority of their customers by writing blog posts around keywords that customers are searching on Google. They make more than 6 million annual revenue using this method. There is a video online on the microconf Youtube channel that you should search for if you are interested.

Conclusion

There are probably many more reasons to blog but these are the ones that came to mind so far. I will update them if I can think of any new one but if you have any other reasons feel free to comment below 😉

Categories
Development

How to fix Local source of nuget packages doesn’t exist

The quick fix if you do not mind using a new nuget source locally will be to run the following command:

 dotnet new nugetconfig

After that you should get the following output:

Getting ready...
The template "NuGet Config" was created successfully.

Where are my nuget source folders?

The source folders serve as cache. In order to list the folder you can use the following command:

 dotnet nuget locals all -l

If you run only “dotnet nuget locals” you will find more information that can be listed.

Hope that this has unblocked you 🙂

Categories
Uncategorized

PCR test for travel in Mauritius same day at Biosante

I recently had to travel to Europe and needed a PCR test done. Not for the covid restriction rules but because the airline that I was travelling through could ask for it.

I found out about that two days before my travel during checkin so I was a bit worried about the time it takes to do a PCR test and get the results back.

I looked online but to be frank in Mauritius you don’t find much online (not details at least). So I went to a Biosante branch near me.

How long to get PCR Test results?

I was pleasantly surprised there. Biosante gives you results the same day. For me I had done a PCR test at 7 am and I already had the results at 3 pm the same day. Which I think is amazing!

They will also take down your phone number and email address to notify you when the results are ready and also send you the results in PDF to your email.

What does the PCR Test result look like?

I have hidden the personal information part and cropped the bottom part of the image. But the important part here is the type of test done on the left and on the right the results showing that the test results were negative.

Where to do the PCR tests?

As you can see, they are all around the island. This is also explained by the fact that they have been here since 1993 and are the first Medical Laboratory in Mauritius to be accredited with ISO 15189 Certification.

How much does it to do the PCR Test?

At the time of writing which is August 2022 I had to pay 1500 MUR to do the test. This translates roughly to 32 EUR. If you have medical travel insurance you should be able to recover it, I think (I have not tried but if you tried let me know in the comments).

Does it hurt to do the PCR Test?

I can’t say this surely for everyone because everyone has a different type of body but in my case the test carried out was painless. The practitioner made sure to calm me down and was gentle through the procedure. So I will have to recommend going to Biosante to do your tests. The fact that they have been operating for 30 years also means that they have really well trained staff and are professionals.

Anyway I hope that you get your PCR Test on time and wish you safe travel.

Categories
Development

An example of how a DOS security vulnerability can be ignored for a long time: Newtonsoft.Json

I recently discovered that the Newtonsoft library in .NET had a vulnerability where you could cause an application to terminate with stackoverflow by potentially passing a really (really) nested JSON object to it.

Kudos to the team at HCL https://alephsecurity.com/vulns/aleph-2018004 for discovering it.

The thing is actually I am writing this in 2022, Newtonsoft patched it by applying a default max depth (max nested) of 64 in September 2021 but the bug was actually disclosed in 2018.

Newtonsoft.json is used by millions of .NET and it just amazed me it took so long to patch this officially. Anyways that’s a small blog post on my amazement. If you have not upgraded yet then do it and if you don’t want to upgrade, add a max depth check if your code.

Categories
Investing

What is the catch in Flexible Savings on Binance?

This articles covers two points that, although are listed in the documentation on Binance, might not be clear for common users like me.

UPDATE 22/02/2023: You cannot use BUSD anymore so replace this with any other stable coin.

At first glance, I was really excited about the Flexible Savings Plan on Binance. A 10% APY i.e. Annual Percentage Yield on BUSD. This was by far more than what the local banks were offering in Savings Account (2% in my country at that time).

Annual Percentage Yield Is Tier-ed

Update 26/09/2022 APR has changed to 8%

BUSD Savings APY Screenshot 14/05/2022

Let’s take BUSD as an example. If you have set 1000 BUSD in your savings, after 1 year you will have 10% interest on the FIRST 500 BUSD and then only 1.5% interest on the rest of the 500 BUSD. If you don’t read it carefully after one year you could have expected this to be 11.5% on the 1000 BUSD which is not the case here.

This means at the end of the year your 1000 BUSD will be 1057.5 BUSD only.

Price Drop In Crypto

Once you have converted your money let’s say USD to BTC. Your money and savings will be in BTC. This means that if BTC’s price drops, although your savings will be increasing, you might make a loss when you convert it back to USD (don’t forget withdrawal fees 15 USD SWIFT for me). This is why I try to use BUSD as much as possible.

The lesson here is to always carefully read all information and understanding the products that you are investing your hard earned money in. There is rarely a free lunch.

Categories
Development

Why Am I Getting The namespace or module is not defined in F#?

The order in which the files in your project’s fsproj file are listed is important here. You have to set the exact order required under ItemGroup in the fsproj file. For example:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <WarnOn>3390;$(WarnOn)</WarnOn>
    </PropertyGroup>

    <ItemGroup>
        <Compile Include="A.fs" />
        <Compile Include="B.fs" />
        <Compile Include="Program.fs" />
    </ItemGroup>
</Project>

Modules defined in B.fs are not going to be open-able in A.fs.

Categories
Development Uncategorized

How To Fix: A function labeled with the ‘EntryPointAttribute’ attribute must be the last declaration in the last file in the compilation sequence.

This error is thrown likely because the file that has the EntryPoint (could be Program.cs) is not listed at the end of ItemGroup in the project’s .fsproj file. When you open it you might find something as follows:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <WarnOn>3390;$(WarnOn)</WarnOn>
    </PropertyGroup>

    <ItemGroup>
	<Compile Include="Program.fs" />
	<Compile Include="SomeOtherFile.fs" />     
    </ItemGroup>

</Project>

The compile sequence is taken from the ItemGroup elements in the .fsproj file. Notice that Program.fs is not the last one, SomeOtherFile.fs is.

The “fix” is to put Program.fs (or whichever file contains your EntryPoint) to the last position as follows:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net5.0</TargetFramework>
        <WarnOn>3390;$(WarnOn)</WarnOn>
    </PropertyGroup>

    <ItemGroup>
	<Compile Include="SomeOtherFile.fs" />    
        <Compile Include="Program.fs" /> 
    </ItemGroup>
</Project>

Hopefully this has fixed your issue and unblocked you. I encountered this error in Rider and you can’t “fix” it from there, you will have to go to the folder where your project is, manually edit the .fsproj file and then restart Rider for the error to fully disappear.

Categories
Development

How To Make An Application Run Forever in F# Without Infinite Loop?

This is an example of how to run asynchronous tasks, wait for all tasks to complete and then exit the process. There are many ways to achieve this but the snippet below is my personal favourite.

open System
open System.Diagnostics
open System.Collections.Generic
open System.Threading.Tasks

[<EntryPoint>]
let main argv =
    let r = Random()
    let makeTask id =
        task {
            let wait = 1000 + (r.Next(5) * 1000)
            do! Async.Sleep wait
            printfn $"Task {id} executed in {wait}s." 
        }
    let tasks = List<Task>()
    for i in 1 .. 10 do
        tasks.Add(makeTask(i))
    Task.WhenAll(tasks.ToArray()).ContinueWith(fun _ -> Process.GetCurrentProcess().Kill()) |> ignore
    Process.GetCurrentProcess().WaitForExit()
    0

Let’s go through the code line by line.

The open code loads libraries from C#.

We will need System.Diagnostics to access the process itself. If we removed everything and kept only:

Process.GetCurrentProcess().WaitForExit()

the process would run forever and still not exit.

Next we are defining an asynchronous Task. This is the new way of doing asynchronous available as from F# 6. Inside the task we are waiting for a random amount time and then printing that the task has executed in a number of seconds.

Next we are creating a List type taken from c# open System.Collections.Generic. This is a mutable list in which we will add 10 Tasks to, each with an identifier i.

We then use Task.WhenAll(tasks.ToArray()) to run all the tasks in list in parallel. Using the .ContinueWith we can chain to execute another task at the end of the execution of all the 10 Tasks.

Finally, we tell the process to Kill itself after executing the 10 Tasks. This is one way of keeping an application running without an infinite for loop.

I have to put a disclaimer here that I am still learning F# and there might be better ways to achieve this.

Categories
Gaming

How To Fix frame rate unsuitable for online play in Elden Ring PC

1. Disable Online Play

Close the game and in the main menu go to the Systems option. Then go to the 4th Option you should see Launch Settings like the screenshot below. Then set the Launch Settings to Play Offline.

2. Reduce Elden Ring Settings

Go to the right most option which will show you Graphics option. Set Quality to low, then go to advanced settings and set Antialiasing as well to Low (This does not get automatically set to Low).

Back to the graphics tab lower the resolution as well. As an example check the screenshot below:

3. NVIDIA Control Panel Settings

Open the Nvidia Control Panel or equivalent AMD control panel. This should look something like the screenshot below.

Go to the Manage 3D Settings tab. Now do the following:

  1. Set the Preferred Graphics Processor to always use your Nvidia processor
  2. Go through the list and disable all options. Except Shader cache if you have SSD and space.

You could also update your driver once Nvidia has released Elden Ring related updates. May be, even an additional step to disconnect any additional displays that you might have.

4. View Minimum Settings

If the above has not worked be sure to crosscheck the minimum requirements at https://store.steampowered.com/app/1245620/ELDEN_RING/

. Although given this game came out on PS4 the requirements shouldn’t be that high.

The above worked for me so I hope it works for you as well!

Categories
Gaming

How to change toggle aim in apex legends PC

From the Lobby click on the bottom right gear as shown below:

After you click on the Gear/Game Menu you can then click on Settings to go to the Settings page:

Changing Toggle Aim For MNK

If you are on Mouse and Keyboard you need to go to the Mouse and Keyboard tab, scroll down and look for Aim Down Sight (Hold) then set a button or overwrite it with right mouse click. Something you can only do on PC is to set the Toggle and Hold buttons to two separate keys. This can’t be done on Controller.

Changing Toggle Aim For Controller

For this one you need to go the Controller tab. Then look for Aim Button then set it as Toggle or Hold:

We have other articles on Apex Legends, if you are getting started we would recommend you to check: How To Get Better At Apex Legends