Friday, October 17, 2008

Official Gmail Blog: A sneak peek at Gmail on Android

Official Gmail Blog: A sneak peek at Gmail on Android

Wednesday, September 3, 2008

Thursday, August 7, 2008

AUTHENTICATE oAuth SIGNATURE in C#(orkut Apps)

From last few days I was stucked in a problem during developing an open social app on orkut for my company.
I had to authenticate the oauth request from orkut app in my C# App.
The request was having data both in querystring and post(form) .
Posted many places but not found any exact Solution.
Cople of solutions were there
http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_23238711.html

http://eran.sandler.co.il/2007/10/17/oauth-c-very-basic-library/

But they only able to autheticate get data request in case of post they were failing.

Even on OAUTH site they have given only the oAuth class that is not useful in case of authentication.


but at last my hit and trail with this code returend me the solution. that was very silly problem Here is the solution.

function bool Auth(httpRequest request)
{
        if (!string.IsNullOrEmpty(request["oauth_signature"]))
        {
            X509Certificate2 cert = new X509Certificate2(Encoding.ASCII.GetBytes(certificate), "", X509KeyStorageFlags.MachineKeySet);
            NameValueCollection queryString = request.QueryString;
            string signature = request["oauth_signature"];
            Base64Decoder decoder = new Base64Decoder(signature.ToCharArray());

            RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PublicKey.Key;
            OAuth.OAuthBase asd = Snew OAuth.OAuthBase();
            string url = request.Url.ToString();
            foreach (string name in request.Form)
                url += "&" + name + "=" + request.Form[name];
            Uri reqURi = new Uri(url);
            string signatureBase = asd.GenerateSignatureBase(reqURi, request["oauth_consumer_key"], "", "",
                request.ServerVariables["REQUEST_METHOD"].ToUpper(), request["oauth_timestamp"],
                request["oauth_nonce"], request["oauth_signature_method"], out urvl, out urlNPAM);
            bool rtn = rsa.VerifyData(
                Encoding.ASCII.GetBytes(signatureBase), "SHA1", decoder.GetDecoded());
           return rtn;
        }
}

Thursday, June 19, 2008

.NET Programming Standards and Naming Conventions

Common .NET Naming Conventions

These are the industry-accepted standard naming conventions for J#, C# and VB.NET programs. For additional information, please see the MSDN help documentation and FX Cop. While individual naming conventions at organizations may vary (Microsoft only suggests conventions for public and protected items), the list below is quickly becoming the de-facto standard in the industry. Please note the absence of Hungarian Notation except in visual controls. These naming standards should find their way into all of your .NET development, including ASP.NET Web applications and .NET Windows Forms applications.

Note that while this document predates the online and printed standards documentation from Microsoft, everything below which indicates it is based on .NET library standards is consistent with that documentation. In areas where Microsoft has not provided guidance (Microsoft generally doesn't care what you do in private/non-exposed code. In fact, they aren't even consistant in their internal code in the .NET framework), de facto standards have emerged, and I have captured them here.

The "ux" naming convention for controls is something I have added and found to be helpful. It is not based on any official standards, but instead based upon a multitude of projects by my teams and others, as well as on-line discussions on the topic. While I strongly recommend that you follow Microsoft guidelines when present, I encourage you to try out the items marked as extensions below and see how they work for you before committing to them.

Type Standard / Convention Example
Namespaces

Standard Based Upon Microsoft .NET Library Standards

Pascal Case, no underscores. Use CompanyName.TechnologyName as root. If you don't have a company, use your domain name or your own initials. Note that any acronyms of three or more letters should be pascal case (Xml instead of XML) instead of all caps.

Why: This convention is consistent with the .NET Framework and is easy to read.

AppliedIS.TimeCard.BusinessRules
IrritatedVowel.Controllers
PeteBrown.DotNetTraining.InheritanceDemo PeteBrown.DotNetTraining.Xml
Assemblies

