Every web application developed using .NET as application framework needs authentication as well as authorization. ASP.NET provides 2 types of authentication providers for the web applications, namely Windows Authentication Provider and Forms Authentication Provider. Am not going to discuss these types and various modes of authentication. But am going to write about how one can implement a code to secure their web pages. And specially if these pages require some kind of user login is a mandatory.
First, you create any page that is supposed to be secured, say for instance AccountDetails.aspx. This page by default takes the inheritance from System.Web.UI.Page class. Now that you have created the page, it is the time for you to induce the security for this page. So add a new class to your application and name that as SecureBasePage.CS. This class is now inherited from System.Web.UI.Page class. The code would look like below
public class SecureBasePage : System.Web.UI.Page
{
public SecureBasePage()
{
}
}
So you have created a class that is similar to that of System.Web.UI.Page class. Now, all you have to do is implement the custom security for this page and inherit your AccountDetails.aspx from this SecureBasePage.. For the implementation of custom security, I take the help of Session Object. And I check that whether the current session has a variable called as LoggedInUser and that is associated with some value. So I have started testing for this value at the constructor of SecureBasePage.
if (Session[ApplicationConstants.SessionVariables.LoggedUserID] == null)While working in this I’ve encountered a huge problem and the problem in terms of the SessionObject. When this session object is used in the SecuredBasePage class, I got the following exception
{
Response.Redirect("LoginPage.aspx");
}
Exception Details: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration> \ <system.web> \ <httpModules> section in the application configuration.
I’ve tried all the possibilities like
1) Adding the enableSession at PageDirective
2) Adding session tag at http Modules as mentioned below
<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule"/>
</httpModules>
3) Adding page directive for the page section with the below code
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" />4) And many more when binged for this error
Finally, I realized that at the time of the constructor of this class, the session is not created. So we have to implement the session validation in any other events of the System.Web.UI.Page class. So I’ve written that in OnInit event
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (Session[ApplicationConstants.SessionVariables.LoggedUserID] == null)
{
Response.Redirect("LoginPage.aspx");
}
}
But here also there raised a problem because the session is still not instantiated with the passed variable. So all you have to do is just change session from generic to CurrentContext
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (HttpContext.Current.Session[ApplicationConstants.SessionVariables.LoggedUserID] == null)
{
Response.Redirect("LoginPage.aspx");
}
}
That is solved and your AccountDetails page is now ready for inheritance from this SecureBasePage.CS..
What do you say ?
Labels: .NET, ASP.NET, C#, CodeSnippet, Exception, First, Tips, Tools, v3.5
Today, I'd to format my system. After successful installation, the following are the tools that are of my choice to install.
WinMail from Live.com
Windows LiveWriter from Live.com
msdnReader from this link
The Architecture Journal from this link. This link is not working, but if you go to the archives, you might find. If you fail to download there, then drop me a mail. I’ll try to upload that to some free upload source.
Xobni for Outlook
I started using Pidgin for multi chat client, but now moved to Digsby.
An RSS tool, FeedDemon from Newsgator
Baraha for local language typing.
Twhirl for following my tweets from Twitter as well as కువకువలు, a telugu twitter
Seven types of browsers. IE, FF, Opera, Flock, Apple Safari, Chrome and Wyzo ( liked it just because of pictures search tool)
Am a .NET Developer, so Visual Studio 2008 along with SQL Server 2005
Am also a community person, so to support or reach directly onto the systems away from me and the folks across the globe, I use Team Viewer.
Hope i’ve not missed any, i’ll keep posted if i missed any
Labels: Tools
when you use the file upload using either ASP:FileUpload or html input control which is a type of file, FireFox doesn’t give you the full path of the selected file. For this purpose i have used both the controls as mentioned below
<asp:FileUpload ID="fleUpLd" runat="server" />
<input type="button" id="btnDD" value="File - Upload " />
Now that I’ve used both, i tried to get the full path of the selected file. Well, you’ll get the full path of the selected file, when this page is viewed in IE, but not in FireFox. I did a full search on net for getting the full path of the file, but my search went in vain.
There are many snippets that did some attempt to show case the full file path. some thing like, using the onchange event with the help of this.value , but that would also show you only the file name when fired in FF. The code is some thing like the below
<input type="file" name="upload1" id="upload" onchange="alert(this.value);" />
According to FireFox at this link, they are considering this requirement as a security breach and made it clear that their browser has over come the security breach by not showing the client-side full path of the file. In their words,
..the entire path of the file was available to the web application. This privacy concern has been resolved in FireFox 3 ..
Hence, there is no possibility of showing the entire path of the file what was ready for file upload. Honestly, I didn’t like this. To get the full path of the file that is ready for upload, the developer has to write a custom control, which is reinventing the wheel.
What do you say?
I just read from one of the blogs at weblogs.asp.net about this. Thought it is interesting to read the way the author presented the issue at this link. Did you like it? And here is the bug ticket for Mozilla. This has full details of why and how .. blah .. blah..
We all know that there are 2 types of controls that are available while developing web applications. They are HTML Controls as well as Server Controls. The main difference between these two controls is just the runat attribute. For any normal HTML Control like input, it becomes server control when you add the runat=“server” attribute.
By adding this attribute, we can work with the control at code behind directly with out having any difficulties. But did you ever thought what happens when you add this attribute?
The secret is that, the visual studio IDE creates a .designer.cs file as a code base for our .aspx page. This code base file is automatically generated, and we have nothing to do there. The purpose of this code base is to construct the controls that have the runat attribute.
What do you say?
In our current application there is a requirement in one of the pages that when the an user is requesting for a some information, there are some options like Passport Number, Social Security Number are optional values to be submitted. And the client wanted them to be check boxes, because, the end user may submit more than one values. Here comes the actual trick, when the end user selected any one option, the text box next to that should be required. The UI would be some thing like the below
And the code for that is as mentioned below
<asp:CheckBox ID="cbPassport" runat="server" Text="Passport Number" onclick="disableRFV(1)" />
<asp:TextBox ID="txtPassportNumber" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassport" Enabled="false" Display="Dynamic"
EnableClientScript="true" ControlToValidate="txtPassportNumber"
ErrorMessage="Pl Enter Passport Number" runat="server" ValidationGroup="vgFields">
</asp:RequiredFieldValidator> <br />
<asp:CheckBox ID="cbSSN" runat="server" Text="Social Security Number" onclick="disableRFV(2)" />
<asp:TextBox ID="txtSSN" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvSSN" Enabled="false" Display="Dynamic"
EnableClientScript="true" ControlToValidate="txtSSN"
ErrorMessage="Pl Enter Passport Number" runat="server" ValidationGroup="vgFields">
</asp:RequiredFieldValidator> <br />
Here you are missing the javascript function disableRFV(). The code for that is as mentioned below
<script language="javascript">
function disableRFV(val)
{
var enableControl = event.srcElement.status;
if(val == "1")
ValidatorEnable(document.getElementById('<%= rfvPassport.ClientID %>'), enableControl);
else
ValidatorEnable(document.getElementById('<%= rfvSSN.ClientID %>'), enableControl);
}
</script>
The point to note is the ValidatorEnable function that is provided by ASP.NET Javascript Script library. And one more thing that we have to remember is that, while submitting the Required Field Validator control id, we have to pass the clientid, because these controls would be having the runat=“server” tag.
So final points are..
1) Write code for the checkbox with a onclick event
2) Enable the ClientScript for the RequiredFieldValidator
3) Don't forget to associate all the RequiredFieldValidators with ValidationGroup
Final) Within the JavaScript function invoked by the checkbox onclick, use the ValidatorEnable method to enable or disable the RequiredFieldValidator
Hope you got it.. if am missing any .. pl remind me
Labels: ASP.NET, CodeSnippet, First, Tips
Recently we have encountered a requirement where there is a page with simple details and a link for each record in that page take you to another page. This another page would have all the details of the selected record of the previous page. Let me rename these as ClassRoomPage containing the names of the students and their respective roll numbers and the second page is StudentDetailsPage where we pass a parameter as Student ID.
So what we did is, we had the first page as ClassRoomPage with GridView and binded that with the respective columns. The trick is that we need a hyperlink to navigate to the next page along with the query parameter. So we added a template column with the hyperlink as mentioned below
<asp:TemplateField HeaderText="Comment">
<ItemTemplate>
<asp:HyperLink id="hlview" runat="server" NavigateUrl='<%#"~/StudentDetails.aspx?RollNumber="+ Eval("RollNum") %>' Text="View" />
</ItemTemplate>
</asp:TemplateField>
Now that we have the both pages, all we need is to do is bind the first page with the ClassRoomDetails and this would add an extra column to the right side of the record and that takes you to the navigation for the next page. What do you say?
Today, there was a requirement to show the month name in a text box. There are two forms that we have to show, depending on the user choice. The choices being the full name of the month as well as short name. Something similar to that of “October” for full name and “Oct” for short name.
We know that we get the month number from DateTime object. This DateTime object has many properties that are directly associated to show the different parameters of Date and Time of the day. But now, for our requirement, you can get the full name of the month with the help of the Globalization object. That is too complicated.
The simple method is to use the ToString() with the format that is required.
DateTime.Now.ToString("MMMM") Give you full name
DateTime.Now.ToString("MMM") returns you short name as required
How is this?
We know that we can schedule any task for specific intervals as defined in the basic configuration. Before we talk about any thing, let me write about how to schedule windows scheduler.
Start => Control Panel => Scheduled Tasks
For more details, you can read the instructions as explained at by Microsoft at the knowledge base. But the missing part is that the KB article doesn’t help you to schedule on a reduced intervals or specific intervals. Just before you click the Finish button, make sure that you check the Advanced Properties button.
Once you select this option, you would be taken to the next screen. At times you would not be able to see that due to not providing the Account Information to access the local system
If that is not your case, you are lucky to proceed next step. Other wise, you would see the below window. The only difference is that the below window doesn’t contain the Security tab.
Now, if you forget to check above “Advanced Properties” checkbox, you still can also get to this tab by right clicking on the selected task and opt for properties. So, finally we are here at the right place and the purpose of this post. Go to the Schedule tab from the properties and click the Advanced button, resulting you the below popup.
The trick here is to select the “Repeat Task” option and provide the number of minutes that it is required to reiterate. This is how you opt to schedule at the specific time intervals.
The entire credit goes to one of the recently joined colleague by name Karthik, being the senior to him, i dictated a rule to him that he updates me with a tip or trick every day. As a result this is a new thing for my knowledge from yesterday’s KT. Let me see how long i’ld post like this.
We are lucky to have a client that is tech savvy. And most of the times our code is being reviewed by their tech architects. Most of the times we get reviewed our code on a frequent time intervals. On one side it is good, on the other side it leaves our developers with some morel loss. Adding to the fuel, is me. I insist my developers to follow certain standards within their code. It is time to post the general points that I emphasize.
1) Use long names for variables
2) Initialize variables at the time of declaration
3) Use .Equals instead of ==
4) Use territory operator ?:
5) Use ?? when expecting the null reference
6) Use .Length() comparison to validate string with values
7) Use StringBulder instead of strings concatenation
8) Use StringBuilder replace instead of string (Ref : http://dotnetperls.com/replace-string-use)
9) Use single line assignments for common values
10) Avoid try catch as much possible
11) Organize Usings and remove & sort the references
12) Use white spaces within every expression
13) Separate user methods from system generated methods. Use of Region
14) Give Author details on every page
15) Maintain the history of modification
16) Write the code in as small reusable methods as possible.
17) Never assing objects to null when they are within the loop
18) If you can use the GC.KeepAlive, make the best use of it
19) Try to separate the Finalze method into a different class and instantiate in the caller class that implements the IDisposable interface
20) Make use of WeakReference to avoid the multiple connections / reads from static content
21) Use int.TryParse, instead of Convert.ToInt or int.Parse
22) Never Ever Trust the User Input, do use Encoding where ever necessary
There are much more, this list would never end. But these are general guidelines that are in my mind at any given time. And different approaches can be identified depending on the situation that the code is in.
Labels: CSharp Tips, Definition, Personal, Tips, Truths
Today, before we start an internal demo of our project, we realized that, on a particular table there is no data in the QA server. We have every thing ready, but no the sample data. We just can’t create an insert script from the table and execute the script there, because, there is a column which is binary type. When we generate the script, the binary data type is not able to populate. Then we are struck with a big question of how to transfer the data between servers.
Let me explain you much in detail about our infra structure.
We have a dev DB server for our internal development hosted on 192.168.2.10 <<local ip address; for our convenience >>
We have a test bed for our application and IIS installed on it, let’s say this is 192.168.3.10, which is altogether a different network. And this IIS is connecting to a TestDB Server (let’s say it is hosted on 192.168.3.20), where we migrate our DB scripts to create the database / tables / stored procedure / user defined functions / blah .. blah .. what not.
Now, this IIS server(192.168.3.10) is connecting to the TestDB(192.168.3.20) on secured connectivity. Our network folks implemented a rule that the x.x.2.x series can’t talk to x.x.3.x series, but not the vice versa. [[This is the trick / loop hole here]] Now that we need to populate the binary data from a table, and we don’t have access.
What all the dev’s do in the begin is to a bing on how to access the remote server to copy data from table. We are not exceptional to this, and we did all kinds of searches. We also googled for the same, unfortunately we end up either creating the LinkedServers. As we couldn’t connect to the remote TestDB server from our DevEnvironment, we couldn’t establish the connectivity. And the our application DBs are not accepting to create a LinkedServer from TestDB server.
after doing lots of trails and found some easy way to populate the data from one server to another with out having to create a Linkage between the servers.
13 Exec sp_configure 'show advanced options', 1
14
15 Exec sp_configure 'Ad Hoc Distributed Queries', 1
16 Reconfigure
17
18 insert into UserProfile
19 select * from OpenDataSource(
20 'SQLNCLI',
21 'Data Source=192.168.3.20;User ID=sa;Password=sa'
22 ).GlobalWebContent.dbo.UserProfile
Pretty neat and simple solution, it took about approximately 4hrs to convince our SQL DBs to execute the above query.
Labels: .NET, ASP.NET, C#, SQLServer 2005
Within the single form it is evident that you can have multiple validation groups. To explain more, it is good to throw some light on such requirement. In our current project we have the following requirement.
If you observe this screenshot, the “Request a Quote” box is repeated. And on click of “Add More” button, one more “Request a Quote” would be added to the screen. Every time such a box is added, they are generated along with RequiredFieldValidator and adding the ValidationGroup property with the respective item index. In the above case, we have 2 validation groups. Now the problem is about validating the required fields on “Submit” button.
If there is only one validation group, you can directly associate the validation group to button with the “ValidationGroup” property. But in this case, we don’t a direct association of single validation group with single button. Hence we need to associate the multiple groups with the submit button, as mentioned below
<asp:Button ID="btnSave3" runat="server" ValidationGroup="3" Text="Submit" OnClick="btnSave3_Click" />
The latest .NET Framework v3.5 doesn’t support the multiple ValidationGroups association before submitting the page to server. Here is the information about such feature unavailability. As it is a limitation with .net framework, started exploring the alternatives.
Got many articles, to resolve this situation. Javi on his one of the old posts, mentioned a JQuery mechanism along with a custom button control. Brain Main’s blog has similar post. Many more if you bing.. What every they are, they all look at the simple Validate() method of Page class. Instead of investing my time again & again and reinventing the same wheel, i decided to go as simple as possible of using Page.Validate and verify that the Page.IsValid property to decide to proceed with the consecutive commends execution. Code looks like the below
Page.Validate();
if (Page.IsValid)
if (ValidateItemOptions(3))
{
// Means there is no Error with the data as well as Required fields
string strIPData = CollectPreviousItem();
// Invoke the Bussiness Method
}
Do you have any other possibility??
(ofcourse, you would not.. but just checking if some thing unearthed would see light)
Labels: .NET, ASP.NET, C#, Community, Debug, Error, Orcas, Truths, v3.5
Today, almost more than 4 hrs I'd spent on this issue. Do you want to know what is that? Here is that. I have 4 checkbox elements and I have to do the following conditions
Condition 1) Any one check box has to selected
Condition 2) If any of the first 2 check boxes are selected, my code should throw an exception when the 3rd check box is selected
Condition 3) vice versa for Condition 2
A picture is worth of 1000 words. Here is the actual requirement.
Hope you got the actual picture. Now here comes the actual twist. You can do that with simple if conditions, but i thought of implementing this using territory operators using a single if condition. And the condition goes like this..
if(((cbRepair1.Checked || cbCalibration1.Checked ) ?
(cbBoth1.Checked) ? false : true :
(cbBoth1.Checked || cbOnLine1.Checked) ? true : false)==false){
throw new Exception("Duplicate selection ..");
}
It took me almost more than 4 hrs. Isn’t it funny!!
Within our current project, we faced a requirement such that there are multiple checkboxes and the user is required to select any one of them (at least one of them). So as there are multiple checkboxes, decided to go with CheckBoxList control. Now the problem is that, we need to show a error message if the user is not selected any one of them. The problem also extends not just there, but the display text should be culture specific.
So the story started long after I've written this post. But editing this entire post due to a simple non supportive feature by IE. I’ll come to that point little later, let me first detail the requirement and solution. There is one more solution for this unsupported error. Please read thru the post.
For all the client side validations, it is widely known that validation controls supported by ASP.NET framework are popularly used. But these controls can’t handle the CheckBoxList. Hence the following solution.
Step 1: Place your CheckBoxList control in a separate div as shown below. Observe that the text for these controls are populated from database depending upon the user culture
<div id="cblItems1">
<asp:CheckBoxList ID="cblOptions" runat="server">
<asp:ListItem Text="<%$Resources:CommonFormFields, Repair%>"></asp:ListItem>
<asp:ListItem Text="<%$Resources:CommonFormFields, Calibration%>"></asp:ListItem>
<asp:ListItem Text="<%$Resources:CommonFormFields, RepairCalibration%>"></asp:ListItem>
<asp:ListItem Text="<%$Resources:CommonFormFields, OnlineService%>"></asp:ListItem>
</asp:CheckBoxList>
</div>
Step 2: Use ASP:Lable and get the error message while loading and place in a separate div and hide this div by default as mentioned below. Please note the div ID as cblError1 and the style is set to hidden by default
<div id="cblError1" style="visibility: hidden">
<asp:Label ID="lblReq1" runat="server" Text="<%$Resources:CommonFormFields, SelectAny%>"></asp:Label>
</div>
Step 3: Write a JScript function that reads all the client side rendered elements as input objects and checks whether any of them are checked or not. Code explains more in detail
function CheckListValidation(cblItm, errDiv)
{
var tDiv = document.getElementById(cblItm);
var chkitems = tDiv.childNodes[1];
var chkitm = chkitems.getElementsByTagName("input");
for (var i = 0; i < chkitm.length; i++)
{
if (chkitm[i].checked)
{
return true;
}
}
document.getElementById(errDiv).style.visibility = 'visible';
return false;
}
Step 4: Now it is the turn of invoking this function from the button click. Every button is having a method called as “OnClientClick” along with Click. Invoke this function from that method as mentioned below
<asp:Button ID="btnAddMore" runat="server" Text="Add More"
OnClientClick="return CheckListValidation('cbOptions','cblError1');"
OnClick="btnAddMore_Click" />
Step 5: All setup and the code is running fine. But there is a problem with this code while running in IE. IE 6 and above doesn’t support the getElementsByTag
var vTe = document.getElementsByTagName(..);There is a long story for this. Let me post one more post for the better mechanism of CheckBoxList Validation. Until then, what are your comments?? Labels: .NET, ASP.NET, C#, IE, JavaScript
1) Which programming language is faster ? VB or C# ?
This is regular and majorly mistaken by the VB developers and mistakenly highlighted by C# developers. According to the .NET architecture every language code is converted into MSIL, hence every language code is common on the first compilation. Then this MSIL is converted onto the native code. The entire purpose of converting the ELL into MSIL is to obtain the Interoperability between Commonly used languages. Hence this is absolutely false, and all we need to remember is that better code generates better performance results and vice versa
2) CodeBehind is better than InLine
It doesn’t really matter whether you implement the code in a separate file or with in the same, the reason behind this is .. anyhow, the IIS is going to compile for the first time and going to cache the page DLL. And once this is done, it doesn’t really mean any thing for the IIS towards processing and generating the output HTML from our ASPX page. Hence, it is totally untrue in-terms of separation of your code to single code behind or multiple code behind pages
3) Use WebServices as much as possible
LOL.. this is my first response for all those who say this. Right .. webservices are the break through in the industry, it doesn’t mean that use it all places. It is also myth to use webservices with in a big application having multiple project within same solution. My recommendation towards using the WebService depends on the type of the system. Use webservices only in case of different systems not within the similar systems
What do you say??
Labels: .NET, ASP.NET, Definition, Error, fun, Industry, Tips, Truths
On 22nd of this month, i got a mail from Abhisheik about this event. This is the first of it’s kind by Microsoft to connect all bloggers. Points that rolled during this meeting are
0) Freebees at TechEd towards. MCP Exam tokens to attend any one exam for free
1) Naked Browser Challenge from http://merawindows.com
2) Silverlight 3 features
a) Smooth Streaming
b) APIs are open to Plugins new features by community to integrate with Silverlight
Give a look at SmoothHD.com for some demos on smooth streaming
3) Release of Expression Blend 3
4) Pandu spoke about Sketch Flow in Expression Blend3
5) Nano Car experience and IPLT20 are developed using .NET technology – a feel good factor. Hope Silverlight streaming would be next generation of media transmission
6) IE 8 and WebSlices and Accelerators are going to be the part of IE8 highlights and key elements of success
7) Interoperability Lab from Microsoft is being setup at Bangalore and this is open for all public with out any fee
During this meeting, Abhisheik mentioned about a trick while presenting the Naked Browser Competition, that is run the command “explore –extoff” to open up the IE8 with lightening fast. This command opens IE with out enabling any Add-ons, which is a plain old fashioned and classical browser of IE4 or IE5 like. Anyhow, it is good that we can use the latest component in classical old style.
June 25th is the next time we can connect as the 2nd event of this kind. Did you attend this? Did i miss any point?
Labels: Community, Microsoft Promotions, Sliverlight, Tips
Now-a-days am conducting few interviews for our organization. While sitting in the other side of the table, I've visualized why most of the interviews fail with me. But when conducting these interviews, most of the candidates are attending with self confidence that they are suitable for the mentioned role and attend without preparation.
When people do some real preparation, they tend to fail due to lack of awareness at the interviewer towards interviewing techniques. Having failed in many interviews, I've learned that the interviews fail because of the following...
By any chance if I miss any, please let me know.
Yes, am mentioning about Security at Silverlight applications. Well, most of the developers think that Security is not the feature of the application. and they claim that it is the responsibility of the framework on which they are developing, be it as .net or java or any other. Thus, they don’t even worry about why security should be the core of any application and it should be given prime attention.
Microsoft has an initiative towards security with in any software development life cycle. This initiative is known as SDL, Security Development Lifecycle. Their definition of SDL is neatly designed as displayed.
.jpg)
And also they have released a security guidance document for writing and deploying Silverlight Application. The document can be downloaded from this link. The TOC is some thing like this
Threat Modeling and the Security Development Lifecycle
Background of Web Security
Same-Origin Policy
Cross-Site Scripting Attacks
Cross-Site Request Forgeries (CSRF)
A CSRF Mitigation: Nonces
Silverlight and Web Security
Changes from version 1.0 to version 2.0
How Silverlight Works
XAML
XAPs.
The Silverlight Sandbox
EnableHtmlAccess
ExternalCallersFromCrossDomain
Silverlight Networking
Cross-Domain Policy Files
How to Maximize Safety of Cross-Domain Access
Trusting Third-Party Domains
LANs and Security Zones
Internet Explorer and the XDomainRequest Object
Sockets
FAQ
How can I safely display a Silverlight ad on my Web site?
Is it safe to load arbitrary XAML in my Web page?
Is it safe to load arbitrary XAML from managed code?
Is it safe to display arbitrary media in XAML?
Is it safe to allow users to upload arbitrary XAPs to my Web site?
How can I tell if a file is a Silverlight application?
Is it safe to render XAML or run XAPs on my server?
How can I make sure my XAP is loaded only from a specific domain?
Is it safe to hide secrets in my XAP?
Does the PasswordBox control protect the password in memory?
Where can I find documentation for these features and APIs?
Labels: .NET, ASP.NET, Microsoft Promotions, Sliverlight, Tech Blogs, Tips
From long time, I've been looking out for a better regular expression for my web application. Every time, I adjust with some freely available expressions and complete the work. But this time, I've decided as not to compromise with what I get for free. And started writing my own expression.
My email validator should justify all the following conditions..
1) it should restrict the user name length between 4 to 50 characters length - {3,50}
2) it should allow dots, underscore, hyphen. But not as starting point - [-.\w]
3) it should allow numerical as well as alphabetic characters of both cases - [0-9a-zA-Z]
4) it should contain one dot after one @
5) all the chars after @ should be at least 2 characters length and may be up to 20 characters consisting of alphanumeric with both cases
After doing all kinds of R&D, concluded as below. Correct me if am mistaken. And extend if you have any further to add
---------------------------------------------
^(([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z]){3,50})*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
-----------------------------------------------
Labels: ASP.NET, Definition, First, Tips
Ofcourse, i might sound late in this announcement, but better late than never. On 31st October 2008, Microsoft has announced the CTP version of Visual Studio 2010 and Framework version 4.0. And their statement goes like this.
Visual Studio 2010 and the .NET Framework 4.0 mark the next generation of developer tools from Microsoft. Designed to address the latest needs of developers, Visual Studio delivers key innovations in the following pillars:
Democratizing Application Lifecycle Management
Application Lifecycle Management (ALM) crosses many roles within an organization and traditionally not every one of the roles has been an equal player in the process. Visual Studio Team System 2010 continues to build the platform for functional equality and shared commitment across an organization’s ALM process.
Enabling emerging trends
Every year the industry develops new technologies and new trends. With Visual Studio 2010 and .NET Framework 4.0, Microsoft delivers tooling and framework support for the latest innovations in application architecture, development and deployment.
Inspiring developer delight
Ever since the first release of Visual Studio, Microsoft has set the bar for developer productivity and flexibility. Visual Studio 2010 continues to deliver on the core developer experience by significantly improving upon it for roles involved with the software development process. .NET Framework 4.0 contains numerous improvements that make it easier to develop powerful and compelling applications.
Riding the next generation platform wave
Microsoft continues to invest in the market leading operating system, productivity application and server platforms to deliver increased customer value in these offerings. With Visual Studio 2010 and .NET Framework 4.0 customers will have the tooling support and the platform support needed to create amazing solutions around these technologies.
Find the same and download from this link
Now-a-days am attending interviews for my next job. Most of the calls are for the Architect position. While preparing for these, realized few responsibilities and activities that were part of my previous roles. And they are the main theme of this post.
As mentioned in the post title, questions that comes to every developer's mind is..
Having mentioned all such questions, , would like to make things clear, out of my experience. Readers has every right to deny or challenge my understanding.
First of all, an Architect is like soul in the human body which you can never see but always experience the existence. This definition is totally true in small sized organizations. Because an Architect plays every role that is part of any implementation with in small scale industries. Architects are expected to be technically sound and functionally expert. The expertise comes with the knowledge and experience they gain from their previous jobs or personal observations from different implementations.
I remember reading from one of the articles by Mr. Joseph Hofstader, 'On software projects, the title Architect is often ambiguously defined and the value provided by architects is not easily quantifiable..'. That's true. In most of the situations the role is not predefined by either management or any other. But in all cases, the person who is acting as an Architect, will give life to the situation and serve the purpose that is being sought for. Did anyone ever thought that how this has become possible from nowhere to everywhere.
The only reason for the success of any Architect is the following..
In any case, if any of one is failing, the consequent steps will yield unexpected results. For all the success of any and every Architect, the fundamental points are..
Having mentioned that, the designation of an Architect wary from Technology vertical to Enterprise level. Depending on the role and responsibilities the designations can be attached to them. For about 3 yrs in my career I've freelanced working with different industry giants on short term as life saving or rescue missions for different domains. The designation with in the teams that I worked, depends on what am I asked resolve.
As it is very short period of time with every client, it is next to impossible to understand the business and the architecture of the application that is being built over 2 yrs and resolve the bottlenecks of the application. But one thing that I kept on my mind towards understanding the bottlenecks of any application is the .NET framework fundamentals and their flaws.
Coming back to the definitions and flavors of an Architect, there are different varieties of designations that are widely popular in the market.
Technical Architect, is some one who is extremely knowledgeable on specific technology. This person purely concentrates the latest updates of the technology
Solution Architect, is some on who is deeply aware of the business and the functionality of every interacting pieces of the business. This person is not necessarily technology agonistic
Enterprise Architect, is some one who takes care of the business and concentrates on how to make different functional units to work aligned to mission and vision of the Enterprise
Infrastructure Architect, is some one who takes care the smooth execution of the release management of the application from development phase to production environment. This role is the key for the application execution bed.
Apart of the above mentioned roles, there are plenty of fancy designations that would sound like, Software Architect, Business Architect, blah .. blah.. In this post, i've mentioned about different designations and roles that an Architect would be playing. Will try to post some other interesting facts about an Architect in the next post. Till such time, happy reading and blogging.
Microsoft has released .NET Framework 3.5 Service Pack 1 on 11th August 2008. Do you believe if I mention here that when compared to the .NET v3.5 with .NET v3.5 SP1, there are
Don't get surprised.. these are not my inventions. NDepend is a tool that will help you to understand any given assembly. Patrick Smacchia, an MVP for C# has a detailed note on his blog about the version differences. I recommend every one to give a look at his post, " .NET 3.5 SP1: Changes Overview "
Labels: Tech Blogs, Tips, Truths, v3.5
Today while am downloading the interview of Biff Gut from ARCast.Tv, i've reached the maximum download that i ever encountered in my life. Secondly, this download is from WiFi network.Creating your own search engine is not a big issue with the availability of the current technology. Apart from that, if you want to get results thrice that of a single search engine.. here is a mechanism for you to search with Live, Google as well as Yahoo at the same time.
First: Goto this link exposed by Microsoft
Second: Beneath the Create Your Own, at the 3rd step, type http://mysearchoff.com/?q=TEST
The reason being that, http://mysearchoff.com is the place where you can perform a search with the above (Three) search engines. The trick is this, we are going to use this facility for our IE.
Final Step: Name the search as Sweet as you like and Press Install button.
By pressing the Install button the JScript of the webpage will install the search component on your IE. And you can see that on the top right corner of your IE with the name that you have given at the 3rd step.
Note: This works only with IE7 or IE 8. You can see that the search on my IE looks as seen below ..
Labels: Microsoft Promotions, Tips
Though the runtime that is released on 28th March 2008 is not related to .NET, but I see a huge breakthrough from Microsoft towards the runtime engine growth as well as the next generation runtime engines. Infact, if they could do it with MS-Access, it is not a big deal for Microsoft to introduce such similar runtime for .NET CLR as well.
Hopefully, in the near future we would see the same kind of runtime for .NET as well, leveraging the .NET languages to the next level of localisation. Honestly many a kind of the following questions are cooking in my mind... help me if you have any clue for any of the following
Rather confirmed, am now more confused... who will help me..
Today, I've downloaded IE8 beta 1 as well as Silverlight 2.0 installed on my laptop. This day have seen many products released at Mix 08 by great personalities like Scott Guthrie, Bob Familiar, Guy Burstein, IEBlog, etc. According to Jane Kim at an interview for Mix08, Activities and WebSlices are two of the most exciting new features in IE8.
Apart of IE8.0 and SL2.0, there are other products such as
I've downloaded all these .. and am trying out one by one .. what about you??
Labels: .NET, ASP.NET, Community, Downloads, IE, Microsoft Promotions, Sliverlight
Unity Application Block, code named as UNITY, is out with latest release:11319 on March 4th 2008. The main purpose of this Application block, is to make the developers to concentrate on the dependency of the objects they instantiate correctly.
The Unity Application Block (Unity) is a lightweight extensible dependency injection container with support for constructor, property, and method call injection.
Unity addresses the issues faced by developers engaged in component-based software engineering. Modern business applications consist of custom business objects and components that that perform specific or generic tasks within the application, in addition to components that individually address cross cutting concerns such as logging, authentication, authorization, caching, and exception handling.
Here is the road map for Enterprise Library version 4.0 and Unity
Labels: Community, Definition, Microsoft Promotions, Tips, Truths
This is a nice talk about how the web evolved and where it should have been as of this day. According to Douglas Crocford, instead of progressing into new technology, we are degrading our technology into where it all started.
Shocking !!! isn't it !!! .. listen to him from his own voice. His discussion has roots back from Herman Hollerith and the 1890 census. In the begin of this episode, I couldn't imagine how this gentleman brought the relation from the good olden days to now-a-days AJAX and JSON. Am convinced with his idea, and certain facts that he is mentioning about are REAL. According to him, we are doing research on the great thoughts that are published way back in the history by many great scholars. Outstanding ..
During the discussion, he mentioned the failures of Java. Another interesting point is that he tells where and how Microsoft could be successful in the key failures of Java. All these days I've seen the failures vs success points of these both technologies from the point of a Developer, but after this Webcast, I realised the areas as visualised by the real researcher. Yes, he has a vary valid points to give attention towards introducing the new bugs to the application at every new release. One more point that he highlighted about the "Open Source" vs "Proprietary Source" as, at the open source there is no single responsibility towards the bugs introduced / induced onto the source. Where as the proprietary source takes the responsibility and fixes them as a patch to the application. Yes!! that too convincing to me.
This is the first time am giving attention to such talks. Probably because of this, I felt that this talk has many points to give attention. Anyhow, overall this is a great talk and every mind that want to contribute to the progress of our technology, should listen to him and put some thought process towards these points.
Did you listen to this ??
Labels: Community, Definition, Industry, Personal, Tech Blogs, Truths, Webcasts
For the ASP.NET pages that has no user input it is a best practice to have the page register with EnableViewState=“false”. This will increase the response time to 200% of the default.
Along with that, you can also do the one more important is that, anyhow these pages have no user input. Secondly, these will have data that is read-only from database. Thus, you are sure that there is no activity from the user that could be saved onto disk. Perhaps the user might work with the data that is available on the page.
Hence, keeping all the above point in mind, by setting the session’s state to read-only makes the WebPages more effective and the response time increases drastically to about another 200%. Think this and change your web page attributes from the next time onwards
Did you ever thought that Bill Gates named their company as "Microsoft"?.. it was a billion dollar question to me all these days. At the early days when Bill is forming his company along with his friends, sought recommendations for a good and fancy name. Every one gave their won stylish and trendy names. They are not ready till their first cheque is due to them. While Steve Balmer is talking about a product that is the brain child of Bill, mentioned as ".. it is a SOFTware for MICROprocessors .. ", these words lead the idea to name their company as Microsoft. And the rest is history and preset.
Does any has proof to violate this information??
Labels: Definition, Microsoft Promotions
With the new year roll out, Microsoft has initiated a new website with the caption as mentioned at the subject of this post. Yes, they are starting a new initiative with all the Standards that are in place with the industry giants and the best out of Individuals, Corporations, Academics, who not ... every one ..
http://www.microsoft.com/standards/ is the link for all such standards. The initial thought for this resulted from the Interop team. They have a separate home for them as http://www.microsoft.com/interop. The history has 2 yrs old story to come out with such standards towards Interoperability. And finally they are with the standards that are in best practice with industry.
I just started going through one by one.. did you ??
Labels: Community, Definition, Industry, Microsoft Promotions, Partner Program, Tech Blogs
The Visual Studio 2008 and .NET Framework 3.5 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2008 features and a variety of framework technologies including: LINQ, C# 3.0, Visual Basic 9, WCF, WF, WPF, ASP.NET AJAX, VSTO, CardSpace, SilverLight, Mobile and Application Lifecycle Management.
I've downloaded this, if any one require this, you can drop me a mail or can collect from me.
Labels: Community, Downloads, IE, Microsoft Promotions, Partner Program, Sliverlight, Tech Blogs, Tips, VS Tips, Webcasts
Who says that Microsoft manufactures products only to sell ?? Microsoft has many products that are free to download. As am into .NET and specially with Visual Studio, am aware that Visual Studio is free to download from Microsoft's website. Yes, that's true.. Microsoft give Visual studio 2008 Express Editions, MSDN Library for Visual Studio 2008 as well as the Runtime for the latest .NET framework 3.5.
Here is the link to learn more towards free products as well as priced products. To know more about the product information about Visual Studio 2008, click here.
Labels: Microsoft Promotions, Orcas, Tips, Truths
That's true, you read the title correct. BBC recently wrote about this on 6th Dec 08. Microsoft is working out towards the XP operating system to be a reality on the co called $100 laptop or XO. If things go as scheduled, $100 Laptop or XO will be a reality by the mid 2008.
James Utzschneider, GM for Marketing and Communications from Microsoft, wrote about this at his blog. According to him, about 40 engineers are working towards mid 2008 to come out with a production-quality release. The XO laptop works with 1GB Flash memory, when compared with traditional Hard Disk Drive.
OLPC, One Laptop Per Child, organisation is having a great idea towards making this product into a reality. During June 2008, Intel announced a laptop under $220 with a title as "Classmate PC". This is similar to that of XO laptop, but some of the basic difference is kind of 2GB Flash memory in ClassmatePC, where as 1GB in XO laptop.
These kind of laptops are really good towards educating the next generation kids towards the technology. Isn't a great work..
Labels: Community, Industry, Microsoft Promotions, Personal, Tech Blogs, Tips, Truths
Servers belong to Office. All these days, wife's worry that their husband not only work wholly with LapTop, on top of this, Micorosoft is coming out with one more product titling as "Stay at Home Servers". Don't you believe this .. pay a visit to their product page. Microsoft addresses this as "WindowsHomeServer". The advantages explained in nice video. This video has all the possible places that every home can have and what every one can do from every location of common home.
Where are we going .. and where is the infrastructure is moving to ?? anyhow, when will India have all such infrastructure inbuilt apartments or homes built with such facilities.
Labels: fun, Microsoft Promotions, Partner Program, Sliverlight, Tech Blogs, Tips, Truths
The ASP.NET 3.5 Extensions Preview provides a glimpse of new, powerful functionality being added to ASP.NET 3.5 and ADO.NET next year. This release delivers features that enable high-productivity data scenarios and creates the best server for rich clients. The release includes an ASP.NET model-view-controller (MVC) framework, ASP.NET Dynamic Data, Silverlight controls for ASP.NET, ADO.NET Data Services, an Entity Framework runtime, new features for ASP.NET AJAX and a wide variety of API References as hosted at ASP.NET Official site.
You can download the ASP.NET 3.5 Preview, which contain all the Siliverlight controls, ADO.NET Data Services and many more. There is a forum specially dedicated to ASP.NET 3.5 Preview at ASP.NET Forums.
Labels: .NET, Ajax, CodeSnippet, Community, Downloads, Microsoft Promotions, MSN, Orcas, Sliverlight, Tech Blogs, Tips, UserGroup, v3.5, Webcasts
Labels: Downloads, Microsoft Promotions, Tips, VS Tips
Labels: Community, Microsoft Promotions, Partner Program, Tech Blogs, UserGroup
After a long time, today, got a requirement from ASP page. Our current client has a major application written in classic ASP 2.0, and we have given him an extension functionality written in .NET with VB as programming language.
Now, we have 2 different applications running at the same box with 2 different technologies, ie., an ASP application and an ASP.NET application. For both of the applications, there is a common functionality talking to the database via a webservice written in Java. The current situation demand a common library that will be reused at both ASP.NET pages as well as ASP pages. Apart of the requirement, the one point that led me to post here is "How to call a .NET Assembly in a Classic page"
Creating .NET Assembly
Imports System
Imports System.Runtime.InteropServices
Public Class MyLibClass
Public Function MyLibFunction() As String
Return " Invoked the method from COM successfully .."
End Function
End Class
With the above code, you can generate a .NET DLL after compiling with either Visual Basic Command Line Utility, VBC.EXE or from the Visual Studio Environment. While compiling this code, give extra attention at the assembly attribute to make the DLL Visible to COM as mentioned below.
<Assembly: ComVisible(True)> If you are using the Visual Studio Environment, go to the Project Properties, at the Compile section don't forget to check the "Register COM interop" check box. This check box will be by default unchecked, indicating that the DLL will not be exposed to COM.
Now the assembly is ready to reuse. But before we start the actual implementation, if you want the Assembly should be register with the GAC, you have to take the assistance from StrongNameKey file. You can create a Strongname Key file with the command utility SN.EXE or from the Visual Studio as well. The command to create the Strongname Key file is as mentioned below
> sn -k strongnamekeyfile.snk
Once you are done with the strong name key file generation, you can attach the key file either with the /keyfile:strongnamekeyfile.snk option or with the assembly attribute as <Assembly: AssemblyKeyFile("strongnamekeyfile.snk")>
Now it is the final time to compile your code and do the calling stuff from ASP page. Once you compile the code from Visual Studio, you will have 3 files, .PDB / .TLB / .DLL. The .DLL is the actual file. You have to do 2 things to share this DLL.
Register as COM as well as with GAC
Now that the DLL is ready, we will take the assistance of REGASM command line utility to register as public assembly.
> regasm /codebase /tlb:a.tlb OurAssemblyFile.dll
With this command, the DLL will be registering at the registry. Please don't forget to use the /codebase option. To register the same with GAC use the following command
> gacutil /if OutAssemblyFile.dll
This command will register with the GAC and is available as reference within the .NET Framework. With the first command, the object is ready to invoke from ASP code. You can use the COM component with Server.CreateObject("OurAssemblyFile.ClassName") command from ASP page. The actual implementation at any ASP page will look like as mentioned below
dim objComFinally, if this page throw any kind of error as Unindentified Class name, then the only solution is to reset the IIS.
set objCom = Server.CreateObject("libraryNameSpace.libraryClass")
objCom.DoSomeWork() ' this method doesn't return any value
Labels: .NET, CodeSnippet, COM, JavaScript, Tips
For all those who didn't attend the Mix at UK during Sep 07, here is a good news. The good news is not only for those who didn't attend the MIX, but for all the technology lovers as well as persons who are passionate about latest technology happenings.
The two day event is now available for offline viewing at their website. Here is the link that give you the download of all the videos of all the sessions that happened. Isn't nice for all of us, who missed the event and who couldn't afford to attend the event.
It's time to download and view them offline. Am going to download all the events, if any of you doesn't have the i-net connectivity or by any issue, could not download these videos, drop me a mail at DSKCHECK at MSN dot COM
Catch you later..
Labels: .NET, C#, Downloads, Microsoft Promotions, MSN, Orcas, Partner Program, Sliverlight, Tips, v3.5, Webcasts
Most of the industry say that, Google is the top search engine and will give you lot of results when you search. But the missing point is that, Live Search gives you deeper search when compared to Google.
Surprising !!!! i just did a small search for my name, Chakravarthy, at both the search engines. To make the figures matter, i go upto 100 pages in Live Search results. Where as, Google takes me only upto 84 pages. To my surprise, when i go back to the 83 page, then i see the search pages count is increased from 84 to 87. is isn't it weird ..
And adding to my surprise, i read a statement at the bottom of the last search page as
"In order to show you the most relevant results, we have omitted some entries very similar to the 870 pages already displayed"
Don't believe !!!! Try out your self..
Blogged with Flock
Labels: Sliverlight
Recently, while coding for a Text Field value padded with left zeros, realised the importance of the RETURN key word for the FUNCTION written in JavaScript. Before i mention the actual importance, let me describe you the situation.
Scenario: A Text box need to be padded with zeros and should have the length of 7 digits, even the data entered is less than 7.
Ex: When the key board input being 88, the text box should show 0000088. Note the ZEROs padded on left.
So, started with a JavaScript function as mentioned below
function PadZeros(x)
{
var v = x.value;
while(v.length<7)
{
v = '0' + v;
}
var ss = document.getElementById(x.id);
ss.value = v;
}
After this, the text box is padding with ZEROs and the code is perfectly running. To allow this to code execute for any given text box, all you have to do is, add the ATTRIBUTE to that text box. And while adding keep one thing in mind that, we would be calling this function on BLUR, ie., LOST FOCUS of the text box. The code is as mentioned below.
this.txtPCode.Attributes.Add("onblur", "PadZeros(this);");
Please note the 'this' keyword. The usage of 'this' keyword has many possibilities. Let me see that, one day will post where the 'this' keyword is used and their context. And also note that, neither the function is returning any value nor the text box is added with the code that handles the output of the function. Will come to that in short.
Every thing is working perfectly well and going on smooth. But suddenly, i realised that the text box is just padding ZEROs when there is no Input. I see all ZEROs in the text box as 0000000. Then came the real trick to the function.
function PadZeros(x)
{
var v = x.value;
if(v.length == 0)
{
var vTe = document.getElementById(x.id);
vTe.focus();
alert('Please enter Provider Code .. ');
}
while(v.length<7)
{
v = '0' + v;
}
var ss = document.getElementById(x.id);
ss.value = v;
}
What do you see here is the mechanism to set the focus back to the text box. Great... but that even is not solving my purpose of leaving the text box blank when there is no input. This function is still adding ZEROs to no input and showing all ZEROs. Then came the purpose of the 'return' keyword. The entire requirement is simply solved by this keyword. All i've done is.. changed the code as mentioned below.
function PadZeros(x)
{
var v = x.value;
if(v.length == 0)
{
var vTe = document.getElementById(x.id);
vTe.focus();
alert('Please enter Provider Code .. ');
return false;
}
while(v.length<7)
{
v = '0' + v;
}
var ss = document.getElementById(x.id);
ss.value = v;
return true;
}
At the code behind added 'return' as shown here
this.txtPCode.Attributes.Add("onblur", "return PadZeros(this);");
That's all.. hoollaa... What do you say ?
Labels: CodeSnippet, JavaScript, Tips
Recent development in my technical life is that, started working out with Orcas Beta 2. So, thought to blog about the latest happenings with C# language. The idea emerged to start a series of posts related to C# new features. This is the first of ever such kind of blogging specific to a topic.
C# 3.0 has many-a-new features. To start with, let me take a concept of Implicitly Typed Variables.
Implicitly Typed Variables
In the good old days, the developer has to worry about the type of the variable. Say for instance, whether to use long or double for a counter. Here all that we observe is that the language that is built upon is the type specific. Hence forth the developer is not required to define the type of the variable at the time of declaration, but it is the task of the compiler to decide what type of the object the variable is. All that the developer has to do is that, use the var keyword while declaring the variable, similar to that of JScript or Visual Basic style. Hey!!! Stop!!!!! don't get confuse with the type of VAR variables declared at JScript or Visual basic.
Let's first discuss the difference between VAR variables at JScript and VAR variables of C#
| VAR JScript | VAR C# |
| This is of no type | The type of the variable is defined by the value declared and decided at the compile time |
| Technically have no type. Can consider of limited types, namely, string literal, numeric, boolean | Type agnostic, have specific predefined formats |
| Type conversion is coercion | Type casting is simple and handled by CLR |
| No mechanism for parsing | explicit functions for parsing to specific type |
Now, let us see the difference between the language specific VAR of VisualBasic 6.0 and C# 3.0
| VAR in VB (but not .NET) | VAR in C# 3.0 |
| By definition, these are Variant | Type of the variable is defined at the compile time |
| Could be any allowed type from with in the known types of the language | Type is decided by the value associated with the variable |
| Largest among all the known data types | Size depends on the type of the value initialised |
To summarize, the variables declared in C# 3.0 are type specific, thou used the key word VAR, during the declaration. Thus, we can conclude that the compiler is the responsible point to decide the type of the variable. Hence we can say with comfort that, the variables from C# 3.0 are Implicitly Typed variables.
Some examples as mentioned below.
var vIntVal = 10; // This will be the System.Int32 type
var vLongVal = 10000000000; // This will be the System.Int64 type
var vDoubleVal = 10.0; // This will be the System.Double type
var vFloatVal = 10.0f; // This will be the System.Single type
float vFlVal = 10.0f; // Thou defined using float key word, but inherits from Struct System.Single
var vStrVal = "String Value "; // This will be the System.String type
So, from the above declarations, it is pretty clear that the variable is defined by the value associated during the declaration. The type is not just limited to the kind of data types as explained above, but you can extend this to any type of the variable that you use while writing code for iterations, similar such as foreach. Below is the example for other known types.
foreach (var vTable in ds.Tables) // Implicitly declared a variable of Data Table Type
{
foreach (var vRow in ((DataTable) vTable).Rows) // Implicit declaration of DataRow variable
{
}
}
By using such, one can extend any extent. The limit is the imagination of the developer. What do you say?
Source:
1) http://cobdev.cob.isu.edu/psb/jscript/306.htm for JScript
2) http://www.1sayfa.com/1024/diger/vb/ch07.htm for Visual Basic 6.0 Datatypes
Labels: .NET, C#, CodeSnippet, CSharp Tips, Orcas, Tips, v3.0

