google

Newest Post

Custom UIPickerView for iPhone - displaying multiple columns in the picker view

| Tuesday, December 31, 2013
Read more »
This article demonstrates the custom picker view for iPhone using the UIPickerView class. This application's main view controller contains a button, a label and a picker view control.
  1. Picker view control will have 5 columns which will be added programmatically and each column can contain n number of images. 
  2. Button is used to rotate the images in the columns of the picker view.
  3. Label is used to display result when any 3 consecutive columns have same image value.
Create a new Xcode project using Single View Application template and place the above controls in the view controller. Add picker view delegate, datasource, other actions and outlets for the controls in the header file.

The ViewController.h file should look like this.

@interface ViewController : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate>
{
    
    IBOutlet UIPickerView *pickerView;
    IBOutlet UILabel *lblWinner;
    IBOutlet UIButton *rotateButtonRef;
    
    NSArray *column1;
  NSArray *column2;
  NSArray *column3;
  NSArray *column4;
  NSArray *column5;
    
}

- (IBAction)btnRotate:(id)sender;

@property(nonatomic, retain) UIPickerView *pickerView;
@property(nonatomic, retain) NSArray *column1;
@property(nonatomic, retain) NSArray *column2;
@property(nonatomic, retain) NSArray *column3;
@property(nonatomic, retain) NSArray *column4;
@property(nonatomic, retain) NSArray *column5;
@property(nonatomic, retain) UILabel *lblWinner;
@property(nonatomic, retain) UIButton *rotateButtonRef;


The NSArray declared above will be used to hold the images for each column of the picker view.

Synthesize all the above properties in the implementation file.
@implementation ViewController
@synthesize pickerView,column1,column2,column3,column4,column5, rotateButtonRef,lblWinner;

Add images to the column arrays in the viewDidLoad as follows

UIImage *one = [UIImage imageNamed:@"one.png"];
UIImage *two = [UIImage imageNamed:@"two.png"];
UIImage *three = [UIImage imageNamed:@"three.png"];
UIImage *four = [UIImage imageNamed:@"four.png"];
UIImage *five = [UIImage imageNamed:@"five.png"];
UIImage *six = [UIImage imageNamed:@"six.png"];
UIImage *seven = [UIImage imageNamed:@"seven.png"];
UIImage *ten  = [UIImage imageNamed:@"ten.png"];
    
    
for (int i = 1; i <= 5; i++)
{
UIImageView *oneView = [[UIImageView alloc] initWithImage:one];
UIImageView *twoView = [[UIImageView alloc] initWithImage:two];
UIImageView *threeView = [[UIImageView alloc] initWithImage:three];
UIImageView *fourView = [[UIImageView alloc] initWithImage:four];
UIImageView *fiveView = [[UIImageView alloc] initWithImage:five];
UIImageView *sixView = [[UIImageView alloc] initWithImage:six];
UIImageView *sevenView = [[UIImageView alloc] initWithImage:seven];
UIImageView *tenView = [[UIImageView alloc] initWithImage:ten];
        NSArray *imageViewArray = [[NSArray alloc] initWithObjects: oneView, twoView, threeView, fourView, fiveView, sixView, sevenView, tenView, nil];
NSString *fieldName = [[NSString alloc] initWithFormat:@"column%d", i];
[self setValue:imageViewArray forKey:fieldName];
}
// Seed the random number generator
srandom(time(NULL));

Rotate button action will check for the win-win condition every time its clicked, if condition is true, then win message is displayed otherwise button can be clicked till the condition is true.

- (IBAction)btnRotate:(id)sender {
    BOOL win = NO;
int numInRow = 1;
int lastValue = -1;
for (int i = 0; i < 5; i++)
{
int newValue = random() % [self.column1 count];
if (newValue == lastValue)
numInRow++;
else
numInRow = 1;
lastValue = newValue;
[pickerView selectRow:newValue inComponent:i animated:YES];
[pickerView reloadComponent:i];
if (numInRow >= 3)
win = YES;
}
rotateButtonRef.hidden = YES;
if (win)
[self performSelector:@selector(winMsg) withObject:nil afterDelay:0.5];
else
[self performSelector:@selector(displayButton) withObject:nil afterDelay:0.5];
lblWinner.text = @"";
}


Two methods displayButton , winMsg have been used to handle the display of button and winner message


-(void)displayButton
{
rotateButtonRef.hidden = NO;
}

-(void)winMsg
{
lblWinner.text = @"Bingo!!! you have won!!";
[self performSelector:@selector(showButton) withObject:nil afterDelay:60.0];
}

Implement the picker view delegate methods to display the images in the picker view.

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 5;
}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
return [self.column1 count];
}
#pragma mark Picker Delegate Methods

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
if (component == 0)
return [self.column1 objectAtIndex:row];
else if (component == 1)
return [self.column2 objectAtIndex:row];
else if (component == 2)
return [self.column3 objectAtIndex:row];
else if (component == 3)
return [self.column4 objectAtIndex:row];
return [self.column5 objectAtIndex:row];
}

Build and run.

The output should look like this.


























After rotating it could look like this.


























And hence the winner
























Thanks! your feedback is most valuable!


Custom UIPickerView for iPhone - displaying multiple columns in the picker view

Posted by : Stranger
Date :Tuesday, December 31, 2013
With 3comments
Tag :

