Python en:Basics
Just printing 'Hello World' is not enough, is it? You want to do more than that - you want to
take some input, manipulate it and get something out of it. We can achieve this in Python
using constants and variables.
Literal Constants
An example of a literal constant is a number like 5, 1.23, 9.25e-3 or a string like 'This is
a string' or "It's a string!". It is called a literal because it is literal - you use its value
literally. The number 2 always represents itself and nothing else - it is a constant because
its value cannot be changed. Hence, all these are referred to as literal constants.
Numbers
Numbers in Python are of three types - integers, floating point and complex numbers.
• An examples of an integer is 2 which is just a whole number.
• Examples of floating point numbers (or floats for short) are 3.23 and 52.3E-4. The E
notation indicates powers of 10. In this case, 52.3E-4 means 52.3 * 10-4.
• Examples of complex numbers are (-5+4j) and (2.3 - 4.6j)
Note for Experienced Programmers
There is no separate 'long int' type. The default integer type can be any large value.
Strings
A string is a sequence of characters. Strings are basically just a bunch of words. The words
can be in English or any other language that is supported in the Unicode standard, which
means almost any language in the world (http:/ / www. unicode. org/ faq/ basic_q. html#16).
Note for Experienced Programmers
There are no "ASCII-only" strings because Unicode is a superset of ASCII. If a strictly
ASCII-encoded byte-stream is needed, then use str.encode("ascii"). For more
details, please see the related discussion at StackOverflow (http:/ / stackoverflow. com/
questions/ 175240/
how-do-i-convert-a-files-format-from-unicode-to-ascii-using-python#175270).
By default, all strings are in Unicode.
I can almost guarantee that you will be using strings in almost every Python program that
you write, so pay attention to the following part on how to use strings in Python.
Python en:Basics 27
Single Quotes
You can specify strings using single quotes such as 'Quote me on this'. All white space
i.e. spaces and tabs are preserved as-is.
Double Quotes
Strings in double quotes work exactly the same way as strings in single quotes. An example
is "What's your name?"
Triple Quotes
You can specify multi-line strings using triple quotes - (""" or '''). You can use single quotes
and double quotes freely within the triple quotes. An example is:
'''This is a multi-line string. This is the first line.
This is the second line.
"What's your name?," I asked.
He said "Bond, James Bond."
'''
Escape Sequences
Suppose, you want to have a string which contains a single quote ('), how will you specify
this string? For example, the string is What's your name?. You cannot specify 'What's
your name?' because Python will be confused as to where the string starts and ends. So,
you will have to specify that this single quote does not indicate the end of the string. This
can be done with the help of what is called an escape sequence. You specify the single
quote as \' - notice the backslash. Now, you can specify the string as 'What\'s your
name?'.
Another way of specifying this specific string would be "What's your name?" i.e. using
double quotes. Similarly, you have to use an escape sequence for using a double quote itself
in a double quoted string. Also, you have to indicate the backslash itself using the escape
sequence \\.
What if you wanted to specify a two-line string? One way is to use a triple-quoted string as
shown previously or you can use an escape sequence for the newline character - \n to
indicate the start of a new line. An example is This is the first line\nThis is the
second line. Another useful escape sequence to know is the tab - \t. There are many more
escape sequences but I have mentioned only the most useful ones here.
One thing to note is that in a string, a single backslash at the end of the line indicates that
the string is continued in the next line, but no newline is added. For example:
"This is the first sentence.\
This is the second sentence."
is equivalent to "This is the first sentence. This is the second sentence.".
Python en:Basics 28
Raw Strings
If you need to specify some strings where no special processing such as escape sequences
are handled, then what you need is to specify a raw string by prefixing r or R to the string.
An example is r"Newlines are indicated by \n".
Strings Are Immutable
This means that once you have created a string, you cannot change it. Although this might
seem like a bad thing, it really isn't. We will see why this is not a limitation in the various
programs that we see later on.
String Literal Concatenation
If you place two string literals side by side, they are automatically concatenated by Python.
For example, 'What\'s ' 'your name?' is automatically converted in to "What's your
name?".
Note for C/C++ Programmers
There is no separate char data type in Python. There is no real need for it and I am
sure you won't miss it.
Note for Perl/PHP Programmers
Remember that single-quoted strings and double-quoted strings are the same - they do
not differ in any way.
Note for Regular Expression Users
Always use raw strings when dealing with regular expressions. Otherwise, a lot of
backwhacking may be required. For example, backreferences can be referred to as
'\\1' or r'\1'.
The format Method
Sometimes we may want to construct strings from other information. This is where the
format() method is useful.
#!/usr/bin/python
# Filename: str_format.py
age = 25
name = 'Swaroop'
print('{0} is {1} years old'.format(name, age))
print('Why is {0} playing with that python?'.format(name))
Output:
$ python str_format.py
Swaroop is 25 years old
Why is Swaroop playing with that python?
How It Works:
A string can use certain specifications and subsequently, the format method can be called
to substitute those specifications with corresponding arguments to the format method.
Python en:Basics 29
Observe the first usage where we use {0} and this corresponds to the variable name which
is the first argument to the format method. Similarly, the second specification is {1}
corresponding to age which is the second argument to the format method.
Notice that we could achieved the same using string concatenation: name + ' is ' +
str(age) + ' years old' but notice how much uglier and error-prone this is. Second, the
conversion to string would be done automatically by the format method instead of the
explicit conversion here. Third, when using the format method, we can change the
message without having to deal with the variables used and vice-versa.
What Python does in the format method is that it substitutes each argument value into the
place of the specification. There can be more detailed specifications such as:
>>> '{0:.3}'.format(1/3) # decimal (.) precision of 3 for float
'0.333'
>>> '{0:_^11}'.format('hello') # fill with underscores (_) with the text
centered (^) to 11 width
'___hello___'
>>> '{name} wrote {book}'.format(name='Swaroop', book='A Byte of Python')
# keyword-based
'Swaroop wrote A Byte of Python'
Details of this formatting specification is explained in the Python Enhancement Proposal
No. 3101 (http:/ / www. python. org/ dev/ peps/ pep-3101/ ).
Variables
Using just literal constants can soon become boring - we need some way of storing any
information and manipulate them as well. This is where variables come into the picture.
Variables are exactly what the name implies - their value can vary, i.e., you can store
anything using a variable. Variables are just parts of your computer's memory where you
store some information. Unlike literal constants, you need some method of accessing these
variables and hence you give them names.
Identifier Naming
Variables are examples of identifiers. Identifiers are names given to identify something.
There are some rules you have to follow for naming identifiers:
• The first character of the identifier must be a letter of the alphabet (uppercase ASCII or
lowercase ASCII or Unicode character) or an underscore ('_').
• The rest of the identifier name can consist of letters (uppercase ASCII or lowercase
ASCII or Unicode character), underscores ('_') or digits (0-9).
• Identifier names are case-sensitive. For example, myname and myName are not the same.
Note the lowercase n in the former and the uppercase N in the latter.
• Examples of valid identifier names are i, __my_name, name_23, a1b2_c3 and
resumé_count.
• Examples of invalid identifier names are 2things, this is spaced out, my-name, and
"this_is_in_quotes".
Python en:Basics 30
Data Types
Variables can hold values of different types called data types. The basic types are numbers
and strings, which we have already discussed. In later chapters, we will see how to create
our own types using classes.
Objects
Remember, Python refers to anything used in a program as an object. This is meant in the
generic sense. Instead of saying 'the something', we say 'the object'.
Note for Object Oriented Programming users
Python is strongly object-oriented in the sense that everything is an object including
numbers, strings and functions.
We will now see how to use variables along with literal constants. Save the following
example and run the program.
How to write Python programs
Henceforth, the standard procedure to save and run a Python program is as follows:
1. Open your favorite editor.
1. Enter the program code given in the example.
1. Save it as a file with the filename mentioned in the comment. I follow the convention
of having all Python programs saved with the extension .py.
1. Run the interpreter with the command python program.py or use IDLE to run the
programs. You can also use the executable method as explained earlier.
Example: Using Variables And Literal Constants
# Filename : var.py
i = 5
print(i)
i = i + 1
print(i)
s = '''This is a multi-line string.
This is the second line.'''
print(s)
Output:
$ python var.py
5
6
This is a multi-line string.
This is the second line.
How It Works:
Here's how this program works. First, we assign the literal constant value 5 to the variable
i using the assignment operator (=). This line is called a statement because it states that
Python en:Basics 31
something should be done and in this case, we connect the variable name i to the value 5.
Next, we print the value of i using the print statement which, unsurprisingly, just prints
the value of the variable to the screen.
Then we add 1 to the value stored in i and store it back. We then print it and expectedly,
we get the value 6.
Similarly, we assign the literal string to the variable s and then print it.
Note for static language programmers
Variables are used by just assigning them a value. No declaration or data type
definition is needed/used.
Logical And Physical Lines
A physical line is what you see when you write the program. A logical line is what Python
sees as a single statement. Python implicitly assumes that each physical line corresponds to
a logical line.
An example of a logical line is a statement like print('Hello World') - if this was on a
line by itself (as you see it in an editor), then this also corresponds to a physical line.
Implicitly, Python encourages the use of a single statement per line which makes code more
readable.
If you want to specify more than one logical line on a single physical line, then you have to
explicitly specify this using a semicolon (;) which indicates the end of a logical
line/statement. For example,
i = 5
print(i)
is effectively same as
i = 5;
print(i);
and the same can be written as
i = 5; print(i);
or even
i = 5; print(i)
However, I strongly recommend that you stick to writing a single logical line in a
single physical line only. Use more than one physical line for a single logical line only if
the logical line is really long. The idea is to avoid the semicolon as much as possible since it
leads to more readable code. In fact, I have never used or even seen a semicolon in a
Python program.
An example of writing a logical line spanning many physical lines follows. This is referred to
as explicit line joining.
s = 'This is a string. \
This continues the string.'
print(s)
Python en:Basics 32
This gives the output:
This is a string. This continues the string.
Similarly,
print\
(i)
is the same as
print(i)
Sometimes, there is an implicit assumption where you don't need to use a backslash. This is
the case where the logical line uses parentheses, square brackets or curly braces. This is is
called implicit line joining. You can see this in action when we write programs using lists
in later chapters.
Indentation
Whitespace is important in Python. Actually, whitespace at the beginning of the line is
important. This is called indentation. Leading whitespace (spaces and tabs) at the
beginning of the logical line is used to determine the indentation level of the logical line,
which in turn is used to determine the grouping of statements.
This means that statements which go together must have the same indentation. Each such
set of statements is called a block. We will see examples of how blocks are important in
later chapters.
One thing you should remember is that wrong indentation can give rise to errors. For
example:
i = 5
print('Value is ', i) # Error! Notice a single space at the start of
the line
print('I repeat, the value is ', i)
When you run this, you get the following error:
File "whitespace.py", line 4
print('Value is ', i) # Error! Notice a single space at the
start of the line
^
IndentationError: unexpected indent
Notice that there is a single space at the beginning of the second line. The error indicated
by Python tells us that the syntax of the program is invalid i.e. the program was not
properly written. What this means to you is that you cannot arbitrarily start new blocks of
statements (except for the default main block which you have been using all along, of
course). Cases where you can use new blocks will be detailed in later chapters such as the
control flow chapter.
How to indent
Do not use a mixture of tabs and spaces for the indentation as it does not work across
different platforms properly. I strongly recommend that you use a single tab or four
Python en:Basics 33
spaces for each indentation level.
Choose either of these two indentation styles. More importantly, choose one and use it
consistently i.e. use that indentation style only.
Note to static language programmers
Python will always use indentation for blocks and will never use braces. Run from
__future__ import braces to learn more.
Summary
Now that we have gone through many nitty-gritty details, we can move on to more
interesting stuff such as control flow statements. Be sure to become comfortable with what
you have read in this chapter.
Sunday, November 27, 2011
Saturday, November 12, 2011
Digest
云计算
对于做这门生意的企业来说,云时代,就是卖“计算机”的不卖“机”了,卖“计算”了;卖“存储器”的不卖“器”了,卖“存储”了。总之,云时代,不卖“服务器”卖“服务”了
Saturday, October 8, 2011
Forehand
what is ultimate forehand? it is power, angel, deep and consistency. u might have this xperience, one day u are totally on, one day totally off. u don't know what happen. in this clinic, we are gonna learn the proper form. u can trust ur form. the cross court, the down the line. the deep shot. short ball. then ur opponent will fear ur forehand.
--grip: semi-west
--ready position: 1140
ready position is well balanced position. ur knees r slightly bend. u can quickly move to the right or the left. i see contantly out there when people played. their raquet is down there, they r looking over here, looking over there. they r not really paying attention to the ball. u have to have good ready position in order to be a good player. ur weight is down. ur eyes r focus. u have really big eyes, watching the ball coming.
again, ur feet are shoulder length split, ur knees are slightly bend. ur raquet is up. at first u may feel stupid, but it is ok.
--footwork: 1400
step out with outside foot. step cross. as u r close to the ball u start we call baby step to get ourself in the position. we plant our leg and drive to hit the ball. tennis is very much of timing game. that a little amount of time is very valuable.
reay position, footwork is prety important part of this puzzle.
--back swing: 1718
type A: big loop. it is kind of waste of the time. it is ok on the clay but ont on the other surface.
type B: compact stroke. it is an abbreviated swing.
tips: the back hand goes back together that will help rotate the shoulder.
Open & closed stances
2 types of stances. open stance and close stance. both of them used outside let to drive the hip and wieght forward.
closed stance: we had plenty of time, i run towards the ball, i plant the foot, i step and i drive through the target.
--Ball contact point:
where r we making the contact with the ball? it is the biggest misconception in people's mind. the proper contact point is right in front of ur front foot. so ur
whole body is behind the ball and then u can generate the power to hit the ball.
dip and lift: dip the knee and lift to hit the ball. that dip and lift actually will generate more power and more spin. let us utilize the biggest muscle in our
body, our leg and our butts. everything works together, my leg, my butts, my shoulder.. so we can generate all the power possible
--follow through:
the final piece of the puzzle is the follow through. without follow through, we lost the control because the ball stay at the string for a shorter amount of time.
a, it is gonna hurt us. if u want to hit the ball with power, u have to relax. the easier u feel, the more power u will hit. u lost the control by not following
through. u gain the control by following through.
Wednesday, October 5, 2011
Lobs and drop shots
introduction
In today's clinic, we are gonna talk about the drop shot and the lobs. i am sure u played with the player. all they do is just lobs and lobs and lobs again. these players move u up to the net with drop shot and then lob coming over your
head. normally we call this old man tennis. this shot is really underestimated. now i just wanna blast every ball.
I guarentee once you learn touch nice drop shot, defensive lobs and offensive lob, u will become a complete player, one
they can use anything they need to win the point. otherwise you just blast and blast, once the opponent change the pace, you r in trouble.
drop shot is great shot, especially on the clay court. but it can be used on any surface out there. lobs too. it can be used to get u out of the trouble. today we will learn the drop shot, learn how to hit it properly. learn when to hit
it. i guarentee you can pick up that stroke and find it is not that difficult. and you will have a lot of fun when u use those in your matches.
==============
drop shot technique
what u have to know about the drop shot is every net shot will use continental grip which is v of the hand on platform number 1. it is our volley grip, half volley grip, drop shot grip, overhead grip and serve grip. once u learn this
continental grip, u r way ahead of most players. most players use easter grip and then change to backhand eastern, or windshild waper here. once you learn the continental grip , u can do whatever u need to do, u can drop shot, u can puch
hard in order to win the point.
now u have the grip, now what we do with the grip. the motion of the drop shot is exactly same as slice motion. what u trying to do is high-to-low-to-high, following through. we are trying to generate the spin, when it hit, it is going to
stay where is that. very important on this shot is do full following through. too many people when they hit the drop shot, they go from hight to low, then what they do is they cut it. most time they cut it right down the net.
what we wanna do is we start closed to the net. because the drop shop is very much of touch shot. we have to learn good touch. i like to use this terminology that when we are taking that ball in, it is like catching a waterbollon toss.
continental grip, turn to the side way position, from high, not too far open. with too far open, we are gonna pop the ball up. it is about 10, maybe 15 degree. maybe a little bit more. depends on where we are on the court. but 10-15 degree in general, from high to low to high.
u don't want to give the drop shot the way too early. otherwise they have plenty of time to run up and cover it. so what we wanna do is make it looks like we are going to blast it. and in the last second we take the pace off the ball,
nice soft hand , put back spin on the ball. so when the ball hits, it bounces 2,3 time before get the service line. that is the sign of a good drop shot. once we feel comfortable about the drop shot, we move back a little bit to make it
more difficult. give a little bit air under the ball. starting to get that feel, understand what it takes to take the pace off the ball.
backhand side is identical to the forehand side.
remember, from high to low to high. finish the slot. don't cut down on the ball. cutting down will go right into the net.
Once we feel comfortable about drop shot, we wanna accelerate the raquet a little bit more. what it does is it put even more spin on it. so when it hit, the ball will bite the ground even harder.
it will sit there and stay.we want our drop shot to be an effective shot. the target we are aiming for is 2,3 bounces before it get to the service line. once we get the feel, we can start working on the placement. the effective drop shot is at the right time we hit the ball to the right place. we don't wanna just hit the drop shot randomly. actually we wanna use drop shot to benefit us, to set ourself up to win the points. we may win the point with the drop shot, we may win at the next point. once you hit the drop shot , close to where it is going. u can cover the down the line hit, or cross over.
terminology: soft hand around the net. you have the soft hand , you can take the pace off and hit it where u want.
tips: soft our hand, down the raquet and from high to low to high.
time: rememer the time we use the drop shot is the opponet is at the baseline. donot use it if they start moving forward, ready to come up to the net cause that will help them put the ball where they want them to be. great way to make ur opponent to move, make them run. remember what we do is take the pace off, put the spin on it and make it under control.
work on the softhand , that is all thing we have done so far. with this tips, u can pick up the drop shot pretty easily. now we move back to the baseline. usually baseline is not the area u normally use the drop shot. it is really hard to make the drop shot effectively unless you have opponent they played way behind the baseline. once you get the feel, you can do what ever you want.
tips: set up like normal stroke. in the last second, change to the continental grip. remember the baseline is not the place you wanna do the drop shot very often.
it is only used when ur opponent played way behind the baseline or they just don't like to come in and then u can force them to come up to the net with this drop shot.
when u at net, or mid court, drop shot is high percentage shot. to the baseline, it is low percentage shot.
tips: drop shot is just like the waterbloon toss or egg toss. nice and soft hand.
Deffensive BH/FH lobs:
2 types of lob: deffensive and offensive lobs. u can hit the lobs from ur forehand side or backhand side. once u understand the technique, it is pretty easy shot.
the reason i like the lob shot whenever u got pulled wide, lob shot give u extra time to come back to the court, back to the point. it works great when u play with really aggresive player. drop shot can keep off their balance, so then are not able to get to the position they wanna to be.
first thing first: grip--continental grip. lob is prety much soft stroke, a touch stroke. 4-5 feet over the outreach of the hand technique: from low to high. 45 degree. short motion. most problems when people lob is they lobs too short. then ur opponent just blast ur lobs. some one lobs way to high.so they have no control over it. shoot about 4-5 feet hight should keep u in the court. and it also give u some room when u are in the match situation.
nice and relax. right over the head. very simple. forehand lobs is great shot to put you back in the court.
tips: always push ur lobs shot to the backhand side. so even u hit the lobs too low, they can't get to hurt u that bad. backhand lob is identical. basically just pushing the ball right to the target.
in this drill, i setup a box of the cone in the back quarter of the court. what i am tring to do is all my lobs are aiming for the back quarter of the court.
first SB will be feeding me and i will be aimming for that side. once we feel confortable, SB will come up to the net after feeding me, put the pressure on me.
backhand lobs is so critical. even u lob too short they can't hurt u.
finish up ur follow through.
RETURNING A DEFFENSIVE LOBS
some people play single or double. they fear getting lobs. the lobs is over his head, they totally in panic.
tips to return the deffensive lob: RELAX. everyone has 3 to 4 seconds on lobs which is over your head. it give u plenty of time to run back to back of the court. relax and realize you have plenty of time. the technique is simple. as soon as u the ball come over ur head. realize u r not able to get it.
conclusion: u r attaching to the net. they throw a lob over ur net. first thing first, realize u r not able to touch it. as soon as u realize u r not able to touch it, try to follow the ball. if u can't follow the ball, anticipate where the ball is gonna bounce. flip back over like it, and u will realize ladies do this much easier than man because their wrist is more flexible. once u understand this technique, u no longer fear going up to the net. this kind of technique will help u single, it will help u doubles, make this point last much longer.
OFFENSIVE FH/BH lobs:
now we are working on the offensive lobs or topspin lobs. the difference between deffensive lob is floating lobs and topspin lob is driving lob. the key to this shot is accerlation. we accerlate the requiet, not slow it down. the harder u drive the back of the ball up, the more pressue the air drive the front of ball down.\
that is how topspin lobs work.
technique: semi-west grip. depending of where u are on the court, u adjust the angel to hit the ball.
================
the ball.
DROP SHOT WALL TRAINING:
Now we are moving to the wall. just make sure we working on the wall with all our strokes. but one stroke is neglected very often time is ur drop shot. when u work on the wall, do not forget working on the drop shot. 2 or 3 feet above the line. find the target. and working on hitting the target everytime.
when u work on your drop shot, it is very important that we do the touch. find the target , aim for the target each time. come to 6 to 7 feet from the wall.
practice it. it is easy , but not quite easy as it looks like. once u feel comfortable here, u start moving back to the service line.
when u feel a little bit comfortable here, u move further a little bit from the net.
if u mess up , do not worry. it is gonna happen.
once u work on ur backhand/forehand drop shot, u will feel comfortable in match situation. and i gurantee u are able to execute this shot when u play it.
Tuesday, September 27, 2011
Serve
Introduction:
from very begining, very basic, how to use your leg mulscle, rotation of ur hips, your shoulders, the snap of the wrist, put them together to gain ultimate server.
to gain the power of the serve, to gain the spin of the kick serve, to gain the accuracy on ur slice serve. to make the serve a weapon.
PROPER SERVE GRIP:
the first thing we work on is the grip, like the other stroke, the grip is so important. on the serve, it is continental grip. too often i see the people who wonder why he can't get the power serve. he is big guy. and he hit the ball hard. the reason is he use semi-wester or easter grip. this grip put the forearm, put the hand in the proper position. so we can snap the ball all the way through. so move to continental grip, then we can move on and do the rest of serve . u r gonna get the power and spin u r looking for.
Serve preparation stages:
come up to the line and get our feet set in the proper position. the left foot should be forward, pointing at the right net pole or 90 degree to the service line. i personally like it. what it does is it already turn the hip slightly. so we r ready to get into the loading position.
preparation stage 1: relax, go through the exact same routine, step by step. everytime we get to the court.
my weight is mainly on my front foot. it is nice and relax and i am well balanced. once i get my feet in the proper positon, i already get my hip rotated. i bounce the ball a couple of time. again, find ur routine, do the routine everytime. whether it is the first poinnt of ur match or the last point of match. then get urself set, get the ball and the raquet in the fron. once u r in this position, we can move on what we called loading position.
at this stage, we start with rotating our shoulder, dropping the weight to the back foot. down together and up together.
one of the hardest thing in the serve is the toss. if u can get the toss to the same place each time, u r gonna be so far ahead of ur component. too often i saw the people holding the ball one palm of the hand. they toss the ball with the bend ball, so sometimes here, sometime overthere. if we toss the ball with the finger tips, with the arm extended, that is the distance in the court we want the ball to be. it is 2,3 feet in side the court where we can hit the ball really hard.
so: preparation position-->down-->rotate shoulder and hip--> rotate the weight back-->down together and up together-->toss the ball into air. that the power position , like the tennis trophy. if we can make the motion together, we can make the serve so much easier.
for the back foot, either step back position or step up position. either higher vertical power or highter horizontal power, depending what we do. the power of the serve come from the biggest musual in our body, the leg mulsal. if u see the great server, they really bend their knee down, drive the leg up to the ball. that is the part most of server do not utilize. that is why u can see 90 pounds boy hit incredible serve. they learned how to drive up the leg, how to relax to snap through that ball.
preparation -->loading-->exploding, just as throwing motion. simpualize it and relax. don't think about it too much because u won't be relax.
toss the ball: extending the arm. this distance did not change too much all over the whole life.
exploding: reach and snap and follow through. same as throwing motion.
preparation stage:
-1,front foot point to right net pole. -2, move the ball to front foot. -3, hold the ball with finger tips -4, bounce the ball a couple of time. >> find your routine and do it every time
load stage:
-1, down together -2, rotate the shoulder, hip and the weight back -3, bend the knee -4, up together -5, extend the arm and toss the ball to 2,3 feet inside the court where we can hit the ball really hard.
exploding stage:
-1, drive the body up with leg mulsules and reach the ball
-2, reach the ball and snap the wrist and follow through cross the body.
-3, move yourself into the court.
from CCTV 5:
1, 前脚脚尖抬起,重心从后向前压。 (PETE SAMPRAS)
2, 扭肩,几乎向后。
3, 直臂抛球, 一点方向
4, 跳起向抢篮板, 下巴始终向上。
5, 后腿打平保持平衡。
6, 二发拍头加速。
Wednesday, September 21, 2011
Complete NTRP Scale
1.0
This player is just starting to play tennis
1.5
This player has limited experience and is still working primarily on getting the ball into play
2.0
FOREHAND: Incomplete swing; lacks directional intent
BACKHAND: Avoids backhands; erratic contact; grip problems; incomplete swing
SERVE/RETURN OF SERVE: Incomplete service motion; double faults common; toss is inconsistent; return of serve erratic
VOLLEY: Reluctant to play net; avoids BH; lacks footwork
PLAYING STYLE: Familiar with basic positions for singles and doubles play; frequently out of position
2.5
FOREHAND: Form developing; prepared for moderately paced shots
BACKHAND: Grip and preparation problems; often chooses to hit FH instead of BH
SERVE/RETURN OF SERVE: Attempting a full swing; can get the ball in play at slow pace; inconsistent toss; can return slow paced serve
VOLLEY: Uncomfortable at net especially on the BH side; frequently uses FH racket face on BH volleys
SPECIAL SHOTS: Can lob intentionally but with little control; can make contact on overheads
PLAYING STYLE: Can sustain a short rally of slow pace; weak court coverage; usually remains in the initial doubles position
3.0
FOREHAND: Fairly consistent with some directional intent; lacks depth control
BACKHAND: Frequently prepared; starting to hit with fair consistency on moderate shots
SERVE/RETURN OF SERVE: Developing rhythm; little consistency when trying for power; second serve is often considerably slower than first serve; can return serve with fair consistency
VOLLEY: Consistent FH volley; inconsistent BH volley, has trouble with low and wide shots
SPECIAL SHOTS: Can lob consistently on moderate shots
PLAYING STYLE: Consistent on medium-paced shots; most common doubles formation is still one-up, one-back; approaches net when play dictates but weak in execution
3.5
FOREHAND: Good consistency and variety on moderate shots; good directional control; developing spin
BACKHAND: Hitting with directional control on moderate shots; has difficulty on high or hard shots; returns difficult shot defensively
SERVE/RETURN OF SERVE: Starting to serve with control and some power; developing spin; can return serve consistently with directional control on moderate shots
VOLLEY: More aggressive net play; some ability to cover side shots; uses proper footwork; can direct FH volleys; controls BH volley but with little offense; difficulty in putting volleys away
SPECIAL SHOTS: Consistent overhead on shots within reach; developing approach shots, drop shots; and half volleys; can place the return of most second serves
PLAYING STYLE: Consistency on moderate shots with directional control; improved court coverage; starting to look for the opportunity to come to the net; developing teamwork in doubles
4.0
FOREHAND: Dependable; hits with depth and control on moderate shots; may try to hit too good a placement on a difficult shot
BACKHAND: Player can direct the ball with consistency and depth on moderate shots; developing spin
SERVE/RETURN OF SERVE: Places both first and second serves; frequent power on first serve; uses spin; dependable return of serve; can return with depth in singles and mix returns in doubles
VOLLEY: Depth and control on FH volley; can direct BH volleys but usually lacks depth; developing wide and low volleys on both sides of the body
SPECIAL SHOTS: Can put away easy overheads; can poach in doubles; follows aggressive shots to the net; beginning to finish point off; can hit to opponent's weaknesses; able to lob defensively on setups; dependable return of serve
PLAYING STYLE: Dependable ground strokes with directional control and depth demonstrated on moderate shots; not yet playing good percentage tennis; teamwork in doubles is evident; rallies may still be lost due to impatience
4.5
FOREHAND: Very dependable; uses speed and spin effectively; controls depth well; tends to overhit on difficult shots; offensive on moderate shots
BACKHAND: Can control direction and depth but may break down under pressure; can hit power on moderate shots
SERVE/RETURN OF SERVE: Aggressive serving with limited double faults; uses power and spin; developing offense; on second serve frequently hits with good depth and placement; frequently hits aggressive service returns; can take pace off with moderate success in doubles
VOLLEY: Can handle a mixed sequence of volleys; good footwork; has depth and directional control on BH; developing touch; most common error is still overhitting
SPECIAL SHOTS: Approach shots hit with good depth and control; can consistently hit volleys and overheads to end the point; frequently hits aggressive service returns
PLAYING STYLE: More intentional variety in game; is hitting with more pace; covers up weaknesses well; beginning to vary game plan according to opponent; aggressive net play is common in doubles; good anticipation; beginning to handle pace
5.0
FOREHAND: Strong shot with control, depth, and spin; uses FH to set up offensive situations; has developed good touch; consistent on passing shots
BACKHAND: Can use BH as an aggressive shot with good consistency; has good direction and depth on most shots; varies spin
SERVE/RETURN OF SERVE: Serve is placed effectively with the intent of hitting to a weakness or developing an offensive situation; has a variety of serves to rely on; good depth, spin, and placement on most second serves to force weak return or set up next shot; can mix aggressive and off-paced service returns with control, depth, and spin
VOLLEY: Can hit most volleys with depth, pace, and direction; plays difficult volleys with depth; given opportunity, volley is often hit for a winner
SPECIAL SHOTS: Approach shots and passing shots are hit with pace and a high degree of effectiveness; can lob offensively; overhead can be hit from any position; hits mid-court volley with consistency; can mix aggressive and off-paced service returns
PLAYING STYLE: Frequently has an outstanding shot or attribute around which his game is built; can vary game plan according to opponent; this player is 'match wise,' plays percentage tennis, and 'beats himself' less than the 4.5 player; solid teamwork in doubles is evident; game breaks down mentally and physically more often than the 5.5 player
5.5
This player can hit dependable shots in stress situations; has developed good anticipation; can pick up cues from such things as opponent's toss, body position, backswing, preparation; first and second serves can be depended on in stress situations and can be hit offensively at any time; can analyze and exploit opponent's weaknesses; has developed power and /or consistency as a major weapon; can vary strategies and style of play in a competitive situation.
6.0 to 7.0
These players will generally not need NTRP ratings. Rankings or past rankings will speak for themselves. The 6.0 player typically has had intensive training for national tournament competition at the junior level and collegiate levels and has obtained a sectional and/or national ranking. The 6.5 player has a reasonable chance of succeeding at the 7.0 level and has extensive satellite tournament experience. The 7.0 is a world class player who is committed to tournament competition on the international level and whose major source of income is tournament prize winnings.
Grip:
First thing first, i wanna spend a couple of minutes on the grip. the grip is the foundation for the every shot we hit in tennis. forehand, backhand, our volley, serve, lobs.. we don't have a proper grip, there is no way we are gonna have the consistency, the power and the control that we want to have. so it is very important you understand the grip.
There are 4 basic grips, i wanna talk about it right now. there are 8 sides of every grip, a octagon. we number those this way, number 1,2,3,4 and 5 on the bottom. it helps us understand where we are trying to get to in order to get the proper grip. the first grip we call the continental grip. this is on number one, v of the hand on platform number one. this grip is used in the serve, the volley, the lobs and the slice. we can learn this grip, this help us tremendously.years ago, this used to be grip to hit all ball with. now we changed. mainly the continental go with your serve, ur volley. everything around the net. the net game goes to the continental grip. your slice also.
Then we mover over to easter grip which is the v of the hand on the platform number 2.this is also called the handshake grip. so you put the raquet out and you shake the hand. that is the proper grip. Sampres uses this grip on his strokes. i teach the semi-western which is the v of the hand on the platform number 3. this actually is the one peaple started very young. because the requet is on the ground. the people go down, pick it up. that is in semi-western grip. Agassi is using semi-western forehand grip. this is the grip i particularly teach because you can hit the spin, you can hit the power. and yet you have that control just by generating more spin.
Going over further is called wester forehand grip which is v of the hand on platform number 4. u notices this grip actually hit the ball with this side of raquet. this grip put too much spin on it. mainly clay player used this grip to play. i don't particulary like it because i found when you r trying to hit the passing shot, you dont have the control to keep the ball low. the ball is too loopy. it is not a very diverse grip. you better move to semi-wester which is much more diverse that way.
For the left-hander, every thing is identical. it is just opposite when we talk about grip. it is very important that you understand it, u learn it, u get the raquet in the proper position. once you do, the consistency u hit will increase, the power will increase. and you will find u r way ahead of your competitors, just by learning the proper grip.
==========================
Wednesday, August 24, 2011
network programming: perl
04_1_echoClient.pl
use strict;
use Socket;
use IO::Handle;
my ($bytes_out,$bytes_in) = (0,0);
my $host = shift || 'localhost';
my $port = shift || getservbyname('echo','tcp');
my $protocol = getprotobyname('tcp');
$host=inet_aton($host);
socket(SOCK,AF_INET,SOCK_STREAM,$protocol);
my $dest_addr=sockaddr_in($port,$host);
connect(SOCK,$dest_addr);
SOCK->autoflush(1);
while (my $msg_out=<>) {
print SOCK $msg_out;
my $msg_in=
print $msg_in;
$bytes_out += length($msg_out);
$bytes_in += length($msg_in);
}
close SOCK;
print STDERR "$bytes_out, $bytes_in\n";
===========================================
04)3_srvEcho.pl
use strict;
use Socket;
use IO::Handle;
use constant MY_ECHO_PORT => 2007;
my ($bytes_out,$bytes_in) = (0,0);
my $port = shift || MY_ECHO_PORT;
my $protocol = getprotobyname('tcp');
$SIG{'INT'} = sub {
print STDERR "$bytes_out, $bytes_in\n";
exit 0;
};
socket (SOCK, AF_INET, SOCK_STREAM, $protocol);
setsockopt (SOCK,SOL_SOCKET,SO_REUSEADDR,1);
my $my_addr = sockaddr_in($port,INADDR_ANY);
bind(SOCK, $my_addr);
listen(SOCK,SOMAXCONN);
warn "waiting for incoming connectionson port $port....\n";
while (1) {
next unless my $remote_addr=accept(SESSION,SOCK);
my ($port,$hisaddr) = sockaddr_in($remote_addr);
warn "Connection from [", inet_ntoa($hisaddr), " , $port]\n";
SESSION->autoflush(1);
while (
$bytes_in += length($_);
chomp;
my $msg_out = (scalar reverse $_) . "\n";
print SESSION $msg_out;
$bytes_out += length ($msg_out);
}
warn "connection from finished\n";
close SESSION;
}
close SOCK;
==============================