Wednesday, February 24, 2010

Sachin Tendulkar 200 ... Love you sachin







Sachin Tendulkar has now got almost every batting records in ODI cricket in his name. When no one had ever got a 200 plus score in ODI cricket, Sachin smashed a double century in 2nd ODI against South Africa. Opening in the inning, Tendulkar looked highly aggressive and on the way got past 194- the highest score in an inning made by a batsman in ODI cricket. The record was held by Saeed Anwar of Pakistan as well as Conventry of Zimbabwe.


Sachin Tendulkar slammed his 46th ODI century leading India to a strong 200 run-mark in the second ODI against South Africa in Gwalior. Tendulkar reached the mark in 90 balls with 13 fours.

It was a poor start for India as Virender Sehwag departed after scoring mere nine runs.

Earlier, Captain Mahendra Singh Dhoni won the toss and elected to bat. India have retained the same side that won the opening one-dayer by a run in Jaipur.

Trailing 0-1 in the series, South Africa have made three changes in their bid to level the series.

Hashim Amla, JP Duminy and Roelof van der Merwe have been included in place of Loots Bosman, Albie Morkel and Johan Botha.

Teams:
India: Mahendra Singh Dhoni (c), Sachin Tendulkar, Virender Sehwag, Virat Kohli, Suresh Raina, Yusuf Pathan, Dinesh Karthik, Ravindra Jadeja, Praveen Kumar, Ashish Nehra, S Sreesanth

South Africa: Jacques Kallis (c), Hashim Amla, Herschelle Gibbs, AB de Villiers, JP Duminy, Alviro Petersen, Mark Boucher, Roelof van der Merwe, Wayne Parnell, Dale Steyn, Charl Langeveldt.

Tuesday, February 16, 2010

SQL Server 2005:Function to remove prefixes 0,-,+,*,.. etc

This function will help you to remove prefixes from given string
"
CREATE FUNCTION [dbo].[remove_prefixes]
(
@str varchar(600)--The String from which you want to remove prefix
)
RETURNS varchar(600)
AS

BEGIN

DECLARE @strLen int
SET @strLen = LEN( @str );
IF @strLen < 1
BEGIN
RETURN @str
END

-- Prefix
DECLARE @prefix char
SET @prefix = LEFT( @str, 1 )


-- '+ or -' as prefix
IF @prefix = '+ or - or * or & '
BEGIN
SET @str = RIGHT( @str, @strLen - 1 )
END

SET @strLen = LEN( @str )
SET @prefix = LEFT( @str, 1 )

-- '0' as prefix
IF @prefix = '0'
BEGIN
SET @str = RIGHT( @str, @strLen - 1 )
END

return @str

END "
For Example
select [dbo].[mpc_remove_prefixes]('*Prefix test')
select [dbo].[mpc_remove_prefixes]('0Prefix test')

Result

Both statement Returns 'Prefix test' as a result

SQL Server 2005:Function To Remove Multiple spaces

Function to remove Multiple Spaces
"
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER FUNCTION [dbo].[removeMultiSpaces]
(
@InString VARCHAR(1024)
)
RETURNS VARCHAR(1024)
AS
BEGIN
WHILE CHARINDEX(' ',@ InString) > 0 -- Checking for double spaces
SET @InString = REPLACE(@InString,' ',' ') -- Replace 2 spaces with 1 space
RETURN @InString

END "

Example:
select [dbo].[fnRemoveMultipleSpaces]('Hi Testing')
Result
Hi Testing

SQL Server 2005: Common Table Expressions (CTE)

Microsoft SQL Server 2005 offers a new feature i.e Common Table Expression (CTE). Which is more readable form of the derived table that can be declared once and referenced multiple times in a query
.CTE can be used in select,insert,delete,update
.CTE can be defined recursively

General Syntax
WITH cte_alias (column_aliases)
AS
(
cte_query_definition --initialization
UNION ALL
cte_query_definition2 --recursive execution
)
SELECT * FROM cte_alias
Example 1:
"
with TestCTE(testVar)
as
(
select testVar = convert(varchar(300),'Nitil')
union all
select testVar + 'a' from TestCTE where len(testVar) < 10
)
select testVar from TestCTE
order by testVar "


Result

testVar
Nitil
Nitila
Nitilaa
Nitilaaa
Nitilaaaa
Nitilaaaaa

Example 2:
"
with TestCTE(testVar)
as
(
select testVar = convert(varchar(8000),'Nitil')
union all
select testVar + 'a' from TestCTE where len(testVar) < 10
union all
select testVar + ' Have a Nice Day' from TestCTE where len(testVar) < 10

)
select testVar from TestCTE
order by len(testVar),testVar"
Result
testVar
Nitil
Nitila
Nitilaa
Nitilaaa
Nitilaaaa
Nitilaaaaa
Nitil Have a Nice Day
Nitila Have a Nice Day
Nitilaa Have a Nice Day
Nitilaaa Have a Nice Day
Nitilaaaa Have a Nice Day

Simple CTE’s
"
with CTETable( column1,column2) as
(
select id,Employee_Name from Employee
)
select * from CTETable "
Result:
column1 column2
1 EmpName1
2 EmpName2

Multiple CTE
"
with testing(column1Id,column2Name) as
(
select id,username from ocean_user
),
rectesting(nam,sal) as
(
select t.column2Name,e.sal from Employee e,testing t
where e.id=t.emp_id and sal > 10000
)
select * from rectesting "

Working on Joomla(Installation And configuration) in brief !!!!

Working on Joomla(Installation And configuration) in brief !!!!

Download XAMPP required version
->Install XAMPP
->Inside Xampp
F:\PHP\xampp\apache\conf we have httpd.conf change the port to 3333
#Listen 12.34.56.78:80
Listen 3333

Check this using your adress bar:

Check the xampp using link http://localhost:3333/xampp/
and
mysql using the link http://localhost:3333/phpmyadmin/ Working

Joomla Installation

Download Joomla_1.5.10-Stable-Full_Package.zip file
Extract it to F:\PHP\xampp\htdocs with your project name
like F:\PHP\xampp\htdocs\myFirstjoomla

Go to address bar and check this
http://localhost:3333/myFirstjoomla/installation/index.php
follow the steps to install

1 : Language :select Language (US english) Next

2 : Pre-installation Check :Check and Next

3 : License :Check and Next

4 : Database : Basic Settings
Database Type :mysql
Host Name :localhost
Username :root
Password :blank
Database Name :Application_Development

5 : FTP Configuration :do nothing for small applicatiopn and Next

6 : Configuration :
Site Name :myFirstjoomla
Your E-mail:uremail@mail.com
Admin Password:****
Confirm Admin Password:****
Default Username For Admin is admin

7 : Finish :P LEASE REMEMBER TO COMPLETE

REMOVE THE INSTALLATION DIRECTORY from F:\PHP\xampp\htdocs\myFirstjoomla
delete installation Folder and it will finish your joomla installation
Template Creation

Goto Site Or Admin Depending upon ur requirement
site :http://localhost:3333/myFirstjoomla/
admin :http://localhost:3333/myFirstjoomla/administrator/

To Edit Existing template
-> Extension ->Template Manager

To Create Your own Template
-> create template ( it Should contain the same folder structure like existing template refer:F:\PHP\xampp\htdocs\myFirstjoomla\templates)
->Paste Your template inside F:\PHP\xampp\htdocs\myFirstjoomla\templates
and refresh the Extension ->template manager and make that template as default
and start working on tht according to Your requirements
Hope this will help you….. :)