Author: nigelb

  • Discourse For Websites

    Discourse For Websites

    Over the last few weeks, I’ve been doing a bit of work with discourse. Here’s a couple of things I learned:

    Discourse uses Docker pretty nicely

    Installing discourse is really easy. They make it very much easy to use with the discourse_docker repository. I had discourse setup and ready to go quite quickly. And then I got stuck, for a few days.

    Sometimes things are broken but fixed quickly

    In the beginning, whatever I did, the static website embedding refused to work. I tried it with RSS feeds and without RSS feeds. Google searches lead me to meta.discourse.org and at that point I tried a few things which were unnecessary, which did not fix the actual problem. It turned out that at some point discourse had broken embedding. However, as soon as we figured out it was actually a discourse bug, the fix was pretty fast.

    WP-Discourse could use some love

    The discourse WordPress plugin does what it promises out of the box, but it needs a bit more work. For instance, it uses the file_get_contents function to open a URL. Some hosts block that function from opening a URL. I have a pull request to fix that, hopefully, it’ll be merged soon.

    I could be wrong, but I couldn’t find a way to bulk publish to discourse. For a site newly converting to discourse, the option seems to be, switch new posts new to Discourse, the rest stays on WordPress.

    Showing the old comments along with the new like How To Geek needs a bit of messing around with the theme.

    Documentation could be better

    I found some failures that were really hard to discover. For instance, the static site embedding works only if you’ve set a username in ‘embed by username’ – No idea why that happens, but there’s no documentation I could find for it. Then there’s help text like below.

    EMBEDDING ONLY: Whether to embed a RSS/ATOM feed as posts.

    Perhaps something better would be

    EMBEDDING ONLY: Check to disable RSS/ATOM feed as posts.

    I intend to open a pull request about this one.

    The API documentation really needs to be better, sadly. The WordPress implementation uses an API endpoint, which doesn’t seem to be documented. I had to figure it out from the WP-Discourse code.

    Error logging needs to be better

    I wish error logs gave me information when the iframe refused to load. I had to pretty much try different things to figure it out. I wish I had a checkbox that would give me better logging information. The development mode doesn’t work out of the box with the docker existing setup, so I’m stuck.

  • Good Bye Open Knowledge, Hello Scary World

    Good Bye Open Knowledge, Hello Scary World

    I’ve been with Open Knowledge since October 2, 2012. It’s been 2 years and 8 months. Back then, I had just lost an opportunity to work at Mozilla with James Socol. I wasn’t sure what I wanted to do, but Open Knowledge looked very attractive. Open Knowledge has connections to Mozilla and Canonical – The two open source communities I’ve worked with heavily. In the last few years, I’ve worked on crowdcrafting.org, openspending.org, and CKAN; conducted trainings in 2 countries; and visited London, Cambridge, Nairobi, Dar es Salaam, and Berlin for work. It’s been a fantastic few years. And it’s time to move on.

    Good Bye!

    From 22nd July, I will no longer be a full-time staff at Open Knowledge. I’ll be around as a freelancer to help transition my position and I’ll be available as a freelancer. I’m already setup to do business and I’m excited to do interesting work. I’m currently working with Miranj, Vidhi, and Guiding Tech!

    If you want a short-term python developer/linux sysadmin or some custom CKAN development done, please get in touch with me.

  • C25K Complete

    C25K Complete

    I can’t remember when I started the C25K program. I know it was sometime in the last 5 years. I do know when I got real serious about it – A year ago. After multiple breaks for travel, falling ill, and general laziness, I’ve finally finished the program. I followed it up with a great 10K that weekend too in celebration.

    This is how I used to think of running

    Last week I started half marathon training. I ran for two weeks and missed day 3 because of a broken sleep cycle and I missed Sunday’s run because it rained all morning. When I think back to finishing C25K, I’m confident that if I don’t finish the half marathon training plan in 12 weeks, it isn’t a big deal, I may take a while to finish it, but I’ll still do my best to eventually finish it.

  • Gurgaon Cross-Country 10K

    Gurgaon Cross-Country 10K

    Saturday seems like ages ago. I took the metro to IFFCO Chowk, where Souvik picked me up to go collect the bib. The most difficult part of the race is just getting to the starting point. The map marker is basically in the middle of nowhere. If you don’t believe me, look for yourself.

    On Sunday morning, I woke up at a god forsaken hour and Souvik picked me up around 0400. It was a nice long drive over to the start point. Despite the fact that I was there the previous morning, I felt like we were nearly lost several times (we weren’t). Once we got there, we met the other crazy people like us who woke up incredibly early and made the long drive to the middle of nowhere to run a cross-country race. Rahul Verghese acknowledged this when he got on the mic. He said, “Congratulations, you’ve done the toughest part of this race. Getting to the start line!” The sun was just about rising when the half marathon folks started at 0530.

    The 10K and 5K group was flagged off at 0545 or so. I’ve noticed that if I start with the crowd, everyone tries to run fast and eventually I burn out quite quickly. This time, I started off right at the end and walked for a few minutes before I started running. In fact, I was among the last few people cross the start line. I made a good attempt to run by feel/colour, though I suspect I need more practice.

    The trail. Can you see how uneven it looks?

    Rahul warned us that things would get tricky very quickly for about 3.5 km and then it would open up into a nice smooth trail. Damn, he wasn’t kidding. It was dusty, there were rocks all around, and thorns. I think we’ve all got scratches and bleeds today. At that point, I was warmed up enough to slowly start passing people. If the rocks didn’t get you, the mud would. Or the thorns on the ground. Or the thorns on the trees. Being tall, I had to duck very often to avoid thorny branches. About this time, I was warmed up enough and confident enough to overtake folks who started too fast 😀 That went well for a while until the bottom of my feet hurt like hell as through I had a stone inside it.

    I stopped and cleared out my shoe thinking I had one of the sticky thorns stuck inside my shoe. I found nothing. I tried walking again and it still hurt. It then dawned on me that I stepped on a thorny branch. The thorn broke off and it was poking my feet through my shoes. I found a large stone, sat on it, and then started trying to pull the thorn off. It took me a good minute to get any grip on it. Perhaps, the next time I should carry a pair of pliers 😉

    After the stretch of stones and thorns, it opened up into a nice wide trail. This stretch was good to run on and I made good pace here. I mostly ran this stretch with a few short walking breaks when I noticed I was out of breath. Between the Faridabad XC and now, I certainly feel like I can do longer stretches of running. Every time I wanted to slow down, I told myself that I’d slow down in the thorny area anyway.

    The heat was horrible. By the time we started, the sun was high up in the sky and the heat was tearing at us. On the way back, the last 0.5 km or so was awful with no tree cover at all. This time, I seem to have managed to smile at the camera more often. Also, look less like I’m about to die.

    Nearly at the finish line :)

    At the finish line everyone was congratulating each other and talking about their experience. The best feeling in the world is when I got the cold towels and dumped it on my face and head. That felt good. I forgot about Strava when I finished. I only had eyes for the water counter. I desperately refilled my bottle and finished it in one gulp.

    My goal was to finish under 1:22:00 to qualify for the Airtel Delhi half Marathon. Thanks to some confusion though, the 10K ended up being actually a 11K. Though my GPS told me it was about 11.2K. I finished the race at the official time of 1:27:13 with a pace of 7:56 min/km. I’m incredibly happy with the pace, especially considering it’s my first 10K and first cross-country race.

    Today, I signed for my next 10K.

    The medal and my bib
  • Live Word Count in Vim

    As a distraction free writing environment, vim has worked great for me in the past. And using sites like 750words.com leads to me being more distracted. It’s far easier for me to full-screen vim and use that as a distraction-free environment. 750words.com has one thing that I like – A live word count in the footer of the page, so I know when to stop. I did some googling around and here’s what I found on stackoverflow for doing something similar in vim.

    Add the following to your .vimrc

    " Live Word Count function! WordCount()   let s:old_status = v:statusmsg   let position = getpos(".")   exe ":silent normal g<c-g>"   let stat = v:statusmsg   let s:word_count = 0   if stat != '--No lines in buffer--'     let s:word_count = str2nr(split(v:statusmsg)[11])     let v:statusmsg = s:old_status   end   call setpos('.', position)   return s:word_count endfunction 

    And then, if you’re using ftplugin, add this to .vim/ftplugin/markdown.vim

    setlocal statusline=wc:{13371f13f0bf161e7595c2ac5df92e005bed3de1d132ef646d0a44f3a1a9ee62}{WordCount()} 

    This will give you a small counter at the bottom with the word count, like so.

    Word Count in vim. See bottom left corner