Getting through the famine period

If you are a full time freelancer, you have, or surely will encounter a famine period, because only thing sure in freelancing is uncertainty. Of course, with great marketing and engagement, that uncertainty can be reduced to a minimum level, but it still exists. Let’s say you encounter a famine period. That can happen for a variety of reasons, you being fired by a client, you firing a client(you can and should do that when you feel the need), client not having any more work/money to keep you on, or the worst one of all, health/family issues taking most of your time.

Whatever happens, you should always have a certain amount that goes from your earnings to a savings account. I handle that by working through an equivalent of a LLC company in the US, and pay myself a monthly paycheck. That way, enough money stays on the company’s account as a certain part of savings, and you should make sure you have at least 3 paycheck’s worth in the account, before you go and buy that new and shiny Apple product you just have to have right now. Of course, be sure to leave enough for taxes, especially if your government does not require you top prepay them for the following year.

After we have the company account, and enough money that goes into savings/taxes, you should consider your personal savings too. On that side, try to reduce your spending until you get to at least full 3 monthly burn rates of savings. If you don’t know how to achieve this, there is a great book on the subject Rich Dad, Poor Dad written by Robert Kiyosaki. It should teach you enough to get started.

When famine happens, and it surely will, the savings backbone and mentality described will help you get through the bad period much easier, and let you continue living your dream job, instead of defaulting to full time employment every time you have a bad financial week or month. The first thing you should do is take a retrospect and analyze what had happened. If the client had fired you, was it your fault, or theirs? Did you communicate all issues with the client, Maybe there was some scope creep, or you just bit more than you can chew. If you have fired the client, why did you do that, what trait of the client you found so annoying that you just couldn’t wok with them? Can you try to spot and avoid that type of client in the future? If the client ran out of work for you, can you offer them more? Or reformulate your offering to maybe suite that type of client better? If the client ran out of money, why did that happen? Was it something your work has caused, could you somehow guided the client to better decisions, and maybe profitability?

After you have summarized everything, it is time to fire up your sales funnel. If you don’t have one, go to a user group, and as if someone has extra work you could take over, if you engage with your local group on a regular basis, they will get to know you, and throw work your way, even when you don’t need it. Contact your previous clients, ask them if they may have some work for you, or know someone who has. Referrals is one of the best ways to get good clients, and be able to provide them with great value.

In the meantime, take a vacation, you have earned it. Being a freelancer, I sometimes dread for vacation time, but always wanting to do/learn more keeps me from resting completely. I know that I should try a screen free day, as soon as possible.

Go learn something new. If you are a Ruby on Rails developer, go and learn a frontend javascript framework, Ember or Angular are good enough. Learn another language, maybe a functional one, Elixir seems to gain popularity, Clojure already is fairly popular within the developer community. Invest time in yourself, you have all those savings to keep your mind at ease. You could even learn a real(non-programming) language, that will make your synapses fire differently, and knowing a foreign language never did any harm to no one. Start writing a blog, just for yourself if you have no audience. It will help you channel everything you know, learn it better, and maybe gain you some tracking in the community.

The famine period will make you desperate to find work, that is something we people feel and can’t really get away from it, but hopefully you will be able to rely on your savings, until you find a client that fits you just right. And if you can’t find a client in 4-5 months, then go and look for a full time job, maybe using some of the hot new skills you have learned.

Why learning new things is so hard, and why you want it to be that way

Do you know that feeling when you are starting to learn something new? The feeling of being lost in all that stuff that you can not grasp? Feeling like an idiot while thinking that you will never learn it. Good, that is the best place where you want to be. Learning new things should be challenging, it should make you cringe sometimes, and make you want to bash your head in the wall.

I was looking at my son a few days ago, and I noticed how he was learning how to climb, trying, his feet would not listen to him, and be there where they should, he was aware of it, and it made him angry, because he wanted to climb up. But he tried again, and again, and again, and then he succeeded, now he is climbing fast and precise, which for a 20 month old kid, that is very good.

So the best place you can be is this one, banging your head, because it is where you learn the most. If you remember those editor learning curves, that are so steep, they are because we learn that way, we have to learn so many things in the start, be it vim, emacs, or even Ruby on Rails. The content you have to wrap your head around is so big, that you can’t fit it in your head in one go. But because of your frustration, you learn faster, likely some animal self preservation instinct kicking in. If learning something new becomes too easy, you are not doing it correctly. There is a saying in cycling, that goes something like this: “If your legs are not hurting while climbing a hill, then you are going way too slow, and need to pick up the pace”.

