Time ago function for C#

Posted by Anuraj on Thursday, December 19, 2013

.Net .Net 4.0 ASP.Net ASP.Net MVC Windows Forms

Here is a small C# snippet which will return a date time value in a readable way as facebook,twitter, stackoverflow and most of the forum sites, like 1 day ago,1 min ago etc. If you’re building a website, then the jQuery plugin Timeago is a pretty sweet way to do it (as long as you can stand webpages that auto update text). I have wrapped it in an extension method.

Programmatically list the local instances of SQL Server

Posted by Anuraj on Thursday, December 19, 2013

.Net .Net 4.0 SQL Server Windows Forms

Long back I wrote a post about Enumerating Instances of SQL Server using C. But this code snippet will not list your sql server instances installed on your system. Here is the code snippet using Windows registry which will list all the local instances of sql server.

How to share cookie between HttpWebRequest and WebView

Posted by Anuraj on Friday, December 13, 2013

.Net .Net 3.0 / 3.5 Xamarin

This is post is about another hybrid application scenario. I had to implement this in one of our projects, the problem was like this, unlike other hybrid applications, this project had a native login screen, which will authenticate the user against a REST API service and once the authentication is successful, service will set an authentication cookie. And once authentication is completed, application will start a new activity, which will load the web application. If cookie is not present, the web application will show the Forms authentication screen.

How to convert JSON to XML and vice versa in C#

Posted by Anuraj on Monday, December 9, 2013

.Net .Net 4.0 ASP.Net Javascript Silverlight

Json.NET supports converting JSON to XML and vice versa using the XmlNodeConverter. The JsonConvert has two helper methods for converting between JSON and XML. The first is SerializeXmlNode(). This method takes an XmlNode and serializes it to JSON text.

How to detect IPhone / IPad through JavaScript

Posted by Anuraj on Wednesday, December 4, 2013

.Net ASP.Net Javascript

Here is code snippet which helps to identity IPhone or IPad through JavaScript.

How to invoke C# from Javascript in Android

Posted by Anuraj on Saturday, November 30, 2013

.Net HTML5 Javascript Xamarin

This post about to invoke C# from Javascript in Xamarin for Android. My last post related to building hybrid applications with C# and Xamarin, I got few comments like in hybrid application development, host language interface with javascript is an important topic, so I thought of writing a blog post.

How to detect hyperlink click in a webview android with C#

Posted by Anuraj on Thursday, November 28, 2013

.Net .Net 3.0 / 3.5 Xamarin

This post is about detecting hyperlink click in a Android webview with C#. This can be useful in two scenarios.
BMC logoBuy me a coffee

Copyright © 2018 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub