Monthly Archives: September 2014

Verbs

Group I Normal Verbs

Most verbs are “Normal Verbs.” These verbs are usually physical actions which you can see somebody doing. These verbs can be used in all tenses.
Normal Verbs

to run, to walk, to eat, to fly, to go, to say, to touch, etc.

Group II Non-Continuous Verbs

The second group, called “Non-Continuous Verbs,” is smaller. These verbs are usually things you cannot see somebody doing. These verbs are rarely used in continuous tenses. They include:

Abstract Verbs

to be, to want, to cost, to seem, to need, to care, to contain, to owe, to exist…

Possession Verbs

to possess, to own, to belong…

Emotion Verbs

to like, to love, to hate, to dislike, to fear, to envy, to mind…

Examples:

He is needing help now. Not Correct
He needs help now. Correct

He is wanting a drink now. Not Correct
He wants a drink now. Correct

Group III Mixed Verbs

The third group, called “Mixed Verbs,” is the smallest group. These verbs have more than one meaning. In a way, each meaning is a unique verb. Some meanings behave like “Non-Continuous Verbs,” while other meanings behave like “Normal Verbs.”
Mixed Verbs

to appear, to feel, to have, to hear, to look, to see, to weigh…
List of Mixed Verbs with Examples and Definitions:

to appear:

Donna appears confused. Non-Continuous Verb
Donna seems confused.
My favorite singer is appearing at the jazz club tonight. Normal Verb
My favorite singer is giving a performance at the jazz club tonight.

to have:

I have a dollar now. Non-Continuous Verb
I possess a dollar.
I am having fun now. Normal Verb
I am experiencing fun now.

to hear:

She hears the music. Non-Continuous Verb
She hears the music with her ears.
She is hearing voices. Normal Verb
She hears something others cannot hear. She is hearing voices in her mind.

to look:

Nancy looks tired. Non-Continuous Verb
She seems tired.
Farah is looking at the pictures. Normal Verb
She is looking with her eyes.

to miss:

John misses Sally. Non-Continuous Verb
He is sad because she is not there.
Debbie is missing her favorite TV program. Normal Verb
She is not there to see her favorite program.

to see:

I see her. Non-Continuous Verb
I see her with my eyes.
I am seeing the doctor. Normal Verb
I am visiting or consulting with a doctor. (Also used with dentist and lawyer.)
I am seeing her. Normal Verb
I am having a relationship with her.
He is seeing ghosts at night. Normal Verb
He sees something others cannot see. For example ghosts, aura, a vision of the future, etc.

to smell:

The coffee smells good. Non-Continuous Verb
The coffee has a good smell.
I am smelling the flowers. Normal Verb
I am sniffing the flowers to see what their smell is like.

to taste:

The coffee tastes good. Non-Continuous Verb
The coffee has a good taste.
I am tasting the cake. Normal Verb
I am trying the cake to see what it tastes like.

to think:

He thinks the test is easy. Non-Continuous Verb
He considers the test to be easy.
She is thinking about the question. Normal Verb
She is pondering the question, going over it in her mind.

to weigh:

The table weighs a lot. Non-Continuous Verb
The table is heavy.
She is weighing herself. Normal Verb
She is determining her weight.

Some Verbs Can Be Especially Confusing:

to be:

Joe is American. Non-Continuous Verb
Joe is an American citizen.
Joe is being very American. Normal Verb
Joe is behaving like a stereotypical American.
Joe is being very rude. Normal Verb
Joe is behaving very rudely. Usually he is not rude.
Joe is being very formal. Normal Verb
Joe is behaving very formally. Usually he is not formal.

NOTICE: Only rarely is “to be” used in a continuous form. This is most commonly done when a person is temporarily behaving badly or stereotypically. It can also be used when someone’s behavior is noticeably different.

to feel:

The massage feels great. Non-Continuous Verb
The massage has a pleasing feeling.
I don’t feel well today. Sometimes used as Non-Continuous Verb
I am a little sick.
I am not feeling well today. Sometimes used as Normal Verb
I am a little sick.

NOTICE: The second meaning of “feel” is very flexible and there is no real difference in meaning between “I don’t feel well today” and “I am not feeling well today.”

Past Perfect

[had + past participle]

