Naweed Akram's Blog
<sharing: Knowledge />
Windows 8/RT WebAuthenticationBroker view issue - Alternative

Doing oAuth in Windows 8 couldn’t have been any easier and simpler. Remember the old days of getting Access Tokens from providers such as Yammer, GitHub, Facebook, 500px etc. (you name it). You had to use browser windows, passing URLs, manage the state etc. Windows 8 make it as simple as the code below to do all the underlying work for you. All you have to do is use the WebAuthenticationBroker, which presents the oAuth dialog, manages user authorization and state, and returns the access token, all with a few lines of code (3-4 lines).

 

However, there is a small issue. Some oAuth site present login/authorization dialogs which exceed the area displayed by WebAuthenticationBroker. This post addresses the problem and provides an alternative.

More ...
Tags:  .NET,  C#,  Silverlight Viewed:  10556       Comments:  9      


XGENO.DBMapper - A new way of OR/DB Mapping

XGENO.DBMapper is a simple, easy-to-use and powerful OR Mapper (just 15KB) for your database queries. It is set of extension methods (on the SQL Connection), which execute a SQL query (simple, parameterized, stored procs etc.) and return the data as a list of .NET objects (classes that you have created).

 

Note: This is not a replacement for existing ORMs (Linq/NHibernate/XGENO.ORM etc.). This is useful when there are lots of stored procedures or dynamic SQL queries are involved, and performance is a critical factor.

More ...
Tags:  .NET,  C#,  VB.NET,  ASP.NET,  MVC,  Silverlight,  ORM Viewed:  3030       Comments:  1      


Marketplace Browser and Downloader for Windows Phone 7 (with Source Code)

[Edit] Source Code has been released for this

 

Zune is a wonderful application for finding and installing Windows Phone 7 applications on your phone. The other alternative is to use Market Place application in WP7 handset. If have an HTC HD2 which doesn't support WP7 officially, but thanks to XDA Developers and DarkForcesTeam, I am running WP7 on this handset with no issues.

Initially, when I upgraded, I couldn't connect to Windows Market Place and browse or install applications because of Windows Live Services Registration (which I later resolved). So, I wrote an app to resolve my problem.

More ...
Tags:  C# Viewed:  4732       Comments:  6      


Descriptive Value for Enums in C#

Consider a scenario that you have the following enum declared, which is used to define SQL operations (keeping it very simple):

    public enum Operands
    {
        Equals,
        GreaterThan,
        LessThan,
        NotEquals
    }

 

Now, if the user wants to convert the enums to values that SQL server can understand (=, <>, <, > etc.), the following needs to be done:

            string _opValue = "";
            Operands _op = Operands.LessThan;

            switch (_op)
            {
                case Operands.Equals:
                    _opValue = "=";
                    break;
                case Operands.GreaterThan:
                    _opValue = ">";
                    break;
                case Operands.LessThan:
                    _opValue = "<";
                    break;
                case Operands.NotEquals:
                    _opValue = "<>";
                    break;
            }

 

Not very convenient. What if, you could say:

 

            Operands _op = Operands.LessThan;
            Console.Write(_op.ToStringValue());

More ...
Tags:  .NET,  C# Viewed:  3537       Comments:  0      


RSS Feed Result for ASP.NET MVC

In this post, we look at creating a RSS Feed Result in ASP.NET MVC (similar to the one implemented on this site). This will allow your MVC site to expose its data (news, blog posts, articals etc.) as RSS feed.

More ...
Tags:  C#,  ASP.NET,  MVC Viewed:  22607       Comments:  2      


RSS Feed
Newsletter


Quick Links

Tags