Standard Based Upon Microsoft .NET Library Standards

If the assembly contains a single name space, or has an entire self-contained root namespace, name the assembly the same name as the namespace.

Why: This convention is consistent with the .NET Framework and is easy to read. More importantly, however, it keeps your assembly names and namespaces lined up, making it really easy to figure out what is any particular assembly, and what assembly you need to reference for any given class.

AppliedIS.TimeCard.BusinessRules.dll
IrritatedVowel.Controllers.dll

Classes and Structs

Standard Based Upon Microsoft .NET Library Standards

Pascal Case, no underscores or leading "C" or "cls". Classes may begin with an "I" only if the letter following the I is not capitalized, otherwise it looks like an Interface. Classes should not have the same name as the namespace in which they reside. Any acronyms of three or more letters should be pascal case, not all caps. Try to avoid abbreviations, and try to always use nouns.

Why: This convention is consistent with the .NET Framework and is easy to read.

Widget
InstanceManager
XmlDocument
MainForm
DocumentForm
HeaderControl
CustomerListDataSet (typed dataset)

Collection Classes

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions, but add Collection to the end of the name

Why: This convention is consistent with the .NET Framework and is easy to read.

WidgetCollection
Delegate Classes

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions, but add Delegate to the end of the name

Why: This convention is consistent with the .NET Framework and is easy to read.

WidgetCallbackDelegate
Exception Classes

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions, but add Exception to the end of the name

Why: This convention is consistent with the .NET Framework and is easy to read.

InvalidTransactionException
Attribute Classes

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions, but add Attribute to the end of the name

Why: This convention is consistent with the .NET Framework and is easy to read.

WebServiceAttribute
Interfaces

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions, but start the name with "I" and capitalize the letter following the "I"

Why: This convention is consistent with the .NET Framework and is easy to read. It also distinguishes classes from interfaces, where (unlike in VB6) are truly different beings. This avoid name collisions as well, as it is quite common to have IFoo and a class named Foo that implements IFoo.

IWidget
Enumerations

Standard Based Upon Microsoft .NET Library Standards

Follow class naming conventions. Do not add "Enum" to the end of the enumeration name. If the enumeration represents a set of bitwise flags, end the name with a plural.

Why: This convention is consistent with the .NET Framework and is easy to read.

SearchOptions (bitwise flags)

AcceptRejectRule (normal enum)

Functions and Subs

Standard Based Upon Microsoft .NET Library Standards

Pascal Case, no underscores except in the event handlers. Try to avoid abbreviations. Many programmers have a nasty habit of overly abbreviating everything. This should be discouraged.

Functions and subs must differ by more than case to be usable from case-insensitive languages like Visual Basic .NET

Why: This convention is consistent with the .NET Framework and is easy to read.

VB: Public Sub DoSomething(...)

C#: public void DoSomething(...)

Properties and Public * Member Variables

Standard Based Upon Microsoft .NET Library Standards

Pascal Case, no underscores. Try to avoid abbreviations. Members must differ by more than case to be usable from case-insensitive languages like Visual Basic .NET.

Why: This convention is consistent with the .NET Framework and is easy to read.

VB: Public Property RecordID As Integer

C#: public int RecordID

Parameters

Standard Based Upon Microsoft .NET Library Standards

Camel Case. Try to avoid abbreviations. Parameters must differ by more than case to be usable from case-insensitive languages like Visual Basic .NET.

Why: This convention is consistent with the .NET Framework and is easy to read.

VB: ByRef recordID As Integer

C#: ref int recordID

Procedure-Level Variables

Standard Based Upon De facto Industry-Accepted Practices

Camel Case

Why: This convention is consistent with the .NET Framework and is easy to read. It also avoids naming collisions with class-level variables (see below)

VB: Dim recordID As Integer

C#: int recordID ;

Class-Level Private and Protected Variables

