Ruby gives you 12 ways to do anything. Erlang makes it tough to find one. Awhile back, I was trying to add time to an existing DateTime value, but I couldn't find a function (such as in the Calendar module) that allowed me to manipulate a DateTime value directly. Here's how I ended up doing it.
I was tasked this week with writing an escript to modify an Erlang config file. All I needed was to read it in, make a couple updates, and write it back out. Should be easy, right? Please make it easy Erlang. No? Of course not... this is Erlang after all.
I ran into an issue where an EUnit test fixture was failing with an error I hadn't seen before. It seemed to be coming from the meck mocking suite itself, and was reporting that it was 'already_started' and the tests would fail to run... that's a new one. So the obvious question was, WTF@#$ WHY????
When dealing with a dynamically typed language, any effort to tame the beast can pay off. For Erlang, that means Dialyzer specs. The more specs added, the more helpful the tool becomes - but getting to that point can be painful. Here are some warnings I've seen, what they mean and how I solved them.
Handling date and times is a thorn in every experienced developer's side. If you haven't had the pleasure yet, you will. ;) Coming off a week of standardizing some datetimes across an Erlang app, here's a few personal thoughts.
On a whim, I created an Erlang module for calculating various holidays, and things were going well until it came to Easter. Have you ever tried to calculate Easter? It's surprisingly difficult! Here's my solution...
Have you ever tried to execute a function at some future time in Erlang? You can, with a timer, but the compiler may complain that the function you're calling via the timer is unused. Why is that and what can you do?