>

Variety in your fitness routine

One problem with any fitness routine regardless of how hard it is to start with, is that your body adapts — very quickly. So its very important to vary what you do. To a large extent it depends on your goals, but assuming the general idea of why you are training is to make you look better and move better, then variety is essential.

So if all you do is run, then try doing some high intensity interval training (HIIT), or strength training. If you are running long distances, try shorter distances, sprints, and hill climbs. If you are just strength training, put some cardio into your strength training with HIIT. Keep changing it up, or you’ll adapt, overwork certain muscle groups, let other muscle groups atrophy and this can lead to injuries.

Most importantly, keep moving. Sitting is still the worst thing you can be doing.

Doit.im

Just discovered this GTD productivity system. Looks very refined and has an iOS component too.

Performance Tuning Advice

I’ve spent a lot of time this year investigating and resolving performance issues due to high load on a PHP web application (Moodle). The load we are talking about here is up to around 2000+ visitors per hour (accordingly to Google Analytics).

The following is a list of general advice on performance tuning. Note it isn’t all technical. How you go about the process is just as important as the technical changes.

  • Implement some form of analytics to track load. Google analytics with the real time monitor is fantastic. Don’t switch this off, even during high load, otherwise you will be flying blind and it will hurt your efforts more than help (if you can’t measure it, you can’t improve it).
  • Invest time on proper load testing scripts that simulate high load behaviour so you can measure and improve. Jmeter is great for this, but there are many tools out there to help you.
  • Apache processes will creep up to maximums (e.g. 256 for prefork worker processes) when they are waiting on something (database, disk etc). Tuning at this level includes tweaking Apache config, PHP config and PHP caching (e.g. eAccelerator). Other options include proxies and caching. This will improve load handling and the speed of your site. Also ensure that your application is caching as much as possible (javascript, css, http headers etc).
  • The database (MySQL in this case) has a huge impact on performance. Two very important things to look at are thread cache size (make sure it is on) and if using InnoDB, your InnoDB buffer pool size. Be sure to check out the excellent MySQLTuner perl script to help you get this right. Monitor your database and logs to find what might be holding things up. Apache relies on MySQL being snappy, if it is slow you’ll have bottlenecks further up the chain.
  • For all layers, its important to realise that the defaults won’t do. Tuning/tweaking is required to get the most out of your web server and database server. There’s a wealth of information out there, do your research and monitor your system to find the bottlenecks.
  • Document your changes. If you don’t know what you changed, then how can you tell what helped (or didn’t)? Be systematic. This isn’t the time to go around randomly changing things and hoping for the best.
  • Don’t make assumptions. It might sound strange but this is a huge one. A lot of performance tuning efforts are hindered by people assuming where problems are rather than finding them through proper metrics (e.g. load testing and monitoring). If you can’t measure it, you can’t call it (regardless of your “experience” and so on).

Bitbucket

If you do any kind of software development, then I suggest using Bitbucket for hosting your source code. It allows for private repositories (so your code is open to the public) and supports both Git and Mecurial. Best of all its free (for teams of 5 or less) and works great. Thanks to Atlassian for such a great service.

Not a productivity ninja

Despite the number of (hopefully) insightful posts on this blog, I’m not a productivity ninja. In fact I’m far from being all that productive. I have a concept of what I think productivity is, and sometimes can get into a good rhythm (i.e. “the zone”). But I find I have to push myself to stay productive most of the time. I don’t think it comes easily. So if you are feeling unproductive, don’t worry. The key is to change one small thing and see if that helps. Continue that approach and hopefully you get closer to where you want to be.

Not 80% complete

An important point about the Pareto Principle (80-20 rule) is that it is not about being 80% complete. The 20% you focus on, needs to get to 100% complete.

In fact that’s why you focus on the important 20%, so you can actually get something to “done” rather than having a lot of unfinished work which happens when you don’t concentrate your efforts.

It’s far more productive to finish something than to start it (starting is the easy part).

Getting Real (Book)

Great book about building useful software in a simple and productive way with the focus on shipping a product and not on the other cruft that usually surrounds software development life cycles.

"Everything you own, owns you."

Gmail Meter

Gmail meter is pretty cool, it gives you patterns on your email usage and habits. For example, check out my most recent daily email traffic graph which clearly shows when I’m going to get slammed with new emails:

Gmail Meter Daily Traffic

Time Management Training

The concept of corporate time management training for employees amuses me. The idea of sending employees off to time management training to make them more efficient is just bizarre. Why would an employee want to learn ways to work harder for the 8 or so hours they are at work and still get paid the same to do so?

Don’t get me wrong, making the most of your time is vitally important (its the one resource you can’t get more of). But, I don’t think shipping people off to time training management training is the solution. Fact is, you first need some motivation to make better use of your time. What exactly is it that you are trying to accomplish by being more efficient. Is it to handle an ever increasing work load? If so, that could be a losing battle.

In fact, I find time management training seems to fall into the trap of “paving the cow paths”. You tend to find ways to be more efficient in what you are doing, rather than assessing how important those things really are. Case in point, being more efficient in all your meetings …

Automating because you can

I like to automate things I do. It’s generally good practice to find ways to avoid repeating yourself. especially as a programmer. However, I find it easy to fall into the trap of automating just because you can (or assume it is always better to).

It helps to take a step back and consider the facts before automating:

  • How long will it take to do this manually?
  • To your best knowledge, at this present point, how many times are going to repeat this?

Note, that you are looking at historical data ONLY when you decide to automate. No wild guesses about what you need in the future (keeping in mind how bad we all are at predicting the future).

This gets you out of the trap of automating something that takes 30s by spending 15 minutes writing a script to do it. Sure, after 30 times you make up the cost, but do you really? 

There’s a hidden cost with automating, and that is distraction. You stop what you are doing and go off and start something else in order to automate the step. So you end up losing focus and getting side-tracked.

Remember there is an opportunity cost to automating. So if it will only take you 30s to type out what you need, and it will get you to the next point in your project, then perhaps, you should skip over the automating and keep going (at least the first few times anyway).

Vimium

Vimium is a Chrome extension that makes your browser keyboard friendly. It’s actually very cool and lets you navigate a lot quicker around a web page than you would otherwise.

After you install it, the following shortcuts are particularly useful (note you need to be focused in the general page and not inside certain items for it to work).

  • shift + ? for help
  • shift + F (capital F) to open things in new windows
  • o to open things from browser history (esc to close this).
  • / for find
  • r to reload
  • esc to close modes

Should you use frameworks?

One of the best things about the CodeIgniter PHP framework is the wide range of classes and helpers available, everything you need to simplify working with URLs, forms, database connections, email, strings, XML, sessions and security among many, many others. 

But should you use such frameworks? I believe you should, and my reasoning is this:

"I’ll never write code that is as bug-free, secure and efficient as a community of developers in a framework."

Many programmers fall into the trap that they think they can write code better than all those that have come before them …

Luckily these days most new programmers now learn a language and then a framework almost immediately helping to mitigate this syndrome and promote good code use.

It all comes down to how honest you are about your skills. Remember, for every few lines of code you write, you have more than likely introduced a new bug.

Combine anchor and img in CodeIgniter

CodeIgniter has a number of cool URL helper functions, two of them are anchor and img which generate the anchor and img HTML tags for you.

What’s even better though is you can combine these like so:

echo anchor('http://www.praj.com.au', img('http://content.praj.com.au/blog/favicon.gif'));

Which produces the combined image with a link anchor around it.

"Left wing? Right wing? I’m staying in the plane."