Windows 8 keyboard shortcuts

| Friday, August 9, 2013
Read more »
These Windows 8 keyboard shortcuts will help you get up to speed if you don't have a touchscreen
Although most people would argue Windows 8 is best appreciated via a touchscreen, that's not an option for those with older PCs or laptops. You can still benefit from the speed of Windows 8's shortcuts, though - just using your keyboard instead.

Most of these shortcuts use the Windows key - that's the one with the Windows logo, usually located to the left or right of the spacebar.

Charms and menus:
Windows + C: Charms
Windows + H: Share
Windows + I: Settings
Windows + K: Devices
Windows + P: Second screen
Windows + X: Admin menu

Search:
Windows + Q: Apps Search screen
Windows + F: Files Search screen
Windows + W: Settings Search screen

Layout:
Windows + . : Split to the right
Windows + Shift + . : Split to the left
Windows + O: Lockscreen orientation

Start screen:
Windows + Z: App options
PageUp/PageDown/mouse wheel: Scroll Start screen
Ctrl + mouse wheel: Semantic zoom

Windows 8 keyboard shortcuts

Posted by : Stranger
Date :Friday, August 9, 2013
With 0comments

Earth Day 2013: Google doodles ‘change of seasons’

| Monday, April 22, 2013
Read more »

Earth Day 2013: Google doodles ‘change of seasons’

Posted by : Stranger
Date :Monday, April 22, 2013
With 0comments

Crunched For Time: 8 Time-Saving Tips For Your Job Search

| Monday, April 8, 2013
Read more »

Crunched For Time: 8 Time-Saving Tips For Your Job Search

Posted by : Stranger
Date :Monday, April 8, 2013
With 0comments

BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

| Friday, April 5, 2013
Read more »
BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

Features

Here's a short list of all the features of BlogEngine.NET
 
Plug ’n play
BlogEngine.NET is very easy to setup and customize. To make it work, just upload the files to an ASP.NET 4.0 webserver and you’re ready to start writing. No database configuration, just plug ‘n play.

Full featured
BlogEngine.NET comes with all the features you would expect from a modern blog engine as well as new unique features such as AJAX comments and screenshot trackbacks.

Web 2.0
BlogEngine.NET features social bookmarks, OpenSearch support, XFN tags, AJAX, FOAF, SIOC, APML, Gravatars, coComments, tag cloud, Google sitemap and other so called Web 2.0 features.

Referrer stats
The referrer statistics enables you to see which websites link to you, so you can follow up with comments or just to have fun. This feature is a real time killer that you cannot live without.
 
Cool widgets
There is a variety of cool widgets that such as an AJAX post calendar or a blogroll that automatically retrieves the latest posts from each blog and displays the title beneath the blog. Most of the controls are configurable from the admin section.

Advanced comment system
Comments are a very important part of a blog, so BlogEngine.NET features a very advanced commenting system in AJAX that supports country flags, live preview, Gravatars, coComments – all of which can easily be modified in the admin section.

Full syndication suite
BlogEngine.NET supports syndication feeds in any possible location. You can find feeds on comments, categories, authors and a main feed. Both RSS 2.0 and ATOM 1.0 are fully supported.
 
Trackbacks and pingbacks
All outgoing links from the posts is tracked- and pinged back, so your blog will get listed in the comments on the linked website if it supports it. When a new post is created, BlogEngine.NET automatically pings Technorati, Feedburner, Ping-o-Matic etc.
 
Search
The search capability of BlogEngine.NET is one of the most advanced and it even allows the visitors to search in the comments. Everything about the search can be configured in the admin section.

Standalone pages
Besides regular blog posts, BlogEngine.NET supports the creation of static pages that exist outside the blog chronology. Pages are useful for all kinds of information about you or your blog.
Multi-author support 
Multi-author support
BlogEngine.NET fully supports multiple authors to write posts on the same blog. Visitors are then able to subscribe to the individual author’s RSS feed or view only the posts from their favourite author.

Cool themes
BlogEngine.NET comes with some very cool themes for you to choose from. If you want to modify or create a new theme you can do so easily with just a basic understanding of HTML and CSS.
 
XHTML compliance
All the controls in BlogEngine.NET are 100% XHTML 1.0 compliant. All posts you write automatically become compliant thanks to the tinyMCE text editor.

Extendable
BlogEngine.NET is built from the ground up using nothing but C# and ASP.NET 4.0 all with simplicity in mind. It means that you can write new controls and themes by using the skills you already have as a .NET developer.

BlogEngine.NET - An innovative open source blogging platform developed with ASP.NET

Posted by : Stranger
Date :Friday, April 5, 2013
With 0comments

How to use ASP.NET Custom Validator on client side

|
Read more »
Knowledge Bank: ASP.NET Custom Validator: Asp.Net Custom validator allows us to validate the controls on page on client side as well as server side, But mainly the validation is done...

How to use ASP.NET Custom Validator on client side

Posted by : Stranger
Date :
With 0comments
Tag :

Introduction to iOS SDK

| Thursday, April 4, 2013
Read more »
The iOS SDK contains the tools and resources to develop native iOS applications, which means that the SDK allows developers to develop, install, run, and test applications in the iOS Simulator and on physical devices.

