Sunday, March 22, 2009
Binary to Decimal and Decimal to Binary conversions
Dim n As Long
Dim s As Integer
For s = 1 To Len(Binary)
n = n + (Mid(Binary, Len(Binary) - s + 1, 1) * (2 ^ (s - 1)))
Next s
BinaryToDecimal = n
End Function
Public Function DecimalToBinary(DecimalNum As Long) As String
Dim tmp As String
Dim n As Long
n = DecimalNum
tmp = Trim(Str(n Mod 2))
n = n \ 2
Do While n <> 0
tmp = Trim(Str(n Mod 2)) & tmp
n = n \ 2
Loop
DecimalToBinary = tmp
End Function
Binary to Hexadecimal
Public Function toHex(s As String)
'Converts a binary string to base 16
Dim sResult As String
Dim nCnt As Integer
For nCnt = 1 To Len(s)
sResult = sResult & Right("00" & Hex(Asc(Mid(s, nCnt, 1))), 2)
Next
toHex = sResult
End Function
Public Function toBinary(s As String)
'Converts hex pairs to binary
Dim sResult As String
Dim nCnt As Integer
For nCnt = 1 To Len(s) Step 2
sResult = sResult & Chr(Val("&H" & Mid(s, nCnt, 2)))
Next
toBinary = sResult
End Function
}
Hexadecimal Number to Binary
Dim lngX As Long
Dim lngY As Long
Dim strBinary As
lngX = &HAAAAAAAA
lngY = 1
On Error Resume Next
strBinary = ""
Do While Err.Number = 0
If lngX And lngY Then
strBinary = "1" & strBinary
Else
strBinary = "0" & strBinary
End If
lngY = lngY + lngY
Loop
If lngX And &H80000000 Then
strBinary = "1" & strBinary
Else
strBinary = "0" & strBinary
End If
MsgBox strBinary
End Sub
Tuesday, February 10, 2009
History of Basketball
Basketball was invented in December 1891 by the Canadian clergyman, educator, and physician James Naismith. Naismith introduced the game when we was an instructor at the Young Men's Christian Association Training School (now Springfield College) in Springfield, Massachusetts. At the request of his superior, Dr. Luther H. Gulick, he organized a vigorous recreation suitable for indoor winter play. The game involved elements of American football, soccer, and hockey, and the first ball used was a soccer ball. Teams had nine players, and the goals were wooden peach baskets affixed to the walls. By 1897-1898, teams of five became standard. The game rapidly spread nationwide and to Canada and other parts of the world, played by both women and men; it also became a popular informal outdoor game. U.S. servicemen in World War II (1939-1945) popularized the sport in many other countries.
A number of U.S. colleges adopted the game between about 1893 and 1895. In 1934 the first college games were staged in New York City's Madison Square Garden, and college basketball began to attract heightened interest. By the 1950s basketball had become a major college sport, thus paving the way for a growth of interest in professional basketball.
The first pro league, the National Basketball League, was formed in 1898 to protect players from exploitation and to promote a less rough game. This league only lasted five years before disbanding; its demise spawned a number of loosely organized leagues throughout the northeastern United States. One of the first and greatest pro teams was the Original Celtics, organized about 1915 in New York City. They played as many as 150 games a season and dominated basketball until 1936. The Harlem Globetrotters, founded in 1927, a notable exhibition team, specializes in amusing court antics and expert ball handling.
In 1949 two subsequent professional leagues, the National Basketball League (formed in 1937) and the Basketball Association of America (1946) merged to create the National Basketball Association (NBA). The Boston Celtics, led by their center Bill Russell, dominated the NBA from the late 1950s through the 1960s. By the 1960s, pro teams from coast to coast played before crowds of many millions annually. Wilt Chamberlain, a center for the Los Angeles Lakers, was another leading player during the era, and his battles with Russell were eagerly anticipated. Kareem Abdul-Jabbar, also a center, came to prominence during the 1970s. Jabbar perfected his famed "sky hook" shot while playing for the Los Angeles Lakers and dominated the opposition.
The NBA suffered a drop in popularity during the late 1970s, but was resuscitated, principally through the growing popularity of its most prominent players. Larry Bird of the Boston Celtics, and Magic Johnson of the Los Angeles Lakers are credited with injecting excitement into the league in the 1980s through their superior skills and decade-long rivalry. During the late 1980s Michael Jordan of the Chicago Bulls rose to stardom and helped the Bulls dominate the NBA during the early 1990s. A new generation of basketball stars, including Shaquille O'Neal of the Orlando Magic and Larry Johnson of the Charlotte Hornets, have sustained the NBA's growth in popularity.