Microsoft.Extensions.AI

Microsoft.Extensions.AI

November 14, 2024

With .NET 9.0, a new set of abstractions has been introduced to simplify integrating AI into applications: `Microsoft.Extensions.AI`. This package offers a consistent programming model by wrapping various AI providers (such as OpenAI, Azure OpenAI, and Ollama), allowing .NET developers to work seamlessly with different models.

Sirwan Afifi Sirwan Afifi
Read more
Local AI Models in Browsers (Chrome Canary)

Browsers and operating systems are increasingly expected to have access to language models. This could really boost productivity, making tasks like translation and summarisation a lot easier.

Sirwan Afifi Sirwan Afifi
Read more
My Approach to Problem Solving - Blazor Version

Here's how I tackle my programming tasks using Test Driven Development (TDD). I first try to understand the problem and then break it down into smaller tasks. TDD helps me do this effectively. I don't use TDD just to write tests; it's a way to manage and solve problems step by step.

Sirwan Afifi Sirwan Afifi
Read more
Azure API Management

Azure API Management

April 17, 2024

I have been playing around with Azure API Management lately and really like it. It's a great way to manage your APIs, essentially serving as an API Gateway to handle incoming API calls and route them to various backend services. The backend service could be any HTTP API, WebSocket, GraphQL, Azure Function, Azure App Services, etc.

Sirwan Afifi Sirwan Afifi
Read more
Redis RESP

Redis RESP

April 17, 2024

RESP (REdis Serialization Protocol) is a binary protocol that Redis uses to communicate with clients. It is a simple protocol that is easy to implement in any programming language. This means that we can communicate with Redis over a socket connection. For instance, here is a naive implementation in C# that sends a command to Redis and reads the response:

Sirwan Afifi Sirwan Afifi
Read more
Securing Next.js Apps Using Microsoft Identity Platform

In a previous article, I explained how to secure a Blazor application using the Microsoft Identity Platform. In this article, I will demonstrate how to secure a Next.js application. The process is almost identical in terms of the steps required on the Azure portal; however, the implementation differs.

Sirwan Afifi Sirwan Afifi
Read more
Securing Blazor 8.x Web Apps Using Microsoft Identity Platform

Implementing authentication and authorisation is always a bit of a headache. There's always those edge cases you forget about when doing it yourself. It's smarter to let a third-party service handle Identity and Access Management stuff. Azure's got you covered with Microsoft Entra ID (you might know it as Azure AD).

Sirwan Afifi Sirwan Afifi
Read more
Beyond Titles, Embracing Data Analysis in Every Tech Role

I use LLMs daily for a wide range of activities, including personal and work projects, as well as for my blog. They help me automate tasks, analyse data, and make decisions, thereby simplifying my life and enhancing work efficiency. Last week, my boss requested a report on our current status, including areas where we are investing more time and money. I had already developed a system to send daily log reports to his email following each stand-up meeting with my team. However...

Sirwan Afifi Sirwan Afifi
Read more
A Weekend with Swift

A Weekend with Swift

February 17, 2024

Every Friday night I try to do something to get my dopamine flowing to start my weekend. Programming is one of the things that does the work for me and increases my dopamine level so much that if I start focusing on something, nothing can distract me. I can keep going for hours after hours without feeling tired, which sometimes isn't good. We should definitely pay attention to our health and get out of the building to connect with real people instead of just sitting in front of the computer coding...

Sirwan Afifi Sirwan Afifi
Read more
Programmers and LLMs

Programmers and LLMs

February 1, 2024