The two driving forces powering native iOS applications are Objective-C and the native iOS system frameworks.This article includes high level frameworks, such as the UIKit and Map Kit frameworks, but also frameworks that are closely tied to the hardware, such as the Accelerate and Core Location frameworks.

native iOS application
An iOS application is a Cocoa application developed for the iOS platform and a Cocoa application as an application that is
  • Composed of objects that ultimately inherit from NSObject, a root class declared in the Foundation framework.
  • Based upon the Objective-C runtime.
The iOS Architecture



Native applications interact directly with the iOS operating system and the native iOS system frameworks. The operating system acts as a mediator between the application and the underlying hardware. A key advantage of this mediation or abstraction is that native applications don’t need to worry about future hardware changes or device specifications.

The iOS architecture can be broken down into four distinct layers
  1. Cocoa Touch
  2. Media 
  3. Core Services
  4. Core OS 
This layered architecture illustrates that level of abstraction, with the higher level layers more abstracted and the lower level layers more fundamental and closely tied to the hardware. It goes without saying that the higher level layers rely on the lower level layers for some of their functionality.


Cocoa Touch Layer
The Cocoa Touch layer is the topmost layer of the iOS architecture. It contains some of the key frameworks which native iOS applications rely upon, with the most prominent being the UIKit framework. The Cocoa Touch layer defines the basic application infrastructure and provides a number of vital technologies, such as multitasking and touch-based input.

The Cocoa Touch layer provides developers with a large number of high level features, such as auto layout, printing, gesture recognizers, and document support. In addition to the UIKit framework, it contains the Map Kit, Event Kit, and Message UI frameworks, among others.

Media Layer
Graphics, audio, and video are handled by the Media layer. This layer contains a number of key technologies, such as Core Graphics, OpenGL ES and OpenAL, AV Foundation, and Core Media. The Media layer contains a large number of frameworks including the Assets Library framework to access a device’s photos and videos, the Core Image framework for image manipulation through filters, and the Core Graphics framework for 2D drawing.

Core Services layer
The Core Services layer is in charge of managing the fundamental system services that native iOS applications use. The Cocoa Touch layer relies heavily on the Core Services layer for some of its functionality. The Core Services layer also provides a number of indispensable features, such as block objects, Grand Central Dispatch, In-App Purchase, and iCloud Storage.

Core services layer includes ARC(Automatic Reference Counting), Foundation frameworks and Core Foundation framework.

Core OS Layer
Most of the functionality provided by the three higher level layers is built upon the Core OS layer and its low level features. The Core OS layer provides a handful of frameworks that your application can use directly, such as the Accelerate and the Security frameworks. The Core OS layer also encapsulates the kernel environment and low level UNIX interfaces to which your application has no access for obvious security reasons. However, through the libSystem library, which is C-based, many low level features can be accessed directly, such as BSD sockets, POSIX threads, and DNS services.

Introduction to iOS SDK

Posted by : Stranger
Date :Thursday, April 4, 2013
With 0comments
Tag :

JOBS vs RITCHIE

| Monday, April 1, 2013
Read more »




JOBS vs RITCHIE

Posted by : Stranger
Date :Monday, April 1, 2013
With 0comments

Free Microsoft .net Technology Online Training: How it works for Trainers?

| Thursday, March 21, 2013
Read more »

Free Microsoft .net Technology Online Training: How it works for Trainers?

Posted by : Stranger
Date :Thursday, March 21, 2013
With 0comments

Web response to display data from another website

| Wednesday, March 20, 2013
Read more »
Data from another website can be displayed in our own website using simple "WebRequest" and "WebResponse".WebRequest uses URL of the another website which can be passed hard coded or dynamically.

Add a Label control on the webpage.

 <asp:Content ID="Content2" ContentPlaceHolderID="generalContent" runat="Server">  
   <asp:Label ID="lblDisplay" runat="server">   
   </asp:Label>  
 </asp:Content>  

Add following code in Page_Load or any other event like button click etc.

 WebRequest wReq = WebRequest.Create("https://www.youtube.com/watch?v=CGu8W4cFlUw");  
       WebResponse mRes = wReq.GetResponse();  
       StreamReader sr = new StreamReader(mRes.GetResponseStream());  
       string sHTML = sr.ReadToEnd();  
       sr.Close();  
       mRes.Close();  
       if (sHTML != string.Empty && sHTML != null)  
       {  
         lblDisplay.Text = sHTML;  
       }  

Add required namespaces in the cs file

 using System;  
 using System.Collections.Generic;  
 using System.IO;  
 using System.Linq;  
 using System.Net;  
 using System.Web;  
 using System.Web.UI;  
 using System.Web.UI.WebControls;  

and That's it.

Enjoy!!!

The output in the browser will be


Web response to display data from another website

Posted by : Stranger
Date :Wednesday, March 20, 2013
With 1 comments:
Tag : ,

LINQ Tutorial-Adding, Updating and Deleting Data

| Monday, March 11, 2013
Read more »

LINQ Tutorial-Adding, Updating and Deleting Data

Posted by : Stranger
Date :Monday, March 11, 2013
With 3comments
Tag :

Integrate Linked In JavaScript API with ASP.NET

|
Read more »
This page on Linked - In developer website explains the method to integrate JavaScript API with ASP.NET.
There are various ways Linked-In can be integrated in an ASP.NET website. I will explain the JavaScript API integration in this article.

