Sunday, October 14, 2012

Dealing with time intervals

Sometimes in a configuration file you want to express something should happen periodically or after a delay. The problem is that Erlang like most languages wants to see an integer number of milliseconds, while I want to write something that will make sense. If I see 5400000  in a config file I have no idea what that means. On the other hand if I see {90, minute} then it is very clear that  this is a time value.

Here is a brief function that will let you specify time as seconds, minutes, hours or days.

Thursday, October 11, 2012

Meta Web Services

I have been building applications and services on the web for almost 20 years. Really it has been that long I put up my first very simple web app with Perl 5 and mSQL (MySQL wasn't out yet) in about 1994. And what I find is that I seem to still be writing the same code now as I was then.

Ok I switched from Perl to PHP to Erlang and have upgraded architectures in there a few times but I am still writing CRUD code by hand after almost 20 years. At one point I actually built a generator to build PHP from templates which was nice but really why am I doing this?

What I really want is a generator script. Let me write a set of rules in to describe the service in a config file of some form, then have the computer build the code.

Now the question is what do I want in this package....

  • Written in Erlang
  • Use Yaws or Cowboy
  • Support Mnesia, MySQL, PostgreSQL and Riak
  • Support Web Sockets
  • REST
  • Authentication via OAuth or local 
  • Integration with Web services (Facebook, Twitter, Dropbox etc)
  • Allow Custom Extensions
  • Should Focus on providing web services not pages (JSON over HTML)
  • Easy to read setup files
Well there you have it. I want to be able to describe my service in a DSL check that into github and have my server pull it out, build what I want and push it live.