Observations, stories, projects, photos.
In English and Russian.

Later Ctrl + ↑

A cure for busyness

Ruminating (actually, procrastinating, who am I kidding?) on what makes a day productive for me, I came up with a metric that rings true so far.

It’s time spent creating vs. time spent consuming.

Creating is making new things or making things better. Or at least trying. Consuming is usually doing things you shouldn’t be doing: reading Secret, playing that game on YouTube because you’re too busy to actually play it, picking up your phone every minute to check for notifications.

Now, not all consuming is bad. More often than not, kicking back and reading a book for a while or daydreaming does more good than harm. You can’t spend all your active time creating, or you’d run out of creative juice. You need time to rest and recharge.

Still, creating creates (ha!) momentum. I’ve noticed that if I start my day on a creative note, I get more done. Rarely what we need to do is to consume something, rather it’s something we should create: write emails, code a program, present our ideas to other people.

Consuming works the same. If you eat (consume) a cake instead of doing a morning pushup set (creating a better body), you’re much more likely to slump on a sofa and watch (consume) another episode of people in fantasy setting killing each other right and left than draft (create) a new blog post.

This reminds me of the concept of stability in physics.

Stability is the ability of a body to restore its balance after a disturbance (change in position or orientation). The quality of the stability is determined by how large a disturbance the body can withstand before the balance is lost. A body that is precariously balanced can withstand only a small disturbance and so has low stability. A body that is solidly balanced can be disturbed greatly and so has high stability.

Consuming is settling on the bottom of a pit: you have nowhere to fall. Stable. Creating is rope walking: at first, every misstep sends you tumbling into the pit. As you learn, even in headwind and with the rope thrashing around, you remain stable atop. When you do fall, you’re back on the rope in no time.

So, time spent creating vs. time spent consuming. At the end of the day, concentrate for a few seconds and in your heart you’ll know at once whether you’ve spent enough time creating.

The struggle against self-sabotage

Written two years ago for one of my other websites which is about to expire. Just reread the book yesterday, and it rings even more true than last time, if it’s possible.

The amateur tweets. The pro works.

That pretty much sums up Steven Pressfield’s “Turning Pro” for me.

In the face of uncertainty and doubt, the amateur chooses distraction, while the pro chooses to do the work instead. The pro knows: doubt won’t go away by itself, one has to push it, shove it, kick it. By doing the work.

What is distraction, if not self-sabotage, sabotage of one’s future self? As Pressfield puts it, lives go down the tubes one hundred and forty characters at a time. It’s not only Twitter, but any distraction or self-delusion that prevents us from doing the work of our life.

Mindset makes all the difference. Approach the work like a pro, and you win. Come at it like an amateur, you give up and in the end it kicks your butt.

The amateur and the pro are Pressfield’s metaphors for people who either run from their fears or face them. It’s a choice that one has to make every day.

What’s your choice?

Ignore this book at your own peril! Short and intense, it will challenge your attitude to work and life — for your own good.

Find the links to buy the book on the official site. I’ve bought my copy on Amazon.

 No comments   2014   Books

Recursive Blocks

Blocks are a language-level feature for C, Objective-C and C++, which, among other things, allow passing code into methods as if it were a variable, or so Apple’s documentation says. Personally, I love blocks. They are convenient, non-blocking (ha-ha) and have a peculiar, but fun syntax.

It all becomes more fun when you have to pass a block between several functions, keeping track of what’s in scope and what isn’t.

Modern Objective-C is using ARC, which is more convenient for the user and more memory safe than what you have to do in C by hand. With simplicity, though, come a few caveats. One of them is a retain cycle, when two objects have strong pointers to each other, that is, while one exists, the other won’t be released. As they are referencing each other, they will both not be released and will clog up memory. Thus, retain cycles.

There are techniques that you can use to avoid them, for example using a weak reference, which means that a weak object only exists if someone is referencing it. As soon as the reference is gone, the object gets released from memory.

Anyway, I learned a new trick for block recursion, which doesn’t make the compiler wail and is easy to understand.

There are three obstacles on the way to block recursion:

  1. You can’t use the block within the same block until it has been fully initialized.
  2. You can’t use only a __block prefix on the block variable, because it creates a retain cycle.
  3. You can’t use only a __weak prefix on the block variable, because then it would be deallocated at the worst possible moment.

The solution is below:

__block __weak void (^weakNextPage)(void); // A weak block variable that we would use inside the block.
void (^nextPage)(void); // The block has to be fully initialized before recursive use, otherwise it would be NULL.
weakNextPage = nextPage = ^(void) { // Have weak and normal block variables point to the same code.
    if (finished) {
        block(YES);
    } else {
        currentPage++; // This is a __block variable declared just before the block declaration.
        weakNextPage(); // Call the block recursively.
    }
};

nextPage(); // Call the first iteration of the block.

Pretty simple, but it’s worth knowing. There’s also a website with a nice URL reminding on the syntax, which is not really straightforward. Oh well, they’re still a joy to use.

 No comments   2014   iOS
Earlier Ctrl + ↓