With, Introducing Microsoft LINQ, as title, Marco Russo & Paolo Pialorsi, authors of the book (title same as the head line) initiated a website, keeping the concept LINQ as the center of the gravity.
The concept seems great and as on this date there is less activity from the creators of the website. Anyhow, hope that this website will become active and vibrant in short time.
Labels: LINQ, Tech Blogs
There is a big debate going on with these two buzz words. Before we get to the point of this post, let's first examine what they are... and what they mean by to the development force.
SaaS : By definition it goes like this, Software As A Service. In the good olden days, we are used to think the application as whole system and all the modules have to function only with in. But as the technology evolved and the new horizons are leading the development process to newer levels, we got a new dimension as "Web Service". This concept then further raise the functionality of the individual modules belonging to the big application turn into smaller parts of reusable components by other applications as well. Resulting the module as a service altogether for any and every consumer application.
This left the architects to view their application in smaller, exportable as well as consumable by different vendors or applications. This led to the concept of designing every application to foresee the reusability and come up with a kind of an architecture, so that every module inside the application is targeted as service. Hence the concept of "Software as a Service"
PaaS : By definition it goes like this, Platform As A Service. In the recent days, the paradigm of application switched over from an individual point of a specialized vertical to the combination with the external functionality as well. As mentioned above, the applications started consuming the Services from external world and expanding their domain functionality. The industry is not just satisfied there with.
Some thing more wanted and flexibility with in the application brought the idea of "Platform neutral" into limelight. Resulting that the application concept attain the new veneer. The architects started visualizing the need for the application platform, as a whole, to be flexible enough to work as a service. Leading to the new scope of web availability to every anonymous user.
-------------------------------------------
This is my first post that ever made me to think very deeply and came out of my own words... How is this ?
Labels: Definition, First, Industry, Personal, Truths
LINQ
By definition Linq is Language Integrated Query. That's not the concept of this post. From my understanding and experience with LINQ as well as SQL programming, i would like to make a point. Most of the ideas that are in air about LINQ is an extension to the Structured Query Language, ie., SQL. In other words it is spelled as a kind of influence by Microsoft to the SQL.
Having mentioned the misconception from the people, let me correct with my understanding of LINQ is all about Reflection. So it is not about any kind of Database related query language.
Lambda Expressions
By definition from MSDN, they are the extension for the Anonymous methods from C# 2.0. In reality they can be interpreted as anonymous functions, such as from C# 3.0 feature some thing similar to FUNC<>. In other words, lambda expressions are nothing but the inline expressions. And the function body of the FUNC goes on the right hand side of <>

