Thursday, March 31, 2011

What is Cloud Computing ?

Cloud computing is a general term for anything that involves delivering hosted services over the Internet. These services are broadly divided into three categories: Infrastructure-as-a-Service (IaaS), Platform-as-a-Service (PaaS) and Software-as-a-Service (SaaS). The name cloud computing was inspired by the cloud symbol that's often used to represent the Internet in flowcharts and diagrams.

So what’s a definition for real people?
Cloud Computing = Web Applications


That’s all there is to it. If you’re using a web or internet-based application from a major provider like Google or Microsoft, you’re using cloud computing. Congrats!


Every web application that you’ve ever used, like Gmail, Google Calendar, Hotmail, SalesForce, Dropbox, and Google Docs, are based on “cloud computing”, because when you connect to one of these services, you’re really connecting to a massive pool of servers somewhere out there on the internet. The client doesn’t need to be a web browser, but that’s the direction everything is heading.

Types of Cloud Services












Advantages of the Cloud Computing

  • Reduced CostCloud technology is paid incrementally, saving organizations money. 
  • Increased StorageOrganizations can store more data than on private computer systems.
  • Highly Automated 
    No longer do IT personnel need to worry about keeping software up to date.
  • FlexibilityCloud computing offers much more flexibility than past computing methods.
  • More Mobility 
    Employees can access information wherever they are, rather than having to remain at their desks.
  • Allows IT to Shift Focus
    No longer having to worry about constant server updates and other computing issues, government organizations will be free to concentrate on innovation.
Web Applications are the future. Cloud Computing is a stupid buzzword. Discuss.

You can download most valuable information from following link.
http://www.microsoft.com/asia/cloud/singapore.aspx#downloads

Sunday, March 20, 2011

A Software Engineer’s Feelings…..Touching...


Software engineer deals with computer applications and manages software development projects. Companies from all sectors of the economy are looking for software engineers and programmers. The software engineering is one of the best jobs in this modern age with a lot of knowledge containing in it and a good earning, too. But what is his Actual Life???

Here it is one of the good article I found from some one's blog(source is below) about the feelings of the Software Engineer.Read  this  story  and  just  see   how  touchy  it is !!!!!!!!!!!!

It was raining heavily outside. Dark clouds gathered in the sky and nature was in its ominous best. I took a break from my work and went to the pantry to grab a cup of coffee. I had a sip and went near the window to see the rain pouring down heavily outside the glass structure. I was inside our huge office building, unruffled by even the fierceness of the nature.
Through the heavy transparent glass, I could see a small girl trying to hold on to her umbrella which the wind was snatching away from her. I felt sorry for the girl, and was happy that I was not in a similar pathetic situation. Yes. I take pride for the fact that I am a software engineer.
I have everything which a common man would envy; money, status, respect, you name it I have it. I always wanted to be software professional and here I am, working for one of the best firms in the world. But then, am I really happy? Now, I could see an imprint of my palm on the other glass window, through which I reminisced my past, basked in the warmth of the sun shine.
My childhood was so much of fun. I vividly remember those rainy days, when I hugged my mother tightly during sleeping listening to all the stories told by her. Now, I have a big house here, but then it is just a house, not a home. My parents are pretty far away from me now. I have a cell phone to talk to them everyday, but then I really miss those dinners which I had with my family everyday. I could easily afford to taste all the different cuisines these days, but the best of food there, lack the love and affection which is present in the food prepared by my mother.
I threw a lavish party for my colleagues for my birthday, but then they would never replace the birthdays when my friends secretly brought a cake and at the end, half of the cake would have ended up on my face. The couple of hundred bucks that u save for a long period just to give a treat to your friends in the road side chat shop can never give the pleasure even after spending a few thousand bucks these days.
The scene of me crying and refusing to have dinner on the day when I fought with my best friend came to my mind. Today, she has gone far away from me, taking away my love and with it my life, but I am sitting and coding here with a false smile on my face. Everyday I meet new people, but then I long ceased to make a new friend.
It’s true that I have a lot of things now. I have a nice bed, but no time to sleep. Lots of money, but no friends to spend it with. The latest designer clothes, but a worn out body . Awards for technical excellence, but no reward for the crave for peaceful ambience. A confident demeanor, but a reluctant and apathetic mind. Full of rain, but no sunshine even in the farthest distance.
Now, I could see the small girl on the road enjoying in the rain with her umbrella firmly in her grip. She might not have all the comforts which I have, but then she has the innocence and fun which I lost a long time back.
I have decided to come out of this false fantasy, even if it is at the expense of losing the tap of the software engineer. I am going to again enjoy my life. I am going to go out in the rain and play with the small kid now. I removed my tie, and went near my computer to shut it down. Just then, I saw a new mail alert in my mail box. I slowly opened outlook and I found a message from my manager with an attachment saying that there was a critical defect in the code and I have to fix it soon. I convinced myself that I am not going to get bogged down again by these pressures and stick to my decision. I ignored the mail and went to the rest room. After a couple of minutes, the software engineer in me came out, his shirt tucked in with the perfect tie knot, sat before the computer, and started typing,
Hi XYZ,
I am looking into the defect and will send the patch files before EOD.


