Monday, September 6, 2010

FirstCoder, a utility for C# developer

Introdcuing an Utility that can reduce your work load specially if you are working in asp.net C#, Just connect your database ..and a few clicks all your business objects are ready to be used.

I have seen at least 40% of our time we spend in doing few standard functions for all the application we develop in our lifetime, sometimes I feel tired doing same monotonous task, i don’t believe in doing any job which can be automated, let the utility do all task for you….just relax!

I am sure many of you might have experienced the same.

Here I have identified few tasks for the same reason, and automated for all the following task for you.

Java Script Objects: The utility writes java script for all your business objects with few standard methods in it, like addToList(), removeFromList(), getById(id), getAll(),

JSON: The utility writes Json structure for all your business objects with few standard methods in it. Like Save, Get. I keep the JSON structure ready, you just need to set the value from your page control and you are done! JSON can make call to web service or WCF service.

WCF / Web Service: The utility creates wcf service for your entire object with a hosting plan on IIS and one page for service registration.

HBM: The utility gets your entire basic HBM ready within in a minute; I take care of id, composite key, one to many, one to one etc.

Business Entity: Write all business entity with custom attribute like wcf compatible, n-hibernate compatible.

Data Objects Structure: You must have seen often we change our database object structure during the development, but never update our technical specification, so here I create a document for all tables, views & procedures.

Once you standardize the definition, I produce exactly the same, you don’t have to spend time in object creation & to review them, and thus I also save some time, so more quickly you can concentrate on core business area.

Here is the link to download the utility

Upcoming Features :
1. Format all projects code at one click.
2. Identify all areas where function definition has not been written
3. Generate a report all of all function details, so we can identify if any duplicate function written or naming convention are incorrect, that may help to save the review time.

Wednesday, September 30, 2009

.Net 3.5 Framework & LINQ

When we talk about .net 3.5 framework, LINQ is a major thing, In simple word linq is a orm.

1. LINQ to Object
Queries performed against the in-memory data
2. LINQ to ADO.Net [Example]
2.1 LINQ to SQL (formerly DLinq) {Queries performed against the relation database only Microsoft SQL Server Supported}
2.2 LINQ to DataSet {Supports queries by using ADO.NET data sets and data tables}
2.3 LINQ to Entities {Microsoft ORM solution}

3. LINQ to XML (formerly XLinq)
{ Queries performed against the XML source}

In my site i have put all examples of linq and its use.

http://etgconsultancy.com/DotNetFrameWork/Framework3p5/LINQ-Implementation.aspx

A Complete implementation of LINQ to SQL can be found here :

http://etgconsultancy.com/DotNetFrameWork/Framework3p5/Linq-to-Sql.aspx

Sunday, September 6, 2009

Implement google map, how to get coordinates

Here are the very simple steps to implement google map in your application..

I assume you have a gmail account, and you have created your mark on http://maps.google.com

So first make your google location.

Now generate your key for google map, if you dont have click on following url to generate key http://code.google.com/apis/maps/signup.html

once you get your key, replace the key in following script.

< script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=yourkey" type="text/javascript" >< / script >
< script type="text/javascript" >

function initialize() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("divMap"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
map.setUIToDefault();
}
}

< / script >

Now place a div where you want to display the google map.

< div id="divMap" style="margin-top:12px;width:500px;height:400px;" >
< / div >

finally initialise the key

< script language="javascript" type="text/javascript" >
window.load= initialize();
< / script >


Google ma getting dipalyed on your site, but you might be wondering why your location not gettting displayed. For that you need to change the coorodinates.

How to get the coordinates ? Simply open your location in google map and copy paste the following javascript code on browser. youe get your location, replace the code in map.setCenter(new GLatLng(37.4419, -122.1419), 13); method in above script.


javascript:void(prompt('',gApplication.getMap().getCenter()));

Or

click on the right top "send" you get the following code

Hi, I'd like to share a Google Maps link with you.
Link: < http://maps.google.com/maps/ms?ie=UTF8&hl=en&msa=0&msid=103425934348104227970.000472c4205e6efea558c&ll=19.298314,72.861425&spn=0.007281,0.009624&z=17 >

Enjoy google map in your application.

Arindam
http://etgconsultancy.com

Sunday, May 3, 2009

CLR, CTS and CLS JIT, MSIL Code

Common Language Runtime :
CLR is the core engine of .Net framework.


CLR provide the following services :
1. Memory management
2. Thread management
3. Exception handling
4. Garbage collection
5. Security


What is JIT ?

The Common Language Runtime (CLR) provides various Just In Time compilers (JIT) and each works on a different architecture depending on Operating System. That is why the same Microsoft Intermediate Language (MSIL) can be executed on different Operating Systems without rewrite the source code. Just In Time (JIT) compilation preserves memory and save time during application initialization. Just In Time (JIT) compilation is used to run at high speed, after an initial phase of slow interpretation. Just In Time Compiler (JIT) code generally offers far better performance than interpreters.


CLS (Common Language Specification):
CLS is a standard for .net . cls is small set of specification to make all languages as a .net compliant languages. cls make a use of cts and clr. if my languages (c#,vb.net,j#,vc++) wants to be compliant language it has to follow cls standard.

CTS (Common Type System):
Common Type System is also a standard like cls. If two languages (c# or vb.net or j# or vc++) wants to communicate with each other, they have to convert into some common type (i.e in clr common language runtime). In c# we use int which is converted to Int32 of CLR to communicate with vb.net which uses Integer or vice versa

Thursday, April 2, 2009

Role Based Security Implementation in AspNet

http://www.asp.net/security/tutorials/role-based-authorization-cs
http://www.codeguru.com/csharp/.net/net_security/authentication/article.php/c7415 [zip file at the end of the file.]

Setting in web.config
=====================
< connectionStrings>
< add name="myDbConnection" connectionString ="Server=43.455.565.67;database=mydatabasename;uid=arindam;pwd=passmenow;" />
< /connectionStrings>

< roleManager enabled="true" defaultProvider="SqlRoleManager" >
< providers>
< add name="SqlRoleManager" type="System.Web.Security.SqlRoleProvider" connectionStringName="myDbConnection" applicationName="MyApplication" />
< /providers>
< /roleManager>


Create the following set of tables to support the role based authorization and security system.

Ceate table User
(
UserID - pk
Username varchar(20),
Password varchar(20)
)

Ceate table SecurityGroupAssigns
(
AssignID - pk
UserID - fk
SecurityGroupId - fk
)


Ceate table SecurityGroup
(
SecurityGroupId - pk
Name
DisplayName
)


Create Table SecurityRightAssign
(
AssignID - PK
SecurityGroupId - fk
SecurityRightID - fk
)

Create Table SecurityRight
(
SecurityRightID - PK
SecurityRight - varchar
)