Standard Based Upon De facto Industry-Accepted Practices

Camel Case with Leading Underscore. In VB.NET, always indicate "Protected" or "Private", do not use "Dim". Use of "m_" is discouraged, as is use of a variable name that differs from the property by only case, especially with protected variables as that violates compliance, and will make your life a pain if you program in VB.NET, as you would have to name your members something different from the accessor/mutator properties.

Of all the items here, the leading underscore is really the only controversial one. I personally prefer it over straight underscore-less camel case for my private variables so that I don't have to qualify variable names with "this." to distinguish from parameters in constructors or elsewhere where I likely will have a naming collision. With VB.NET's case insensitivity, this is even more important as your accessor properties will usually have the same name as your private member variables except for the underscore.

As far as m_ goes, it is really just about aesthetics. I (and many others) find m_ ugly, as it looks like there is a hole in the variable name. It's almost offensive. I used to use it in VB6 all the time, but that was only because variables could not have a leading underscore. I couldn't be happier to see it go away.

Microsoft recommends against the m_ (and the straight _) even though they did both in their code. Also, prefixing with a straight "m" is right out. Of course, since they code mainly in C#, they can have private members that differ only in case from the properties. VB folks have to do something else. Rather than try and come up with language-by-language special cases, I recommend the leading underscore for all languages that will support it.

If I want my class to be fully CLS-compliant, I could leave off the prefix on any C# protected member variables. In practice, however, I never worry about this as I keep all potentially protected member variables private, and supply protected accessors and mutators instead.

Why: In a nutshell, this convention is simple (one character), easy to read (your eye is not distracted by other leading characters), and successfully avoids naming collisions with procedure-level variables and class-level properties.

VB: Private _recordID As Integer

C#: private int _recordID ;

Controls on Forms

An Extension to the Standards