Friday, March 18, 2011

User Define Functions In Java Script

Here are some functions which are very important in developments.


To Trim the String type text

function Trim(str) {
    return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' ');
}

function trim(argvalue) {
  var tmpstr = ltrim(argvalue);
return rtrim(tmpstr);
}


Check the Text field no of characters

function NoOfCharacters(ctrl) {
return  ctrl.value.length;
}


To Get the Part of a String

Function Substring(str,startValue,endValue) {
return  ctrl.substring(startValue,endValue);
}

Eg:
Substring('ABCDE',0,1)
 'A'


To Split a Text

1)
function Splitting(str,SplitBy) {
        var arrSplit =str.split(SplitBy);
        var intCount = 0;
        var strRetVal = '';
        while (intCount < arrSplit.length) {
            strRetVal += arrSplit[intCount] + ' - ' + '';
            intCount += 1;
        }
return strRetVal ;
}

Eg:
 Splitting('ABC\nDEFG','\n')  
 'ABC-DEFG'


2)
function customSplit(strvalue, separator, arrayName) {
  var n = 0;
if (separator.length != 0) {
    while (strvalue.indexOf(separator) != -1) {
      eval("arr"+n+" = strvalue.substring(0, strvalue.indexOf(separator));");
      strvalue = strvalue.substring(strvalue.indexOf(separator)+separator.length,
          strvalue.length+1);
      n++;
    }
    eval("arr" + n + " = strvalue;");
    arraySize = n+1;
  }
  else {
    for (var x = 0; x < strvalue.length; x++) {
      eval("arr"+n+" = \"" + strvalue.substring(x, x+1) + "\";");
      n++;
    }
    arraySize = n;
  }
eval(arrayName + " = new makeArray(arraySize);");
for (var i = 0; i < arraySize; i++)
    eval(arrayName + "[" + i + "] = arr" + i + ";");
return arraySize;
}


Eg:
var strvalue = "abc##123##zzz##$$$";
var returnArraySize = customSplit(strvalue, "##", "NewArray");
The above will create the following:
NewArray[0] has value "abc"
NewArray[1] has value "123"
NewArray[2] has value "zzz"
NewArray[3] has value "$$$"
returnArraySize      has value "4"



Replace Text

function ReplaceString(str,oldValue,newValue)
{
Return  str.replace(oldValue,newValue);
}

Eg:
ReplaceString('Hello World','World','!')
Hello !


Sort Method
//Sort alphabetically and ascending:
var myarray=["Bob", "Bully", "Amy"]
myarray.sort() //Array now becomes ["Amy", "Bob", "Bully"]

//Sort alphabetically and descending:
var myarray=["Bob", "Bully", "Amy"]
myarray.sort()
myarray.reverse() //Array now becomes ["Bully", "Bob", "Amy"]



Custom Sort Method

function customSort(a,b) {
    return( a.toString().length - b.toString().length );
}

var arlene = new Array("orange","apple","strawberry","banana");
alert( arlene.sort(customSort).toString() );


Add Space

function addSpace(argvalue, numlength) {
if (! numlength > 0)
    numlength = 10;
if (argvalue.length < numlength) {
    for(var i = argvalue.length; i < numlength; i++)
      argvalue = " " + argvalue;
  }
return argvalue;
}

Eg:
addSpace("123.45", 10);
"    123.45"


Highlighted the text in selected textBox

function ShowSelection(textComponent) {
    var selectedText;
    // IE version
    if (document.selection != undefined) {
        textComponent.focus();
        var sel = document.selection.createRange();
        selectedText = sel.text;
    }
    // Mozilla version
    else if (textComponent.selectionStart != undefined) {
        var startPos = textComponent.selectionStart;
        var endPos = textComponent.selectionEnd;
        selectedText = textComponent.value.substring(startPos, endPos)
    }
    return selectedText;
}


Disable the Key Press event in a text box

function DisableKeyPressEvent(e) {
    var unicode = e.charCode ? e.charCode : e.keyCode
    if (unicode!=0) //if not a number
    {
        return false //disable key press
    }
}


Select the Item from ComboBox

function SelectComboItem(combo,value)
    {
    if(value!=null)
        {
          for (var i=0 ; i <= combo.length; i++)
            {
            combo.selectedIndex= i;
            if (combo[combo.selectedIndex].value==value)
              {
               combo.selectedIndex= i;
               return true;
              }
             else
              {
              combo.selectedIndex= 0;
              } 
            }
        }
    else
        {
            combo.selectedIndex= 0;
        }
    }



Set Current Date

function setDate()
  {
 
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
 
var dateLast=day+'/'+month+'/'+year;


   document.getElementById("txtDate").value=dateLast;

  return true;
  }

Saturday, March 12, 2011

Best Practices for Speeding Up Your Web Site

Why We Need To Think About This ?


Actually most of the developers just like me always thinking how much effort we can put to develop to access web pages as much as fast and also how to do this.According to this I found one of the good article and like to shared with u all.Alright here are some number of best practices for making web pages fast. The list includes 35 best practices.
  • Minimize HTTP Requests
  • Use a Content Delivery Network
  • Add an Expires or a Cache-Control Header
  • Gzip Components
  • Put Stylesheets at the Top
  • Put Scripts at the Bottom
  • Avoid CSS Expressions
  • Make JavaScript and CSS External
  • Reduce DNS Lookups
  • Minify JavaScript and CSS
  • Avoid Redirects
  • Remove Duplicate Scripts
  • Configure ETags
  • Make Ajax Cacheable
  • Flush the Buffer Early
  • Use GET for AJAX Requests
  • Post-load Components
  • Preload Components
  • Reduce the Number of DOM Elements
  • Split Components Across Domains
  • Minimize the Number of iframes
  • No 404s
  • Reduce Cookie Size
  • Use Cookie-free Domains for Components
  • Minimize DOM Access
  • Develop Smart Event Handlers
  • Choose over @import
  • Avoid Filters
  • Optimize Images
  • Optimize CSS Sprites
  • Don't Scale Images in HTML
  • Make favicon.ico Small and Cacheable
  • Keep Components under 25K
  • Pack Components into a Multipart Document
  • Avoid Empty Image src


How to get count with some filtering condition in select command using groups as well

count(case when IsNull(G.EmpCode,'X')='X' then null else 1 end) as Fullfilled
count(case when A.Selected = 'Y' then 1 else null end) as NoOfGaps


Eg:


SELECT A.EmpCode
,F.EMPLOYEENAME as EmployeeName
,E.DESCSHORT
,count(case when IsNull(G.EmpCode,'X')='X' then null else 1 end) as Fullfilled
,count(case when IsNull(G.EmpCode,'X')='X' then 1 else null end) as NotFullfilled
,count(case when A.Selected = 'Y' then 1 else null end) as NoOfGaps
,sum(case when A.Status = 'T' then G.TrainingHrs else 0 end) as NoOfHrs
,sum(case when A.Status = 'T' then G.TrainingFees else 0 end) as Costs
,count(case when A.Status = 'A' then 1 else null end) as Attending
from tb_Employee as A
left outer join HR_Competency D on A.CompetencyGroup = D.CompetencyGroup and A.Competency = D.Competency and D.CompanyCode = A.CompanyCode
left outer join HR_EmployeeMaster F on A.CompanyCode = F.CompanyCode and A.EmpCode = F.EmpCode
left outer join HR01_CODEREF E on F.JobGrade = E.Code and E.CodeType = 'JOB' and E.CompanyCode = A.CompanyCode
left outer join TR_EmployeeTraining G on A.CompanyCode = G.CompanyCode and A.EmpCode = G.EmpCode and A.TrainingYear = G.TrainingYear
and A.CompetencyGroup = G.CompetencyGroup and A.Competency = G.Competency and G.Status not in ('S', 'P', 'R', 'C', 'W','Z')

where A.CompanyCode = 'LSH' and rtrim(A.TrainingYear) = year(getdate())
and  A.EmpCode IN (SELECT  X.EMPCODE FROM HR_EMPLOYEEMASTER X, HR_PAYROLL Y WHERE X.COMPANYCODE = 'LSH'
AND X.COMPANYCODE = Y.COMPANYCODE AND X.EMPCODE = Y.EMPCODE AND Y.CPFSTATUS <> '4'  AND X.EMPCODE='IQ001' )
group by A.CompanyCode,A.EmpCode,F.EMPLOYEENAME,E.DESCSHORT

Friday, March 11, 2011

Java Script Validations

Check the Text field Value is Empty or not

function IsValueEmpty(ctrl) {
if (ctrl.value== '') {
        alert("This field cannot be empty!");
        return false;
 }
}

   

Check the selected index of the dropdown

function IsValueEmpty(ctrl) {
if (ctrl.selectedIndex == 0) {
        alert("Please select the one of the Item from the dropdown!");
        return false;
 }
}


Check the selected value of the checkbox

function Ischecked(ctrl) {
if (ctrl.checked == false) {
        alert("Please checked the value of the checkbox !");
        return false;
 }
}


Email Check

1)

function echeck(str) {

var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot = str.indexOf(dot)

if (str != '') {

    if (str.indexOf(at) == -1) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(at, (lat + 1)) != -1) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(dot, (lat + 2)) == -1) {
        alert("Invalid E-mail ID")
        return false
    }

    if (str.indexOf(" ") != -1) {
        alert("Invalid E-mail ID")
        return false
    }
}
                  return true                                        
}



2)
function isEmail(argvalue) {
if (argvalue.indexOf(" ") != -1)
    return false;
  else if (argvalue.indexOf("@") == -1)
    return false;
  else if (argvalue.indexOf("@") == 0)
    return false;
  else if (argvalue.indexOf("@") == (argvalue.length-1))
    return false;
// arrayString = argvalue.split("@"); (works only in netscape3 and above.)
  var retSize = customSplit(argvalue, "@", "arrayString");
if (arrayString[1].indexOf(".") == -1)
    return false;
  else if (arrayString[1].indexOf(".") == 0)
    return false;
  else if (arrayString[1].charAt(arrayString[1].length-1) == ".") {
    return false;
  }
return true;
}


Num Check Function

1)
function NumbersOnlyWithEnter(e) {
    var unicode = e.charCode ? e.charCode : e.keyCode
    if (unicode < 48 || unicode > 57) //if not a number
    {
        if (unicode != 13) {
            return false //disable key press
        }
    }
}


2)
function numCheck(argvalue) {
if (argvalue.length == 0)
    return false;
for (var n = 0; n < argvalue.length; n++)
    if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
      return false;
return true;
}

Eg:
The followings will return "true".
numCheck("1234")
numCheck("0123")
The followings will return "false".
numCheck("abcd")
numCheck("a123")
numCheck("123a")
numCheck("12.3")



Check the URL format is Correct or Not
  
function isURL(argvalue) {
if (argvalue.indexOf(" ") != -1)
    return false;
  else if (argvalue.indexOf("http://") == -1)
    return false;
  else if (argvalue == "http://")
    return false;
  else if (argvalue.indexOf("http://") > 0)
    return false;
argvalue = argvalue.substring(7, argvalue.length);
  if (argvalue.indexOf(".") == -1)
    return false;
  else if (argvalue.indexOf(".") == 0)
    return false;
  else if (argvalue.charAt(argvalue.length - 1) == ".")
    return false;
if (argvalue.indexOf("/") != -1) {
    argvalue = argvalue.substring(0, argvalue.indexOf("/"));
    if (argvalue.charAt(argvalue.length - 1) == ".")
      return false;
  }
if (argvalue.indexOf(":") != -1) {
    if (argvalue.indexOf(":") == (argvalue.length - 1))
      return false;
    else if (argvalue.charAt(argvalue.indexOf(":") + 1) == ".")
      return false;
    argvalue = argvalue.substring(0, argvalue.indexOf(":"));
    if (argvalue.charAt(argvalue.length - 1) == ".")
      return false;
  }
return true;
}

Sunday, March 6, 2011

DB Backup, Restore, Shrink

Backup Database to Disk

USE TESTDB;
GO
BACKUP DATABASE TESTDB
TO DISK = 'D:\SQLServerBackups\TESTDB201101241156.Bak'
GO


Restore Database
----Make Database to single user Mode
ALTER DATABASE YourDB
SET SINGLE_USER WITH
ROLLBACK IMMEDIATE
----Restore Database
RESTORE DATABASE YourDB
FROM DISK = 'D:BackUpYourBaackUpFile.bak'
WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf',
MOVE 'YourLDFLogicalName' TO 'D:DataYourLDFFile.ldf'
/*If there is no error in statement before database will be in multiuser
mode.
If error occurs please execute following command it will convert
database in multi user.*/
ALTER DATABASE YourDB SET MULTI_USER
GO


Shrinking a database and specifying a percentage of free space
DBCC SHRINKDATABASE (TESTDB, 10);
GO


Truncating a database
DBCC SHRINKDATABASE (TESTDB, TRUNCATEONLY);

Thursday, March 3, 2011

How to Clear Recent Project list or File list from Visual Studio .Net Start Page

Close Visual Studio (if its open)

    GOTO > Start > Run > RegEdit

    GOTO > HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\\ProjectMRUList
    remove unnecessary items from list.

    Similarly repeat the steps for FileMRuList
    GOTO > HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\\FileMRUList
    remove unnecessary items from list.

    To Clear the Find and Replace List
    GOTO > HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\\Find
    remove unnecessary items from list.

Another Simple way is,
    Create one Text file "Clear.txt" and add below contents in it

    Windows Registry Editor Version 5.00

    [-HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ProjectMRUList]
    [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\ProjectMRUList]

    Save and Close the file and rename is as "Clear.reg"; that is Registry file. Double Click to Run the file, this will clear the "Recent Project List" on your Visual Studio 2005 Startup Page. You can add entries for "Recent File List" and "Find and Replace List" in this same .reg file.



Source : http://dotnetslackers.com/Community/blogs/kaushalparik/archive/2008/06/17/clear-recent-project-list-or-file-list-from-visual-studio-net-start-page.aspx

Tuesday, March 1, 2011

Get all the object definitions: SPROC, TRIGGER, VIEW & FUNCTION

SELECT SchemaName=schema_name(schema_id),
       ObjectName=object_Name(m.object_ID),
       ObjectDefinition=definition
FROM   sys.SQL_Modules m
  INNER JOIN sys.objects o
    ON m.object_id=o.object_id

ORDER BY SchemaName, ObjectName