If you're a programmer like me, you might also like making things easier by [automating stuff](https://automatetheboringstuff.com/). This isn't about being lazy; it's about being efficient. For instance, when I'm shopping at [Tesco](https://www.tesco.com/), which is my go-to supermarket in the UK because it's cheaper and right next to my house, I always think about how I can speed up the shopping process. Usually, I rely on a shopping list, but it's time-consuming, especially because I need to carefully check nutrition labels, and what I buy varies depending on things like gym days or cheat meal days.

Sirwan Afifi Sirwan Afifi
Read more
Migrating to Astro

Migrating to Astro

January 5, 2024

Astro is a new kind of static site builder that delivers lightning-fast performance by bringing together the best of modern build tools like React and GraphQL, and serverless deployment with Vercel. In this post, we'll walk through how to migrate an existing MDX blog to Astro.

Sirwan Afifi Sirwan Afifi
Read more
A Quick Note

A Quick Note

September 8, 2023

My colleague was assigned a task in which he had to set up open-source software on one of our servers. The process was a bit tricky, making the installation challenging, so he was somewhat disappointed to not finish his task. This is one of those moments when you want to fix a problem, but so many things happe

Sirwan Afifi Sirwan Afifi
Read more
iPhone

iPhone

April 4, 2023

On April 30, 2023, I was out with my friend, and we were traveling back home from London Waterloo to Guildford. We had to wait a couple of hours for the train to Guildford, so we decided to pass the time by traveling back and forth from Waterloo to the Northern line. While on the tube, both of us fell asleep, and my phone was on my lap...

Sirwan Afifi Sirwan Afifi
Read more
Visualising Your IoT Data

Visualising Your IoT Data

March 18, 2023

Recently, I've learned a lot about the Internet of Things (IoT) and I just gotta share some of the cool stuff I've found. I'm using the ESP32 module to gather data from a temperature sensor and humidity sensor. I've used the Arduino IDE before, ..

Sirwan Afifi Sirwan Afifi
Read more
Different ways of adding your signature on a PDF

My coworker wrote some Python code to add a signature on PDFs. Since Python isn't my thing, I wrote the same code in a few of my favorite languages. Probably because I haven't used Python in production or because of its wired syntax (Maybe I only like curly-brace languages). Anyway, here's the Python code I mentioned:

Sirwan Afifi Sirwan Afifi
Read more
Blazor Meetup

Blazor Meetup

May 6, 2022

On May 4, 2022, I attended a meetup at one of Microsoft's campuses in Reading. This was my first time at a meetup like this. It was about Blazor on .NET 6 presented by Steve Sanderson. I was already familiar with him from his previous work Knockout, which was/is an MVVM framework designed for the web. These days, I mostly build web applications using Node.js/React. In addition, I have been looking at Blazor...

Sirwan Afifi Sirwan Afifi
Read more
Using Mirage With Vite

Using Mirage With Vite

July 26, 2021

Recently, I have been using Vite and liked it quite a bit. It's an extremely fast build tool, If you haven't checked it out, you should definitely do so. Although it was developed by Evan You, it can be used for React, Svelte, and more...

Sirwan Afifi Sirwan Afifi
Read more
Web Server Logs

Web Server Logs

July 21, 2021

An important part of managing software applications effectively is keeping logs, because they provide information about the server's performance and activity and can indicate any issues. An application's behavior has to be analyzed in order to track events and debug any issues...

Sirwan Afifi Sirwan Afifi
Read more
OS Notification

OS Notification

May 20, 2021

I recently tweeted something about a little script I had put together to automate one of the tasks I had always struggle with. I thought it would be a good idea to share the process in a little bit more detail:

Sirwan Afifi Sirwan Afifi
Read more
Getting Started With Sequelize

Sequelize is an Object Relational Mapper (ORM) which enables us to query and manipulate data stored in a relational database. There are several ORM for Node.js out there...

Sirwan Afifi Sirwan Afifi
Read more
WebSocket and React

WebSocket and React

March 8, 2020

WebSocket is a communication protocol. It's bidirectional in nature which means that either client or server can send data at any time. With WebSocket, we can build applications such as multiplayer games, ...

Sirwan Afifi Sirwan Afifi
Read more
Displaying Secured Images

Displaying Secured Images

January 25, 2020

Ran into an interesting problem this week with displaying secured images on the page. The problem is that `img` tag doesn't show the image if the resource is secured with a token or a username/password...

Sirwan Afifi Sirwan Afifi
Read more
MobX with React and TypeScript

MobX is one of the popular state management libraries. One of the great things about MobX is that we can store state in a simple data structure and allow the library to take care of keeping everything up to date.

Sirwan Afifi Sirwan Afifi
Read more
Server-Sent Events and React

Server-Sent Events and React

December 15, 2019

Server Sents Events are realtime events sent from the server to the client. It's a way to subscribe to a data stream sent by a server. Basically, it is a long-running HTTP connection with a particular mime type.

Sirwan Afifi Sirwan Afifi
Read more
Passing custom HTTP Header via Apollo Client

Today I wanted to send along an array as a parameter with all queries from client to server. But I wanted to find a quick way to accomplish the task as changing all queries took a tremendous amount of time. One thing that came to my mind was making use of ...

Sirwan Afifi Sirwan Afifi
Read more
Redux

Redux

November 5, 2019

Redux is a predictable state container for JavaScript apps.

Sirwan Afifi Sirwan Afifi
Read more
Flux

Flux

October 27, 2019

A design pattern developed at Facebook to keep data flowing in one direction (unidirectional data flow)

Sirwan Afifi Sirwan Afifi
Read more
Building Ionic React App

Building Ionic React App

October 22, 2019

Ionic is a cross-platform mobile app development framework built on top of Angular. It allows you to build mobile apps using web technologies like HTML, CSS, and JavaScript...

Sirwan Afifi Sirwan Afifi
Read more
Testing React Components

Testing React Components

October 3, 2019

Testing React components is a crucial part of the development process. It helps us to make sure that our components are working as expected.

Sirwan Afifi Sirwan Afifi
Read more
Higher-Order Components

Higher-Order Components

September 23, 2019

Higher-Order Components are a great way to share common functionality between components without repeating code.

Sirwan Afifi Sirwan Afifi
Read more
Importing JSON files into SQL Server

I was assigned to a task to import a GeoJSON file into a SQL Server database. The file was pretty big; I couldn't even open the file in an editor. At first, I wanted to write a simple program (with C# or Python) to open the file and then loop through the entries, ...

Sirwan Afifi Sirwan Afifi
Read more
Migrating To Gatsby

Migrating To Gatsby

July 23, 2019

I've been playing around with Gatsby, and so far I'm quite happy. It's basically a framework based on React and GraphQL that makes it easy to create both website and web applications.

Sirwan Afifi Sirwan Afifi
Read more
Morse code

Morse code

July 9, 2019

Morse Code is a set of dots and dashes (short mark, dot or 'dit' (·) and longer mark, dash or 'dah' (-)). Basically, it's a character encoding scheme for transmitting cryptographic messages which used in telecommunication. Think of it as the early version of texting. ...

Sirwan Afifi Sirwan Afifi
Read more
Calling Stored Procedures using Dapper

Today I wanted to call a Stored Procedure using Entity Framework Core. It is possible using DbSet.FromSql() method, which is one of the powerful features of Entity Framework Core. It gives us the ability to run RAW SQL queries directly against a database...

Sirwan Afifi Sirwan Afifi
Read more
Passed Exam 70-483 - Programming in C#

I have been developing with C# for a while, and I decided to pass Exam 70-483 in order to validate my skill. In order to pass the exam, you should be able to perform the following skills:...

Sirwan Afifi Sirwan Afifi
Read more
Hosting React app on IIS

Hosting React app on IIS

April 10, 2019

Today I wanted to host a React application; the first and easiest option was hosting the app using a package called serve which is basically a static file serving tool. The process was easy, all I had to do was first prepare a production build of my application using npm run build then run the npx serve command inside my build's directory...

Sirwan Afifi Sirwan Afifi
Read more
Hosting a WCF Service as a Windows Service Using Topshelf

You might be wondering why I am blogging about WCF. Is it still relevant? This is part of a legacy WCF project, and I am responsible for adding some functionalities to it, I like it though. By the way, it's been a long time since it went out of fashion, but many large enterprise applications still use it.

Sirwan Afifi Sirwan Afifi
Read more
What's Elasticsearch

What's Elasticsearch

December 5, 2018

Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.

Sirwan Afifi Sirwan Afifi
Read more
GraphQL

GraphQL

October 28, 2018

Recently I have been working on a node stack project as a full stack JavaScript developer, it's a great experience because I'm working with talented developers. We use TypeScript on both backend and frontend which is great because I'm coming from a .NET background and couldn’t be happier; Well we have types for our JS code :) ...

Sirwan Afifi Sirwan Afifi
Read more
React Hooks

React Hooks

October 28, 2018

Hooks are a new feature that is coming up in React v16.7.0-alpha, it's a really great feature, I am so excited about this new feature. The goal is to use all functionalities you can ...

Sirwan Afifi Sirwan Afifi
Read more
Shahriban - My first Hackathon project (Challenges, Lessons Learned)

As you probably know, Hackathon is an event that programmers, designers, entrepreneurs to get together for a short period of time to collaborate on a project. The cool part of this event is delivering tasks rapidly, In fact, it's more like a Marathon for programmers. I have never participated in a hackathon ...

Sirwan Afifi Sirwan Afifi
Read more
Uploading file in Vue.js

In this blog post I am going to show you how you can upload file using Vue.js. On the backend we will use ASP.NET Core MVC to expose an endpoint to the client to receive file.

Sirwan Afifi Sirwan Afifi
Read more
TypeScript and Vue.js

TypeScript and Vue.js

May 29, 2018

In this blog post I would like to show how to combine Vue.js with TypeScript inside an ASP.NET Core 2.x application.

Sirwan Afifi Sirwan Afifi
Read more
Developing Console-based UI in CSharp

Console Applications don't have graphical user interface or GUI. Instead, they run from Command Line, for example instead of writing a name into a textbox and clicking a button we would instead invoke the Console Application and provide the name as a parameter. ...

Sirwan Afifi Sirwan Afifi
Read more
Does making decision matter?

We make decision all the time, most of these decisions are done unconsciously, others we agonize over, we all have been there agonizing over a difficult or big decision, we always worry about what to do next, in fact we are trying to make the right decision, ...

Sirwan Afifi Sirwan Afifi
Read more
Running PowerShell on macOS

It's been a while I have been using macOS as my primary operating system, you can read about my expreince here. Today I wanted to run a PowerShell script, I searched around and figured out Microsoft has made PowerShell open source open source and the ...

Sirwan Afifi Sirwan Afifi
Read more
SQL Server on Linux in Docker on a Mac

Over the last few months, I have been working on a couple of ASP.NET Core projects, it's been great experience so far becuase I can easily work on different platforms while working on these projects. I recently bought a MacBook Pro and have decided to do .NET projects on macOS since then...

Sirwan Afifi Sirwan Afifi
Read more
Working remotely

Working remotely

May 4, 2017

It has been 8 months and so that I have been working remotely for a startup out there. It's been my pleasure to work with a team of great and talented members. over the past few months, I have learned a lot both in terms of technical stuff and working as a team member.

Sirwan Afifi Sirwan Afifi
Read more
My first experiences with Linux

Running Window 98 on my PC was my first experience with Windows. in fact, for the last 11 years or so, Windows has been the dominant operating system that I've been using. So, up until now, I have been an avid fan of Windows.

Sirwan Afifi Sirwan Afifi
Read more
Environments in ASP.NET Core

Environments in ASP.NET Core

November 23, 2016

In ASP.NET Core we can have different hosting environments, this is supported by an environment variable called ASPNETCORE_ENVIRONMENT. You can see this value is already set to Development:

Sirwan Afifi Sirwan Afifi
Read more
Designing Fluent Interfaces in C#

The concept of Fluent Interface was coined by Martin Fowler to create various objects and wire them up together. This pattern is often used for object configuration and setup.

Sirwan Afifi Sirwan Afifi
Read more
Delegates in C#

Delegates in C#

July 3, 2016

Lately I have been studying some topics in C# in order to improve myself. I think Delegate is one of those topics which is kinda difficult for beginners to initiate with. So, in order to make it clear how it works, I'm going to make some explanations in this post.

Sirwan Afifi Sirwan Afifi
Read more
Asynchronous Execution in JavaScript

As you know browsers are typically single threaded, It means that the browser can only be doing either update the UI or executing JavaScript at any given time. It actually incapable of doing theme simultaneously.

Sirwan Afifi Sirwan Afifi
Read more
My first blog post!

My first blog post!

November 28, 2015

Here's my first blog post :) In this blog I'm going to share thing that I learn, hope you enjoy reading my blog :)

Sirwan Afifi Sirwan Afifi
Read more