So you’re sitting at a computer all day packing on the pounds? Thinking about signing up to the gym to keep in shape? But hey! Most of us have been there. Sign-up for a few months and give up after a few weeks right? I’ve been there many times. But for the last two years and a half I did manage to keep in good shape by going to the gym. So I would like to share with you what worked for me.

First a quick recap (and bragging) of the progress I’ve made. Three years ago I could barely run around the block without thinking I was going to die. Now I can run 5 km three times a week pushing a stroller with my two kids in it. I was also very weak. Here’s the progress I’ve made with my strength over the last three years.

Getting in shape

Training “to get in shape” never worked for me. You pump irons looking at yourself in the mirror and thinking you’ll look like Arnie in just a few months. But that never works. For two simple reasons.

No measurable goals and no lasting motivation. Looking better, being in better shape, that doesn’t work. Losing weight is easily trackable. But… “losing” is incredibly boring and depressing. How about gaining!

Gaining some strength! (And muscles too.)

Strength training is the perfect type of training for “office” workers like most of us.

It is intense without being mentally draining.

You can be done in an hour or so.

It’s the best way to wake up and get you pumped for the day.

It is easily trackable.

You can set achievable goals.

You’ll progress very fast at the beginning, this likely stay motivated.

The path to your goals is pretty straight forward.

The first time you lift more than 300 pounds, you’ll feel like a superhero. And that feeling keeps coming back each time you break a new personal record.

Strength training pushes you to be consistent. If you miss a workout, you’ll never break that record of yours this week!

Pick a simple program

The nice thing about a program like this one is that you’ll actually know what you’re doing! The worst thing to do in the gym is to improvise. Starting Strength will make you master the barbell and a few very important movements you use every day.

But the most important point is, your progress needs to be easily trackable. With Starting Strength it’s pretty simple, your goal is to add ~5 pounds each time you go to the gym.

If strength is not your goal, there are many programs available. Check out this program picker.

Track your progress

I’ve tried many iPhone apps to track my progress. The most fun is Fitocracy. There’s a game aspect to it that helped me a lot at the beginning. Follow me here on Fitocracy.

A lot of my progress at the beginning was made by improving my techniques. Mastering something new is also a very rewarding experience and I found learning about better ways the squat, bench press and deadlift to be fascinating.

Set goals

A simple goal could be to go from Novice to Intermediate level. Don’t be too audacious and revise your goals if you’re losing motivation. But make sure you’re always progressing, ie. increasing weigths.

Consistency and intensity

Those are the two keys to make progress. Make a schedule that is reasonable and that you can follow in the long term.

And here’s the most important part. When you go to the gym: make it INTENSE! If you’re not progressing, you’re either not eating, sleeping or trying hard enough. Forget what you though your body could do. It can lift way more than you think!

I’ve been through some incredible pain to make the progress that I have. But this increases the feeling of accomplishment you get afterwards. It also thought me a lot about pushing harder and more brave in other parts of my life.

A few more tips

One big problem I had at the beginning was caused by breathing. I was thought that it’s bad to hold your breath when pushing. It’s actually important to hold your breath when lifting heaving to protect your internal organs. This is called the Valsalva Maneuver. It’s all explained in details in the Starting Strength book.

Regarding supplements. After some research, I ended up with the following combination. Whey protein isolate, creatine, Omega 3 and Vitamin D everyday. And BCAA around trainings. Check out Examine.com to get the details about all those.

One last thing that helped me a lot was to get a training belt. I’d recommend getting one once you reach intermediate level. It will help you stabilize your back and torso.

Diet

I use to follow a strict diet. I tried a few. Nowadays I don’t, but I still do intermittent fasting. But one thing is for sure. If you want to increase you strength, the more you eat the better. The math is pretty simple, try to optimize to get the most protein per calories you consume.

In summary, lifting heavy things is incredibly rewarding, a nice way to get in shape and a great excuse to stuff your face with copious amounts of meat. Seriously. What more could you want?

