Today on my OOP344(c++) subject I learned that when we delete a pointer,
int main(){
int* b;
b=new int[3];
b[0]=3;
delete b;
b[0]=7;
printf("%d\n",*b); //7 will be printed here
return 0;
}
we actually deleting not the pointer (ptr) but what stored in the address.
And we don't need to declare the pointer again if we want to reuse it.
We can assign the pointer a new value without declaring it again.
That is what I call true recycling but not that useless curbside recycling program
Friday, July 9, 2010
Thursday, June 24, 2010
What is Cloud computing
This site clear explains what is Cloud Computing.
Reading Wikipedia about clouding computing was nothing but frustration. The only information I found useful from the article was:
Cloud computing derives characteristics from, but should not be confused with:
1. Autonomic computing — "computer systems capable of self-management".[11]
2. Client–server model – Client–server computing refers broadly to any distributed application that distinguishes between service providers (servers) and service requesters (clients).[12]
3. Grid computing — "a form of distributed computing and parallel computing, whereby a 'super and virtual computer' is composed of a cluster of networked, loosely coupled computers acting in concert to perform very large tasks"
4. Mainframe — powerful computers used mainly by large organizations for critical applications, typically bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.[13]
5. Utility computing — the "packaging of computing resources, such as computation and storage, as a metered service similar to a traditional public utility, such as electricity";[14]
6. Peer-to-peer – a distributed architecture without the need for central coordination, with participants being at the same time both suppliers and consumers of resources (in contrast to the traditional client–server model).
Reading Wikipedia about clouding computing was nothing but frustration. The only information I found useful from the article was:
Cloud computing derives characteristics from, but should not be confused with:
1. Autonomic computing — "computer systems capable of self-management".[11]
2. Client–server model – Client–server computing refers broadly to any distributed application that distinguishes between service providers (servers) and service requesters (clients).[12]
3. Grid computing — "a form of distributed computing and parallel computing, whereby a 'super and virtual computer' is composed of a cluster of networked, loosely coupled computers acting in concert to perform very large tasks"
4. Mainframe — powerful computers used mainly by large organizations for critical applications, typically bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.[13]
5. Utility computing — the "packaging of computing resources, such as computation and storage, as a metered service similar to a traditional public utility, such as electricity";[14]
6. Peer-to-peer – a distributed architecture without the need for central coordination, with participants being at the same time both suppliers and consumers of resources (in contrast to the traditional client–server model).
Friday, June 4, 2010
I just found a very interesting blog post
about History of Programming Languages
I think that post could be a good test to learn how much you know about programming.
about History of Programming Languages
I think that post could be a good test to learn how much you know about programming.
Thursday, May 20, 2010
How to create a short link
I just found out how to create a short link. And I am really exited about it.
I hate to type something like: http://zenit.senecac.on.ca/wiki/index.php/OOP344
so from now i just type: bit.ly/oop344
On the website bit.ly you can register by providing a valid email address and then create your own short links. The service is for free and if the short name wasn't chosen by somebody else then you can own the name and share it with your friends.
I hate to type something like: http://zenit.senecac.on.ca/wiki/index.php/OOP344
so from now i just type: bit.ly/oop344
On the website bit.ly you can register by providing a valid email address and then create your own short links. The service is for free and if the short name wasn't chosen by somebody else then you can own the name and share it with your friends.
Tuesday, April 6, 2010
There is one step from hate to love...
OK guys now rise your hands who love pointers!
No one? Really?
Then lets do the work-through!
#include
int main(){
int i;
int j;
int a[5]={1,2,3,4,5};
int b[3][5]={
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15}
};
printf("%d\n", *a); //Try to find two differences
printf("%d\n", **b); //in those two lines.....No rush, take your time :-)
return 0;
}
Now look to the result:
1
1
Now you know that name of array is a pointer to the first member stored
in the array, but if it is two dimensional array then name of the array
is a pointer to pointer to the data stored in first member of the array.
And if you want to scary somebody you can print something like *************c.
But it is deep night and I will afraid to do something like that.
Ok ok I know you don't feel good about me already. But wait a minute I didn't
promise that you going to love pointers! I just said that "There is one step
from hate to LOVE". Sorry there is no magic here...
Magic is here: Punk Magician
And you gonna LOVE it :-)
No one? Really?
Then lets do the work-through!
#include
int main(){
int i;
int j;
int a[5]={1,2,3,4,5};
int b[3][5]={
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15}
};
printf("%d\n", *a); //Try to find two differences
printf("%d\n", **b); //in those two lines.....No rush, take your time :-)
return 0;
}
Now look to the result:
1
1
Now you know that name of array is a pointer to the first member stored
in the array, but if it is two dimensional array then name of the array
is a pointer to pointer to the data stored in first member of the array.
And if you want to scary somebody you can print something like *************c.
But it is deep night and I will afraid to do something like that.
Ok ok I know you don't feel good about me already. But wait a minute I didn't
promise that you going to love pointers! I just said that "There is one step
from hate to LOVE". Sorry there is no magic here...
Magic is here: Punk Magician
And you gonna LOVE it :-)
Wednesday, March 17, 2010
Skype, Google talk... and Microphone? Not necessary:-)
In our days programmers often use programs like Skype, Google talk, MSN, etc for conference calls. In order to participate in the call you need:
1. Computer with one of the program installed on it.
2. Internet.
3. Speakers.
4. Microphone.
But what to do if somebody already calling to you but you don't have microphone? How many of you tried to shout to your computer in hope that it has embedded microphone? :-). Solution was very close. In situation like that you just need to plug in another earphones in a plughole for microphone and talk to left earphone. Keep it very close to your mouse and also you may need to put microphone volume on maximum. For urgent call the quality of sound is very very acceptable but if you consider to have a long relationship with somebody on other end of the internet consider to buy a good microphone.
1. Computer with one of the program installed on it.
2. Internet.
3. Speakers.
4. Microphone.
But what to do if somebody already calling to you but you don't have microphone? How many of you tried to shout to your computer in hope that it has embedded microphone? :-). Solution was very close. In situation like that you just need to plug in another earphones in a plughole for microphone and talk to left earphone. Keep it very close to your mouse and also you may need to put microphone volume on maximum. For urgent call the quality of sound is very very acceptable but if you consider to have a long relationship with somebody on other end of the internet consider to buy a good microphone.
Wednesday, March 3, 2010
int* p=0;
There is a little program:
#include
int main(){
int* p=0;
p++;
printf("%u\n", p);
return 0;
}
The output is: 4
and the program runs without mistakes and warnings.
But why I couldn't run the next one?
#include
int main(){
int* p=4;
printf("%u\n", p);
return 0;
}
in other words my question would be:
How to make p=4 at one stroke?
#include
int main(){
int* p=0;
p++;
printf("%u\n", p);
return 0;
}
The output is: 4
and the program runs without mistakes and warnings.
But why I couldn't run the next one?
#include
int main(){
int* p=4;
printf("%u\n", p);
return 0;
}
in other words my question would be:
How to make p=4 at one stroke?
Subscribe to:
Posts (Atom)