Wednesday, September 19, 2012

Introduction to SVN

What you will need to download the Tortoise SVN client application.
Download and install and after a restart (bummer) we are ready to start working!
The Tortoise SVN adds its functionality in the Windows Explorer Context Menu.
Introduction to SVN

Verifying the connection to the SVN Server

Before we start working we will have to Verify the connection to the SVN Server. Right click on any folder in the Windows Explorer and select TortoiseSVN -> Repo-browser
you will be asked for a path to the repository enter : file:///C:/<The location of the repositories>/<The repository name you selected> in my case I will enter :
what you should get is this:
Introduction to SVN
If you got this it means that you can connect to the SVN Server.
If you are trying to connect to a remote server you will have to enter the following when asked for the URL of the repository:
https://<The ip of the Server>/svn/<The Repository Name>
You should get the same results.

Getting the files from the repository

To get the files from the repository we created earlier (in the previous article) we will have to create a new folder, which I presume everyone knows how to do :).
After you have created the folder, right click on it and select the "SVN Checkout…" option from the context menu. You will see the following screen:
SVN Checkout
If you followed all the steps the address of the repository should be already written here. All you have to do is click "OK"
Files Checked Out
This means we have checked out the files successfully and we can start working!
The directory should look like this:
Checked out Directory
The Green V marks mean that nothing has changed inside the directory. Lets add a new file to the trunk (main branch) directory. We will then Right Click on the trunk and select "Commit"
SVN Commit
The SVN Server has detected that you have added a new file and you will have to check the Checkbox next to it in order for it to be inserted to the repository.
Lets try and edit the file and add some text in it. Both the file and the Directory will get a red exclamation mark saying they have been changed:
Folder Changed
File Changed
To send the Changes to the Server you can right click any of them and select "SVN Commit…" from the context menu. Doing it on the Folder will make the Commit recursive to all the files inside it.
That’s it!

Saturday, September 15, 2012

Shortcut to Lock Your Computer

You secure your computer by locking it whenever you're
away from your desk. If you are on a domain, by pressing Ctrl+Alt+Del and then
clicking Lock Computer, you can prevent unauthorized users from gaining access
to your computer. Only you and members of the Administrators group on your
computer can unlock it.


Follow the below steps to accomplish the

Right-click an
open area of your desktop--> point to New--> and then click

Shortcut to Lock Your Computer

2. In
the Location box, type %windir%\System32\rundll32.exe user32.dll

Shortcut to Lock Your Computer

3. Click Next--> in the Name box type a name
for the shortcut such as--> Lock Computer--> and then click

Shortcut to Lock Your Computer

Shortcut to Lock Your Computer


How to Change a Printer from Offline to Online.

Once you have added either a USB or networked printer to your PC or Mac computer, you can begin sending documents to print. However, on occasion, a print command will create an error on the printer and take it offline, which will prevent all future jobs from printing. To resolve this issue, you will need to change your printer settings from offline to online.

PC Instructions

1. Open the Start menu and click on the "Printers and Faxes" icon. This will open a window with a list of the printers currently set up on your computer.

2. Double-click on the icon of the printer you want to change to online. A pop-up window detailing all current print jobs will open.

3. Go to Printer in the menu bar of the pop-up window and uncheck "Use Printer Offline." This action will change the printer from offline to online.

Mac Instructions

1. Open System Preferences by clicking on the icon in the Dock.

2. Go to the Print & Fax control panel under the Hardware category.

3. Select the printer you want to take online from the list on the left side of the screen. Then click on the "Open Print Queue" button.

4. Click on the "Resume Printer" button at the top of the queue window to change the printer from offline to online.

The open source ASP.NET CMS

1. DotNetNuke

Of all the ASP .NET CMSes out there, DotNetNuke is probably the most well known and popular. One of the reasons for the popularity of this CMS is due to its multiple versions which allow for the flexibility to accommodate a beginning web developer, a small to medium sized business, or even a large enterprise. It has enjoyed a busy development since before 2003 that continues to this day.
For those that don't need much support other than what the open source community can provide, there's the DotNetNuke Community Edition offered under the BSD License. It contains most of the features which comprise the other editions, but the support is left up to the community. The Professional Edition gives you support from the DotNetNuke Corporation along with a few more features, and for a (much) increased price, the Enterprise Edition gives you a few more features along with phone support.
This CMS has been around for a while, so it's very stable and there's a plethora of add-ons in the community, so it's definitely the first stop if you're looking for something that's proven.

2. Orchard

Provided under the New BSD License, Orchard CMS is Microsoft's hand in the open source world. The Orchard Project is based on a community, backed by full-time developers from Microsoft, that develop components and scripts that are open tools for developers to create applications, and their primary focus at the time is Orchard CMS. Despite some slow development in the beginning, Orchard has struck a chord with the open source community, and the number of contributors is growing every day.
While some of the things you'd expect in a more robust CMS might be missing, there's several fantastic back-end features which will delight anyone who is looking for a young project to support that has a great prospect of growing in the future.

3. Kentico

