A private online five year diary

Part of my 2011 retrospective highlighted that i want to spend more time on fun pet projects.

As i was doing my retrospective i had an idea for an online 5-year diary. My mum has one, actually it used to be my nanna’s, and now mum is continuing it. I have heard, and i can imagine, that there is something rather nice about seeing what you were doing on this day years ago, and the memories it brings back.

Some people keep them going for much longer than five years: here’s one i found on flickr that spans one day over 11 years!

Pop's diary
Pop’s diary, by Rob Fenwick

I went to look in the shops to get some ideas about what 5-year diaries are like. Some key points i discovered: they have a bookmark so that it’s easy to get to today. They often have a lock and key: that gave me the idea that these things are private. They have a space at the top for reminders of birthdays and anniversaries.

I wanted to start my own online 5-year diary on the beginning of the year. On the 1st of January i began coding a Rails app, and by the evening fiveyeardiary.herokuapp.com existed! it looked like this:

Talk about lean startup! :D

By day 2 i’d grabbed the Twitter Bootstrap CSS and applied some styling like this:

As startup ideas go, this is quite terrible, because you have to use it for a year before it becomes really useful! So i decided to experiment with other views. As it’s a web app, we can mix things around in ways that you can’t in a physical book.

For example, wouldn’t it be interesting to see what you do every monday?

Or maybe you’d want to see it like a traditional diary, a week at a time:

Once i’ve got a few months in, it might also be interesting to see what i do on the same day of each month. We can do that! :)

I’ve been using it now for 3 weeks and i’m really liking it. As time goes on i’ve found i write more, and my entries have become more personal. Hence the blurring out! ;)

I really like the fact that this is not social and it’s not networking! Nothing i write here is going to appear in someone’s RSS feed, or get cross-posted to a blog, or announced on twitter or facebook. This is my private space for my private thoughts.

Soon i will add search capabilities. I have a vague idea about mood analysis of what you’ve written. I also see the possibilities of mobile apps, which is quite exciting. I’m aware that people will want to use this in very different ways, so i’m waiting to see what people want most.

If you would like to start your own five year diary, writing as much or little as you like every day, you can find it, currently here: fiveyeardiary.herokuapp.com. It may move at some point, but your private notes will be migrated securely.

It’s also open source, so if you prefer to host your own it’s easy to do so, either locally or on heroku. You can find out how at github.com/sermoa/fiveyeardiary

I’m keen for feedback, so please let me know what you’d like to see, and i’ll see what i can do! :)

Rails on Ubuntu in 14 minutes

I recently installed Ubuntu Jaunty Jackalope and hadn’t yet got around to putting Rails on to it.

Installing Ruby and Gems and Rails and getting them all to work nicely together can be a pain, so i’m happy to say i managed to go from nothing to Rails installed and working in 14 minutes this time! Thanks very much to Installing Ruby on Rails on Debian/Ubuntu for most of the tips. Here’s how it panned out for me:

Continue reading

Distressing times for the Rails community

Things like this sadden me: Mike Gunderloy resigns as a Rails activist, no longer wishing to be a public spokesperson for Rails. This is a great loss for the community.

Things like this disappoint me: the attitudes of a few people cause a tainting on the entire community. Even if David Naughton has misunderstood the issue, it is clear that the whole debate has had a negative effect on the Rails community.

Unexpected pornography at a professional conference surprises me, shocks me a little. I wonder whether Matt Aimonetti, at any point during the preparation of that presentation, thought “This is likely to offend some people”, and if so, whether Matt decided not to care.

The refusal of some Rails representatives to even acknowledge that there is a problem angers me. Yes it was edgy. Yes it was creative. It can be those things and still be offensive. “Creative” is not a synonym for “acceptable”. Offending people is a big deal. The unpology “I’m sorry that you happened to be offended” is a world away from apologising for having been the cause of offence.

It is not a person’s fault for being offended. Without wishing to be a Bible-basher, there is a lot to be said for this little nugget of advice:

“If it is possible, as far as it depends on you, live at peace with everyone.”

You can’t please everybody all the time, but there are basic precautions that you can take, and when you have made a mistake, you can take responsibility for it and apologise for it.

I think that is the end of my rant, and i hope i will have nothing more to say about it.

* * *

I would like to say publicly, again, that i appreciate my job so very much. I am extremely lucky to work in a family-friendly, vibrant, fun, laid-back yet totally professional environment, doing a job that i enjoy with my whole heart. I don’t expect expect to be discriminated against, nor do i expect any special treatment. I receive precisely the appropriate amount of respect and admiration that i deserve based on my skill as a programmer. I am extremely grateful for it.

Here’s a picture of me loving my job today, along with some of my colleagues, sat on the picnic bench in the sunshine: yfrog.com/4o8a2j :)

* * *

Sort of related to the rant, i have been wondering tonight where my opinions come from. Different people have different opinions, and i can read and intellectually understand varying stances, so what is it that sways me so strongly in one particular direction? I have an opinion on almost any given topic, but i don’t always know what it is that makes me feel that way.

I find the various out-of-control tram hurtling down a track thought experiments quite interesting in terms of moral dilemmas to which people often have a strong opinion, yet cannot quite explain why. Ethics and morals are curious subjects.

CouchDB and data storage

Alexander Lang has written a great article about why CouchDB is not compatible with ActiveRecord, and why you should not try to coerce CouchDB into mimicking a relational database. It really is a very different thing altogether: The case of ActiveRecord vs. CouchDB

In my experience of CouchDB i first tried out ActiveCouch because of my familiarity with ActiveRecord. I soon came across problems because it was trying to make CouchDB something that it is not. As i exclaimed at the time, “LOL. ActiveRecord this is not!”

I had far more success with couchrest which is a much closer CouchDB wrapper, enabling CouchDB to be used as it’s intended: as a RESTful interface with map/reduce views.

Domain-Driven Design

Recently i have been reading Domain-Driven Design by Eric Evans. Through reading it my understanding of Rails – and web programming – has completely turned around. My thinking used to be entirely database-centric. I saw Rails as little more than an easy access into the database. For ages i didn’t even realise that you could have models that weren’t connected to a database table!

Now my thinking has changed and i consider the primary focus to be the domain model. I think about the classes and the design patterns that apply to them. I consider how they fit together, how they communicate with each other, and the boundaries between the core domain and subdomains. In my mind, the database has gone from being the most important thing to being just a method of persistence for the data in the domain model.

When you think of things this way round you are less likely to get hung up on the differences between ActiveRecord and CouchDB. You work out your domain, design the classes and then think about the most appropriate database platform to support your model.

Update: I’ve just come across a useful article that provides three methods to achieve a has_many relational structure in CouchDB. CouchDB “Joins” by Christopher Lenz.

Christmas cards: DONE!

Wow, what a relief! I finished writing my Christmas cards at 18:30 this evening. I am so glad of the idea to print labels. Thanks to Rails, CouchDB and my pdf_label_maker library, it was much easier than usual. I just sat down and forced myself to get through them all, pausing only once to take a photo:

Half way through

Note the chocolate, ruler and calculator, heheh! I actually bought some cheapo labels from the £1 shop … they weren’t even on an A4 sheet, which meant i had to do quite a lot of measuring and trial and error. But i’m so pleased with the result – they look so neat, as opposed to my handwriting which gets terrible whenever i have to write a lot in one go.

Christmas cards: DONE!

Yes, i actually did write a Christmas card to topfunky! ;)

The best thing is … if i keep the database updated during the year, i can print them all out again next year! I’m definitely going to keep developing it, and learning more about CouchDB on Rails in the process.

A hurrah moment!

Not really part of the “CouchDB on Rails” series, but i thought i’d post it anyway …

I have successfully entered the addresses for Christmas cards into my database and generated PDF output that should be of the right layout to print onto Avery labels. Sweet! The really awesome thing was, i started to forget that i was working with CouchDB and it just felt like any normal Rails project.

I only know two label formats right now, and neither of them are the one that i actually want to use.

L7162 – too big:
L7162 labels

J8651 – too small:
J8651 labels

But the cool thing is, i made a little library, pushed to GitHub of course! It is not CouchDB-specific. It’s probably not even Rails-specific, although the examples are. Perhaps some other people will contribute the dimensions of other label formats for me.

For those who want to know how i implemented this in the CouchDB application, here’s the commit.

For those who are interested in the PdfLabelMaker library, here it is: pdf_label_maker.

My thanks to Nick Sieger for giving me the example code to begin from.

Update 14th December 2008: Success! Labels printed and Christmas cards written! :) See this post for more.

Y GIT IZ BETTR THAN X

LOLCATZ IN UR GITHUBZ!

There is really no need for this: lol.whygitisbetterthanx.com but it is so funny!

GIT WILL ALLOW U 2 HAS MULTIPLE LOCAL BRANCHEZ DAT CAN BE ENTIRELY INDEPENDENT OV EACH OTHR AN TEH CREASHUN, MERGIN AN DELESHUN OV DOSE LINEZ OV DEVELOPMENT TAEK SECONDZ.

Aimee’s law of LOLCATS: Anything you push to GitHub will, in time, become translated into LOLCAT. This is inevitable.

P.S. I’ve just had a look on GitHub, and the page has now been translated into 11 languages. :) Sed ankoraŭ neniu estas tradukinta ĝin en Esperanton. Mi pensas, ke Esperanto devus esti la sekvontan tradukon. “Kial Git estas pli bona ol X” :)

CouchDB on Rails (part 8 of ?)

  1. An introduction to CouchDB
  2. Installing CouchDB
  3. Experimenting with CouchDB’s web interface
  4. Integrating with Rails using ActiveCouch
  5. Integrating with Rails using RelaxDB
  6. Getting to scaffolding using RelaxDB
  7. Installing CouchDB from Subversion source code
  8. Trying out couchrest and topfunky’s basic_model

Some time has gone by since i last used CouchDB and one method seems to have bubbled up to the top as a good one to use. It is couchrest, helped along by topfunky‘s basic_model wrapper. Today i am going to have a little play with them.

I have been meaning to get back into CouchDB but to be honest, i was tired of the old CD Collection database, and i was waiting for some inspiration. Today that inspiration arrived! I need to write my Christmas cards by the end of the week. I was impressed this afternoon by my auntie’s label printing system, and i decided i should do the same. I did some label printing last week at work, and i quite fancy making a nice little Ruby library for it.

I also think an address book is a pretty neat application for CouchDB as a document oriented database. It’ll work quite well for people who have multiple email addresses, or multiple telephone numbers. The document for each person can expand as big as it needs to be without wasting database space for the people who only have one phone number.

I need to print these address labels by the end of the week. You know that if a programmer has 100 hours to do something, they will generally spend 99 hours figuring out how to do it in 1 hour! Let’s go then! :D

Continue reading