Thursday, 13 November 2008

Visual Studio 2010 here to try

Microsoft visual studio 2010 CTP version VHD available from microsoft's new connect web site..

https://connect.microsoft.com/VisualStudio/content/content.aspx?ContentID=9790

Saturday, 25 October 2008

Free Anti Virus Systems

Few useful links to Free anti virus systems for personal use.

http://free.avg.com/

http://www.avast.com/

Saturday, 18 October 2008

File monitoring on Windows

I was wondering today what the hell my system was doing as I hear continuous harddisk activity (rather call it noise) for a long time. I found the FileMon tool from microsoft very useful, installed and traced the culprit.

FileMon shows all file activity with advanced filters.

Wednesday, 15 October 2008

Mounting ISO file as a CD Drive (Virtually)

Here is a very useful software for mounting your iso file as a virtual cd from microsoft.
Download here
Very handy while installing some of the software and need to run it from cd drive only.

Friday, 10 October 2008

Ajax Alessandro Gallo's Article further reading

A closer look at Page methods provides clarity on calling Page web methods and parameters involved with an example.
Good reading for new .Net Ajaxian's!

DevArchive.net Blog: Calling page methods from javascript by method name (ASP.NET AJAX)

DevArchive.net Blog: Calling page methods from javascript by method name (ASP.NET AJAX)

Excellent article on writing Page Methods to call from Ajax.

Happy Ajaxing!

Tuesday, 7 October 2008

Online color pickers

Found this useful tools.

http://www.pagetutor.com/colorpicker/index.html

Another beautiful one here.

http://www.colorpicker.com/

Happy Coloring!

Tuesday, 17 June 2008

TRY CATCH in SQL Code

This is quite a handy feature in SQL Server that has been introduced recently.

In your stored procedures or functions,you can now write a try catch block and catch errors as we do in the more proper programming lanugages.


USE [SAMPLEDB]

GO

- StoredProcedure [dbo].[GetStudents]

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE dbo.GetStudents
AS

SET NOCOUNT ON;

--Error variables
DECLARE @errMessage VARCHAR(2000)
@errNum INT,
@errSeverity INT,
@errState INT,
@errProcedure NVARCHAR(500),
@errLine INT


BEGIN TRY

-- Do some processing here...
Select * from Students
-- Open Cursor etc

END TRY
BEGIN CATCH

--capture error information into variables
SELECT @errNumber = ERROR_NUMBER(),
@errSeverity = ERROR_SEVERITY(),
@errState = ERROR_STATE(),
@errProcedure = ERROR_PROCEDURE(),
@errLine = ERROR_LINE()

--raise an error now

RAISERROR (@errMessage, @errSeverity, 1, @errNumber, @errSeverity, @errState, @errProcedure, @errLine) WITH NOWAIT;

--rollback any open transaction

IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION;
END

GOTO OutOfCatch

END CATCH

OutOfCatch:

- Finishing code here

Tuesday, 3 June 2008

WCF, SOA and AJAX quick reading!

WCF, SOA and AJAX

The latest programming framework from microsoft for distributed applications. WCF is a single answer to various approaches existed earlier which are WebServices,Remoting and COM+, DCOM etc. In other sense WCF is replacement for .Net 1.0/1.1 's Web Services and Remoting technologies.

WCF enables implimentation of SOA (Service Oriented Architecture) where application is seperated into consumable (functions/methods) services which can be consumed by client applications over a distributed environment.

WCF can use SOAP messages for communication between two processes. WCF implements many advanced web services (WS) standards such as WS-Addressing, WS-ReliableMessaging and WS-Security.

WCF implimentation
WCF Service is implimented as a class. WCF Service involves following concepts.

Service Contract
An interface that defines operations/methods that are available on the service. These methods transfer data which

Data Contract
Date Contract defines the so called data transfer objects in/out of the WCF Service.

Implimenting a WCF Service Example

http://msdn.microsoft.com/en-us/library/ms733764.aspx

WCF Service run time behaviour can be controlled. Checkout the following example.

http://msdn.microsoft.com/en-us/library/ms734715.aspx

End Points
WCF client connects to a WCF Service via an EndPoint.

End point defines (ABC) Address/Binding/Contract which specifies

- An address that indicates where the endpoint can be found.
- A binding that specifies how a client can communicate with the endpoint.
- A contract that identifies the operations available.
- A set of behaviors that specify local implementation details of the endpoint.

END POINT Example