USE 1 – Completed Action Before Something in the Past

Examples:

  • She had never seen a bear before she moved to Alaska.
  • I had never seen such a beautiful beach before I went to Kauai.
  • I did not have any money because I had lost my wallet.
  • Tony knew Istanbul so well because he had visited the city several times.
  • Had Susan ever studied Thai before she moved to Thailand?
  • She only understood the movie because she had read the book.
  • Kristine had never been to an opera before last night.
  • We were not able to get a hotel room because we had not booked in advance.
  • A: Had you ever visited the U.S. before your trip in 2006?
  • B: Yes, I had been to the U.S. once before.

USE 2 – Duration Before Something in the Past (Non-Continuous Verbs)

  • By the time Alex finished his studies, he had been in London for over eight years.
  • They felt bad about selling the house because they had owned it for more than forty years.

MPORTANT Specific Times with the Past Perfect

example: She had visited her Japanese relatives once in 1993 before she moved in with them in 1996.

Present Perfect

FORM
[has/have + past participle]

The present perfect is a grammatical combination of the present tense and the perfect aspect, used to express a past event that has present consequences.

The present perfect in English is used chiefly for completed past actions or events, when it is understood that it is the present result of the events that is focused upon, rather than the moment of completion.

i.e I have [present tense] eaten [perfect aspect]; he has eaten (present perfect, generally denoting something that took place prior to the present moment)

1) Actions started in the past and continuing in the present:

We have had the same car for eleven years.

2) When the time period referred to has not finished:

It has rained a lot this year.

3) Actions repeated in an unspecified period between the past and now:

We have eaten at that restaurant many times.

4) Actions completed in the very recent past (+just):

Have you just finished work?

5) When the precise time of the action is not important or not known:

She’s studied Japanese, Russian and English.

Unspecified time before Now

  • I have seen that movie twenty times.
  • I think I have met him once before.
  • There have been many earthquakes in California.
  • People have traveled to the Moon.
  • People have not traveled to Mars.
  • Have you read the book yet?
  • Nobody has ever climbed that mountain.
  • A: Has there ever been a war in the United States?
  • B: Yes, there has been a war in the United States.

Use double pointers to control pointers outside of functions

dbl_ptr_1

First we have a variable mainInt which has the value 45 and an address.
By definition, a pointer’s value is an address. And a pointer’s address is just some address.

Hence,

1) intPtr’s value, by definition, MUST be an address. In our case, it is the address of mainInt. 0x7fff5fbff86c
2) intPtr’s address is just some address. 0x7fff5fbff860
2) Dereferencing intPtr means we “get the value associated with the address value of intPtr”. The value is 45.

where

So basically, the function definition dblPtr has a double pointer parameter called paramPtr.

1) First, we look at the function call. Since the parameter is a double int pointer called paramPtr, it needs to point to an address of an int pointer. So we give it the address of intPtr, which is 0x7fff5fbff860.

2) Then, for the function defintion’s parameter, we draw a double pointer called “paramPtr” that will point to the address of intPtr given in the function call in step 1.

3) Thus, going into line 1 of dblPtr, we have everything set up as shown in the image.

dbl_ptr_2

What this means is that we dereference paramPtr, which gives us *paramPtr, which will move intPtr itself because we are using a dereference of it. When do:

we get the intPtr and point it to a newly allocated int variable on the heap. That int variable has the value 6969.

dbl_ptr_3

Hence, after the function call, in our specific case, we’d get:

after function call: *intPtr: 6969
after function call: intPtr: 0x100103ad0
after function call: &intPtr: 0x7fff5fbff860

Note that only intPtr would change from pointing to mainInt, to pointing to heap variable 6969. If there were other pointers pointing to mainInt, they would still be pointing there.

Full Source and Sample Output

SAMPLE OUTPUT:

before function call: address of variable mainInt: 0x7fff5fbff83c
before function call: value of variable mainInt: 45
before function call: *intPtr: 45
before function call: intPtr: 0x7fff5fbff83c
before function call: &intPtr: 0x7fff5fbff830
paramPtr is: 0x7fff5fbff830
&paramPtr is: 0x7fff5fbff688
*paramPtr is: 0x7fff5fbff83c
paramPtr is now: 0x7fff5fbff830
*paramPtr is now: 0x100103ad0
**paramPtr is now: 6969
after function call: value of variable mainInt: 45
after function call: address of variable mainInt: 0x7fff5fbff83c
after function call: *intPtr: 6969
after function call: intPtr: 0x100103ad0
after function call: &intPtr: 0x7fff5fbff830
after function call: *temp: 45
after function call: temp: 0x7fff5fbff83c
after function call: &temp: 0x7fff5fbff828