Following are the steps of the Linked-In JS API integration.

1. Register yourself as developer on the linked-in website.
2. Create a new application or use an existing one. API Key and Secret Key of the application will be used for this integration.
3. Most Important - Make sure to specify the domain or list of domains for which above API key will be used, in "JavaScript API Domains" as in this screenshot:

JavaScript API Domains
4.Add following script in the <head> section of the html or aspx page to access the Linked-In API framework.
 <script type="text/javascript" src="http://platform.linkedin.com/in.js">  
  api_key: your_api_key_goes_here  
 </script>  

5. Add the following HTML to the body of your document to display the Linked-In Sign In button.
 <script type="in/Login">  
 </script>  



6. On clicking the above button, it should popup an authorization window asking you to Sign In to LinkedIn and grant API permission to your application. By default this pop up will ask for "Basic Profile Permissions" only.
Sign In and grant API permission
7. Test the page by reloading the page a few times. Notice that the login button reappears every time, even though you have already logged into the app and granted permission.Configure the authorize parameter in the framework script tag:
 <script type="text/javascript" src="http://platform.linkedin.com/in.js">  
  api_key: your_api_key_goes_here   
  authorize: true  
 </script>  

So far we have done integrating the LinkedIn Sign In and API permissions. In the next part I will explain how to display the details from the LinkedIn Profile.

LinkedIn JavaScript API uses REST services as back end. Lets rewrite the code above.

1. Introduce two parameters while importing the JS API framework.
 <script type="text/javascript" src="http://platform.linkedin.com/in.js">  
     api_key: your api key  
     onLoad: onLinkedInLoad  
     authorize: true  
   </script>  

The onLoad parameter tells the framework to wait until it's finished loading and then invoke a JavaScript function of your choosing. In this example, the function's name is onLinkedInLoad.
As discussed previously, setting authorize to true automatically authenticates any viewers who have previously granted your site permission using the JavaScript API.

2.The IN Object- The IN object is your way to hook into the LinkedIn JavaScript API. It's what the framework script tag inserts into the page. All the JavaScript API functions will begin with IN..
 function onLinkedInLoad() {  
       IN.Event.on(IN, "auth", onLinkedInAuth);  
     }  

In.Events. Events listen for activities, and run code when they happen. This line says to listen for the auth event, which triggers when someone signs in, and execute the onLinkedInAuth() function afterwards. Events are covered in more detail in the JavaScript API Reference.

3. Add the following HTML to the body of your document to display the Linked-In Sign In button.
 <script type="in/Login">  
 </script>  




4. Fetching profile information
 function onLinkedInAuth() {  
       IN.API.Profile("me")  
       .result(displayProfiles);  
     }  

The first part, IN.API.Profile("me"), makes a request to the LinkedIn API servers for the profile belonging to the signed-in user. The keyword "me" is a special short-hand way of referring to the signed-in member.
After it successfully retrieves data, the JavaScript framework sends the information to a callback function you specify in the result() method. In this case, it's a reference to the displayProfiles() function which we'll define below.
The In.API.Profile() method supports three of ways to identify a member: "me", member ids (like 4KoRHzE6GO), and public profile URLs.

5. Add controls in the body of the page to display profile details.
 Hello  
   <asp:Label ID='lblName' runat="server"></asp:Label>  

6. Results from the Profile API come grouped under one parameter.The displayProfiles() function receives a parameter which is the complete JSON-formatted result of the underlying call. By default the data is always in a values array. Since this is the Profile API call, values contains profile data. In this case, there's only one profile for the signed-in member, me, so it's in values[0]. The fields and field names returned for a profile are : id, firstName, lastName, headline, and pictureUrl.

 function displayProfiles(profiles) {  
     member = profiles.values[0];  
      document.getElementById("lblName").innerHTML = member.firstName + " " + member.lastName;  
 }  

7. To fetch additional profile details, fields() method can be used. Change the "onLinkedInAuth" method to include fields() method.

 function onLinkedInAuth() {  
       IN.API.Profile("me")  
       .fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary")  
       .result(displayProfiles);  
     }  

8. Change the "displayProfiles" method as follows and add additional control in the body of the page to display more details.

 function displayProfiles(profiles) {  
       member = profiles.values[0];  
       alert(JSON.stringify(member));  
       member.lastName + "<br/> Location is " + member.location.name + " </p>";  
       document.getElementById("lblName").innerHTML = member.firstName + " " + member.lastName;  
       document.getElementById("imgProfile").src = member.pictureUrl;  
       document.getElementById("lblSummary").innerHTML = "<pre>" + member.summary + "</pre>";  
       document.getElementById("lblIndustry").innerHTML = member.industry;  
 }  

Please note
 alert(JSON.stringify(member)); 

This will display the JSON string returned by the LinkedIn API call.

LinkedIn contains many other useful resources beyond member profiles. The JavaScript API allows you access to every part of LinkedIn exposed through REST APIs. For a complete list read out REST APIs documentation.
The commonly used resources have high-level wrapper classes to help you access them (IN.API.Profile is one such wrapper). Currently, these are:
  • IN.API.Connections
  • IN.API.MemberUpdates
  • IN.API.NetworkUpdates
  • IN.API.PeopleSearch
  • IN.API.Profile