A new user group that is taking into shape, specially for the teams that involve software testing. You can get to know more about this user group from http://mtaug.net or get onto http://groups.msn.com/mtaug
This group is going to be functioning in parallel with "Hyderabad .NET User Group", http://muag.net or http://groups.msn.com/dotNETUserGroupHyd
Tomorrow, 20th July 2007, is going to be the launch of the group. Am going to be there as a speaker for C# 3.0 fundamentals.. are you ?
Labels: CSharp Tips, Orcas, v3.5
Thousands of partners registered with Microsoft competing for the WPC Awards. The finalists ready and their details are out from Microsoft, you can see their details at this link. Out of 42 categories 125 partners reached the finals. 3 companies with Indian origin also found their way to the final and competing with giants. They are
The final show is scheduled to July 11, 2007. Let's see whether these companies will win and give a tough competition with the peers in the industry.
Labels: Partner Program
Labels: fun
One of the frequently seen situations from a technical standpoint in a large scale of Business Layer objects is, invoking methods from different objects when they contain same method name. Today, am going to make it simple to give an example for Runtime Polymorphism. Leave your comments if am mistaken
At this stage, I don’t think to mention about "Polymorphism", as hope that you are aware of how polymorphic behavior can be fused using C#. If you want a start up, in simple words, implementation of one Method with many definitions, as mentioned below.
class Employee
{
/// <summary>
/// Invoked for the Regular salaried employes
/// </summary>
/// <param name="intEmpId">Employee ID</param>
/// <param name="intAbscentDays">Number of days</param>
/// <returns></returns>
public long CalculateSal(int intEmpId, int intAbscentDays)
{
return (GetEmpSal(intEmpId) * (GetWorkingDays(DateTime.Now.Month) - intAbscentDays));
}
/// <summary>
/// Invoked for the employees, who work as Daily wage
/// </summary>
/// <param name="lSalPerDay">Salary per day</param>
/// <param name="intDays">For number of days</param>
/// <returns></returns>
public long CalculateSal(long lSalPerDay, int intDays)
{
return lSalPerDay * intDays;
}
}
A simple way of invoking is as mentioned below.
Employee eTe = new Employee();
long lSal = eTe.CalculateSal(124, 2);
long lSal = eTe.CalculateSal(678.35, 18);
So, by now, you are clear how to write polymorphic method and as well as how to use. Let’s jump to how you can make the Runtime Polymorphism.
To continue the discussion, first we need to know that there are 2 basic types of polymorphism. They are, Overloading, referred as Compile time polymorphism, and Overriding also called as Run-Time polymorphism. What you have seen above is the first kind of polymorphism. The second type is referred as late binding. In other words, the selection of the method for execution at runtime depends on the reference of the actual object that is triggering the invoking of the method. Now let's explore that with some example.
Let us take a small class, as mentioned below with few properties. This class acts as a base class for us.
public class EmpNames
{
public string FirstName { get; set; }
public string MiddleName { get; set; }
public string LastName { get; set; }
}
We will now inherit this into the following classes. Observe that the both classes doesn't have any direct relation with each other and can be instantiated as is.
/// <summary>
/// This class calculate the wages for given number of days
/// </summary>
public class Wages : EmpNames
{
/// <summary>
/// This will calculate the wages for the employees
/// </summary>
/// <param name="Params">Wage per Day, Number of Working days in a month</param>
/// <returns> WagePerDay * WorkingDays </returns>
public double CalculateSalary(ArrayList Params)
{
return double.Parse(Params[0].ToString()) * int.Parse(Params[1].ToString());
}
}
/// <summary>
/// This class will calculate the salary
/// </summary>
public class Salried : EmpNames
{
/// <summary>
/// This will calculate the salary for the employees
/// </summary>
/// <param name="Params">Working days Per Month, Leaves, Salary Per Month</param>
/// <returns> Full Salary in case no value for Leaves. Other case, (SalaryPerMonth/WorkingDays) * (WorkingDays - Leaves) </returns>
public double CalculateSalary(ArrayList Params)
{
double dSal=double.Parse(Params[2].ToString());
int intLeaves = int.Parse(Params[1].ToString());
if (!intLeaves.Equals(0))
{
int intWrkDays = int.Parse(Params[0].ToString());
dSal = (dSal / intWrkDays) * (intWrkDays - intLeaves);
}
return dSal;
}
}
Now that we have these two classes, We can write our code to instantiate them as individual. But the point of this post is to describe the "RunTime Polymorphism". Before we go further, note that, each class has the method "CalculateSalary" and as they are not directly related, you can instantiate them with out any hassle.
EmpNames empObj;ArrayList alValues = new ArrayList();
alValues.Add(30); //Just add all the fields as this
bool bSalaried = true; //am using this variable for validation of emp
if (bSalaried) //Validating whether Salaried or Wages
empObj = new Salried();
else
empObj = new Wages();
After executing the above lines of code, you are sure about the type of the variable empObj. This is Runtime initiating the object. But this is not the purpose of our current topic.double dVal;
//The below line will throw compile time error
//dVal = empObj.CalculateSalary(alValues);
dVal = ((Wages) empObj).CalculateSalary(alValues);
What do you see from the last line of the above code? Did you find that the method invoked is from a class type. Now, think that, what if the class is being instantiated as Salaried and the last line is being invoked?
This is called as RunTime Polymorphism.
-----------------------
Declaimer: What ever you read here is out of my own experience. No one shall be made responsible for the contents and issues that are mentioned here. If you have something to share in person on this post, pl drop me a mail at dskcheck@gmail.com with the title in the subject.
Labels: .NET, CodeSnippet, VS Tips
During my last interview, got a question about the mentioned subject. Have decided to learn and post some code.
Definition of the Asynchronous Calling:
Executing the method Asynchronously, inother words, executing like the concept of Thread. The bottom line is inheriting the method by System.IAsyncResult and using BeginInvoke and EndInvoke to track the status of the method. Between these methods, one can check the status by IsCompleted status.
This is acomplished by Deligate keyword. Will edit this post during the time with all the example code.
Labels: .NET, CodeSnippet, Tips
Labels: Tech Blogs, VSTS
Labels: VS Tips
public static string PropCase(string strText)Ofcourse, you have to use the Globalization class to get the CultureInfo method be available for conversion.
{
return new
CultureInfo("en").TextInfo.ToTitleCase(strText.ToLower());
}
Labels: CodeSnippet
Labels: Tech Blogs
After trying out many client tools to post from my desktop, am now decided to use Microsoft's Live Writer.
Seems simple, let me try out this. How do you see this post on the web now?
Isn't it cool ???
The Microsoft .NET Framework 3.5 Beta 1 is a preview release of the latest version of the .NET Framework. Many ISV’s, enterprises and Microsoft product teams are successfully building on the new features Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF) and Windows CardSpace in the .NET Framework 3.0. Microsoft plans to continue to invest in the .NET Framework developer platform and in support of existing users the .NET Framework 3.5 has a minimal number of breaking changes. So that existing applications built for .NET Framework 2.0 or .NET Framework 3.0 should continue to run without requiring changes. The .NET Framework 3.5 adds new features in several major technology areas; including:
.NET Framework 3.5 is planned to release at the end of 2007 and will ship with Visual Studio code name ”Orcas” and will also continue to be available for separate download from MSDN. For more detail about the features being introduced in .NET Framework 3.5 and Visual Studio code name “Orcas”, click here http://msdn2.microsoft.com/en-us/vstudio/aa700830.aspx
And you can dowload the latest version from this link. Did you?
-----------------------
If you have something to share in person on this post, pl drop me a mail at dskcheck@gmail.com with the title in the subject.
Labels: Team
|
My understanding towards this goes as mentioned below,
First - NO STANDARDS : Who creates these Standards .. aren't these created by individuals like us??? why people are used to relate them with companies ??? and blame on organisations ??? if there is a practice that is resulting and implemented in an organisation, the employees who is currently working with that company ignore them when they join new organisation and start blame the new organisation. Would like conclude on this topic is, STANDARDS doesn't belong to organisations, but to INDIVIDUALs
Second - HAVE NOTIME : A big laugh, recollect from some old book that, "TIME IS THERE WITH THOSE WHO PLAN". To justify the statement, Prime Minister / Chief Minister / You and ME / Every one 's time is totally planned in-advance with regular stuff like sleep / wakeup / bath / travel / eat / blah .. blah .., isn't it. But what happens if there a sudden requirement for these guys to attend. In case of CMs / PMs they will plan again to reschedule all their plans. Isn't it. But what about those who say,
To me, "HAVE NO TIME" is really a statement with no meaning... GUYS !!!! Wakeup and start planning, then you have lot's of time
Anyhow, pl comment
-----------------------
If you have something to share in person on this post, pl drop me a mail at dskcheck@gmail.com with the title in the subject.
Labels: Personal
Labels: Hoax
Labels: Linux
Labels: Error
Labels: Microsoft Promotions
Let me post about the truths that many of you unaware
First ) Am a Diploma holder for Bharatha Natyam
Second ) While persuing Education, dance tutions are my main trade towards financial support for my education
Third ) Started my technical career as DataEntry operator with HPCL at Kondapally @ 70/- perday for entering about 3000 records. This is during my 3rd year of Graduation. During the entire year, very few days visited the college.
Forth ) Soon after the college exam on April 2nd 1996, started my professional career as Faculty Member at Prime Computers, Gudiwada on April 4th 1996.
Fifth ) Recently finished the 6th Sem Exams of MCA from Sikkim Manipal University. Yet there are 4 & 5 th semisters are pending due to my visit to Dubai.
-----------------------
If you have something to share in person on this post, pl drop me a mail at dskcheck@gmail.com with the title in the subject.
Using the Visual Studio .NET 2003 Debugger with ASP.NET ApplicationsDid you come across of such articles any other place ... pl post back here to know more.
Labels: Debug
Labels: CSharp Blogs
Labels: Ajax

