Posts

Entity Framework Core with SQL Server on Mac

Hi All mac and microsoft tech lovers, There was a time where we love to use our macs and microsoft technologies but since there were not quite compatible with each we have to use windows os to work with microsoft technologies. But now microsoft has developed tools and compatibility to do this on any os. So here I would like to show you how to work with SQL Server and Entity Framework Core in your mac. Lets get started... You have to have docker in order to use SQL Server on Mac. So if you are new to this and would like to learn how to do that please read my blog from here and come back to this. Ok.. I think you have set up Docker, SQL Server and Azure Data Studio. I'm going to use Visual Studio for Mac as my IDE. If you like to use that you can download it from: https://visualstudio.microsoft.com/vs/mac/ . Lets continue then.. 1. Open Visual Studio for Mac (VSM) and create a Web API project. I call it MyAPI I'm going to create a project with N-Tier architecture,...

Tool to Synchronize email templates between different SendGrid accounts

Hi All, Here I'll directly provide my code where I developed a tool to copy email templates from one SendGrid account to another SendGrid account. It is nice to have a such tool when migrating all of your newly created and modified email templates from develop environment to production servers. So here is the code that I have came up with: public class EmailSyncService : IEmailSyncService { private readonly EmailSyncSettingsModel _emailSyncSettingsModel; public EmailSyncService(IOptions<EmailSyncSettingsModel> emailSyncSettingsModel) { _emailSyncSettingsModel = emailSyncSettingsModel.Value; } public async Task<List<KeyValuePair<string, string>>> SyncSendGridTemplates(string source, string destination) { var newTemplates = new List<KeyValuePair<string, string>>(); var sourceKey = _emailSyncSettingsModel.GetType().GetProperty(source).GetValue(_emailSyn...

Work with SQL Server in Mac like in Windows

Image
Hi all Mac and SQL Server lovers, In this blog post I will explain you how to work with SQL Server in your mac like in a windows machine. Lets start. Start SQL Server in Mac  1. Install docker ( https://hub.docker.com/editions/community/docker-ce-desktop-mac ) 2. Increase the memory to 4 GB You can do this by going to docker --> Preferences --> Advanced   3. Open the terminal and type bellow command  docker run --name sql3 -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=sysAdmin@123' -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest-ubuntu This will download and install SQL Server 2017 for linux If you want different version of SQL Server, then you can find it from here:  https://hub.docker.com/_/microsoft-mssql-server NOTE: When providing a password for  sa (System Admin), it should meet the following criteria:  A t least 8 characters long contain characters from three of the following four sets: Uppercase letters, Lower...

Angular 2+: Passing data between components (Quick Note)

Hi devs, This is a quick note to guide you how to pass data between components. There are 2 main ways of doing this: 1. Passing data from Parent to Child 2. Passing data from Child to Parent 1. Passing data from Parent to Child - using @Input() 1.1. Add variable to child component to retrieve value child.component.html < p > Value from parent: {{parentValue}} </ p > child.component.ts parentValue: string; @Input() set valueFromParent(value: any){ this .parentValue = value; }; 1.2.  Pass value from parent to child parent.component.html < app-child [ valueFromParent ]= "parentValue" ></ app-child > parent.component.ts export class ParentComponent implements OnInit { parentValue: string = "sss" ; constructor () { } ngOnInit() { } } 2. Passing data from Child to Parent - using @Output() and EventEmitter 2.1. child.component.ts @Output() valueForParent = new EventEmitter<string>();...

Work with HTML5 Video Player with Angular 2+

Image
Hi coders, This is just a straight forward post. I'll explain you all, how to use the html5 video player ( https://www.w3schools.com/html/html5_video.asp ) with angular. Actually there are some tricky parts as well, such as; not refreshing the video when clicking on multiple video urls. So, lets get started. video-player.component.html <div id=" jobCallDetailModal " class="modal fade dashboardN" role="dialog" data-backdrop="static"> <div class="modal-dialog modal-lg modal-xl"> <div class="modal-content"> <div class="modal-header" *ngIf="callDetails != null" > <button type="button" class="close" (click)="closeVideoViewer()"> <i class="ti ti-close"></i> </button> <h5 class="modal-title float-left">Job...

Firebase with.Net Core and C#

Image
Hi folks, Are you developing web applications with .net ? Are you supporting mobile applications to communicate with your applications ? Are you thinking of providing realtime capabilities with your apps? Then I suggest you to read on Firebase Real-Time Dataabses by Google. " The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. " - Google Firebase Team Read more:  https://firebase.google.com/docs/database/ In this post I'm going to discuss what is firebase but I'm going to discuss how to work with it with .Net C#. Firebase doesn't provide a separate library or a nugget to work with .Net, so you might find this bit tricky when you have to work with it from the backend. Senario To demonstrate the solution I will create a scenario. In my scenario we have created a video call function (which is implemented with OpenTok library) and it allows users to create sessions and i...

Authenticate users with JWT (JSON Web Tokens) with .Net and TypeScript

Image
When creating web applications, it is a common thing to provide a user login function. And when creating user logins it is required to authenticate them probably using a token which contain the user session data and user role data. When considering the token creation and authenticate it there are several ways and technologies to do and in this blog I would like to explain how to create token and validate it using JWT (JSON Web Tokens). Read about JWT from here There are several packages in NuGet store that provide JWT features and in this article I'm going to use  System.IdentityModel.Tokens.Jwt  Install this in your project using the NuGet package manager. Ok, now let's get started. 1.      Create token Let's create a class to create token when user log in to the system.  Create a hased key of SHA256 to use when crating the token.  using System; using System.Text; using System.IdentityModel.Tokens.Jwt; using Microsoft.I...