WordPress domain – Redirect loop problem

I recently changed my wordpress host to be, well, wordpress. I already owned this URL, bomadeno.com, and wanted to remap it. I followed the instructions here, but got a redirect error in chrome.

A little googling and this problem seems to be person specific, indeed there was no redirect loop in incognito mode. I went to chrome’s content and cookies settings and deleted all cookies for bomadeno.com and wordpress.bomadeno.com. Sure enough, the problem was fixed.

Troubleshooting the Database

A customer sent me a short email about formatting in their new system. Simple enough, I created a sample in the system and sent them a specification for formatting, and told them “just delete the sample when you’re done”.

Alas. Ten minutes later, an email arrives “I deleted the sample… everything is gone and I can’t log in?!”


Shock fades into denial – it must be the platform. Right? A database failure, or a virus. Glancing at the database, it appears to have rolled back 3 months. I sent off a support request to Heroku and they pulled a friendly face of “that’s very odd, our databases don’t do that kind of thing on their own”.

So, I took a closer look, and sure enough there are suggestions it isn’t just a rolled-back database – a few missing things were created before a few present things, so it isn’t just a plain rollback, more like a systematic deletion. And the automated database backup hasn’t run since last night, so the most recent work by the customer is lost.

Despite it apparently being a bug in the delete method, no matter how hard I tried, I wasn’t able to reproduce it in the CMS locally or on production. I created almost exact replicas of the structure prior to the error, and couldn’t get a repeat of the bug – maybe there was something malicious at play?

I played around for hours, loading up content, deleting it, renaming it, trying to be malicious, and nothing came up. I pored over the logs from the client working on the CMS,  and as I got further back in time noticed that they were testing content in the “client” side application as they added it.

I connected the client side application and worked through some exercises, deleted a few from the CMS. Nothing. Edited a few more things, completed a few more exercises, hit delete.

Long pause… “Signed out of CMS”. Ok… How odd. I couldn’t sign back in, either – user not found. I’m a system administrator, how can I be not found! This sounds exactly like the reported problem. There’s a lot to be said for examining the logs carefully – not just the immediate problem, but the surrounding context. Get a feel for what the user was doing when they encountered the problem!

Another database dump, and sure enough, my user account is deleted, along with quite a few (but not all) of the slides. Mixed feelings at this point – on one hand, I’ve reproduced the bug and am making some headway. On the other hand, the bug and subsequent data loss must be my fault – depressing.

At this point I wrote down the facts as I knew them

  • The user needs to use the application as well as the CMS for the bug to occur
  • A few User(s) are deleted
  • Many Exercises are deleted

Not much links users to exercises in the system. Just one little table called “UserProgress” which has a many-1 relationship with users and exercises, which entries are created in as the user progresses through exercises. A quick check of the database, and indeed all UserProgress rows are deleted as well. A lot of fingers now point at this relation.

Opening up the rails models, the UserProgress model has dependent => destroy set on it’s relations to User and Slide. On the other end, that’s also set – so if one end is destroyed, so is the other, regardless of which end is destroyed. This is not good. If a slide is destroyed here, it cascades – all the Exercise’s Progress relations are deleted, then all the Progress’s Users, then all the User’s Progresses, then all the Progress’s Exercises. We have come full circle – and it doesn’t have to end here… This explains why almost all users, and absolutely all slides vanished from the production database.

I created a simple test case and deleted a slide the user has marked progress on. The Bug is reproduced! This is a vital step in any troubleshooting. Another two unrelated deletion-of-progress bugs raise their heads – unrelated in the sense they don’t help fix the initial bug, but they take an hour to fix (they get in the way of running test cases for the show-stopper bug).

