Posts

Showing posts from 2016

Building an Amazon S3 API with Express and Multer-S3 in Node Js

Introduction
Amazon Simple Storage Service (Amazon S3), provides developers and IT teams with secure, durable, highly-scalable cloud storage. Amazon S3 is easy to use object storage, with a simple web service interface to store and retrieve any amount of data from anywhere on the web. With Amazon S3, you pay only for the storage you actually use. There is no minimum fee and no setup cost. To learn more about Amazon S3 check out http://www.aws.amazon.com/s3. It is free, cheap and easy.

Diving into Amazon S3
I am not going to explain much about it here because i have already written a  tutorial on how to implement it, so Check it out.


Fare well!!! and i am wishing you a wonderful Christmas.

Using SignalR with Unity

Image
Introduction
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. Read more

I will demonstrate how to implement dependency injection with Unity IoC container in a SignalR project. We will be building a simple online chatting app.


Installing Packages
To begin your journey to the world of realtime web apps, start by installing these packages:
Unity IoC for DIInstall-Package UnitySever and client package for hosting with IIS and ASP.NET and Javascript clientInstall-Package Microsoft.AspNet.SignalRServer package for hosting SignalR endpointsInstall-Package Microsoft.AspNet.SignalR.CoreClient package .NET SignalR applicationsInstall-Package Microsoft.AspNet.SignalR.ClientClient package for javascript SignalR applicationsInstall-Package Microsoft.AspNet.SignalR.JS Creating The Ch…

How to get user location from a web service in c#

Image
Introduction
Have you ever wondered on how to get user location based on the network the user is currently on? Maybe you want to display the user country based on location or you want to disable some countries that shouldn't access your app, Your in the right place!!!

freegeoip.net provides a public HTTP API for software developers to search the geolocation of IP addresses. It uses a database of IP addresses that are associated to cities along with other relevant information like time zone, latitude and longitude.

Let's see some codes in C#.

C# Impelmentation
1. Create a Location class that will be used as a data transfer object. It will contain properties to hold the data return from the web service.



















2. Call the ReadAsync<T> method of  the HttpClient Class. The method will handle serialization of object to the response object.

























Let's play with it a littleif(currentLocation == "Nigeria"){
      //allow }else{     //deny }
Run it in the console and you would…

Lazy initialization in C#

Image
Introduction
lazy initialization defers the creation of a large or resource-intensive object, or the execution of a resource-intensive task, particularly when such creation or execution might not occur during the lifetime of the program.

In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.

To learn more about lazy initialization, check this out


Why use it?
When you have an object that has lots of data, but you only need some required data, the Lazy<T> class gives you access to load only specific data you need.It defers the creating of objects. It only initializes the object when neededIt increases code performanceThe codeThe code here will be written in pure C#. Let's start with some basic console program.



when you run the program, you will get "John Doe" as the result.

Getting More Advanced 
I created a generic class for a more adv…

Implementing a payment gateway on your website in Node JS

Image
Introduction
Implementing a payment gateway on your website in the past was so difficult and expensive. Most programmers when it comes to implementing a payment gateway they begin to do some equations on their mind like costs, security, and implementation.

And not all payment gateway supports international transactions which is why some projects cannot scale easily. A solution for you In the last few years, tons of payment gateway has been bombing the internet and they have helped to streamline the process of implementation, costs, and security. Here are few providers: PaystackInterswitch web payCash envoy I used Paystack in one of my project written in Node JS to build an API that can handle payments. Paystack already has an API to work with payments.
To sign up for a test account, create an account with Paystack to get your public and secret keys and they are not very expensive to use. When your ready to go live, then you can sign up for a live account. To get information about the