Sunday, December 26, 2010

Native Code Generator Tool-NGen


Native Code Generator Tool NGen.exe that ships with the .NET Framework can be used to compile IL code to native code when an application is installed on a user’s machine. Since the code is compiled at install time, the CLR’s JIT compiler does not have to compile the IL code at runtime, and this can improve the application’s performance. The NGen.exe tool is interesting in two scenarios:

  1. Improving an application’s startup time Running NGen.exe can improve startup time because the code will already be compiled into native code so that compilation doesn’t have to occur at runtime.
  2. Reducing an application’s working set If you believe that an assembly will be loaded into multiple processes simultaneously, running NGen.exe on that assembly can reduce the applications’ working set. The reason is because the NGen.exe tool compiles the IL to native code and saves the output in a separate file. This file can be memory-mapped into multiple-process address spaces simultaneously, allowing the code to be shared; not every process needs its own copy of the code.

Saturday, December 18, 2010

Martin Fowler in Chennai


This week, ThoughtWorks Chief Scientist, author & Agile Manifesto Co-founder Martin Fowler was in RainTree Mount hotel, Chennai on Wednesday 15 Dec. Martin shared his rich experiences & thoughts on Software Design and Architecture in the 21st Century. The talk was well organised by ThoughtWorks.

At the events, Martin shared his views on Agile methods, and in particular, Domain Specific Lanuguage (DSL) Programming; as a leading voice in these techniques, he gave a suite of short talks on his thoughts and ideas about how these methods and other developments affect software development. Itz quite interesting the way he runs the sessions. He started with interesting topic introduction as 'in stead of taking single boring topic, letz take 3 different areas'.

Itz a pleasant learning experience about documentation and itz expected level for the better productivity. Martin recommended the non traditional way of communication channel - Share and Speak. I liked his quote 'Design/develop in Group; Review individually' against the traditional vice versa path.

I feel itz a better fit for everyone in the industry like technical leads, senior project managers, architects, senior developers & testers, program managers, VPs and CXOs.

For more information on the event, visit http://www.thoughtworks.com/21st-century-software-design

Saturday, December 11, 2010

UnSafe Code


By default, Microsoft’s C# compiler produces safe code. Safe code is code that is verifiably safe. However, Microsoft’s C# compiler allows developers to write unsafe code. Unsafe code is allowed to work directly with memory addresses and can manipulate bytes at these addresses. This is a very powerful feature and is typically useful when interoperating with unmanaged code or when you want to improve the performance of a time-critical algorithm.

However, using unsafe code introduces a significant risk: unsafe code can corrupt data structures and exploit or even open up security vulnerabilities. For this reason, the C# compiler requires that all methods that contain unsafe code be marked with the unsafe keyword. In addition, the C# compiler requires you to compile the source code by using the /unsafe compiler switch.

When the JIT compiler attempts to compile an unsafe method, it checks to see if the assembly containing the method has been granted the System.Security.Permissions.Security Permission with the System.Security.Permissions.SecurityPermissionFlag’s SkipVerification flag set. If this flag is set, the JIT compiler will compile the unsafe code and allow it to execute. The CLR is trusting this code and is hoping the direct address and byte manipulations do not cause any harm. If the flag is not set, the JIT compiler throws either a System.InvalidProgramException or a System.Security.VerificationException, preventing the method from executing. In fact, the whole application will probably terminate at this point, but at least no harm can be done.

Friday, December 3, 2010

LINQ Namespace


In .NET framework history, Language INtegrated Query (LINQ) was added in CLR Version 2.0 SP1 and FW 3.5. It contains the database query integrated within the high level language like C#, VisualBasic, ASP .NET. We don't need to have a separate database access layer in the enterprise application architecture. LINQ allows you to perform type-safe queries over local and remote collections to sQL Server tables. A big advantage of LINQ is that it presents a consistent querying API across a variety of domains. The types of resolving LINQ queries reside in the below namespaces.