9. Handling errors:  The JavaScript API will inspect the REST response on your behalf and if an error occurred (the API returns an HTTP non-200 status code), the framework will notify you. You can specify a special error handler for using the optional error() method:

 function onLinkedInAuth() {  
       IN.API.Profile("me")  
       .fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline")  
       .result(displayProfiles)  
       .error(displayProfilesErrors);  
     }  

Add a div in the body to display the errors.

 <div id="profiles">  
   </div>  

Display error message in the above div as follows:

 function displayProfilesErrors(error) {  
       profilesDiv = document.getElementById("profiles");  
       profilesDiv.innerHTML = error.message;  
       console.log(error);  
     }  

LinkedIn Members publish a variety of information about themselves on their member profile. Check out the link to view list of Profile Fields.

By default the API call processes "BasicPofile" permissions vide r_basicprofile.

To access email address fields, API requires r_emailaddress member permission.
To access profile related fields which are not covered under basic profile permissions like three-current-positions, date-of-birth etc, the API request requires r_fullprofile member permission.
To access contact information fields, API requires r_contactinfo member permission.
To access connection fields, API requires r_networkmember permission.
To access group membership fields, API requires rw_groupsmember permission.
To access network update fields, API requires rw_nusmember permission.

Scope parameter is added in the framework request to access fields other than basic profile.

 <script type="text/javascript" src="http://platform.linkedin.com/in.js">  
     api_key: your api key  
     scope: r_basicprofile r_emailaddress r_fullprofile  
     onLoad: onLinkedInLoad  
     authorize: true  
   </script>  

All basic, email and full profile fields can be accessed with above permissions.

 function onLinkedInAuth() {  
       IN.API.Profile("me")  
       .fields("firstName", "lastName", "industry", "location:(name)", "picture-url", "headline", "summary", "num-connections", "public-profile-url", "distance", "positions", "email-address", "educations", "date-of-birth")  
       .result(displayProfiles)  
       .error(displayProfilesErrors);  
     }  


Leave comments if anything in above code doesn't work. I have working code with me. Drop me your email id to get same.


Reference Links

Integrate Linked In JavaScript API with ASP.NET

Posted by : Stranger
Date :
With 9comments

Facebook Messenger App is Updated With Improvements to Group Conversations.

| Thursday, March 7, 2013
Read more »
Facebook Messenger for iPhone has been updated with improvements to group conversations.

Text your friends for free. Get Facebook Messenger to instantly reach friends on their smart phones, feature phones or desktop computers.

Features:
- Chat with a group
- Send voice messages, photos, smileys and other emoji
- Get push notifications
- Know who’s seen your messages
- Include your location

What's New In This Version:
Updates to group conversations
- Name a group right from the top of your conversation
- Get to your group conversations in one tap – just swipe left to see them in your sidebar
- Search for group conversations by name or look them up by friends in the group
- Other improvements and bug fixes

You can download Facebook Messenger from the App Store for free.

Facebook Messenger App is Updated With Improvements to Group Conversations.

Posted by : Stranger
Date :Thursday, March 7, 2013
With 0comments
Tag :

Architecture of .Net Framework

| Saturday, March 2, 2013
Read more »
The .Net Framework is an inbuilt windows component that supports Building and running the next generation of application xml web services. The .Net Framework has been developed to cater to the following objectives and Requirements:
  • To provide a consistent object-oriented environment to develop applications;
  • To provide a code execution environment that simplifies deployment and versioning;
  • To provide a code execution that eliminates the issues faced by scripted environments with respect to performance.
  • To provide a common programming model where the choice of a programming
  • Language becomes a matter of choice.
The .Net framework is made up of two components- Common Language Runtime (CLR) and the .Net Framework Class Library (FCL).The CLR is the basic for the .Net Framework and provides various services that application can use. It also forms the environment that other application run on.

The runtime is supposed to be an agent that manages code at execution time, providing core services, such as memory management, thread management, and remoteing. It also encourages security and robustness by implementing safety and other type of code accuracy. Since code management is a basic principal of the runtime is known as unmanaged code. The .Net framework consists of web Forms, Windows Forms and console applications the pertain to the presentation layer of an application.
  • Web forms are used in web-based application whereas windows forms are used in windows based application.
  • You can create a character-based console application that can be executed from the command line.
  • .Net Framework consists of two other component the .Net Framework Base classes the CLR.

Common Language Runtime
  • The Common Language Runtime (CLR) is a core component of Microsoft's .NET initiative. It is Microsoft's implementation of the Common Language Infrastructure (CLI) standard, which defines an execution environment for program code. In the CLR, code is expressed in a form of bytecode called the Common Intermediate Language (CIL, previously known as MSIL—Microsoft Intermediate Language).
  • Developers using the CLR write code in a language such as C# or VB.NET. At compile time, a .NET compiler converts such code into CIL code. At runtime, the CLR's just-in-time compiler converts the CIL code into code native to the operating system. Alternatively, the CIL code can be compiled to native code in a separate step prior to runtime by using the Native Image Generator (NGEN). This speeds up all later runs of the software as the CIL-to-native compilation is no longer necessary.
  • Although some other implementations of the Common Language Infrastructure run on non-Windows operating systems, Microsoft's implementation runs only on Microsoft Windows operating systems.
Intermediate Language