The Heart of the Node Event Loop

I am a big believer in mastering your tools to become a better developer. And the best way to master your tools is to understand how they are made.

Do you know what’s happening inside Node.js or EventMachine?

There’s an event loop. So there must be a loop somewhere, right? A loop handling events. Let’s take a look…

The Loop

Event loops like the one in Node or EventMachine are designed to react to I/O events. This could be an incoming connection, data arriving on a socket, etc. What’s more, it must react to these events extremely quickly. Like most things in software, the simplest design is usually the fastest. And event loops are usually very simple.

First, it consists of an endless loop:

while (true) {
...
}

Everything will happen in that loop. All of your Node programs will be running inside that loop. Which is similar to the loop you’ll find in virtual machines and emulators, where an actual processor is simulated instead.

A Turn in the Loop

Somewhere in the loop, your process will wait for I/O events to happen. Luckily, most operating systems come with a function that allows us to do just that. Several options exist, such as kqueue on Mac OS, epoll on Linux. The most portable (but slowest) one is select. For more on this, see select.

select watches a bunch of I/O objects (files, sockets) and lets you know when something happens. It looks something like this:

After we’re done executing all of the callbacks, we’re ready for another turn in the loop – it’ll patiently wait for other I/O events to happen.

But There’s More!

This is a simplification of how things work internally. However, even if the Node event loop is a little more complex than that, the structure is the same. It’s still a loop using select (or a variation), and triggering callbacks.

Still not sure how this allows huge amounts of concurrent connections to be handled by a server? Or you’d like to dive deeper into event loops and how it works in Node, and how other features such as setTimeout are implemented? Join the next edition of my online class.

Everything is online. You can ask questions. You’ll get exercises. And you’ll also get recordings of the class to watch again at your leisure.

The class already helped a number of developers master Node and EventMachine. Here’s what one of them had to say:

I don’t know where to begin. I am blown away. Other online “classes” that I have attended are very lackluster compared to your class.
The format was amazing, […], building on top of each lesson as we progressed.
[…]
I am not sure it could have been done better. This is complicated stuff, and I feel you have gone well above expectations to help understand the event loop.
I can easily say that I have leveled up – it has changed my thinking on event driven programs. Not just in Node but for Ruby as well. - Tom Buchok

The previous edition was a great success and sold out quickly. I’m expecting this one to sold out very soon too. So if you’re interested, book now!

What Picasso meant is that good artists duplicate the work of other artists without changing it. But great artists take the work of other artists and make it their own.

I believe programming can be an art, or at least something we should aim for. (For the record, here’s my favorite piece of art… err! code, Lua’s bytecode. If you have the patience to wrap you head around it, I guarantee you’ll believe me when I say this is a piece of art. But let’s stay on track here…)

To become a better programmer you have to first copy, and then steal.

Copying

A painter that copies another painter’s work, for example, will reproduce every lines and colors one at the time. This makes you realize how many parts come into play to make an amazing piece of art (or software). So when I say copy, I certainly don’t mean copy-paste code from StackOverflow. I mean: recode the thing, line for line or in your own style or language, by looking at the original.

This might seem dumb at first, but it works for the same reason taking notes helps you remember things. Even if you don’t go back to read them. It’s also better than simply reading the code. As you can’t get lazy and skim over some parts.

The first open source project I ever created was called WebAccept. An horrible idea I know… But I learned so much! I copied most of the design and code from NAnt, also a copy, or as they said: a .NET port of Ant, the Java build too, which probably started as a copy of Make. That project taught me more than I ever learned in school and at work about good software design, documentation, tests and all.

I’ve been applying the same approach ever since. With Thin, I copied Mongrel. With TinyRB, I copied TinyPy and Lua. Each time learning more and more.

That’s why I think the best way to learn is to copy, recode, recreate from scratch. And also why I use this approach in all my presentations and classes.

Stealing

Stealing is the next level. You can copy some code and still not understand how it works. You can also copy some code and not see a better way to do it. But, you become great when you adapt the code to make it better.

