lamehacks

Stuff is fun

Archive for December, 2011

Implementing a state machine in javascript

Sunday, December 11th, 2011

For reasons beyond my understanding, and despite their relative ubuiquity, state machines are still largely disregarded by a huge slice of programmers.
Many problems can be modeled using a state machine, the most common one is the maintenance of a database table column which holds some kind of state. Many programmers don’t realize that they are in presence of a state machine and end up throwing bits of code accross the codebase to flip state whenever necessary. They are basically resourcing to a messy ad-hoc implementation of a state machine without realizing it. Personally I’ve been tearing my hair off because of this countless times.
Simply put, if you’re going to use ad-hoc code to flip states among three or more possible values, you are going to make mistakes and ultimately render you codebase unmanageable.
(more…)

How to fix Canon Powershot A590 IS battery issue

Friday, December 9th, 2011

I have mixed feelings about this camera, while it packed a great set of features for its price, the image quality was notoriously inferior to older A-series cameras such as the A60, A80,A80, etc.
But the big deal breaker was the battery issue. Most cameras would run out of battery (well, not quite, read bellow) after very few shots. This defect affected nearly every unit of this and similar models. So badly that canon pulled these cameras out of the market as quickly as possible. (more…)

. .

Entries (RSS) and Comments (RSS).