In the .NET environment, a source code which is written in any one of the programming languages should be translated into a byte code format before its execution. This byte code format is called Common Intermediate Language(CIL) or Microsoft Intermediate Language (MSIL).
Common Intermediate Language:
  • Common Intermediate Language (CIL, pronounced either "sil" or "kil") (formerly called Microsoft Intermediate Language or MSIL) is the lowest-level human-readable programming language defined by the Common Language Infrastructure specification and used by the .NET Framework and Mono. Languages which target a CLI-compatible runtime environment compile to CIL, which is assembled into bytecode. CIL is an object-oriented assembly language, and is entirely stack-based. It is executed by a virtual machine.
  • CIL was originally known as Microsoft Intermediate Language (MSIL) during the beta releases of the .NET languages. Due to standardization of C# and the Common Language Infrastructure, the bytecode is now officially known as CIL. Because of this legacy, CIL is still frequently referred to as MSIL, especially by long-standing users of the .NET languages.
JIT Compilation
  • The high level programming languages that need to be compiled require a runtime, so that the architecture on which the language runs is provided with details on how to execute its code.
  • All the programming languages use its corresponding runtime to run the application.
  • For example, To run an application developed using Visual Basic, the computer on which the application will be run must be installed with the Visual Basic runtime. The Visual Basic runtime can run only the applications developed with Visual Basic and not the ones developed with any other programming language like Java.
  • In the .NET Framework, all the Microsoft .NET languages use a common language runtime, which solves the problem of installing separate runtime for each of the programming languages. Microsoft .NET Common Language Runtime installed on a computer can run any language that is Microsoft .NET compatible.
  • The main advantage of the .NET Framework is the interoperability between different languages. As all the Microsoft .NET languages share the same common runtime language, they all work well together. For example, you can use an object written in C# from Visual Basic.NET. The same applies for all the other Microsoft .NET languages.
  • When you compile a Microsoft.NET language, the complier generates code written in the Microsoft Intermediate Language (MSIL). MSIL is a set of instructions that can quickly be translated into native code.
  • A Microsoft.NET application can be run only after the MSIL code is translated into native machine code. In .NET Framework, the intermediate language is complied "just in time" (JIT) into native code when the application or component is run instead of compiling the application at development time. The Microsoft.NET runtime consists of two JIT compilers. They are standard JIT compiler and the EconoJIT compiler. The EconoJIT compiler compiles faster than the standard JIT compiler, but the code it produces is not as optimized as the code obtained from the standard JIT compiler.
Managed Code
The code whose execution is managed by the .Net Framework Common Language Runtime is known as Managed code. It refers to a contract of cooperation between natively executing code and the runtime.The process of compiling and executing managed code in given below.
  • Compile a programs developed in a language that targets the CLR, instead of compiling the source code into machine level code, the compiler translates it into Microsoft Intermediate language(MSIL) or Intermediate language (IL).No matter which lang has been used to develop the application , it always get translated into IL. This ensure languages interoperability.
  • In addition to translating the code into IL, the compiler also produce metadata about the program during the process of compilation. Meta data contains the description of the program
  • The IL and the metadata are linked in an assembly.
  • The compiler creates the .EXE or .DLL file.
  • Execute the .Exe or .DLL file, the code and all the other relevant information from the base class library is sent to the class loader. The class loader the code in the memory.
  • Before the code can be executed, the .Net framework needs to convert the IL into native or CPU-specific code. The Just-In-Time (JIT) compiler translator the code from IL into managed native code.
  • The CLR supplies a JIT compiler for each supported CPU architecture.
  • During JIT compilation, the code is also checked for type safety. Type safety ensures that objects are always accessed in a compatible way, you try to pass an 8-byte value to a method the accepts a 4-byte value as it parameter.
  • After translating the IL into native code, the converted code is sent to the .Net runtime manager.
  • The .Net runtime manager executes the code. While executing the code, security check the performed to ensure that the code has the appropriate permissions for accessing the available resources.

Metadata
  • Metadata is binary information describing your program that is stored either in a common language runtime portable executable (PE) file or in memory. When you compile your code into a PE file, metadata is inserted into one portion of the file, while your code is converted to Microsoft intermediate language (MSIL) and inserted into another portion of the file.
  • Every type and member defined and referenced in a module or assembly is described within metadata. When code is executed, the runtime loads metadata into memory and references it to discover information about your code's classes, members, inheritance, and so on.
Benefits of metadata:

     Metadata is the key to a simpler programming model, eliminating the need for Interface Definition Language (IDL) files, header files, or any external method of component reference. Metadata allows .NET languages to describe themselves automatically in a language-neutral manner, unseen by both the developer and the user. Additionally, metadata is extensible through the use of attributes. Metadata provides the following major benefits:



Self-describing files:

  • Common language runtime modules and assemblies are self-describing. A module's metadata contains everything needed to interact with another module.
  • Metadata automatically provides the functionality of IDL in COM, allowing you to use one file for both definition and implementation. Runtime modules and assemblies do not even require registration with the operating system.
  • As a result, the descriptions used by the runtime always reflect the actual code in your compiled file, which increases application reliability.
Language Interoperability and easier component-based design:

  • Metadata provides all the information required about compiled code for you to inherit a class from a PE file written in a different language.
  • You can create an instance of any class written in any managed language (any language that targets the common language runtime) without worrying about explicit marshaling or using custom interoperability code.