This is how the world of software evolves. Making baby steps towards greatness by building on the work of others before us. Making things a tiny bit better each time. There should be no shame in this kind of stealing.

After copying Thin from Mongrel almost line for line, I rewrote it six times to steal it and make it my own.

Lets copy together!

OK! Want to give it a try?

To get you started and show you how I do it, I’ll be teaching a new class in which I’ll rebuild a Ruby web server from scratch.

And here’s the kick… it’s free!

Sign-up bellow and join me this Friday, June 21st at 1PM ET. It should last about an hour and I’ll take some questions at the end.

However, because of technical limitations, only 100 people can attend it live. But, recordings will be available if you sign up.

All you need is basic understanding of web dev with Ruby (with Rails, Sinatra or other) and a browser with Flash.

I applied a systematic approach in validating and launching each one of those. All became profitable from day one (I describe some of my techniques in Copywriting For Geeks bonuses). But my classes are the ones generating most of my revenues. This is why I have three. When you find something that works well and that you love to do, you crank it to eleven.

Numbers

Those two years also marked another important milestone. I recently crossed the $250,000 mark in sales. While I don’t think this is exceptional, I’m extremely proud of it. Especially proud of the fact that all of it came from my products, that I created from scratch. I’m now making a living entirely with the things I passionately create in my tiny home office and that feels awesome!

I should also note that I took a lot of weeks and sometimes several months off instead of expanding my business. Had I been more proactive, that number could easily be higher. But I made it a rule not get into any business which would take control of my time. And allowed myself to wander without too much guilt.

It’s not that hard

A lot of people will say you have to make plenty of sacrifices to have a successful business. Sacrifice your health, time with your family and everything else. I found that a business is everything you want it to be. So it can be a bunch of sacrifices if you want it to be or it can be something else. That is the beauty of it all. If you want to work more, you can, and you will be compensated. Not by a pat on the back from your boss, but by more money in your pockets and more customers thanking you. It’s up to you to make those decisions and part of what makes building a business such an empowering and scary adventure.

If you read somewhere that you have to max 10 credit cards, gain 20 pounds and work 15 hours a day to make your business succeed, it’s a lie. In fact, my finances are going great, I actually lost 20 pounds and have worked fewer than 15h per week.

The hard part is not the sacrifices, but the change in mindset you need to make. Putting your stuff out there and asking people to pay you money, constantly promoting your stuff, accepting that some will dislike your products, living in the fear of losing it all and occasional self-doubt can be though challenges.

You Can Do It!

Be my own boss and not have anyone dictate my schedule or interests has been my grand professional goal for as long as I can remember. So don’t be fooled in thinking it took me two years to get where I am today, it took me twelve or more.

Twelve years ago, I was unable to get any job as a software developer. Sitting in my room at my parents house, I furiously coded a VB6 application with the intention of selling it. But didn’t know a thing about where to go from there. Didn’t know anyone who knew anything about that either. Didn’t believe starting a business was possible for people with questionable social skills like me.

If you’re dreaming of being your own boss and creating a business too, here are a few advices:

Start small (give away stuff, open source, etc.) and use your successes to build up your confidence, credibility and authority.

Start by copying and adapting successful businesses (but make sure they are successful first).

Your new passions are sales, marketing and advertising.

Create the best products you can. I promise, people will notice how much you care someday (if they haven’t already).

Be patient, but determined.

Thank You!

You know what makes or breaks a business? Customers. And boy did I found great ones!

If I have anyone to thank for my success it’s you who bought my products. Thank you! None of this would have been possible without your trust, feedback, patience and encouragements. You have changed my life and I can’t never thank you enough for it.

Most of my customers are now referred by other customers who enjoyed my products enough not only to buy and use them, but who tell others about it. That feels incredibly great!

I’m surely not the first programmer to mention the side effects of being in front of a computer all day. Right after getting a job, I started packing on pounds and my health kept degrading.

