Why You Should Write Software Like You Would Build a House

The creation of software from the ground up is an interesting and difficult management challenge, especially in small startup environments. In many startups (including some within larger companies), I encountered a “lets just get started, we can always change the details later” philosophy, sometimes due to a misunderstanding of agile development techniques.the construction plan of a house

I have learned that this will more often than not, cause severe problems when the later finally comes. Sometimes it will even be threatening to the entire business or project. This is in line with recent studies which have shown that late requirement changes are one of the predominant reasons for failed projects in software development.

The problem that developers and managers alike often run into is communicating these risks to non-technical decision makers. People prefer to make decisions based on things they can visually grasp, rather than theoretical constructs and ideas, which often makes them push them behind as long as possible.

A good idea for communication can be to compare the creation of software to building a house. In fact when I thought this through, I was surprised how many similarities I found. Continue reading

A Tale About Antique Protocols And Not-So-Smart NAT Routers

Digital Signage Remote Control App

Digital Signage Remote Control App

At the land-based branch of our company, we recently discovered the Popcorn Hour S-300, for what we thought could be a solid solution to run promotion videos in of our shops. It is Linux-based and has a very simple client that allows remote control and uploading of videos.

The protocol it uses is antique plain FTP which seemed like a horrible design decision in the first place. But after all, it is quite solid, known to work and this is not exactly an application where security matters, so we didn’t care very much.

Continue reading

Speed up CtrlP vim plugin and automatically clear it’s cache using guard

I just changed from the famous Command-T plugin to CtrlP.

Command-T provides a file navigator for vim, such as the modal that popped up in Textmate when you hit ⌘-t. While it worked well for a while, it relied on an external Ruby library, causing issues with rvm as outlined in my previous post. Then recently it refused to work with MacVim entirely, due to a rendering issue that made it unusable.

While I looked for a way to fix the issue, I stumbled upon CtrlP. CtrlP is a native vim replacement which not only makes it cleaner by design but also a bit faster (and most important for me, it actually worked with my setup).

One issue I never really got around however was the fact that a) building the cache took quite a while, causing quite a delay when you bring it up for the first time and b) the cache wasn’t rebuilt automatically when you changed a file.

I couldn’t really accept this and investigated a bit where it stored it’s cache file. When I found it in $HOME/.cache/ctrlp/$ESCAPED_PROJECT_PATH.txt, I realized that it was full of entries like this:

tmp/cache/sass/9e16d302b803e71649858656bd7da287cac6ab9b/_alternating-rows-and-columns.scssc
tmp/cache/assets/D3B/DD0/sprockets%2Fba7a4ad6548c886b0d4054293aec5e07

As I will never need to open these anyway, I would very much prefer to skip them in the indexing process. CtrlP’s README gave an excellent hint:

set wildignore+=*/tmp/*,*.so,*.swp,*.zip     " MacOSX/Linux
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe  " Windows

Restarting vim and trying to bring up CtrlP immediately showed the effect. The startup time was reduced significantly.

This has only solved one of the issues, however. The reloading issue still existed.
Here is what I came up with to solve it, and it may not be the cleanest or best solution. Just for the record, there likely are better ways which involve using vim’s –remote-send option and others. All I was looking for was a quite and dirty solution and here it is:

I immediately thought of guard which I use to automatically run my tests when files change. In order to be able to execute a command only when a file has been added or removed, I cloned guard-shell to make guard-addremove.

To use it to clean your CtrlP cache, make sure that you add guard and guard-addremove to your project’s Gemfile:

gem 'guard'
gem 'guard-addremove'

Now edit your Guardfile so that it has a statement like this in it:

guard 'addremove' do
  # Ignore Vim swap files
  ignore /~$/
  ignore /^(?:.*[\\\/])?\.[^\\\/]+\.sw[p-z]$/
 
  watch(/.*/) { `rm ~/.cache/ctrlp/%Users%pascal%Projects%example.txt &> /dev/null` }
end

You will have to take care to get the path to your cache file right. To do this run vim in your project’s directory, open CtrlP and and check out the contents of $HOME/.cache/ctrlp in another window.

I am aware that this can be improved. Someone who is more experienced with vim than I am might also be able to adjust it so that it can be used with NERDTree and others. I would love to see your examples in the comments.