Sunday, July 22, 2012

Important Law's of Computer or IT Industry

Parkinson’s Laws: 

1st law:
"Work expands to fill the time available"
"Data expands to fill the space available for storage."
 2nd law:
Expenditures rise to meet income

Wirth's law:

 "Software gets slower faster than hardware gets faster".

Moore's law

(Intel's co-founder Gordon Moore) the number of transistors on integrated circuits doubles approximately every two years. The period often quoted as "18 months" According to "2010 update to the International Technology" Roadmap for Semiconductors has growth slowing at the end of 2013, and after 2013 "time transistor counts and densities" are to double only every 3 years not 18 months

Last but not least, a very important rule for project management: You can't control what you can't measure.

Tuesday, June 26, 2012

How to Use VSS in Visual Studio 2010?

I have been asked this question many times, so I thought I can write down a blog on this topic.
Question: How can I use VSS(not TFS) in Visual studio 2010?
Solution: Please follow these steps to use VSS in Visual Studio 2010:
Step-1. Go to Tool and Option

Step-2.In Option select Source Control(see 2.1 in image). Then Select VSS from dropdown Source Control PlugIn. Click OK.

Step-3. In VS2010, open a solution. Right click on solution(3.1) and then select "Add solution to source control".(see 3.2 in image).

Step-4. Select database for sourcesafe and it will add the solution in VSS

I hope it will help you. Enjoy green coding at

Wednesday, May 23, 2012

Enum comparison Sample

Here is the sample for using enum for comparison with numeric value. See the highlighted lines for using a enum comparison in switch case:
you can use this aspx page's code behind file to test in your aspx page, for this you have to make the following changes Inherits in aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPage.aspx.cs" Inherits="Code4Green.FreeCodeGenerationTool.TestPage" %>


using System;
using System.Web.UI.HtmlControls;

namespace Code4Green.FreeCodeGenerationTool
    public partial class TestPage : System.Web.UI.Page
        public enum FilterByDoctorType

        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                this.Controls.Add(CreateDoctorContextControls(1, 111011));
                this.Controls.Add(CreateDoctorContextControls(2, 111011));
                this.Controls.Add(CreateDoctorContextControls(3, 111011));
                this.Controls.Add(CreateDoctorContextControls(4, 111011));

        private HtmlGenericControl CreateDoctorContextControls(int filterByValue, int doctorId)
            HtmlGenericControl htmlStudentListItemControl = new HtmlGenericControl();

            switch (filterByValue)
                case ((int)FilterByDoctorType.General):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"General Physician. "); break;
                case ((int)FilterByDoctorType.Dental):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Dental Surgon. "); break;
                case ((int)FilterByDoctorType.ENT):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"ENT Specialist. "); break;
                case ((int)FilterByDoctorType.Orthopadic):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Orthopadic surgon. "); break;
                case ((int)FilterByDoctorType.Cancer):
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"Cancer Specialist. "); break;
                    htmlStudentListItemControl = CreateYourWebControl(doctorId,"General Physician"); break;

            return htmlStudentListItemControl;

        private HtmlGenericControl CreateYourWebControl(int doctorId,string yourText)
            HtmlGenericControl divControl = new HtmlGenericControl("div");

            HtmlGenericControl hyperlinkControl = new HtmlGenericControl("a");
            hyperlinkControl.Attributes.Add("href", "");
            hyperlinkControl.Attributes.Add("class", "yourCSS.Class");
            hyperlinkControl.Attributes.Add("title", "Plant a free tree by using code4green website");
            hyperlinkControl.InnerText = "goto code4green website";

            HtmlGenericControl spanControl = new HtmlGenericControl("span");
            spanControl.Attributes.Add("class", "MySpanClass");
            spanControl.InnerText =yourText;
            return divControl;

Wednesday, April 25, 2012

SkyDrive War - MS, Google, and DropBox