Reading Tim Ferris’ Four Hour Body got me the kick to try a diet. His is called Slow-Carb. Basically: no bread/pasta, no dairy, no fruits, but one cheat day per week. Gotta say it worked quite well and was surprisingly easy to follow. I lost about 25 pounds in a few months and maintained that weight ever since.

But during that time I also got into strength training, but noticed I made very little progress and felt my energy level was pretty low. So I went on to try something else. Also no carbs and no dairy seemed a little weird to me.

Enter Intermittent Fasting

The premise is you fast for 16h+ and eat during the remaining hours of the day. Which basically means you skip breakfast.

LeanGain also adds fasted training, meaning you even train before eating, after ~15h of fast! Crazy uurg!

OMG! But breakfast is the most important meal of the day!

There have been numerous studies showing that skipping breakfast makes you fat and all. But apparently, other studies are proving this wrong. People skipping breakfast either already have bad eating habits or fasting make them eat more in subsequent meals. Which is why I tracked my calories, carbs, fat and proteins closely at first.

Intermittent fasting actually has a bunch of health benefits. Some studies even show it can lower blood pressure. I’ve had hypertension for a few years and medication was the next step. So that was enough to convince me to try it for a few months.

I’m not a health expert in any way, so I encourage you read about fasting myths here by the author of LeanGain.

Results

I’ve been following the LeanGain approach for almost two months now and here are my results.

I had been maintaining my weight around 175 pounds and ~18% of body fat (143.5 of lean mass) for close to a year. I was unable to get lower and also unable to get more strength. Now after ~two months I’m at 170 pounds and ~14.5% body fat (145.35 of lean mass).

So I gained ~1.85 pounds of lean mass (musclez!) and lost ~6.85 pounds of fat in a little less than two months.

My strength has also been increasing:
- Bench press: from 160 pounds to 185 pounds
- Squat: from 225 pounds to 275 pounds
- Deadlift: from 185 pounds to 315 pounds (was scared at first to try this, which explains the very low initial number)

And… surprise surprise! My blood pressure dropped back to normal in just one month!

Right before starting on October 23: 155/83
On November 24: 133/84

Although it was hard during the first two weeks. I actually now feel more focused during the morning when fasting. And I also have more time during the AM as I don’t need to eat/prepare breakfast.

WARNING!

Obviously, I’m not a doctor. I don’t know what I’m talking about here and am simply reporting my results. Do any of this at your own risk.

I remember as a kid I was so excited when something broke in the house, a phone, the TV or the Nintendo. That meant I got to open the thing and look at how it worked. Of course I had to nag my parents for it and they sometimes questioned if I was the one who broke it in the first place simply to crack it open. Maybe once… but not more, I swear!

Later on I discovered programming and became fascinated by how easy it was to create things with it. It took me a few years, but I finally got the itch to crack it open and learn how programming languages are made.

Since then, I believe I became a better programmer simply because programming languages are the tools we use, and understanding how your tools work, in any profession, art or science, is the best way to master our craft.

Overview of a language

Here’s a quick overview of how a typical programming language is structured:

Here’s a walkthrough:

The lexer will take your code, split it into tokens and tag them. If your code was in english, that would be like splitting each sentences into words and tagging each word as an adjective, noun or verb.

Then the parser takes those tokens and try to derive meaning from it by matching tokens with a set of rules defined in a grammar. This is where we define what constitute an expression, a method call, a local variable and such in our language. The result of that parsing phase is a tree of nodes, called AST for Abstract Syntax Tree.

Now, if our language is a tree walker interpreter (like ruby < 1.9), the interpreter will browse the nodes one by one and execute the action associated with each type of node. It’s not very efficient, so that’s why most languages compile to bytecode instead of keeping the nodes in memory and executing from them.

Bytecode is very close to machine code, but at the same time close to our language source too. The trick is to bring it as close to the machine as possible to get higher performance and as close to our language as possible to make it easier to compile. Once we have that bytecode, we run it through the virtual machine. It will walk through the bytecode executing actions associated with each byte.