Labels: Error
*With XXXXXXX Web Calling, you can make two free three-minute phone calls to virtually any landline or cell phone worldwide. Offer applies to new Verizon Web Calling customers only.
Labels: MSN
Phoenix is the code name for a software optimization and analysis framework that is the basis for all future Microsoft compiler technologies
I've tried the Webserice Factory, and yet to try out the Mobile. Did you any?

The partner system exposed as XMLWebInterface, which accepts XML Data as POST and returns XML as GET. I’m using HttpWebReqeust from System.Net classes to post and get responses from the exposed interface. One of the interesting tasks that I’ve ever done in my life.| Name | Salary |
| Karthik | 25000 |
| Samuel | 32000 |
| John | 17000 |
| Murali | 28000 |
| Syam | 15000 |
Output should be
| Name | Salary |
| Syam | 15000 |
| John | 17000 |
| Samuel | 32000 |
| Murali | 28000 |
| Karthik | 25000 |
Today, while reading about the patches for Teamsystem, came across of Rules to follow while conducting Scrum. This data found from Scrumforteamsuit product website. As the website says, this product is developed by Conchango in collaboration with Ken Schwaber and Microsoft. At this point of time, I need to mention about Ken Schwaber, Ken Schwaber co-developed the Scrum Process with Jeff Sutherland in the early 1990s. Visit Ken’s website to learn more on Scrum.
Here are the guidelines or thumb rules during the scrum participation. Let me see, how this will work out for me.
Did you try out this?
Today, while searching for information related to Phishing attacks, I came across of a white paper published by “NGS (Next Generation Software)”. The whitepapers link has great information related to Security threats and the prevention mechanisms. Great research information at single location.
Must have a copy in your library. I had one, did you?