using System.Linq; // LINQ to In-memory Objects
using System.Xml.Linq; // LINQ to XML
using System.Data.Linq; // LINQ to SQL Server
using System.Data.Entity; // LINQ to Entity Framework
using System.Linq.Expressions // To build Expression Tree

LINQ to SQL Server and Entity Framework APIs leverage lower level ADO .NET types in System.Data namespace.

Sunday, November 28, 2010

ASP .NET MVC workshop



In our firm, we conducted a hands-on workshop in ASP .NET MVC technology. It went well with few enthusiastic participants. Common questions are around whatz major diff between ASP .NET and ASP .NET MVC, how MVC engine works, technical directions of Microsoft in web based ASP .NET space.

MVC is an architectural pattern introdced in Smalltalk (1979), which maintains multiple views of the same data. Key concept is Models for maintaining data, Views for displaying and Controllers for handling events.

In terms of pattern, ASP .NET is page controller and ASP .NET MVC is front controller as indicated in associated image on left hand side.

As Points of Interest, ASP .NET MVC is
  • Not the new Web Forms 4.0
  • Not replacing Web Forms, but Adds to it
  • It can not use Web Controls
  • Not a whole new engine but sits on ASP.NET engine
  • Not the best solution for REST

In terms of technical directions in web based ASP .NET space, Microsoft runs with ASP .NET MVC, ASP .NET AJAX and ASP .NET DynamicData.

Hope, ASP .NET MVC workshop reaches these core concepts to the participants. Happy Coding!

Monday, November 15, 2010

Cloud Computing Summit


Cloud computing comes into focus only when you think about what IT always needs: a way to increase capacity or add capabilities on the fly without investing in new infrastructure, training new personnel, or licensing new software. Cloud computing encompasses any subscription-based or pay-per-use service that, in real time over the Internet, extends IT's existing capabilities.

Four fundamental requirements for Cloud are: (1) Scale out (2) Automated service (3) High availability and (4) Multi tenancy.