When do we stop learning like this, headstrong, just pushing until you accomplish something, I can’t tell, is it the moment when we become aware of other people, who may judge us, or we fear others judging us? Basically school, i would say high school inmost instances. Ironically, the place where you must be able to learn the most, makes you unlearn learning. Makes you give up trying to do things you do not know how to do, because you believe someone will laugh at you. Yep, that happened to me, and I gave up, only to pick it up later in my life, and realize the time I have wasted. And you must not waste your time like that too.

Just pursue your dreams and ignore the bad critics. Of course you need to have some common sense, and someone you trust to tell you when you suck. But, for example, some if not most people are told they can’t sing when they are teenagers, by underpaid public teachers, and then they give up completely. Maybe they needed more practice, their performance was not, and never would be Elvis like, but they could have learned to sing, a little at least. All people are not the same, and each one of us learns differently. Because of that, you must find a way that is best for you personally, also a reason why public education sucks, by treating and grading everyone the same. When you find your way, it might be writing things down, doodling, repeating out loud, or presenting at user groups and conferences, do it, and do more of it. Your brain will be grateful to you, and regular mental stimulation does the same for your brain, as exercise does for your body(and brain). Not only will you reduce the risk from e.g. Alzheimer’s Disease, but it could indirectly improve your life style, and with that your life expectancy. Learn more, live a longer and healthier life.

There is a great quote that describes this perfectly, and it is from a great book series, that everyone must read, at least once. “My brother has his sword, King Robert has his warhammer and I have my mind…and a mind needs books as a sword needs a whetstone if it is to keep its edge. That’s why I read so much Jon Snow.” – George R.R. Martin, A Game of Thrones

Rails No-No's: Not using background processing

Have you encountered a website with a very slow response? How do you feel when you have to wait for 5 or more seconds, for the page to even start responding? How do you feel when the app you are waiting for ages, is something you are paying for on a monthly basis? Fuck this, let’s try something different? Yep, that is the same thing your users (customers) are feeling when your app is waiting for something. And users have the tendency of voting with their wallets, which in this case, can make your much thinner than it is at the moment.

First and foremost issue is sending emails, when the user registers or when they ask for a password renewal. Those situations can even stand sending emails in sync, but you are blocking the web process thread for new requests while the email processing ends. Let’s consider a situation where you have some larger data massaging operation, that hides between a single form submit. Take for example large business reports, which have to collect data from a number of different data sources, both internal and external. Now, this process can take from a couple of seconds, to hours if your data is not well optimized. You are basically wasting that person’s time on waiting for the report to finish. Now multiply the average time that a person waits, with their hourly rate and that with the average number of reports someone waits for, and with the number of people running such reports in a given company. That is a serious waste of money right there, now if you could somehow optimize this process, you could stand to easily save $10,000+ on lost time, and more over the lifespan of the application.

Imagine if the users abandoned your shopping cart, while it was processing something that could have ran in the background. Now you are losing real sales, and your client is on their way of either firing you, or going broke.

OK, enough melodrama for now. Let us now consider a different option from doing everything in one process in sync. You have the option of threading, but that won’t get you very far, because you are still blocking the user’s flow, while they wait for the response. Enter background workers, which are best run on a separate machine, and they have queue of tasks that need to be performed. A set number of processes which take handle of those tasks, and report back(if needed) when the task is finished. Here are a few options for background jobs in Ruby on Rails:

  • Sidekiq – Multi threaded background processing built on Celluloid::IO and actor based model
  • Delayed::Job – One of the first, if not the first background workers for rails, extracted from Shopify
  • Resque – Background worker using redis instead of the database for queuing jobs

I’ve been using all of them over the years, but as of a year ago, I have been using only Sidekiq on new and migrated some old applications from other workers to it. The benefit of Sidekiq is using actor model and threads to process jobs concurrently, it has a low memory footprint and can be used to boost your application performance, and responsiveness. If you are on Heroku, this will cost you one worker instance per month, as that should be enough to process a very large number of background jobs. If you are running your own stack, one server with the minimum hardware requirements will suffice. No one cares if their email is delivered in 3 minutes instead of right now. But they do care if they can’t do anything for that 3 minutes while waiting for “something to finish”. Here is a basic example of how it’s done with Sidekiq:

class UserGeoLocator
  include Sidekiq::Worker

  def perform(user_id)
    user = User.find(user_id)

You can find out all the things it can be used for in the Sidekiq Wiki on Github.

Impostor Syndrome

Are you feeling like an impostor in your team? Are you achieving things other members of your team appraise you for, but you live in fear, day in and day out, that today is the day when you will be exposed as a fraud? Maybe someone incompetent enough to do the job you are doing right now, and earn the paycheck you are receiving at the moment? Do you think that everything you have done, and are doing successfully, is just pure luck and a fluke, and that one day your luck will run out?

Unless you are working on some menial governmental job, and slacking as hell, you are most surely wrong. You have got Impostor Syndrome, a fairly common disorder that is manifesting in highly achieving people. Basically, it means you can’t internalize your accomplishments, and thinking that you are not as intelligent as other people believe you are. You accept all praise with doubt and uncertainty, and await your day of judgment.

The Impostor Syndrome, or phenomenon, as the phrase appeared in the book The Imposter Phenomenon in High Achieving Women: Dynamics and Therapeutic Intervention, is not a psychological problem, but mostly a sociological issue. It is present mostly in highly achieving women, minorities, but there is evidence it occurs in a comparable number of men also. The most effective technique of overcoming it, is to simply recognize it exists, but that can be hard, especially if you do not know about it, or even if you do, can not admit to yourself that you have it, but still leaning on to your story, even if it makes no sense to anyone else but you. Here is where great teammates and managers come in, they must be able to recognize it, because it is happening in the technology sector more that we want to admit. Especially now, that the diversity in technology is finally a topic everyone is talking, and doing something about it. So if you have a coworker, or a subordinate, who is suffering from this syndrome, please point it, and help them. It is a bad state to be in, as paranoia will eat their productivity.

One of the ways to stop the issue is writing, keeping a journal. Then the person suffering from the syndrome can organize and perceive their achievements, they can easier associate them with reality. Also, all the records are there for a later time, when they are feeling the syndrome again, to remind them of the things they have achieved.

It is healthy to want more all the time, but be sure to acknowledge what you have done already, and never let your inner doubts keep you from doing great things.

Gaining more Authority by becoming an author

I’ve recently read the book Authority by Nathan Barry, and I wanted to share what I have learned from it. The book is basically a course on how to self-publish your content, and how to properly launch it to get the biggest financial gain out of it.

The author does over all of the topics needed to write, market, and self-publish your material. And the book struck me hard, because I am looking into branching to product business myself. And I’ve always enjoyed good writing, mostly consuming it, and very rarely producing.

He got me to start writing after a long time, and that is the first time in my life, that I sincerely enjoy writing, after battling with it way back through school. Authority will teach you that by sharing your knowledge, you can and will become and authority in your field, someone who people look up to for answers on a given topic, even if they never had heard of you a month before. This will hopefully get you better clients, and better paying ones. I will soon be writing about another book soon, one that will help you get out of the rut of being a commodity, and start earning what you are really worth. You will also be producing more value for your clients, but that is the bonus effect for you and your clients.

The book teaches you how to achieve authority by writing books, but you can also achieve the same effect if you do other aspects of teaching people, or being a member of and open source community. There are many ways, and almost every one of them includes teaching and giving some of the stuff for free. And also, teaching something will make you learn it even better, and you will surely become an expert in that field. So if you want to learn something to the core, teach it to other people, some of them will be below your level, some of them will not, and those that are not will surely be there to help you when you make mistakes, and push you even further. In the future, you could even teach your idol something new, wouldn’t that be cool?

The social proof behind this book lies in so many stories of authors gaining public recognition, and consulting jobs, because let’s face it, we are in the tech industry. Take for example Obie Fernandez who wrote the book The Rails Way that skyrocketed his consultancy Hashrocket into getting plenty consulting gigs, at very high prices, and one of many reasons for that was that a founder wrote the book on Rails.

Another example is Thoughtbot, a consulting shop that has become a mecca of providing free teaching for developers, which they spun into paid courses too, but the content they provide for free is overwhelming, and it brings them bunch of consulting gigs, through word of mouth alone.