Are you ready to secure your code? Well i'm ready and prepared to shoot out the threats to my code.
Microsoft is conducting a contest for all the developers to prove their skills on securing code. I've registered to this contest, did you?
Wish me all the best for the first round..
| Tasks | Architect | Administrator | Developer | Tester |
| Performance Goals | A | R | C | I |
| Performance Modeling | A | I | I | I |
| Performance Design Principles | A | I | I | |
| Performance Architecture | A | C | I | |
| Architecture and Design Review | R | I | I | |
| Code Development | | A | | |
| Technology-Specific Performance Issues | | A | | |
| Code Review | | R | I | |
| Performance Testing | C | C | I | A |
| Tuning | C | R | | |
| Troubleshooting | C | A | I | |
| Deployment Review | C | R | I | I |
| SOA | OOPs |
| These are Schemas | These are Types |
| These are isolated | Linked |
| Contains separate deployment | Synchronized Deployment |
| Interoperable based on standards | Transparent use of functions remotely |
Regards,
DSK Chakravarthy
Sr. Software Engineer
Mercator – Member of the Emirates Group
Area 2, 7th Floor, Al – Fattan Plaza,
Post Box – 686, Dubai, UAE
Desk +971 (0)4 213 3115
Fax +971 (0)4 213 3998
Mobile +971 (50) 281 9972


