Logging for Sinatra applications can be a bit tricky. When in development mode, exceptions are helpfully shown in the browser, or in your terminal where you started the application. In production, however, it takes some additional configuration to properly log requests and errors.
Read more on Production Logging for Sinatra Applications…
Also posted in Tools Tagged logging, sinatra
I run Linux at work and at home. Sometimes I need to switch to Windows or Mac for a time, and when I do, I always find myself missing something from my usual environment.
Read more on Why I Stick with the Linux Desktop…
I’ve been using *nix systems for quite a while. But there are a few commands that I somehow overlooked and I wish I’d discovered years earlier.
1. man ascii
This prints out the ascii tables in octal, hexadeciamal and decimal. I can’t believe I didn’t know about this one until a month ago. I’d always resorted to googling for the tables. This is much more convenient.
ASCII(7) BSD Miscellaneous Information Manual ASCII(7)
ascii -- octal, hexadecimal and decimal ASCII character sets
The octal set:
000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel
010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si
020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb
030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us
For more information, see the ascii man page.
Read more on 5 Unix Commands I Wish I’d Discovered Years Earlier…
Let’s assume that we have a daemon running on some kind of POSIX system written in Ruby that works great most of the time, but every few months gets “stuck” and needs to be restarted. We might tolerate this failure rate, or we might set up something like monit to automatically restart the daemon when it becomes “stuck.” But wouldn’t it be better to get to the bottom of the issue?
Next time the daemon gets stuck, what tools might we use to figure out what’s happened to it? If you’re still developing, you might have included the
pry gem or you might even be using
pry-rescue to catch exceptions. But on a production system, you probably won’t have such luxuries available.
Luckily, since a Ruby process is still a process, there are actually quite a few POSIX utilities at our disposal. Let’s find the PID of our our process and see what we can learn. Read more on Tools for Debugging Running Ruby Processes…
When I bought my Macbook a few months ago, one of the hardware choices I made was to get a 128GB solid state drive with it. While I love the performance of my SSD, its small size has given me some problems when trying to manage my disk usage.
A few days ago, I opened the activity monitor and was shocked to see that my machine was reporting less than 4 Gigabytes of free space left on my disk! The worst part was that I had absolutely no idea what was taking up all of that space. Was it all the downloads I had saved from Chrome? My music library?
Read more on Tracking Down Disk Usage on the Command Line…
I recently needed to configure a machine with multiple installations of Ubuntu Server 12.10. One way to go about doing this is to create a separate, small boot partition to store the configuration for an initial Grub boot menu. Each installed OS gets its own partition with its own bootloader configuration. The initial menu stored on the boot partition is used to chainload the bootloader files for whichever OS is selected.
This technique involves using Grub Legacy on the small boot partition to chainload to the Grub2 configuration on each of the OS partitions. Instructions on how to do this can be found in the Ubuntu Lucid Multiple OS Installation guide. The instructions describe a couple of ways to go about getting Grub Legacy on the boot partition. I chose to go the route of installing Ubuntu (12.10 in my case) like normal, then removing Grub2, installing Grub Legacy temporarily, and finally reinstalling Grub2 again once the boot partition had been configured.
I ran into a couple of snags after getting to the Remove Grub 2 and install Grub Legacy part of the instructions, so I am going to duplicate the steps here and insert the couple of additional steps I ended up needing.
Read more on Multiple Ubuntu Installations with Grub…
Ubuntu’s leader Mark Shuttleworth closed the operating system’s Bug #1 on May 30th, 8 years after the system was first written.
Bug #1 (liberation) was that “Microsoft has a majority market share” in the then-new desktop PC marketplace. According to Shuttleworth’s comment about closing the bug, the definition of PC has changed since 2004. “PC” doesn’t just mean laptops and desktops anymore. Now people do a large majority of their computing on smartphones, tablets, wearable devices, and other devices. Shuttleworth also mentions that it’s better for Ubuntu to focus on excellence in their own right rather than on impacting someone else’s products.
When I first saw this, I was frustrated because it seemed Ubuntu was copping out. But the more I think about it, the more I realize that he is right. A lot of things have changed since the bug was first opened. For the longest time, Windows was really the only operating system in use. I myself had never heard of Linux, and very few people I knew had Macs. Open source wasn’t widely used.
Read more on Ubuntu’s Biggest Bug Squashed…
I was recently tasked with finding a solution for leader election in a distributed system we are developing. I began to explore the realm of distributed algorithms, which eventually resulted in a more fundamental problem: How can we easily make all the nodes communicate reliably? After exploring ZeroMQ and UDP broadcasting, I decided to explore the Hadoop ecosystem to see if any of their solutions were reusable, and I discovered the excellent Apache ZooKeeper.
ZooKeeper is an open-source server that allows for highly reliable distributed coordination. It is a clustered service that can serve as a single source of truth for configuration information, distributed synchronization and other services. Zookeeper makes a number of guarantees about it’s data, it will be: sequential, atomic, reliable, timely, and consistent across the cluster.
Read more on Taming Your Cluster with ZooKeeper…
We were recently faced with the problem of how to ship and support a complicated piece of server software. We needed the software to be installed on a customer’s existing infrastructure and were nervous about depending on them to have experts in house.
We decided to build a virtual machine “appliance” style packaging and to ship a fully-configured Linux installation. This greatly simplified the process of installing at a customer’s site, but building such an appliance repeatably is not trivial.
Read more on Building a Virtual Appliance – Repeatably…