Posts

WCF web service & Jquery

Here is a new item we can try out, seems to be very light. In this post i will walk through a simple credential validation. Create a simple ASP.NET project Add a the following mark-up in your Login.aspx page     < div>         < input  type= "text"  id= "username"  />         < input  type= "password"  id= "password"  />         < input  type= "button"  id= "login"  value= "Login"  />     </ div > Add jquery library and reference     < script  src= "Scripts/jquery-1.5.1.js"  type= "text/javascript">< / script > Add WCF Service Set aspNetCompatibilityEnabled attribute to true in your web.config file     < serviceHostingEnvironment  multipleSiteBindingsEnabled= " true "  aspNetCompatibilityEnabled= " true "  /> Set Factory attribute to "System.ServiceModel.Activation.WebScriptServiceHo

Code First!!!

Image
Code first- I just love this approach, well any developer would. MVC has been haunting since long ago. So thinking to my self better late than never gave it shot and found it to be pretty neat & interesting. And Microsoft as before with MVC, Entity framework, etc etc leaves you wondering how they did that!!! . Lets start coding (if we get a chance to ;) ), Select ASP.NET MVC3 Web Application in the next select Internet application and try razor view engine with html5 Now check your solution explorer you will see quite a lot of things that has come from thin air. Don't b shocked there is still to come Microsoft now needs a developer who knows to create a class For this sample project let me create following two classes Employee and Department and add to Models folder      public   class   Employee     {          public   int  Id {  get ;  set ; }          public   string  Name {  get ;  set ; }          public   string  

Notify Async operation in C#

Image
Threading is a nice thing until we know how it is being executed. Sometime it can be a pain in the arse and sometimes asset you gain from. Today came across a question on how to get to know a async operation is completed thought of spending some time to explain it in my way. How do you get to know a Async operation is completed, well one way is  IAsyncResult ,this is how we go, Lets create a delegate that will be used call our time consuming or background task. delegate   string   CallFunctionDelegate ( string  arg1,  string  arg2); say the time consuming function private   string  DoSomeThingBig( string  arg1,  string  arg2) just to show how to pass argument, i have used some dummy arguments. Once the time consuming function is completed lets call the notification function that will called after the asynchronous operation let that be private   void  AfterDoingSomethingBig( IAsyncResult  result) Now for this kind of function signature we have a delegate class calle

Visual studio styles

Transform your visual studio's visual looks :) There are a lot of templates that are readily available. Thanks to Luke Sampson who has created a space to share styles. Personally i like  WekeRoad Ink   and  Zenburn 2010 public   partial   class   _Default  : System.Web.UI. Page     {          delegate   string   CallFunctionDelegate ( string  arg1,  string  arg2);          protected   void  Page_Load( object  sender,  EventArgs  e)         {              AsyncCallback  CallBackAfterAsynOperation =  new   AsyncCallback ();         } Its damn easy to get it done. 1.Open Visual Studio 2.Click on Tools->Import and export settings 3.Select Import selected environment settings 4.Select No, Just Import new setting 5.Now browse for the settings file you downloaded from  http://studiostyl.es/ Make your visual studio interesting. If you are really good in colors create one style and upload in Luke's repository.

Chrome in a nut shell

Image
I've always been fascinated by Google's approach to invade "The Internet" (i got a gut feeling that this invasion is going to bring good.).Well it all started when Google released their browser Chrome. I will be sharing tiny bits of tip on chrome browser Chrome started in sep 2008 and am stuck with it ever since, the simple idea of creating a process for individual tabs and sandboxing it was the core what pulled me in.Understanding chrome was like reading a comic (literally). Chrome at a very high level Chrome has 4 release channels, Stable : Targets layman or people who want rock solid completely tested browser.Its more of fully polished product. Beta : This channel is the last filter the build goes through before going stable. Dev : This channel features the latest version of chrome build and prone to crashes.People who like to preview a lot of features (like me ;) ) and help google's open source project in a least possible way should be opting fo

Mail This!!!

Image
I am sure many of you might have come across situations where you want to send mail from your application. I will be sharing a bit of code that will help you in this. For sending a mail all we need is a SMTP(Simple Mail Transfer Protocol) Server which we will be getting it for free from GMAIL.(smtp.gmail.com) Now to use this server we need credentials to this server. There is no big deal in getting these credentials you only need to have a gmail account.(Which also is free :)) OK now we got all the essential ingredients, lets start coding.... Sending mail is in C# .NET is straight forward.Its all there in System.Net.Mail and System.Net namespaces.Now to connect to a server we need a client object which is instantiated from the  System.Net.Mail.SmtpClient class . To setup the properties of a SMTP client you might want to refer this . SmtpClient  emailClient =  new   SmtpClient ( "smtp.gmail.com" ); The argument passed to the constructor is the SMTP server host

Developing SMS Services in C#

Image
            This following project has been sticking my back since my engineering from past 4 years.Ever since then the same cookie was served in different plates. i meant to say one functionality was implemented for different applications. In this post i will be implementing the project for a college domain.Say there is a database that stores the student details like attendance,marks,profile,etc,.Our application will receive a message sent from cell phone and query the database to retrieve the result and send it back to the respective user. Now to receive & send a message we will be using a GSM modem(something similar to a cell phone) now the modem looks something like this the black slot on the PCB(printed circuit board) is to insert a sim card. "A picture is worth thousand words " so trying to put the whole process in nut shell..... I know this is not worth thousand words, forgive me will try to picturize better next time. Lets start CODING!! To c