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….. :)

Thursday, December 31, 2009

Not ALL rules can be followed!!! :D

A lady manager of a big reputed office noticed a new man one day and told him to come into her office.
"What is your name?" was the first thing she asked the new guy.
"John," the new guy replied.
She scowled, "Look... I don't know what kind of a namby-pamby place you worked before, but I don't call anyone by their first name. It breeds familiarity and that leads to a breakdown in authority.
I refer to my employees by their last name only ... Smith, Jones, Baker ...that's all.
I am to be referred to only as Mrs. Robertson. Now that we got that straight, what is your last name?"
The new guy sighed, "Darling............ My name is John Darling."
"Okay John, the next thing I want to tell you is . . .." :-) ;-)

Tuesday, March 31, 2009

Start Automation Testing with WATIR

WATIR
I would like to share my knowledge on WATIR(Web Application Testing In Ruby language).It is pronounced water
What is WATIR?
WATIR is an open source automated testing tool in ruby language. This tool helps us in automated testing for any web application. It allows us to write Test cases .So that we can avoid the drawbacks of manual testing like time complexity , human resource, document management ,simplicity ,flexibility etc .We can easily write Test Cases by learning few commands of Ruby Language. Ruby also a object oriented programming language like JAVA.I feel this is one of very efficient and interesting Automated Testing tool. Also Watir is too much magic and is too confusing for people to understand.
WATIR Installation
->Download ruby advanced version (Ruby 1.8.*.*) and install it by just clicking setup file
->Go to command command prompt and type gem install watir .This step will completes your installation process !!!.
How it works ?
->Go to command prompt and type irb .irb is interactive ruby shell for ruby.
We can run the ruby command here .
require 'watir' # use watir gem
test_site = 'http://www.google.com' # set a variable
ie = Watir::IE.new # open the IE browser,here ie is the variable
ie.goto(test_site) # load url, go to site
ie.text_field(:name, "q").set("some Text") # load text "pickaxe" into search field named"q"
ie.button(:name, "btnG").click #btnG" is the name of the Search button, click it
if ie.text.include?("Programming Ruby")
puts "Test Passed. Found the test string: 'Programming Ruby'."
else
puts "Test Failed! Could not find: 'Programming Ruby'"
end

I reffered this example from http://wtr.rubyforge.org/.Save this code in a file with .rb extension . And to execute this file go to the parent directory via command prompt and type ruby file.rb
For more detail please refer
wtr.rubyforge.org/watir_user_guide.html
I will end with a list of most common beginner problems:
-> Capitalizing Watir in the require statement: require ‘watir’ NOT require ‘Watir’.

-> Not putting an “end” for the class statement in the test case file.
-> Leaving out the “class” statement in the test case file.
-> Not specifying that your test class inherits from Watir::TestCase.
-> Not starting the test case definition with def “test_”
-> Capitalizing of test names instead of keeping them lower case, “test_01_test_to_see_if this_works”.
Drawbacks
Watir is Ruby library that works only with Internet Explorer on Windows at present.Still trust me Watir is one of the most useful and very interesting framework.
If you have any doubt regarding WATIR please contact me on
nitil84@gmail.com.