While executing, our VM or interpreter will modify the runtime. The runtime is where our program lives. It’s the living world in which our program is executing. When you create objects or call methods, this is all happening in the runtime. Having a fast and memory efficient runtime is crucial. This is also where the garbage collector is doing its work.

How bytecode is actually executed

One of the most fascinating thing I learned was how the bytecode is interpreted by the virtual machine. Even though it’s a Virtual machine, it is very close to how the actual physical machine, the processor, work. So understanding this leads to understanding how your whole machine works!

Is there something more depression than having zero creativity? You know you want to create something but don’t know what. Or perhaps you have a problem, but can’t find the proper solution. Sometimes your brain is just not in full power. You see all those people on the internets creating amazing things. Why can’t you create stuff like that?

I know the feeling!

I’ve had some very creative times in my life, but I’ve also had some very depressing times where I felt like the dumbest person on earth. Throughout the years, I’ve studied famous creative people and tried various ways to stimulate my creativity.

Here are the three techniques that worked best. Each one worked very well but at different times, often in combination.

1. Break a habit

The best way to have no creativity is to turn your brain off. When your whole day or week is a routine you don’t even have to think to complete, you’re basically living on autopilot. Changing small things in a routine can have a huge impact on your creativity.

Take a different path to work. Change haircut. Change your lunch menu. Anything small or big will stimulate your brain. I’ve used this technique numerous times.

Also, changing a habit will stimulate you to change other ones. So if you want to change something important, change some small things first, which will give you motivation (doing something new is always exciting isn’t it?). Then, use that motivation and confidence to change something bigger.

The point is to get momentum. This also work for anything you want to accomplish, not only having more creativity.

2. Be alone

Be alone, that is the secret of invention: be alone, that is when ideas are born. - Nikola Tesla

Solitude is greatly underrated. I believe no serious work, deep thinking or innovation is possible with people around you.

This has nothing to do with being introvert or not. Creating requires a high level of concentration which can’t be reached when there are people around. You can’t still get with people before of after that process to get feedback or re-energize.

Without great solitude no serious work is possible. - Pablo Picasso

And by alone, I also mean no IM, Twitter, Facebook or such.

3. Get bored

Here’s an easy way to get bored: consume less. Not because I believe consuming is bad, but because I think it forces us to the other side: producing.

Necessity is the mother of invention. - Unknown

Get bored long enough and I assure you getting unbored by creating will become a necessity.

I remember having no internet when I was younger on my parents computer. That’s why I first learn to program, there was nothing else to do on that damn thing!

Drop a comment below and let me know if you have any tip of your own to stimulate your creativity!

One question I get all the time when I release something is: how do you find the time? Although this is false, you don’t find free time, you make it. Because as soon as your time becomes free you fill it with an activity: playing, reading, sleeping, thinking. This is Parkinson’s Law: your daily activities expand to fill the time available.

Time is your most valuable asset. With time you can make whatever you want, be it money or anything else. With some money you can afford some more time and with some more time you can get some more money. Success builds upon successes.

A few years ago, after releasing my first successful open-source projects, some people told me: “appreciate the time you have now, because once you have kids you won’t have time for this anymore”. A year later, my daughter was born, the same year, I released tinyrb the most complex coding project I ever did. Now I have two kids, more projects than ever and managed to quit my job doing only what I love.

How to Make Time?

Everyone’s life is different. Of course, now I get pretty much all the time that I want (but I still have to plan for it). But I’ve always found ways to make time for my projects. Here’s a quick recap of hours I saved to dedicate to my projects when I had a job.

Work from home: -2h/day
Sleep less: -2h/day
Don’t watch TV: -2h/day

That makes an extra 6 hours per day. 30 hours per week (without the weekends). That’s almost another workweek right there and I haven’t cut a minute from the things I love, like spending time with my family and reading books. I don’t always spent all this time on my projects, but when I have an idea, I can make things happen in a week or so. The point is, this is my time, I decide what I do with it.

