Posts

Asynchronous Data Grid View Using Tasks

Image
Hi Guys, This time I made a fully UI Responsive Asynchronous Data Grid for WinForms.  This uses Tasks to call a database asynchronously and fetches data without blocking the main thread. Tasks are Managed Thread Pool Threads so they are efficient compared to regular threads. Before you Start, 1) Visual Studio with .NET Framework 4.5  Step One : The Solution Make a WinForms Application as Following Step Two : Paste the Below Code in the AsyncDataGridView.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using System.Data; namespace AsyncDataGridView.AsyncDataGrid {     public class AsyncDataGridView : DataGridView     {         //Sql Command Object         public SqlCommand SelectCommand { get; set; }         //Connection Stri...

Real Time Web using SignalR

Image
Hi Guys, This time I made a shopping site which works real time. Yes, you heard it right. It is real time. If two users ave connected and one buys something, the other person gets the update without him making any interaction to the Server. Surely the potential of this real time web is limitless. Before you Start, 1) Visual Studio with .NET Framework 4 or higher Step One : The Solution Create a Web application project. Then Right Click on Solution -> Manage NuGet Packages For Solution Then Search for SignalR, Json2 and jquery as shown and then install them. Then make Solution as shown Then Open UpdateStock.js paste the following code. /// <reference path="../Scripts/jquery-1.6.4.min.js" /> /// <reference path="../Scripts/jquery.signalR-2.0.0.js" /> /// <reference path="../Scripts/jquery-ui-1.10.3.js" /> $(function () { //Instance of the Hub var hub =...

Stack Implementation using Managed Extensibility Framework

Image
Hi Guys, This time I made a small application to simulate a basic stack data structure. But to make things interesting I used Managed Extensibility Framework. Before you Start, 1) Visual Studio with .NET Framework 4 or higher (Any Version) Step One : The Solution Create a console application project and a class library as shown in the image. Refer both the projects with System.ComponentModel.Composition. And add a reference to Console Application from the class library. Step Two : The Code Paste the following code in the Program.cs file of MEFClient Project.  using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; namespace MEFClient {     //Stack Implementation      [Export(typeof(IStack))]     class MySimpleStack : IStack     {   ...

Notifications : Service Broker, SqlDependency and NotifyIcon

Image
Hi Guys, This time I made a small application to show notifications using Service Broker (Query Notifications), SqlDependency and NotifyIcon. Before you Start, 1) Sql Server (Any Version) 2) Visual Studio (Any Version) Step One : Enable Service Broker for the Database you work on. Step Two : Add the Following Code in a Console/Windows Application   using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Linq; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace TestApplication {     class Program     {         static void Main(string[] args)         {             //Start the Dependency         ...

HTML 5, Bing Map Control to Show your Current Location

Image
Hi Guys, My this post simply shows you how to use the HTML 5 navigator object and Bing Map Control to show your current location. Before you Start, 1) You need to have an HTML 5 Compatible browser. Duh, almost all the new browsers supports it. 2) A text Editor (Notepad, Wordpad would do) 3) A Bing API Key (You can get one from www.bingmapsportal.com  by registering) Step One : Open the Text Editor and Paste Following HTML and Save it as HTML. <!DOCTYPE HTML>  <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>       <script type="text/javascript" src=" http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script >       <script type="text/javascript">       var map = null,lat,lng; function errorHandler() { }               ...

Asynchronous Programming : Sending Mails using async and await in .NET 4.5

Image
Hi Folks, This is Time I am going to tell you how to send mails asynchronously using async and await keywords . Enjoy. Before You Start you must have, - Visual Studio 12 installed Step 1: Create a Console Project in Visual Studio     Step 2: Make Mail Manager Class to Send Asynchronous mails Step 3: Call it using the Console application

Security : Encryption and Decryption function in SQL Server

Image
Hi Folks, This is a continuation of my last Blog post. Enjoy. Before You Start you must have, - Visual Studio 2005/2008/2010 installed - MS SQL Server 2005/2008 installed Step 1: Create an SQL Server Project in Visual Studio Step 2 : Add a user defined Function Step 3 : Add the code in my previous blog which Encrypts a string to the user defined function Step 4 : Add Database reference to the Database which you want to deploy the function Step 5 : Right Click on the Project and Click Deploy once deployed you can see the Project has been deployed on your database under. [Database Name]->Programmability->Assemblies Step 6 : Use the Functions in SQL Server Once the Project is deployed you can see the two functions in  [Database Name]->Programmability->Functions->Scalar-valued Functions Then they can be used in SQL Server as regular functions.