http://msdn.microsoft.com/en-us/library/ms734786.aspx

Create Endpoint in code

http://msdn.microsoft.com/en-us/library/ms731080.aspx


Message Contracts

Data contracts carry data in and out of the operations provided by WCF. Message contracts extend or enable them over to SOAP.

WCF supports two kinds of operations.
-RPC (Remote procedure call Style) or Messaging Style

RPC uses its binary approach hence can serialise any type of data.

Messaging style is to enable SOAP with seemless programming feature for developers.
which enables developers use SOAP messages quickly and easily create and use service applications without learning SOAP protocall in much detailed.

Using Message Contracts

http://msdn.microsoft.com/en-us/library/ms734715.aspx

Hosting and Consuming WCF Services.

http://msdn.microsoft.com/en-us/library/bb332338.aspx

Now coming to consuming WCF using AJAX

I find the following example, a simple and clear demonstration of how WCF call works below the surface of new AJAX script manager reference model.

This example uses basic xmlhttprequest object to make the asynch call.

http://blogs.msdn.com/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx

AJAX call to WCF service can be made using the new scriptmanagerproxy control which automatically generates a dynamic javascript object which can then be consumed in javascript.

Few Links to WCF Tools

servicesengine

Service Trace Viewer

More on this in another article soon.

Happy Coding !


Thursday, 29 May 2008

Plug in for Visual Studio for Auto Commenting code

A great solution to developers nightmare called "Documentation/Commenting the code"

Ghostdoc is a nice handy plugin for Visual Studio that helps you in commenting your code.

http://www.roland-weigelt.de/ghostdoc

Friday, 9 May 2008

XML Deserialisation - Useful technique in writing DAL

Usual scenario in 3 tier model is to develop DAL layer which interacts with database objects such as tables, stored procedures etc.

While writing methods that retrieve data and build bussiness objects, usual steps followed are

Connect to database
Get data into a DataReader/DataTable
Create corresponding Business Obejct
Assign properties to give life to the business object
Return the business object with data

Now I would like to bring attention to the following technique which saves the hassle of assigning each property of the object using XML serialisation.

Here I took student object as our case. The stored procedure which returns Student object information from database table must be written using FOR XML clause in T-SQL so that it returns data in XML format.

GETTING ONE RECORD / RETURNING ONE OBJECT

SELECT [ID]
,[StudentName]
FROM [Students Where ID = @StudentId
FOR XML path('Student')


GETTING LIST OF RECORDS / SERIALIZE TO LIST<> OR COLLECTION<>

SELECT [ID]
,[StudentName]
FROM [Students
FOR XML path('Student'), root('ArrayOfStudent')

Here Path('ClassName') and root('ArrayOf' + ClassName) needs to be carefully coded.

Now the xmlSerializer.Deserialize assigns all the corresponding properties from XML into the Student object and builds it for us automatically saving the hassle of assigning all the properties from for ex. DataReader object one property a line etc.

Final note is that this technique works only if your Business Object exactly reflects to the data that is being returned from your stored proc. I find this technique useful in certain occassions.

public Student GetStudentById(int StudentId)
{
using (SqlConnection dbConnection = GetConnection()) // assuming this function returns new connection
{
dbConnection.Open();

SqlCommand dbCommand = dbConnection.CreateCommand();
dbCommand.CommandType = CommandType.StoredProcedure;
dbCommand.CommandText = "GetStudentByIdXml";

SqlParameter studentIdParam = dbCommand.Parameters.Add("@ID", SqlDbType.Int);
studentIdParam.Direction = ParameterDirection.Input;
studentIdParam.Value = StudentId;

using (XmlReader xmlReader = dbCommand.ExecuteXmlReader())
{

XmlSerializer xmlSerializer = new XmlSerializer(typeof(Student));
Student student = (Student)xmlSerializer.Deserialize(xmlReader);
if (student == null)
{
throw new ApplicationException("Student not found!");
}

return Student;
}
}
}

INCASE OF RETURNING LIST<> OR COLLECTION

using (XmlReader xmlReader = dbCommand.ExecuteXmlReader())
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(List));
returnList = (List)xmlSerializer.Deserialize(xmlReader);
}


Happy Coding!

Wednesday, 7 May 2008

Web Dev tools,frameworks and useful sites

CSSBeauty Database of well designed web content and css

Joomla Worlds most famous content management tool

TextLinkAds Online text Ad engine

RubyOnRails Open source web framework

MooTools Open soruce Ajax framwork