Attributes:

  • The .NET Framework allows you to declare specific kinds of metadata, called attributes, in your compiled file. Attributes can be found throughout the .NET Framework and are used to control in more detail how your program behaves at run time.
  • Additionally, you can emit your own custom metadata into .NET Framework files through user-defined custom attributes. For more information, see Extending Metadata Using Attributes.
Metadata Tools:
Several tools are used to handle metadata.
  • Reflection is a tool which is used to handle metadata.
  • Third party tools (Ex : Post sharp, Mono ceil) are used to retrieve and manipulate metadata.
  • Manifest is a text file that contains metadata about .NET assemblies.
Automatic Memory Management

Automatic memory management is one of the services that the common language runtime provides during Managed Execution. The common language runtime's garbage collector manages the allocation and release of memory for an application. For developers, this means that you do not have to write code to perform memory management tasks when you develop managed applications. Automatic memory management can eliminate common problems, such as forgetting to free an object and causing a memory leak, or attempting to access memory for an object that has already been freed. This section describes how the garbage collector allocates and releases memory.
  1. Allocating Memory
  2. Releasing Memory
  3. Generation and Performance
  4. Releasing memory for Unmanaged Resource

Architecture of .Net Framework

Posted by : Stranger
Date :Saturday, March 2, 2013
With 1 comments:
Tag : ,

Calculate Age from Date of Birth Using Java Script.

|
Read more »
Calculate Age from Date of Birth Using Java Script.: In my previous posts, I explained jQuey .toggleClass() Example in ASp.Net , jQuery Draggable Div Example in ASP.Net , Disable cut, copy and...

Calculate Age from Date of Birth Using Java Script.

Posted by : Stranger
Date :
With 0comments

Currency conversion using web service in Asp.Net

| Friday, March 1, 2013
Read more »
This article explains the conversion of currency with real time currency conversion rates. This is done using a web service which contains real time rates of conversion.

The web service being used is

 http://www.webservicex.net/CurrencyConvertor.asmx

Add following controls on the page
1. Dropdownlist for "From Currency"
2. Dropdownlist for "To Currency"
3. Textbox for "Value to be converted"
4. Textbox for "Result"



.Aspx page will have following code for the above controls:

 From Currency:&nbsp;  
     <asp:DropDownList ID="ddlFrom" runat="server" Width='205' DataSourceID='sqlDsCountries'  
       DataTextField='CountryName' DataValueField='CountryCode'>  
     </asp:DropDownList>  
     <br />  
     <br />  
     To Currency:&nbsp;  
     <asp:DropDownList ID="ddlTo" runat="server" Width='205' DataSourceID='sqlDsCountries'  
       DataTextField='CountryName' DataValueField='CountryCode'>  
     </asp:DropDownList>  
     <br />  
     <br />  
     Value to be converted:&nbsp;  
     <asp:TextBox ID="txtValue" runat="server" Width='200'></asp:TextBox><br />  
     <br />  
     Result:&nbsp;<asp:TextBox ID="txtResult" runat="server" Width='200'></asp:TextBox>  

Add a button in the aspx page to retrieve the results and write following code in the button click

       string Result = "";  
       string url="";   
       double value= Convert.ToDouble(txtValue.Text);   
       url = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + ddlFrom.SelectedValue + "&ToCurrency=" + ddlTo.SelectedValue + "";   
       HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);   
       HttpWebResponse response = (HttpWebResponse)request.GetResponse();   
       StreamReader Stream = new StreamReader(response.GetResponseStream());   
       XmlDocument doc = new XmlDocument();   
       Result = Stream.ReadToEnd();   
       doc.LoadXml(Result);   
       string CR = doc.GetElementsByTagName("double").Item(0).InnerText;   
       double rate= double.Parse(CR);   
       double result= value * rate;   
       txtResult.Text = Convert.ToString(result);  


Please share your comments and any queries.

Currency conversion using web service in Asp.Net

Posted by : Stranger
Date :Friday, March 1, 2013
With 2comments

Top HR Interview Question - Tell Me About Yourself??

| Thursday, February 28, 2013
Read more »
Do you know why this question is asked so often in most job interviews? This question is actually an ice-breaker. Asking this question starts the conversion. So you should better be ready with an answer. This question gives the interviewer a chance to know about the interviewee. Once you start talking about yourself, interviewer starts preparing his/her next question. So there are high chances that the next question that would be fired on you will be based on the answer of this question. As the answer for this will be based on you, you think and prepare it before the interview.

While preparing for the answer consider including following points.
1. You:
Tell them your name and which place you are from. Suppose you are “Mike Creamer”, then do not start with “Myself Mike Creamer”; start with “I am Mike Creamer”. This is a very common mistake. Not acceptable in interviews especially in call center jobs.
You may talk about your family (cover up in short); you may talk about your how you came to the city, etc.

2. Your education:
Tell them about your education i.e. graduation/post-graduation. If you are a fresher then tell them the grades you got. If you have done something different than others then tell them. It surely adds a value!

3. Your experience:
Talk about your whole experience. Start from early years and gradually come to recent years. If you have a long experience then you must not be doing same thing all years. Then exactly what you were doing? This is what your interviewer wants to listen. If you are a fresher then talk about your projects.