Recent days, Industry started contributing towards cloud application. If you go thro netflix site (http://netflixpivot.cloudapp.net/), you can feel the performance of Cloud. Last week, had a chance to attend the summit on Cloud & SOA at Bangalore. Event linked is posted at http://events.linkedin.com/ABOUT-BT-SUMMIT-2010-Bangalore/pub/371837

Vendors are providing the services in 3 categories, (1) Infrastructure (2) Platform (3) Application. In case of Microsoft, they are named as (1) IAAS(Infrastructure As A Service) like ForeFront, SystemCentre (2) PAAS(Platform As A Service) like SQL Azure, App Fabric, Azure OS (3) SAAS(Software As A Service) Office Live, Exchange Live, SharePoint Live, CRM Live. Microsoft is doing further R&D on DataSync, Azure reporting (similar to SSRS), Project Houston-DB Manager, etc

Microsoft Azure and Amazon EZ2 are the top competitors in the market. Itz interesting to observe CIO.com analysis about their top 5 differences. http://www.cio.com/article/632213/Microsoft_vs._Amazon_Clouds_5_Key_Differences

Saturday, November 6, 2010

Resource Files in .NET Assembly


In general, manifest is another set of metadata tables that basically contain the names of the files that are part of the assembly. It contains 4 metadata tables namely AssemblyDef, ManifestResourceDef, FileDef and ExportedTypesDef.

You can add a file as a resource to the assembly by using the /embed[resource] switch. This switch takes a file (any file) and embeds the file’s contents into the resulting PE file. The manifest’s ManifestResourceDef table is updated to reflect the existence of the resources.

/link[resource] switch updates the manifest’s ManifestResourceDef and FileDef tables, indicating that the resource exists and identifying which of the assembly’s files contains it. The resource file is not embedded into the assembly PE file; it remains separate and must be packaged and deployed with the other assembly files.

On adding resource files in any .NET assembly, C# compiler’s /resource switch embeds the specified resource file into the resulting assembly PE file, updating the ManifestResourceDef table. The compiler’s /linkresource switch adds an entry to the ManifestResourceDef and the FileDef manifest tables to refer to a stand-alone resource file.

Saturday, October 30, 2010

Biz Tech-ThoughtWorks


Today, attended ThoughtWork's BizTech conference (web site at http://thoughtworker.com/events/biztech-live-chennai). Just wanted to share the knowledge what learnt.

Session had 2 topics, 'Agile & TDD' by Vijay and 'Formal methods' by Rajesh. Itz a wonderful techy day between 10AM and 3PM. Audience shot lot of interesting/sensible questions, which shows the quality of presentation. TW shares not only business benefits of Agile; but also industry growth (surprisingly) Inter sting topics are pair programming, test driven development, tech debt, story card, safety net, continuous improvement. Since, the model is contra with traditional development model, people asked the typical questions like pair conflicts, level of knowledge, project bidding, cost of ownership, project billing, extra person hours, etc . Answers were awesome!

As the result, I got better perception. My understanding is that there are two key success factors for ThoughtWorkers. (1) Organization culture (2) Attitude of Learn & Grow.

Hats off to Martin Fowler for building 1700 world class knowledge workers across the globe. In the current IT environment, Martin makes a huge difference in work culture to produce better quality and productivity. Inspired by his leadership.

Friday, October 22, 2010

No standard library


On working with every new versions of VS, itz quite interesting to have everything handy. As an example, you use FW class without its namespace declared. New VS recommends to declare it by a right click. I know Microsoft is supporting these features for developer's productivity. Unfortunately, it leads into lazy to learn.

Letz take a classic example of no standard library. On using /nostdlib switch, C# compiler wont refer MSCorLib.dll at all, meaning developer needs to share the list of all assembly references. In fact, Microsoft uses this switch when building the MSCorLib.dll assembly itself and in other cases. Sample compiler command layout would be:

csc.exe /out:Program.exe /t:winexe /nostdlib Program.cs

I know itz debatable question about productivity vs learning block; but itz a tech bit to think. At the same time, FW Expert like Brad Adrams gives better pictures on core libraries.


Saturday, October 16, 2010

FrameWork Versions


Recently, one of my colleague got confused on installing two versions of VS and its related framework. It triggers the process to display the installed FW versions in a machine.

Each assembly you build can be either an executable application or a DLL containing a set of types for use by an executable application. Of course, the CLR is responsible for managing the execution of code contained within these assemblies. It means that the .NET Framework must be installed on the host machine.

Microsoft has created a redistribution package that you can freely ship to install the .NET Framework on your customers’ machines. Some versions of Windows ship with the .NET Framework already installed. You can tell if the .NET Framework has been installed by looking for the MSCorEE.dll file in the %SystemRoot%\System32 directory. The existence of this file tells you that the .NET Framework is installed. However, several versions of the .NET Framework can be installed on a single machine simultaneously.

If you want to determine exactly which versions of the .NET Framework are installed, you can test the subkeys under the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP The .NET Framework SDK includes a command-line utility called CLRVer.exe that shows all of the CLR versions installed on a machine. It can show which version of the CLR is being used by processes currently running on the machine by using the –all switch or passing the ID of the process you are interested in.

Thursday, October 7, 2010

makefile in .NET


makefile is an interesting concept in UNIX world to read its instructions from text files. In current VS enviornment, developers jst click play button in IDE. No idea beyond that. But, VS has this makefile concept via 'Response File' with extension rsp.

A response file is a text file that contains a set of compiler command line switches. When you execute CSC.exe, the compiler opens response files and uses any switches that are specified in them as though the switches were passed to CSC.exe on the command line. You instruct the compiler to use a response file by specifying its name on the command line prepended by an @ sign. As an example, csc.exe @MyProject.rsp CodeFile1.cs CodeFile2.cs

This tells the C# compiler what to name the output file and what kind of target to create. As you can see, response files are very convenient because you don’t have to manually express the desired command-line arguments each time you want to compile your project. C# compiler supports multiple response files.

Compiler automatically looks for files called CSC.rsp. When you run CSC.exe, it looks in the current directory for a local CSC.rsp file—you should place any project-specific settings in this file. The compiler also looks in the directory containing the CSC.exe file for a global CSC.rsp file in %SystemRoot% folder \Microsoft.NET\Framework\vX.X.X directory (where X.X.X is version of installed .NET Framework). Settings in the local file override the global file.

When you use the /reference compiler switch to reference an assembly, you can specify a complete path to a particular file. However, if you do not specify a path, the compiler will search for the file in the following places (in the order listed):
  1. Working directory.
  2. Global file.
  3. Any directories specified using the /lib compiler switch.
  4. Any directories specified using the LIB environment variable

Itz possible for the compiler to ignore both local and global CSC.rsp files by specifying the /noconfig command-line switch

Friday, October 1, 2010

disassembler concern


Couple of weeks back, our dotnet manager Srini raised the disassembler concern against IP(Intellectual Property). Yes, it’s true. Three options to mitigate:

At first, in typical n-tier modern architecture, Core logic resides in server-side code (such as a Web service, Web form, or stored procedure) and so the assembly resides on your server. Because no one outside of your company can access the assembly, your IP is completely safe.

Second point is related to obfuscators. For distributing assemblies, you can obtain an obfuscator utility from a third-party vendor. These utilities scramble the names of all of the private symbols in your assembly’s metadata. It will be difficult for someone to unscramble the names and understand the purpose of each method.

On dissatisfaction of obfuscators, you can consider implementing your own sensitive algorithms in some unmanaged module that will contain native CPU instructions instead of IL and metadata. Then you can use the CLR’s interoperability features (assuming that you have ample permissions) to communicate between the managed and unmanaged portions of your application. This is third option.

Thanx for Srini's feedback to think in this line.

Saturday, September 25, 2010

compiler optimization switch


There are two C# compiler switches that impact code optimization: /optimize and /debug.

On disabing optimize switch (/optimize-), the unoptimized IL code produced by the compiler contains many no-operation (NOP) instructions and also branches that jump to the next line of code. On debugging in IDE, the extra instructions make code easier to debug by allowing breakpoints to be set on control flow instructions. On enabling the switch (/optimize+), compiler will remove these NOP and branch instructions

On enabling debug switch (+/full/pdbonly), the compiler produces a Program Database (PDB) file which helps the debugger find local variables and map the IL instructions to source code. /debug:full switch tells the JIT compiler that you intend to debug the assembly, and the JIT compiler will track what native code came from each IL instruction. This allows you to use the just-in-time debugger feature of Visual Studio to connect a debugger to an already-running process and debug the code easily.

By default, Debug version has /optimize- and /debug:full switches. But Release configuration has /optimize+ and /debug:pdbonly switches specified.

Recently, one of my collegue KarthickAlagar generated the big impact in prod launch. Hats off for his Release mode analysis!

Saturday, September 18, 2010

Contents of .NET Managed Module


There are 4 components in a .NET Managed Module. They are listed as:

1. PE32(Portable Executable 32 bit) or PE32+ header
2. CLR (Common Language Runtime) header
3. Metadata (Data about data)
4. IL(Intermediate Language) Code

PE file header is similar to the Common Object File Format (COFF) header. If the header uses the PE32 format, the file can run on a 32-bit or 64-bit version of Windows. If the header uses the PE32+ format, the file requires a 64-bit version of Windows to run. This header also indicates the type of file: GUI, CUI, or DLL, and contains a timestamp indicating when the file was built.

CLR header contains the version of the CLR required, the MethodDef metadata token of the managed module’s entry point Main method, and the location/size of the module’s metadata, resources, strong name, etc

Every managed module contains two types of metadata tables: tables that describe the types and members defined in your source code and tables that describe the types and members referenced by your source code.

During compilation, .NET source code is converted into the intermediate format to be known by CLR. This type of intermediate format code is termed as IL in .NET environment. At runtime, the CLR converts IL into native CPU instructions.

Friday, September 10, 2010

Compiler switch /Platform


On drilling one of C# compiler (CSC) switch /platform, learned quite interesting info. Letz share it here.

Platform has 4 key switches, anycpu(default), x86, x64 and Itanium. anycpu switch creates PE32/agnostic signature in managed module, which runs as 32 bit app in x86 Windows, as 64 bit in x64 Windows and 64 bit in IA64 Windows. Second switch x86 creates PE32/x86 sign in module, which runs as 32 bit in x86, WoW64 (Windows on Windows64) in x64 & IA64 Windows.
x64 switch creates PE32+/x64 in managed module, which runs as 64 bit app only in x64 Windows. Last switch Itanium makes PE32+/Itanium signature, which runs as 64 bit app only in IA64 Windows.

Windows OS loads x86, x64, or IA64 version of MSCorEE.dll into the process’s address space from C:\Windows\System32 directory. For WoW64, it loads from C:\Windows\SysWow64 directory. Primary thread calls a method defined inside MSCore.dll. This method initializes the CLR, loads the EXE assembly, and then calls its entry point method (Main). At this point, the managed application is up and running.

.NET FW 4.0 has Environment’s Is64BitOperatingSystem property to determine if it is running on a 64-bit version of Windows


Saturday, September 4, 2010

Enum usage in WCF

On working in a defect tracking tool using WCF, I faced a weird problem and thought it might be interesting to you.

Application throws service connection error when I used enums in data contract. The real problem was: DefectStatus
enums was assigned with int values. Itz started by 1 instead of 0. Obviously WCF requires that there is an enum value equal to 0 for serialization. If not, server layer won't get that to your client through WCF - strange but true!

On analysing this problem, there is a work around and a solution. Work around is simiple to start with zero as follows.
public enum DefectStatus
{Unknown = 0,Open = 1,Assigned = 2}

Solution is to put [ServiceKnownType(typeof(Enum))] attribute on the service interface contract, and also add the [EnumMember] attribute to every enum value within the Enumeration data contract
[ServiceKnownType(typeof(DefectStatus))]
public interface IDefectMaintenace
{
}

public enum DefectStatus
{
[EnumMember()]
Open = 1,
[EnumMember()]
Assigned = 2
}

Root cause for the problem is defined in msdn as 'enumeration types can be marked with the DataContractAttribute attribute, in which case every member that participates in serialization must be marked with the EnumMemberAttribute attribute. Members that are not marked are not serialized'. Ref is:
http://msdn.microsoft.com/en-us/library/ms731923.aspx

Saturday, August 28, 2010

Architecture of SharePoint-2007


This blog is just an abstract of my recent session on SharePoint Overview.

What is SharePoint?
SharePoint is a software platform developed by Microsoft for collaboration and web publishing combined under a single server. These capabilities include developing web sites, portals, intranets, content management systems, search engines, wikis, blogs, and other tools for business intelligence

Architecture of SharePoint-2007
My understanding is graphically represented in the left side pyramid.

Operating System
Windows Server 2003
, which uses the Microsoft .NET 2.0 FW, Windows Workflow Foundation. Internet Information Services 6.0 is used for hosting Web applications of ASP.NET 2.x master pages, content pages, Web parts

Database Services
Microsoft SQL Server (either SQL 2000 SP4 or SQL 2005) is used to store all content i.e. data, file and configuration information.

Windows SharePoint Services
Storage: Content databases, Management: Administration pages with deep configuration options, Deployment: Web farms, physical servers, and roles, Site Model: Web application, site collection, and sites

Microsoft Office SharePoint Services
Portal
: Templates, people, audience targeting, Search: Search center, cross-site search, Content Management: Authoring, publishing, records management, Business Process: Forms server, line of business (LOB) integration, Business Intelligence: Excel services, Key Performance Indicator (KPI) lists, Report Center

Shared Services
User profile
store, Search services, Usage reporting, Excel services, Notification service for generating alerts

Saturday, August 21, 2010

Cache in Regular Expressions


The chart illustrates the difference in performance between the code, which relies on repeatedly instantiating a Regex object with the same regular expression pattern to call an instance matching method, and the second, which calls a static matching method.

// BAD: Never reinstantiate the same object
Regex rgx = new Regex(pattern);
return rgx.IsMatch(input);

// GOOD: Take advantage of regex cache
return Regex.IsMatch(input, pattern);

The execution time of the first code is about 15 times the execution time of the second example. The difference in performance is due to the caching of regular expressions used in static method calls. Whereas the first example instantiates a regular expression object and converts the regular expression into opcodes in each of fourteen method calls (one for each element in the string array), the second example performs this conversion only once, on the first method call. Subsequently, it retrieves the interpreted regular expression.from the cache each time the expression is needed.

Only regular expressions used in static method calls are cached; regular expressions used in instance methods are not. The size of the cache is defined by the Regex.CacheSize property. By default, 15 regular expressions are cached, although this value can be modified if necessary. If the number of regular expressions exceeds the cache size, the regular expression engine discards the least recently used regular expression to cache the newest one.

Note that there is a breaking change in regular expression caching between versions 1.1 and subsequent versions of the .NET Framework. In version 1.1, both instance and static regular expressions are cached; in version 2.0 and all subsequent versions, only regular expressions used in static method calls are cached.

Saturday, July 31, 2010

Motivation


Itz great to see Jason Haley recommendation; my name is listed along with my favorite techie Somasegar, Scott, etc

Go Green Google


Blackle is a website powered by Google Custom Search, which aims to save energy by displaying a black background and using grayish-white font color for search results.

The concept behind Blackle is that computer monitors can be made to consume less energy by displaying much darker colors. Blackle is based on a study which tested a variety of CRT and LCD monitors. There is dispute over whether there really are any energy saving effects. This concept was first brought to the attention of Heap Media by a blog post, which estimated that Google could save 750 megawatt hours a year by utilizing it for CRT screens.[1][5] The homepage of Blackle provides a count of the number of watt hours claimed to have been saved by enabling this concept.

Statistics on power savings on the various LCD Models are listed in the attached image.

To read about blackle, plz visit at 'http://www.blackle.com/about/'

Sunday, July 25, 2010

Sealed Class


Sealed Class is the class which can not be inherited.the members/methods in the sealed class can not be derived from any other class. A compile-time error occurs if a sealed class is specified as the base class of another class. By default, structs are sealed; not classes in .NET

Here we see evidence of the small but measurable speedup allowed by the use of the keyword sealed in the C# programming language. The benchmark shows that for the very simplest interface methods, the sealed keyword can improve performance by about a third of a nanosecond per method invocation. For interface-heavy programs, the sealed keyword decoration can result in a speedup on all method calls with no downside.

~~~ Sealed class benchmark results (C#) ~~~       
See "Benchmark" section for the code compared.

TestA.GetNumber (regular): 2.490 ns
TestB.GetNumber (sealed): 2.162 ns [faster]

So, the keyword sealed provides a way to demand that the class not to be inherited from, but it is also useful for performance optimization.

Sunday, July 18, 2010

readonly preferance


C# has two versions of constants. They are compile timed 'const' and run timed 'readonly'. As named, const variables are replaced with the value of that constant in the object code. But readonly constants are evaluated at runtime; they are referenced with IL( Intermediate Language) generated variables not the value. Compile time constants can be used only for primitive types.

readonly for instance constants are used to store different values for each instance of a class type. Compile time const are static constants by definition
// compile time
public const int Millennium = 2000;

// run time
public static readonly int thisYear = 2010;

Advantage of using const over readonly is performance, where as readonly prefers the increased flexibility due to runtime compatability constants.

Thursday, July 8, 2010

MSDTC-Transaction Controller


On writing an .NET application with multiple LINQ insert/update statements TransactionScope is useful.
Letz say we are inserting EmployeeInfo table, then EmployeeSalaray table, followed by EmployeeAttendance table.
When the application completes all work it wants to perform in a transaction, Complete method informs transaction manager that it is acceptable to commit the transaction. Failing to call this method aborts the transaction. Isn't it cool?

But, I got an error '[System.Transactions.TransactionManagerCommunicationException] during TransactionScope execution. On analysis, it has been found Network access for Distributed Transaction Manager (MSDTC) has been disabled by default in XP. MSDTC is a transaction manager which permits client applications to include several different sources of data in one transaction, and which then coordinates committing the distributed transaction across all the servers that are enlisted in the transaction.

To resolve this issue, MSDTC is enabled via 'Control Panel->Administrative Tools->ComponentServices->MyComputer' MSDTC properties. You need to click on Security Configuration button under Transaction Configuration panel. In that section, enable 'Network DTC Access' After this setup, my application runs smoothly and TransactionScope is successful.

Tuesday, June 29, 2010

Technology Populism


Technology Populism — information workers provisioning technology outside of IT's auspices — is a topic of great interest to both technology vendors and IT departments. But is it more hype than reality? No. Information
workers are increasingly playing a role in selecting and managing the smartphones, computers, and software they use to get their jobs done. And because IT departments feel the necessity of meeting the growing needs of a distributed workforce while cutting costs, we see them increasingly allowing some technology autonomy for workers. For technology product marketers, this means speaking directly to end users about solving their specific business problems. Going forward, technology vendors will have to design, develop, and market products directly to a variety of information workers who, like consumers, have myriad choices

Technology populism is driven by people's need to interact. For many employees, the telephone and e-mail are being replaced by text messaging, instant messaging and mobile devices such as iPhones and Blackberrys, and social computing tools such as Facebook and Wikipedia. Drivers behind technology populism include: (1) Cheap broadband at home and work as personal and professional lives converge (2) A new generation of applications based on network interactions

To compete among the niche group, IT managers to be driven by ‘technology populism'

Friday, June 18, 2010

No(n parameter) constructor in Value Type


There are two key types in .NET framework (1) Value (2) Reference. As we know, value consumes stack and reference uses heap memory to store direct and indirect data. On working in Value type .NET objects, got the quite
interesting observation.

In terms of constructor, there are two significant differences between value and reference types.
1. Value type can't define non-parameter constructor where as reference will.
2. If no constructor is defined, .NET Compiler can produce default non-parameter constructor for reference type, where as value type can't.

1. Non parameter
On writing the below code with parameterless constructor, .NET compiler throws the error 'Structs cannot contain explicit parameterless constructors'
public struct RectangleInfo {
public RectangleInfo() {

2. No constructor
On using ILDASM to inspect the members of the value type, a parameterless constructor is not a member of the structure as marked in the attached image. But during the app execution, .NET framework has ability to instantiate a value type by using a language's constructor called implicit default constructor.

Sunday, June 13, 2010

Recommendation Note


This week is in vacation mode at Goa beach resort;completely out of work station. Got a surprise recommendation note from Dave, one of the popular web master.

Last year, published an article in code project (http://www.codeproject.com/KB/silverlight/DB_in_SL3.aspx). CRUD explains the complete operation in any language; itz about Silverlight 3. Dave recommended it(http://www.daveenjoys.com/2010/05/20/introduction-to-web-net-programming/) with code example category. In general, motivation drives additional energy and so i'm ready to publish next CRUD article in ASP.NET MVC Framework.

Truth, naked, unblushing truth, the first virtue of all serious history, must be the sole recommendation of this personal narrative.”-Edward Gibbon(1780). Thanx Dave!

Saturday, June 5, 2010

HTML5 beats


HTML5 beats Adobe Flex, Microsoft Silverlight and Oracle JavaFX. Here u go!
http://bexhuff.com/2009/06/html-5-versus-flash-flex

Thought works to back up:
  • Plug in Hell: Except HTML 5, plug in is required to install in the customer machine for Adobe Flex, Microsoft Silverlight, and Oracle JavaFX by design. In the current IT, there are lot of focus towards app security. But, plug-in design leaks the power of security and provides the high probability of hacking/security break operation.
  • Next Gen Web: As MS web developer, Silverlight is not the only option to build the next gen web applications. Better choice would be ASP.NET MVC, WCF and Entity framework for UI, Service and DB app layers. Still, HTML5 UI capability exceeds other technologies.
  • Browser support: Though HTML5 spec is evolving, all browsers will support HTML 5 completely by 2010 end. Major browsers like Firefox 3, Internet Explorer 8, Chrome 2 and Safari 4 are already supporting.
  • Performance: In terms of performance, built-in browser support execution faster than the custom plug in app.

Google wave is built on HTML5 and more list to go! CTOs may have more tech justifications to switch.

Sunday, May 30, 2010

Real Controller


In general, MVC stands for Model (database), Controller (business logic), View (what you see/view logic). During the recent hands-on in ASP .NET MVC, Controller component is quite interesting. By the way, the vendor abstracts every thing and itz a matter of few seconds to create the app. Still, the cool point about the controller is that web request URL is routed programmatically thro built in mechanism. In the traditional ASP .NET, URL is through pagenames/URL rewriting via the physical locations in web server. If you notice the motive of web form, just to mimic winform model development with the introduction of ViewState and PostBack, which creates few problem. Many webpages have significant size of view state that affects the performance and also developers don't have the control of HTML rendering, which is done by server. Apparently, unit testing is quite challenging. Now, if you switch into MVC, it has clean separation of MVC, SEO and REST friendly URL, No viewstate and postback and programmatically routing. Isn't it Cool?

Saturday, May 22, 2010

WCFClient ServiceReference Folder


Though WCF claims the multiple end point connectivity in the next gen distributed computing, itz an interesting problem in terms of client connectivity reference.

Letz talk with a specific example. A console client application is created to consume a WCF Service. With the usual process of VS2008 WCF example, every thing works fine. Cool! One thing got noticed is the directory structure. In the sense, WCF Service Reference is mandated to be at Service References folder of the client application. On relocating to another directory structure, the app couldn't locate the service at all. Itz weird. Drilled little bit. Noticed VS Data Source file for the service reference namely 'ConsoleApplication1.WCFServiceRef. CompoisiteType', as refered in the image. The content of the data source says
ConsoleApplication1.WCFServiceRef.CompositeType, Service
References.WCFServiceRef.Reference.cs,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

It talks about type info with reference of 'Reference.cs' file. No where in the content and directory, the absolute path is not specified. Still, app needs 'ServiceReference' under the client application folder. Quite thrill to know!

Sunday, May 16, 2010

ASP .NET MVC backyard


With the coding experience of VC++, previous gen programmers learnt Model View Controller (MVC) pattern in During that course, they need to write from scratch meaning writing their own model, views and controller in VC++ using MFC base classes. The behavior of MVC operations are hardly coded by making their hands dirty. With this tech background, had a chance to write the first ASP .NET MVC using 2.0 RC (Release Candidate) framework, supplied by Microsoft. You know what, itz surprising experience Becaz FW automatically built the project solution structure in a true way with Model, View, Controller, Config projects and the core functional objects.

As the programmer, the duty is jst adding my product messages within little timeslot. FW takes care of the complete MVC operations; programmer needs to type a tiny LOC(Line Of Code) to complete the product.

On watching this programming trend, itz obvious that vendors are focusing more and more core work and programmers are jst to heat the frozen food to eat; no more kitchen stuff!

Saturday, May 8, 2010

GetTogether


Jst back from one of the lovely moments in the life.

Guess what! Itz 20th Annual meet. Our effort started few months back. Out of 24 classmates, 16 gathered with families across the globe. It was initiated on 2003 end after my US return. Though, we had 2 gatherings (just friends), this May-2010 event was mega with family, prof, HOD, principal. Lot of emotional, thanks, sorry, dedication during stage shows. In fact, our teachers were so proud on seeing our growth. We presented a small video with full of old memories and thanx note with inspiring note. Mind blowing!
Few families had Kodai 5 days trip in an isolated guest house, as the follow-up. Had great fun, teasing, old moments sharing to next gen, etc

As JK said, Life is full of lovely moments. With that, now back to work. Herez some snaps at http://picasaweb.google.co.in/ganesan.senthilvel/20AnnualMeet#

We are humbled and honored to host tribute to our teachers

Monday, April 26, 2010

Kick off

Glad to kick off my tech share activities