Probably the ones that are the biggest authority, at least for me, are the people behind Basecamp, who share everything they do, and gave us some of the best tools to create web applications for free, and everything else they publish on Signal v. Noise is great content, not only for developers, but for small business owners, who do not need venture capital to succeed in business.

P.S. This is the first post i have written using org2blog for Emacs and I am enjoying it. If you are into learning something new, you can try picking up Emacs, i have written about my pains learning it in the post Learning Emacs.

Rails No-No's: Using inline CoffeeScript with Haml

I’ve always had a love-hate relationship with HAML, partly because if the css is clean, it can be a great thing, and if it isn’t then your markup will look really ugly. But that is not the thing I’m writing about now. This is about something else, using inline CoffeeScript inside Haml templates. As you know, you really shouldn’t be using inline JavaScript at all, but you can get by, especially if you have some weird use cases. The thing with CoffeeScript is that  it has to get compiled each time into JavaScript, which is fine, if you are using something like Sprockets to compile it on deployment, but if you are using the feature Haml provides you to shoot yourself in the foot, you can cause some serious performance issues for your site.
Consider the two following snippet:

  %h1 Some nice headline

  $('h1').click ->
  alert('You clicked on the headline')

If you put that in the template, you are causing yourself with a hit of about 100-200ms that takes to compile that coffescript into javascript, and then inline it. But if you try doing this:

  %h1 Some nice headline

  $('h1').click(function() {
    alert('You clicked on the headline');

Then the performance hit is mostly gone. You still have a code smell in your views, but not a one that will cause a drastic performance loss if you don’t remove it right away.
But if you consider a situation in which you render nested partials, and each one of them has some inline coffeescript, which I myself have done unknowingly before, that will multiply the issue with the amount of rendered partials. You can of course count on rails caching to save your ass, and it will most of the times, but not always. And then you will have that one customer who waits for more than 10 seconds to get their page.

If by any means you want to reduce the maintenance nightmare, you will be very fast to remove inline javascript from the code all together, which will most probably also optimise your javascript code, and make it more maintainable in the future.

Blogging, or the lack of it

As you can notice, I’ve been blogging very sporadically over the years. And I’m trying my best to amend that. There have been times of super productivity, and times of writing nothing for a couple of months. One of the reasons for it is the perceived lack of time to do, but probably the main reason is the lack of will or fear to write. I have read a great book by Sacha Chua called A No-Excuses Guide to Blogging which has kicked me in the butt, and forced me to think more about sharing the work I do, and produce more digital content. You should definitely read it, especially if you work in the tech industry like I do.

My outtakes from the book are, that you should write every day, and don’t be afraid that you will sound stupid, or come in a wrong way, while you are starting out, because even Seth Godin was a beginner writer way way back, before he published his first materials. And I can bet that he struggled with blocks, and everything you, and I, are struggling with when starting to write. But the act of writing more and more, and sharing everything you know with the world, will not only make you a better writer, you will also learn a lot quicker by writing things down, and could get the public recognition for the work you do.

The big question is, what to write about, and Sacha’s book answers it completely. You write about anything and everything, just sit down and write about what you are learning, reading, or going through in your day to day work. Write things down for yourself, on how to set up the deployment for x, or how to retouch a certain type of photo, other people may find it helpful. If you can help just one person struggling on the Internet, trying to find the solution to X, you have done a great job. And when you have to do the same task, sometime in the future, you will have your own reference to look into, and avoid the process of finding a solution again and again. You can also interview someone you work with, they surely have a lot to share with the world, as everyone does. And maybe you will get them into creating a blog, and writing themselves.

Try to have friends or family read your drafts, and point to any mistakes if and when you make some, and you do the same thing for them, because the effort spent writing and reading other people’s material will only make you a better developer/designer and definitely a better person.

Commit to write every day, you do not have to publish it, but just go and write. There is a great post from Nathan Barry, the self published author of Authority, and other well received books, in which he describes how a commitment to write 1000 words a day, each day made him quite a lot of money, and skyrocketed his audience.

You do not have to be so drastic and write 1000 words a day, start slowly and then progress. Try to write at least 200 words, about anything, some of it will be worth publishing, some of it will be crap, some of it will be gold. However, that is what life and work are all about, even if you were some mythical creature, being able to produce only great stuff all the time, that doesn’t work in the long run, at least not for me.