Kentico CMS for
Another CMS offering multiple licensing options is the Kentico CMS. The free license requires you to keep the logo and copyright information on your page, but the commercial versions offer support and allow you to work without the branding. It's designed to be easy to use for even novice users, so web development should go fast with someone who is experienced.
Kentico's focus lies in three areas: Content Management, E-Commerce, and Social Networking. That broad base makes it an excellent choice for a wide variety of technology ventures. If the company's success, showing a three year growth of 553%, is any indication, this is a CMS to keep an eye on.

4. Umbraco

As an open source project, Umbraco isn't going to break your budget, and it has really come alive over the past few years. It was first released in 2004 but it took a little while for it to gain traction. Lately, though, it has become very popular with designers due to the open templating system and ability to build in guidelines that automatically format the content writers provide. Also, it uses ASP .NET “master pages” and XSLT, so you won't have to work with a heaped-together templating format. It's written in C# and is happy to work with a variety of databases, so hosting shouldn't be a problem for you.
In 2009, CMS Wire dubbed Umbraco as one of the best open-source .NET CMS options available. In 2011, it was averaging close to 1000 downloads a day via Codeplex and is highly ranked amongst top downloads via the Microsoft Installer.

5. mojoPortal

mojoPortal is another open source CMS option based upon the .NET framework. It has a very active developer group and is consistently being updated. While it is free to download and use, there are a number of commercial add-ons that are used to help fund the project. When it comes to developing your own applications, many people prefer mojoPortal because it can act as a starter kit for advanced .NET sites or portals.
mojoPortal is also considered to be very strong as a standalone CMS. It is easy to learn and very simple to use. It includes a variety of different tools such as blogs, photo galleries, chat, newsletters, pools, forums, and much more. It also has a very strong community which makes troubleshooting extremely simple.

6. Sitefinity

Sitefinity is a commercial .NET content management system with 5 available license editions ranging from free for personal use, to $499 for small businesses up to $19,999 for enterprise use. The license will last for 1 year and during this time, you will get every update and free technical support with paid licenses. Once the year is up, you can still use Sitefinity to run your sites, however you will no longer receive free support or software updates. It is also important to note that the standard license is only good for one domain.
Currently Sitefinity is responsible for powering more than 200 government websites as well as large companies. Some of their most prominent government websites include: The White House Federal Credit Union, United States Courts, Downtown Fort Worth, and the Canadian Securities Transition Office. Additional customers include: Toyota, Vogue, IKEA, Chevron, Bayer, and Coca-Cola. With the price tag as high as it is, you'll want to be sure you're happy with it before you buy it by trying it first, but if the big boys are paying nearly $20,000 a year for it, you know the customer service is going to be top notch.

7. Composite C1

Composite C1
A relative newcomer to the ASP.NET market, Composite C1 was originally sold as a commercial CMS in Northern Europe until September 2010. Now, it's a free and open source CMS in version 3.0 that's offered under the Mozilla Public License. It's focus is for web developers working on corporate websites, so its learning curve is most likely too steep for the neonate. The 3.0 version, released in December 2011, was only downloaded a little over 1000 times from codeplex, but despite it's dark horse status, it continues to be a well designed CMS for the more experienced developer that wants their CMS to be more functional than it is beautiful.
There are enough free community and commercial add-ons for you to plug in the functionality you need quickly, so Composite C1 is worth checking out if you want to get your hands dirty.

Wednesday, September 5, 2012

Some best practices while writing ASP.NET code

Use int.TryParse() to keep away from Exception.

While using Convert.ToInt32(), if the input parameter is of wrong format and if it can not be convertable into integer then an exception of type "System.FormatException" will be thrown, but in case of int.TryParse() no Exception will be thrown.
e.g :-
If we are converting a QueryString value to integer and the QueryString value is "de8913jhjkdas", then -
int employeeID = 0;
employeeAge = Convert.ToInt32(Request.QueryString.Get("id"));//Here it will throw an Exception.
int employeeAge = 0;
int.TryParse(Request.QueryString.Get("id");, out employeeAge);//Here it will not throw any Exception.

You can also use bool.TryParse, float.TryParse,double.TryParse, etc for converting into other datatypes.


Convert.ToString() V/S obj.ToString()

Use Convert.ToString(), because if you are using obj.ToString() and the object(obj) value is null it will throw an excetion of type "System.NullReferenceException".

The cause of the exception is null doesn't have a method called ToString().

Response.Write("Name : " +Session["User_Name"].ToString());        //Here it will throw an Exception if Session["User_Name"] is null.

Response.Write("Name : " +Convert.ToString(Session["User_Name"])); //Here it will not throw any Exception.

String.Empty V/S ""

If you want to check whether a string is empty or not then use String.Empty instead of "", because "" will create a new object in the memory for the checking while String.Empty will not create any object, because Empty is a read-only property of String class.

So its better to use if("Devi" == String.Empty) instead of if("Devi" == "").

You can also use if("Devi".Length == 0) for doing the same thing but if the string is null then it will throw an exception of type "System.NullReferenceException".

 String.IsNullorEmpry() V/S ("" || null)

Suppose you want to check a string for both its emptiness and nullability then its better to use String.IsNullOrEmpty() instead of ("" || null). Because "" will create a new object but String.IsNullOrEmpty() will not do so.

So its better to use if(String.IsNullOrEmpty("Devi")) instead of if("Devi" == ""|| "Devi" == null)