Wednesday, 19 March 2008

IE Developer Bar for debugging Javascript/css etc

Nice new tool from, yes this time Microsoft itselft apart from the debugbar that is also very good.

The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages.

IE Developer Bar

Great help to UI developers.

Automatic Property in .Net 3.0

Class Sample
{


Private int m_UserId;

Public int UserId
{
get{ return m_UserId; }
set{ m_UserId = value; }
}


}


Now the new .Net 3.0 approach is

Class Sample
{

Public int UserId
{
get;
set;
}

}

Saves few lines of regular code and you can change the scope of get or set to make the property read only etc.

Default values for reference types are going to be null and value types to be according to the normal behaviour of .Net.

Tuesday, 18 March 2008

Converting string into GUID in C#

Some thing as easy as this may make you blink for a while on a busy day.

string strGuid;
strGuid = "your existing guid in string format";
Guid guid = new Guid(strGuid);

Friday, 14 March 2008

doPDF - Free PDF creator - very easy to use.


http://www.dopdf.com

doPDF6.0
installs itself as a virtual PDF printer driver so after a successful installation will appear in your Printers and Faxes list.

To convert to PDF, you just have to print the document to the doPDF free pdf converter. Open a document (with Microsoft Word, WordPad, NotePad or any other software), choose Print and select doPDF.

It will ask you where to save the PDF file and when finished, the PDF file will be automatically opened in your default PDF viewer.

Great Stuff !!

Thursday, 6 March 2008

Great new way to read msdn

MSDN reader, a nice new tool to get rss synch'ed and easy way to scroll thru pages.

http://code.msdn.microsoft.com/msdnreader

Virtual PC on web: New world of webtops - your pc on net

Few WebTop links. Amazing new flash based web sites.

http://demo.eyeos.org

http://g.ho.st/main.jsp

http://www.jooce.com

http://desktoptwo.com

Monday, 25 February 2008

Free and Easy to use Backup Software

I have been searching for a simple to use good Backup software for personal (bonus if free).
Finally found a wonderful software!.
Here is the link.

http://www.educ.umu.se/~cobian/cobianbackup.htm

Thursday, 21 February 2008

New world of MS Ajax Client Reference - Good Bye to getElementById

By now most of us know what Ajax can do for us, but interms of basic javascripting (DOM) there were not many improvements since long time, now we have a new package of easy to work api's available with Microsoft Ajax.

http://asp.net/AJAX/Documentation/Live/ClientReference/default.aspx

Small example of simplicity introduced is..

document.getElementById("Button1").value = "new label for the button";

can be written with a simple $get method as shown below.

$get("Button1").value = "new label for the button";

Happy Scripting!!

Wednesday, 20 February 2008

.js files nested to your aspx pages - registry setting

As an option it is nice to have javascript removed from aspx pages and put into .js files but if they sit in seperate location it may become difficult to manage them in visual studio as to which page is using which .js file.

if you want (pagename).aspx.js to be treated as a nested object like (aspx.cs) file you can use the following registry settings.

Add the below text to a settings.reg file and right click the file in windows explorer to find an option to "merge" menu option. Choose it to add settings to registry and restart visual studio to find the effect.


--------- settings.reg-----------------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.aspx\.js]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Projects\{E24C65DC-7377-472b-9ABA-BC803B73C61A}\RelatedFiles\.ascx\.js]

--------------------------------------------


you may need to have LoadScriptsBeforeUI="false" in scriptmanager if you are using ajax in the same pages.

Happy scripting seperate in (pagename).aspx.js files.!

Tuesday, 19 February 2008

Tuesday, 12 February 2008

A simple and easy Scrum process guide!

This is for people who are interested to impiment scrum but unable to find simple and easy material which takes straight to the point.

Scrum awareness and impimentation guide

http://www.scrumforteamsystem.com/processguidance/v2/ProcessGuidance.aspx
http://www.scrumforteamsystem.com/processguidance/v2/Scrum/Scrum.aspx
http://www.scrumforteamsystem.com/processguidance/v2/Process/Process.aspx

Popular Scrum Tools

http://www.agile42.com/cms/pages
http://www.agile42.com/cms/pages/download

or

http://trac.edgewall.org/wiki/TracDownload

Create Virtual harddrive .VHD file from Phisical Drive

Here is a good tool for this purpose.

http://www.winimage.com/download.htm

This tool creates .vhd files that can be used with Microsoft Virtual PC. Great stuff.