I’m currently in a small research group to see what the Raspberry Pi can mean for my school. Basically we’re checking out its features and capabilities. Our eventual goal is to create a remote controlled boat with a tracking camera on top of it.
Since Perl is my language of choice I decided to see what’s available already for programming the Raspberry Pi with Perl. It turns out there’s a distribution called HiPi (website) which seems to cover every possible interface the Raspberry Pi has.
Sadly I was having some issues in getting HiPi to install. When compiling the bcm2835 library the build process would fail. It turned out that the configure-process for bcm2835 detected that the files were newer than the date and time of the Raspberry Pi I was installing it to. This is something you’ll only find out if you try to install HiPi manually. When I was running the automated install script it wouldn’t give these details.
Luckily this can be fixed without any trouble. Just issue a date command like this:
$ date --set="2013-06-01T15:00"
Because the Raspberry Pi doesn’t come with a real-time clock it needs some help setting the time. You can also use NTP to keep the date and time of your Raspberry Pi updated, but this requires a network connection.
I’ve been using tmux for a while no to manage my terminal sessions. One thing I kept on doing was after starting
tmux that I would be manually adding windows, splitting them and issuing commands in each pane such as echoing the contents of log files with
I had heard about scripting
tmux before but never really looked into it yet, until now. Since I solely use the key bindings I had to figure out how to issue these commands without them. Turns out this is pretty easy and it’s documented in the man page.
Here’s an example of a tmux script I just added to Maximus-Web.
tmux -2 new-session -d -s $SESSION
# Setup a window for tailing log files
tmux new-window -t $SESSION:1 -n 'Logs'
tmux split-window -h
tmux select-pane -t 0
tmux send-keys "tail -f /vagrant/maximus.log" C-m
tmux select-pane -t 1
tmux send-keys "tail -f /vagrant/maximus-worker.log" C-m
tmux split-window -v
tmux resize-pane -D 20
tmux send-keys "tail -f /vagrant/maximus-mojo.log" C-m
# Setup a CoffeeScript compiler/watchdog pane
tmux select-pane -t 0
tmux split-window -v
tmux resize-pane -D 20
tmux send-keys "coffee -o /vagrant/root/static/js/ -cw /vagrant/root/coffee/" C-m
# Setup a MySQL window
tmux new-window -t $SESSION:2 -n 'MySQL' 'mysql -uroot'
# Set default window
tmux select-window -t $SESSION:1
# Attach to session
tmux -2 attach-session -t $SESSION
You can view the (up to date) origin of this script at GitHub.
So what exactly does this script do?
- It creates a new tmux session.
- It creates a new window called ‘Logs’ which is split into a grid of 2×2 with the bottom 2 panes being smaller in size (height). In every pane a command is executed. For example in pane 0 the command
tail -f /vagrant/maximus.log gets executed.
- A second window called ‘MySQL’ is created which runs the
mysql -uroot command.
- Then we switch back to the first window (actually second, as tmux pane numbers start with 0) which is the window that shows us the contents of these log files.
- Finally we attach to the tmux session.
The added benefit of this small script is that from now on all I have to do is run it and my tmux session will be configured for this specific project (Maximus in this case).
I’ve also found some other useful tmux resources as well which are listed below:
This evening a wrote a Perl script using Mojolicious to generate a RSS and Atom feed for the BlitzMax website. I did this because that website has been lacking it. I use Google Reader to stay up to date with countless websites. Any website that doesn’t provide a RSS or Atom feed I’ve got to visit manually and scan through it to see if anything new and interesting has been posted. Which in turn can takes some time.
Below is the script I’ve written that uses some modules of the Mojolicious toolkit. Mojo::DOM makes it very easy to get specific content from a page and the CSS selector support is great. On top of that I’ve hardly had to use the documentation to figure out how to do what I wanted. Very clear API! For the feed generation I’ve used XML::Feed. I’m also using CHI to cache page content so it doesn’t need to fetch this every time the script runs.
You can host the script yourself, or you can add one of the links below to your RSS/Atom reader. As long as traffic doesn’t get too high I’ll be providing public access to the feeds.
On the 25th of February 2010 a new BlitzMax project was started, called Maximus. After almost one year and a half of on and off development the client application finally reached version 1.0.0. The webapplication for the project reached 1.0.0 a little while ago.
Maximus is a module manager for BlitzMax. Its purpose is to ease management and installation of BlitzMax modules, giving the developer more time to spend on developing, and not manually installing and downloading modules and their dependencies.
Those who want their BlitzMax lives to be easier should now download the Maximus client.
In the last year or so I’ve been noticing that a lot of Perl modules contain a .shipit file. As I had no clue what it was about I searched the internet to see what ShipIt was and were to get it. But as you can see Google (or any other search engine) doesn’t return a link that describes. The name seems to be very common.
I figured as much that it was used to package up a module and simplify doing releases to CPAN. As well as integration with your SCM.
But never, never ever(!), did I think about looking up the name ShipIt on CPAN till today. I don’t know why I did so, but perhaps it’s because I’m still not very used to Perl modules being named anything different than Some::Long::Module::Name. Weird thing is that ShipIt first saw the light in 2007 (probably earlier, but the changelog doesn’t contain dates) so it’s out there for quite some time now. I must say I like these more decent names, as long as it doesn’t get as out of hand as it is with Ruby gems… How they name every single small gem as if it’s some sort of big ass application is beyond me. But who am I to judge about naming.
But that’s not why I’m writing this post. The main reason is for people, like me, to get to know the tool. I’m looking forward to using it to manage my modules so I don’t have to worry about updating version numbers, tagging the release in my SCM, test the final package and upload it to CPAN (or not). I know Dist::Zilla does this and a whole lot more as well, but I like Module::Install better. At least for now.