So I almost didn’t make my little todo list for today due to unforseen issues with installing couchdb, but I got past this, and now decided on using MongoDB for he database for my little bot.
About this month
First I want to describe these blog entries and my endeavor. I don not want to write introductory tutorials on erlang. I don’t think this is what I would be good at, as there are other pretty good sites for this out there (just check out LearnYouSomeErlang). No my intention is to just have a little track record on my journey through the erlang language, and my path to creating my little bot on it’s search for Happiness.
I don’t intend to write every day, maybe I will, but I don’t plan to, as I don’t want to force myself here. For #learnbruary just showing what I do, and talking about it like I do already, is enough.
So here we go, with these little topics that make up my todo list.
Yesterdays topic was on learning how to properly read a config file in erlang and using it in my script. I found out that the way the bot I am using is built up, is just reading in an erlang file and having these values available.
Then I thought to myself waitaminute, as I can hot-code-swap, there is technically no need to have a special config file. So a basic configuration through some defines should be enough in my case.
Yes, hot code reloading is the main thing why I chose erlang in the first place (well, next to the fact that it’s a nice learning experience and a challenge for me).
So todays topic was to save data somehow. First I thought about internal erlang stuff, like DTS or ETS, or even mnesia (built in erlang storages, either memory or disk based, or both…). Then I thought, as I want to maybe have a way to watch the data apart from the bot itself, I need some convenient way to browse all the data. I figured out that couchdb was written in erlang, and it should be easy to integrate it with my bot.
But as I struggled to just get the database properly installed on my server, man it was a pain in the behind, I just scrapped it and got me mongodb. Cause, as I found out, this also has nice erlang support. And let me tell you, installation of mongodb on my debian wheezy server was a breeze. Easy as pie, loved it. That’s how things are supposed to be.
So yes, I made it in the end, my deadline was to set up the database, and that I did. Tomorrow it’s integration with the bot and saving some stuff that the bot gets through the chat. Let’s see how that works out.