Auto Start MongoDB Mac OSX

Follow the instructions to install MongoDB, after that, run through the creation of the database. The default location is /data/db but if you’re using Macports to install, you can choose to install your database alongside mongodb in /opt/local/var/db/mongodb.

To start the mongo server, simply run mongodb. MongoDB doesn’t auto launch itself. To do so, we have to edit the plist and add it to LaunchDaemon.

This is based on a MacPorts installation. If you’re using Brew, your mileage might vary.

  1. Edit /Library/LaunchDaemons/org.macports.mongodb.plist. My plist file looks like this.
  2. sudo launchctl load /Library/LaunchDaemons/org.macports.mongodb.plist
  3. Restart your system
  4. Go back into terminal and run mongo. You should be able to get into the interactive Mongo shell directly.

To stop this auto-start behaviour, simply use the unload command like so: sudo launchctl unload /Library/LaunchDaemons/org.macports.mongodb.plist

Advertisements

Software is a Young Buck

nom nom nom

Browsing reddit and came across this comment on this post:

Computer programmer…

We are in the “pre-industrial” era of software development, and even the best of us aren’t very good at it

Think about it..

Mechanical engineering is hundreds of years old

Architecture is older

Software starts at roughly 1950

We have a long way to go

When a new bridge, building or airplane is designed, everybody knows it will almost certainly work correctly

Major software projects frequently crash and burn and are abandoned

Those that succeed are filled with bugs

Software is NOT a rigorous engineering discipline

..and yes..I have been programming since 1972 and I know a bit about software

So we have the following forces at work now:

What does this all mean? Simply, software is here and if you want to remain relevant in tomorrow’s economy, you gotta learn the language.

Two Useful Bash Commands to Find and Replace

Some useful shell commands I’ve been using lately.

First one does a print into console of all words match `/media/static` for files in the folder and below that ends with a html file type.

The second one finds all html file types and replaces /media/static/images/yellowcross.png with {% static ‘images/yellowcross.png’ %}

grep -rn "/media/static" . `find . -name "*html"`

find . -name "*.html" -print | xargs sed -i "" "s+/media/static/images/yellowcross.png+{% static 'images/yellowcross.png' %}+g"