Are you ready for SkyDrive war? Google has launched GoogleDrive(same as MS's SkyDrive) too. Now there are three major player in the market(cloud based market). Microsoft, Google, and DropBox. The major difference is data storage. Microsoft is giving 25GB+unlimited MS office docs+unlimited photos, while Google is just giving 5 GB space(for extra space you have to pay  $2.49 per month for 25 GB).
Another big difference is declaimer. Google declaimer is saying that google will have rights on your documents, while Microsoft and Dropbox are not claiming your documents.
If you are already a member of existing SkyDrive users than go to SkyDrive website and claim your free 25 GB.
Here you can see the comparison between cloud based storage drives
Compare SkyDrive
Generate Green Code Using

Thursday, April 19, 2012

How To Clean Infected site or SQL INJECTION "<script src=>"

If your site has been hacked and your web pages are opening some website that mean your website has been hacked. There are two kind of possible injections your site may have:
  • File injection: Your web files like html pages/javascript/css may have virus, than check your pages: you will found the this type code added at the end of each page's html: "".
  • SQL Injection: If you have a content management system than your content database is hacked using sql injection. Please see your table/file where you are keeping your page's content(like product info, page info, menu info, header info, footer info). You will found that each row of your table is being and following text has been added at the end of each records:

  • For your web files, you have to check all your files and fix manually one by one.
  • For content database, you can run the following update SQL query to fix:
SET [ItemName] = Replace(cast([ImageName] as nvarchar(100)), '<title&&rt;<script src=http://', '')
Please modify this query and replace your table name, column name for the bold letters in query.

Other ways to fix this issues:

  • Remove query string
  • Do not use in-line sql statement in your server side script (like select * from table where id=' + request.quesrystring(id) or value from query string)
  • Check the length of id in query string, if it is more than 20 chars than it is most likely infected. Quick fix trim id to 20 characters, so it will remove that malicious string and than it will not work.

I hope this will help someone to make their day and to over come of this nightmare.

I have fixed many infected content databases using this SQL in sql server/access db. I hope it will help you too.
FYI: url( in infected script may be changed in your case. so replace to your url.

Please don't forget 22 April "Earth day", do something to protect our mother earth"
Use code4green for your code generation.

Wednesday, April 4, 2012

Window 8 - Metro Style Apps, A big market to make money

I am seating here in (Fairmont PacificRim center) for windows 8 development training (Windows App development for phone, tablets, laptops) . Here I have got a interesting numbers for Windows OS which is a great opportunity to make money with windows app market.
You can make one app which will run on desktop, laptop, Tablet, smartphone.
Here is the number of devices for windows OS:
Windows OS - 500 Million devices
Android - 232 million devices
iPhone - 152 million devices
Mac OS - 30 million devices
If you think 0.01% pie of this Windows device than you can calculate the amount you can make with $0.99/App. With 01 app of $0.99, you can make 1/2 million dollars. This is not impossible :), so go for it.

So if you make an Windows app using windows 8 OS with Visual studio 2011, it is easy to make such apps and it is also easy to submit on Windows App store using Visual studio.
The only thing you need is one time registration fees with windows app store, which is $49.00 dollar - individual, and $99.00 for Business.

Monday, March 5, 2012

What is LightSwitch 2011 - Quickview of LightSwitch

It is a tool which built applications which are built on classic three-tier architecture, on top of existing .NET technologies.
It is a combination of GUI Layer + Business Logic Layer + DB Layer

GUI - Silver light, which workd for windows or web.
Business Logic Layer - WCF service or OData
DB Layer - SQL Server, SQL Azure, Sharepoint

According to the Microsoft
"The LightSwitch presentation tier is a Silverlight application. It can run as a Windows desktop application or hosted in a browser. The LightSwitch logic tier exposes a set of WCF RIA DomainServices running in ASP.NET. The logic tier process can be hosted locally (on the user’s machine), on an IIS server, or in Windows Azure. A LightSwitch application’s primary application storage uses SQL Server or SQL Azure and can consume data from existing SharePoint 2010 lists, databases accessible via an Entity Framework provider, and custom build WCF RIA DomainServices.

With LightSwitch, your application can point to an existing data source—or databases that are automatically created—without the need to write code. For the user interface, LightSwitch provides screens that are based on predefined templates. They allow you to display data automatically by simply specifying which elements you want to show.

For the business logic, LightSwitch allows you to do simple validation such as required fields and minimum numeric values. But LightSwitch also gives developers the ability to write more complex business logic code for such scenarios as saving changes to a data source or performing authorization operations."

Tuesday, February 21, 2012

Codename for Sharepoint 2013 is released

Codename of Sharepoint 2013 is released on 1 Feb 2012. According to PJ Hough (CVP of Development, MS Office Division) - Codename of Sharepoint 2013 and Office 2013 is "Office 15".
PJ Hough is also said about this release: "First time ever, we will simultaneously update our cloud services, servers, and mobile and PC clients for Office, Office 365, Exchange, SharePoint, Lync, Project and Visio".
Here are some key features of "Office 2015": It is a true 64-bit version, a truly touch-enabled Office, "Ribbon" getting replaced by "Metro" style browsing , and It need to support ARM processors(ARM is the industry's leading provider of 32-bit embedded microprocessors).

Important links for more info on Sharepoint 2013/office 2015:

Monday, February 13, 2012

Components of CMDUI.xml or Definition of CMDUI.xml

Here is the list of main components of CMDUI.xml:

1. Tab

2. Group

3. Control

4. Contextual tab group

The next few sections briefly explain these components and their uses.
Tabs on the SharePoint 2010 Server Ribbon
Tabs: are the root of the Server ribbon. They contain one or more groups, and contain similar functions.

Groups on the SharePoint 2010 Server Ribbon
Every tab in the ribbon contains a series of one or more groups. Groups are used to associate controls with similar functionality. Each group is associated with a template that defines the layout of the group and how the group should appear based on the scale of the ribbon. The scale of the ribbon refers to situations where there are too many controls to show in the ribbon, for example, when the browser is not in a full-screen maximized state and is in a windowed state.
Group Templates on the SharePoint 2010 Server Ribbon

Group templates are used to define the different layout options for the controls within a group. Microsoft includes 29 group templates in the CMDUI.xml file (to locate them, search for the element at the end of this file).

Controls on the SharePoint 2010 Server Ribbon:
The ribbon would not be complete if users did not have anything to select or click. Controls are the items that live inside the ribbon that users can interact with. Controls reside within groups. These include things such as buttons, toggle buttons, check boxes, text boxes and many other controls. For a complete list of all the available controls, see Architecture of the Server Ribbon at

Contextual Tab Groups on the SharePoint 2010 Server Ribbon:
Contextual tab groups are used to provide functions that are not global to the current context, such as the page. They appear only when certain circumstances have been met and contain one or more tabs.

Contextual tab groups hide functionality and menu choices from the user when they are not available, and appear when applicable. Other examples of contextual tab groups include the Editing Tools contextual tab group that appears when editing a wiki page, or the Picture Tools contextual tab group that appears when a picture is selected in edit mode.