4. Your experience regarding to the post you has applied for:
This is of most interest to your interviewer. You may be having lot of experience but how much experience you have regarding current job post is very important. If you do not have it then you can talk about some related experience. Or if you do not have related experience too then say it clearly. Buy along with it give them confidence that you can do it and you have genuine interest to do it.

Fresh candidates who do not have any kind of experience, you should show some positive attitude and exhibit willingness to learn and do new things. Be ready to do new things. Don’t worry that you will make mistakes. Fresher candidates are expected to do mistakes and your employers are well aware of it so you don’t have any reason to be afraid. Believe me no one will give you more work than you can handle.



5. Do not describe your salary or pay scale at this point of time (unless explicitly asked).

6. Avoid giving unnecessary details. Value your interviewer’s time.

7. The idle answer should not last more than 1 minute.

Good luck.

Article from - http://careercounselings.net/top-hr-interview-question-tell-me-about-yourself/

Top HR Interview Question - Tell Me About Yourself??

Posted by : Stranger
Date :Thursday, February 28, 2013
With 0comments

Extending the Named and Optional Parameters

| Tuesday, February 26, 2013
Read more »
In Named and Optional Parameters, article illustrates about the named and optional parameters. In this article I am extending this article to differentiate between parameters ,arguments and more about optional parameters.

The parameter is a variable which is the part of the method, however argument is the variable which invoke in the place of parameter.

Arguments initialize parameters.


 public void Method(string parameter)  
 {   
   txtString.Text = parameter;  
 }  

When this method is called then argument is passed.

 Method(argument);  

Little bit more about the Optional Parameters

Optional parameters restrictions

  1. Ref or out modifiers not allowed.
  2. Paramsarray is not allowed as optional, and must be the last parameter.
  3. Optional parameters must be written after required parameters.
  4. Default value of optional parameter must be a Compile-time constant.

Extending the Named and Optional Parameters

Posted by : Stranger
Date :Tuesday, February 26, 2013
With 0comments
Tag :

Apple iOS development extended to Visual Studio

| Friday, February 22, 2013
Read more »

Apple iOS development extended to Visual Studio

Posted by : Stranger
Date :Friday, February 22, 2013
With 0comments
Tag :

what is cloud computing for beginners | Developers Code

| Wednesday, February 20, 2013
Read more »

what is cloud computing for beginners | Developers Code

Posted by : Stranger
Date :Wednesday, February 20, 2013
With 1 comments:

Why good employees leave???

|
Read more »

Why good employees leave???

Posted by : Stranger
Date :
With 5comments

Custom UIPickerView with multiple Columns

| Tuesday, February 19, 2013
Read more »
Display multiple columns in UIPickerView.

Custom UIPickerView with multiple Columns

Custom UIPickerView with multiple Columns

Posted by : Stranger
Date :Tuesday, February 19, 2013
With 1 comments:
Tag :

Adding Custom Code Snippet in XCode

|
Read more »
Following article demonstrates the steps of adding custom code snippets in Xcode
 
Adding Custom Code Snippet in XCode

Adding Custom Code Snippet in XCode

Posted by : Stranger
Date :
With 0comments
Tag :

Google Maps in asp.net website with dynamic addresses from database.

| Monday, February 18, 2013
Read more »
Add following javascript in the head section of the page to access the google maps API.
 <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"></script>  

Add following javascript code in the head section of the page to access the google api functions to display the map on the page.

 <script>  
     var geocoder;  
     var map;  
     function initialize() {  
       geocoder = new google.maps.Geocoder();  
       var latlng = new google.maps.LatLng(-34.397, 150.644);  
       var mapOptions = {  
         zoom: 8,  
         center: latlng,  
         mapTypeId: google.maps.MapTypeId.ROADMAP  
       }  
       map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);  
     }  
     function codeAddress() {  
       var address = document.getElementById('<%= hdnAddress.ClientID %>').value;  
       //alert(address);  
       geocoder.geocode({ 'address': address }, function (results, status) {  
         if (status == google.maps.GeocoderStatus.OK) {  
           map.setCenter(results[0].geometry.location);  
           var marker = new google.maps.Marker({  
             map: map,  
             position: results[0].geometry.location  
           });  
         } else {  
           alert("Geocode was not successful for the following reason: " + status);  
         }  
       });  
     }  
   </script>  

Above functions can be called "onload" by adding the "onload" attribute to the body tag as follows

 <body onload='initialize();'>  

Also this javascript can be called from the server side by registering the script in "Page_Load" event of the class.

 ClientScript.RegisterStartupScript(GetType(), "show", "initialize();", true);  
 ClientScript.RegisterStartupScript(GetType(), "show1", "codeAddress();", true);  

An ASP.NET hidden control is used to store the address of the location obtained from the database. Value to "hdnAddress" can be assigned from server side or client side as per the functionality of the page.

Following "div" element is added on the page to display the map on the webpage.

 <div id="map_canvas" style="width: 285px; height: 275px;"></div>  
  </div>  

The output on the browser will be
Size of the div with id "map_canvas" can be altered by changing the "height" and "width" attributes of the div element.

Try and Enjoy Coding!

Note - Please provide your feedback and let me know if there is any problem with above code.

Google Maps in asp.net website with dynamic addresses from database.

Posted by : Stranger
Date :Monday, February 18, 2013
With 3comments
Next Prev
▲Top▲