In recent projects (since 2002 or so), I have taken to a single prefix for all my UI controls. I typically use "ux" (I used to use "ui", but it wasn't set apart well in intellisense). "ux" comes from my usual design abbreviations where it means "User eXperience", which has also since become a popular acronym. I have found this to be extremely helpful in that I get the desired grouping in the intellisense even better than if I use "txt", "lbl" etc. It also allows you to change combo boxes to text boxes etc. without having to change the names - something that happens often during initial prototyping, or when programming using highly iterative agile/xp methodologies.

Why: This convention avoids problems with changing control types (textboxes to drop-down lists, or simple text box to some uber textbox, or text box to date picker, for example), and groups the items together in intellisense. It is also much shorter than most Hungarian conventions, and definitely shorter and less type-dependent than appending the control type to the end of the variable name. I will use generic suffixes which allow me enough freedom to change them around.

"ux" prefix

uxUserID, uxHeader, uxPatientDateOfBirth, uxSubmit

Constants

Standard Based Upon Microsoft .NET Library Standards

Same naming conventions as public/private member variables or procedure variables of the same scope. If exposed publicly from a class, use PascalCase. If private to a function/sub, use camelCase..

Do not use SCREAMING_CAPS

Why: This convention is consistent with the .NET Framework and is easy to read. A sizable section of the Framework Design Guidelines is dedicated to why they chose not to go the SCREAMING_CAPS route. Using SCREAMING_CAPS also exposes more of the implementation than is necessary. Why should a consumer need to know if you have an enum, or (perhaps because they are strings) a class exposing public constants? In the end, you often want to treat them the same way, and black-box the implementation. This convention satisfies that criteria.

SomeClass.SomePublicConstant

localConstant

_privateClassScopedConstant

* Public class-level variables are universally frowned upon. It is considered to be a much better practice to use property procedures (accessors and mutators) to provide read and/or write access to a private member variable. If you must expose a member variable to other classes using "Public", follow the property naming conventions, but don't complain if your guilty conscience keeps you up at night ;-).

Please don't copy and paste these conventions on your own site. Feel free instead to link directly to this page. That way you get the ability to automatically get updates when I make them, as well as get that warm fuzzy you get by not copying someone else's work. Schools and accredited educational institutions can paste these conventions on their own sites if and only if they include a direct link to this page an an attribution for the source of the information from "Pete Brown's irritatedVowel.com". Thank you for respecting my wishes on this.

You Can find the standards for publicly exposed classes/properties etc at MSDN . If you want to run a tool to validate your code for public standards and required practices, download FXCop or use the analysis tools in Visual Studio 2005+।



Tuesday, May 13, 2008

IPL aur Match Fixer


Kis kis ko kharidun main, sab ke sab Bike hue hain,

Retirement ke baad aaj bhi IPL main tike hue hain,

Baal jhad gaye, daant gir gaye par gaya na inka josh,

IPL main paise kamane ko sab ke sab hain madhosh

 

"Matthew Hayden" Madrasi hain, kabhi dhyaan nahi aaya,

"Gilcrist", "Gibbs" ko Hyderabad main dekh kar sar chakraya,

"Akshay Kumar" ji "Firozshah Kotla" main Rassi par Fisle,

Devdas "Shahrukh khan" bhi aakhirkar Bangali hi Nikle

 

Kis player pe dao lagaun main, bada Confusion hai bhai,

"Preity Zinta" ne Smile ke zarie "Yuvraj" se six lagayi,

Cheer Leader's ke kapdo ne kiya "Afridi" ko Distract,

Hasina dekh kar bhul gaye wo "Murlitharan" ka spin attack

 

Iska bhi samjh nahi aata ki aakhir public hai kis oor,

Local team ke harne par bhi machate hain khoob shor,

Kisi ko bhi pata nahi kaun hai is team ka khiladi,

"Katrina Kaif" dekhne aayi hai Banglore ki junta saari

 

"Harbhajan" ne josh main aakar "Srishanth" ko diya chanta,

"Lalit Modi" ne "Preity" impression ke liye "Bhajji" ko danta,

Match ke beach main "Eden Gardens" ki lights ho gaye Gull,

Actually ticket bechte "Shahrukh" gaye the bulbs check karna bhul

 

"Lalit Modi" ne kaha "Kapil" ki ICL hai Paise kamane ka zariya,

Jabki BCCI ki IPL to sirf hai ek Promotion of Cricket badhiya,

"Mukesh Ambani" ki "Mumbai Indians" hi hai ek team Hindustani,

Jaise baaki sab franchizy teams hain Chini, Japani ya Pakistani

 

Kya ajeeb circus hai yeh, kya hai yeh Tamasha

Foreign players par hi hai kyon tiki sabki asha,

Indian players kab IPL main apna khel dikhyenge,

Kab Dada aur Dravid bhi T20 main century banenge

 

Kab aenge "Sachin" apni Mumbai team ko bachane,

Kab honge "Laxman" Hyderabad ke captain sayane,

Kab hogi Janta ke dilon main teams ke prati loyalty,

Kab hum "Match Fixers" kharid payenge Players ki Royalty


Thursday, February 21, 2008

.Net Comparison Chart (.Net vs Coldfusion, PHP, JAVA)

.Net Analysis

Judging the value of one development platform over another is a heated debate that has been raging for years.  The most common deciding factor typically centers on the developer's familiarity, an extremely subjective measurement.  If an expert developer from each platform was asked which is the easiest to use, each would site his or her own.  In the end, however, there are really only two quantifiable factors that should be used when deciding on a platform: cost and performance.


Since most hosting plans for each platform are similar in cost, website performance and lines of code (a hidden cost) are the only quantifiable measurements than can be used to gauge the value of one development language over another.  The following information provides a breakdown of some of the key differences between .Net, Java, Cold Fusion MX and PHP. 


In terms of website performance, which refers to how fast a page can be displayed to a user, .Net has proven to be far superior to Cold Fusion MX, PHP and Java in real-world applications and in tests conducted by independent analysis firms.  With respect to lines of code, a similar application can be written in .Net with 15% of the code required for the same application written in Java.  This results in a more maintainable system that can be developed more quickly with fewer resources.  A "lines of code" comparison between .Net and Cold Fusion MX or PHP is difficult since the development methodologies are so drastically different.  In order to achieve the same type of coding methodology, a developer would need to implement Java, which would lump the "lines of code" results in with the Java analysis already mentioned.  In general, Java is not used due to cost and time considerations, so the website pages load more slowly and the code is more difficult to maintain.


In general, .Net brings the power of an enterprise application into the cost range of a small and medium sized business by reducing the lines of code required.  This reduction in code results in decreased development time, expensive development staff, maintenance and overall cost, while delivering superior website performance.

 

Feature

.Net

Java

Cold Fusion MX

PHP

Compiled Code – Increases website speed (precompiled is the fastest)

Yes – both precompiled and dynamically compiled when a page is requested

Yes – both precompiled and dynamically compiled when a page is requested

Yes – dynamically compiled when a page is requested

No – a 3rd party accelerator can be used to increase performance but it is not installed on most shared hosting servers.

Scripted Language – results in poor website performance

No

No

Somewhat

Yes – a 3rd party accelerator can be used to increase performance but it is not installed on most shared hosting servers.

Object Oriented – Increases the ability for code reuse and provides enhanced features as well as reduced development time; since code is more reusable, results in fewer bugs that can be discovered by any client and fixed for everyone; encourages developers to write more maintainable code.

Yes

Yes

Somewhat

No

Supported Development Languages – easier to find developers

C++, C#, Visual Basic.NET, Jscript.NET, Python, Perl, Java (J#), COBOL, Eiffel, Delphi – 25 languages supported currently

Java

CFML and CFScript

PHP

Browser Specific HTML Rendering – different HTML is automatically sent to IE than to Netscape, reducing incompatibility issues

Yes

No

No

No

Open Source

No

Yes

Somewhat

Yes

Real World Examples:

ComputerJobs.com

ComputerJobs.com converted from Cold Fusion to .Net and saw a 400% improvement in server efficiency.  They predicted that they would save over $100K in the following year due to reduced hardware.

Sun Microsystems' Java Pet Store J2EE BluePrint Application

A team of 2 developers rebuilt the "Sun Microsystems' Java Pet Store J2EE BluePrint Application" using .Net in 4 weeks with 25% of the code.  When tested in a lab, the .Net application ran %1000 faster than a tuned version of the Java application.  The same Pet Store application was rebuilt by both Microsoft and Sun for an independent competition sponsored by The Middleware Company.   Below is a comparison of the results:


.Net 1.1/Windows 2003

J2EE/Windows 2000

Lines of Code

2,096

14,004

Time required for tuning and optimization prior to performance test

2 man-weeks

10 man-weeks

Price/Performance Ratio – the cost per server divided by the maximum transactions per second the server could handle

$316 – in other words, for a Java application to handle the same amount of website traffic as a .Net application, and additional $989 would need to be spent on server hardware.

$1,305

Maximum Pages served per Second

1,400

600

Maximum Number of Concurrent Users

6,000

4,000

Maximum Number of Transactions per Second

117

59

Test Notes: Each application was executed on identical Compaq Proliant servers; J2EE was tested on two Application Servers, one of which crashed midway and did not complete the test; J2EE used an Oracle 9i database while .Net used a SQL Server 2000 database; J2EE ran on Windows 2000 because it outperformed RedHat Linux 7.2 in a trial test.  For the complete study, visit: http://www.msakademik.net/download/j2eedotnetbenchmark.pdf   

The Nile Benchmark

The Nile Benchmark is a complete end-to-end ecommerce application server benchmark that has been widely used by independent testing laboratories including Doculabs, eWeek®, and PC Magazine® to benchmark application server products.    The Nile application is a useful benchmark because it is simple and straightforward, yet exercises the common elements found in most real Web applications.  The benchmark shows that the Nile application implemented using Microsoft ASP.NET outperforms the same application implemented using EJBs on a leading J2EE application server by 345% on an 8 CPU system when output caching is enabled for both products. It also shows that the Microsoft.NET version of Nile outperforms the EJB version of Nile on an 8 CPU system by over 421% when output caching is not used.  

.Net References:

  1. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/coldfusiontoaspnet.asp
  2. http://www.sitepoint.com/article.php/870
  3. http://www.sitepoint.com/article/871
  4. http://www.msdnaa.net/Resources/display.aspx?ResID=2315
  5. http://www.microsoft.com/resources/casestudies/CaseStudy.asp?CaseStudyID=13392
  6. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/psimp.asp
  7. http://gotdotnet.com/team/compare/nileperf.aspx
  8. http://gotdotnet.com/team/compare/Nile%20Benchmark%20Results.doc
  9. http://www.middleware-company.com/documents/j2eedotnetbenchmark.pdf
  10. http://gotdotnet.com/team/compare/middleware.aspx

Friday, May 25, 2007

Resume Tips for Technology Professionals




With increasing numbers of job seekers competing for the most desirable technical jobs, your resume needs to be better than the rest to get noticed.


Technical Summary

Effective technical resumes clearly show the candidate's technical skills -- a hiring manager shouldn't have to go fishing for this information. An excellent way to include technical knowledge is to add a Technical Summary or Technical Expertise section to your resume. Break the section into subcategories so the reader can quickly scan through your knowledge of programs and applications. Possible categories include technical certifications, hardware, operating systems, networking/protocols, office productivity, programming/languages, Web applications and database applications. Only list programs/applications that you could confidently discuss in an interview.


Career Summary

Many hiring managers say they are searching for candidates who offer more than technical credentials. Soft skills such as interpersonal communications, ability to work collaboratively and commitment to achieving corporate goals are just as desirable. In other words, your resume needs a personality. The reader shouldn't only be impressed by your technical qualifications, but should find you to be likeable and well suited for the team. You can highlight some of these skills in a Career Summary section.


Focus on Technological Results

Technical candidates usually make one of two critical errors on their resumes -- either the document is excessively long with excruciating detail on every assignment ever completed, or too short with hardly any descriptions at all. There needs to be some middle ground -- the resume should be succinct yet effectively showcase your achievements.


What to Include

For each position held, give a brief synopsis of the scope of your responsibility. Then show how your performance benefited the company. Give examples of how past initiatives led to positive outcomes such as enhanced efficiency, faster time-to-market, monetary savings, etc.

Accomplishments are most powerful when they are measurable, so include actual performance figures whenever possible. Focus on your most impressive technical projects/accomplishments. What types of challenges did you face? What did you do to overcome the challenges? How did your performance improve the organization's bottom line?

For contract work, provide a bulleted list of your top projects, indicating the company (or type of company if confidential), reason for hiring you, scope of your project, your specific approach to the project, challenges/obstacles faced, work performed and benefits to the company.

If you are new to the field and concerned about a lack of experience, consider offering free or low-cost technical services to charitable organizations, friends, family or local businesses. This allows you to hone your craft and show related work or volunteer experience on your resume. Also, pursue as much training as possible to get up to speed. Entry-level candidates should focus on their potential in the field, ability to quickly learn challenging concepts and motivation to succeed in the industry.


Keywords

The best keywords for your resume depend on your job target and experience. Specific programs and applications are often used as keywords, which is another reason why a Technical Summary is a good idea. To determine the best keywords for your industry, examine job postings on Monster and see which credentials and skills are used frequently; these are potential keywords that should be incorporated into your resume.