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.
Wednesday, August 22, 2012
Table Tennis Tournament 20/8/2012
The last time I played Table Tennis (TT) was during secondary 2 I think. However, I started to play table tennis again since last May 2012.
Back then in secondary school, I was a total noob. I always lose. I don't remember winning any games. Right now, I felt like I have improved so much compared to back then. I was one of the best in my department. There is another person same level as me let'sc call him 'E'. The winning ratio between me and E is 50:50. I wanted more exposure. So, I went ahead and I played during weekends with my cousin, friend, and even total strangers.. Until one day..
The day when I received a broadcast email regarding TT tournament. I did not want my National Service life to be just work all the time. And I never participated in any tournament before. I invited a few my friends to come along but they rejected it. Back then during my poly time, there were many things I wanted to do and be involved, but none of my friends were interested. So I did not go. But right now, I told myself that I shall not listen to others no more. Its time for me to make my own decision. Its time for me to be myself. I shall not depends on other people views and decision..
So.. I joined the tournament for fun. I did not know how far can I go. I was just joining it for fun to see where do I stand.
A few days before that, 'E' was advising me to get a new paddle as the one that I am using currently is the cheapest one which cost $10. I ignored his advise initially. 2 days before the tournament I dig out my wallet and there were $70 inside. And I was like thinking of getting a new paddle with a $50 budget. oh and 1 week before the tournament, I played with some strangers at Sengkang and hurt my wrist. my right wrist sprained and it was very painful. The following day, I was having a shooting test. If you did shoot before, you should know the recoil effect on your wrist and palm. These 2 events worsen my condition.
My wrist was injured pretty badly even till today (22/8/2012), I have not recovered yet. Ok so back to Sunday. Before I went to a sport shop, I went to a pharmacy to get a wrist support. It costed me $39! and I was like "Man.. That's it! I am not buying a new paddle." So yea, I decided not to buy. I thought even if I buy, there is no guarantee that I will even win my 1st match. Oh and the tournament was based on a knock out system. If you lose, that's it! No more games.
The night before the tournament, I was googling, "what makes a table tennis bat good". Guess what? It says that it depends on rubber resistance. The more resistance, the better. In order to measure your paddle resistance, you need to get a TT ball, hold it tight, and rub across your paddle to feel the resistance. If it rubs smoothly, forget the current paddle, and get a new one. Ok pretty easy to measure huh? So I took out my paddle and I did that and guess what?! The ball rubs across very smoothly, and my eyes at this moment rolled out. "OMG! I am dead!".. Ahh never mind, I will just play based on my skills and luck.
Let's go to the basics, in a match, in order to win, it depends on 2 things, your skills and equipment. I would say, 70% skills and 30% equipment. In this case, you can say that I only based on my skills which I think is only about 30% coz I am not so good.
So, I was having a cold sweat basically. When I stepped into the sports hall, there were lots of crowd and lots of tables. I was like, "goshhh...!" It was freaking nervous. I can assure you that. On top of that, everyone was warming up. All the tables was full. And all the audience were watching you playing. I wonder what were they saying.
And you know what is the best thing about this tournament?! I don't know whether it was just a fate or a coincidence. But my game was the 1st game in my category which was novice category. A few minutes before my match I was sitting and watching people play. Generally, the way they play is like a beginner like me. So, I was expecting someone at my level. Oh and I did not manage to warm up as all the tables are full.
So, when my turn came, I met my opponent, and he was sweating! which means he had plenty of warm. He was well built and in his 30s. And I was like, OMG.
We had about 3-5 minutes warm up game. His balls were super spinny, curly, speedy, and pretty. I had a very hard time returning his serve. I can tell that he is a pro! Much higher level than me. If I am only at Level 1, my opponent was a fusion of 2 friends of mine (whom I consider pro), 'E' and 'J' to form EJ Level 2. Let me rate his strength. I would say, 50-60% skills, 30% equipment. I only rate myself 30% skills/
The game consists of 3 rounds. Each round is 11 points. At first, I thought, total is 5 rounds, so I took my own sweet time. I had a good game with my opponent. We laughed and joked during the match. So here are the scores for each round (O / Me):
- 1st round: 11 / 9
- 2nd round: 8 / 11
- 3rd round: 11 / 7
So basically, I only won 1 round which is on the 2nd round. I was so sad after the 3rd round coz I thought it was for 5 rounds. So yea, I shook his hands in the end and I wished him luck. My game lasts for about 20 minutes I think.
Anyway, this post sounds like I am making an excuse after losing. Don't get me wrong. I don't really care whether I lose or win. As a men, I do accept my defeat and I acknowledged my shortcomings.
Hope that you enjoyed reading this. :)
Subscribe to:
Posts (Atom)