Here are a few more examples of useless activities you might have done recently: checked-out Google+, Installed OS X Lion.
You might be thinking: “but I have to keep up to date with latest technologies”. I’m not saying you shouldn’t, but you certainly don’t need to try every new technology that comes out the minute it comes out. Let other people filter it for you.

This is Hard, I Need My Night of Sleep and Forget About Working From Home

Yeah, life is hard, I agree with that.

The Four Hour Workweek has a chapter on how to work your way up to working from home full-time. It’s hard, takes time, guts and determination. I started with only one occasional day per week, then a few more, then full-time a year later. You can plan for it and make concessions (like a smaller salary, remember: time is your most valuable asset).

How to Find Motivation?

I remember a year ago, I found this video and that was quite a revelation to me. I know it can be cheesy, but sometimes that tasty cheese is all you need to get the energy needed :) (oh what a cheesy pun!). It all boils down to: how bad do you want it? Not bad enough if you can’t make time for it.

When you want to succeed as bad as you want to breath, then you’ll be successful.

Copywriting is the art/science of selling with words. Most geeks do not believe in copywriting. Long copy can’t sell, right? Who reads a single sentence in Apple’s copy? All you need is a fancy product name and an incredible list of features, right?

Wrong, wrong and … wrong! And I’ll explain why in a minute.

Various styles of copy work depending on the stage of sophistication of the market and their state of awareness.

States of awareness

How aware of your product and their needs is your market?

1. The most aware: everybody knows about your product, no need for long copy, state the price and what’s new about it.
2. The customer knows of the product but doesn’t yet want it.
3. The prospect knows he wants what product does, but doesn’t know yet there is a product.
4. The prospect has a need, recognize the need, but doesn’t recognize the connection between need & your product.
5. Completely unaware market.

Most mainstream copy is cheesy to geeks because we have a very high state of awareness (state 1-2).

Sophistication of the market

Copy also depends on how many products have been there before you. This is called the sophistication of the market.

Here are the 4 stages of sophistication of a market with a sample headline describing each.

Learn to write amazing copy NOW, for FREE! ZOMGBBQ!

I have to admit, my interest in copywriting was caused by an over-exposure to Mad Men. After watching the four seasons a dozen times, I carefully studied Influence, by Robert B. Cialdini, the mythical (and out of print) Breakthrough Advertising, by Eugene Schwartz, a bunch of other books and bought a crap load of videos, PDFs and online tutorials about copywriting.

After applying some of this stuff, I started selling a lot more and my life began to change quite drastically :).

It took me some time to admit this was due to my copywriting skills, but I was literally getting emails from customers saying: “Your tag line hooked me”, “[…] then I read your [product] description and that sealed it” and “this sentence convinced me”.

So, I’ve decided to pack all my learnings in a small eBook for easy and quick consumption by you!

We’ve all read about A/B testing. How it can help you increase conversion four quadrillion percent, twice. The problem is you need a few (a lot actually) conversions to be able to make a choice. So for example, when I run an A/B test on my ebook sales page, I let it run for a fews weeks until I get a few conversions (sales).

That is a very slow process. Also, you can’t run multiple A/B tests at the same time, as it would mix up the results of each test.

When I launched my class, there was quite a lot of things I wanted to test on the page. The problem was, I could only get 20 conversions (sales) and I had to get results fast. There was no way I could wait weeks for results.

So here’s what I did.

Track scrolling

Instead of tracking sales or clicks, I tracked scrolling. I assume if someone finds the headline or copy interesting, he will scroll to read more. The goal of the sales page is to get people to read it till the end.

Using that technique, I was able to tweak the headline and copy, and get results in a few hours instead of weeks.

40% increase in conversions

My tests totalled a 40% increase in people that clicked the Register button.

I must admit A/B testing sometimes feels like black magic. For eg.: switching to a blue Buy button on my book sales page yielded a 440% improvement in sales… ?! But running lots of smaller tests seems like a better thing to do than depending on a full conversion such as sale or sign up.