A quick removal of the offending dependent => destroy association from the UserProgress model (http://guides.rubyonrails.org/association_basics.html – deleting a customer deletes orders, which is sensible. Not the other way round!) and I am ready to re-run my test case.

Fixed! Hurray – off to the autobuild it goes.

Lessons learned:

  • Bugs usually clump together around bad code
  • Bad code is usually the less tested code
  • “System” level bugs that don’t occur until everything comes together require more complex tests
  • Be humble, expect the mistake to be in your code, not others
  • Don’t just throw answers together until they work. (i.e. putting the association property on both sides “just to be sure”)

Delicious omelette

I just made a delicious omelette. I’m not sure which bit is the delicious factor, but I suspect it’s the occasional hit of sun-dried tomato amidst the fairly salty omelette.

To construct the artefact you need

  • Eggs (obviously).
  • A handful of black olives,
  • A handful of diced salami,
  • A few thinly sliced sun-dried tomatoes.

I seasoned with a sprinkle of garam masala, paprika, tiny bit of balsamic vinegar and a little (very little!) salt. Salt might be completely unnecessary given the salami.

Then did roughly this

  1. Whisk the eggs till they’re a consistent color (not much effort needed), sling in the other bits, and cook on a medium heat (not hot!) till it’s pretty firm.
  2. Turn it using a plate inversion technique and cook for a minute or so more (don’t use a spatula or you have to clean up the kitchen like I now have to).
  3. Eat it. I would upload a picture but I already ate it. (the omelette, not the picture) Maybe next time.

Using the Redmine Kanban

We’re working on a small project and wanted to see how well the Redmine kanban works – it fell to me to set it up.

I started by followed the instructions from the Kanban plugin website, however, it requires a few extra steps to get it working at all:

  • Install the gem block_helpers (gem install block_helpers)
  • Read the README.rdoc that comes with the project – to save you some time here it is in short – you need to go to the administration page in Redmine, then configure the kanban plugin. There, you need to configure the pane settings – any panes you want to use must link to a status within your own redmine – there’s a list of recommendations in the readme but it’s just common sense.

Now, how does it fare in use? It unfortunately has a showstopper bug – moving something twice on the kanban logs you out. In addition to that, some users were unable to see the kanban. This means that the kanban plugin as it stands, is unusable for anything but an ‘overview’ of the projects (and an non-interactive overview at that).

Seeing as development seems to have ended a while ago, this plugin isn’t worth installing, and we have removed it from our Redmine setup. If it resumes active development, I will do a more full review of the plugin.

Team Fortress uber update ‘Meet The Medic’ and… Free to play!

You can now (finally!) meet the medic!

And in amazing addition, Valve just went and took a bold, moderately scary, but awesome step. They took one of their greatest games, and made it free to play – free, forever, no catch. I’ll bet this is where they’ve aimed ever since they launched the cash store, probably as a better business model for them and a great way to encourage more new players. I can hardly believe it, as it’s one of a few games which I would still pay ‘full retail’ price for even now.

In every way, Team Fortress 2 seems like an inspirational game. It ticks so many boxes it… runs on a 5-year-old laptop, looks amazing on a brand new desktop, is artistic, tells a story (really well) of the characters in a typically storyless genre, is balanced, is about more than just you, involves the community, funds community developers, requires next to no money from you (absolutely none now!), receives regular (awesome) (free) updates, servers are well populated, and probably most importantly, is great fun.

As long as they keep up the balanced and quality update work, I can only see this being a good thing. By balanced, I mean, a person who pays gains no real advantage over a person who works to craft and collect items. They might get items faster, and they might get unique looking items, but the free player will always be able to match the item buying player. I doubt it will be anything other than this, as updates and new weapons are always balanced – or aim to be, and are polished up later.

If you’re new to the game, don’t worry. The team is what matters, so you can just do your best to help meet the objective – no one will hate you for being new. (if anyone does, hit them with a baseball bat (or a fish!))

Anyway what are you waiting for, stop reading this post right now and go download the game!

Uber Update – The secret Pyro Update

Again with the secret updates! Today, there is a hidden pyro update in addition to “World War Wednesday” Uber Update page. Right there as soon as you load the page. Yep, on the blackboard, a picture of a pyro with a great big arrow pointing to it – it’s a link to the pyro update.

Only one new weapon this time, “The Detonator”. Seems like a good name for it too, seeing as it’s a flare gun that detonates. Nice and simple! Details are scarce – “Alt fire detonates explosive flare” – but let’s take a guess – we shoot the flare, detonate it, and set nearby targets on fire. As benefits are rarely without drawbacks, I’ll take a guess at slightly lower damage, a slower moving flare, or increased reload time, though that’s pure speculation.

Sounds like a great weapon for setting distant enemy groups on fire, and a great addition for spy checking at a distance. Anyway, once again it’s exciting to find another secret. Makes me wonder if there’s a missed secret on page 1 – has anyone found one?