Tuesday, May 14, 2013
Sunday, March 31, 2013
Lambda Expression Only Available With -std=c++0x or -std=gnu++0x
So here is the story in short:
I was revising my C++ programming based on a book that I borrowed from a library titled, "Sams Teach Yourself C++ in One Hour a Day", written by Siddhartha Rao. The book is good. Its pact with tons of examples. But its proofreading is not so good. So, if your programming is not bad, you should be able to spot the mistakes when you read through. The downside to this book is that it does not mention the solution that we have to configure if certain examples does not work. for example, it makes quite a difference to,
#include or its variant of .h The extra blogger codes drives me crazy.
I do not know about other books. To be honest, I never read other programming books in detail before. So, I don't know. But overall, I like the book.
Ok, I think I have drifted away. Let's get back on the track. So, today, while I am trying out the lambda function, I came across this error, "Lambda Expression Only Available With -std=c++0x or -std=gnu++0x".
I googled for quite sometime. Most of the answers are for those who are familiar with their IDE. They keep on saying add the command line to your compiler. I looked at my compiler setting, I scratched my head.
After searching and thinking for awhile. I opened up my compiler setting again for the second time. This time, I read carefully, then I saw something and I ticked it as shown below:
I was revising my C++ programming based on a book that I borrowed from a library titled, "Sams Teach Yourself C++ in One Hour a Day", written by Siddhartha Rao. The book is good. Its pact with tons of examples. But its proofreading is not so good. So, if your programming is not bad, you should be able to spot the mistakes when you read through. The downside to this book is that it does not mention the solution that we have to configure if certain examples does not work. for example, it makes quite a difference to,
Ok, I think I have drifted away. Let's get back on the track. So, today, while I am trying out the lambda function, I came across this error, "Lambda Expression Only Available With -std=c++0x or -std=gnu++0x".
I googled for quite sometime. Most of the answers are for those who are familiar with their IDE. They keep on saying add the command line to your compiler. I looked at my compiler setting, I scratched my head.
After searching and thinking for awhile. I opened up my compiler setting again for the second time. This time, I read carefully, then I saw something and I ticked it as shown below:
Binggo! That's it! It worked! Now, the codes can be compiled.
Hope that you enjoyed this post. It is not meant for those who are familiar with their IDEs. The last time I used codeblocks was in 2009. ;)
Tuesday, November 13, 2012
How To Keep it FIT The Lazy Way
Well, its as the title mentioned, how to keep it fit the lazy way?
Why do I say, "lazy way"?
Well, you guess?
That is because I am very very very very lazy person. Trust me. I am anti-gym by the way. If possible, I only want to practice one type of workout that enhances all the muscles. But yeah no such thing I guess.
So, here is how to keep fit the lazy way:
Why do I say, "lazy way"?
Well, you guess?
That is because I am very very very very lazy person. Trust me. I am anti-gym by the way. If possible, I only want to practice one type of workout that enhances all the muscles. But yeah no such thing I guess.
So, here is how to keep fit the lazy way:
- 5 Minutes London Bridge - Do a few variations of planks, 15 seconds each till you reach 5 minutes. Do it everyday!
- Pull ups - Do pull up everyday. I don't care how many do you want to do. But at least, once a week, you have to do 10 sets of pull ups in one day. You are free to do any kind of variations. Be creative and excite all your muscles.
- Push ups - This one you have to do concurrently with pull ups. For me, I will do 5 sets of 16-20 push ups concurrently with the last 5 sets of 8-10 pull ups. It depends on your ability too. Do as much as you can, but don't force yourself. If you can't complete it, there is always next time. Don't overdo it till you collapse or what. that is just plain stupi*.
- RUN - This is important. RUN at least once a week. If you are fat, run for 30 minutes for each session. For me, I run at least twice a week, about 5 Km each. Its really a pain in the as*. But hey, I want my wife to look sexy and slim for only me. So, I guess, I have to do some favour for her first?
Be consistent and never give up! Love every pain and muscle aches. Trust me, I love them. Oh and I get extremely motivated to workout more whenever I watch fighting and ninja movies.
See ya!
How To Strengthen Your Weak Arm Naturally
Yeah, you heard it?
How to increase it strength to be in par with your strong arm naturally, without going to the gym and lifting weights?
Its easy. Do a one hand push up and use only your weak arm. Do not use your strong arm to do a one hand push up. Remember, your objective is to strengthen your weak arm to be as strong as your strong arm. You will have to burst your weak arm fast. If you use your strong hand in the process, well, your weak arm will need more time to catch up with your strong arm. (Currently I am at this stage)
Here is how to do it at http://www.beastskills.com/one-arm-pushup/
What's next?
Once you got use to one hand push up, do a one hand pull up using your weak arm. Good luck!
How to increase it strength to be in par with your strong arm naturally, without going to the gym and lifting weights?
Its easy. Do a one hand push up and use only your weak arm. Do not use your strong arm to do a one hand push up. Remember, your objective is to strengthen your weak arm to be as strong as your strong arm. You will have to burst your weak arm fast. If you use your strong hand in the process, well, your weak arm will need more time to catch up with your strong arm. (Currently I am at this stage)
Here is how to do it at http://www.beastskills.com/one-arm-pushup/
What's next?
Once you got use to one hand push up, do a one hand pull up using your weak arm. Good luck!
Sunday, October 21, 2012
Network Classes Range
I don't normally blog but the situations forces me to. You see.. I am currently studying for my CCNA examination that I plan to take by December 2012. So yeah, while reading the free guide that I came across online, I came across this topic that talks about Network Classes and its ranges. Its pretty confusing to me.
Let me show you why it is confusing. There are seveal network classes, but I will only list the first three. It is as below:
Max No. of Hosts = (2^n) - 2.
Hence, Max No. of Hosts for:
Let me show you why it is confusing. There are seveal network classes, but I will only list the first three. It is as below:
| Class | First Octet Range | Default Subnet Mask |
|---|---|---|
| A | 1 - 127 | 255.0.0.0 |
| B | 128 - 191 | 255.255.0.0 |
| C | 192 - 223 | 255.255.255.0 |
Figure 1
Max No. of Hosts = (2^n) - 2.
Hence, Max No. of Hosts for:
- A: 16, 777, 214
- B: 65, 534
- C: 254
But, what about Max No. of Networks for those class A, B, C?
A: 254
B: 65, 534
C: 16, 777, 214
WRONG! WRONG WRONG!
I too got the same perception initially. But when I looked at the book, it says,
Max No. of Networks for:
- A: 127
- B: 16, 384
- C: 2, 097,152
How on earth did they get that value??
After thinking and thinking, scribbling, and sketching on a piece of paper, I think I found the answer. Let me explain in my own way.
Let's go back to figure 1 above, look at the octet range for class A, B, and C. How on earth did they derive it. I can't catch a ball when I first look at it. I presume that you have some understanding about logical addressing and subnet mask. I am not gonna explain on that. So in order to get the octet ranges in a way that I could understand, here is what I do:
| Class | Binary | Octet Value | Default Subnet Mask |
|---|---|---|---|
| A | 0000 0001 | 1 | 255.0.0.0 |
| 0111 1111 | 127 | 255.0.0.0 | |
| B | 10000 0000 | 128 | 255.255.0.0 |
| 1011 1111 | 191 | 255.255.0.0 | |
| C | 1100 0000 | 192 | 255.255.255.0 |
| 1101 1111 | 223 | 255.255.255.0 |
Figure 2
Does this make sense to you? It does to me. Now I can understand what is written in figure 1, Octet Range.
Ok, now let's go to the second issue which is the maximum number of networks for each classes.
For class A, you can clearly see from the table that max number of network is 127. What about B and C?
*evil grin*
Here is the formula that I derived,
- B: 2^(n-2)
- C: 2^(n-3)
Why is it "-2" and "-3"? Good question! To be honest, I am not too sure too. I derived this formula from looking at those 3 classes. You know that broadcast is not included in the calculation right? so, it is "-1" for every class basically. I know it is not a strong explanation. I'll update this post again when I find the right answer.
This post is basically to remind myself when I forget the basics. Hope you guys enjoyed it.
Subscribe to:
Posts (Atom)