param dereference

First, we have a variable called aNum. That variable has an address, with an associated value:



We then have:

We have an integer pointer point to the address of our aNum variable.



Then we have a function definition:

We use that function like this:

The function gets pushed onto the main function stack. The function returns void so we do not push any return variables onto the stack. Next, the function has

as its parameter. Hence, that parameter gets pushed onto the stack like so:

param_deref_3

The parameter variable param points to whatever intPtr is pointing to…which is aNum’s address.

In our function definition, param gets dereferenced. This means that it gets the value associated with the address that it is pointing to. In our case its the value of aNum, which is 100. It changes it to 45.

param_deref_4

When the function call ends, the whole function with its parameter list gets popped. All we’re left with is aNum, which value has been changed to 45.
the pointer numPtr which points to the address of aNum, and thus, also will get 45 if we dereference it.
param_deref_5

Sample Output

OUTSIDE: int * intPtr is: 100
OUTSIDE: someNumber is: 100
INSIDE: parameter pointer is DEREFERENCED…getting the original value which is: 100
INSIDE: original value changed to: 45

OUTSIDE: int * intPtr is: 45
OUTSIDE: someNumber is: 45

full source

update column data where its NOT LIKE

update column Birthday with randoms

if length of birthday string is less than 9

set nationality using LOOR RAND()

Update Code, which is a VARCHAR(40)

Gender

returning a pointer

Pointer manipulation with a return pointer

Just a simple walk through of how pointers work when we have a function with a pointer parameter and a pointer return variable. Full Source down below.

First in our main, we have a variable called aNum that has value 100. Then we have a pointer variable point to the address of our aNum variable.

It should look like this:

return_ptr_1

We look at numPtr’s dereference, which should be 100.

Anything a pointer dereference, it gets the data value contained by the address that the pointer is pointing to. Thus, since our pointer is pointing to an address that contains the value 100 ( aka aNum ).

numPtr dereference is:100
aNum is now: 100

Also, every variable works like a stack. Every additional variable is pushed onto the top. First In Last Out style.

Now, it gets interesting. We have a function definition for returnFunc:

We see that our function definition has a parameter int pointer that points to an int variable’s address.
This means that when we use this returnFunc function, we must give a parameter. In our case, we must give a parameter that the returnFunc’s integer pointer parameter can point to. When we call our function:

we must provide an integer pointer data for the function definition’s parameter to point to. We give it integer pointer “numPtr”. (Remember, numPtr is pointing to aNum)
This is what it looks like:

return_ptr_3

Notice that in our stack, the return variable is there. This means that our returnFunc returns an int pointer. Now, we see that our param_IntPtr, which points to our outside scope’s numPtr, gets dereferenced. That dereference is currently 100. At this point:

numPtr points to aNum.
aNum is 100.
numPtr’s dereference is 100.
param_IntPtr points to whatever numPtr is pointing to (WHICH IS aNum), thus param_IntPtr’s dereference (which is aNum’s value) is 100.

When param_IntPtr dereferences, it takes hold of the data its pointing to, namely, aNum. It changes that value to 45.

Thus, now,
*param_IntPtr, aNum, and *numPtr are all 45 at this point.

return_ptr_4

Then we have this line:

we have a local integer pointer point to a new variable made in the heap with the values 6680.
Then we return the integer pointer (address of the heap variable).

return_ptr_5

Now when we go to our main function scope, we see this:

So hence, our main function integer pointer numPtr points FROM aNum’s address to the heap variable’s address. When we dereference numPtr, we get 6680. When we display numPtr’s address,
it would be the address of the variable in our heap.

return_ptr_6

Console Output

numPtr dereference is:100
aNum is now: 100

heapVariable address is:0x100103ae0
numPtr address is now:0x100103ae0

numPtr dereference is now:6680
aNum is now: 45

Full Source