My Recommended WordPress Themes and Plugins

After having used WordPress for a number of years, I’ve really started to get into more plugins that help me present and share my content the way I want. I’ve also gone through some themes and picked one I like, including versions for desktop and mobile. Here’s my recommendations for WordPress themes and plugins…

Themes

Twenty Eleven

twentyeleven2Twenty Eleven is still my WordPress theme of choice. It’s feature-full, clean, elegant, and problem free from my experience.

Please note it’s not actively updated so you may need to Google around for fixes. For example, I wrote a post on how to fix the featured image that is buggy in the default Twenty Eleven theme.

Continue reading “My Recommended WordPress Themes and Plugins”

Encoded.ca: Encode and Decode Stuff

As a developer, I find I’m often encoding something, decoding something, deobfuscating something, decoding urls or parameters, base64 encoding, wrapping/unwrapping, replying/unreplying, etc. So I made a web page that does that all that and you can find it at encoded.ca. I’ll certainly be adding more in the future.

encoded

How to Install mod_pagespeed on CentOS

I was introduced to Google’s mod_pagespeed at my current place of employment. I dismissed it at first until I was tasked with adding it to one of our existing web apps that didn’t have it yet. Wow. KeepAlive + mod_pagespeed is fantastic. I know KeepAlive is old but it’s still off by default in Apache’s HTTPd config and, all by itself, it gives you a 3x savings in some cases I’ve tried. That, and mod_pagespeed brings you stuff like auto-bundling certain css and javascript into a single request, minifying javascript files and inline javascript, compressing images, generating optimized/rescaled images based on IMG tag width/height, etc. and it goes on. It’s a brilliant “best of breed” (forgive me for saying that!) compilation of all the best web performance techniques. Here’s how to install it…

Continue reading “How to Install mod_pagespeed on CentOS”

How to Round to Arbitrary Precision in any Programming Language

How to Round to Arbitrary Precision in any Programming Language: an AMultiply your rounding number by 10^y where y is the precision to round to. Call your language’s built-in round() method on this number. Divide the result by 10^y. Easy peasy. It also makes it easier to implement different rounding methods because you’re always dealing with the digit at the same location in the number.

How to Round to Arbitrary Precision in any Programming Language: Multiply your rounding number by 10^y where y is the precision to round to. Call your language’s built-in round() method on this number. Divide the result by 10^y. Easy peasy. It also makes it easier to implement different rounding methods because you’re always dealing with the digit at the same location in the number.

In javascript:

Then there’s Math.round() which you may not have or may not want to use and, if you’re rounding, at all, you’ll inevitably find yourself looking at various rounding methods. Since Math.round(), and usually all default round() methods in most programming languages, use traditional “half up” rounding, you may find you need a different method, like banker’s rounding which is “half to even”.

To accomplish a different rounding method, create your own round() function, apply the appropriate power to your number. Then, subtract the integer portion of the number. You are left with the fraction portion of your number: This gives you the rounding digit as your final number. With this number, you can then decide whether to truncate the original number or add 1. Once you’re done that, you can then remove the power manipulation you did in the first step and now you’re left with the final rounded number.

In javascript:

The functions Math.floor() (floor and ceiling), Math.pow() (exponentiation), and the modulus operator, are usually already available for most modern languages, under the same names, and don’t really have a need to be re-implemented compared to the need to re-implement rounding. Implementing your own functions for these is usually relatively trivial, however.

There you go! Arbitrary precision rounding in any programming language and, thrown in for good measure, how to implement a different rounding method to boot!